[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 118/162: Currency : display correctly the sal
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 118/162: Currency : display correctly the saldo at the end / beginning operation |
Date: |
Sat, 11 Jul 2020 13:23:57 -0400 (EDT) |
sparkyx pushed a commit to annotated tag E-4
in repository noalyss.
commit 1138118acd9a4a9ebb496146186020c4339fb610
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Sun Dec 9 17:46:55 2018 +0100
Currency : display correctly the saldo at the end / beginning operation
---
include/class/acc_ledger_fin.class.php | 59 +++++++++++++++++++++++-----------
1 file changed, 40 insertions(+), 19 deletions(-)
diff --git a/include/class/acc_ledger_fin.class.php
b/include/class/acc_ledger_fin.class.php
index c8bd178..3b5c119 100644
--- a/include/class/acc_ledger_fin.class.php
+++ b/include/class/acc_ledger_fin.class.php
@@ -629,24 +629,35 @@ class Acc_Ledger_Fin extends Acc_Ledger
}
$r.="</TABLE>";
$acc_currency=$this->get_currency();
- $cur=$acc_currency->get_code();
- $cur_rate=$acc_currency->get_rate_date($e_date);
- $default_currency=new Acc_Currency($this->db , 0);
- // saldo
- $r.='<br>'.sprintf(_("Ancien solde = %d %s"),$solde, $cur);
- $new_solde=bcadd($new_solde,$tot_amount);
- $r.='<br>'.sprintf(_("Nouveau solde = %d %s"),$new_solde,
$cur);
+
+ // If currency is not the default one
if ( $acc_currency->get_id() != 0)
{
+ $solde=$fBank->get_bk_balance_currency();
+ $cur=$acc_currency->get_code();
+ $cur_rate=$acc_currency->get_rate_date($e_date);
+ $default_currency=new Acc_Currency($this->db , 0);
+ // saldo
+
+ $r.='<br>'.sprintf(_("Ancien solde = %f %s"),$solde,
$cur);
+ $new_solde=bcadd($solde,$tot_amount);
+ $r.='<br>'.sprintf(_("Nouveau solde = %f %s"),$new_solde,
$cur);
+ $r.='<br>'.sprintf(_("Difference = %f %s"), $tot_amount,
$cur);
+
+
$r.='<br>'.sprintf(_("Taux = %s"),$cur_rate);
- $r.='<br>'.sprintf(_("Nouveau solde = %d
%s"),bcmul($new_solde,$cur_rate),$default_currency->get_code());
- }
- $r.='<br>'.sprintf(_("Difference = %d %s"), $tot_amount, $cur);
-
- if ( $acc_currency->get_id() != 0)
- {
- $r.='<br>'.sprintf(_("Difference = %d %s"),
bcmul($tot_amount,$cur_rate), $default_currency->get_code());
+ $r.='<br>'.sprintf(_("Nouveau solde = %f
%s"),bcmul($new_solde,$cur_rate),$default_currency->get_code());
+ } else {
+
+ $cur=$acc_currency->get_code();
+ // saldo
+
+ $r.='<br>'.sprintf(_("Ancien solde = %f %s"),$solde,
$cur);
+ $new_solde=bcadd($new_solde,$tot_amount);
+ $r.='<br>'.sprintf(_("Nouveau solde = %f %s"),$new_solde,
$cur);
+ $r.='<br>'.sprintf(_("Difference = %f %s"), $tot_amount,
$cur);
+
}
// check for upload piece
$file = new IFile();
@@ -1031,11 +1042,21 @@ class Acc_Ledger_Fin extends Acc_Ledger
throw new Exception($r);
}
$this->db->commit();
- $r = "";
- $r.=sprintf("<br>"._("Ancien solde %s %s"),
nbm($solde),$acc_currency->get_code());
- $new_solde = bcadd($new_solde, $amount);
- $r.=sprintf("<br>"._("Nouveau solde %s %s"),
nbm($new_solde),$acc_currency->get_code());
- $ret.=$r;
+ if ( $acc_currency->get_id() == 0)
+ {
+ $r = "";
+ $r.=sprintf("<br>"._("Ancien solde %s %s"),
nbm($solde),$acc_currency->get_code());
+ $new_solde = bcadd($new_solde, $amount);
+ $r.=sprintf("<br>"._("Nouveau solde %s %s"),
nbm($new_solde),$acc_currency->get_code());
+ $ret.=$r;
+ } else {
+ $solde_cur=$fBank->get_bk_balance_currency();
+ $r = "";
+ $r.=sprintf("<br>"._("Ancien solde %s %s"),
nbm($solde_cur),$acc_currency->get_code());
+ $new_solde = bcadd($solde_cur, $amount);
+ $r.=sprintf("<br>"._("Nouveau solde %s %s"),
nbm($new_solde),$acc_currency->get_code());
+ $ret.=$r;
+ }
return $ret;
}
- [Noalyss-commit] [noalyss] 104/162: acc_ledger_fin . translation, (continued)
- [Noalyss-commit] [noalyss] 104/162: acc_ledger_fin . translation, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 106/162: Currency : All ledger's listing mode , html , csv and pdf, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 111/162: Currency : ledger printing for FIN + detail operation, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 105/162: Indentation, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 108/162: currency : sale extended html , csv, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 109/162: change background, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 113/162: Currency : cosmetic display history : show only the value of the card/accounting, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 114/162: Currency : export CSV history for card and accounting, fix bug with unneeded oc_vat_amount + add the currency rate, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 115/162: currency : adapt middle of payment, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 117/162: Currency : error when displaying, add 4 due to a mistype instruction, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 118/162: Currency : display correctly the saldo at the end / beginning operation,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 107/162: Currency : sales in listing mode, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 122/162: Merge branch 'master' into r700-currency, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 112/162: Database upgrade 131, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 116/162: Currency : send the saldo for financial ledger, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 123/162: Merge commit '3f53de417dd89e9a90a386404f93f8648155e046' into r700-currency, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 110/162: Currency : purchase oneline + extended html and csv, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 119/162: Currency = payment automatic for Sales and Purchases, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 121/162: Merge branch 'master' into r700-currency, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 124/162: Missing bracket, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 125/162: Esthetic with button "Add accounting", Dany De Bontridder, 2020/07/11