FIX empty discount where created if amount is null for a line with a different tva
This commit is contained in:
parent
e42290cb88
commit
0ca6661e69
@ -563,11 +563,13 @@ if (empty($reshook))
|
|||||||
// Boucle sur chaque taux de tva
|
// Boucle sur chaque taux de tva
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($object->lines as $line) {
|
foreach ($object->lines as $line) {
|
||||||
|
if($line->total_ht!=0) { // no need to create discount if amount is null
|
||||||
$amount_ht [$line->tva_tx] += $line->total_ht;
|
$amount_ht [$line->tva_tx] += $line->total_ht;
|
||||||
$amount_tva [$line->tva_tx] += $line->total_tva;
|
$amount_tva [$line->tva_tx] += $line->total_tva;
|
||||||
$amount_ttc [$line->tva_tx] += $line->total_ttc;
|
$amount_ttc [$line->tva_tx] += $line->total_ttc;
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Insert one discount by VAT rate category
|
// Insert one discount by VAT rate category
|
||||||
$discount = new DiscountAbsolute($db);
|
$discount = new DiscountAbsolute($db);
|
||||||
@ -583,6 +585,7 @@ if (empty($reshook))
|
|||||||
$discount->fk_facture_source = $object->id;
|
$discount->fk_facture_source = $object->id;
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
foreach ($amount_ht as $tva_tx => $xxx) {
|
foreach ($amount_ht as $tva_tx => $xxx) {
|
||||||
$discount->amount_ht = abs($amount_ht [$tva_tx]);
|
$discount->amount_ht = abs($amount_ht [$tva_tx]);
|
||||||
$discount->amount_tva = abs($amount_tva [$tva_tx]);
|
$discount->amount_tva = abs($amount_tva [$tva_tx]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user