lang->line('Utilisateurs simples'); ?>
-lang->line('Utilisateurs géolocalisés'); ?>
-lang->line('Codes validés'); ?>
-lang->line('Codes générés'); ?>
-diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php
index cb4c3585..2acc72c3 100755
--- a/application/controllers/Gestion.php
+++ b/application/controllers/Gestion.php
@@ -1546,6 +1546,7 @@ class Gestion extends CI_Controller
if ($taux != null) {
$taux = $taux->first_row();
$data['idConfig'] = $taux->id;
+ $data['type'] = $taux->type;
if ($taux->type == 'visa'){
$data['taux_client_r'] = $taux->taux_com_client_retrait;
$data['taux_client_d'] = $taux->taux_com_client_depot;
@@ -1617,7 +1618,12 @@ class Gestion extends CI_Controller
$res = $this->wallet_model->getSharingRateByNetwork($network_id);
$data['commission'] = $res ? $res->first_row()->balance_com : 0 ;
}elseif($taux->type == 'ilink_sante'){
-
+ $nh_config = $this->nano_health_model->getConfig($network_id);
+ $data['nh_config'] = $nh_config ? $nh_config->first_row() : null ;
+ $data['config_id'] = $data['nh_config'] ? $data['nh_config']->id : null ;
+ $data['years_prices_grid'] = $this->nano_health_model->getConfigYearsPricesGrid($data['config_id']);
+ $data['months_prices_grid'] = $this->nano_health_model->getConfigMonthsPricesGrid($data['config_id']);
+ $data['acts'] = $this->nano_health_model->getConfigActs($data['config_id']);
}
@@ -1640,8 +1646,8 @@ class Gestion extends CI_Controller
$this->load->view('gestion_wallet');
elseif ($taux->type == 'ilink')
$this->load->view('gestion_wallet_ilink');
-// elseif ($taux->type == 'ilink_sante')
-// $this->load->view('nano_health/admin/gestion_wallet_ilink_sante');
+ elseif ($taux->type == 'ilink_sante')
+ $this->load->view('nano_health/admin/gestion_wallet');
elseif ($taux->type == 'autre')
$this->load->view('gestion_wallet_autre');
$this->load->view('footer');
@@ -1666,11 +1672,12 @@ class Gestion extends CI_Controller
{
if($this->isLogged()){
if (isset($_POST)) {
- $country_id = $_POST['country_id'];
- $network_id = $_POST['network_id'];
$type = $_POST['type'];
$res = false;
if($method == 'create') {
+ $country_id = $_POST['country_id'];
+ $network_id = $_POST['network_id'];
+
if($type == 'ilink'){
$exist = $this->wallet_model->verifyConfigWalletInCountry($type,$country_id);
if($exist){
@@ -1682,6 +1689,8 @@ class Gestion extends CI_Controller
} else if($method == 'update'){
+ $idConfig = $_POST['id_config'];
+
if($type == 'visa'){
$taux_client_r = $_POST['taux_client_r'];
$taux_client_d = $_POST['taux_client_d'];
@@ -1693,10 +1702,10 @@ class Gestion extends CI_Controller
$taux_bq_r = $_POST['taux_bq_r'];
$frais_d = $_POST['frais_d'];
- $res = $this->wallet_model->updateConfigWallet($network_id , $taux_client_r , $taux_client_d , $taux_ag_r ,$taux_ag_d , $taux_sup_r , $taux_sup_d, $taux_bq_r , $taux_bq_d , $frais_d);
+ $res = $this->wallet_model->updateConfigWallet($idConfig , $taux_client_r , $taux_client_d , $taux_ag_r ,$taux_ag_d , $taux_sup_r , $taux_sup_d, $taux_bq_r , $taux_bq_d , $frais_d);
}else if ($type == 'ilink'){
- $idConfig = $_POST['id_config'];
+
$config = $_POST['config'];
$fields = isset($_POST['fields']) ? $_POST['fields'] : [];
@@ -1767,6 +1776,10 @@ class Gestion extends CI_Controller
break;
}
+ $res = true;
+ }else if($type == 'ilink_sante'){
+ unset($_POST['id_config'],$_POST['type']);
+ $this->nano_health_model->updateConfig($idConfig,$_POST);
$res = true;
}
@@ -2241,81 +2254,6 @@ class Gestion extends CI_Controller
}
}
-
- public function nano_health(){
- if ($this->isLogged()) {
- $data['active'] = "nano_health";
- $data['alert'] = "";
- $data['game_pays'] = $this->user_model->getGameCountry();
-
- if ($this->input->get('id')) {
- $data['network_id'] = $this->input->get('id');
-
- if ($this->input->get('history')) {
- $this->historique_nano_credit($data['network_id'], $this->input->get('d'), $this->input->get('f'), $this->input->get('history'));
- } elseif ($this->input->get('group')) {
- $this->users_group_details($data['network_id'],$this->input->get('group'));
- } else {
- $data['insurances'] = $this->nano_health_model->getAllInsurances($data['network_id']);
- $data['configWallet'] = $this->wallet_model->getConfigWallet($data['network_id'])->first_row();
- $networkDetails = $this->user_model->getNetworkDetails($data['network_id']);
- if ($networkDetails) {
- $data['network'] = $networkDetails->first_row()->network;
- $data['country'] = $networkDetails->first_row()->country;
- $data['currency_code'] = $networkDetails->first_row()->currency_code;
- }
-
- $data['rates_nano_credit'] = $this->nano_credit_model->getNanoCreditRates($data['configWallet']->id);
- $data['taxes_nano_credit'] = $this->wallet_model->getTaxes($data['configWallet']->id, 'nano_credit');
-
- $data['rates_epargne'] = $this->nano_credit_model->getNanoCreditRates($data['configWallet']->id, 'epargne');
- $data['taxes_epargne'] = $this->wallet_model->getTaxes($data['configWallet']->id, 'epargne');
- $this->load->view('header_gestion', $data);
- $this->load->view('nano_health/config_nano_health');
- $this->load->view('footer');
- }
- } else {
- $data['networks'] = $this->nano_health_model->getAllIlinkWorldNetworks();
- $this->load->view('header_gestion', $data);
- $this->load->view('nano_health/gestion_nano_health');
- $this->load->view('footer');
-
- }
- }
- }
-
- public function activate_nano_health()
- {
- if ($this->isLogged()) {
- if (isset($_POST)) {
- $data = array('has_nano_health' => 1);
- $this->db->where('id_network', $_POST['id_network']);
- $res = $this->db->update('configWallet', $data);
- if ($res) {
- echo json_encode("200");
- } else {
- echo json_encode("500");
- }
- }
- }
- }
-
- public function deactivate_nano_health()
- {
- if ($this->isLogged()) {
- if (isset($_POST)) {
- $data = array('has_nano_health' => 0);
- $this->db->where('id_network', $_POST['id_network']);
- $res = $this->db->update('configWallet', $data);
- if ($res) {
- echo json_encode("200");
- } else {
- echo json_encode("500");
- }
- }
- }
- }
-
public function regulations()
{
diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php
index 9ac03472..4c83a024 100755
--- a/application/controllers/Hyperviseur_dash.php
+++ b/application/controllers/Hyperviseur_dash.php
@@ -460,6 +460,16 @@ class Hyperviseur_dash extends CI_Controller
}
$data["totalCommissionBanque"] = Money::of(round($totalCommissionBanque,2), $this->session->userdata('currency_code'), $context )->formatTo('fr_FR');
+ }elseif($data['hasWallet']->first_row()->type == 'ilink_sante'){
+ $nh_config = $this->nano_health_model->getConfig($id_network);
+ $data['nh_config'] = $nh_config ? $nh_config->first_row() : null ;
+ $data['config_id'] = $data['nh_config'] ? $data['nh_config']->id : null ;
+ $data['provider_billing_periods'] = $this->user_model->getEnumValues('nh_networks_configs','provider_billing_period');
+ $data['years_prices_grid'] = $this->nano_health_model->getConfigYearsPricesGrid($data['config_id']);
+ $data['months_prices_grid'] = $this->nano_health_model->getConfigMonthsPricesGrid($data['config_id']);
+ $data['acts'] = $this->nano_health_model->getConfigActs($data['config_id']);
+ $data['billing_types'] = $this->user_model->getEnumValues('nh_acts','billing_type');
+ $data['authorization_types'] = $this->user_model->getEnumValues('nh_acts','authorization_type');
}
//Create wallet if it not exist
@@ -501,6 +511,8 @@ class Hyperviseur_dash extends CI_Controller
$this->load->view('gestion_wallet_hyp');
elseif ($data['hasWallet']->first_row()->type == 'ilink')
$this->load->view('gestion_wallet_ilink_hyp');
+ elseif ($data['hasWallet']->first_row()->type == 'ilink_sante')
+ $this->load->view('nano_health/hyper/gestion_wallet');
$this->load->view('footer');
}
}
diff --git a/application/controllers/NanoHealthController.php b/application/controllers/NanoHealthController.php
new file mode 100644
index 00000000..f1d0e41f
--- /dev/null
+++ b/application/controllers/NanoHealthController.php
@@ -0,0 +1,73 @@
+load->model('wallet_model');
+ $this->load->model('nano_health_model');
+ }
+
+
+ public function updateConfigYearsPricesGrid(){
+ if($this->isLogged()) {
+ if (isset($_POST)) {
+ $configId = $_POST['config_id'];
+ $grid = $_POST['grid'] ?? [];
+
+ $this->db->delete('nh_years_prices_grid',['nh_network_config_id' => $configId]);
+ $this->db->insert_batch('nh_years_prices_grid',$grid);
+
+ echo json_encode("200");
+ }
+ }
+ }
+
+ public function updateConfigMonthsPricesGrid(){
+ if($this->isLogged()) {
+ if (isset($_POST)) {
+ $configId = $_POST['config_id'];
+ $grid = $_POST['grid'] ?? [];
+
+ $this->db->delete('nh_months_prices_grid',['nh_network_config_id' => $configId]);
+ $this->db->insert_batch('nh_months_prices_grid',$grid);
+
+ echo json_encode("200");
+ }
+ }
+ }
+
+ public function storeAct(){
+ if($this->isLogged()) {
+ if (isset($_POST)) {
+ $id = $_POST['id'];
+ $_POST['nh_network_config_id'] = $_POST['config_id'];
+ unset($_POST['config_id']);
+
+ if(!empty($id)){
+ $this->db->where('id',$id);
+ $this->db->update('nh_acts',$_POST);
+ }else{
+ $this->db->insert('nh_acts',$_POST);
+ }
+
+ echo json_encode("200");
+ }
+ }
+ }
+
+ private function isLogged()
+ {
+ if (!$this->session->userdata('email')) {
+ $this->session->set_flashdata('error', 'log in first');
+
+ $data['alert'] = "ok";
+ $data['message'] = "Login first!";
+ $this->load->view('login', $data);
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/application/helpers/functions_helper.php b/application/helpers/functions_helper.php
index 5124ee8a..d8f7d198 100644
--- a/application/helpers/functions_helper.php
+++ b/application/helpers/functions_helper.php
@@ -79,7 +79,7 @@ if (!function_exists('getDelayOfTreatmentInSeconds')) {
}
}
-if ( ! function_exists('line_with_arguments'))
+if (!function_exists('line_with_arguments'))
{
function line_with_arguments($line, $args = array())
{
@@ -88,3 +88,49 @@ if ( ! function_exists('line_with_arguments'))
}
}
+if (!function_exists('convertDate')) {
+ function convertDate($date)
+ {
+ $month = null;
+ switch ($date) {
+ case "Jan":
+ $month = 1;
+ break;
+ case "Feb":
+ $month = 2;
+ break;
+ case "Mar":
+ $month = 3;
+ break;
+ case "Apr":
+ $month = 4;
+ break;
+ case "May":
+ $month = 5;
+ break;
+ case "Jun":
+ $month = 6;
+ break;
+ case "Jul":
+ $month = 7;
+ break;
+ case "Aug":
+ $month = 8;
+ break;
+ case "Sep":
+ $month = 9;
+ break;
+ case "Oct":
+ $month = 10;
+ break;
+ case "Nov":
+ $month = 11;
+ break;
+ case "Dec":
+ $month = 12;
+ break;
+ }
+ return $month;
+ }
+}
+
diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php
index 48fdcf05..c7d481cd 100755
--- a/application/language/english/message_lang.php
+++ b/application/language/english/message_lang.php
@@ -634,5 +634,42 @@ $lang['nano_health_management'] = 'Nano health management';
$lang['edit_nano_health'] = 'nano health configuration';
$lang['insurances_list'] = 'Insurance list';
$lang['add_insurance'] = 'Add an insurance';
-$lang['wallet_disabled'] = "Wallet disabled"
+$lang['wallet_disabled'] = "Wallet disabled";
+$lang['provider_billing_period'] = "Provider billing period";
+$lang['max_number_of_beneficiaries'] = "Maximum number of beneficiaries";
+$lang['age_limit_of_child_beneficiary'] = "Age limit of child beneficiary";
+$lang['support_type'] = "Type of support";
+$lang['percentage_insurer'] = "Insurer share";
+$lang['percentage_insured'] = "Insured share";
+$lang['list_of_acts'] = "List of acts";
+$lang['WEEKLY'] = "Weekly";
+$lang['BIMONTHLY'] = "Bimonthly";
+$lang['MONTHLY'] = "Monthly";
+$lang['current_affection'] = "Current Affection";
+$lang['long_term_affection'] = "Long-term condition";
+$lang['exoneration'] = "Exoneration";
+$lang['years_price_grid'] = "Age-based rate grid";
+$lang['months_price_grid'] = "Rate grid by minimum number of months";
+$lang['min_age'] = "Minimum age";
+$lang['max_age'] = "Max. age";
+$lang['markup_percentage'] = "Markup percentage";
+$lang['min_amount'] = "Minimum amount";
+$lang['number_of_months'] = "Number of months";
+$lang['edit_years_prices_grid'] = "Edit age-based rate grid";
+$lang['edit_months_prices_grid'] = "Modify the rate grid by minimum number of months";
+$lang['coverage_limit_per_insured_per_year'] = "Coverage limit per insured per year";
+$lang['current_affection_rule'] = "The sum of the % of current affection must equal 100%";
+$lang['long_term_affection_rule'] = "The sum of the % of long term condition must equal 100%";
+$lang['exoneration_rule'] = "The sum of the % of long term exoneration must equal 100%";
+$lang['add_act'] = "Add a procedure";
+$lang['edit_act'] = "Edit an act";
+$lang['billing_type'] = "Billing type";
+$lang['authorization_type'] = "authorization type";
+$lang['subscriptions_of_the_last_12_months'] = "Subscriptions of the last 12 months";
+$lang['subscriptions_historic'] = "Subscription history";
+$lang['PACKAGE'] = "Package";
+$lang['UNIT_PRICE'] = "Unit price";
+$lang['FREE'] = "Free";
+$lang['PRIOR'] = "Prerequisite";
+
?>
diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php
index ff2e47f8..6fd59893 100755
--- a/application/language/french/message_lang.php
+++ b/application/language/french/message_lang.php
@@ -646,5 +646,41 @@ $lang['nano_health_management'] = 'Gestion du nano santé';
$lang['edit_nano_health'] = 'Configuration du nano santé';
$lang['insurances_list'] = 'Liste des assurances';
$lang['add_insurance'] = "Ajouter une assurance";
-$lang['wallet_disabled'] = "Wallet désactivé"
+$lang['wallet_disabled'] = "Wallet désactivé";
+$lang['provider_billing_period'] = "Période de facturation des prestataires";
+$lang['max_number_of_beneficiaries'] = "Nombre maximum d’ayants droit";
+$lang['age_limit_of_child_beneficiary'] = "Age limite de l’ayant droit enfant";
+$lang['support_type'] = "Type de prise en charges";
+$lang['percentage_insurer'] = "Part assureur";
+$lang['percentage_insured'] = "Part assuré";
+$lang['list_of_acts'] = "Liste des actes";
+$lang['WEEKLY'] = "Hebdomadaire";
+$lang['BIMONTHLY'] = "Bimensuel";
+$lang['MONTHLY'] = "Mensuel";
+$lang['current_affection'] = "Affection courante";
+$lang['long_term_affection'] = "Affection longue durée";
+$lang['exoneration'] = "Exonération";
+$lang['years_price_grid'] = "Grille des tarifs par paliers d'age";
+$lang['months_price_grid'] = "Grille des tarifs par nombre de mois minimun";
+$lang['min_age'] = "Age Min.";
+$lang['max_age'] = "Age Max.";
+$lang['markup_percentage'] = "Pourcentage de majoration";
+$lang['min_amount'] = "Montant minimum";
+$lang['number_of_months'] = "Nombre de mois";
+$lang['edit_years_prices_grid'] = "Modifier la grille des tarifs par paliers d'age";
+$lang['edit_months_prices_grid'] = "Modifier la grille des tarifs par nombre de mois minimun";
+$lang['coverage_limit_per_insured_per_year'] = "Limite couverture par assuré par an";
+$lang['current_affection_rule'] = "La somme des % d'affection courante doit être égale à 100%";
+$lang['long_term_affection_rule'] = "La somme des % d'affection longue durée doit être égale à 100%";
+$lang['exoneration_rule'] = "La somme des % d'exonération durée doit être égale à 100%";
+$lang['add_act'] = "Ajouter un acte";
+$lang['edit_act'] = "Modifier un acte";
+$lang['billing_type'] = "Type de facturation";
+$lang['authorization_type'] = "Type d'autorisation";
+$lang['subscriptions_of_the_last_12_months'] = "Souscriptions des 12 derniers mois";
+$lang['subscriptions_historic'] = "Historique des souscriptions";
+$lang['PACKAGE'] = "Forfait";
+$lang['UNIT_PRICE'] = "Prix unitaire";
+$lang['FREE'] = "Libre";
+$lang['PRIOR'] = "Préalable";
?>
diff --git a/application/models/Nano_health_model.php b/application/models/Nano_health_model.php
index e62ac5cc..f9073738 100644
--- a/application/models/Nano_health_model.php
+++ b/application/models/Nano_health_model.php
@@ -12,14 +12,29 @@ class Nano_health_model extends CI_Model
{
public function createConfig($id_network){
- $this->db->query("INSERT INTO nh_networks_configs (network_id) VALUES ($id_network)");
+ $this->db->insert('nh_networks_configs', ['network_id' => $id_network]);
return $this->db->insert_id();
}
- public function getAllInsurances($id_network)
- {
- $query = $this->db->query("SELECT * FROM nh_insurances WHERE network_id = $id_network");
- return $query->num_rows() > 0 ? $query : false ;
+ public function getConfig($id_network){
+ return $this->db->get_where('nh_networks_configs',['network_id'=> $id_network]);
+ }
+
+ public function updateConfig($configId, $data){
+ $this->db->where('id', $configId);
+ return $this->db->update('nh_networks_configs', $data);
+ }
+
+ public function getConfigYearsPricesGrid($configId){
+ return $this->db->get_where('nh_years_prices_grid',['nh_network_config_id'=> $configId]);
+ }
+
+ public function getConfigMonthsPricesGrid($configId){
+ return $this->db->get_where('nh_months_prices_grid',['nh_network_config_id'=> $configId]);
+ }
+
+ public function getConfigActs($configId){
+ return $this->db->get_where('nh_acts',['nh_network_config_id'=> $configId]);
}
// Nano sante
diff --git a/application/models/User_model.php b/application/models/User_model.php
index 7e28b652..e527a80c 100755
--- a/application/models/User_model.php
+++ b/application/models/User_model.php
@@ -1876,11 +1876,7 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT *
FROM infos_transaction
WHERE deleted = 1 AND `network_id`=".$id_network.$chain);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function getTransactionsSup($debut , $fin , $codeMembre){
@@ -2649,4 +2645,11 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT * FROM agents WHERE id ='".$id_agent."'");
return $query->num_rows()>0 ? $query->first_row() : false;
}
+
+ function getEnumValues($table, $field)
+ {
+ $type = $this->db->query( "SHOW COLUMNS FROM {$table} WHERE Field = '{$field}'" )->row( 0 )->Type;
+ preg_match("/^enum\(\'(.*)\'\)$/", $type, $matches);
+ return explode("','", $matches[1]);
+ }
}
diff --git a/application/models/Wallet_model.php b/application/models/Wallet_model.php
index 43d7670a..fac2811a 100644
--- a/application/models/Wallet_model.php
+++ b/application/models/Wallet_model.php
@@ -65,11 +65,7 @@ class Wallet_model extends CI_Model
$query = $this->db->query("SELECT *
FROM infos_transaction
WHERE `codeParrain`='".$codeMembre."'".$chain);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function getInfosWalletAgentForHyper($id_network){
@@ -111,11 +107,7 @@ class Wallet_model extends CI_Model
INNER JOIN towns ON towns.id=agents.town_id
".$where_clause;
//var_dump($statement);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
/**
@@ -192,11 +184,7 @@ class Wallet_model extends CI_Model
LEFT JOIN publiciteConfig ON countries.id=publiciteConfig.id_country AND publiciteConfig.id_config=2
WHERE towns.status=1
GROUP BY countries.id");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
/**
@@ -229,11 +217,7 @@ class Wallet_model extends CI_Model
WHERE child.category='geolocated' AND dad.category='super' AND dad.code_membre='".$codeSup."'
");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function nameOfCurrentGeolocatedUser_forSuper($geolocatedUser_memberCode){
@@ -251,21 +235,12 @@ class Wallet_model extends CI_Model
$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 , configWallet.enabled 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;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function getConfigWallet($id_network){
- $sql = "SELECT * FROM `configWallet` WHERE id_network = ?";
- $query = $this->db->query($sql , array($id_network));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ $query = $this->db->get_where('configWallet' , ['id_network' => $id_network]);
+ return $query->num_rows() > 0 ? $query : false ;
}
public function verifyConfigWalletInCountry($type, $country_id){
@@ -276,26 +251,38 @@ class Wallet_model extends CI_Model
}
public function addConfigWallet($network_id , $type){
- $sql='SELECT * FROM `configWallet` WHERE id_network = ?' ;
- $existQuery = $this->db->query($sql , array($network_id));
+ $this->db->trans_start();
+ $existQuery = $this->db->get_where('configWallet' , ['id_network' => $network_id]);
if($existQuery->num_rows() > 0){
- $query = $this->db->query("UPDATE `configWallet` SET enabled = 1 AND type = $type WHERE id_network = '".$network_id."'");
+ $this->db->where('id_network', $network_id);
+ $this->db->update('configWallet', ['enabled' => 1 , 'type' => $type]);
+ $query = $nhConfigExist = $this->db->get_where('nh_networks_configs' , ['network_id' => $network_id]);
+ if($nhConfigExist->num_rows() == 0 && $type == 'ilink_sante'){
+ $this->createNanoHealthWalletConfig($network_id);
+ }
+ $this->db->trans_complete();
return $query;
}else{
- $sql='INSERT INTO `configWallet` (`id_network`, `type`) VALUES (?,?);' ;
- $query = $this->db->query($sql , array($network_id, $type));
+ $query = $this->db->insert('configWallet' , ['id_network' => $network_id, 'type' => $type]);
if($query && $type == 'ilink_sante'){
- // Creer la config du nano santé
- $configID = $this->nano_health_model->createConfig($network_id);
- $query = $this->db->query("UPDATE `configWallet` SET nh_network_config_id = $configID WHERE id_network = '".$network_id."'");
+ $this->createNanoHealthWalletConfig($network_id);
}
+ $this->db->trans_complete();
return $query;
}
}
- public function updateConfigWallet($network_id , $taux_client_r , $taux_client_d, $taux_ag_r , $taux_ag_d , $taux_sup_r , $taux_sup_d , $taux_bq_r , $taux_bq_d , $frais_d ){
- $sql= 'UPDATE `configWallet` SET `taux_com_client_retrait` = ?, `taux_com_client_depot` = ?, `taux_com_ag_retrait` = ?, `taux_com_ag_depot` = ?, `taux_com_sup_retrait` = ? , `taux_com_sup_depot` = ?, `part_banque_retrait` = ?, `part_banque_depot` = ?, `frais_min_banque_depot` = ? WHERE (`id_network` = ?);';
- $query = $this->db->query($sql , array($taux_client_r,$taux_client_d,$taux_ag_r,$taux_ag_d,$taux_sup_r,$taux_sup_d, $taux_bq_r , $taux_bq_d , $frais_d , $network_id));
+ private function createNanoHealthWalletConfig($network_id){
+ // Creer la config du nano santé
+ $configID = $this->nano_health_model->createConfig($network_id);
+ $this->db->where('id_network', $network_id);
+ $this->db->update('configWallet', ['nh_network_config_id' => $configID]);
+ }
+
+ public function updateConfigWallet($config_id , $taux_client_r , $taux_client_d, $taux_ag_r , $taux_ag_d , $taux_sup_r , $taux_sup_d , $taux_bq_r , $taux_bq_d , $frais_d ){
+ $sql= 'UPDATE `configWallet` SET `taux_com_client_retrait` = ?, `taux_com_client_depot` = ?, `taux_com_ag_retrait` = ?, `taux_com_ag_depot` = ?,
+ `taux_com_sup_retrait` = ? , `taux_com_sup_depot` = ?, `part_banque_retrait` = ?, `part_banque_depot` = ?, `frais_min_banque_depot` = ? WHERE (`id` = ?);';
+ $query = $this->db->query($sql , array($taux_client_r,$taux_client_d,$taux_ag_r,$taux_ag_d,$taux_sup_r,$taux_sup_d, $taux_bq_r , $taux_bq_d , $frais_d , $config_id));
return $query;
}
@@ -310,70 +297,39 @@ class Wallet_model extends CI_Model
}
public function getWallet($id_agent){
- $sql = "SELECT * FROM `wallet_agent` WHERE agent_id = ?";
- $query = $this->db->query($sql , array($id_agent));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ $query = $this->db->get_where('wallet_agent' , ['agent_id' => $id_agent]);
+ return $query->num_rows() > 0 ? $query : false ;
}
public function addWallet($id_agent){
-
- $sql = "SELECT * FROM `networks_agents` WHERE agent_id = ?";
- $query = $this->db->query($sql , array($id_agent));
+ $query = $this->db->get_where('networks_agents' , ['agent_id' => $id_agent]);
if($query->num_rows()>0){
$id_networkAgent = $query->first_row()->id;
- $sql = "INSERT INTO `wallets` (`id_networkAgent`) VALUES (?);";
- $query = $this->db->query($sql , array($id_networkAgent));
+ $query = $this->db->insert('wallets' , ['id_networkAgent' => $id_networkAgent]);
return $query;
}else{
return false;
}
-
}
public function getAgentTransactions($id_wallet){
- $query = $this->db->query("SELECT *
- FROM wallet_transaction
- WHERE `id_wallet`= '".$id_wallet."'");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ $query = $this->db->get_where('wallet_transaction' , ['id_wallet' => $id_wallet]);
+ return $query->num_rows() > 0 ? $query : false ;
}
public function getAgentiLinkTransactions($id_wallet){
- $query = $this->db->query("SELECT *
- FROM infos_ilink_transaction
- WHERE `id_wallet_ag`= '".$id_wallet."'");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ $query = $this->db->get_where('infos_ilink_transaction' , ['id_wallet_ag' => $id_wallet]);
+ return $query->num_rows() > 0 ? $query : false ;
}
public function getNetworkHyper($id_network){
- $sql = "SELECT * FROM `hyper_infos` WHERE network_id = ?";
- $query = $this->db->query($sql , array($id_network));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ $query = $this->db->get_where('hyper_infos' , ['network_id' => $id_network]);
+ return $query->num_rows() > 0 ? $query : false ;
}
public function getAllAgentsForNetwork($id_network){
- $sql = "SELECT * FROM super_infos WHERE network_id = ?";
- $query = $this->db->query($sql , array($id_network));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ $query = $this->db->get_where('hyper_infos' , ['network_id' => $id_network]);
+ return $query->num_rows() > 0 ? $query : false ;
}
public function reinitializeWallet($id_wallet){
@@ -387,11 +343,7 @@ class Wallet_model extends CI_Model
$query = $this->db->query("SELECT n.id AS id_network , n.name AS network,n.status AS status,c.name AS country,c.currency_name_fr, c.currency_name_en , c.currency_code, wp.id AS wallet_password FROM networks n
INNER JOIN countries_currencies c ON n.country_id=c.id INNER JOIN configWallet cw ON cw.id_network = n.id
LEFT JOIN walletsPassword wp ON wp.network_id = n.id WHERE status = 1;");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function addWalletPassword($network_id, $encrypted_password, $salt, $email)
@@ -424,11 +376,7 @@ class Wallet_model extends CI_Model
$query = $this->db->query("SELECT *
FROM infos_recharges
WHERE `network_id`=".$id_network.$chain);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function addWalletRecharge($montant,$wallet_id , $id_network){
@@ -492,11 +440,7 @@ class Wallet_model extends CI_Model
{
$sql = "SELECT * FROM `paliersConfigWallet` WHERE (`id` = ?);";
$query = $this->db->query($sql, array($id));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function deletePalierConfigWallet($type, $idConfig)
@@ -565,11 +509,7 @@ class Wallet_model extends CI_Model
)
) AND code <> ? ;";
$query = $this->db->query($sql, array($code));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
//Liste des monnaies pour les pays dont un wallet est actif
@@ -580,11 +520,7 @@ class Wallet_model extends CI_Model
)
) AND code <> ? ;";
$query = $this->db->query($sql, array($code));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function insertExchangeRate($currency ,$rate){
@@ -596,11 +532,7 @@ class Wallet_model extends CI_Model
public function getExchangeRate($currency){
$sql = "SELECT * FROM `exchange_rate` WHERE `target_currency` = ?;";
$query = $this->db->query($sql , array($currency));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function updateExchangeRate($currency,$rate){
@@ -615,11 +547,7 @@ class Wallet_model extends CI_Model
SELECT distinct c.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 WHERE status = 1
);";
$query = $this->db->query($sql);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function getActiveCountries(){
@@ -627,21 +555,13 @@ class Wallet_model extends CI_Model
SELECT distinct n.country_id FROM networks n WHERE n.status = 1
);";
$query = $this->db->query($sql);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function getCountry($id){
$sql= "SELECT name FROM countries WHERE id = $id";
$query = $this->db->query($sql);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function cancelCreditRequest($id_demand){
@@ -684,11 +604,7 @@ class Wallet_model extends CI_Model
public function getSimulateur($code){
$sql = "SELECT * FROM `simulateur` WHERE `code` = ?;";
$query = $this->db->query($sql , array($code));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function setSharingRate($network_id,$config_id,$rate, $url){
@@ -707,21 +623,13 @@ class Wallet_model extends CI_Model
public function getSharingRate($id_network ,$idConfig){
$sql = "SELECT taux_partage , url FROM `paying_networks` WHERE `id_network` = ? AND id_configWallet = ? ;";
$query = $this->db->query($sql , array($id_network,$idConfig));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function getSharingRateByNetwork($id_network){
$sql = "SELECT balance_com FROM `paying_networks` WHERE `id_network` = ? ;";
$query = $this->db->query($sql , array($id_network));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function countPayingNetworks($id_country ,$idConfig){
@@ -729,21 +637,13 @@ class Wallet_model extends CI_Model
networks n ON n.country_id = c.id WHERE n.status = 1 AND c.id = ?
) AND id_configWallet = ? ;";
$query = $this->db->query($sql , array($id_country, $idConfig));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function getActiveNetworksByCountry($country_id , $network_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 networks.id <> $network_id AND countries.id = $country_id");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function getPayingNetworksByConfigWallet($id_config)
@@ -761,11 +661,7 @@ class Wallet_model extends CI_Model
$query = $this->db->query("SELECT *
FROM infos_ilink_transaction
WHERE `network_emetteur`= '".$id_network."'");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function getCurrency($id_network){
@@ -783,11 +679,7 @@ class Wallet_model extends CI_Model
$query = $this->db->query("SELECT *
FROM infos_transferts_commission
WHERE `codeParrain`='".$codeMembre."'".$chain);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function getCommissionTransfersByNetwork($debut , $fin , $id_network){
@@ -795,11 +687,7 @@ class Wallet_model extends CI_Model
$query = $this->db->query("SELECT *
FROM infos_transferts_commission
WHERE `network_id`='".$id_network."'".$chain);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function getIlinkTransactionsSup($debut , $fin , $codeMembre){
@@ -807,11 +695,7 @@ class Wallet_model extends CI_Model
$query = $this->db->query("SELECT *
FROM infos_ilink_transaction
WHERE `code_parrain`='".$codeMembre."'".$chain);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return $query->num_rows() > 0 ? $query : false ;
}
public function getInfosWalletAgentForSuper($codeMembre)
diff --git a/application/views/admin_dash.php b/application/views/admin_dash.php
index 5f77a774..2a2f06cd 100755
--- a/application/views/admin_dash.php
+++ b/application/views/admin_dash.php
@@ -1,509 +1,462 @@
-
-
-
-
-
-
-db->query("SELECT user_id FROM user_infos
- WHERE country_id='".$this->session->userdata('current_pays')."' AND MONTH(date_created) = '".$months[$i-1]."' AND YEAR(date_created) = '".$years[$i-1]."' AND network_id IN (SELECT network_id
- FROM hyper_infos
- WHERE country_id ='".$this->session->userdata('current_pays')."'
- AND code_membre ='".$this->session->userdata('current_hyper')."'
- GROUP BY network_id)");
- $users_simple_data[] = $users_simple_query_mounth->num_rows();
- }
-
-
- $users_simple_query = $list_simple_users;
-
- if($users_simple_query!=false){
- $users_simple=$users_simple_query->num_rows();
- // Count networks for simple users
- $array_simple = array();
- $num = 0;
- if ($users_simple > 0) {
- foreach($users_simple_query->result() as $row) {
- $num++;
- $array_simple[] = $row->network;
- }
-
- $vals_simple = array_count_values($array_simple);
- //echo 'No. of NON Duplicate Items: '.count($vals_simple).'
';
- //print_r($vals_simple);
- $pieChart2 = array();
- foreach(array_keys($vals_simple) as $paramName2) {
- $color2 = dechex(rand(0x000000, 0xFFFFFF));
- $trash2 = array("value" => $vals_simple[$paramName2],
- "color" => "#".$color2,
- "highlight" => "#".$color2,
- "label" => $paramName2);
-
- $pieChart2[]= $trash2;
-
- }
- }
- }else{
- $pieChart2 = array();
- }
-
- /**
- ** Geolocated User Treatment
- **/
- $users_geolocated_query = $list_geolocated_users;
-
- // Geolocated Users by month replace 2016 by NOW()
- $users_geolocated_data[] = '';
- $users_geolocated_data =array();
- for ($i = 1; $i <= 12; $i++) {
- $users_geolocated_query_january = $this->db->query("SELECT agent_id FROM super_infos
- WHERE category='geolocated' AND MONTH(date_created) = '".$months[$i-1]."' AND YEAR(date_created) = ".$years[$i-1]."
- AND code_parrain IN (SELECT code_membre FROM super_infos WHERE category='super' AND code_parrain='".$this->session->userdata('current_hyper')."')");
- $users_geolocated_data[] = $users_geolocated_query_january->num_rows();
- }
-
- if($users_geolocated_query!=false){
- $users_geolocated=$users_geolocated_query->num_rows();
- //$users_geolocated_query = json_encode($users_geolocated_query->result());
- // Counts network for geolocated users
- $array_geolocated = array();
- $num = 0;
- if ($users_geolocated > 0) {
- foreach($users_geolocated_query->result() as $row) {
- $num++;
- $array_geolocated[] = $row->network;
- }
- $vals_geolocated = array_count_values($array_geolocated);
- //echo 'No. of NON Duplicate Items: '.count($vals_geolocated).'
';
- //print_r($vals_geolocated);
- $pieChart = array();
- foreach(array_keys($vals_geolocated) as $paramName) {
- $color = dechex(rand(0x000000, 0xFFFFFF));
- $trash = array("value" => $vals_geolocated[$paramName],
- "color" => "#".$color,
- "highlight" => "#".$color,
- "label" => $paramName);
-
- $pieChart[]= $trash;
- }
- }
- }else{
- $pieChart = array();
- }
-?>
-
-
lang->line('Utilisateurs simples'); ?>
-lang->line('Utilisateurs géolocalisés'); ?>
-lang->line('Codes validés'); ?>
-lang->line('Codes générés'); ?>
-lang->line('Utilisateurs simples'); ?>
+lang->line('Utilisateurs géolocalisés'); ?>
+lang->line('Codes validés'); ?>
+lang->line('Codes générés'); ?>
+Hypervisors
-Geolocated members
-Validated codes
-Generated codes
-Hypervisors
+Geolocated members
+Validated codes
+Generated codes
+