[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 144/218: Currency : meaning 1 EUR is worth x
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 144/218: Currency : meaning 1 EUR is worth x currency for Sales |
Date: |
Thu, 12 Sep 2019 15:58:56 -0400 (EDT) |
sparkyx pushed a commit to branch entreprise
in repository noalyss.
commit 3d45f187a63a2c3b6b40f3b0a809b527f032c6f3
Author: Dany De Bontridder <address@hidden>
Date: Fri Jan 4 17:33:09 2019 +0100
Currency : meaning 1 EUR is worth x currency for Sales
---
html/js/acc_currency.js | 6 +++---
include/class/acc_ledger_sold.class.php | 11 ++++++-----
include/class/anc_operation.class.php | 2 +-
include/template/form_ledger_detail.php | 2 +-
4 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/html/js/acc_currency.js b/html/js/acc_currency.js
index 0fb6fdf..fdf49ab 100644
--- a/html/js/acc_currency.js
+++ b/html/js/acc_currency.js
@@ -115,7 +115,7 @@ function CurrencyCompute(p_rate,p_update)
console.log("rate is nan" + rate);
rate=1;
}
- var tot=tvac*rate;
+ var tot=tvac/rate;
tot=Math.round(tot*100)/100;
$(p_update).innerHTML=tot;
@@ -148,11 +148,11 @@ function CurrencyComputeMisc(p_rate,p_update)
console.log("rate is nan" + rate);
rate=1;
}
- var totDeb=debAmount*rate;
+ var totDeb=debAmount/rate;
totDeb=Math.round(totDeb*100)/100;
$('default_currency_deb').innerHTML=totDeb;
- var totCred=credAmount*rate;
+ var totCred=credAmount/rate;
totCred=Math.round(totCred*100)/100;
$('default_currency_cred').innerHTML=totCred;
diff --git a/include/class/acc_ledger_sold.class.php
b/include/class/acc_ledger_sold.class.php
index ba973c0..0714584 100644
--- a/include/class/acc_ledger_sold.class.php
+++ b/include/class/acc_ledger_sold.class.php
@@ -309,7 +309,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
$amount_currency = bcmul(${'e_march' . $i . '_price'},
${'e_quant' . $i});
// convert amount to currency
- $amount=bcmul($amount_currency,$p_currency_rate);
+ $amount=bcdiv($amount_currency,$p_currency_rate);
$tot_amount = bcadd($tot_amount, $amount);
$tot_amount = round($tot_amount, 2);
@@ -363,7 +363,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
$l->load();
$tva_item_currency = bcmul($amount,
$l->get_parameter('rate'));
}
- $tva_item=bcmul($tva_item_currency,$p_currency_rate);
+ $tva_item=bcdiv($tva_item_currency,$p_currency_rate);
$tva_item=round($tva_item,2);
if (isset($tva[$idx_tva]))
{
@@ -413,7 +413,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
$op->save_form_plan($_POST, $i, $j_id);
}
- $price_euro=bcmul(${'e_march'.$i.'_price'}, $p_currency_rate);
+ $price_euro=bcdiv(${'e_march'.$i.'_price'}, $p_currency_rate);
if ($g_parameter->MY_TVA_USE == 'Y') {
/* save into quant_sold */
$r = $this->db->exec_sql("select insert_quant_sold
($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)", array(null, /* 1 */
@@ -942,12 +942,13 @@ class Acc_Ledger_Sold extends Acc_Ledger {
// Add the sum
$decalage=($g_parameter->MY_TVA_USE ==
'Y')?'<td></td><td></td><td></td><td></td>':'<td></td>';
$tot = bcadd($tot_amount, $tot_tva, 2);
- $tot_eur=round(bcmul($tot, $p_currency_rate),2);
+ $tot_eur=round(bcdiv($tot, $p_currency_rate),2);
$tot=nbm($tot);
$str_tot=_('Totaux');
// Get currency code
- $str_code='EUR';
+ $default_currency=new Acc_Currency($this->db,0);
+ $str_code=$default_currency->get_code();
if ( $p_currency_code != 0 ) {
$acc_currency=new Acc_Currency($this->db);
$acc_currency->set_id($p_currency_code);
diff --git a/include/class/anc_operation.class.php
b/include/class/anc_operation.class.php
index 1344527..aa3b19d 100644
--- a/include/class/anc_operation.class.php
+++ b/include/class/anc_operation.class.php
@@ -799,7 +799,7 @@ class Anc_Operation
$op->oa_group=$this->oa_group;
$op->j_id=$p_j_id;
// convert oa_amount to EUR
- $op->oa_amount=bcmul($val[$p_item][$row],$this->currency_rate);
+ $op->oa_amount=bcdiv($val[$p_item][$row],$this->currency_rate);
$op->oa_debit=$this->oa_debit;
$op->oa_date=$this->oa_date;
diff --git a/include/template/form_ledger_detail.php
b/include/template/form_ledger_detail.php
index ab315cf..9f2bd1f 100644
--- a/include/template/form_ledger_detail.php
+++ b/include/template/form_ledger_detail.php
@@ -68,7 +68,7 @@
<td>
<?=$currency_select->input()?>
<?=$currency_input->change('CurrencyCompute(\'p_currency_rate\',\'p_currency_euro\');')?>
- <?=$currency->get_code();?>
+ <?=$currency->get_code();?>
</td>
</tr>
- [Noalyss-commit] [noalyss] 116/218: Database upgrade 131, (continued)
- [Noalyss-commit] [noalyss] 116/218: Database upgrade 131, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 120/218: Currency : send the saldo for financial ledger, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 135/218: Translation, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 123/218: Currency = payment automatic for Sales and Purchases, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 131/218: Translation + use of httpInput, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 124/218: 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/09/12
- [Noalyss-commit] [noalyss] 138/218: Translation, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 139/218: Translation, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 137/218: Translation, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 140/218: Misc. Operation : input : Missing tag TR, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 144/218: Currency : meaning 1 EUR is worth x currency for Sales,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 141/218: Currency : for misc. operation, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 159/218: Currency : because of Misc Operation, the tiers must also be saved into operation_currency. Fix also PRINTJRN for currency, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 166/218: Typo, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 79/218: Bug : in Purchase and Sale , the last rows disappear when we change the ledger, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 104/218: Reverse for Currency, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 118/218: Currency : export CSV history for card and accounting, fix bug with unneeded oc_vat_amount + add the currency rate, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 146/218: Currency : history for accounting , correct amount in currency, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 145/218: 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, 2019/09/12
- [Noalyss-commit] [noalyss] 150/218: Currency : detail operation Sale , the amount in currency were wrong in the summary, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 154/218: by default jrn is an empty array, Dany De Bontridder, 2019/09/12