diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php index ef65a720..9e66242e 100755 --- a/application/controllers/Gestion.php +++ b/application/controllers/Gestion.php @@ -1554,6 +1554,16 @@ class Gestion extends CI_Controller $data['taux_bq_d'] = $taux->part_banque_depot; $data['taux_bq_r'] = $taux->part_banque_retrait; $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'){ $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']); @@ -1591,19 +1601,22 @@ class Gestion extends CI_Controller $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_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') { $res = $this->user_model->getSharingRateByNetwork($network_id); $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(); @@ -1857,10 +1870,12 @@ class Gestion extends CI_Controller $data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null ; $data['endDate'] = $endDate ?date($format, strtotime($endDate)): null ; $endDate = Date('Y-m-d', strtotime($endDate."+1 day")); - if($type == 'transaction') - $data['transactions'] = $this->user_model->getTransactions($startDate , $endDate ,$network_id); + if ($type == 'transaction') + $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 - $data['transactions'] = $this->user_model->getRecharges($startDate , $endDate ,$network_id); + $data['transactions'] = $this->user_model->getRecharges($startDate, $endDate, $network_id); $data['active'] = "wallet"; $data['alert'] = ""; @@ -1872,8 +1887,10 @@ class Gestion extends CI_Controller $data['country'] = $networkDetails->first_row()->country; } $this->load->view('header_gestion', $data); - if($type == 'transaction') + if ($type == 'transaction') $this->load->view('historique_transactions'); + else if ($type == 'transaction_ilink') + $this->load->view('historique_transactions_ilink'); else $this->load->view('historique_recharges'); $this->load->view('footer'); diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index 346d1749..50a24a85 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -337,6 +337,29 @@ class Hyperviseur_dash extends CI_Controller $data['taux_bq_d'] = $taux->part_banque_depot; $data['taux_bq_r'] = $taux->part_banque_retrait; $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') { $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']); @@ -374,6 +397,18 @@ class Hyperviseur_dash extends CI_Controller $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_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 @@ -387,27 +422,7 @@ class Hyperviseur_dash extends CI_Controller $data["commission"] = $row->balance_com; $data["principal"] = $row->balance_princ; $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); $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")); if ($type == 'transaction') $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 $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); if ($type == 'transaction') $this->load->view('historique_transactions'); + else if ($type == 'transaction_ilink') + $this->load->view('historique_transactions_ilink'); else $this->load->view('historique_recharges'); $this->load->view('footer'); diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 8ee5d47e..2c5d5a25 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -408,5 +408,8 @@ $lang['sharing_updated'] = 'Taux de partage mis à jour'; $lang['not_defined'] ='Non défini'; $lang['no_network'] = 'Aucun réseau'; $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'; ?> diff --git a/application/models/User_model.php b/application/models/User_model.php index 932e49e7..b388a6ca 100755 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -2506,4 +2506,27 @@ class User_model extends CI_Model 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; + } + } } diff --git a/application/views/gestion_wallet_ilink.php b/application/views/gestion_wallet_ilink.php index ecc1b288..6f4ecb04 100755 --- a/application/views/gestion_wallet_ilink.php +++ b/application/views/gestion_wallet_ilink.php @@ -70,21 +70,21 @@ $date = date("Y"); $retraits_data[] = ''; $retraits_data = array(); for ($i = 1; $i <= 12; $i++) { - $retraits_query_mounth = $this->db->query("SELECT id FROM infos_transaction - WHERE network_id='" . $network_id . "' - AND MONTH(date_created) = '" . $months[$i - 1] . "' - AND YEAR(date_created) = '" . $years[$i - 1] . "' - AND type_transac='debit'"); + $retraits_query_mounth = $this->db->query("SELECT id FROM infos_ilink_transaction + WHERE network_emetteur='" . $network_id . "' + AND MONTH(date) = '" . $months[$i - 1] . "' + AND YEAR(date) = '" . $years[$i - 1] . "' + AND type_transaction='retrait'"); $retraits_data[] = $retraits_query_mounth->num_rows(); } $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'); -$retraits = $this->db->query("SELECT * FROM infos_transaction - WHERE network_id='" . $network_id . "' - AND date_created BETWEEN '" . $startDate . "' AND '" . $endDate . "' - AND type_transac='debit'"); +$retraits = $this->db->query("SELECT * FROM infos_ilink_transaction + WHERE network_emetteur='" . $network_id . "' + AND date BETWEEN '" . $startDate . "' AND '" . $endDate . "' + AND type_transaction='retrait'"); /** ** Dépots @@ -94,18 +94,17 @@ $date = date("Y"); $depots_data[] = ''; $depots_data = array(); for ($i = 1; $i <= 12; $i++) { - $depots_query_mounth = $this->db->query("SELECT id FROM infos_transaction - WHERE network_id='" . $network_id . "' - AND MONTH(date_created) = '" . $months[$i - 1] . "' - AND YEAR(date_created) = '" . $years[$i - 1] . "' - AND type_transac='credit'"); + $depots_query_mounth = $this->db->query("SELECT id FROM infos_ilink_transaction + WHERE network_emetteur='" . $network_id . "' + AND MONTH(date) = '" . $months[$i - 1] . "' + AND YEAR(date) = '" . $years[$i - 1] . "' + AND type_transaction='depot'"); $depots_data[] = $depots_query_mounth->num_rows(); } -$depots = $this->db->query("SELECT * FROM infos_transaction - WHERE network_id='" . $network_id . "' - AND date_created BETWEEN '" . $startDate . "' AND '" . $endDate . "' - AND type_transac='credit'"); - +$depots = $this->db->query("SELECT * FROM infos_ilink_transaction + WHERE network_emetteur='" . $network_id . "' + AND date BETWEEN '" . $startDate . "' AND '" . $endDate . "' + AND type_transaction='depot'"); if ($transactions != false) { $transac = $transactions->num_rows(); $array_transac = array(); @@ -113,7 +112,7 @@ if ($transactions != false) { if ($transac > 0) { foreach ($transactions->result() as $row) { $num++; - $array_transac[] = $row->type_transac; + $array_transac[] = $row->type_transaction; } $vals_transac = array_count_values($array_transac); $pieChart = array(); @@ -772,7 +771,7 @@ $fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );

