[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 122/238: Currency : display correctly the sal
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 122/238: Currency : display correctly the saldo at the end / beginning operation |
Date: |
Sat, 26 Oct 2019 04:40:49 -0400 (EDT) |
sparkyx pushed a commit to annotated tag rel7110
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] 218/238: Merge branch 'accept7100' into entreprise, (continued)
- [Noalyss-commit] [noalyss] 218/238: Merge branch 'accept7100' into entreprise, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 199/238: Merge with dev7109, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 206/238: Cosmetic, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 210/238: Improve apparence, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 237/238: Acc_Ledger : problem with acc_ledger::load(), Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 229/238: Task #1759 = PRINTBAL sur 4 colonnes, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 224/238: Improve PHPUNIT Test for phpunit7 and phpunit8, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 91/238: PHP 7.2 : fix incomptability, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 117/238: Currency : cosmetic display history : show only the value of the card/accounting, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 138/238: Translation, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 122/238: Currency : display correctly the saldo at the end / beginning operation,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 130/238: typo doc, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 123/238: Currency = payment automatic for Sales and Purchases, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 147/238: Currency : detail operation Purchase , the amount in currency were wrong in the summary, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 152/238: New function findSide return D if number is <0, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 168/238: translation, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 174/238: Merge branch 'r700-currency' of gitlab.noalyss.eu:noalyss/noalyss into r700-currency, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 193/238: Php7.2 incompatibility, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 176/238: Mantis #1626: AFFICHAGE BALANCE FICHE - soldes nuls au débit, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 192/238: Mantis #0001618: Journaux - choix du type en premier, Dany De Bontridder, 2019/10/26
- [Noalyss-commit] [noalyss] 195/238: mantis #1690: Bug : impossible d'utiliser < dans Inplace_Edit Replace strip_tags , add a space before the "<", Dany De Bontridder, 2019/10/26