From ab2a2136c6df9fdee9883a9f686ff807943c6170 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 11 May 2013 22:19:53 +0000 Subject: [PATCH] =?UTF-8?q?Task=20#0000809:=20Journaux=20achat/vente=20:?= =?UTF-8?q?=20TVA=20diff=C3=A9rente=20de=20celle=20calcul=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/js/infobulle.js | 1 + include/class_acc_ledger_purchase.php | 33 ++++++++++++++++++--------- include/class_acc_ledger_sold.php | 11 ++++++--- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/html/js/infobulle.js b/html/js/infobulle.js index a2be76b72..3a7b4ad45 100644 --- a/html/js/infobulle.js +++ b/html/js/infobulle.js @@ -55,6 +55,7 @@ content[24]="Donnez une partie du poste comptable ou du libellé pour filtrer"; content[25]="Donnez une partie du libellé, la date, le montant ou le numéro d'opération pour filtrer, cela n'efface pas ce qui a déjà été sélectionné"; content[26]="Donnez une partie du quickcode, nom, description... pour filtrer"; content[27]="Attention, SI la fiche a changé de poste comptable, c'est seulement le dernier qui est affiché"; +content[28]="Attention Différence entre TVA calculée et donnée"; function showBulle(p_ctl) { d=document.getElementById('bulle'); diff --git a/include/class_acc_ledger_purchase.php b/include/class_acc_ledger_purchase.php index 3c8081611..61344af7e 100644 --- a/include/class_acc_ledger_purchase.php +++ b/include/class_acc_ledger_purchase.php @@ -1353,21 +1353,19 @@ class Acc_Ledger_Purchase extends Acc_Ledger if ( $g_parameter->MY_TVA_USE=='Y') { + $op=new Acc_Compute(); + + $op->set_parameter("amount",$amount); + $op->set_parameter('amount_vat_rate',$oTva->get_parameter('rate')); + $op->compute_vat(); + $tva_computed=$op->get_parameter('amount_vat'); //----- if tva_amount is not given we compute the vat ---- if ( strlen (trim (${'e_march'.$i.'_tva_amount'})) == 0) { - $op=new Acc_Compute(); - - $op->set_parameter("amount",$amount); - $op->set_parameter('amount_vat_rate',$oTva->get_parameter('rate')); - $op->compute_vat(); $tva_item=$op->get_parameter('amount_vat'); } else - $tva_item=round($ - {'e_march'.$i.'_tva_amount' - } - ,2); + $tva_item=round(${'e_march'.$i.'_tva_amount'},2); if (isset($tva[$idx_tva] ) ) $tva[$idx_tva]+=$tva_item; @@ -1396,8 +1394,21 @@ class Acc_Ledger_Purchase extends Acc_Ledger $r.=''; $r.=$oTva->get_parameter('label'); $r.=''; - $r.=''; - $r.=nbm($tva_item); + /* warning if tva_computed and given are not the + same */ + bcscale(2); + if ( bcsub($tva_item,$tva_computed) != 0) + { + + $r.=''; + $r.=HtmlInput::infobulle(28); + $r.='' + .nbm($tva_item).''; + } + else{ + $r.=''; + $r.=nbm($tva_item); + } $r.=''; $r.=''; $r.=nbm(round($amount,2)); diff --git a/include/class_acc_ledger_sold.php b/include/class_acc_ledger_sold.php index 23cb92769..bc85b699e 100644 --- a/include/class_acc_ledger_sold.php +++ b/include/class_acc_ledger_sold.php @@ -625,7 +625,8 @@ class Acc_Ledger_Sold extends Acc_Ledger } - /*!@brief show the summary of the operation and propose to save it + /*! + *@brief show the summary of the operation and propose to save it *@param array contains normally $_POST. It proposes also to save * the Analytic accountancy *@param $p_summary false for the feedback, true to show the summary @@ -772,16 +773,20 @@ class Acc_Ledger_Sold extends Acc_Ledger $r.=''; $r.=$oTva->get_parameter('label'); $r.=''; - $r.=''; + /* warning if tva_computed and given are not the same */ if ( bcsub($tva_item,$tva_computed) != 0) { + $r.=''; + $r.=HtmlInput::infobulle(28); $r.='' .nbm($tva_item).''; } - else + else{ + $r.=''; $r.=nbm($tva_item); + } $r.=''; $r.=''; $r.=nbm($amount);