Files
streamline-emr/docker/statistics/Modules/WardManagement/Resources/views/inpatient/incoming_bills.blade.php
T
2025-03-31 03:46:05 +03:00

305 lines
16 KiB
PHP
Executable File

@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/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4 class="page-title">{{ __('inpatient.incoming_inpatient_bills') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('inpatient.dashboard') }}</a></li>
<li class="active">{{ __('inpatient.incoming_inpatient_bills') }}</li>
</ol>
</div>
</div>
@include('flash::message')
<div class="white-box">
{{ Form::open(['route' => 'inpatient_bills.incoming', 'method' => 'POST']) }}
<div class="row">
<div class="col-md-3">
<div class="form-group">
{{ Form::label('ward_id', __('inpatient.wards')) }}
{{ Form::select('ward_id', $wards, '', ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
{{ Form::label('inpatient_status', __('inpatient.inpatient_status')) }}
{{ Form::select('inpatient_status', $inpatient_status, 0, ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-2">
<div class="form-group" id="searchby">
{{ Form::label('search_by', __('inpatient.date')) }}
{{ Form::select('search_by', ['0'=>__('inpatient.today'), '1' => __('inpatient.yesterday'),'2'=>__('inpatient.custom_date'),'3'=>__('inpatient.custom_date_range')], '', ['class' => 'form-control','id'=>'search_by', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-3" style="display: none;" id="date_search">
<div class="form-group" id="reg_date" style="padding-top: 23px;">
<div class="input-group">
{{ Form::text('reg_date','',['class' => 'form-control compulsory', 'required','readonly','id'=>'datepicker-autoclose']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="col-md-3" style="display: none;" id="date_range_search">
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('start_date', __('inpatient.from')) }}
<div class="input-group">
{{ Form::text('start_date','',['class' => 'form-control compulsory','readonly','id'=>'datepicker-autoclose-1']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group" id="reg_date">
{{ Form::label('end_date', __('inpatient.to')) }}
<div class="input-group">
{{ Form::text('end_date','',['class' => 'form-control compulsory','readonly','id'=>'datepicker-autoclose-2']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group" style="padding-top: 5px;"><br>
{{ Form::button(__('inpatient.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id'=>'select_patient']) }}
</div>
</div>
</div>
{{ Form::close() }}
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
<h4><label class="label label-info">{{ $search_text }}</label></h4>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table table-bordered">
<thead>
<tr>
<th style="display: none"></th>
<th>{{ __('inpatient.admission_day_ward_discharge') }}</th>
<th>{{ __('inpatient.patient_names') }}</th>
<th>{{ __('inpatient.admitted_by') }}</th>
<th>{{ __('inpatient.category') }}</th>
<th>{{ __('inpatient.ward') }}</th>
<th>{{ __('inpatient.total_saved_bill') }}</th>
<th>{{ __('inpatient.amount_paid_and_invoiced') }}</th>
<th>{{ __('inpatient.balance') }}</th>
<th>{{ __('inpatient.bill_last_updated') }}</th>
<th>{{ __('inpatient.action') }}</th>
</tr>
</thead>
<tbody>
@php
$amount_to_pay_grand_total = 0;
$amount_paid_grand_total = 0;
$total_bill_sum = 0;
@endphp
@if(count($inpatients_info) > 0)
@foreach($inpatients_info as $inpatient_info)
<tr>
<th style="display: none">{{ $inpatient_info->id }}</th>
<td>
{{ streamline_date_time($inpatient_info->admitted_on) }}
@php
$admitted_on = new Carbon\Carbon($inpatient_info->admitted_on);
if ($inpatient_info->discharged == 1) {
$days_on_ward = $admitted_on->diffInDays($inpatient_info->discharged_on);
} else {
$days_on_ward = $admitted_on->diffInDays(Carbon\Carbon::now());
}
@endphp
<br><br>
<span style='font-size: smaller; color: #0a776c; font-weight: bold;'>{{ $days_on_ward }} {{ __('inpatient.days_on_ward') }}</span>
@if($inpatient_info->discharged == 1)
<br><br><span style="color:green; font-weight:bold">{{ __('inpatient.discharged_on') }} {{ streamline_date($inpatient_info->discharged_on) }} {{ __('inpatient.by') }} {{ get_full_name($inpatient_info->discharged_by, 'id', 'first_name', 'last_name', 'users') }}</span>
@endif
</td>
<td>{!! insurance_flag($inpatient_info->patient_id) !!} ({{ $inpatient_info->patients_number }})</td>
<td>
{{ get_full_name($inpatient_info->created_by, "id", "first_name", "last_name", "users") }}
</td>
<td>{{ $patient_categories[$inpatient_info->patients_category_id] ?? "" }}</td>
<td>{{ $wards[$inpatient_info->ward_id] ?? "" }}</td>
@php
$amount_to_pay = $inpatient_info->bills_amount_to_pay ?? 0;
$bill_last_created_by = $inpatient_info->bills_created_by;
$bill_last_updated_by = $inpatient_info->bills_updated_by;
$bill_last_updated_by = $bill_last_updated_by ? get_full_name($bill_last_updated_by, 'id', 'first_name', 'last_name', 'users') : get_full_name($bill_last_created_by, 'id', 'first_name', 'last_name', 'users');
$amount_to_pay_grand_total += is_numeric($amount_to_pay) ? $amount_to_pay : 0;
$amount_to_pay = is_null($inpatient_info->bills_amount_to_pay) ? "<label class='label label-info'>Bill not yet saved</label>" : ugandan_shillings($amount_to_pay);
$invoices_amount = is_numeric($inpatient_info->bills_invoices_amount) ? $inpatient_info->bills_invoices_amount : 0;
$amount_paid = is_numeric($inpatient_info->bills_amount_paid) ? $inpatient_info->bills_amount_paid : 0;
$amount_paid_plus_invoices_to_pay = $amount_paid + $invoices_amount;
$amount_paid_grand_total += $amount_paid_plus_invoices_to_pay;
$original_bill = is_numeric($inpatient_info->bills_original_bill) ? $inpatient_info->bills_original_bill : 0;
$total_bill_sum += $original_bill;
@endphp
<td>{{ ugandan_shillings($original_bill) }}</td>
<td>{!! ugandan_shillings($amount_paid_plus_invoices_to_pay) !!}</td>
<td>
{!! $amount_to_pay !!}
</td>
<td>
{{ streamline_date_time($inpatient_info->updated_at) }} by {{ $bill_last_updated_by }}
@php
$inpatient_bill_record = \Streamline\Models\InpatientBill::where(['patient_id' => $inpatient_info->patient_id, 'episode_id' => $inpatient_info->episode_id])->first();
@endphp
@if ($inpatient_bill_record)
@php
$bill_authorized_by_array = is_null($inpatient_bill_record->bill_authorized_by) ? [] : explode(",", $inpatient_bill_record->bill_authorized_by);
$bill_authorized_at_array = is_null($inpatient_bill_record->bill_authorized_at) ? [] : explode(",",$inpatient_bill_record->bill_authorized_at);
@endphp
@if (count($bill_authorized_by_array) > 0)
<p>
<b style="color: blue">{{ __('inpatient.bill_authorized_by') }}:</b>
@for ($i = 0; $i < count($bill_authorized_by_array); $i++)
{{ get_full_name($bill_authorized_by_array[$i], "id", "first_name", "last_name", "users") }} {{ __('inpatient.on') }} {{ streamline_date_time($bill_authorized_at_array[$i]) }}
@endfor
</p>
@endif
@endif
</td>
<td>
<a class="btn btn-success btn-sm" href="patient_finance/set_patient_session{{ $inpatient_info->patient_id }}">Select Patient</a>
<br><br>
<a class="btn btn-primary btn-sm" href="patient_finance/view_inpatient_bill/{{ $inpatient_info->patient_id }}/{{ $inpatient_info->episode_id }}">View Inpatient Bill</a>
<br><br>
{{ Form::open(['url' => 'receive_inpatient_payment']) }}
{{ Form::hidden('patient_id', $inpatient_info->patient_id) }}
{{ Form::hidden('episode_id', $inpatient_info->episode_id) }}
{{ Form::submit('Receive Payment', ['class' => 'btn btn-info btn-sm btn-rounded'])}}
{{ Form::close() }}
</td>
</tr>
@endforeach
@else
<tr class="warning"><td class="center" colspan="10">{{ __('inpatient.no_records_found') }}</td></tr>
@endif
</tbody>
<tfoot>
<tr>
<th style="display: none"></th>
<th><strong>{{ __('inpatient.total') }}</strong></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>{{ ugandan_shillings($total_bill_sum) }}</th>
<th>{{ ugandan_shillings($amount_paid_grand_total) }}</th>
<th>{{ ugandan_shillings($amount_to_pay_grand_total) }}</th>
<th></th>
<th></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<style type="text/css">
#depositTable td{
border-left: 1px solid #dddddd;
}
</style>
@endpush
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
$('#datepicker-autoclose,#datepicker-autoclose-1,#datepicker-autoclose-2').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd'
});
$('#search_by').change(function () {
if ($(this).val() == 2) {
$('#date_search').show();
$('#date_range_search').hide();
} else if ($(this).val() == 3) {
$('#date_range_search').show();
$('#date_search').hide();
} else {
$('#date_search,#date_range_search').hide();
}
});
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy',
{ extend: 'csv',
message: 'INCOMING INPATIENT BILLS',
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
},
sheetName: 'INCOMING INPATIENT BILLS ON STREAMLINE'
},
{ extend: 'excel',
message: 'INCOMING INPATIENT BILLS',
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
},
sheetName: 'INPATIENT BILLS ON STREAMLINE'
},
{ extend: 'pdf',
message: 'INCOMING INPATIENT BILLS',
exportOptions: {
columns: [ 0, 1, 2 ]
},
sheetName: 'INPATIENT BILLS ON STREAMLINE'
},
'print'
]
});
</script>
@endpush