+ Add historic of ilink transactions

This commit is contained in:
Djery-Tom 2020-06-24 13:06:52 +01:00
parent 888c17ba8e
commit 36b456108b
7 changed files with 402 additions and 60 deletions

View File

@ -1554,6 +1554,16 @@ class Gestion extends CI_Controller
$data['taux_bq_d'] = $taux->part_banque_depot; $data['taux_bq_d'] = $taux->part_banque_depot;
$data['taux_bq_r'] = $taux->part_banque_retrait; $data['taux_bq_r'] = $taux->part_banque_retrait;
$data['frais_d'] = $taux->frais_min_banque_depot; $data['frais_d'] = $taux->frais_min_banque_depot;
$data['transactions'] = $this->user_model->getTransactions(null,null,$network_id);
$totalCommissionBanque = 0;
if($data['transactions']){
foreach ($data['transactions']->result() as $row) {
$totalCommissionBanque += $row->commission_banque;
}
}
$data['totalCommissionBanque'] = $totalCommissionBanque ;
} elseif ($taux->type == 'ilink'){ } elseif ($taux->type == 'ilink'){
$data['plr_user_wallet_wallet'] = $this->user_model->getPalierConfigWallet("user_wallet_wallet_international", $data['idConfig']); $data['plr_user_wallet_wallet'] = $this->user_model->getPalierConfigWallet("user_wallet_wallet_international", $data['idConfig']);
$data['plr_user_wallet_cash'] = $this->user_model->getPalierConfigWallet("user_wallet_cash_international", $data['idConfig']); $data['plr_user_wallet_cash'] = $this->user_model->getPalierConfigWallet("user_wallet_cash_international", $data['idConfig']);
@ -1591,19 +1601,22 @@ class Gestion extends CI_Controller
$data['taux_bq_r_cart'] = $taux->taux_com_banque_retrait_carte_cash; $data['taux_bq_r_cart'] = $taux->taux_com_banque_retrait_carte_cash;
$data['taux_hyp_r_cart_ilink'] = $taux->taux_com_hyp_retrait_carte_cash_ilink; $data['taux_hyp_r_cart_ilink'] = $taux->taux_com_hyp_retrait_carte_cash_ilink;
$data['taux_bq_r_cart_ilink'] = $taux->taux_com_banque_retrait_carte_cash_ilink; $data['taux_bq_r_cart_ilink'] = $taux->taux_com_banque_retrait_carte_cash_ilink;
$data['transactions'] = $this->user_model->getNetworkIlinTransactions($network_id);
$totalCommissionBanque = 0;
if ($data['transactions']) {
foreach ($data['transactions']->result() as $trans) {
$totalCommissionBanque += $trans->commission_banque;
}
}
$data["totalCommissionBanque"] = $totalCommissionBanque;
}elseif ($taux->type == 'autre') { }elseif ($taux->type == 'autre') {
$res = $this->user_model->getSharingRateByNetwork($network_id); $res = $this->user_model->getSharingRateByNetwork($network_id);
$data['commission'] = $res ? $res->first_row()->balance_com : 0 ; $data['commission'] = $res ? $res->first_row()->balance_com : 0 ;
} }
$data['transactions'] = $this->user_model->getTransactions(null,null,$network_id);
$totalCommissionBanque = 0;
if($data['transactions']){
foreach ($data['transactions']->result() as $row) {
$totalCommissionBanque += $row->commission_banque;
}
}
$data['totalCommissionBanque'] = $totalCommissionBanque ;
$hyper = $this->user_model->getNetworkHyper($network_id)->first_row(); $hyper = $this->user_model->getNetworkHyper($network_id)->first_row();
@ -1857,10 +1870,12 @@ class Gestion extends CI_Controller
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null ; $data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null ;
$data['endDate'] = $endDate ?date($format, strtotime($endDate)): null ; $data['endDate'] = $endDate ?date($format, strtotime($endDate)): null ;
$endDate = Date('Y-m-d', strtotime($endDate."+1 day")); $endDate = Date('Y-m-d', strtotime($endDate."+1 day"));
if($type == 'transaction') if ($type == 'transaction')
$data['transactions'] = $this->user_model->getTransactions($startDate , $endDate ,$network_id); $data['transactions'] = $this->user_model->getTransactions($startDate, $endDate, $network_id);
else if ($type == 'transaction_ilink')
$data['transactions'] = $this->user_model->getIlinkTransactions($startDate, $endDate, $network_id);
else else
$data['transactions'] = $this->user_model->getRecharges($startDate , $endDate ,$network_id); $data['transactions'] = $this->user_model->getRecharges($startDate, $endDate, $network_id);
$data['active'] = "wallet"; $data['active'] = "wallet";
$data['alert'] = ""; $data['alert'] = "";
@ -1872,8 +1887,10 @@ class Gestion extends CI_Controller
$data['country'] = $networkDetails->first_row()->country; $data['country'] = $networkDetails->first_row()->country;
} }
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
if($type == 'transaction') if ($type == 'transaction')
$this->load->view('historique_transactions'); $this->load->view('historique_transactions');
else if ($type == 'transaction_ilink')
$this->load->view('historique_transactions_ilink');
else else
$this->load->view('historique_recharges'); $this->load->view('historique_recharges');
$this->load->view('footer'); $this->load->view('footer');

