phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r5518 - in phpcompta/trunk: html include include/templat


From: phpcompta-dev
Subject: [Phpcompta-dev] r5518 - in phpcompta/trunk: html include include/template
Date: Sun, 20 Oct 2013 21:13:27 +0200 (CEST)

Author: danydb
Date: 2013-10-20 21:13:26 +0200 (Sun, 20 Oct 2013)
New Revision: 5518

Modified:
   phpcompta/trunk/html/ajax_ledger.php
   phpcompta/trunk/include/class_acc_ledger.php
   phpcompta/trunk/include/class_acc_operation.php
   phpcompta/trunk/include/class_acc_reconciliation.php
   phpcompta/trunk/include/export_histo_csv.php
   phpcompta/trunk/include/export_ledger_csv.php
   phpcompta/trunk/include/template/ledger_detail_ach.php
   phpcompta/trunk/include/template/ledger_detail_ven.php
   phpcompta/trunk/include/template/print_ledger_simple.php
Log:
task #0000900: Ajout d'une date de paiement

Modified: phpcompta/trunk/html/ajax_ledger.php
===================================================================
--- phpcompta/trunk/html/ajax_ledger.php        2013-10-19 20:28:13 UTC (rev 
5517)
+++ phpcompta/trunk/html/ajax_ledger.php        2013-10-20 19:13:26 UTC (rev 
5518)
@@ -405,6 +405,24 @@
 
                }
            }