lang->line('Historique des 12 derniers mois'); ?>

- + lang->line('transactions_historic'); ?> diff --git a/application/views/gestion_wallet_ilink_hyp.php b/application/views/gestion_wallet_ilink_hyp.php index 4e2f2ec2..f534aae3 100755 --- a/application/views/gestion_wallet_ilink_hyp.php +++ b/application/views/gestion_wallet_ilink_hyp.php @@ -157,7 +157,7 @@ $retraits_query_mounth = array_filter($transactions, function ($trans) use ($i, $months ,$years){ $month = date("m",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); } @@ -168,7 +168,7 @@ $retraits = array_filter($transactions, function ($trans) use ($i, $endDate ,$startDate){ $date = strtotime($trans->date); // 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){ $month = date("m",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 = array_filter($transactions, function ($trans) use ($i, $endDate ,$startDate){ $date = strtotime($trans->date); // return $date >= strtotime($startDate) && $date <= strtotime($endDate) && $trans->type == 'credit' ; - return $trans->type == 'credit' ; + return $trans->type_transaction == 'depot' ; }); if($transactions!=false){ @@ -199,7 +199,7 @@ if ($transac > 0) { foreach($transactions as $row) { $num++; - $array_transac[] = $row->type; + $array_transac[] = $row->type_transaction; } $vals_transac = array_count_values($array_transac); $pieChart = array(); @@ -946,7 +946,7 @@ lang->line('paying_networks_accounts'); ?> - + lang->line('transactions_historic'); ?> diff --git a/application/views/historique_transactions_ilink.php b/application/views/historique_transactions_ilink.php new file mode 100755 index 00000000..5d0bb721 --- /dev/null +++ b/application/views/historique_transactions_ilink.php @@ -0,0 +1,281 @@ + + + + + +
+setTimezone($timezone); + return $carbon->toDateTimeString(); + } + return $date; + } +?> + +
+ +

+ lang->line('Gestion des wallets') ; echo ' '.$network.' - '.$country; ?> + + +

+ +
+ +

Erreur!

+ +
+ + +
+ +

Success!

+ +
+ + +
+
+
+
+
+ +
+ lang->line('Période') ?> + + + + + Format : session->userdata('site_lang') === 'french' ? 'Jour - Mois - Année ' : 'Year - Month - Day'?> +
+
+
+ +
+
+
+
+
+

lang->line('Historique des transactions') ?>

+
+
+ num_rows(); + $num = 0; + if ($numrows > 0) { + $fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL ); + ?> + + + + + + + + + + + + + + + + + + + session->userdata('category') != 'super') { ?> + + + + + + + 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 " + + + + + + + + + + + + + + "; + ?> + session->userdata('category') != 'super') { ?> + + + + + + + + lang->line('Aucune transaction'); + } + }else { + echo $this->lang->line('Aucune transaction'); + } + ?> + +
IDTypeOperationlang->line('cart_number') ?>lang->line('customer_net_amount') ?>lang->line('fees') ?>lang->line('tax') ?>lang->line('Commission de la banque') ?>lang->line('Commission de l\'hyperviseur') ?>lang->line('Commission du superviseur') ?>lang->line('Commission de l\'agent') ?>lang->line('agent_name') ?>lang->line('user_name') ?>DateAction
$row->id".strtoupper($type)."".strtoupper($row->acteur).' - '.$row->operation."".join(" ", str_split($row->numero_carte, 4))."".$fmt->format($net)."".$fmt->format( $row->frais)."".$fmt->format( $row->taxe)."".$fmt->format( $row->commission_banque)."".$fmt->format( $row->commission_hyp)."".$fmt->format( $row->commission_sup)."".$fmt->format( $row->commission_ag)."".$row->agent."".$row->user."".toLocateDate($row->date,$this->session->userdata('timezone'))." + +
+ +
+
+
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +