noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 02/04: TVA with one account : fix small bugs


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 02/04: TVA with one account : fix small bugs if account no given
Date: Thu, 19 Apr 2018 03:56:52 -0400 (EDT)

sparkyx pushed a commit to branch r700-currency
in repository noalyss.

commit f18d11aaa367aba31261ddc386f878bbab554803
Author: Dany De Bontridder <address@hidden>
Date:   Sat Apr 7 14:11:05 2018 +0200

    TVA with one account : fix small bugs if account no given
---
 include/class/acc_ledger_purchase.class.php | 13 ++++++++-----
 include/class/acc_ledger_sold.class.php     |  2 +-
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/class/acc_ledger_purchase.class.php 
b/include/class/acc_ledger_purchase.class.php
index 056d4f0..b401222 100644
--- a/include/class/acc_ledger_purchase.class.php
+++ b/include/class/acc_ledger_purchase.class.php
@@ -189,8 +189,7 @@ class  Acc_Ledger_Purchase extends Acc_Ledger
                $a_poste=explode(',',$tva_rate->tva_poste);
 
                if (
-                   $this->db->get_value('select count(*) from tmp_pcmn where 
pcm_val=$1',array($a_poste[0])) == 0 ||
-                   $this->db->get_value('select count(*) from tmp_pcmn where 
pcm_val=$1',array($a_poste[1])) == 0 )
+                   $this->db->get_value('select count(*) from tmp_pcmn where 
pcm_val=$1',array($a_poste[0])) == 0 )
                  throw new Exception(_(" La TVA ".$tva_rate->tva_label." 
utilise des postes comptables inexistants"));
 
             }
@@ -756,10 +755,14 @@ class  Acc_Ledger_Purchase extends Acc_Ledger
                     if ( $value > 0 ) $tot_debit=bcadd($tot_debit,abs($value));
                     $acc_operation->insert_jrnx();
                     // if TVA is on both side, we deduce it immediately
-                    if ( $oTva->get_parameter("both_side")==1)
+                    
+                    if ( $oTva->get_parameter("both_side")==1 )
                     {
                         $poste_vat=$oTva->get_side('c');
-                        
+                        if ( $poste_vat == '#')
+                        {
+                            $poste_vat=$oTva->get_side('d');
+                        }
                         $acc_operation=new Acc_Operation($this->db);
                         $acc_operation->date=$e_date;
                         $acc_operation->poste=$poste_vat;
@@ -769,7 +772,7 @@ class  Acc_Ledger_Purchase extends Acc_Ledger
                         $acc_operation->type='c';
                         $acc_operation->periode=$tperiode;
                         $acc_operation->insert_jrnx();
-                       if ( $value < 0 ) 
$tot_debit=bcadd($tot_debit,abs($value));
+                        if ( $value < 0 ) 
$tot_debit=bcadd($tot_debit,abs($value));
                     }
 
                 }
diff --git a/include/class/acc_ledger_sold.class.php 
b/include/class/acc_ledger_sold.class.php
index f37eeec..437cc97 100644
--- a/include/class/acc_ledger_sold.class.php
+++ b/include/class/acc_ledger_sold.class.php
@@ -185,7 +185,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
                 $a_poste = explode(',', $tva_rate->tva_poste);
 
                 if (
-                        $this->db->get_value('select count(*) from tmp_pcmn 
where pcm_val=$1', array($a_poste[0])) == 0 ||
+                       
                         $this->db->get_value('select count(*) from tmp_pcmn 
where pcm_val=$1', array($a_poste[1])) == 0)
                     throw new Exception(_(" La TVA " . $tva_rate->tva_label . 
" utilise des postes comptables inexistants"));
             }



reply via email to

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