Add partial payment informations in insurances and subscriptions details
This commit is contained in:
parent
c8bcfcf9cb
commit
1678e4e37b
|
@ -406,7 +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->getInsurancePaymentTransactions($this->input->get('id'));
|
||||
$data['transactions'] = $this->nano_health_model->getInsuranceInvoices($this->input->get('id'), 'PAID');
|
||||
$data['deletion_of_beneficiaries'] = $this->nano_health_model->getBeneficiariesDeletionHistory($data['insurance']->id ?? null);
|
||||
|
||||
$this->load->view('header_hyp', $data);
|
||||
|
|
|
@ -17,18 +17,17 @@ class NanoHealthController extends CI_Controller
|
|||
$configId = $_POST['config_id'];
|
||||
$grid = $_POST['grid'] ?? [];
|
||||
|
||||
try{
|
||||
$this->db->trans_begin();
|
||||
$this->db->delete('nh_years_prices_grid',['nh_network_config_id' => $configId]);
|
||||
if(sizeof($grid) > 0){
|
||||
$this->db->insert_batch('nh_years_prices_grid',$grid);
|
||||
}
|
||||
$this->db->trans_begin();
|
||||
$this->db->delete('nh_years_prices_grid',['nh_network_config_id' => $configId]);
|
||||
if(sizeof($grid) > 0){
|
||||
$this->db->insert_batch('nh_years_prices_grid',$grid);
|
||||
}
|
||||
if ($this->db->trans_status() === FALSE) {
|
||||
$this->db->trans_rollback();
|
||||
echo json_encode("500");
|
||||
} else {
|
||||
$this->db->trans_commit();
|
||||
echo json_encode("200");
|
||||
}catch (Throwable $exception){
|
||||
$this->db->trans_rollback();
|
||||
var_dump($exception->getMessage());
|
||||
echo json_encode("500");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,27 +46,26 @@ class NanoHealthController extends CI_Controller
|
|||
}
|
||||
}
|
||||
|
||||
try{
|
||||
$this->db->trans_begin();
|
||||
foreach ($grid as $row){
|
||||
$n = $row['payment_period'] == 'DAILY' ? 22 : 1 ;
|
||||
if($row['payment_period'] == 'ONE_TIME'){
|
||||
$row['payment_duration_months'] = null;
|
||||
}
|
||||
$row['number_of_fractions'] = $n * ($row['payment_duration_months'] ?? 1);
|
||||
if(!empty($row['id'])){
|
||||
$this->db->where('id',$row['id']);
|
||||
$this->db->update('nh_months_prices_grid', $row);
|
||||
}else{
|
||||
$this->db->insert('nh_months_prices_grid',$row);
|
||||
}
|
||||
$this->db->trans_begin();
|
||||
foreach ($grid as $row){
|
||||
$n = $row['payment_period'] == 'DAILY' ? 22 : 1 ;
|
||||
if($row['payment_period'] == 'ONE_TIME'){
|
||||
$row['payment_duration_months'] = null;
|
||||
}
|
||||
$row['number_of_fractions'] = $n * ($row['payment_duration_months'] ?? 1);
|
||||
if(!empty($row['id'])){
|
||||
$this->db->where('id',$row['id']);
|
||||
$this->db->update('nh_months_prices_grid', $row);
|
||||
}else{
|
||||
$this->db->insert('nh_months_prices_grid',$row);
|
||||
}
|
||||
}
|
||||
if ($this->db->trans_status() === FALSE) {
|
||||
$this->db->trans_rollback();
|
||||
echo json_encode("500");
|
||||
} else {
|
||||
$this->db->trans_commit();
|
||||
echo json_encode("200");
|
||||
}catch (Throwable $exception){
|
||||
$this->db->trans_rollback();
|
||||
var_dump($exception->getMessage());
|
||||
echo json_encode("500");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ class Insurances extends CI_Controller
|
|||
$bonus_amount = Money::of(round($row->total_bonus_amount, 2), $row->currency_code, $this->context)->formatTo('fr_FR');
|
||||
|
||||
$data[] = array($row->insured_id , $row->lastname, $row->phone, $row->number_of_months, $row->number_of_beneficiaries,
|
||||
$bonus_amount, $row->start_at, $row->end_at, $row->created_at,
|
||||
$bonus_amount, $this->lang->line($row->payment_period) , $row->start_at, $row->end_at, $row->created_at,
|
||||
'<a href="'.$current_url.'?history=insurance-insured&id='.$row->insured_id.'" class="btn btn-primary" > '.$this->lang->line('Voir plus...').'</a>');
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,9 @@ class Nano_health_model extends CI_Model
|
|||
}
|
||||
|
||||
public function getInfosInsuranceSubscriptionById($insuranceSubscriptionId){
|
||||
return $this->db->get_where('nh_infos_insurances_subscriptions',['insurance_subscription_id'=> $insuranceSubscriptionId])->first_row();
|
||||
return $this->db->select('s.*, pg.payment_period , pg.number_of_fractions')
|
||||
->from('nh_infos_insurances_subscriptions s')->join('nh_months_prices_grid pg', 'pg.id = s.months_grid_id')
|
||||
->where('s.insurance_subscription_id',$insuranceSubscriptionId)->get()->row();
|
||||
}
|
||||
|
||||
public function getNhValidatingAgentSubscriptionHistory($agentId , $state){
|
||||
|
@ -62,8 +64,17 @@ 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->get_where('nh_insurances_payments',['insured_id'=> $insuredId]);
|
||||
// }
|
||||
|
||||
public function getInsuranceInvoices($insuredId , $state){
|
||||
return $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();
|
||||
|
||||
}
|
||||
|
||||
public function getSubscriptionBeneficiaries($subscriptionId){
|
||||
|
|
|
@ -1381,7 +1381,8 @@ $careRequests = [];
|
|||
}
|
||||
|
||||
select.each(function () {
|
||||
$(this).parent("td").html($(this).find('option:selected').text()).attr("value",$(this).val());
|
||||
$(this).parent("td").html($(this).find('option:selected').text())
|
||||
.attr("value",$(this).val()).attr("name",$(this).attr('name'));
|
||||
});
|
||||
});
|
||||
// Edit row on edit button click
|
||||
|
|
|
@ -158,6 +158,32 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-xs-6">
|
||||
<div class="small-box bg-aqua-active">
|
||||
<div class="inner">
|
||||
<h3 style="white-space: pre-wrap; font-size: 1.9em;"><?= $this->lang->line($insurance->payment_period) ?></h3>
|
||||
<p><?= $this->lang->line('payment_period') ?></p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-clock"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-xs-6">
|
||||
<div class="small-box bg-aqua-active">
|
||||
<div class="inner">
|
||||
<h3 style="white-space: pre-wrap; font-size: 1.9em;"><?= $insurance->number_of_fractions ?></h3>
|
||||
<p><?= $this->lang->line('number_of_fractions') ?></p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-clock"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title"><?= $this->lang->line('beneficiaries') ?></h3>
|
||||
|
@ -306,7 +332,7 @@
|
|||
$amount = Money::of(round($row->amount, 2), $insurance->currency_code, $this->context)->formatTo('fr_FR');
|
||||
|
||||
echo "<tr>
|
||||
<td>" . ($i+1) . "</td>
|
||||
<td>" . $row->invoice_id . "</td>
|
||||
<td>" . $row->insurance_subscription_id . "</td>
|
||||
<td>" . $amount . "</td>
|
||||
<td>" . $this->lang->line($row->reason). "</td>
|
||||
|
|
|
@ -189,6 +189,28 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-xs-6">
|
||||
<div class="small-box bg-aqua-active">
|
||||
<div class="inner">
|
||||
<h3 style="white-space: pre-wrap; font-size: 1.9em;"><?= $this->lang->line($subscription->payment_period) ?></h3>
|
||||
<p><?= $this->lang->line('payment_period') ?></p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-clock"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-xs-6">
|
||||
<div class="small-box bg-aqua-active">
|
||||
<div class="inner">
|
||||
<h3 style="white-space: pre-wrap; font-size: 1.9em;"><?= $subscription->number_of_fractions ?></h3>
|
||||
<p><?= $this->lang->line('number_of_fractions') ?></p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-clock"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box box-primary">
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
<th><?= $this->lang->line('number_of_months') ?></th>
|
||||
<th><?= $this->lang->line('number_of_beneficiaries') ?></th>
|
||||
<th><?= $this->lang->line('bonus_amount') ?></th>
|
||||
<th><?= $this->lang->line('payment_period') ?></th>
|
||||
<th><?= $this->lang->line('start_at') ?></th>
|
||||
<th><?= $this->lang->line('end_at') ?></th>
|
||||
<th align='center'><?= $this->lang->line('subscription_date') ?></th>
|
||||
|
@ -132,15 +133,15 @@
|
|||
},
|
||||
"type": "POST"
|
||||
},
|
||||
"aaSorting": [[8, "desc"]],
|
||||
"aaSorting": [[9, "desc"]],
|
||||
"columnDefs": [
|
||||
{
|
||||
"targets": [6,7],
|
||||
"targets": [7,8],
|
||||
// "orderable": false,
|
||||
render: $.fn.dataTable.render.moment('YYYY-MM-DD', 'D MMMM YYYY', format)
|
||||
},
|
||||
{
|
||||
"targets": [8],
|
||||
"targets": [9],
|
||||
// "orderable": false,
|
||||
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
<th><?= $this->lang->line('number_of_months') ?></th>
|
||||
<th><?= $this->lang->line('number_of_beneficiaries') ?></th>
|
||||
<th><?= $this->lang->line('bonus_amount') ?></th>
|
||||
<th><?= $this->lang->line('payment_period') ?></th>
|
||||
<th><?= $this->lang->line('start_at') ?></th>
|
||||
<th><?= $this->lang->line('end_at') ?></th>
|
||||
<th align='center'><?= $this->lang->line('subscription_date') ?></th>
|
||||
|
@ -135,15 +136,15 @@
|
|||
},
|
||||
"type": "POST"
|
||||
},
|
||||
"aaSorting": [[8, "desc"]],
|
||||
"aaSorting": [[9, "desc"]],
|
||||
"columnDefs": [
|
||||
{
|
||||
"targets": [6,7],
|
||||
"targets": [7,8],
|
||||
// "orderable": false,
|
||||
render: $.fn.dataTable.render.moment('YYYY-MM-DD', 'D MMMM YYYY', format)
|
||||
},
|
||||
{
|
||||
"targets": [8],
|
||||
"targets": [9],
|
||||
// "orderable": false,
|
||||
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue