+ Fix regulations limits
This commit is contained in:
parent
1ef09b3298
commit
36ce2e3ac0
|
@ -2260,14 +2260,21 @@ class Gestion extends CI_Controller
|
||||||
if (isset($_POST)) {
|
if (isset($_POST)) {
|
||||||
|
|
||||||
$country_id = $_POST['country_id'];
|
$country_id = $_POST['country_id'];
|
||||||
$max_day = $_POST['max_day'];
|
$max_day_national = $_POST['max_day_national'];
|
||||||
$max_week = $_POST['max_week'];
|
$max_week_national = $_POST['max_week_national'];
|
||||||
$max_month = $_POST['max_month'];
|
$max_month_national = $_POST['max_month_national'];
|
||||||
|
|
||||||
|
$max_day_international = $_POST['max_day_international'];
|
||||||
|
$max_week_international = $_POST['max_week_international'];
|
||||||
|
$max_month_international = $_POST['max_month_international'];
|
||||||
|
|
||||||
$limits = $this->wallet_model->getRegulationsLimits($country_id);
|
$limits = $this->wallet_model->getRegulationsLimits($country_id);
|
||||||
if($limits){
|
if($limits){
|
||||||
$this->wallet_model->updateRegulationsLimits($country_id,$max_day,$max_week,$max_month);
|
$this->wallet_model->updateRegulationsLimits($country_id,$max_day_national,$max_week_national,$max_month_national,
|
||||||
|
$max_day_international,$max_week_international,$max_month_international);
|
||||||
}else{
|
}else{
|
||||||
$this->wallet_model->insertRegulationsLimits($country_id,$max_day,$max_week,$max_month);
|
$this->wallet_model->insertRegulationsLimits($country_id,$max_day_national,$max_week_national,$max_month_national,
|
||||||
|
$max_day_international,$max_week_international,$max_month_international);
|
||||||
}
|
}
|
||||||
$res = true;
|
$res = true;
|
||||||
if ($res) {
|
if ($res) {
|
||||||
|
|
|
@ -503,4 +503,7 @@ $lang['regulations_updated'] = 'Regulatory limits updated';
|
||||||
$lang['refunded_amount'] = "Amount refunded";
|
$lang['refunded_amount'] = "Amount refunded";
|
||||||
$lang['remains_to_be_reimbursed'] = "Remainder to reimburse";
|
$lang['remains_to_be_reimbursed'] = "Remainder to reimburse";
|
||||||
$lang['end_date'] = "End date";
|
$lang['end_date'] = "End date";
|
||||||
|
$lang['cash_withdrawal'] = "Withdrawal in cash";
|
||||||
|
$lang['validation_date'] = "Date of validation";
|
||||||
|
$lang['repayment_date'] = "Repayment date";
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -515,4 +515,7 @@ $lang['regulations_updated'] = 'Limites réglementaires mis à jour';
|
||||||
$lang['refunded_amount'] = "Montant remboursé";
|
$lang['refunded_amount'] = "Montant remboursé";
|
||||||
$lang['remains_to_be_reimbursed'] = "Reste à rembourser";
|
$lang['remains_to_be_reimbursed'] = "Reste à rembourser";
|
||||||
$lang['end_date'] = "Date de fin";
|
$lang['end_date'] = "Date de fin";
|
||||||
|
$lang['cash_withdrawal'] = "Retrait en cash";
|
||||||
|
$lang['validation_date'] = "Date de la validation";
|
||||||
|
$lang['repayment_date'] = "Date de remboursement";
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -829,7 +829,8 @@ class Wallet_model extends CI_Model
|
||||||
// Gestion reglementaire
|
// Gestion reglementaire
|
||||||
|
|
||||||
public function getRegulationsCountries(){
|
public function getRegulationsCountries(){
|
||||||
$query = $this->db->query("SELECT distinct cc.id , cc.name as country , cc.currency_code, r.id_country, r.montant_max_jour, r.montant_max_hebdo, r.montant_max_mensuel FROM networks n
|
$query = $this->db->query("SELECT distinct cc.id , cc.name as country , cc.currency_code, r.id_country, r.montant_max_jour_national, r.montant_max_hebdo_national, r.montant_max_mensuel_national,
|
||||||
|
r.montant_max_jour_international, r.montant_max_hebdo_international, r.montant_max_mensuel_international FROM networks n
|
||||||
INNER JOIN countries_currencies cc ON n.country_id= cc.id INNER JOIN configWallet cw ON cw.id_network = n.id LEFT JOIN regulations r ON r.id_country = cc.id;");
|
INNER JOIN countries_currencies cc ON n.country_id= cc.id INNER JOIN configWallet cw ON cw.id_network = n.id LEFT JOIN regulations r ON r.id_country = cc.id;");
|
||||||
if ($query->num_rows() > 0) {
|
if ($query->num_rows() > 0) {
|
||||||
return $query;
|
return $query;
|
||||||
|
@ -847,15 +848,17 @@ INNER JOIN countries_currencies cc ON n.country_id= cc.id INNER JOIN configWalle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function insertRegulationsLimits($id_country, $max_day , $max_week , $max_month){
|
public function insertRegulationsLimits($id_country, $max_day_national , $max_week_national , $max_month_national, $max_day_international , $max_week_international , $max_month_international){
|
||||||
$sql = "INSERT INTO `regulations` (`id_country`, `montant_max_jour`, `montant_max_hebdo`, `montant_max_mensuel`) VALUES (?,?, ?, ?);";
|
$sql = "INSERT INTO `regulations` (`id_country`, `montant_max_jour_national`, `montant_max_hebdo_national`, `montant_max_mensuel_national`,
|
||||||
$query = $this->db->query($sql , array($id_country,$max_day,$max_week,$max_month));
|
`montant_max_jour_international`, `montant_max_hebdo_international`, `montant_max_mensuel_international`) VALUES (?,?, ?, ?,?,?,?);";
|
||||||
|
$query = $this->db->query($sql , array($id_country,$max_day_national,$max_week_national,$max_month_national,$max_day_international,$max_week_international,$max_month_international));
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateRegulationsLimits($id_country, $max_day , $max_week , $max_month){
|
public function updateRegulationsLimits($id_country, $max_day_national , $max_week_national , $max_month_national, $max_day_international , $max_week_international , $max_month_international){
|
||||||
$sql = "UPDATE `regulations` SET `montant_max_jour` = ? , `montant_max_hebdo` = ? , `montant_max_mensuel` = ? WHERE (`id_country` = ?);";
|
$sql = "UPDATE `regulations` SET `montant_max_jour_national` = ? , `montant_max_hebdo_national` = ? , `montant_max_mensuel_national` = ?,
|
||||||
$query = $this->db->query($sql , array($max_day,$max_week,$max_month,$id_country));
|
`montant_max_jour_international` = ? , `montant_max_hebdo_international` = ? , `montant_max_mensuel_international` = ? WHERE (`id_country` = ?);";
|
||||||
|
$query = $this->db->query($sql , array($max_day_national,$max_week_national,$max_month_national,$max_day_international,$max_week_international,$max_month_international,$id_country));
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,9 +65,12 @@ $context = new \Brick\Money\Context\AutoContext();
|
||||||
<tr>
|
<tr>
|
||||||
<th align='center'>N°</th>
|
<th align='center'>N°</th>
|
||||||
<th><?php echo $this->lang->line('Pays'); ?></th>
|
<th><?php echo $this->lang->line('Pays'); ?></th>
|
||||||
<th align='center'><?php echo $this->lang->line('max_amount_per_day'); ?></th>
|
<th align='center'><?php echo $this->lang->line('max_amount_per_day').' national'; ?></th>
|
||||||
<th align='center'><?php echo $this->lang->line('max_amount_per_week'); ?></th>
|
<th align='center'><?php echo $this->lang->line('max_amount_per_week').' national'; ?></th>
|
||||||
<th align='center'><?php echo $this->lang->line('max_amount_per_month'); ?></th>
|
<th align='center'><?php echo $this->lang->line('max_amount_per_month').' national'; ?></th>
|
||||||
|
<th align='center'><?php echo $this->lang->line('max_amount_per_day').' international'; ?></th>
|
||||||
|
<th align='center'><?php echo $this->lang->line('max_amount_per_week').' international'; ?></th>
|
||||||
|
<th align='center'><?php echo $this->lang->line('max_amount_per_month').' international'; ?></th>
|
||||||
<th align='center'> Action </th>
|
<th align='center'> Action </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -82,10 +85,13 @@ $context = new \Brick\Money\Context\AutoContext();
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
?>
|
?>
|
||||||
<td> <?php if($row->id_country) echo Money::of(round($row->montant_max_jour, 2), $row->currency_code, $context)->formatTo('fr_FR') ?></td>
|
<td> <?php if($row->id_country) echo Money::of(round($row->montant_max_jour_national, 2), $row->currency_code, $context)->formatTo('fr_FR') ?></td>
|
||||||
<td><?php if($row->id_country) echo Money::of(round($row->montant_max_hebdo, 2), $row->currency_code, $context)->formatTo('fr_FR') ?></td>
|
<td><?php if($row->id_country) echo Money::of(round($row->montant_max_hebdo_national, 2), $row->currency_code, $context)->formatTo('fr_FR') ?></td>
|
||||||
<td><?php if($row->id_country) echo Money::of(round($row->montant_max_mensuel, 2), $row->currency_code, $context)->formatTo('fr_FR'); ?></td>
|
<td><?php if($row->id_country) echo Money::of(round($row->montant_max_mensuel_national, 2), $row->currency_code, $context)->formatTo('fr_FR'); ?></td>
|
||||||
<?php
|
<td> <?php if($row->id_country) echo Money::of(round($row->montant_max_jour_international, 2), $row->currency_code, $context)->formatTo('fr_FR') ?></td>
|
||||||
|
<td><?php if($row->id_country) echo Money::of(round($row->montant_max_hebdo_international, 2), $row->currency_code, $context)->formatTo('fr_FR') ?></td>
|
||||||
|
<td><?php if($row->id_country) echo Money::of(round($row->montant_max_mensuel_international, 2), $row->currency_code, $context)->formatTo('fr_FR'); ?></td>
|
||||||
|
<?php
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<td>
|
<td>
|
||||||
|
@ -97,32 +103,55 @@ $context = new \Brick\Money\Context\AutoContext();
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<div class="modal fade" id="<?='configureLimits'.$num?>" tabindex="-1" role="dialog" aria-hidden="true">
|
<div class="modal fade" id="<?='configureLimits'.$num?>" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h3 class="modal-title"><?php echo $this->lang->line('define_the_limits'); ?></h3>
|
<h3 class="modal-title"><?php echo $this->lang->line('define_the_limits'); ?></h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form id="<?='limitsForm'.$num?>">
|
<form id="<?='limitsForm'.$num?>" class="row">
|
||||||
<div class="form-group">
|
<div class="col-lg-6 col-md-6">
|
||||||
<label for="rate"
|
<div class="form-group">
|
||||||
class="col-form-label"><?= $this->lang->line('max_amount_per_day') ?></label>
|
<label for="rate"
|
||||||
<input type="number" min="0" step=".01" required class="form-control"
|
class="col-form-label"><?= $this->lang->line('max_amount_per_day').' national' ?></label>
|
||||||
name="max_day" id="<?='max_day'.$num?>" value="<?=$row->montant_max_jour?>">
|
<input type="number" min="0" step=".01" required class="form-control"
|
||||||
</div>
|
name="max_day_national" id="<?='max_day_national'.$num?>" value="<?=$row->montant_max_jour_national?>">
|
||||||
<div class="form-group">
|
</div>
|
||||||
<label for="url"
|
<div class="form-group">
|
||||||
class="col-form-label"><?= $this->lang->line('max_amount_per_week') ?></label>
|
<label for="url"
|
||||||
<input type="number" min="0" step=".01" required class="form-control" value="<?=$row->montant_max_hebdo?>"
|
class="col-form-label"><?= $this->lang->line('max_amount_per_week').' national' ?></label>
|
||||||
id="<?='max_week'.$num?>" name="max_week">
|
<input type="number" min="0" step=".01" required class="form-control" value="<?=$row->montant_max_hebdo_national?>"
|
||||||
</div>
|
id="<?='max_week_national'.$num?>" name="max_week_national">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="url"
|
<label for="url"
|
||||||
class="col-form-label"><?= $this->lang->line('max_amount_per_month') ?></label>
|
class="col-form-label"><?= $this->lang->line('max_amount_per_month').' national' ?></label>
|
||||||
<input type="number" min="0" step=".01" required class="form-control" value="<?=$row->montant_max_mensuel?>"
|
<input type="number" min="0" step=".01" required class="form-control" value="<?=$row->montant_max_mensuel_national?>"
|
||||||
id="<?='max_month'.$num?>" name="max_month">
|
id="<?='max_month_national'.$num?>" name="max_month_national">
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="rate"
|
||||||
|
class="col-form-label"><?= $this->lang->line('max_amount_per_day').' international' ?></label>
|
||||||
|
<input type="number" min="0" step=".01" required class="form-control"
|
||||||
|
name="max_day_international" id="<?='max_day_international'.$num?>" value="<?=$row->montant_max_jour_international?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="url"
|
||||||
|
class="col-form-label"><?= $this->lang->line('max_amount_per_week').' international' ?></label>
|
||||||
|
<input type="number" min="0" step=".01" required class="form-control" value="<?=$row->montant_max_hebdo_international?>"
|
||||||
|
id="<?='max_week_international'.$num?>" name="max_week_international">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="url"
|
||||||
|
class="col-form-label"><?= $this->lang->line('max_amount_per_month').' international' ?></label>
|
||||||
|
<input type="number" min="0" step=".01" required class="form-control" value="<?=$row->montant_max_mensuel_international?>"
|
||||||
|
id="<?='max_month_international'.$num?>" name="max_month_international">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
@ -203,14 +232,22 @@ $context = new \Brick\Money\Context\AutoContext();
|
||||||
|
|
||||||
$(document).on("click", ".setLimits", function () {
|
$(document).on("click", ".setLimits", function () {
|
||||||
if ($('#limitsForm'+num)[0].checkValidity()) {
|
if ($('#limitsForm'+num)[0].checkValidity()) {
|
||||||
const max_day = parseFloat($('#max_day'+num).val());
|
|
||||||
const max_week = parseFloat($('#max_week'+num).val());
|
const max_day_national = parseFloat($('#max_day_national'+num).val());
|
||||||
const max_month = parseFloat($('#max_month'+num).val());
|
const max_week_national = parseFloat($('#max_week_national'+num).val());
|
||||||
|
const max_month_national = parseFloat($('#max_month_national'+num).val());
|
||||||
|
|
||||||
|
const max_day_international = parseFloat($('#max_day_international'+num).val());
|
||||||
|
const max_week_international = parseFloat($('#max_week_international'+num).val());
|
||||||
|
const max_month_international = parseFloat($('#max_month_international'+num).val());
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?php echo base_url('index.php/Gestion/setRegulationsLimits')?>',
|
url: '<?php echo base_url('index.php/Gestion/setRegulationsLimits')?>',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: {"country_id": country_id, "max_day": max_day, "max_week": max_week,"max_month" : max_month},
|
data: {"country_id": country_id,
|
||||||
|
"max_day_national": max_day_national, "max_week_national": max_week_national,"max_month_national" : max_month_national,
|
||||||
|
"max_day_international": max_day_international, "max_week_international": max_week_international,"max_month_international" : max_month_international
|
||||||
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data == '200') {
|
if (data == '200') {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
|
|
|
@ -135,9 +135,9 @@
|
||||||
<th><?php echo $this->lang->line('tax') ?></th>
|
<th><?php echo $this->lang->line('tax') ?></th>
|
||||||
<th><?php echo $this->lang->line('agent_name') ?></th>
|
<th><?php echo $this->lang->line('agent_name') ?></th>
|
||||||
<th><?php echo $this->lang->line('issuer_id') ?></th>
|
<th><?php echo $this->lang->line('issuer_id') ?></th>
|
||||||
<th>Retrait en cash</th>
|
<th><?php echo $this->lang->line('cash_withdrawal') ?></th>
|
||||||
<th>Date de la demande</th>
|
<th><?php echo $this->lang->line('validation_date') ?></th>
|
||||||
<th>Date de remboursement</th>
|
<th><?php echo $this->lang->line('repayment_date') ?></th>
|
||||||
<th align='center'><?php echo $this->lang->line('created_date') ?></th>
|
<th align='center'><?php echo $this->lang->line('created_date') ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -159,7 +159,7 @@
|
||||||
$retrait = "";
|
$retrait = "";
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
<td align='center' >$row->id_demande</td>
|
<td align='center' >$row->id_demande</td>
|
||||||
<td>" . strtoupper($row->etat) . "</td>
|
<td>" . str_replace('_',' ',$row->etat) . "</td>
|
||||||
<td>" . strtoupper($row->type_caution) . "</td>
|
<td>" . strtoupper($row->type_caution) . "</td>
|
||||||
<td>" . strtoupper($row->duree_mois) . "</td>
|
<td>" . strtoupper($row->duree_mois) . "</td>
|
||||||
<td>" . Money::of(round($row->montant_rembourse, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
|
<td>" . Money::of(round($row->montant_rembourse, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
|
||||||
|
@ -169,7 +169,7 @@
|
||||||
<td>" . $row->agent . "</td>
|
<td>" . $row->agent . "</td>
|
||||||
<td>" . $emetteur . "</td>
|
<td>" . $emetteur . "</td>
|
||||||
<td>" . $retrait . "</td>
|
<td>" . $retrait . "</td>
|
||||||
<td>" . toLocateDate($row->date_demande, $this->session->userdata('timezone')) . "</td>
|
<td>" . toLocateDate($row->date_validation, $this->session->userdata('timezone')) . "</td>
|
||||||
<td>" . toLocateDate($row->date_remboursement, $this->session->userdata('timezone')) . "</td>
|
<td>" . toLocateDate($row->date_remboursement, $this->session->userdata('timezone')) . "</td>
|
||||||
<td>" . toLocateDate($row->date_creation, $this->session->userdata('timezone')) . "</td>";
|
<td>" . toLocateDate($row->date_creation, $this->session->userdata('timezone')) . "</td>";
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -151,12 +151,12 @@
|
||||||
$moneyNet = Money::of(round($row->montant, 2), $currency_code, $context);
|
$moneyNet = Money::of(round($row->montant, 2), $currency_code, $context);
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
<td align='center' >$row->id_epargne</td>
|
<td align='center' >$row->id_epargne</td>
|
||||||
<td>" . strtoupper($row->etat) . "</td>
|
<td>" . str_replace('_',' ',$row->etat) . "</td>
|
||||||
<td>" . strtoupper($row->duree_mois) . "</td>
|
<td>" . strtoupper($row->duree_mois) . "</td>
|
||||||
<td>" . $moneyNet->formatTo('fr_FR') . "</td>
|
<td>" . $moneyNet->formatTo('fr_FR') . "</td>
|
||||||
<td>" . Money::of(round($row->interet, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
|
<td>" . Money::of(round($row->interet, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
|
||||||
<td>" . Money::of(round($row->taxe, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
|
<td>" . Money::of(round($row->taxe, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
|
||||||
<td>" . $emetteur . "</td>
|
<td>" . $emetteur. "</td>
|
||||||
<td>" . toLocateDate($row->date_creation, $this->session->userdata('timezone')) . "</td>
|
<td>" . toLocateDate($row->date_creation, $this->session->userdata('timezone')) . "</td>
|
||||||
<td>" . toLocateDate($row->date_cassation, $this->session->userdata('timezone')) . "</td>
|
<td>" . toLocateDate($row->date_cassation, $this->session->userdata('timezone')) . "</td>
|
||||||
<td>" . toLocateDate($row->date_fin, $this->session->userdata('timezone')) . "</td>";
|
<td>" . toLocateDate($row->date_fin, $this->session->userdata('timezone')) . "</td>";
|
||||||
|
|
Loading…
Reference in New Issue