diff --git a/application/config/constants.php b/application/config/constants.php index bbac5ac2..4c54c511 100755 --- a/application/config/constants.php +++ b/application/config/constants.php @@ -93,4 +93,5 @@ define('WALLET_SERVICE_EXTERNE_URL','https://ilink-app.com:8085'); define('WALLET_SERVICE_EXTERNE_TOKEN','JeJMx6KNW1qo2h01rCVOLfX3f1nmcF2I'); define('NOTIFICATION_SERVICE_URL','https://ilink-app.com:8083'); define('NOTIFICATION_SERVICE_TOKEN','RfXvPQzQRgwpzQYPnLfWpZzgx4QseHlg'); - +define('NANO_SANTE_SERVICE_URL','https://ilink-app.com:8086'); +define('NANO_SANTE_SERVICE_TOKEN','eStSQIoAfnTJ9nkCs0IJkJiKACxYVcQm'); diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index 8fbc707f..4171d8ab 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -359,10 +359,33 @@ class Hyperviseur_dash extends CI_Controller if ($this->isLogged()) { $id_network = $this->session->userdata('network_id'); $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); + + $res = $this->wallet_model->getWalletPassword($id_network); + $data['walletPassword'] = $res ? $res->first_row() : null; + $data['alert'] = ""; + $data['active'] = "wallet_wallet"; + $data['code_parrain'] = $this->session->userdata('code_parrain'); + $data['category'] = $this->session->userdata('category'); + $data['network'] = $this->session->userdata('network'); + $data['network_id'] = $id_network; + $data['country'] = $this->session->userdata('current_pays'); + $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); + if ($data['hasWallet']) { if ($this->input->get('history')) { - $this->historique($id_network, $this->input->get('d'), $this->input->get('f'), $this->input->get('history'), $this->input->get('parrainId')); + if($this->input->get('id') !== null){ + $data['insurance_subscription_id'] = $this->input->get('id'); + $data['subscription'] = $this->nano_health_model->getInfosInsuranceSubscriptionById($this->input->get('id')); + $data['beneficiaries'] = $this->db->get_where('nh_insurances_having_rights',['insurance_subscription_id' => $data['insurance_subscription_id']]); + $data['user'] = $this->db->get_where('user_infos',['user_id' => $data['subscription']->user_id ?? null])->first_row(); + $this->load->view('header_hyp', $data); + $this->load->view('nano_health/hyper/infos_insurance_subscription'); + $this->load->view('footer'); + return; + }else{ + $this->historique($id_network, $this->input->get('d'), $this->input->get('f'), $this->input->get('history'), $this->input->get('parrainId')); + } } elseif ($this->input->get('config')) { $this->config_wallet($this->input->get('config'), $this->input->get('country')); } elseif ($this->input->get('show')) { @@ -456,18 +479,6 @@ class Hyperviseur_dash extends CI_Controller $data['wallet_id'] = $row->wallet_id; $data['curreny_code'] = $this->session->userdata('currency_code'); - - $res = $this->wallet_model->getWalletPassword($id_network); - $data['walletPassword'] = $res ? $res->first_row() : null; - $data['alert'] = ""; - $data['active'] = "wallet_wallet"; - $data['code_parrain'] = $this->session->userdata('code_parrain'); - $data['category'] = $this->session->userdata('category'); - $data['network'] = $this->session->userdata('network'); - $data['network_id'] = $id_network; - $data['country'] = $this->session->userdata('current_pays'); - $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); - $this->load->view('header_hyp', $data); if ($data['hasWallet']->first_row()->type == 'visa') $this->load->view('gestion_wallet_hyp'); @@ -519,6 +530,9 @@ class Hyperviseur_dash extends CI_Controller $data['refunds'] = $this->wallet_model->getRefunds($startDate, $endDate, $network_id); else if ($type == 'commission_payments') $data['payments'] = $this->wallet_model->getCommissionPayments($startDate, $endDate, $network_id); + else if ($type == 'insurance-subscriptions'){ + + } else{ $data['transactions'] = $this->wallet_model->getRecharges($startDate, $endDate, $network_id); $data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code')); @@ -552,6 +566,8 @@ class Hyperviseur_dash extends CI_Controller $this->load->view('historique_remboursement'); else if ($type == 'commission_payments') $this->load->view('config_wallet_ilink_hyp/historique_commission_payements'); + else if ($type == 'insurance-subscriptions') + $this->load->view('nano_health/hyper/insurances_subscriptions.php'); else $this->load->view('historique_recharges'); $this->load->view('footer'); @@ -1926,7 +1942,7 @@ class Hyperviseur_dash extends CI_Controller $nh_config = $this->nano_health_model->getConfig($data['network_id']); $data['nh_config'] = $nh_config ? $nh_config->first_row() : null ; $data['config_id'] = $data['nh_config'] ? $data['nh_config']->id : null ; - $data['doctors'] = $this->db->get('nh_validating_doctors'); + $data['doctors'] = $this->db->get_where('nh_validating_doctors',['nh_network_config_id' => $data['config_id']]); $this->load->view('header_hyp', $data); $this->load->view('nano_health/hyper/validating_doctors'); diff --git a/application/controllers/NanoHealthController.php b/application/controllers/NanoHealthController.php index 1b8c3f67..672e74ab 100644 --- a/application/controllers/NanoHealthController.php +++ b/application/controllers/NanoHealthController.php @@ -18,7 +18,9 @@ class NanoHealthController extends CI_Controller $grid = $_POST['grid'] ?? []; $this->db->delete('nh_years_prices_grid',['nh_network_config_id' => $configId]); - $this->db->insert_batch('nh_years_prices_grid',$grid); + if(sizeof($grid) > 0){ + $this->db->insert_batch('nh_years_prices_grid',$grid); + } echo json_encode("200"); } @@ -32,8 +34,9 @@ class NanoHealthController extends CI_Controller $grid = $_POST['grid'] ?? []; $this->db->delete('nh_months_prices_grid',['nh_network_config_id' => $configId]); - $this->db->insert_batch('nh_months_prices_grid',$grid); - + if(sizeof($grid) > 0){ + $this->db->insert_batch('nh_months_prices_grid',$grid); + } echo json_encode("200"); } } diff --git a/application/controllers/pagination/InsuranceSubscription.php b/application/controllers/pagination/InsuranceSubscription.php new file mode 100755 index 00000000..af2bc35e --- /dev/null +++ b/application/controllers/pagination/InsuranceSubscription.php @@ -0,0 +1,79 @@ +load->model('pagination/InsuranceSubscription_model', 'model'); + + // 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 + $this->converter = new CurrencyConverter($provider); + $this->context = new AutoContext(); + + } + + + function getLists() + { + $data = $row = array(); + + // Fetch member's records + $witData = $this->model->getRows($_POST); + + $i = $_POST['start']; + $current_url = $_POST['currentURL']; + foreach ($witData as $row) { + $i++; + + $bonus_amount = Money::of(round($row->total_bonus_amount, 2), $row->currency_code, $this->context)->formatTo('fr_FR'); + + $data[] = array($i,$row->insurance_subscription_id, $row->lastname, $row->phone, $row->number_of_months, $row->number_of_beneficiaries, + $bonus_amount, strtoupper($this->lang->line($row->state)), $row->created_at, + ' '.$this->lang->line('Voir plus...').''); + } + + $output = array( + "draw" => $_POST['draw'], + "recordsTotal" => $this->model->countAll($_POST), + "recordsFiltered" => $this->model->countFiltered($_POST), + "data" => $data, + ); + + // Output to JSON format + echo json_encode($output); + } + +} diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index 75e866ab..4ab5eb84 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -665,7 +665,7 @@ $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_of_the_last_12_months'] = "Subscriptions and care requests of the last 12 months"; $lang['subscriptions_historic'] = "Subscription history"; $lang['PACKAGE'] = "Package"; $lang['UNIT_PRICE'] = "Unit price"; @@ -693,4 +693,25 @@ $lang['add_provider_class'] = "Add a provider class"; $lang['edit_provider_class'] = "Edit a class"; $lang['delete_provider_class'] = "Delete a provider class"; $lang['provider_class_deleted'] = "Deleted provider class"; +$lang['first_rule_months_price_grid'] = "The minimum amount must not exceed the coverage limit per year"; +$lang['subscriptions_history'] = "Subscription history"; +$lang['bonus_amount'] = "Bonus amount"; +$lang['number_of_beneficiaries'] = "Number of beneficiaries"; +$lang['age_limit_of_insured_and_spouse'] = "Age limit of the insured and spouse"; +$lang['age_limit_rule'] = "The age limit of the insured and spouse must be strictly greater than the age limit of the child beneficiary"; +$lang['insured_infos'] = "Information about the insured"; +$lang['subscriptions'] = "Subscriptions"; +$lang['subscription_detail'] = "Subscription detail"; +$lang['beneficiaries'] = "The beneficiaries"; +$lang['insured_bonus_amount'] = "Insured_bonus amount"; +$lang['gender'] = "Gender"; +$lang['show'] = "Show"; +$lang['accept'] = "Accept"; +$lang['reject'] = "Reject"; +$lang['UNDER_VALIDATION'] = "Under validation"; +$lang['CHILD'] = "CHILD"; +$lang['SPOUSE'] = "SPOUSE"; +$lang['care_requests'] = "Care requests"; +$lang['birthdate_proof_doc'] = "Birth certificate"; +$lang['justice_doc'] = "Justice document"; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 0959c10c..88a8e810 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -677,7 +677,7 @@ $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_of_the_last_12_months'] = "Souscriptions et demandes de soins des 12 derniers mois"; $lang['subscriptions_historic'] = "Historique des souscriptions"; $lang['PACKAGE'] = "Forfait"; $lang['UNIT_PRICE'] = "Prix unitaire"; @@ -705,4 +705,25 @@ $lang['add_provider_class'] = "Ajouter une classe de prestataire"; $lang['edit_provider_class'] = "Modifier une classe"; $lang['delete_provider_class'] = "Suppression d'une classe de prestataire"; $lang['provider_class_deleted'] = "Classe de prestataire supprimée"; +$lang['first_rule_months_price_grid'] = "Le montant minimal ne doit pas être supérieur à la limite de couverture par an"; +$lang['subscriptions_history'] = "Historique des souscriptions"; +$lang['bonus_amount'] = "Montant de la prime"; +$lang['number_of_beneficiaries'] = "Nombre d’ayants droit"; +$lang['age_limit_of_insured_and_spouse'] = "Age limite de l'assuré et du conjoint"; +$lang['age_limit_rule'] = "L'age limite de l'assuré et du conjoint doit être strictetement supérieur à l'age limite de l’ayant droit enfant"; +$lang['insured_infos'] = "Informations sur l'assuré"; +$lang['subscriptions'] = "Souscriptions"; +$lang['subscription_detail'] = "Detail de la souscription"; +$lang['beneficiaries'] = "Les ayants droits ou benéficiaires"; +$lang['insured_bonus_amount'] = "Montant de la prime d'assuré"; +$lang['gender'] = "Sexe"; +$lang['show'] = "Afficher"; +$lang['accept'] = "Accepter"; +$lang['reject'] = "Rejeter"; +$lang['UNDER_VALIDATION'] = "En cours de validation"; +$lang['CHILD'] = "ENFANT"; +$lang['SPOUSE'] = "CONJOINT"; +$lang['care_requests'] = "Demandes de soins"; +$lang['birthdate_proof_doc'] = "Acte de naissance"; +$lang['justice_doc'] = "Document de justice"; ?> diff --git a/application/models/Nano_health_model.php b/application/models/Nano_health_model.php index 5d883c09..ccac8606 100644 --- a/application/models/Nano_health_model.php +++ b/application/models/Nano_health_model.php @@ -42,4 +42,8 @@ class Nano_health_model extends CI_Model { return $this->db->get_where('nh_provider_classes',['nh_network_config_id'=> $configId]); } + + public function getInfosInsuranceSubscriptionById($insuranceSubscriptionId){ + return $this->db->get_where('nh_infos_insurances_subscriptions',['insurance_subscription_id'=> $insuranceSubscriptionId])->first_row(); + } } diff --git a/application/models/User_model.php b/application/models/User_model.php index 0a990be1..4d4ed004 100755 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -168,11 +168,7 @@ class User_model extends CI_Model FROM super_infos WHERE category='super' AND code_parrain='".$codeHyp."')"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getVilleByUserGeo($network,$country){ @@ -203,11 +199,7 @@ class User_model extends CI_Model WHERE child.category='geolocated' AND dad.category='super' AND dad.code_parrain='".$codeHyp."' AND child.town='".$ville."' LIMIT 100"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getUsersGeolocatedPositionByVilleForHyp($ville,$codeHyp){ @@ -219,11 +211,7 @@ class User_model extends CI_Model ON child.code_parrain=dad.code_membre WHERE child.category='geolocated' AND dad.category='super' AND dad.code_parrain='".$codeHyp."' AND child.town='".$ville."'"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getDemandes($code_membre){ @@ -242,11 +230,7 @@ class User_model extends CI_Model ORDER BY dateAjout"); } - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } @@ -318,11 +302,7 @@ class User_model extends CI_Model WHERE d.code_membre='".$member_code."'".$chain. "ORDER BY date_creation"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } @@ -339,11 +319,7 @@ class User_model extends CI_Model WHERE child.category='super' AND dad.category='hyper' AND dad.code_membre='".$codeHyp."' "); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getUsersGeolocatedForSup($codeSup){ @@ -359,11 +335,7 @@ class User_model extends CI_Model WHERE child.category='geolocated' AND dad.category='super' AND dad.code_membre='".$codeSup."' LIMIT 100 "); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getAllGeolocatedUsersForHyp($codeHyp){ @@ -377,11 +349,7 @@ class User_model extends CI_Model AND code_parrain='".$codeHyp."') "); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getAllDemandesForSuper($member_code){ @@ -798,11 +766,7 @@ class User_model extends CI_Model AND (codeParrain='".$codeHyper."' OR codeParrain IN (SELECT code_membre FROM super_infos WHERE code_parrain='".$codeHyper."' AND category ='super')) ORDER BY dateAjout"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function adminGetTempsMoyen($pays,$codeHyper,$ville){ @@ -835,11 +799,7 @@ class User_model extends CI_Model ORDER BY temps LIMIT 5"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } @@ -855,11 +815,7 @@ class User_model extends CI_Model ORDER BY temps DESC LIMIT 5"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } @@ -874,11 +830,7 @@ class User_model extends CI_Model OR child.code_parrain IN (SELECT code_membre FROM super_infos WHERE code_parrain='".$codeHyper."' AND category ='super') AND child.town_id='".$ville."' "); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getAllSimpleUser($pays,$codeHyper){ @@ -891,22 +843,14 @@ class User_model extends CI_Model AND super_infos.code_parrain ='".$codeHyper."' GROUP BY super_infos.network_id)"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getGeneratedCodes($codeHyper){ $query = $this->db->query("SELECT * FROM codeGenerer WHERE code_parrain='".$codeHyper."' AND code_parrain!=code_membre"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } @@ -914,11 +858,7 @@ class User_model extends CI_Model $query = $this->db->query("SELECT * FROM codeGenerer WHERE category='hyper'"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } @@ -928,11 +868,7 @@ class User_model extends CI_Model FROM info_demandesAdhesion WHERE code_membre='".$codeHyp."'"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getCodesByHyperviseur($codeHyp){ @@ -944,11 +880,7 @@ class User_model extends CI_Model WHERE category='super' AND code_parrain='".$codeHyp."') "); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getCoutForAdmin($pays,$hyper,$ville,$type){ @@ -1011,11 +943,7 @@ class User_model extends CI_Model AND child.latitude!=-1 AND child.longitude!=-1 ORDER BY child.agent_id DESC LIMIT 100"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getCoutGeolocatedUsersForAdmin($pays,$hyper,$ville){ @@ -1103,11 +1031,7 @@ class User_model extends CI_Model AND child.category='geolocated' "); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getUsersSimpleForSup($network,$member_code){ @@ -1120,30 +1044,18 @@ class User_model extends CI_Model AND users.member_code='".$member_code."' AND users.network='".$network."') "); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getAllVilles(){ $query = $this->db->query("SELECT towns.id, towns.name, towns.status ,c.name AS country,c.id AS country_id FROM towns INNER JOIN countries c on towns.country_id = c.id"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getAllPays(){ $query = $this->db->query("SELECT * FROM countries ORDER BY name"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function changeVilleStatut($id_ville,$new_statut){ @@ -1160,20 +1072,12 @@ class User_model extends CI_Model public function getAllNetworksNames(){ $query = $this->db->query("SELECT * FROM networks WHERE country_id IS NULL ORDER BY name"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getAllAssignedNetworks(){ $query = $this->db->query("SELECT networks.name AS network,networks.status AS status,networks.id,countries.name AS country,networks.country_id FROM `networks` INNER JOIN countries ON networks.country_id=countries.id"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function assignCountryToNetwork($name,$id_country){ @@ -1198,11 +1102,7 @@ class User_model extends CI_Model public function getAllAdmin(){ $query = $this->db->query("SELECT firstname,lastname,admin.id AS id_admin,email,phone,adresse,admin.country AS country_id,admin.category,admin.salt,c.name AS country FROM admin INNER JOIN countries c on admin.country = c.id"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function isEmailExist($email) { @@ -1289,19 +1189,11 @@ class User_model extends CI_Model public function getIdCodeGenerer($code_membre){ $query = $this->db->query("SELECT id FROM codeGenerer WHERE code_parrain='".$code_membre."' OR code_parrain IN (SELECT code_membre FROM codeGenerer where code_parrain='".$code_membre."')"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getGabonNetwork(){ $query = $this->db->query("SELECT id,name FROM networks WHERE country_id='78'"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getCodeHyper($id_network){ $query = $this->db->query("SELECT codeGenerer_id FROM networks_agents WHERE network_id='".$id_network."'"); @@ -1320,11 +1212,7 @@ class User_model extends CI_Model public function getVillesByPays($pays_id){ $query = $this->db->query("SELECT towns.id, towns.name, towns.status FROM towns WHERE towns.country_id='".$pays_id."'"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getAgentsFromCountry($id_country){ @@ -1332,11 +1220,7 @@ class User_model extends CI_Model FROM super_infos AS ag WHERE ag.country_id='".$id_country."' AND category='super' GROUP BY lastname"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getPointGeolocalised($id_network,$lastname){ @@ -1391,11 +1275,7 @@ class User_model extends CI_Model public function getNetworks($country_id){ $query = $this->db->query("SELECT id,name FROM networks WHERE country_id ='".$country_id."'"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getActiveNetworks($country_id){ @@ -1420,11 +1300,7 @@ class User_model extends CI_Model AND child.town_id='".$ville."' LIMIT ".$start.",".$limit); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function get_current_page_records_hyper($limit, $start,$hyper,$ville) @@ -1443,11 +1319,7 @@ class User_model extends CI_Model AND child.town='".$ville."' LIMIT ".$start.",".$limit); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function get_current_page_records_super($limit, $start,$super) @@ -1464,11 +1336,7 @@ class User_model extends CI_Model AND child.code_parrain='".$super."' LIMIT ".$start.",".$limit); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function get_total($pays,$hyper,$ville) @@ -1497,29 +1365,17 @@ class User_model extends CI_Model AND child.latitude!=-1 AND child.longitude!=-1 LIMIT ".$start.",".$limit); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getAllNetworksInfos($country_id){ $query = $this->db->query("SELECT * FROM networks WHERE country_id ='".$country_id."'"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getCountries(){ $query = $this->db->query("SELECT countries.id,countries.name,countries.code_country,countries.code_dial,towns.name AS ville,towns.id AS id_ville FROM `towns` INNER JOIN countries ON towns.country_id=countries.id GROUP BY countries.id "); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getFreeCode(){ @@ -1551,11 +1407,7 @@ class User_model extends CI_Model public function getInfosActivationHyperviseur(){ $query = $this->db->query("SELECT networks_agents.phone, networks_agents.validation_code, agents.number_super,agents.number_geoBysuper FROM `agents` INNER JOIN networks_agents ON networks_agents.agent_id=agents.id INNER JOIN codeGenerer ON codeGenerer.id=networks_agents.codeGenerer_id WHERE codeGenerer.category='hyper' AND agents.number_geoBysuper IS NULL AND agents.number_super IS NULL "); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function getCodeMembreHyper($network_id){ @@ -1719,11 +1571,7 @@ class User_model extends CI_Model WHERE child.country_id='".$pays."' ORDER BY child.agent_id DESC "); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function checkCountryGameExist($pays){ @@ -1750,11 +1598,7 @@ class User_model extends CI_Model public function getPaliers(){ $query = $this->db->query("SELECT * FROM paliers"); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } public function modifPalier($value,$niveau){ $query = $this->db->query("UPDATE paliers SET valeur = ".$value." WHERE id =".$niveau); @@ -1839,11 +1683,7 @@ class User_model extends CI_Model $query = $this->db->query("SELECT * FROM infos_transaction 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 getDeletedTransactions($debut , $fin , $id_network){ @@ -1866,11 +1706,7 @@ class User_model extends CI_Model $query = $this->db->query("SELECT * FROM wallet_agent WHERE `network_id`=".$id_network); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } /** diff --git a/application/models/Wallet_model.php b/application/models/Wallet_model.php index fac2811a..0175fc96 100644 --- a/application/models/Wallet_model.php +++ b/application/models/Wallet_model.php @@ -53,11 +53,7 @@ class Wallet_model extends CI_Model $query = $this->db->query("SELECT * FROM infos_transaction 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 getTransactionsSup($debut , $fin , $codeMembre){ @@ -72,11 +68,7 @@ class Wallet_model extends CI_Model $query = $this->db->query("SELECT * FROM wallet_agent WHERE `network_id`=".$id_network); - if($query->num_rows()>0){ - return $query; - }else{ - return false; - } + return $query->num_rows() > 0 ? $query : false; } /** diff --git a/application/models/pagination/InsuranceSubscription_model.php b/application/models/pagination/InsuranceSubscription_model.php new file mode 100644 index 00000000..0c4dd087 --- /dev/null +++ b/application/models/pagination/InsuranceSubscription_model.php @@ -0,0 +1,97 @@ +table = 'nh_infos_insurances_subscriptions'; + // Set orderable column fields + $this->column_order = array(null, 'insurance_subscription_id', 'lastname', 'phone', 'number_of_months', 'number_of_beneficiaries', 'bonus_amount', 'state','created_at', null); + // Set searchable column fields + $this->column_search = array('insurance_subscription_id', 'lastname', 'phone', 'number_of_months', 'number_of_beneficiaries', 'bonus_amount', 'state','created_at'); + // Set default order + $this->order = array('created_at' => 'desc'); + } + + /* + * Fetch members data from the database + * @param $_POST filter data based on the posted parameters + */ + public function getRows($postData) + { + $this->_get_datatables_query($postData); + if ($postData['length'] != -1) { + $this->db->limit($postData['length'], $postData['start']); + } + $query = $this->db->get(); + return $query->result(); + } + + /* + * Count all records + */ + public function countAll($postData) + { + $this->db->from($this->table); + $this->db->where('network_id', $postData['id_network']); + return $this->db->count_all_results(); + } + + /* + * Count records based on the filter params + * @param $_POST filter data based on the posted parameters + */ + public function countFiltered($postData) + { + $this->_get_datatables_query($postData); + $query = $this->db->get(); + return $query->num_rows(); + } + + /* + * Perform the SQL queries needed for an server-side processing requested + * @param $_POST filter data based on the posted parameters + */ + private function _get_datatables_query($postData) + { + + $this->db->from($this->table); + $this->db->where('network_id', $postData['id_network']); + if (strlen($postData['startDate']) > 0 && strlen($postData['endDate']) > 0) { + $this->db->where('created_at >=', date('Y-m-d', strtotime($postData['startDate']))); + $this->db->where('created_at <', date('Y-m-d', strtotime($postData['endDate']. "+1 day"))); + } + + $i = 0; + // loop searchable columns + foreach ($this->column_search as $item) { + // if datatable send POST for search + if ($postData['search']['value']) { + // first loop + if ($i === 0) { + // open bracket + $this->db->group_start(); + $this->db->like($item, $postData['search']['value']); + } else { + $this->db->or_like($item, $postData['search']['value']); + } + + // last loop + if (count($this->column_search) - 1 == $i) { + // close bracket + $this->db->group_end(); + } + } + $i++; + } + + if (isset($postData['order'])) { + $this->db->order_by($this->column_order[$postData['order']['0']['column']], $postData['order']['0']['dir']); + } else if (isset($this->order)) { + $order = $this->order; + $this->db->order_by(key($order), $order[key($order)]); + } + } +} diff --git a/application/views/config_wallet_ilink_hyp/agent_send_cash_canal.php b/application/views/config_wallet_ilink_hyp/agent_send_cash_canal.php index 38bdcd09..7f165ab5 100755 --- a/application/views/config_wallet_ilink_hyp/agent_send_cash_canal.php +++ b/application/views/config_wallet_ilink_hyp/agent_send_cash_canal.php @@ -8,106 +8,7 @@ - + - + - + = 0) { + $.fn.dataTable.ext.buttons.copyHtml5.action.call(self, e, dt, button, config); + } else if (button[0].className.indexOf('buttons-excel') >= 0) { + $.fn.dataTable.ext.buttons.excelHtml5.available(dt, config) ? + $.fn.dataTable.ext.buttons.excelHtml5.action.call(self, e, dt, button, config) : + $.fn.dataTable.ext.buttons.excelFlash.action.call(self, e, dt, button, config); + } else if (button[0].className.indexOf('buttons-csv') >= 0) { + $.fn.dataTable.ext.buttons.csvHtml5.available(dt, config) ? + $.fn.dataTable.ext.buttons.csvHtml5.action.call(self, e, dt, button, config) : + $.fn.dataTable.ext.buttons.csvFlash.action.call(self, e, dt, button, config); + } else if (button[0].className.indexOf('buttons-pdf') >= 0) { + $.fn.dataTable.ext.buttons.pdfHtml5.available(dt, config) ? + $.fn.dataTable.ext.buttons.pdfHtml5.action.call(self, e, dt, button, config) : + $.fn.dataTable.ext.buttons.pdfFlash.action.call(self, e, dt, button, config); + } else if (button[0].className.indexOf('buttons-print') >= 0) { + $.fn.dataTable.ext.buttons.print.action(e, dt, button, config); + } + dt.one('preXhr', function (e, s, data) { + // DataTables thinks the first item displayed is index 0, but we're not drawing that. + // Set the property to what it was before exporting. + settings._iDisplayStart = oldStart; + data.start = oldStart; + }); + // Reload the grid with the original page. Otherwise, API functions like table.cell(this) don't work properly. + setTimeout(dt.ajax.reload, 0); + // Prevent rendering of the full data to the DOM + return false; + }); + }); + // Requery the server with the new one-time export settings + dt.ajax.reload(); + } diff --git a/application/views/gestion_recherche.php b/application/views/gestion_recherche.php index d7ec95f4..06f539a7 100755 --- a/application/views/gestion_recherche.php +++ b/application/views/gestion_recherche.php @@ -470,7 +470,7 @@
- user_image
@@ -479,13 +479,13 @@
- document_front
- document_back
@@ -674,7 +674,7 @@
- user_image
@@ -683,13 +683,13 @@
- document_front
- document_back
diff --git a/application/views/nano_health/admin/gestion_wallet.php b/application/views/nano_health/admin/gestion_wallet.php index 689ee639..d616f94a 100755 --- a/application/views/nano_health/admin/gestion_wallet.php +++ b/application/views/nano_health/admin/gestion_wallet.php @@ -11,60 +11,16 @@ use Brick\Money\Money; $context = new \Brick\Money\Context\AutoContext(); -$month = time(); -$months[] = convertDate(date("M")); -$label_months [] = date("M") . " " . date("Y"); -$years[] = date("Y"); -for ($i = 1; $i <= 11; $i++) { - $month = strtotime('last month', $month); - $months [] = convertDate(date("M", $month)); - $years[] = date("Y", $month); - $label_months [] = date("M", $month) . " " . date("Y", $month); -} - -/** - ** Retraits - **/ -$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_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'"); +//$month = time(); +//$months[] = convertDate(date("M")); +//$label_months [] = date("M") . " " . date("Y"); +//$years[] = date("Y"); +//for ($i = 1; $i <= 11; $i++) { +// $month = strtotime('last month', $month); +// $months [] = convertDate(date("M", $month)); +// $years[] = date("Y", $month); +// $label_months [] = date("M", $month) . " " . date("Y", $month); +//} //if ($transactions != false) { // $transac = $transactions->num_rows(); diff --git a/application/views/nano_health/hyper/gestion_wallet.php b/application/views/nano_health/hyper/gestion_wallet.php index 3a241c52..93c21fa1 100755 --- a/application/views/nano_health/hyper/gestion_wallet.php +++ b/application/views/nano_health/hyper/gestion_wallet.php @@ -10,16 +10,30 @@ use Brick\Money\Money; $context = new \Brick\Money\Context\AutoContext(); -//$month = time(); -//$months[] = convertDate(date("M")); -//$label_months [] = date("M") . " " . date("Y"); -//$years[] = date("Y"); -//for ($i = 1; $i <= 11; $i++) { -// $month = strtotime('last month', $month); -// $months [] = convertDate(date("M", $month)); -// $years[] = date("Y", $month); -// $label_months [] = date("M", $month) . " " . date("Y", $month); -//} +$month = time(); +$months[] = convertDate(date("M")); +$label_months [] = date("M") . " " . date("Y"); +$years[] = date("Y"); +for ($i = 1; $i <= 11; $i++) { + $month = strtotime('last month', $month); + $months [] = convertDate(date("M", $month)); + $years[] = date("Y", $month); + $label_months [] = date("M", $month) . " " . date("Y", $month); +} + +/** + ** Liste des souscriptions + **/ +$date = date("Y"); +$insuranceSubcriptions =array(); +for ($i = 1; $i <= 12; $i++) { + $monthQuery = $this->db->query("SELECT id FROM nh_insurances_subscriptions + WHERE MONTH(created_at) = '".$months[$i-1]."' AND YEAR(created_at) = '".$years[$i-1]."' + AND network_id ='".$this->session->userdata('network_id')."'"); + array_push($insuranceSubcriptions, $monthQuery->num_rows()); +} + +$careRequests = []; //if ($transactions != false) { // $transac = $transactions->num_rows(); @@ -129,6 +143,17 @@ $context = new \Brick\Money\Context\AutoContext();
+
+
+

coverage_limit_per_insured_per_year ?? 0, 2), $curreny_code, $context)->formatTo('fr_FR'); ?>

+

lang->line('coverage_limit_per_insured_per_year') ?>

+
+
+ +
+
+
+

max_number_of_beneficiaries ?? ''; ?>

@@ -139,8 +164,18 @@ $context = new \Brick\Money\Context\AutoContext();
- -
+
+
+
+

age_limit_of_insured_and_spouse ?? ''; ?>

+

lang->line('age_limit_of_insured_and_spouse') ?>

+
+
+ +
+
+
+

age_limit_of_child_beneficiary ?? ''; ?>

@@ -151,17 +186,6 @@ $context = new \Brick\Money\Context\AutoContext();
-
-
-
-

coverage_limit_per_insured_per_year ?? 0, 2), $curreny_code, $context)->formatTo('fr_FR'); ?>

-

lang->line('coverage_limit_per_insured_per_year') ?>

-
-
- -
-
-
@@ -311,7 +335,7 @@ $context = new \Brick\Money\Context\AutoContext();

lang->line('subscriptions_of_the_last_12_months'); ?>

@@ -426,7 +450,7 @@ $context = new \Brick\Money\Context\AutoContext();