+            
+         if (isset($_POST['p_date_paid']) )
+           {
+             $ech=$_POST['p_date_paid'];
+             if ( trim($ech) != '' && isDate($ech) != null)
+               {
+                 $cn->exec_sql("update jrn set 
jr_date_paid=to_date($1,'DD.MM.YYYY') where jr_id=$2",
+                               array($ech,$jr_id));
+
+               }
+             else
+               {
+                 $cn->exec_sql("update jrn set jr_date_paid=null where 
jr_id=$1",
+                               array($jr_id));
+
+               }
+           }
+            
             $cn->exec_sql("update jrn set 
jr_comment=$1,jr_pj_number=$2,jr_date=to_date($4,'DD.MM.YYYY') where jr_id=$3",
                           
array($_POST['lib'],$_POST['npj'],$jr_id,$_POST['p_date']));
            $cn->exec_sql("update jrnx set j_date=to_date($1,'DD.MM.YYYY') 
where j_grpt in (select jr_grpt_id from jrn where jr_id=$2)",

Modified: phpcompta/trunk/include/class_acc_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger.php        2013-10-19 20:28:13 UTC 
(rev 5517)
+++ phpcompta/trunk/include/class_acc_ledger.php        2013-10-20 19:13:26 UTC 
(rev 5518)
@@ -538,6 +538,7 @@
              jrn.jr_montant as montant,
              substr(jrn.jr_comment,1,35) as comment,
              to_char(jrn.jr_date,'DD-MM-YYYY') as date,
+             to_char(jrn.jr_date_paid,'DD-MM-YYYY') as date_paid,
              jr_pj_number,
              jr_internal,
              jrn.jr_grpt_id as grpt_id,
@@ -815,6 +816,7 @@
                $str_dossier = dossier::get();
                $table->add("Date", $url, 'order by jr_date 
asc,substring(jr_pj_number,\'[0-9]+$\')::numeric asc', 'order by  jr_date 
desc,substring(jr_pj_number,\'[0-9]+$\')::numeric desc', "da", "dd");
                $table->add('Echeance', $url, " order by  jr_ech asc", " order 
by  jr_ech desc", 'ea', 'ed');
+               $table->add('Paiement', $url, " order by  jr_date_paid asc", " 
order by  jr_date_paid desc", 'eap', 'edp');
                $table->add('PJ', $url, ' order by  
substring(jr_pj_number,\'[0-9]+$\')::numeric asc ', ' order by  
substring(jr_pj_number,\'[0-9]+$\')::numeric desc ', "pja", "pjd");
                $table->add('Tiers', $url, " order by  name asc", " order by  
name desc", 'na', 'nd');
                $table->add('Montant', $url, " order by jr_montant asc", " 
order by jr_montant desc", "ma", "md");
@@ -854,9 +856,10 @@
                $r.='<th>' . $table->get_header(1) . '</td>';
                $r.='<th>' . $table->get_header(2) . '</th>';
                $r.='<th>' . $table->get_header(3) . '</th>';
+               $r.='<th>' . $table->get_header(4) . '</th>';
+               $r.='<th>' . $table->get_header(6) . '</th>';
+               $r.=th('Notes', ' style="width:15%"');
                $r.='<th>' . $table->get_header(5) . '</th>';
-               $r.=th('Notes', ' style="width:15%"');
-               $r.='<th>' . $table->get_header(4) . '</th>';
                // if $p_paid is not equal to 0 then we have a paid column
                if ($p_paid != 0)
                {
@@ -894,12 +897,15 @@
                                $r.=td($row['jrn_def_name']);
                        // date
                        $r.="<TD>";
-                       $r.=smaller_date($row['str_jr_date']);
+                       $r.=$row['str_jr_date'];
                        $r.="</TD>";
                        // echeance
                        $r.="<TD>";
-                       $r.=smaller_date($row['str_jr_ech']);
+                       $r.=$row['str_jr_ech'];
                        $r.="</TD>";
+                       $r.="<TD>";
+                       $r.=$row['str_jr_date_paid'];
+                       $r.="</TD>";
 
                        // pj
                        $r.="<TD>";
@@ -2544,8 +2550,8 @@
                $sql = "select jr_id    ,
              jr_montant,
              substr(jr_comment,1,60) as jr_comment,
-             to_char(jr_ech,'DD.MM.YYYY') as str_jr_ech,
-             to_char(jr_date,'DD.MM.YYYY') as str_jr_date,
+             to_char(jr_ech,'DD.MM.YY') as str_jr_ech,
+             to_char(jr_date,'DD.MM.YY') as str_jr_date,
              jr_date as jr_date_order,
              jr_grpt_id,
              jr_rapt,
@@ -2593,9 +2599,9 @@
                                 (select 
qp_internal,qp_price,qp_nd_tva,qp_nd_tva_recup,case when qp_vat_sided<>0 then 0 
else qp_vat end as vat from quant_purchase where qp_internal=X.jr_internal) as 
invoice_purchase
                        )
                else null
-               end as total_invoice
-
-
+               end as total_invoice,
+            jr_date_paid,
+            to_char(jr_date_paid,'DD.MM.YY') as str_jr_date_paid
              from
              jrn as X left join jrn_note using(jr_id)
              join jrn_def on jrn_def_id=jr_def_id

Modified: phpcompta/trunk/include/class_acc_operation.php
===================================================================
--- phpcompta/trunk/include/class_acc_operation.php     2013-10-19 20:28:13 UTC 
(rev 5517)
+++ phpcompta/trunk/include/class_acc_operation.php     2013-10-20 19:13:26 UTC 
(rev 5518)
@@ -44,6 +44,7 @@
     var $periode;                      /*!< periode to use */
     var $amount;                       /*!< amount of the operatoin */
     var $grpt;                 /*!< the group id */
+    var $date_paid;
     /*!
      * \brief constructor set automatically the attributes user and periode
      * \param $p_cn the databse connection
@@ -591,7 +592,7 @@
         $sql="SELECT jr_id, jr_def_id, jr_montant, jr_comment, jr_date, 
jr_grpt_id,
              jr_internal, jr_tech_date, jr_tech_per, jrn_ech, jr_ech, 
jr_rapt,jr_ech,
              jr_valid, jr_opid, jr_c_opid, jr_pj, jr_pj_name, jr_pj_type,
-             jr_pj_number, jr_mt,jr_rapt
+             jr_pj_number, jr_mt,jr_rapt,jr_date_paid
              FROM jrn where jr_id=$1";
         $array=$this->db->get_array($sql,array($this->jr_id));
         if ( count($array) == 0 ) throw new Exception('Aucune ligne trouvée');

Modified: phpcompta/trunk/include/class_acc_reconciliation.php
===================================================================
--- phpcompta/trunk/include/class_acc_reconciliation.php        2013-10-19 
20:28:13 UTC (rev 5517)
+++ phpcompta/trunk/include/class_acc_reconciliation.php        2013-10-20 
19:13:26 UTC (rev 5518)
@@ -125,8 +125,26 @@
             // Ok we can insert
             $Res=$this->db->exec_sql("insert into 
jrn_rapt(jr_id,jra_concerned) values ".
                                     "(".$this->jr_id.",$jr_id2)");
-                       // try to letter automatically same account from both 
operation
-                       $this->auto_letter($jr_id2);
+            // try to letter automatically same account from both operation
+            $this->auto_letter($jr_id2);
+            
+            // update date of paiement 
-----------------------------------------------------------------------
+            $source_type=$this->db->get_value("select substr(jr_internal,1,1) 
from jrn where jr_id=$1",array($this->jr_id));
+            $dest_type=$this->db->get_value("select substr(jr_internal,1,1) 
from jrn where jr_id=$1",array($jr_id2));
+            if (($source_type =='A' || $source_type=='V') && ($dest_type != 
'A' && $dest_type != 'V'))
+            {
+                // set the date on source
+                $date=$this->db->get_value('select jr_date from jrn where 
jr_id=$1',array($jr_id2));
+                if ( trim ($date) == '') $date=null;
+                $this->db->exec_sql('update jrn set jr_date_paid=$1 where 
jr_id=$2 and jr_date_paid is null ',array($date,$this->jr_id));
+            }
+            if (($source_type !='A' && $source_type !='V') && ($dest_type == 
'A' || $dest_type == 'V'))
+            {
+                // set the date on dest
+                $date=$this->db->get_value('select jr_date from jrn where 
jr_id=$1',array($this->jr_id));
+                if (trim($date) == '') $date=null;
+                $this->db->exec_sql('update jrn set jr_date_paid=$1 where 
jr_id=$2 and jr_date_paid is null ',array($date,$jr_id2));
+            }
         }
         return true;
     }

Modified: phpcompta/trunk/include/export_histo_csv.php
===================================================================
--- phpcompta/trunk/include/export_histo_csv.php        2013-10-19 20:28:13 UTC 
(rev 5517)
+++ phpcompta/trunk/include/export_histo_csv.php        2013-10-20 19:13:26 UTC 
(rev 5518)
@@ -39,6 +39,7 @@
 printf('"%s";',"Journal");
 printf('"%s";',"Date");
 printf('"%s";',"Echeance");
+printf('"%s";',"Paiement");
 printf('"%s";',"Piece");
 printf('"%s";',"Tiers");
 printf('"%s";',"Description");
@@ -52,6 +53,7 @@
     printf('"%s";',$res[$i]['jrn_def_name']);
     printf('"%s";',$res[$i]['str_jr_date']);
     printf('"%s";',$res[$i]['str_jr_ech']);
+    printf('"%s";',$res[$i]['str_jr_date_paid']);
     printf('"%s";',$res[$i]['jr_pj_number']);
     printf('"%s";',$res[$i]['quick_code']);
     printf('"%s %s";',$res[$i]['name'],$res[$i]['first_name']);

Modified: phpcompta/trunk/include/export_ledger_csv.php
===================================================================
--- phpcompta/trunk/include/export_ledger_csv.php       2013-10-19 20:28:13 UTC 
(rev 5517)
+++ phpcompta/trunk/include/export_ledger_csv.php       2013-10-20 19:13:26 UTC 
(rev 5518)
@@ -196,11 +196,12 @@
                 $col_tva.='"Tva '.$line_tva['tva_label'].'";';
             }
         }
-        echo 
'"Date";"operation";"Client/Fourn.";"Commentaire";"inter.";"HTVA";privé;DNA;tva 
non ded.;opérations liées'.$col_tva.'"TVAC"'."\n\r";
+        echo 
'"Date";"Paiement";"operation";"Client/Fourn.";"Commentaire";"inter.";"HTVA";privé;DNA;tva
 non ded.;opérations liées'.$col_tva.'"TVAC"'."\n\r";
         foreach ($Row as $line)
         {
             printf('"%s";"%s";"%s";"%s";"%s";%s;%s;%s;%s;',
                    $line['date'],
+                   $line['date_paid'],
                    $line['num'],
                    $Jrn->get_tiers($line['jrn_def_type'],$line['jr_id']),
                    $line['comment'],

Modified: phpcompta/trunk/include/template/ledger_detail_ach.php
===================================================================
--- phpcompta/trunk/include/template/ledger_detail_ach.php      2013-10-19 
20:28:13 UTC (rev 5517)
+++ phpcompta/trunk/include/template/ledger_detail_ach.php      2013-10-20 
19:13:26 UTC (rev 5518)
@@ -1,297 +1,316 @@
 <?php require_once('template/ledger_detail_top.php'); ?>
 <div class="content" style="padding:0;">
-<?php 
-  require_once('class_own.php');
-  $owner=new Own($cn);
-?>
+    <?php
+    require_once('class_own.php');
+    $owner = new Own($cn);
+    ?>
 
-    <?php if ( $access=='W') : ?>
-<form  class="print" onsubmit="return op_save(this);">
-   <?php endif; ?>
+    <?php if ($access == 'W') : ?>
+        <form  class="print" onsubmit="return op_save(this);">
+        <?php endif; ?>
 
-    <?php echo 
HtmlInput::hidden('whatdiv',$div).HtmlInput::hidden('jr_id',$jr_id).dossier::hidden();?>
-    <table style="width:100%">
-    <tr><td>
-                                                       <table>
-                                                       <tr><td>
-                                                       <?php
-                                                       $date=new 
IDate('p_date');
-                                                       
$date->value=format_date($obj->det->jr_date);
-                                                        echo 
td('Date').td($date->input());
+        <?php echo HtmlInput::hidden('whatdiv', $div) . 
HtmlInput::hidden('jr_id', $jr_id) . dossier::hidden(); ?>
+        <table style="width:100%">
+            <tr><td>
+                    <table>
+                            <td></td>
+                        <?php
+                        $date = new IDate('p_date');
+                        $date->value = format_date($obj->det->jr_date);
+                        echo td('Date') . td($date->input());
+                        ?>
+                        <tr>
+                            <td></td>
+                            <?php
+                            $date_ech = new IDate('p_ech');
+                            $date_ech->value = format_date($obj->det->jr_ech);
+                            echo td('Echeance') . td($date_ech->input());
+                            ?>
+                        </tr>
+                        <tr>
+                            <td></td>
+                            <td>
+                                Date paiement
+                            </td>
+                            <td>
+                                <?php
+                                $date_paid = new IDate('p_date_paid');
+                                $date_paid->value = 
format_date($obj->det->jr_date_paid);
+                                echo $date_paid->input();
+                                ?>
+                            </td>
+                        </tr>
 
-                                                        ?>
-                                                       </td>
-                                                       <tr>
-                                                       <td>
-                                                       <?php
-                                                       $date_ech=new 
IDate('p_ech');
-                                                       
$date_ech->value=format_date($obj->det->jr_ech);
-                                                        echo 
td('Echeance').td($date_ech->input());
+                        <tr><td>
+                                <?php
+                                $bk = new Fiche($cn, 
$obj->det->array[0]['qp_supplier']);
+                                echo td(_('Fournisseur'));
 
-                                                        ?>
-                                                       </td>
-                                                       </tr>
+                                $view_card_detail = 
HtmlInput::card_detail($bk->get_quick_code(), h($bk->getName()), ' class="line" 
');
+                                echo td($view_card_detail);
+                                ?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>
+                                <?php
+                                $itext = new IText('npj');
+                                $itext->value = 
strip_tags($obj->det->jr_pj_number);
+                                echo td(_('Pièce')) . td($itext->input());
+                                ?>
+                            </td>
+                        <tr>
+                            <td>
+                                <?php
+                                $itext = new IText('lib');
+                                $itext->value = 
strip_tags($obj->det->jr_comment);
+                                $itext->size = 40;
+                                echo td(_('Libellé')) . td($itext->input(), ' 
colspan="2" ');
+                                ?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td></td>
+                            <td>Payé</td>
+                            <td>
+                                <?php
+                                $ipaid = new ICheckBox("ipaid", 'paid');
+                                $ipaid->selected = ($obj->det->jr_rapt == 
'paid');
+                                echo $ipaid->input();
+                                ?>
+                            </td>
+                        </tr>
 
-                                                       <tr><td>
-                                                       <?php 
-                                                       $bk=new 
Fiche($cn,$obj->det->array[0]['qp_supplier']);
-                                                       echo 
td(_('Fournisseur'));
+                    </table>
+                </td><td>
+                    <table style="border:solid 1px yellow">
+                        <tr>
+                            <td>
+                                Note
+                            </td></tr>
+                        <tr>
+                            <td>
+                                <?php
+                                $inote = new ITextarea('jrn_note');
+                                $inote->width = 25;
+                                $inote->heigh = 5;
+                                $inote->value = strip_tags($obj->det->note);
+                                echo $inote->input();
+                                ?>
 
-                                                       
$view_card_detail=HtmlInput::card_detail($bk->get_quick_code(),h($bk->getName()),
 ' class="line" ');
-                                                       echo 
td($view_card_detail);
-                                                       ?>
-                                                       </td>
-                                                       </tr>
-                                                       <tr>
-                                                       <td>
-                                                       <?php 
-                                                       $itext=new IText('npj');
-                                                       
$itext->value=strip_tags($obj->det->jr_pj_number);
-                                                       echo 
td(_('Pièce')).td($itext->input());
-                                                       ?>
-                                                       </td>
-                                                       <tr>
-                                                       <td>
-                                                       <?php 
-                                                         $itext=new 
IText('lib');
-                                                         
$itext->value=strip_tags($obj->det->jr_comment);
-                                                         $itext->size=40;
-                                                       echo 
td(_('Libellé')).td($itext->input(),' colspan="2" ');
+                            </td>
+                        </tr>
+                    </table>
+                </td>
+            </tr>
 
+        </table>
+        <div class="myfieldset">
+            <h1 class="legend"><?php echo _('Détail') ?></h1>
+            <table class="result">
+                <?php
+                bcscale(2);
+                $total_htva = 0;
+                $total_tvac = 0;
+                echo th(_('Quick Code'));
+                echo th(_('Description'));
+                if ($owner->MY_TVA_USE == 'Y')
+                {
+                    echo th(_('Taux TVA'), 'style="text-align:right"');
+                } else
+                {
+                    echo th('');
+                }
+                echo th(_('Prix/Un.'), 'style="text-align:right"');
+                echo th(_('Quantité'), 'style="text-align:right"');
+                echo th(_('Non ded'), 'style="text-align:right"');
 
-                                                       ?>
-                                                       </td>
-                                                       </tr>
-                                                           <tr>
-                                                                               
                                           <td></td>
-                                                            <td>Payé</td>
-                                                            <td>
-                                                                <?php 
-                                                                $ipaid=new 
ICheckBox("ipaid",'paid');
-                                                                
$ipaid->selected=($obj->det->jr_rapt=='paid');
-                                                                echo 
$ipaid->input();
-                                                                ?>
-                                                            </td>
-                                                        </tr>
-                               </table>
-                               </td><td>
-                               <table style="border:solid 1px yellow">
-                               <tr>
-                               <td>
-                                       Note
-                               </td></tr>
-                               <tr>
-                               <td>
-                               <?php 
-                               $inote=new ITextarea('jrn_note');
-                               $inote->width=25;
-                               $inote->heigh=5;
-                               $inote->value=strip_tags($obj->det->note);
-                               echo $inote->input();
-                               ?>
+                if ($owner->MY_TVA_USE == 'Y')
+                {
+                    echo th(_('HTVA'), 'style="text-align:right"');
+                    echo th(_('TVA'), 'style="text-align:right"');
+                    echo th(_('TVAC'), 'style="text-align:right"');
+                } else
+                    echo th(_('Total'), 'style="text-align:right"');
 
-                               </td>
-                               </tr>
-                               </table>
-                               </td>
-                               </tr>
+                if ($owner->MY_ANALYTIC != 'nu' && $div == 'popup')
+                {
+                    $anc = new Anc_Plan($cn);
+                    $a_anc = $anc->get_list(' order by pa_id ');
+                    $x = count($a_anc);
+                    /* set the width of the col */
+                    echo '<th colspan="' . $x . '">' . _('Compt. Analytique') 
. '</th>';
 
-</table>
-<div class="myfieldset">
-       <h1 class="legend"><?php echo _('Détail')?></h1>
-<table class="result">
-<?php 
-  bcscale(2);
-  $total_htva=0;$total_tvac=0;
-  echo th(_('Quick Code'));
-echo th(_('Description'));
-if ( $owner->MY_TVA_USE == 'Y') {
-  echo th(_('Taux TVA'), 'style="text-align:right"');
-} else {
-  echo th('');
-}
-echo th(_('Prix/Un.'), 'style="text-align:right"');
-echo th(_('Quantité'), 'style="text-align:right"');
-echo th(_('Non ded'), 'style="text-align:right"');
+                    /* add hidden variables pa[] to hold the value of pa_id */
+                    echo Anc_Plan::hidden($a_anc);
+                }
+                echo '</tr>';
+                for ($e = 0; $e < count($obj->det->array); $e++)
+                {
+                    $row = '';
+                    $q = $obj->det->array[$e];
+                    $fiche = new Fiche($cn, $q['qp_fiche']);
+                    $view_card_detail = 
HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE), "", ' 
class="line" ');
+                    $row = td($view_card_detail);
+                    $sym_tva = '';
 
-if ( $owner->MY_TVA_USE == 'Y') {
-  echo th(_('HTVA'), 'style="text-align:right"');
-  echo th(_('TVA'), 'style="text-align:right"');
-  echo th(_('TVAC'), 'style="text-align:right"');
-}else
-  echo th(_('Total'), 'style="text-align:right"');
+                    if ($owner->MY_TVA_USE == 'Y' && $q['qp_vat_code'] != '')
+                    {
+                        /* retrieve TVA symbol */
+                        $tva = new Acc_Tva($cn, $q['qp_vat_code']);
+                        $tva->load();
+                        $sym_tva = h($tva->get_parameter('label'));
+                    }
+                    if ($owner->MY_UPDLAB == 'Y')
+                    {
+                        $l_lib = ($q['j_text'] == '') ? 
$fiche->strAttribut(ATTR_DEF_NAME) : $q['j_text'];
+                        $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
+                        $input = new IText("e_march" . $q['j_id'] . "_label", 
$l_lib);
+                        $input->css_size = "100%";
+                    } else
+                    {
+                        $input = new ISpan("e_march" . $q['j_id'] . "_label");
+                        $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
+                        $input->value = $fiche->strAttribut(ATTR_DEF_NAME);
+                    }
+                    $row.=td($input->input() . $hidden);
+                    $row.=td($sym_tva, 'style="text-align:center"');
+                    $pu = 0;
+                    if ($q['qp_quantite'] != 0)
+                        $pu = bcdiv($q['qp_price'], $q['qp_quantite']);
+                    $row.=td(nbm($pu), 'class="num"');
+                    $row.=td(nbm($q['qp_quantite']), 'class="num"');
 
-    if ($owner->MY_ANALYTIC != 'nu' && $div=='popup'){
-      $anc=new Anc_Plan($cn);
-      $a_anc=$anc->get_list(' order by pa_id ');
-      $x=count($a_anc);
-      /* set the width of the col */
-      echo '<th colspan="'.$x.'">'._('Compt. Analytique').'</th>';
+                    $no_ded = bcadd($q['qp_dep_priv'], $q['qp_nd_amount']);
+                    $row.=td(nbm($no_ded), ' style="text-align:right"');
+                    $htva = $q['qp_price'];
 
-      /* add hidden variables pa[] to hold the value of pa_id */
-      echo Anc_Plan::hidden($a_anc);
-    }
-echo '</tr>';
-  for ($e=0;$e<count($obj->det->array);$e++) {
-    $row='';
-    $q=$obj->det->array[$e];
-    $fiche=new Fiche($cn,$q['qp_fiche']);
-       
$view_card_detail=HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE),"",
 ' class="line" ');
-   $row=td($view_card_detail);
-   $sym_tva='';
 
-   if ( $owner->MY_TVA_USE=='Y' && $q['qp_vat_code'] != '') {
-     /* retrieve TVA symbol */
-     $tva=new Acc_Tva($cn,$q['qp_vat_code']);
-     $tva->load();
-     $sym_tva=h($tva->get_parameter('label'));
-   }
-   if ($owner->MY_UPDLAB == 'Y')
-    {
-        $l_lib = ($q['j_text'] == '') ? $fiche->strAttribut(ATTR_DEF_NAME) : 
$q['j_text'];
-        $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
-        $input = new IText("e_march" . $q['j_id'] . "_label", $l_lib);
-        $input->css_size="100%";
-    }
-    else
-    {
-        $input = new ISpan("e_march" . $q['j_id'] . "_label");
-        $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
-        $input->value = $fiche->strAttribut(ATTR_DEF_NAME);
-    }
-    $row.=td($input->input().$hidden);
-    $row.=td($sym_tva,'style="text-align:center"');
-       $pu=0;
-       if ( $q['qp_quantite'] != 0 ) 
$pu=bcdiv($q['qp_price'],$q['qp_quantite']);
-    $row.=td(nbm($pu),'class="num"');
-    $row.=td(nbm($q['qp_quantite']),'class="num"');
+                    $row.=td(nbm($htva), 'class="num"');
+                    $tvac = bcadd($htva, $q['qp_vat']);
+                    $tvac = bcadd($tvac, $q['qp_nd_tva']);
+                    $tvac = bcadd($tvac, $q['qp_nd_tva_recup']);
 
-    $no_ded=bcadd($q['qp_dep_priv'],$q['qp_nd_amount']);
-    $row.=td(nbm($no_ded),' style="text-align:right"');
-    $htva=$q['qp_price'];
 
+                    if ($owner->MY_TVA_USE == 'Y')
+                    {
+                        $tva_amount = bcadd($q['qp_vat'], $q['qp_nd_tva']);
+                        $tva_amount = bcadd($tva_amount, 
$q['qp_nd_tva_recup']);
+                        $class = "";
+                        if ($q['qp_vat_sided'] <> 0)
+                        {
+                            $class = ' style="text-decoration:line-through"';
+                            $tvac = bcsub($tvac, $q['qp_vat']);
+                        }
+                        $row.=td(nbm($tva_amount), 'class="num" ' . $class);
+                        $row.=td(nbm($tvac), 'class="num"');
+                    }
+                    $total_tvac+=$tvac;
+                    $total_htva+=$htva;
+                    /* Analytic accountancy */
+                    if ($owner->MY_ANALYTIC != "nu" && $div == 'popup')
+                    {
+                        $poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
+                        if (preg_match('/^(6|7)/', $poste))
+                        {
+                            $anc_op = new Anc_Operation($cn);
+                            $anc_op->j_id = $q['j_id'];
+                            echo HtmlInput::hidden('op[]', $anc_op->j_id);
+                            /* compute total price */
+                            bcscale(2);
 
-    $row.=td(nbm($htva),'class="num"');
-    $tvac=bcadd($htva,$q['qp_vat']);
-    $tvac=bcadd($tvac,$q['qp_nd_tva']);
-    $tvac=bcadd($tvac,$q['qp_nd_tva_recup']);
+                            $row.=$anc_op->display_table(1, $htva, $div);
+                        } else
+                        {
+                            $row.=td('');
+                        }
+                    }
+                    echo tr($row);
+                }
+                if ($owner->MY_TVA_USE == 'Y')
+                    $row = td(_('Total'), ' 
style="font-style:italic;text-align:right;font-weight: bolder;width:auto" 
colspan="6"');
+                else
+                    $row = td(_('Total'), ' 
style="font-style:italic;text-align:right;font-weight: bolder;width:auto" 
colspan="6"');
+                $row.=td(nbm($total_htva), 'class="num" 
style="font-style:italic;font-weight: bolder;"');
+                if ($owner->MY_TVA_USE == 'Y')
+                    $row.=td("") . td(nbm($total_tvac), 'class="num" 
style="font-style:italic;font-weight: bolder;"');
+                echo tr($row);
+                ?>
+            </table>
 
 
-    if ($owner->MY_TVA_USE=='Y')
-      {
-               $tva_amount=bcadd($q['qp_vat'],$q['qp_nd_tva']);
-               $tva_amount=bcadd($tva_amount,$q['qp_nd_tva_recup']);
-               $class="";
-               if ($q['qp_vat_sided']<>0) {
-                       $class=' style="text-decoration:line-through"';
-                       $tvac=bcsub($tvac,$q['qp_vat']);
-               }
-               $row.=td(nbm($tva_amount),'class="num" '.$class);
-               $row.=td(nbm($tvac),'class="num"');
-      }
-    $total_tvac+=$tvac;
-    $total_htva+=$htva;
-    /* Analytic accountancy */
-    if ( $owner->MY_ANALYTIC != "nu" && $div == 'popup'){
-      $poste=$fiche->strAttribut(ATTR_DEF_ACCOUNT);
-      if ( preg_match('/^(6|7)/',$poste)) {
-       $anc_op=new Anc_Operation($cn);
-       $anc_op->j_id=$q['j_id'];
-       echo HtmlInput::hidden('op[]',$anc_op->j_id);
-       /* compute total price */
-       bcscale(2);
+        </div>
+        <div class="myfieldset">
+            <h1 class="legend"><?php echo _('Ecritures comptables') ?></h1>
 
-       $row.=$anc_op->display_table(1,$htva,$div);
 
-      }  else {
-       $row.=td('');
-      }
-    }
-    echo tr($row);
+            <?php
+            /* if it is not in a popup, the details are hidden */
+            if ($div != 'popup')
+            {
+                $ib = new IButton("a" . $div);
+                $ib->label = 'Afficher';
+                $ib->javascript = "g('detail_" . $div . 
"').style.display='block';g('a" . $div . "').style.display='none';";
+                echo $ib->input();
+                echo '<div id="detail_' . $div . '" class="content" 
style="display:none">';
+                $ib = new IButton("h" . $div);
+                $ib->label = 'Cacher';
+                $ib->javascript = "g('detail_" . $div . 
"').style.display='none';g('a" . $div . "').style.display='block';";
+                echo $ib->input();
+            } else
+                echo '<div class="content">';
+            $detail = new Acc_Misc($cn, $obj->jr_id);
+            $detail->get();
+            ?>
+            <table class="result">
+                <tr>
+                    <?php
+                    echo th(_('Poste Comptable'));
+                    echo th(_('Quick Code'));
+                    echo th(_('Libellé'));
+                    echo th(_('Débit'), ' style="text-align:right"');
+                    echo th(_('Crédit'), ' style="text-align:right"');
+                    echo '</tr>';
+                    for ($e = 0; $e < count($detail->det->array); $e++)
+                    {
+                        $row = '';
+                        $q = $detail->det->array;
+                        $view_history = sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>', 
$q[$e]['j_poste'], $gDossier, $q[$e]['j_poste']);
 
-  }
-  if ($owner->MY_TVA_USE=='Y')
-         $row= td(_('Total'),' 
style="font-style:italic;text-align:right;font-weight: bolder;width:auto" 
colspan="6"');
-  else
-         $row= td(_('Total'),' 
style="font-style:italic;text-align:right;font-weight: bolder;width:auto" 
colspan="6"');
-$row.=td(nbm($total_htva),'class="num" style="font-style:italic;font-weight: 
bolder;"');
-if ($owner->MY_TVA_USE=='Y')
-  $row.=td("").td(nbm($total_tvac),'class="num" 
style="font-style:italic;font-weight: bolder;"');
-echo tr($row);
-?>
-</table>
-
-
+                        $row.=td($view_history);
+                        if ($q[$e]['j_qcode'] != '')
+                        {
+                            $fiche = new Fiche($cn);
+                            $fiche->get_by_qcode($q[$e]['j_qcode']);
+                            $view_history = sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>', $fiche->id, 
$gDossier, $q[$e]['j_qcode']);
+                        } else
+                            $view_history = '';
+                        $row.=td($view_history);
+                        /* $row=td($q[$e]['j_poste']); */
+                        /* $row.=td($q[$e]['j_qcode']); */
+                        if ($q[$e]['j_qcode'] != '')
+                        {
+                            // nom de la fiche
+                            $ff = new Fiche($cn);
+                            $ff->get_by_qcode($q[$e]['j_qcode']);
+                            $row.=td($ff->strAttribut(h(ATTR_DEF_NAME)));
+                        } else
+                        {
+                            // libellé du compte
+                            $name = $cn->get_value('select pcm_lib from 
tmp_pcmn where pcm_val=$1', array($q[$e]['j_poste']));
+                            $row.=td(h($name));
+                        }
+                        $montant = td(nbm($q[$e]['j_montant']), 'class="num"');
+                        $row.=($q[$e]['j_debit'] == 't') ? $montant : td('');
+                        $row.=($q[$e]['j_debit'] == 'f') ? $montant : td('');
+                        echo tr($row);
+                    }
+                    ?>
+            </table>
+        </div>
 </div>
-       <div class="myfieldset">
-       <h1 class="legend"><?php echo _('Ecritures comptables')?></h1>
 
-
-<?php 
-  /* if it is not in a popup, the details are hidden */
-  if ( $div != 'popup') {
-    $ib=new IButton ("a".$div);
-    $ib->label='Afficher';
-    
$ib->javascript="g('detail_".$div."').style.display='block';g('a".$div."').style.display='none';";
-    echo $ib->input();
-    echo '<div id="detail_'.$div.'" class="content" style="display:none">';
-    $ib=new IButton ("h".$div);
-    $ib->label='Cacher';
-    
$ib->javascript="g('detail_".$div."').style.display='none';g('a".$div."').style.display='block';";
-    echo $ib->input();
-  } else
-    echo '<div class="content">';
-$detail=new Acc_Misc($cn,$obj->jr_id);
-$detail->get();
-?>
-<table class="result">
-<tr>
-<?php 
- echo th(_('Poste Comptable'));
-    echo th(_('Quick Code'));
-    echo th(_('Libellé'));
-echo th(_('Débit'),' style="text-align:right"');
-echo th(_('Crédit'),' style="text-align:right"');
-echo '</tr>';
-  for ($e=0;$e<count($detail->det->array);$e++) {
-    $row=''; $q=$detail->det->array;
-   $view_history= sprintf('<A class="detail" style="text-decoration:underline" 
HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>',
-                          $q[$e]['j_poste'], $gDossier, $q[$e]['j_poste']);
-
-    $row.=td($view_history);
-    if ( $q[$e]['j_qcode'] !=''){
-      $fiche=new Fiche($cn);
-      $fiche->get_by_qcode($q[$e]['j_qcode']);
-      $view_history= sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
-                            $fiche->id,$gDossier, $q[$e]['j_qcode']);
-    }
-    else
-      $view_history='';
-    $row.=td($view_history);
-    /* $row=td($q[$e]['j_poste']); */
-    /* $row.=td($q[$e]['j_qcode']); */
-    if ( $q[$e]['j_qcode'] !='') {
-      // nom de la fiche
-      $ff=new Fiche($cn);
-      $ff->get_by_qcode( $q[$e]['j_qcode']);
-      $row.=td($ff->strAttribut(h(ATTR_DEF_NAME)));
-    } else {
-      // libellé du compte
-      $name=$cn->get_value('select pcm_lib from tmp_pcmn where 
pcm_val=$1',array($q[$e]['j_poste']));
-      $row.=td(h($name));
-    }
-    $montant=td(nbm($q[$e]['j_montant']),'class="num"');
-    $row.=($q[$e]['j_debit']=='t')?$montant:td('');
-    $row.=($q[$e]['j_debit']=='f')?$montant:td('');
-    echo tr($row);
-
-  }
-?>
-</table>
-</div>
-</div>
-
-<?php 
+<?php
 require_once('ledger_detail_bottom.php');
 ?>
 </div>

Modified: phpcompta/trunk/include/template/ledger_detail_ven.php
===================================================================
--- phpcompta/trunk/include/template/ledger_detail_ven.php      2013-10-19 
20:28:13 UTC (rev 5517)
+++ phpcompta/trunk/include/template/ledger_detail_ven.php      2013-10-20 
19:13:26 UTC (rev 5518)
@@ -1,295 +1,312 @@
 <?php require_once('template/ledger_detail_top.php'); ?>
 <div class="content" style="padding:0;">
-<?php 
-  require_once('class_own.php');
-  $owner=new Own($cn);
-?>
+    <?php
+    require_once('class_own.php');
+    $owner = new Own($cn);
+    ?>
 
-    <?php if ( $access=='W') : ?>
-<form class="print" onsubmit="return op_save(this);">
-   <?php endif; ?>
+    <?php if ($access == 'W') : ?>
+        <form class="print" onsubmit="return op_save(this);">
+        <?php endif; ?>
 
-    <?php echo 
HtmlInput::hidden('whatdiv',$div).HtmlInput::hidden('jr_id',$jr_id).dossier::hidden();?>
-  <table style="width:100%">
-  <tr><td>
-                                               <table>
-                                               <tr><td>
-                                               <?php
-                                               $date=new IDate('p_date');
-                                               
$date->value=format_date($obj->det->jr_date);
-                                                echo 
td('Date').td($date->input());
+        <?php echo HtmlInput::hidden('whatdiv', $div) . 
HtmlInput::hidden('jr_id', $jr_id) . dossier::hidden(); ?>
+        <table style="width:100%">
+            <tr><td>
+                    <table>
+                        <tr>
+                            
+                                <?php
+                                $date = new IDate('p_date');
+                                $date->value = format_date($obj->det->jr_date);
+                                echo td('Date') . td($date->input());
+                                ?>
+                        </tr>
+                        <tr>
+                                <?php
+                                $date_ech = new IDate('p_ech');
+                                $date_ech->value = 
format_date($obj->det->jr_ech);
+                                echo td('Echeance') . td($date_ech->input());
+                                ?>
+                                                    <tr>
+                            <td></td>
+                            <td>
+                                Date paiement
+                            </td>
+                            <td>
+<?php
+$date_paid = new IDate('p_date_paid');
+$date_paid->value = format_date($obj->det->jr_date_paid);
+echo $date_paid->input();
+?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>
+<?php
+$bk = new Fiche($cn, $obj->det->array[0]['qs_client']);
+echo td(_('Client'));
 
-                                                ?>
-                                                </td>
-                                               </tr>
-                                                                               
<tr>
-                                                       <td>
-                                                       <?php
-                                                       $date_ech=new 
IDate('p_ech');
-                                                       
$date_ech->value=format_date($obj->det->jr_ech);
-                                                        echo 
td('Echeance').td($date_ech->input());
+$view_card_detail = HtmlInput::card_detail($bk->get_quick_code(), 
h($bk->getName()), ' class="line" ');
+echo td($view_card_detail);
+?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>
+<?php
+$itext = new IText('npj');
+$itext->value = strip_tags($obj->det->jr_pj_number);
+echo td(_('Pièce')) . td($itext->input());
+?>
+                            </td>
+                        <tr>
+                            <td>
+<?php
+$itext = new IText('lib');
+$itext->value = strip_tags($obj->det->jr_comment);
+$itext->size = 40;
+echo td(_('Libellé')) . td($itext->input(), ' colspan="2" ');
+?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td></td>
+                            <td>Payé</td>
+                            <td>
+<?php
+$ipaid = new ICheckBox("ipaid", 'paid');
+$ipaid->selected = ($obj->det->jr_rapt == 'paid');
+echo $ipaid->input();
+?>
+                            </td>
+                        </tr>
 
-                                                        ?>
-                                                       </td>
-                                               <tr>
-                                               <td>
-                                               <?php 
-                                               $bk=new 
Fiche($cn,$obj->det->array[0]['qs_client']);
-                                               echo td(_('Client'));
+                    </table>
+                </td>
+                <td style='width:50%'>
+                    <table style="width:100%;border:solid 1px yellow">
+                        <tr>
+                            <td>
+                                Note
+                            </td></tr>
+                        <tr>
+                            <td>
+<?php
+$inote = new ITextarea('jrn_note');
+$inote->width = 25;
+$inote->heigh = 5;
+$inote->value = strip_tags($obj->det->note);
+echo $inote->input();
+?>
 
-                                               
$view_card_detail=HtmlInput::card_detail($bk->get_quick_code(),h($bk->getName()),
 ' class="line" ');
-                                                       echo 
td($view_card_detail);
-                                               ?>
-                                               </td>
-                                               </tr>
-                                               <tr>
-                                               <td>
-                                               <?php 
-                                               $itext=new IText('npj');
-                                               
$itext->value=strip_tags($obj->det->jr_pj_number);
-                                               echo 
td(_('Pièce')).td($itext->input());
-                                               ?>
-                                               </td>
-                                               <tr>
-                                               <td>
-                                               <?php 
-                                                 $itext=new IText('lib');
-                                                 
$itext->value=strip_tags($obj->det->jr_comment);
-                                                 $itext->size=40;
-                                               echo 
td(_('Libellé')).td($itext->input(),' colspan="2" ');
+                            </td>
+                        </tr>
+                    </table>
+                </td>
+            </tr>
+        </table>
+        <div class="myfieldset">
+            <h1 class="legend">
+<?php echo _('Détail') ?>
+            </h1>
+            <table class="result">
+                <?php
+                bcscale(2);
+                $total_htva = 0;
+                $total_tvac = 0;
+                echo th(_('Quick Code'));
+                echo th(_('Description'));
+                echo th(_('Prix/Un'), 'style="text-align:right"');
+                echo th(_('Quantité'), 'style="text-align:right"');
+                if ($owner->MY_TVA_USE == 'Y')
+                    echo th(_('Taux TVA'), 'style="text-align:right"');
+                else
+                    echo th('');
+                if ($owner->MY_TVA_USE == 'Y')
+                {
+                    echo th(_('HTVA'), 'style="text-align:right"');
+                    echo th(_('TVA'), 'style="text-align:right"');
+                    echo th(_('TVAC'), 'style="text-align:right"');
+                } else
+                    echo th(_('Total'), 'style="text-align:right"');
 
+                if ($owner->MY_ANALYTIC != 'nu' && $div == 'popup')
+                {
+                    $anc = new Anc_Plan($cn);
+                    $a_anc = $anc->get_list(" order by pa_id ");
+                    $x = count($a_anc);
+                    /* set the width of the col */
+                    echo '<th colspan="' . $x . '">' . _('Compt. Analytique') 
. '</th>';
 
-                                               ?>
-                                               </td>
-                                               </tr>
-                                               <tr>
-                                                                               
                   <td></td>
-                                                        <td>Payé</td>
-                                                        <td>
-                                                            <?php 
-                                                            $ipaid=new 
ICheckBox("ipaid",'paid');
-                                                            
$ipaid->selected=($obj->det->jr_rapt=='paid');
-                                                            echo 
$ipaid->input();
-                                                            ?>
-                                                        </td>
-                                                    </tr>
-                                               </table>
-</td>
-<td style='width:50%'>
-                       <table style="width:100%;border:solid 1px yellow">
-                       <tr>
-                       <td>
-                               Note
-                       </td></tr>
-                       <tr>
-                       <td>
-                       <?php 
-                       $inote=new ITextarea('jrn_note');
-                       $inote->width=25;
-                       $inote->heigh=5;
-                       $inote->value=strip_tags($obj->det->note);
-                       echo $inote->input();
-                       ?>
+                    /* add hidden variables pa[] to hold the value of pa_id */
+                    echo Anc_Plan::hidden($a_anc);
+                }
 
-                       </td>
-                       </tr>
-                       </table>
-</td>
-</tr>
-</table>
-<div class="myfieldset">
-       <h1 class="legend">
-<?php echo _('Détail')?>
-       </h1>
-<table class="result">
-<?php 
-  bcscale(2);
-  $total_htva=0;$total_tvac=0;
-  echo th(_('Quick Code'));
-echo th(_('Description'));
-echo th(_('Prix/Un'), 'style="text-align:right"');
-echo th(_('Quantité'), 'style="text-align:right"');
-if ( $owner->MY_TVA_USE == 'Y')
-  echo th(_('Taux TVA'), 'style="text-align:right"');
-else
-  echo th('');
-if ( $owner->MY_TVA_USE == 'Y') {
-  echo th(_('HTVA'), 'style="text-align:right"');
-  echo th(_('TVA'), 'style="text-align:right"');
-  echo th(_('TVAC'), 'style="text-align:right"');
-} else
-  echo th(_('Total'), 'style="text-align:right"');
+                echo '</tr>';
+                for ($e = 0; $e < count($obj->det->array); $e++)
+                {
+                    $row = '';
+                    $q = $obj->det->array[$e];
+                    $fiche = new Fiche($cn, $q['qs_fiche']);
+                    $view_card_detail = 
HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE), "", ' 
class="line" ');
+                    $row.=td($view_card_detail);
+                    if ($owner->MY_UPDLAB == 'Y')
+                    {
+                        $l_lib = ($q['j_text'] == '') ? 
$fiche->strAttribut(ATTR_DEF_NAME) : $q['j_text'];
+                        $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
+                        $input = new IText("e_march" . $q['j_id'] . "_label", 
$l_lib);
+                        $input->css_size = "100%";
+                    } else
+                    {
+                        $input = new ISpan("e_march" . $q['j_id'] . "_label");
+                        $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
+                        $input->value = $fiche->strAttribut(ATTR_DEF_NAME);
+                    }
 
-    if ($owner->MY_ANALYTIC != 'nu' && $div == 'popup'){
-      $anc=new Anc_Plan($cn);
-      $a_anc=$anc->get_list(" order by pa_id ");
-      $x=count($a_anc);
-      /* set the width of the col */
-      echo '<th colspan="'.$x.'">'._('Compt. Analytique').'</th>';
+                    $row.=td($input->input() . $hidden);
+                    $sym_tva = '';
+                    $pu = 0;
+                    if ($q['qs_quantite'] != 0)
+                        $pu = bcdiv($q['qs_price'], $q['qs_quantite']);
+                    $row.=td(nbm($pu), 'class="num"');
+                    $row.=td(nbm($q['qs_quantite']), 'class="num"');
+                    $sym_tva = '';
+                    if ($owner->MY_TVA_USE == 'Y' && $q['qs_vat_code'] != '')
+                    {
+                        /* retrieve TVA symbol */
+                        $tva = new Acc_Tva($cn, $q['qs_vat_code']);
+                        $tva->load();
+                        $sym_tva = (h($tva->get_parameter('label')));
+                        //     $sym_tva=$sym
+                    }
 
-      /* add hidden variables pa[] to hold the value of pa_id */
-      echo Anc_Plan::hidden($a_anc);
-    }
+                    $row.=td($sym_tva, 'style="text-align:center"');
 
-echo '</tr>';
-  for ($e=0;$e<count($obj->det->array);$e++) {
-    $row='';
-    $q=$obj->det->array[$e];
-    $fiche=new Fiche($cn,$q['qs_fiche']);
-       
$view_card_detail=HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE),"",
 ' class="line" ');
-       $row.=td($view_card_detail);
-       if ($owner->MY_UPDLAB == 'Y')
-    {
-        $l_lib = ($q['j_text'] == '') ? $fiche->strAttribut(ATTR_DEF_NAME) : 
$q['j_text'];
-        $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
-        $input = new IText("e_march" . $q['j_id'] . "_label", $l_lib);
-        $input->css_size="100%";
-    }
-    else
-    {
-        $input = new ISpan("e_march" . $q['j_id'] . "_label");
-        $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
-        $input->value = $fiche->strAttribut(ATTR_DEF_NAME);
-    }
+                    $htva = $q['qs_price'];
 
-    $row.=td($input->input().$hidden);
-    $sym_tva='';
-       $pu=0;
-       if ($q['qs_quantite'] != 0)     
$pu=bcdiv($q['qs_price'],$q['qs_quantite']);
-    $row.=td(nbm($pu),'class="num"');
-    $row.=td(nbm($q['qs_quantite']),'class="num"');
-       $sym_tva='';
-   if ( $owner->MY_TVA_USE=='Y' && $q['qs_vat_code'] != '') {
-     /* retrieve TVA symbol */
-     $tva=new Acc_Tva($cn,$q['qs_vat_code']);
-     $tva->load();
-     $sym_tva=(h($tva->get_parameter('label')));
-     //     $sym_tva=$sym
-   }
+                    $row.=td(nbm($htva), 'class="num"');
+                    $tvac = bcadd($htva, $q['qs_vat']);
+                    if ($owner->MY_TVA_USE == 'Y')
+                    {
+                        $class = "";
+                        if ($q['qs_vat_sided'] != 0)
+                        {
+                            $class = ' style="text-decoration:line-through"';
+                            $tvac = bcsub($tvac, $q['qs_vat']);
+                        }
+                        $row.=td(nbm($q['qs_vat']), 'class="num"' . $class);
+                        $row.=td(nbm($tvac), 'class="num"');
+                    }
+                    $total_tvac = bcadd($total_tvac, $tvac);
+                    $total_htva = bcadd($total_htva, $htva);
+                    /* Analytic accountancy */
+                    if ($owner->MY_ANALYTIC != "nu" && $div == 'popup')
+                    {
+                        $poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
+                        if (preg_match('/^(6|7)/', $poste))
+                        {
+                            $anc_op = new Anc_Operation($cn);
+                            $anc_op->j_id = $q['j_id'];
+                            echo HtmlInput::hidden('op[]', $anc_op->j_id);
+                            /* compute total price */
+                            bcscale(2);
 
-   $row.=td($sym_tva,'style="text-align:center"');
+                            $row.=$anc_op->display_table(1, $htva, $div);
+                        } else
+                        {
+                            $row.=td('');
+                        }
+                    }
+                    echo tr($row);
+                }
+                if ($owner->MY_TVA_USE == 'Y')
+                    $row = td(_('Total'), ' 
style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"');
+                else
+                    $row = td(_('Total'), ' 
style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"');
+                $row.=td(nbm($total_htva), 'class="num" 
style="font-style:italic;font-weight: bolder;"');
+                if ($owner->MY_TVA_USE == 'Y')
+                    $row.=td("") . td(nbm($total_tvac), 'class="num" 
style="font-style:italic;font-weight: bolder;"');
+                echo tr($row);
+                ?>
+            </table>
+            </td>
+            </tr>
+            </table>
+            </td>
+            </tr>
+            </table>
+        </div>
+        <div class="myfieldset">
+            <h1 class="legend">
+            <?php echo _('Ecritures comptables') ?>
+            </h1>
+            <?php
+            /* if it is not in a popup, the details are hidden */
+            if ($div != 'popup')
+            {
+                $ib = new IButton("a" . $div);
+                $ib->label = 'Afficher';
+                $ib->javascript = "g('detail_" . $div . 
"').style.display='block';g('a" . $div . "').style.display='none';";
+                echo $ib->input();
+                echo '<div id="detail_' . $div . '" style="display:none">';
+                $ib = new IButton("h" . $div);
+                $ib->label = 'Cacher';
+                $ib->javascript = "g('detail_" . $div . 
"').style.display='none';g('a" . $div . "').style.display='block';";
+                echo $ib->input();
+            } else
+                echo '<div>';
 
-    $htva=$q['qs_price'];
+            $detail = new Acc_Misc($cn, $obj->jr_id);
+            $detail->get();
+            ?>
 
-    $row.=td(nbm($htva),'class="num"');
-    $tvac=bcadd($htva,$q['qs_vat']);
-    if ($owner->MY_TVA_USE=='Y')
-      {
-               $class="";
-               if ($q['qs_vat_sided'] != 0) {
-                       $class=' style="text-decoration:line-through"';
-                       $tvac=bcsub($tvac,$q['qs_vat']);
-               }
-               $row.=td(nbm($q['qs_vat']),'class="num"'.$class);
-               $row.=td(nbm($tvac),'class="num"');
-      }
-    $total_tvac=bcadd($total_tvac,$tvac);
-    $total_htva=bcadd($total_htva,$htva);
-    /* Analytic accountancy */
-    if ( $owner->MY_ANALYTIC != "nu" && $div == 'popup'){
-      $poste=$fiche->strAttribut(ATTR_DEF_ACCOUNT);
-      if ( preg_match('/^(6|7)/',$poste)) {
-       $anc_op=new Anc_Operation($cn);
-       $anc_op->j_id=$q['j_id'];
-       echo HtmlInput::hidden('op[]',$anc_op->j_id);
-       /* compute total price */
-       bcscale(2);
+            <table class="result">
+                <tr>
+                    <?php
+                    echo th(_('Poste Comptable'));
+                    echo th(_('Quick Code'));
+                    echo th(_('Libellé'));
+                    echo th(_('Débit'), ' style="text-align:right"');
+                    echo th(_('Crédit'), ' style="text-align:right"');
+                    echo '</tr>';
+                    for ($e = 0; $e < count($detail->det->array); $e++)
+                    {
+                        $row = '';
+                        $q = $detail->det->array[$e];
+                        $view_history = sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>', $q['j_poste'], 
$gDossier, $q['j_poste']);
 
-       $row.=$anc_op->display_table(1,$htva,$div);
+                        $row.=td($view_history);
+                        if ($q['j_qcode'] != '')
+                        {
+                            $fiche = new Fiche($cn);
+                            $fiche->get_by_qcode($q['j_qcode']);
+                            $view_history = sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>', $fiche->id, 
$gDossier, $q['j_qcode']);
+                        } else
+                            $view_history = '';
+                        $row.=td($view_history);
 
-      }  else {
-       $row.=td('');
-      }
-    }
-    echo tr($row);
-
-  }
-  if ($owner->MY_TVA_USE=='Y')
-       $row= td(_('Total'),' 
style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"');
-  else
-       $row= td(_('Total'),' 
style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"');
-$row.=td(nbm($total_htva),'class="num" style="font-style:italic;font-weight: 
bolder;"');
-if ($owner->MY_TVA_USE=='Y')
-  $row.=td("").td(nbm($total_tvac),'class="num" 
style="font-style:italic;font-weight: bolder;"');
-echo tr($row);
-?>
-</table>
-</td>
-</tr>
-</table>
-</td>
-</tr>
-</table>
+                        if ($q['j_qcode'] != '')
+                        {
+                            // nom de la fiche
+                            $ff = new Fiche($cn);
+                            $ff->get_by_qcode($q['j_qcode']);
+                            $row.=td($ff->strAttribut(h(ATTR_DEF_NAME)));
+                        } else
+                        {
+                            // libellé du compte
+                            $name = $cn->get_value('select pcm_lib from 
tmp_pcmn where pcm_val=$1', array($q['j_poste']));
+                            $row.=td(h($name));
+                        }
+                        $montant = td(nbm($q['j_montant']), 'class="num"');
+                        $row.=($q['j_debit'] == 't') ? $montant : td('');
+                        $row.=($q['j_debit'] == 'f') ? $montant : td('');
+                        echo tr($row);
+                    }
+                    ?>
+            </table>
+        </div>
 </div>
-<div class="myfieldset">
-       <h1 class="legend">
-<?php echo _('Ecritures comptables')?>
-       </h1>
-       <?php 
-  /* if it is not in a popup, the details are hidden */
-  if ( $div != 'popup') {
-    $ib=new IButton ("a".$div);
-    $ib->label='Afficher';
-    
$ib->javascript="g('detail_".$div."').style.display='block';g('a".$div."').style.display='none';";
-    echo $ib->input();
-    echo '<div id="detail_'.$div.'" style="display:none">';
-    $ib=new IButton ("h".$div);
-    $ib->label='Cacher';
-    
$ib->javascript="g('detail_".$div."').style.display='none';g('a".$div."').style.display='block';";
-    echo $ib->input();
-  } else
-    echo '<div>';
-
-  $detail=new Acc_Misc($cn,$obj->jr_id);
-$detail->get();
-?>
-
-<table class="result">
-<tr>
-<?php 
- echo th(_('Poste Comptable'));
-    echo th(_('Quick Code'));
-    echo th(_('Libellé'));
-echo th(_('Débit'),' style="text-align:right"');
-echo th(_('Crédit'),' style="text-align:right"');
-echo '</tr>';
-  for ($e=0;$e<count($detail->det->array);$e++) {
-    $row=''; $q=$detail->det->array[$e];
-   $view_history= sprintf('<A class="detail" style="text-decoration:underline" 
HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>',
-                          $q['j_poste'], $gDossier, $q['j_poste']);
-
-    $row.=td($view_history);
-    if ( $q['j_qcode'] !=''){
-      $fiche=new Fiche($cn);
-      $fiche->get_by_qcode($q['j_qcode']);
-      $view_history= sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
-                            $fiche->id,$gDossier, $q['j_qcode']);
-    }
-    else
-      $view_history='';
-    $row.=td($view_history);
-
-    if ( $q['j_qcode'] !='') {
-      // nom de la fiche
-      $ff=new Fiche($cn);
-      $ff->get_by_qcode( $q['j_qcode']);
-      $row.=td($ff->strAttribut(h(ATTR_DEF_NAME)));
-    } else {
-      // libellé du compte
-      $name=$cn->get_value('select pcm_lib from tmp_pcmn where 
pcm_val=$1',array($q['j_poste']));
-      $row.=td(h($name));
-    }
-    $montant=td(nbm($q['j_montant']),'class="num"');
-    $row.=($q['j_debit']=='t')?$montant:td('');
-    $row.=($q['j_debit']=='f')?$montant:td('');
-    echo tr($row);
-
-  }
-?>
-</table>
-</div>
-</div>
-<?php 
+<?php
 require_once('ledger_detail_bottom.php');
 ?>
 </div>

Modified: phpcompta/trunk/include/template/print_ledger_simple.php
===================================================================
--- phpcompta/trunk/include/template/print_ledger_simple.php    2013-10-19 
20:28:13 UTC (rev 5517)
+++ phpcompta/trunk/include/template/print_ledger_simple.php    2013-10-20 
19:13:26 UTC (rev 5518)
@@ -2,6 +2,7 @@
     <tr>
         <th>Pièce</th>
         <th>Date</th>
+        <th>Paiement</th>
         <th>Ref</th>
         <th>Client / Fournisseur</th>
         <th>Description</th>
@@ -38,8 +39,9 @@
    
     $class = ($i % 2 == 0) ? ' class="even" ' : ' class="odd" ';
     echo "<tr $class>";
+    echo "<TD>" . h($line['jr_pj_number']) . "</TD>";
     echo "<TD>" . smaller_date($line['date']) . "</TD>";
-    echo "<TD>" . h($line['jr_pj_number']) . "</TD>";
+    echo "<TD>" . smaller_date($line['date_paid']) . "</TD>";
     echo "<TD>" . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . 
"</TD>";
     $tiers = $Jrn->get_tiers($line['jrn_def_type'], $line['jr_id']);
     echo td($tiers);



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

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