noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 04/04: Task #1654 - PRINTJRN : Opération mal


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 04/04: Task #1654 - PRINTJRN : Opération mal classé Correct export CSV DETAILLED Ods , Fin, GL
Date: Sat, 21 Jul 2018 05:19:36 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit eecca863f375ec2b353e041a47f31ec25b51c8b7
Author: Dany De Bontridder <address@hidden>
Date:   Sat Jul 21 11:19:02 2018 +0200

    Task #1654 - PRINTJRN : Opération mal classé
    Correct export CSV DETAILLED Ods , Fin, GL
---
 include/export/export_ledger_csv.php | 170 +++++++++++++++++++----------------
 1 file changed, 94 insertions(+), 76 deletions(-)

diff --git a/include/export/export_ledger_csv.php 
b/include/export/export_ledger_csv.php
index 82e7203..7e43512 100644
--- a/include/export/export_ledger_csv.php
+++ b/include/export/export_ledger_csv.php
@@ -178,6 +178,91 @@ if ($get_option=='A')
     $acc_ledger_history->export_csv();
     exit;
 }
+/**
+ * Mode list for ODS , FIN and GL
+ */
+if ($get_option=="L" && ($jrn_type=='ODS'||$jrn_type=='FIN'||$jrn_type=='GL') )
+{
+    if ( $get_jrn==0) {
+        $Row=$Jrn->get_rowSimple($get_from_periode, $get_to_periode, $a_jrn);
+    }else {
+        $Row=$Jrn->get_rowSimple($get_from_periode, $get_to_periode);
+    }
+    $cn->prepare('reconcile_date_csv',
+            'select  * 
+                     from 
+                       jrn 
+                     where 
+                       jr_id in 
+                           (select 
+                               jra_concerned 
+                               from 
+                               jrn_rapt 
+                               where jr_id = $1 
+                            union all 
+                            select 
+                            jr_id 
+                            from jrn_rapt 
+                            where jra_concerned=$1)');
+    $title=array();
+    $title[]=_("operation");
+    $title[]=_("Date");
+    $title[]=_("N° Pièce");
+    $title[]=_("QuickCode");
+    $title[]=_("Tiers");
+    $title[]=_("commentaire");
+    $title[]=_("internal");
+    $title[]=_("montant");
+    $export->write_header($title);
+    foreach ($Row as $line)
+    {
+        $tiers_id=$Jrn->get_tiers_id($line['jrn_def_type'], $line['jr_id']);
+        $fiche_tiers=new Fiche($cn, $tiers_id);
+        $tiers=$fiche_tiers->strAttribut(ATTR_DEF_NAME, 0)." 
".$fiche_tiers->strAttribut(ATTR_DEF_FIRST_NAME,
+                        0);
+
+        $export->add($line['num']);
+        $export->add($line['date']);
+        $export->add($line['jr_pj_number']);
+        $export->add($fiche_tiers->get_quick_code());
+        $export->add($tiers);
+        $export->add($line['comment']);
+        $export->add($line['jr_internal']);
+        //       echo "<TD>".$line['pj'].";";
+        // If the ledger is financial :
+        // the credit must be negative and written in red
+        // Get the jrn type
+        if ($line['jrn_def_type']=='FIN')
+        {
+            $positive=$cn->get_value("select qf_amount from quant_fin  ".
+                    " where jr_id=$1", array($line['jr_id']));
+
+            $export->add($positive, "number");
+            $export->add("");
+        }
+        else
+        {
+            $export->add($line['montant'], "number");
+        }
+        //------ Add reconcilied operation ---------------
+        $ret_reconcile=$cn->execute('reconcile_date_csv',
+                array($line['jr_id']));
+        $max=Database::num_row($ret_reconcile);
+        if ($max>0)
+        {
+            for ($e=0; $e<$max; $e++)
+            {
+                $row=Database::fetch_array($ret_reconcile, $e);
+                $export->add($row['jr_date']);
+                $export->add($row['jr_internal']);
+                $export->add($row['jr_pj_number']);
+            }
+        }
+        $export->write();
+    }
+    return;
+}
+
 //-----------------------------------------------------------------------------
 // Detail printing for ACH or VEN : 1 row resume the situation with VAT, DNA
 // for Misc the amount 
