[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 138/162: Currency : Precision 6
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 138/162: Currency : Precision 6 |
Date: |
Sat, 11 Jul 2020 13:24:04 -0400 (EDT) |
sparkyx pushed a commit to annotated tag E-4
in repository noalyss.
commit cc5c5abd6e99977530ced6f8bf5105294b3877eb
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: 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] 129/162: Translation, (continued)
- [Noalyss-commit] [noalyss] 129/162: Translation, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 130/162: use of httpInput, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 134/162: Translation, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 137/162: Currency : for misc. operation, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 135/162: Translation, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 136/162: Misc. Operation : input : Missing tag TR, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 140/162: Currency : meaning 1 EUR is worth x currency for Sales, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 141/162: Currency : the meaning is : 1 euro is worth xxx Currency , so we divide the amount with the currency rate to compute the EUR value, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 143/162: Currency : detail operation Purchase , the amount in currency were wrong in the summary, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 132/162: Translation, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 138/162: Currency : Precision 6,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 142/162: Currency : history for accounting , correct amount in currency, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 144/162: remove commented code, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 145/162: Currency : purchase, save all detail also in currency, fix problem with the advance payment, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 146/162: Currency : detail operation Sale , the amount in currency were wrong in the summary, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 139/162: Currency : precision 6, display default currency , protect used currency against delete, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 147/162: Task #1660 : place the button for the inventory on the top, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 148/162: New function findSide return D if number is <0, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 155/162: Protect parameters, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 156/162: PHP 7.2 incomptability : sizeof of not array, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 158/162: PHP 7.2 mistyped command, Dany De Bontridder, 2020/07/11