noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 67/323: Task #0001530: Réécriture PRINTJRN R


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 67/323: Task #0001530: Réécriture PRINTJRN Rename file template/acc_history_ledger_sale_oneline.php to template/acc_ledger_history_sale_oneline.php Manage PURCHASE - oneline,detailled , extended and accounting Adapt test file
Date: Wed, 14 Mar 2018 17:38:20 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 0708cd16caef2c2545afaee798b5c9db3a52ece1
Author: Dany De Bontridder <address@hidden>
Date:   Sun Jan 21 14:48:47 2018 +0100

    Task #0001530: Réécriture PRINTJRN
    Rename file template/acc_history_ledger_sale_oneline.php to 
template/acc_ledger_history_sale_oneline.php
    Manage PURCHASE - oneline,detailled , extended and accounting
    Adapt test file
---
 include/class/acc_ledger_history.class.php         |   8 +-
 .../class/acc_ledger_history_purchase.class.php    | 207 ++++++++++++++++++++-
 include/class/acc_ledger_history_sale.class.php    |  13 +-
 include/impress_jrn.inc.php                        |  10 +-
 ....php => acc_ledger_history_purchase_detail.php} |  38 ++--
 ...hp => acc_ledger_history_purchase_extended.php} |  22 ++-
 ...php => acc_ledger_history_purchase_oneline.php} |  71 +++----
 .../template/acc_ledger_history_sale_detail.php    |   2 +-
 .../template/acc_ledger_history_sale_extended.php  |   6 +-
 ...ine.php => acc_ledger_history_sale_oneline.php} |   2 +-
 scenario/acc_ledger_historyTest.php                |  20 +-
 11 files changed, 307 insertions(+), 92 deletions(-)

diff --git a/include/class/acc_ledger_history.class.php 
b/include/class/acc_ledger_history.class.php
index 61f0c1b..30b25da 100644
--- a/include/class/acc_ledger_history.class.php
+++ b/include/class/acc_ledger_history.class.php
@@ -26,6 +26,7 @@
  */
 require_once NOALYSS_INCLUDE."/class/acc_ledger_history_generic.class.php";
 require_once NOALYSS_INCLUDE."/class/acc_ledger_history_sale.class.php";
+require_once NOALYSS_INCLUDE."/class/acc_ledger_history_purchase.class.php";
 /**
  * @brief Display history of operation
  */
