From 13bc4341dfc19b42217598a4b0364f98e8e0a2a1 Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Thu, 25 Jun 2020 12:05:34 +0100 Subject: [PATCH] + Fix bugs with currency conversion --- application/controllers/Hyperviseur_dash.php | 7 ++++--- application/views/gestion_wallet_autre.php | 4 +++- application/views/gestion_wallet_ilink.php | 8 +++++--- application/views/gestion_wallet_ilink_hyp.php | 8 +++++--- ...ion_wallet_ilink_paying_network_account.php | 4 +++- .../views/historique_transactions_ilink.php | 18 ++++++++++-------- 6 files changed, 30 insertions(+), 19 deletions(-) diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index 7f076d6d..630caaff 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -6,6 +6,7 @@ use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration; use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider; use Brick\Math\RoundingMode; use Brick\Money\Money; +use Brick\Money\Context\AutoContext; /** * Created by PhpStorm. * User: Hanry Nzale @@ -412,7 +413,7 @@ class Hyperviseur_dash extends CI_Controller array_push($data['transactions'], $trans); } } - $data["totalCommissionBanque"] = Money::of(round($totalCommissionBanque,0), $this->session->userdata('currency_code'))->formatTo('fr_FR'); + $data["totalCommissionBanque"] = Money::of(round($totalCommissionBanque,0), $this->session->userdata('currency_code'), new AutoContext() )->formatTo('fr_FR'); } @@ -424,8 +425,8 @@ class Hyperviseur_dash extends CI_Controller } $row = $res->first_row(); - $data["commission"] = Money::of(round($row->balance_com,0), $this->session->userdata('currency_code'))->formatTo('fr_FR'); - $data["principal"] = Money::of(round($row->balance_princ,0), $this->session->userdata('currency_code'))->formatTo('fr_FR'); + $data["commission"] = Money::of(round($row->balance_com,0), $this->session->userdata('currency_code'),new AutoContext())->formatTo('fr_FR'); + $data["principal"] = Money::of(round($row->balance_princ,0), $this->session->userdata('currency_code'),new AutoContext())->formatTo('fr_FR'); $data['wallet_id'] = $row->wallet_id; $data['curreny_code'] = $this->session->userdata('currency_code'); diff --git a/application/views/gestion_wallet_autre.php b/application/views/gestion_wallet_autre.php index 4c6a2c8e..3b172d20 100755 --- a/application/views/gestion_wallet_autre.php +++ b/application/views/gestion_wallet_autre.php @@ -7,6 +7,8 @@ href="">
-

code : 'XAF')->formatTo('fr_FR'); ?>

+

code : 'XAF',new AutoContext())->formatTo('fr_FR'); ?>

lang->line('Solde Commission') ?>

diff --git a/application/views/gestion_wallet_ilink.php b/application/views/gestion_wallet_ilink.php index cae2fd1f..e4edf97d 100755 --- a/application/views/gestion_wallet_ilink.php +++ b/application/views/gestion_wallet_ilink.php @@ -7,6 +7,8 @@ href=""> " . $walletHyper->first_row()->lastname . " - " . Money::of(round($walletHyper->first_row()->balance_princ, 0),$currency ? $currency->code : 'XAF')->formatTo('fr_FR'). " - " .Money::of(round($walletHyper->first_row()->balance_com, 0), $currency ? $currency->code : 'XAF')->formatTo('fr_FR'). " - " .Money::of(round($totalCommissionBanque,0), $currency ? $currency->code : 'XAF')->formatTo('fr_FR') . ""; + " . Money::of(round($walletHyper->first_row()->balance_princ, 0),$currency ? $currency->code : 'XAF',new AutoContext())->formatTo('fr_FR'). " + " .Money::of(round($walletHyper->first_row()->balance_com, 0), $currency ? $currency->code : 'XAF',new AutoContext())->formatTo('fr_FR'). " + " .Money::of(round($totalCommissionBanque,0), $currency ? $currency->code : 'XAF',new AutoContext())->formatTo('fr_FR') . ""; echo "" . $depots->num_rows() . " " . $retraits->num_rows() . " diff --git a/application/views/gestion_wallet_ilink_hyp.php b/application/views/gestion_wallet_ilink_hyp.php index 18d7b293..e48de399 100755 --- a/application/views/gestion_wallet_ilink_hyp.php +++ b/application/views/gestion_wallet_ilink_hyp.php @@ -92,6 +92,8 @@ } ".$row->lastname." - ".Money::of(round($princ,0), $this->session->userdata('currency_code'))->formatTo('fr_FR')." - ".Money::of(round($com,0), $this->session->userdata('currency_code'))->formatTo('fr_FR').""; + ".Money::of(round($princ,0), $this->session->userdata('currency_code'),new AutoContext())->formatTo('fr_FR')." + ".Money::of(round($com,0), $this->session->userdata('currency_code'),new AutoContext())->formatTo('fr_FR').""; $nb_depots = 0; $nb_retraits = 0; $commission_banque = 0; @@ -1028,7 +1030,7 @@ use Brick\Money\Money; $commission_banque+= $retrait->commission_banque; } } - echo "".Money::of(round($commission_banque,0), $this->session->userdata('currency_code'))->formatTo('fr_FR')." + echo "".Money::of(round($commission_banque,0), $this->session->userdata('currency_code'),new AutoContext())->formatTo('fr_FR')." ".$nb_depots." ".$nb_retraits." "; diff --git a/application/views/gestion_wallet_ilink_paying_network_account.php b/application/views/gestion_wallet_ilink_paying_network_account.php index 2c949c3f..65a9f2da 100755 --- a/application/views/gestion_wallet_ilink_paying_network_account.php +++ b/application/views/gestion_wallet_ilink_paying_network_account.php @@ -11,6 +11,8 @@ lang->line('paying_networks_accounts')?> - balance_com, 0),$row->currency_code ? $row->currency_code : 'XAF')->formatTo('fr_FR')?> + balance_com, 0),$row->currency_code ? $row->currency_code : 'XAF',new AutoContext())->formatTo('fr_FR')?> montant_retrait ; } - $moneyNetInit = Money::of(round($net, $row->init_currency,0)); + $moneyNetInit = Money::of(round($net,0), $row->init_currency,new AutoContext()); $moneyNetFinal = $converter->convert($moneyNetInit, $row->final_currency ? $row->final_currency : 'XAF', RoundingMode::DOWN); echo " $row->id @@ -162,12 +164,12 @@ use Brick\Money\Money; ".join(" ", str_split($row->numero_carte, 4))." ".$moneyNetInit->formatTo('fr_FR')." ".$moneyNetFinal->formatTo('fr_FR')." - ".Money::of(round($row->frais,0), $row->init_currency)->formatTo('fr_FR')." - ".Money::of(round($row->taxe, 0),$row->init_currency)->formatTo('fr_FR')." - ".Money::of(round($row->commission_banque ? $row->commission_banque : 0, 0),$row->init_currency)->formatTo('fr_FR')." - ".Money::of(round($row->commission_hyp ? $row->commission_hyp : 0, 0),$row->init_currency)->formatTo('fr_FR')." - ".Money::of(round($row->commission_sup ? $row->commission_sup : 0 , 0),$row->init_currency)->formatTo('fr_FR')." - ".Money::of(round($row->commission_ag ? $row->commission_ag : 0, 0),$row->init_currency)->formatTo('fr_FR')." + ".Money::of(round($row->frais,0), $row->init_currency,new AutoContext())->formatTo('fr_FR')." + ".Money::of(round($row->taxe, 0),$row->init_currency,new AutoContext())->formatTo('fr_FR')." + ".Money::of(round($row->commission_banque ? $row->commission_banque : 0, 0),$row->init_currency,new AutoContext())->formatTo('fr_FR')." + ".Money::of(round($row->commission_hyp ? $row->commission_hyp : 0, 0),$row->init_currency,new AutoContext())->formatTo('fr_FR')." + ".Money::of(round($row->commission_sup ? $row->commission_sup : 0 , 0),$row->init_currency,new AutoContext())->formatTo('fr_FR')." + ".Money::of(round($row->commission_ag ? $row->commission_ag : 0, 0),$row->init_currency,new AutoContext())->formatTo('fr_FR')." ".$row->agent." ".$row->user." ".toLocateDate($row->date,$this->session->userdata('timezone'))."";