resolved conflicts

This commit is contained in:
2025-03-31 03:46:05 +03:00
6454 changed files with 1520539 additions and 9 deletions
@@ -0,0 +1,39 @@
@if(session()->has('credit_limit_message'))
<div class="modal fade" id="credit_limit_modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
@php $family_account_id = get_patient_family_account_id($patient->id); @endphp
@if($family_account_id != null)
@php
$family_account_details = \Streamline\Models\FamilyAccount::find($family_account_id);
@endphp
<h4 style="color: red">{{ __('patient_finance.this_patient_has_used_more_than_their_credit_limit_of') }} <strong>{{ ugandan_shillings($family_account_details->credit_limit) }}</strong>. {{ session()->get('credit_limit_message') }} </h4>
@endif
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patient_finance.ok') }}</button>
</div>
</div>
</div>
</div>
@php
session()->forget('credit_limit_message');
@endphp
@endif
@push('scripts')
<script type="text/javascript">
$("#credit_limit_modal").modal("show");
</script>
@endpush
@@ -0,0 +1,885 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Customer Statement - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style style="text-css">
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-inside: avoid;
}
.total_div {
page-break-inside: avoid;
}
</style>
</head>
<body>
@php
$total_to_pay = 0;
$total_paid_by_patient = 0;
$total_amount_refunded = 0;
$total_left_to_pay = 0;
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
@endphp
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">
{{ __('patient_finance.customer_episode_statement_from') }} <span style="color: #0000FF">{{ streamline_date($episode->created_at) }}</span>
</h5>
<br>
<table class="table table-sm">
<tr>
<th style="color: black">{{ __('patient_finance.patient_names') }}</th>
<td>{!! insurance_flag($patient->id) !!}</td>
<th style="color: black">{{ __('patient_finance.patient_number') }}</th>
<td>{{ $patient->number }}</td>
<th style="color: black">{{ __('patient_finance.price_list_category') }}</th>
<td>
{{ __('patient_finance.default') }}
</td>
</tr>
<tr>
<th style="color: black">{{ __('patient_finance.patient_discount') }}</th>
<td>
@if(isset($discount->discount))
{{ $discount->discount }} %
@php $discount_percentage = $discount->discount; @endphp
@else
0 %
@php $discount_percentage = 0; @endphp
@endif
</td>
<th style="color: black">{{ __('patient_finance.patient_category') }}</th>
<td>{{ isset($categories[$patient->category_id]) ? $categories[$patient->category_id] : "N/A" }}</td>
<th style="color: black">{{ __('patient_finance.pay_later') }}</th>
<td>
@if(isset($discount->pay_later) && $discount->pay_later == 1)
{{ __('patient_finance.yes') }}
@php $pay_later = 1; @endphp
{{ Form::hidden('patient_category_id', $patient->category_id) }}
@else
{{ __('patient_finance.no') }}
@php $pay_later = 0; @endphp
@endif
</td>
</tr>
</table>
<br>
<div class="row">
@if(count($paid_services) > 0 || count($used_services) > 0 || (!$is_doc_consul_fee_paid && $doc_consultation_id) || count($invoiced_services) > 0)
@php
$total_services_cost = 0;
@endphp
<div class="col">
<h4>{{ __('patient_finance.consultation_and_services') }}</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 60%">{{ __('patient_finance.service') }}</th>
<th>{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php
// for invoices that involve copayment and then create double records, first check
// if they exist in the invoice table with the same time and exclude them from the paid ones
$already_invoiced_services = [];
$already_invoiced_services_times = [];
$already_invoiced_services_episode_id = [];
@endphp
@if(count($invoiced_services) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.invoiced_services') }}</h5></td>
</tr>
@foreach($invoiced_services as $invoice)
<tr>
<td colspan="2"><b>{{ __('patient_finance.invoiced_on') }} {{ streamline_date_time($invoice->created_at) }}</b></td>
</tr>
@php
$already_invoiced_services[] = $invoice->items_ids;
$already_invoiced_services_times[] = $invoice->created_at;
$already_invoiced_services_episode_id[] = $invoice->episode_id;
$items_ids = explode(",", $invoice->items_ids);
$items_amounts = explode(",", $invoice->items_amounts);
$total_paid_by_patient += $invoice->patient_amount;
$total_to_pay += array_sum($items_amounts);
$total_services_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'services') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($paid_services) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.paid_services') }}</h5></td>
</tr>
@foreach($paid_services as $paid_service)
@php
if (in_array($paid_service->items_ids, $already_invoiced_services)) {
// get the key to search the timestamps
$key = array_search($paid_service->items_ids, $already_invoiced_services);
if($already_invoiced_services_times[$key] == $paid_service->created_at && $already_invoiced_services_episode_id[$key] == $paid_service->episode_id) {
// this means that the payments are the same so just get the patient amounts
$total_paid_by_patient += $paid_service->patient_amount_paid;
$total_amount_refunded += $paid_service->refund_amount;
continue;
}
}
@endphp
<tr>
<td colspan="2"><b>{{ __('patient_finance.billed_on') }} {{ streamline_date_time($paid_service->created_at) }}</b></td>
</tr>
@php
$items_ids = explode(",", $paid_service->items_ids);
$items_amounts = explode(",", $paid_service->items_amounts);
$total_paid_by_patient += $paid_service->patient_amount_paid;
$total_amount_refunded += $paid_service->refund_amount;
$total_to_pay += array_sum($items_amounts);
$total_services_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'services') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($used_services) > 0 || (!$is_doc_consul_fee_paid && $doc_consultation_id))
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.unpaid_services') }}</h5></td>
</tr>
@foreach($used_services as $used_service)
@php
$items_ids = explode(",", $used_service->service_id);
$items_quantities = explode(",", $used_service->quantity);
@endphp
@for($i = 0; $i < count($items_ids); $i++)
@php
if ($price_list_id) {
$service_cost = get_price_list_category_price($price_list_id, 6, $items_ids[$i]);
} else {
$service_cost = (int)get_name($items_ids[$i], 'id', 'non_insured_price', 'services');
}
$total_to_pay += ($service_cost * $items_quantities[$i]);
$total_services_cost += ($service_cost * $items_quantities[$i]);
@endphp
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'services') }} <i>(Ordered on {{ streamline_date_time($used_service->created_at) }})</i></td>
<td>{{ ugandan_shillings(($service_cost * $items_quantities[$i])) }}</td>
</tr>
@endfor
@endforeach
@if(!$is_doc_consul_fee_paid && $doc_consultation_id)
@php
if ($price_list_id) {
$service_cost = get_price_list_category_price($price_list_id, 6, $doc_consultation_id);
} else {
$service_cost = (int)get_name($doc_consultation_id, 'id', 'non_insured_price', 'services');
}
$total_to_pay += is_numeric($service_cost) ? $service_cost : 0;
$total_services_cost += is_numeric($service_cost) ? $service_cost : 0;
@endphp
<tr>
<td>{{ get_name($doc_consultation_id, 'id', 'name', 'services') }}</td>
<td>{{ ugandan_shillings($service_cost) }}</td>
</tr>
@endif
@endif
<tr>
<td><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($total_services_cost) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
@if(count($paid_sundries) > 0 || count($ordered_sundries) > 0 || count($invoiced_sundries) > 0)
@php $total_sundries_cost = 0; @endphp
<div class="col">
<h4>{{ __('patient_finance.sundries') }}</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 50%">{{ __('patient_finance.sundry_name') }}</th>
<th style="width: 45%">{{ __('patient_finance.quantity') }}</th>
<th style="width: 45%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php
// for invoices that involve copayment and then create double records, first check
// if they exist in the invoice table with the same time and exclude them from the paid ones
$already_invoiced_sundries = [];
$already_invoiced_sundries_times = [];
$already_invoiced_sundries_episode_id = [];
@endphp
@if(count($invoiced_sundries) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.invoiced_sundries') }}</h5></td>
</tr>
@foreach($invoiced_sundries as $invoice)
<tr>
<td colspan="2"><b>{{ __('patient_finance.invoiced_on') }} {{ streamline_date_time($invoice->created_at) }}</b></td>
</tr>
@php
$already_invoiced_sundries[] = $invoice->items_ids;
$already_invoiced_sundries_times[] = $invoice->created_at;
$already_invoiced_sundries_episode_id[] = $invoice->episode_id;
$items_ids = explode(",", $invoice->items_ids);
$items_amounts = explode(",", $invoice->items_amounts);
$total_paid_by_patient += $invoice->patient_amount;
$total_to_pay += array_sum($items_amounts);
$total_sundries_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'sundries') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($paid_sundries) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.paid_sundries') }}</h5></td>
</tr>
@foreach($paid_sundries as $paid_sundry)
@php
if (in_array($paid_sundry->sundry_items, $already_invoiced_sundries)) {
// get the key to search the timestamps
$key = array_search($paid_sundry->sundry_items, $already_invoiced_sundries);
if($already_invoiced_sundries_times[$key] == $paid_sundry->created_at && $already_invoiced_sundries_episode_id[$key] == $paid_sundry->episode_id) {
// this means that the payments are the same so just get the patient amounts
$total_paid_by_patient += $paid_sundry->patient_amount_paid;
$total_amount_refunded += $paid_sundry->refund_amount;
continue;
}
}
@endphp
<tr>
<td colspan="3"><b>{{ __('patient_finance.billed_on') }} {{ streamline_date_time($paid_sundry->created_at) }}</b></td>
</tr>
@php
$items_ids = explode(",", $paid_sundry->sundry_items);
$items_quantity = explode(",", $paid_sundry->sundry_quantity);
$items_amounts = explode(",", $paid_sundry->sundry_subtotals);
$total_paid_by_patient += $paid_sundry->patient_amount_paid;
$total_amount_refunded += $paid_sundry->refund_amount;
$total_to_pay += array_sum($items_amounts);
$total_sundries_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'sundries') }}</td>
<td>{{ $items_quantity[$i] }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endfor
@endforeach
@endif
@if(count($ordered_sundries) > 0)
<tr>
<td colspan="3" class="text-center"><h5>{{ __('patient_finance.unpaid_sundries') }}</h5></td>
</tr>
@foreach($ordered_sundries as $ordered_sundry)
@php
$sundries_ids = explode(',', $ordered_sundry->sundries_id);
$sundries_quantities = explode(',', $ordered_sundry->quantity);
@endphp
@for($i = 0; $i < count($sundries_ids); $i++)
@php
if ($price_list_id) {
$sundry_cost = get_price_list_category_price($price_list_id, 5, $sundries_ids[$i]) * $sundries_quantities[$i];
} else {
$sundry_cost = get_name($sundries_ids[$i], 'id', 'non_insured_price', 'sundries') * $sundries_quantities[$i];
}
$total_to_pay += $sundry_cost;
$total_sundries_cost += $sundry_cost;
@endphp
<tr>
<td>{{ get_name($sundries_ids[$i], 'id', 'name', 'sundries') }} <i>(Ordered on {{ streamline_date_time($ordered_sundry->created_at) }})</i></td>
<td>{{ $sundries_quantities[$i] }}</td>
<td>{{ ugandan_shillings($sundry_cost) }}</td>
</tr>
@endfor
@endforeach
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($total_sundries_cost) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
</div>
<br>
<div class="row">
@if(count($paid_investigations) > 0 || count($ordered_investigations) > 0 || count($invoiced_investigations) > 0)
@php $total_investigations_cost = 0; @endphp
<div class="col">
<h4>{{ __('patient_finance.investigations') }}</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 50%">{{ __('patient_finance.investigation_name') }}</th>
<th style="width: 45%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php
// for invoices that involve copayment and then create double records, first check
// if they exist in the invoice table with the same time and exclude them from the paid ones
$already_invoiced_investigations = [];
$already_invoiced_investigations_times = [];
$already_invoiced_investigations_episode_id = [];
@endphp
@if(count($invoiced_investigations) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.invoiced_investigations') }}</h5></td>
</tr>
@foreach($invoiced_investigations as $invoice)
<tr>
<td colspan="2"><b>{{ __('patient_finance.invoiced_on') }} {{ streamline_date_time($invoice->created_at) }}</b></td>
</tr>
@php
$already_invoiced_investigations[] = $invoice->items_ids;
$already_invoiced_investigations_times[] = $invoice->created_at;
$already_invoiced_investigations_episode_id[] = $invoice->episode_id;
$items_ids = explode(",", $invoice->items_ids);
$items_amounts = explode(",", $invoice->items_amounts);
$total_paid_by_patient += $invoice->patient_amount;
$total_to_pay += array_sum($items_amounts);
$total_investigations_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'investigations') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($paid_investigations) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.paid_investigations') }}</h5></td>
</tr>
@foreach($paid_investigations as $paid_investigation)
@php
if (in_array($paid_investigation->investigation_items, $already_invoiced_investigations)) {
// get the key to search the timestamps
$key = array_search($paid_investigation->investigation_items, $already_invoiced_investigations);
if($already_invoiced_investigations_times[$key] == $paid_investigation->created_at && $already_invoiced_investigations_episode_id[$key] == $paid_investigation->episode_id) {
// this means that the payments are the same so just get the patient amounts
$total_paid_by_patient += $paid_investigation->patient_amount_paid;
$total_amount_refunded += $paid_investigation->refund_amount;
continue;
}
}
@endphp
<tr>
<td colspan="2"><b>{{ __('patient_finance.billed_on') }} {{ streamline_date_time($paid_investigation->created_at) }}</b></td>
</tr>
@php
$items_ids = explode(",", $paid_investigation->investigation_items);
$items_amounts = explode(",", $paid_investigation->investigation_amounts);
$total_paid_by_patient += $paid_investigation->patient_amount_paid;
$total_amount_refunded += $paid_investigation->refund_amount;
$total_to_pay += array_sum($items_amounts);
$total_investigations_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'investigations') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($ordered_investigations) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.unpaid_investigations') }}</h5></td>
</tr>
@foreach($ordered_investigations as $ordered_investigation)
<tr>
<td colspan="2"><b>{{ __('patient_finance.ordered_on') }} {{ streamline_date_time($ordered_investigation->created_at) }}</b></td>
</tr>
@php
$items_ids = explode(",", $ordered_investigation->investigation_id);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@php
if ($price_list_id) {
$investigation_cost = get_price_list_category_price($price_list_id, 2, $items_ids[$i]);
} else {
$investigation_cost = get_name($items_ids[$i], 'id', 'non_insured_price', 'investigations');
}
$total_to_pay += $investigation_cost;
$total_investigations_cost += $investigation_cost;
@endphp
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'investigations') }}</td>
<td>{{ ugandan_shillings($investigation_cost) }}</td>
</tr>
@endfor
@endforeach
@endif
<tr>
<td><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($total_investigations_cost) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
@if(count($paid_treatments) > 0 || count($treatments) > 0 || count($invoiced_treatments) > 0)
@php $total_treatment_cost = 0; @endphp
<div class="col">
<h4>{{ __('patient_finance.drugs') }}</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 50%">{{ __('patient_finance.drug_name') }}</th>
<th style="width: 45%">{{ __('patient_finance.quantity') }}</th>
<th style="width: 45%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php
// for invoices that involve copayment and then create double records, first check
// if they exist in the invoice table with the same time and exclude them from the paid ones
$already_invoiced_treatments = [];
$already_invoiced_treatments_times = [];
$already_invoiced_treatments_episode_id = [];
@endphp
@if(count($invoiced_treatments) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.invoiced_drugs') }}</h5></td>
</tr>
@foreach($invoiced_treatments as $invoice)
<tr>
<td colspan="2"><b>{{ __('patient_finance.invoiced_on') }} {{ streamline_date_time($invoice->created_at) }}</b></td>
</tr>
@php
$already_invoiced_treatments[] = $invoice->items_ids;
$already_invoiced_treatments_times[] = $invoice->created_at;
$already_invoiced_treatments_episode_id[] = $invoice->episode_id;
$items_ids = explode(",", $invoice->items_ids);
$items_amounts = explode(",", $invoice->items_amounts);
$total_paid_by_patient += $invoice->patient_amount;
$total_to_pay += array_sum($items_amounts);
$total_treatment_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'drugs') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($paid_treatments) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.paid_drugs') }}</h5></td>
</tr>
@foreach($paid_treatments as $paid_treatment)
@php
if (in_array($paid_treatment->treatment_items, $already_invoiced_treatments)) {
// get the key to search the timestamps
$key = array_search($paid_treatment->treatment_items, $already_invoiced_treatments);
if($already_invoiced_treatments_times[$key] == $paid_treatment->created_at && $already_invoiced_treatments_episode_id[$key] == $paid_treatment->episode_id) {
// this means that the payments are the same so just get the patient amounts
$total_paid_by_patient += $paid_treatment->patient_amount_paid;
$total_amount_refunded += $paid_treatment->refund_amount;
continue;
}
}
@endphp
<tr>
<td colspan="3"><b>{{ __('patient_finance.billed_on') }} {{ streamline_date_time($paid_treatment->created_at) }}</b></td>
</tr>
@php
$items_ids = explode(",", $paid_treatment->treatment_items);
$items_quantity = explode(",", $paid_treatment->treatment_quantities);
$items_amounts = explode(",", $paid_treatment->treatment_subtotals);
$total_paid_by_patient += $paid_treatment->patient_amount_paid;
$total_amount_refunded += $paid_treatment->refund_amount;
$total_to_pay += array_sum($items_amounts);
$total_treatment_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'drugs') }}</td>
<td>{{ $items_quantity[$i] }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endfor
@endforeach
@endif
@if(count($treatments) > 0)
<tr>
<td colspan="3" class="text-center"><h5>{{ __('patient_finance.unpaid_drugs') }}</h5></td>
</tr>
@foreach($treatments as $treatment)
<tr>
<td colspan="3"><b>{{ __('patient_finance.ordered_on') }} {{ streamline_date_time($treatment->created_at) }}</b></td>
</tr>
@php
$items_ids = explode(",", $treatment->drugs);
$items_quantities = explode(",", $treatment->quantities_dispensed);
$purchased_elsewhere = is_null($treatment->purchased_elsewhere) ? [] : explode(",", $treatment->purchased_elsewhere);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@php
if ($price_list_id) {
$drug_cost = get_price_list_category_price($price_list_id, 3, $items_ids[$i]) * $items_quantities[$i];
} else {
$drug_cost = get_name($items_ids[$i], 'id', 'non_insured_price', 'drugs') * $items_quantities[$i];
}
if(!(count($purchased_elsewhere) > 0 && isset($purchased_elsewhere[$i]) && $purchased_elsewhere[$i] == 1)) {
$total_to_pay += $drug_cost;
$total_treatment_cost += $drug_cost;
}
@endphp
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'drugs') }}</td>
<td>{{ $items_quantities[$i] }}</td>
@if(!(count($purchased_elsewhere) > 0 && isset($purchased_elsewhere[$i]) && $purchased_elsewhere[$i] == 1))
<td>{{ ugandan_shillings($drug_cost) }}</td>
@else
<td>{{ __('patient_finance.purchased_from_else_where') }}</td>
@endif
</tr>
@endfor
@endforeach
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($total_treatment_cost) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
</div>
<br>
<div class="row">
@if(count($paid_procedures) > 0 || count($ordered_procedures) > 0 || count($invoiced_procedures) > 0)
@php $total_procedures_cost = 0; @endphp
<div class="col">
<h4>{{ __('patient_finance.procedures') }}</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 60%">{{ __('patient_finance.procedure_name') }}</th>
<th style="width: 40%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php
// for invoices that involve copayment and then create double records, first check
// if they exist in the invoice table with the same time and exclude them from the paid ones
$already_invoiced_procedures = [];
$already_invoiced_procedures_times = [];
$already_invoiced_procedures_episode_id = [];
@endphp
@if(count($invoiced_procedures) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.invoiced_procedures') }}</h5></td>
</tr>
@foreach($invoiced_procedures as $invoice)
<tr>
<td colspan="2"><b>{{ __('patient_finance.invoiced_on') }} {{ streamline_date_time($invoice->created_at) }}</b></td>
</tr>
@php
$already_invoiced_procedures[] = $invoice->items_ids;
$already_invoiced_procedures_times[] = $invoice->created_at;
$already_invoiced_procedures_episode_id[] = $invoice->episode_id;
$items_ids = explode(",", $invoice->items_ids);
$items_amounts = explode(",", $invoice->items_amounts);
$total_paid_by_patient += $invoice->patient_amount;
$total_to_pay += array_sum($items_amounts);
$total_procedures_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'procedures') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($paid_procedures) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.paid_procedures') }}</h5></td>
</tr>
@foreach($paid_procedures as $paid_procedure)
@php
if (in_array($paid_procedure->procedure_items, $already_invoiced_procedures)) {
// get the key to search the timestamps
$key = array_search($paid_procedure->procedure_items, $already_invoiced_procedures);
if($already_invoiced_procedures_times[$key] == $paid_procedure->created_at && $already_invoiced_procedures_episode_id[$key] == $paid_procedure->episode_id) {
// this means that the payments are the same so just get the patient amounts
$total_paid_by_patient += $paid_procedure->patient_amount_paid;
$total_amount_refunded += $paid_procedure->refund_amount;
continue;
}
}
@endphp
<tr>
<td colspan="2"><b>{{ __('patient_finance.billed_on') }} {{ streamline_date_time($paid_procedure->created_at) }}</b></td>
</tr>
@php
$items_ids = explode(",", $paid_procedure->procedure_items);
$items_amounts = explode(",", $paid_procedure->procedure_amounts);
$total_paid_by_patient += $paid_procedure->patient_amount_paid;
$total_amount_refunded += $paid_procedure->refund_amount;
$total_to_pay += array_sum($items_amounts);
$total_procedures_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'procedures') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($ordered_procedures) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.unpaid_procedures') }}</h5></td>
</tr>
@foreach($ordered_procedures as $ordered_procedure)
@php
if ($price_list_id) {
$procedure_cost = get_price_list_category_price($price_list_id, 4, $ordered_procedure->procedure_id);
} else {
$procedure_cost = get_name($ordered_procedure->procedure_id, 'id', 'non_insured_price', 'procedures');
}
$total_to_pay += $procedure_cost;
$total_procedures_cost += $procedure_cost;
@endphp
<tr>
<td>{{ get_name($ordered_procedure->procedure_id, 'id', 'name', 'procedures') }} <i>(Ordered on {{ streamline_date_time($ordered_procedure->created_at) }})</i></td>
<td>{{ ugandan_shillings($procedure_cost) }}</td>
</tr>
@endforeach
@endif
<tr>
<td><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($total_procedures_cost) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
@if(count($inpatient_deposits) > 0)
@php $total_inpatient_deposits = 0; @endphp
<div class="col">
<h4>{{ __('patient_finance.inpatient_deposits') }}</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 60%">{{ __('patient_finance.received_on') }}</th>
<th style="width: 40%">{{ __('patient_finance.patient_amount') }}</th>
</tr>
</thead>
<tbody>
@foreach($inpatient_deposits as $deposit)
@php
$total_paid_by_patient += $deposit->patient_amount_paid;
//$total_to_pay += $deposit->patient_amount_paid;
$total_inpatient_deposits += $deposit->patient_amount_paid;
@endphp
<tr>
<td>{{ streamline_date_time($deposit->created_at) }}</td>
<td>{{ ugandan_shillings($deposit->patient_amount_paid) }}</td>
</tr>
@endforeach
<tr>
<td><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($total_inpatient_deposits) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
</div>
<br>
<div class="row">
@if($inpatient_to_pay > 0)
<div class="col">
<h4>{{ __('patient_finance.inpatient_bills') }}</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 60%">{{ __('patient_finance.total') }}</th>
<th style="width: 40%">{{ __('patient_finance.patient_amount') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td><b></b></td>
@php $total_to_pay += $inpatient_to_pay; @endphp
<td>{{ ugandan_shillings($inpatient_to_pay) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
@if(count($patient_debts) > 0)
<div class="col">
<h4>{{ __('patient_finance.patient_debts') }}</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 60%">{{ __('patient_finance.incurred_from') }}</th>
<th style="width: 40%">{{ __('patient_finance.amount_to_pay') }}</th>
<th style="width: 40%">{{ __('patient_finance.amount_paid') }}</th>
<th style="width: 40%">{{ __('patient_finance.balance') }}</th>
</tr>
</thead>
<tbody>
@foreach($patient_debts as $debt)
<tr>
<td>{{ get_name($debt->tag_id, 'id', 'name', 'finance_point_tags') }} <i>({{ streamline_date_time($debt->created_at) }})</i></td>
<td>{{ ugandan_shillings($debt->balance) }}</td>
<td>{{ ugandan_shillings($debt->amount_paid_off) }}</td>
<td>
@if(!is_null($debt->balance_remaining))
@php $total_paid_by_patient += $debt->amount_paid_off; @endphp
{{ ugandan_shillings($debt->balance_remaining) }}
@else
{{ ugandan_shillings($debt->balance) }}
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
</div>
<div class="row total_div">
<div class="col m-r">
<b>{{ __('patient_finance.total_to_pay') }}</b>
<br>
{{ ugandan_shillings($total_to_pay) }}
</div>
<div class="col">
<b>{{ __('patient_finance.total_paid_by_the_patient') }}</b>
<br>
{{ ugandan_shillings($total_paid_by_patient) }}
</div>
<div class="col">
<b>{{ __('patient_finance.total_amount_refunded') }}</b>
<br>
{{ ugandan_shillings($total_amount_refunded) }}
</div>
<div class="col">
<b>{{ __('patient_finance.total_left_to_pay') }}</b>
<br>
@php
$total_left_to_pay = $total_to_pay - ($total_paid_by_patient + $total_amount_refunded);
@endphp
{{ ugandan_shillings($total_left_to_pay) }}
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,889 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Customer Statement - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style style="text-css">
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-inside: avoid;
}
.total_div {
page-break-inside: avoid;
}
</style>
</head>
<body>
@php
$total_to_pay = 0;
$total_paid_by_patient = 0;
$total_amount_refunded = 0;
$total_left_to_pay = 0;
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
@endphp
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">
Customer Statement
</h5>
<br>
<table class="table table-sm">
<tr>
<th style="color: black">{{ __('patient_finance.patient_names') }}</th>
<td>{!! insurance_flag($patient->id) !!}</td>
<th style="color: black">{{ __('patient_finance.patient_number') }}</th>
<td>{{ $patient->number }}</td>
<th style="color: black">{{ __('patient_finance.price_list_category') }}</th>
<td>
{{ __('patient_finance.default') }}
</td>
</tr>
<tr>
<th style="color: black">{{ __('patient_finance.patient_discount') }}</th>
<td>
@if(isset($discount->discount))
{{ $discount->discount }} %
@php $discount_percentage = $discount->discount; @endphp
@else
0 %
@php $discount_percentage = 0; @endphp
@endif
</td>
<th style="color: black">{{ __('patient_finance.patient_category') }}</th>
<td>{{ isset($categories[$patient->category_id]) ? $categories[$patient->category_id] : "N/A" }}</td>
<th style="color: black">{{ __('patient_finance.pay_later') }}</th>
<td>
@if(isset($discount->pay_later) && $discount->pay_later == 1)
{{ __('patient_finance.yes') }}
@php $pay_later = 1; @endphp
{{ Form::hidden('patient_category_id', $patient->category_id) }}
@else
{{ __('patient_finance.no') }}
@php $pay_later = 0; @endphp
@endif
</td>
</tr>
</table>
<br>
<div class="row">
@if(count($paid_services) > 0 || count($used_services) > 0 || (count($doc_consultation_id) > 0 && !is_null($doc_consultation_id[0])) || count($invoiced_services) > 0)
@php
$total_services_cost = 0;
@endphp
<div class="col">
<h4>{{ __('patient_finance.consultation_and_services') }}</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 60%">{{ __('patient_finance.service') }}</th>
<th>{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php
// for invoices that involve copayment and then create double records, first check
// if they exist in the invoice table with the same time and exclude them from the paid ones
$already_invoiced_services = [];
$already_invoiced_services_times = [];
$already_invoiced_services_episode_id = [];
@endphp
@if(count($invoiced_services) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.invoiced_services') }}</h5></td>
</tr>
@foreach($invoiced_services as $invoice)
<tr>
<td colspan="2"><b>{{ __('patient_finance.invoiced_on') }} {{ streamline_date_time($invoice->created_at) }}</b></td>
</tr>
@php
$items_ids = explode(",", $invoice->items_ids);
$items_amounts = explode(",", $invoice->items_amounts);
$total_paid_by_patient += $invoice->patient_amount;
$total_to_pay += array_sum($items_amounts);
$total_services_cost += array_sum($items_amounts);
$already_invoiced_services[] = $invoice->items_ids;
$already_invoiced_services_times[] = $invoice->created_at;
$already_invoiced_services_episode_id[] = $invoice->episode_id;
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'services') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($paid_services) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.paid_services') }}</h5></td>
</tr>
@foreach($paid_services as $paid_service)
@php
if (in_array($paid_service->items_ids, $already_invoiced_services)) {
// get the key to search the timestamps
$key = array_search($paid_service->items_ids, $already_invoiced_services);
if($already_invoiced_services_times[$key] == $paid_service->created_at && $already_invoiced_services_episode_id[$key] == $paid_service->episode_id) {
// this means that the payments are the same so just get the patient amounts
$total_paid_by_patient += $paid_service->patient_amount_paid;
$total_amount_refunded += $paid_service->refund_amount;
continue;
}
}
@endphp
<tr>
<td colspan="2"><b>{{ __('patient_finance.billed_on') }} {{ streamline_date_time($paid_service->created_at) }}</b></td>
</tr>
@php
$items_ids = explode(",", $paid_service->items_ids);
$items_amounts = explode(",", $paid_service->items_amounts);
$total_paid_by_patient += $paid_service->patient_amount_paid;
$total_amount_refunded += $paid_service->refund_amount;
$total_to_pay += array_sum($items_amounts);
$total_services_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'services') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($used_services) > 0 || (count($doc_consultation_id) > 0 && !is_null($doc_consultation_id[0])))
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.unpaid_services') }}</h5></td>
</tr>
@foreach($used_services as $used_service)
@php
$items_ids = explode(",", $used_service->service_id);
$items_quantities = explode(",", $used_service->quantity);
@endphp
@for($i = 0; $i < count($items_ids); $i++)
@php
if ($price_list_id) {
$service_cost = get_price_list_category_price($price_list_id, 6, $items_ids[$i]);
} else {
$service_cost = (int)get_name($items_ids[$i], 'id', 'non_insured_price', 'services');
}
$total_to_pay += ($service_cost * $items_quantities[$i]);
$total_services_cost += ($service_cost * $items_quantities[$i]);
@endphp
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'services') }} <i>(Ordered on {{ streamline_date_time($used_service->created_at) }})</i></td>
<td>{{ ugandan_shillings(($service_cost * $items_quantities[$i])) }}</td>
</tr>
@endfor
@endforeach
@if(count($doc_consultation_id) > 0 && !is_null($doc_consultation_id[0]))
@foreach($doc_consultation_id as $doc_consul_id)
@php
if ($price_list_id) {
$service_cost = get_price_list_category_price($price_list_id, 6, $doc_consul_id);
} else {
$service_cost = (int)get_name($doc_consul_id, 'id', 'non_insured_price', 'services');
}
$total_to_pay += is_numeric($service_cost) ? $service_cost : 0;
$total_services_cost += is_numeric($service_cost) ? $service_cost : 0;
@endphp
<tr>
<td>{{ get_name($doc_consul_id, 'id', 'name', 'services') }}</td>
<td>{{ ugandan_shillings($service_cost) }}</td>
</tr>
@endforeach
@endif
@endif
<tr>
<td><b>Total</b></td>
<td>{{ ugandan_shillings($total_services_cost) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
@if(count($paid_sundries) > 0 || count($ordered_sundries) > 0 || count($invoiced_sundries) > 0)
@php $total_sundries_cost = 0; @endphp
<div class="col">
<h4>Sundries</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 50%">{{ __('patient_finance.sundry_name') }}</th>
<th style="width: 45%">{{ __('patient_finance.quantity') }}</th>
<th style="width: 45%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php
// for invoices that involve copayment and then create double records, first check
// if they exist in the invoice table with the same time and exclude them from the paid ones
$already_invoiced_sundries = [];
$already_invoiced_sundries_times = [];
$already_invoiced_sundries_episode_id = [];
@endphp
@if(count($invoiced_sundries) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.invoiced_sundries') }}</h5></td>
</tr>
@foreach($invoiced_sundries as $invoice)
<tr>
<td colspan="2"><b>{{ __('patient_finance.invoiced_on') }} {{ streamline_date_time($invoice->created_at) }}</b></td>
</tr>
@php
$already_invoiced_sundries[] = $invoice->items_ids;
$already_invoiced_sundries_times[] = $invoice->created_at;
$already_invoiced_sundries_episode_id[] = $invoice->episode_id;
$items_ids = explode(",", $invoice->items_ids);
$items_amounts = explode(",", $invoice->items_amounts);
$total_paid_by_patient += $invoice->patient_amount;
$total_to_pay += array_sum($items_amounts);
$total_sundries_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'sundries') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($paid_sundries) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.paid_sundries') }}</h5></td>
</tr>
@foreach($paid_sundries as $paid_sundry)
@php
if (in_array($paid_sundry->sundry_items, $already_invoiced_sundries)) {
// get the key to search the timestamps
$key = array_search($paid_sundry->sundry_items, $already_invoiced_sundries);
if($already_invoiced_sundries_times[$key] == $paid_sundry->created_at && $already_invoiced_sundries_episode_id[$key] == $paid_sundry->episode_id) {
// this means that the payments are the same so just get the patient amounts
$total_paid_by_patient += $paid_sundry->patient_amount_paid;
$total_amount_refunded += $paid_sundry->refund_amount;
continue;
}
}
@endphp
<tr>
<td colspan="3"><b>{{ __('patient_finance.billed_on') }} {{ streamline_date_time($paid_sundry->created_at) }}</b></td>
</tr>
@php
$items_ids = explode(",", $paid_sundry->sundry_items);
$items_quantity = explode(",", $paid_sundry->sundry_quantity);
$items_amounts = explode(",", $paid_sundry->sundry_subtotals);
$total_paid_by_patient += $paid_sundry->patient_amount_paid;
$total_amount_refunded += $paid_sundry->refund_amount;
$total_to_pay += array_sum($items_amounts);
$total_sundries_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'sundries') }}</td>
<td>{{ $items_quantity[$i] }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endfor
@endforeach
@endif
@if(count($ordered_sundries) > 0)
<tr>
<td colspan="3" class="text-center"><h5>{{ __('patient_finance.unpaid_sundries') }}</h5></td>
</tr>
@foreach($ordered_sundries as $ordered_sundry)
@php
$sundries_ids = explode(',', $ordered_sundry->sundries_id);
$sundries_quantities = explode(',', $ordered_sundry->quantity);
@endphp
@for($i = 0; $i < count($sundries_ids); $i++)
@php
if ($price_list_id) {
$sundry_cost = get_price_list_category_price($price_list_id, 5, $sundries_ids[$i]) * $sundries_quantities[$i];
} else {
$sundry_cost = get_name($sundries_ids[$i], 'id', 'non_insured_price', 'sundries') * $sundries_quantities[$i];
}
$total_to_pay += $sundry_cost;
$total_sundries_cost += $sundry_cost;
@endphp
<tr>
<td>{{ get_name($sundries_ids[$i], 'id', 'name', 'sundries') }} <i>(Ordered on {{ streamline_date_time($ordered_sundry->created_at) }})</i></td>
<td>{{ $sundries_quantities[$i] }}</td>
<td>{{ ugandan_shillings($sundry_cost) }}</td>
</tr>
@endfor
@endforeach
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($total_sundries_cost) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
</div>
<br>
<div class="row">
@if(count($paid_investigations) > 0 || count($ordered_investigations) > 0 || count($invoiced_investigations) > 0)
@php $total_investigations_cost = 0; @endphp
<div class="col">
<h4>{{ __('patient_finance.investigations') }}</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 50%">{{ __('patient_finance.investigation_name') }}</th>
<th style="width: 45%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php
// for invoices that involve copayment and then create double records, first check
// if they exist in the invoice table with the same time and exclude them from the paid ones
$already_invoiced_investigations = [];
$already_invoiced_investigations_times = [];
$already_invoiced_investigations_episode_id = [];
@endphp
@if(count($invoiced_investigations) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.invoiced_investigations') }}</h5></td>
</tr>
@foreach($invoiced_investigations as $invoice)
<tr>
<td colspan="2"><b>{{ __('patient_finance.invoiced_on') }} {{ streamline_date_time($invoice->created_at) }}</b></td>
</tr>
@php
$already_invoiced_investigations[] = $invoice->items_ids;
$already_invoiced_investigations_times[] = $invoice->created_at;
$already_invoiced_investigations_episode_id[] = $invoice->episode_id;
$items_ids = explode(",", $invoice->items_ids);
$items_amounts = explode(",", $invoice->items_amounts);
$total_paid_by_patient += $invoice->patient_amount;
$total_to_pay += array_sum($items_amounts);
$total_services_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'investigations') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($paid_investigations) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.paid_investigations') }}</h5></td>
</tr>
@foreach($paid_investigations as $paid_investigation)
@php
if (in_array($paid_investigation->investigation_items, $already_invoiced_investigations)) {
// get the key to search the timestamps
$key = array_search($paid_investigation->investigation_items, $already_invoiced_investigations);
if($already_invoiced_investigations_times[$key] == $paid_investigation->created_at && $already_invoiced_investigations_episode_id[$key] == $paid_investigation->episode_id) {
// this means that the payments are the same so just get the patient amounts
$total_paid_by_patient += $paid_investigation->patient_amount_paid;
$total_amount_refunded += $paid_investigation->refund_amount;
continue;
}
}
@endphp
<tr>
<td colspan="2"><b>{{ __('patient_finance.billed_on') }} {{ streamline_date_time($paid_investigation->created_at) }}</b></td>
</tr>
@php
$items_ids = explode(",", $paid_investigation->investigation_items);
$items_amounts = explode(",", $paid_investigation->investigation_amounts);
$total_paid_by_patient += $paid_investigation->patient_amount_paid;
$total_amount_refunded += $paid_investigation->refund_amount;
$total_to_pay += array_sum($items_amounts);
$total_investigations_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'investigations') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($ordered_investigations) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.unpaid_investigations') }}</h5></td>
</tr>
@foreach($ordered_investigations as $ordered_investigation)
<tr>
<td colspan="2"><b>Ordered On {{ streamline_date_time($ordered_investigation->created_at) }}</b></td>
</tr>
@php
$items_ids = explode(",", $ordered_investigation->investigation_id);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@php
if ($price_list_id) {
$investigation_cost = get_price_list_category_price($price_list_id, 2, $items_ids[$i]);
} else {
$investigation_cost = (int)get_name($items_ids[$i], 'id', 'non_insured_price', 'investigations');
}
$total_to_pay += $investigation_cost;
$total_investigations_cost += $investigation_cost;
@endphp
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'investigations') }}</td>
<td>{{ ugandan_shillings($investigation_cost) }}</td>
</tr>
@endfor
@endforeach
@endif
<tr>
<td><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($total_investigations_cost) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
@if(count($paid_treatments) > 0 || count($treatments) > 0 || count($invoiced_treatments) > 0)
@php $total_treatment_cost = 0; @endphp
<div class="col">
<h4>{{ __('patient_finance.drugs') }}</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 50%">{{ __('patient_finance.drug_name') }}</th>
<th style="width: 45%">{{ __('patient_finance.quantity') }}</th>
<th style="width: 45%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php
// for invoices that involve copayment and then create double records, first check
// if they exist in the invoice table with the same time and exclude them from the paid ones
$already_invoiced_treatments = [];
$already_invoiced_treatments_times = [];
$already_invoiced_treatments_episode_id = [];
@endphp
@if(count($invoiced_treatments) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.invoiced_drugs') }}</h5></td>
</tr>
@foreach($invoiced_treatments as $invoice)
<tr>
<td colspan="2"><b>{{ __('patient_finance.invoiced_on') }} {{ streamline_date_time($invoice->created_at) }}</b></td>
</tr>
@php
$already_invoiced_treatments[] = $invoice->items_ids;
$already_invoiced_treatments_times[] = $invoice->created_at;
$already_invoiced_treatments_episode_id[] = $invoice->episode_id;
$items_ids = explode(",", $invoice->items_ids);
$items_amounts = explode(",", $invoice->items_amounts);
$total_paid_by_patient += $invoice->patient_amount;
$total_to_pay += array_sum($items_amounts);
$total_services_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'drugs') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($paid_treatments) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.paid_drugs') }}</h5></td>
</tr>
@foreach($paid_treatments as $paid_treatment)
@php
if (in_array($paid_treatment->treatment_items, $already_invoiced_treatments)) {
// get the key to search the timestamps
$key = array_search($paid_treatment->treatment_items, $already_invoiced_treatments);
if($already_invoiced_treatments_times[$key] == $paid_treatment->created_at && $already_invoiced_treatments_episode_id[$key] == $paid_treatment->episode_id) {
// this means that the payments are the same so just get the patient amounts
$total_paid_by_patient += $paid_treatment->patient_amount_paid;
$total_amount_refunded += $paid_treatment->refund_amount;
continue;
}
}
@endphp
<tr>
<td colspan="3"><b>{{ __('patient_finance.billed_on') }} {{ streamline_date_time($paid_treatment->created_at) }}</b></td>
</tr>
@php
$items_ids = explode(",", $paid_treatment->treatment_items);
$items_quantity = explode(",", $paid_treatment->treatment_quantities);
$items_amounts = explode(",", $paid_treatment->treatment_subtotals);
$total_paid_by_patient += $paid_treatment->patient_amount_paid;
$total_amount_refunded += $paid_treatment->refund_amount;
$total_to_pay += array_sum($items_amounts);
$total_treatment_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'drugs') }}</td>
<td>{{ $items_quantity[$i] }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endfor
@endforeach
@endif
@if(count($treatments) > 0)
<tr>
<td colspan="3" class="text-center"><h5>{{ __('patient_finance.unpaid_drugs') }}</h5></td>
</tr>
@foreach($treatments as $treatment)
<tr>
<td colspan="3"><b>{{ __('patient_finance.ordered_on') }} {{ streamline_date_time($treatment->created_at) }}</b></td>
</tr>
@php
$items_ids = explode(",", $treatment->drugs);
$items_quantities = explode(",", $treatment->quantities_dispensed);
$purchased_elsewhere = is_null($treatment->purchased_elsewhere) ? [] : explode(",", $treatment->purchased_elsewhere);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@php
if ($price_list_id) {
$drug_cost = get_price_list_category_price($price_list_id, 3, $items_ids[$i]) * $items_quantities[$i];
} else {
$drug_cost = (int)get_name($items_ids[$i], 'id', 'non_insured_price', 'drugs') * $items_quantities[$i];
}
if(!(count($purchased_elsewhere) > 0 && isset($purchased_elsewhere[$i]) && $purchased_elsewhere[$i] == 1)) {
$total_to_pay += $drug_cost;
$total_treatment_cost += $drug_cost;
}
@endphp
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'drugs') }}</td>
<td>{{ $items_quantities[$i] }}</td>
@if(!(count($purchased_elsewhere) > 0 && isset($purchased_elsewhere[$i]) && $purchased_elsewhere[$i] == 1))
<td>{{ ugandan_shillings($drug_cost) }}</td>
@else
<td>{{ __('patient_finance.purchased_from_else_where') }}</td>
@endif
</tr>
@endfor
@endforeach
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($total_treatment_cost) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
</div>
<br>
<div class="row">
@if(count($paid_procedures) > 0 || count($ordered_procedures) > 0 || count($invoiced_procedures) > 0)
@php $total_procedures_cost = 0; @endphp
<div class="col">
<h4>{{ __('patient_finance.procedures') }}</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 60%">{{ __('patient_finance.procedure_name') }}</th>
<th style="width: 40%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php
// for invoices that involve copayment and then create double records, first check
// if they exist in the invoice table with the same time and exclude them from the paid ones
$already_invoiced_procedures = [];
$already_invoiced_procedures_times = [];
$already_invoiced_procedures_episode_id = [];
@endphp
@if(count($invoiced_procedures) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.invoiced_procedures') }}</h5></td>
</tr>
@foreach($invoiced_procedures as $invoice)
<tr>
<td colspan="2"><b>{{ __('patient_finance.invoiced_on') }} {{ streamline_date_time($invoice->created_at) }}</b></td>
</tr>
@php
$already_invoiced_procedures[] = $invoice->items_ids;
$already_invoiced_procedures_times[] = $invoice->created_at;
$already_invoiced_procedures_episode_id[] = $invoice->episode_id;
$items_ids = explode(",", $invoice->items_ids);
$items_amounts = explode(",", $invoice->items_amounts);
$total_paid_by_patient += $invoice->patient_amount;
$total_to_pay += array_sum($items_amounts);
$total_services_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'procedures') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($paid_procedures) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.paid_procedures') }}</h5></td>
</tr>
@foreach($paid_procedures as $paid_procedure)
@php
if (in_array($paid_procedure->procedure_items, $already_invoiced_procedures)) {
// get the key to search the timestamps
$key = array_search($paid_procedure->procedure_items, $already_invoiced_procedures);
if($already_invoiced_procedures_times[$key] == $paid_procedure->created_at && $already_invoiced_procedures_episode_id[$key] == $paid_procedure->episode_id) {
// this means that the payments are the same so just get the patient amounts
$total_paid_by_patient += $paid_procedure->patient_amount_paid;
$total_amount_refunded += $paid_procedure->refund_amount;
continue;
}
}
@endphp
<tr>
<td colspan="2"><b>{{ __('patient_finance.billed_on') }} {{ streamline_date_time($paid_procedure->created_at) }}</b></td>
</tr>
@php
$items_ids = explode(",", $paid_procedure->procedure_items);
$items_amounts = explode(",", $paid_procedure->procedure_amounts);
$total_paid_by_patient += $paid_procedure->patient_amount_paid;
$total_amount_refunded += $paid_procedure->refund_amount;
$total_to_pay += array_sum($items_amounts);
$total_procedures_cost += array_sum($items_amounts);
@endphp
@for($i=0; $i < count($items_ids); $i++)
@if(isset($items_ids[$i]) && $items_ids[$i] != 0)
<tr>
<td>{{ get_name($items_ids[$i], 'id', 'name', 'procedures') }}</td>
<td>{{ ugandan_shillings($items_amounts[$i]) }}</td>
</tr>
@endif
@endfor
@endforeach
@endif
@if(count($ordered_procedures) > 0)
<tr>
<td colspan="2" class="text-center"><h5>{{ __('patient_finance.unpaid_procedures') }}</h5></td>
</tr>
@foreach($ordered_procedures as $ordered_procedure)
@php
if ($price_list_id) {
$procedure_cost = get_price_list_category_price($price_list_id, 4, $ordered_procedure->procedure_id);
} else {
$procedure_cost = (int)get_name($ordered_procedure->procedure_id, 'id', 'non_insured_price', 'procedures');
}
$total_to_pay += $procedure_cost;
$total_procedures_cost += $procedure_cost;
@endphp
<tr>
<td>{{ get_name($ordered_procedure->procedure_id, 'id', 'name', 'procedures') }} <i>({{ __('patient_finance.ordered_on') }} {{ streamline_date_time($ordered_procedure->created_at) }})</i></td>
<td>{{ ugandan_shillings($procedure_cost) }}</td>
</tr>
@endforeach
@endif
<tr>
<td><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($total_procedures_cost) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
@if(count($inpatient_deposits) > 0)
@php $total_inpatient_deposits = 0; @endphp
<div class="col">
<h4>{{ __('patient_finance.inpatient_deposits') }}</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 60%">{{ __('patient_finance.received_on') }}</th>
<th style="width: 40%">{{ __('patient_finance.patient_amount') }}</th>
</tr>
</thead>
<tbody>
@foreach($inpatient_deposits as $deposit)
@php
$total_paid_by_patient += $deposit->patient_amount_paid;
//$total_to_pay += $deposit->patient_amount_paid;
$total_inpatient_deposits += $deposit->patient_amount_paid;
@endphp
<tr>
<td>{{ streamline_date_time($deposit->created_at) }}</td>
<td>{{ ugandan_shillings($deposit->patient_amount_paid) }}</td>
</tr>
@endforeach
<tr>
<td><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($total_inpatient_deposits) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
</div>
<br>
<div class="row">
@if($inpatient_to_pay > 0)
<div class="col">
<h4>{{ __('patient_finance.inpatient_bills') }}</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 60%">{{ __('patient_finance.total') }}</th>
<th style="width: 40%">{{ __('patient_finance.patient_amount') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td><b></b></td>
@php $total_to_pay += $inpatient_to_pay; @endphp
<td>{{ ugandan_shillings($inpatient_to_pay) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
@if(count($patient_debts) > 0)
<div class="col">
<h4>{{ __('patient_finance.patient_debts') }}</h4>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 60%">{{ __('patient_finance.incurred_from') }}</th>
<th style="width: 40%">{{ __('patient_finance.amount_to_pay') }}</th>
<th style="width: 40%">{{ __('patient_finance.amount_paid') }}</th>
<th style="width: 40%">{{ __('patient_finance.balance') }}</th>
</tr>
</thead>
<tbody>
@foreach($patient_debts as $debt)
<tr>
<td>{{ get_name($debt->tag_id, 'id', 'name', 'finance_point_tags') }} <i>({{ streamline_date_time($debt->created_at) }})</i></td>
<td>{{ ugandan_shillings($debt->balance) }}</td>
<td>{{ ugandan_shillings($debt->amount_paid_off) }}</td>
<td>
@if(!is_null($debt->balance_remaining))
@php $total_paid_by_patient += $debt->amount_paid_off; @endphp
{{ ugandan_shillings($debt->balance_remaining) }}
@else
{{ ugandan_shillings($debt->balance) }}
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
</div>
<br>
<div class="row total_div">
<div class="col m-r">
<b>{{ __('patient_finance.total_to_pay') }}</b>
<br>
{{ ugandan_shillings($total_to_pay) }}
</div>
<div class="col">
<b>{{ __('patient_finance.total_paid_by_the_patient') }}</b>
<br>
{{ ugandan_shillings($total_paid_by_patient) }}
</div>
<div class="col">
<b>{{ __('patient_finance.total_amount_refunded') }}</b>
<br>
{{ ugandan_shillings($total_amount_refunded) }}
</div>
<div class="col">
<b>{{ __('patient_finance.total_left_to_pay') }}</b>
<br>
@php
$total_left_to_pay = $total_to_pay - ($total_paid_by_patient + $total_amount_refunded);
@endphp
{{ ugandan_shillings($total_left_to_pay) }}
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,167 @@
<div class="modal" id="debt_plan_modal" tabindex="-1" role="dialog" aria-labelledby="debt_plan_modal_label" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="debt_plan_modal_label"><b>{{ __('patient_finance.debt_plan') }}</b></h5>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('staff_guarantor_amount_owed',__('patient_finance.amount_owed')) }}
{{ Form::number('staff_guarantor_amount_owed','',['class' => 'form-control compulsory','readonly','id'=>'staff_guarantor_amount_owed']) }}
</div>
<div class="form-group">
{{ Form::label('date_of_bill',__('patient_finance.date_of_bill')) }}
<div class="input-group">
{{--{{ Form::text('date_of_bill','',['class' => 'form-control compulsory', 'required','readonly','id'=>'date_of_bill']) }}--}}
{{ Form::text('date_of_bill','',['class' => 'form-control compulsory', 'required','id'=>'date_of_bill']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
<div class="form-group">
{{ Form::label('guarantor_to_pay_modal',__('patient_finance.guarantor_to_pay')) }}
{{ Form::number('guarantor_to_pay_modal',0,['class' => 'form-control compulsory', 'required','id'=>'guarantor_to_pay_modal']) }}
</div>
<div class="form-group">
{{ Form::label('patient_to_pay_modal',__('patient_finance.balance_to_pay')) }}
{{ Form::number('patient_to_pay_modal','',['class' => 'form-control compulsory','id'=>'patient_to_pay_modal','readonly']) }}
</div>
<div class="form-group">
{{ Form::label('payment_arrangement',__('patient_finance.arrangement_for_balance')) }}
{{ Form::select('payment_arrangement',$payment_arrangement,'',['class' => 'form-control compulsory','required','id'=>'payment_arrangement']) }}
</div>
<div class="form-group">
{{ Form::label('guarantor_type','Guarantor Type') }}
<br>
{{ Form::radio('guarantor_type', 1, false, ['class' => 'guarantor_type']) }} Staff &nbsp;&nbsp;
{{ Form::radio('guarantor_type', 0, false, ['class' => 'guarantor_type']) }} Non staff
</div>
</div>
<div class="col-md-6">
<div class="form-group" id="staff-guarantor-div">
{{ Form::label('staff_guarantor_modal',__('patient_finance.staff_guarantor')) }}
{{ Form::select('staff_guarantor_modal[]',$staff_guarantors,'',['class' => 'form-control compulsory','required','id'=>'staff_guarantor_modal', 'multiple' => 'true']) }}
</div>
<div class="form-group" id="non-staff-guarantor-div" style="display: none;">
{{ Form::label('staff_guarantor_modal',__('patient_finance.non_staff_guarantor')) }}
{{ Form::select('non_staff_guarantor_modal[]',$non_staff_guarantors,'',['class' => 'form-control compulsory','required','id'=>'non_staff_guarantor_modal', 'multiple' => 'true']) }}
<small><a href="#" id="addNewNonStaffGuarantor">{{__('patient_finance.add_new')}}</a></small>
</div>
<div class="form-group">
<div id="first_installment_date_div">
{{ Form::label('first_installment_date',__('patient_finance.first_installment_date')) }}
<div class="input-group">
{{ Form::text('first_installment_date','',['class' => 'form-control compulsory', 'required','readonly','id'=>'first_installment_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
<div id="second_installment_date_div" style="display: none;">
{{ Form::label('second_installment_date',__('patient_finance.second_installment_date')) }}
<div class="input-group">
{{ Form::text('second_installment_date','',['class' => 'form-control compulsory' ,'readonly','id'=>'second_installment_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
<div id="third_installment_date_div" style="display: none;">
{{ Form::label('third_installment_date',__('patient_finance.third_installment_date')) }}
<div class="input-group">
{{ Form::text('third_installment_date','',['class' => 'form-control compulsory','readonly','id'=>'third_installment_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
<div id="fourth_installment_date_div" style="display: none;">
{{ Form::label('fourth_installment_date',__('patient_finance.fourth_installment_date')) }}
<div class="input-group">
{{ Form::text('fourth_installment_date','',['class' => 'form-control compulsory','readonly','id'=>'fourth_installment_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="form-group">
{{ Form::label('comment',__('patient_finance.comment')) }}
{{ Form::textarea('comment','',['class' => 'form-control','id'=>'comment']) }}
</div>
<div class="form-group">
{{ Form::label('authorised_by_temp',__('patient_finance.authorised_by')) }}
{{ Form::text('authorised_by_temp',auth()->user()->username,['class' => 'form-control compulsory','readonly']) }}
{{ Form::hidden('authorised_by',auth()->user()->id,['id'=>'authorised_by']) }}
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">{{ __('patient_finance.cancel_button') }}</button>
<button type="button" class="btn btn-success" id="save_debt_plan">{{ __('patient_finance.save_changes') }}</button>
</div>
</div>
</div>
</div>
<div class="modal" id="new_non_staff_guarantor_modal" tabindex="-1" role="dialog" aria-labelledby="new_non_staff_guarantor_modal_label" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="new_non_staff_guarantor_modal_label"><b>{{ __('patient_finance.add_new_non_staff_guarantor') }}</b></h5>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('non_staff_guarantor_first_name',__('patients.first_name')) }}
{{ Form::text('non_staff_guarantor_first_name','',['class' => 'form-control compulsory','id'=>'non_staff_guarantor_first_name']) }}
</div>
<div class="form-group">
{{ Form::label('non_staff_guarantor_date_of_birth',__('patients.date_of_birth')) }}
<div class="input-group">
{{ Form::text('non_staff_guarantor_date_of_birth','',['class' => 'form-control compulsory', 'required','id'=>'non_staff_guarantor_date_of_birth']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
<div class="form-group">
{{ Form::label('non_staff_guarantor_gender',__('patients.gender')) }}
<br>
{{ Form::radio('non_staff_guarantor_gender', 1, false, ['class' => 'non_staff_guarantor_gender']) }} Male &nbsp;&nbsp;
{{ Form::radio('non_staff_guarantor_gender', 2, false, ['class' => 'non_staff_guarantor_gender']) }} Female
</div>
<div class="form-group">
{{ Form::label('non_staff_guarantor_contact',__('patients.phone')) }}
{{ Form::text('non_staff_guarantor_contact','',['class' => 'form-control compulsory','id'=>'non_staff_guarantor_contact']) }}
</div>
</div>
<div class="col-md-6">
<div class="form-group">
{{ Form::label('non_staff_guarantor_last_name',__('patients.last_name')) }}
{{ Form::text('non_staff_guarantor_last_name','',['class' => 'form-control compulsory','id'=>'non_staff_guarantor_last_name']) }}
</div>
<div class="form-group">
@php $marital_status = $marital_statuses = \DB::table('marital_statuses')->pluck("name", "id")->toArray(); @endphp
{{ Form::label('non_staff_guarantor_marital_status',__('patients.marital_status')) }}
{{ Form::select('non_staff_guarantor_marital_status',$marital_status,'',['class' => 'form-control compulsory','id'=>'non_staff_guarantor_marital_status']) }}
</div>
<div class="form-group">
{{ Form::label('non_staff_guarantor_residence','Residence') }}
{{ Form::text('non_staff_guarantor_residence','',['class' => 'form-control compulsory','id'=>'non_staff_guarantor_residence']) }}
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">{{ __('patient_finance.cancel') }}</button>
<button type="button" class="btn btn-success" id="save_new_non_staff_guarantor">{{ __('patient_finance.save') }}</button>
</div>
</div>
</div>
</div>
@@ -0,0 +1,553 @@
@php use Modules\PatientFinance\Http\Controllers\PatientFinanceController; @endphp
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}"
rel="stylesheet">
<style type="text/css">
#t_header th {
background-color: #708090;
color: #000;
}
.color-tr {
background: #FFFF99;
}
.aTable tr {
background-color: #DDD;
}
.table_no_padding td {
padding: 4px;
}
span.not_paid {
color: red;
}
span.paid {
color: green;
}
span.partial_paid {
color: orange;
}
span.invoiced {
color: blue;
}
</style>
@endpush
@section('content')
@if(session()->get("print_patient_account_receipt_pdf") == 1)
{{ Form::hidden('print_patient_account_receipt_pdf', 1, ['id' => 'print_patient_account_receipt_pdf']) }}
@endif
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patient_finance.patient_finance') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> {{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('finance') }}"><i
class="fa fa-money"></i> {{ __('patient_finance.finance_home') }}</a></li>
<li class="active"><i class="fa fa-user"></i> {{ __('patient_finance.patient_finance') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('layouts.finance_header')
</div>
</div>
{{ Form::open(['route' => 'patient_finance.select_payment_option']) }}
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('patient_finance.date') }}</th>
<th>{{ __('patient_finance.consultation') }}</th>
<th>{{ __('patient_finance.treatment') }}</th>
<th>{{ __('patient_finance.investigations') }}</th>
<th>{{ __('patient_finance.procedures') }}</th>
<th>{{ __('patient_finance.other_services') }}</th>
<th>{{ __('patient_finance.inpatient_deposits') }}</th>
<th>{{ __('patient_finance.sundries') }}</th>
@if(is_eye_module_enabled())
<th>{{ __('patient_finance.eye_glasses') }}</th>
@endif
<th>{{ __('patient_finance.co_payment') }}</th>
<th>{{ __('patient_finance.debts') }}</th>
<th>{{ __('patient_finance.select') }}</th>
</tr>
</thead>
<tbody>
@if(!is_null($episodes))
@foreach($episodes as $episode)
@php
$service_items = PatientFinanceController::get_service_items_string($episode->id);
$service_items_pay_later = PatientFinanceController::get_service_items_pay_later_string($episode->id);
$service_items_inpatient_deposit = PatientFinanceController::get_inpatient_deposit_string($episode->id);
$used_services = \Streamline\Models\OrderedService::where(['patient_id' => $episode->patient_id, 'episode_id' => $episode->id, 'payment_status' => 0,'inpatient_bill_generated' => 0])->get();
$consultation_payment_status = "<span class='no_records'>NA</span>";
$other_services_payment_status = "<span class='no_records'>NA</span>";
$service_items_ids_array = [];
foreach ($service_items as $item){
array_push($service_items_ids_array, explode(',', $item['items_ids']));
}
foreach ($service_items_pay_later as $item){
array_push($service_items_ids_array, explode(',', $item['items_ids']));
}
$service_deposits_types = [];
foreach($service_items_ids_array as $service_item_id){
if (is_array($service_item_id)) {
foreach ($service_item_id as $id) {
$service_deposits_types[] = get_name($id, "id", "item_type", "services");
}
} else {
$service_deposits_types[] = get_name($service_item_id, "id", "item_type", "services");
}
}
if (in_array('Consultation', $service_deposits_types)) {
if (in_array($patient->category_id, $pay_later_categories)){
$consultation_payment_status = "<span class='invoiced'>Invoiced</span>";
} elseif ($episode->paid_over == "pos") {
$consultation_payment_status = "<label class='label label-success'>POS</span>";
} else {
$consultation_payment_status = "<span class='paid'>Paid</span>";
}
}
if (in_array('Service', $service_deposits_types) || in_array('Other_service', $service_deposits_types) || in_array('Services', $service_deposits_types)) {
$other_services = 1; // paid services
if (in_array($patient->category_id, $pay_later_categories)){
$other_services_payment_status = "<span class='invoiced'>Invoiced</span>";
} else {
$other_services_payment_status = "<span class='paid'>Paid</span>";
}
}
foreach($used_services as $service){
$single_order_services_ids_array = explode(",",$service->service_id);
foreach ($single_order_services_ids_array as $single_order_services_id) {
$service_type = get_name($single_order_services_id, "id", "item_type", "services");
if ($service_type == 'Consultation') {
$consultation_payment_status = "<span class='not_paid'>" . __('patient_finance.unpaid') . "</span>";
} elseif ($service_type == 'Service' || $service_type == 'Other_service' || $service_type == 'Services') {
$other_services_payment_status = "<span class='not_paid'>" . __('patient_finance.unpaid') . "</span>";
}
}
}
if (in_array('Co_Payment', $service_deposits_types)) {
if (in_array($patient->category_id, $pay_later_categories)){
$copayment_payment_status = "<span class='invoiced'>Invoiced</span>";
} else {
$copayment_payment_status = isset($other_services_payment_status) ? $other_services_payment_status : "<span class='paid'>Paid</span>";
}
} else {
$copayment_payment_status = "<span class='no_records'>NA</span>";
}
if(count($service_items_inpatient_deposit) > 0){
$inpatient_deposits = 1;
} else {
$inpatient_deposits = 0;
}
$investigations = PatientFinanceController::check_investigations_payment($episode->id);
$prescription = PatientFinanceController::check_prescription_payment($episode->id);
$is_inpatient = get_name($episode->id, "episode_id", "payment_status", "inpatient_info");
$procedures_paid = PatientFinanceController::check_procedures_payment($episode->id);
$sundries_paid = PatientFinanceController::check_sundry_payment($episode->id);
$debt_paid = PatientFinanceController::check_debt($episode->id);
$debt_plans = PatientFinanceController::check_patient_debt_plan($episode->id);
$opticals_paid = PatientFinanceController::check_optical_payment($episode->id);
//process all the copayments
if ($episode->co_payment == 0) {
$valueCo = "<span class='not_paid'>" . __('patient_finance.unpaid') . "</span>";
} else {
if (in_array($patient->category_id, $pay_later_categories)){
$valueCo = "<span class='invoiced'>Invoiced</span>";
}else{
$valueCo = "<span class='not_paid'>Unpaid</span>";
}
}
//process all the investigations
if ($investigations === 0 ) {
$investigations_payment_status = "<span class='not_paid'>" . __('patient_finance.unpaid') . "</span>";
} elseif ($investigations === 1) {
if (in_array($patient->category_id, $pay_later_categories)){
$investigations_payment_status = "<span class='invoiced'>Invoiced</span>";
}else{
$investigations_payment_status = "<span class='paid'>Paid</span>";
}
} else {
$investigations_payment_status = "<span class='no_records'>NA</span>";
}
//process all the prescription payment status
if ($prescription == 0) {
$treatment_payment_status = "<span class='not_paid'>" . __('patient_finance.unpaid') . "</span>";
} elseif ($prescription == 1) {
if (in_array($patient->category_id, $pay_later_categories)){
$treatment_payment_status = "<span class='invoiced'>Invoiced</span>";
}else{
$treatment_payment_status = "<span class='paid'> Paid</span>";
}
} else {
$treatment_payment_status = "<span class='no_records'>NA</span>";
}
// check if the patient is admitted
if ($is_inpatient == '1' || $is_inpatient == '0'){
//process all the inpatient deposits
$real_inpatient_deposit_status = PatientFinanceController::get_inpatient_deposit_status($episode->id);
if ($inpatient_deposits == '0') {
$inpatient_deposits_payment_status = "<span class='not_paid'>" . __('patient_finance.unpaid') . "</span>";
} elseif ($real_inpatient_deposit_status == '1') {
$inpatient_deposits_payment_status = "<span class='paid'>" . __('patient_finance.paid') . "</span>";
} elseif ($real_inpatient_deposit_status == '2') {
$inpatient_deposits_payment_status = "<span class='partial_paid'>" . __('patient_finance.partial_payment') . "</span>";
}
} else {
$inpatient_deposits_payment_status = "<span class='no_records'>NA</span>";
}
//process all procedure payments
if ($procedures_paid === 0) {
$procedures_payment_status = "<span class='not_paid'>" . __('patient_finance.unpaid') . "</span>";
} elseif ($procedures_paid === 1) {
if (in_array($patient->category_id, $pay_later_categories)){
$procedures_payment_status = "<span class='invoiced'>Invoiced</span>";
}else{
$procedures_payment_status = "<span class='paid'>Paid</span>";
}
} else {
$procedures_payment_status = "<span class='no_records'>NA</span>";
}
//process all sundries payments
if ($sundries_paid === 0) {
$sundries_payment_status = "<span class='not_paid'>" . __('patient_finance.unpaid') . "</span>";
} elseif ($sundries_paid === 1) {
if (in_array($patient->category_id, $pay_later_categories)){
$sundries_payment_status = "<span class='invoiced'>Invoiced</span>";
}else{
$sundries_payment_status = "<span class='paid'>Paid</span>";
}
} else {
$sundries_payment_status = "<span class='no_records'>NA</span>";
}
// process all optical payments
if ($opticals_paid === 0) {
$optical_payment_status = "<span class='not_paid'>" . __('patient_finance.unpaid') . "</span>";
} elseif ($opticals_paid === 1) {
if (in_array($patient->category_id, $pay_later_categories)){
$optical_payment_status = "<span class='invoiced'>Invoiced</span>";
} else {
$optical_payment_status = "<span class='paid'>Paid</span>";
}
} else {
$optical_payment_status = "<span class='no_records'>NA</span>";
}
//debt status
if ($debt_paid === 0) {
$debt_value = "<span class='not_paid'>" . __('patient_finance.patient_debts_unpaid') . "</span>";
} elseif ($debt_paid === 1) {
$debt_value = "<span class='paid'>" . __('patient_finance.patient_debts_paid') . "</span>";
} else{
$debt_value = ""; //"<span class='no_records'>NA</span>";
}
if($debt_plans === 0) {
$debt_value .= "<br/><span class='not_paid'>" . __('patient_finance.unpaid_debt_plan') . "</span>";
} elseif($debt_plans === 1) {
$debt_value .= "<br/><span class='paid'>" . __('patient_finance.paid_debt_plan') . "</span>";
}
$patient_ran_away_without_paying = check_if_patient_ran_away_without_paying($episode->id);
$episode_appointment = get_all_first(['episode_id' => $episode->id, 'patient_id' => $episode->patient_id], 'patient_appointments');
@endphp
<tr id='my_row{{ $episode->id }}'>
<td width='15%'>
<a href='#'
style='color: #0099CC'>{{ streamline_date($episode->created_at) }}</a>
@if(check_if_episode_is_a_followup($episode->id))
@php $original_episode = \Streamline\Models\PatientEpisode::find($episode->parent_episode_id); @endphp
@if ($original_episode)
<small style="color: green"><br>({{ __('patient_finance.reviewed_from') }} {{ streamline_date($original_episode->created_at) }}
)</small>
@endif
@endif
</td>
<td>
@if($episode->episode_type == 1)
<span class="label label-info">{{ __('patient_flow_monitoring.lab_self_request') }}</span>
@else
@php
$consultation_done_by = get_doctor_who_has_done_episode_consultation($episode->patient_id, $episode->id);
if(!is_null($consultation_done_by)){
$consultation_id = get_consultation_service_id_allocated_at_episode_consultation($episode->patient_id, $episode->id);
$price_list_id = is_patient_category_attached_to_price_list($episode->patient_id);
if($price_list_id){
$consultation_fee = get_price_list_category_price($price_list_id, 6, $consultation_id);
} else {
$consultation_fee = get_name($consultation_id, "id", "non_insured_price", "services");
}
}
@endphp
{!! $consultation_payment_status !!}
@if(!is_null($consultation_done_by))
<br>
<b>{{ __('patient_finance.done_by') }}
:</b> {{ get_full_name($consultation_done_by, "id", "first_name", "last_name", "users") }}
<br>
<b>{{ __('patient_finance.fee') }}
:</b>{{ ugandan_shillings($consultation_fee) }}
@endif
@endif
</td>
<td>
@if($prescription === 0)
<span class='not_paid'>{{ __('patient_finance.unpaid') }}</span>
@elseif ($prescription === 1)
@if(in_array($patient->category_id, $pay_later_categories))
<span class='invoiced'>{{ __('patient_finance.invoiced') }}</span>
@else
<span class='paid'>{{ __('patient_finance.paid') }}</span>
@endif
@else
<span class='no_records'>NA</span>
@endif
</td>
<td>{!! $investigations_payment_status !!}</td>
<td>{!! $procedures_payment_status !!}</td>
<td>{!! $other_services_payment_status !!}</td>
<td>{!! $inpatient_deposits_payment_status !!}</td>
<td>{!! $sundries_payment_status !!}</td>
@if(is_eye_module_enabled())
<td>{!! $optical_payment_status !!}</td>
@endif
<td>{!! $copayment_payment_status !!}</td>
<td>{!! $debt_value !!}</td>
<td>
<input type="radio" onchange="show()" class="radio-option" name="episode_id"
id="episode_id" value="{{ $episode->id }}"/>
</td>
</tr>
@if($patient_ran_away_without_paying)
<tr style="background-color: #ffcccc">
<td>
<a href='#'
style='color: #0099CC'>{{ streamline_date($episode->created_at) }}</a>
</td>
<td colspan="11" class="text-center">
<span style="color: orangered">{{ __('patient_finance.patient_ran_away') }}</span>
</td>
</tr>
@endif
@endforeach
@else
<tr>
<td colspan="11" class="center"
style="color: red">{{ __('patient_finance.no_patient_episode') }}</td>
</tr>
@endif
</tbody>
</table>
</div>
{{ $episodes->links() }}
</div>
<div id="payment_buttons" style="display: none;">
<div class="row">
<div class="col-sm-2">
@if(Auth::user()->can('make-consultation-deposits'))
<button type="submit" name="consultation" class="btn btn-success btn-sm col-sm-12"
value="consultation">{{ __('patient_finance.consultation') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('make-treatment-deposits'))
<button type="submit" name="treatment" class="btn btn-success btn-sm col-sm-12"
value="treatment">{{ __('patient_finance.treatment') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('make-investigations-deposits'))
<button type="submit" name="investigations" class="btn btn-success btn-sm col-sm-12"
value="investigations">{{ __('patient_finance.investigations') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('make-procedures-deposits'))
<button type="submit" name="procedures" class="btn btn-success btn-sm col-sm-12"
value="procedures">{{ __('patient_finance.procedures') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('make-co-payments-deposits'))
<button type="submit" name="co_payments" class="btn btn-success btn-sm col-sm-12"
value="co_payments">{{ __('patient_finance.co_payment') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('make-other-services-deposits'))
<button type="submit" name="other_services" class="btn btn-success btn-sm col-sm-12"
value="other_services">{{ __('patient_finance.other_services') }}</button>
@endif
</div>
</div>
<br><br>
<div class="row">
<div class="col-sm-2">
@if(Auth::user()->can('make-patient-refund'))
<button type="submit" name="refund_patient"
class="btn btn-success btn-sm pull-right col-sm-12"
value="refund_patient">{{ __('patient_finance.refund_patient') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('make-central-billing'))
<button type="submit" name="central_billing"
class="btn btn-success btn-sm pull-right col-sm-12"
value="central_billing">{{ __('patient_finance.central_billing') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('make-sundries-deposits'))
<button type="submit" name="sundries" class="btn btn-success btn-sm pull-right col-sm-12"
value="sundries">{{ __('patient_finance.sundries') }}</button>
@endif
</div>
<div class="col-sm-2">
<button type="submit" name="inpatient_billing" class="btn btn-success btn-sm col-sm-12"
value="inpatient_billing">{{ __('patient_finance.inpatient_billing') }}</button>
</div>
<div class="col-sm-2">
<button type="submit" name="inpatient_deposit"
class="btn btn-success btn-sm pull-right col-sm-12"
value="inpatient_deposit">{{ __('patient_finance.inpatient_deposits') }}</button>
</div>
<div class="col-sm-2">
<button type="submit" name="patient_debts" class="btn btn-success btn-sm pull-right col-sm-12"
value="patient_debts">{{ __('patient_finance.patient_debts') }}</button>
</div>
</div>
<br><br>
<div class="row">
<div class="col-sm-2">
<button type="button" class="btn btn-success btn-sm pull-right col-sm-12"
id="customer_episode_statement">{{ __('patient_finance.customer_episode_statement') }}</button>
</div>
@if(is_patient_category_pay_later($patient->category_id))
<div class="col-sm-2">
<button type="submit" name="edit_claim_number"
class="btn btn-success btn-sm pull-right col-sm-12"
value="edit_claim_number">{{ __('patient_finance.edit_claim_number') }}</button>
</div>
@endif
<div class="col-sm-2">
<button type="submit" name="patient_debt_plan"
class="btn btn-success btn-sm pull-right col-sm-12"
value="patient_debt_plan">{{ __('patient_finance.patient_debt_plan') }}</button>
</div>
@if(is_eye_module_enabled())
<div class="col-sm-2">
<button type="submit" name="optical_items"
class="btn btn-success btn-sm pull-right col-sm-12"
value="optical_items">{{ __('patient_finance.eye_glasses') }}</button>
</div>
@endif
</div>
</div>
</div>
</div>
{{ Form::close() }}
@endsection
@push('scripts')
<script type="text/javascript">
if ($('#print_patient_account_receipt_pdf').val() == 1) {
var win = window.open('/patient_accounts/print_receipt_pdf_details', '_blank');
if (win) {
win.focus();
} else {
alert('Please allow popups for Stre@mline');
}
}
function show() {
$('#payment_buttons').show();
}
$('.radio-option').change(function () {
//this is to highlight the clicked episode row
let episode_id = $(this).val();
if (this.checked) {
// remove the class that highlights the selected row
$('[id^=my_row]').removeClass('color-tr');
$('#my_row' + episode_id).addClass('color-tr');
}
});
$("#customer_episode_statement").click(function () {
let current_episode_id = $('input[name=episode_id]:checked').val();
let win = window.open('/patient_finance/customer_episode_statement/' + current_episode_id, '_blank');
if (win) {
win.focus();
} else {
alert("Please allow pop-ups for this system")
}
});
</script>
@endpush
<style type="text/css">
.modal-dialog {
position: absolute;
top: 40%;
left: 30%;
transform: translate(-50%, -50%) !important;
}
</style>
@@ -0,0 +1,435 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<style type="text/css">
#deposit_table td{
border-left: 1px solid #dddddd;
}
#discount_table td{
border-left: 1px solid #dddddd;
}
#paid_investigations_table td{
border-left: 1px solid #dddddd;
}
@media only print, print {
body.non-print .row.bg-title,
body.non-print .row.col-md-12.white-box,
body.non-print .row.investigations-section,
body.non-print .navbar-default.sidebar,
body.non-print .navbar.navbar-default.navbar-static-top,
body.non-print .main-header,
body.non-print .custom-header,
body.non-print .modal-header button,
body.non-print .deposit-title,
body.non-print footer,
.modal-backdrop.toPrint {
display: none !important;
visibility: hidden !important;
}
.modal.toPrint {
position: relative;
overflow: hidden;
visibility:visible;
width: 100%;
font-size: 80%;
}
.modal.toPrint .nav .li {
visibility: hidden;
}
.modal.toPrint .nav .li.active {
visibility: visible;
}
}
</style>
@endpush
@section('content')
{{-- Hide the print option here outside of the form --}}
@if(session()->get("print_cashier_receipt_pdf") == 1)
{{ Form::hidden('print_cashier_receipt_pdf', 1, ['id' => 'print_cashier_receipt_pdf']) }}
@endif
@php $co_payment = check_patient_category_co_payment_status($patient->category_id); @endphp
@if(check_if_episode_is_a_followup($episode->id))
@php
$parent_episode_details = \Streamline\Models\PatientEpisode::find($episode->parent_episode_id);
$parent_ordered_investigations = \Streamline\Models\OrderedInvestigation::where(['episode_id' => $episode->parent_episode_id,'payment_status' => '0','inpatient_bill_generated' => 0])->get();
$parent_paid_investigations = \Streamline\Models\InvestigationDeposit::where(['episode_id' => $episode->parent_episode_id])->orderBy('created_at', 'desc')->get();
@endphp
@endif
<div class="row bg-title">
<div class="col-md-7">
<h4 class="page-title">
{{ __('patient_finance.investigation_title') }} : <span style="color: #0000FF">{{ streamline_date($episode->created_at) }}</span>{!! isset($parent_episode_details) ? "<span style='color: green;'> (" . __('.episode_is_review') . " ". streamline_date($parent_episode_details->created_at).")</span>" : '' !!}
</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li class="active">{{ __('patient_finance.finance_home') }}</li>
</ol>
</div>
</div>
@if(check_if_episode_is_a_followup($episode->id))
@include('patient_finance::patient_finance.make_deposit_investigations_review')
@endif
@if($paid_investigations->count() > 0 || count($invoiced_investigations) > 0)
<div class="white-box">
<div class="row">
<div class="col-md-12">
<h4>{{ __('patient_finance.investigation_payments') }}</h4>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="paid_investigations_table">
<thead>
<tr>
<th>#</th>
<th>{{ __('patient_finance.receipt_number') }}</th>
<th>{{ __('patient_finance.cashier') }}</th>
<th>{{ __('patient_finance.investigation_items') }}</th>
<th>{{ __('patient_finance.investigation_prices') }}</th>
<th>{{ __('patient_finance.patient_amount_paid') }}</th>
<th>{{ __('patient_finance.payment_date') }}</th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
@php $counter = 1; @endphp
@foreach($paid_investigations as $investigation)
@php
// check if this payment was from central billing
$central_billing_count = \Illuminate\Support\Facades\DB::table('central_billing_deposits')->where('receipt_number', $investigation->receipt_number)->count();
$chi_count = \Illuminate\Support\Facades\DB::table('chi_deposits')->where('receipt_number', $investigation->receipt_number)->count();
if ($central_billing_count > 0 || $chi_count > 0){
// skip this record so that it is only printed and cancelled from the central billings side
continue;
}
@endphp
<tr>
<td>{{ $counter }}</td>
<td>{{ $investigation->receipt_number }}</td>
<td>{{ get_full_name($investigation->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>
@php $items_counter = 1; @endphp
@php $investigation_items_array = explode(",", $investigation->investigation_items); @endphp
@foreach($investigation_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'investigations') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $investigation_price_array = explode(",", $investigation->investigation_amounts); @endphp
@foreach($investigation_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
{{ ugandan_shillings($investigation->patient_amount_paid) }}
@if($investigation->refund_amount > 0)
<br><br>
<span style="color: orangered">
{{ ugandan_shillings($investigation->refund_amount) }} {{ __('patient_finance.was_refunded') }}
</span>
@endif
</td>
<td>{{ streamline_date_time($investigation->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_investigation_receipt/1/{{ $investigation->receipt_number }}">{{ __('patient_finance.print_receipt') }}</a>
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($investigation->receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
</td>
<td>
@if(is_null($investigation->received) && can_receipt_be_cancelled($investigation->receipt_number) && Auth::user()->can('cancel-patient-transaction'))
<a class="btn btn-danger btn-sm" href="/patient_finance/cancel_receipt/2/{{ $investigation->id }}">{{ __('patient_finance.cancel_receipt') }}</a>
@endif
</td>
</tr>
@php $counter++; @endphp
@endforeach
@foreach($invoiced_investigations as $investigation)
@php
// check if this payment was from central billing
$central_billing_count = \Illuminate\Support\Facades\DB::table('central_billing_deposits')->where('receipt_number', $investigation->receipt_number)->count();
if ($central_billing_count > 0){
// skip this record so that it is only printed and cancelled from the central billings side
continue;
}
@endphp
<tr>
<td>{{ $counter }}</td>
<td>{{ $investigation->receipt_number }}</td>
<td>
@php $items_counter = 1; @endphp
@php $treatment_items_array = explode(",", $investigation->items_ids); @endphp
@foreach($treatment_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'investigations') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $treatment_price_array = explode(",", $investigation->items_amounts); @endphp
@foreach($treatment_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
<span style="color:#0000FF">{{ __('patient_finance.invoiced') }}</span>
</td>
<td>{{ streamline_date_time($investigation->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_investigation_receipt/2/{{ $investigation->receipt_number }}">{{ __('patient_finance.print_invoice') }}</a>
</td>
<td>
@if($investigation->invoiced == 0 && can_receipt_be_cancelled($investigation->receipt_number) && Auth::user()->can('cancel-patient-transaction'))
<a class="btn btn-primary btn-sm" href="/patient_finance/cancel_invoice/2/{{ $investigation->id }}">{{ __('patient_finance.cancel_invoice') }}</a>
@endif
</td>
</tr>
@php $counter++; @endphp
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endif
<div class="white-box">
@if(patient_insurance_status($patient_id) == 1)
<a href="/patient_finance/make_chi_deposits/3" class="btn btn-success btn-sm">View CHI Deposits Receipts</a>
<br><br>
@endif
<div class="row investigations-section">
<div class="col-md-12">
@include('flash::message')
@if($ordered_investigations->count() > 0)
@php
// ids of the ordered investigations
$investigation_ids = array();
$eye_applications = []; // whether to double the price for both eyes or 1
// id of the current ordered investigations to update table later
$order_ids = array();
// amounts at the time of the inv was ordered
$inv_orders_amounts = [];
foreach($ordered_investigations as $ordered_investigation){
$investigation_ids = array_merge($investigation_ids, explode(",", $ordered_investigation->investigation_id));
$eye_applications = array_merge($eye_applications, explode(",", $ordered_investigation->eye));
array_push($order_ids, $ordered_investigation->id);
$inv_orders_amounts = is_null($ordered_investigation->investigation_amount) ? array_merge($inv_orders_amounts, []) : array_merge($inv_orders_amounts, explode(",", $ordered_investigation->investigation_amount));
}
$count_orders = count($order_ids);
// create strings from arrays to use when submitting
$order_ids_string = implode(',', $order_ids);
$investigation_ids_string = implode(',', $investigation_ids);
$ordered_inv_amounts_string = implode(',', $inv_orders_amounts);
@endphp
@if(Auth::user()->can('price-list-category-change-billing'))
{{ Form::open(['route' => 'patient_finance.make_deposit_investigations', 'data-toggle' => 'validator']) }}
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('price_list_category_id', 'Price List Category') }}
<select name="price_list_category_id" class="form-control compulsory" required>
<option value="0">- {{ __('patient_finance.default_pricing') }} -</option>
@foreach($price_list_categories as $record)
<option value="{{ $record->id }}">{{ get_name($record->patient_category_id, 'id', 'name', 'patient_categories') }}</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-6">
<br>
{{ Form::button(__('patient_finance.apply_changes'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
</div>
</div>
<hr>
{{ Form::close() }}
@endif
{{ Form::open(['route' => 'patient_finance.store_deposit_investigations', 'data-toggle' => 'validator']) }}
{{ Form::hidden('patient_id', $patient_id, ['id' => 'patient_id']) }}
{{ Form::hidden('episode_id', $episode_id, ['id' => 'episode_id']) }}
{{ Form::hidden('order_ids', $order_ids_string) }}
{{ Form::hidden('investigation_ids', $investigation_ids_string) }}
{{ Form::hidden('investigation_order_amounts', $ordered_inv_amounts_string) }}
{{ Form::hidden('tag_id', 2, ['id' => 'tag_id']) }}
<div class="row">
<div class="col-md-8">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="deposit_table">
<thead>
<tr>
<th style="width: 50%">{{ __('patient_finance.investigation_name') }}</th>
<th style="width: 45%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php
$investigation_amount_total = 0;
$investigation_amount = 0;
@endphp
@for ($i = 0; $i < count($investigation_ids); $i++)
@php
$eye_application_multiplier = ((isset($eye_applications[$i]) && $eye_applications[$i] == 2) ? 2 : 1);
// check if the patient category is attached to a price list
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_set && $price_list_set != 0){
$investigation_amount = get_price_list_category_price($price_list_set, 2, $investigation_ids[$i]);
} elseif ($price_list_id) {
$investigation_amount = get_price_list_category_price($price_list_id, 2, $investigation_ids[$i]);
} else {
//if amount was set at time of ordering
if (isset($inv_orders_amounts[$i]) && !is_null($inv_orders_amounts[$i])) {
$investigation_amount = $inv_orders_amounts[$i];
} else{
$investigation_amount = get_name($investigation_ids[$i], "id", "non_insured_price", "investigations");
}
}
// add amounts to totals
$investigation_amount = $investigation_amount * $eye_application_multiplier;
$investigation_amount_total += $investigation_amount;
@endphp
<tr @if(!Auth::user()->can('view-item-prices')) style="display: none" @endif>
<td>
<label>{{ get_name($investigation_ids[$i], "id", "name", "investigations") }}</label>
</td>
<td>
{{ Form::number('investigation_amount[]', $investigation_amount, ['class' => 'form-control col-sm-8 items_amounts', 'readonly']) }}
</td>
</tr>
@endfor
@if(!Auth::user()->can('view-item-prices'))
<tr>
<td>{{ __('patient_finance.investigations') }}</td>
<td>{{ ugandan_shillings($investigation_amount_total) }}</td>
</tr>
@endif
{{ Form::hidden('investigation_amount_total', $investigation_amount_total) }}
</tbody>
</table>
</div>
@if(is_donor_feature_enabled())
<br><hr>
<h4>{{ __('patient_finance.discount') }}</h4>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="discounts_table">
<thead>
<tr>
<th>{{ __('patient_finance.discount') }}</th>
<th>{{ __('patient_finance.donor_amount') }}</th>
<th>{{ __('patient_finance.patient_amount') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{ Form::select('donor_discount', $discount_options, '', ['class' => 'form-control col-sm-12', 'onchange' => 'show_discounts_amounts(this.value)']) }}
</td>
<td><div id="donor_discount"></div></td>
<td><div id="patient_discount"></div></td>
</tr>
</tbody>
</table>
<!-- is the controller to check if discount is selected if value is anything other than 0 -->
{{ Form::hidden('discount_type', 0, ['id' => 'discount_type']) }}
</div>
@endif
</div>
@include('patient_finance::patient_finance.make_deposit_totals_section')
</div>
{{ Form::close() }}
@else
<h4 class="text-center" style="color: red">{{ __('patient_finance.no_ordered_investigations') }}</h4>
@endif
</div>
</div>
</div>
<!-- include the debt plan modal partial -->
@include('patient_finance::patient_finance.debt.debt_plan')
<!-- include the credit limit modal partial -->
@include('patient_finance::patient_finance.credit_limit_modal')
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
// check if the patient has paid and a pdf print is required
if ($('#print_cashier_receipt_pdf').val() == 1) {
var win = window.open('/patient_finance/print_item_receipt_pdf', '_blank');
if (win) {
win.focus();
} else {
alert('Please allow popups for Stre@mline');
}
}
</script>
@endpush
@push('styles')
<style>
.modal-dialog {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%) !important;
}
</style>
@endpush
@@ -0,0 +1,148 @@
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<h5 style="color: maroon;"><b>{{ __('patient_finance.investigation_original_episode') }} {{ streamline_date($parent_episode_details->created_at) }}</b></h5>
@if(count($parent_paid_investigations))
<strong>{{ __('patient_finance.investigation_payments') }}</strong>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="paid_investigations_table">
<thead>
<tr>
<th>#</th>
<th>{{ __('patient_finance.receipt_number') }}</th>
<th>{{ __('patient_finance.investigation_items') }}</th>
<th>{{ __('patient_finance.investigation_prices') }}</th>
<th>{{ __('patient_finance.patient_amount_paid') }}</th>
<th>{{ __('patient_finance.payment_date') }}</th>
<th></th>
</tr>
</thead>
<tbody>
@php $counter = 1; @endphp
@foreach($parent_paid_investigations as $investigation)
<tr>
<td>{{ $counter }}</td>
<td>{{ $investigation->receipt_number }}</td>
<td>
@php $items_counter = 1; @endphp
@php $investigation_items_array = explode(",", $investigation->investigation_items); @endphp
@foreach($investigation_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'investigations') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $investigation_price_array = explode(",", $investigation->investigation_amounts); @endphp
@foreach($investigation_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
{{ ugandan_shillings($investigation->patient_amount_paid) }}
@if($investigation->refund_amount > 0)
<br><br>
<span style="color: orangered">
{{ ugandan_shillings($investigation->refund_amount) }} {{ __('patient_finance.was_refunded') }}
</span>
@endif
</td>
<td>{{ streamline_date_time($investigation->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_investigation_receipt/1/{{ $investigation->id }}">{{ __('patient_finance.print_receipt') }}</a>
</td>
</tr>
@php $counter++; @endphp
@endforeach
</tbody>
</table>
</div>
@endif
@if(count($parent_ordered_investigations) > 0)
@php
// ids of the ordered investigations
$parent_investigation_ids = array();
// id of the current ordered investigations to update table later
$parent_order_ids = array();
foreach($parent_ordered_investigations as $parent_ordered_investigation){
$parent_investigation_ids = array_merge($parent_investigation_ids, explode(",", $parent_ordered_investigation->investigation_id));
array_push($parent_order_ids, $parent_ordered_investigation->id);
}
$parent_count_orders = count($parent_order_ids);
// create strings from arrays to use when submitting
$parent_order_ids_string = implode(',', $parent_order_ids);
$parent_investigation_ids_string = implode(',', $parent_investigation_ids);
@endphp
<div style="background-color: #f9e3dc; padding-top: 5px;">
<strong>{{ __('patient_finance.unpaid_investigations') }}</strong>
<div class="row">
<div class="col-sm-10">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="deposit_table">
<thead>
<tr>
<th style="width: 50%">{{ __('patient_finance.investigation_name') }}</th>
<th style="width: 45%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php
$parent_investigation_amount_total = 0;
$parent_investigation_amount = 0;
@endphp
@foreach ($parent_investigation_ids as $parent_investigation_id)
@php
// check if the patient category is attached to a price list
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_set && $price_list_set != 0){
$parent_investigation_amount = get_price_list_category_price($price_list_set, 2, $parent_investigation_id);
} elseif ($price_list_id) {
$parent_investigation_amount = get_price_list_category_price($price_list_id, 2, $parent_investigation_id);
} else {
$parent_investigation_amount = get_name($parent_investigation_id, "id", "non_insured_price", "investigations");
}
// add amounts to totals
$parent_investigation_amount_total += $parent_investigation_amount;
@endphp
<tr>
<td>
<label>{{ get_name($parent_investigation_id, "id", "name", "investigations") }}</label>
</td>
<td>
{{ Form::number('investigation_amount[]', $parent_investigation_amount, ['class' => 'form-control col-sm-8 investigation_amount', 'readonly']) }}
</td>
</tr>
@endforeach
{{ Form::hidden('investigation_amount_total', $parent_investigation_amount_total) }}
</tbody>
</table>
</div>
</div>
<div class="col-sm-2">
<div>
{{ Form::open(['route' => 'patient_finance.select_payment_option']) }}
{{ Form::hidden('episode_id', $parent_episode_details->id) }}
<button type="submit" name="investigations" class="btn btn-success btn-sm btn-rd" value="investigations">{{ __('patient_finance.pay_for_investigation') }}</button>
{{ Form::close() }}
</div>
</div>
</div>
</div>
@endif
</div>
</div>
</div>
@@ -0,0 +1,368 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<style>
#discounts_table td{
border-left: 1px solid #dddddd;
}
#paid_opticals_table td{
border-left: 1px solid #dddddd;
}
#opticals_table td{
border-left: 1px solid #dddddd;
}
</style>
@endpush
@section('content')
{{-- Hide the print option here outside of the form --}}
@if(session()->get("print_cashier_receipt_pdf") == 1)
{{ Form::hidden('print_cashier_receipt_pdf', 1, ['id' => 'print_cashier_receipt_pdf']) }}
@endif
@php $co_payment = check_patient_category_co_payment_status($patient->category_id); @endphp
<div class="row bg-title">
<div class="col-md-7">
<h4 class="page-title">
{{ __('patient_finance.optics_for_episode') }} : <span style="color: #0000FF">{{ streamline_date($episode->created_at) }}</span>
</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.eye_glasses_payment') }}</li>
</ol>
</div>
</div>
@if(count($paid_opticals) > 0 || count($invoiced_opticals) > 0)
<div class="row">
<div class="col-md-12">
<div class="white-box">
<h4>{{ __('patient_finance.eye_glasses_payment') }}</h4>
<table class="table color-bordered-table success-bordered-table" id="paid_opticals_table">
<thead>
<tr>
<th>{{ __('patient_finance.receipt_number') }}</th>
<th>{{ __('patient_finance.optics_items') }}</th>
<th>{{ __('patient_finance.optics_quantities') }}</th>
<th>{{ __('patient_finance.optics_subtotals') }}</th>
<th>{{ __('patient_finance.patient_amount_paid') }}</th>
<th>{{ __('patient_finance.payment_date') }}</th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
@foreach($paid_opticals as $paid_optical)
@php
// check if this payment was from central billing
$central_billing_count = \Illuminate\Support\Facades\DB::table('central_billing_deposits')->where('receipt_number', $paid_optical->receipt_number)->count();
if ($central_billing_count > 0){
// skip this record so that it is only printed and cancelled from the central billings side
continue;
}
@endphp
<tr>
<td>{{ $paid_optical->receipt_number }}</td>
<td>
@php $items_counter = 1; @endphp
@php $optical_items_array = explode(",", $paid_optical->items); @endphp
@foreach($optical_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'eye_glasses') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $optical_quantity_array = explode(",", $paid_optical->quantity); @endphp
@foreach($optical_quantity_array as $quantity)
{{ $items_counter }}. {{ $quantity }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $optical_price_array = explode(",", $paid_optical->subtotals); @endphp
@foreach($optical_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
{{ ugandan_shillings($paid_optical->patient_amount_paid) }}
@if($paid_optical->refund_amount > 0)
<br><br>
<span style="color: orangered">
{{ ugandan_shillings($paid_optical->refund_amount) }} {{ __('patient_finance.was_refunded') }}
</span>
@endif
</td>
<td>{{ streamline_date_time($paid_optical->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_optical_items_receipt/1/{{ $paid_optical->receipt_number }}">Print Receipt</a>
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($paid_optical->receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
</td>
<td>
@if(is_null($paid_optical->received) && Auth::user()->can('cancel-patient-transaction'))
<a class="btn btn-danger btn-sm" href="/patient_finance/cancel_receipt/16/{{ $paid_optical->id }}">Cancel Receipt</a>
@endif
</td>
</tr>
@endforeach
@foreach($invoiced_opticals as $invoiced_optical)
@php
// check if this payment was from central billing
$central_billing_count = \Illuminate\Support\Facades\DB::table('central_billing_deposits')->where('receipt_number', $invoiced_optical->receipt_number)->count();
if ($central_billing_count > 0){
// skip this record so that it is only printed and cancelled from the central billings side
continue;
}
@endphp
<tr>
<td>{{ $invoiced_optical->receipt_number }}</td>
<td>
@php $items_counter = 1; @endphp
@php $optical_items_array = explode(",", $invoiced_optical->items_ids); @endphp
@foreach($optical_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'eye_glasses') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $optical_quantity_array = explode(",", $invoiced_optical->items_quantity); @endphp
@foreach($optical_quantity_array as $quantity)
{{ $items_counter }}. {{ $quantity }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $optical_price_array = explode(",", $invoiced_optical->items_amounts); @endphp
@foreach($optical_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
{{ ugandan_shillings($invoiced_optical->patient_amount) }}
</td>
<td>{{ streamline_date_time($invoiced_optical->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_optical_items_receipt/2/{{ $invoiced_optical->receipt_number }}">Print Invoice</a>
</td>
<td>
@if(is_null($invoiced_optical->received) && Auth::user()->can('cancel-patient-transaction'))
<a class="btn btn-danger btn-sm" href="/patient_finance/cancel_invoice/16/{{ $invoiced_optical->id }}">Cancel Invoice</a>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endif
<div class="row">
<div class="col-md-12">
@include('flash::message')
<div class="white-box">
@if($ordered_opticals->count() > 0)
@php
$opticals_ids = [];
$opticals_quantity = [];
$order_ids = [];
foreach($ordered_opticals as $ordered_optical){
$opticals_ids = array_merge($opticals_ids, explode(",", $ordered_optical->eye_glasses_id));
$opticals_quantity = array_merge($opticals_quantity, explode(",", $ordered_optical->quantity));
array_push($order_ids, $ordered_optical->id);
}
$count_orders = count($order_ids);
// create strings from arrays to use when submitting
$order_ids_string = implode(',', $order_ids);
$opticals_ids_string = implode(',', $opticals_ids);
@endphp
@if(Auth::user()->can('price-list-category-change-billing'))
{{ Form::open(['route' => 'patient_finance.make_deposit_optical_items', 'data-toggle' => 'validator']) }}
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('price_list_category_id', 'Price List Category') }}
<select name="price_list_category_id" class="form-control compulsory" required>
<option value="0">- {{ __('patient_finance.default_pricing') }} -</option>
@foreach($price_list_categories as $record)
<option value="{{ $record->id }}">{{ get_name($record->patient_category_id, 'id', 'name', 'patient_categories') }}</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-6">
<br>
{{ Form::button(__('patient_finance.apply_changes'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
</div>
</div>
<hr>
{{ Form::close() }}
@endif
{{ Form::open(['route' => 'patient_finance.store_optical_items_deposit', 'data-toggle' => 'validator']) }}
{{ Form::hidden('patient_id', $patient_id, ['id' => 'patient_id']) }}
{{ Form::hidden('episode_id', $episode_id, ['id' => 'episode_id']) }}
{{ Form::hidden('order_ids', $order_ids_string) }}
{{ Form::hidden('optical_ids', $opticals_ids_string) }}
{{ Form::hidden('tag_id', 19, ['id' => 'tag_id']) }}
<div class="row">
<div class="col-md-8">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="opticals_table">
<thead>
<tr>
<th style="width: 40%">{{ __('patient_finance.eye_glasses') }}</th>
<th style="width: 25%">{{ __('patient_finance.unit_cost') }}</th>
<th style="width: 10%">{{ __('patient_finance.quantity') }}</th>
<th style="width: 25%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php $orders_count = 0; @endphp
@for ($i = 0; $i < count($opticals_ids); $i++)
@php
// check if the patient category is attached to a price list
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_set && $price_list_set != 0){
$optical_amount = get_price_list_category_price($price_list_set, 7, $opticals_ids[$i]);
} elseif ($price_list_id) {
$optical_amount = get_price_list_category_price($price_list_id, 7, $opticals_ids[$i]);
} else {
$optical_amount = get_name($opticals_ids[$i], "id", "non_insured_price", "eye_glasses");
}
// get the subtotal for this item
$optical_subtotal = $opticals_quantity[$orders_count] * $optical_amount;
@endphp
<tr>
<td>{{ get_name($opticals_ids[$i], "id", "name", "eye_glasses") }}</td>
<td>
{{ Form::number('optical_amount[]', $optical_amount, ['class' => 'form-control col-sm-8', 'readonly']) }}
</td>
<td>
{{ Form::number('quantity[]', $opticals_quantity[$orders_count], ['class' => 'form-control col-sm-8', 'readonly']) }}
</td>
<td>
{{ Form::number('optical_subtotal[]', $optical_subtotal, ['class' => 'form-control col-sm-8 items_amounts', 'readonly']) }}
</td>
</tr>
@php $orders_count++; @endphp
@endfor
</tbody>
</table>
</div>
@if(is_donor_feature_enabled())
<br><hr>
<h4>{{ __('patient_finance.discount') }}</h4>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="discounts_table">
<thead>
<tr>
<th>{{ __('patient_finance.discount') }}</th>
<th>{{ __('patient_finance.donor_amount') }}</th>
<th>{{ __('patient_finance.patient_amount') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{ Form::select('donor_discount', $discount_options, '', ['class' => 'form-control col-sm-12', 'onchange' => 'show_discounts_amounts(this.value)']) }}
</td>
<td><div id="donor_discount"></div></td>
<td><div id="patient_discount"></div></td>
</tr>
</tbody>
</table>
<!-- is the controller to check if discount is selected if value is anything other than 0 -->
{{ Form::hidden('discount_type', 0, ['id' => 'discount_type']) }}
</div>
@endif
</div>
@include('patient_finance::patient_finance.make_deposit_totals_section')
</div>
{{ Form::close() }}
@else
<h4 class="text-center" style="color: red">{{ __('patient_finance.no_ordered_optics') }}</h4>
@endif
</div>
</div>
</div>
<!-- include the debt plan modal partial -->
@include('patient_finance::patient_finance.debt.debt_plan')
<!-- include the credit limit modal partial -->
@include('patient_finance::patient_finance.credit_limit_modal')
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
// check if the patient has paid and a pdf print is required
if ($('#print_cashier_receipt_pdf').val() == 1) {
var win = window.open('/patient_finance/print_item_receipt_pdf', '_blank');
if (win) {
win.focus();
} else {
alert('Please allow popups for Stre@mline');
}
}
</script>
@endpush
@push('styles')
<style>
.modal-dialog {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%) !important;
}
</style>
@endpush
@@ -0,0 +1,401 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<style type="text/css">
#discounts_table td{
border-left: 1px solid #dddddd;
}
#paid_procedures_table td{
border-left: 1px solid #dddddd;
}
#procedures_table td{
border-left: 1px solid #dddddd;
}
</style>
@endpush
@section('content')
{{-- Hide the print option here outside of the form --}}
@if(session()->get("print_cashier_receipt_pdf") == 1)
{{ Form::hidden('print_cashier_receipt_pdf', 1, ['id' => 'print_cashier_receipt_pdf']) }}
@endif
@php $co_payment = check_patient_category_co_payment_status($patient->category_id); @endphp
@if(check_if_episode_is_a_followup($episode->id))
@php
$parent_episode_details = \Streamline\Models\PatientEpisode::find($episode->parent_episode_id);
$parent_episode_ordered_procedures = \Streamline\Models\OrderedProcedure::where(['episode_id' => $episode->parent_episode_id,'payment_status' => '0'])->get();
$parent_episode_paid_procedures = \Streamline\Models\ProcedureDeposit::where(['episode_id' => $episode->parent_episode_id])->orderBy('created_at', 'desc')->get();
@endphp
@endif
<div class="row bg-title">
<div class="col-md-7">
<h4 class="page-title">
{{ __('patient_finance.procedures_for_episode_started') }} : <span style="color: #0000FF">{{ streamline_date($episode->created_at) }}</span>{!! isset($parent_episode_details) ? "<span style='color: green;'> (" . __('.episode_is_review') . " ". streamline_date($parent_episode_details->created_at).")</span>" : '' !!}
</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
</ol>
</div>
</div>
@if(check_if_episode_is_a_followup($episode->id))
@include('patient_finance::patient_finance.make_deposit_procedures_review')
@endif
@if($paid_procedures->count() > 0 || count($invoiced_procedures) > 0)
<div class="white-box">
<div class="row">
<div class="col-md-12">
<h4>{{ __('patient_finance.procedure_payments') }}</h4>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="paid_procedures_table">
<thead>
<tr>
<th>#</th>
<th>{{ __('patient_finance.receipt_number') }}</th>
<th>{{ __('patient_finance.cashier') }}</th>
<th>{{ __('patient_finance.procedure_items') }}</th>
<th>{{ __('patient_finance.procedure_prices') }}</th>
<th>{{ __('patient_finance.patient_amount_paid') }}</th>
<th>{{ __('patient_finance.payment_date') }}</th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
@php $counter = 1; @endphp
@foreach($paid_procedures as $procedure)
@php
// check if this payment was from central billing
$central_billing_count = \Illuminate\Support\Facades\DB::table('central_billing_deposits')->where('receipt_number', $procedure->receipt_number)->count();
$chi_count = \Illuminate\Support\Facades\DB::table('chi_deposits')->where('receipt_number', $procedure->receipt_number)->count();
if ($central_billing_count > 0 || $chi_count > 0){
// skip this record so that it is only printed and cancelled from the central billings side
continue;
}
@endphp
<tr>
<td>{{ $counter }}</td>
<td>{{ $procedure->receipt_number }}</td>
<td>{{ get_full_name($procedure->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>
@php $items_counter = 1; @endphp
@php $procedure_items_array = explode(",", $procedure->procedure_items); @endphp
@foreach($procedure_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'procedures') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $procedure_price_array = explode(",", $procedure->procedure_amounts); @endphp
@foreach($procedure_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
{{ ugandan_shillings($procedure->patient_amount_paid) }}
@if($procedure->refund_amount > 0)
<br><br>
<span style="color: orangered">
{{ ugandan_shillings($procedure->refund_amount) }} {{ __('patient_finance.was_refunded') }}
</span>
@endif
</td>
<td>{{ streamline_date_time($procedure->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_procedures_receipt/1/{{ $procedure->receipt_number }}">{{ __('patient_finance.print_receipt') }}</a>
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($procedure->receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
</td>
<td>
@if(is_null($procedure->received) && can_receipt_be_cancelled($procedure->receipt_number) && Auth::user()->can('cancel-patient-transaction'))
<a class="btn btn-danger btn-sm" href="/patient_finance/cancel_receipt/4/{{ $procedure->id }}">{{ __('patient_finance.cancel_receipt') }}</a>
@endif
</td>
</tr>
@php $counter++; @endphp
@endforeach
@foreach($invoiced_procedures as $procedure)
@php
// check if this payment was from central billing
$central_billing_count = \Illuminate\Support\Facades\DB::table('central_billing_deposits')->where('receipt_number', $procedure->receipt_number)->count();
if ($central_billing_count > 0){
// skip this record so that it is only printed and cancelled from the central billings side
continue;
}
@endphp
<tr>
<td>{{ $counter }}</td>
<td>{{ $procedure->receipt_number }}</td>
<td>
@php $items_counter = 1; @endphp
@php $procedure_items_array = explode(",", $procedure->items_ids); @endphp
@foreach($procedure_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'procedures') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $procedure_price_array = explode(",", $procedure->items_amounts); @endphp
@foreach($procedure_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
<span style="color:#0000FF">{{ __('patient_finance.invoiced') }}</span>
</td>
<td>{{ streamline_date_time($procedure->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_procedures_receipt/2/{{ $procedure->receipt_number }}">{{ __('patient_finance.print_invoice') }}</a>
</td>
<td>
@if($procedure->invoiced == 0 && can_receipt_be_cancelled($procedure->receipt_number) && Auth::user()->can('cancel-patient-transaction'))
<a class="btn btn-danger btn-sm" href="/patient_finance/cancel_invoice/4/{{ $procedure->id }}">{{ __('patient_finance.cancel_invoice') }}</a>
@endif
</td>
</tr>
@php $counter++; @endphp
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endif
<div class="row">
<div class="col-md-12">
@include('flash::message')
<div class="white-box">
@if(patient_insurance_status($patient_id) == 1)
<a href="/patient_finance/make_chi_deposits/2" class="btn btn-success btn-sm">View CHI Deposits Receipts</a>
<br><br>
@endif
@if($ordered_procedures->count() > 0)
@php
$procedure_ids = array();
$order_ids = array();
$eye_applications = []; // whether to double the price for both eyes or 1
// amounts at the time was ordered
$procedures_orders_amounts = [];
foreach($ordered_procedures as $ordered_procedure){
$procedure_ids = array_merge($procedure_ids, explode(",", $ordered_procedure->procedure_id));
$eye_applications = array_merge($eye_applications, explode(",", $ordered_procedure->eye));
array_push($order_ids, $ordered_procedure->id);
//if amounts are put at the time of ordering
$procedures_orders_amounts = is_null($ordered_procedure->procedure_amount) ? array_merge($procedures_orders_amounts, []) : array_merge($procedures_orders_amounts, explode(",", $ordered_procedure->procedure_amount));
}
$count_orders = count($order_ids);
// create strings from arrays to use when submitting
$order_ids_string = implode(',', $order_ids);
$procedure_ids_string = implode(',', $procedure_ids);
$procedure_orders_amounts_string = implode(',', $procedures_orders_amounts);
@endphp
@if(Auth::user()->can('price-list-category-change-billing'))
{{ Form::open(['route' => 'patient_finance.make_deposit_procedures', 'data-toggle' => 'validator']) }}
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('price_list_category_id', 'Price List Category') }}
<select name="price_list_category_id" class="form-control compulsory" required>
<option value="0">- {{ __('patient_finance.default_pricing') }} -</option>
@foreach($price_list_categories as $record)
<option value="{{ $record->id }}">{{ get_name($record->patient_category_id, 'id', 'name', 'patient_categories') }}</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-6">
<br>
{{ Form::button(__('patient_finance.apply_changes'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
</div>
</div>
<hr>
{{ Form::close() }}
@endif
{{ Form::open(['route' => 'patient_finance.store_deposit_procedures', 'data-toggle' => 'validator']) }}
{{ Form::hidden('patient_id', $patient_id, ['id' => 'patient_id']) }}
{{ Form::hidden('episode_id', $episode_id, ['id' => 'episode_id']) }}
{{ Form::hidden('order_ids', $order_ids_string) }}
{{ Form::hidden('procedure_ids', $procedure_ids_string) }}
{{ Form::hidden('procedure_order_amounts', $procedure_orders_amounts_string) }}
{{ Form::hidden('tag_id', 4, ['id' => 'tag_id']) }}
<div class="row">
<div class="col-md-8">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="procedures_table">
<thead>
<tr>
<th style="width: 60%">{{ __('patient_finance.procedure_name') }}</th>
<th style="width: 40%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php
$procedure_amount_total = 0;
$procedure_amount = 0;
@endphp
@for ($i = 0; $i < count($procedure_ids); $i++)
@php
$eye_application_multiplier = ((isset($eye_applications[$i]) && $eye_applications[$i] == 2) ? 2 : 1);
// check if the patient category is attached to a price list
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_set && $price_list_set != 0){
$procedure_amount = get_price_list_category_price($price_list_set, 4, $procedure_ids[$i]);
} elseif ($price_list_id) {
$procedure_amount = get_price_list_category_price($price_list_id, 4, $procedure_ids[$i]);
} else {
//if amount was set at time of ordering
if (isset($procedures_orders_amounts[$i]) && !is_null($procedures_orders_amounts[$i])) {
$procedure_amount = $procedures_orders_amounts[$i];
$eye_application_multiplier = 1;
} else{
$procedure_amount = get_name($procedure_ids[$i], "id", "non_insured_price", "procedures");
}
}
// add amounts to totals
$procedure_amount = $procedure_amount * $eye_application_multiplier;
$procedure_amount_total += $procedure_amount;
@endphp
<tr @if(!Auth::user()->can('view-item-prices')) style="display: none" @endif>
<td>
<label>{{ get_name($procedure_ids[$i], "id", "name", "procedures") }}</label>
</td>
<td>
{{ Form::number('procedure_amount[]', $procedure_amount, ['class' => 'form-control col-sm-8 items_amounts', 'readonly']) }}
</td>
</tr>
@endfor
@if(!Auth::user()->can('view-item-prices'))
<tr>
<td>{{ __('patient_finance.procedures') }}</td>
<td>{{ ugandan_shillings($procedure_amount_total) }}</td>
</tr>
@endif
{{ Form::hidden('procedure_amount_total', $procedure_amount_total) }}
</tbody>
</table>
</div>
@if(is_donor_feature_enabled())
<br><hr>
<h4>{{ __('patient_finance.discount') }}</h4>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="discounts_table">
<thead>
<tr>
<th>{{ __('patient_finance.discount') }}</th>
<th>{{ __('patient_finance.donor_amount') }}</th>
<th>{{ __('patient_finance.patient_amount') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{ Form::select('donor_discount', $discount_options, '', ['class' => 'form-control col-sm-12', 'onchange' => 'show_discounts_amounts(this.value)']) }}
</td>
<td><div id="donor_discount"></div></td>
<td><div id="patient_discount"></div></td>
</tr>
</tbody>
</table>
<!-- is the controller to check if discount is selected if value is anything other than 0 -->
{{ Form::hidden('discount_type', 0, ['id' => 'discount_type']) }}
</div>
@endif
</div>
@include('patient_finance::patient_finance.make_deposit_totals_section')
</div>
{{ Form::close() }}
@else
<h4 class="text-center" style="color: red">{{ __('patient_finance.no_ordered_procedures') }}</h4>
@endif
</div>
</div>
</div>
<!-- include the debt plan modal partial -->
@include('patient_finance::patient_finance.debt.debt_plan')
<!-- include the credit limit modal partial -->
@include('patient_finance::patient_finance.credit_limit_modal')
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
// check if the patient has paid and a pdf print is required
if ($('#print_cashier_receipt_pdf').val() == 1) {
var win = window.open('/patient_finance/print_item_receipt_pdf', '_blank');
if (win) {
win.focus();
} else {
alert('Please allow popups for Stre@mline');
}
}
</script>
@endpush
@push('styles')
<style>
.modal-dialog {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%) !important;
}
</style>
@endpush
@@ -0,0 +1,144 @@
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<h5 style="color: maroon;"><b>{{ __('patient_finance.procedures_original_episode') }} {{ streamline_date($parent_episode_details->created_at) }}</b></h5>
@if(count($parent_episode_paid_procedures) > 0)
<strong>{{ __('patient_finance.procedure_payments') }}</strong>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="paid_procedures_table">
<thead>
<tr>
<th>#</th>
<th>{{ __('patient_finance.receipt_number') }}</th>
<th>{{ __('patient_finance.procedure_items') }}</th>
<th>{{ __('patient_finance.procedure_prices') }}</th>
<th>{{ __('patient_finance.patient_amount_paid') }}</th>
<th>{{ __('patient_finance.payment_date') }}</th>
<th></th>
</tr>
</thead>
<tbody>
@php $counter = 1; @endphp
@foreach($parent_episode_paid_procedures as $procedure)
<tr>
<td>{{ $counter }}</td>
<td>{{ $procedure->receipt_number }}</td>
<td>
@php $items_counter = 1; @endphp
@php $procedure_items_array = explode(",", $procedure->procedure_items); @endphp
@foreach($procedure_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'procedures') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $procedure_price_array = explode(",", $procedure->procedure_amounts); @endphp
@foreach($procedure_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
{{ ugandan_shillings($procedure->patient_amount_paid) }}
@if($procedure->refund_amount > 0)
<br><br>
<span style="color: orangered">
{{ ugandan_shillings($procedure->refund_amount) }} {{ __('patient_finance.was_refunded') }}
</span>
@endif
</td>
<td>{{ streamline_date_time($procedure->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_procedures_receipt/1/{{ $procedure->id }}">{{ __('patient_finance.print_receipt') }}</a>
</td>
</tr>
@php $counter++; @endphp
@endforeach
</tbody>
</table>
</div>
@endif
@if(count($parent_episode_ordered_procedures) > 0)
@php
$parent_episode_procedure_ids = array();
$parent_episode_order_ids = array();
foreach($parent_episode_ordered_procedures as $parent_episode_ordered_procedure){
$parent_episode_procedure_ids = array_merge($parent_episode_procedure_ids, explode(",", $parent_episode_ordered_procedure->procedure_id));
array_push($parent_episode_order_ids, $parent_episode_ordered_procedure->id);
}
$count_orders = count($parent_episode_order_ids);
// create strings from arrays to use when submitting
$parent_episode_order_ids_string = implode(',', $parent_episode_order_ids);
$parent_episode_procedure_ids_string = implode(',', $parent_episode_procedure_ids);
@endphp
<div style="background-color: #f9e3dc; padding-top: 5px;">
<strong>{{ __('patient_finance.unpaid_procedures') }}</strong>
<div class="row">
<div class="col-sm-10">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="procedures_table">
<thead>
<tr>
<th style="width: 60%">{{ __('patient_finance.procedure_name') }}</th>
<th style="width: 40%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php
$parent_episode_procedure_amount_total = 0;
$parent_episode_procedure_amount = 0;
@endphp
@foreach ($parent_episode_procedure_ids as $parent_episode_procedure_id)
@php
// check if the patient category is attached to a price list
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_set && $price_list_set != 0){
$parent_episode_procedure_amount = get_price_list_category_price($price_list_set, 4, $parent_episode_procedure_id);
} elseif ($price_list_id) {
$parent_episode_procedure_amount = get_price_list_category_price($price_list_id, 4, $parent_episode_procedure_id);
} else {
$parent_episode_procedure_amount = get_name($parent_episode_procedure_id, "id", "non_insured_price", "procedures");
}
// add amounts to totals
$parent_episode_procedure_amount_total += $parent_episode_procedure_amount;
@endphp
<tr>
<td>
<label>{{ get_name($parent_episode_procedure_id, "id", "name", "procedures") }}</label>
</td>
<td>
{{ Form::number('procedure_amount[]', $parent_episode_procedure_amount, ['class' => 'form-control col-sm-8 procedure_amount', 'readonly']) }}
</td>
</tr>
@endforeach
{{ Form::hidden('procedure_amount_total', $parent_episode_procedure_amount_total) }}
</tbody>
</table>
</div>
</div>
<div class="col-sm-2">
<div>
{{ Form::open(['route' => 'patient_finance.select_payment_option']) }}
{{ Form::hidden('episode_id', $parent_episode_details->id) }}
<button type="submit" name="procedures" class="btn btn-success btn-sm btn-rd" value="procedures">{{ __('patient_finance.pay_for_procedures') }}</button>
{{ Form::close() }}
</div>
</div>
</div>
</div>
@endif
</div>
</div>
</div>
@@ -0,0 +1,521 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<style type="text/css">
#discounts_table td{
border-left: 1px solid #dddddd;
}
#paid_services_table td{
border-left: 1px solid #dddddd;
}
#services_table td{
border-left: 1px solid #dddddd;
}
</style>
@endpush
@section('content')
{{-- Hide the print option here outside of the form --}}
@if(session()->get("print_cashier_receipt_pdf") == 1)
{{ Form::hidden('print_cashier_receipt_pdf', 1, ['id' => 'print_cashier_receipt_pdf']) }}
@endif
@php
$co_payment = check_patient_category_co_payment_status($patient->category_id);
$service_items_array = [];
$patient_insurance_status = patient_insurance_status($patient_id);
@endphp
<!-- not to self: this blade is used by both consultations, services and co_payments so remember to add an if stmt -->
@if(check_if_episode_is_a_followup($episode->id))
@php
$parent_episode_details = \Streamline\Models\PatientEpisode::find($episode->parent_episode_id);
$parent_episode_paid_services = \Streamline\Models\ServiceDeposit::where(['episode_id' => $episode->parent_episode_id, 'service_type' => $deposit_type])->orderBy('created_at', 'desc')->get();
@endphp
@endif
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ $deposit_type }} {{ __('patient_finance.for_episode_started') }} : <span style="color:#0000FF">{{ streamline_date($episode->created_at) }}</span>{!! isset($parent_episode_details) ? "<span style='color: green;'> (" . __('.episode_is_review') . " ". streamline_date($parent_episode_details->created_at).")</span>" : '' !!}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.service_payment') }}</li>
</ol>
</div>
</div>
@if(check_if_episode_is_a_followup($episode->id))
@include('patient_finance::patient_finance.make_deposit_services_review')
@endif
@if($paid_services->count() > 0 || count($invoiced_services) > 0)
<div class="white-box">
<div class="row">
<div class="col-md-12">
<h4>{{ __('patient_finance.service_payment') }}</h4>
<table class="table color-bordered-table success-bordered-table" id="paid_services_table">
<thead>
<tr>
<th>#</th>
<th>{{ __('patient_finance.receipt_number') }}</th>
<th>{{ __('patient_finance.cashier') }}</th>
<th>{{ __('patient_finance.service_items') }}</th>
<th>{{ __('patient_finance.service_prices') }}</th>
<th>{{ __('patient_finance.patient_amount_paid') }}</th>
<th>{{ __('patient_finance.payment_date') }}</th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
@php $counter = 1; @endphp
@foreach($paid_services as $service)
@php
// check if this payment was from central billing
$central_billing_count = \Illuminate\Support\Facades\DB::table('central_billing_deposits')->where('receipt_number', $service->receipt_number)->count();
$chi_count = \Illuminate\Support\Facades\DB::table('chi_deposits')->where('receipt_number', $service->receipt_number)->count();
if ($central_billing_count > 0 || $chi_count > 0){
// skip this record so that it is only printed and cancelled from the central billings side
continue;
}
@endphp
<tr>
<td>{{ $counter }}</td>
<td>{{ $service->receipt_number }}</td>
<td>{{ get_full_name($service->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>
@php
$items_counter = 1;
$service_items_array = explode(",", $service->items_ids);
@endphp
@foreach($service_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'services') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php
$items_counter = 1;
$service_price_array = explode(",", $service->items_amounts);
@endphp
@foreach($service_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
{{ ugandan_shillings($service->patient_amount_paid) }}
@if($service->refund_amount > 0)
<br><br>
<span style="color: orangered">
{{ ugandan_shillings($service->refund_amount) }} {{ __('patient_finance.was_refunded') }}
</span>
@endif
</td>
<td>{{ streamline_date_time($service->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_service_receipt/1/{{ $service->receipt_number }}">{{ __('patient_finance.print_receipt') }}</a>
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($service->receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
</td>
<td>
@if(is_null($service->received) && can_receipt_be_cancelled($service->receipt_number) && Auth::user()->can('cancel-patient-transaction'))
<a class="btn btn-danger btn-sm" href="/patient_finance/cancel_receipt/8/{{ $service->id }}">Cancel Receipt</a>
@endif
</td>
</tr>
@php $counter++; @endphp
@endforeach
@foreach($invoiced_services as $service)
@php
// check if this payment was from central billing
$central_billing_count = \Illuminate\Support\Facades\DB::table('central_billing_deposits')->where('receipt_number', $service->receipt_number)->count();
if ($central_billing_count > 0){
// skip this record so that it is only printed and cancelled from the central billings side
continue;
}
@endphp
<tr>
<td>{{ $counter }}</td>
<td>{{ $service->receipt_number }}</td>
<td>
@php
$items_counter = 1;
$service_items_array = explode(",", $service->items_ids);
@endphp
@foreach($service_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'services') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php
$items_counter = 1;
$service_price_array = explode(",", $service->items_amounts);
@endphp
@foreach($service_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
<span style="color:#0000FF">{{ __('patient_finance.invoiced') }}</span>
</td>
<td>{{ streamline_date_time($service->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_service_receipt/2/{{ $service->receipt_number }}">{{ __('patient_finance.print_invoice') }}</a>
</td>
<td>
@if($service->invoiced == 0 && can_receipt_be_cancelled($service->receipt_number) && Auth::user()->can('cancel-patient-transaction'))
<a class="btn btn-danger btn-sm" href="/patient_finance/cancel_invoice/8/{{ $service->id }}">{{ __('patient_finance.cancel_invoice') }}</a>
@endif
</td>
</tr>
@php $counter++; @endphp
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endif
<div class="row">
<div class="col-md-12">
@include('flash::message')
<div class="white-box">
@if($patient_insurance_status == 1)
<a href="/patient_finance/make_chi_deposits/1" class="btn btn-success btn-sm">View CHI Deposits Receipts</a>
<br><br>
@endif
<!-- check if there are registered service items, display error if not -->
@if($service_items->count() > 0)
@if(Auth::user()->can('price-list-category-change-billing'))
@if($tag_id == 6)
{{ Form::open(['route' => 'patient_finance.make_deposit_consultation', 'data-toggle' => 'validator']) }}
@elseif($tag_id == 8)
{{ Form::open(['route' => 'patient_finance.make_deposit_other_services', 'data-toggle' => 'validator']) }}
@elseif($tag_id == 7)
{{ Form::open(['route' => 'patient_finance.make_deposit_co_payments', 'data-toggle' => 'validator']) }}
@endif
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('price_list_category_id', 'Price List Category') }}
<select name="price_list_category_id" class="form-control compulsory" required>
<option value="0">- {{ __('patient_finance.default_pricing') }} -</option>
@foreach($price_list_categories as $record)
<option value="{{ $record->id }}">{{ get_name($record->patient_category_id, 'id', 'name', 'patient_categories') }}</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-6">
<br>
{{ Form::button(__('patient_finance.apply_changes'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
</div>
</div>
<hr>
{{ Form::close() }}
@endif
{{ Form::open(['route' => 'patient_finance.store_deposit_services', 'data-toggle' => 'validator']) }}
{{ Form::hidden('patient_id', $patient_id, ['id' => 'patient_id']) }}
{{ Form::hidden('episode_id', $episode_id, ['id' => 'episode_id']) }}
{{ Form::hidden('service_type', $deposit_type, ['id' => 'service_type']) }}
{{ Form::hidden('tag_id', $tag_id, ['id' => 'tag_id']) }}
@php
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
@endphp
@if($price_list_id && !($price_list_set && $price_list_set != 0))
{{ Form::hidden('price_list_category', $price_list_id, ['id' => 'price_list_category']) }}
@else
{{ Form::hidden('price_list_category', $price_list_set, ['id' => 'price_list_category']) }}
@endif
<div class="row">
<div class="col-md-8">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="services_table">
<thead>
<tr>
<th style="width: 5%">#</th>
<th style="width: 60%">{{ $deposit_type }}</th>
<th>{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td class="center">
<input type="checkbox" name="chk" />
</td>
<td>
<select name='service_id[]' id='1000' class="form-control col-sm-12" onchange="show_service_price(this.value, this.id)">
<option>--{{ __('patient_finance.select_service') }}--</option>
@foreach($service_items as $item)
<option value='{{ $item->id }}'>{{ $item->name }}</option>
@endforeach
</select>
</td>
<td><div id="0"></div></td>
</tr>
@if(!empty($used_services))
@foreach($used_services as $used_service)
@php
$service_ids = explode(",", $used_service->service_id);
$service_quantity = explode(",", $used_service->quantity);
$ordered_services_amounts = (is_null($used_service->service_amount) || $used_service->service_amount == '') ? []: explode(",", $used_service->service_amount);
$total_services_costs = 0;
@endphp
{{ Form::hidden('order_ids[]', $used_service->id) }}
@for($i = 0; $i < count($service_ids); $i++)
<tr @if(!Auth::user()->can('view-item-prices')) style="display: none" @endif>
<td class="center"></td>
<td>
{{ Form::hidden('service_id[]', $service_ids[$i]) }}
{{ Form::text('service_text[]', get_name($service_ids[$i], "id", "name", "services"), ['class' => 'form-control', 'readonly']) }}
</td>
@php
$service_cost = 0;
if($price_list_set && $price_list_set != 0){
$service_cost = get_price_list_category_price($price_list_set, 6, $service_ids[$i]);
}else if($price_list_id){
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
$service_cost = get_price_list_category_price($price_list_id, 6, $service_ids[$i]);
} else {
$pre_order = \Streamline\Models\Services::withTrashed()->find($service_ids[$i]);
//if amount was set at time of ordering
if (isset($ordered_services_amounts[$i]) && !is_null($ordered_services_amounts[$i])) {
$service_cost = $ordered_services_amounts[$i];
} else{
$service_cost = $pre_order->non_insured_price;
}
}
$total_services_costs += ($service_cost * $service_quantity[$i]);
@endphp
<td>
<input type="number" class="form-control items_amounts" name="service_amount[]" readonly="" value="{{ $service_cost * $service_quantity[$i] }}">
</td>
</tr>
@endfor
@if(!Auth::user()->can('view-item-prices'))
<tr>
<td></td>
<td>{{ $deposit_type }}</td>
<td>{{ ugandan_shillings($total_services_costs) }}</td>
</tr>
@endif
@endforeach
@endif
</tbody>
</table>
</div>
<div id="modify_table_buttons">
<input type="button" class = "btn btn-success btn-sm" value="<?php echo __('patient_finance.add_row') ?>" onclick="add_service_row('services_table')" />
<input type="button" class = "btn btn-danger btn-sm" value="<?php echo __('patient_finance.delete_row') ?>" onclick="delete_service_row('services_table')" />
</div>
@if(is_donor_feature_enabled())
<br><hr>
<h4>{{ __('patient_finance.discount') }}</h4>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="discounts_table">
<thead>
<tr>
<th>{{ __('patient_finance.discount') }}</th>
<th>{{ __('patient_finance.donor_amount') }}</th>
<th>{{ __('patient_finance.patient_amount') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{ Form::select('donor_discount', $discount_options, '', ['class' => 'form-control col-sm-12', 'onchange' => 'show_discounts_amounts(this.value)']) }}
</td>
<td><div id="donor_discount"></div></td>
<td><div id="patient_discount"></div></td>
</tr>
</tbody>
</table>
<!-- is the controller to check if discount is selected if value is anything other than 0 -->
{{ Form::hidden('discount_type', 0, ['id' => 'discount_type']) }}
</div>
@endif
</div>
@include('patient_finance::patient_finance.make_deposit_totals_section')
</div>
{{ Form::close() }}
@else
<h4 class="text-center" style="color: red">{{ __('patient_finance.there_are_no_registered') }} {{ $deposit_type }} {{ __('patient_finance.records_in_the_system') }}</h4>
@endif
</div>
</div>
</div>
<!-- include the debt plan modal partial -->
@include('patient_finance::patient_finance.debt.debt_plan')
<!-- include the credit limit modal partial -->
@include('patient_finance::patient_finance.credit_limit_modal')
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
// check if the patient has paid and a pdf print is required
if ($('#print_cashier_receipt_pdf').val() == 1) {
var win = window.open('/patient_finance/print_item_receipt_pdf', '_blank');
if (win) {
win.focus();
} else {
alert('Please allow popups for Stre@mline');
}
}
// temporary row count
let rowCount = 1;
// add another row to the services table
function add_service_row(tableID) {
let table = document.getElementById(tableID);
rowCount = table.rows.length;
let row = table.insertRow(rowCount);
let colCount = table.rows[0].cells.length;
for (let i = 0; i < colCount; i++) {
let newcell = row.insertCell(i);
newcell.innerHTML = table.rows[1].cells[i].innerHTML;
if (i === 1) {
newcell.childNodes[0].id = rowCount + 1000;
/*added to auto increment the id of the newly added select element*/
newcell.childNodes[0].nextSibling.id = rowCount + 1000;
}
if (i === 2) {
table.rows[rowCount].cells[2].innerHTML = '';
table.rows[rowCount].cells[2].innerHTML = '<div id="' + rowCount + '"></div>';
}
switch (newcell.childNodes[0].type) {
case "text":
newcell.childNodes[0].value = "";
break;
case "checkbox":
newcell.childNodes[0].checked = false;
break;
case "select-one":
newcell.childNodes[0].selectedIndex = "";
break;
}
}
}
// delete row to the services table
function delete_service_row(tableID) {
try {
let table = document.getElementById(tableID);
let rowCount = table.rows.length;
for (let i = 0; i < rowCount; i++) {
let row = table.rows[i];
let chkbox = row.cells[0].childNodes[1];
if (null != chkbox && true === chkbox.checked) {
if (rowCount <= 2) {
alert("<?php echo __('patient_finance.cannot_delete_all_warning') ?>");
break;
}
table.deleteRow(i);
rowCount--;
i--;
}
}
} catch (e) {
alert(e);
}
}
// display the appropriate price of the service
function show_service_price(service_id, prompt_div_id) {
// get patient id
let patient_id = $('#patient_id').val();
let price_list_category = $('#price_list_category').val();
$.ajax({
method: 'POST',
url: '/patient_finance/get_service_cost',
data: {'patient_id' : patient_id, 'service_id' : service_id, 'price_list_category' : price_list_category},
success: function(response){
// add amount to div
$('#' + (prompt_div_id - 1000)).html(response);
// enable button for calculating
$('#calculate_button').attr('disabled', false);
calculate_values();
}
});
}
</script>
@endpush
@push('styles')
<style>
.modal-dialog {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%) !important;
}
</style>
@endpush
@@ -0,0 +1,67 @@
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<h5 style="color: maroon;"><b>{{ __('patient_finance.for_episode_started') }} {{ streamline_date($parent_episode_details->created_at) }}</b></h5>
@if(count($parent_episode_paid_services) > 0)
<strong>{{ __('patient_finance.paid_consultations') }}</strong>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="paid_services_table">
<thead>
<tr>
<th>#</th>
<th>{{ __('patient_finance.receipt_number') }}</th>
<th>{{ __('patient_finance.service_items') }}</th>
<th>{{ __('patient_finance.service_prices') }}</th>
<th>{{ __('patient_finance.patient_amount_paid') }}</th>
<th>{{ __('patient_finance.payment_date') }}</th>
<th></th>
</tr>
</thead>
<tbody>
@php $counter = 1; @endphp
@foreach($parent_episode_paid_services as $service)
<tr>
<td>{{ $counter }}</td>
<td>{{ $service->receipt_number }}</td>
<td>
@php $items_counter = 1; @endphp
@php $service_items_array = explode(",", $service->items_ids); @endphp
@foreach($service_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'services') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $service_price_array = explode(",", $service->items_amounts); @endphp
@foreach($service_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
{{ ugandan_shillings($service->patient_amount_paid) }}
@if($service->refund_amount > 0)
<br><br>
<span style="color: orangered">
{{ ugandan_shillings($service->refund_amount) }} {{ __('patient_finance.was_refunded') }}
</span>
@endif
</td>
<td>{{ streamline_date_time($service->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_service_receipt/1/{{ $service->id }}">{{ __('patient_finance.print_receipt') }}</a>
</td>
</tr>
@php $counter++; @endphp
@endforeach
</tbody>
</table>
</div>
@else
<div><code>{{ __('patient_finance.no_consultation_in_period') }}</code></div>
@endif
</div>
</div>
</div>
@@ -0,0 +1,457 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<style type="text/css">
#discounts_table td{
border-left: 1px solid #dddddd;
}
#paid_treatments_table td{
border-left: 1px solid #dddddd;
}
#treatments_table td{
border-left: 1px solid #dddddd;
}
</style>
@endpush
@section('content')
{{-- Hide the print option here outside of the form --}}
@if(session()->get("print_cashier_receipt_pdf") == 1)
{{ Form::hidden('print_cashier_receipt_pdf', 1, ['id' => 'print_cashier_receipt_pdf']) }}
@endif
@php
$co_payment = check_patient_category_co_payment_status($patient->category_id);
$treatment_balance = 0;
@endphp
@if(check_if_episode_is_a_followup($episode->id))
@php
$parent_episode_details = \Streamline\Models\PatientEpisode::find($episode->parent_episode_id);
$parent_episode_treatment = \Streamline\Models\Treatment::where(['payment_status' => 0, 'episode_id' => $episode->parent_episode_id])->first();
$parent_episode_paid_treatments = \Streamline\Models\TreatmentDeposits::where(['episode_id' => $episode->parent_episode_id])->get();
@endphp
@endif
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.treatment_for_episode') }} : <span style="color:#0000FF">{{ streamline_date($episode->created_at) }}</span>{!! isset($parent_episode_details) ? "<span style='color: green;'> (" . __('.episode_is_review') . " ". streamline_date($parent_episode_details->created_at).")</span>" : '' !!}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.treatment_payment') }}</li>
</ol>
</div>
</div>
@if(check_if_episode_is_a_followup($episode->id))
@include('patient_finance::patient_finance.make_deposit_treatment_review')
@endif
@if(count($paid_treatments) > 0 || count($invoiced_treatments) > 0)
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<h4>{{ __('patient_finance.treatment_payment') }}</h4>
<table class="table color-bordered-table success-bordered-table" id="paid_treatments_table">
<thead>
<tr>
<th>{{ __('patient_finance.receipt_number') }}</th>
<th>{{ __('patient_finance.cashier') }}</th>
<th>{{ __('patient_finance.treatment_items') }}</th>
<th>{{ __('patient_finance.treatment_quantities') }}</th>
<th>{{ __('patient_finance.treatment_subtotals') }}</th>
<th>{{ __('patient_finance.patient_amount_paid') }}</th>
<th>{{ __('patient_finance.payment_date') }}</th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
@foreach($paid_treatments as $paid_treatment)
@php
// check if this payment was from central billing
$central_billing_count = \Illuminate\Support\Facades\DB::table('central_billing_deposits')->where('receipt_number', $paid_treatment->receipt_number)->count();
$chi_count = \Illuminate\Support\Facades\DB::table('chi_deposits')->where('receipt_number', $paid_treatment->receipt_number)->count();
if ($central_billing_count > 0 || $chi_count > 0){
// skip this record so that it is only printed and cancelled from the central billings side
continue;
}
@endphp
<tr>
<td>{{ $paid_treatment->receipt_number }}</td>
<td>{{ get_full_name($paid_treatment->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>
@php $items_counter = 1; @endphp
@php $treatment_items_array = explode(",", $paid_treatment->treatment_items); @endphp
@foreach($treatment_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'drugs') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $treatment_quantity_array = explode(",", $paid_treatment->treatment_quantities); @endphp
@foreach($treatment_quantity_array as $quantity)
{{ $items_counter }}. {{ $quantity }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $treatment_price_array = explode(",", $paid_treatment->treatment_subtotals); @endphp
@foreach($treatment_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
{{ ugandan_shillings($paid_treatment->patient_amount_paid) }}
@if($paid_treatment->refund_amount > 0)
<br><br>
<span style="color: orangered">
{{ ugandan_shillings($paid_treatment->refund_amount) }} {{ __('patient_finance.was_refunded') }}
</span>
@endif
</td>
<td>{{ streamline_date_time($paid_treatment->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_treatment_receipt/1/{{ $paid_treatment->receipt_number }}">{{ __('patient_finance.print_receipt') }}</a>
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($paid_treatment->receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
</td>
<td>
@if(is_null($paid_treatment->received) && can_receipt_be_cancelled($paid_treatment->receipt_number) && Auth::user()->can('cancel-patient-transaction'))
<a class="btn btn-danger btn-sm" href="/patient_finance/cancel_receipt/3/{{ $paid_treatment->id }}">{{ __('patient_finance.cancel_receipt') }}</a>
@endif
</td>
</tr>
@endforeach
@foreach($invoiced_treatments as $paid_treatment)
@php
// check if this payment was from central billing
$central_billing_count = \Illuminate\Support\Facades\DB::table('central_billing_deposits')->where('receipt_number', $paid_treatment->receipt_number)->count();
if ($central_billing_count > 0){
// skip this record so that it is only printed and cancelled from the central billings side
continue;
}
@endphp
<tr>
<td>{{ $paid_treatment->receipt_number }}</td>
<td>
@php $items_counter = 1; @endphp
@php $treatment_items_array = explode(",", $paid_treatment->items_ids); @endphp
@foreach($treatment_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'drugs') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $treatment_quantity_array = explode(",", $paid_treatment->items_quantity); @endphp
@foreach($treatment_quantity_array as $quantity)
{{ $items_counter }}. {{ $quantity }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $treatment_price_array = explode(",", $paid_treatment->items_amounts); @endphp
@foreach($treatment_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
<span style="color:#0000FF">{{ __('patient_finance.invoiced') }}</span>
</td>
<td>{{ streamline_date_time($paid_treatment->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_treatment_receipt/2/{{ $paid_treatment->receipt_number }}">{{ __('patient_finance.print_invoice') }}</a>
</td>
<td>
@if($paid_treatment->invoiced == 0 && can_receipt_be_cancelled($paid_treatment->receipt_number) && Auth::user()->can('cancel-patient-transaction'))
<a class="btn btn-danger btn-sm" href="/patient_finance/cancel_invoice/3/{{ $paid_treatment->id }}">{{ __('patient_finance.cancel_invoice') }}</a>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endif
<div class="row">
<div class="col-md-12">
@include('flash::message')
<div class="white-box">
@if(patient_insurance_status($patient_id) == 1)
<a href="/patient_finance/make_chi_deposits/4" class="btn btn-success btn-sm">View CHI Deposits Receipts</a>
<br><br>
@endif
@if(count($treatments) > 0)
@if(Auth::user()->can('price-list-category-change-billing'))
{{ Form::open(['route' => 'patient_finance.make_deposit_treatment', 'data-toggle' => 'validator']) }}
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('price_list_category_id', 'Price List Category') }}
<select name="price_list_category_id" class="form-control compulsory" required>
<option value="0">- {{ __('patient_finance.default_pricing') }} -</option>
@foreach($price_list_categories as $record)
<option value="{{ $record->id }}">{{ get_name($record->patient_category_id, 'id', 'name', 'patient_categories') }}</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-6">
<br>
{{ Form::button(__('patient_finance.apply_changes'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
</div>
</div>
<hr>
{{ Form::close() }}
@endif
{{ Form::open(['route' => 'patient_finance.store_deposit_treatment', 'data-toggle' => 'validator']) }}
{{ Form::hidden('patient_id', $patient_id, ['id' => 'patient_id']) }}
{{ Form::hidden('episode_id', $episode_id, ['id' => 'episode_id']) }}
{{ Form::hidden('tag_id', 3, ['id' => 'tag_id']) }}
<div class="row">
<div class="col-md-8">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="treatments_table">
<thead>
<tr>
<th style="width: 40%">{{ __('patient_finance.item_name') }}</th>
<th style="width: 20%">{{ __('patient_finance.item_quantity') }}</th>
<th style="width: 20%">{{ __('patient_finance.item_price') }}</th>
<th style="width: 20%">{{ __('patient_finance.subtotal') }}</th>
</tr>
</thead>
<tbody>
@foreach($treatments as $treatment)
@if(!(is_incoming_prescriptions_feature_enabled() && $treatment->confirmation_status == 0))
@php
$treatment_amount = 0;
$treatment_amount_total = 0;
$total_treatment_amount = 0;
$treatment_balance += get_progressive_treatment_balance($treatment->id, $patient_id);
// check if treatment is altered and is using old model
if ($treatment->altered != 0 && $treatment->is_new_alter_model == 0) {
$altered_drugs = get_name($treatment->altered, 'id', 'drugs', 'patient_dispensings');
$altered_quantities = get_name($treatment->altered, 'id', 'quantity_dispensed', 'patient_dispensings');
$drug_ids = ($altered_drugs != 'N/A') ? explode(",", $altered_drugs) : explode(",", $treatment->drugs);
$drug_quantities = ($altered_quantities != 'N/A') ? explode(",", $altered_quantities) : explode(",", $treatment->quantities_dispensed);
} else {
$drug_ids = explode(",", $treatment->drugs);
$drug_quantities = explode(",", $treatment->quantities_dispensed);
}
$purchased_elsewhere = explode(",", $treatment->purchased_elsewhere);
$remove_pos_row = ($treatment->is_pos == 1) ? "remove_before_calculation" : "";
@endphp
<tr style="background-color: #f9f9f9" class="order_id_{{ $treatment->id }} {{ $remove_pos_row }}">
<td colspan="4">
@if($treatment->is_pos == 1)
<input type="checkbox" onclick="remove_row_from_billing(this, {{ $treatment->id }})" />
&nbsp;&nbsp;&nbsp;
@endif
<span>{{ __('patient_finance.order') }} #{{ $treatment->id }}</span>
<i class="pull-right">{{ __('patient_finance.order_created_by') }}: {{ get_full_name($treatment->created_by, 'id', 'first_name', 'last_name', 'users') }}</i>
</td>
@if (!in_array(0, $purchased_elsewhere))
<!-- check if all records are purchased elsewhere and store all the treatment ids for later clearing -->
{{ Form::hidden('all_records_purchased_elsewhere[]', $treatment->id) }}
@endif
</tr>
@for ($i = 0; $i < count($drug_ids); $i++)
@if(get_name($drug_ids[$i], "id", "name", "drugs") != "N/A")
@php
// check if the patient category is attached to a price list
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_set && $price_list_set != 0){
$treatment_amount = get_price_list_category_price($price_list_set, 3, $drug_ids[$i]);
} elseif ($price_list_id) {
$treatment_amount = get_price_list_category_price($price_list_id, 3, $drug_ids[$i]);
} else {
$treatment_amount = get_name($drug_ids[$i], "id", "non_insured_price", "drugs");
}
if(isset($drug_quantities[$i]) && $drug_quantities[$i] != ""){
$treatment_subtotal = $drug_quantities[$i] * $treatment_amount;
} else {
$treatment_subtotal = 0;
}
// add amounts to totals
$treatment_amount_total += $treatment_amount;
@endphp
@if (count($purchased_elsewhere) > 0 && isset($purchased_elsewhere[$i]) && $purchased_elsewhere[$i] == 1)
<tr @if(!Auth::user()->can('view-item-prices')) style="display: none" @endif class="order_id_{{ $treatment->id }} {{ $remove_pos_row }}">
<td>
<label>{{ get_name($drug_ids[$i], "id", "name", "drugs") }}</label>
@if (!is_chi_enabled() && !is_drug_covered_by_pay_later_category(get_name($patient_id, 'id', 'category_id', 'patients'), $drug_ids[$i]))
&nbsp;&nbsp;<br><span class='badge badge-danger'>{{ __('patient_finance.not_covered_by') }} {{ get_name(get_name($patient_id, 'id', 'category_id', 'patients'), 'id', 'name', 'patient_categories') }}</span>
@endif
</td>
<td>
{{ Form::number('treatment_quantity_show', $drug_quantities[$i], ['class' => 'form-control col-sm-8', 'readonly']) }}
</td>
<td>
{{ Form::number('treatment_amount_show', $treatment_amount, ['class' => 'form-control col-sm-8', 'readonly']) }}
</td>
<td style='color: orange'>{{ __('patient_finance.purchased_from_else_where') }}</td>
</tr>
@else
<tr @if(!Auth::user()->can('view-item-prices')) style="display: none" @endif class="order_id_{{ $treatment->id }} {{ $remove_pos_row }}">
<td>
<label>{{ get_name($drug_ids[$i], "id", "name", "drugs") }}</label>
@if (!is_chi_enabled() && !is_drug_covered_by_pay_later_category(get_name($patient_id, 'id', 'category_id', 'patients'), $drug_ids[$i]))
&nbsp;&nbsp;<br><span class='badge badge-danger'>Not covered by {{ get_name(get_name($patient_id, 'id', 'category_id', 'patients'), 'id', 'name', 'patient_categories') }}</span>
@endif
</td>
<td>
{{ Form::number('treatment_quantity[]', $drug_quantities[$i], ['class' => 'form-control col-sm-8', 'readonly']) }}
</td>
<td>
{{ Form::number('treatment_amount[]', $treatment_amount, ['class' => 'form-control col-sm-8', 'readonly']) }}
</td>
<td>
@php $total_treatment_amount += $treatment_subtotal; @endphp
{{ Form::number('treatment_subtotal[]', $treatment_subtotal, ['class' => 'form-control col-sm-8 items_amounts', 'readonly']) }}
</td>
{{ Form::hidden('treatment_item[]', $drug_ids[$i]) }}
{{ Form::hidden('treatment_id[]', $treatment->id) }}
</tr>
@endif
@endif
@endfor
@if(!Auth::user()->can('view-item-prices'))
<tr>
<td>{{ __('patient_finance.treatment') }}</td>
<td colspan="3">{{ ugandan_shillings($total_treatment_amount) }}</td>
</tr>
@endif
@else
<tr>
<td colspan="4"><h4 class="text-center"><code>{{ __('patient_finance.treatments_have_not_yet_been_confirmed_by_pharmacy') }}</code></h4></td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
@if(is_donor_feature_enabled())
<br><hr>
<h4>{{ __('patient_finance.discount') }}</h4>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="discounts_table">
<thead>
<tr>
<th>{{ __('patient_finance.discount') }}</th>
<th>{{ __('patient_finance.donor_amount') }}</th>
<th>{{ __('patient_finance.patient_amount') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{ Form::select('donor_discount', $discount_options, '', ['class' => 'form-control col-sm-12', 'onchange' => 'show_discounts_amounts(this.value)']) }}
</td>
<td><div id="donor_discount"></div></td>
<td><div id="patient_discount"></div></td>
</tr>
</tbody>
</table>
<!-- is the controller to check if discount is selected if value is anything other than 0 -->
{{ Form::hidden('discount_type', 0, ['id' => 'discount_type']) }}
</div>
@endif
</div>
@include('patient_finance::patient_finance.make_deposit_totals_section')
</div>
{{ Form::close() }}
@else
<h4 class="text-center" style="color: red">{{ __('patient_finance.no_new_ordered_treatments') }}</h4>
@endif
</div>
</div>
</div>
<!-- include the debt plan modal partial -->
@include('patient_finance::patient_finance.debt.debt_plan')
<!-- include the credit limit modal partial -->
@include('patient_finance::patient_finance.credit_limit_modal')
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
// check if the patient has paid and a pdf print is required
if ($('#print_cashier_receipt_pdf').val() == 1) {
var win = window.open('/patient_finance/print_item_receipt_pdf', '_blank');
if (win) {
win.focus();
} else {
alert('Please allow popups for Stre@mline');
}
}
</script>
@endpush
@push('styles')
<style>
.modal-dialog {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%) !important;
}
</style>
@endpush
@@ -0,0 +1,157 @@
@php
$treatment_amount = 0;
@endphp
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<h5 style="color: maroon;"><b>{{ __('patient_finance.treatment_for_episode') }} {{ streamline_date($parent_episode_details->created_at) }}</b></h5>
@if(count($parent_episode_paid_treatments) > 0)
<strong>{{ __('patient_finance.treatment_payment') }}</strong>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('patient_finance.receipt_number') }}</th>
<th>{{ __('patient_finance.treatment_items') }}</th>
<th>{{ __('patient_finance.treatment_quantities') }}</th>
<th>{{ __('patient_finance.treatment_subtotals') }}</th>
<th>{{ __('patient_finance.patient_amount_paid') }}</th>
<th>{{ __('patient_finance.payment_date') }}</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($parent_episode_paid_treatments as $paid_treatment)
<tr>
<td>{{ $paid_treatment->receipt_number }}</td>
<td>
@php $items_counter = 1; @endphp
@php $treatment_items_array = explode(",", $paid_treatment->treatment_items); @endphp
@foreach($treatment_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'drugs') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $treatment_quantity_array = explode(",", $paid_treatment->treatment_quantities); @endphp
@foreach($treatment_quantity_array as $quantity)
{{ $items_counter }}. {{ $quantity }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $treatment_price_array = explode(",", $paid_treatment->treatment_subtotals); @endphp
@foreach($treatment_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
{{ ugandan_shillings($paid_treatment->patient_amount_paid) }}
@if($paid_treatment->refund_amount > 0)
<br><br>
<span style="color: orangered">
{{ ugandan_shillings($paid_treatment->refund_amount) }} {{ __('patient_finance.was_refunded') }}
</span>
@endif
</td>
<td>{{ streamline_date_time($paid_treatment->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_treatment_receipt/1/{{ $paid_treatment->id }}">{{ __('patient_finance.print_receipt') }}</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
@if(!is_null($parent_episode_treatment))
<div style="background-color: #f9e3dc; padding-top: 5px;">
<strong>{{ __('patient_finance.unpaid_treatment') }}</strong>
<div class="row">
<div class="col-sm-10">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="treatments_table">
<thead>
<tr>
<th style="width: 40%">{{ __('patient_finance.item_name') }}</th>
<th style="width: 20%">{{ __('patient_finance.item_quantity') }}</th>
<th style="width: 20%">{{ __('patient_finance.item_price') }}</th>
<th style="width: 20%">{{ __('patient_finance.subtotal') }}</th>
</tr>
</thead>
<tbody>
@php
$parent_treatment_amount = 0;
$parent_treatment_amount_total = 0;
// ids of the ordered drugs
$parent_drug_ids = explode(",", $parent_episode_treatment->drugs);
// quantities of the ordered drugs
$parent_drug_quantities = explode(",", $parent_episode_treatment->quantities_dispensed);
@endphp
@for ($i = 0; $i < count($parent_drug_ids); $i++)
@if(get_name($parent_drug_ids[$i], "id", "name", "drugs") != "N/A")
@php
// check if the patient category is attached to a price list
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_set && $price_list_set != 0){
$parent_treatment_amount = get_price_list_category_price($price_list_set, 3, $parent_drug_ids[$i]);
} elseif ($price_list_id) {
$parent_treatment_amount = get_price_list_category_price($price_list_id, 3, $parent_drug_ids[$i]);
} else {
$parent_treatment_amount = get_name($parent_drug_ids[$i], "id", "non_insured_price", "drugs");
}
if(isset($parent_drug_quantities[$i]) && $parent_drug_quantities[$i] != ""){
$parent_treatment_subtotal = $parent_drug_quantities[$i] * $parent_treatment_amount;
} else {
$parent_treatment_subtotal = 0;
}
// add amounts to totals
$parent_treatment_amount_total += $parent_treatment_amount;
@endphp
<tr>
<td>
<label>{{ get_name($parent_drug_ids[$i], "id", "name", "drugs") }}</label>
</td>
<td>
{{ Form::number('treatment_quantity[]', $parent_drug_quantities[$i], ['class' => 'form-control col-sm-8', 'readonly']) }}
</td>
<td>
{{ Form::number('treatment_amount[]', $parent_treatment_amount, ['class' => 'form-control col-sm-8', 'readonly']) }}
</td>
<td>
{{ Form::number('treatment_subtotal[]', $parent_treatment_subtotal, ['class' => 'form-control col-sm-8 treatment_subtotal', 'readonly']) }}
</td>
</tr>
{{ Form::hidden('treatment_item[]', $parent_drug_ids[$i]) }}
@endif
@endfor
</tbody>
</table>
</div>
</div>
<div class="col-sm-2">
<div>
{{ Form::open(['route' => 'patient_finance.select_payment_option']) }}
{{ Form::hidden('episode_id', $parent_episode_details->id) }}
<button type="submit" name="treatment" class="btn btn-success btn-sm btn-rd" value="treatment">{{ __('patient_finance.pay_for_treatment') }}</button>
{{ Form::close() }}
</div>
</div>
</div>
</div>
@endif
</div>
</div>
</div>
@@ -0,0 +1,921 @@
@php use Streamline\Services\PatientFinance\PatientPaymentMethodService; @endphp
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
@endpush
@section('content')
{{-- Hide the print option here outside of the form --}}
@if(session()->get("print_cashier_receipt_pdf") == 1)
{{ Form::hidden('print_cashier_receipt_pdf', 1, ['id' => 'print_cashier_receipt_pdf']) }}
@endif
<div class="row bg-title">
<div class="col-md-7">
<h4 class="page-title">
{{ __('patient_finance.inpatient_deposit') }}
</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li class="active">{{ __('patient_finance.inpatient_deposit') }}</li>
</ol>
</div>
</div>
{{ Form::open(['route' => 'patient_finance.store_inpatient_deposit', 'data-toggle' => 'validator']) }}
{{ Form::hidden('patient_id', $patient_id, ['id' => 'patient_id']) }}
{{ Form::hidden('episode_id', $episode_id, ['id' => 'episode_id']) }}
<div class="white-box">
<!--
1. check if the patient's category is in the patient_discounts table with threshold_type not null
2. check if the patient is a dependant to any patient in the patient_discounts table with threshold
3. if any of the 2 conditions above, then save necessary info into dependants_consumptions table
4. show current available balance to this cashier making this deposit
-->
@php
$does_patient_category_have_threshold = does_patient_category_have_threshold($patient->category_id);
$patient_is_a_dependant_of = patient_is_a_dependant_of($patient_id);
$patient_insurance_status = patient_insurance_status($patient->id) == 1;
@endphp
@include('flash::message')
<div class="row">
<div class="col-md-4">
<h4>{{ __('patient_finance.patient_information') }}</h4>
<div class="table-responsive">
<table class="table table-responsive table-bordered">
<tbody>
<tr>
<td><b>{{ __('patient_finance.patient_names') }}</b></td>
<td>
{!! insurance_flag($patient->id) !!}
@if($patient_insurance_status)
<small style="color:#069">({{ __('patients.joined_chi_scheme') }} {{patient_duration_on_chi_sheme($patient->id)}})</small>
@endif
</td>
</tr>
<tr>
<td><b>{{ __('patient_finance.patient_number') }}</b></td>
<td>{{ $patient->number }}</td>
</tr>
<tr>
<td><b>{{ __('patient_finance.patient_category') }}</b></td>
<td>{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}</td>
</tr>
<tr>
<td><b>{{ __('patient_finance.pay_later') }}</b></td>
<td>
@if(isset($discount->pay_later) && $discount->pay_later == 1)
{{ __('patient_finance.yes') }}
{{ Form::hidden('pay_later', 1, ['id' => 'pay_later']) }}
@else
{{ __('patient_finance.no') }}
{{ Form::hidden('pay_later', 0, ['id' => 'pay_later']) }}
@endif
</td>
</tr>
@php $family_account_id = get_patient_family_account_id($patient->id); @endphp
@if($family_account_id != null)
<tr>
<th style="color: blue">{{ __('patient_finance.family_account_of') }}</th>
<td>
@php $family_head_id = get_name($family_account_id, 'id', 'family_head_id', 'family_accounts'); @endphp
{{ get_full_name($family_head_id, 'id', 'first_name', 'last_name', 'patients') }}
({{ get_name($family_head_id, 'id', 'number', 'patients') }})
</td>
</tr>
<tr>
<th style="color: blue">{{ __('patient_finance.family_account_balance') }}</th>
<td>
{{ is_numeric(get_name($family_account_id, 'id', 'current_balance', 'family_accounts')) ? ugandan_shillings(get_name($family_account_id, 'id', 'current_balance', 'family_accounts')) : "N/A" }}
</td>
</tr>
{{ Form::hidden('family_account_id', $family_account_id) }}
{{ Form::hidden('family_account_balance',get_name($family_account_id, "id", "current_balance", "family_accounts")) }}
@endif
@if($does_patient_category_have_threshold == true || !is_null($patient_is_a_dependant_of))
<tr>
<th style="color: rgb(122, 60, 141)">{{ __('patient_finance.patient_dependant_of') }}</th>
<td>{{ get_full_name($patient_is_a_dependant_of, "id", "first_name", "last_name", "patients") }}</td>
</tr>
<tr>
<th style="color: rgb(122, 60, 141)">{{ __('patient_finance.dependant_balance') }}</th>
<td>{{ ugandan_shillings(get_balance_from_category_threshold($patient_is_a_dependant_of)) }}</td>
</tr>
{{-- if patient is some one's dependant then use the dependants patient category --}}
{{ Form::hidden('pay_later', 1, ['id' => 'pay_later']) }}
{{ Form::hidden('patient_category_id', get_name($patient_is_a_dependant_of, 'id', 'category_id','patients')) }}
{{ Form::hidden('dependants_balance',get_balance_from_category_threshold($patient_is_a_dependant_of)) }}
@endif
</tbody>
</table>
</div>
</div>
<div class="col-md-8">
<h4>{{ __('patient_finance.deposits_made') }}</h4>
<div class="table-responsive">
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<th>{{ __('patient_finance.receipt_number') }}</th>
<th>{{ __('patient_finance.staff_in_charge') }}</th>
<th>{{ __('patient_finance.received_on') }}</th>
<th>{{ __('patient_finance.patient_amount') }}</th>
<th></th>
<th></th>
</thead>
<tbody>
@if(count($inpatient_deposits) > 0)
@php $total_paid = 0; @endphp
@foreach($inpatient_deposits as $deposit)
<tr>
<td>{{ $deposit->receipt_number }}</td>
<td>{{ get_full_name($deposit->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>{{ streamline_date_time($deposit->created_at) }}</td>
@php $total_paid += $deposit->patient_amount_paid; @endphp
<td>
{{ ugandan_shillings($deposit->patient_amount_paid) }}
@if($deposit->refund_amount > 0)
<br><br>
<span style="color: orangered">
{{ ugandan_shillings($deposit->refund_amount) }} {{ __('patient_finance.was_refunded') }}
</span>
@endif
</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_inpatient_deposit_receipt/{{ $deposit->receipt_number }}">{{ __('patient_finance.print_receipt') }}</a>
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($deposit->receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
</td>
<td>
@if(is_null($deposit->received) && Auth::user()->can('cancel-patient-transaction'))
<a class="btn btn-danger btn-sm" href="/patient_finance/cancel_receipt/10/{{ $deposit->id }}">{{ __('patient_finance.cancel_receipt') }}</a>
@endif
</td>
</tr>
@endforeach
<tr>
<td colspan="3"><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($total_paid) }}</td>
<td></td>
<td></td>
</tr>
@else
<tr>
<td colspan="6" style="color: red" class="text-center">{{ __('patient_finance.no_deposit_made') }}</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
@php
$category_to_pay_deposits = 0;
@endphp
<div class="row">
@if(count($inpatient_category_payments) > 0)
<div class="col">
<h4>{{ __('patient_finance.patient_category_invoices') }}</h4>
<div class="table-responsive">
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<th>{{ __('inpatient.created_on') }}</th>
<th>{{ __('patient_finance.transaction_date') }}</th>
<th>{{ __('inpatient.patient_category') }}</th>
<th>{{ __('patient_finance.patient_amount') }}</th>
<th>{{ __('inpatient.invoice_status') }}</th>
</thead>
<tbody>
@php
$total_paid = 0;
@endphp
@foreach($inpatient_category_payments as $payment)
@if ($payment->patient_amount > 0)
<tr>
<td>
{{ streamline_date_time($payment->created_at) }}
<br>By <span style="color: rgb(70, 122, 172); font-weight: 900">{{ get_full_name($payment->created_by, "id", "first_name", "last_name", "users") }}<span>
</td>
<td>
@if($payment->transaction_date)
{{ streamline_date($payment->transaction_date) }}
@else
{{ streamline_date_time($payment->created_at) }}
@endif
</td>
<td>{{ get_name($payment->patient_category, "id", "name", "patient_categories") }}</td>
@php
$total_paid += $payment->patient_amount;
$category_to_pay_deposits += $payment->patient_amount;
@endphp
<td>{{ ugandan_shillings($payment->patient_amount) }}</td>
<td>
@if($payment->payment_complete)
<span class="label label-success">{{ __('inpatient.invoice_paid') }}</span>
@elseif(!is_null($payment->amount_paid_off))
<span class="label label-info">{{ __('inpatient.partially_paid') }}</span>
@else
<span class="label label-danger">{{ __('inpatient.invoice_not_cleared') }}</span>
@endif
<br><br>
@if($payment->invoiced == 0 && Auth::user()->can('cancel-patient-transaction'))
<a class="btn btn-primary btn-sm" href="/patient_finance/cancel_invoice/10/{{ $payment->id }}">{{ __('patient_finance.cancel_invoice') }}</a>
@endif
</td>
</tr>
@endif
@endforeach
<tr>
<td><b>{{ __('patient_finance.total') }}</b></td>
<td></td>
<td></td>
<td><b>{{ ugandan_shillings($total_paid) }}</b></td>
<td></td>
</tr>
@if($does_patient_category_have_threshold == true || !is_null($patient_is_a_dependant_of))
@php
$dependant_consumptions_total = 0;
$dependant_consumptions = \Streamline\Models\DependantsConsumption::where(['dependant_patient_id' => $patient_id, 'episode_id' => $episode_id])->get();
@endphp
@if(count($dependant_consumptions) > 0)
<tr>
<td colspan="5"><b style="color:blue">{{ __('inpatient.inpatient_consumption_on_dependant_account') }}</b></td>
</tr>
@foreach($dependant_consumptions as $dependant_consumption_record)
@if($dependant_consumption_record->items_ids == "Inpatient-deposit")
<tr>
<td>{{ streamline_date_time($dependant_consumption_record->created_at) }}</td>
<td>{{ streamline_date_time($dependant_consumption_record->created_at) }}</td>
<td>{{ __('inpatient.dependant_of') }}{{ get_full_name($patient_is_a_dependant_of, "id", "first_name", "last_name", "patients") }}</td>
<td>{{ $dependant_consumption_record->receipt_number }}</td>
<td>{{ ugandan_shillings($dependant_consumption_record->amount_consumed) }}</td>
</tr>
@php
$dependant_consumptions_total += $dependant_consumption_record->amount_consumed;
@endphp
@endif
@endforeach
<tr>
<td><b>{{ __('patient_finance.total') }}</b></td>
<td></td>
<td></td>
<td><b>{{ ugandan_shillings($dependant_consumptions_total) }}</b></td>
<td></td>
</tr>
@endif
@endif
</tbody>
</table>
</div>
</div>
@endif
@php
$ward_discounts_total = 0;
@endphp
@if(count($ward_discount_deposits) > 0)
<div class="col">
<h4>{{ __('patient_finance.ward_discount_deposits') }}</h4>
<div class="table-responsive">
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<th>{{ __('patient_finance.received_on') }}</th>
<th>{{ __('patient_finance.patient_amount') }}</th>
</thead>
<tbody>
@php $total_paid = 0; @endphp
@foreach($ward_discount_deposits as $deposit)
<tr>
<td>{{ streamline_date_time($deposit->created_at) }}</td>
@php
$total_paid += $deposit->amount;
$ward_discounts_total += $deposit->amount;
@endphp
<td>{{ ugandan_shillings($deposit->amount) }}</td>
</tr>
@endforeach
<tr>
<td><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($total_paid) }}</td>
</tr>
</tbody>
</table>
</div>
</div>
@endif
@if(count($debt_plan_payments) > 0)
<div class="col">
<h4>{{ __('patient_finance.debt_plan_payments') }}</h4>
<div class="table-responsive">
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<th>{{ __('patient_finance.received_on') }}</th>
<th>{{ __('patient_finance.patient_amount') }}</th>
</thead>
<tbody>
@php $total_paid = 0; @endphp
@foreach($debt_plan_payments as $deposit)
<tr>
<td>{{ streamline_date_time($deposit->created_at) }}</td>
@php $total_paid += $deposit->staff_guarantor_to_pay; @endphp
<td>{{ ugandan_shillings($deposit->staff_guarantor_to_pay) }}</td>
</tr>
@endforeach
<tr>
<td><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($total_paid) }}</td>
</tr>
</tbody>
</table>
</div>
</div>
@endif
</div>
</div>
<div class="white-box">
<div class="row">
@if(!$inpatient_bill)
<div class="col-md-12">
<h3><span class="label label-danger">{{ __('patient_finance.no_patient_billing_generated') }}</span></h3>
</div>
@endif
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
@if(!$inpatient_bill)
{{ Form::label('amount_owed', __('patient_finance.amount_owed')) }}
{{ Form::number('amount_owed', 0, ['class' => 'form-control compulsory', 'readonly']) }}
@else
{{ Form::label('amount_owed', __('patient_finance.amount_owed')) }}
{{ Form::number('amount_owed', (($inpatient_bill->amount_to_pay ?? '') + $uncleared_chi_amount), ['class' => 'form-control compulsory', 'readonly']) }}
@endif
</div>
</div>
<div class="col-md-3">
<div class="form-group">
{{ Form::label('patient_to_pay', __('patient_finance.inpatient_deposits')) }}
{{ Form::hidden('original_patient_to_pay', 0, ['id' => 'original_patient_to_pay']) }}
{{ Form::number('patient_to_pay', 0, ['class' => 'form-control compulsory', 'required', 'id' => 'patient_to_pay', 'onchange' => 'reset_payment_methods_amounts()']) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group">
@if($does_patient_category_have_threshold == true || !is_null($patient_is_a_dependant_of))
{{ Form::label('patient_category_amount', get_name(get_name($patient_is_a_dependant_of, 'id', 'category_id', 'patients'), 'id', 'name', 'patient_categories').' '.__('patient_finance.to_pay') . __('patient_finance.dependant_patient_category')) }}
{{ Form::number('patient_category_amount', 0, ['class' => 'form-control compulsory', 'required', 'id' => 'patient_category_amount']) }}
@else
{{ Form::label('patient_category_amount', get_name($patient->category_id, 'id', 'name', 'patient_categories').' '.__('patient_finance.to_pay') . ' (Patient Category)') }}
@if(isset($discount->pay_later) && $discount->pay_later == 1)
{{ Form::number('patient_category_amount', 0, ['class' => 'form-control compulsory', 'required', 'id' => 'patient_category_amount']) }}
@else
{{ Form::number('patient_category_amount', 0, ['class' => 'form-control', 'id' => 'patient_category_amount', 'readonly']) }}
@endif
@endif
</div>
</div>
<div class="col-md-3">
@if(Auth::user()->can('add-ward-discount'))
<div class="form-group">
{{ Form::label('ward_discount_amount', __('patient_finance.ward_discount_amount')) }}
{{ Form::number('ward_discount_amount', 0, ['class' => 'form-control compulsory', 'required', 'id' => 'ward_discount_amount']) }}
</div>
@endif
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
@if($patient_insurance_status)
{{ Form::label('chi_to_pay', __('patient_finance.chi_to_pay')) }}
{{ Form::number('chi_to_pay', $chi_to_pay, ['class' => 'form-control', 'readonly']) }}
{{ Form::hidden('uncleared_chi_amount', $uncleared_chi_amount) }}
@if($uncleared_chi_amount > 0)
<br><span style="color: red"><b>{{ ugandan_shillings($uncleared_chi_amount) . ' ' . __('insurance_claims.chi_amount_uncleared_error') }}</b></span>
@endif
@endif
</div>
</div>
<div class="col-md-6"></div>
<div class="col-md-3">
@if(isset($discount->pay_later) && $discount->pay_later == 1 && Auth::user()->can('add-transaction-date-patient-invoices'))
{{ Form::label('transaction_date', __('patient_finance.transaction_date')) }}
<div class="input-group">
{{ Form::text('transaction_date', date('Y-m-d'), ['class'=>'form-control compulsory', 'readonly', 'id'=>'transaction_date']) }}
</div>
@endif
</div>
</div>
<hr>
<div class="row">
<div class="col-md-4">
<div class="form-group">
{{ Form::label('cash_to_pay',__('patient_finance.cash_to_pay')) }}
{{ Form::hidden('original_cash_to_pay', 0, ['id' => 'original_cash_to_pay']) }}
{{ Form::number('cash_to_pay',0,['class' => 'form-control','id'=>'cash_to_pay','readonly']) }}
</div>
<br><br>
<label class="label label-primary" onclick="add_payment_method();">{{ __('patient_finance.add_payment_method') }}</label>
<br><br>
<div id="payment_methods_div" style="display: none"></div>
</div>
<div class="col-md-4">
@php
$patient_account_balance = $patient->patient_account_balance;
$family_account_id = get_patient_family_account_id($patient->id);
$patient_has_family_accounts = false;
if ($family_account_id != null) {
$patient_has_family_accounts = true;
$family_accounts_credit_limit = is_numeric(get_name($family_account_id, 'id', 'credit_limit', 'family_accounts')) ? get_name($family_account_id, 'id', 'credit_limit', 'family_accounts') : 0;
$family_account_balance = get_name($family_account_id, "id", "current_balance", "family_accounts");
}
@endphp
@if($patient_account_balance > 0 || $patient_has_family_accounts)
<div id="available_wallets_div" style="border-style: dashed; border-color: lightgrey; padding: 10px; margin-bottom: 20px">
<h3>{{ __('patient_finance.available_wallets') }}</h3>
@if($patient_has_family_accounts)
<hr>
<h4>{{ __('patient_finance.family_account') }}</h4>
<div class="row">
<div class="col-md-6 form-group">
<label for="family_account_balance">{{ __('patient_finance.current_balance') }}</label>
{{ Form::number('family_account_balance', $family_account_balance, ['class' => 'form-control', 'id' => 'family_account_balance', 'readonly']) }}
{{ Form::hidden('family_account_id', $family_account_id) }}
{{ Form::hidden('family_account_credit_limit', $family_accounts_credit_limit) }}
</div>
<div class="col-md-6 form-group">
<label for="family_account_balance">{{ __('patient_finance.pay_with') }}</label>
{{ Form::number('family_account_pay_with', 0, ['class' => 'form-control', 'id' => 'family_account_pay_with', 'min' => 0,'onchange'=>'deduct_amounts_from_wallets()']) }}
</div>
</div>
@endif
@if($patient_account_balance > 0)
<hr>
<h4>{{ __('patient_finance.patient_account') }}</h4>
<div class="row">
<div class="col-md-6 form-group">
<label for="patient_account_balance">{{ __('patient_finance.current_balance') }}</label>
{{ Form::number('patient_account_balance', $patient_account_balance, ['class' => 'form-control', 'id' => 'patient_account_balance', 'readonly']) }}
</div>
<div class="col-md-6 form-group">
<label for="patient_account_balance">{{ __('patient_finance.pay_with') }}</label>
{{ Form::number('patient_account_pay_with', 0, ['class' => 'form-control', 'id' => 'patient_account_pay_with', 'min' => 0, 'max' => $patient_account_balance,'onchange'=>'deduct_amounts_from_wallets()']) }}
</div>
</div>
@endif
</div>
@endif
</div>
<div class="col-md-4" id="staff_guarantor" style="display: none">
<div class="form-group">
{{ Form::label('staff_guarantor_to_pay',__('patient_finance.staff_guarantor_to_pay')) }}
{{ Form::number('staff_guarantor_to_pay','',['class' => 'form-control','readonly','id'=>'staff_guarantor_to_pay']) }}
{{ Form::hidden('debt_plan_id', 0, ['id' => 'debt_plan_id']) }}
</div>
</div>
</div>
<br><br><br>
@if($is_bill_updated)
{{ Form::button(__('patient_finance.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id' => 'submit_button']) }}
{{ Form::button(__('patient_finance.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light m-r-10']) }}
<a id="authorise_debt_plan" class="btn btn-danger">{{ __('patient_finance.authorise_debt_plan') }}</a>
@else
<code>Inpatient sheet has recently been updated. Please save inpatient bill to continue payment</code>
@endif
</div>
{{ Form::close() }}
@include('patient_finance::patient_finance.credit_limit_modal')
<!-- include the debt plan modal partial -->
@include('patient_finance::patient_finance.debt.debt_plan')
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script>
// date pickers for debt plan
$('#date_of_bill').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
setDate: new Date(),
readOnly: true
});
// set the default to today
$("#date_of_bill").datepicker("setDate", new Date()).attr('readonly','readonly');
$('#authorise_debt_plan').click(function (e) {
e.preventDefault();
let patient_to_pay = $("#patient_to_pay").val();
// check if patient amount is more than 0
if(patient_to_pay > 0){
// set values in modal
$('#staff_guarantor_amount_owed').val(patient_to_pay);
$('#patient_to_pay_modal').val(patient_to_pay);
if(confirm("<?php echo __('patient_finance.debt_plan_warning') ?>")){
$('#debt_plan_modal').modal('show');
// check if guarantor to pay has changed and update patient balance
$("#guarantor_to_pay_modal").change(function() {
let patient_to_pay_modal = patient_to_pay - this.value;
$("#patient_to_pay_modal").val(patient_to_pay_modal);
});
} else {
alert("<?php echo __('patient_finance.debt_plan_cancelled') ?>");
}
} else {
alert("<?php echo __('patient_finance.patient_amount_zero') ?>");
}
});
//staff list or non staff depending on the guarantor type chosen
$(".guarantor_type").change(function() {
if ($(this).val() == 1) {
$("#staff-guarantor-div").show();
$("#non_staff_guarantor_modal").val("");
$("#non-staff-guarantor-div").hide();
} else if ($(this).val() == 0){
$("#staff-guarantor-div").hide();
$("#staff_guarantor_modal").val("");
$("#non-staff-guarantor-div").show();
}
console.log($(this).val());
});
//add new non staff guarantor modal
$('#addNewNonStaffGuarantor').click(function (e) {
e.preventDefault();
$('#debt_plan_modal').modal('hide');
$('#new_non_staff_guarantor_modal').modal('show');
});
//save the new non staff guarantor
$("#save_new_non_staff_guarantor").click(function (e) {
e.preventDefault();
let first_name = $('#non_staff_guarantor_first_name').val();
let last_name = $('#non_staff_guarantor_last_name').val();
let date_of_birth = $('#non_staff_guarantor_date_of_birth').val();
let marital_status = $('#non_staff_guarantor_marital_status').val();
let residence = $('#non_staff_guarantor_residence').val();
let gender = $("input[name='non_staff_guarantor_gender']" ).val();
let contact = $('#non_staff_guarantor_contact').val();
let has_errors = false;
let error_messages = "";
if(first_name === '' || last_name === '' || date_of_birth === '' || marital_status === '' || residence === '' || gender === '' || contact === ''){
error_messages += "Please fill in all the missing fields\n";
has_errors = true;
}
if(has_errors){
alert(error_messages);
} else {
// all required inputs have been inserted so continue to save
let data = {
'first_name' : first_name,
'last_name' : last_name,
'date_of_birth' : date_of_birth,
'marital_status': marital_status,
'gender' : gender,
'residence' : residence,
'contact' : contact
};
var name = first_name + " " + last_name;
$.ajax({
method: 'POST',
url: '/patient_finance/save_new_non_staff_guarantor',
data: data,
success: function(response){
// auto select the newly added select
$('#non_staff_guarantor_modal').append($('<option>', {
value: response,
text: name
}));
$('#non_staff_guarantor_modal').val(response);//preselect the newly added referral
// close current modal
$('#new_non_staff_guarantor_modal').modal('hide');
// show the debt plan modal
$('#debt_plan_modal').modal('show');
}
});
}
});
$('#non_staff_guarantor_modal,#staff_guarantor_modal').select2({
placeholder: "Select",
width: "100%",
dropdownParent: $('#debt_plan_modal')
});
// date pickers for debt plan
$('#date_of_bill,#non_staff_guarantor_date_of_birth').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
setDate: new Date(),
readOnly: true
});
$('#first_installment_date,#second_installment_date,#third_installment_date,#fourth_installment_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy'
});
$("#payment_arrangement").change(function () {
let payment_arrangement = $("#payment_arrangement").val();
if(payment_arrangement == 1){
$("#first_installment_date_div").show();
$("#second_installment_date_div").hide();
$("#third_installment_date_div").hide();
$("#fourth_installment_date_div").hide();
} else if(payment_arrangement == 2){
$("#second_installment_date_div").show();
$("#first_installment_date_div").show();
$("#third_installment_date_div").hide();
$("#fourth_installment_date_div").hide();
} else if(payment_arrangement == 3){
$("#third_installment_date_div").show();
$("#second_installment_date_div").show();
$("#first_installment_date_div").show();
$("#fourth_installment_date_div").hide();
} else if(payment_arrangement == 4){
$("#fourth_installment_date_div").show();
$("#second_installment_date_div").show();
$("#third_installment_date_div").show();
$("#first_installment_date_div").show();
}
});
// save the debt plan
$('#save_debt_plan').click(function () {
// get all values from modal
let guarantor_to_pay = parseInt($('#guarantor_to_pay_modal').val());
let amount_owed = parseInt($('#staff_guarantor_amount_owed').val());
let date_of_bill = $('#date_of_bill').val();
let patient_to_pay = $('#patient_to_pay_modal').val();
let payment_arrangement = $('#payment_arrangement').val();
let staff_guarantor = $('#staff_guarantor_modal').val();
let non_staff_guarantor = $('#non_staff_guarantor_modal').val();
let guarantor_type = $("input[name='guarantor_type']:checked").val();
let initial_patient_to_pay = $('#original_patient_to_pay').val();
let comment = $('#comment').val();
let authorised_by = $('#authorised_by').val();
let patient_id = $('#patient_id').val();
let episode_id = $('#episode_id').val();
let first_installment_date = $('#first_installment_date').val();
let second_installment_date = $('#second_installment_date').val();
let third_installment_date = $('#third_installment_date').val();
let fourth_installment_date = $('#fourth_installment_date').val();
let tag_id = 10;
// set flag for errors
let has_errors = false;
let error_messages = "";
console.log("staff guarantor "+staff_guarantor);
console.log("non staff guarantor "+non_staff_guarantor);
console.log("guarantor type "+guarantor_type);
if(guarantor_type == 0){
staff_guarantor = non_staff_guarantor;
}
if(payment_arrangement === ''){
error_messages += "<?php echo __('patient_finance.fill_in2') ?>" + "\n";
has_errors = true;
}
if(staff_guarantor === ''){
error_messages += "<?php echo __('patient_finance.fill_in3') ?>" + "\n";
has_errors = true;
}
// check if there are any registered errors and alert messages
if(has_errors){
alert(error_messages);
} else {
// all required inputs have been inserted so continue to save
let data = {'guarantor_to_pay' : guarantor_to_pay, 'amount_owed' : amount_owed,
'date_of_bill' : date_of_bill, 'patient_to_pay': patient_to_pay,
'patient_id' : patient_id, 'episode_id' : episode_id, 'tag_id' : tag_id,
'payment_arrangement' : payment_arrangement, 'guarantor_type' : guarantor_type,
'staff_guarantor' : staff_guarantor, 'comment' : comment, 'authorised_by' : authorised_by,
'first_installment_date' : first_installment_date, 'second_installment_date' : second_installment_date,
'third_installment_date' : third_installment_date, 'fourth_installment_date' : fourth_installment_date};
$.ajax({
method: 'POST',
url: '/patient_finance/save_debt_plan',
data: data,
success: function(response){
if(parseInt(response) !== 0){
// close current modal
$('#debt_plan_modal').modal('hide');
// correct the patient amount to pay
$('#patient_to_pay').val(patient_to_pay);
reset_payment_methods_amounts();
// disable calculate button and debt plan button
$('#authorise_debt_plan').hide();
// show the staff_guarantor div
$('#staff_guarantor').show();
// add amount to staff_guarantor_to_pay
$('#staff_guarantor_to_pay').val(guarantor_to_pay);
$('#debt_plan_id').val(response);
$('#submit_button').click();
} else {
// something went wrong! Engage panic mode
alert("<?php echo __('patient_finance.error_message') ?>");
}
}
});
}
});
$("#print_agreement").click(function(e){
printElementContent('printableContent','Staff Guarantor Agreement');
});
function deduct_amounts_from_wallets() {
let patient_account_amount = +$('#patient_account_pay_with').val();
let family_account_amount = +$('#family_account_pay_with').val();
let original_cash_to_pay = +$('#original_cash_to_pay').val();
// simplify the amounts
if (isNaN(family_account_amount)) {
family_account_amount = 0;
}
if (isNaN(patient_account_amount)) {
patient_account_amount = 0;
}
$('.payment_methods_amount').each(function () {
$(this).val(0);
});
if((patient_account_amount + family_account_amount) > original_cash_to_pay) {
alert("Please make sure you enter the correct amounts");
$('#cash_to_pay').val(original_cash_to_pay);
$('#patient_account_pay_with').val(0);
$('#family_account_pay_with').val(0);
} else {
original_cash_to_pay -= (patient_account_amount + family_account_amount);
$('#cash_to_pay').val(original_cash_to_pay);
}
}
$('#transaction_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd'
});
// check if the patient has paid and a pdf print is required
if ($('#print_cashier_receipt_pdf').val() == 1) {
var win = window.open('/patient_finance/print_item_receipt_pdf', '_blank');
if (win) {
win.focus();
} else {
alert('Please allow popups for Stre@mline');
}
}
let payment_method_counter = 0;
function add_payment_method() {
$('#payment_methods_div').show();
if ($('#cash_to_pay').val() == 0) {
$('#cash_to_pay').val( $('#patient_to_pay').val());
$('#original_cash_to_pay').val( $('#patient_to_pay').val());
}
$('#payment_methods_div').append('<div id="payment_method_div'+ payment_method_counter + '"><div class="row">' +
'<div class="col-md-6">' +
'<label>Payment Method</label>' +
'<select class="form-control payment_method" name="payment_method[]" onchange="changePaymentMethod(this.value, '+ payment_method_counter + ')"><option value="0">--select method--</option><?php echo (new PatientPaymentMethodService())->getPaymentMethodOptions() ?></select>' +
'</div><div class="col-md-6"><label>Payment Amount</label><input name="payment_methods_amount[]" type="number" class="form-control payment_methods_amount" onkeyup="payment_methods_amount_calculate()"></div></div>' +
'<br><label>Reference Number</label><input type="text" name="ref_number[]" id="ref_number'+ payment_method_counter + '" class="form-control" />' +
'<input type="hidden" name="ref_number_added_by[]" id="ref_number_added_by'+ payment_method_counter + '" value="0" /><hr></div>');
payment_method_counter++;
}
function changePaymentMethod(value, id) {
$.ajax({
method: 'POST',
url: '/patient_payment_methods/is_ref_required',
data: {'id' : value},
success: function(response){
if(response == 1) {
$('#ref_number' + id).prop('required', true);
} else {
$('#ref_number' + id).prop('required', false);
}
}
});
}
function payment_methods_amount_calculate() {
// tally up all the entered values
let total_amount_payment_methods = 0;
$('.payment_methods_amount').each(function () {
total_amount_payment_methods += +$(this).val();
});
let cash_to_pay = $('#original_cash_to_pay').val();
cash_to_pay -= total_amount_payment_methods;
if (cash_to_pay < 0) {
alert("You have entered more money in the payment methods than is supposed to be paid");
$('#cash_to_pay').val($('#original_cash_to_pay').val());
$('.payment_methods_amount').each(function () {
$(this).val(0);
});
return false;
}
$('#cash_to_pay').val(cash_to_pay);
}
function reset_payment_methods_amounts() {
let patient_to_pay_amount = $('#patient_to_pay').val();
$('#original_patient_to_pay').val(patient_to_pay_amount);
$('#cash_to_pay').val(patient_to_pay_amount);
$('#original_cash_to_pay').val(patient_to_pay_amount);
$('#patient_account_pay_with').val(0);
$('#family_account_pay_with').val(0);
$('.payment_methods_amount').each(function () {
$(this).val(0);
});
}
</script>
@endpush
@@ -0,0 +1,414 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<style type="text/css">
#discounts_table td{
border-left: 1px solid #dddddd;
}
#paid_sundries_table td{
border-left: 1px solid #dddddd;
}
#sundries_table td{
border-left: 1px solid #dddddd;
}
</style>
@endpush
@section('content')
{{-- Hide the print option here outside of the form --}}
@if(session()->get("print_cashier_receipt_pdf") == 1)
{{ Form::hidden('print_cashier_receipt_pdf', 1, ['id' => 'print_cashier_receipt_pdf']) }}
@endif
@php $co_payment = check_patient_category_co_payment_status($patient->category_id); @endphp
@if(check_if_episode_is_a_followup($episode->id))
@php
$parent_episode_details = \Streamline\Models\PatientEpisode::find($episode->parent_episode_id);
$parent_episode_ordered_sundries = \Streamline\Models\OrderedSundry::where(['episode_id' => $episode->parent_episode_id,'payment_status' => '0'])->get();
$parent_episode_paid_sundries = \Streamline\Models\SundryDeposit::where(['episode_id' => $episode->parent_episode_id])->first();
@endphp
@endif
<div class="row bg-title">
<div class="col-md-7">
<h4 class="page-title">
{{ __('patient_finance.sundries_for_episode') }} : <span style="color: #0000FF">{{ streamline_date($episode->created_at) }}</span>{!! isset($parent_episode_details) ? "<span style='color: green;'> (" . __('.episode_is_review') . " ". streamline_date($parent_episode_details->created_at).")</span>" : '' !!}
</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.sundries_payment') }}</li>
</ol>
</div>
</div>
@if(check_if_episode_is_a_followup($episode->id))
@include('patient_finance::patient_finance.make_sundries_deposit_review')
@endif
@if(count($paid_sundries) > 0 || count($invoiced_sundries) > 0)
<div class="row">
<div class="col-md-12">
<div class="white-box">
<h4>{{ __('patient_finance.sundries_payment') }}</h4>
<table class="table color-bordered-table success-bordered-table" id="paid_sundries_table">
<thead>
<tr>
<th>{{ __('patient_finance.receipt_number') }}</th>
<th>{{ __('patient_finance.cashier') }}</th>
<th>{{ __('patient_finance.sundries_items') }}</th>
<th>{{ __('patient_finance.sundries_quantities') }}</th>
<th>{{ __('patient_finance.sundries_subtotals') }}</th>
<th>{{ __('patient_finance.patient_amount_paid') }}</th>
<th>{{ __('patient_finance.payment_date') }}</th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
@foreach($paid_sundries as $paid_sundry)
@php
// check if this payment was from central billing
$central_billing_count = \Illuminate\Support\Facades\DB::table('central_billing_deposits')->where('receipt_number', $paid_sundry->receipt_number)->count();
$chi_count = \Illuminate\Support\Facades\DB::table('chi_deposits')->where('receipt_number', $paid_sundry->receipt_number)->count();
if ($central_billing_count > 0 || $chi_count > 0){
// skip this record so that it is only printed and cancelled from the central billings side
continue;
}
@endphp
<tr>
<td>{{ $paid_sundry->receipt_number }}</td>
<td>{{ get_full_name($paid_sundry->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>
@php $items_counter = 1; @endphp
@php $sundry_items_array = explode(",", $paid_sundry->sundry_items); @endphp
@foreach($sundry_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'sundries') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $sundry_quantity_array = explode(",", $paid_sundry->sundry_quantity); @endphp
@foreach($sundry_quantity_array as $quantity)
{{ $items_counter }}. {{ $quantity }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $sundry_price_array = explode(",", $paid_sundry->sundry_subtotals); @endphp
@foreach($sundry_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
{{ ugandan_shillings($paid_sundry->patient_amount_paid) }}
@if($paid_sundry->refund_amount > 0)
<br><br>
<span style="color: orangered">
{{ ugandan_shillings($paid_sundry->refund_amount) }} {{ __('patient_finance.was_refunded') }}
</span>
@endif
</td>
<td>{{ streamline_date_time($paid_sundry->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_sundries_receipt/1/{{ $paid_sundry->receipt_number }}">{{ __('patient_finance.print_receipt') }}</a>
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($paid_sundry->receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
</td>
<td>
@if(is_null($paid_sundry->received) && can_receipt_be_cancelled($paid_sundry->receipt_number) && Auth::user()->can('cancel-patient-transaction'))
<a class="btn btn-danger btn-sm" href="/patient_finance/cancel_receipt/5/{{ $paid_sundry->id }}">{{ __('patient_finance.cancel_receipt') }}</a>
@endif
</td>
</tr>
@endforeach
@foreach($invoiced_sundries as $invoiced_sundry)
@php
// check if this payment was from central billing
$central_billing_count = \Illuminate\Support\Facades\DB::table('central_billing_deposits')->where('receipt_number', $invoiced_sundry->receipt_number)->count();
if ($central_billing_count > 0){
// skip this record so that it is only printed and cancelled from the central billings side
continue;
}
@endphp
<tr>
<td>{{ $invoiced_sundry->receipt_number }}</td>
<td>
@php $items_counter = 1; @endphp
@php $sundry_items_array = explode(",", $invoiced_sundry->items_ids); @endphp
@foreach($sundry_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'sundries') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $sundry_quantity_array = explode(",", $invoiced_sundry->items_quantity); @endphp
@foreach($sundry_quantity_array as $quantity)
{{ $items_counter }}. {{ $quantity }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $sundry_price_array = explode(",", $invoiced_sundry->items_amounts); @endphp
@foreach($sundry_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
{{ ugandan_shillings($invoiced_sundry->patient_amount) }}
</td>
<td>{{ streamline_date_time($invoiced_sundry->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_sundries_receipt/2/{{ $invoiced_sundry->receipt_number }}">{{ __('patient_finance.print_invoice') }}</a>
</td>
<td>
@if(is_null($invoiced_sundry->received) && can_receipt_be_cancelled($invoiced_sundry->receipt_number) && Auth::user()->can('cancel-patient-transaction'))
<a class="btn btn-danger btn-sm" href="/patient_finance/cancel_invoice/5/{{ $invoiced_sundry->id }}">{{ __('patient_finance.cancel_invoice') }}</a>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endif
<div class="row">
<div class="col-md-12">
@include('flash::message')
<div class="white-box">
@if(patient_insurance_status($patient_id) == 1)
<a href="/patient_finance/make_chi_deposits/5" class="btn btn-success btn-sm">View CHI Deposits Receipts</a>
<br><br>
@endif
@if($ordered_sundries->count() > 0)
@php
$sundries_ids = [];
$sundries_quantity = [];
$order_ids = [];
// amounts at the time of the inv was ordered
$sundries_orders_amounts = [];
foreach($ordered_sundries as $ordered_sundry){
$sundries_ids = array_merge($sundries_ids, explode(",", $ordered_sundry->sundries_id));
$sundries_quantity = array_merge($sundries_quantity, explode(",", $ordered_sundry->quantity));
array_push($order_ids, $ordered_sundry->id);
//if amounts are put at the time of ordering
$sundries_orders_amounts = is_null($ordered_sundry->sundries_amount) ? array_merge($sundries_orders_amounts, []) : array_merge($sundries_orders_amounts, explode(",", $ordered_sundry->sundries_amount));
}
$count_orders = count($order_ids);
// create strings from arrays to use when submitting
$order_ids_string = implode(',', $order_ids);
$sundries_ids_string = implode(',', $sundries_ids);
$sundries_orders_amounts_string = implode(',', $sundries_orders_amounts);
$remove_pos_row = ($treatment->is_pos == 1) ? "remove_before_calculation" : ""
@endphp
@if(Auth::user()->can('price-list-category-change-billing'))
{{ Form::open(['route' => 'patient_finance.make_deposit_sundries', 'data-toggle' => 'validator']) }}
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('price_list_category_id', 'Price List Category') }}
<select name="price_list_category_id" class="form-control compulsory" required>
<option value="0">- {{ __('patient_finance.default_pricing') }} -</option>
@foreach($price_list_categories as $record)
<option value="{{ $record->id }}">{{ get_name($record->patient_category_id, 'id', 'name', 'patient_categories') }}</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-6">
<br>
{{ Form::button(__('patient_finance.apply_changes'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
</div>
</div>
<hr>
{{ Form::close() }}
@endif
{{ Form::open(['route' => 'patient_finance.store_sundries_deposit', 'data-toggle' => 'validator']) }}
{{ Form::hidden('patient_id', $patient_id, ['id' => 'patient_id']) }}
{{ Form::hidden('episode_id', $episode_id, ['id' => 'episode_id']) }}
{{ Form::hidden('order_ids', $order_ids_string) }}
{{ Form::hidden('sundry_ids', $sundries_ids_string) }}
{{ Form::hidden('sundry_order_amounts', $sundries_orders_amounts_string) }}
{{ Form::hidden('tag_id', 5, ['id' => 'tag_id']) }}
<div class="row">
<div class="col-md-8">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="sundries_table">
<thead>
<tr>
<th style="width: 40%">{{ __('patient_finance.sundry_name') }}</th>
<th style="width: 10%">{{ __('patient_finance.quantity') }}</th>
<th style="width: 25%">{{ __('patient_finance.unit_cost') }}</th>
<th style="width: 25%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php $orders_count = 0; $total_sundry_amount = 0; @endphp
@for ($i = 0; $i < count($sundries_ids); $i++)
@php
// check if the patient category is attached to a price list
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_set && $price_list_set != 0){
$sundry_amount = get_price_list_category_price($price_list_set, 5, $sundries_ids[$i]);
} elseif ($price_list_id) {
$sundry_amount = get_price_list_category_price($price_list_id, 5, $sundries_ids[$i]);
} else {
//if amount was set at time of ordering
if (isset($sundries_orders_amounts[$i]) && !is_null($sundries_orders_amounts[$i])) {
$sundry_amount = $sundries_orders_amounts[$i];
} else{
$sundry_amount = get_name($sundries_ids[$i], "id", "non_insured_price", "sundries");
}
}
// get the subtotal for this sundry
$sundry_subtotal = $sundries_quantity[$orders_count] * $sundry_amount;
$total_sundry_amount += $sundry_subtotal;
@endphp
<tr @if(!Auth::user()->can('view-item-prices')) style="display: none" @endif>
<td>
<label>{{ get_name($sundries_ids[$i], "id", "name", "sundries") }}</label>
</td>
<td>
{{ Form::number('quantity[]', $sundries_quantity[$orders_count], ['class' => 'form-control col-sm-8', 'readonly']) }}
</td>
<td>
{{ Form::number('sundry_amount[]', $sundry_amount, ['class' => 'form-control col-sm-8', 'readonly']) }}
</td>
<td>
{{ Form::number('sundry_subtotal[]', $sundry_subtotal, ['class' => 'form-control col-sm-8 items_amounts', 'readonly']) }}
</td>
</tr>
@php $orders_count++; @endphp
@endfor
@if(!Auth::user()->can('view-item-prices'))
<tr>
<td>{{ __('patient_finance.sundries') }}</td>
<td colspan="3">{{ ugandan_shillings($total_sundry_amount) }}</td>
</tr>
@endif
</tbody>
</table>
</div>
@if(is_donor_feature_enabled())
<br><hr>
<h4>{{ __('patient_finance.discount') }}</h4>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="discounts_table">
<thead>
<tr>
<th>{{ __('patient_finance.discount') }}</th>
<th>{{ __('patient_finance.donor_amount') }}</th>
<th>{{ __('patient_finance.patient_amount') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{ Form::select('donor_discount', $discount_options, '', ['class' => 'form-control col-sm-12', 'onchange' => 'show_discounts_amounts(this.value)']) }}
</td>
<td><div id="donor_discount"></div></td>
<td><div id="patient_discount"></div></td>
</tr>
</tbody>
</table>
<!-- is the controller to check if discount is selected if value is anything other than 0 -->
{{ Form::hidden('discount_type', 0, ['id' => 'discount_type']) }}
</div>
@endif
</div>
@include('patient_finance::patient_finance.make_deposit_totals_section')
</div>
{{ Form::close() }}
@else
<h4 class="text-center" style="color: red">{{ __('patient_finance.no_ordered_sundries') }}</h4>
@endif
</div>
</div>
</div>
<!-- include the debt plan modal partial -->
@include('patient_finance::patient_finance.debt.debt_plan')
<!-- include the credit limit modal partial -->
@include('patient_finance::patient_finance.credit_limit_modal')
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
// check if the patient has paid and a pdf print is required
if ($('#print_cashier_receipt_pdf').val() == 1) {
var win = window.open('/patient_finance/print_item_receipt_pdf', '_blank');
if (win) {
win.focus();
} else {
alert('Please allow popups for Stre@mline');
}
}
</script>
@endpush
@push('styles')
<style>
.modal-dialog {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%) !important;
}
</style>
@endpush
@@ -0,0 +1,154 @@
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<h5 style="color: maroon;"><b>{{ __('patient_finance.sundries_for_episode') }} {{ streamline_date($parent_episode_details->created_at) }}</b></h5>
@if(!is_null($parent_episode_paid_sundries))
<strong>{{ __('patient_finance.sundries_payment') }}</strong>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="parent_episode_paid_sundries_table">
<thead>
<tr>
<th>{{ __('patient_finance.receipt_number') }}</th>
<th>{{ __('patient_finance.sundries_items') }}</th>
<th>{{ __('patient_finance.sundries_quantities') }}</th>
<th>{{ __('patient_finance.sundries_subtotals') }}</th>
<th>{{ __('patient_finance.patient_amount_paid') }}</th>
<th>{{ __('patient_finance.payment_date') }}</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ $parent_episode_paid_sundries->receipt_number }}</td>
<td>
@php $items_counter = 1; @endphp
@php $sundry_items_array = explode(",", $parent_episode_paid_sundries->sundry_items); @endphp
@foreach($sundry_items_array as $item)
{{ $items_counter }}. {{ get_name($item, 'id', 'name', 'sundries') }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $sundry_quantity_array = explode(",", $parent_episode_paid_sundries->sundry_quantity); @endphp
@foreach($sundry_quantity_array as $quantity)
{{ $items_counter }}. {{ $quantity }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
@php $items_counter = 1; @endphp
@php $sundry_price_array = explode(",", $parent_episode_paid_sundries->sundry_subtotals); @endphp
@foreach($sundry_price_array as $price)
{{ $items_counter }}. {{ ugandan_shillings($price) }} <br>
@php $items_counter++; @endphp
@endforeach
</td>
<td>
{{ ugandan_shillings($parent_episode_paid_sundries->patient_amount_paid) }}
@if($parent_episode_paid_sundries->refund_amount > 0)
<br><br>
<span style="color: orangered">
{{ ugandan_shillings($parent_episode_paid_sundries->refund_amount) }} was refunded
</span>
@endif
</td>
<td>{{ streamline_date_time($parent_episode_paid_sundries->created_at) }}</td>
<td>
<a class="btn btn-success btn-sm" href="/patient_finance/print_sundries_receipt/2/{{ $paid_sundries->id }}">{{ __('patient_finance.print_receipt') }}</a>
</td>
</tr>
</tbody>
</table>
</div>
@endif
@if(count($parent_episode_ordered_sundries) > 0)
@php
$parent_episode_sundries_ids = array();
$parent_episode_order_ids = array();
foreach($parent_episode_ordered_sundries as $parent_episode_ordered_sundry){
$parent_episode_sundries_ids = array_merge($parent_episode_sundries_ids, explode(",", $parent_episode_ordered_sundry->sundries_id));
array_push($parent_episode_order_ids, $parent_episode_ordered_sundry->id);
}
$parent_episode_count_orders = count($parent_episode_order_ids);
// create strings from arrays to use when submitting
$parent_episode_order_ids_string = implode(',', $parent_episode_order_ids);
$parent_episode_sundries_ids_string = implode(',', $parent_episode_sundries_ids);
@endphp
<div style="background-color: #f9e3dc; padding-top: 5px;">
<strong>{{ __('patient_finance.unpaid_sundries') }}</strong>
<div class="row">
<div class="col-sm-10">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="sundries_table">
<thead>
<tr>
<th style="width: 40%">{{ __('patient_finance.sundry_name') }}</th>
<th style="width: 25%">{{ __('patient_finance.unit_cost') }}</th>
<th style="width: 10%">{{ __('patient_finance.quantity') }}</th>
<th style="width: 25%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php $parent_episode_orders_count = 0; @endphp
@foreach ($parent_episode_sundries_ids as $parent_episode_sundries_id)
@php
// check if the patient category is attached to a price list
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_set && $price_list_set != 0){
$parent_episode_sundry_amount = get_price_list_category_price($price_list_set, 5, $parent_episode_sundries_id);
} elseif ($price_list_id) {
$parent_episode_sundry_amount = get_price_list_category_price($price_list_id, 5, $parent_episode_sundries_id);
} else {
$parent_episode_sundry_amount = get_name($parent_episode_sundries_id, "id", "non_insured_price", "sundries");
}
// get quantity ordered
$parent_episode_quantity = get_name($parent_episode_order_ids[$parent_episode_orders_count], "id", "quantity", "ordered_sundries");
// get the subtotal for this sundry
$parent_episode_sundry_subtotal = $parent_episode_quantity * $parent_episode_sundry_amount;
@endphp
<tr>
<td>
<label>{{ get_name($parent_episode_sundries_id, "id", "name", "sundries") }}</label>
</td>
<td>
{{ Form::number('sundry_amount[]', $parent_episode_sundry_amount, ['class' => 'form-control col-sm-8', 'readonly']) }}
</td>
<td>
{{ Form::number('quantity[]', $parent_episode_quantity, ['class' => 'form-control col-sm-8', 'readonly']) }}
</td>
<td>
{{ Form::number('sundry_subtotal[]', $parent_episode_sundry_subtotal, ['class' => 'form-control col-sm-8 sundry_amount', 'readonly']) }}
</td>
</tr>
@php $parent_episode_orders_count++; @endphp
@endforeach
</tbody>
</table>
</div>
</div>
<div class="col-sm-2">
<div>
{{ Form::open(['route' => 'patient_finance.select_payment_option']) }}
{{ Form::hidden('episode_id', $parent_episode_details->id) }}
<button type="submit" name="sundries" class="btn btn-success btn-sm btn-rd" value="sundries">{{ __('patient_finance.pay_for_sundries') }}</button>
{{ Form::close() }}
</div>
</div>
</div>
</div>
@endif
</div>
</div>
</div>
@@ -0,0 +1,976 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<style type="text/css">
.deposit_table td{
border-left: 1px solid #dddddd;
}
</style>
@endpush
@section('content')
{{-- Hide the print option here outside of the form --}}
@if(session()->get("print_cashier_receipt_pdf") == 1)
{{ Form::hidden('print_cashier_receipt_pdf', 1, ['id' => 'print_cashier_receipt_pdf']) }}
@endif
<div class="row bg-title">
<div class="col-md-7">
<h4 class="page-title">{{ __('patient_finance.patient_collective_bills') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li class="active">{{ __('patient_finance.finance_home') }}</li>
</ol>
</div>
</div>
<div class="white-box">
{{ Form::open(['route' => 'patient_finance.save_pay_all_patient_bills', 'data-toggle' => 'validator']) }}
<div class="row">
<div class="col-md-8" style="max-height:900px;overflow:auto;">
@php
$total_invs_amount = 0;
$total_sundries_amount = 0;
$total_procedures_amount = 0;
$total_services_amount = 0;
$total_drugs_amount = 0;
$debt_to_pay = 0;
$inpatient_to_pay = 0;
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
@endphp
@if(count($ordered_investigations) > 0)
<h4>Investigations</h4>
<br>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table deposit_table">
<thead>
<tr>
<th style="width: 50%">{{ __('patient_finance.investigation_name') }}</th>
<th style="width: 45%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@foreach($ordered_investigations as $record)
@php
$investigations = explode(",", $record->investigation_id);
@endphp
<tr>
<td colspan="2">
{{ Form::hidden('investigation_order_id[]', $record->id) }}
<i class="pull-right">{{ __('patient_finance.ordered_on') }} {{ streamline_date_time_short($record->created_at) }}</i>
</td>
</tr>
@foreach ($investigations as $investigation)
@php
// get insurance status for investigation
$investigation_insurance_status = get_name($investigation, "id", "insurance_coverage", "investigations");
// check if the patient category is attached to a price list
if ($price_list_id) {
$investigation_amount = get_price_list_category_price($price_list_id, 2, $investigation);
} else {
if($investigation_insurance_status == 1 && patient_insurance_status($patient_id) == 1){
$investigation_amount = get_name($investigation, "id", "insured_price", "investigations");
} else {
$investigation_amount = get_name($investigation, "id", "non_insured_price", "investigations");
}
}
$total_invs_amount += $investigation_amount;
@endphp
<tr>
{{ Form::hidden('investigation_ids[]', $investigation) }}
{{ Form::hidden('investigation_episode_id[]', $record->episode_id) }}
{{ Form::hidden('investigation_amount[]', $investigation_amount) }}
<td>{{ get_name($investigation, "id", "name", "investigations") }}</td>
<td>{{ ugandan_shillings($investigation_amount) }}</td>
</tr>
@endforeach
@endforeach
{{ Form::hidden('investigation_total',$total_invs_amount,['id'=>'investigation_total']) }}
{{ Form::hidden('investigations_patient_to_pay_original', $total_invs_amount, ['id' => 'investigations_patient_to_pay_original']) }}
{{ Form::hidden('investigations_patient_to_pay_original_balance', -1, ['id' => 'investigations_patient_to_pay_original_balance']) }}
<tr>
<td>{{ __('patient_finance.total') }}</td>
<td>{{ ugandan_shillings($total_invs_amount) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
@if(count($ordered_sundries) > 0)
<h4>{{ __('patient_finance.sundries') }}</h4>
<br>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table deposit_table">
<thead>
<tr>
<th>{{ __('patient_finance.sundry_name') }}</th>
<th>{{ __('patient_finance.unit_cost') }}</th>
<th>{{ __('patient_finance.quantity') }}</th>
<th>{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@foreach($ordered_sundries as $record)
@php
// get insurance status for sundry
$sundry_insurance_status = get_name($record->sundries_id, "id", "insurance", "sundries");
// check if the patient category is attached to a price list
if ($price_list_id) {
$sundry_amount = get_price_list_category_price($price_list_id, 5, $record->sundries_id);
} else {
if($sundry_insurance_status == 1 && patient_insurance_status($patient_id) == 1){
$sundry_amount = get_name($record->sundries_id, "id", "insured_price", "sundries");
} else {
$sundry_amount = get_name($record->sundries_id, "id", "non_insured_price", "sundries");
}
}
// get the subtotal for this sundry
$sundry_subtotal = $record->quantity * $sundry_amount;
$total_sundries_amount += $sundry_subtotal;
@endphp
<tr>
{{ Form::hidden('sundry_id[]', $record->sundries_id) }}
{{ Form::hidden('sundry_episode_id[]', $record->episode_id) }}
{{ Form::hidden('sundry_amount[]', $sundry_subtotal) }}
{{ Form::hidden('sundry_subtotal[]', $sundry_amount) }}
{{ Form::hidden('sundry_quantity[]', $record->quantity) }}
{{ Form::hidden('sundry_order_id[]', $record->id) }}
<td>{{ get_name($record->sundries_id, "id", "name", "sundries") }} (<i>Ordered {{ streamline_date_time_short($record->created_at) }}</i>)</td>
<td>{{ ugandan_shillings($sundry_amount) }}</td>
<td>{{ $record->quantity }}</td>
<td>{{ ugandan_shillings($sundry_subtotal) }}</td>
</tr>
@endforeach
{{ Form::hidden('sundry_total',$total_sundries_amount,['id'=>'sundry_total']) }}
{{ Form::hidden('sundries_patient_to_pay_original', $total_sundries_amount, ['id' => 'sundries_patient_to_pay_original']) }}
{{ Form::hidden('sundries_patient_to_pay_original_balance', -1, ['id' => 'sundries_patient_to_pay_original_balance']) }}
<tr>
<td colspan="3">{{ __('patient_finance.total') }}</td>
<td>{{ ugandan_shillings($total_sundries_amount) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
@if(count($ordered_procedures) > 0)
<h4>{{ __('patient_finance.procedures') }}</h4>
<br>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table deposit_table">
<thead>
<tr>
<th style="width: 60%">{{ __('patient_finance.procedure_name') }}</th>
<th style="width: 40%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@foreach($ordered_procedures as $record)
@php
// get insurance status for procedure
$procedure_insurance_status = get_name($record->procedure_id, "id", "insurance", "procedures");
//check if there is a procedure amt added when order was made
if(!is_null($record->procedure_amount)){
$procedure_amount = $record->procedure_amount;
} else {
// check if the patient category is attached to a price list
if ($price_list_id) {
$procedure_amount = get_price_list_category_price($price_list_id, 4, $record->procedure_id);
} else {
if($procedure_insurance_status == 1 && patient_insurance_status($patient_id) == 1){
$procedure_amount = get_name($record->procedure_id, "id", "insured_price", "procedures");
} else {
$procedure_amount = get_name($record->procedure_id, "id", "non_insured_price", "procedures");
}
}
}
$total_procedures_amount += $procedure_amount;
@endphp
<tr>
{{ Form::hidden('procedure_episode_id[]', $record->episode_id) }}
{{ Form::hidden('procedure_id[]', $record->procedure_id) }}
{{ Form::hidden('procedure_amount[]', $procedure_amount) }}
{{ Form::hidden('procedure_order_id[]', $record->id) }}
<td>{{ get_name($record->procedure_id, "id", "name", "procedures") }} (<i>Ordered {{ streamline_date_time_short($record->created_at) }}</i>)</td>
<td>{{ ugandan_shillings($procedure_amount) }}</td>
</tr>
@endforeach
{{ Form::hidden('procedure_total',$total_procedures_amount,['id'=>'procedure_total']) }}
{{ Form::hidden('procedures_patient_to_pay_original', $total_procedures_amount, ['id' => 'procedures_patient_to_pay_original']) }}
{{ Form::hidden('procedures_patient_to_pay_original_balance', -1, ['id' => 'procedures_patient_to_pay_original_balance']) }}
<tr>
<td>{{ __('patient_finance.total') }}</td>
<td>{{ ugandan_shillings($total_procedures_amount) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
@if(count($ordered_services) > 0)
<h4>{{ __('patient_finance.consultation_and_services') }}</h4>
<br>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table deposit_table">
<thead>
<tr>
<th style="width: 60%">{{ __('patient_finance.services') }}</th>
<th style="width: 40%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@foreach($ordered_services as $record)
@php
$service_cost = 0;
if($price_list_id){
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
$service_cost = get_price_list_category_price($price_list_id, 6, $record["service_id"]);
} else {
$pre_order = \Streamline\Models\Services::withTrashed()->find($record["service_id"]);
$service_insurance = $pre_order->insurance_coverage;
if($service_insurance == 1 && patient_insurance_status($patient_id) == 1){
$service_cost = $pre_order->insured_price;
} else {
$service_cost = $pre_order->non_insured_price;
}
}
$service_cost *= $record["quantity"];
$total_services_amount += $service_cost;
@endphp
<tr>
{{ Form::hidden('service_episode_id[]', $record["episode_id"]) }}
{{ Form::hidden('service_id[]', $record["service_id"]) }}
{{ Form::hidden('service_amount[]', $service_cost, ['class' => 'service_amount']) }}
{{ Form::hidden('service_order_id[]', $record["id"]) }}
<td>{{ get_name($record["service_id"], "id", "name", "services") }} (<i>Ordered {{ streamline_date_time_short($record["created_at"]) }}</i>)</td>
<td>{{ ugandan_shillings($service_cost) }}</td>
</tr>
@endforeach
{{ Form::hidden('service_total',$total_services_amount,['id'=>'service_total']) }}
{{ Form::hidden('services_patient_to_pay_original', $total_services_amount, ['id' => 'services_patient_to_pay_original']) }}
{{ Form::hidden('services_patient_to_pay_original_balance', -1, ['id' => 'services_patient_to_pay_original_balance']) }}
<tr>
<td>{{ __('patient_finance.total') }}</td>
<td>{{ ugandan_shillings($total_services_amount) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
@if(count($treatments) > 0)
<h4>{{ __('patient_finance.treatments') }}</h4>
<br>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table deposit_table">
<thead>
<tr>
<th style="width: 40%">{{ __('patient_finance.item_name') }}</th>
<th style="width: 20%">{{ __('patient_finance.item_quantity') }}</th>
<th style="width: 20%">{{ __('patient_finance.item_price') }}</th>
<th style="width: 20%">{{ __('patient_finance.subtotal') }}</th>
</tr>
</thead>
<tbody>
@foreach($treatments as $record)
@if(!(is_incoming_prescriptions_feature_enabled() && $record->confirmation_status == 0))
@php
if ($record->altered != 0 && $record->is_new_alter_model == 0) {
$altered_drugs = get_name($record->altered, 'id', 'drugs', 'patient_dispensings');
$altered_quantities = get_name($record->altered, 'id', 'quantity_dispensed', 'patient_dispensings');
$drug_ids = ($altered_drugs != 'N/A') ? explode(",", $altered_drugs) : explode(",", $record->drugs);
$drug_quantities = ($altered_quantities != 'N/A') ? explode(",", $altered_quantities) : explode(",", $record->quantities_dispensed);
} else {
$drug_ids = explode(",", $record->drugs);
$drug_quantities = explode(",", $record->quantities_dispensed);
}
$purchased_elsewhere = explode(",", $record->purchased_elsewhere);
@endphp
<tr>
<td colspan="4">
{{ Form::hidden('drug_order_id[]', $record->id) }}
<i class="pull-right">{{ __('patient_finance.ordered') }} {{ streamline_date_time_short($record->created_at) }}</i>
</td>
</tr>
@for ($i = 0; $i < count($drug_ids); $i++)
@php
if (count($purchased_elsewhere) > 0 && isset($purchased_elsewhere[$i]) && $purchased_elsewhere[$i] == 1) {
continue;
}
// get insurance status for drug
$drug_insurance_status = get_name($drug_ids[$i], "id", "insurance_coverage", "drugs");
// check if the patient category is attached to a price list
if ($price_list_id) {
$treatment_amount = get_price_list_category_price($price_list_id, 3, $drug_ids[$i]);
} else {
// check if drug and patient is eligible for insurance
if($drug_insurance_status == 1 && patient_insurance_status($patient_id) == 1){
$treatment_amount = get_name($drug_ids[$i], "id", "insured_price", "drugs");
} else {
$treatment_amount = get_name($drug_ids[$i], "id", "non_insured_price", "drugs");
}
}
if(isset($drug_quantities[$i]) && $drug_quantities[$i] != ""){
$treatment_subtotal = $drug_quantities[$i] * $treatment_amount;
} else {
$treatment_subtotal = 0;
}
$total_drugs_amount += $treatment_subtotal;
@endphp
<tr>
{{ Form::hidden('drug_id[]', $drug_ids[$i]) }}
{{ Form::hidden('drug_episode_id[]', $record->episode_id) }}
{{ Form::hidden('drug_amount[]', $treatment_subtotal) }}
{{ Form::hidden('treatment_amount[]', $treatment_amount) }}
{{ Form::hidden('treatment_quantity[]', $drug_quantities[$i]) }}
<td>{{ get_name($drug_ids[$i], "id", "name", "drugs") }}</td>
<td>{{ $drug_quantities[$i] }}</td>
<td>{{ ugandan_shillings($treatment_amount) }}</td>
<td>{{ ugandan_shillings($treatment_subtotal) }}</td>
</tr>
@endfor
@else
<tr>
<td colspan="4"><h4 class="text-center"><code>{{ __('patient_finance.treatments_have_not_yet_been_confirmed_by_pharmacy') }}</code></h4></td>
</tr>
@endif
@endforeach
{{ Form::hidden('drug_total',$total_drugs_amount,['id'=>'drug_total']) }}
{{ Form::hidden('treatment_patient_to_pay_original', $total_drugs_amount, ['id' => 'treatment_patient_to_pay_original']) }}
{{ Form::hidden('treatment_patient_to_pay_original_balance', -1, ['id' => 'treatment_patient_to_pay_original_balance']) }}
<tr>
<td colspan="3">{{ __('patient_finance.total') }}</td>
<td>{{ ugandan_shillings($total_drugs_amount) }}</td>
</tr>
</tbody>
</table>
</div>
@endif
@if(count($patient_debts) > 0)
<h4>{{ __('patient_finance.patient_debts') }}</h4>
<br>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table deposit_table">
<thead>
<tr>
<th style="width: 60%">{{ __('patient_finance.incurred_from') }}</th>
<th style="width: 40%">{{ __('patient_finance.amount_to_pay') }}</th>
</tr>
</thead>
<tbody>
@php $debt_to_pay = 0; @endphp
@foreach($patient_debts as $debt)
<tr>
<td>{{ get_name($debt->tag_id, 'id', 'name', 'finance_point_tags') }} <i>({{ streamline_date_time_short($debt->created_at) }})</i></td>
<td>
@if($debt->balance_remaining)
@php $debt_to_pay += $debt->balance_remaining; @endphp
{{ ugandan_shillings($debt->balance_remaining) }}
@else
@php $debt_to_pay += $debt->balance; @endphp
{{ ugandan_shillings($debt->balance) }}
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
@if(count($inpatient_infos) > 0)
<h4>{{ __('patient_finance.inpatient_bills') }}</h4>
<br>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table deposit_table">
<thead>
<tr>
<th>{{ __('patient_finance.amount_to_pay') }}</th>
<th>{{ __('patient_finance.generated_on') }}</th>
</tr>
</thead>
<tbody>
@foreach($inpatient_infos as $info)
@php $inpatient_to_pay += $info->amount_to_pay; @endphp
<tr>
<td>{{ ugandan_shillings($info->amount_to_pay) }}</td>
<td>{{ streamline_date_time_short($info->updated_at) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
</div>
<div class="col-md-4">
<table class="table table-striped table-bordered">
<tr>
<th style="color: black">{{ __('patient_finance.patient_names') }}</th>
<td>{!! insurance_flag($patient->id) !!}</td>
</tr>
<tr>
<th style="color: black">{{ __('patient_finance.patient_number') }}</th>
<td>{{ $patient->number }}</td>
</tr>
<tr>
<th style="color: black">{{ __('patient_finance.patient_discount') }}</th>
<td>
@if(isset($discount->discount))
{{ $discount->discount }} %
{{ Form::hidden('discount_percentage', $discount->discount, ['id' => 'discount_percentage']) }}
@else
0 %
{{ Form::hidden('discount_percentage', 0, ['id' => 'discount_percentage']) }}
@endif
</td>
</tr>
<tr>
<th style="color: black">{{ __('patient_finance.patient_category') }}</th>
<td>{{ isset($categories[$patient->category_id]) ? $categories[$patient->category_id] : "N/A" }}</td>
</tr>
@php $family_account_id = get_patient_family_account_id($patient->id); @endphp
@if($family_account_id != null)
<tr>
<th style="color: blue">{{ __('patient_finance.family_account_of') }}</th>
<td>
@php $family_head_id = get_name($family_account_id, 'id', 'family_head_id', 'family_accounts'); @endphp
{{ get_full_name($family_head_id, 'id', 'first_name', 'last_name', 'patients') }}
({{ get_name($family_head_id, 'id', 'number', 'patients') }})
</td>
</tr>
<tr>
<th style="color: blue">{{ __('patient_finance.family_account_balance') }}</th>
<td>
{{ is_numeric(get_name($family_account_id, 'id', 'current_balance', 'family_accounts')) ? ugandan_shillings(get_name($family_account_id, 'id', 'current_balance', 'family_accounts')) : "N/A" }}
</td>
</tr>
{{ Form::hidden('family_account_id', $family_account_id) }}
{{ Form::hidden('family_account_balance',get_name($family_account_id, "id", "current_balance", "family_accounts")) }}
@endif
</table>
@if($inpatient_to_pay > 0)
<div class="form-group">
{{ Form::label('inpatient_to_pay', __('patient_finance.inpatient_bills')) }}
{{ Form::number('inpatient_to_pay',$inpatient_to_pay,['class' => 'form-control compulsory','id'=>'inpatient_to_pay','onchange'=>'calculate_debts_inpatient_change()']) }}
{{ Form::hidden('inpatient_to_pay_original',$inpatient_to_pay,['id'=>'inpatient_to_pay_original']) }}
</div>
@endif
@if($debt_to_pay > 0)
<div class="form-group">
{{ Form::label('debt_to_pay', __('patient_finance.patient_debts')) }}
{{ Form::number('debt_to_pay',$debt_to_pay,['class' => 'form-control compulsory','id'=>'debt_to_pay','onchange'=>'calculate_debts_inpatient_change()']) }}
{{ Form::hidden('debt_to_pay_original',$debt_to_pay,['id'=>'debt_to_pay_original']) }}
</div>
@endif
<div class="form-group">
{{ Form::label('total_amount_pay',__('patient_finance.total_amount')) }}
{{ Form::number('total_amount_pay','',['class' => 'form-control','readonly','id'=>'total_amount_pay']) }}
</div>
<div class="form-group">
{{ Form::label('hospital_to_pay_general_discount',__('patient_finance.hospital_to_pay')) }}
{{ Form::number('hospital_to_pay_general_discount','',['class' => 'form-control','readonly','id'=>'hospital_to_pay_general_discount']) }}
</div>
<div class="row">
<div class="col-sm-8">
<div class="form-group">
@if($family_account_id != null)
{{ Form::label('patient_to_pay',__('patient_finance.family_to_pay')) }}
@else
{{ Form::label('patient_to_pay',__('patient_finance.patient_to_pay')) }}
@endif
{{ Form::number('patient_to_pay',0,['class' => 'form-control compulsory','id'=>'patient_to_pay','onchange'=>'get_balance()', 'required']) }}
{{ Form::hidden('original_patient_to_pay','',['id'=>'original_patient_to_pay']) }}
</div>
</div>
<div class="col-sm-4" style="padding-top: 25px;">
<div class="form-group">
{{ Form::button(__('patient_finance.calculate'),['type'=>'button','class'=>'btn btn-info', 'onclick' => 'reset_totals()']) }}
</div>
</div>
</div>
<div id="one_off_discount_div" style="display: none">
<div class="form-group">
{{ Form::label('one_off_discount', __('patient_finance.one_off_discount_amount')) }}
{{ Form::number('one_off_discount', 0, ['class' => 'form-control', 'id'=>'one_off_discount','onchange'=>'deduct_one_off_discount()']) }}
</div>
<div class="form-group">
{{ Form::label('one_off_discount_memo', __('patient_finance.one_off_discount_memo')) }}
{{ Form::textarea('one_off_discount_memo', 0, ['class' => 'form-control', 'id'=>'one_off_discount_memo']) }}
</div>
</div>
<div class="row">
<div class="col-md-6">
<label class="label label-primary" id="add_payment_method_button" onclick="add_payment_method();" style="display: none">{{ __('patient_finance.add_payment_method') }}</label>
</div>
<div class="col-md-6">
@if(Auth::user()->can('give-one-off-discounts'))
<label class="label label-primary pull-right" id="add_one_off_discount_button" onclick="add_one_off_discount();" style="display: none">{{ __('patient_finance.add_one_off_discount') }}</label>
@endif
</div>
</div>
<br><br>
<div id="payment_methods_div" style="display: none">
<div class="form-group">
{{ Form::label('cash_to_pay',__('patient_finance.cash_to_pay')) }}
{{ Form::hidden('original_cash_to_pay', 0, ['id' => 'original_cash_to_pay']) }}
{{ Form::number('cash_to_pay',0,['class' => 'form-control','id'=>'cash_to_pay','readonly']) }}
</div>
</div>
<div class="form-group">
{{ Form::label('balance',__('patient_finance.balance')) }}
{{ Form::number('balance',0,['class' => 'form-control','id'=>'balance','readonly']) }}
</div>
<a class="btn btn-primary btn-block" href="/patient_finance/customer_statement" target="_blank">{{__('patient_finance.print')}}</a>
<br>
<input type="submit" class="btn btn-success btn-block" value="<?php echo __('patient_finance.complete_payment') ?>" onclick="return finalize_payment();"/>
</div>
</div>
{{ Form::close() }}
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
$(document).ready(function() {
calculate_total();
// check if the patient has paid and a pdf print is required
if ($('#print_cashier_receipt_pdf').val() == 1) {
var win = window.open('/patient_finance/print_item_receipt_pdf', '_blank');
if (win) {
win.focus();
} else {
alert('Please allow popups for Stre@mline');
}
}
});
function add_one_off_discount() {
$('#one_off_discount_div').show();
}
function deduct_one_off_discount() {
let one_off_discount = +$('#one_off_discount').val();
let patient_to_pay = +$('#patient_to_pay').val();
patient_to_pay -= one_off_discount;
// show the amount patient has to pay
$('#patient_to_pay').val(patient_to_pay);
reset_payment_methods_amounts();
}
function finalize_payment() {
if (confirm("<?php echo __('patient_finance.complete_payment_warning') ?>")){
let original_patient_amount = +$('#original_patient_to_pay').val();
let patient_amount = +$('#patient_to_pay').val();
// check if amount left is not greater than the original
if (patient_amount < 0 || patient_amount > original_patient_amount){
alert("<?php echo __('patient_finance.valid_amount_warning') ?>");
return false;
} else {
return true;
}
} else {
return false;
}
}
function calculate_total() {
let services_patient_to_pay = false;
let procedures_patient_to_pay = false;
let investigations_patient_to_pay = false;
let treatment_patient_to_pay = false;
let sundries_patient_to_pay = false;
let services_patient_to_pay_amount = 0;
let procedures_patient_to_pay_amount = 0;
let investigations_patient_to_pay_amount = 0;
let treatment_patient_to_pay_amount = 0;
let sundries_patient_to_pay_amount = 0;
// check if some return NaN and use 0 instead
let investigation_total = +$('#investigation_total').val() || 0;
let sundry_total = +$('#sundry_total').val() || 0;
let procedure_total = +$('#procedure_total').val() || 0;
let service_total = +$('#service_total').val() || 0;
let drug_total = +$('#drug_total').val() || 0;
let inpatient_to_pay = +$('#inpatient_to_pay').val() || 0;
let debt_to_pay = +$('#debt_to_pay').val() || 0;
let patient_to_pay = investigation_total + sundry_total + procedure_total + service_total +
drug_total;
if($("#services_patient_to_pay_original").val()){
services_patient_to_pay = true;
services_patient_to_pay_amount = parseInt($("#services_patient_to_pay_original").val());
}
if($("#procedures_patient_to_pay_original").val()){
procedures_patient_to_pay = true;
procedures_patient_to_pay_amount = parseInt($("#procedures_patient_to_pay_original").val());
}
if($("#investigations_patient_to_pay_original").val()){
investigations_patient_to_pay = true;
investigations_patient_to_pay_amount = parseInt($("#investigations_patient_to_pay_original").val());
}
if($("#treatment_patient_to_pay_original").val()){
treatment_patient_to_pay = true;
treatment_patient_to_pay_amount = parseInt($("#treatment_patient_to_pay_original").val());
}
if($("#sundries_patient_to_pay_original").val()){
sundries_patient_to_pay = true;
sundries_patient_to_pay_amount = parseInt($("#sundries_patient_to_pay_original").val());
}
// get the discount percentage
let discount_percentage = parseInt($("#discount_percentage").val());
if (discount_percentage > 0) {
// apply the discount to each item
if(services_patient_to_pay){
services_patient_to_pay_amount = services_patient_to_pay_amount - (services_patient_to_pay_amount * (discount_percentage / 100));
$("#services_patient_to_pay").val(services_patient_to_pay_amount);
}
if(procedures_patient_to_pay){
procedures_patient_to_pay_amount = procedures_patient_to_pay_amount - (procedures_patient_to_pay_amount * (discount_percentage / 100));
$("#procedures_patient_to_pay").val(procedures_patient_to_pay_amount);
}
if(investigations_patient_to_pay){
investigations_patient_to_pay_amount = investigations_patient_to_pay_amount - (investigations_patient_to_pay_amount * (discount_percentage / 100));
$("#investigations_patient_to_pay").val(investigations_patient_to_pay_amount);
}
if(treatment_patient_to_pay){
treatment_patient_to_pay_amount = treatment_patient_to_pay_amount - (treatment_patient_to_pay_amount * (discount_percentage / 100));
$("#treatment_patient_to_pay").val(treatment_patient_to_pay_amount);
}
if(sundries_patient_to_pay){
sundries_patient_to_pay_amount = sundries_patient_to_pay_amount - (sundries_patient_to_pay_amount * (discount_percentage / 100));
$("#sundries_patient_to_pay").val(sundries_patient_to_pay_amount);
}
}
// get percentage that hospital will pay
let hospital_to_pay_general_discount = patient_to_pay * (discount_percentage / 100);
// remove the hospital discount from the patient amount
patient_to_pay -= hospital_to_pay_general_discount;
// add the inpatient and debts on the patient amount
// since no discounts or balance should be applied to those two
patient_to_pay += inpatient_to_pay + debt_to_pay;
// show the amount patient has to pay
$('#patient_to_pay').val(patient_to_pay);
$('#total_amount_pay').val(patient_to_pay);
// set the original amount patient will pay in case value is changed for correct balance
$('#original_patient_to_pay').val(patient_to_pay);
// show hospital to pay in percentage discounts
$('#hospital_to_pay_general_discount').val(hospital_to_pay_general_discount);
// reset the balance to 0
$('#balance').val(0);
$('#one_off_discount').val(0);
$('#one_off_discount_memo').val("");
$("#add_one_off_discount_button").show();
$("#add_payment_method_button").show();
reset_payment_methods_amounts();
}
function get_balance() {
let inpatient_to_pay = +$('#inpatient_to_pay').val();
let debt_to_pay = +$('#debt_to_pay').val();
let original_patient_amount = +$('#original_patient_to_pay').val() - (inpatient_to_pay + debt_to_pay);
let patient_amount = +$('#patient_to_pay').val() - (inpatient_to_pay + debt_to_pay);
// check if amount left is not greater than the original
if (patient_amount < 0 || patient_amount > original_patient_amount){
alert("Please input a valid patient to pay amount. Inpatient bills and debts to pay are not included.");
// reset the totals
$("#service_total").val($("#services_patient_to_pay_original").val());
$("#procedure_total").val($("#procedures_patient_to_pay_original").val());
$("#investigation_total").val($("#investigations_patient_to_pay_original").val());
$("#drug_total").val($("#treatment_patient_to_pay_original").val());
$("#sundry_total").val($("#sundries_patient_to_pay_original").val());
calculate_total();
return;
}
let balance = original_patient_amount - patient_amount;
$('#balance').val(balance);
reset_payment_methods_amounts();
let services_patient_to_pay = false;
let procedures_patient_to_pay = false;
let investigations_patient_to_pay = false;
let treatment_patient_to_pay = false;
let sundries_patient_to_pay = false;
let services_patient_to_pay_amount = 0;
let procedures_patient_to_pay_amount = 0;
let investigations_patient_to_pay_amount = 0;
let treatment_patient_to_pay_amount = 0;
let sundries_patient_to_pay_amount = 0;
if($("#service_total").val()){
services_patient_to_pay = true;
services_patient_to_pay_amount = parseInt($("#service_total").val());
// check if amount for balance is set above -1
if (parseInt($("#services_patient_to_pay_original_balance").val()) > -1){
services_patient_to_pay_amount = $("#services_patient_to_pay_original_balance").val();
} else {
$("#services_patient_to_pay_original_balance").val(services_patient_to_pay_amount);
}
}
if($("#procedure_total").val()){
procedures_patient_to_pay = true;
procedures_patient_to_pay_amount = parseInt($("#procedure_total").val());
// check if amount for balance is set above -1
if (parseInt($("#procedures_patient_to_pay_original_balance").val()) > -1){
procedures_patient_to_pay_amount = $("#procedures_patient_to_pay_original_balance").val();
} else {
$("#procedures_patient_to_pay_original_balance").val(procedures_patient_to_pay_amount);
}
}
if($("#investigation_total").val()){
investigations_patient_to_pay = true;
investigations_patient_to_pay_amount = parseInt($("#investigation_total").val());
// check if amount for balance is set above -1
if (parseInt($("#investigations_patient_to_pay_original_balance").val()) > -1){
investigations_patient_to_pay_amount = $("#investigations_patient_to_pay_original_balance").val();
} else {
$("#investigations_patient_to_pay_original_balance").val(investigations_patient_to_pay_amount);
}
}
if($("#drug_total").val()){
treatment_patient_to_pay = true;
treatment_patient_to_pay_amount = parseInt($("#drug_total").val());
// check if amount for balance is set above -1
if (parseInt($("#treatment_patient_to_pay_original_balance").val()) > -1){
treatment_patient_to_pay_amount = $("#treatment_patient_to_pay_original_balance").val();
} else {
$("#treatment_patient_to_pay_original_balance").val(treatment_patient_to_pay_amount);
}
}
if($("#sundry_total").val()){
sundries_patient_to_pay = true;
sundries_patient_to_pay_amount = parseInt($("#sundry_total").val());
// check if amount for balance is set above -1
if (parseInt($("#sundries_patient_to_pay_original_balance").val()) > -1){
sundries_patient_to_pay_amount = $("#sundries_patient_to_pay_original_balance").val();
} else {
$("#sundries_patient_to_pay_original_balance").val(sundries_patient_to_pay_amount);
}
}
// reducing balance method below
if(services_patient_to_pay && balance > 0){
// check if balance is less than the amount to pay
if (balance < services_patient_to_pay_amount){
services_patient_to_pay_amount -= balance;
balance = 0;
} else {
balance -= services_patient_to_pay_amount;
services_patient_to_pay_amount = 0;
}
$("#service_total").val(services_patient_to_pay_amount);
} else {
$("#service_total").val(services_patient_to_pay_amount);
}
if(procedures_patient_to_pay && balance > 0){
// check if balance is less than the amount to pay
if (balance < procedures_patient_to_pay_amount){
procedures_patient_to_pay_amount -= balance;
balance = 0;
} else {
balance -= procedures_patient_to_pay_amount;
procedures_patient_to_pay_amount = 0;
}
$("#procedure_total").val(procedures_patient_to_pay_amount);
} else {
$("#procedure_total").val(procedures_patient_to_pay_amount);
}
if(investigations_patient_to_pay && balance > 0){
// check if balance is less than the amount to pay
if (balance < investigations_patient_to_pay_amount){
investigations_patient_to_pay_amount -= balance;
balance = 0;
} else {
balance -= investigations_patient_to_pay_amount;
investigations_patient_to_pay_amount = 0;
}
$("#investigation_total").val(investigations_patient_to_pay_amount);
} else {
$("#investigation_total").val(investigations_patient_to_pay_amount);
}
if(treatment_patient_to_pay && balance > 0){
// check if balance is less than the amount to pay
if (balance < treatment_patient_to_pay_amount){
treatment_patient_to_pay_amount -= balance;
balance = 0;
} else {
balance -= treatment_patient_to_pay_amount;
treatment_patient_to_pay_amount = 0;
}
$("#drug_total").val(treatment_patient_to_pay_amount);
} else {
$("#drug_total").val(treatment_patient_to_pay_amount);
}
if(sundries_patient_to_pay && balance > 0){
// check if balance is less than the amount to pay
if (balance < sundries_patient_to_pay_amount){
sundries_patient_to_pay_amount -= balance;
} else {
sundries_patient_to_pay_amount = 0;
}
$("#sundry_total").val(sundries_patient_to_pay_amount);
} else {
$("#sundry_total").val(sundries_patient_to_pay_amount);
}
}
function add_payment_method() {
$('#payment_methods_div').show();
if ($('#cash_to_pay').val() == 0) {
$('#cash_to_pay').val( $('#patient_to_pay').val());
$('#original_cash_to_pay').val( $('#patient_to_pay').val());
}
$('#payment_methods_div').append('<div class="row"><div class="col-md-6"><label>Payment Method</label><select class="form-control payment_method" name="payment_method[]"><option value="0">--select method--</option><?php echo $patient_payment_methods_options ?></select></div><div class="col-md-6"><label>Payment Amount</label><input name="payment_methods_amount[]" type="number" class="form-control payment_methods_amount" onkeyup="payment_methods_amount_calculate()"></div></div><br>');
}
function payment_methods_amount_calculate() {
// tally up all the entered values
let total_amount_payment_methods = 0;
$('.payment_methods_amount').each(function () {
total_amount_payment_methods += +$(this).val();
});
let cash_to_pay = $('#original_cash_to_pay').val();
cash_to_pay -= total_amount_payment_methods;
if (cash_to_pay < 0) {
alert("You have entered more money in the payment methods than is supposed to be paid");
$('#cash_to_pay').val($('#original_cash_to_pay').val());
$('.payment_methods_amount').each(function () {
$(this).val(0);
});
return false;
}
$('#cash_to_pay').val(cash_to_pay);
}
function reset_payment_methods_amounts() {
$('#cash_to_pay').val( $('#patient_to_pay').val());
$('#original_cash_to_pay').val( $('#patient_to_pay').val());
$('.payment_methods_amount').each(function () {
$(this).val(0);
});
}
function reset_totals() {
$("#service_total").val($("#services_patient_to_pay_original").val());
$("#procedure_total").val($("#procedures_patient_to_pay_original").val());
$("#investigation_total").val($("#investigations_patient_to_pay_original").val());
$("#drug_total").val($("#treatment_patient_to_pay_original").val());
$("#sundry_total").val($("#sundries_patient_to_pay_original").val());
$("#inpatient_to_pay").val($("#inpatient_to_pay_original").val());
$("#debt_to_pay").val($("#debt_to_pay_original").val());
calculate_total();
}
function calculate_debts_inpatient_change() {
let inpatient_to_pay_removed = +$('#inpatient_to_pay_original').val() - +$('#inpatient_to_pay').val();
let debt_to_pay_removed = +$('#debt_to_pay_original').val() - +$('#debt_to_pay').val();
let patient_to_pay = +$('#patient_to_pay').val();
patient_to_pay -= inpatient_to_pay_removed + debt_to_pay_removed;
// show the amount patient has to pay
$('#patient_to_pay').val(patient_to_pay);
reset_payment_methods_amounts();
}
</script>
@endpush
@@ -0,0 +1,584 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Inpatient Bill - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style style="text-css">
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">
{{ __('patient_finance.central_billing_title') }} : <span style="color: #0000FF">{{ streamline_date($episode->created_at) }}</span>
</h5>
<br>
<table class="table table-sm">
<tr>
<th style="color: black">{{ __('patient_finance.patient_names') }}</th>
<td>{!! insurance_flag($patient->id) !!}</td>
<th style="color: black">{{ __('patient_finance.patient_number') }}</th>
<td>{{ $patient->number }}</td>
<th style="color: black">{{ __('patient_finance.price_list_category') }}</th>
<td>
{{ __('patient_finance.default') }}
</td>
</tr>
<tr>
<th style="color: black">{{ __('patient_finance.patient_discount') }}</th>
<td>
@if(isset($discount->discount))
{{ $discount->discount }} %
@php $discount_percentage = $discount->discount; @endphp
@else
0 %
@php $discount_percentage = 0; @endphp
@endif
</td>
<th style="color: black">{{ __('patient_finance.patient_category') }}</th>
<td>{{ isset($categories[$patient->category_id]) ? $categories[$patient->category_id] : "N/A" }}</td>
<th style="color: black">{{ __('patient_finance.pay_later') }}</th>
<td>
@if(isset($discount->pay_later) && $discount->pay_later == 1)
{{ __('patient_finance.yes') }}
@php $pay_later = 1; @endphp
{{ Form::hidden('patient_category_id', $patient->category_id) }}
@else
{{ __('patient_finance.no') }}
@php $pay_later = 0; @endphp
@endif
</td>
</tr>
</table>
<br>
@php
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
$total_amount_to_pay = 0;
@endphp
<div class="row">
<div class="col-6">
<h4>{{ __('patient_finance.consultation_services') }}</h4>
<div>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 60%">{{ __('patient_finance.service') }}</th>
<th>{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@php
$total = 0;
@endphp
@if($doc_consultation_id)
<tr>
<td>
{{ get_name($doc_consultation_id, "id", "name", "services") }}
</td>
@php
$service_cost = 0;
if($price_list_id){
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
$service_cost = get_price_list_category_price($price_list_id, 6, $doc_consultation_id);
} else {
$pre_order = \Streamline\Models\Services::withTrashed()->find($doc_consultation_id);
$service_cost = $pre_order->non_insured_price;
}
$total += $service_cost;
$total_amount_to_pay += $total;
@endphp
<td>
{{ ugandan_shillings($service_cost) }}
</td>
</tr>
@endif
@php $used_services_amount_total = 0; @endphp
@if(!empty($used_services))
@foreach($used_services as $used_service)
@php
$service_ids = explode(",", $used_service->service_id);
$service_quantity = explode(",", $used_service->quantity);
$ordered_services_amounts = (is_null($used_service->service_amount) || $used_service->service_amount == '') ? []: explode(",", $used_service->service_amount);
@endphp
@for($i = 0; $i < count($service_ids); $i++)
<tr>
<td>
{{ get_name($service_ids[$i], "id", "name", "services") }}
</td>
@php
$service_cost = 0;
if($price_list_id){
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
$service_cost = get_price_list_category_price($price_list_id, 6, $service_ids[$i]);
} else {
$pre_order = \Streamline\Models\Services::withTrashed()->find($service_ids[$i]);
//if amount was set at time of ordering
if (isset($ordered_services_amounts[$i]) && !is_null($ordered_services_amounts[$i])) {
$service_cost = $ordered_services_amounts[$i];
} else {
$service_cost = $pre_order->non_insured_price;
}
}
$total = $service_cost * $service_quantity[$i];
$used_services_amount_total += $total;
$total_amount_to_pay += $total;
@endphp
<td>
{{ ugandan_shillings($service_cost * $service_quantity[$i]) }}
</td>
</tr>
@endfor
@endforeach
@endif
<tr>
<td><b>Total</b></td>
<td>{{ ugandan_shillings($used_services_amount_total) }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-6">
<h4>{{ __('patient_finance.procedures') }}</h4>
<div>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 60%">{{ __('patient_finance.procedure_name') }}</th>
<th style="width: 40%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@if($ordered_procedures->count() > 0)
@php
$procedure_ids = array();
$order_ids = array();
// amounts at the time was ordered
$procedures_orders_amounts = [];
foreach($ordered_procedures as $ordered_procedure){
$procedure_ids = array_merge($procedure_ids, explode(",", $ordered_procedure->procedure_id));
array_push($order_ids, $ordered_procedure->id);
//if amounts are put at the time of ordering
$procedures_orders_amounts = is_null($ordered_procedure->procedure_amount) ? array_merge($procedures_orders_amounts, []) : array_merge($procedures_orders_amounts, explode(",", $ordered_procedure->procedure_amount));
}
$count_orders = count($order_ids);
// create strings from arrays to use when submitting
$order_ids_string = implode(',', $order_ids);
$procedure_ids_string = implode(',', $procedure_ids);
$procedure_orders_amounts_string = implode(',', $procedures_orders_amounts);
@endphp
@php
$procedure_amount_total = 0;
$procedure_amount = 0;
@endphp
@for ($i = 0; $i < count($procedure_ids); $i++)
@php
// check if the patient category is attached to a price list
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_id) {
$procedure_amount = get_price_list_category_price($price_list_id, 4, $procedure_ids[$i]);
} else {
//if amount was set at time of ordering
if (isset($procedures_orders_amounts[$i]) && !is_null($procedures_orders_amounts[$i])) {
$procedure_amount = $procedures_orders_amounts[$i];
} else{
$procedure_amount = get_name($procedure_ids[$i], "id", "non_insured_price", "procedures");
}
}
$procedure_amount_total += $procedure_amount;
$total_amount_to_pay += $procedure_amount;
@endphp
<tr>
<td>
<label>{{ get_name($procedure_ids[$i], "id", "name", "procedures") }}</label>
</td>
<td>
{{ ugandan_shillings($procedure_amount) }}
</td>
</tr>
@endfor
<tr>
<td><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($procedure_amount_total) }}</td>
</tr>
@else
<tr>
<td colspan="2"><h4 class="text-center">{{ __('patient_finance.no_procedures') }}</h4></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<h4>{{ __('patient_finance.investigations') }}</h4>
<div>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 50%">{{ __('patient_finance.investigation_name') }}</th>
<th style="width: 45%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@if($ordered_investigations->count() > 0)
@php
// ids of the ordered investigations
$investigation_ids = array();
// id of the current ordered investigations to update table later
$order_ids = array();
// amounts at the time of the inv was ordered
$inv_orders_amounts = [];
foreach($ordered_investigations as $ordered_investigation){
$investigation_ids = array_merge($investigation_ids, explode(",", $ordered_investigation->investigation_id));
array_push($order_ids, $ordered_investigation->id);
$inv_orders_amounts = is_null($ordered_investigation->investigation_amount) ? array_merge($inv_orders_amounts, []) : array_merge($inv_orders_amounts, explode(",", $ordered_investigation->investigation_amount));
}
$count_orders = count($order_ids);
// create strings from arrays to use when submitting
$order_ids_string = implode(',', $order_ids);
$investigation_ids_string = implode(',', $investigation_ids);
$ordered_inv_amounts_string = implode(',', $inv_orders_amounts);
@endphp
@php
$investigation_amount_total = 0;
$investigation_amount = 0;
@endphp
@for ($i = 0; $i < count($investigation_ids); $i++)
@php
// check if the patient category is attached to a price list
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_id) {
$investigation_amount = get_price_list_category_price($price_list_id, 2, $investigation_ids[$i]);
} else {
//if amount was set at time of ordering
if (isset($inv_orders_amounts[$i]) && !is_null($inv_orders_amounts[$i])) {
$investigation_amount = $inv_orders_amounts[$i];
} else{
$investigation_amount = get_name($investigation_ids[$i], "id", "non_insured_price", "investigations");
}
}
$investigation_amount_total += $investigation_amount;
$total_amount_to_pay += $investigation_amount;
@endphp
<tr>
<td>
<label>{{ get_name($investigation_ids[$i], "id", "name", "investigations") }}</label>
</td>
<td>
{{ ugandan_shillings($investigation_amount) }}
</td>
</tr>
@endfor
<tr>
<td><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($investigation_amount_total) }}</td>
</tr>
@else
<tr>
<td colspan="2"><h4 class="text-center">{{ __('patient_finance.no_investigations') }}</h4></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-6">
<h4>{{ __('patient_finance.treatment') }}</h4>
<div>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 40%">{{ __('patient_finance.item_name') }}</th>
<th style="width: 20%">{{ __('patient_finance.quantity') }}</th>
<th style="width: 20%">{{ __('patient_finance.item_price') }}</th>
<th style="width: 20%">{{ __('patient_finance.subtotal') }}</th>
</tr>
</thead>
<tbody>
@if($treatment)
@php
$treatment_amount_total = 0;
$treatment_amount = 0;
// ids of the ordered drugs
$drug_ids = explode(",", $treatment['drugs']);
// quantities of the ordered drugs
$drug_quantities = explode(",", $treatment['quantities_dispensed']);
$purchased_elsewhere = is_null($treatment["purchased_elsewhere"]) ? [] : explode(",", $treatment["purchased_elsewhere"]);
@endphp
@for ($i = 0; $i < count($drug_ids); $i++)
@php
// check if the patient category is attached to a price list
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_id) {
$treatment_amount = get_price_list_category_price($price_list_id, 3, $drug_ids[$i]);
} else {
$treatment_amount = get_name($drug_ids[$i], "id", "non_insured_price", "drugs");
}
@endphp
@if(count($purchased_elsewhere) > 0 && isset($purchased_elsewhere[$i]) && $purchased_elsewhere[$i] == 1)
<tr>
<td>
<label>{{ get_name($drug_ids[$i], "id", "name", "drugs") }}</label>
</td>
<td>{{ $drug_quantities[$i] }}</td>
<td>
{{ ugandan_shillings($treatment_amount) }}
</td>
<td style='color: orange'>{{ __('patient_finance.purchased_from_else_where') }}</td>
</tr>
@else
<tr>
<td>
<label>{{ get_name($drug_ids[$i], "id", "name", "drugs") }}</label>
</td>
<td>{{ $drug_quantities[$i] }}</td>
<td>
{{ ugandan_shillings($treatment_amount) }}
</td>
<td>
@php
$treatment_subtotal = $drug_quantities[$i] * $treatment_amount;
$treatment_amount_total += $treatment_subtotal;
$total_amount_to_pay += $drug_quantities[$i] * $treatment_amount;
@endphp
{{ ugandan_shillings($treatment_subtotal) }}
</td>
</tr>
@endif
@endfor
<tr>
<td colspan="3"><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($treatment_amount_total) }}</td>
</tr>
@else
<tr>
<td colspan="4"><h4 class="text-center">{{ __('patient_finance.no_treatment') }}</h4></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<h4>{{ __('patient_finance.sundries') }}</h4>
<div>
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th style="width: 40%">{{ __('patient_finance.sundry_name') }}</th>
<th style="width: 25%">{{ __('patient_finance.unit_cost') }}</th>
<th style="width: 10%">{{ __('patient_finance.quantity') }}</th>
<th style="width: 25%">{{ __('patient_finance.amount') }}</th>
</tr>
</thead>
<tbody>
@if($ordered_sundries->count() > 0)
@php
$sundries_ids = array();
$sundries_quantity = array();
$order_ids = array();
// amounts at the time of the inv was ordered
$sundries_orders_amounts = [];
foreach($ordered_sundries as $ordered_sundry){
$sundries_ids = array_merge($sundries_ids, explode(",", $ordered_sundry->sundries_id));
$sundries_quantity = array_merge($sundries_quantity, explode(",", $ordered_sundry->quantity));
array_push($order_ids, $ordered_sundry->id);
//if amounts are put at the time of ordering
$sundries_orders_amounts = is_null($ordered_sundry->sundries_amount) ? array_merge($sundries_orders_amounts, []) : array_merge($sundries_orders_amounts, explode(",", $ordered_sundry->sundries_amount));
}
$count_orders = count($order_ids);
// create strings from arrays to use when submitting
$order_ids_string = implode(',', $order_ids);
$sundries_ids_string = implode(',', $sundries_ids);
$sundries_orders_amounts_string = implode(',', $sundries_orders_amounts);
$orders_count = 0;
$sundries_cost_total = 0;
@endphp
@for($i = 0; $i < count($sundries_ids); $i++)
@php
// check if the patient category is attached to a price list
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_id) {
$sundry_amount = get_price_list_category_price($price_list_id, 5, $sundries_ids[$i]);
} else {
//if amount was set at time of ordering
if (isset($sundries_orders_amounts[$i]) && !is_null($sundries_orders_amounts[$i])) {
$sundry_amount = $sundries_orders_amounts[$i];
} else{
$sundry_amount = get_name($sundries_ids[$i], "id", "non_insured_price", "sundries");
}
}
// get the subtotal for this sundry
$sundry_subtotal = $sundries_quantity[$i] * $sundry_amount;
$sundries_cost_total += $sundry_subtotal;
$total_amount_to_pay += $sundry_subtotal;
@endphp
<tr>
<td>
<label>{{ get_name($sundries_ids[$i], "id", "name", "sundries") }}</label>
</td>
<td>
{{ $sundry_amount }}
</td>
<td>
{{ $sundries_quantity[$i] }}
</td>
<td>
{{ ugandan_shillings($sundry_subtotal) }}
</td>
</tr>
@php $orders_count++; @endphp
@endfor
<tr>
<td colspan="3"><b>{{ __('patient_finance.total') }}</b></td>
<td>{{ ugandan_shillings($sundries_cost_total) }}</td>
</tr>
@else
<tr>
<td colspan="4"><h4 class="text-center">{{ __('patient_finance.no_sundries') }}</h4></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
@php
$patient_to_pay = $total_amount_to_pay;
$patient_category_to_pay = 0;
if ($pay_later == 1) {
$patient_category_to_pay = $patient_to_pay;
$patient_to_pay = 0;
}
$hospital_to_pay_general_discount = $patient_to_pay * ($discount_percentage / 100);
$patient_to_pay = $patient_to_pay - $hospital_to_pay_general_discount;
@endphp
<div class="col-6">
<div class="row">
<div class="col-6">
<table class="table table-sm table-bordered">
<tr>
<th style="color: black">{{ __('patient_finance.total_amount') }}</th>
<td>
<p>{{ ugandan_shillings($total_amount_to_pay) }}</p>
</td>
</tr>
@if($hospital_to_pay_general_discount > 0)
<tr>
<th style="color: black">{{ __('patient_finance.hospital_to_pay') }}</th>
<td><p>{{ ugandan_shillings($hospital_to_pay_general_discount) }}</p></td>
</tr>
@endif
</table>
</div>
<div class="col-6">
<table class="table table-sm table-bordered">
<tr>
<th style="color: black">{{ __('patient_finance.patient_to_pay') }}</th>
<td>
<p>{{ ugandan_shillings($patient_to_pay) }}</p>
</td>
</tr>
@if($patient_category_to_pay > 0)
<tr>
<th style="color: black">{{ isset($categories[$patient->category_id]) ? $categories[$patient->category_id] : "Patient Category" }} To Pay</th>
<td><p>{{ ugandan_shillings($patient_category_to_pay) }}</p></td>
</tr>
@endif
</table>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,346 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.central_billing_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.central_billing_receipt') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" target="_blank" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>@if($is_invoice == 1) {{ __('patient_finance.invoice_number') }} @else {{ __('patient_finance.receipt_number') }} @endif :</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_name') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.quantity') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(isset($service_ids_array) && count($service_ids_array) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($service_ids_array); $i++)
<tr>
<td>{{ get_name($service_ids_array[$i], "id", "name", "services") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($service_prices_array[$i]) }}</td>
</tr>
@endfor
@else
@php $service_total = 0; @endphp
@for($i = 0; $i < count($service_ids_array); $i++)
@php $service_total += $service_prices_array[$i]; @endphp
@endfor
<tr>
<td>Services</td>
<td>N/A</td>
<td>{{ ugandan_shillings($service_total) }}</td>
</tr>
@endif
@endif
@if(isset($procedure_ids_array) && count($procedure_ids_array) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($procedure_ids_array); $i++)
<tr>
<td>{{ get_name($procedure_ids_array[$i], "id", "name", "procedures") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($procedure_amounts_array[$i]) }}</td>
</tr>
@endfor
@else
@php $procedure_total = 0; @endphp
@for($i = 0; $i < count($procedure_ids_array); $i++)
@php $procedure_total += $procedure_amounts_array[$i]; @endphp
@endfor
<tr>
<td>Procedures</td>
<td>N/A</td>
<td>{{ ugandan_shillings($procedure_total) }}</td>
</tr>
@endif
@endif
@if(isset($investigation_ids_array) && count($investigation_ids_array) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($investigation_ids_array); $i++)
<tr>
<td>{{ get_name($investigation_ids_array[$i], "id", "name", "investigations") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($investigation_amounts_array[$i]) }}</td>
</tr>
@endfor
@else
@php $invs_total = 0; @endphp
@for($i = 0; $i < count($investigation_ids_array); $i++)
@php $invs_total += $investigation_amounts_array[$i]; @endphp
@endfor
<tr>
<td>Investigations</td>
<td>N/A</td>
<td>{{ ugandan_shillings($invs_total) }}</td>
</tr>
@endif
@endif
@if(isset($treatment_item) && count($treatment_item) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($treatment_item); $i++)
<tr>
<td>{{ get_name($treatment_item[$i], "id", "name", "drugs") }}</td>
<td>{{ $treatment_quantity[$i] }}</td>
<td>{{ ugandan_shillings($treatment_subtotal[$i]) }}</td>
</tr>
@endfor
@else
@php $treatment_total = 0; @endphp
@for($i = 0; $i < count($treatment_item); $i++)
@php $treatment_total += $treatment_subtotal[$i]; @endphp
@endfor
<tr>
<td>Treatment</td>
<td>N/A</td>
<td>{{ ugandan_shillings($treatment_total) }}</td>
</tr>
@endif
@endif
@if(isset($sundry_item) && count($sundry_item) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($sundry_item); $i++)
<tr>
<td>{{ get_name($sundry_item[$i], "id", "name", "sundries") }}</td>
<td>{{ $sundry_quantity[$i] }}</td>
<td>{{ ugandan_shillings($sundry_subtotal[$i]) }}</td>
</tr>
@endfor
@else
@php $sundry_total = 0; @endphp
@for($i = 0; $i < count($sundry_item); $i++)
@php $sundry_total += $sundry_subtotal[$i]; @endphp
@endfor
<tr>
<td>Sundries</td>
<td>N/A</td>
<td>{{ ugandan_shillings($sundry_total) }}</td>
</tr>
@endif
@endif
@if(isset($optic_item))
@for($i = 0; $i < count($optic_item); $i++)
<tr>
<td>{{ get_name($optic_item[$i], "id", "name", "eye_glasses") }}</td>
<td>{{ $optic_quantity[$i] }}</td>
<td>{{ ugandan_shillings($optic_subtotal[$i]) }}</td>
</tr>
@endfor
@endif
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2"><b>{{ __('patient_finance.total_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($staff_guarantor_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.staff_guarantor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($staff_guarantor_to_pay) }}</b></td>
</tr>
@endif
@if($patient_category_to_pay > 0)
<tr>
<td colspan="2"><b>{{ get_name($patient_category_id_to_pay, "id", "name", "patient_categories") }} To Pay</b></td>
<td><b>{{ ugandan_shillings($patient_category_to_pay) }}</b></td>
</tr>
@endif
@if($hospital_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.hospital_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($hospital_to_pay) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_amount') }}</b></td>
<td><b>{{ ugandan_shillings($one_off_discount) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0 && $one_off_discount_memo != "")
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_memo') }}</b></td>
<td><b>{{ $one_off_discount_memo }}</b></td>
</tr>
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
@if($treatment_balance > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.progressive_treatment_balance') }}</b></td>
<td><b>{{ ugandan_shillings($treatment_balance) }}</b></td>
</tr>
@endif
@if(count($return_payment_methods) > 0)
<tr><td colspan="3"></td></tr>
@foreach($return_payment_methods as $key => $value)
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_paid_with') }} {{ ($key == 0) ? 'Cash' : get_name($key, 'id', 'name', 'patient_payment_methods') }}</b></td>
<td><b>{{ ugandan_shillings($value) }}</b></td>
</tr>
@endforeach
@endif
@if($patient_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_patient_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($patient_account_pay_with) }}</b></td>
</tr>
@endif
@if($family_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_family_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($family_account_pay_with) }}</b></td>
</tr>
@endif
@if($balance > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.balance_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($balance) }}</b></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,298 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Patient Receipt - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
font-size: 0.8em;
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<table class="table table-bordered">
<tr>
<td><b>{{ __('patient_finance.patient_names') }}</b></td>
<td>{{ $patient->first_name }} {{ $patient->last_name }}</td>
<td><b>{{ __('patient_finance.patient_number') }}</b></td>
<td>{{ $patient->number }}</td>
<td><b>{{ __('patient_finance.patient_category') }}</b></td>
<td>{{ get_name($patient->category_id, "id", "name", "patient_categories") }}</td>
</tr>
<tr>
<td><b>{{ __('patient_finance.date') }}</b></td>
<td colspan="2">{{ streamline_date_time_short($receipt_date) }}</td>
<td><b>@if($is_invoice == 1) {{ __('patient_finance.invoice_number') }} @else {{ __('patient_finance.receipt_number') }} @endif</b></td>
<td colspan="2">{{ $receipt_number }}</td>
</tr>
</table>
<div>
<table class="table table-bordered" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.quantity') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(isset($service_ids_array) && count($service_ids_array) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($service_ids_array); $i++)
<tr>
<td>{{ get_name($service_ids_array[$i], "id", "name", "services") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($service_prices_array[$i]) }}</td>
</tr>
@endfor
@else
@php $service_total = 0; @endphp
@for($i = 0; $i < count($service_ids_array); $i++)
@php $service_total += $service_prices_array[$i]; @endphp
@endfor
<tr>
<td>Services</td>
<td>N/A</td>
<td>{{ ugandan_shillings($service_total) }}</td>
</tr>
@endif
@endif
@if(isset($procedure_ids_array) && count($procedure_ids_array) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($procedure_ids_array); $i++)
<tr>
<td>{{ get_name($procedure_ids_array[$i], "id", "name", "procedures") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($procedure_amounts_array[$i]) }}</td>
</tr>
@endfor
@else
@php $procedure_total = 0; @endphp
@for($i = 0; $i < count($procedure_ids_array); $i++)
@php $procedure_total += $procedure_amounts_array[$i]; @endphp
@endfor
<tr>
<td>Procedures</td>
<td>N/A</td>
<td>{{ ugandan_shillings($procedure_total) }}</td>
</tr>
@endif
@endif
@if(isset($investigation_ids_array) && count($investigation_ids_array) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($investigation_ids_array); $i++)
<tr>
<td>{{ get_name($investigation_ids_array[$i], "id", "name", "investigations") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($investigation_amounts_array[$i]) }}</td>
</tr>
@endfor
@else
@php $invs_total = 0; @endphp
@for($i = 0; $i < count($investigation_ids_array); $i++)
@php $invs_total += $investigation_amounts_array[$i]; @endphp
@endfor
<tr>
<td>Investigations</td>
<td>N/A</td>
<td>{{ ugandan_shillings($invs_total) }}</td>
</tr>
@endif
@endif
@if(isset($treatment_item) && count($treatment_item) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($treatment_item); $i++)
<tr>
<td>{{ get_name($treatment_item[$i], "id", "name", "drugs") }}</td>
<td>{{ $treatment_quantity[$i] }}</td>
<td>{{ ugandan_shillings($treatment_subtotal[$i]) }}</td>
</tr>
@endfor
@else
@php $treatment_total = 0; @endphp
@for($i = 0; $i < count($treatment_item); $i++)
@php $treatment_total += $treatment_subtotal[$i]; @endphp
@endfor
<tr>
<td>Treatments</td>
<td>N/A</td>
<td>{{ ugandan_shillings($treatment_total) }}</td>
</tr>
@endif
@endif
@if(isset($sundry_item) && count($sundry_item) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($sundry_item); $i++)
<tr>
<td>{{ get_name($sundry_item[$i], "id", "name", "sundries") }}</td>
<td>{{ $sundry_quantity[$i] }}</td>
<td>{{ ugandan_shillings($sundry_subtotal[$i]) }}</td>
</tr>
@endfor
@else
@php $sundry_total = 0; @endphp
@for($i = 0; $i < count($sundry_item); $i++)
@php $sundry_total += $sundry_subtotal[$i]; @endphp
@endfor
<tr>
<td>Sundries</td>
<td>N/A</td>
<td>{{ ugandan_shillings($sundry_total) }}</td>
</tr>
@endif
@endif
@if(isset($optic_item))
@for($i = 0; $i < count($optic_item); $i++)
<tr>
<td>{{ get_name($optic_item[$i], "id", "name", "eye_glasses") }}</td>
<td>{{ $optic_quantity[$i] }}</td>
<td>{{ ugandan_shillings($optic_subtotal[$i]) }}</td>
</tr>
@endfor
@endif
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2"><b>{{ __('patient_finance.total_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($staff_guarantor_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.staff_guarantor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($staff_guarantor_to_pay) }}</b></td>
</tr>
@endif
@if($patient_category_to_pay > 0)
<tr>
<td colspan="2"><b>{{ get_name($patient_category_id_to_pay, "id", "name", "patient_categories") }} To Pay</b></td>
<td><b>{{ ugandan_shillings($patient_category_to_pay) }}</b></td>
</tr>
@endif
@if($hospital_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.hospital_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($hospital_to_pay) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_amount') }}</b></td>
<td><b>{{ ugandan_shillings($one_off_discount) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0 && $one_off_discount_memo != "")
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_memo') }}</b></td>
<td><b>{{ $one_off_discount_memo }}</b></td>
</tr>
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
@if($balance > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.balance_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($balance) }}</b></td>
</tr>
@endif
@if($treatment_balance > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.progressive_treatment_balance') }}</b></td>
<td><b>{{ ugandan_shillings($treatment_balance) }}</b></td>
</tr>
@endif
@if(count($return_payment_methods) > 0)
<tr><td colspan="3"></td></tr>
@foreach($return_payment_methods as $key => $value)
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_paid_with') }} {{ ($key == 0) ? 'Cash' : get_name($key, 'id', 'name', 'patient_payment_methods') }}</b></td>
<td><b>{{ ugandan_shillings($value) }}</b></td>
</tr>
@endforeach
@endif
@if($patient_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_patient_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($patient_account_pay_with) }}</b></td>
</tr>
@endif
@if($family_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_family_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($family_account_pay_with) }}</b></td>
</tr>
@endif
</tbody>
</table>
</div>
<div class="row">
<div class="col">
<i style="font-size: 0.8em; float: left">&copy; {{ date('Y') }} Stre@mline</i>
</div>
<div class="col">
<i style="float: right">{{ __('patient_finance.printed_on') }} {{ date(" d M Y h:ia") }} {{ __('patient_finance.by') }} {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</i>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,204 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.central_billing_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.central_billing_receipt') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
<div class="row" style="float:right;"><button class="btn btn-success glyphicon glyphicon-print" onclick="print_receipt()"> {{ __('patient_finance.print') }}</button></div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.original_print_date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.reprint_date') }}:</b> {{ streamline_date_time_short(date('Y-m-d H:i:s')) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.receipt_number') }}:</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_name') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
@php $total_amount_pay = 0; @endphp
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.quantity') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(isset($service_ids_array) && count($service_ids_array) > 0)
<tr>
<td colspan="3" class="text-center"><b>{{ __('patient_finance.services') }}</b></td>
</tr>
@for($i = 0; $i < count($service_ids_array); $i++)
<tr>
<td>{{ get_name($service_ids_array[$i], "id", "name", "services") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($service_prices_array[$i]) }}</td>
@php $total_amount_pay += $service_prices_array[$i]; @endphp
</tr>
@endfor
@endif
@if(isset($procedure_ids_array) && count($procedure_ids_array) > 0)
<tr>
<td colspan="3" class="text-center"><b>{{ __('patient_finance.procedures') }}</b></td>
</tr>
@for($i = 0; $i < count($procedure_ids_array); $i++)
<tr>
<td>{{ get_name($procedure_ids_array[$i], "id", "name", "procedures") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($procedure_amounts_array[$i]) }}</td>
@php $total_amount_pay += $procedure_amounts_array[$i]; @endphp
</tr>
@endfor
@endif
@if(isset($investigation_ids_array) && count($investigation_ids_array) > 0)
<tr>
<td colspan="3" class="text-center"><b>{{ __('patient_finance.investigations') }}</b></td>
</tr>
@for($i = 0; $i < count($investigation_ids_array); $i++)
<tr>
<td>{{ get_name($investigation_ids_array[$i], "id", "name", "investigations") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($investigation_amounts_array[$i]) }}</td>
@php $total_amount_pay += $investigation_amounts_array[$i]; @endphp
</tr>
@endfor
@endif
@if(isset($treatment_item) && count($treatment_item) > 0)
<tr>
<td colspan="3" class="text-center"><b>{{ __('patient_finance.drugs') }}</b></td>
</tr>
@for($i = 0; $i < count($treatment_item); $i++)
<tr>
<td>{{ get_name($treatment_item[$i], "id", "name", "drugs") }}</td>
<td>{{ $treatment_quantity[$i] }}</td>
<td>{{ ugandan_shillings($treatment_subtotal[$i]) }}</td>
@php $total_amount_pay += $treatment_subtotal[$i]; @endphp
</tr>
@endfor
@endif
@if(isset($sundry_item) && count($sundry_item) > 0)
<tr>
<td colspan="3" class="text-center"><b>{{ __('patient_finance.sundries') }}</b></td>
</tr>
@for($i = 0; $i < count($sundry_item); $i++)
<tr>
<td>{{ get_name($sundry_item[$i], "id", "name", "sundries") }}</td>
<td>{{ $sundry_quantity[$i] }}</td>
<td>{{ ugandan_shillings($sundry_subtotal[$i]) }}</td>
@php $total_amount_pay += $sundry_subtotal[$i]; @endphp
</tr>
@endfor
@endif
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2"><b>{{ __('patient_finance.total_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_amount_paid') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
@if(($total_amount_pay - $patient_to_pay) > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.balance') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay - $patient_to_pay) }}</b></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,373 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.chi_deposit_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.chi_deposit_receipt') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" target="_blank" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
@if (!empty(session()->get('episode_id')))
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
@else
<div class="row" style="float:right;"><button class="btn btn-success glyphicon glyphicon-print" onclick="print_receipt()"> {{ __('patient_finance.print') }}</button></div>
@endif
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.receipt_number') }} :</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_name') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th><b>{{ __('patient_finance.description') }}</b></th>
<th><b>{{ __('patient_finance.quantity') }}</b></th>
<th><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(isset($service_ids_array) && count($service_ids_array) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($service_ids_array); $i++)
<tr>
<td>{{ get_name($service_ids_array[$i], "id", "name", "services") }}</td>
<td>N/A</td>
<td>
{{ ugandan_shillings($service_co_payment_amount_array[$i]) }}
@if($service_chi_amount_array[$i] > 0)
<span style="color: green">({{ ugandan_shillings($service_chi_amount_array[$i]) }} {{ __('patient_finance.paid_by_chi') }}) </span>
@endif
</td>
</tr>
@endfor
@else
@php $service_total = 0; @endphp
@for($i = 0; $i < count($service_ids_array); $i++)
@php $service_total += $service_co_payment_amount_array[$i]; @endphp
@endfor
<tr>
<td>Services</td>
<td>1</td>
<td>{{ ugandan_shillings($service_total) }}</td>
</tr>
@endif
@endif
@if(isset($procedure_ids_array) && count($procedure_ids_array) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($procedure_ids_array); $i++)
<tr>
<td>{{ get_name($procedure_ids_array[$i], "id", "name", "procedures") }}</td>
<td>1</td>
<td>
{{ ugandan_shillings($procedure_co_payment_amount_array[$i]) }}
@if($procedure_chi_amount_array[$i] > 0)
<span style="color: green">({{ ugandan_shillings($procedure_chi_amount_array[$i]) }} {{ __('patient_finance.paid_by_chi') }}) </span>
@endif
</td>
</tr>
@endfor
@else
@php $procedure_total = 0; @endphp
@for($i = 0; $i < count($procedure_ids_array); $i++)
@php $procedure_total += $procedure_co_payment_amount_array[$i]; @endphp
@endfor
<tr>
<td>Procedures</td>
<td>1</td>
<td>{{ ugandan_shillings($procedure_total) }}</td>
</tr>
@endif
@endif
@if(isset($investigation_ids_array) && count($investigation_ids_array) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($investigation_ids_array); $i++)
<tr>
<td>{{ get_name($investigation_ids_array[$i], "id", "name", "investigations") }}</td>
<td>1</td>
<td>
{{ ugandan_shillings($investigation_co_payment_amount_array[$i]) }}
@if($investigation_chi_amount_array[$i] > 0)
<span style="color: green">({{ ugandan_shillings($investigation_chi_amount_array[$i]) }} {{ __('patient_finance.paid_by_chi') }}) </span>
@endif
</td>
</tr>
@endfor
@else
@php $invs_total = 0; @endphp
@for($i = 0; $i < count($investigation_ids_array); $i++)
@php $invs_total += $investigation_co_payment_amount_array[$i]; @endphp
@endfor
<tr>
<td>Investigations</td>
<td>1</td>
<td>{{ ugandan_shillings($invs_total) }}</td>
</tr>
@endif
@endif
@if(isset($treatment_item) && count($treatment_item) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($treatment_item); $i++)
<tr>
<td>{{ get_name($treatment_item[$i], "id", "name", "drugs") }}</td>
<td>{{ $treatment_quantity[$i] }}</td>
<td>
{{ ugandan_shillings($treatment_co_payment_amount_array[$i]) }}
@if($treatment_chi_amount_array[$i] > 0)
<span style="color: green">({{ ugandan_shillings($treatment_chi_amount_array[$i]) }} {{ __('patient_finance.paid_by_chi') }}) </span>
@endif
</td>
</tr>
@endfor
@else
@php $treatment_total = 0; @endphp
@for($i = 0; $i < count($treatment_item); $i++)
@php $treatment_total += $treatment_co_payment_amount_array[$i]; @endphp
@endfor
<tr>
<td>Treatment</td>
<td>1</td>
<td>{{ ugandan_shillings($treatment_total) }}</td>
</tr>
@endif
@endif
@if(isset($sundry_item) && count($sundry_item) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($sundry_item); $i++)
<tr>
<td>{{ get_name($sundry_item[$i], "id", "name", "sundries") }}</td>
<td>{{ $sundry_quantity[$i] }}</td>
<td>
{{ ugandan_shillings($sundry_co_payment_amount_array[$i]) }}
@if($sundry_chi_amount_array[$i] > 0)
<span style="color: green">({{ ugandan_shillings($sundry_chi_amount_array[$i]) }} {{ __('patient_finance.paid_by_chi') }}) </span>
@endif
</td>
</tr>
@endfor
@else
@php $sundry_total = 0; @endphp
@for($i = 0; $i < count($sundry_item); $i++)
@php $sundry_total += $sundry_co_payment_amount_array[$i]; @endphp
@endfor
<tr>
<td>Sundries</td>
<td>1</td>
<td>{{ ugandan_shillings($sundry_total) }}</td>
</tr>
@endif
@endif
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2"><b>{{ __('patient_finance.total_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($chi_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.chi_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($chi_to_pay) }}</b></td>
</tr>
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_co_payment') }}</b></td>
<td>
<b>{{ ugandan_shillings($patient_co_payment) }}</b>
</td>
</tr>
@if($patient_category_to_pay > 0)
<tr>
<td colspan="2"><b>{{ get_name($patient_category_id_to_pay, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_category_to_pay) }}</b></td>
</tr>
@endif
<tr><td colspan="3"></td></tr>
@if($hospital_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.hospital_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($hospital_to_pay) }}</b></td>
</tr>
@endif
@if($staff_guarantor_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.staff_guarantor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($staff_guarantor_to_pay) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_amount') }}</b></td>
<td><b>{{ ugandan_shillings($one_off_discount) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0 && !empty($one_off_discount_memo))
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_memo') }}</b></td>
<td><b>{{ $one_off_discount_memo }}</b></td>
</tr>
@endif
@if(count($return_payment_methods) > 0)
@foreach($return_payment_methods as $key => $value)
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_paid_with') }} {{ ($key == 0) ? 'Cash' : get_name($key, 'id', 'name', 'patient_payment_methods') }}</b></td>
<td><b>{{ ugandan_shillings($value) }}</b></td>
</tr>
@endforeach
@endif
@if($patient_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_patient_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($patient_account_pay_with) }}</b></td>
</tr>
@endif
@if($family_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_family_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($family_account_pay_with) }}</b></td>
</tr>
@endif
@if($balance > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.balance_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($balance) }}</b></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,315 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Patient Receipt - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
font-size: 0.8em;
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<table class="table table-bordered">
<tr>
<td><b>{{ __('patient_finance.patient_names') }}</b></td>
<td>{{ $patient->first_name }} {{ $patient->last_name }}</td>
<td><b>{{ __('patient_finance.patient_number') }}</b></td>
<td>{{ $patient->number }}</td>
<td><b>{{ __('patient_finance.patient_category') }}</b></td>
<td>{{ get_name($patient->category_id, "id", "name", "patient_categories") }}</td>
</tr>
<tr>
<td><b>{{ __('patient_finance.date') }}</b></td>
<td>{{ streamline_date_time_short($receipt_date) }}</td>
<td><b>{{ __('patient_finance.receipt_number') }}</b></td>
<td>{{ $receipt_number }}</td>
<td><b>{{ __('patient_finance.cashier') }}</b></td>
<td>{{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</td>
</tr>
</table>
<div>
<table class="table table-bordered" id="receipt_table">
<thead>
<th><b>{{ __('patient_finance.description') }}</b></th>
<th><b>{{ __('patient_finance.quantity') }}</b></th>
<th><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(isset($service_ids_array) && count($service_ids_array) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($service_ids_array); $i++)
<tr>
<td>{{ get_name($service_ids_array[$i], "id", "name", "services") }}</td>
<td>N/A</td>
<td>
{{ ugandan_shillings($service_co_payment_amount_array[$i]) }}
@if($service_chi_amount_array[$i] > 0)
<span style="color: green">({{ ugandan_shillings($service_chi_amount_array[$i]) }} {{ __('patient_finance.paid_by_chi') }}) </span>
@endif
</td>
</tr>
@endfor
@else
@php $service_total = 0; @endphp
@for($i = 0; $i < count($service_ids_array); $i++)
@php $service_total += $service_co_payment_amount_array[$i]; @endphp
@endfor
<tr>
<td>Services</td>
<td>1</td>
<td>{{ ugandan_shillings($service_total) }}</td>
</tr>
@endif
@endif
@if(isset($procedure_ids_array) && count($procedure_ids_array) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($procedure_ids_array); $i++)
<tr>
<td>{{ get_name($procedure_ids_array[$i], "id", "name", "procedures") }}</td>
<td>1</td>
<td>
{{ ugandan_shillings($procedure_co_payment_amount_array[$i]) }}
@if($procedure_chi_amount_array[$i] > 0)
<span style="color: green">({{ ugandan_shillings($procedure_chi_amount_array[$i]) }} {{ __('patient_finance.paid_by_chi') }}) </span>
@endif
</td>
</tr>
@endfor
@else
@php $procedure_total = 0; @endphp
@for($i = 0; $i < count($procedure_ids_array); $i++)
@php $procedure_total += $procedure_co_payment_amount_array[$i]; @endphp
@endfor
<tr>
<td>Procedures</td>
<td>1</td>
<td>{{ ugandan_shillings($procedure_total) }}</td>
</tr>
@endif
@endif
@if(isset($investigation_ids_array) && count($investigation_ids_array) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($investigation_ids_array); $i++)
<tr>
<td>{{ get_name($investigation_ids_array[$i], "id", "name", "investigations") }}</td>
<td>1</td>
<td>
{{ ugandan_shillings($investigation_co_payment_amount_array[$i]) }}
@if($investigation_chi_amount_array[$i] > 0)
<span style="color: green">({{ ugandan_shillings($investigation_chi_amount_array[$i]) }} {{ __('patient_finance.paid_by_chi') }}) </span>
@endif
</td>
</tr>
@endfor
@else
@php $invs_total = 0; @endphp
@for($i = 0; $i < count($investigation_ids_array); $i++)
@php $invs_total += $investigation_co_payment_amount_array[$i]; @endphp
@endfor
<tr>
<td>Investigations</td>
<td>1</td>
<td>{{ ugandan_shillings($invs_total) }}</td>
</tr>
@endif
@endif
@if(isset($treatment_item) && count($treatment_item) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($treatment_item); $i++)
<tr>
<td>{{ get_name($treatment_item[$i], "id", "name", "drugs") }}</td>
<td>{{ $treatment_quantity[$i] }}</td>
<td>
{{ ugandan_shillings($treatment_co_payment_amount_array[$i]) }}
@if($treatment_chi_amount_array[$i] > 0)
<span style="color: green">({{ ugandan_shillings($treatment_chi_amount_array[$i]) }} {{ __('patient_finance.paid_by_chi') }}) </span>
@endif
</td>
</tr>
@endfor
@else
@php $treatment_total = 0; @endphp
@for($i = 0; $i < count($treatment_item); $i++)
@php $treatment_total += $treatment_co_payment_amount_array[$i]; @endphp
@endfor
<tr>
<td>Treatments</td>
<td>N/A</td>
<td>{{ ugandan_shillings($treatment_total) }}</td>
</tr>
@endif
@endif
@if(isset($sundry_item) && count($sundry_item) > 0)
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($sundry_item); $i++)
<tr>
<td>{{ get_name($sundry_item[$i], "id", "name", "sundries") }}</td>
<td>{{ $sundry_quantity[$i] }}</td>
<td>
{{ ugandan_shillings($sundry_co_payment_amount_array[$i]) }}
@if($sundry_chi_amount_array[$i] > 0)
<span style="color: green">({{ ugandan_shillings($sundry_chi_amount_array[$i]) }} {{ __('patient_finance.paid_by_chi') }}) </span>
@endif
</td>
</tr>
@endfor
@else
@php $sundry_total = 0; @endphp
@for($i = 0; $i < count($sundry_item); $i++)
@php $sundry_total += $sundry_co_payment_amount_array[$i]; @endphp
@endfor
<tr>
<td>Sundries</td>
<td>N/A</td>
<td>{{ ugandan_shillings($sundry_total) }}</td>
</tr>
@endif
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.total_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($chi_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.chi_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($chi_to_pay) }}</b></td>
</tr>
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_co_payment') }}</b></td>
<td><b>{{ ugandan_shillings($patient_co_payment) }}</b></td>
</tr>
@if($patient_category_to_pay > 0)
<tr>
<td><b>{{ get_name($patient_category_id_to_pay, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_category_to_pay) }}</b></td>
</tr>
@endif
@if($hospital_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.hospital_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($hospital_to_pay) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_amount') }}</b></td>
<td><b>{{ ugandan_shillings($one_off_discount) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0 && !empty($one_off_discount_memo))
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_memo') }}</b></td>
<td><b>{{ $one_off_discount_memo }}</b></td>
</tr>
@endif
@if($staff_guarantor_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.staff_guarantor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($staff_guarantor_to_pay) }}</b></td>
</tr>
@endif
@if(count($return_payment_methods) > 0)
@foreach($return_payment_methods as $key => $value)
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_paid_with') }} {{ ($key == 0) ? 'Cash' : get_name($key, 'id', 'name', 'patient_payment_methods') }}</b></td>
<td><b>{{ ugandan_shillings($value) }}</b></td>
</tr>
@endforeach
@endif
@if($patient_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_patient_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($patient_account_pay_with) }}</b></td>
</tr>
@endif
@if($family_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_family_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($family_account_pay_with) }}</b></td>
</tr>
@endif
@if($balance > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.balance_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($balance) }}</b></td>
</tr>
@endif
</tbody>
</table>
</div>
<div class="row">
<div class="col">
<i style="font-size: 0.8em; float: left">&copy; {{ date('Y') }} Stre@mline</i>
</div>
<div class="col">
<i style="float: right">{{ __('patient_finance.printed_on') }} {{ date(" d M Y h:ia") }} {{ __('patient_finance.by') }} {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</i>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,228 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.collective_bills_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.collective_bills_receipt') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
<div class="row" style="float:right;"><button class="btn btn-success glyphicon glyphicon-print" onclick="print_receipt()"> {{ __('patient_finance.print') }}</button></div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.receipt_number') }}</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_name') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.quantity') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(isset($service_ids_array))
@for($i = 0; $i < count($service_ids_array); $i++)
<tr>
<td>{{ get_name($service_ids_array[$i], "id", "name", "services") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($service_prices_array[$i]) }}</td>
</tr>
@endfor
@endif
@if(isset($procedure_ids_array))
@for($i = 0; $i < count($procedure_ids_array); $i++)
<tr>
<td>{{ get_name($procedure_ids_array[$i], "id", "name", "procedures") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($procedure_amounts_array[$i]) }}</td>
</tr>
@endfor
@endif
@if(isset($investigation_ids_array))
@for($i = 0; $i < count($investigation_ids_array); $i++)
<tr>
<td>{{ get_name($investigation_ids_array[$i], "id", "name", "investigations") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($investigation_amounts_array[$i]) }}</td>
</tr>
@endfor
@endif
@if(isset($treatment_item))
@for($i = 0; $i < count($treatment_item); $i++)
<tr>
<td>{{ get_name($treatment_item[$i], "id", "name", "drugs") }}</td>
<td>{{ $treatment_quantity[$i] }}</td>
<td>{{ ugandan_shillings($treatment_subtotal[$i]) }}</td>
</tr>
@endfor
@endif
@if(isset($sundry_item))
@for($i = 0; $i < count($sundry_item); $i++)
<tr>
<td>{{ get_name($sundry_item[$i], "id", "name", "sundries") }}</td>
<td>{{ $sundry_quantity[$i] }}</td>
<td>{{ ugandan_shillings($sundry_subtotal[$i]) }}</td>
</tr>
@endfor
@endif
@if(isset($inpatient_to_pay))
<tr>
<td>{{ __('patient_finance.inpatient_bills') }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($inpatient_to_pay) }}</td>
</tr>
@endif
@if(isset($debt_to_pay))
<tr>
<td>{{ __('patient_finance.patient_debts') }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($debt_to_pay) }}</td>
</tr>
@endif
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2"><b>{{ __('patient_finance.total_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($balance > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.balance_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($balance) }}</b></td>
</tr>
@endif
@if($hospital_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.hospital_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($hospital_to_pay) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_amount') }}</b></td>
<td><b>{{ ugandan_shillings($one_off_discount) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0 && $one_off_discount_memo != "")
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_memo') }}</b></td>
<td><b>{{ $one_off_discount_memo }}</b></td>
</tr>
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
@if(count($return_payment_methods) > 0)
<tr><td colspan="3"></td></tr>
@foreach($return_payment_methods as $key => $value)
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_paid_with') }} {{ ($key == 0) ? 'Cash' : get_name($key, 'id', 'name', 'patient_payment_methods') }}</b></td>
<td><b>{{ ugandan_shillings($value) }}</b></td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,177 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.inpatient_deposit') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" target="_blank" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.receipt_number') }}</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_names') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
<tr>
<td><b>{{ __('patient_finance.inpatient_deposit') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
@if(isset($ward_discount_amount) && $ward_discount_amount > 0)
<tr>
<td><b>{{ __('patient_finance.ward_discount_amount') }}</b></td>
<td><b>{{ ugandan_shillings($ward_discount_amount) }}</b></td>
</tr>
@endif
@if(isset($patient_category_amount) && $patient_category_amount > 0)
<tr>
<td><b>{{ get_name($patient->category_id, 'id', 'name', 'patient_categories').' '.__('patient_finance.to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_category_amount) }}</b></td>
</tr>
@endif
@if(isset($staff_guarantor_to_pay) && $staff_guarantor_to_pay > 0)
<tr>
<td><b>{{ __('patient_finance.staff_guarantor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($staff_guarantor_to_pay) }}</b></td>
</tr>
@endif
@if(isset($return_payment_methods) && count($return_payment_methods) > 0)
<tr><td colspan="2"></td></tr>
@foreach($return_payment_methods as $key => $value)
<tr>
<td><b>{{ __('patient_finance.patient_paid_with') }} {{ ($key == 0) ? 'Cash' : get_name($key, 'id', 'name', 'patient_payment_methods') }}</b></td>
<td><b>{{ ugandan_shillings($value) }}</b></td>
</tr>
@endforeach
@endif
@if(isset($patient_account_pay_with) && $patient_account_pay_with > 0)
<tr>
<td><b>{{ __('patient_finance.paid_with_patient_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($patient_account_pay_with) }}</b></td>
</tr>
@endif
@if(isset($family_account_pay_with) && $family_account_pay_with > 0)
<tr>
<td><b>{{ __('patient_finance.paid_with_family_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($family_account_pay_with) }}</b></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,157 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.inpatient_payment') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@if (!empty(session()->get('episode_id')))
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
@else
<div class="row" style="float:right;"><button class="btn btn-success glyphicon glyphicon-print" onclick="print_receipt()"> {{ __('patient_finance.print') }}</button></div>
@endif
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.receipt_number') }}</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.ref') }}</b> : {{ get_full_name($patient_id, 'id', 'first_name', 'last_name', 'patients') }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($category, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
<tr>
<td><b>{{ __('patient_finance.investigations') }}</b></td>
<td><b>{{ ugandan_shillings($request->investigation_cost) }}</b></td>
</tr>
<tr>
<td><b>{{ __('patient_finance.treatment') }}</b></td>
<td><b>{{ ugandan_shillings($request->treatment_cost) }}</b></td>
</tr>
<tr>
<td><b>{{ __('patient_finance.sundries') }}</b></td>
<td><b>{{ ugandan_shillings($request->sundries_cost) }}</b></td>
</tr>
<tr>
<td><b>{{ __('patient_finance.procedures') }}</b></td>
<td><b>{{ ugandan_shillings($request->procedure_cost) }}</b></td>
</tr>
<tr>
<td><b>{{ __('patient_finance.extras') }}</b></td>
<td><b>{{ ugandan_shillings($request->extras_cost) }}</b></td>
</tr>
<tr>
<td><b>TTA</b></td>
<td><b>{{ ugandan_shillings($request->tta_cost) }}</b></td>
</tr>
<tr>
<td><b>{{ __('patient_finance.total') }}</b></td>
<td><b>{{ ugandan_shillings($request->total_patient_amount_to_pay) }}</b></td>
</tr>
<tr>
<td><b>{{ __('patient_finance.amount_paid') }}</b></td>
<td><b>{{ ugandan_shillings($request->amount_paid) }}</b></td>
</tr>
<tr>
<td><b>{{ __('patient_finance.balance') }}</b></td>
<td><b>{{ ugandan_shillings($request->balance) }}</b></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,232 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.investigation_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.investigation_payment') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" target="_blank" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>@if($is_invoice == 1) {{ __('patient_finance.invoice_number') }} @else {{ __('patient_finance.receipt_number') }} @endif :</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_names') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($investigation_ids_array); $i++)
<tr>
<td>{{ get_name($investigation_ids_array[$i], "id", "name", "investigations") }}</td>
<td>{{ ugandan_shillings($investigation_amounts_array[$i]) }}</td>
</tr>
@endfor
@endif
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td><b>{{ __('patient_finance.total_amount') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($staff_guarantor_to_pay > 0)
<tr>
<td><b>{{ __('patient_finance.staff_guarantor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($staff_guarantor_to_pay) }}</b></td>
</tr>
@endif
@if($patient_category_to_pay > 0)
<tr>
<td><b>{{ get_name($patient_category_id_to_pay, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_category_to_pay) }}</b></td>
</tr>
@endif
@if($donor_to_pay > 0)
<tr>
<td><b>{{ __('patient_finance.donor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($donor_to_pay) }}</b></td>
</tr>
@endif
@if($hospital_to_pay > 0)
<tr>
<td><b>{{ __('patient_finance.hospital_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($hospital_to_pay) }}</b></td>
</tr>
@endif
@if($patient_unpaid_debts > 0)
<tr>
<td><b>{{ __('patient_finance.patient_debts_paid') }}</b></td>
<td><b>{{ ugandan_shillings($patient_unpaid_debts) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0)
<tr>
<td><b>{{ __('patient_finance.one_off_discount_amount') }}</b></td>
<td><b>{{ ugandan_shillings($one_off_discount) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0 && $one_off_discount_memo != "")
<tr>
<td><b>{{ __('patient_finance.one_off_discount_memo') }}</b></td>
<td><b>{{ $one_off_discount_memo }}</b></td>
</tr>
@endif
<tr>
<td><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
@if(count($return_payment_methods) > 0)
<tr><td colspan="2"></td></tr>
@foreach($return_payment_methods as $key => $value)
<tr>
<td><b>{{ __('patient_finance.patient_paid_with') }} {{ ($key == 0) ? 'Cash' : get_name($key, 'id', 'name', 'patient_payment_methods') }}</b></td>
<td><b>{{ ugandan_shillings($value) }}</b></td>
</tr>
@endforeach
@endif
@if($patient_account_pay_with > 0)
<tr>
<td><b>{{ __('patient_finance.paid_with_patient_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($patient_account_pay_with) }}</b></td>
</tr>
@endif
@if($family_account_pay_with > 0)
<tr>
<td><b>{{ __('patient_finance.paid_with_family_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($family_account_pay_with) }}</b></td>
</tr>
@endif
@if($balance > 0)
<tr>
<td><b>{{ __('patient_finance.balance_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($balance) }}</b></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,156 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.investigation_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.investigation_payment') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.original_print_date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.reprint_date') }}:</b> {{ streamline_date_time_short(date('Y-m-d H:i:s')) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.receipt_number') }}: </b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_names') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($investigation_ids_array); $i++)
<tr>
<td>{{ get_name($investigation_ids_array[$i], "id", "name", "investigations") }}</td>
<td>{{ ugandan_shillings($investigation_prices_array[$i]) }}</td>
</tr>
@endfor
@endif
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td><b>{{ __('patient_finance.total_amount') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($discounts_applied > 0)
<tr>
<td>
<b>
@if($type == 1)
{{ __('patient_finance.discounts_applied') }}
@else
{{ get_name($patient->category_id, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}
@endif
</b>
</td>
<td><b>{{ ugandan_shillings($discounts_applied) }}</b></td>
</tr>
@endif
<tr>
<td><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,236 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.optical_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.optical_receipt') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" target="_blank" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
@if (!empty(session()->get('episode_id')))
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
@else
<div class="row" style="float:right;"><button class="btn btn-success glyphicon glyphicon-print" onclick="print_receipt()"> {{ __('patient_finance.print') }}</button></div>
@endif
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>Tel:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>@if($is_invoice == 1) {{ __('patient_finance.invoice_number') }} @else {{ __('patient_finance.receipt_number') }} @endif :</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_names') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.quantity') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@for($i = 0; $i < count($optical_item); $i++)
<tr>
<td>{{ get_name($optical_item[$i], "id", "name", "eye_glasses") }}</td>
<td>{{ $optical_quantity[$i] }}</td>
<td>{{ ugandan_shillings($optical_subtotal[$i]) }}</td>
</tr>
@endfor
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2"><b>{{ __('patient_finance.total_amount') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($staff_guarantor_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.staff_guarantor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($staff_guarantor_to_pay) }}</b></td>
</tr>
@endif
@if($patient_category_to_pay > 0)
<tr>
<td colspan="2"><b>{{ get_name($patient_category_id_to_pay, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_category_to_pay) }}</b></td>
</tr>
@endif
@if($donor_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.donor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($donor_to_pay) }}</b></td>
</tr>
@endif
@if($hospital_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.hospital_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($hospital_to_pay) }}</b></td>
</tr>
@endif
@if($patient_unpaid_debts > 0)
<tr>
<td colspan="2"><b>Patient Debts Paid</b></td>
<td><b>{{ ugandan_shillings($patient_unpaid_debts) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0)
<tr>
<td colspan="2"><b>One Off Discount</b></td>
<td><b>{{ ugandan_shillings($one_off_discount) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0 && $one_off_discount_memo != "")
<tr>
<td colspan="2"><b>One Off Discount Memo</b></td>
<td><b>{{ $one_off_discount_memo }}</b></td>
</tr>
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
@if(count($return_payment_methods) > 0)
<tr><td colspan="3"></td></tr>
@foreach($return_payment_methods as $key => $value)
<tr>
<td colspan="2"><b>Patient Paid With {{ ($key == 0) ? 'Cash' : get_name($key, 'id', 'name', 'patient_payment_methods') }}</b></td>
<td><b>{{ ugandan_shillings($value) }}</b></td>
</tr>
@endforeach
@endif
@if($patient_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_patient_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($patient_account_pay_with) }}</b></td>
</tr>
@endif
@if($family_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_family_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($family_account_pay_with) }}</b></td>
</tr>
@endif
@if($balance > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.balance_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($balance) }}</b></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,161 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.optical_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.optical_receipt') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@if (!empty(session()->get('episode_id')))
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
@else
<div class="row" style="float:right;"><button class="btn btn-success glyphicon glyphicon-print" onclick="print_receipt()"> {{ __('patient_finance.print') }}</button></div>
@endif
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>Tel:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</span><br>
<span class="receipt-label"><b>Original Print Date:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>Reprint Date:</b> {{ streamline_date_time_short(date('Y-m-d H:i:s')) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.receipt_number') }}: </b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_names') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.quantity') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@for($i = 0; $i < count($optical_ids_array); $i++)
<tr>
<td>{{ get_name($optical_ids_array[$i], "id", "name", "eye_glasses") }}</td>
<td>{{ $optical_quantity_array[$i] }}</td>
<td>{{ ugandan_shillings($optical_prices_array[$i]) }}</td>
</tr>
@endfor
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2"><b>{{ __('patient_finance.total_amount') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($discounts_applied > 0)
<tr>
<td colspan="2">
<b>
@if($type == 1)
{{ __('patient_finance.discounts_applied') }}
@else
{{ get_name($patient->category_id, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}
@endif
</b>
</td>
<td><b>{{ ugandan_shillings($discounts_applied) }}</b></td>
</tr>
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,214 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Patient Receipt - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
font-size: 0.8em;
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<table class="table table-bordered">
<tr>
<td><b>{{ __('patient_finance.patient_names') }}</b></td>
<td>{{ $patient->first_name }} {{ $patient->last_name }}</td>
<td><b>{{ __('patient_finance.patient_number') }}</b></td>
<td>{{ $patient->number }}</td>
<td><b>{{ __('patient_finance.patient_category') }}</b></td>
<td>{{ get_name($patient->category_id, "id", "name", "patient_categories") }}</td>
</tr>
<tr>
<td><b>{{ __('patient_finance.date') }}</b></td>
<td colspan="2">{{ streamline_date_time_short($receipt_date) }}</td>
<td><b>@if($is_invoice == 1) {{ __('patient_finance.invoice_number') }} @else {{ __('patient_finance.receipt_number') }} @endif</b></td>
<td colspan="2">{{ $receipt_number }}</td>
</tr>
</table>
<table class="table table-bordered" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.quantity') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($items); $i++)
<tr>
<td>
@if($item_table == "inpatient")
{{ $items[$i] }}
@else
{{ get_name($items[$i], "id", "name", $item_table) }}
@endif
</td>
<td>{{ $item_quantity[$i] }}</td>
<td>{{ ugandan_shillings($item_subtotal[$i]) }}</td>
</tr>
@endfor
@endif
<tr>
<td colspan="3" class="text-center">
@if(!are_patient_receipts_full_detail())
<b>{{ ucfirst($item_table) }}</b>
@endif
</td>
</tr>
<tr>
<td colspan="2"><b>{{ __('patient_finance.total_amount') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($staff_guarantor_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.staff_guarantor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($staff_guarantor_to_pay) }}</b></td>
</tr>
@endif
@if($patient_category_to_pay > 0)
<tr>
<td colspan="2"><b>{{ get_name($patient_category_id_to_pay, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_category_to_pay) }}</b></td>
</tr>
@endif
@if($donor_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.donor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($donor_to_pay) }}</b></td>
</tr>
@endif
@if($hospital_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.hospital_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($hospital_to_pay) }}</b></td>
</tr>
@endif
@if($patient_unpaid_debts > 0)
<tr>
<td colspan="2"><b>Patient Debts Paid</b></td>
<td><b>{{ ugandan_shillings($patient_unpaid_debts) }}</b></td>
</tr>
@endif
@if($ward_discount_amount > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.ward_discount_amount') }}</b></td>
<td><b>{{ ugandan_shillings($ward_discount_amount) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_amount') }}</b></td>
<td><b>{{ ugandan_shillings($one_off_discount) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0 && $one_off_discount_memo != "")
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_memo') }}</b></td>
<td><b>{{ $one_off_discount_memo }}</b></td>
</tr>
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
@if($balance > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.balance_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($balance) }}</b></td>
</tr>
@endif
@if($discounts_applied > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.discounts_applied') }}</b></td>
<td><b>{{ ugandan_shillings($discounts_applied) }}</b></td>
</tr>
@endif
@if($treatment_balance > 0)
<tr>
<td colspan="2"><b>Progressive Treatment Balance</b></td>
<td><b>{{ ugandan_shillings($treatment_balance) }}</b></td>
</tr>
@endif
@if(count($return_payment_methods) > 0)
<tr><td colspan="3"></td></tr>
@foreach($return_payment_methods as $key => $value)
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_paid_with') }} {{ ($key == 0) ? 'Cash' : get_name($key, 'id', 'name', 'patient_payment_methods') }}</b></td>
<td><b>{{ ugandan_shillings($value) }}</b></td>
</tr>
@endforeach
@endif
@if($patient_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_patient_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($patient_account_pay_with) }}</b></td>
</tr>
@endif
@if($family_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_family_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($family_account_pay_with) }}</b></td>
</tr>
@endif
</tbody>
</table>
<div class="row">
<div class="col">
<i style="font-size: 0.8em; float: left">&copy; {{ date('Y') }} Stre@mline</i>
</div>
<div class="col">
<i style="float: right">{{ __('patient_finance.printed_on') }} {{ date(" d M Y h:ia") }} {{ __('patient_finance.by') }} {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</i>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,232 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.procedure_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.procedure_payment') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" target="_blank" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>@if($is_invoice == 1) {{ __('patient_finance.invoice_number') }} @else {{ $patient->last_name }} @endif :</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_names') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($procedure_ids_array); $i++)
<tr>
<td>{{ get_name($procedure_ids_array[$i], "id", "name", "procedures") }}</td>
<td>{{ ugandan_shillings($procedure_amounts_array[$i]) }}</td>
</tr>
@endfor
@endif
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td><b>{{ __('patient_finance.total_amount') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($staff_guarantor_to_pay > 0)
<tr>
<td><b>{{ __('patient_finance.staff_guarantor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($staff_guarantor_to_pay) }}</b></td>
</tr>
@endif
@if($patient_category_to_pay > 0)
<tr>
<td><b>{{ get_name($patient_category_id_to_pay, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_category_to_pay) }}</b></td>
</tr>
@endif
@if($donor_to_pay > 0)
<tr>
<td><b>{{ __('patient_finance.donor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($donor_to_pay) }}</b></td>
</tr>
@endif
@if($hospital_to_pay > 0)
<tr>
<td><b>{{ __('patient_finance.hospital_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($hospital_to_pay) }}</b></td>
</tr>
@endif
@if($patient_unpaid_debts > 0)
<tr>
<td><b>{{ __('patient_finance.patient_debts_paid') }}</b></td>
<td><b>{{ ugandan_shillings($patient_unpaid_debts) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0)
<tr>
<td><b>{{ __('patient_finance.one_off_discount_amount') }}</b></td>
<td><b>{{ ugandan_shillings($one_off_discount) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0 && $one_off_discount_memo != "")
<tr>
<td><b>{{ __('patient_finance.one_off_discount_memo') }}</b></td>
<td><b>{{ $one_off_discount_memo }}</b></td>
</tr>
@endif
<tr>
<td><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
@if(count($return_payment_methods) > 0)
<tr><td colspan="2"></td></tr>
@foreach($return_payment_methods as $key => $value)
<tr>
<td><b>{{ __('patient_finance.patient_paid_with') }} {{ ($key == 0) ? 'Cash' : get_name($key, 'id', 'name', 'patient_payment_methods') }}</b></td>
<td><b>{{ ugandan_shillings($value) }}</b></td>
</tr>
@endforeach
@endif
@if($patient_account_pay_with > 0)
<tr>
<td><b>{{ __('patient_finance.paid_with_patient_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($patient_account_pay_with) }}</b></td>
</tr>
@endif
@if($family_account_pay_with > 0)
<tr>
<td><b>{{ __('patient_finance.paid_with_family_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($family_account_pay_with) }}</b></td>
</tr>
@endif
@if($balance > 0)
<tr>
<td><b>{{ __('patient_finance.balance_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($balance) }}</b></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,156 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.procedure_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.procedure_payment') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.original_print_date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.reprint_date') }}:</b> {{ streamline_date_time_short(date('Y-m-d H:i:s')) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.receipt_number') }}: </b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_names') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($procedure_ids_array); $i++)
<tr>
<td>{{ get_name($procedure_ids_array[$i], "id", "name", "procedures") }}</td>
<td>{{ ugandan_shillings($procedure_prices_array[$i]) }}</td>
</tr>
@endfor
@endif
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td><b>{{ __('patient_finance.total_amount') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($discounts_applied > 0)
<tr>
<td>
<b>
@if($type == 1)
{{ __('patient_finance.discounts_applied') }}
@else
{{ get_name($patient->category_id, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}
@endif
</b>
</td>
<td><b>{{ ugandan_shillings($discounts_applied) }}</b></td>
</tr>
@endif
<tr>
<td><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,232 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.services_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.services_payment') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" target="_blank" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_names') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>@if($is_invoice == 1) {{ __('patient_finance.invoice_number') }} @else {{ __('patient_finance.receipt_number') }} @endif :</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($service_prices_array); $i++)
<tr>
<td>{{ get_name($service_ids_array[$i], "id", "name", "services") }}</td>
<td>{{ ugandan_shillings($service_prices_array[$i]) }}</td>
</tr>
@endfor
@endif
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td><b>{{ __('patient_finance.total_amount') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($staff_guarantor_to_pay > 0)
<tr>
<td><b>{{ __('patient_finance.staff_guarantor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($staff_guarantor_to_pay) }}</b></td>
</tr>
@endif
@if($patient_category_to_pay > 0)
<tr>
<td><b>{{ get_name($patient_category_id_to_pay, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_category_to_pay) }}</b></td>
</tr>
@endif
@if($donor_to_pay > 0)
<tr>
<td><b>{{ __('patient_finance.donor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($donor_to_pay) }}</b></td>
</tr>
@endif
@if($hospital_to_pay > 0)
<tr>
<td><b>{{ __('patient_finance.hospital_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($hospital_to_pay) }}</b></td>
</tr>
@endif
@if($patient_unpaid_debts > 0)
<tr>
<td><b>{{ __('patient_finance.patient_debts_paid') }}</b></td>
<td><b>{{ ugandan_shillings($patient_unpaid_debts) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0)
<tr>
<td><b>{{ __('patient_finance.one_off_discount_amount') }}</b></td>
<td><b>{{ ugandan_shillings($one_off_discount) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0 && $one_off_discount_memo != "")
<tr>
<td><b>{{ __('patient_finance.one_off_discount_memo') }}</b></td>
<td><b>{{ $one_off_discount_memo }}</b></td>
</tr>
@endif
<tr>
<td><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
@if(count($return_payment_methods) > 0)
<tr><td colspan="2"></td></tr>
@foreach($return_payment_methods as $key => $value)
<tr>
<td><b>{{ __('patient_finance.patient_paid_with') }} {{ ($key == 0) ? 'Cash' : get_name($key, 'id', 'name', 'patient_payment_methods') }}</b></td>
<td><b>{{ ugandan_shillings($value) }}</b></td>
</tr>
@endforeach
@endif
@if($patient_account_pay_with > 0)
<tr>
<td><b>{{ __('patient_finance.paid_with_patient_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($patient_account_pay_with) }}</b></td>
</tr>
@endif
@if($family_account_pay_with > 0)
<tr>
<td><b>{{ __('patient_finance.paid_with_family_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($family_account_pay_with) }}</b></td>
</tr>
@endif
@if($balance > 0)
<tr>
<td><b>{{ __('patient_finance.balance_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($balance) }}</b></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,156 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.services_receipt') }}kkk</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.services_payment') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_names') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.original_print_date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.reprint_date') }}:</b> {{ streamline_date_time_short(date('Y-m-d H:i:s')) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.receipt_number') }}: </b> {{ $receipt_number }}</span><br>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($service_ids_array); $i++)
<tr>
<td>{{ get_name($service_ids_array[$i], "id", "name", "services") }}</td>
<td>{{ ugandan_shillings($service_prices_array[$i]) }}</td>
</tr>
@endfor
@endif
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td><b>{{ __('patient_finance.total_amount') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($discounts_applied > 0)
<tr>
<td>
<b>
@if($type == 1)
{{ __('patient_finance.discounts_applied') }}
@else
{{ get_name($patient->category_id, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}
@endif
</b>
</td>
<td><b>{{ ugandan_shillings($discounts_applied) }}</b></td>
</tr>
@endif
<tr>
<td><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,234 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.sundries_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.sundries_payment') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" target="_blank" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>@if($is_invoice == 1) {{ __('patient_finance.invoice_number') }} @else {{ __('patient_finance.receipt_number') }} @endif :</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_names') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.quantity') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($sundry_item); $i++)
<tr>
<td>{{ get_name($sundry_item[$i], "id", "name", "sundries") }}</td>
<td>{{ $sundry_quantity[$i] }}</td>
<td>{{ ugandan_shillings($sundry_subtotal[$i]) }}</td>
</tr>
@endfor
@endif
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2"><b>{{ __('patient_finance.total_amount') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($staff_guarantor_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.staff_guarantor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($staff_guarantor_to_pay) }}</b></td>
</tr>
@endif
@if($patient_category_to_pay > 0)
<tr>
<td colspan="2"><b>{{ get_name($patient_category_id_to_pay, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_category_to_pay) }}</b></td>
</tr>
@endif
@if($donor_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.donor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($donor_to_pay) }}</b></td>
</tr>
@endif
@if($hospital_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.hospital_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($hospital_to_pay) }}</b></td>
</tr>
@endif
@if($patient_unpaid_debts > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_debts_paid') }}</b></td>
<td><b>{{ ugandan_shillings($patient_unpaid_debts) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_amount') }}</b></td>
<td><b>{{ ugandan_shillings($one_off_discount) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0 && $one_off_discount_memo != "")
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_memo') }}</b></td>
<td><b>{{ $one_off_discount_memo }}</b></td>
</tr>
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
@if(count($return_payment_methods) > 0)
<tr><td colspan="3"></td></tr>
@foreach($return_payment_methods as $key => $value)
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_paid_with') }} {{ ($key == 0) ? 'Cash' : get_name($key, 'id', 'name', 'patient_payment_methods') }}</b></td>
<td><b>{{ ugandan_shillings($value) }}</b></td>
</tr>
@endforeach
@endif
@if($patient_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_patient_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($patient_account_pay_with) }}</b></td>
</tr>
@endif
@if($family_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_family_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($family_account_pay_with) }}</b></td>
</tr>
@endif
@if($balance > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.balance_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($balance) }}</b></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,226 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.sundries_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.sundries_payment') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" target="_blank" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
<div class="row" style="float:right;"><button class="btn btn-success glyphicon glyphicon-print" onclick="print_receipt()"> {{ __('patient_finance.print') }}</button></div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>@if($is_invoice == 1) {{ __('patient_finance.invoice_number') }} @else {{ __('patient_finance.receipt_number') }} @endif :</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_names') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.quantity') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($sundry_item); $i++)
<tr>
<td>{{ get_name($sundry_item[$i], "id", "name", "sundries") }}</td>
<td>{{ $sundry_quantity[$i] }}</td>
<td>{{ ugandan_shillings($sundry_subtotal[$i]) }}</td>
</tr>
@endfor
@endif
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2"><b>{{ __('patient_finance.total_amount') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($staff_guarantor_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.staff_guarantor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($staff_guarantor_to_pay) }}</b></td>
</tr>
@endif
@if($patient_category_to_pay > 0)
<tr>
<td colspan="2"><b>{{ get_name($patient_category_id_to_pay, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_category_to_pay) }}</b></td>
</tr>
@endif
@if($donor_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.donor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($donor_to_pay) }}</b></td>
</tr>
@endif
@if($hospital_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.hospital_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($hospital_to_pay) }}</b></td>
</tr>
@endif
@if($patient_unpaid_debts > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_debts_paid') }}</b></td>
<td><b>{{ ugandan_shillings($patient_unpaid_debts) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_amount') }}</b></td>
<td><b>{{ ugandan_shillings($one_off_discount) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0 && $one_off_discount_memo != "")
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_memo') }}</b></td>
<td><b>{{ $one_off_discount_memo }}</b></td>
</tr>
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
@if(count($return_payment_methods) > 0)
<tr><td colspan="3"></td></tr>
@foreach($return_payment_methods as $key => $value)
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_paid_with') }} {{ ($key == 0) ? 'Cash' : get_name($key, 'id', 'name', 'patient_payment_methods') }}</b></td>
<td><b>{{ ugandan_shillings($value) }}</b></td>
</tr>
@endforeach
@endif
@if($patient_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_patient_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($patient_account_pay_with) }}</b></td>
</tr>
@endif
@if($family_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_family_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($family_account_pay_with) }}</b></td>
</tr>
@endif
@if($balance > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.balance_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($balance) }}</b></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,158 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.sundries_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.sundries_payment') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.original_print_date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.reprint_date') }}:</b> {{ streamline_date_time_short(date('Y-m-d H:i:s')) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.receipt_number') }}: </b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_names') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.quantity') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($sundry_ids_array); $i++)
<tr>
<td>{{ get_name($sundry_ids_array[$i], "id", "name", "sundries") }}</td>
<td>{{ $sundry_quantity_array[$i] }}</td>
<td>{{ ugandan_shillings($sundry_prices_array[$i]) }}</td>
</tr>
@endfor
@endif
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2"><b>{{ __('patient_finance.total_amount') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($discounts_applied > 0)
<tr>
<td colspan="2">
<b>
@if($type == 1)
{{ __('patient_finance.discounts_applied') }}
@else
{{ get_name($patient->category_id, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}
@endif
</b>
</td>
<td><b>{{ ugandan_shillings($discounts_applied) }}</b></td>
</tr>
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,241 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.treatment_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.treatment_payment') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
@php
// check if receipt has a debt plan
$previous_debt_plan_id = get_name($receipt_number, 'receipt_number', 'id', 'debt_plan');
@endphp
@if($previous_debt_plan_id != 'N/A')
<br><br>
<a class="btn btn-primary btn-sm" target="_blank" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $previous_debt_plan_id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a>
@endif
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>Tel:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>@if($is_invoice == 1) {{ __('patient_finance.invoice_number') }} @else {{ __('patient_finance.receipt_number') }} @endif :</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_names') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.quantity') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($treatment_item); $i++)
<tr>
<td>{{ get_name($treatment_item[$i], "id", "name", "drugs") }}</td>
<td>{{ $treatment_quantity[$i] }}</td>
<td>{{ ugandan_shillings($treatment_subtotal[$i]) }}</td>
</tr>
@endfor
@endif
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2"><b>{{ __('patient_finance.total_amount') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($staff_guarantor_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.staff_guarantor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($staff_guarantor_to_pay) }}</b></td>
</tr>
@endif
@if($patient_category_to_pay > 0)
<tr>
<td colspan="2"><b>{{ get_name($patient_category_id_to_pay, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_category_to_pay) }}</b></td>
</tr>
@endif
@if($donor_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.donor_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($donor_to_pay) }}</b></td>
</tr>
@endif
@if($hospital_to_pay > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.hospital_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($hospital_to_pay) }}</b></td>
</tr>
@endif
@if($patient_unpaid_debts > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_debts_paid') }}</b></td>
<td><b>{{ ugandan_shillings($patient_unpaid_debts) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_amount') }}</b></td>
<td><b>{{ ugandan_shillings($one_off_discount) }}</b></td>
</tr>
@endif
@if($one_off_discount > 0 && $one_off_discount_memo != "")
<tr>
<td colspan="2"><b>{{ __('patient_finance.one_off_discount_memo') }}</b></td>
<td><b>{{ $one_off_discount_memo }}</b></td>
</tr>
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
@if(count($return_payment_methods) > 0)
<tr><td colspan="3"></td></tr>
@foreach($return_payment_methods as $key => $value)
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_paid_with') }} {{ ($key == 0) ? 'Cash' : get_name($key, 'id', 'name', 'patient_payment_methods') }}</b></td>
<td><b>{{ ugandan_shillings($value) }}</b></td>
</tr>
@endforeach
@endif
@if($patient_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_patient_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($patient_account_pay_with) }}</b></td>
</tr>
@endif
@if($family_account_pay_with > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.paid_with_family_account_wallet') }}</b></td>
<td><b>{{ ugandan_shillings($family_account_pay_with) }}</b></td>
</tr>
@endif
@if($balance > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.balance_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($balance) }}</b></td>
</tr>
@endif
@if($treatment_balance > 0)
<tr>
<td colspan="2"><b>{{ __('patient_finance.progressive_treatment_balance') }}</b></td>
<td><b>{{ ugandan_shillings($treatment_balance) }}</b></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,158 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('patient_finance.treatment_receipt') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_finance.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('patient_finance.finance_home') }}</a></li>
<li class="active">{{ __('patient_finance.treatment_payment') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
<div class="row">
<div class="col-9"></div>
<div class="col-1" style="float:right;"><button class="btn btn-success" onclick="print_receipt()"><span class="glyphicon glyphicon-print"></span> {{ __('patient_finance.print') }}</button></div>
<div class="col-2">
@if(Auth::user()->can('view-episode-summary'))
<a type="button" class="btn btn-primary" href="/patients/episode_summary/{{ session()->get('episode_id') }}" target="_blank" id="patient_file">{{ __('patient_episode.episode_summary') }}</a>
@endif
</div>
</div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.original_print_date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.reprint_date') }}:</b> {{ streamline_date_time_short(date('Y-m-d H:i:s')) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.receipt_number') }}: </b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_names') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_finance.description') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.quantity') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_finance.price') }}</b></th>
</thead>
<tbody>
@if(are_patient_receipts_full_detail())
@for($i = 0; $i < count($treatment_ids_array); $i++)
<tr>
<td>{{ get_name($treatment_ids_array[$i], "id", "name", "drugs") }}</td>
<td>{{ $treatment_quantity_array[$i] }}</td>
<td>{{ ugandan_shillings($treatment_prices_array[$i]) }}</td>
</tr>
@endfor
@endif
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2"><b>{{ __('patient_finance.total_amount') }}</b></td>
<td><b>{{ ugandan_shillings($total_amount_pay) }}</b></td>
</tr>
@if($discounts_applied > 0)
<tr>
<td colspan="2">
<b>
@if($type == 1)
{{ __('patient_finance.discounts_applied') }}
@else
{{ get_name($patient->category_id, "id", "name", "patient_categories") }} {{ __('patient_finance.to_pay') }}
@endif
</b>
</td>
<td><b>{{ ugandan_shillings($discounts_applied) }}</b></td>
</tr>
@endif
<tr>
<td colspan="2"><b>{{ __('patient_finance.patient_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($patient_to_pay) }}</b></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -0,0 +1,257 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
label{
background-color: #3a87ad;
color: #fff;
border-radius: 3px;
display: inline-block;
padding: 2px 4px;
font-size: 11.844px;
font-weight: bold;
line-height: 14px;
vertical-align: baseline;
white-space: nowrap;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
</style>
@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">{{ __('patient_finance.finance_home') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> {{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> {{ __('patient_finance.finance_home') }}</a></li>
<li><a href="{{ route('patients.index') }}"><i class="fa fa-user"></i> {{ __('patients.patients') }}</a></li>
</ol>
</div>
</div>
<div class="white-box">
@include('flash::message')
{{ Form::open(['route' => 'patient_finance.search_results', 'method' => 'ANY', 'role' => 'search']) }}
<div class="row">
<div class="col-md-3">
<div class="form-group" id="patient_numbers">
{{ Form::label('number', __('patients.patient_number')) }}
{{ Form::text('number', '', ['class' => 'form-control typeahead', 'placeholder' => __('patients.patient_number'), 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="first_names">
{{ Form::label('first_name', __('patients.first_name')) }}
{{ Form::text('first_name', '', ['class' => 'form-control typeahead', 'placeholder' => __('patients.first_name'), 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="last_names">
{{ Form::label('last_name', __('patients.last_name')) }}
{{ Form::text('last_name', '', ['class' => 'form-control typeahead', 'placeholder' => __('patients.last_name'), 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="national_ids">
{{ Form::label('national_id', __('patients.national_id')) }}
{{ Form::text('national_id', '', ['class' => 'form-control typeahead', 'placeholder' => __('patients.national_id'), 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="insurance_groups">
{{ Form::label('insurance_group', __('patients.insurance_group')) }}
{{ Form::text('insurance_group', '', ['class' => 'form-control typeahead', 'placeholder' => __('patients.insurance_group'), 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="patient_categorys">
{{ Form::label('patient_category', __('patients.patient_category')) }}
{{ Form::text('patient_category', '', ['class' => 'form-control typeahead', 'placeholder' => __('patients.patient_category'), 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="subcountys">
{{ Form::label('subcounty', __('patients.sub_county')) }}
{{ Form::text('subcounty', '', ['class' => 'form-control typeahead', 'placeholder' => __('patients.sub_county'), 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="parishs">
{{ Form::label('parish', __('patients.parish')) }}
{{ Form::text('parish', '', ['class' => 'form-control typeahead', 'placeholder' => __('patients.parish'), 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="villages">
{{ Form::label('village', __('patients.village')) }}
{{ Form::text('village', '', ['class' => 'form-control typeahead', 'placeholder' => __('patients.village'), 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-1" style="padding-top: 23px;">
<button type="submit" class="btn btn-success">{{ __('patients.search') }}</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<img src="/uploads/streamline_images/two_surgeons.jpg" class="img-rounded" style=" height: 150px; margin: auto;" alt="surgery" />
</div>
</div>
{{ Form::close() }}
</div>
@endsection
@push('scripts')
<!-- Typehead Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/typeahead.js-master/dist/typeahead.bundle.min.js') }}"></script>
<script type="text/javascript">
let substringMatcher = function(strs) {
return function findMatches(q, cb) {
let matches, substrRegex;
// an array that will be populated with substring matches
matches = [];
// regex used to determine if a string contains the substring `q`
substrRegex = new RegExp(q, 'i');
// iterate through the pool of strings and for any string that
// contains the substring `q`, add it to the `matches` array
$.each(strs, function(i, str) {
if (substrRegex.test(str)) {
matches.push(str);
}
});
cb(matches);
};
};
$('#patient_numbers .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'patient_numbers',
source: substringMatcher(<?php echo json_encode($patient_numbers); ?>)
}
);
$('#first_names .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'first_names',
source: substringMatcher(<?php echo json_encode($first_names); ?>)
}
);
$('#last_names .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'last_names',
source: substringMatcher(<?php echo json_encode($last_names); ?>)
}
);
$('#national_ids .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'national_ids',
source: substringMatcher(<?php echo json_encode($national_ids); ?>)
}
);
$('#insurance_groups .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'insurance_groups',
source: substringMatcher(<?php echo json_encode($insurance_groups); ?>)
}
);
$('#patient_categorys .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'patient_categorys',
source: substringMatcher(<?php echo json_encode($patient_categories); ?>)
}
);
$('#subcountys .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'subcountys',
source: substringMatcher(<?php echo json_encode($subcounties); ?>)
}
);
$('#parishs .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'parishs',
source: substringMatcher(<?php echo json_encode($parishes); ?>)
}
);
$('#villages .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'villages',
source: substringMatcher(<?php echo json_encode($villages); ?>)
}
);
</script>
@endpush
@@ -0,0 +1,77 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
@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">{{ __('patient_finance.finance_home') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> {{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> {{ __('patient_finance.finance_home') }}</a></li>
<li><a href="{{ route('patients.index') }}"><i class="fa fa-user"></i> {{ __('patients.patients') }}</a></li>
<li class="active"><i class="fa fa-search"></i> {{ __('patient_finance.search_results') }}</li>
</ol>
</div>
</div>
<div class="white-box">
<h3 class="page-title">{{ __('patient_finance.search_results') }}</h3>
<div class="row">
<div class="col-md-12">
@if(isset($criteria) && isset($patients))
<p>{{ __('patients.search_criteria') }} : <code>{{ $criteria }}</code> &nbsp;&nbsp;&nbsp;{{ __('patients.total_results') }} : <code>{{ count($patients) }}</code> &nbsp;&nbsp;&nbsp;<a href="{{ route('patient_finance.search_patients') }}">{{ __('patients.clear_search') }}</a></p>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('patients.patient_number') }}</th>
<th>{{ __('patients.full_names') }}</th>
<th>{{ __('patients.age') }}</th>
<th>{{ __('patients.next_of_kin') }}</th>
<th>{{ __('patients.marital_status') }}</th>
<th>{{ __('patients.phone') }}</th>
<th>{{ __('patients.occupation') }}</th>
<th>{{ __('patients.category') }}</th>
<th></th>
</tr>
</thead>
<tbody>
@if(count($patients) > 0)
@foreach($patients as $patient)
<tr>
<td>{{ $patient->number }}</td>
<td>{!! insurance_flag($patient->id) !!}</td>
<td>{{ get_patients_age($patient->date_of_birth) }}</td>
<td>{{ $patient->next_of_kin }}</td>
<td>{{ array_key_exists($patient->marital_status, $marital_statuses) ? $marital_statuses[$patient->marital_status] : "N/A" }}</td>
<td>{{ $patient->phone }}</td>
<td>{{ array_key_exists($patient->occupation_id, $occupations) ? $occupations[$patient->occupation_id] : "N/A" }}</td>
<td>{{ array_key_exists($patient->category_id, $categories) ? $categories[$patient->category_id] : "N/A" }}</td>
<td>
{{ Form::model($patient->id ,['method' => 'POST', 'route' => ['patient_finance.set_patient_session', $patient->id]]) }}
<button type="submit" class="btn btn-success btn-sm">{{ __('patients.select') }}</button>
{{ Form::close() }}
</td>
</tr>
@endforeach
@else
<tr class="warning"><td class="center" colspan="10">{{ __('patients.no_records_found') }}</td></tr>
@endif
</tbody>
</table>
</div>
{{ $patients->links() }}
@endif
</div>
</div>
</div>
@endsection