[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 122/218: Currency : display correctly the sal
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 122/218: Currency : display correctly the saldo at the end / beginning operation |
Date: |
Thu, 12 Sep 2019 15:58:52 -0400 (EDT) |
sparkyx pushed a commit to branch entreprise
in repository noalyss.
commit 1138118acd9a4a9ebb496146186020c4339fb610
Author: Dany De Bontridder <address@hidden>
Date: 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] 202/218: Merge branch 'dev7109' into entreprise, (continued)
- [Noalyss-commit] [noalyss] 202/218: Merge branch 'dev7109' into entreprise, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 162/218: Currency - fix view, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 178/218: Mantis #1665: Pouvoir modifier l'ordre dans les listing de compta analytique, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 78/218: Bug : ajax fails if wait_box does not exist, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 105/218: Background color, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 92/218: Merge branch 'master' into r700-currency, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 98/218: Fin currency : detail operation show currency , rate and amount, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 97/218: Fin : currency , add missing info into Operation_Currency, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 113/218: change background, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 95/218: currency : adapt for FIN, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 122/218: Currency : display correctly the saldo at the end / beginning operation,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 136/218: Translation, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 115/218: Currency : ledger printing for FIN + detail operation, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 143/218: Currency : precision 6, display default currency , protect used currency against delete, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 149/218: Currency : purchase, save all detail also in currency, fix problem with the advance payment, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 151/218: Task #1660 : place the button for the inventory on the top, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 157/218: Merge branch 'r700-currency' of gitlab.noalyss.eu:noalyss/noalyss into r700-currency, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 75/218: Improve waiting box, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 171/218: Mantis #0001666: Export CSV depuis histo ne filtre pas par journal, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 175/218: mantis #1690: Bug : impossible d'utiliser < dans Inplace_Edit Use base64_decode to protect the string in serialize, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 194/218: TEST : fix some little bugs, Dany De Bontridder, 2019/09/12