diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 92c5713880c..540c0437b08 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -651,8 +651,8 @@ if ($action == 'create') print "\n"; } - $total_debit = price2num($total_debit); - $total_credit = price2num($total_credit); + $total_debit = price2num($total_debit, 'MT'); + $total_credit = price2num($total_credit, 'MT'); if ($total_debit != $total_credit) { diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 973900ca96f..cc58f1e6dec 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1290,15 +1290,15 @@ if (empty($reshook)) $qualified=1; if (empty($lines[$i]->qty)) $qualified=0; // We discard qty=0, it is an option if (! empty($lines[$i]->special_code)) $qualified=0; // We discard special_code (frais port, ecotaxe, option, ...) - if ($qualified) $totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ? + if ($qualified){ + $totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ? + $tva_tx = $lines[$i]->tva_tx; + $amountdeposit[$tva_tx] += ($lines[$i]->total_ht * $valuedeposit) / 100; + } + } - if ($totalamount != 0) { - if ($numlines > 0) $numlines = $numlines-1; - $tva_tx = $lines[$numlines]->tva_tx; - if (! empty($lines[$numlines]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$numlines]->vat_src_code.')'; - $amountdeposit[$tva_tx] = ($totalamount * $valuedeposit) / 100; - } else { + if($totalamount == 0) { $amountdeposit[0] = 0; } } else { @@ -1309,7 +1309,6 @@ if (empty($reshook)) $amount_ttc_diff = $amountdeposit[0]; } - foreach ($amountdeposit as $tva => $amount) { if (empty($amount)) continue; @@ -1322,6 +1321,7 @@ if (empty($reshook)) } elseif ($typeamount=='variable') { $descline.= ' ('. $valuedeposit.'%)'; } + $descline.= ' - '.$srcobject->ref; $result = $object->addline( $descline,