updated streamline-setup v2

This commit is contained in:
2025-01-15 08:53:49 -08:00
committed by alec.turner
parent a2ce9248f0
commit 4b569f81b0
20228 changed files with 2932048 additions and 63204 deletions
@@ -0,0 +1,85 @@
@extends('layouts.main')
@push('styles')
@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">{{ __('finance_reports.guarantor_agreement') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="/finance_reports">{{ __('finance_reports.reports_home') }}</a></li>
<li class="active">{{ __('finance_reports.guarantor_agreement') }}</li>
</ol>
</div>
</div>
<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 id="divToPrint">
<div class="row" style="padding: 10px;">
<div class="col-sm-6">
<img style="margin: auto; height: 83px;" src="/uploads/logo/logo.png">
</div>
<div class="col-sm-6"></div>
</div>
<div class="row" style="padding: 10px;">
<div class="col-sm-12">
{{ __('patient_finance.agreement1') }}
<b>{{ ugandan_shillings($amount_to_pay) }}</b>
{{ __('patient_finance.agreement2') }}
<b>{{ ugandan_shillings($amount_owed) }}</b>
{{ __('patient_finance.agreement3') }}
(<b>{{ $patient_names }}</b>)
{{ __('patient_finance.agreement4') }}
<b>{{ $payment_date }}</b>
{{ __('patient_finance.agreement5') }}
<b>{{ $arrangement }}</b>
{{ __('patient_finance.agreement6') }}.
<br><br><br>
<div class="row">
<div class="col-sm-2"><b>{{ __('patient_finance.signed_by') }}:</b></div>
<div class="col-sm-4"><b>{{ __('patient_finance.name') }}: {{ $guarantor_name }}</b></div>
<div class="col-sm-2"><b>{{ __('patient_finance.grade') }}:</b></div>
<div class="col-sm-2"><b>{{ __('patient_finance.department') }}:</b></div>
<div class="col-sm-2"><b>{{ __('patient_finance.date') }}:</b></div>
</div>
<br><br>
<div class="row">
<div class="col-sm-2"><b>{{ __('patient_finance.witnessed_by') }}:</b></div>
<div class="col-sm-4"><b>{{ __('patient_finance.name') }}:</b></div>
<div class="col-sm-2"><b>{{ __('patient_finance.grade') }}:</b></div>
<div class="col-sm-2"><b>{{ __('patient_finance.department') }}:</b></div>
<div class="col-sm-2"><b>{{ __('patient_finance.date') }}:</b></div>
</div>
</div>
</div>
<br><br>
<strong>{{ __('patient_finance.date') }} Printed:</strong> {{ \Carbon\Carbon::now()->format('D m Y') }}
</div>
</div>
@endsection
@push('scripts')
<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,122 @@
@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>Debt Plan Receipt</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('patient_debtors.staff_guarantors') }}">Debt Plan Report</a></li>
<li class="active">Debt Plan 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()"> 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>Tel:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>Email:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>Cashier:</b> {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</span><br>
<span class="receipt-label"><b>Receipt Number: </b> {{ $new_receipt_number }}</span><br>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>Description</b></th>
<th style="width: 20%"><b>Amount</b></th>
</thead>
<tbody>
<tr>
<td>Comment</td>
<td>{{ $request->comment }}</td>
</tr>
<tr>
<td>Expected Amount</td>
<td>{{ ugandan_shillings($request->amount_owed) }}</td>
</tr>
<tr>
<td>Amount Paid</td>
<td>{{ ugandan_shillings($request->amount_paid) }}</td>
</tr>
<tr>
<td>Balance</td>
<td>{{ ugandan_shillings($request->balance) }}</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,152 @@
@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-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">Debt Plan Receipt</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('finance_reports.index') }}">Reports</a></li>
<li class="active">Receipt</li>
</ol>
</div>
</div>
@include('flash::message')
<div class="row">
<div class="col-md-6 offset-3">
<div class="white-box">
<div class="row" style="float:right;"><button class="btn btn-success glyphicon glyphicon-print" onclick="print_receipt()"> Print</button></div>
<div class="row" id="divToPrint">
<div class="col-sm-12" 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>Email:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>Cashier:</b> {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</span><br>
<span class="receipt-label"><b>Receipt Number:</b>
@php
$amount_paid = unserialize($payment->amount_paid_history);
$date_paid = unserialize($payment->date_paid_history);
$staff_in_charge = unserialize($payment->staff_in_charge_history);
$comments = unserialize($payment->comment_history);
$receipts = unserialize($payment->receipt_history);
$balances = unserialize($payment->balance_history);
@endphp
@foreach ($receipts as $item)
{{ $item }}
@endforeach
</span><br>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<tr>
<th style="width: 60%; justify-content: center"><b>Description</b></th>
<th style="width: 20%"><b>Amount</b></th>
</tr>
</thead>
<tbody>
<tr>
<td>Expected Amount:</td>
<td>
{{ ugandan_shillings(get_name($payment->debt_plan_id, 'id', 'staff_guarantor_to_pay', 'debt_plan')) }}
</td>
</tr>
<tr>
<td>Amount Paid:</td>
<td>
@foreach ($amount_paid as $item)
{{ ugandan_shillings($item) }}<br>
@endforeach
</td>
</tr>
<tr>
<td>Balance:</td>
<td>
@foreach ($balances as $item)
{{ ugandan_shillings($item) }}<br>
@endforeach
</td>
</tr>
<tr>
<td>Reason:</td>
<td>Debt Plan Payment</td>
</tr>
{{--<tr>--}}
{{--<td><strong>Total Paid:</strong></td>--}}
{{--<td><strong>{{ ugandan_shillings($payment->amount_received) }}</strong></td>--}}
{{--</tr>--}}
<tr>
<td><strong>Received By</strong></td>
<td><strong>{{ get_full_name($payment->created_by, 'id', 'first_name', 'last_name', 'users') }}</strong></td>
</tr>
</tbody>
</table>
</div>
</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,290 @@
@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/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">Receive Guarantor Payments</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="/finance_reports">Reports Dashboard</a></li>
<li class="active">Guarantor Payments</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-8">
<div class="row">
<div class="panel panel-default col-md-12">
<div class="panel-body panel-primary">
<h2><strong>Payment Debt Plan</strong></h2>
<br/>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>Guarantor Name</th>
<th>Payment Arrangement</th>
<th>Amount To Pay</th>
<th>Amount Paid</th>
<th>Completion Date</th>
</tr>
</thead>
<tbody>
@php $amount_paid_on_debt = 0; @endphp
@if(!is_null($debts))
<td>
@php
$guarantor_ids_array = explode(",", $debts->staff_guarantor);
@endphp
<ul>
@if ($debts->guarantor_type == 1)
@for ($i = 0; $i < count($guarantor_ids_array); $i++)
<li>{{ get_full_name($guarantor_ids_array[$i], 'id', 'first_name', 'last_name', 'users') }}</li>
@endfor
@else
@for ($i = 0; $i < count($guarantor_ids_array); $i++)
<li>{{ get_full_name($guarantor_ids_array[$i], 'id', 'first_name', 'last_name', 'non_staff_guarantors') }}</li>
@endfor
@endif
</ul>
</td>
<td>{{ get_name($debts->debt_plan_arrangement, 'id', 'name', 'debt_plan_arrangements') }}</td>
<td>{{ ugandan_shillings($debts->staff_guarantor_to_pay) }}
<td>
<?php $amount_paid_on_debt = $debts->amount_paid_off ?? 0; ?>
{{ ugandan_shillings($amount_paid_on_debt) }}
</td>
<td>
@if (!is_null($debts->fourth_installment_date))
{{ streamline_date($debts->fourth_installment_date) }}
@elseif(!is_null($debts->third_installment_date))
{{ streamline_date($debts->third_installment_date) }}
@elseif(!is_null($debts->second_installment_date))
{{ streamline_date($debts->second_installment_date) }}
@elseif(!is_null($debts->first_installment_date))
{{ streamline_date($debts->first_installment_date) }}
@endif
</td>
@else
<td colspan="6"><span style="color: red;">RECORDS NOT FOUND</span></td>
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="panel panel-default col-md-12">
<div class="panel-body panel-primary">
<h2><strong>Payment History</strong></h2>
<br/>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>Balance</th>
<th>Amount Paid</th>
<th>Receipt No.</th>
<th>Date</th>
<th>Staff In Charge</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
@if($debt_with_balances)
@foreach($debt_with_balances as $debt_with_balance)
<tr>
<td>{{ ugandan_shillings($debt_with_balance->balance) }}</td>
<td>{{ ugandan_shillings($debt_with_balance->amount_paid) }}</td>
<td>{{ $debt_with_balance->receipt_number }}</td>
<td>{{ streamline_date($debt_with_balance->date_paid) }}</td>
<td>{{ $users_array[$debt_with_balance->created_by] }}</td>
<td>{{ $debt_with_balance->comment }}</td>
</tr>
@endforeach
@else
<td colspan="6"><span style="color: red;">RECORDS NOT FOUND</span></td>
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body panel-primary">
@php $amount_owed = $debts->staff_guarantor_to_pay - $amount_paid_on_debt @endphp
@if($amount_owed < 1)
<h3 style="color: green">Payment has been made in full</h3>
@else
{{ Form::open(['route' => 'patient_debtors.process_debt_plan_payment_staff', 'data-toggle' => 'validator']) }}
<br/>
<h3>Make Payment</h3>
<br/>
<div class="form-group">
{{ Form::label('amount_label', 'Expected Amount') }}
<div class="input-group">
{{ Form::number('amount_owed', $amount_owed,
['class'=>'form-control compulsory required', 'readonly', 'id'=>'amount_owed']) }}
</div>
</div>
<div class="form-group">
{{ Form::label('amount_paid_label', 'Amount Paid') }}
<div class="input-group">
{{ Form::number('amount_paid', 0, ['class'=>'form-control compulsory required', 'id'=>'amount_paid']) }}
</div>
</div>
<div class="form-group">
{{ Form::label('balance_label', 'Balance') }}
<div class="input-group">
{{ Form::number('balance', '', ['class'=>'form-control compulsory required', 'readonly', 'id'=>'balance']) }}
</div>
</div>
<div class="form-group">
{{ Form::label('date_label', 'Date of Payment') }}
<div class="input-group">
{{ Form::text('date', '', ['class'=>'form-control compulsory required','readonly', 'id'=>'date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
<div class="form-group">
{{ Form::label('comment_label', 'Comment') }}
<div class="input-group">
{{ Form::textarea('comment','', ['class'=>'form-control compulsory required', 'id'=>'comment']) }}
</div>
</div>
{{ Form::hidden('staff_guarantor', $debts->staff_guarantor, ['id' => 'staff_guarantor']) }}
{{ Form::hidden('payment_id', $debts->id, ['id' => 'payment_id']) }}
<div class="form-group">
<a class="btn btn-danger" id="write_off_btn">Write Off Debt</a>
{{ Form::submit('Make Payment', ['class'=>'btn btn-success pull-right']) }}
</div>
{{ Form::close() }}
@endif
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal" id="write_off_modal" tabindex="-1" role="dialog" aria-labelledby="write_off_modal_label" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header text-center">
<h5 class="modal-title" id="write_off_modal_label"><b>Write Off Balance</b></h5>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Amount To Be Written Off</label>
<input id="amount_to_write_off" type="number" class="form-control">
</div>
<div class="form-group">
<label>Write Off Memo</label>
<textarea id="write_off_memo" type="number" rows="5" class="form-control"></textarea>
</div>
<div class="form-group">
<label>Expense Account</label>
{{ Form::select('expense_account', $expense_accounts, '', ['class'=>'form-control', 'id'=>'expense_account']) }}
</div>
<button class="btn btn-rounded btn-block btn-success" id="complete_write_off">Complete</button>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<!-- Date Picker Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script type="text/javascript">
$('#write_off_btn').click(function() {
let amount_owed = $('#amount_owed').val();
$('#amount_to_write_off').val(amount_owed);
$('#write_off_modal').modal('show');
});
$('#complete_write_off').click(function() {
let amount = $('#amount_to_write_off').val();
let expense_account = $('#expense_account').val();
let write_off_memo = $('#write_off_memo').val();
let amount_paid = $('#amount_paid').val();
let amount_owed = $('#amount_owed').val();
let staff_guarantor = $('#staff_guarantor').val();
let payment_id = $('#payment_id').val();
if (amount === '') {
alert('Please Enter An Amount To Write Off.')
} else if (expense_account === '') {
alert('Please Select An Expense Account To Write Off To.')
} else if (write_off_memo === '') {
alert('Please Enter A Memo For This Write Off.')
} else {
$.ajax({
method: 'post',
url: '/patient_debtors/write_off_debt_plan',
data: {
'amount': amount, 'amount_paid': amount_paid, 'amount_owed': amount_owed, 'staff_guarantor': staff_guarantor,
'expense_account': expense_account, 'write_off_memo': write_off_memo, 'payment_id': payment_id
},
success: function(response) {
if(!response.includes("no")) {
alert("Write off has been completed successfully");
window.location.href = '/patient_debtors/staff_guarantors';
} else {
alert("An error occurred. Please try again");
}
}
});
}
});
$('#date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
$('#amount_paid').change(function (e) {
e.preventDefault();
let amount = $('#amount_owed').val();
let bal = amount - this.value;
$('#balance').val(bal);
});
$('#table').DataTable();
</script>
@endpush
@@ -0,0 +1,150 @@
@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>Debtor Payment Receipt</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('patient_debtors.debtors') }}">Debtors Report</a></li>
<li class="active">Debtor Payment Receipt</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
<div class="row" style="float:right;">
@if(is_cashier_receipt_type_print_html())
<button class="btn btn-success glyphicon glyphicon-print" onclick="print_receipt()"> Print</button>
@else
<form action="{{ route('patient_debtors.print_debtor_receipt_pdf_details') }}" method="post" target="_blank">
{{ csrf_field() }}
<input value="{{ $request->comment }}" type="hidden" name="comment"/>
<input value="{{ $request->amount_owed }}" type="hidden" name="amount_owed"/>
<input value="{{ $request->amount_paid }}" type="hidden" name="amount_paid"/>
<input value="{{ $request->balance }}" type="hidden" name="balance"/>
<input value="{{ serialize($payment_methods) }}" type="hidden" name="payment_methods"/>
<input value="{{ $new_receipt_number }}" type="hidden" name="receipt_number"/>
<input value="{{ $patient->id }}" type="hidden" name="patient_id"/>
<button type="submit" class="btn btn-success glyphicon glyphicon-print"> Print</button>
</form>
@endif
</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>Email:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>Cashier:</b> {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</span><br>
<span class="receipt-label"><b>Receipt Number: </b> {{ $new_receipt_number }}</span><br>
<span class="receipt-label"><b>Patient Names: </b> {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>Patient Number: </b> {{ $patient->number }}</span><br>
<span class="receipt-label"><b>Patient Category: </b> {{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}</span><br>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>Description</b></th>
<th style="width: 20%"><b>Amount</b></th>
</thead>
<tbody>
<tr>
<td>Comment</td>
<td>{{ $request->comment }}</td>
</tr>
<tr>
<td>Expected Amount</td>
<td>{{ ugandan_shillings($request->amount_owed) }}</td>
</tr>
<tr>
<td>Amount Paid</td>
<td>{{ ugandan_shillings($request->amount_paid) }}</td>
</tr>
<tr>
<td>Balance</td>
<td>{{ ugandan_shillings($request->balance) }}</td>
</tr>
@if(count($payment_methods) > 0)
<tr><td colspan="2"></td></tr>
@foreach($payment_methods as $key => $value)
<tr>
<td><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
</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,307 @@
@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/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/select2/select2.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">Debtors</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="/finance_reports">Reports Dashboard</a></li>
<li class="active">Debtors Reports</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body">
@include('flash::message')
{{ Form::open(['method'=>'post','route' => 'patient_debtors.debtors']) }}
<div class="row">
<div class="col-md-3 b-r">
<div class="form-group">
<label>Staff Member:</label>
<select class="form-control compulsory required" name="staff_member" id="staff_member" required>
<option value="">-select-</option>
<option value="ALL STAFF">ALL STAFF</option>
@foreach($users as $item)
<option value="{{ $item->id }}">{{ $item->username }}</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-9">
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label>Select Date:</label>
<select class="form-control compulsory required" name="dates" id="dates" required>
<option value="">-select-</option>
<option value="today">TODAY</option>
<option value="yesterday">YESTERDAY</option>
<option value="custom_date">CUSTOM DATE</option>
<option value="custom_date_range">DATE RANGE</option>
</select>
</div>
</div>
<div class="col-md-3">
<div id="sDate" style="display: none;">
<div class="form-group">
{{ Form::label('start_date', 'Date On') }}
<div class="input-group">
{{ Form::text('start_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'start_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div id="eDate" style="display: none;">
<div class="form-group">
{{ Form::label('end_date', 'End Date') }}
<div class="input-group">
{{ Form::text('end_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'end_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group" style="margin-top: 25px;">
{{ Form::submit('Submit', ['class'=>'btn btn-success btn-rounded btn-block pull-right']) }}
</div>
</div>
</div>
</div>
</div>
{{ Form::close() }}
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body panel-primary">
@if(count($debtors) > 0)
<h2><strong>Report For Debtors</strong></h2>
<br/>
@if(isset($display))
<h3 class="label label-info"> {!! $display !!}</h3>
@endif
<br/>
<br/>
<div class="table-responsive">
<table id="table" class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>Date</th>
<th>Patient No.</th>
<th>Patient Name</th>
<th>Staff In-charge</th>
<th>Receipt No.</th>
<th>Initial Debt Amount</th>
<th>Amount Paid</th>
<th>Balance</th>
<th></th>
<th></th>
</tr>
</thead>
@php
$sum_total_amount = 0;
$sum_amount_paid = 0;
$sum_balance = 0;
$counter = 1;
@endphp
@if(count($debtors) > 0)
<tbody>
@foreach($debtors as $debtor)
@php
$payment = Streamline\Models\DebtorPayment::where('debt_id', $debtor->id)->first();
$balance_remaining = $debtor->balance_remaining ?? $debtor->balance;
@endphp
<tr>
<td>{{ $counter }}</td>
<td>
{{ streamline_date($debtor->created_at) }}
</td>
<td>
{{ get_name($debtor->patient_id, 'id', 'number', 'patients') }}
</td>
<td>
{{ get_full_name($debtor->patient_id, 'id', 'first_name', 'last_name', 'patients') }}
</td>
<td>
{{ get_full_name($debtor->created_by, 'id', 'first_name', 'last_name', 'users') }}
</td>
<td>
{{ $debtor->receipt_number }}
</td>
<td>
{{ ugandan_shillings($debtor->balance) }}
</td>
<td>
{{ ugandan_shillings($debtor->amount_paid_off ?? 0) }}
</td>
<td>
{{ ugandan_shillings($balance_remaining) }}
</td>
@if(is_null($payment))
<td>
<a class="btn btn-success btn-block btn-sm btn-rounded" style="color: white" href="{{ route('patient_debtors.receive_debtor_payment', implode(",",array($debtor->id, "new"))) }}">Receive Payment</a>
</td>
<td></td>
@elseif($payment)
@if($balance_remaining > 0)
<td>
<a class="btn btn-warning btn-sm btn-block btn-rounded" style="color: white" href="{{ route('patient_debtors.receive_debtor_payment', implode(",",array($debtor->id, "update"))) }}">Update Payment</a>
</td>
<td>
<a class="btn btn-info btn-sm btn-block btn-rounded" style="color: white" href="{{ route('patient_debtors.history_debtor_payments', $debtor->id) }}"><i class="fa fa-eye"></i> View Receipts</a>
</td>
@elseif($balance_remaining == 0)
<td>
<a class="btn btn-info btn-block btn-sm btn-rounded" style="color: white" href="{{ route('patient_debtors.history_debtor_payments', $debtor->id) }}"><i class="fa fa-eye"></i> View Receipts</a>
</td>
<td></td>
@else
<td></td>
<td></td>
@endif
@else
<td></td>
<td></td>
@endif
</tr>
@php
$sum_total_amount += $debtor->balance;
$sum_amount_paid += ($debtor->amount_paid_off ?? 0);
$sum_balance += $balance_remaining;
$counter++;
@endphp
@endforeach
</tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>Total</td>
<td>{{ ugandan_shillings($sum_total_amount) }}</td>
<td>{{ ugandan_shillings($sum_amount_paid) }}</td>
<td>{{ ugandan_shillings($sum_balance) }}</td>
<td></td>
<td></td>
</tr>
@else
<td colspan="9"><span style="color: red;">RECORDS NOT FOUND</span></td>
@endif
</table>
</div>
@else
<div class="row">
<div class="offset-5"></div>
<div class="col-md-6" style="margin-top: 70px;">
<h3 class="btn btn-warning"><strong>Select a Valid date range</strong>e</h3>
</div>
</div>
@endif
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<!-- Date Picker Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script>
$('#dates').change(function (e) {
if($(this).val() === "custom_date"){
$("#eDate").hide();
$("#sDate").show();
}else if($(this).val() === "custom_date_range"){
$("#sDate").show();
$("#eDate").show();
}else{
$("#eDate").hide();
$("#sDate").hide();
}
});
</script>
<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 type="text/javascript">
jQuery('#end_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
</script>
<script type="text/javascript">
jQuery('#start_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
</script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
"aoColumnDefs": [{
"aTargets": [2,3],
"defaultContent": "",
}]
});
</script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script>
$('#staff_member').select2({
placeholder: "-- select --"
});
</script>
@endpush
@@ -0,0 +1,204 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<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">Debtor Payment Receipt</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('patient_debtors.debtors') }}">Debtors Report</a></li>
<li class="active">Debtor Payment Receipt</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="white-box" id="divToPrint">
@include('flash::message')
<style type="text/css" media="print" >
/*class for the element we dont want to print*/
.no-print{
display:none;
}
</style>
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-5">
<p style="text-align: center; font-size: 0.8em">
<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>Email:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>Department:</b> Finance</span><br>
<span class="receipt-label"><b>Date:</b> {{ streamline_date(\Carbon\Carbon::now()->toDateTimeString()) }}</span><br>
<span class="receipt-label"><b>Patient Name:</b> {{ get_name($patient_id, 'id', 'first_name', 'patients') }} {{ get_name($patient_id, 'id', 'last_name', 'patients') }}</span><br>
<span class="receipt-label"><b>Patient Number</b> : {{ get_name($patient_id, 'id', 'number', 'patients') }}</span><br>
</p>
@php $x = 0; @endphp
@foreach($payments as $payment)
<table style="font-size: 0.8em; font-weight: normal; font-family: monospace">
<tr class="no-print">
<th></th>
<th></th>
<th width="10%"></th>
</tr>
<tr class="{{ $x }} no-print print-all">
<td>Amount Paid: </td>
<td>{{ ugandan_shillings($payment->amount_paid) }}</td>
<td class="no-print" style="font-size: 1em;">
@if(is_cashier_receipt_type_print_html())
<button id="{{ $x }}" class="btn float-right btn-sm btn-primary waves-effect waves-light no-print print-btn">
<i class="fa fa-print m-r-5"></i> <span>Print</span>
</button>
@else
<form action="{{ route('patient_debtors.reprint_debtor_receipt_pdf_details') }}" method="post" target="_blank">
{{ csrf_field() }}
<input value="{{ $debtor_id }}" type="hidden" name="debt_id"/>
<input value="{{ $payment->id }}" type="hidden" name="is_single_print"/>
<input value="{{ $patient_id }}" type="hidden" name="patient_id"/>
<button type="submit" class="btn float-right btn-sm btn-primary waves-effect waves-light">
<i class="fa fa-print m-r-5"></i> <span>Print</span>
</button>
</form>
@endif
<br><br><br>
@if(is_null($payment->received_id))
<a class="btn float-right btn-sm btn-danger waves-effect waves-light" href="/patient_debtors/reverse_debtor_payment/{{ $payment->id }}" onclick="return confirm('Are you sure you want to reverse this debtor payment?')">
<i class="fa fa-trash m-r-5"></i>Reverse
</a>
@endif
</td>
</tr>
<tr class="{{ $x }} no-print print-all">
<td>Balance: </td>
<td>{{ ugandan_shillings($payment->balance) }}</td>
</tr>
<tr class="{{ $x }} no-print print-all">
<td>Receipt Number: </td>
<td>
{{ $payment->receipt_number }}
</td>
</tr>
<tr class="{{ $x }} no-print print-all">
<td>Received By: </td>
<td>
{{ get_full_name($payment->created_by, 'id', 'first_name', 'last_name', 'users') }}
</td>
</tr>
<tr class="{{ $x }} no-print print-all">
<td>Comment : </td>
<td>
{{ $payment->comment }}
</td>
</tr>
<tr class="{{ $x }} no-print print-all">
<td>Received On : </td>
<td>
{{ streamline_date($payment->date_paid) }}
</td>
</tr>
<tr class=" no-print"><td colspan="2"><hr ></td></tr>
</table>
@php $x++; @endphp
@endforeach
<i style="font-size: 0.7em; float: left">Viewed By : {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</i>
<i style="font-size: 0.6em; float: right">&copy; Stre@mline</i>
</div>
@if(count($payments) > 1)
<div class="col-md-4 no-print">
<div style="float: right;">
@if(is_cashier_receipt_type_print_html())
<button class="btn btn-primary btn-sm print-all-debtor-receipts">Print all receipts</button><br>
@else
<form action="{{ route('patient_debtors.reprint_debtor_receipt_pdf_details') }}" method="post" target="_blank">
{{ csrf_field() }}
<input value="{{ $debtor_id }}" type="hidden" name="debt_id"/>
<input value="0" type="hidden" name="is_single_print"/>
<input value="{{ $patient_id }}" type="hidden" name="patient_id"/>
<button type="submit" class="btn btn-primary btn-sm">Print all receipts</button>
</form>
@endif
</div>
</div>
@endif
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
$(document).ready(function () {
$(".print-all-debtor-receipts").click(function () {
$(".print-all").each(function () {
$(this).removeClass("no-print");
});
// print the whole document
print_debtor_receipt();
// add no-print attribute to all for the selected debts
$(".print-all").each(function () {
$(this).addClass("no-print");
});
});
// prepare for printing single debt receipt
$(".print-btn").click(function () {
var id = $(this).attr("id");
// remove no-print attribute from all for the selected debts
$("." + id).each(function () {
$(this).removeClass("no-print");
});
// print the whole document
print_debtor_receipt();
// add no-print attribute to all for the selected print_debtor_receipt
$("." + id).each(function () {
$(this).addClass("no-print");
});
});
});
// print for a single debt receipt
function print_debtor_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,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>Debt Plan Receipt</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="/">Debt Plan Report</a></li>
<li class="active">Debt Plan 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()"> 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>Tel:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>Email:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>Cashier:</b> {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</span><br>
{{--<span class="receipt-label"><b>Date:</b> {{ streamline_date_time_short($request->date) }}</span><br>--}}
@php
$new_receipt_number = generateReceiptNumberFromDB();
@endphp
<span class="receipt-label"><b>Receipt Number: </b> {{ $new_receipt_number }}</span><br>
{{--<span class="receipt-label"><b>REF</b> : {{ get_patient_name($request->patient_id) }}</span><br>--}}
{{--<span class="receipt-label"><b>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>Description</b></th>
<th style="width: 20%"><b>Amount</b></th>
</thead>
<tbody>
<tr>
<td>Reason</td>
<td>Patient Debt Plan Receipt</td>
</tr>
<tr>
<td>Staff Guarantor To Pay</td>
<td>{{ ugandan_shillings($debt_plan->staff_guarantor_to_pay) }}</td>
</tr>
<tr>
<td>Patient Amount Paid</td>
<td>{{ ugandan_shillings($debt_plan->amount_owed - $debt_plan->staff_guarantor_to_pay) }}</td>
</tr>
<tr>
<td>Total Amount</td>
<td>{{ ugandan_shillings($debt_plan->amount_owed) }}</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,104 @@
<!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 Names</b></td>
<td>{{ get_full_name($patient_id, 'id', 'first_name', 'last_name', 'patients') }}</td>
<td><b>Patient Number</b></td>
<td>{{ get_name($patient_id, 'id', 'number', 'patients') }}</td>
<td><b>Patient Category</b></td>
<td>{{ get_name(get_name($patient_id, 'id', 'category_id', 'patients'), 'id', 'name', 'patient_categories') }}</td>
</tr>
<tr>
<td><b>Cashier</b></td>
<td colspan="2">{{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</td>
<td><b>Receipt Number</b></td>
<td colspan="2">{{ $receipt_number }}</td>
</tr>
</table>
<table class="table table-bordered" id="receipt_table">
<thead>
<th style="width: 60%"><b>Description</b></th>
<th style="width: 20%"><b>Amount</b></th>
</thead>
<tbody>
<tr>
<td>Comment</td>
<td>{{ $comment }}</td>
</tr>
<tr>
<td>Expected Amount</td>
<td>{{ ugandan_shillings($amount_owed) }}</td>
</tr>
<tr>
<td>Amount Paid</td>
<td>{{ ugandan_shillings($amount_paid) }}</td>
</tr>
<tr>
<td>Balance</td>
<td>{{ ugandan_shillings($balance) }}</td>
</tr>
@if(count($payment_methods) > 0)
<tr><td colspan="2"></td></tr>
@foreach($payment_methods as $key => $value)
<tr>
<td><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
</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">Printed On {{ date(" d M Y h:ia") }} By {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</i>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,323 @@
@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/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">Receive Debtor Payments</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="/finance_reports">Reports Dashboard</a></li>
<li class="active">Debtors</li>
</ol>
</div>
</div>
@php
$back_date = \Streamline\Models\HospitalInformation::first()->pluck('back_date');
@endphp
<div class="row">
<div class="col-md-8">
<div class="row">
<div class="panel panel-default col-md-12">
<div class="panel-body panel-primary">
<h2><strong>Debtor Payment</strong></h2>
<br/>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>Patient Number</th>
<th>Patient Name</th>
<th>Amount To Pay</th>
<th>Amount Paid</th>
</tr>
</thead>
<tbody>
@if(!is_null($debts))
<td>{{ get_name($debts->patient_id, 'id', 'number', 'patients') }}</td>
<td>{{ get_full_name($debts->patient_id, 'id', 'first_name', 'last_name', 'patients') }}</td>
<td>{{ ugandan_shillings($debts->balance) }}
<td>{{ ugandan_shillings($debts->amount_paid_off) }}</td>
@else
<td colspan="3"><span style="color: red;">RECORDS NOT FOUND</span></td>
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="panel panel-default col-md-12">
<div class="panel-body panel-primary">
<h2><strong>Payment History</strong></h2>
<br/>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>Balance</th>
<th>Amount Paid</th>
<th>Receipt No.</th>
<th>Date</th>
<th>Staff In Charge</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
@foreach($debt_payments as $debt_payment)
<tr>
<td>{{ ugandan_shillings($debt_payment->balance) }}</td>
<td>{{ ugandan_shillings($debt_payment->amount_paid) }}</td>
<td>{{ $debt_payment->receipt_number }}</td>
<td>{{ streamline_date($debt_payment->date_paid) }}</td>
<td>{{ get_full_name($debt_payment->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>{{ $debt_payment->comment }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body panel-primary">
<?php $amount_owed = !is_null($debts->balance_remaining) ? $debts->balance_remaining : $debts->balance ?>
@if($amount_owed < 1)
<h3 style="color: green">Payment has been made in full</h3>
@else
{{ Form::open(['route' => 'patient_debtors.process_debtor_payment', 'data-toggle' => 'validator']) }}
<h3>Make Payment</h3>
<div class="form-group">
{{ Form::label('amount_label', 'Expected Amount') }}
<div class="input-group">
{{ Form::number('amount_owed', $amount_owed,
['class'=>'form-control compulsory required', 'readonly', 'id'=>'amount_owed']) }}
</div>
</div>
<div class="form-group">
{{ Form::label('amount_paid_label', 'Amount Paid') }}
<div class="input-group">
{{ Form::number('amount_paid', 0, ['class'=>'form-control compulsory', 'id'=>'amount_paid', 'required']) }}
</div>
</div>
<div class="row">
<div class="col-md-6">
<label class="label label-primary" id="add_payment_method_button" onclick="add_payment_method();">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','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_label', 'Balance Remaining on Debt') }}
<div class="input-group">
{{ Form::number('balance', '', ['class'=>'form-control compulsory required', 'readonly', 'id'=>'balance', 'required']) }}
</div>
</div>
<div class="form-group">
{{ Form::label('date_label', 'Date of Payment') }}
<div class="input-group">
{{ Form::text('date', date('d-m-Y'), ['class'=>'form-control compulsory','readonly', 'id'=>'date', 'required']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
<div class="form-group">
{{ Form::label('comment_label', 'Comment') }}
<div class="input-group">
{{ Form::textarea('comment','', ['class'=>'form-control compulsory', 'id'=>'comment', 'required']) }}
</div>
</div>
{{ Form::hidden('patient_id', $debts->patient_id, ['id' => 'patient_id']) }}
{{ Form::hidden('debt_id', $debts->id, ['id' => 'debt_id']) }}
<a class="btn btn-danger" id="write_off_btn">Write Off Debt</a>
{{ Form::submit('Receive Payment', ['class'=>'btn btn-success pull-right', 'onclick'=>"return confirm('Are you sure you want to complete this payment')"]) }}
{{ Form::close() }}
@endif
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal" id="write_off_modal" tabindex="-1" role="dialog" aria-labelledby="write_off_modal_label" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header text-center">
<h5 class="modal-title" id="write_off_modal_label"><b>Write Off Balance</b></h5>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Amount To Be Written Off</label>
<input id="amount_to_write_off" type="number" class="form-control">
</div>
<div class="form-group">
<label>Write Off Memo</label>
<textarea id="write_off_memo" type="number" rows="5" class="form-control"></textarea>
</div>
<div class="form-group">
<label>Expense Account</label>
{{ Form::select('expense_account', $expense_accounts, '', ['class'=>'form-control', 'id'=>'expense_account']) }}
</div>
<button class="btn btn-rounded btn-block btn-success" id="complete_write_off">Complete</button>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<!-- Date Picker Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script type="text/javascript">
$('#table').DataTable();
$('#write_off_btn').click(function() {
let amount_owed = $('#amount_owed').val();
$('#amount_to_write_off').val(amount_owed);
$('#write_off_modal').modal('show');
});
$('#complete_write_off').click(function() {
let amount = $('#amount_to_write_off').val();
let expense_account = $('#expense_account').val();
let write_off_memo = $('#write_off_memo').val();
let debt_id = $('#debt_id').val();
let patient_id = $('#patient_id').val();
let amount_owed = $('#amount_owed').val();
let balance = $('#balance').val();
if (amount === '') {
alert('Please Enter An Amount To Write Off.')
} else if (expense_account === '') {
alert('Please Select An Expense Account To Write Off To.')
} else if (write_off_memo === '') {
alert('Please Enter A Memo For This Write Off.')
} else {
$.ajax({
method: 'post',
url: '/patient_debtors/write_off_debts',
data: {
'amount': amount, 'debt_id': debt_id, 'amount_owed': amount_owed, 'patient_id': patient_id,
'expense_account': expense_account, 'write_off_memo': write_off_memo, 'balance': balance
},
success: function(response) {
if(!response.includes("not")) {
alert("Write off has been completed successfully");
window.location.href = '/patient_debtors/debtors';
} else {
alert("An error occurred. Please try again");
}
}
});
}
});
let min_days = <?php echo $back_date[0]; ?>;
var min_date = new Date();
min_date.setDate(min_date.getDate()-min_days);
$('#date').datepicker({
autoclose: true,
todayHighlight: true,
endDate: new Date(),
startDate: min_date,
format: 'dd-mm-yyyy'
});
$('#amount_paid').change(function (e) {
e.preventDefault();
let amount = $('#amount_owed').val();
let bal = amount - this.value;
if(bal < 0 ){
alert("Please Don't Exceed the Required Amount, Thank You.");
this.value = 0;
}else if(bal > 0 || bal === 0){
$('#balance').val(bal);
}
reset_payment_methods_amounts();
});
function add_payment_method() {
$('#payment_methods_div').show();
if ($('#cash_to_pay').val() == 0) {
$('#cash_to_pay').val( $('#amount_paid').val());
$('#original_cash_to_pay').val( $('#amount_paid').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( $('#amount_paid').val());
$('#original_cash_to_pay').val( $('#amount_paid').val());
$('.payment_methods_amount').each(function () {
$(this).val(0);
});
}
</script>
@endpush
@@ -0,0 +1,91 @@
<!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 Names</b></td>
<td>{{ get_full_name($patient_id, 'id', 'first_name', 'last_name', 'patients') }}</td>
<td><b>Patient Number</b></td>
<td>{{ get_name($patient_id, 'id', 'number', 'patients') }}</td>
<td><b>Patient Category</b></td>
<td>{{ get_name(get_name($patient_id, 'id', 'category_id', 'patients'), 'id', 'name', 'patient_categories') }}</td>
</tr>
</table>
@foreach($debt_payments as $debt_payment)
<table class="table table-bordered" id="receipt_table">
<tbody>
<tr>
<td><b>Amount Paid</b></td>
<td>{{ ugandan_shillings($debt_payment->amount_paid) }}</td>
<td><b>Balance</b></td>
<td>{{ ugandan_shillings($debt_payment->balance) }}</td>
</tr>
<tr>
<td><b>Comment</b></td>
<td>{{ $debt_payment->comment }}</td>
<td><b>Received By</b></td>
<td>{{ get_full_name($debt_payment->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
</tr>
<tr>
<td><b>Receipt Number</b></td>
<td>{{ $debt_payment->receipt_number }}</td>
<td><b>Received On</b></td>
<td>{{ streamline_date($debt_payment->date_paid) }}</td>
</tr>
</tbody>
</table>
<hr>
@endforeach
<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">Printed On {{ date(" d M Y h:ia") }} By {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</i>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,246 @@
@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/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/select2/select2.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">Guarantors</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> Home</a></li>
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> Finance Home</a></li>
<li><a href="{{ route('finance_reports.index') }}"><i class="fa fa-list"></i> Reports Home</a></li>
<li class="active">Guarantors</li>
</ol>
</div>
</div>
@include('flash::message')
<div class="row white-box">
{{ Form::open(['method'=>'post','route' => 'patient_debtors.staff_guarantors']) }}
<div class="col-md-4">
<div class="form-group">
{{ Form::label('staff_member', 'Select Guarantor') }}
<select class="form-control compulsory required" name="staff_member" id="staff_member" required>
<option value="">-- Select --</option>
<option value="ALL STAFF">ALL GUARANTORS</option>
@foreach($users as $item)
<option value="{{ $item->id }}">{{ $item->first_name. " ".$item->last_name }}</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
{{ Form::label('start_date', 'Start Date') }}
<div class="input-group">
{{ Form::text('start_date', '', ['class'=>'form-control compulsory required', 'readonly', 'id'=>'start_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
{{ Form::label('end_date', 'End Date') }}
<div class="input-group">
{{ Form::text('end_date', '', ['class'=>'form-control compulsory required', 'readonly', 'id'=>'end_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group" style="margin-top: 20px;">
{{ Form::submit('Submit', ['class'=>'btn btn-success pull-right']) }}
</div>
</div>
{{ Form::close() }}
</div>
<div class="white-box">
<h4> {!! $display ?? '' !!}</h4>
<br>
<br/>
<div class="table-responsive">
<table id="table" class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>Guarantor Name</th>
<th>Patient Name</th>
<th>Date Of Bill</th>
<th>Arrangement For Balance</th>
<th>Completion Date</th>
<th>Authorised By</th>
<th>Comment</th>
<th>Guarantor To Pay</th>
<th>Amount Paid</th>
<th>Balance</th>
<th></th>
<th></th>
</tr>
</thead>
@php
$sum_total_amount = 0;
$sum_amount_paid = 0;
$sum_balance = 0;
@endphp
@if(count($debts) > 0)
<tbody>
@foreach($debts as $debt)
<tr>
<td>
@php
$guarantor_ids_array = explode(",", $debt->staff_guarantor);
@endphp
<ul>
@if ($debt->guarantor_type == 1)
@for ($i = 0; $i < count($guarantor_ids_array); $i++)
<li>{{ get_full_name($guarantor_ids_array[$i], 'id', 'first_name', 'last_name', 'users') }}</li>
@endfor
@else
@for ($i = 0; $i < count($guarantor_ids_array); $i++)
<li>{{ get_full_name($guarantor_ids_array[$i], 'id', 'first_name', 'last_name', 'non_staff_guarantors') }}</li>
@endfor
@endif
</ul>
</td>
<td>{{ get_name($debt->patient_id, 'id', 'first_name', 'patients') }} {{ get_name($debt->patient_id, 'id', 'last_name', 'patients') }}</td>
<td>{{ streamline_date($debt->created_at) }}</td>
<td>{{ get_name($debt->debt_plan_arrangement, 'id', 'name', 'debt_plan_arrangements') }}</td>
<td>
@if (!is_null($debt->fourth_installment_date))
{{ streamline_date($debt->fourth_installment_date) }}
@elseif(!is_null($debt->third_installment_date))
{{ streamline_date($debt->third_installment_date) }}
@elseif(!is_null($debt->second_installment_date))
{{ streamline_date($debt->second_installment_date) }}
@elseif(!is_null($debt->first_installment_date))
{{ streamline_date($debt->first_installment_date) }}
@endif
</td>
<td>{{ get_full_name($debt->authorised_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>{{ $debt->comment ?? "N/A" }}</td>
<td>
{{ ugandan_shillings($debt->staff_guarantor_to_pay) }}
</td>
<td>
{{ ugandan_shillings($debt->amount_paid_off) }}
</td>
<td>
{{ ugandan_shillings($debt->balance_remaining) }}
</td>
<td><a class="btn btn-primary btn-sm btn-rounded" target="_blank" href="/patient_debtors/debt_plan_guarantor_agreement/{{ $debt->id }}">{{ __('patient_finance.print_guarantor_agreement') }}</a></td>
@php
$current_amount_paid = ($debt->amount_paid_off ?? 0);
$sum_total_amount += $debt->staff_guarantor_to_pay;
$sum_amount_paid += $current_amount_paid;
$sum_balance += $debt->balance_remaining ?? $debt->staff_guarantor_to_pay;
@endphp
<td>
@if($current_amount_paid == 0)
{{ Form::open(['method'=>'post', 'route'=>'patient_debtors.receive_debt_plan_payments_staff']) }}
{{ Form::hidden('debt_plan_id', $debt->id) }}
{{ Form::hidden('status', 'new') }}
{{ Form::submit('Receive Payment', ['class'=>'btn btn-success btn-sm btn-rounded']) }}
{{ Form::close() }}
@elseif ($current_amount_paid < $debt->staff_guarantor_to_pay)
{{ Form::open(['method'=>'post', 'route'=>'patient_debtors.receive_debt_plan_payments_staff']) }}
{{ Form::hidden('debt_plan_id', $debt->id) }}
{{ Form::hidden('status', 'update') }}
{{ Form::submit('Update Payment', ['class'=>'btn btn-warning btn-sm btn-rounded']) }}
{{ Form::close() }}
@elseif ($current_amount_paid == $debt->staff_guarantor_to_pay)
{{ Form::open(['method'=>'post', 'route'=>'patient_debtors.receive_debt_plan_payments_staff']) }}
{{ Form::hidden('debt_plan_id', $debt->id) }}
{{ Form::hidden('status', 'update') }}
{{ Form::submit('View Payments', ['class'=>'btn btn-primary btn-sm btn-rounded']) }}
{{ Form::close() }}
@endif
</td>
</tr>
@endforeach
</tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>Total</td>
<td>{{ ugandan_shillings($sum_total_amount) }}</td>
<td>{{ ugandan_shillings($sum_amount_paid) }}</td>
<td>{{ ugandan_shillings($sum_balance) }}</td>
<td></td>
<td></td>
</tr>
@else
<td colspan="7"><span style="color: red;">RECORDS NOT FOUND</span></td>
@endif
</table>
</div>
</div>
@endsection
@push('scripts')
<!-- Date Picker Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
jQuery('#end_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
</script>
<script type="text/javascript">
jQuery('#start_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
</script>
<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/select2/select2.min.js') }}"></script>
<script>
$('#staff_member').select2({
placeholder: "-- select --"
});
</script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
"aoColumnDefs": [{
"aTargets": [2,3],
"defaultContent": "",
}]
});
</script>
@endpush