noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 31/35: Export CSV print ledger , add the qcod


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 31/35: Export CSV print ledger , add the qcode for ODS and FIN
Date: Tue, 24 May 2016 21:25:40 +0000 (UTC)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 56d655b3526852142ba3d267f4ee894813c82f05
Author: Dany De Bontridder <address@hidden>
Date:   Mon May 16 17:44:23 2016 +0200

    Export CSV print ledger , add the qcode for ODS and FIN
---
 include/class/class_acc_ledger.php      |   39 ++++++++++++++++++++-----------
 include/class/class_acc_ledger_sold.php |    2 +-
 include/export/export_ledger_csv.php    |   11 +++++++--
 3 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/include/class/class_acc_ledger.php 
b/include/class/class_acc_ledger.php
index d9c094a..010caa4 100644
--- a/include/class/class_acc_ledger.php
+++ b/include/class/class_acc_ledger.php
@@ -385,7 +385,7 @@ class Acc_Ledger extends jrn_def_sql
                                      jr_internal,
                                      case j_debit when 't' then 
j_montant::text else '   ' end as deb_montant,
                                      case j_debit when 'f' then 
j_montant::text else '   ' end as cred_montant,
-                                     j_debit as debit,j_poste as 
poste,jr_montant , " .
+                                     j_debit as debit,j_poste as 
poste,j_qcode,jr_montant , " .
                                        "case when j_text='' or j_text is null 
then pcm_lib else j_text end as description,j_grpt as grp,
                                      jr_comment||' ('||jr_internal||')'  as 
jr_comment,
                                     jr_pj_number,
@@ -404,7 +404,7 @@ class Acc_Ledger extends jrn_def_sql
                                      jr_internal,
                                      case j_debit when 't' then 
j_montant::text else '   ' end as deb_montant,
                                      case j_debit when 'f' then 
j_montant::text else '   ' end as cred_montant,
-                                     j_debit as debit,j_poste as poste," .
+                                     j_debit as debit,j_poste as 
poste,j_qcode," .
                                        "case when j_text='' or j_text is null 
then pcm_lib else j_text end as description,j_grpt as grp,
                                      jr_comment||' ('||jr_internal||')' as 
jr_comment,
                                     jr_pj_number,
@@ -3381,17 +3381,14 @@ class Acc_Ledger extends jrn_def_sql
                );
                return $r;
        }
-
-       /**
-        * Retrieve the third : supplier for purchase, customer for sale, bank 
for fin,
-        * @param $p_jrn_type type of the ledger FIN, VEN ACH or ODS
-        */
-       function get_tiers($p_jrn_type, $jr_id)
-       {
-               if ($p_jrn_type == 'ODS')
-                       return ' ';
-               $tiers = '';
-               switch ($p_jrn_type)
+        //---------------------------------------------------------------------
+        /// Return the f_id of the tiers , called by get_tiers
+        //!\param $p_jrn_type type of the ledger FIN, VEN ACH or ODS
+        //!\param $jr_id jrn.jr_id
+        //---------------------------------------------------------------------
+        function get_tiers_id($p_jrn_type, $jr_id)
+        {
+            switch ($p_jrn_type)
                {
                        case 'VEN':
                                $tiers = $this->db->get_value('select 
max(qs_client) from quant_sold join jrnx using (j_id) join jrn on 
(jr_grpt_id=j_grpt) where jrn.jr_id=$1', array($jr_id));
@@ -3405,7 +3402,21 @@ class Acc_Ledger extends jrn_def_sql
                                break;
                }
                if ($this->db->count() == 0)
-                       return '';
+                       return 0;
+                return $tiers;
+        }
+       /**
+        * Retrieve the third : supplier for purchase, customer for sale, bank 
for fin,
+        * @param $p_jrn_type type of the ledger FIN, VEN ACH or ODS
+        * @param $jr_id jrn.jr_id
+        */
+       function get_tiers($p_jrn_type, $jr_id)
+       {
+               if ($p_jrn_type == 'ODS')
+                       return ' ';
+               $tiers = $this->get_tiers_id($p_jrn_type, $jr_id);
+                if ( $tiers == 0 )return "";
+               
                $name = $this->db->get_value('select ad_value from fiche_detail 
where ad_id=1 and f_id=$1', array($tiers));
                $first_name = $this->db->get_value('select ad_value from 
fiche_detail where ad_id=32 and f_id=$1', array($tiers));
                return $name . ' ' . $first_name;
diff --git a/include/class/class_acc_ledger_sold.php 
b/include/class/class_acc_ledger_sold.php
index 3f1188c..bf4fada 100644
--- a/include/class/class_acc_ledger_sold.php
+++ b/include/class/class_acc_ledger_sold.php
@@ -226,7 +226,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
      * * It generates the document if gen_invoice is set and save the middle 
of payment if any ($e_mp)
      *
      * \param $p_array is usually $_POST or a predefined operation
-     * \return string
+     * \return string : internal number 
      * \note throw an Exception
      */
 
diff --git a/include/export/export_ledger_csv.php 
b/include/export/export_ledger_csv.php
index df91236..7ff9888 100644
--- a/include/export/export_ledger_csv.php
+++ b/include/export/export_ledger_csv.php
@@ -134,6 +134,7 @@ if  ( $get_option == 0 )
     $title[]=_("Interne");
     $title[]=_("Date");
     $title[]=_("Poste");
+    $title[]=_("QuickCode");
     $title[]=_("Libellé");
     $title[]=_("Débit");
     $title[]=_("Crédit");
@@ -159,6 +160,7 @@ if  ( $get_option == 0 )
         $export->add($op['internal']);
         $export->add($op['j_date']);
         $export->add($op['poste']);
+        $export->add($op['j_qcode']);
         $export->add($desc);
         $export->add($op['deb_montant'],"number");
         $export->add($op['cred_montant'],"number");
@@ -184,6 +186,7 @@ if  ($get_option == 1)
         $title[]=_("operation");
         $title[]=_("Date");
         $title[]=_("N° Pièce");
+        $title[]=_("QuickCode");
         $title[]=_("Tiers");
         $title[]=_("commentaire");
         $title[]=_("internal");
@@ -191,11 +194,15 @@ if  ($get_option == 1)
         $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($Jrn->get_tiers($line['jrn_def_type'],$line['jr_id']));
+            $export->add($fiche_tiers->get_quick_code());
+            $export->add($tiers);
             $export->add($line['comment']);
             $export->add($line['jr_internal']);
             //   echo "<TD>".$line['pj'].";";



reply via email to

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