From 99316612d91353d686a26bbbe1a3ddd1bc290b9a Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Tue, 23 Jun 2020 07:41:44 +0100 Subject: [PATCH] + Update taux de partage --- application/controllers/Gestion.php | 38 +- application/controllers/Hyperviseur_dash.php | 4 +- application/models/User_model.php | 12 +- application/views/gestion_wallet_autre.php | 349 ++++++++++++++++++ ...ion_wallet_ilink_config_paying_network.php | 4 +- application/views/gestion_wallets.php | 7 +- 6 files changed, 391 insertions(+), 23 deletions(-) create mode 100755 application/views/gestion_wallet_autre.php diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php index 85bf1ad4..f4955f49 100755 --- a/application/controllers/Gestion.php +++ b/application/controllers/Gestion.php @@ -1622,6 +1622,8 @@ class Gestion extends CI_Controller $this->load->view('gestion_wallet'); elseif ($taux->type == 'ilink') $this->load->view('gestion_wallet_ilink'); + elseif ($taux->type == 'autre') + $this->load->view('gestion_wallet_autre'); $this->load->view('footer'); } } @@ -1818,26 +1820,30 @@ class Gestion extends CI_Controller // Asynchrous method $network_id = $_POST['network_id']; - $pool = Pool::create(); - $pool->add(function () use ($network_id) { - // Fetch all agents , hyperviseur , superviseur - $f_agents = $this->user_model->getAllAgentsForNetwork($network_id) ; - if ($f_agents){ - foreach($f_agents->result() AS $row){ - //Create wallet if it not exist - $res = $this->user_model->getWallet($row->agent_id); - if($res){ - // Reinitialize the wallet + $type = $_POST['type']; + if($type != 'autre'){ + $pool = Pool::create(); + $pool->add(function () use ($network_id) { + // Fetch all agents , hyperviseur , superviseur + $f_agents = $this->user_model->getAllAgentsForNetwork($network_id) ; + if ($f_agents){ + foreach($f_agents->result() AS $row){ + //Create wallet if it not exist + $res = $this->user_model->getWallet($row->agent_id); + if($res){ + // Reinitialize the wallet // $this->user_model->reinitializeWallet($res->first_row()->wallet_id); - }else{ - $this->user_model->addWallet($row->agent_id); + }else{ + $this->user_model->addWallet($row->agent_id); + } } } - } - })->then(function () { + })->then(function () { + + }); + await($pool); + } - }); - await($pool); } private function historique($network_id ,$startDate ,$endDate, $type) diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index ce69da76..c3ba4ad3 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -987,7 +987,7 @@ class Hyperviseur_dash extends CI_Controller if (isset($country)) { $data['country_id'] = $country; $data['country'] = $this->user_model->getCountry($country)->first_row(); - $res = $this->user_model->getActiveNetworks($country); + $res = $this->user_model->getActiveNetworksByCountry($country); $data['networks'] = []; if($res){ $result = $res->result(); @@ -1006,7 +1006,7 @@ class Hyperviseur_dash extends CI_Controller $this->load->view('footer'); return; } - $res = $this->user_model->getActiveCountries(); + $res = $this->user_model->getWalletsCountries(); $data['countries'] = []; if($res){ $result = $res->result(); diff --git a/application/models/User_model.php b/application/models/User_model.php index 8fe7b7f9..71acfd32 100755 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -2080,7 +2080,7 @@ class User_model extends CI_Model // Wallet public function getAllActivatedNetworks(){ - $query = $this->db->query("SELECT networks.name AS network,networks.status AS status,networks.id,countries.name AS country,networks.country_id , configWallet.id_network FROM `networks` + $query = $this->db->query("SELECT networks.name AS network,networks.status AS status,networks.id,countries.name AS country,networks.country_id , configWallet.id_network , configWallet.type FROM `networks` INNER JOIN countries ON networks.country_id=countries.id LEFT JOIN configWallet ON configWallet.id_network = networks.id WHERE status = 1"); if($query->num_rows()>0){ return $query; @@ -2476,4 +2476,14 @@ class User_model extends CI_Model return false; } } + + public function getActiveNetworksByCountry($country_id){ + $query = $this->db->query("SELECT networks.name , networks.id , configWallet.type FROM `networks` INNER JOIN countries ON networks.country_id=countries.id + INNER JOIN configWallet ON configWallet.id_network = networks.id WHERE status = 1 AND countries.id = $country_id"); + if($query->num_rows()>0){ + return $query; + }else{ + return false; + } + } } diff --git a/application/views/gestion_wallet_autre.php b/application/views/gestion_wallet_autre.php new file mode 100755 index 00000000..96e8efd7 --- /dev/null +++ b/application/views/gestion_wallet_autre.php @@ -0,0 +1,349 @@ + + + + + + +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_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'"); + +/** + ** Dépots + **/ +$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_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'"); + +if ($transactions != false) { + $transac = $transactions->num_rows(); + $array_transac = array(); + $num = 0; + if ($transac > 0) { + foreach ($transactions->result() as $row) { + $num++; + $array_transac[] = $row->type_transac; + } + $vals_transac = array_count_values($array_transac); + $pieChart = array(); + foreach (array_keys($vals_transac) as $paramName) { + $color = dechex(rand(0x000000, 0xFFFFFF)); + $trash = array("value" => $vals_transac[$paramName], + "color" => "#" . $color, + "highlight" => "#" . $color, + "label" => $paramName); + + $pieChart[] = $trash; + } + } +} else { + $pieChart = array(); +} +$fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL ); +?> + +
+ +
+ +

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

