From d6a9da57e11d64ecb68f21437c50fd2e0c0e7d44 Mon Sep 17 00:00:00 2001 From: gauthier Date: Mon, 1 Oct 2018 14:11:19 +0200 Subject: [PATCH 1/3] FIX : need to round with 2 decimals to avoid movements not correctly balanced --- htdocs/accountancy/bookkeeping/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 9dcb924779e..50af8a6855d 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, 2); + $total_credit = price2num($total_credit, 2); if ($total_debit != $total_credit) { From 2142ccee8a6490257e06135d87aef8a6f38b7f94 Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 8 Feb 2019 15:17:40 +0100 Subject: [PATCH 2/3] FIX : better method --- htdocs/accountancy/bookkeeping/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 50af8a6855d..67217954467 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, 2); - $total_credit = price2num($total_credit, 2); + $total_debit = price2num($total_debit, 'MT'); + $total_credit = price2num($total_credit, 'MT'); if ($total_debit != $total_credit) { From ab781c32c7bcdf9e5028ae7d0a276a4ec5a4077d Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Mon, 11 Mar 2019 11:19:32 +0100 Subject: [PATCH 3/3] Wrong vat if deposit from propal with multiple vat --- htdocs/compta/facture/card.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index b379bf31602..0f6820e1859 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1196,15 +1196,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 { @@ -1215,7 +1215,6 @@ if (empty($reshook)) $amount_ttc_diff = $amountdeposit[0]; } - foreach ($amountdeposit as $tva => $amount) { $arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount'); @@ -1226,6 +1225,7 @@ if (empty($reshook)) } elseif ($typeamount=='variable') { $descline.= ' ('. $valuedeposit.'%)'; } + $descline.= ' - '.$srcobject->ref; $result = $object->addline( $descline,