phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r4775 - phpcompta/tags/rel600/include


From: phpcompta-dev
Subject: [Phpcompta-dev] r4775 - phpcompta/tags/rel600/include
Date: Sat, 25 Feb 2012 14:47:14 +0100 (CET)

Author: danydb
Date: 2012-02-25 14:47:13 +0100 (Sat, 25 Feb 2012)
New Revision: 4775

Modified:
   phpcompta/tags/rel600/include/class_document.php
Log:
0000528: VEN_TVAC n'est pas correctement calcul?\195?\169

Modified: phpcompta/tags/rel600/include/class_document.php
===================================================================
--- phpcompta/tags/rel600/include/class_document.php    2012-02-20 08:24:08 UTC 
(rev 4774)
+++ phpcompta/tags/rel600/include/class_document.php    2012-02-25 13:47:13 UTC 
(rev 4775)
@@ -982,22 +982,18 @@
             $id='e_march'.$counter.'_tva_amount' ;
             $price='e_march'.$counter.'_price' ;
             $quant='e_quant'.$counter;
-            if ( ! isset(${'e_march'.$counter.'_price'})|| 
!isset(${'e_quant'.$counter}))
-                return "";
+            if ( ! isset(${'e_march'.$counter.'_price'})|| 
!isset(${'e_quant'.$counter}))     return "";
             // check that something is sold
-            if ( ${'e_march'.$counter.'_price'} == 0 || ${'e_quant'.$counter} 
== 0 )
-                return "";
-
-
-            // if it is exist
+            if ( ${'e_march'.$counter.'_price'} == 0 || ${'e_quant'.$counter} 
== 0 ) return "";
+                       bcscale(2);
+            // if TVA not exist
             if ( ! isset(${$id}))
-                $r=round(${$price}*${$quant},2);
-            else
-                $r=round($
-                         {
-                             $price
-                         }
-                         *${$quant}+$id,2);
+                $r=  bcmul(${$price},${$quant});
+            else{
+                $r=  bcmul(${$price},${$quant});
+                $r=bcadd($r,${$id});
+                       }
+                       return $r;
             break;
 
         case 'TOTAL_VEN_HTVA':
@@ -1025,6 +1021,7 @@
         case 'TOTAL_VEN_TVAC':
             extract($p_array);
             $sum=0.0;
+                       bcscale(2);
             for ($i=0;$i<$nb_item;$i++)
             {
                 $tva='e_march'.$i.'_tva_amount';
@@ -1036,10 +1033,9 @@
                 }
                 $sell=${'e_march'.$i.'_price'};
                 $qt=${'e_quant'.$i};
-
-
-                $sum+=$sell*$qt+$tva_amount;
-                $sum=round($sum,2);
+                               $tot=bcmul($sell,$qt);
+                               $tot=bcadd($tot,$tva_amount);
+                               $sum=bcadd($sum,$tot);
             }
             $r=round($sum,2);
 



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]