+ Update calculator and fix bugs
This commit is contained in:
parent
68ffad6bf1
commit
cc4cd2dd65
|
@ -1559,6 +1559,7 @@ class Gestion extends CI_Controller
|
|||
$data['plr_user_wallet_cash'] = $this->user_model->getPalierConfigWallet("user_wallet_cash" , $data['idConfig']);
|
||||
$data['plr_agent_depot_wallet'] = $this->user_model->getPalierConfigWallet("agent_depot_wallet" , $data['idConfig']);
|
||||
$data['plr_agent_cash_cash'] = $this->user_model->getPalierConfigWallet("agent_cash_cash" , $data['idConfig']);
|
||||
$data['taxes'] = $this->user_model->getTaxes($data['idConfig']);
|
||||
$data['u_w_w_min'] = $taux->taux_com_user_wallet_wallet_min;
|
||||
$data['u_w_w_max'] = $taux->taux_com_user_wallet_wallet_max;
|
||||
$data['taux_u_w_w'] = $taux->taux_com_user_wallet_wallet;
|
||||
|
@ -1715,6 +1716,23 @@ class Gestion extends CI_Controller
|
|||
|
||||
}
|
||||
|
||||
public function saveTaxes(){
|
||||
if($this->isLogged()) {
|
||||
if(isset($_POST)) {
|
||||
$idConfig = $_POST['id_config'];
|
||||
$taxes = isset($_POST['taxes']) ? $_POST['taxes'] : null ;
|
||||
$this->insertTaxes($taxes, $idConfig);
|
||||
$res = true;
|
||||
|
||||
if ($res) {
|
||||
echo json_encode("200");
|
||||
} else {
|
||||
echo json_encode("500");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function insertPalier($palier , $name , $idConfig){
|
||||
|
||||
$exist = $this->user_model->getPalierConfigWallet($name , $idConfig);
|
||||
|
@ -1734,6 +1752,25 @@ class Gestion extends CI_Controller
|
|||
}
|
||||
}
|
||||
|
||||
private function insertTaxes($palier , $idConfig){
|
||||
|
||||
$exist = $this->user_model->getTaxes($idConfig);
|
||||
if($exist){
|
||||
$this->user_model->deleteTaxes($idConfig);
|
||||
}
|
||||
|
||||
if($palier) {
|
||||
foreach ($palier as $p) {
|
||||
$array = json_decode(json_encode($p), true);
|
||||
$row = [];
|
||||
foreach ($array as $key => $value){
|
||||
$row[] = $value;
|
||||
}
|
||||
$this->user_model->addTaxe($idConfig, $row[0], $row[1], $row[2], $row[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function delete_config_wallet()
|
||||
{
|
||||
if($this->isLogged()){
|
||||
|
|
|
@ -338,6 +338,7 @@ class Hyperviseur_dash extends CI_Controller
|
|||
$data['plr_user_wallet_cash'] = $this->user_model->getPalierConfigWallet("user_wallet_cash", $data['idConfig']);
|
||||
$data['plr_agent_depot_wallet'] = $this->user_model->getPalierConfigWallet("agent_depot_wallet", $data['idConfig']);
|
||||
$data['plr_agent_cash_cash'] = $this->user_model->getPalierConfigWallet("agent_cash_cash", $data['idConfig']);
|
||||
$data['taxes'] = $this->user_model->getTaxes($data['idConfig']);
|
||||
$data['u_w_w_min'] = $taux->taux_com_user_wallet_wallet_min;
|
||||
$data['u_w_w_max'] = $taux->taux_com_user_wallet_wallet_max;
|
||||
$data['taux_u_w_w'] = $taux->taux_com_user_wallet_wallet;
|
||||
|
@ -656,9 +657,19 @@ class Hyperviseur_dash extends CI_Controller
|
|||
$data['plr_user_wallet_cash'] = $this->user_model->getPalierConfigWallet("user_wallet_cash", $data['idConfig']);
|
||||
$data['plr_agent_depot_wallet'] = $this->user_model->getPalierConfigWallet("agent_depot_wallet", $data['idConfig']);
|
||||
$data['plr_agent_cash_cash'] = $this->user_model->getPalierConfigWallet("agent_cash_cash", $data['idConfig']);
|
||||
$data['taxes'] = $this->user_model->getTaxes($data['idConfig']);
|
||||
$operations = [
|
||||
new Operation(1, $this->lang->line('op1')),
|
||||
new Operation(2, "Retrait d'argent")
|
||||
new Operation(2, $this->lang->line('op2')),
|
||||
new Operation(3, $this->lang->line('op3')),
|
||||
// new Operation(4, $this->lang->line('op4')),
|
||||
new Operation(5, $this->lang->line('op5')),
|
||||
new Operation(6, $this->lang->line('op6')),
|
||||
// new Operation(7, $this->lang->line('op7')),
|
||||
// new Operation(8, $this->lang->line('op8')),
|
||||
new Operation(9, $this->lang->line('op9')),
|
||||
new Operation(10, $this->lang->line('op10')),
|
||||
new Operation(11, $this->lang->line('op11')),
|
||||
];
|
||||
$data['operations'] = $operations;
|
||||
// if (isset($_POST)) {
|
||||
|
@ -670,21 +681,6 @@ class Hyperviseur_dash extends CI_Controller
|
|||
$this->load->view('footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function cancelCreditRequest()
|
||||
{
|
||||
if ($this->isLogged()) {
|
||||
if (isset($_POST)) {
|
||||
$id_demand = $_POST['id_demand'];
|
||||
$res = $this->user_model->cancelCreditRequest($id_demand);
|
||||
if ($res) {
|
||||
echo json_encode("200");
|
||||
} else {
|
||||
echo json_encode("500");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Operation
|
||||
|
|
|
@ -307,6 +307,7 @@ class Superviseur_dash extends CI_Controller
|
|||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
||||
$data['country'] = $this->session->userdata('current_pays');
|
||||
$data['category'] = $this->session->userdata('category');
|
||||
$data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code'));
|
||||
|
||||
$this->load->view('header_sup', $data);
|
||||
$this->load->view('historique_transactions');
|
||||
|
|
|
@ -369,5 +369,18 @@ $lang['agent_name'] = 'Nom de l\'agent';
|
|||
$lang['cancel'] = 'Annuler';
|
||||
$lang['canceled_transaction'] = 'Transaction annulée';
|
||||
$lang['canceled_credit_request'] = 'Demande de crédit annulée';
|
||||
$lang['edit_tax'] = 'Modifier les taxes';
|
||||
$lang['configuration_of_tax'] = 'Configuration des taxes du wallet';
|
||||
$lang['transaction_taxes'] = 'Taxes sur les transactions';
|
||||
$lang['op1'] = 'Envoi de wallet à wallet';
|
||||
$lang['op2'] = 'Envoi de wallet à carte';
|
||||
$lang['op3'] = 'Envoi de wallet à cash';
|
||||
$lang['op4'] = 'Envoi de wallet à Banque';
|
||||
$lang['op5'] = 'Envoi de carte à wallet';
|
||||
$lang['op6'] = 'Envoi de carte à cash';
|
||||
$lang['op7'] = 'Envoi de carte à carte';
|
||||
$lang['op8'] = 'Envoi de carte à banque';
|
||||
$lang['op9'] = 'Retrait de wallet en cash';
|
||||
$lang['op10'] = 'Retrait de carte vers wallet';
|
||||
$lang['op11'] = 'Retrait de carte vers cash';
|
||||
?>
|
||||
|
|
|
@ -2234,6 +2234,12 @@ class User_model extends CI_Model
|
|||
return $query;
|
||||
}
|
||||
|
||||
public function addTaxe($idConfig ,$nom, $type ,$valeur , $destination){
|
||||
$sql = "INSERT INTO `taxes` (`nom`, `type`, `valeur`, `destination`, `idConfig`) VALUES (?,?,?,?,?);";
|
||||
$query = $this->db->query($sql , array($nom,$type, $valeur , $destination ,$idConfig));
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function updatePalierConfigWallet($id ,$min , $max ,$taux){
|
||||
$sql = "UPDATE `paliersConfigWallet` SET `min` = ? , `max` = ? , `taux` = ? WHERE (`id` = ?);";
|
||||
$query = $this->db->query($sql , array($min, $max , $taux , $id));
|
||||
|
@ -2250,6 +2256,16 @@ class User_model extends CI_Model
|
|||
}
|
||||
}
|
||||
|
||||
public function getTaxes($idConfig){
|
||||
$sql = "SELECT * FROM `taxes` WHERE (`idConfig` = ? );";
|
||||
$query = $this->db->query($sql , array($idConfig));
|
||||
if($query->num_rows()>0){
|
||||
return $query;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getOnePalierConfigWallet($id){
|
||||
$sql = "SELECT * FROM `paliersConfigWallet` WHERE (`id` = ?);";
|
||||
$query = $this->db->query($sql , array($id));
|
||||
|
@ -2267,6 +2283,13 @@ class User_model extends CI_Model
|
|||
|
||||
}
|
||||
|
||||
public function deleteTaxes($idConfig){
|
||||
$sql = "DELETE FROM `taxes` WHERE (`idConfig` = ? );";
|
||||
$query = $this->db->query($sql , array($idConfig));
|
||||
return $query;
|
||||
|
||||
}
|
||||
|
||||
public function updateConfigWalletIlink($u_w_w_min,$u_w_w_max,$taux_u_w_w,$u_w_c_min,$u_w_c_max,$taux_u_w_c,$taux_u_w_cart,$taux_u_c_w,$taux_u_c_c,$ag_d_w_min,$ag_d_w_max,$taux_ag_d_w,
|
||||
$taux_ag_d_c_c,$ag_c_c_min,$ag_c_c_max,$taux_ag_c_c,$taux_ag_cart_c,$taux_ag_cash_c,$taux_ag_s_c,$taux_sup_s_c,$taux_hyp_s_c,$taux_ag_r_c,$taux_sup_r_c,$taux_hyp_r_c,
|
||||
$taux_ag_d_c,$taux_sup_d_c,$taux_hyp_d_c,$taux_bq_d_c ,$taux_ag_r_cart,$taux_sup_r_cart,$taux_hyp_r_cart,$taux_bq_r_cart ,$idConfig){
|
||||
|
|
|
@ -4,78 +4,133 @@
|
|||
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css">
|
||||
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
|
||||
<?php
|
||||
|
||||
use Brick\Money\CurrencyConverter;
|
||||
use Brick\Money\ExchangeRateProvider\PDOProvider;
|
||||
use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration;
|
||||
use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider;
|
||||
use Brick\Math\RoundingMode;
|
||||
use Brick\Money\Money;
|
||||
|
||||
extract($_POST);
|
||||
|
||||
$showResult = false;
|
||||
$frais = 0;
|
||||
$taxe = 0;
|
||||
$config = $hasWallet->first_row();
|
||||
$plr_user_wallet_wallet = $plr_user_wallet_wallet ? $plr_user_wallet_wallet->result() : [];
|
||||
$plr_user_wallet_cash = $plr_user_wallet_cash ? $plr_user_wallet_cash->result() : [];
|
||||
$plr_agent_depot_wallet = $plr_agent_depot_wallet ? $plr_agent_depot_wallet->result() : [];
|
||||
$plr_agent_cash_cash = $plr_agent_cash_cash ? $plr_agent_cash_cash->result() : [];
|
||||
$taxes = $taxes ? $taxes->result() : [];
|
||||
$taxesNationales = array_filter($taxes, function ($tax) {
|
||||
return $tax->destination == 'national';
|
||||
});
|
||||
|
||||
if(isset($save))
|
||||
{
|
||||
$taxesInternationales = array_filter($taxes, function ($tax) {
|
||||
return $tax->destination == 'international';
|
||||
});
|
||||
|
||||
if (isset($save)) {
|
||||
$showResult = true;
|
||||
switch($operation) {
|
||||
case 1: //Envoi wallet à wallet
|
||||
$frais = ($init_country != $final_country) ? calculateFees1($plr_user_wallet_wallet, $montant) : calculateFees2($config->taux_com_user_wallet_wallet_min , $config->taux_com_user_wallet_wallet_max, $config->taux_com_user_wallet_wallet, $montant);
|
||||
break;
|
||||
case '-':
|
||||
$res=$fn-$sn;
|
||||
break;
|
||||
switch ($operation) {
|
||||
case 1: //Envoi wallet à wallet
|
||||
$frais = ($init_country != $final_country) ? calculateFees1($plr_user_wallet_wallet, $montant) : calculateFees2($config->taux_com_user_wallet_wallet_min, $config->taux_com_user_wallet_wallet_max, $config->taux_com_user_wallet_wallet, $montant);
|
||||
$taxe = ($init_country != $final_country) ? calculateTax($taxesInternationales , $frais) : calculateTax($taxesNationales ,$frais);
|
||||
break;
|
||||
case 2: //Envoi de wallet à carte
|
||||
$frais = $montant * $config->taux_com_user_wallet_carte / 100;
|
||||
$taxe = ($init_country != $final_country) ? calculateTax($taxesInternationales , $frais) : calculateTax($taxesNationales ,$frais);
|
||||
break;
|
||||
case 3: //Envoi de wallet à cash
|
||||
$frais = ($init_country != $final_country) ? calculateFees1($plr_user_wallet_cash, $montant) : calculateFees2($config->taux_com_user_wallet_cash_min, $config->taux_com_user_wallet_cash_max, $config->taux_com_user_wallet_cash, $montant);
|
||||
$taxe = ($init_country != $final_country) ? calculateTax($taxesInternationales , $frais) : calculateTax($taxesNationales ,$frais);
|
||||
break;
|
||||
case 4: //Envoi de wallet à banque
|
||||
// Non disponible
|
||||
break;
|
||||
case 5: //Envoi de carte à wallet
|
||||
$frais =$montant * $config->taux_com_user_carte_wallet / 100;
|
||||
$taxe = ($init_country != $final_country) ? calculateTax($taxesInternationales , $frais) : calculateTax($taxesNationales ,$frais);
|
||||
break;
|
||||
case 6: //Envoi de carte à cash
|
||||
$frais =$montant * $config->taux_com_user_carte_cash / 100;
|
||||
$taxe = ($init_country != $final_country) ? calculateTax($taxesInternationales , $frais) : calculateTax($taxesNationales ,$frais);
|
||||
break;
|
||||
case 9: // Retrait de wallet en cash
|
||||
$frais = calculateFees2($config->taux_com_user_wallet_cash_min, $config->taux_com_user_wallet_cash_max, $config->taux_com_user_wallet_cash, $montant);
|
||||
break;
|
||||
case 10: //Retrait de carte vers wallet
|
||||
$frais = $montant * $config->taux_com_user_carte_wallet / 100;
|
||||
break;
|
||||
case 11: // Retrait de wallet en cash
|
||||
$frais = $montant * $config->taux_com_user_carte_cash / 100;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function calculateFees1(array $paliers , $montant){
|
||||
//Calcul des frais internationaux
|
||||
function calculateFees1(array $paliers, $montant)
|
||||
{
|
||||
$size = sizeof($paliers);
|
||||
$min = $paliers[0]->min ;
|
||||
$max= $size > 0 ? $paliers[$size-1]->max : 0;
|
||||
$min = $paliers[0]->min;
|
||||
$max = $size > 0 ? $paliers[$size - 1]->max : 0;
|
||||
$palier = null;
|
||||
foreach ($paliers as $p){
|
||||
if($montant >= $p->min && $montant <= $p->max){
|
||||
foreach ($paliers as $p) {
|
||||
if ($montant >= $p->min && $montant <= $p->max) {
|
||||
$palier = $p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($palier){
|
||||
return (($palier->min + $palier->max)/2 * $palier->taux /100 );
|
||||
}else{
|
||||
if($montant < $min)
|
||||
return $min* $paliers[0]->taux /100;
|
||||
if ($palier) {
|
||||
return (($palier->min + $palier->max) / 2 * $palier->taux / 100);
|
||||
} else {
|
||||
if ($montant < $min)
|
||||
return $min * $paliers[0]->taux / 100;
|
||||
else if ($montant > $max)
|
||||
return $max*$paliers[$size-1]->taux /100;
|
||||
return $max * $paliers[$size - 1]->taux / 100;
|
||||
}
|
||||
}
|
||||
|
||||
function calculateFees2($min , $max , $taux , $montant){
|
||||
if($montant < $min)
|
||||
return $min* $taux /100;
|
||||
//Calcul des frais nationaux
|
||||
function calculateFees2($min, $max, $taux, $montant)
|
||||
{
|
||||
if ($montant < $min)
|
||||
return $min * $taux / 100;
|
||||
else if ($montant > $max)
|
||||
return $max*$taux /100;
|
||||
return $max * $taux / 100;
|
||||
else
|
||||
return $montant * $taux /100;
|
||||
return $montant * $taux / 100;
|
||||
}
|
||||
|
||||
//Calcul des taxes
|
||||
function calculateTax(array $taxes, $frais)
|
||||
{
|
||||
$sommeTaux = 0;
|
||||
$sommeFixe = 0;
|
||||
foreach ($taxes as $tax) {
|
||||
if ($tax->type == '%')
|
||||
$sommeTaux += $tax->valeur;
|
||||
|
||||
if ($tax->type == 'fixe')
|
||||
$sommeFixe += $tax->valeur;
|
||||
}
|
||||
return ($frais * $sommeTaux / 100) + $sommeFixe;
|
||||
}
|
||||
|
||||
// set to whatever your rates are relative to
|
||||
$baseCurrency = 'USD';
|
||||
|
||||
// use your own credentials, or re-use your existing PDO connection
|
||||
$pdo = new PDO('mysql:host='.$this->db->hostname.';dbname='.$this->db->database, $this->db->username, $this->db->password);
|
||||
$pdo = new PDO('mysql:host=' . $this->db->hostname . ';dbname=' . $this->db->database, $this->db->username, $this->db->password);
|
||||
|
||||
$configuration = new PDOProviderConfiguration();
|
||||
|
||||
$configuration->tableName = 'exchange_rate';
|
||||
$configuration->exchangeRateColumnName = 'exchange_rate';
|
||||
$configuration->tableName = 'exchange_rate';
|
||||
$configuration->exchangeRateColumnName = 'exchange_rate';
|
||||
$configuration->targetCurrencyColumnName = 'target_currency';
|
||||
$configuration->sourceCurrencyCode = $baseCurrency;
|
||||
$configuration->sourceCurrencyCode = $baseCurrency;
|
||||
|
||||
// this provider loads exchange rates from your database
|
||||
$provider = new PDOProvider($pdo, $configuration);
|
||||
|
@ -137,25 +192,26 @@ $converter = new CurrencyConverter($provider);
|
|||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<label for="montant" > <?php echo $this->lang->line('Montant') ?></label>
|
||||
<label for="montant"> <?php echo $this->lang->line('Montant') ?></label>
|
||||
<input type="text" required class="form-control" id="montant"
|
||||
name="montant" value="<?php echo @$montant;?>">
|
||||
name="montant" value="<?php echo @$montant; ?>">
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<?php
|
||||
$result=$countries;
|
||||
if($result){
|
||||
$numrows=$result->num_rows();
|
||||
$result = $countries;
|
||||
if ($result) {
|
||||
$numrows = $result->num_rows();
|
||||
|
||||
if ($numrows > 0) { ?>
|
||||
<label for="init_country"><?php echo $this->lang->line('departure_country') ?></label>
|
||||
<select class="form-control" name="init_country" id="init_country" required>
|
||||
<?php foreach($result->result() as $row) {
|
||||
<select class="form-control" name="init_country" id="init_country"
|
||||
required>
|
||||
<?php foreach ($result->result() as $row) {
|
||||
|
||||
echo "<option value='".$row->id."'>".$row->name."</option>";
|
||||
echo "<option value='" . $row->id . "'>" . $row->name . "</option>";
|
||||
} ?>
|
||||
</select>
|
||||
<?php }else{
|
||||
<?php } else {
|
||||
echo $this->lang->line('no_country');
|
||||
}
|
||||
?>
|
||||
|
@ -166,17 +222,18 @@ $converter = new CurrencyConverter($provider);
|
|||
|
||||
<div class="col-lg-3">
|
||||
<?php
|
||||
$result=$operations;
|
||||
if($result){
|
||||
$numrows= sizeof($result);
|
||||
$result = $operations;
|
||||
if ($result) {
|
||||
$numrows = sizeof($result);
|
||||
if ($numrows > 0) { ?>
|
||||
<label for="operation">Operation</label>
|
||||
<select class="form-control" name="operation" id="operation" <?php echo @$operation;?> required>
|
||||
<?php foreach($result as $row) {
|
||||
echo "<option value='".$row->id."'>".$row->name."</option>";
|
||||
<select class="form-control" name="operation"
|
||||
id="operation" <?php echo @$operation; ?> required>
|
||||
<?php foreach ($result as $row) {
|
||||
echo "<option value='" . $row->id . "'>" . $row->name . "</option>";
|
||||
} ?>
|
||||
</select>
|
||||
<?php }else{
|
||||
<?php } else {
|
||||
echo $this->lang->line('no_operation');
|
||||
}
|
||||
?>
|
||||
|
@ -186,19 +243,20 @@ $converter = new CurrencyConverter($provider);
|
|||
</div>
|
||||
<div class="col-lg-3">
|
||||
<?php
|
||||
$result=$countries;
|
||||
if($result){
|
||||
$numrows=$result->num_rows();
|
||||
$result = $countries;
|
||||
if ($result) {
|
||||
$numrows = $result->num_rows();
|
||||
|
||||
if ($numrows > 0) { ?>
|
||||
<label for="final_country"><?php echo $this->lang->line('country_of_destination') ?></label>
|
||||
<select class="form-control" name="final_country" id="final_country" required>
|
||||
<?php foreach($result->result() as $row) {
|
||||
<select class="form-control" name="final_country" id="final_country"
|
||||
required>
|
||||
<?php foreach ($result->result() as $row) {
|
||||
|
||||
echo "<option value='".$row->id."'>".$row->name."</option>";
|
||||
echo "<option value='" . $row->id . "'>" . $row->name . "</option>";
|
||||
} ?>
|
||||
</select>
|
||||
<?php }else{
|
||||
<?php } else {
|
||||
echo $this->lang->line('no_country');
|
||||
}
|
||||
?>
|
||||
|
@ -208,14 +266,14 @@ $converter = new CurrencyConverter($provider);
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($showResult) {
|
||||
$r1 = array_filter($operations , function ($op) use ($operation){
|
||||
<?php if ($showResult) {
|
||||
$r1 = array_filter($operations, function ($op) use ($operation) {
|
||||
return $op->id == $operation;
|
||||
});
|
||||
$r2 = array_filter($countries->result() , function ($c) use ($init_country){
|
||||
$r2 = array_filter($countries->result(), function ($c) use ($init_country) {
|
||||
return $c->id == $init_country;
|
||||
});
|
||||
$r3 = array_filter($countries->result() , function ($c) use ($final_country){
|
||||
$r3 = array_filter($countries->result(), function ($c) use ($final_country) {
|
||||
return $c->id == $final_country;
|
||||
});
|
||||
$op = reset($r1);
|
||||
|
@ -223,36 +281,45 @@ $converter = new CurrencyConverter($provider);
|
|||
$f = reset($r3);
|
||||
?>
|
||||
<div class="login-box" style="width: 600px;">
|
||||
<h5 ><strong style="text-decoration: underline;" >Resultat</strong> : <?=@$op->name.' du '.$d->name.' vers '.$f->name?></h5>
|
||||
<h5><strong style="text-decoration: underline;">Resultat</strong>
|
||||
: <?= @$op->name . ' du ' . $d->name . ' vers ' . $f->name ?></h5>
|
||||
<div class="login-box-body">
|
||||
<div class="row">
|
||||
<?php
|
||||
$money = Money::of(@$montant, @$d->currency_code);
|
||||
$money2 = Money::of(round(@$montant - @$frais,0), @$d->currency_code);
|
||||
$money2 = Money::of(round(@$montant - @$frais - @$taxe, 0), @$d->currency_code);
|
||||
$money3 = Money::of(round(@$montant - @$frais - @$taxe, 0), @$d->currency_code);
|
||||
$moneyTaxe = Money::of(round(@$taxe, 0), @$d->currency_code);
|
||||
$money2 = $converter->convert($money2, @$f->currency_code, RoundingMode::DOWN);
|
||||
$moneyFrais = Money::of(round(@$frais,0), @$d->currency_code);
|
||||
$money3 = $converter->convert($money3, @$d->currency_code, RoundingMode::DOWN);
|
||||
$moneyFrais = Money::of(round(@$frais, 0), @$d->currency_code);
|
||||
?>
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<div>
|
||||
<label> <?php echo $this->lang->line('amount_departure_country') ?></label>
|
||||
<h4><?= $money->formatTo('fr_FR') ?></h4>
|
||||
</div>
|
||||
<div>
|
||||
<label> Frais de la transaction</label>
|
||||
<h4><?= $moneyFrais->formatTo('fr_FR') ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<div>
|
||||
<label> <?php echo $this->lang->line('amount_country_of_destination') ?></label>
|
||||
<h4><?= $money2->formatTo('fr_FR') ?></h4>
|
||||
<div>
|
||||
<label> <?php echo $this->lang->line('amount_departure_country') ?></label>
|
||||
<h4><?= $money->formatTo('fr_FR') ?></h4>
|
||||
</div>
|
||||
<div>
|
||||
<label> Frais de la transaction</label>
|
||||
<h4><?= $moneyFrais->formatTo('fr_FR') ?></h4>
|
||||
</div>
|
||||
<div>
|
||||
<label>Taxe de la transaction </label>
|
||||
<h4><?= $moneyTaxe->formatTo('fr-FR') ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<div>
|
||||
<label> <?php echo $this->lang->line('amount_country_of_destination') ?></label>
|
||||
<h4><?= $money2->formatTo('fr_FR') ?></h4>
|
||||
<h4><?= $money3->formatTo('fr_FR') ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php } ?>
|
||||
<button type="submit"
|
||||
name="save"
|
||||
class="btn btn-warning btn-block openModal"><?php echo $this->lang->line('calculate'); ?></button>
|
||||
|
@ -289,9 +356,14 @@ $converter = new CurrencyConverter($provider);
|
|||
|
||||
<script>
|
||||
$(function () {
|
||||
anElement = new AutoNumeric('#montant', '', {digitGroupSeparator: ' ', decimalPlaces:'0', minimumValue : '0' , maximumValue: '99999999999999999999999999'});
|
||||
anElement = new AutoNumeric('#montant', '', {
|
||||
digitGroupSeparator: ' ',
|
||||
decimalPlaces: '0',
|
||||
minimumValue: '0',
|
||||
maximumValue: '99999999999999999999999999'
|
||||
});
|
||||
|
||||
$("#calculatorForm").submit( function(eventObj) {
|
||||
$("#calculatorForm").submit(function (eventObj) {
|
||||
var txt = document.getElementById('montant');
|
||||
const montant = anElement.getNumber();
|
||||
txt.value = montant;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<!-- DataTables -->
|
||||
<link rel="stylesheet"
|
||||
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
|
||||
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
|
||||
<div class="content-wrapper">
|
||||
|
||||
<?php
|
||||
|
@ -213,7 +212,6 @@
|
|||
<th>" . $this->lang->line('Date de traitement') . "</th>
|
||||
<th>" . $this->lang->line('Statut') . "</th>
|
||||
<th>" . $this->lang->line('Délai de traitement') . "</th>
|
||||
<th>Action</th>
|
||||
</tr>";
|
||||
|
||||
?>
|
||||
|
@ -228,10 +226,8 @@
|
|||
foreach ($result->result() as $row) {
|
||||
$num++;
|
||||
$etat = $this->lang->line("Non traitée");
|
||||
$disabled ="disabled";
|
||||
if ($row->statut == 1) {
|
||||
$etat = $this->lang->line("Acceptée");
|
||||
$disabled="";
|
||||
} else if ($row->statut == 2) {
|
||||
$etat = $this->lang->line("Annulée");
|
||||
}
|
||||
|
@ -251,11 +247,6 @@
|
|||
<td > ".toLocateDate($row->dateModif,$this->session->userdata('timezone'))."</td>
|
||||
<td>$etat</td>
|
||||
<td>" . traitementTemps($row->temps, $row->dateAjout) . "</td>
|
||||
<td>
|
||||
<button data-id-demand=\"$row->demande_id\" class=\"btn btn-danger btn-block cancelBtn\"".$disabled ."
|
||||
<b>".$this->lang->line('cancel')."</b>
|
||||
</button>
|
||||
</td>
|
||||
</tr>";
|
||||
|
||||
}
|
||||
|
@ -737,7 +728,6 @@
|
|||
<th>" . $this->lang->line('Date de traitement') . "</th>
|
||||
<th>" . $this->lang->line('Statut') . "</th>
|
||||
<th>" . $this->lang->line('Délai de traitement') . "</th>
|
||||
<th>Action</th>
|
||||
</tr>";
|
||||
?>
|
||||
</thead>
|
||||
|
@ -750,10 +740,8 @@
|
|||
foreach ($result->result() as $row) {
|
||||
$num++;
|
||||
$etat = $this->lang->line("Non traitée");
|
||||
$disabled="disabled";
|
||||
if ($row->statut == 1) {
|
||||
$etat = $this->lang->line("Acceptée");
|
||||
$disabled = "";
|
||||
} else if ($row->statut == 2) {
|
||||
$etat = $this->lang->line("Annulée");
|
||||
}
|
||||
|
@ -775,12 +763,7 @@
|
|||
<td>".toLocateDate($row->dateAjout,$this->session->userdata('timezone'))."</td>
|
||||
<td> ".toLocateDate($row->dateModif,$this->session->userdata('timezone'))."</td>
|
||||
<td>$etat</td>
|
||||
<td>" . traitementTemps($row->temps, $row->dateAjout) . "</td>1
|
||||
<td>
|
||||
<button data-id-demand=\"$row->demande_id\" class=\"btn btn-danger btn-block cancelBtn\"".$disabled ."
|
||||
<b>".$this->lang->line('cancel')."</b>
|
||||
</button>
|
||||
</td>
|
||||
<td>" . traitementTemps($row->temps, $row->dateAjout) . "</td>
|
||||
</tr>";
|
||||
|
||||
}
|
||||
|
@ -986,8 +969,6 @@
|
|||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.20/dataRender/datetime.js"></script>
|
||||
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
|
||||
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
|
@ -1223,35 +1204,3 @@
|
|||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).on("click", ".cancelBtn", function () {
|
||||
const id_demand = $(this).data('id-demand');
|
||||
$.ajax({
|
||||
url : '<?php echo base_url('index.php/Hyperviseur_dash/cancelCreditRequest')?>',
|
||||
type : 'POST',
|
||||
dataType : 'json',
|
||||
data: {"id_demand": id_demand},
|
||||
async:true,
|
||||
success : function(data){
|
||||
if(data=='200'){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?php echo $this->lang->line('canceled_credit_request')?>",
|
||||
text: "<?php echo $this->lang->line('informations_updated')?>",
|
||||
timer: 3000
|
||||
}).then(()=>{
|
||||
location.reload();
|
||||
});
|
||||
// alert("Les informations ont été mises à jour.") ? "" : location.reload();
|
||||
}else{
|
||||
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
|
||||
}
|
||||
},
|
||||
|
||||
error : function(resultat, statut, erreur){
|
||||
console.log(resultat+" "+erreur);
|
||||
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -295,9 +295,17 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="margin">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-update"
|
||||
style="width: 100%"><?php echo $this->lang->line('Modifier la configuration') ?></button>
|
||||
<div class="col-lg-6">
|
||||
<div class="margin">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-update"
|
||||
style="width: 100%"><?php echo $this->lang->line('Modifier la configuration') ?></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="margin">
|
||||
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#modal-tax"
|
||||
style="width: 100%"><?php echo $this->lang->line('edit_tax') ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row centered">
|
||||
|
@ -794,6 +802,41 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row centered">
|
||||
<div class="col-lg-4 col-lg-offset-4 col-xs-12">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php echo $this->lang->line('transaction_taxes'); ?></h3>
|
||||
</div>
|
||||
<div class="box-body table-responsive" style="overflow-x:auto;">
|
||||
<table class="table table-hover" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo $this->lang->line('Nom') ; ?> </th>
|
||||
<th>Type</th>
|
||||
<th>Valeur</th>
|
||||
<th>Destination</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
if($taxes!=false){
|
||||
foreach($taxes->result() as $row) {
|
||||
echo "<tr>
|
||||
<td>".$row->nom."</td>
|
||||
<td>".$row->type."</td>
|
||||
<td>".$row->valeur."</td>
|
||||
<td>".$row->destination."</td>".'
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
|
@ -1309,6 +1352,71 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="modal-tax">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h3 class="modal-title"><?php echo $this->lang->line('configuration_of_tax'); ?></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="taxForm">
|
||||
<div class="form-group" style="overflow-x:auto;">
|
||||
<div class="table-title">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<label for="nom"
|
||||
class="col-form-label"><?php echo $this->lang->line('transaction_taxes') ; ?></label>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" class="btn btn-info add-new new5"><i class="fa fa-plus"></i> <?php echo $this->lang->line('new_level') ; ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="transactions_taxes" class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo $this->lang->line('Nom') ; ?> </th>
|
||||
<th>Type</th>
|
||||
<th>Valeur</th>
|
||||
<th>Destination</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
if($taxes!=false){
|
||||
foreach($taxes->result() as $row) {
|
||||
echo "<tr>
|
||||
<td>".$row->nom."</td>
|
||||
<td>".$row->type."</td>
|
||||
<td>".$row->valeur."</td>
|
||||
<td>".$row->destination."</td>".'
|
||||
<td>
|
||||
<a class="add add5" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||
<a class="edit edit5" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||
<a class="delete delete5" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
// ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left"
|
||||
data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
|
||||
<button type="button" id="saveTaxes" data-network-id="<?= $network_id ?>" data-id-config="<?= $idConfig ?>"
|
||||
class="btn btn-primary"><?php echo $this->lang->line('Continuer'); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="rechargeAccount" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
|
@ -1616,6 +1724,63 @@
|
|||
|
||||
});
|
||||
|
||||
$('#saveTaxes').click(function () {
|
||||
const network_id = $(this).data('network-id');
|
||||
const id_config = $(this).data('id-config');
|
||||
// Paliers
|
||||
var taxes = [];
|
||||
|
||||
$('#transactions_taxes tr').has('td').each(function() {
|
||||
var arrayItem = {};
|
||||
$('td', $(this)).each(function(index, item) {
|
||||
if(index < 4){
|
||||
if(index == 2)
|
||||
arrayItem[index] = parseFloat($(item).html());
|
||||
arrayItem[index] = $(item).html();
|
||||
}
|
||||
});
|
||||
taxes.push(arrayItem);
|
||||
});
|
||||
|
||||
if ($('#taxForm')[0].checkValidity()) {
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('index.php/Gestion/saveTaxes')?>',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
"network_id": network_id,"id_config" : id_config,
|
||||
"taxes" : taxes ,
|
||||
},
|
||||
success: function (data) {
|
||||
if(data=='200'){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?php echo $this->lang->line('wallet_update')?>",
|
||||
text:"<?php echo $this->lang->line('informations_updated')?>",
|
||||
timer: 3000
|
||||
}).then(()=>{
|
||||
location.reload();
|
||||
});
|
||||
|
||||
}else{
|
||||
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
|
||||
}
|
||||
},
|
||||
|
||||
error: function (resultat, statut, error) {
|
||||
console.log(resultat + " " + error);
|
||||
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
$('#taxForm')[0].reportValidity();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#resetPassword').click(function () {
|
||||
const wallet_password_id = $(this).data('wallet_password_id');
|
||||
const network = $(this).data('network');
|
||||
|
@ -2043,5 +2208,78 @@
|
|||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
// Taxes
|
||||
$(document).ready(function() {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
var actions5 = $("#transactions_taxes td:last-child").html();
|
||||
// Append table with add row form on add new button click
|
||||
$(".new5").click(function(){
|
||||
if(!actions5){
|
||||
actions5 = '<a class="add add5" title="Add" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
||||
' <a class="edit edit5" title="Edit" data-toggle="tooltip"><i class="material-icons"></i></a>\n' +
|
||||
' <a class="delete delete5" title="Delete" data-toggle="tooltip"><i class="material-icons"></i></a>';
|
||||
}
|
||||
$(this).attr("disabled", "disabled");
|
||||
var index = $("#transactions_taxes tbody tr:last-child").index();
|
||||
var row = "<tr> <td><input type='text' required class='form-control' name='nom' id='nom'></td> " +
|
||||
"<td> <select class='form-control' id='type' required> <option value='%'> % </option> <option value='fixe'> fixe </option> </select> </td> "+
|
||||
"<td><input type='number' required class='form-control' min='0' name='valeur' id='valeur'></td>" +
|
||||
"<td> <select class='form-control' id='destination' required> <option value='national'> national </option> <option value='international'> international </option> </select> </td>" +
|
||||
"<td>" + actions5 + "</td>" +
|
||||
"</tr>";
|
||||
$("#transactions_taxes").append(row);
|
||||
$("#transactions_taxes tbody tr").eq(index + 1).find(".add, .edit").toggle();
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
// Add row on add button click
|
||||
$(document).on("click", ".add5", function(){
|
||||
var empty = false;
|
||||
var input = $(this).parents("tr").find('input');
|
||||
var select = $(this).parents("tr").find('select');
|
||||
input.each(function(){
|
||||
if(!$(this)[0].checkValidity()){
|
||||
$(this).addClass("error");
|
||||
$(this)[0].reportValidity();
|
||||
empty = true;
|
||||
} else{
|
||||
$(this).removeClass("error");
|
||||
}
|
||||
|
||||
});
|
||||
$(this).parents("tr").find(".error").first().focus();
|
||||
if(!empty){
|
||||
select.each(function(){
|
||||
$(this).parent("td").html($(this).val());
|
||||
});
|
||||
input.each(function(){
|
||||
$(this).parent("td").html($(this).val());
|
||||
});
|
||||
$(this).parents("tr").find(".add, .edit").toggle();
|
||||
$(".new5").removeAttr("disabled");
|
||||
}
|
||||
});
|
||||
// Edit row on edit button click
|
||||
$(document).on("click", ".edit5", function(){
|
||||
$(this).parents("tr").find("td:not(:last-child)").each(function(index){
|
||||
if(index == 0)
|
||||
$(this).html('<input type="text" required class="form-control" value="' + $(this).text() + '">');
|
||||
if(index == 1)
|
||||
$(this).html("<select class='form-control' id='type' required> <option value='%' > % </option> <option value='fixe'> fixe </option> </select>");
|
||||
if(index == 2)
|
||||
$(this).html('<input type="number" required class="form-control" min="0" value="' + $(this).text() + '">');
|
||||
if(index == 3)
|
||||
$(this).html("<select class='form-control' id='destination' required> <option value='national'> national </option> <option value='international'> international </option> </select>");
|
||||
});
|
||||
$(this).parents("tr").find(".add, .edit").toggle();
|
||||
$(".new5").attr("disabled", "disabled");
|
||||
});
|
||||
// Delete row on delete button click
|
||||
$(document).on("click", ".delete5", function(){
|
||||
$(this).parents("tr").remove();
|
||||
$(".new5").removeAttr("disabled");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!-- Page script -->
|
||||
<script src="<?php echo base_url('dist/js/custom.js') ?>"></script>
|
||||
|
|
|
@ -100,7 +100,9 @@
|
|||
<th><?php echo $this->lang->line('Commission de l\'agent') ?></th>
|
||||
<th><?php echo $this->lang->line('agent_name') ?></th>
|
||||
<th align='center'>Date</th>
|
||||
<th align='center'>Action</th>
|
||||
<?php if ($this->session->userdata('category') != 'super') { ?>
|
||||
<th align='center'>Action</th>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -133,11 +135,13 @@
|
|||
<td>".$row->agent."</td>
|
||||
<td>".toLocateDate($row->date_created,$this->session->userdata('timezone'))."</td>";
|
||||
?>
|
||||
<?php if ($this->session->userdata('category') != 'super') { ?>
|
||||
<td>
|
||||
<button data-id-transaction="<?= $row->id ?>" id="cancel" class="btn btn-danger btn-block" <?php if($row->canceled) echo "disabled"?> >
|
||||
<b><?php echo $this->lang->line('cancel')?></b>
|
||||
</button>
|
||||
</td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
|
Loading…
Reference in New Issue