From 783001659aa3647c60ed284cfdf17d68e0072833 Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Mon, 24 Jan 2022 09:08:05 +0100 Subject: [PATCH] Implements invoices of health care sheet and add QR code on listadmin table --- application/controllers/Agent.php | 118 ++-------- application/controllers/Hyperviseur_dash.php | 27 +++ .../controllers/NanoHealthController.php | 33 +++ .../pagination/GeolocatedUsers.php | 18 +- .../controllers/pagination/Insurances.php | 4 +- .../controllers/pagination/Invoices.php | 75 +++++++ application/language/english/message_lang.php | 13 +- application/language/french/message_lang.php | 13 +- .../pagination/GeolocatedUsers_model.php | 2 +- .../models/pagination/Invoices_model.php | 109 ++++++++++ application/views/header_agent.php | 13 +- application/views/header_hyp.php | 6 + .../health_care_sheet_consultation_form.php | 78 +++---- ...th_care_sheet_update_consultation_form.php | 77 +++---- .../hyper/infos_health_care_sheet.php | 4 +- .../hyper/insurances_health_care_sheets.php | 36 +++- .../nano_health/hyper/insurances_invoices.php | 204 ++++++++++++++++++ .../views/nano_health/hyper/listeadmin.php | 10 +- 18 files changed, 637 insertions(+), 203 deletions(-) create mode 100755 application/controllers/pagination/Invoices.php create mode 100644 application/models/pagination/Invoices_model.php create mode 100755 application/views/nano_health/hyper/insurances_invoices.php diff --git a/application/controllers/Agent.php b/application/controllers/Agent.php index 6c005fbe..8d13b083 100755 --- a/application/controllers/Agent.php +++ b/application/controllers/Agent.php @@ -33,8 +33,8 @@ class Agent extends CI_Controller $data['show_health_care_sheet_buttons'] = true; if ($this->input->get('history')) { + $history = $this->input->get('history'); if($this->input->get('id') !== null){ - $history = $this->input->get('history'); if($history == 'insurance-health_care_sheets'){ $data['active'] = "health_care_sheets"; $data['health_care_sheet_id'] = $this->input->get('id'); @@ -49,7 +49,7 @@ class Agent extends CI_Controller $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')); + $this->historique($this->input->get('d'), $this->input->get('f'), $this->input->get('history') , $data); } }else if($this->input->get('action')) { @@ -73,17 +73,7 @@ class Agent extends CI_Controller } $this->load->view('footer'); }else{ - $startDate = $this->input->get('d'); - $endDate = $this->input->get('f'); - - $format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d'; - $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")); - - $this->load->view('header_agent', $data); - $this->load->view('nano_health/hyper/insurances_health_care_sheets'); - $this->load->view('footer'); + $this->historique($this->input->get('d'), $this->input->get('f'), 'insurance-health_care_sheets' , $data); } } } @@ -112,110 +102,30 @@ class Agent extends CI_Controller } else { $context = new AutoContext(); //Create wallet if it not exist - $res = $this->wallet_model->getWallet($agent_id); - if ($res == false) { - if ($data['hasWallet']) { - $this->user_model->addWallet($agent_id); - } - } - $res = $this->wallet_model->getWallet($agent_id); - if ($res != null) { - $row = $res->first_row(); - $data["commission"] = Money::of(round($row->balance_com, 2), $this->session->userdata('currency_code'), $context)->formatTo('fr_FR'); - $data["principal"] = Money::of(round($row->balance_princ, 2), $this->session->userdata('currency_code'), $context)->formatTo('fr_FR'); - $agents_g = $this->user_model->getUsersGeolocatedForSup($this->session->userdata('member_code')); - $data['agents_g'] = $agents_g; - - //Fetch all transactions of any geolocated agent of the network - $data["transactions"] = array(); - if ($agents_g) { - foreach ($agents_g->result() as $row) { - $wallet = $this->wallet_model->getWallet($row->agent_id); - if ($wallet) { - if ($data['hasWallet']->first_row()->type == 'visa') { - $transactions = $this->user_model->getAgentTransactions($wallet->first_row()->wallet_id); - } else if ($data['hasWallet']->first_row()->type == 'ilink') { - $transactions = $this->user_model->getAgentiLinkTransactions($wallet->first_row()->wallet_id); - } - if ($transactions) { - foreach ($transactions->result() as $trans) { - $trans->agent_id = $row->agent_id; // Add agent id to transaction - array_push($data['transactions'], $trans); - } - } - } - } - } - } else { - $data["commission"] = "N/A"; - $data["principal"] = "N/A"; - $data["totalCommissionBanque"] = "N/A"; - $data["transactions"] = false; - } - - - $data['currency_code'] = $this->session->userdata('currency_code'); - $data['alert'] = ""; - $data['active'] = "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['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); - $data['pays'] = $this->user_model->getAllGameCountries(); - $data['networks'] = $this->user_model->getActiveNetwork(); - $data['agentWalletInfos'] = $this->user_model->getInfosWalletAgentForHyper($id_network); -// $data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code')); - $this->load->view('header_sup', $data); - if ($data['hasWallet']->first_row()->type == 'visa') - $this->load->view('gestion_wallet_sup'); - elseif ($data['hasWallet']->first_row()->type == 'ilink') - $this->load->view('gestion_wallet_sup_ilink'); - $this->load->view('footer'); } } } - private function historique($network_id, $startDate, $endDate, $codeMembre, $type) + private function historique($startDate, $endDate,$type , $data) { - $data['configWallet'] = $this->wallet_model->getConfigWallet($network_id); + $format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d'; $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->getTransactionsSup($startDate, $endDate, $codeMembre); - else if ($type == 'transaction_ilink') - $data['transactions'] = $this->wallet_model->getIlinkTransactionsSup($startDate, $endDate, $codeMembre); - else if ($type == 'commission_transfer') - $data['transactions'] = $this->wallet_model->getCommissionTransfers($startDate, $endDate, $this->session->userdata('member_code')); - else if ($type == 'balance_statement') - $data['wallets'] = $this->user_model->getInfosWalletAgentForSuper($codeMembre); - $data['active'] = "wallet"; - $data['alert'] = ""; - $data['network'] = $this->session->userdata('network'); - $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); - $data['networks'] = $this->user_model->getActiveNetwork(); -// $data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code')); - $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); - $data['country'] = $this->session->userdata('current_pays'); - $data['category'] = $this->session->userdata('category'); - $data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code')); - $data['id_network'] = $this->session->userdata('network_id'); + if ($type == 'insurance-invoices') + $data['active'] = 'wallet_invoices'; + else if ($type == 'insurance-health_care_sheets') + $data['active'] = 'wallet_health_care_sheets'; - - $this->load->view('header_sup', $data); - if ($type == 'transaction') - $this->load->view('historique_transactions'); - else if ($type == 'transaction_ilink') - $this->load->view('historique_transactions_ilink'); - else if ($type == 'commission_transfer') - $this->load->view('historique_transferts_commission'); - else if ($type == 'balance_statement') - $this->load->view('config_wallet_ilink_hyp/etat_soldes'); + $this->load->view('header_agent', $data); + if ($type == 'insurance-invoices') + $this->load->view('nano_health/hyper/insurances_invoices'); + else if ($type == 'insurance-health_care_sheets') + $this->load->view('nano_health/hyper/insurances_health_care_sheets'); $this->load->view('footer'); } diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index a4b458ad..f08c8555 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -624,6 +624,8 @@ class Hyperviseur_dash extends CI_Controller $this->load->view('nano_health/hyper/insurances_insured.php'); else if ($type == 'insurance-health_care_sheets') $this->load->view('nano_health/hyper/insurances_health_care_sheets.php'); + else if ($type == 'insurance-invoices') + $this->load->view('nano_health/hyper/insurances_invoices.php'); else $this->load->view('historique_recharges'); $this->load->view('footer'); @@ -1727,6 +1729,31 @@ class Hyperviseur_dash extends CI_Controller $this->load->view('footer'); } + public function generateQRCode(){ + if ($this->isLogged()) { + $url = WALLET_SERVICE_URL.'/qrcode/generate'; + $data = http_build_query($_POST); + $ch = curl_init($url."?".$data); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); + /* set the content type json */ + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + 'Content-Type:application/json', + 'Authorization:'.WALLET_SERVICE_TOKEN, + 'X-localization:'. $this->session->userdata('site_lang') == 'french' ? 'fr' : 'en' + )); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + /* execute request */ + $result = curl_exec($ch); + /* close cURL resource */ + curl_close($ch); + if ($result) { + echo $result; + } else { + echo json_encode(['status' => 500]); + } + } + } + public function recherche() { diff --git a/application/controllers/NanoHealthController.php b/application/controllers/NanoHealthController.php index 6a41ad69..a7e00fe8 100644 --- a/application/controllers/NanoHealthController.php +++ b/application/controllers/NanoHealthController.php @@ -482,6 +482,39 @@ class NanoHealthController extends CI_Controller } } + public function generateInvoice() + { + if($this->isLogged()) { + if (isset($_POST)) { + $url = NANO_SANTE_SERVICE_URL.'/generate-invoice'; + + $data = http_build_query($_POST); +// $getUrl = $url."?".$data; + $ch = curl_init($url."?".$data); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); + /* set the content type json */ + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + 'Content-Type:application/json', + 'Authorization:'.NANO_SANTE_SERVICE_TOKEN, + 'X-localization:'. $this->session->userdata('site_lang') == 'french' ? 'fr' : 'en' + )); + /* set return type json */ + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + /* execute request */ + $result = curl_exec($ch); + /* close cURL resource */ + curl_close($ch); + + if ($result) { + echo $result; + } else { + echo json_encode(['status' => 500]); + } + } + } + } + private function isLogged() { if (!$this->session->userdata('email')) { diff --git a/application/controllers/pagination/GeolocatedUsers.php b/application/controllers/pagination/GeolocatedUsers.php index 053a5417..5989b7d6 100755 --- a/application/controllers/pagination/GeolocatedUsers.php +++ b/application/controllers/pagination/GeolocatedUsers.php @@ -33,19 +33,19 @@ class GeolocatedUsers extends CI_Controller $data = array("", $row->lastname,$row->adresse, $row->code_membre , $row->email, $row->phone , $row->provider_class ,$status); -// if($_POST['category'] == 'geolocated'){ -// if($row->has_qr_code) -// array_push($data,"".$this->lang->line('display').""); -// else -// array_push($data,""); -// } + if($_POST['category'] == 'geolocated'){ + if($row->has_qr_code) + $data[] = "" . $this->lang->line('display') . ""; + else + $data[] = ""; + } if ($this->session->userdata("category") == "0" or $this->session->userdata("category") == "hyper") - array_push($data, ""); + $data[] = ""; - array_push($list,$data); + $list[] = $data; } diff --git a/application/controllers/pagination/Insurances.php b/application/controllers/pagination/Insurances.php index 39fe67ca..c7f60728 100755 --- a/application/controllers/pagination/Insurances.php +++ b/application/controllers/pagination/Insurances.php @@ -10,7 +10,7 @@ use Brick\Money\Money; class Insurances extends CI_Controller { - private $converter = null; +// private $converter = null; private $context = null; function __construct() @@ -40,7 +40,7 @@ class Insurances extends CI_Controller $provider = new BaseCurrencyProvider($provider, $baseCurrency); // this currency converter can now handle any currency pair - $this->converter = new CurrencyConverter($provider); +// $this->converter = new CurrencyConverter($provider); $this->context = new AutoContext(); } diff --git a/application/controllers/pagination/Invoices.php b/application/controllers/pagination/Invoices.php new file mode 100755 index 00000000..0fb68f9a --- /dev/null +++ b/application/controllers/pagination/Invoices.php @@ -0,0 +1,75 @@ +load->model('pagination/Invoices_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->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) { + $amount = Money::of(round($row->amount, 2), $row->currency_code, $this->context)->formatTo('fr_FR'); + $insured_amount = Money::of(round($row->insured_amount, 2), $row->currency_code, $this->context)->formatTo('fr_FR'); + $insurer_amount = Money::of(round($row->insurer_amount, 2), $row->currency_code, $this->context)->formatTo('fr_FR'); + + $data[] = array($row->invoice_id , $row->institution_name , $amount , $insured_amount, $insurer_amount, + $row->period_start_at, $row->period_end_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 a3543664..8af5af26 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -819,7 +819,6 @@ $lang['drugs_or_device'] = "Drug / Device"; $lang['resubmit'] = "Resubmit"; $lang['subscription_resubmitted'] = "The subscription has been resubmitted"; $lang['insurance_part'] = "Insurance share"; -$lang['insurance_part'] = "Insurance share"; $lang['consultation_id'] = "Consulation ID"; $lang['new_care_sheet'] = "Enter a care sheet"; $lang['new_prestation'] = "New service"; @@ -842,4 +841,16 @@ $lang['consultation_rule_1'] = "You must enter at least one benefit"; $lang['execution_updated'] = "Modified execution"; $lang['execution_rule_1'] = "You must enter at least one test or prescription"; $lang['execution_rule_2'] = "An execution concerns only either examinations or medical prescriptions"; +$lang['INVOICE_ISSUED'] = "Invoice issued"; +$lang['display'] = "Display"; +$lang['qr_code_generated'] = "QR Code generated with success"; +$lang['invoices'] = "Invoices"; +$lang['manage_invoices'] = "Invoice management"; +$lang['export_invoices_list'] = "Export invoice list"; +$lang['total_amount'] = "Total Amount"; +$lang['total_insured_part'] = "Total Insured Share"; +$lang['total_insurance_part'] = "Total Insurance Share"; +$lang['invoices_history'] = "Invoice history"; +$lang['health_care_sheets_history'] = "History of health care sheets"; +$lang['invoice_id'] = "Invoice ID"; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index d41451a8..7d06da65 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -830,7 +830,6 @@ $lang['drugs_or_device'] = "Médicament / Appareillage"; $lang['resubmit'] = "Resoumettre"; $lang['subscription_resubmitted'] = "La souscription a été re-soumise"; $lang['insurance_part'] = "Part de l'assurance"; -$lang['insurance_part'] = "Part de l'assurance"; $lang['consultation_id'] = "ID de la consultation"; $lang['new_care_sheet'] = "Saisir une feuille de soins"; $lang['new_prestation'] = "Nouvelle prestation"; @@ -853,4 +852,16 @@ $lang['execution_updated'] = "Execution modifiée"; $lang['consultation_rule_1'] = "Vous devez saisir au moins une prestation"; $lang['execution_rule_1'] = "Vous devez saisir au moins un examen ou prescription"; $lang['execution_rule_2'] = "Une execution concerne uniquement soit les examens , soit les prescriptions médicales"; +$lang['INVOICE_ISSUED'] = "Facture émise"; +$lang['display'] = "Afficher"; +$lang['qr_code_generated'] = "QR Code généré avec succes"; +$lang['invoices'] = "Factures"; +$lang['manage_invoices'] = "Gestion des factures"; +$lang['export_invoices_list'] = "Exporter la liste des factures"; +$lang['total_amount'] = "Total Montant"; +$lang['total_insured_part'] = "Total Part de l'assuré"; +$lang['total_insurance_part'] = "Total Part de assurance"; +$lang['invoices_history'] = "Historique des factures"; +$lang['health_care_sheets_history'] = "Historique des feuilles de soins"; +$lang['invoice_id'] = "ID de la facture"; ?> diff --git a/application/models/pagination/GeolocatedUsers_model.php b/application/models/pagination/GeolocatedUsers_model.php index 7d44037b..007d1731 100644 --- a/application/models/pagination/GeolocatedUsers_model.php +++ b/application/models/pagination/GeolocatedUsers_model.php @@ -9,7 +9,7 @@ class GeolocatedUsers_model extends CI_Model // Set table name $this->table = 'agent_plus'; // Set orderable column fields - $this->column_order = array('code_parrain','lastname', 'adresse', 'code_membre', 'email' , 'phone', 'active', 'provider_class',null); + $this->column_order = array('code_parrain','lastname', 'adresse', 'code_membre', 'email' , 'phone', 'active', 'provider_class',null, null); // Set searchable column fields $this->column_search = array('code_parrain','lastname', 'adresse', 'code_membre', 'email' , 'phone','provider_class'); // Set default order diff --git a/application/models/pagination/Invoices_model.php b/application/models/pagination/Invoices_model.php new file mode 100644 index 00000000..f5372e2f --- /dev/null +++ b/application/models/pagination/Invoices_model.php @@ -0,0 +1,109 @@ +table = 'nh_infos_invoices'; + // Set orderable column fields + $this->column_order = array('invoice_id','institution_name','amount', 'insured_amount', 'insurer_amount', 'period_start_at', 'period_end_at', null); + // Set searchable column fields + $this->column_search = array('invoice_id','institution_name','amount', 'insured_amount', 'insurer_amount', 'period_start_at', 'period_end_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); + if(!empty($postData['id_network'])){ + $this->db->where('network_id', $postData['id_network']); + } + + if(!empty($postData['network_agent_id'])){ + $this->db->where('network_agent_id', $postData['network_agent_id']); + } + 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); + if(!empty($postData['id_network'])){ + $this->db->where('network_id', $postData['id_network']); + } + + if(!empty($postData['network_agent_id'])){ + $this->db->where('network_agent_id', $postData['network_agent_id']); + } + 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/header_agent.php b/application/views/header_agent.php index e71103f3..dc7d40c9 100755 --- a/application/views/header_agent.php +++ b/application/views/header_agent.php @@ -105,11 +105,18 @@ first_row()->type == 'ilink_sante') { ?> -
  • "> - - Feuille de soins + + + lang->line('health_care_sheets'); ?> + +
  • +
  • "> + + + lang->line('invoices'); ?>
  • diff --git a/application/views/header_hyp.php b/application/views/header_hyp.php index dfadcc40..110a04f8 100755 --- a/application/views/header_hyp.php +++ b/application/views/header_hyp.php @@ -221,6 +221,12 @@ lang->line('health_care_sheets'); ?> +
  • "> + + + lang->line('invoices'); ?> + +
  • lang->line('act_code'); ?> lang->line('Montant'); ?> + lang->line('home_visit_fees'); ?> lang->line('moderator_ticket'); ?> lang->line('insurance_amount'); ?> - lang->line('home_visit_fees'); ?> Actions @@ -364,7 +364,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); arrayItem['act_id'] = $(item).attr('value'); if (index === 1) arrayItem['amount'] = parseFloat($(item).html()); - if (index === 4) + if (index === 2) arrayItem['home_visit_fees'] = parseFloat($(item).html()) || null; }); prestations.push(arrayItem); @@ -460,36 +460,40 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); } function calculatePrestationsAmount(){ - $('#amount').on('input', function () { - var amount = parseFloat($(this).val()); - var care_condition = $('#sheet-form').find('select[name="care_condition"]').val(); - if(isNaN(amount)){ - $('#moderator-ticket').val(''); - $('#insurance-amount').val(''); - }else{ - $.ajax({ - url: '', - type: 'POST', - dataType: 'json', - data: { - "network_id" : "", "amount": amount, "care_condition": care_condition - }, - success: function (data) { - if(data.status === 200){ - $('#moderator-ticket').val(data.response.moderator_ticket); - $('#insurance-amount').val(data.response.insurance_amount); - }else{ - toastr.error(data.error , "lang->line('request_error')?>"); - } - }, - error: function (resultat, statut, error) { - console.log(resultat + " " + error); - toastr.error("lang->line('error_message')?>", "lang->line('request_error')?>"); - } - }); - } + $('#amount').on('input',fetchPrestationsAmount) + $('#fees').on('input',fetchPrestationsAmount) + } - }) + function fetchPrestationsAmount(){ + var amount = parseFloat($("#amount").val()); + var fees = parseFloat($("#fees").val()); + fees = isNaN(fees) ? 0 : fees; + var care_condition = $('#sheet-form').find('select[name="care_condition"]').val(); + if(isNaN(amount + fees)){ + $('#moderator-ticket').val(''); + $('#insurance-amount').val(''); + }else{ + $.ajax({ + url: '', + type: 'POST', + dataType: 'json', + data: { + "network_id" : "", "amount": (amount + fees), "care_condition": care_condition + }, + success: function (data) { + if(data.status === 200){ + $('#moderator-ticket').val(data.response.moderator_ticket); + $('#insurance-amount').val(data.response.insurance_amount); + }else{ + toastr.error(data.error , "lang->line('request_error')?>"); + } + }, + error: function (resultat, statut, error) { + console.log(resultat + " " + error); + toastr.error("lang->line('error_message')?>", "lang->line('request_error')?>"); + } + }); + } } $('[data-toggle="tooltip"]').tooltip(); @@ -511,9 +515,10 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); '' + '' + '' + + '' + '' + '' + - '' + + ' ' + actions1 + '' + ''; $("#prestations").append(row); @@ -559,11 +564,12 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); if (index == 1) $(this).html(''); if (index == 2) - $(this).html(''); - if (index == 3) - $(this).html(''); - if (index == 4) $(this).html(''); + if (index == 3) + $(this).html(''); + if (index == 4) + $(this).html(''); + }); $(this).parents("tr").find(".add, .edit").toggle(); $(".new1").attr("disabled", "disabled"); diff --git a/application/views/nano_health/agent/health_care_sheet_update_consultation_form.php b/application/views/nano_health/agent/health_care_sheet_update_consultation_form.php index 715d6dc7..ae873010 100755 --- a/application/views/nano_health/agent/health_care_sheet_update_consultation_form.php +++ b/application/views/nano_health/agent/health_care_sheet_update_consultation_form.php @@ -151,9 +151,9 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); lang->line('act_code'); ?> lang->line('Montant'); ?> + lang->line('home_visit_fees'); ?> lang->line('moderator_ticket'); ?> lang->line('insurance_amount'); ?> - lang->line('home_visit_fees'); ?> Actions @@ -415,9 +415,9 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); $('#prestations').append('' + ''+(it.act.name|| '')+'' + ''+(parseFloat(it.amount) || '')+'' + + ''+(parseFloat(it.home_visit_fees) || '')+'' + ''+(it.moderator_ticket_formatted || '')+'' + ''+(it.insurance_amount_formatted || '')+'' + - ''+(parseFloat(it.home_visit_fees) || '')+'' + ''+actions1+'' + '') }); @@ -481,7 +481,7 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); } if (index === 1) arrayItem['amount'] = parseFloat($(item).html()); - if (index === 4) + if (index === 2) arrayItem['home_visit_fees'] = parseFloat($(item).html()) || null; }); prestations.push(arrayItem); @@ -587,36 +587,40 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); } function calculatePrestationsAmount(){ - $('#amount').on('input', function () { - var amount = parseFloat($(this).val()); - var care_condition = $('#sheet-form').find('select[name="care_condition"]').val(); - if(isNaN(amount)){ - $('#moderator-ticket').val(''); - $('#insurance-amount').val(''); - }else{ - $.ajax({ - url: '', - type: 'POST', - dataType: 'json', - data: { - "network_id" : "", "amount": amount, "care_condition": care_condition - }, - success: function (data) { - if(data.status === 200){ - $('#moderator-ticket').val(data.response.moderator_ticket); - $('#insurance-amount').val(data.response.insurance_amount); - }else{ - toastr.error(data.error , "lang->line('request_error')?>"); - } - }, - error: function (resultat, statut, error) { - console.log(resultat + " " + error); - toastr.error("lang->line('error_message')?>", "lang->line('request_error')?>"); - } - }); - } + $('#amount').on('input',fetchPrestationsAmount) + $('#fees').on('input',fetchPrestationsAmount) + } - }) + function fetchPrestationsAmount(){ + var amount = parseFloat($("#amount").val()); + var fees = parseFloat($("#fees").val()); + fees = isNaN(fees) ? 0 : fees; + var care_condition = $('#sheet-form').find('select[name="care_condition"]').val(); + if(isNaN(amount + fees)){ + $('#moderator-ticket').val(''); + $('#insurance-amount').val(''); + }else{ + $.ajax({ + url: '', + type: 'POST', + dataType: 'json', + data: { + "network_id" : "", "amount": (amount + fees), "care_condition": care_condition + }, + success: function (data) { + if(data.status === 200){ + $('#moderator-ticket').val(data.response.moderator_ticket); + $('#insurance-amount').val(data.response.insurance_amount); + }else{ + toastr.error(data.error , "lang->line('request_error')?>"); + } + }, + error: function (resultat, statut, error) { + console.log(resultat + " " + error); + toastr.error("lang->line('error_message')?>", "lang->line('request_error')?>"); + } + }); + } } $('[data-toggle="tooltip"]').tooltip(); @@ -638,9 +642,9 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); '' + '' + '' + + '' + '' + '' + - '' + ' ' + actions1 + '' + ''; $("#prestations").append(row); @@ -692,11 +696,12 @@ $fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL); if (index === 1) $(this).html(''); if (index === 2) - $(this).html(''); + $(this).html(''); if (index === 3) - $(this).html(''); + $(this).html(''); if (index === 4) - $(this).html(''); + $(this).html(''); + }); $(this).parents("tr").find(".add, .edit").toggle(); $(".new1").attr("disabled", "disabled"); diff --git a/application/views/nano_health/hyper/infos_health_care_sheet.php b/application/views/nano_health/hyper/infos_health_care_sheet.php index b27405f2..004ae39b 100755 --- a/application/views/nano_health/hyper/infos_health_care_sheet.php +++ b/application/views/nano_health/hyper/infos_health_care_sheet.php @@ -230,9 +230,9 @@ # lang->line('act_code'); ?> lang->line('Montant'); ?> + lang->line('home_visit_fees'); ?> lang->line('moderator_ticket'); ?> lang->line('insurance_amount'); ?> - lang->line('home_visit_fees'); ?> Date @@ -249,9 +249,9 @@ " . ($i+1) . " " . $row->act_code . " " . $amount . " + ".$home_visit_fees." " . $moderator_ticket . " " . $insurance_amount . " - ".$home_visit_fees." " . $row->created_at. ""; ?> diff --git a/application/views/nano_health/hyper/insurances_health_care_sheets.php b/application/views/nano_health/hyper/insurances_health_care_sheets.php index 0b4634a7..4e183188 100755 --- a/application/views/nano_health/hyper/insurances_health_care_sheets.php +++ b/application/views/nano_health/hyper/insurances_health_care_sheets.php @@ -57,6 +57,9 @@ + @@ -192,17 +195,17 @@ 'pageLength', { "extend": 'excelHtml5', - title: "lang->line('subscriptions_history') ?>", + title: "lang->line('health_care_sheets_history') ?>", }, { extend: 'csvHtml5', - title: "lang->line('subscriptions_history') ?>", + title: "lang->line('health_care_sheets_history') ?>", }, { extend: 'pdfHtml5', orientation: 'landscape', pageSize: 'LEGAL', - title: "lang->line('subscriptions_history') ?>", + title: "lang->line('health_care_sheets_history') ?>", trim: false, "action": newexportaction }, @@ -281,6 +284,33 @@ $('#modal').modal('show'); }) + $('#generate-invoice').click(function () { + $.ajax({ + url: '', + type: 'POST', + dataType: 'json', + data: { network_agent_id : ""}, + success: function (data) { + if(data.status === 200){ + Swal.fire({ + icon: 'success', + title: "La facture a été générée", + text:"lang->line('informations_updated')?>", + timer: 3000 + }).then(()=>{ + location.reload(); + }); + }else{ + toastr.error(data.error , "lang->line('request_error')?>"); + } + }, + error: function (resultat, statut, error) { + console.log(resultat + " " + error); + toastr.error("lang->line('error_message')?>", "lang->line('request_error')?>"); + } + }); + }) + $('#check-insured').click(function () { if ($('#search-form')[0].checkValidity()) { let option = $('#search-form').find('select[name="option"]').val(); diff --git a/application/views/nano_health/hyper/insurances_invoices.php b/application/views/nano_health/hyper/insurances_invoices.php new file mode 100755 index 00000000..911f28e3 --- /dev/null +++ b/application/views/nano_health/hyper/insurances_invoices.php @@ -0,0 +1,204 @@ + + + + + +
    + + +
    +

    + lang->line('manage_invoices') ?> + + +

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

    lang->line('export_invoices_list') ?>

    +
    +
    +
    +
    + + + + + + + + + + + + + + +
    lang->line('invoice_id') ?>Emetteurlang->line('total_amount') ?>lang->line('total_insured_part') ?>lang->line('total_insurance_part') ?>Date debutDate finAction
    +
    +
    +
    +
    +
    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/views/nano_health/hyper/listeadmin.php b/application/views/nano_health/hyper/listeadmin.php index 7d0b2249..8f46081f 100755 --- a/application/views/nano_health/hyper/listeadmin.php +++ b/application/views/nano_health/hyper/listeadmin.php @@ -85,7 +85,7 @@ lang->line('provider_class'); ?> lang->line('Active'); ?> - + QR Code session->userdata("category") == "0" or $this->session->userdata("category") == "hyper") { echo " Action "; @@ -419,10 +419,11 @@ $.ajax({ url: '', type: 'POST', - data: {id_agent: id_agent}, + data: {'user_id': id_agent , 'type' : 'agent'}, dataType: 'json', success: function (data) { - data = JSON.parse(data) + console.log('status',data.status) + console.log('respon',data.response) if(data.status === 200){ Swal.fire({ icon: 'success', @@ -433,11 +434,10 @@ location.reload(); }); }else{ - toastr.error("lang->line('error_message')?>", "lang->line('request_error')?>"); + toastr.error(data.error , "lang->line('request_error')?>"); } }, error: function (error) { - console.log(error.responseText); toastr.error("lang->line('error_message')?>", "lang->line('request_error')?>"); } });