+ +
+ +

Erreur!

+ +
+ + +
+ +

Success!

+ +
+ + + +
+ +
+
+
+
+
+

%

+

lang->line('rate_com_user_wallet_cart') ?>

+
+
+ +
+
+
+
+
+
+
+
+

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

+ +
+
+
+ +
+
+
+
+
+
+
+

+ lang->line("Parts dépots & retraits"); ?>

+
+
+ +
+
+
+ +
+
+
+

lang->line('Commission Hyperviseur') ?>

+
+
+ + + + ".$this->lang->line('Nom')." + + + + + "; + ?> + + + + + + + + "; + + echo " + + "; + + } + ?> + +
".$this->lang->line('Solde Principal')."".$this->lang->line('Solde Commission')."".$this->lang->line('Commission banque')."".$this->lang->line('DEPOT'). 's'."".$this->lang->line('RETRAIT').'s'."
" . $walletHyper->first_row()->lastname . "" . $fmt->format($walletHyper->first_row()->balance_princ) . "" . $fmt->format($walletHyper->first_row()->balance_com) . "" . $fmt->format($totalCommissionBanque) . "" . $depots->num_rows() . "" . $retraits->num_rows() . "
+
+
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/views/gestion_wallet_ilink_config_paying_network.php b/application/views/gestion_wallet_ilink_config_paying_network.php index c9bae56c..2dd843a0 100755 --- a/application/views/gestion_wallet_ilink_config_paying_network.php +++ b/application/views/gestion_wallet_ilink_config_paying_network.php @@ -59,6 +59,7 @@ N° lang->line('Nom'); ?> + Wallet lang->line('share_rate')?> Action @@ -71,7 +72,8 @@ //$member_code = randomString1(10); echo " $num - $row->name"; + $row->name + ".strtoupper($row->type).""; ?> rate != null ) { diff --git a/application/views/gestion_wallets.php b/application/views/gestion_wallets.php index 99a568c7..7361ebdd 100755 --- a/application/views/gestion_wallets.php +++ b/application/views/gestion_wallets.php @@ -77,7 +77,7 @@ id_network){ ?> - lang->line('Actif'); ?> + type) ?>
- + +
@@ -228,7 +229,7 @@ url : '', type : 'POST', dataType : 'json', - data : {"network_id": network_id}, + data : {"network_id": network_id , "type" : type}, async : true , timeout : 0, success : function () {