noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 09/21: FIX : Tax_Summary->check fails when th


From: dwm
Subject: [Noalyss-commit] [noalyss] 09/21: FIX : Tax_Summary->check fails when there is no data, check was not correct
Date: Sun, 15 Dec 2024 09:51:38 -0500 (EST)

sparkyx pushed a commit to branch unstable
in repository noalyss.

commit 86321e5666e8ca39c29cf54cb814777a0255dac7
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sat Dec 7 10:02:01 2024 +0100

    FIX : Tax_Summary->check fails when there is no data, check was not correct
---
 include/class/tax_summary.class.php | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/include/class/tax_summary.class.php 
b/include/class/tax_summary.class.php
index 7417034ff..aae844bcd 100644
--- a/include/class/tax_summary.class.php
+++ b/include/class/tax_summary.class.php
@@ -136,26 +136,43 @@ class Tax_Summary
                        )
                   ";
         $cnt=$this->db->get_value($sql, [$this->date_start, $this->date_end]);
-        if ($cnt==0)
+        $cnt_ledger=$this->db->get_value("
+            select count(*) from jrnx 
+                           where 
+                          jrnx.j_jrn_def in (select jrn_def_id from jrn_def 
where jrn_def_type = 'VEN')
+                           and j_date >= to_date($1,'DD.MM.YYYY') 
+                           and j_date <= to_date($2,'DD.MM.YYYY') 
+        ", [$this->date_start, $this->date_end]);
+        if ($cnt==0 && $cnt_ledger !=0)
         {
-            throw new Exception(_("Données manquantes"),100);
+            throw new Exception('TX148:'_("Données manquantes"),100);
         }
         /* -------------Purchase --------------------------------- */
+
         $sql="select count(*) 
              from 
                 quant_purchase
              where  
                    j_id  in (select j_id from jrnx 
                        where 
-                          jrnx.j_jrn_def in (select jrn_def_id from jrn_def 
where jrn_def_type = 'VEN')
+                          jrnx.j_jrn_def in (select jrn_def_id from jrn_def 
where jrn_def_type = 'ACH')
                            and j_date >= to_date($1,'DD.MM.YYYY') 
                            and j_date <= to_date($2,'DD.MM.YYYY') 
                        )
                              ";
         $cnt=$this->db->get_value($sql, [$this->date_start, $this->date_end]);
-        if ($cnt>0)
+
+        $cnt_ledger=$this->db->get_value("
+            select count(*) from jrnx 
+                           where 
+                          jrnx.j_jrn_def in (select jrn_def_id from jrn_def 
where jrn_def_type = 'ACH')
+                           and j_date >= to_date($1,'DD.MM.YYYY') 
+                           and j_date <= to_date($2,'DD.MM.YYYY') 
+        ", [$this->date_start, $this->date_end]);
+
+        if ($cnt ==0 &&  $cnt_ledger !=0)
         {
-            throw new Exception(_("Données manquantes"),100);
+            throw new Exception('TX175'._("Données manquantes"),100);
         }
     }
     private function build_exigibility()



reply via email to

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