[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 142/238: Currency : Precision 6
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 142/238: Currency : Precision 6 |
Date: |
Sat, 26 Oct 2019 04:40:53 -0400 (EDT) |
sparkyx pushed a commit to annotated tag rel7110
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] 102/238: Version DB 131, (continued)
- [Noalyss-commit] [noalyss] 102/238: Version DB 131, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 113/238: change background, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 112/238: currency : sale extended html , csv, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 110/238: Currency : All ledger's listing mode , html , csv and pdf, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 119/238: currency : adapt middle of payment, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 124/238: Currency : when we pay at the same time as we record the sale / purchase , either the bank is in euro (default currency) or the sale/purchase has the same currency than the financial ledger, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 126/238: Merge branch 'master' into r700-currency, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 146/238: Currency : history for accounting , correct amount in currency, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 139/238: Translation, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 133/238: Translation, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 142/238: Currency : Precision 6,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 156/238: Merge branch 'r700-currency' of gitlab.noalyss.eu:noalyss/noalyss into r700-currency, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 143/238: Currency : precision 6, display default currency , protect used currency against delete, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 134/238: use of httpInput, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 135/238: Translation, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 151/238: Task #1660 : place the button for the inventory on the top, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 155/238: Task #0001309: Association d'une opération avec elle-même., Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 163/238: PHP 7.2 mistyped command, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 171/238: Mantis #0001666: Export CSV depuis histo ne filtre pas par journal, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 169/238: Mantis #0001688: Affichage centime dans l'écran de confirmation, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 184/238: CSS : cosmetic, Dany De Bontridder, 2019/10/26