diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php
index ae7672ed..97ae1f77 100755
--- a/application/controllers/Hyperviseur_dash.php
+++ b/application/controllers/Hyperviseur_dash.php
@@ -406,8 +406,8 @@ class Hyperviseur_dash extends CI_Controller
$data['insurance'] = $this->nano_health_model->getInfosInsuredById($this->input->get('id'));
$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['transactions'] = $this->nano_health_model->getInsuranceInvoices($this->input->get('id'), 'PAID');
+ $data['payments'] = $this->nano_health_model->getInsurancePaymentTransactions($data['insurance']->id ?? null);
+ $data['invoices'] = $this->nano_health_model->getInsuranceInvoices($this->input->get('id'));
$data['deletion_of_beneficiaries'] = $this->nano_health_model->getBeneficiariesDeletionHistory($data['insurance']->id ?? null);
$this->load->view('header_hyp', $data);
diff --git a/application/models/Nano_health_model.php b/application/models/Nano_health_model.php
index f66dc00d..f3210cec 100644
--- a/application/models/Nano_health_model.php
+++ b/application/models/Nano_health_model.php
@@ -64,16 +64,22 @@ class Nano_health_model extends CI_Model
return $this->db->get_where('nh_infos_insurances',['insured_id'=> $insuredId])->first_row();
}
-// public function getInsurancePaymentTransactions($insuredId){
-// return $this->db->get_where('nh_insurances_payments',['insured_id'=> $insuredId]);
-// }
+ public function getInsurancePaymentTransactions($insuredId){
+ return $this->db->select('p.* , in.invoice_id')
+ ->from('nh_insurances_payments p')->join('nh_insurances_invoices in', 'in.id = p.invoice_id')
+ ->where('in.insurance_id',$insuredId)->order_by('p.created_at','desc')->get();
+ }
- public function getInsuranceInvoices($insuredId , $state){
- return $this->db->select('i.* , is.insurance_subscription_id')
+ public function getInsuranceInvoices($insuredId , $state = null){
+ $query = $this->db->select('i.* , is.insurance_subscription_id')
->from('nh_insurances_invoices i')->join('nh_insurances in', 'in.id = i.insurance_id')
->join('nh_insurances_subscriptions is', 'is.id = i.subscription_id','left')
- ->where('i.state',$state)
- ->where('in.insured_id',$insuredId)->order_by('i.created_at','desc')->get();
+ ->where('in.insured_id',$insuredId);
+ if(!empty($state)){
+ $query =$query->where('i.state',$state);
+ }
+
+ return $query->order_by('i.created_at','desc')->get();
}
diff --git a/application/views/nano_health/hyper/infos_insurance.php b/application/views/nano_health/hyper/infos_insurance.php
index e8f9e05f..17c8bbb7 100755
--- a/application/views/nano_health/hyper/infos_insurance.php
+++ b/application/views/nano_health/hyper/infos_insurance.php
@@ -323,23 +323,24 @@
-
+
- # |
+ ID |
= $this->lang->line('souscription_id'); ?> |
= $this->lang->line('Montant'); ?> |
= $this->lang->line('reason'); ?> |
+ = $this->lang->line('state'); ?> |
Date |
result() as $i => $row) {
+ if (isset($invoices)) {
+ foreach ($invoices->result() as $i => $row) {
$amount = Money::of(round($row->amount, 2), $insurance->currency_code, $this->context)->formatTo('fr_FR');
echo "
@@ -347,6 +348,43 @@
" . $row->insurance_subscription_id . " |
" . $amount . " |
" . $this->lang->line($row->reason). " |
+ " . $this->lang->line($row->state). " |
+ " . $row->created_at. " | ";
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ID |
+ = $this->lang->line('invoice_id'); ?> |
+ = $this->lang->line('Montant'); ?> |
+ Date |
+
+
+
+ result() as $i => $row) {
+ $amount = Money::of(round($row->amount, 2), $insurance->currency_code, $this->context)->formatTo('fr_FR');
+
+ echo "
+ " . $row->payment_id . " |
+ " . $row->invoice_id . " |
+ " . $amount . " |
" . $row->created_at. " | ";
?>
@@ -625,11 +663,22 @@
}
);
- $('#transactions').DataTable(
+ $('#invoices').DataTable(
{
order: [[1, 'asc']],
"columnDefs": [{
- "targets": [4],
+ "targets": [5],
+ // "orderable": false,
+ render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
+ }],
+ }
+ );
+
+ $('#payments').DataTable(
+ {
+ order: [[1, 'asc']],
+ "columnDefs": [{
+ "targets": [3],
// "orderable": false,
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
}],