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,331 @@
@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-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">Patient Accounts Consumptions{{ __('patient_accounts.') }}</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> {{ __('family_accounts.home') }}</a></li>
<li class="active"><i class="fa fa-eye"></i> Reports</li>
</ol>
</div>
</div>
@include('patient_discounts::patient_accounts.menu')
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
{{ Form::open(['url' => 'patient_accounts/consumptions_report', 'method' => 'ANY']) }}
<div class="row">
<div class="col-md-3">
<div class="form-group" id="patient_numbers">
{{ Form::label('patient_number',__('investigations.patient_number')) }}
{{ Form::text('patient_number', '', ['class' => 'form-control typeahead', 'placeholder' => 'Patient number', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="searchby">
{{ Form::label('search_by', __('family_accounts.date')) }}
{{ Form::select('search_by', ['0'=>'Last 24 hours','1'=>'Custom Date','2'=>'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>
</div>
{{ Form::close() }}
@if(!is_null($reg_date))
<h4>Showing consumption of <font color="blue">{{ streamline_date($reg_date) }}</font></h4>
@elseif(!is_null($start_date) && !is_null($end_date))
<h4>Showing consumption from<font color="blue">{{ streamline_date($start_date) }}</font> to <font color="blue">{{ streamline_date($end_date) }}</font></h4>
@endif
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>Patient Names</th>
<th>Amount Consumed</th>
<th>Date Consumed</th>
<th>Staff</th>
<th>Reason</th>
<th>{{ __('family_accounts.action') }}</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>
<td>{{ get_full_name($record->created_by, 'id', 'first_name', 'last_name', 'users') }}</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>
<td>
<a href="/patient_accounts/view_details/{{ $record->patient_id }}/" class="btn btn-outline-success btn-sm"><i class="fa fa-book"></i> Statement</a>
</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>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<!-- Date Picker Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/typeahead.js-master/dist/typeahead.bundle.min.js') }}"></script>
<script>
var substringMatcher = function (strs) {
return function findMatches(q, cb) {
var matches, substringRegex;
// 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); ?>)
}
);
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy',
{ extend: 'csv',
message: 'Patient Accounts'
},
{ extend: 'excel',
message: 'Patient Accounts',
exportOptions: {
columns: [ 0, 1, 2, 4 ]
},
sheetName: 'Patient Accounts'
},
{ extend: 'pdf',
message: 'Patient Accounts',
orientation: 'landscape',
pageSize: 'LETTER',
exportOptions: {
columns: [ 0, 1, 2, 4 ]
},
customize: function(doc) {
doc.defaultStyle.fontSize = 10;
}
},
{ extend: 'print',
message: 'Patient Accounts',
exportOptions: {
columns: [ 0, 1, 2, 4 ]
},
customize: function (win) {
$(win.document.body)
.css('font-size', '10pt')
.css('background', '#fff')
.prepend(
'<img src="<?php echo asset('uploads/logo/logo-sm.png'); ?>" style="position:absolute; top:0; right:0;" />'
);
$(win.document.body).find('table')
.addClass('compact')
.css('font-size', 'inherit');
}
}
]
});
$('#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
@@ -0,0 +1,127 @@
@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 Account Deposits{{ __('patient_accounts.') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('family_accounts.dashboard') }}</a></li>
<li><a href="{{ route('patient_finance.home') }}">{{ __('family_accounts.finance_home') }}</a></li>
<li class="active">Patient Account Deposits Receipt{{ __('patient_accounts.') }}</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()"> Print{{ __('patient_accounts.') }}</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">
@php
$hospital_information = \Streamline\Models\HospitalInformation::first();
@endphp
<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>{{ __('family_accounts.tel') }}</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('family_accounts.email') }}</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('family_accounts.cashier') }}</b> {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('family_accounts.date') }}</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>{{ __('family_accounts.receipt_number') }}</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>Transaction Date{{ __('patient_accounts.') }}</b> {{ streamline_date($deposit_date) }}</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>Amounts{{ __('patient_accounts.') }}</b></th>
</thead>
<tbody>
<tr>
<td>{{ $description }}</td>
<td><b>{{ ugandan_shillings($deposit_amount) }}</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 Paid With{{ __('patient_accounts.') }} {{ ($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%;">{{ __('family_accounts.streamline') }}</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,268 @@
@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-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patient_accounts.patient_accounts_deposits') }}</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> {{ __('family_accounts.home') }}</a></li>
<li class="active"><i class="fa fa-eye"></i> {{ __('patient_accounts.reports') }}</li>
</ol>
</div>
</div>
@include('patient_discounts::patient_accounts.menu')
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
{{ Form::open(['url' => 'patient_accounts/deposits_report', 'method' => 'ANY']) }}
<div class="row">
<div class="col-md-3">
<div class="form-group" id="patient_numbers">
{{ Form::label('patient_number',__('investigations.patient_number')) }}
{{ Form::text('patient_number', '', ['class' => 'form-control typeahead', 'placeholder' => 'Patient number', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="searchby">
{{ Form::label('search_by', __('family_accounts.date')) }}
{{ Form::select('search_by', ['0'=>'Last 24 hours','1'=>'Custom Date','2'=>'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>
</div>
{{ Form::close() }}
@if(!is_null($reg_date))
<h4>{{ __('family_accounts.showing_deposit_of') }} <font color="blue">{{ streamline_date($reg_date) }}</font></h4>
@elseif(!is_null($start_date) && !is_null($end_date))
<h4>{{ __('family_accounts.showing_deposit_from') }}<font color="blue">{{ streamline_date($start_date) }}</font> {{ __('patient_accounts.to') }} <font color="blue">{{ streamline_date($end_date) }}</font></h4>
@endif
<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>
<th>{{ __('family_accounts.action') }}</th>
</tr>
</thead>
<tbody>
@php $counter = 1; $total_deposits = 0; @endphp
@if(count($patient_deposits) > 0)
@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>
<td>
<a href="/patient_accounts/view_details/{{ $deposit->patient_id }}/" class="btn btn-outline-success btn-sm"><i class="fa fa-book"></i> {{ __('patient_accounts.statement') }}</a>
<br><br>
@if(Auth::user()->can('cancel-patient-accounts-deposits') && is_null($deposit->received))
<a href="/patient_accounts/cancel_deposit/{{ $deposit->id }}/" class="btn btn-outline-primary btn-sm" onclick="return confirm('Are you sure you want to cancel this deposit?')"> {{ __('patient_accounts.cancel_deposit') }}</a>
@endif
</td>
</tr>
@php $counter++; @endphp
@endforeach
@endif
</tbody>
<tfoot>
<tr>
<td></td>
<td><strong>{{ __('family_accounts.total') }}</strong></td>
<td><strong>{{ ugandan_shillings($total_deposits) }}</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<!-- Date Picker Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/typeahead.js-master/dist/typeahead.bundle.min.js') }}"></script>
<script>
var substringMatcher = function (strs) {
return function findMatches(q, cb) {
var matches, substringRegex;
// 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); ?>)
}
);
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy',
{ extend: 'csv',
message: 'Patient Accounts'
},
{ extend: 'excel',
message: 'Patient Accounts',
exportOptions: {
columns: [ 0, 1, 2, 4 ]
},
sheetName: 'Patient Accounts'
},
{ extend: 'pdf',
message: 'Patient Accounts',
orientation: 'landscape',
pageSize: 'LETTER',
exportOptions: {
columns: [ 0, 1, 2, 4 ]
},
customize: function(doc) {
doc.defaultStyle.fontSize = 10;
}
},
{ extend: 'print',
message: 'Patient Accounts',
exportOptions: {
columns: [ 0, 1, 2, 4 ]
},
customize: function (win) {
$(win.document.body)
.css('font-size', '10pt')
.css('background', '#fff')
.prepend(
'<img src="<?php echo asset('uploads/logo/logo-sm.png'); ?>" style="position:absolute; top:0; right:0;" />'
);
$(win.document.body).find('table')
.addClass('compact')
.css('font-size', 'inherit');
}
}
]
});
$('#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
@@ -0,0 +1,147 @@
@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/select2/select2.min.css') }}" rel="stylesheet" />
<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-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('family_accounts.add_family_deposit') }}</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> {{ __('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> {{ __('family_accounts.add_family_deposit') }}</li>
</ol>
</div>
</div>
@include('patient_discounts::patient_accounts.menu')
<div class="white-box">
@include('patient_discounts::patient_accounts.patient_details')
@include('flash::message')
{{ Form::open(['method'=>'post','route'=>'patient_accounts.store_deposit']) }}
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('deposit_amount',__('family_accounts.amount_deposited')) }}
{{ Form::number('deposit_amount', '',['class' => 'form-control compulsory', 'id' => 'deposit_amount', 'required']) }}
</div>
<div class="row">
<div class="col-md-6">
<label class="label label-primary" id="add_payment_method_button" onclick="add_payment_method();">{{ __('patient_accounts.add_payment_method') }}</label>
</div>
<div class="col-md-6"></div>
</div>
<br><br>
<div id="payment_methods_div" style="display: none">
<div class="form-group">
{{ Form::label('cash_to_pay',__('patient_accounts.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>
{{ Form::submit(__('family_accounts.save'),['class'=>'btn btn-success'])}}
{{ Form::reset(__('family_accounts.cancel'),['type'=>'reset','class'=>'btn btn-default'])}}
</div>
</div>
<div class="col-md-6">
<div class="form-group">
{{ Form::label('deposit_date', __('family_accounts.deposited_on')) }}
<div class="input-group">
{{ Form::text('deposit_date', date('d-m-Y'), ['class'=>'form-control compulsory', 'required' , 'readonly', 'id'=>'deposit_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
</div>
{{ Form::close() }}
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.family_dropdown').select2({
placeholder: "Select member"
});
$('.select2-selection.select2-selection--single').css('height','calc(3.85rem)');
$('.select2-selection.select2-selection--single').css('padding-top','5px');
$('.select2-selection.select2-selection--single').css('border-left', '3px solid #F08080');/*add compulsory class*/
$('.select2-selection.select2-selection--single.sec_d').css('border-left', '3px solid #aaa');
$('.select2-selection__arrow').css('top','3px');
$('#deposit_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
});
$('#deposit_amount').change(function (e) {
reset_payment_methods_amounts();
});
function add_payment_method() {
$('#payment_methods_div').show();
if ($('#cash_to_pay').val() == 0) {
$('#cash_to_pay').val( $('#deposit_amount').val());
$('#original_cash_to_pay').val( $('#deposit_amount').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( $('#deposit_amount').val());
$('#original_cash_to_pay').val( $('#deposit_amount').val());
$('.payment_methods_amount').each(function () {
$(this).val(0);
});
}
</script>
@endpush
@@ -0,0 +1,15 @@
<div class="panel panel-default" style="border-radius: 5px;">
<div class="panel-body">
@if(Auth::user()->can('view-patient-accounts-deposits'))
<a href="{{ route('patient_accounts.deposits_report') }}" class="nav-item btn btn-success"><i class="fa fa-plus"></i> <span style="margin-left: 10px;">{{ __('patient_accounts.patient_accounts_deposits_reports') }}</span></a>
@endif
@if(Auth::user()->can('view-patient-accounts-refunds'))
<a href="{{ route('patient_accounts.refunds_report') }}" class="nav-item btn btn-success"><i class="fa fa-plus"></i> <span style="margin-left: 10px;">{{ __('patient_accounts.patient_accounts_refunds_reports') }}</span></a>
@endif
@if(Auth::user()->can('view-patient-accounts-consumptions'))
<a href="{{ route('patient_accounts.consumptions_report') }}" class="nav-item btn btn-success"><i class="fa fa-plus"></i> <span style="margin-left: 10px;">{{ __('patient_accounts.patient_accounts_consumption_reports') }}</span></a>
@endif
</div>
</div>
@@ -0,0 +1,29 @@
<div class="table-responsive">
<table class="table table-bordered table-condensed table-striped">
<thead>
<tr>
<th style="color: black">{{ __('layout.patient_number') }}</th>
<th style="color: black">{{ __('layout.patient_names') }}</th>
<th style="color: black">{{ __('layout.gender') }}</th>
<th style="color: black">{{ __('layout.age') }}</th>
<th style="color: black">{{ __('patient_accounts.phone_number') }}</th>
<th style="color: black">{{ __('patient_accounts.email') }}</th>
<th style="color: black">{{ __('layout.patient_category') }}</th>
</tr>
</thead>
<tbody>
@php $dob = new Carbon\Carbon($patient->date_of_birth) @endphp
<tr>
<td>{{ $patient->number }}</td>
<td>{!! insurance_flag($patient->id) !!}</td>
<td>{{ $patient->gender == 1 ? __('layout.male') : __('layout.female') }}</td>
<td>{{ $dob->diffInYears(Carbon\Carbon::now()) }} ({{ __('patient_accounts.years') }})</td>
<td>{{ $patient->phone }}</td>
<td>{{ $patient->email }}</td>
<td>{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}</td>
</tr>
</tbody>
</table>
<hr>
</div>
@@ -0,0 +1,89 @@
<!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>{{ __('patient_finance.patient_names') }}</b></td>
<td>{{ get_full_name($patient_id, 'id', 'first_name', 'last_name', 'patients') }} ({{ get_name($patient_id, 'id', 'number', 'patients') }})</td>
<td><b>{{ __('patient_finance.date') }}</b></td>
<td colspan="2">{{ streamline_date_time_short($receipt_date) }}</td>
<td><b>{{ __('patient_finance.receipt_number') }}</b></td>
<td colspan="2">{{ $receipt_number }}</td>
<td><b>{{ __('patient_accounts.transaction_date') }}</b></td>
<td colspan="2">{{ $deposit_date }}</td>
</tr>
</table>
<table class="table table-bordered" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('patient_accounts.details') }}</b></th>
<th style="width: 20%"><b>{{ __('patient_accounts.amounts') }}</b></th>
</thead>
<tbody>
<tr>
<td>{{ $description }}</td>
<td><b>{{ ugandan_shillings($deposit_amount) }}</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_accounts.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 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_accounts.printed_on') }} {{ date(" d M Y h:ia") }} {{ __('patient_accounts.by') }} {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</i>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,234 @@
<!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">
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">{{ $search_info }}</h5>
<hr><br>
@if(count($patient_deposits) > 0)
<h4><b>{{ __('patient_accounts.deposits') }}</b></h4>
<div>
<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>
<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>
<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(get_name($patient_id, 'id', 'patient_account_balance', 'patients')) }}</span>
<hr>
</div>
</div>
</body>
</html>
@@ -0,0 +1,136 @@
@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/select2/select2.min.css') }}" rel="stylesheet" />
<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-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patient_accounts.refund_patient_accounts') }}</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> {{ __('family_accounts.home') }}</a></li>
<li class="active"><i class="fa fa-eye"></i> {{ __('patient_accounts.refund_patient_accounts') }}</li>
</ol>
</div>
</div>
@include('patient_discounts::patient_accounts.menu')
<div class="white-box">
@include('patient_discounts::patient_accounts.patient_details')
{{ Form::open(['method'=>'post','route'=>'patient_accounts.save_refund_deposit']) }}
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('current_balance', __('patient_accounts.current_balance')) }}
{{ Form::number('current_balance', $current_balance,['class' => 'form-control compulsory', 'id' => 'current_balance', 'readonly']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('refund_amount', __('patient_accounts.refund_amount')) }}
{{ Form::number('refund_amount', '',['class' => 'form-control compulsory', 'id' => 'refund_amount', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
{{ Form::label('refund_date', __('patient_accounts.refund_date')) }}
<div class="input-group">
{{ Form::text('refund_date', date('d-m-Y'), ['class'=>'form-control compulsory', 'required' , 'readonly', 'id'=>'refund_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
<div class="form-group">
{{ Form::label('account_id',__('patient_accounts.account_to_pay_from')) }}
{{ Form::select('account_id', $banks, '', ['class' => 'form-control compulsory','required', 'id' => 'account_id', 'onchange' => 'get_bank_balance()']) }}
</div>
<div class="form-group">
{{ Form::label('account_balance',__('patient_accounts.account_balance')) }}
{{ Form::text('account_balance', 0, ['class'=>'form-control compulsory', 'id'=>'account_balance', 'readonly']) }}
</div>
<div class="form-group">
{{ Form::label('refund_reason', __('patient_accounts.refunded_reason')) }}
{{ Form::textarea('refund_reason', '',['class' => 'form-control compulsory', 'required', 'rows' => '5']) }}
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div>
{{ Form::submit(__('family_accounts.save'),['class'=>'btn btn-success submit_btn'])}}
{{ Form::reset(__('family_accounts.cancel'),['type'=>'reset','class'=>'btn btn-default'])}}
</div>
{{ Form::close() }}
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
$('#refund_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
function get_bank_balance() {
let refund_amount = parseInt($('#refund_amount').val());
if (!isNaN(refund_amount)) {
let account_id = $('#account_id').val();
let today = new Date();
let today_formatted = String(today.getDate()).padStart(2, '0') + '-' + String(today.getMonth() + 1).padStart(2, '0') + '-' + today.getFullYear();
if (account_id !== '') {
$.ajax({
method: 'POST',
url: '/banking/get_current_account_balance_per_date',
data: {
'bank': account_id,
'date': today_formatted
},
async: true,
success: function(response) {
var bank_record = JSON.parse(response);
var account_balance = bank_record['account_balance'];
$('#account_balance').val(account_balance);
if (account_balance <= 0) {
alert('Account Balance is Zero(0) UGX');
$('.submit_btn').hide();
} else if (refund_amount > account_balance) {
alert('Your Account Balance is low');
$('.submit_btn').hide();
} else {
$('.submit_btn').show();
}
},
error: function(error) {
//console.log(error);
}
});
}
} else {
alert("Please enter the refund before selecting an account");
$('#account_id').val('');
}
}
</script>
@endpush
@@ -0,0 +1,271 @@
@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-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patient_accounts.patient_accounts_refunds') }}</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> {{ __('family_accounts.home') }}</a></li>
<li class="active"><i class="fa fa-eye"></i> {{ __('patient_accounts.reports') }}</li>
</ol>
</div>
</div>
@include('patient_discounts::patient_accounts.menu')
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
{{ Form::open(['url' => 'patient_accounts/refunds_report', 'method' => 'ANY']) }}
<div class="row">
<div class="col-md-3">
<div class="form-group" id="patient_numbers">
{{ Form::label('patient_number',__('investigations.patient_number')) }}
{{ Form::text('patient_number', '', ['class' => 'form-control typeahead', 'placeholder' => 'Patient number', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="searchby">
{{ Form::label('search_by', __('family_accounts.date')) }}
{{ Form::select('search_by', ['0'=>'Last 24 hours','1'=>'Custom Date','2'=>'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>
</div>
{{ Form::close() }}
@if(!is_null($reg_date))
<h4>{{ __('family_accounts.showing_deposit_of') }} <font color="blue">{{ streamline_date($reg_date) }}</font></h4>
@elseif(!is_null($start_date) && !is_null($end_date))
<h4>{{ __('family_accounts.showing_deposit_from') }}<font color="blue">{{ streamline_date($start_date) }}</font> {{ __('patient_accounts.to') }} <font color="blue">{{ streamline_date($end_date) }}</font></h4>
@endif
<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_record_date') }}</th>
<th>{{ __('patient_accounts.refund_transaction_date') }}</th>
<th>{{ __('patient_accounts.refunded_by') }}</th>
<th>{{ __('patient_accounts.refunded_reason') }}</th>
<th>{{ __('family_accounts.action') }}</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_time($refund->created_at) }}</td>
<td>{{ streamline_date($refund->refund_date) }}</td>
<td>{{ get_full_name($refund->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>{{ $refund->refund_reason }}</td>
<td>
<a href="/patient_accounts/view_details/{{ $refund->patient_id }}/" class="btn btn-outline-success btn-sm"><i class="fa fa-book"></i> {{ __('patient_accounts.statement') }}</a>
<br><br>
@if(Auth::user()->can('cancel-patient-accounts-deposits'))
<a href="/patient_accounts/cancel_refund/{{ $refund->id }}/" class="btn btn-outline-primary btn-sm" onclick="return confirm('Are you sure you want to cancel this refund?')"> {{ __('patient_accounts.cancel_refund') }}</a>
@endif
</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>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<!-- Date Picker Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/typeahead.js-master/dist/typeahead.bundle.min.js') }}"></script>
<script>
var substringMatcher = function (strs) {
return function findMatches(q, cb) {
var matches, substringRegex;
// 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); ?>)
}
);
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy',
{ extend: 'csv',
message: 'Patient Accounts'
},
{ extend: 'excel',
message: 'Patient Accounts',
exportOptions: {
columns: [ 0, 1, 2, 4 ]
},
sheetName: 'Patient Accounts'
},
{ extend: 'pdf',
message: 'Patient Accounts',
orientation: 'landscape',
pageSize: 'LETTER',
exportOptions: {
columns: [ 0, 1, 2, 4 ]
},
customize: function(doc) {
doc.defaultStyle.fontSize = 10;
}
},
{ extend: 'print',
message: 'Patient Accounts',
exportOptions: {
columns: [ 0, 1, 2, 4 ]
},
customize: function (win) {
$(win.document.body)
.css('font-size', '10pt')
.css('background', '#fff')
.prepend(
'<img src="<?php echo asset('uploads/logo/logo-sm.png'); ?>" style="position:absolute; top:0; right:0;" />'
);
$(win.document.body).find('table')
.addClass('compact')
.css('font-size', 'inherit');
}
}
]
});
$('#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
@@ -0,0 +1,363 @@
@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