@@ -125,7 +126,7 @@ abstract class Acc_Ledger_History
     static function factory(Database $cn, $pa_ledger, $p_from, $p_to, $p_mode)
     {
         // For Accounting writing , we use Acc_Ledger_History
-        if ($p_mode=="E")
+        if ($p_mode=="A")
         {
             $ret=new Acc_Ledger_History_Generic($cn, $pa_ledger, $p_from, 
$p_to,
                     $p_mode);
@@ -236,8 +237,8 @@ abstract class Acc_Ledger_History
      */
     protected function prepare_reconcile_date()
     {
-        static $prepare=0;
-        if ($prepare==0)
+        $prepare=$this->db->is_prepare("reconcile_date");
+        if ($prepare==FALSE)
         {
             $this->db->prepare('reconcile_date',
                     'select  * 
@@ -256,7 +257,6 @@ abstract class Acc_Ledger_History
                                 from jrn_rapt 
                                 where jra_concerned=$1)');
         }
-        $prepare=1;
     }
     /**
      * display accounting of operations m_mode=A
diff --git a/include/class/acc_ledger_history_purchase.class.php 
b/include/class/acc_ledger_history_purchase.class.php
index 64b9b55..715ffa0 100644
--- a/include/class/acc_ledger_history_purchase.class.php
+++ b/include/class/acc_ledger_history_purchase.class.php
@@ -21,6 +21,209 @@
 
 /**
  * @file
- * @brief 
+ * @brief class Acc_Ledger_History_Purchase , list of operations
  */
-?>
+require_once NOALYSS_INCLUDE."/class/acc_ledger_history.class.php";
+
+/**
+ * @brief Display the operations for Purchase
+ */
+class Acc_Ledger_History_Purchase extends Acc_Ledger_History
+{
+
+    private $data; //!< Contains rows from SQL
+
+    public function __construct(\Database $cn, $pa_ledger, $p_from, $p_to,
+            $p_mode)
+    {
+        parent::__construct($cn, $pa_ledger, $p_from, $p_to, $p_mode);
+    }
+
+    /**
+     * @brief display the accounting 
+     */
+    public function export_accounting_html()
+    {
+        $ledger_history=new Acc_Ledger_History_Generic($this->db,
+                $this->ma_ledger, $this->m_from, $this->m_to, $this->m_mode);
+        $ledger_history->export_accounting_html();
+    }
+
+    public function export_detail_html()
+    {
+        $own=new Noalyss_Parameter_Folder($this->db);
+
+        $this->get_row();
+        $this->add_vat_info();
+        $this->prepare_reconcile_date();
+        include NOALYSS_TEMPLATE."/acc_ledger_history_purchase_detail.php";
+    }
+
+    public function export_extended_html()
+    {
+        $this->get_row();
+        $this->add_vat_info();
+        $this->prepare_detail();
+        $this->prepare_reconcile_date();
+        include NOALYSS_TEMPLATE."/acc_ledger_history_purchase_extended.php";
+    }
+
+    /**
+     * @brief display in HTML following the mode 
+     */
+    function export_html()
+    {
+        switch ($this->m_mode)
+        {
+            case "E":
+                $this->export_extended_html();
+                break;
+            case "D":
+                $this->export_detail_html();
+                break;
+            case "L":
+                $this->export_oneline_html();
+                break;
+            case "A":
+                $this->export_accounting_html();
+                break;
+            default:
+                break;
+        }
+    }
+
+    /**
+     * display in HTML one operation by line
+     */
+    public function export_oneline_html()
+    {
+        $this->get_row();
+        $this->prepare_reconcile_date();
+        require_once 
NOALYSS_TEMPLATE.'/acc_ledger_history_purchase_oneline.php';
+    }
+
+    /**
+     * Get the rows from jrnx and quant* tables
+     * @param int $p_limit max of rows to returns
+     * @param int $p_offset the number of rows to skip
+     */
+    public function get_row($p_limit=-1, $p_offset="")
+    {
+        $periode=sql_filter_per($this->db, $this->m_from, $this->m_to, 'p_id',
+                'jr_tech_per');
+
+        $cond_limite=($p_limit!=-1)?" limit ".$p_limit." offset ".$p_offset:"";
+
+        $ledger_list=join(",", $this->ma_ledger);
+        $sql="
+            with row_sale as 
+                (select qp_internal,
+                    qp_supplier,sum(qp_price) as novat,
+                    sum(qp_vat) as vat ,
+                    sum(qp_vat_sided) as tva_sided ,
+                    sum(qp_nd_amount) as noded_amount, 
+                    sum(qp_nd_tva) as noded_vat,
+                    sum(qp_dep_priv) as private_amount
+                 from 
+                    quant_purchase group by qp_supplier,qp_internal),
+              supplier_detail as (
+              select x.f_id as f_id,
+                (select ad_value from fiche_detail where ad_id=1 and 
f_id=x.f_id) as name,
+                (select ad_value from fiche_detail where ad_id=32 and 
f_id=x.f_id) as first_name,
+                (select ad_value from fiche_detail where ad_id=23 and 
f_id=x.f_id) as qcode
+              from 
+              fiche as x)
+            select   
+                    name,
+                    first_name,
+                    qcode,
+                    jr_id,
+                    jr_pj_number,
+                    jr_date,
+                    jr_date_paid,
+                    jr_internal,
+                    qp_supplier,
+                    jrn.jr_comment,
+                    jr_pj_name,
+                    vat,
+                    tva_sided,
+                    novat,
+                    noded_amount,
+                    noded_vat,
+                    private_amount,
+                    novat+vat-tva_sided as tvac
+            from
+                jrn
+                join row_sale on (qp_internal=jr_internal)
+                join supplier_detail on (qp_supplier=f_id)
+            where
+                jr_def_id in ({$ledger_list})
+                and {$periode}
+                {$cond_limite}";
+        $this->data=$this->db->get_array($sql);
+    }
+
+    /**
+     * @brief preprare the query for fetching the detailed VAT of an operation
+     * @staticvar int $prepare
+     */
+    private function add_vat_info()
+    {
+        $prepare=$this->db->is_prepare("vat_infop");
+        if ($prepare==0)
+        {
+            $this->db->prepare("vat_infop",
+                    "
+                select 
+                    sum(qp_vat) vat_amount , 
+                    qp_vat_code 
+                from 
+                    quant_purchase
+                where 
+                    qp_internal = $1 
+                group by qp_vat_code,qp_internal order by qp_vat_code");
+        }
+
+        $prepare=1;
+        $nb_row=count($this->data);
+        for ($i=0; $i<$nb_row; $i++)
+        {
+            $ret=$this->db->execute("vat_infop",
+                    array($this->data[$i]["jr_internal"]));
+            $array=Database::fetch_all($ret);
+            $this->data[$i]["detail_vat"]=$array;
+        }
+    }
+
+    /**
+     * Prepare the query for fetching detail of an operation
+     */
+    private function prepare_detail()
+    {
+
+        if ($this->db->is_prepare("detail_purchase")==FALSE)
+        {
+            $this->db->prepare("detail_purchase",
+                    "
+                with card_name as 
+                (select f_id,ad_value as name 
+                    from fiche_detail where ad_id=1),
+                card_qcode as  
+                (select f_id,ad_value as qcode 
+                from fiche_detail where ad_id=23)
+                select         
qp_price,qp_quantite,qp_vat,qp_vat_code,qp_unit,qp_vat_sided,name,qcode,tva_label,
+                qp_price+qp_vat-qp_vat_sided as tvac
+                from 
+                    quant_purchase
+                    join jrnx using (j_id)              
+                    join card_name on (card_name.f_id=qp_fiche)
+                    join card_qcode on (card_qcode.f_id=qp_fiche)
+                    join tva_rate on ( qp_vat_code=tva_id)
+                where
+                    qp_internal=$1
+                
+            ");
+        }
+    }
+
+}
diff --git a/include/class/acc_ledger_history_sale.class.php 
b/include/class/acc_ledger_history_sale.class.php
index 217b184..4f1b2f6 100644
--- a/include/class/acc_ledger_history_sale.class.php
+++ b/include/class/acc_ledger_history_sale.class.php
@@ -71,12 +71,11 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
     }
     /**
      * Prepare the query for fetching detail of an operation
-     * @staticvar int $prepare
      */
     private function prepare_detail()
     {
-        static $prepare=0;
-        if ( $prepare == 0) 
+        
+        if ( $this->db->is_prepare("detail_sale")== FALSE) 
         {
             $this->db->prepare("detail_sale","
                 with card_name as 
@@ -98,7 +97,6 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
                 
             ");
         }
-        $prepare=1;        
     }
     /**
      * Get the rows from jrnx and quant* tables
@@ -161,8 +159,8 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
      */
     private function add_vat_info()
     {
-        static $prepare=0;
-        if ( $prepare==0) {
+         $prepare=$this->db->is_prepare("vat_info");
+        if ( $prepare==FALSE) {
             $this->db->prepare("vat_info","
                 select 
                     sum(qs_vat) vat_amount , 
@@ -175,7 +173,6 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
              
         }
         
-        $prepare=1;
         $nb_row=count($this->data);
         for ($i=0;$i<$nb_row;$i++)
         {
@@ -215,7 +212,7 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
     {
         $this->get_row();
         $this->prepare_reconcile_date();
-        require_once NOALYSS_TEMPLATE.'/acc_history_ledger_sale_oneline.php';
+        require_once NOALYSS_TEMPLATE.'/acc_ledger_history_sale_oneline.php';
         
     }
 
diff --git a/include/impress_jrn.inc.php b/include/impress_jrn.inc.php
index f359495..a5b02b2 100644
--- a/include/impress_jrn.inc.php
+++ b/include/impress_jrn.inc.php
@@ -144,13 +144,15 @@ print td('Jusque ') . $w->input('to_periode', 
$periode_end);
 print "</TR><TR>";
 $a = array(
        array('value' => 'L', 'label' => _('Liste opérations')),
-       array('value' => 'E', 'label' => _('Ecriture comptable')),
-       array('value' => 'D', 'label' => _('Avec Détails opérations '))
+       array('value' => 'E', 'label' => _('Liste détaillées opérations ')),
+       array('value' => 'A', 'label' => _('Ecriture comptable')),
+       array('value' => 'D', 'label' => _('Détails TVA'))
 );
 $w->selected = 1;
 print '</TR>';
 print '<TR>';
-$w->selected = (isset($simple)) ? $simple : '1';
+$simple=$http->get("p_simple","string","L");
+$w->selected = $simple;
 echo '<td>Style d\'impression '.Icon_Action::infobulle(32).'</td>' . 
$w->input('p_simple', $a);
 print "</TR>";
 
@@ -169,7 +171,7 @@ echo '<hr>';
 if (isset($_REQUEST['bt_html']))
 {
     // Type of report : listing=1 , Accounting writing=0, detail =2
-    $simple=$http->get("p_simple","string");
+   
     $jrn_id=$http->get("jrn_id","number");
     
     /*
diff --git a/include/template/acc_ledger_history_sale_detail.php 
b/include/template/acc_ledger_history_purchase_detail.php
similarity index 76%
copy from include/template/acc_ledger_history_sale_detail.php
copy to include/template/acc_ledger_history_purchase_detail.php
index cfa9bf2..ea39c3f 100644
--- a/include/template/acc_ledger_history_sale_detail.php
+++ b/include/template/acc_ledger_history_purchase_detail.php
@@ -24,8 +24,7 @@ if (!defined('ALLOWED'))
 
 /**
  * @file
- * @brief from Acc_Ledger_History_Sale::export_html_oneline
- * @todo prévoir aussi pour les non assujetti : faire disparaître les montants 
TVA
+ * @brief Display one purchase operation on one line , with the sum of VAT, 
ND...
  */
 ?>
 <TABLE class="result">
@@ -34,9 +33,11 @@ if (!defined('ALLOWED'))
         <th><?php echo _("Date")?></th>
         <th><?php echo _("Paiement")?></th>
         <th><?php echo _("Ref")?></th>
-        <th><?php echo _("Client")?></th>
+        <th><?php echo _("Fournisseur")?></th>
         <th><?php echo _("Description")?></th>
         <th style="text-align:right">HTVA</th>
+        <th style="text-align:right">Privé</th>
+        <th style="text-align:right">DNA</th>
         
         
 <?php
@@ -44,6 +45,7 @@ $col_tva="";
 
  if ( $own->MY_TVA_USE=='Y')
         {
+            echo '<th style="text-align:right">TVA ND</th>';
             $a_Tva=$this->db->get_array("select tva_id,tva_label from tva_rate 
where tva_rate != 0.0000 order by tva_id");
             foreach($a_Tva as $line_tva)
             {
@@ -58,8 +60,8 @@ echo $col_tva;
 <?php
 $i = 0;
 $tot['htva']=0;
-$tot['dep_priv']=0;
-$tot['dna']=0;
+$tot['private_amount']=0;
+$tot['noded_amount']=0;
 $tot['tva_nd']=0;
 $tot['tvac']=0;
 $tot['tva']=array();
@@ -84,23 +86,34 @@ foreach ($this->data as $line) {
     echo "<TD>" . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . 
"</TD>";
     
     // find the tiers (normally in $Row ! 
-    $tiers =HtmlInput::history_card($line['qs_client'],h($line['name'].' 
'.$line['first_name'])."[{$line['qcode']}]");
-
+    $tiers =HtmlInput::history_card($line['qp_supplier'],h($line['name'].' 
'.$line['first_name'])."[{$line['qcode']}]");
     echo td($tiers);
-    
     // Label
     echo "<TD>" . h($line['jr_comment']) . "</TD>";
     
+    // Private expense
+    
$private_amount=($line['private_amount']==0)?"":nbm(round($line['private_amount'],2),2);
+    $tot['private_amount']=bcadd($tot['private_amount'],  
floatval($line['private_amount']));
+    
+    // No deductible
+    
$noded_amount=($line['noded_amount']==0)?"":nbm(round($line['noded_amount'],2),2);
+    
$tot['noded_amount']=bcadd($tot['noded_amount'],round(floatval($line['noded_amount'])),2);
 
     // HTVA amount 
     echo "<TD class=\"num\">" . nbm(round($line['novat'],2),2) . "</TD>";
     $tot['htva']=bcadd($tot['htva'],  round(floatval($line['novat']),2));
     
+    echo "<TD class=\"num\">" .$private_amount . "</TD>";
+    echo "<TD class=\"num\">" . $noded_amount . "</TD>";
+    
     
//--------------------------------------------------------------------------
     // If VAT then display it
     
//--------------------------------------------------------------------------
     if ($own->MY_TVA_USE == 'Y' )
     {
+        $tva_dna=($line['noded_vat']==0)?"":nbm(round($line['noded_vat']),2);
+        $tot['tva_nd']=bcadd($tot['tva_nd'],  
round(floatval($line['noded_vat']),2));
+        echo "<TD class=\"num\">" . $tva_dna. "</TD>";
         $a_tva_amount=array();
         
         foreach ($line['detail_vat'] as $lineTVA)
@@ -108,10 +121,10 @@ foreach ($this->data as $line) {
                 foreach ($a_Tva as $idx=>$line_tva)
                 {
 
-                    if ($line_tva['tva_id'] == $lineTVA['qs_vat_code'])
+                    if ($line_tva['tva_id'] == $lineTVA['qp_vat_code'])
                     {
                         $a=$line_tva['tva_id'];
-                        $a_tva_amount[$a]=$lineTVA["vat_amount"];
+                        $a_tva_amount[$a]=$lineTVA['vat_amount'];
                     }
                 }
             }
@@ -128,7 +141,7 @@ foreach ($this->data as $line) {
     }
     
     echo '<td class="num">'.nbm($line['tvac'],2).'</td>';
-    $tot['tvac']=bcadd($tot['tvac'], round(floatval($line['tvac']),2));
+    $tot['tvac']=bcadd($tot['tvac'], round($line['tvac'],2));
     /*
      * If reconcile print them
      */
@@ -159,7 +172,10 @@ foreach ($this->data as $line) {
         <td></td>
         <td></td>
         <td class="num"><?php echo nbm($tot['htva']); ?></td>
+        <td class="num"><?php echo nbm($tot['private_amount']) ?></td>
+        <td class="num"><?php echo nbm($tot['noded_amount'])?></td>
         <?php if ($own->MY_TVA_USE == 'Y' ): ?>
+            <td><?php echo nbm($tot['tva_nd']) ?></td>
             <?php  foreach ($a_Tva as $line_tva) :
                         $a=$line_tva['tva_id'];
                         if ( isset($tot['tva'][$a])) :
diff --git a/include/template/acc_ledger_history_sale_extended.php 
b/include/template/acc_ledger_history_purchase_extended.php
similarity index 87%
copy from include/template/acc_ledger_history_sale_extended.php
copy to include/template/acc_ledger_history_purchase_extended.php
index fdaa472..a30de33 100644
--- a/include/template/acc_ledger_history_sale_extended.php
+++ b/include/template/acc_ledger_history_purchase_extended.php
@@ -78,10 +78,10 @@ for ($i=0;$i<$nb_data;$i++):
             <?=$this->data[$i]['jr_pj_number']?>
         </td>
         <td>
-            <?=$this->data[$i]['jr_internal']?>
+            <?=HtmlInput::detail_op($this->data[$i]['jr_id'], 
$this->data[$i]['jr_internal'])?>
         </td>
         <td>
-            
<?=HtmlInput::history_card($this->data[$i]['qs_client'],h($this->data[$i]['name'].'
 '.$this->data[$i]['first_name']))?>
+            
<?=HtmlInput::history_card($this->data[$i]['qp_supplier'],h($this->data[$i]['name'].'
 '.$this->data[$i]['first_name']))?>
         </td>
         <td>
             <?=h($this->data[$i]['jr_comment'])?>
@@ -111,16 +111,18 @@ for ($i=0;$i<$nb_data;$i++):
         </td>
     </tr>
     <tr>
-        <td class="width:auto" colspan="8">
+        <td></td>
+        <td></td>
+        <td class="width:auto" colspan="8" style="border-style: 
solid;border-width:1px;border-color: blue">
 <?php
     /// Detail opération
-$det=$this->db->execute("detail_sale",array($this->data[$i]['jr_internal']));
+$det=$this->db->execute("detail_purchase",array($this->data[$i]['jr_internal']));
 $a_detail=Database::fetch_all($det);
 ?>
             <table style="width: 100%">
                 <tr>
                     <th><?=_("Item")?></th>
-                    <th class="num"><?=_("Prix Uni")?></th>
+                    <th class="num"><?=_("Prix Unit")?></th>
                     <th class="num"><?=_("Quantité")?></th>
                     <th class="num"><?=_("HTVA")?></th>
                     <th class="num"><?=_("TVA")?></th>
@@ -131,13 +133,13 @@ $a_detail=Database::fetch_all($det);
 $nb_detail=count($a_detail);
 for ($j=0;$j<$nb_detail;$j++):
 ?>  
-                <tr>
+                <tr >
                     <td><?=$a_detail[$j]['qcode']?>  
                         <?=$a_detail[$j]['name']?>  </td>
-                    <td class="num" 
style="width:10%"><?=$a_detail[$j]['qs_quantite']?>  </td>
-                    <td class="num" 
style="width:10%"><?=$a_detail[$j]['qs_unit']?>  </td>
-                    <td class="num" 
style="width:10%"><?=nbm($a_detail[$j]['qs_price'])?>  </td>
-                    <td class="num" 
style="width:10%"><?=nbm($a_detail[$j]['qs_vat'])?>  </td>
+                    <td class="num" 
style="width:10%"><?=$a_detail[$j]['qp_quantite']?>  </td>
+                    <td class="num" 
style="width:10%"><?=$a_detail[$j]['qp_unit']?>  </td>
+                    <td class="num" 
style="width:10%"><?=nbm($a_detail[$j]['qp_price'])?>  </td>
+                    <td class="num" 
style="width:10%"><?=nbm($a_detail[$j]['qp_vat'])?>  </td>
                     <td class="num" 
style="width:10%"><?=$a_detail[$j]['tva_label']?>  </td>
                     <td class="num" 
style="width:10%"><?=nbm($a_detail[$j]['tvac'])?>  </td>
                 </tr>
diff --git a/include/template/acc_ledger_history_sale_extended.php 
b/include/template/acc_ledger_history_purchase_oneline.php
similarity index 62%
copy from include/template/acc_ledger_history_sale_extended.php
copy to include/template/acc_ledger_history_purchase_oneline.php
index fdaa472..3a6d783 100644
--- a/include/template/acc_ledger_history_sale_extended.php
+++ b/include/template/acc_ledger_history_purchase_oneline.php
@@ -19,11 +19,15 @@
  */
 // Copyright (2018) Author Dany De Bontridder <address@hidden>
 
+if (!defined('ALLOWED'))
+    die('Appel direct ne sont pas permis');
 
 /**
  * @file
- * @brief detail of the list of operation with VAT and items
+ * @brief display purchase on one line with sum of VAT, Operation, Private exp.
+ * @todo prévoir aussi pour les non assujetti : faire disparaître les montants 
TVA
  */
+
 ?>
 <table class="result">
     <tr>
@@ -49,8 +53,12 @@
             <?=_('HTVA')?>
         </th>
         <th>
+            <?=_('Non ded')?>
+        </th>
+        <th>
             <?=_('TVA')?>
         </th>
+              
         <th>
             <?=_('TVAC')?>
         </th>
@@ -60,12 +68,19 @@ $nb_data=count($this->data);
 $tot_amount_novat=0;
 $tot_amount_vat=0;
 $tot_amount_tvac=0;
+$tot_amount_private=0;
+$tot_nonded_vat=0;
+$tot_nonded_amount=0;
+
 for ($i=0;$i<$nb_data;$i++):
-    $odd=' class="odd" ';
+    $odd=($i%2==0)?' class="even" ':' class="odd" ';
     $tot_amount_novat=bcadd($tot_amount_novat,$this->data[$i]['novat']);
     $tot_amount_vat=bcadd($tot_amount_vat,$this->data[$i]['vat']);
     $tot_amount_vat=bcsub($tot_amount_vat,$this->data[$i]['tva_sided']);
     $tot_amount_tvac=bcadd($tot_amount_tvac,$this->data[$i]['tvac']);
+    
$tot_nonded_amount=bcadd($tot_nonded_amount,$this->data[$i]['noded_amount']);
+    
$tot_nonded_amount=bcadd($tot_nonded_amount,$this->data[$i]['private_amount']);
+    $tot_nonded_vat=bcadd($tot_nonded_vat, $this->data[$i]['noded_vat']);
 ?>
     <tr <?=$odd?> >
         <td>
@@ -78,10 +93,10 @@ for ($i=0;$i<$nb_data;$i++):
             <?=$this->data[$i]['jr_pj_number']?>
         </td>
         <td>
-            <?=$this->data[$i]['jr_internal']?>
+           <?=HtmlInput::detail_op($this->data[$i]['jr_id'], 
$this->data[$i]['jr_internal'])?>
         </td>
         <td>
-            
<?=HtmlInput::history_card($this->data[$i]['qs_client'],h($this->data[$i]['name'].'
 '.$this->data[$i]['first_name']))?>
+            
<?=HtmlInput::history_card($this->data[$i]['qp_supplier'],h($this->data[$i]['name'].'
 '.$this->data[$i]['first_name']." [ {$this->data[$i]['qcode']} ]"))?>
         </td>
         <td>
             <?=h($this->data[$i]['jr_comment'])?>
@@ -90,6 +105,9 @@ for ($i=0;$i<$nb_data;$i++):
             <?=nbm($this->data[$i]['novat'])?>
         </td>
         <td class="num">
+            
<?=nbm(bcadd($this->data[$i]['noded_amount'],$this->data[$i]['private_amount']));?>
+        </td>
+        <td class="num">
             
<?=nbm(bcsub($this->data[$i]['vat'],$this->data[$i]['tva_sided']))?>
         </td>
         <td class="num">
@@ -110,44 +128,6 @@ for ($i=0;$i<$nb_data;$i++):
     } ?>
         </td>
     </tr>
-    <tr>
-        <td class="width:auto" colspan="8">
-<?php
-    /// Detail opération
-$det=$this->db->execute("detail_sale",array($this->data[$i]['jr_internal']));
-$a_detail=Database::fetch_all($det);
-?>
-            <table style="width: 100%">
-                <tr>
-                    <th><?=_("Item")?></th>
-                    <th class="num"><?=_("Prix Uni")?></th>
-                    <th class="num"><?=_("Quantité")?></th>
-                    <th class="num"><?=_("HTVA")?></th>
-                    <th class="num"><?=_("TVA")?></th>
-                    <th class="num"><?=_("Code TVA")?></th>
-                    <th class="num"><?=_("TVAC")?></th>
-                </tr>
-<?php
-$nb_detail=count($a_detail);
-for ($j=0;$j<$nb_detail;$j++):
-?>  
-                <tr>
-                    <td><?=$a_detail[$j]['qcode']?>  
-                        <?=$a_detail[$j]['name']?>  </td>
-                    <td class="num" 
style="width:10%"><?=$a_detail[$j]['qs_quantite']?>  </td>
-                    <td class="num" 
style="width:10%"><?=$a_detail[$j]['qs_unit']?>  </td>
-                    <td class="num" 
style="width:10%"><?=nbm($a_detail[$j]['qs_price'])?>  </td>
-                    <td class="num" 
style="width:10%"><?=nbm($a_detail[$j]['qs_vat'])?>  </td>
-                    <td class="num" 
style="width:10%"><?=$a_detail[$j]['tva_label']?>  </td>
-                    <td class="num" 
style="width:10%"><?=nbm($a_detail[$j]['tvac'])?>  </td>
-                </tr>
-<?php
-endfor;
-?>
-                
-            </table>
-        </td>
-    </tr>    
 <?php 
     endfor;
 ?>
@@ -161,9 +141,10 @@ endfor;
             <td></td>
             <td></td>
             <td></td>
-            <td><?=nbm($tot_amount_novat)?></td>
-            <td><?=nbm($tot_amount_vat)?></td>
-            <td><?=nbm($tot_amount_tvac)?></td>
+            <td class="num"><?=nbm($tot_amount_novat)?></td>
+            <td class="num"><?=nbm($tot_nonded_amount)?></td>
+            <td class="num"><?=nbm($tot_amount_vat)?></td>
+            <td class="num"><?=nbm($tot_amount_tvac)?></td>
             <td></td>
             <td></td>
         </tr>
diff --git a/include/template/acc_ledger_history_sale_detail.php 
b/include/template/acc_ledger_history_sale_detail.php
index cfa9bf2..a485163 100644
--- a/include/template/acc_ledger_history_sale_detail.php
+++ b/include/template/acc_ledger_history_sale_detail.php
@@ -83,7 +83,7 @@ foreach ($this->data as $line) {
     // Internal with detail
     echo "<TD>" . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . 
"</TD>";
     
-    // find the tiers (normally in $Row ! 
+    // find the tiers (normally in $this->data ! 
     $tiers =HtmlInput::history_card($line['qs_client'],h($line['name'].' 
'.$line['first_name'])."[{$line['qcode']}]");
 
     echo td($tiers);
diff --git a/include/template/acc_ledger_history_sale_extended.php 
b/include/template/acc_ledger_history_sale_extended.php
index fdaa472..effaf43 100644
--- a/include/template/acc_ledger_history_sale_extended.php
+++ b/include/template/acc_ledger_history_sale_extended.php
@@ -78,7 +78,7 @@ for ($i=0;$i<$nb_data;$i++):
             <?=$this->data[$i]['jr_pj_number']?>
         </td>
         <td>
-            <?=$this->data[$i]['jr_internal']?>
+            <?=HtmlInput::detail_op($this->data[$i]['jr_id'], 
$this->data[$i]['jr_internal'])?>
         </td>
         <td>
             
<?=HtmlInput::history_card($this->data[$i]['qs_client'],h($this->data[$i]['name'].'
 '.$this->data[$i]['first_name']))?>
@@ -111,7 +111,9 @@ for ($i=0;$i<$nb_data;$i++):
         </td>
     </tr>
     <tr>
-        <td class="width:auto" colspan="8">
+        <td></td>
+        <td></td>
+        <td class="width:auto" colspan="8" style="border-style: 
solid;border-width:1px;border-color: blue">
 <?php
     /// Detail opération
 $det=$this->db->execute("detail_sale",array($this->data[$i]['jr_internal']));
diff --git a/include/template/acc_history_ledger_sale_oneline.php 
b/include/template/acc_ledger_history_sale_oneline.php
similarity index 97%
rename from include/template/acc_history_ledger_sale_oneline.php
rename to include/template/acc_ledger_history_sale_oneline.php
index f3cfa48..45e1294 100644
--- a/include/template/acc_history_ledger_sale_oneline.php
+++ b/include/template/acc_ledger_history_sale_oneline.php
@@ -79,7 +79,7 @@ for ($i=0;$i<$nb_data;$i++):
             <?=$this->data[$i]['jr_pj_number']?>
         </td>
         <td>
-            <?=$this->data[$i]['jr_internal']?>
+            <?=HtmlInput::detail_op($this->data[$i]['jr_id'], 
$this->data[$i]['jr_internal'])?>
         </td>
         <td>
             
<?=HtmlInput::history_card($this->data[$i]['qs_client'],h($this->data[$i]['name'].'
 '.$this->data[$i]['first_name']." [ {$this->data[$i]['qcode']} ]"))?>
diff --git a/scenario/acc_ledger_historyTest.php 
b/scenario/acc_ledger_historyTest.php
index b0863ba..361fef4 100644
--- a/scenario/acc_ledger_historyTest.php
+++ b/scenario/acc_ledger_historyTest.php
@@ -34,18 +34,17 @@ $cn=Dossier::connect();
 
 $ledger_history=Acc_Ledger_History::factory($cn, $ledger, 216, 217, "E");
 echo h1("Detailled Accounting");
-echo h2(_("export detail html all ledgers result = Detailled Accounting"));
+echo h2(_("export detail html all ledgers result = Detailled Accounting from 
Acc_Ledger_History_Generic"));
 $ledger_history->export_detail_html();
 
-echo h2(_("Set mode to D etailled all_ledgers result = Detailled Accounting" 
));
+echo h2(_("Set mode to D etailled all_ledgers result = Detailled Accounting 
from Acc_Ledger_History_Generic" ));
 $ledger_history->set_m_mode("D");
 $ledger_history->export_html();
 
-echo h2(_("Only VEN"));
+echo h1(_("Only VEN from Acc_Ledger_History_Sale"));
 $ledger_history=Acc_Ledger_History::factory($cn, [2], 216, 217, "L");
 $ledger_history->export_detail_html();
 
-echo h1("One line");
 echo h2(_("Only VEN one line"));
 $ledger_history->set_a_ledger([2]);
 $ledger_history->set_m_mode("L");
@@ -66,3 +65,16 @@ $ledger_history=Acc_Ledger_History::factory($cn, [3,2], 216, 
217, "L");
 
 $ledger_history->export_oneline_html();
 
+echo h1("ACH from Acc_Ledger_History_Purchase");
+echo h2("Detailled accouting");
+$ledger_history=new Acc_Ledger_History_Purchase($cn,[3],216,217,"A");
+$ledger_history->export_html();
+echo h2("Ach one line");
+$ledger_history->set_m_mode("L");
+$ledger_history->export_html();
+echo h2("Ach Detail");
+$ledger_history->set_m_mode("D");
+$ledger_history->export_html();
+echo h2("Ach Extended");
+$ledger_history->set_m_mode("E");
+$ledger_history->export_html();



reply via email to

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