noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 27/219: Task #0001443: opérations rapprochée


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 27/219: Task #0001443: opérations rapprochées : bug quand on utilise des tva avec autoliquidation Check with the view v_quant_detail and take into account the negative VAT
Date: Mon, 18 Dec 2017 13:22:30 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit c587b47be8ace878d259b0e5828eb2d2c4c9de78
Author: Dany De Bontridder <address@hidden>
Date:   Thu Aug 31 10:09:51 2017 +0200

    Task #0001443: opérations rapprochées : bug quand on utilise des tva avec 
autoliquidation
    Check with the view v_quant_detail and take into account the negative VAT
---
 include/class/acc_reconciliation.class.php | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/include/class/acc_reconciliation.class.php 
b/include/class/acc_reconciliation.class.php
index ad5351a..ba6d01f 100644
--- a/include/class/acc_reconciliation.class.php
+++ b/include/class/acc_reconciliation.class.php
@@ -369,11 +369,36 @@ j1.j_poste as poste
         bcscale(2);
         for ($i=0;$i<count($array);$i++)
         {
-            $first_amount=$array[$i]['first']['jr_montant'];
+             
$retdb=$this->db->execute("detail_quant",array($array[$i]['first']['jr_id']));
+            if ( Database::num_row($retdb) != 0)
+            {
+                // then second_amount takes in account the vat_sided
+                $row=Database::fetch_array($retdb, 0);
+                $total_price=bcadd($row['price'],$row['vat_amount']);
+                $total_price=bcsub($total_price,$row['vat_sided']);
+                $first_amount=$total_price;
+
+            } else {
+                // else take the amount from jrn
+                $first_amount=$array[$i]['first']['jr_montant'];
+            }
             $second_amount=0;
             for ($e=0;$e<count($array[$i]['depend']);$e++)
             {
-                
$second_amount=bcadd($second_amount,$array[$i]['depend'][$e]['jr_montant']);
+                
$retdb=$this->db->execute("detail_quant",array($array[$i]['depend'][$e]['jr_id']));
+                // if exist in quant_
+                if ( Database::num_row($retdb) != 0)
+                {
+                    // then second_amount takes in account the vat_sided
+                    $row=Database::fetch_array($retdb, 0);
+                    $total_price=bcadd($row['price'],$row['vat_amount']);
+                    $total_price=bcsub($total_price,$row['vat_sided']);
+                    $second_amount=bcadd($second_amount,$total_price);
+                    
+                } else {
+                // else take the amount from jrn
+                  
$second_amount=bcadd($second_amount,$array[$i]['depend'][$e]['jr_montant']);
+                }
             }
             if ( $p_equal &&  $first_amount==$second_amount)
             {



reply via email to

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