View File

@ -337,6 +337,29 @@ class Hyperviseur_dash extends CI_Controller
$data['taux_bq_d'] = $taux->part_banque_depot; $data['taux_bq_d'] = $taux->part_banque_depot;
$data['taux_bq_r'] = $taux->part_banque_retrait; $data['taux_bq_r'] = $taux->part_banque_retrait;
$data['frais_d'] = $taux->frais_min_banque_depot; $data['frais_d'] = $taux->frais_min_banque_depot;
$agents_g = $this->user_model->getAllGeolocatedUsersForHyp($this->session->userdata('member_code'));
//Fetch all transactions of any geolocated agent of the network
$data["transactions"] = array();
$totalCommissionBanque = 0;
if ($agents_g) {
foreach ($agents_g->result() as $row) {
$wallet = $this->user_model->getWallet($row->agent_id);
if ($wallet) {
$transactions = $this->user_model->getAgentTransactions($wallet->first_row()->wallet_id);
if ($transactions) {
foreach ($transactions->result() as $trans) {
$totalCommissionBanque += $trans->commission_banque;
$trans->code_parrain = $row->code_parrain; // Add code parrain to transaction
array_push($data['transactions'], $trans);
}
}
}
}
}
$data["totalCommissionBanque"] = $totalCommissionBanque;
} elseif ($data['hasWallet']->first_row()->type == 'ilink') { } elseif ($data['hasWallet']->first_row()->type == 'ilink') {
$data['plr_user_wallet_wallet'] = $this->user_model->getPalierConfigWallet("user_wallet_wallet_international", $data['idConfig']); $data['plr_user_wallet_wallet'] = $this->user_model->getPalierConfigWallet("user_wallet_wallet_international", $data['idConfig']);
$data['plr_user_wallet_cash'] = $this->user_model->getPalierConfigWallet("user_wallet_cash_international", $data['idConfig']); $data['plr_user_wallet_cash'] = $this->user_model->getPalierConfigWallet("user_wallet_cash_international", $data['idConfig']);
@ -374,6 +397,18 @@ class Hyperviseur_dash extends CI_Controller
$data['taux_bq_r_cart'] = $taux->taux_com_banque_retrait_carte_cash; $data['taux_bq_r_cart'] = $taux->taux_com_banque_retrait_carte_cash;
$data['taux_hyp_r_cart_ilink'] = $taux->taux_com_hyp_retrait_carte_cash_ilink; $data['taux_hyp_r_cart_ilink'] = $taux->taux_com_hyp_retrait_carte_cash_ilink;
$data['taux_bq_r_cart_ilink'] = $taux->taux_com_banque_retrait_carte_cash_ilink; $data['taux_bq_r_cart_ilink'] = $taux->taux_com_banque_retrait_carte_cash_ilink;
$transactions = $this->user_model->getNetworkIlinTransactions($id_network);
$data["transactions"] = array();
$totalCommissionBanque = 0;
if ($transactions) {
foreach ($transactions->result() as $trans) {
$totalCommissionBanque += $trans->commission_banque;
array_push($data['transactions'], $trans);
}
}
$data["totalCommissionBanque"] = $totalCommissionBanque;
} }
//Create wallet if it not exist //Create wallet if it not exist
@ -387,27 +422,7 @@ class Hyperviseur_dash extends CI_Controller
$data["commission"] = $row->balance_com; $data["commission"] = $row->balance_com;
$data["principal"] = $row->balance_princ; $data["principal"] = $row->balance_princ;
$data['wallet_id'] = $row->wallet_id; $data['wallet_id'] = $row->wallet_id;
$agents_g = $this->user_model->getAllGeolocatedUsersForHyp($this->session->userdata('member_code'));
//Fetch all transactions of any geolocated agent of the network
$data["transactions"] = array();
$totalCommissionBanque = 0;
if ($agents_g) {
foreach ($agents_g->result() as $row) {
$wallet = $this->user_model->getWallet($row->agent_id);
if ($wallet) {
$transactions = $this->user_model->getAgentTransactions($wallet->first_row()->wallet_id);
if ($transactions) {
foreach ($transactions->result() as $trans) {
$totalCommissionBanque += $trans->commission_banque;
$trans->code_parrain = $row->code_parrain; // Add code parrain to transaction
array_push($data['transactions'], $trans);
}
}
}
}
}
$data["totalCommissionBanque"] = $totalCommissionBanque;
$res = $this->user_model->getWalletPassword($id_network); $res = $this->user_model->getWalletPassword($id_network);
$data['walletPassword'] = $res ? $res->first_row() : null; $data['walletPassword'] = $res ? $res->first_row() : null;
@ -462,6 +477,8 @@ class Hyperviseur_dash extends CI_Controller
$endDate = Date('Y-m-d', strtotime($endDate . "+1 day")); $endDate = Date('Y-m-d', strtotime($endDate . "+1 day"));
if ($type == 'transaction') if ($type == 'transaction')
$data['transactions'] = $this->user_model->getTransactions($startDate, $endDate, $network_id); $data['transactions'] = $this->user_model->getTransactions($startDate, $endDate, $network_id);
else if ($type == 'transaction_ilink')
$data['transactions'] = $this->user_model->getIlinkTransactions($startDate, $endDate, $network_id);
else else
$data['transactions'] = $this->user_model->getRecharges($startDate, $endDate, $network_id); $data['transactions'] = $this->user_model->getRecharges($startDate, $endDate, $network_id);
@ -481,6 +498,8 @@ class Hyperviseur_dash extends CI_Controller
$this->load->view('header_hyp', $data); $this->load->view('header_hyp', $data);
if ($type == 'transaction') if ($type == 'transaction')
$this->load->view('historique_transactions'); $this->load->view('historique_transactions');
else if ($type == 'transaction_ilink')
$this->load->view('historique_transactions_ilink');
else else
$this->load->view('historique_recharges'); $this->load->view('historique_recharges');
$this->load->view('footer'); $this->load->view('footer');

