From 082596b2910ffc793e1896c712b63c0720042110 Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Fri, 4 Feb 2022 17:52:51 +0100 Subject: [PATCH] Add history of deleted beneficiaries --- application/controllers/Hyperviseur_dash.php | 1 + application/language/english/message_lang.php | 3 + application/language/french/message_lang.php | 3 + application/models/Nano_health_model.php | 7 + .../nano_health/hyper/infos_insurance.php | 178 +++++++++++++++++- 5 files changed, 190 insertions(+), 2 deletions(-) diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index f261c3ea..0005f7aa 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -407,6 +407,7 @@ class Hyperviseur_dash extends CI_Controller $data['beneficiaries'] = $this->nano_health_model->getInsuranceBeneficiaries($data['insurance']->id ?? null); $data['user'] = $this->db->get_where('user_infos',['user_id' => $data['insurance']->user_id ?? null])->first_row(); $data['transactions'] = $this->nano_health_model->getInsurancePaymentTransactions($this->input->get('id')); + $data['deletion_of_beneficiaries'] = $this->nano_health_model->getBeneficiariesDeletionHistory($data['insurance']->id ?? null); $this->load->view('header_hyp', $data); $this->load->view('nano_health/hyper/infos_insurance'); diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index bb9aa267..e0557a88 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -862,4 +862,7 @@ $lang['request_id'] = "Request ID"; $lang['export_request_list'] = "Export request list"; $lang['USED'] = "Used"; $lang['used_care_requests'] = "Used care requests"; +$lang['beneficiaries_deletion_history'] = "Deletion history of beneficiaries"; +$lang['deletion_date'] = "Date of deletion"; +$lang['STOP_INSURANCE'] = "Stopping insurance"; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 912e286e..748548dd 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -873,4 +873,7 @@ $lang['request_id'] = "ID de la demande"; $lang['export_request_list'] = "Exporter la liste des demandes"; $lang['USED'] = "Utilisée"; $lang['used_care_requests'] = "Demandes de soins utilisées"; +$lang['beneficiaries_deletion_history'] = "Historique de suppression des ayants droit"; +$lang['deletion_date'] = "Date de suppression"; +$lang['STOP_INSURANCE'] = "Arrêt de l'assurance" ?> diff --git a/application/models/Nano_health_model.php b/application/models/Nano_health_model.php index 48c601b8..2653d5c8 100644 --- a/application/models/Nano_health_model.php +++ b/application/models/Nano_health_model.php @@ -150,4 +150,11 @@ class Nano_health_model extends CI_Model } return $query->count_all_results(); } + + public function getBeneficiariesDeletionHistory($insuranceId){ + return $this->db->select('b.* , i.deleted_at') + ->from('nh_having_rights b')->join('nh_insurances_having_rights i', 'b.id = i.having_right_id') + ->where('i.deleted_at IS NOT NULL') + ->where('i.insurance_id',$insuranceId)->order_by('i.deleted_at','desc')->get(); + } } diff --git a/application/views/nano_health/hyper/infos_insurance.php b/application/views/nano_health/hyper/infos_insurance.php index e48e1715..84664390 100755 --- a/application/views/nano_health/hyper/infos_insurance.php +++ b/application/views/nano_health/hyper/infos_insurance.php @@ -163,7 +163,7 @@

lang->line('beneficiaries') ?>

- +
@@ -322,6 +322,134 @@ +
+
+

lang->line('beneficiaries_deletion_history') ?>

+
+
+
#
+ + + + + + + + + + + + + + result() as $i => $row) { + $bonus_amount = Money::of(round($row->bonus_amount, 2), $insurance->currency_code, $this->context)->formatTo('fr_FR'); + + echo " + + + + + + + "; + ?> + + + + + + +
#lang->line('Nom'); ?>lang->line('gender'); ?>lang->line('birth_date'); ?>Affiliationlang->line('bonus_amount'); ?>lang->line('deletion_date'); ?>Images
" . ($i+1) . "" . $row->lastname.' '.$row->firstname . "" . $row->gender . "" . $row->birthdate . "".$this->lang->line($row->affiliation)."".$bonus_amount."" . $row->deleted_at. " + +
+
+ + @@ -373,7 +501,7 @@ const format = "session->userdata('site_lang')?>" === 'french' ? 'fr' : 'en'; moment.updateLocale(moment.locale(format), {invalidDate: ""}); // Blank text when is invalid date - $('#example1').DataTable( + $('#beneficiaries').DataTable( { order: [[1, 'asc']], dom: 'Bfrtip', @@ -414,6 +542,52 @@ } ); + $('#deleted-beneficiaries').DataTable( + { + order: [[1, 'asc']], + dom: 'Bfrtip', + "columnDefs": [{ + "targets": [6], + // "orderable": false, + render: $.fn.dataTable.render.moment( 'YYYY-MM-DD HH:mm:ss' , 'D MMMM YYYY HH:mm:ss', format) + }], + "buttons": [ + 'pageLength', + { + "extend": 'excelHtml5', + title: "lang->line('beneficiaries_deletion_history') . ' :: ' . $this->lang->line('subscription_detail') . ' - ' . $insured_id?>", + // exportOptions: { + // columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17] + // }, + customizeData: function (data) { + for (var i = 0; i < data.body.length; i++) { + for (var j = 0; j < data.body[i].length; j++) { + // data.body[i][j] = '\u200C' + data.body[i][j]; + if ([5].includes(j)) { + // Get the value and strip the non numeric characters + // var value = $(this).text(); + value = data.body[i][j].replace(',', ".") + data.body[i][j] = Number(value.replace(/[^0-9\.-]+/g, "")); + } + } + } + }, + }, + { + extend: 'csvHtml5', + title: "lang->line('beneficiaries_deletion_history') . ' :: ' . $this->lang->line('subscription_detail') . ' - ' . $insured_id?>", + }, + { + extend: 'pdfHtml5', + orientation: 'landscape', + pageSize: 'LEGAL', + title: "lang->line('beneficiaries_deletion_history') . ' :: ' . $this->lang->line('subscription_detail') . ' - ' . $insured_id?>", + }, + // 'colvis' + ] + } + ); + $('#transactions').DataTable( { order: [[1, 'asc']],