@@ -187,87 +272,20 @@ if ($get_option=="L" || $get_option == 'D')
 {
 
 //-----------------------------------------------------
-    if ($jrn_type=='ODS'||$jrn_type=='FIN'||$jrn_type=='GL')
+    if ($jrn_type=='ODS'||$jrn_type=='FIN'||$jrn_type=='GL') 
     {
-        if ( $get_jrn==0) {
-            $Row=$Jrn->get_rowSimple($get_from_periode, $get_to_periode, 
$a_jrn);
-        }else {
-            $Row=$Jrn->get_rowSimple($get_from_periode, $get_to_periode);
-        }
-        $cn->prepare('reconcile_date_csv',
-                'select  * 
-                         from 
-                           jrn 
-                         where 
-                           jr_id in 
-                               (select 
-                                   jra_concerned 
-                                   from 
-                                   jrn_rapt 
-                                   where jr_id = $1 
-                                union all 
-                                select 
-                                jr_id 
-                                from jrn_rapt 
-                                where jra_concerned=$1)');
-        $title=array();
-        $title[]=_("operation");
-        $title[]=_("Date");
-        $title[]=_("N° Pièce");
-        $title[]=_("QuickCode");
-        $title[]=_("Tiers");
-        $title[]=_("commentaire");
-        $title[]=_("internal");
-        $title[]=_("montant");
-        $export->write_header($title);
-        foreach ($Row as $line)
+         if ($get_jrn == 0 )
         {
-            $tiers_id=$Jrn->get_tiers_id($line['jrn_def_type'], 
$line['jr_id']);
-            $fiche_tiers=new Fiche($cn, $tiers_id);
-            $tiers=$fiche_tiers->strAttribut(ATTR_DEF_NAME, 0)." 
".$fiche_tiers->strAttribut(ATTR_DEF_FIRST_NAME,
-                            0);
-
-            $export->add($line['num']);
-            $export->add($line['date']);
-            $export->add($line['jr_pj_number']);
-            $export->add($fiche_tiers->get_quick_code());
-            $export->add($tiers);
-            $export->add($line['comment']);
-            $export->add($line['jr_internal']);
-            //   echo "<TD>".$line['pj'].";";
-            // If the ledger is financial :
-            // the credit must be negative and written in red
-            // Get the jrn type
-            if ($line['jrn_def_type']=='FIN')
-            {
-                $positive=$cn->get_value("select qf_amount from quant_fin  ".
-                        " where jr_id=$1", array($line['jr_id']));
+            $acc_ledger_history=new Acc_Ledger_History_Generic($cn, $a_jrn,
+                $get_from_periode, $get_to_periode, 'D');
+        } else {
+            $acc_ledger_history=new Acc_Ledger_History_Generic($cn, 
array($a_jrn),
+                $get_from_periode, $get_to_periode, 'D');
 
-                $export->add($positive, "number");
-                $export->add("");
-            }
-            else
-            {
-                $export->add($line['montant'], "number");
-            }
-            //------ Add reconcilied operation ---------------
-            $ret_reconcile=$cn->execute('reconcile_date_csv',
-                    array($line['jr_id']));
-            $max=Database::num_row($ret_reconcile);
-            if ($max>0)
-            {
-                for ($e=0; $e<$max; $e++)
-                {
-                    $row=Database::fetch_array($ret_reconcile, $e);
-                    $export->add($row['jr_date']);
-                    $export->add($row['jr_internal']);
-                    $export->add($row['jr_pj_number']);
-                }
-            }
-            $export->write();
         }
+        $acc_ledger_history->export_csv();
+        return;
     }
-
 
//------------------------------------------------------------------------------
 // One line summary with tiers, amount VAT, DNA, tva code ....
 // 



reply via email to

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