Modif calcul TVA
This commit is contained in:
parent
1bb4e7c375
commit
7f90fe7295
@ -301,31 +301,31 @@ class FactureFourn
|
||||
*/
|
||||
Function updateline($id, $label, $puht, $tauxtva, $qty=1)
|
||||
{
|
||||
$puht = ereg_replace(",",".",$puht);
|
||||
|
||||
$totalht = $puht * $qty;
|
||||
$tva = ($totalht * $tauxtva / 100);
|
||||
$totalttc = $totalht + $tva;
|
||||
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det ";
|
||||
$sql .= "SET description ='".$label."'";
|
||||
$sql .= ", pu_ht = '$puht'";
|
||||
$sql .= ", qty ='$qty'";
|
||||
$sql .= ", total_ht='$totalht'";
|
||||
$sql .= ", tva='$tva'";
|
||||
$sql .= ", tva_taux='$tauxtva'";
|
||||
$sql .= ", total_ttc='$totalttc'";
|
||||
|
||||
$sql .= " WHERE rowid = $id";
|
||||
|
||||
if (! $this->db->query($sql) )
|
||||
if (is_numeric($puht) && is_numeric($qty))
|
||||
{
|
||||
print $this->db->error() . '<b><br>'.$sql;
|
||||
$totalht = ($puht * $qty);
|
||||
$tva = ($totalht * $tauxtva / 100);
|
||||
$totalttc = $totalht + $tva;
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det ";
|
||||
$sql .= "SET description ='".$label."'";
|
||||
$sql .= ", pu_ht = " .ereg_replace(",",".",$puht);
|
||||
$sql .= ", qty =" .ereg_replace(",",".",$qty);
|
||||
$sql .= ", total_ht=" .ereg_replace(",",".",$totalht);
|
||||
$sql .= ", tva=" .ereg_replace(",",".",$tva);
|
||||
$sql .= ", tva_taux=" .ereg_replace(",",".",$tauxtva);
|
||||
$sql .= ", total_ttc=".ereg_replace(",",".",$totalttc);
|
||||
|
||||
$sql .= " WHERE rowid = $id";
|
||||
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
print $this->db->error() . '<b><br>'.$sql;
|
||||
}
|
||||
|
||||
// Mise a jour prix facture
|
||||
$this->updateprice($this->id);
|
||||
}
|
||||
|
||||
// Mise a jour prix facture
|
||||
$this->updateprice($this->id);
|
||||
}
|
||||
/**
|
||||
* Supprime une ligne de la facture
|
||||
@ -382,7 +382,10 @@ class FactureFourn
|
||||
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn SET total_ht = '$total_ht', total_tva = '$total_tva', total_ttc = '$total_ttc'";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn SET";
|
||||
$sql .= " total_ht = ". ereg_replace(",",".",$total_ht);
|
||||
$sql .= ",total_tva = ".ereg_replace(",",".",$total_tva);
|
||||
$sql .= ",total_ttc = ".ereg_replace(",",".",$total_ttc);
|
||||
$sql .= " WHERE rowid = $facid ;";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user