noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 86/238: Currency : show the currency of the l


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 86/238: Currency : show the currency of the ledger when entering info
Date: Sat, 26 Oct 2019 04:40:40 -0400 (EDT)

sparkyx pushed a commit to annotated tag rel7110
in repository noalyss.

commit 2b04571d0ff3cd8709531097fb3f1164ed992143
Author: Dany De Bontridder <address@hidden>
Date:   Fri Nov 2 20:04:46 2018 +0100

    Currency : show the currency of the ledger when entering info
---
 html/ajax_misc.php                     |  7 ++++++-
 html/do.php                            |  2 --
 html/js/scripts.js                     | 15 +++++++++++++++
 include/class/acc_ledger.class.php     |  9 ++++++++-
 include/class/acc_ledger_fin.class.php |  2 +-
 include/template/form_ledger_fin.php   |  9 ++++++---
 6 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index bd9f124..7f5218f 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -627,7 +627,12 @@ EOF;
             }
             exit();
             break;
-        
+        case 'currencyCode':
+            $ledger_id=$http->request('ledger',"number");
+            $code=$cn->get_value("select cr_code_iso from public.currency join 
jrn_def on (currency.id=jrn_def.currency_id) where jrn_def.jrn_def_id=$1",
+                    [$ledger_id]);
+            echo $code;
+            break;
        default:
                var_dump($_REQUEST);
 }
diff --git a/html/do.php b/html/do.php
index 0278416..fc04b28 100644
--- a/html/do.php
+++ b/html/do.php
@@ -33,9 +33,7 @@ require_once NOALYSS_INCLUDE.'/lib/html_input.class.php';
 require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
 require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php';
 $http=new HttpInput();
-
 mb_internal_encoding("UTF-8");
-
 // if gDossier is not set redirect to form to choose a folder
 if ( ! isset($_REQUEST['gDossier']))
 {
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 05f0bdf..a1e4fe1 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -3514,3 +3514,18 @@ function 
updatePeriode(p_dossier,p_exercice,p_periode_from,p_periode_to,p_last)
     new 
Ajax.Updater(p_periode_to,"ajax_misc.php",{method:"get",parameters:{op:"periode_change","gDossier":p_dossier,"exercice":exercice,field:p_periode_to,"type":"to","last":p_last}});
     remove_waiting_box();
 }
+/**
+ * 
+ * @returns {undefined}
+ */
+function show_ledger_fin_currency()
+{
+    var ledger=$('p_jrn').value;
+    var dossier=$('gDossier').value;
+    // $('ledger_currency').
+    var a=new Ajax.Updater("ledger_currency",
+                    "ajax_misc.php",
+                    { 
+                        parameters: 
{"op":"currencyCode","gDossier":dossier,"ledger":ledger}
+                    });
+}
\ No newline at end of file
diff --git a/include/class/acc_ledger.class.php 
b/include/class/acc_ledger.class.php
index 51adc98..35380e9 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -2933,7 +2933,14 @@ class Acc_Ledger extends jrn_def_sql
                 
Dossier::id(),$select->name,$p_currency_code,$p_currency_rate,$p_eur_amount);
         return $select;
     }
-
+    /**
+     * @brief returns the code iso of the default currency for this ledger
+     */
+    function get_currency()
+    {
+        $cr_iso_code=$this->db->get_value("select cr_code_iso from 
public.currency where id=$1",[$this->currency_id]);
+        return $cr_iso_code;
+    }
 }
 
 ?>
diff --git a/include/class/acc_ledger_fin.class.php 
b/include/class/acc_ledger_fin.class.php
index c9ef7d9..e12008c 100644
--- a/include/class/acc_ledger_fin.class.php
+++ b/include/class/acc_ledger_fin.class.php
@@ -301,7 +301,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
 
                // Ledger (p_jrn)
                //--
-               
$onchange="update_bank();ajax_saldo('first_sold');update_name();update_row('fin_item');";
+               
$onchange="update_bank();ajax_saldo('first_sold');update_name();update_row('fin_item');show_ledger_fin_currency();";
 
                if ($g_parameter->MY_DATE_SUGGEST == 'Y')
                        $onchange .= 'get_last_date();';
diff --git a/include/template/form_ledger_fin.php 
b/include/template/form_ledger_fin.php
index ef12d18..2e34607 100644
--- a/include/template/form_ledger_fin.php
+++ b/include/template/form_ledger_fin.php
@@ -13,7 +13,7 @@
                        array('value'=>2,'label'=>_("Avec date opérations"))
        );
        $wchdate->selected=(isset($chdate))?$chdate:1;
-       $wchdate->javascript='onchange="show_fin_chdate(\'chdate\')"';
+       $wchdate->javascript='onchange="show_fin_chdate(\'chdate\');"';
 ?>
 <?php echo $wchdate->input();?>
 <span id="chdate_ext">
@@ -22,8 +22,11 @@
 
 <?php echo $f_period?><br>
 <?php echo $f_jrn?><br>
-<?php echo _('Banque')?><?php echo $f_bank ?>
-
+    <?php echo _('Banque')?><?php echo $f_bank ?>&nbsp;
+        <?php echo _("Devise")?>&nbsp;
+    <span id="ledger_currency">
+            <?php echo $this->get_currency();?>
+    </span>
 </fieldset>
 
 <fieldset>



reply via email to

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