noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 32/219: Task #0001426: Distinction dans l'af


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 32/219: Task #0001426: Distinction dans l'affichage des historiques des OD: libellé + fiche Ajout des qcodes pour l'historique par poste Ajout des postes comptables pour l'historique par Fiche Ajout des tiers Fait aussi pour les export PDF & CSV
Date: Mon, 18 Dec 2017 13:22:31 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 9152c9266699246e0510872bb45974b17b93ca1f
Author: Dany De Bontridder <address@hidden>
Date:   Sat Sep 2 23:14:52 2017 +0200

    Task #0001426: Distinction dans l'affichage des historiques des OD: libellé 
+ fiche
    Ajout des qcodes pour l'historique par poste
    Ajout des postes comptables pour l'historique par Fiche
    Ajout des tiers
    Fait aussi pour les export PDF & CSV
---
 include/ajax/ajax_history.php                      |  10 +-
 include/class/acc_account_ledger.class.php         | 155 +++++++++++++--------
 include/class/acc_operation.class.php              |  84 +++++++++++
 include/class/acc_reconciliation.class.php         |   2 +-
 include/class/fiche.class.php                      | 120 +++++++++++-----
 include/export/export_fiche_detail_csv.php         |  34 +++--
 include/export/export_fiche_detail_pdf.php         |   8 +-
 include/export/export_poste_detail_csv.php         |  18 ++-
 include/export/export_poste_detail_pdf.php         |  11 +-
 scenario/FicheTest.php                             |  53 +++++++
 scenario/acc_ledger_AccountTest.php                |  44 ++++++
 scenario/historic-card.php                         |  16 +++
 scenario/scenario-historic.php                     |   2 +
 .../include/class/acc_account_ledgerTest.class.php |  22 +--
 unit-test/include/class/ficheTest.class.php        |   7 +-
 15 files changed, 454 insertions(+), 132 deletions(-)

diff --git a/include/ajax/ajax_history.php b/include/ajax/ajax_history.php
index a6426b1..e858501 100644
--- a/include/ajax/ajax_history.php
+++ b/include/ajax/ajax_history.php
@@ -34,7 +34,7 @@ require_once NOALYSS_INCLUDE.'/class/acc_account.class.php';
 require_once NOALYSS_INCLUDE.'/class/exercice.class.php';
 $div=$_REQUEST['div'];
 mb_internal_encoding("UTF-8");
-
+$http=new HttpInput();
 /**
  *if $_SESSION['g_user'] is not set : echo a warning
  */