View File

@ -408,5 +408,8 @@ $lang['sharing_updated'] = 'Taux de partage mis à jour';
$lang['not_defined'] ='Non défini'; $lang['not_defined'] ='Non défini';
$lang['no_network'] = 'Aucun réseau'; $lang['no_network'] = 'Aucun réseau';
$lang['activated_countries'] = 'Pays activés'; $lang['activated_countries'] = 'Pays activés';
$lang['paying_networks_accounts'] = 'Comptes des reseaux payeurs' $lang['paying_networks_accounts'] = 'Comptes des reseaux payeurs';
$lang['user_name'] = 'Nom de l\'utilisateur';
$lang['fees'] = 'Frais';
$lang['tax'] = 'Taxe';
?> ?>

View File

@ -2506,4 +2506,27 @@ class User_model extends CI_Model
return false; return false;
} }
} }
public function getIlinkTransactions($debut , $fin , $id_network){
$chain = $debut ? " AND date BETWEEN '".$debut."' AND '".$fin."'" : "";
$query = $this->db->query("SELECT *
FROM infos_ilink_transaction
WHERE `network_emetteur`=".$id_network.$chain);
if($query->num_rows()>0){
return $query;
}else{
return false;
}
}
public function getNetworkIlinTransactions($id_network){
$query = $this->db->query("SELECT *
FROM infos_ilink_transaction
WHERE `network_emetteur`= '".$id_network."'");
if($query->num_rows()>0){
return $query;
}else{
return false;
}
}
} }

