noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 130/173: fixup! Merge branch 'dev-7200' into


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 130/173: fixup! Merge branch 'dev-7200' into entreprise
Date: Mon, 22 Mar 2021 12:59:09 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 3b8970136106a2541f34e1d40dec0a9a0eda2bfa
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Sun Nov 24 23:52:48 2019 +0100

    fixup! Merge branch 'dev-7200' into entreprise
---
 include/class/prepared_query.class.php    | 25 +++++++++++++++++++++++--
 include/class/print_ledger_fin.class.php  | 20 ++++++--------------
 include/class/print_ledger_misc.class.php |  6 ++----
 3 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/include/class/prepared_query.class.php 
b/include/class/prepared_query.class.php
index 325469e..69cf594 100644
--- a/include/class/prepared_query.class.php
+++ b/include/class/prepared_query.class.php
@@ -79,6 +79,27 @@ class Prepared_Query {
                                 where jra_concerned=$1)');
         }
     }
-    
-    
+    /**
+     * Prepare the query for find the amount in currency
+     */
+    public function prepare_currency()
+    {
+        $prepare=$this->db->is_prepare("amount_cur");
+        if ($prepare==FALSE)
+        {
+
+            $this->db->prepare("amount_cur",
+                    "select jrn2.jr_id , 
+                    sum(coalesce(oc_amount,0)) as sum_ocamount
+               from operation_currency
+                    join jrnx using (j_id)
+                    join jrn as jrn2 on (j_grpt=jrn2.jr_grpt_Id) 
+               where 
+                    j_id in (select j_id from jrnx where 
j_grpt=jrn2.jr_grpt_id )
+                    and  jr_id=$1
+                    group by jr_id"
+            );
+        }
+    }
+
 }
diff --git a/include/class/print_ledger_fin.class.php 
b/include/class/print_ledger_fin.class.php
index 316e02e..0a472cb 100644
--- a/include/class/print_ledger_fin.class.php
+++ b/include/class/print_ledger_fin.class.php
@@ -93,24 +93,16 @@ class Print_Ledger_Financial extends Print_Ledger
      */
     function export()
     {
-        $http=new HttpInput();
-        
$a_jrn=$this->ledger->get_operation($http->get('from_periode',"number"),
-                                            $http->get('to_periode','number'));
+        $ledger=$this->get_ledger();
+        $a_jrn=$ledger->get_operation($this->get_from(),$this->get_to());
+
         $this->SetFont('DejaVu', '', 6);
         if ( $a_jrn == null ) return;
         bcscale(2);
         
-        $this->cn->prepare("amount_cur",
-                "select jrn2.jr_id , 
-                    sum(coalesce(oc_amount,0)) as sum_ocamount
-               from operation_currency
-                    join jrnx using (j_id)
-                    join jrn as jrn2 on (j_grpt=jrn2.jr_grpt_Id) 
-               where 
-                    j_id in (select j_id from jrnx where 
j_grpt=jrn2.jr_grpt_id )
-                    and  jr_id=$1
-                    group by jr_id"
-                );
+        $prepare=new Prepared_Query($this->cn);
+        $prepare->prepare_currency();
+        
         for ( $i=0;$i<count($a_jrn);$i++)
         {
             $row=$a_jrn[$i];
diff --git a/include/class/print_ledger_misc.class.php 
b/include/class/print_ledger_misc.class.php
index 6040405..4e76bb6 100644
--- a/include/class/print_ledger_misc.class.php
+++ b/include/class/print_ledger_misc.class.php
@@ -70,10 +70,8 @@ class Print_Ledger_Misc extends Print_Ledger
      */
     function export()
     {
-        $http=new HttpInput();
-        
-        
$a_jrn=$this->ledger->get_rowSimple($http->get('from_periode','number'),
-                                            $http->get('to_periode','number'));
+        
$a_jrn=$this->get_ledger()->get_rowSimple($this->get_from(),$this->get_to());
+
         $this->SetFont('DejaVu', '', 6);
         if ( $a_jrn == null ) return;
         $ledger=$this->get_ledger();



reply via email to

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