noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 18/162: task #448 : Currency : display curren


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 18/162: task #448 : Currency : display currency info into operation detail
Date: Sat, 11 Jul 2020 13:23:22 -0400 (EDT)

sparkyx pushed a commit to annotated tag E-4
in repository noalyss.

commit 8909b0c79f12b8e136ffe7eb1e5380c7bd5224a3
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Thu May 10 10:06:21 2018 +0200

    task #448 : Currency : display currency info into operation detail
---
 include/class/acc_currency.class.php   | 19 +++++++++++++++++++
 include/class/acc_operation.class.php  |  2 +-
 include/template/ledger_detail_ach.php | 18 +++++++++++++++++-
 include/template/ledger_detail_ven.php | 19 ++++++++++++++++---
 4 files changed, 53 insertions(+), 5 deletions(-)

diff --git a/include/class/acc_currency.class.php 
b/include/class/acc_currency.class.php
index 0e99cd9..1581013 100644
--- a/include/class/acc_currency.class.php
+++ b/include/class/acc_currency.class.php
@@ -115,6 +115,25 @@ class Acc_Currency
         
         return $select;
     }
+    /**
+     * Return sum of the w/o VAT and VAT or an operation
+     */
+    function sum_amount($p_jr_id)
+    {
+        $sql = " 
+            select sum(round(oc_amount,2)) +
+               sum(round(oc_vat_amount,2)) 
+       from operation_currency 
+       where 
+            j_id in (
+                    select j_id 
+                    from jrnx 
+                    where 
+                    j_grpt in ( select jr_grpt_id from jrn where jr_id=$1))";
+        $sum=$this->cn->get_value($sql, [$p_jr_id]);
+        return $sum;
+
+    }
     
 
 }
diff --git a/include/class/acc_operation.class.php 
b/include/class/acc_operation.class.php
index cf92376..bf19a07 100644
--- a/include/class/acc_operation.class.php
+++ b/include/class/acc_operation.class.php
@@ -765,7 +765,7 @@ class Acc_Detail extends Acc_Operation
         $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_date_paid,jr_optype
+             jr_pj_number, 
jr_mt,jr_rapt,jr_date_paid,jr_optype,currency_id,currency_rate,currency_rate_ref
              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');
diff --git a/include/template/ledger_detail_ach.php 
b/include/template/ledger_detail_ach.php
index 67ef4bf..66a9d95 100644
--- a/include/template/ledger_detail_ach.php
+++ b/include/template/ledger_detail_ach.php
@@ -256,9 +256,25 @@ $str_anc="";
                 if ($owner->MY_TVA_USE == 'Y')
                     $row.=td("") . td("").td(nbm($total_tvac), 'class="num" 
style="font-style:italic;font-weight: bolder;"');
                 echo tr($row);
+                
                 ?>
             </table>
-
+<?php
+/*
+ * Info about currency if not in euro
+ */
+    // Add a row with currency and amount
+    if ( $obj->det->currency_id != "" && $obj->det->currency_id > 0) 
+    {
+        $currency=new Acc_Currency($obj->db, $obj->det->currency_id);
+        $four_space="&nbsp;"."&nbsp;"."&nbsp;"."&nbsp;";
+        
+        echo  $currency->get_code(),$four_space;
+        echo _("Taux utilisé"),"&nbsp;", $obj->det->currency_rate,$four_space;
+        echo _("Taux Réf"), "&nbsp;",$obj->det->currency_rate_ref.$four_space;
+        echo _("Montant en devise"), 
"&nbsp;",$currency->sum_amount($obj->jr_id).$four_space;
+    }
+?>
 
         </div>
 
diff --git a/include/template/ledger_detail_ven.php 
b/include/template/ledger_detail_ven.php
index 26047ac..11e41d9 100644
--- a/include/template/ledger_detail_ven.php
+++ b/include/template/ledger_detail_ven.php
@@ -117,7 +117,6 @@ echo $ipaid->input();
 
             </tr>
         </table>
-        <div class="myfieldset">
             <table class="result">
                 <?php
                 bcscale(2);
@@ -263,8 +262,22 @@ echo $ipaid->input();
             </td>
             </tr>
             </table>
-        </div>
-            
+<?php
+/*
+ * Info about currency if not in euro
+ */
+    // Add a row with currency and amount
+    if ( $obj->det->currency_id != "" && $obj->det->currency_id > 0) 
+    {
+        $currency=new Acc_Currency($obj->db, $obj->det->currency_id);
+        $four_space="&nbsp;"."&nbsp;"."&nbsp;"."&nbsp;";
+        
+        echo  $currency->get_code(),$four_space;
+        echo _("Taux utilisé"),"&nbsp;", $obj->det->currency_rate,$four_space;
+        echo _("Taux Réf"), "&nbsp;",$obj->det->currency_rate_ref.$four_space;
+        echo _("Montant en devise"), 
"&nbsp;",$currency->sum_amount($obj->jr_id).$four_space;
+    }
+?>            
 <?php
 require_once NOALYSS_TEMPLATE.'/ledger_detail_bottom.php';
 ?>



reply via email to

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