[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 142/218: Currency : Precision 6
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 142/218: Currency : Precision 6 |
Date: |
Thu, 12 Sep 2019 15:58:56 -0400 (EDT) |
sparkyx pushed a commit to branch entreprise
in repository noalyss.
commit cc5c5abd6e99977530ced6f8bf5105294b3877eb
Author: Dany De Bontridder <address@hidden>
Date: Fri Jan 4 16:44:14 2019 +0100
Currency : Precision 6
---
include/class/acc_compute.class.php | 4 ++--
include/class/acc_ledger.class.php | 6 +++---
include/class/acc_ledger_purchase.class.php | 3 ++-
include/class/acc_ledger_sold.class.php | 1 +
include/lib/manage_table_sql.class.php | 20 +++++++++++++++++++-
include/template/form_ledger_detail.php | 2 +-
6 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/include/class/acc_compute.class.php
b/include/class/acc_compute.class.php
index 49ba34d..a6a33d3 100644
--- a/include/class/acc_compute.class.php
+++ b/include/class/acc_compute.class.php
@@ -89,13 +89,13 @@ class Acc_Compute
function convert_euro()
{
$local_amount=$this->amount;
- $this->amount=bcmul($this->amount,$this->currency_rate);
+ $this->amount=bcmul($this->amount,$this->currency_rate,6);
$this->amount_currency=$local_amount;
}
function convert_euro_vat()
{
$local_amount=$this->amount_vat;
- $this->amount_vat=bcmul($this->amount_vat,$this->currency_rate);
+ $this->amount_vat=bcmul($this->amount_vat,$this->currency_rate,6);
$this->amount_vat_currency=$local_amount;
}
public function get_parameter($p_string)
diff --git a/include/class/acc_ledger.class.php
b/include/class/acc_ledger.class.php
index 7dfcd0e..f128d99 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -913,12 +913,12 @@ class Acc_Ledger extends jrn_def_sql
$currency_select = $this->CurrencyInput("currency_code",
"p_currency_rate" , "p_currency_euro");
$currency_select->selected=$http->request('p_currency_code','string',0);
- $currency_input=new INum("p_currency_rate",6);
+ $currency_input=new INum("p_currency_rate");
+ $currency_input->prec=6;
$currency_input->id="p_currency_rate";
$currency_input->value=$http->request('p_currency_rate','string',1);
-
$currency_input->javascript='onchange="format_number(this,6);CurrencyCompute(\'p_currency_rate\',\'p_currency_euro\');"';
$ret.=_("Devise")." ".$currency_select->input();
- $ret.=$currency_input->change();
+
$ret.=$currency_input->change('CurrencyComputeMisc(\'p_currency_rate\',\'p_currency_euro\');');
$currency=new Acc_Currency($this->db,0);
$ret.=$currency->get_code();
diff --git a/include/class/acc_ledger_purchase.class.php
b/include/class/acc_ledger_purchase.class.php
index fefced5..504cd24 100644
--- a/include/class/acc_ledger_purchase.class.php
+++ b/include/class/acc_ledger_purchase.class.php
@@ -1397,9 +1397,10 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$currency_select->selected=$http->request('p_currency_code','string',0);
$currency_input=new INum("p_currency_rate");
+ $currency_input->prec=6;
$currency_input->id="p_currency_rate";
$currency_input->value=$http->request('p_currency_rate','string',1);
-
$currency_input->javascript='onchange="format_number(this,4);CurrencyCompute(\'p_currency_rate\',\'p_currency_euro\');"';
+
$currency_input->javascript='onchange="format_number(this,6);CurrencyCompute(\'p_currency_rate\',\'p_currency_euro\');"';
$currency=new Acc_Currency($this->db,0);
diff --git a/include/class/acc_ledger_sold.class.php
b/include/class/acc_ledger_sold.class.php
index e55ae9b..ba973c0 100644
--- a/include/class/acc_ledger_sold.class.php
+++ b/include/class/acc_ledger_sold.class.php
@@ -1490,6 +1490,7 @@ EOF;
$currency_input=new INum("p_currency_rate");
$currency_input->id="p_currency_rate";
+ $currency_input->prec=6;
$currency_input->value=$http->request('p_currency_rate','string',1);
$currency_input->javascript='onchange="format_number(this,4);CurrencyCompute(\'p_currency_rate\',\'p_currency_euro\');"';
diff --git a/include/lib/manage_table_sql.class.php
b/include/lib/manage_table_sql.class.php
index 2982c4d..b642c5d 100644
--- a/include/lib/manage_table_sql.class.php
+++ b/include/lib/manage_table_sql.class.php
@@ -893,7 +893,7 @@ function check()
$text->size=$min_size;
echo $text->input();
}
- elseif ($this->a_type[$key]=="numeric")
+ elseif ($this->a_type[$key]=="numeric") // number 2
decimale
{
$text=new INum($key);
$text->value=$value;
@@ -901,6 +901,24 @@ function check()
$text->size=$min_size;
echo $text->input();
}
+ elseif ($this->a_type[$key]=="numeric4") // number 4
decimale
+ {
+ $text=new INum($key);
+ $text->prec=4;
+ $text->value=$value;
+ $min_size=(strlen($value)<10)?10:strlen($value)+1;
+ $text->size=$min_size;
+ echo $text->input();
+ }
+ elseif ($this->a_type[$key]=="numeric6") // number 6
decimale
+ {
+ $text=new INum($key);
+ $text->prec=6;
+ $text->value=$value;
+ $min_size=(strlen($value)<10)?10:strlen($value)+1;
+ $text->size=$min_size;
+ echo $text->input();
+ }
elseif ($this->a_type[$key]=="date")
{
$text=new IDate($key);
diff --git a/include/template/form_ledger_detail.php
b/include/template/form_ledger_detail.php
index b337c9d..ab315cf 100644
--- a/include/template/form_ledger_detail.php
+++ b/include/template/form_ledger_detail.php
@@ -67,7 +67,7 @@
</td>
<td>
<?=$currency_select->input()?>
- <?=$currency_input->change()?>
+
<?=$currency_input->change('CurrencyCompute(\'p_currency_rate\',\'p_currency_euro\');')?>
<?=$currency->get_code();?>
</td>
- [Noalyss-commit] [noalyss] 107/218: Currency : export PDF and CSV with currency for printing financial ledger listing(oneline), (continued)
- [Noalyss-commit] [noalyss] 107/218: Currency : export PDF and CSV with currency for printing financial ledger listing(oneline), Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 130/218: typo doc, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 129/218: Esthetic with button "Add accounting", Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 114/218: Currency : purchase oneline + extended html and csv, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 125/218: Merge branch 'master' into r700-currency, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 128/218: Missing bracket, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 127/218: Merge commit '3f53de417dd89e9a90a386404f93f8648155e046' into r700-currency, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 132/218: Translation, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 133/218: Translation, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 134/218: use of httpInput, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 142/218: Currency : Precision 6,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 147/218: Currency : detail operation Purchase , the amount in currency were wrong in the summary, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 148/218: remove commented code, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 152/218: New function findSide return D if number is <0, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 93/218: translate, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 37/218: comment, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 50/218: Protect function nb , return the string if the parameter is not a float, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 52/218: Create invoice : New version of libreoffice use the numeric in another way, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 56/218: Fix todo_list : if list empty , gets an error in php 7.2, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 60/218: Security fix : f_id is a number, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 57/218: Security : direct injection, Dany De Bontridder, 2019/09/12