View File

@ -70,21 +70,21 @@ $date = date("Y");
$retraits_data[] = ''; $retraits_data[] = '';
$retraits_data = array(); $retraits_data = array();
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
$retraits_query_mounth = $this->db->query("SELECT id FROM infos_transaction $retraits_query_mounth = $this->db->query("SELECT id FROM infos_ilink_transaction
WHERE network_id='" . $network_id . "' WHERE network_emetteur='" . $network_id . "'
AND MONTH(date_created) = '" . $months[$i - 1] . "' AND MONTH(date) = '" . $months[$i - 1] . "'
AND YEAR(date_created) = '" . $years[$i - 1] . "' AND YEAR(date) = '" . $years[$i - 1] . "'
AND type_transac='debit'"); AND type_transaction='retrait'");
$retraits_data[] = $retraits_query_mounth->num_rows(); $retraits_data[] = $retraits_query_mounth->num_rows();
} }
$startDate = (new DateTime('01-' . $months[11] . '-' . $years[11]))->format('Y-m-d H:i:s'); $startDate = (new DateTime('01-' . $months[11] . '-' . $years[11]))->format('Y-m-d H:i:s');
$endDate = date_create_from_format('m/Y', $months[0] . '/' . $years[0])->format('Y-m-d H:i:s'); $endDate = date_create_from_format('m/Y', $months[0] . '/' . $years[0])->format('Y-m-d H:i:s');
$retraits = $this->db->query("SELECT * FROM infos_transaction $retraits = $this->db->query("SELECT * FROM infos_ilink_transaction
WHERE network_id='" . $network_id . "' WHERE network_emetteur='" . $network_id . "'
AND date_created BETWEEN '" . $startDate . "' AND '" . $endDate . "' AND date BETWEEN '" . $startDate . "' AND '" . $endDate . "'
AND type_transac='debit'"); AND type_transaction='retrait'");
/** /**
** Dépots ** Dépots
@ -94,18 +94,17 @@ $date = date("Y");
$depots_data[] = ''; $depots_data[] = '';
$depots_data = array(); $depots_data = array();
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
$depots_query_mounth = $this->db->query("SELECT id FROM infos_transaction $depots_query_mounth = $this->db->query("SELECT id FROM infos_ilink_transaction
WHERE network_id='" . $network_id . "' WHERE network_emetteur='" . $network_id . "'
AND MONTH(date_created) = '" . $months[$i - 1] . "' AND MONTH(date) = '" . $months[$i - 1] . "'
AND YEAR(date_created) = '" . $years[$i - 1] . "' AND YEAR(date) = '" . $years[$i - 1] . "'
AND type_transac='credit'"); AND type_transaction='depot'");
$depots_data[] = $depots_query_mounth->num_rows(); $depots_data[] = $depots_query_mounth->num_rows();
} }
$depots = $this->db->query("SELECT * FROM infos_transaction $depots = $this->db->query("SELECT * FROM infos_ilink_transaction
WHERE network_id='" . $network_id . "' WHERE network_emetteur='" . $network_id . "'
AND date_created BETWEEN '" . $startDate . "' AND '" . $endDate . "' AND date BETWEEN '" . $startDate . "' AND '" . $endDate . "'
AND type_transac='credit'"); AND type_transaction='depot'");
if ($transactions != false) { if ($transactions != false) {
$transac = $transactions->num_rows(); $transac = $transactions->num_rows();
$array_transac = array(); $array_transac = array();
@ -113,7 +112,7 @@ if ($transactions != false) {
if ($transac > 0) { if ($transac > 0) {
foreach ($transactions->result() as $row) { foreach ($transactions->result() as $row) {
$num++; $num++;
$array_transac[] = $row->type_transac; $array_transac[] = $row->type_transaction;
} }
$vals_transac = array_count_values($array_transac); $vals_transac = array_count_values($array_transac);
$pieChart = array(); $pieChart = array();
@ -772,7 +771,7 @@ $fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
<h3 class="box-title"> <h3 class="box-title">
<?php echo $this->lang->line('Historique des 12 derniers mois'); ?></h3> <?php echo $this->lang->line('Historique des 12 derniers mois'); ?></h3>
<div class="box-tools"> <div class="box-tools">
<a class="btn btn-primary" href="<?php echo current_url().($network_id ? '?id='.$network_id . '&history=transaction' : '')?>"> <a class="btn btn-primary" href="<?php echo current_url().($network_id ? '?id='.$network_id . '&history=transaction_ilink' : '')?>">
<?php echo $this->lang->line('transactions_historic'); ?> <?php echo $this->lang->line('transactions_historic'); ?>
</a> </a>
<a class="btn btn-info" href="<?php echo current_url().($network_id ? '?id='.$network_id . '&history=recharge' : '')?>"> <a class="btn btn-info" href="<?php echo current_url().($network_id ? '?id='.$network_id . '&history=recharge' : '')?>">

View File

@ -157,7 +157,7 @@
$retraits_query_mounth = array_filter($transactions, function ($trans) use ($i, $months ,$years){ $retraits_query_mounth = array_filter($transactions, function ($trans) use ($i, $months ,$years){
$month = date("m",strtotime($trans->date)); $month = date("m",strtotime($trans->date));
$year = date("Y",strtotime($trans->date)); $year = date("Y",strtotime($trans->date));
return $month == $months[$i-1] && $year == $years[$i-1] && $trans->type == 'debit' ; return $month == $months[$i-1] && $year == $years[$i-1] && $trans->type_transaction == 'retrait' ;
}); });
$retraits_data[] = sizeof($retraits_query_mounth); $retraits_data[] = sizeof($retraits_query_mounth);
} }
@ -168,7 +168,7 @@
$retraits = array_filter($transactions, function ($trans) use ($i, $endDate ,$startDate){ $retraits = array_filter($transactions, function ($trans) use ($i, $endDate ,$startDate){
$date = strtotime($trans->date); $date = strtotime($trans->date);
// return $date >= strtotime($startDate) && $date <= strtotime($endDate) && $trans->type == 'debit' ; // return $date >= strtotime($startDate) && $date <= strtotime($endDate) && $trans->type == 'debit' ;
return $trans->type == 'debit' ; return $trans->type_transaction == 'retrait' ;
}); });
/** /**
@ -182,14 +182,14 @@
$depots_query_mounth= array_filter($transactions, function ($trans) use ($i, $months ,$years){ $depots_query_mounth= array_filter($transactions, function ($trans) use ($i, $months ,$years){
$month = date("m",strtotime($trans->date)); $month = date("m",strtotime($trans->date));
$year = date("Y",strtotime($trans->date)); $year = date("Y",strtotime($trans->date));
return $month == $months[$i-1] && $year == $years[$i-1] && $trans->type == 'credit' ; return $month == $months[$i-1] && $year == $years[$i-1] && $trans->type_transaction == 'depot' ;
}); });
$depots_data[] = sizeof($depots_query_mounth); $depots_data[] = sizeof($depots_query_mounth);
} }
$depots = array_filter($transactions, function ($trans) use ($i, $endDate ,$startDate){ $depots = array_filter($transactions, function ($trans) use ($i, $endDate ,$startDate){
$date = strtotime($trans->date); $date = strtotime($trans->date);
// return $date >= strtotime($startDate) && $date <= strtotime($endDate) && $trans->type == 'credit' ; // return $date >= strtotime($startDate) && $date <= strtotime($endDate) && $trans->type == 'credit' ;
return $trans->type == 'credit' ; return $trans->type_transaction == 'depot' ;
}); });
if($transactions!=false){ if($transactions!=false){
@ -199,7 +199,7 @@
if ($transac > 0) { if ($transac > 0) {
foreach($transactions as $row) { foreach($transactions as $row) {
$num++; $num++;
$array_transac[] = $row->type; $array_transac[] = $row->type_transaction;
} }
$vals_transac = array_count_values($array_transac); $vals_transac = array_count_values($array_transac);
$pieChart = array(); $pieChart = array();
@ -946,7 +946,7 @@
<a class="btn btn-success" href="<?php echo current_url().($network_id ? '?show=paying_networks' : '')?>"> <a class="btn btn-success" href="<?php echo current_url().($network_id ? '?show=paying_networks' : '')?>">
<?php echo $this->lang->line('paying_networks_accounts'); ?> <?php echo $this->lang->line('paying_networks_accounts'); ?>
</a> </a>
<a class="btn btn-primary" href="<?php echo current_url().($network_id ? '?history=transaction' : '')?>"> <a class="btn btn-primary" href="<?php echo current_url().($network_id ? '?history=transaction_ilink' : '')?>">
<?php echo $this->lang->line('transactions_historic'); ?> <?php echo $this->lang->line('transactions_historic'); ?>
</a> </a>
<a class="btn btn-info" href="<?php echo current_url().($network_id ? '?history=recharge' : '')?>"> <a class="btn btn-info" href="<?php echo current_url().($network_id ? '?history=recharge' : '')?>">

View File

@ -0,0 +1,281 @@
<!-- 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"/>
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
<div class="content-wrapper">
<?php
use Carbon\Carbon;
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) ? 'Wallet' : $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">&times;</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('Historique des transactions') ?></h3>
</div>
<div class="box-body" style="overflow-x:auto;">
<?php
if($transactions){
$numrows = $transactions->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'>ID</th>
<th align='center'>Type</th>
<th align='center'>Operation</th>
<th><?php echo $this->lang->line('cart_number') ?></th>
<th><?php echo $this->lang->line('customer_net_amount') ?></th>
<th><?php echo $this->lang->line('fees') ?></th>
<th><?php echo $this->lang->line('tax') ?></th>
<th><?php echo $this->lang->line('Commission de la banque') ?></th>
<th><?php echo $this->lang->line('Commission de l\'hyperviseur') ?></th>
<th><?php echo $this->lang->line('Commission du superviseur') ?></th>
<th><?php echo $this->lang->line('Commission de l\'agent') ?></th>
<th><?php echo $this->lang->line('agent_name') ?></th>
<th><?php echo $this->lang->line('user_name') ?></th>
<th align='center'>Date</th>
<?php if ($this->session->userdata('category') != 'super') { ?>
<th align='center'>Action</th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
$config = $configWallet->first_row();
foreach ($transactions->result() as $row) {
$num++;
$type = $row->type_transaction == 'depot' ? $this->lang->line('DEPOT') : $this->lang->line('RETRAIT');
$net = 0;
$banque = 0;
if($row->type_transaction == 'depot'){
$net = $row->montant_depot;
$banque = $row->montant * (1 - ($config->taux_com_client_depot / 100));
}else{
$net = $row->montant_retrait ;
}
echo "<tr>
<td align='center' >$row->id</td>
<td>".strtoupper($type)."</td>
<td>".strtoupper($row->acteur).' - '.$row->operation."</td>
<td>".join(" ", str_split($row->numero_carte, 4))."</td>
<td>".$fmt->format($net)."</td>
<td>".$fmt->format( $row->frais)."</td>
<td>".$fmt->format( $row->taxe)."</td>
<td>".$fmt->format( $row->commission_banque)."</td>
<td>".$fmt->format( $row->commission_hyp)."</td>
<td>".$fmt->format( $row->commission_sup)."</td>
<td>".$fmt->format( $row->commission_ag)."</td>
<td>".$row->agent."</td>
<td>".$row->user."</td>
<td>".toLocateDate($row->date,$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
}
?>
</tbody>
<?php
} else {
echo $this->lang->line('Aucune transaction');
}
}else {
echo $this->lang->line('Aucune transaction');
}
?>
</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 src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
<script src="<?php echo base_url('bower_components/toastr/toastr.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": [[ 0, "desc" ]],
"columnDefs": [ {
targets: 13,
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=transaction_ilink" + "&d=" + debut + "&f=" + fin;
else
window.location = "<?php echo current_url()?>" + "?id=118&history=transaction_ilink" + "&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=transaction_ilink";
else
window.location = "<?php echo current_url()?>" + "?id=118&history=transaction_ilink";
});
});
</script>
<script>
$(document).on("click", "#cancel", function () {
const id_transaction = $(this).data('id-transaction');
$.ajax({
url : '<?php echo base_url('index.php/Gestion/cancelIlinkTransation')?>',
type : 'POST',
dataType : 'json',
data: {"id_transaction": id_transaction},
async:true,
success : function(data){
if(data){
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('canceled_transaction')?>",
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>