@@ -50,7 +50,8 @@ if ( isset($_GET['f_id']))
   {
     $exercice=new Exercice($cn);
     $old='';
-    $fiche=new Fiche($cn,$_GET['f_id']);
+    $f_id=$http->get('f_id',"number");
+    $fiche=new Fiche($cn,$f_id);
     $year=$g_user->get_exercice();
     if ( $year == 0 )
       {
@@ -64,8 +65,9 @@ if ( isset($_GET['f_id']))
         $array['to_periode']=$limit_periode[1]->last_day();
        if (isset($_GET['ex']))
          {
-           $limit_periode=$per->get_limit($_GET['ex']);
-           if ( $_GET['ex'] < $year)
+            $ex=$http->get('ex','number');
+           $limit_periode=$per->get_limit($ex);
+           if ( $ex < $year)
              $array['from_periode']=$limit_periode[0]->first_day();
            else
              $array['to_periode']=$limit_periode[1]->last_day();
diff --git a/include/class/acc_account_ledger.class.php 
b/include/class/acc_account_ledger.class.php
index 0ccb3de..77fb0e7 100644
--- a/include/class/acc_account_ledger.class.php
+++ b/include/class/acc_account_ledger.class.php
@@ -45,8 +45,9 @@ class Acc_Account_Ledger
      address@hidden get the row thanks the resource
      address@hidden double array 
(j_date,deb_montant,cred_montant,description,jrn_name,j_debit,jr_internal)
      *         (tot_deb,tot_credit)
+     * @deprecated since version 6920
      */
-    private function get_row_sql($Res)
+    private function get_row_sql_deprecated($Res)
     {
         $array=array();
         $tot_cred=0.0;
@@ -84,22 +85,38 @@ class Acc_Account_Ledger
     {
         $periode=sql_filter_per($this->db,$p_from,$p_to,'p_id','jr_tech_per');
 
-        $Res=$this->db->exec_sql("select distinct 
j_id,jr_id,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,j_date,".
+        $this->row=$this->db->get_array("select distinct 
j_id,jr_id,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,j_date,".
                                  "case when j_debit='t' then j_montant else 0 
end as deb_montant,".
                                  "case when j_debit='f' then j_montant else 0 
end as cred_montant,".
                                  " jr_comment as description,jrn_def_name as 
jrn_name,".
                                  "j_debit, jr_internal,jr_pj_number ".
                                  " from jrnx left join jrn_def on 
jrn_def_id=j_jrn_def ".
                                  " left join jrn on jr_grpt_id=j_grpt".
-                                 " where j_poste=".$this->id." and ".$periode.
-                                 " order by j_date");
-        return $this->get_row_sql($Res);
+                                 " where j_poste=$1 and $periode ".
+                                 " order by j_date",array($this->id));
+         $res_saldo = $this->db->exec_sql(
+                 "select  sum(deb_montant),sum(cred_montant) from 
+                    (select case when j_debit='t' then j_montant else 0 end as 
deb_montant,
+                    case when j_debit='f' then j_montant else 0 end as 
cred_montant
+                    from jrnx 
+                    left join jrn_def 
+                    on jrn_def_id=j_jrn_def 
+                    left join jrn on jr_grpt_id=j_grpt
+                  where j_poste=$1 and $periode ) as m
+                  ",array($this->id));
+        $this->tot_deb=$this->tot_cred=0;
+        
+        if ( Database::num_row($res_saldo) > 0 ) {
+            $this->tot_deb=Database::fetch_result($res_saldo, 0, 0);
+            $this->tot_cred=Database::fetch_result($res_saldo, 0, 1);
+        }
+        return array($this->row,$this->tot_deb,$this->tot_cred);
     }
     /*!
      * \brief  Get data for accounting entry between 2 date
      *
-     *\param  $p_from date from
-     *\param  $p_to   end date
+     *\param  $p_from date from DD.MM.YYYY
+     *\param  $p_to   end date DD.MM.YYYY
      *\param $let 0 means all rows, 1 only lettered, 2 only unlettered
      *\param $solded 0 means all account, 1 means only accounts with a saldo 
<> 0
      *\note the data are filtered by the access of the current user
@@ -127,14 +144,15 @@ class Acc_Account_Ledger
          {
            $filter=str_replace('jrn_def_id','jr_def_id',$filter_sql);
            $bal_sql="select sum(amount_deb) as s_deb,sum(amount_cred) as 
s_cred, j_poste
-                               from                                            
(select case when j_debit='t' then j_montant else 0 end as amount_deb,
-                                                               case when 
j_debit='f' then j_montant else 0 end as amount_cred,
-                                                               j_poste
-                                                               from jrnx join 
jrn on (j_grpt = jr_grpt_id)
-                                                               where
-                                                               j_poste=$1 and
-                                                               $filter and
-                                                               ( 
to_date($2,'DD.MM.YYYY') <= j_date and
+                        from                                           
+                        (select case when j_debit='t' then j_montant else 0 
end as amount_deb,
+                                case when j_debit='f' then j_montant else 0 
end as amount_cred,
+                                j_poste
+                                from jrnx join jrn on (j_grpt = jr_grpt_id)
+                                where
+                                j_poste=$1 and
+                                $filter and
+                                ( to_date($2,'DD.MM.YYYY') <= j_date and
                                   to_date($3,'DD.MM.YYYY') >= j_date  )) as 
signed_amount
                                                group by j_poste
                                                ";
@@ -142,26 +160,49 @@ class Acc_Account_Ledger
            if ( $this->db->count() == 0 ) return array();
            if ($r[0]['s_deb']==$r[0]['s_cred']) return array();
          }
-        $Res=$this->db->exec_sql("select  jr_id,to_char(j_date,'DD.MM.YYYY') 
as j_date_fmt,j_date,".
-                                 "case when j_debit='t' then j_montant else 0 
end as deb_montant,".
-                                 "case when j_debit='f' then j_montant else 0 
end as cred_montant,".
-                                 " case when j_text is null or j_text = '' 
then jr_comment 
+        $this->row=$this->db->get_array("select  
j_id,jr_id,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,j_date,
+                                j_qcode
+                                 ,case when j_debit='t' then j_montant else 0 
end as deb_montant,
+                                 case when j_debit='f' then j_montant else 0 
end as cred_montant,
+                                  case when j_text is null or j_text = '' then 
jr_comment 
                                    else jr_comment||' '||j_text  end
-                as description,jrn_def_name as jrn_name,".
-                                 "j_debit, jr_internal,jr_pj_number,
-                                                                
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter ".
-                                 ",pcm_lib ".
-                                
",jr_tech_per,p_exercice,jrn_def_name,jrn_def_code".
-                                 " from jrnx left join jrn_def on 
(jrn_def_id=j_jrn_def )".
-                                 " left join jrn on (jr_grpt_id=j_grpt)".
-                                 " left join tmp_pcmn on (j_poste=pcm_val)".
-                                " left join parm_periode on (p_id=jr_tech_per) 
".
-                                 " where j_poste=$1 and ".
-                                 " ( to_date($2,'DD.MM.YYYY') <= j_date and ".
-                                 "   to_date($3,'DD.MM.YYYY') >= j_date )".
-                                 " and $filter_sql  $sql_let ".
-                                 " order by 
j_date,substring(jr_pj_number,'[0-9]+$') asc",array($this->id,$p_from,$p_to));
-        return $this->get_row_sql($Res);
+                                 as description,jrn_def_name as jrn_name,
+                                 j_debit, jr_internal,jr_pj_number,
+                                 coalesce(comptaproc.get_letter_jnt(j_id),-1) 
as letter 
+                                 ,pcm_lib
+                                ,jr_tech_per
+                                 ,p_exercice
+                                 ,jrn_def_name
+                                 ,jrn_def_code
+                                  from jrnx 
+                                  join jrn_def on (jrn_def_id=j_jrn_def )
+                                   join jrn on (jr_grpt_id=j_grpt)
+                                   join tmp_pcmn on (j_poste=pcm_val)
+                                  join parm_periode on (p_id=jr_tech_per) 
+                                  where j_poste=$1 and 
+                                  ( to_date($2,'DD.MM.YYYY') <= j_date and 
+                                    to_date($3,'DD.MM.YYYY') >= j_date )
+                                  and $filter_sql  $sql_let 
+                                  order by 
j_date,substring(jr_pj_number,'[0-9]+$') asc",array($this->id,$p_from,$p_to));
+        $res_saldo = $this->db->exec_sql("select  
sum(deb_montant),sum(cred_montant) from 
+                    (select case when j_debit='t' then j_montant else 0 end as 
deb_montant,
+                    case when j_debit='f' then j_montant else 0 end as 
cred_montant
+                                  from jrnx 
+                                  join jrn_def on (jrn_def_id=j_jrn_def )
+                                   join jrn on (jr_grpt_id=j_grpt)
+                                   join tmp_pcmn on (j_poste=pcm_val)
+                                  join parm_periode on (p_id=jr_tech_per) 
+                                  where j_poste=$1 and 
+                                  ( to_date($2,'DD.MM.YYYY') <= j_date and 
+                                    to_date($3,'DD.MM.YYYY') >= j_date ) 
+                                  and $filter_sql  $sql_let ) as 
m",array($this->id,$p_from,$p_to));
+        $this->tot_deb=$this->tot_cred=0;
+        
+        if ( Database::num_row($res_saldo) > 0 ) {
+            $this->tot_deb=Database::fetch_result($res_saldo, 0, 0);
+            $this->tot_cred=Database::fetch_result($res_saldo, 0, 1);
+        }
+        return array($this->row,$this->tot_deb,$this->tot_cred);
     }
 
 
@@ -311,6 +352,7 @@ class Acc_Account_Ledger
         return 0;
 
     }
+   
     /*!
      * \brief HtmlTable, display a HTML of a poste for the asked period
      * \param $p_array array for filter
@@ -337,12 +379,14 @@ class Acc_Account_Ledger
                        echo "<TABLE id=\"tb".$from_div."\" 
class=\"resultfooter\" 
style=\"border-collapse:separate;margin:1%;width:98%;;border-spacing:0px 
2px\">";
         echo '<tbody>';
         echo "<TR>".
-        "<TH style=\"text-align:left\"> Date</TH>".
-        "<TH style=\"text-align:left\"> n° de pièce </TH>".
-        "<TH style=\"text-align:left\"> Code interne </TH>".
-        "<TH style=\"text-align:left\"> Description </TH>".
-        "<TH style=\"text-align:right\"> D&eacute;bit  </TH>".
-        "<TH style=\"text-align:right\"> Cr&eacute;dit </TH>".
+        "<TH style=\"text-align:left\">"._('Date')." </TH>".
+        "<TH style=\"text-align:left\">"._('n° de pièce')." </TH>".
+        "<TH style=\"text-align:left\">"._('QuickCode')."</TH>".
+        "<TH style=\"text-align:left\">"._('Code interne')." </TH>".
+        "<TH style=\"text-align:left\">"._('Tiers')." </TH>".
+        "<TH style=\"text-align:left\">"._('Description')."</TH>".
+        "<TH style=\"text-align:right\">"._('Débit')."</TH>".
+        "<TH style=\"text-align:right\">"._("Crédit")."</TH>".
         th('Prog.','style="text-align:right"').
         th('Let.','style="text-align:right"');
         "</TR>"
@@ -351,8 +395,13 @@ class Acc_Account_Ledger
        bcscale(2);
        $old_exercice="";
        $idx=0;
+        $operation=new Acc_Operation($this->db);
         foreach ( $this->row as $op )
         {
+           
+            
$tiers=$operation->find_tiers($op['jr_id'],$op['j_id'],$op['j_qcode']);
+           
+            
             $vw_operation = sprintf('<A class="detail" 
style="text-decoration:underline;color:red" 
HREF="javascript:modifyOperation(\'%s\',\'%s\')" >%s</A>', $op['jr_id'], 
dossier::id(), $op['jr_internal']);
             $let = '';
                        $html_let = "";
@@ -374,9 +423,8 @@ class Acc_Account_Ledger
                        $side="&nbsp;".$this->get_amount_side($progress);
                    echo "<TR class=\"highlight\">".
                      "<TD>$old_exercice</TD>".
-                     td('').
-                     "<TD></TD>".
-                     "<TD>Totaux</TD>".
+                     "<TD></TD>".td().td().td().
+                     "<TD>"._("Totaux")."</TD>".
                      "<TD style=\"text-align:right\">".nbm($sum_deb)."</TD>".
                      "<TD style=\"text-align:right\">".nbm($sum_cred)."</TD>".
                      td(nbm(abs($progress)).$side,'style="text-align:right"').
@@ -398,7 +446,9 @@ class Acc_Account_Ledger
            echo "<TR $class name=\"tr_" . $let . "_" . $from_div . "\">" .
                        "<TD>".smaller_date(format_date($op['j_date']))."</TD>".
              td(h($op['jr_pj_number'])).
+             "<TD>".h($op['j_qcode'])."</TD>".
              "<TD>".$vw_operation."</TD>".
+                "<TD>".$tiers."</TD>".
              "<TD>".h($op['description'])."</TD>".
              "<TD style=\"text-align:right\">".nbm($op['deb_montant'])."</TD>".
              "<TD 
style=\"text-align:right\">".nbm($op['cred_montant'])."</TD>".
@@ -409,17 +459,17 @@ class Acc_Account_Ledger
            $old_exercice=$op['p_exercice'];
         }
         echo '<tfoot>';
-        $solde_type=($sum_deb>$sum_cred)?"solde débiteur":"solde créditeur";
+        $solde_type=($sum_deb>$sum_cred)?_("solde débiteur"):_("solde 
créditeur");
         $diff=bcsub($sum_deb,$sum_cred);
                $side="&nbsp;".$this->get_amount_side($diff);
         echo "<TR class=\"highlight\">".
-        "<TD >Totaux</TD><td></td>".
-        "<TD ></TD>".
-        "<TD></TD>".
+                td($op['p_exercice']).
+                td().td().td().td().
+        "<TD >Totaux</TD>".
          "<TD  style=\"text-align:right\">".nbm($sum_deb)."</TD>".
          "<TD  style=\"text-align:right\">".nbm($sum_cred)."</TD>".
          "<TD style=\"text-align:right\">".nbm(abs($diff)).$side."</TD>".
-
+                td().
         "</TR>";
        echo   "<tr><TD>$solde_type</TD><td></td>".
          "<TD style=\"text-align:right\">".nbm(abs($diff))."</TD>".
@@ -702,12 +752,5 @@ class Acc_Account_Ledger
     function filter_history($p_table_id) {
         return _('Filtre rapide').' '.HtmlInput::filter_table($p_table_id, 
'0,1,2,3,4,5,6,7', 1);
     }
-    static function test_me()
-    {
-        $cn=Dossier::connect();
-        $a=new Acc_Account_Ledger($cn,550);
-        echo ' Journal 4 '.$a->belong_ledger(4);
-        return $a->belong_ledger(4);;
-
-    }
+ 
 }
diff --git a/include/class/acc_operation.class.php 
b/include/class/acc_operation.class.php
index 344f340..cc51756 100644
--- a/include/class/acc_operation.class.php
+++ b/include/class/acc_operation.class.php
@@ -25,6 +25,7 @@
  */
 require_once NOALYSS_INCLUDE.'/class/user.class.php';
 require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
+require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php';
 
 /*!
  * \brief  this file match the tables jrn & jrnx the purpose is to
@@ -68,6 +69,89 @@ class Acc_Operation
                                   array($this->jr_id));
         return $ret;
     }
+     /**
+     * \brief prepare the query for getting the qcode of the tiers, when
+     * executing this SQL , an array of (jrn.jr_id , jrnx.j_id) must be 
+     * provided
+     */
+    private function prepare_sql_tiers()
+    {
+         // prepare for getting the tiers
+        $this->db->prepare('prep_tiers',"select fiche_detail.f_id,ad_value 
from 
+                                        fiche_detail 
+                                         join (select qf_other as f_id 
+                                          from quant_fin
+                                          where 
+                                          quant_fin.jr_id = $1
+                                        union all 
+                                        select qp_supplier as f_id 
+                                        from quant_purchase
+                                        where quant_purchase.j_id=$2
+                                        union all 
+                                        select qs_client as f_id 
+                                        from quant_sold                        
+                                        where quant_sold.j_id=$2 ) as v_fiche 
on (fiche_detail.f_id=v_fiche.f_id) where ad_id=23 ");
+    }
+    /**
+     * \brief prepare the query for getting the qcode of the tiers, when
+     * executing this SQL , an array of (jrn.jr_id , jrnx.j_id) must be 
+     * provided
+     */
+    private function prepare_sql_counterpart()
+    {
+         // prepare for getting the tiers
+        $this->db->prepare('prep_counterpart',"select 
fiche_detail.f_id,ad_value from 
+                                        fiche_detail 
+                                         join (select qf_bank as f_id 
+                                          from quant_fin
+                                          where 
+                                          quant_fin.jr_id = $1
+                                        union all 
+                                        select qp_fiche as f_id 
+                                        from quant_purchase
+                                        where quant_purchase.j_id=$2
+                                        union all 
+                                        select qs_fiche as f_id 
+                                        from quant_sold                        
+                                        where quant_sold.j_id=$2 ) as v_fiche 
on (fiche_detail.f_id=v_fiche.f_id) where ad_id=23 ");
+    }
+    /**
+     * @brief Find the tiers of an operation , thanks the SQL prepared query
+     * prep_tiers and prep_counterpart. Return a string with the quick_code
+     * @param type $pn_jrn_id pk of the table jrn (jrn.jr_id)
+     * @param type $pn_jrnx_id pk of the table jrnx (jrnx.jr_id)
+     * @param type $p_code quickcode 
+     * @return string
+     */
+    function find_tiers($pn_jrn_id,$pn_jrnx_id,$p_code) 
+    {
+        static $p=0;
+        if ( $p == 0 ){
+            $this->prepare_sql_counterpart();
+            $this->prepare_sql_tiers();
+            $p=1;
+        }
+        $tiers="";
+         $res_tiers=$this->db->execute('prep_tiers',
+                 array($pn_jrn_id,$pn_jrnx_id));
+         if ( Database::num_row($res_tiers) > 0) {
+                $atiers=Database::fetch_array($res_tiers);
+                $tiers=$atiers['ad_value'];
+                // If the found tiers has the same quickcode than the current
+                // card, it means it is a card of supplier or customer,
+                //  so we must look for the countercard
+                if ($tiers == $p_code)  {
+                    $res_counterpart=$this->db->execute('prep_counterpart',
+                            array($pn_jrn_id,$pn_jrnx_id));
+                    $tiers="";
+                    if ( Database::num_row($res_counterpart) > 0) {
+                        $atiers=Database::fetch_array($res_counterpart);
+                        $tiers=$atiers['ad_value'];
+                    }
+                }
+            }
+            return $tiers;
+    }
     /**
      address@hidden  Insert into the table Jrn
      *The needed data are :
diff --git a/include/class/acc_reconciliation.class.php 
b/include/class/acc_reconciliation.class.php
index 0bed22e..9c4ff61 100644
--- a/include/class/acc_reconciliation.class.php
+++ b/include/class/acc_reconciliation.class.php
@@ -619,7 +619,7 @@ j1.j_poste as poste
      * @param type $p_jrn_id  jrn.jr_id
      * @param type $p_default_amount amount to return if not found in the view
      * v_quant_detail
-     * @return type
+     * @return number
      */
     function get_amount_noautovat($p_jrn_id,$p_default_amount) {
         $retdb=$this->db->execute("detail_quant",array($p_jrn_id));
diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index 4fe2b10..5f0275b 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -27,6 +27,7 @@ require_once NOALYSS_INCLUDE.'/lib/itext.class.php';
 require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
 require_once NOALYSS_INCLUDE.'/class/fiche_def.class.php';
 require_once NOALYSS_INCLUDE.'/lib/iposte.class.php';
+require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php';
 
 /*! \file
  * \brief define Class fiche, this class are using
@@ -1097,8 +1098,9 @@ class Fiche
     /**
      address@hidden fetch and return and array
      address@hidden get_row get_row_date
+     * @deprecated since version 6920
      */
-    private function get_row_result($res)
+    private function get_row_result_deprecated($res)
     {
         $array=array();
         $tot_cred=0.0;
@@ -1119,6 +1121,8 @@ class Fiche
             }
         }
         $this->row=$array;
+         $this->tot_deb=$tot_deb;
+        $this->tot_cred=$tot_cred;
         return array($array,$tot_deb,$tot_cred);
     }
     /*!
@@ -1154,10 +1158,10 @@ class Fiche
         }
 
         $qcode=$this->strAttribut(ATTR_DEF_QUICKCODE);
-        $Res=$this->cn->exec_sql("select distinct 
substring(jr_pj_number,'[0-9]+$'),j_id,j_date,to_char(j_date,'DD.MM.YYYY') as 
j_date_fmt,j_qcode,".
+        $this->row=$this->cn->get_array("select distinct 
substring(jr_pj_number,'[0-9]+$'),j_id,j_date,to_char(j_date,'DD.MM.YYYY') as 
j_date_fmt,j_qcode,".
                                  "case when j_debit='t' then j_montant else 0 
end as deb_montant,".
                                  "case when j_debit='f' then j_montant else 0 
end as cred_montant,".
-                                 " jr_comment as description,jrn_def_name as 
jrn_name,".
+                                 " jr_comment as description,jrn_def_name as 
jrn_name,j_poste,".
                                 " jr_pj_number,".
                                  "j_debit, 
jr_internal,jr_id,coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter, ".
                                 " jr_tech_per,p_exercice,jrn_def_name,
@@ -1170,15 +1174,34 @@ class Fiche
                                  "   to_date($3,'DD.MM.YYYY') >= j_date )".
                                  " and $filter_sql $sql_let ".
                                  " order by 
j_date,substring(jr_pj_number,'[0-9]+$')",array($qcode,$p_from,$p_to));
-
-        return $this->get_row_result($Res);
+        
+        $res_saldo = $this->cn->exec_sql("select  
sum(deb_montant),sum(cred_montant) from 
+                    (select case when j_debit='t' then j_montant else 0 end as 
deb_montant,
+                    case when j_debit='f' then j_montant else 0 end as 
cred_montant
+                                  from jrnx 
+                                  join jrn_def on (jrn_def_id=j_jrn_def )
+                                   join jrn on (jr_grpt_id=j_grpt)
+                                   join tmp_pcmn on (j_poste=pcm_val)
+                                  join parm_periode on (p_id=jr_tech_per) 
+                                  where j_qcode=$1 and 
+                                  ( to_date($2,'DD.MM.YYYY') <= j_date and 
+                                    to_date($3,'DD.MM.YYYY') >= j_date ) 
+                                  and $filter_sql  $sql_let ) as 
m",array($this->id,$p_from,$p_to));
+        $this->tot_deb=$this->tot_cred=0;
+        
+        if ( Database::num_row($res_saldo) > 0 ) {
+            $this->tot_deb=Database::fetch_result($res_saldo, 0, 0);
+            $this->tot_cred=Database::fetch_result($res_saldo, 0, 1);
+        }
+        
+        return [$this->row,$this->tot_deb,$this->tot_cred];
     }
 
     /*!
      * \brief  Get data for poste
      *
-     * \param  $p_from periode from
-     * \param  $p_to   end periode
+     * \param  $p_from periode periode.p_id
+     * \param  $p_to   end periode periode.p_id
      * \return double array 
(j_date,deb_montant,cred_montant,description,jrn_name,j_debit,jr_internal)
      *         (tot_deb,tot_credit
      *
@@ -1193,16 +1216,40 @@ class Fiche
         $qcode=$this->strAttribut(ATTR_DEF_QUICKCODE);
         $periode=sql_filter_per($this->cn,$p_from,$p_to,'p_id','jr_tech_per');
 
-        $Res=$this->cn->exec_sql("select j_date,to_char(j_date,'DD.MM.YYYY') 
as j_date_fmt,j_qcode,".
-                                 "case when j_debit='t' then j_montant else 0 
end as deb_montant,".
-                                 "case when j_debit='f' then j_montant else 0 
end as cred_montant,".
-                                 " jr_comment as description,jrn_def_name as 
jrn_name,".
-                                 "j_debit, jr_internal,jr_id ".
-                                 " from jrnx left join jrn_def on 
jrn_def_id=j_jrn_def ".
-                                 " left join jrn on jr_grpt_id=j_grpt".
-                                 " where j_qcode='".$qcode."' and ".$periode.
-                                 " order by j_date::date");
-        return $this->get_row_result($Res);
+        $this->row=$this->cn->get_array("select j_date,
+                            to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
+                            j_qcode,
+                            case when j_debit='t' then j_montant else 0 end as 
deb_montant,
+                            case when j_debit='f' then j_montant else 0 end as 
cred_montant,
+                            jr_comment as description,
+                            jrn_def_name as jrn_name,
+                            j_debit, 
+                            jr_internal,
+                            jr_id 
+                            from jrnx 
+                            left join jrn_def on jrn_def_id=j_jrn_def 
+                            left join jrn on jr_grpt_id=j_grpt
+                            where 
+                            j_qcode=$1  and {$periode}
+                            order by j_date::date",array(
+                               $qcode
+                                 ));
+         $res_saldo = $this->cn->exec_sql("select  
sum(deb_montant),sum(cred_montant) from 
+                    (select case when j_debit='t' then j_montant else 0 end as 
deb_montant,
+                    case when j_debit='f' then j_montant else 0 end as 
cred_montant
+                                  from jrnx 
+                                    left join jrn_def on jrn_def_id=j_jrn_def 
+                                    left join jrn on jr_grpt_id=j_grpt
+                                    where 
+                                    j_qcode=$1  and {$periode} ) as m",
+                 array($this->id));
+        $this->tot_deb=$this->tot_cred=0;
+        
+        if ( Database::num_row($res_saldo) > 0 ) {
+            $this->tot_deb=Database::fetch_result($res_saldo, 0, 0);
+            $this->tot_cred=Database::fetch_result($res_saldo, 0, 1);
+        }
+        return array($this->row,$this->tot_deb,$this->tot_cred);
 
     }
     /*!
@@ -1283,14 +1330,14 @@ class Fiche
         if ( $p_array == null)
             $p_array=$_REQUEST;
         $progress=0;
-               // if from_periode is greater than to periode then swap the 
values
-               if (cmpDate($p_array['from_periode'],$p_array['to_periode']) > 
0)
-               {
-                       $tmp=$p_array['from_periode'];
-                       $p_array['from_periode']=$p_array['to_periode'];
-                       $p_array['to_periode']=$tmp;
+        // if from_periode is greater than to periode then swap the values
+        if (cmpDate($p_array['from_periode'],$p_array['to_periode']) > 0)
+        {
+                $tmp=$p_array['from_periode'];
+                $p_array['from_periode']=$p_array['to_periode'];
+                $p_array['to_periode']=$tmp;
 
-               }
+        }
         list($array, $tot_deb, $tot_cred) = 
$this->get_row_date($p_array['from_periode'], $p_array['to_periode'], $op_let);
 
         if ( count($this->row ) == 0 )
@@ -1309,7 +1356,9 @@ class Fiche
         echo "<TR>".
         "<TH style=\"text-align:left\">"._('Date')."</TH>".
         "<TH style=\"text-align:left\">"._('n° pièce')." </TH>".
+        "<TH style=\"text-align:left\">"._('Poste')." </TH>".
         "<TH style=\"text-align:left\">"._('Code interne')." </TH>".
+        "<TH style=\"text-align:left\">"._('Tiers')." </TH>".
         "<TH style=\"text-align:left\">"._('Description')." </TH>".
         "<TH style=\"text-align:right\">"._('Débit')."  </TH>".
         "<TH style=\"text-align:right\">"._('Crédit')." </TH>".
@@ -1320,6 +1369,7 @@ class Fiche
        $old_exercice="";$sum_deb=0;$sum_cred=0;
        bcscale(2);
        $idx=0;
+        $operation=new Acc_Operation($this->cn);
         foreach ( $this->row as $op )
         {
             $vw_operation = sprintf('<A class="detail" 
style="text-decoration:underline;color:red" 
HREF="javascript:modifyOperation(\'%s\',\'%s\')" >%s</A>', $op['jr_id'], 
dossier::id(), $op['jr_internal']);
@@ -1346,6 +1396,7 @@ class Fiche
                      td('').
                      "<TD></TD>".
                      "<TD>Totaux</TD>".
+                            td().
                      "<TD style=\"text-align:right\">".nbm($sum_deb)."</TD>".
                      "<TD style=\"text-align:right\">".nbm($sum_cred)."</TD>".
                      td(nbm(abs($progress)).$side,'style="text-align:right"').
@@ -1360,13 +1411,16 @@ class Fiche
                        $side="&nbsp;".$this->get_amount_side($progress);
            $sum_cred=bcadd($sum_cred,$op['cred_montant']);
            $sum_deb=bcadd($sum_deb,$op['deb_montant']);
-               if ($idx%2 == 0) $class='class="odd"'; else $class=' 
class="even"';
-               $idx++;
-
+            if ($idx%2 == 0) $class='class="odd"'; else $class=' class="even"';
+            $idx++;
+            
+            $tiers=$operation->find_tiers($op['jr_id'], $op['j_id'], 
$op['j_qcode']);
            echo "<TR $class name=\"tr_" . $let . "_" . $from_div . "\">" .
                        
"<TD>".smaller_date(format_date($op['j_date_fmt']))."</TD>".
              td(h($op['jr_pj_number'])).
+               td($op['j_poste']).
             "<TD>".$vw_operation."</TD>".
+            td($tiers).
             "<TD>".h($op['description'])."</TD>".
             "<TD style=\"text-align:right\">".nbm($op['deb_montant'])."</TD>".
              "<TD 
style=\"text-align:right\">".nbm($op['cred_montant'])."</TD>".
@@ -1376,18 +1430,20 @@ class Fiche
            $old_exercice=$op['p_exercice'];
 
         }
-        $solde_type=($sum_deb>$sum_cred)?"solde débiteur":"solde créditeur";
+        $solde_type=($sum_deb>$sum_cred)?_("solde débiteur"):_("solde 
créditeur");
+        $solde_side=($sum_deb>$sum_cred)?"D":"C";
         $diff=abs(bcsub($sum_deb,$sum_cred));
         echo '<tfoot>';
        echo "<TR class=\"highlight\">".
-        "<TD>Totaux</TD>".
-        "<TD ></TD>".
-        "<TD ></TD>".
+               td($op['p_exercice']).
+               td().
+               td().
+        td(_('Totaux')).
         "<TD></TD>".
         "<TD  style=\"text-align:right\">".nbm($sum_deb)."</TD>".
         "<TD  style=\"text-align:right\">".nbm($sum_cred)."</TD>".
          "<TD style=\"text-align:right\">".nbm($diff)."</TD>".
-
+            td($solde_side).
         "</TR>";
         echo "<TR style=\"font-weight:bold\">".
         "<TD>$solde_type</TD>".
diff --git a/include/export/export_fiche_detail_csv.php 
b/include/export/export_fiche_detail_csv.php
index f4eaacb..30061ac 100644
--- a/include/export/export_fiche_detail_csv.php
+++ b/include/export/export_fiche_detail_csv.php
@@ -26,6 +26,8 @@ require_once NOALYSS_INCLUDE.'/lib/database.class.php';
 require_once NOALYSS_INCLUDE.'/class/fiche.class.php';
 require_once NOALYSS_INCLUDE.'/lib/noalyss_csv.class.php';
 require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
+require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php';
+
 $http=new HttpInput();
 
 $f_id=$http->request("f_id", "number");
@@ -63,22 +65,26 @@ if ( count($Fiche->row ) == 0 )
 if ( ! isset ($_REQUEST['oper_detail']))
 {
     $title=array();
-    $title=array("Qcode",
-                "Date",
-                "n° pièce",
-                "Code interne",
-                "Code journal",
-                "Nom journal",
-                "Description",
-                "Débit",
-                "Crédit",
-                "Prog.",
-                "Let."   );
+    $title=array(_("QCODE"),
+                _("Poste"),
+                _("Date"),
+                _("n° pièce"),
+                _("Code interne"),
+                _("Code journal"),
+                _("Nom journal"),
+                _("Tiers"),
+                _("Description"),
+                _("Débit"),
+                _("Crédit"),
+                _("Prog."),
+                _("Let.")
+        );
     $export->write_header($title);
     $progress=0;
     $current_exercice="";
     $tot_deb=0;$tot_cred=0; 
     bcscale(2);
+    $operation=new Acc_Operation($cn);
     foreach ( $Fiche->row as $op )
     {
         /*
@@ -95,6 +101,9 @@ if ( ! isset ($_REQUEST['oper_detail']))
                 $export->add(_('total'));
                 $export->add($current_exercice);
                 $export->add($solde_type);
+                $export->add("");
+                $export->add("");
+                $export->add("");
                 $export->add($tot_deb,"number");
                 $export->add($tot_cred,"number");
                 $export->add($diff,"number");
@@ -106,16 +115,19 @@ if ( ! isset ($_REQUEST['oper_detail']))
                 $tot_deb=0;$tot_cred=0;   
                  $export->write();
             }
+        $tiers=$operation->find_tiers($op['jr_id'], $op['j_id'], 
$op['j_qcode']);
         $diff=bcsub($op['deb_montant'],$op['cred_montant']);
         $progress=bcadd($progress,$diff);
         $tot_deb=bcadd($tot_deb,$op['deb_montant']);
         $tot_cred=bcadd($tot_cred,$op['cred_montant']);
         $export->add($op['j_qcode']);
+        $export->add($op['j_poste']);
         $export->add($op['j_date_fmt']);
         $export->add($op['jr_pj_number']);
         $export->add($op['jr_internal']);
         $export->add($op['jrn_def_code']);
         $export->add($op['jrn_def_name']);
+        $export->add($tiers);
         $export->add($op['description']);
         $export->add($op['deb_montant'],"number");
         $export->add($op['cred_montant'],"number");
diff --git a/include/export/export_fiche_detail_pdf.php 
b/include/export/export_fiche_detail_pdf.php
index 3cbc9b8..ff30dca 100644
--- a/include/export/export_fiche_detail_pdf.php
+++ b/include/export/export_fiche_detail_pdf.php
@@ -30,6 +30,7 @@ include_once("lib/impress.class.php");
 require_once NOALYSS_INCLUDE.'/class/fiche.class.php';
 require_once  NOALYSS_INCLUDE.'/header_print.php';
 require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
+require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php';
 require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
 require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
 $http=new HttpInput();
@@ -53,7 +54,7 @@ $pdf->setTitle(_("Détail fiche"),true);
 
 
 $Fiche=new Fiche($cn,$f_id);
-
+$operation=new Acc_Operation($cn);
 
 
list($array,$tot_deb,$tot_cred)=$Fiche->get_row_date($from_periode,$to_periode,$_GET['ople']);
 // don't print empty account
@@ -148,7 +149,10 @@ for ($e=0;$e<count($array);$e++)
     $l++;
     
$pdf->write_cell($size[$l],6,mb_substr($row['jrn_def_code'],0,14),0,0,$align[$l]);
     $l++;
-    
$pdf->LongLine($size[$l],6,($row['description'].'('.$row['jr_internal'].")"),0,$align[$l]);
+    $tiers=$operation->find_tiers($row['jr_id'], $row['j_id'], 
$row['j_qcode']);
+    
$description=($tiers=="")?$row["description"]:"[".$tiers."]".$row['description'];
+
+    
$pdf->LongLine($size[$l],6,($description.'('.$row['jr_internal'].")"),0,$align[$l]);
 
     $l++;
     
$pdf->LongLine($size[$l],6,(($row['letter']!=-1)?strtoupper(base_convert($row['letter'],10,36)):''),0,$align[$l]);
diff --git a/include/export/export_poste_detail_csv.php 
b/include/export/export_poste_detail_csv.php
index a230b6b..66e15dc 100644
--- a/include/export/export_poste_detail_csv.php
+++ b/include/export/export_poste_detail_csv.php
@@ -27,6 +27,8 @@ require_once 
NOALYSS_INCLUDE.'/class/acc_account_ledger.class.php';
 require_once  NOALYSS_INCLUDE.'/class/acc_operation.class.php';
 require_once NOALYSS_INCLUDE.'/lib/noalyss_csv.class.php';
 require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
+require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php';
+
 $http=new HttpInput();
 
 $r_poste=$http->request("poste_id");
@@ -63,6 +65,7 @@ if ( ! isset ($_REQUEST['oper_detail']))
     foreach ($a_poste as $pos)
     {
         $Poste=new Acc_Account_Ledger($cn,$pos['pcm_val']);
+        $operation=new Acc_Operation($cn);
         $name=$Poste->get_name();
         list($array,$tot_deb,$tot_cred)=$Poste->get_row_date( $from_periode,
                                                              $to_periode,
@@ -76,9 +79,11 @@ if ( ! isset ($_REQUEST['oper_detail']))
         $title[]=_("n° pièce");
         $title[]=_("Code journal");
         $title[]=_("Nom journal");
+        $title[]=_("QuickCode");
         $title[]=_("Lib.");
         $title[]=_("Interne");
         $title[]=_("Date");
+        $title[]=_("Tiers");
         $title[]=_("Description");
         $title[]=_("Débit");
         $title[]=_("Crédit");
@@ -109,6 +114,8 @@ if ( ! isset ($_REQUEST['oper_detail']))
                 $export->add($solde_type);
                 $export->add("");
                 $export->add("");
+                $export->add("");
+                $export->add("");
                 
                 $export->add($tot_deb,"number");
                 $export->add($tot_cred,"number");
@@ -121,6 +128,8 @@ if ( ! isset ($_REQUEST['oper_detail']))
                 $current_exercice=$op['p_exercice'];
                 $tot_deb=0;$tot_cred=0;    
             }
+            
$tiers=$operation->find_tiers($op['jr_id'],$op['j_id'],$op['j_qcode']);
+           
             $tot_deb=bcadd($tot_deb,$op['deb_montant']);
             $tot_cred=bcadd($tot_cred,$op['cred_montant']);
             $diff=bcsub($op['deb_montant'],$op['cred_montant']);
@@ -129,9 +138,11 @@ if ( ! isset ($_REQUEST['oper_detail']))
            $export->add($op['jr_pj_number']);
            $export->add($op['jrn_def_code']);
            $export->add($op['jrn_def_name']);
+           $export->add($op['j_qcode']);
             $export->add($name);
             $export->add($op['jr_internal']);
             $export->add($op['j_date_fmt']);
+            $export->add($tiers);
             $export->add($op['description']);
             $export->add($op['deb_montant'],"number");
             $export->add($op['cred_montant'],"number");
@@ -152,6 +163,8 @@ if ( ! isset ($_REQUEST['oper_detail']))
         $export->add($solde_type);
         $export->add("");
         $export->add("");
+        $export->add("");
+        $export->add("");
 
         $export->add($tot_deb,"number");
         $export->add($tot_cred,"number");
@@ -183,11 +196,12 @@ else
         $title[]=_("QuickCode");
         $title[]=_("Interne");
         $title[]=_("Date");
+        $title[]=_("Tiers");
         $title[]=_("Description");
         $title[]=_("Montant");
         $title[]=_("D/C");
         $export->write_header($title);
-
+        $operation=new Acc_Operation($cn);
 
 
         foreach ( $Poste->row as $a )
@@ -197,11 +211,13 @@ else
             $result=$op->get_jrnx_detail();
             foreach ( $result as $r)
             {
+                $tiers=$operation->find_tiers($r['jr_id'], $r['j_id'], 
$r['j_qcode']);
                 $export->add($r['j_poste']);
                 $export->add($r['pcm_lib']);
                 $export->add($r['j_qcode']);
                 $export->add($r['jr_internal']);
                 $export->add($r['jr_date']);
+                $export->add($tiers);
                 $export->add($a['description']);
                 $export->add($a['jr_pj_number']);
                 $export->add($r['j_montant'],"number");
diff --git a/include/export/export_poste_detail_pdf.php 
b/include/export/export_poste_detail_pdf.php
index 84ed0a9..31207b7 100644
--- a/include/export/export_poste_detail_pdf.php
+++ b/include/export/export_poste_detail_pdf.php
@@ -29,6 +29,7 @@ require_once NOALYSS_INCLUDE.'/lib/database.class.php';
 require_once NOALYSS_INCLUDE.'/lib/impress.class.php';
 require_once NOALYSS_INCLUDE.'/header_print.php';
 require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
+require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php';
 require_once NOALYSS_INCLUDE.'/class/user.class.php';
 require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
 require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
@@ -49,8 +50,9 @@ if ( isset ( $poste_fille) )
     $a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val::text 
like $1||'%' order by pcm_val",array($poste_id));
 }
 else
+{
     $a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val::text 
= $1 ",array($poste_id));
-
+}
 
 $ret="";
 
@@ -69,10 +71,11 @@ if ( count($a_poste) == 0 )
 }
 $size=array(13,25,13,65,12,20,20,20);
 $align=array('L','C','C','L','R','R','R','R');
-
+ $operation=new Acc_Operation($cn);
 foreach ($a_poste as $poste)
 {
     $Poste=new Acc_Account_Ledger($cn,$poste['pcm_val']);
+
     
list($array,$tot_deb,$tot_cred)=$Poste->get_row_date($from_periode,$to_periode,$_GET['ople']);
     // don't print empty account
     if ( count($array) == 0 )
@@ -161,7 +164,9 @@ foreach ($a_poste as $poste)
         $l++;
         
$pdf->write_cell($size[$l],6,mb_substr($row['jrn_def_code'],0,14),0,0,$align[$l]);
         $l++;
-        $pdf->LongLine($size[$l],6,  $row['description'],0,$align[$l]);
+        $tiers=$operation->find_tiers($row['jr_id'], $row['j_id'], 
$row['j_qcode']);
+        
$description=($tiers=="")?$row["description"]:"[".$tiers."]".$row['description'];
+        $pdf->LongLine($size[$l],6,  $description,0,$align[$l]);
         $l++;
         
$pdf->write_cell($size[$l],6,(($row['letter']!=-1)?$row['letter']:''),0,0,$align[$l]);
         $l++;
diff --git a/scenario/FicheTest.php b/scenario/FicheTest.php
new file mode 100644
index 0000000..6e5c651
--- /dev/null
+++ b/scenario/FicheTest.php
@@ -0,0 +1,53 @@
+<?php
+//@description: Test the class Acc_Ledger_Account
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+// Copyright (2016) Author Dany De Bontridder <address@hidden>
+
+/**
+ * @file
+ * @brief 
+ * @param type $name Descriptionara
+ */
+
+ $_GET=array (
+);
+$_POST=array (
+);
+$_POST['gDossier']=$gDossierLogInput;
+$_GET['gDossier']=$gDossierLogInput;
+$_REQUEST=array_merge($_GET,$_POST);
+
+require_once NOALYSS_INCLUDE."/class/fiche.class.php";
+
+ $_GET=array (
+);
+$_POST=array (
+);
+$_POST['gDossier']=$gDossierLogInput;
+$_GET['gDossier']=$gDossierLogInput;
+$_REQUEST=array_merge($_GET,$_POST);
+
+$a=new Fiche($cn,230);
+echo h1("Fiche->get_row");
+$result=$a->get_row(227,230);
+var_dump($result);
+echo h1("Fiche->get_row_date");
+$result=$a->get_row_date('01.01.2015','01.01.2017');
+var_dump($result);
+
diff --git a/scenario/acc_ledger_AccountTest.php 
b/scenario/acc_ledger_AccountTest.php
new file mode 100644
index 0000000..cc09e95
--- /dev/null
+++ b/scenario/acc_ledger_AccountTest.php
@@ -0,0 +1,44 @@
+<?php
+//@description: Test the class Fiche
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+// Copyright (2016) Author Dany De Bontridder <address@hidden>
+
+/**
+ * @file
+ * @brief 
+ * @param type $name Descriptionara
+ */
+require_once NOALYSS_INCLUDE."/class/acc_account_ledger.class.php";
+
+ $_GET=array (
+);
+$_POST=array (
+);
+$_POST['gDossier']=$gDossierLogInput;
+$_GET['gDossier']=$gDossierLogInput;
+$_REQUEST=array_merge($_GET,$_POST);
+
+$a=new Acc_Account_Ledger($cn,7000017);
+echo h1("Acc_Account_Ledger->get_row");
+$result=$a->get_row(227,215);
+var_dump($result);
+echo h1("Acc_Account_Ledger->get_row_date");
+$result=$a->get_row_date('01.01.2015','01.01.2017');
+var_dump($result);
+
diff --git a/scenario/historic-card.php b/scenario/historic-card.php
new file mode 100644
index 0000000..6dd7687
--- /dev/null
+++ b/scenario/historic-card.php
@@ -0,0 +1,16 @@
+<?php 
+//@description:history
+$_GET=array (
+  'gDossier' => '10104',
+  'act' => 'de',
+  'f_id' => '11',
+  'div' => 'det2',
+  'l' => '2',
+  'op' => 'history',
+);
+$_POST=array (
+);
+$_POST['gDossier']=$gDossierLogInput;
+$_GET['gDossier']=$gDossierLogInput;
+ $_REQUEST=array_merge($_GET,$_POST);
+include 'ajax_misc.php';
diff --git a/scenario/scenario-historic.php b/scenario/scenario-historic.php
index 3ee4169..8896e8e 100644
--- a/scenario/scenario-historic.php
+++ b/scenario/scenario-historic.php
@@ -21,4 +21,6 @@ $_POST=array (
 $_POST['gDossier']=$gDossierLogInput;
 $_GET['gDossier']=$gDossierLogInput;
  $_REQUEST=array_merge($_GET,$_POST);
+ global $http;
+ $http=new HttpInput();
 include 'history_operation.inc.php';
diff --git a/unit-test/include/class/acc_account_ledgerTest.class.php 
b/unit-test/include/class/acc_account_ledgerTest.class.php
index c936326..4605342 100644
--- a/unit-test/include/class/acc_account_ledgerTest.class.php
+++ b/unit-test/include/class/acc_account_ledgerTest.class.php
@@ -18,10 +18,11 @@ class Acc_Account_LedgerTest extends 
PHPUnit_Framework_TestCase
      */
     protected function setUp()
     {
-        global $g_connection, $g_parameter;
+        global $g_connection, $g_parameter,$g_user;
         $_REQUEST['gDossier']=DOSSIER;
         $g_connection=new Database(DOSSIER);
         $g_parameter=new Own($g_connection);
+        $g_user=new User($g_connection);
         $this->object=new Acc_Account_Ledger($g_connection, 400);
     }
 
@@ -40,10 +41,7 @@ class Acc_Account_LedgerTest extends 
PHPUnit_Framework_TestCase
      */
     public function testGet_row()
     {
-        // Remove the following lines when you implement this test.
-        $this->markTestIncomplete(
-                'This test has not been implemented yet.'
-        );
+      $this->object->get_row(215,235);
     }
 
     /**
@@ -52,10 +50,7 @@ class Acc_Account_LedgerTest extends 
PHPUnit_Framework_TestCase
      */
     public function testGet_row_date()
     {
-        // Remove the following lines when you implement this test.
-        $this->markTestIncomplete(
-                'This test has not been implemented yet.'
-        );
+        $this->object->get_row_date('01.01.2017', '01.02.2017', 0);
     }
     function dataGet_Name()
     {
@@ -278,13 +273,6 @@ class Acc_Account_LedgerTest extends 
PHPUnit_Framework_TestCase
         $this->assertEquals($p_card, $result[0]['f_id']);
     }
 
-    /**
-     * @covers Acc_Account_Ledger::test_me
-     * @todo   Implement testTest_me().
-     */
-    public function testTest_me()
-    {
-          $this->assertEquals($this->object->test_me(),0);
-    }
+   
 
 }
diff --git a/unit-test/include/class/ficheTest.class.php 
b/unit-test/include/class/ficheTest.class.php
index 31a638a..06e344b 100644
--- a/unit-test/include/class/ficheTest.class.php
+++ b/unit-test/include/class/ficheTest.class.php
@@ -324,12 +324,9 @@ class FicheTest extends PHPUnit_Framework_TestCase
      */
     public function testGet_row()
     {
-        // Remove the following lines when you implement this test.
-        $this->markTestIncomplete(
-                'This test has not been implemented yet.'
-        );
+       $this->object->get_row(235,238);
+       
     }
-
     /**
      * @covers Fiche::HtmlTableDetail
      * @todo   Implement testHtmlTableDetail().



reply via email to

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