mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-12 03:01:32 +00:00
364 lines
18 KiB
PHP
Executable File
364 lines
18 KiB
PHP
Executable File
@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/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" />
|
|
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
|
|
@endpush
|
|
|
|
@section('content')
|
|
<div class="row bg-title">
|
|
<div class="col-lg-6 col-md-4 col-sm-4 col-xs-12">
|
|
<h4 class="page-title">{{ __('patient_accounts.patient_account_statement') }}</h4>
|
|
</div>
|
|
<div class="col-lg-6 col-sm-8 col-md-8 col-xs-12">
|
|
<ol class="breadcrumb">
|
|
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> {{ __('family_accounts.home') }}</a></li>
|
|
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> {{ __('family_accounts.finance_home') }}</a></li>
|
|
<li class="active"><i class="fa fa-eye"></i> {{ __('patient_accounts.patient_account_statement') }}</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
|
|
@include('patient_discounts::patient_accounts.menu')
|
|
|
|
<div class="white-box">
|
|
@include('flash::message')
|
|
|
|
{{ Form::open(['url' => '/patient_accounts/statement', 'method' => 'ANY']) }}
|
|
<div class="row">
|
|
<div class="col-md-3">
|
|
<div class="form-group" id="searchby">
|
|
{{ Form::label('search_by', __('family_accounts.date')) }}
|
|
{{ Form::select('search_by', ['0'=>__('family_accounts.last_24_hours'),'1'=>__('family_accounts.custom_date'),'2'=>__('family_accounts.custom_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', __('family_accounts.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', __('family_accounts.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-3">
|
|
<div class="form-group" style="padding-top: 5px;"><br>
|
|
{{ Form::button(__('family_accounts.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id'=>'select_patient']) }}
|
|
</div>
|
|
</div>
|
|
{{ Form::close() }}
|
|
|
|
<div class="col-md-1">
|
|
<div style="float: right;">
|
|
{{ Form::open(['url' => '/patient_accounts/print_statement', 'target' => '_blank'])}}
|
|
{{ Form::hidden('reg_date', $reg_date) }}
|
|
{{ Form::hidden('start_date', $start_date) }}
|
|
{{ Form::hidden('end_date', $end_date) }}
|
|
{{ Form::hidden('search_by', $search_by) }}
|
|
<button type="submit" class="btn btn-rounded" style="background-color: #03C03C; color: white;">
|
|
<i class="fa fa-print"></i>
|
|
<span>{{ __('patient_accounts.print_statement') }}</span>
|
|
</button>
|
|
{{ Form::close() }}
|
|
<br>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="white-box">
|
|
@include('patient_discounts::patient_accounts.patient_details')
|
|
|
|
@if(count($patient_deposits) > 0)
|
|
<h4><b>{{ __('patient_accounts.deposits') }}</b></h4>
|
|
|
|
<div class="table-responsive">
|
|
<table class="table color-bordered-table success-bordered-table">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>{{ __('patient_accounts.patient_names') }}</th>
|
|
<th>{{ __('patient_accounts.deposit_amount') }}</th>
|
|
<th>{{ __('patient_accounts.deposit_date') }}</th>
|
|
<th>{{ __('patient_accounts.received_by') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@php $counter = 1; $total_deposits = 0; @endphp
|
|
@foreach($patient_deposits as $deposit)
|
|
|
|
<tr>
|
|
<td>{{ $counter }}</td>
|
|
<td>{{ get_full_name($deposit->patient_id, 'id', 'first_name', 'last_name', 'patients') }} ({{ get_name($deposit->patient_id, 'id', 'number', 'patients') }})</td>
|
|
<td>
|
|
{{ ugandan_shillings($deposit->deposit_amount) }}
|
|
@php $total_deposits += $deposit->deposit_amount; @endphp
|
|
</td>
|
|
<td>{{ streamline_date($deposit->deposit_date) }}</td>
|
|
<td>{{ get_full_name($deposit->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
|
|
</tr>
|
|
@php $counter++; @endphp
|
|
@endforeach
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<td></td>
|
|
<td><strong>{{ __('family_accounts.total') }}</strong></td>
|
|
<td><strong>{{ ugandan_shillings($total_deposits) }}</strong></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
|
|
<hr>
|
|
@endif
|
|
|
|
@if(count($patient_refunds) > 0)
|
|
<h4><b>{{ __('patient_accounts.refunds') }}</b></h4>
|
|
|
|
<div class="table-responsive">
|
|
<table class="table color-bordered-table success-bordered-table">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>{{ __('patient_accounts.patient_names') }}</th>
|
|
<th>{{ __('patient_accounts.refund_amount') }}</th>
|
|
<th>{{ __('patient_accounts.refund_date') }}</th>
|
|
<th>{{ __('patient_accounts.received_by') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@php $counter = 1; $total_refunds = 0; @endphp
|
|
@foreach($patient_refunds as $refund)
|
|
<tr>
|
|
<td>{{ $counter }}</td>
|
|
<td>{{ get_full_name($refund->patient_id, 'id', 'first_name', 'last_name', 'patients') }} ({{ get_name($refund->patient_id, 'id', 'number', 'patients') }})</td>
|
|
<td>
|
|
{{ ugandan_shillings($refund->refund_amount) }}
|
|
@php $total_refunds += $refund->refund_amount; @endphp
|
|
</td>
|
|
<td>{{ streamline_date($refund->refund_date) }}</td>
|
|
<td>{{ get_full_name($refund->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
|
|
</tr>
|
|
@php $counter++; @endphp
|
|
@endforeach
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<td></td>
|
|
<td><strong>{{ __('family_accounts.total') }}</strong></td>
|
|
<td><strong>{{ ugandan_shillings($total_refunds) }}</strong></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
|
|
<hr>
|
|
@endif
|
|
|
|
@if(count($patient_consumptions) > 0)
|
|
<h4><b>{{ __('patient_accounts.consumption') }}</b></h4>
|
|
|
|
<div class="table-responsive">
|
|
<table class="table color-bordered-table success-bordered-table">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>{{ __('patient_accounts.patient_names') }}</th>
|
|
<th>{{ __('patient_accounts.amount_consumed') }}</th>
|
|
<th>{{ __('patient_accounts.date_consumed') }}</th>
|
|
<th>{{ __('patient_accounts.reason') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@php $counter = 1; $total_consumption = 0; @endphp
|
|
@foreach($patient_consumptions as $record)
|
|
<tr>
|
|
<td>{{ $counter }}</td>
|
|
<td>{{ get_full_name($record->patient_id, 'id', 'first_name', 'last_name', 'patients') }} ({{ get_name($record->patient_id, 'id', 'number', 'patients') }})</td>
|
|
<td>
|
|
{{ ugandan_shillings($record->amount_consumed) }}
|
|
@php $total_consumption += $record->amount_consumed; @endphp
|
|
</td>
|
|
<td>{{ streamline_date_time($record->created_at) }}</td>
|
|
@php
|
|
$tag_id = $record->tag_id;
|
|
$items_received_array = [];
|
|
|
|
if($tag_id == 6 || $tag_id == 8){
|
|
|
|
$service_deposit_record = \Streamline\Models\ServiceDeposit::where('receipt_number', $record->receipt_number)->first();
|
|
|
|
if ($service_deposit_record){
|
|
$items_received = explode(",", $service_deposit_record->items_ids);
|
|
|
|
for($i = 0; $i < count($items_received); $i++){
|
|
$items_received_array[] = get_name($items_received[$i], "id", "name", "services");
|
|
}
|
|
}
|
|
} elseif($tag_id == 3){
|
|
|
|
$treatment_deposit_record = \Streamline\Models\TreatmentDeposits::where('receipt_number', $record->receipt_number)->first();
|
|
|
|
if ($treatment_deposit_record){
|
|
$items_received = explode(",", $treatment_deposit_record->treatment_items);
|
|
|
|
for($i = 0; $i < count($items_received); $i++){
|
|
$items_received_array[] = get_name($items_received[$i], "id", "name", "drugs");
|
|
}
|
|
}
|
|
} elseif($tag_id == 5){
|
|
|
|
$sundries_deposit_record = \Streamline\Models\SundryDeposit::where('receipt_number', $record->receipt_number)->first();
|
|
|
|
if ($sundries_deposit_record){
|
|
$items_received = explode(",", $sundries_deposit_record->sundry_items);
|
|
|
|
for($i = 0; $i < count($items_received); $i++){
|
|
$items_received_array[] = get_name($items_received[$i], "id", "name", "sundries");
|
|
}
|
|
}
|
|
} elseif($tag_id == 2){
|
|
$investigation_deposit_record = \Streamline\Models\InvestigationDeposit::where('receipt_number', $record->receipt_number)->first();
|
|
|
|
if ($investigation_deposit_record){
|
|
$items_received = explode(",", $investigation_deposit_record->investigation_items);
|
|
|
|
for($i = 0; $i < count($items_received); $i++){
|
|
$items_received_array[] = get_name($items_received[$i], "id", "name", "investigations");
|
|
}
|
|
}
|
|
} elseif($tag_id == 4){
|
|
|
|
$procedure_deposit_record = \Streamline\Models\ProcedureDeposit::where('receipt_number', $record->receipt_number)->first();
|
|
|
|
if ($procedure_deposit_record){
|
|
$items_received = explode(",", $procedure_deposit_record->procedure_items);
|
|
|
|
for($i = 0; $i < count($items_received); $i++){
|
|
$items_received_array[] = get_name($items_received[$i], "id", "name", "procedures");
|
|
}
|
|
}
|
|
}
|
|
@endphp
|
|
<td>
|
|
<strong>{{ get_name($record->tag_id, 'id', 'name', 'finance_point_tags') }}</strong>
|
|
<ol>
|
|
@for($j = 0; $j < count($items_received_array); $j++)
|
|
<li>{{ $items_received_array[$j] }}</li>
|
|
@endfor
|
|
</ol>
|
|
</td>
|
|
</tr>
|
|
@php $counter++; @endphp
|
|
@endforeach
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<td></td>
|
|
<td><strong>{{ __('family_accounts.total') }}</strong></td>
|
|
<td><strong>{{ ugandan_shillings($total_consumption) }}</strong></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
|
|
<hr>
|
|
@endif
|
|
|
|
<div style="font-weight: bolder; font-size: 24px;">
|
|
<br><br>
|
|
<span><strong>{{ __('patient_accounts.current_balance') }}:</strong> {{ ugandan_shillings($patient->patient_account_balance) }}</span>
|
|
<hr>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-2"></div>
|
|
@if(Auth::user()->can('view-patient-accounts-deposits'))
|
|
<div class="col-md-4">
|
|
<a href="/patient_accounts/make_deposit/" class="btn btn-success btn-block"> {{ __('patient_accounts.make_deposit') }}</a>
|
|
</div>
|
|
@endif
|
|
@if(Auth::user()->can('view-patient-accounts-refunds'))
|
|
<div class="col-md-4">
|
|
<a href="/patient_accounts/refund_deposit/" class="btn btn-primary btn-block"> {{ __('patient_accounts.refund_deposit') }}</a>
|
|
</div>
|
|
@endif
|
|
<div class="col-md-2"></div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
|
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
|
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
|
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
|
|
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
|
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
|
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
|
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
|
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
|
|
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
|
<script>
|
|
|
|
$('#datepicker-autoclose,#datepicker-autoclose-1,#datepicker-autoclose-2').datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true,
|
|
format: 'dd-mm-yyyy'
|
|
});
|
|
|
|
$('#search_by').change(function () {
|
|
if ($(this).val() == 1) {
|
|
$('#date_search').show();
|
|
$('#date_range_search').hide();
|
|
}
|
|
else if ($(this).val() == 2) {
|
|
$('#date_range_search').show();
|
|
$('#date_search').hide();
|
|
}
|
|
else {
|
|
$('#date_search,#date_range_search').hide();
|
|
}
|
|
});
|
|
</script>
|
|
@endpush
|
|
|
|
|
|
|
|
|
|
|