+ Add Balance compensation in paying networks
This commit is contained in:
parent
eae6ee845a
commit
31ac8e45d5
|
@ -457,6 +457,8 @@ class Hyperviseur_dash extends CI_Controller
|
|||
$data['transactions'] = $this->user_model->getCommissionTransfers($startDate, $endDate, $this->session->userdata('member_code'));
|
||||
else if ($type == 'balance_statement')
|
||||
$data['wallets'] = $this->user_model->getInfosWalletAgentForHyper($this->session->userdata('network_id'));
|
||||
else if ($type == 'refund_history')
|
||||
$data['refunds'] = $this->user_model->getRefunds($startDate, $endDate, $network_id);
|
||||
else
|
||||
$data['transactions'] = $this->user_model->getRecharges($startDate, $endDate, $network_id);
|
||||
|
||||
|
@ -482,6 +484,8 @@ class Hyperviseur_dash extends CI_Controller
|
|||
$this->load->view('historique_transferts_commission');
|
||||
else if ($type == 'balance_statement')
|
||||
$this->load->view('config_wallet_ilink_hyp/etat_soldes');
|
||||
else if ($type == 'refund_history')
|
||||
$this->load->view('historique_remboursement');
|
||||
else
|
||||
$this->load->view('historique_recharges');
|
||||
$this->load->view('footer');
|
||||
|
@ -598,7 +602,7 @@ class Hyperviseur_dash extends CI_Controller
|
|||
$this->email->message($this->lang->line('mot de passe') . ' : ' . $password);
|
||||
|
||||
if ($this->email->send()) {
|
||||
$this->user_model->updateWalletPassword($wallet_password_id, $encrypted_password, $salt, $email);
|
||||
$this->user_model->updateWalletPassword($wallet_password_id, $encrypted_password, $salt);
|
||||
$res = true;
|
||||
} else {
|
||||
// show_error($this->email->print_debugger());
|
||||
|
@ -640,6 +644,32 @@ class Hyperviseur_dash extends CI_Controller
|
|||
}
|
||||
}
|
||||
|
||||
public function rembourser_compensation()
|
||||
{
|
||||
if ($this->isLogged()) {
|
||||
if (isset($_POST)) {
|
||||
$password = $_POST['password'];
|
||||
$id_config = $_POST['id_config'];
|
||||
$id_network = $_POST['id_network'];
|
||||
$salt = $_POST['salt'];
|
||||
$encrypted_password = $_POST['encrypted_password'];
|
||||
$montant = $_POST['montant'];
|
||||
|
||||
$hash = base64_encode(sha1($password . $salt, true) . $salt);
|
||||
|
||||
if ($encrypted_password == $hash) {
|
||||
$res = $this->user_model->insertRembourssementCompensation($montant, $id_network, $id_config);
|
||||
$code = $res ? '200' : '401';
|
||||
} else {
|
||||
$code = '400';
|
||||
}
|
||||
|
||||
echo json_encode($code);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function calculator()
|
||||
{
|
||||
if ($this->isLogged()) {
|
||||
|
@ -720,26 +750,27 @@ class Hyperviseur_dash extends CI_Controller
|
|||
$frais = ($init_country != $final_country) ? $this->calculateFees1($plr_user_wallet_wallet, $montant) : $this->calculateFees1($plr_user_wallet_wallet_national, $montant);
|
||||
$taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
||||
|
||||
$com_hyp += $frais ;
|
||||
$com_hyp = $frais;
|
||||
$this->session->set_userdata('com_hyp', $com_hyp);
|
||||
break;
|
||||
case 2: //Envoi de wallet à carte
|
||||
$frais = $montant * $config->taux_com_user_wallet_carte / 100;
|
||||
// $taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales , $frais) : $this->calculateTax($taxesNationales ,$frais);
|
||||
$com_hyp += $frais * $config->taux_com_hyp_envoi_wallet_carte_ilink / 100 ;
|
||||
$com_bq += $frais * $config->taux_com_banque_envoi_wallet_carte_ilink / 100 ;
|
||||
$this->session->set_userdata('com_hyp',$com_hyp);$this->session->set_userdata('com_bq',$com_bq);
|
||||
$com_hyp = $frais * $config->taux_com_hyp_envoi_wallet_carte_ilink / 100;
|
||||
$com_bq = $frais * $config->taux_com_banque_envoi_wallet_carte_ilink / 100;
|
||||
$this->session->set_userdata('com_hyp', $com_hyp);
|
||||
$this->session->set_userdata('com_bq', $com_bq);
|
||||
break;
|
||||
case 3: //Envoi de wallet à cash
|
||||
$frais = ($init_country != $final_country) ? $this->calculateFees1($plr_user_wallet_cash, $montant) : $this->calculateFees1($plr_user_wallet_cash_national, $montant);
|
||||
$taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
||||
|
||||
$com_hyp += $frais ;
|
||||
$com_hyp = $frais;
|
||||
$this->session->set_userdata('com_hyp', $com_hyp);
|
||||
// $this->session->set_userdata('frais_retrait',$frais);
|
||||
$code = $this->random_string();
|
||||
$data['message_code'] = '' . $code;
|
||||
$this->user_model->insertSimulateur($frais,$montant-$frais-$taxe,$code,$montant);
|
||||
// $this->user_model->insertSimulateur($frais,$montant-$frais-$taxe,$code,$montant);
|
||||
break;
|
||||
case 4: //Envoi de wallet à banque
|
||||
// Non disponible
|
||||
|
@ -757,28 +788,30 @@ class Hyperviseur_dash extends CI_Controller
|
|||
$frais = ($init_country != $final_country) ? $this->calculateFees1($plr_user_wallet_cash, $montant) : $this->calculateFees1($plr_user_wallet_cash_national, $montant);
|
||||
$taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
||||
|
||||
$com_hyp += $frais ;
|
||||
$com_hyp = $frais;
|
||||
$this->session->set_userdata('com_hyp', $com_hyp);
|
||||
$code = $this->random_string();
|
||||
$data['message_code'] = '' . $code;
|
||||
$this->user_model->insertSimulateur($frais,$montant-$frais-$taxe,$code,$montant);
|
||||
// $this->user_model->insertSimulateur($frais,$montant-$frais-$taxe,$code,$montant);
|
||||
break;
|
||||
case 10: //Retrait de carte vers wallet
|
||||
$frais = $montant * $config->taux_com_user_carte_wallet / 100;
|
||||
|
||||
$com_hyp += $frais * $config->taux_com_hyp_retrait_carte_cash_ilink / 100 ;
|
||||
$com_bq += $frais * $config->taux_com_banque_retrait_carte_cash_ilink / 100 ;
|
||||
$this->session->set_userdata('com_hyp',$com_hyp);$this->session->set_userdata('com_bq',$com_bq);
|
||||
$com_hyp = $frais * $config->taux_com_hyp_retrait_carte_cash_ilink / 100;
|
||||
$com_bq = $frais * $config->taux_com_banque_retrait_carte_cash_ilink / 100;
|
||||
$this->session->set_userdata('com_hyp', $com_hyp);
|
||||
$this->session->set_userdata('com_bq', $com_bq);
|
||||
break;
|
||||
case 11: // Retrait de carte vers cash
|
||||
$frais = $montant * $config->taux_com_user_carte_cash / 100;
|
||||
|
||||
$com_hyp += $frais * $config->taux_com_hyp_retrait_carte_cash_ilink / 100 ;
|
||||
$com_bq += $frais * $config->taux_com_banque_retrait_carte_cash_ilink / 100 ;
|
||||
$this->session->set_userdata('com_hyp',$com_hyp);$this->session->set_userdata('com_bq',$com_bq);
|
||||
$com_hyp = $frais * $config->taux_com_hyp_retrait_carte_cash_ilink / 100;
|
||||
$com_bq = $frais * $config->taux_com_banque_retrait_carte_cash_ilink / 100;
|
||||
$this->session->set_userdata('com_hyp', $com_hyp);
|
||||
$this->session->set_userdata('com_bq', $com_bq);
|
||||
$code = $this->random_string();
|
||||
$data['message_code'] = '' . $code;
|
||||
$this->user_model->insertSimulateur($frais * $config->taux_com_hyp_retrait_carte_cash_ilink / 100,$montant-$frais-$taxe,$code,$montant);
|
||||
// $this->user_model->insertSimulateur($frais * $config->taux_com_hyp_retrait_carte_cash_ilink / 100,$montant-$frais-$taxe,$code,$montant);
|
||||
break;
|
||||
case 12: // Agent - Retrait en cash
|
||||
// empty
|
||||
|
@ -788,13 +821,14 @@ class Hyperviseur_dash extends CI_Controller
|
|||
if($simulateur) {
|
||||
$part_ag = $simulateur->first_row()->com_hyp * $config->taux_com_ag_retrait_cash / 100;
|
||||
$part_sup = $simulateur->first_row()->com_hyp * $config->taux_com_sup_retrait_cash / 100;
|
||||
$com_ag += $part_ag;
|
||||
$com_sup += $part_sup ;
|
||||
$com_ag = $part_ag;
|
||||
$com_sup = $part_sup;
|
||||
$com_hyp -= ($part_ag + $part_sup);
|
||||
$data['montant_retrait'] = $simulateur->first_row()->montant_retrait;
|
||||
$data['frais_retrait'] = $simulateur->first_row()->com_hyp;
|
||||
$data['montant_init'] = $simulateur->first_row()->montant;
|
||||
$this->session->set_userdata('com_ag',$com_ag);$this->session->set_userdata('com_sup',$com_sup);
|
||||
$this->session->set_userdata('com_ag', $com_ag);
|
||||
$this->session->set_userdata('com_sup', $com_sup);
|
||||
$this->session->set_userdata('com_hyp', $com_hyp);
|
||||
}else{
|
||||
$data['error_simulateur'] = 'Code de retrait incorrect';
|
||||
|
@ -808,51 +842,58 @@ class Hyperviseur_dash extends CI_Controller
|
|||
case 13: // Agent - Retrait de la carte vers cash
|
||||
$frais = $montant * $config->taux_com_wallet_ag_carte_cash / 100;
|
||||
|
||||
$com_ag += $frais * $config->taux_com_ag_retrait_carte_cash/ 100 ;
|
||||
$com_sup += $frais * $config->taux_com_sup_retrait_carte_cash / 100 ;
|
||||
$com_hyp += $frais * $config->taux_com_hyp_retrait_carte_cash / 100 ;
|
||||
$com_bq += $frais * $config->taux_com_banque_retrait_carte_cash / 100 ;
|
||||
$this->session->set_userdata('com_ag',$com_ag);$this->session->set_userdata('com_sup',$com_sup);
|
||||
$this->session->set_userdata('com_hyp',$com_hyp);$this->session->set_userdata('com_bq',$com_bq);
|
||||
$com_ag = $frais * $config->taux_com_ag_retrait_carte_cash / 100;
|
||||
$com_sup = $frais * $config->taux_com_sup_retrait_carte_cash / 100;
|
||||
$com_hyp = $frais * $config->taux_com_hyp_retrait_carte_cash / 100;
|
||||
$com_bq = $frais * $config->taux_com_banque_retrait_carte_cash / 100;
|
||||
$this->session->set_userdata('com_ag', $com_ag);
|
||||
$this->session->set_userdata('com_sup', $com_sup);
|
||||
$this->session->set_userdata('com_hyp', $com_hyp);
|
||||
$this->session->set_userdata('com_bq', $com_bq);
|
||||
break;
|
||||
case 14: // Agent - Envoi de cash vers wallet iLink
|
||||
$frais = ($init_country != $final_country) ? $this->calculateFees1($plr_agent_depot_wallet_ilink, $montant) : $this->calculateFees1($plr_agent_depot_wallet_ilink_national, $montant);
|
||||
$taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
||||
$com_ag += $frais * $config->taux_com_ag_envoi_cash / 100 ;
|
||||
$com_sup += $frais * $config->taux_com_sup_envoi_cash / 100 ;
|
||||
$com_hyp += $frais * $config->taux_com_hyp_envoi_cash / 100 ;
|
||||
$this->session->set_userdata('com_ag',$com_ag);$this->session->set_userdata('com_sup',$com_sup);
|
||||
$com_ag = $frais * $config->taux_com_ag_envoi_cash / 100;
|
||||
$com_sup = $frais * $config->taux_com_sup_envoi_cash / 100;
|
||||
$com_hyp = $frais * $config->taux_com_hyp_envoi_cash / 100;
|
||||
$this->session->set_userdata('com_ag', $com_ag);
|
||||
$this->session->set_userdata('com_sup', $com_sup);
|
||||
$this->session->set_userdata('com_hyp', $com_hyp);
|
||||
break;
|
||||
case 15: // Agent - Envoi de cash vers autre wallet
|
||||
$frais = ($init_country != $final_country) ? $this->calculateFees1($plr_agent_depot_autre_wallet, $montant) : $this->calculateFees1($plr_agent_depot_autre_wallet_national, $montant);
|
||||
$taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
||||
$com_ag += $frais * $config->taux_com_ag_envoi_cash / 100 ;
|
||||
$com_sup += $frais * $config->taux_com_sup_envoi_cash / 100 ;
|
||||
$com_hyp += $frais * $config->taux_com_hyp_envoi_cash / 100 ;
|
||||
$this->session->set_userdata('com_ag',$com_ag);$this->session->set_userdata('com_sup',$com_sup);
|
||||
$com_ag = $frais * $config->taux_com_ag_envoi_cash / 100;
|
||||
$com_sup = $frais * $config->taux_com_sup_envoi_cash / 100;
|
||||
$com_hyp = $frais * $config->taux_com_hyp_envoi_cash / 100;
|
||||
$this->session->set_userdata('com_ag', $com_ag);
|
||||
$this->session->set_userdata('com_sup', $com_sup);
|
||||
$this->session->set_userdata('com_hyp', $com_hyp);
|
||||
break;
|
||||
case 16: // Agent - Envoi de cash vers une carte visa
|
||||
$frais = $montant * $config->taux_com_wallet_ag_envoi_cash_carte / 100;
|
||||
$com_ag += $frais * $config->taux_com_ag_depot_cash_carte/ 100 ;
|
||||
$com_sup += $frais * $config->taux_com_sup_depot_cash_carte / 100 ;
|
||||
$com_hyp += $frais * $config->taux_com_hyp_depot_cash_carte / 100 ;
|
||||
$com_bq += $frais * $config->taux_com_banque_depot_cash_carte / 100 ;
|
||||
$this->session->set_userdata('com_ag',$com_ag);$this->session->set_userdata('com_sup',$com_sup);
|
||||
$this->session->set_userdata('com_hyp',$com_hyp);$this->session->set_userdata('com_bq',$com_bq);
|
||||
$com_ag = $frais * $config->taux_com_ag_depot_cash_carte / 100;
|
||||
$com_sup = $frais * $config->taux_com_sup_depot_cash_carte / 100;
|
||||
$com_hyp = $frais * $config->taux_com_hyp_depot_cash_carte / 100;
|
||||
$com_bq = $frais * $config->taux_com_banque_depot_cash_carte / 100;
|
||||
$this->session->set_userdata('com_ag', $com_ag);
|
||||
$this->session->set_userdata('com_sup', $com_sup);
|
||||
$this->session->set_userdata('com_hyp', $com_hyp);
|
||||
$this->session->set_userdata('com_bq', $com_bq);
|
||||
break;
|
||||
case 17: // Agent - Envoi de cash vers cash
|
||||
$frais = ($init_country != $final_country) ? $this->calculateFees1($plr_agent_cash_cash, $montant) : $this->calculateFees1($plr_agent_cash_cash_national, $montant);
|
||||
$taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
||||
$com_ag += $frais * $config->taux_com_ag_envoi_cash / 100 ;
|
||||
$com_sup += $frais * $config->taux_com_sup_envoi_cash / 100 ;
|
||||
$com_hyp += $frais * $config->taux_com_hyp_envoi_cash / 100 ;
|
||||
$this->session->set_userdata('com_ag',$com_ag);$this->session->set_userdata('com_sup',$com_sup);
|
||||
$com_ag = $frais * $config->taux_com_ag_envoi_cash / 100;
|
||||
$com_sup = $frais * $config->taux_com_sup_envoi_cash / 100;
|
||||
$com_hyp = $frais * $config->taux_com_hyp_envoi_cash / 100;
|
||||
$this->session->set_userdata('com_ag', $com_ag);
|
||||
$this->session->set_userdata('com_sup', $com_sup);
|
||||
$this->session->set_userdata('com_hyp', $com_hyp);
|
||||
$code = $this->random_string();
|
||||
$data['message_code'] = '' . $code;
|
||||
$this->user_model->insertSimulateur($frais,$montant-$frais-$taxe,$code,$montant);
|
||||
// $this->user_model->insertSimulateur($frais,$montant-$frais-$taxe,$code,$montant);
|
||||
break;
|
||||
case 18: // Agent - Envoi de cash vers banque
|
||||
// Indisponible
|
||||
|
@ -1125,6 +1166,8 @@ class Hyperviseur_dash extends CI_Controller
|
|||
$data['country'] = $this->session->userdata('current_pays');
|
||||
$data['category'] = $this->session->userdata('category');
|
||||
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
||||
$res = $this->user_model->getWalletPassword($this->session->userdata('network_id'));
|
||||
$data['walletPassword'] = $res ? $res->first_row() : null;
|
||||
$data['networks'] = $this->user_model->getPayingNetworksByConfigWallet($data['idConfig']);
|
||||
|
||||
$this->load->view('header_hyp', $data);
|
||||
|
|
|
@ -418,4 +418,25 @@ $lang ['config_ilink_agent_send_cash_carte'] = 'Sending cash to a visa card';
|
|||
$lang ['config_ilink_agent_send_cash_canal'] = 'Sending cash to another channel (Wallet or cash)';
|
||||
$lang ['config_user'] = 'User configuration';
|
||||
$lang ['config_agent'] = 'Configuration agent';
|
||||
$lang ['config_ilink_note'] = 'The sharing of commissions is done between the hypervisor and the paying network!';
|
||||
$lang ['configure_paying_network'] = 'Configure the paying network';
|
||||
$lang ['paying_network_updated'] = 'Paying network updated';
|
||||
$lang ['commission_transfer_historic'] = 'History of commission transfers';
|
||||
$lang ['init_balance_princ'] = 'Initial principal balance';
|
||||
$lang ['init_balance_com'] = 'Initial commission balance';
|
||||
$lang ['final_balance_princ'] = 'Final principal balance';
|
||||
$lang ['final_balance_com'] = 'Final commission balance';
|
||||
$lang ['export_commission_transfer_history'] = 'Export the history of commission transfers displayed';
|
||||
$lang ['export_transaction_history'] = 'Export the history of displayed transactions';
|
||||
$lang ['export_balance_statement'] = 'Export the current state of accounts';
|
||||
$lang ['balance_statement'] = 'Statement of accounts';
|
||||
$lang ['created_date'] = 'Creation date';
|
||||
$lang['compensation_balance'] = 'Compensation balance';
|
||||
$lang['refund_compensation'] = 'Refund compensation';
|
||||
$lang ['refund'] = 'Refund';
|
||||
$lang ['refund_made'] = 'Refund made';
|
||||
$lang ['refund_history'] = 'History of refunds';
|
||||
$lang ['remaining_amount'] = 'Remaining amount';
|
||||
$lang ['amount_greater_than_balance'] = 'Amount greater than the compensation balance';
|
||||
$lang['no_refund'] = 'No refund';
|
||||
?>
|
||||
|
|
|
@ -443,4 +443,13 @@ $lang['export_transaction_history'] = 'Exporter l\'historique des transactions a
|
|||
$lang['export_balance_statement'] = 'Exporter l\'état actuel des comptes';
|
||||
$lang['balance_statement'] = 'État des comptes';
|
||||
$lang['created_date'] = 'Date de creation';
|
||||
$lang['compensation_balance'] = 'Solde de compensation';
|
||||
$lang['refund_compensation'] = 'Rembourser la compensation';
|
||||
$lang['refund'] = 'Rembourser';
|
||||
$lang['refund_made'] = 'Remboursement effectué';
|
||||
$lang['refund_history'] = 'Historique des remboursements';
|
||||
$lang['remaining_amount'] = 'Montant restant';
|
||||
$lang['amount_greater_than_balance'] = 'Montant supérieur au solde de compensation';
|
||||
$lang['no_refund'] = 'Aucun remboursement';
|
||||
|
||||
?>
|
||||
|
|
|
@ -2201,19 +2201,22 @@ class User_model extends CI_Model
|
|||
}
|
||||
}
|
||||
|
||||
public function addWalletPassword($network_id,$encrypted_password,$salt,$email){
|
||||
public function addWalletPassword($network_id, $encrypted_password, $salt, $email)
|
||||
{
|
||||
$sql = "INSERT INTO `walletsPassword` (`network_id`, `encrypted_password`, `salt`, `email`) VALUES ( ?, ?, ?, ?);";
|
||||
$query = $this->db->query($sql, array($network_id, $encrypted_password, $salt, $email));
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function updateWalletPassword($wallet_password_id,$encrypted_password,$salt,$email){
|
||||
$sql = "UPDATE `walletsPassword` SET `encrypted_password` = ? , `salt` = ? , `email` = ? WHERE (`id` = ?);";
|
||||
$query = $this->db->query($sql , array($encrypted_password,$salt,$email,$wallet_password_id));
|
||||
public function updateWalletPassword($wallet_password_id, $encrypted_password, $salt)
|
||||
{
|
||||
$sql = "UPDATE `walletsPassword` SET `encrypted_password` = ? , `salt` = ? WHERE (`id` = ?);";
|
||||
$query = $this->db->query($sql, array($encrypted_password, $salt, $wallet_password_id));
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function getWalletPassword($network_id){
|
||||
public function getWalletPassword($network_id)
|
||||
{
|
||||
$sql = "SELECT * FROM walletsPassword WHERE network_id = ?";
|
||||
$query = $this->db->query($sql, array($network_id));
|
||||
if ($query->num_rows() > 0) {
|
||||
|
@ -2540,8 +2543,9 @@ class User_model extends CI_Model
|
|||
}
|
||||
}
|
||||
|
||||
public function getPayingNetworksByConfigWallet($id_config){
|
||||
$query = $this->db->query("SELECT n.name , n.id , cw.type , c.name as country ,c.currency_code, pw.taux_partage as rate , pw.balance_com FROM networks n INNER JOIN countries_currencies c ON n.country_id=c.id
|
||||
public function getPayingNetworksByConfigWallet($id_config)
|
||||
{
|
||||
$query = $this->db->query("SELECT n.name , n.id , cw.type , c.name as country ,c.currency_code, pw.taux_partage as rate , pw.balance_com , pw.balance_compensation, pw.id_configWallet as config_id FROM networks n INNER JOIN countries_currencies c ON n.country_id=c.id
|
||||
INNER JOIN configWallet cw ON cw.id_network = n.id INNER JOIN paying_networks pw ON pw.id_network = n.id WHERE pw.id_configWallet = $id_config ");
|
||||
if ($query->num_rows() > 0) {
|
||||
return $query;
|
||||
|
@ -2607,7 +2611,8 @@ class User_model extends CI_Model
|
|||
}
|
||||
}
|
||||
|
||||
public function getInfosWalletAgentForSuper($codeMembre){
|
||||
public function getInfosWalletAgentForSuper($codeMembre)
|
||||
{
|
||||
$query = $this->db->query("SELECT *
|
||||
FROM wallet_agent
|
||||
WHERE `codeParrain`='" . $codeMembre . "'");
|
||||
|
@ -2617,4 +2622,34 @@ class User_model extends CI_Model
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function insertRembourssementCompensation($montant, $id_network, $id_config)
|
||||
{
|
||||
$sql = "SELECT * FROM `paying_networks` WHERE `id_network` = ? AND id_configWallet = ? ;";
|
||||
$query = $this->db->query($sql, array($id_network, $id_config));
|
||||
if ($query->num_rows() > 0) {
|
||||
$montant_init = $query->first_row()->balance_compensation;
|
||||
if (($montant_init - $montant) < 0)
|
||||
return false;
|
||||
$sql = "UPDATE `paying_networks` SET balance_compensation = ? WHERE `id_network` = ? AND id_configWallet = ?;";
|
||||
$this->db->query($sql, array($montant_init - $montant, $id_network, $id_config));
|
||||
$sql = "INSERT INTO `remboursemment_compensation` (`montant` , `montant_restant`,`id_paying_network` , `id_network`) VALUES ( ?, ?, ? ,?);";
|
||||
$this->db->query($sql, array($montant, $montant_init - $montant, $id_network, $this->session->userdata('network_id')));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getRefunds($debut, $fin, $id_network)
|
||||
{
|
||||
$chain = $debut ? " AND date BETWEEN '" . $debut . "' AND '" . $fin . "'" : "";
|
||||
$query = $this->db->query("SELECT rp.* , n.name as network , cc.name as country , cc.currency_code FROM remboursemment_compensation rp
|
||||
INNER JOIN networks n ON n.id = id_paying_network INNER JOIN countries_currencies cc ON cc.id = n.country_id
|
||||
WHERE rp.id_network =" . $id_network . $chain);
|
||||
if ($query->num_rows() > 0) {
|
||||
return $query;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,11 @@
|
|||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php echo $this->lang->line('paying_networks'); ?></h3>
|
||||
<div class="box-tools">
|
||||
<a class="btn btn-success" href="<?php echo current_url() . '?history=refund_history' ?>">
|
||||
<?php echo $this->lang->line('refund_history'); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body" style="overflow-x:auto;">
|
||||
|
||||
|
@ -68,6 +73,8 @@
|
|||
<th align='center'>Wallet</th>
|
||||
<th align='center'> <?php echo $this->lang->line('share_rate') ?></th>
|
||||
<th><?= $this->lang->line('Solde Commission') ?></th>
|
||||
<th><?= $this->lang->line('compensation_balance') ?></th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -92,7 +99,8 @@
|
|||
} else {
|
||||
?>
|
||||
<td>
|
||||
<span class="label label-danger" style="font-size: 1em;" ><?php echo $this->lang->line('not_defined'); ?></span>
|
||||
<span class="label label-danger"
|
||||
style="font-size: 1em;"><?php echo $this->lang->line('not_defined'); ?></span>
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
|
@ -100,6 +108,17 @@
|
|||
<td>
|
||||
<?= Money::of(round($row->balance_com, 2), $row->currency_code ? $row->currency_code : 'XAF', $context)->formatTo('fr_FR') ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= Money::of(round($row->balance_compensation, 2), $row->currency_code ? $row->currency_code : 'XAF', $context)->formatTo('fr_FR') ?>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-primary btn-block openModal" data-toggle="modal"
|
||||
data-target="#refundModal" data-network-id="<?= $row->id ?>"
|
||||
data-config-id="<?= $row->config_id ?>"
|
||||
<?php if ($row->balance_compensation == 0) echo "disabled" ?>>
|
||||
<b><?php echo $this->lang->line('refund_compensation'); ?></b>
|
||||
</button>
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
@ -119,27 +138,58 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="configureRate" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
|
||||
<div class="modal fade" id="refundModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title"><?php echo $this->lang->line('configure_share_rate'); ?></h3>
|
||||
<h3 class="modal-title"><?php echo $this->lang->line('refund_compensation'); ?></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="rateForm">
|
||||
<?php if ($walletPassword != null) { ?>
|
||||
<form id="refundForm">
|
||||
<div class="form-group">
|
||||
<label for="rate"
|
||||
class="col-form-label"><?php echo $this->lang->line('share_rate') . ' (%)'; ?></label>
|
||||
<input type="number" min="0" step=".01" max="100" required class="form-control"
|
||||
name="rate" id="rate" value="0">
|
||||
<label for="montant"
|
||||
class="col-form-label"><?php echo $this->lang->line('Montant') ?></label>
|
||||
<input type="text" required class="form-control" id="montant" name="montant">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label><?php echo $this->lang->line('mot de passe') ?></label>
|
||||
<div class="input-group" id="show_hide_password">
|
||||
<input class="form-control" name="password" id="password" type="password">
|
||||
<div class="input-group-addon">
|
||||
<a href=""><i class="fa fa-eye-slash" aria-hidden="true"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
<a href="#" id="resetPassword" class="pull-right forgot-password"
|
||||
data-wallet_password_id="<?php echo $walletPassword->id ?>"
|
||||
data-network="<?php echo $network ?>" data-country="<?php echo $country ?>"
|
||||
data-email="<?php echo $walletPassword->email ?>">
|
||||
<?php echo $this->lang->line('i_forgot_password') ?>
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
<?php } else { ?>
|
||||
<div class="text-center">
|
||||
<h4> <?php echo $this->lang->line('no_wallet_password') ?></h4>
|
||||
<a href="<?php echo base_url('index.php/Hyperviseur_dash/walletPassword') ?>" alt=""
|
||||
class="btn btn-primary"><?php echo $this->lang->line('click_here') ?></a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary"
|
||||
data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
|
||||
<button type="button" class="btn btn-primary"
|
||||
id="enableRate"> <?php echo $this->lang->line('Valider'); ?></button>
|
||||
<?php if ($walletPassword != null) { ?>
|
||||
<button type="button" class="btn btn-primary" data-wallet_id="<?php echo 12 ?>"
|
||||
data-salt="<?php echo $walletPassword->salt ?>"
|
||||
data-encrypted_password="<?php echo $walletPassword->encrypted_password ?>"
|
||||
id="refund">
|
||||
<?php echo $this->lang->line('refund'); ?>
|
||||
</button>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -163,12 +213,35 @@
|
|||
<!-- AdminLTE for demo purposes -->
|
||||
<script src="<?php echo base_url('dist/js/demo.js') ?>"></script>
|
||||
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
|
||||
<script src="<?php echo base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
|
||||
<script src="<?php echo base_url('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') ?>"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.js"></script>
|
||||
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.5.4"></script>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('#validated').DataTable();
|
||||
|
||||
anElement = new AutoNumeric('#montant', '', {
|
||||
digitGroupSeparator: ' ',
|
||||
decimalPlaces: '0',
|
||||
minimumValue: '1',
|
||||
maximumValue: '99999999999999999999999999'
|
||||
});
|
||||
|
||||
$("#show_hide_password a").on('click', function (event) {
|
||||
event.preventDefault();
|
||||
if ($('#show_hide_password input').attr("type") == "text") {
|
||||
$('#show_hide_password input').attr('type', 'password');
|
||||
$('#show_hide_password i').addClass("fa-eye-slash");
|
||||
$('#show_hide_password i').removeClass("fa-eye");
|
||||
} else if ($('#show_hide_password input').attr("type") == "password") {
|
||||
$('#show_hide_password input').attr('type', 'text');
|
||||
$('#show_hide_password i').removeClass("fa-eye-slash");
|
||||
$('#show_hide_password i').addClass("fa-eye");
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
|
@ -183,40 +256,99 @@
|
|||
$(document).on("click", ".openModal", function () {
|
||||
network_id = $(this).data('network-id');
|
||||
config_id = $(this).data('config-id');
|
||||
})
|
||||
});
|
||||
|
||||
$('#refund').click(function () {
|
||||
|
||||
const salt = $(this).data('salt');
|
||||
const encrypted_password = $(this).data('encrypted_password');
|
||||
|
||||
if ($('#refundForm')[0].checkValidity()) {
|
||||
const montant = anElement.getNumber(); //parseFloat($('#montant').val());
|
||||
const password = $('#password').val();
|
||||
|
||||
$(document).on("click", "#enableRate", function () {
|
||||
// const network_id = $(this).data('network-id');
|
||||
if ($('#rateForm')[0].checkValidity()) {
|
||||
const rate = parseFloat($('#rate').val());
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('index.php/Hyperviseur_dash/config_sharing_rate')?>',
|
||||
url: '<?php echo base_url('index.php/Hyperviseur_dash/rembourser_compensation')?>',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {"network_id": network_id, "rate": rate , "config_id" : config_id},
|
||||
data: {
|
||||
"id_config": config_id,
|
||||
"id_network": network_id,
|
||||
"montant": montant,
|
||||
"password": password,
|
||||
"salt": salt,
|
||||
"encrypted_password": encrypted_password
|
||||
},
|
||||
success: function (data) {
|
||||
if (data == '200') {
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?php echo $this->lang->line('sharing_updated')?>",
|
||||
title: "<?php echo $this->lang->line('refund_made')?>",
|
||||
text: "<?php echo $this->lang->line('informations_updated')?>",
|
||||
timer: 3000
|
||||
}).then(() => {
|
||||
location.reload();
|
||||
});
|
||||
|
||||
// alert("Les informations ont été mises à jour.") ? "" :
|
||||
} else if (data == '400') {
|
||||
toastr.error("<?php echo $this->lang->line('incorrect_password')?>", "<?php echo $this->lang->line('request_error')?>");
|
||||
} else if (data == '401') {
|
||||
toastr.error("<?php echo $this->lang->line('amount_greater_than_balance')?>", "<?php echo $this->lang->line('request_error')?>");
|
||||
} 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 {
|
||||
$('#rateForm')[0].reportValidity();
|
||||
};
|
||||
$('#refundForm')[0].reportValidity();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#resetPassword').click(function () {
|
||||
const wallet_password_id = $(this).data('wallet_password_id');
|
||||
const network = $(this).data('network');
|
||||
const country = $(this).data('country');
|
||||
const email = $(this).data('email');
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('index.php/Hyperviseur_dash/resetWalletPassword')?>',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
"wallet_password_id": wallet_password_id,
|
||||
"email": email,
|
||||
"network": network,
|
||||
"country": country
|
||||
},
|
||||
success: function (data) {
|
||||
if (data == '200') {
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?php echo $this->lang->line('password_has_been_reset')?>",
|
||||
text: "<?php echo $this->lang->line('informations_updated')?>",
|
||||
timer: 3000
|
||||
}).then(() => {
|
||||
location.reload();
|
||||
});
|
||||
// alert("Les informations ont été mises à jour.") ? "" :
|
||||
} 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')?>");
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,245 @@
|
|||
<!-- DataTables -->
|
||||
<link rel="stylesheet"
|
||||
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Brick\Money\Context\AutoContext;
|
||||
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;
|
||||
|
||||
// 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);
|
||||
|
||||
$configuration = new PDOProviderConfiguration();
|
||||
|
||||
$configuration->tableName = 'exchange_rate';
|
||||
$configuration->exchangeRateColumnName = 'exchange_rate';
|
||||
$configuration->targetCurrencyColumnName = 'target_currency';
|
||||
$configuration->sourceCurrencyCode = $baseCurrency;
|
||||
|
||||
// this provider loads exchange rates from your database
|
||||
$provider = new PDOProvider($pdo, $configuration);
|
||||
|
||||
// this provider calculates exchange rates relative to the base currency
|
||||
$provider = new BaseCurrencyProvider($provider, $baseCurrency);
|
||||
|
||||
// this currency converter can now handle any currency pair
|
||||
$converter = new CurrencyConverter($provider);
|
||||
$context = new AutoContext();
|
||||
|
||||
function toLocateDate($date, $timezone)
|
||||
{
|
||||
if ($date) {
|
||||
$carbon = Carbon::createFromFormat('Y-m-d H:i:s', $date, 'UTC');
|
||||
$carbon->setTimezone($timezone);
|
||||
return $carbon->toDateTimeString();
|
||||
}
|
||||
return $date;
|
||||
}
|
||||
|
||||
?>
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
|
||||
<h1>
|
||||
<?php echo isset($category) ? $this->lang->line('refund_history') : $this->lang->line('Gestion des wallets');
|
||||
echo ' ' . $network . ' - ' . $country; ?>
|
||||
<!-- <input type="button" class="btn btn-primary pull-right" id="Bactiver"-->
|
||||
<!-- value="Activer/Désactiver le(s) réseau(x)" />-->
|
||||
</h1>
|
||||
<?php
|
||||
$site_url = base_url();
|
||||
|
||||
if ($alert == "ok") {
|
||||
|
||||
if (!$success == "ok") {
|
||||
?>
|
||||
<div class='alert alert-danger alert-dismissible col-xs-6'>
|
||||
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
|
||||
<h4><i class='icon fa fa-ban'></i> Erreur!</h4>
|
||||
<?php echo $message; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-success alert-dismissible col-xs-6">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-check"></i> Success!</h4>
|
||||
<?php echo $message; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-6 col-xs-12">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-aqua"><i class="ion ion-android-time"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text"><?php echo $this->lang->line('Période') ?> </span>
|
||||
<span class="info-box-number">
|
||||
<input id="picker"
|
||||
style="background: #fff; cursor: pointer; padding: 1px 1px; border: 1px solid #ccc; width: 100%"
|
||||
data-category="<?php echo isset($category) ? $category : null ?>"
|
||||
type="text" name="daterange"
|
||||
data-lang="<?php echo $this->session->userdata('site_lang') ?>"
|
||||
value="<?php echo ($startDate != null & $endDate != null) ? $startDate . ' - ' . $endDate : '' ?>"/>
|
||||
|
||||
</span>
|
||||
<span> Format : <?php echo $this->session->userdata('site_lang') === 'french' ? 'Jour - Mois - Année ' : 'Year - Month - Day' ?> </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php echo $this->lang->line('recharge_historic'); ?></h3>
|
||||
</div>
|
||||
<div class="box-body" style="overflow-x:auto;">
|
||||
<?php
|
||||
if ($refunds){
|
||||
$numrows = $refunds->num_rows();
|
||||
$num = 0;
|
||||
if ($numrows > 0) {
|
||||
$fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
||||
?>
|
||||
|
||||
<table id="transactions" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align='center'>N°</th>
|
||||
<th><?php echo $this->lang->line('Montant') ?></th>
|
||||
<th><?php echo $this->lang->line('remaining_amount') ?></th>
|
||||
<th><?php echo $this->lang->line('Reseau') ?></th>
|
||||
<th><?php echo $this->lang->line('Pays') ?></th>
|
||||
<th align='center'>Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
|
||||
foreach ($refunds->result() as $row) {
|
||||
$num++;
|
||||
echo "<tr>
|
||||
<td align='center' >$num</td>
|
||||
<td>" . Money::of(round($row->montant, 2), $row->currency_code, $context)->formatTo('fr_FR') . "</td>
|
||||
<td>" . Money::of(round($row->montant_restant, 2), $row->currency_code, $context)->formatTo('fr_FR') . "</td>
|
||||
<td>" . $row->network . "</td>
|
||||
<td>" . $row->country . "</td>
|
||||
<td>" . toLocateDate($row->date, $this->session->userdata('timezone')) . "</td>
|
||||
</tr>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
echo $this->lang->line('no_refund');
|
||||
}
|
||||
} else {
|
||||
echo $this->lang->line('no_refund');
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- jQuery 3 -->
|
||||
<script src="<?php echo base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
|
||||
<!-- Bootstrap 3.3.7 -->
|
||||
<script src="<?php echo base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
|
||||
<!-- DataTables -->
|
||||
<script src="<?php echo base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
|
||||
<script src="<?php echo base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
|
||||
<!-- SlimScroll -->
|
||||
<script src="<?php echo base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
|
||||
<!-- FastClick -->
|
||||
<script src="<?php echo base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
|
||||
<!-- AdminLTE App -->
|
||||
<script src="<?php echo base_url('dist/js/adminlte.min.js') ?>"></script>
|
||||
<!-- AdminLTE for demo purposes -->
|
||||
<script src="<?php echo base_url('dist/js/demo.js') ?>"></script>
|
||||
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment-with-locales.min.js"></script>
|
||||
<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>
|
||||
$(function () {
|
||||
const lang = $('#picker').data('lang');
|
||||
const format = lang === 'french' ? 'fr' : 'en';
|
||||
moment.updateLocale(moment.locale(format), {invalidDate: ""}); // Blank text when is invalid date
|
||||
$('#transactions').DataTable({
|
||||
"aaSorting": [[5, "desc"]],
|
||||
"columnDefs": [{
|
||||
targets: 5,
|
||||
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
|
||||
}]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var startDate;
|
||||
var endDate;
|
||||
|
||||
$(function () {
|
||||
const lang = $('#picker').data('lang');
|
||||
const category = $('#picker').data('category');
|
||||
$('input[name="daterange"]').daterangepicker({
|
||||
opens: 'left',
|
||||
autoUpdateInput: false,
|
||||
locale: {
|
||||
format: lang === 'french' ? 'DD-MM-YYYY' : 'YYYY-MM-DD',
|
||||
cancelLabel: 'Clear'
|
||||
}
|
||||
}, function (start, end, label) {
|
||||
const debut = start.format('YYYY-MM-DD');
|
||||
const fin = end.format('YYYY-MM-DD');
|
||||
if (category)
|
||||
window.location = "<?php echo current_url()?>" + "?history=refund_history" + "&d=" + debut + "&f=" + fin;
|
||||
else
|
||||
window.location = "<?php echo current_url()?>" + "?id=118&history=refund_history" + "&d=" + debut + "&f=" + fin;
|
||||
|
||||
});
|
||||
|
||||
$('input[name="daterange"]').on('cancel.daterangepicker', function (ev, picker) {
|
||||
//do something, like clearing an input
|
||||
$('#daterange').val('');
|
||||
if (category)
|
||||
window.location = "<?php echo current_url()?>" + "?history=refund_history";
|
||||
else
|
||||
window.location = "<?php echo current_url()?>" + "?id=118&history=refund_history";
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
@ -8,7 +8,6 @@
|
|||
<?php
|
||||
|
||||
use Brick\Money\Context\AutoContext;
|
||||
use Brick\Money\Context\CustomContext;
|
||||
use Carbon\Carbon;
|
||||
use Brick\Money\CurrencyConverter;
|
||||
use Brick\Money\ExchangeRateProvider\PDOProvider;
|
||||
|
|
Loading…
Reference in New Issue