+ Fix bugs with currency conversion
This commit is contained in:
parent
3a22be7eed
commit
13bc4341df
|
@ -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');
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
|
||||
|
||||
<?php
|
||||
|
||||
use Brick\Money\Context\AutoContext;
|
||||
use Brick\Money\Money;
|
||||
function convertDate($date)
|
||||
{
|
||||
|
@ -175,7 +177,7 @@ $fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
|
|||
<div class="col-lg-4 col-xs-6">
|
||||
<div class="small-box bg-green">
|
||||
<div class="inner">
|
||||
<h3><?php echo Money::of(round($commission,0), $currency ? $currency->code : 'XAF')->formatTo('fr_FR'); ?></h3>
|
||||
<h3><?php echo Money::of(round($commission,0), $currency ? $currency->code : 'XAF',new AutoContext())->formatTo('fr_FR'); ?></h3>
|
||||
<p><?php echo $this->lang->line('Solde Commission') ?></p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
|
||||
|
||||
<?php
|
||||
|
||||
use Brick\Money\Context\AutoContext;
|
||||
use Brick\Money\Money;
|
||||
function convertDate($date)
|
||||
{
|
||||
|
@ -824,9 +826,9 @@ $fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
|
|||
$fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
|
||||
echo "<tr>
|
||||
<td>" . $walletHyper->first_row()->lastname . "</td>
|
||||
<td>" . Money::of(round($walletHyper->first_row()->balance_princ, 0),$currency ? $currency->code : 'XAF')->formatTo('fr_FR'). "</td>
|
||||
<td>" .Money::of(round($walletHyper->first_row()->balance_com, 0), $currency ? $currency->code : 'XAF')->formatTo('fr_FR'). "</td>
|
||||
<td>" .Money::of(round($totalCommissionBanque,0), $currency ? $currency->code : 'XAF')->formatTo('fr_FR') . "</td>";
|
||||
<td>" . Money::of(round($walletHyper->first_row()->balance_princ, 0),$currency ? $currency->code : 'XAF',new AutoContext())->formatTo('fr_FR'). "</td>
|
||||
<td>" .Money::of(round($walletHyper->first_row()->balance_com, 0), $currency ? $currency->code : 'XAF',new AutoContext())->formatTo('fr_FR'). "</td>
|
||||
<td>" .Money::of(round($totalCommissionBanque,0), $currency ? $currency->code : 'XAF',new AutoContext())->formatTo('fr_FR') . "</td>";
|
||||
|
||||
echo "<td>" . $depots->num_rows() . "</td>
|
||||
<td>" . $retraits->num_rows() . "</td>
|
||||
|
|
|
@ -92,6 +92,8 @@
|
|||
}
|
||||
</style>
|
||||
<?php
|
||||
|
||||
use Brick\Money\Context\AutoContext;
|
||||
use Brick\Money\Money;
|
||||
function convertDate($date){
|
||||
$month = null;
|
||||
|
@ -1011,8 +1013,8 @@ use Brick\Money\Money;
|
|||
}
|
||||
echo "<tr>
|
||||
<td>".$row->lastname."</td>
|
||||
<td>".Money::of(round($princ,0), $this->session->userdata('currency_code'))->formatTo('fr_FR')."</td>
|
||||
<td>".Money::of(round($com,0), $this->session->userdata('currency_code'))->formatTo('fr_FR')."</td>";
|
||||
<td>".Money::of(round($princ,0), $this->session->userdata('currency_code'),new AutoContext())->formatTo('fr_FR')."</td>
|
||||
<td>".Money::of(round($com,0), $this->session->userdata('currency_code'),new AutoContext())->formatTo('fr_FR')."</td>";
|
||||
$nb_depots = 0;
|
||||
$nb_retraits = 0;
|
||||
$commission_banque = 0;
|
||||
|
@ -1028,7 +1030,7 @@ use Brick\Money\Money;
|
|||
$commission_banque+= $retrait->commission_banque;
|
||||
}
|
||||
}
|
||||
echo "<td>".Money::of(round($commission_banque,0), $this->session->userdata('currency_code'))->formatTo('fr_FR')."</td>
|
||||
echo "<td>".Money::of(round($commission_banque,0), $this->session->userdata('currency_code'),new AutoContext())->formatTo('fr_FR')."</td>
|
||||
<td>".$nb_depots."</td>
|
||||
<td>".$nb_retraits."</td>
|
||||
</tr>";
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
<?php echo $this->lang->line('paying_networks_accounts')?>
|
||||
</h1>
|
||||
<?php
|
||||
|
||||
use Brick\Money\Context\AutoContext;
|
||||
use Brick\Money\Money;
|
||||
$site_url = base_url();
|
||||
|
||||
|
@ -95,7 +97,7 @@
|
|||
}
|
||||
?>
|
||||
<td>
|
||||
<?= Money::of(round($row->balance_com, 0),$row->currency_code ? $row->currency_code : 'XAF')->formatTo('fr_FR')?>
|
||||
<?= Money::of(round($row->balance_com, 0),$row->currency_code ? $row->currency_code : 'XAF',new AutoContext())->formatTo('fr_FR')?>
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
|
||||
<div class="content-wrapper">
|
||||
<?php
|
||||
use Carbon\Carbon;
|
||||
|
||||
use Brick\Money\Context\AutoContext;
|
||||
use Carbon\Carbon;
|
||||
use Brick\Money\CurrencyConverter;
|
||||
use Brick\Money\ExchangeRateProvider\PDOProvider;
|
||||
use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration;
|
||||
|
@ -153,7 +155,7 @@ use Brick\Money\Money;
|
|||
}else{
|
||||
$net = $row->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 "<tr>
|
||||
<td align='center' >$row->id</td>
|
||||
|
@ -162,12 +164,12 @@ use Brick\Money\Money;
|
|||
<td>".join(" ", str_split($row->numero_carte, 4))."</td>
|
||||
<td>".$moneyNetInit->formatTo('fr_FR')."</td>
|
||||
<td>".$moneyNetFinal->formatTo('fr_FR')."</td>
|
||||
<td>".Money::of(round($row->frais,0), $row->init_currency)->formatTo('fr_FR')."</td>
|
||||
<td>".Money::of(round($row->taxe, 0),$row->init_currency)->formatTo('fr_FR')."</td>
|
||||
<td>".Money::of(round($row->commission_banque ? $row->commission_banque : 0, 0),$row->init_currency)->formatTo('fr_FR')."</td>
|
||||
<td>".Money::of(round($row->commission_hyp ? $row->commission_hyp : 0, 0),$row->init_currency)->formatTo('fr_FR')."</td>
|
||||
<td>".Money::of(round($row->commission_sup ? $row->commission_sup : 0 , 0),$row->init_currency)->formatTo('fr_FR')."</td>
|
||||
<td>".Money::of(round($row->commission_ag ? $row->commission_ag : 0, 0),$row->init_currency)->formatTo('fr_FR')."</td>
|
||||
<td>".Money::of(round($row->frais,0), $row->init_currency,new AutoContext())->formatTo('fr_FR')."</td>
|
||||
<td>".Money::of(round($row->taxe, 0),$row->init_currency,new AutoContext())->formatTo('fr_FR')."</td>
|
||||
<td>".Money::of(round($row->commission_banque ? $row->commission_banque : 0, 0),$row->init_currency,new AutoContext())->formatTo('fr_FR')."</td>
|
||||
<td>".Money::of(round($row->commission_hyp ? $row->commission_hyp : 0, 0),$row->init_currency,new AutoContext())->formatTo('fr_FR')."</td>
|
||||
<td>".Money::of(round($row->commission_sup ? $row->commission_sup : 0 , 0),$row->init_currency,new AutoContext())->formatTo('fr_FR')."</td>
|
||||
<td>".Money::of(round($row->commission_ag ? $row->commission_ag : 0, 0),$row->init_currency,new AutoContext())->formatTo('fr_FR')."</td>
|
||||
<td>".$row->agent."</td>
|
||||
<td>".$row->user."</td>
|
||||
<td>".toLocateDate($row->date,$this->session->userdata('timezone'))."</td>";
|
||||
|
|
Loading…
Reference in New Issue