Files

434 lines
24 KiB
PHP

@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ $chi_plan->name }}</span> {{ __('insurance.details') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ url('insurance') }}">{{ __('insurance.insurance') }}</a></li>
<li class="active">{{ __('insurance.CHI_plan_details') }}</li>
</ol>
</div>
<!-- /.col-lg-12 -->
</div>
<div class="row">
<div class="col-sm-12">
@include('insurance::chi_plan.menu')
</div>
</div>
@include('flash::message')
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6">
<h4 class="text-center"><span style="color: blue;">{{ $chi_plan->name }}</span> {{ __('insurance.details') }} </h4>
<table class="table table-striped table-bordered">
<tbody>
<tr>
<td style="font-size: 18px;">{{ __('insurance.plan_name') }}</td>
<td style="font-size: 18px;">{{ $chi_plan->name }}</td>
<td style="font-size: 18px;">{{ __('insurance.plan_fee') }}</td>
<td style="font-size: 18px;">{{ ugandan_shillings($chi_plan->plan_fee) }}</td>
</tr>
<tr>
<td style="font-size: 18px;">{{ __('insurance_groups.start_date') }}</td>
<td style="font-size: 18px;">{{ streamline_date($chi_plan->plan_start_date) }}</td>
<td style="font-size: 18px;">{{ __('insurance_groups.end_date') }}</td>
<td style="font-size: 18px;">{{ streamline_date($chi_plan->plan_end_date) }}</td>
</tr>
</tbody>
</table>
</div>
<div class="col-md-3">
<a href="{{ url('community_health_insurance_plan/') }}/{{ $chi_plan->id}}/print" target="_blank" class="btn btn-rounded" style="background-color: #5a996d; color: white;"><i class="fa fa-print"></i><span style="margin-left: 10px;">Print Plan</span></a>
</div>
</div>
<br>
<div class="row">
<div class="col-md-12">
<h3 class="text-center" style="font-size: 16px;">{{ __('insurance.plan_benefits') }}</h3>
@php
$insurance_benefits = \Streamline\Models\InsuranceBenefit::where('plan_id', $chi_plan->id)->get();
@endphp
@if(count($insurance_benefits) > 0)
@php $counter = 1 @endphp
@foreach($insurance_benefits as $insurance_benefit)
<table class="table" style="font-size: 16px;">
<tbody>
<tr>
<td>{{ $counter }}. <strong>Benefit Name: </strong></td>
<td>{{ $insurance_benefit->name }}</td>
</tr>
<tr>
<td><strong>&nbsp;&nbsp;&nbsp;&nbsp;Waiting Period:</strong></td>
<td>{{ $insurance_benefit->waiting_period }}</td>
</tr>
<tr>
<td><strong>&nbsp;&nbsp;&nbsp;&nbsp;Benefit Fee: </strong></td>
<td>{{ ugandan_shillings_with_decimals($insurance_benefit->fee) }}</td>
</tr>
<tr>
<td><strong>&nbsp;&nbsp;&nbsp;&nbsp;Created By: </strong></td>
<td>{{ get_full_name($insurance_benefit->created_by, "id", "first_name", "last_name", "patients") }} at {{ streamline_date($insurance_benefit->created_at) }}</td>
</tr>
</tbody>
</table>
@php
$counter++;
$benefit = \Streamline\Models\InsuranceBenefit::find($insurance_benefit->id);
$benefit_drugs = DB::table('insurance_benefit_items')->whereNull('deleted_at')->where('item_type', 4)
->where('benefit_id', $insurance_benefit->id)->get();
$benefit_sundries = DB::table('insurance_benefit_items')->whereNull('deleted_at')->where('item_type', 5)
->where('benefit_id', $insurance_benefit->id)->get();
$benefit_invs = DB::table('insurance_benefit_items')->whereNull('deleted_at')->where('item_type', 3)
->where('benefit_id', $insurance_benefit->id)->get();
$benefit_procedures = DB::table('insurance_benefit_items')->whereNull('deleted_at')->where('item_type', 2)
->where('benefit_id', $insurance_benefit->id)->get();
$benefit_services = DB::table('insurance_benefit_items')->whereNull('deleted_at')->where('item_type', 1)
->where('benefit_id', $insurance_benefit->id)->get();
@endphp
{{-- start showing benefits belonging to this service --}}
<div style="border:5px solid #9b9b9b; padding: 5px;">
<h4>{{ __('insurance_benefits.procedures') }}</h4>
<table class="table color-bordered-table success-bordered-table item-tables">
<thead>
<tr>
<th>{{ __('insurance_benefits.name') }}</th>
<th>{{ __('insurance_benefits.authorisation') }}</th>
<th>{{ __('insurance_benefits.cash_price') }}</th>
<th>{{ __('insurance_benefits.co_payment') }}</th>
<th>{{ __('insurance.chi_to_pay') }}</th>
<th>{{ __('insurance_benefits.annual_member_limit') }}</th>
<th>{{ __('insurance_benefits.annual_family_limit') }}</th>
</tr>
</thead>
<tbody>
@foreach($benefit_procedures as $record)
@php $items_array = explode(",", $record->item_id); $count = 0; @endphp
@foreach($items_array as $item_id)
@php
$item_details = get_item_insurance_details($item_id, 2, $benefit->id);
if (!$item_details) {continue;}
if ($count > 4) {break;}
$count++;
@endphp
<tr>
<td>{{ $procedures[$item_id] }}</td>
<td>{{ $item_details['authorisation'] == 1 ? 'Yes' : 'No' }}</td>
<td>{{ ugandan_shillings($item_details['cash_price']) }}</td>
<td>{{ ugandan_shillings($item_details['co_payment']) }}</td>
<td>
@php
$chi_to_pay = $item_details['cash_price'] - $item_details['co_payment'];
@endphp
{{ ugandan_shillings($chi_to_pay) }}
</td>
<td>{{ ugandan_shillings($item_details['annual_member_limit']) }}</td>
<td>{{ ugandan_shillings($item_details['annual_family_limit']) }}</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
<hr>
<h4>{{ __('insurance_benefits.services') }}</h4>
<table class="table color-bordered-table success-bordered-table item-tables">
<thead>
<tr>
<th>{{ __('insurance_benefits.name') }}</th>
<th>{{ __('insurance_benefits.authorisation') }}</th>
<th>{{ __('insurance_benefits.cash_price') }}</th>
<th>{{ __('insurance_benefits.co_payment') }}</th>
<th>{{ __('insurance.chi_to_pay') }}</th>
<th>{{ __('insurance_benefits.annual_member_limit') }}</th>
<th>{{ __('insurance_benefits.annual_family_limit') }}</th>
</tr>
</thead>
<tbody>
@foreach($benefit_services as $record)
@php $items_array = explode(",", $record->item_id); $count = 0; @endphp
@foreach($items_array as $item_id)
@php
$item_details = get_item_insurance_details($item_id, 1, $benefit->id);
if (!$item_details) {continue;}
if ($count > 4) {break;}
$count++;
@endphp
<tr>
<td>{{ $services[$item_id] }}</td>
<td>{{ $item_details['authorisation'] == 1 ? 'Yes' : 'No' }}</td>
<td>{{ ugandan_shillings($item_details['cash_price']) }}</td>
<td>{{ ugandan_shillings($item_details['co_payment']) }}</td>
<td>
@php
$chi_to_pay = $item_details['cash_price'] - $item_details['co_payment'];
@endphp
{{ ugandan_shillings($chi_to_pay) }}
</td>
<td>{{ ugandan_shillings($item_details['annual_member_limit']) }}</td>
<td>{{ ugandan_shillings($item_details['annual_family_limit']) }}</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
<hr>
<h4>{{ __('insurance_benefits.investigations') }}</h4>
<table class="table color-bordered-table success-bordered-table item-tables">
<thead>
<tr>
<th>{{ __('insurance_benefits.name') }}</th>
<th>{{ __('insurance_benefits.authorisation') }}</th>
<th>{{ __('insurance_benefits.cash_price') }}</th>
<th>{{ __('insurance_benefits.co_payment') }}</th>
<th>{{ __('insurance.chi_to_pay') }}</th>
<th>{{ __('insurance_benefits.annual_member_limit') }}</th>
<th>{{ __('insurance_benefits.annual_family_limit') }}</th>
</tr>
</thead>
<tbody>
@foreach($benefit_invs as $record)
@php $items_array = explode(",", $record->item_id); $count = 0; @endphp
@foreach($items_array as $item_id)
@php
$item_details = get_item_insurance_details($item_id, 3, $benefit->id);
if (!$item_details) {continue;}
if ($count > 4) {break;}
$count++;
@endphp
<tr>
<td>{{ $investigations[$item_id] }}</td>
<td>{{ $item_details['authorisation'] == 1 ? 'Yes' : 'No' }}</td>
<td>{{ ugandan_shillings($item_details['cash_price']) }}</td>
<td>{{ ugandan_shillings($item_details['co_payment']) }}</td>
<td>
@php
$chi_to_pay = $item_details['cash_price'] - $item_details['co_payment'];
@endphp
{{ ugandan_shillings($chi_to_pay) }}
</td>
<td>{{ ugandan_shillings($item_details['annual_member_limit']) }}</td>
<td>{{ ugandan_shillings($item_details['annual_family_limit']) }}</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
<hr>
<h4>{{ __('insurance_benefits.drugs') }}</h4>
<table class="table color-bordered-table success-bordered-table item-tables">
<thead>
<tr>
<th>{{ __('insurance_benefits.name') }}</th>
<th>{{ __('insurance_benefits.authorisation') }}</th>
<th>{{ __('insurance_benefits.cash_price') }}</th>
<th>{{ __('insurance_benefits.co_payment') }}</th>
<th>{{ __('insurance.chi_to_pay') }}</th>
<th>{{ __('insurance_benefits.annual_member_limit') }}</th>
<th>{{ __('insurance_benefits.annual_family_limit') }}</th>
</tr>
</thead>
<tbody>
@foreach($benefit_drugs as $record)
@php $items_array = explode(",", $record->item_id); $count = 0; @endphp
@foreach($items_array as $item_id)
@php
$item_details = get_item_insurance_details($item_id, 4, $benefit->id);
if (!$item_details) {continue;}
if ($count > 4) {break;}
$count++;
@endphp
<tr>
<td>{{ $drugs[$item_id] }}</td>
<td>{{ $item_details['authorisation'] == 1 ? 'Yes' : 'No' }}</td>
<td>{{ ugandan_shillings($item_details['cash_price']) }}</td>
<td>{{ ugandan_shillings($item_details['co_payment']) }}</td>
<td>
@php
$chi_to_pay = $item_details['cash_price'] - $item_details['co_payment'];
@endphp
{{ ugandan_shillings($chi_to_pay) }}
</td>
<td>{{ ugandan_shillings($item_details['annual_member_limit']) }}</td>
<td>{{ ugandan_shillings($item_details['annual_family_limit']) }}</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
<hr>
<h4>{{ __('insurance_benefits.sundries') }}</h4>
<table class="table color-bordered-table success-bordered-table item-tables">
<thead>
<tr>
<th>{{ __('insurance_benefits.name') }}</th>
<th>{{ __('insurance_benefits.authorisation') }}</th>
<th>{{ __('insurance_benefits.cash_price') }}</th>
<th>{{ __('insurance_benefits.co_payment') }}</th>
<th>{{ __('insurance.chi_to_pay') }}</th>
<th>{{ __('insurance_benefits.annual_member_limit') }}</th>
<th>{{ __('insurance_benefits.annual_family_limit') }}</th>
</tr>
</thead>
<tbody>
@foreach($benefit_sundries as $record)
@php $items_array = explode(",", $record->item_id); $count = 0; @endphp
@foreach($items_array as $item_id)
@php
$item_details = get_item_insurance_details($item_id, 5, $benefit->id);
if (!$item_details) {continue;}
if ($count > 4) {break;}
$count++;
@endphp
<tr>
<td>{{ $sundries[$item_id] }}</td>
<td>{{ $item_details['authorisation'] == 1 ? 'Yes' : 'No' }}</td>
<td>{{ ugandan_shillings($item_details['cash_price']) }}</td>
<td>{{ ugandan_shillings($item_details['co_payment']) }}</td>
<td>
@php
$chi_to_pay = $item_details['cash_price'] - $item_details['co_payment'];
@endphp
{{ ugandan_shillings($chi_to_pay) }}
</td>
<td>{{ ugandan_shillings($item_details['annual_member_limit']) }}</td>
<td>{{ ugandan_shillings($item_details['annual_family_limit']) }}</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
</div>
<hr>
{{-- end showing benefits belonging to this service --}}
@endforeach
@endif
</div>
<div class="col-md-3"></div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<script>
$('.item-tables').DataTable({
dom: 'Bfrtip',
bInfo: false,
bPaginate: false,
buttons: [
'copy',
{extend: 'csv',
message: '<?php echo $chi_plan->name?> C.H.I Plan',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
sheetName: '<?php echo $chi_plan->name?> C.H.I Plan'
},
{extend: 'excel',
message: '<?php echo $chi_plan->name?> C.H.I Plan',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
sheetName: '<?php echo $chi_plan->name?> C.H.I Plan'
},
{extend: 'pdf',
message: '<?php echo $chi_plan->name?> C.H.I Plan',
orientation: 'portrait',
pageSize: 'LETTER',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
customize: function (doc) {
doc.defaultStyle.fontSize = 10;
// doc.styles.tableHeader.alignment = 'left';
}
},
{extend: 'print',
message: '<?php echo $chi_plan->name?> C.H.I Plan',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
customize: function (win) {
$(win.document.body)
.css('font-size', '10pt')
.css('background', '#fff')
.prepend(
'<img src="<?php echo asset('uploads/logo/logo-sm.png'); ?>" style="position:absolute; top:0; right:0;" />'
);
$(win.document.body).find('table')
.addClass('compact')
.css('font-size', 'inherit');
}
}
]
});
</script>
@endpush