Files
streamline-emr/docker/streamline-src/Modules/Expenses/Resources/views/payments/bills/voucher.blade.php
T

293 lines
17 KiB
PHP
Executable File

@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('payments.bill_payments_voucher') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> {{ __('payments.home') }}</a></li>
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> {{ __('payments.finance_home') }}</a></li>
<li class="active"><i class="fa fa-credit-card"></i> {{ __('payments.payment_detail') }}</li>
</ol>
</div>
</div>
@include('flash::message')
<div class="row">
<div class="col-md-12 pull-right text-right">
<button class="btn btn-rounded" style="background-color: #03C03C; color: white;" id="print_btn"> <i class="fa fa-print"></i> {{ __('payments.print_payments_voucher') }}</button>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-12">
<div class="white-box" id="printableContent">
<div class="row">
<div class="col-md-6 text-left">
<address>
<img src="{{ asset($hospital_information->logo) }}" class="img-responsive">
<h3> &nbsp;<b class="text-danger">{{ $hospital_information->name }}</b></h3>
<p class="text-muted m-l-5">{{ $hospital_information->phone_number }}, {{ $hospital_information->email }},
<br/> {{ get_name($hospital_information->sub_county,'id', 'name', 'subcounties') }}, {{ get_name($hospital_information->district,'id', 'name', 'districts') }},
<br/> {{ $hospital_information->country }}.</p>
</address>
</div>
<br/>
</div>
<hr/>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<br/>
<table id="table" class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('payments.items') }}</th>
<th>{{ __('payments.vendor') }}</th>
<th>{{ __('payments.quantity') }}</th>
<th>{{ __('payments.unit_cost') }}</th>
<th>{{ __('payments.amount_paid') }}</th>
<th>{{ __('payments.paid_from_bank') }}</th>
<th>{{ __('payments.staff') }}</th>
<th>{{ __('payments.transaction_date') }}</th>
<th>{{ __('payments.record_date') }}</th>
@if(Auth::user()->can('delete-payment-record'))
<th>{{ __('payments.action') }}</th>
@endif
</tr>
</thead>
<tbody>
@php
$total = 0;
@endphp
@foreach($payments as $item)
<tr>
<td>
@php
$bill = \Streamline\Models\HospitalBill::find($item->bill_id);
$items = explode(',', $bill->item_ids);
$quantities = explode(',', $bill->item_quantities);
@endphp
@if($bill->bill_type == 'DRU')
@for($x = 0; $x < count($items); $x++)
{{ get_name($items[$x], 'id', 'name', 'drugs') }} <br/>
@endfor
@elseif($bill->bill_type == 'SUN')
@for($x = 0; $x < count($items); $x++)
{{ get_name($items[$x], 'id', 'name', 'sundries') }} <br/>
@endfor
@elseif($bill->bill_type == 'DEN')
@for($x = 0; $x < count($items); $x++)
{{ get_name($items[$x], 'id', 'name', 'dentals') }} <br/>
@endfor
@elseif($bill->bill_type == 'RAD')
@for($x = 0; $x < count($items); $x++)
{{ get_name($items[$x], 'id', 'name', 'radiologies') }} <br/>
@endfor
@elseif($bill->bill_type == 'LAB')
@for($x = 0; $x < count($items); $x++)
{{ get_name($items[$x], 'id', 'name', 'labs') }} <br/>
@endfor
@elseif($bill->bill_type == 'GEN')
@for($x = 0; $x < count($items); $x++)
{{ get_name($items[$x], 'id', 'name', 'general_items') }} <br/>
@endfor
@elseif($bill->bill_type == 'PAY')
@for($x = 0; $x < count($items); $x++)
{{ get_name($items[$x], 'id', 'name', 'payment_items') }} <br/>
@endfor
@elseif($bill->bill_type == 'EYE')
@for($x = 0; $x < count($items); $x++)
{{ get_name($items[$x], 'id', 'name', 'eye_glasses') }} <br/>
@endfor
@endif
</td>
<td>{{ get_name($item->vendor, 'id', 'name', 'suppliers') }}</td>
<td>
@for($x = 0; $x < count($items); $x++)
{{ $quantities[$x]." units" }} <br/>
@endfor
</td>
<td>
@if($bill->bill_type == 'DRU')
@for($x = 0; $x < count($items); $x++)
{{ ugandan_shillings(get_name($items[$x], 'id', 'cost_price', 'drugs')) }} <br/>
@endfor
@elseif($bill->bill_type == 'SUN')
@for($x = 0; $x < count($items); $x++)
{{ ugandan_shillings(get_name($items[$x], 'id', 'cost_price', 'sundries')) }} <br/>
@endfor
@elseif($bill->bill_type == 'DEN')
@for($x = 0; $x < count($items); $x++)
{{ ugandan_shillings(get_name($items[$x], 'id', 'cost_price', 'dentals')) }} <br/>
@endfor
@elseif($bill->bill_type == 'RAD')
@for($x = 0; $x < count($items); $x++)
{{ ugandan_shillings(get_name($items[$x], 'id', 'cost_price', 'radiologies')) }} <br/>
@endfor
@elseif($bill->bill_type == 'LAB')
@for($x = 0; $x < count($items); $x++)
{{ ugandan_shillings(get_name($items[$x], 'id', 'cost_price', 'labs')) }} <br/>
@endfor
@elseif($bill->bill_type == 'GEN')
@for($x = 0; $x < count($items); $x++)
{{ ugandan_shillings(get_name($items[$x], 'id', 'cost_price', 'general_items')) }} <br/>
@endfor
@elseif($bill->bill_type == 'PAY')
@for($x = 0; $x < count($items); $x++)
{{ ugandan_shillings(get_name($items[$x], 'id', 'unit_cost', 'payment_items')) }} <br/>
@endfor
@elseif($bill->bill_type == 'EYE')
@for($x = 0; $x < count($items); $x++)
{{ ugandan_shillings(get_name($items[$x], 'id', 'buying_price', 'eye_glasses')) }} <br/>
@endfor
@endif
</td>
<td>{{ ugandan_shillings($item->amount) }}</td>
<td>{{ get_name($item->account_id, 'id', 'name', 'chart_of_accounts') }}</td>
<td>{{ get_full_name($item->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>{{ streamline_date($item->expense_date) }}</td>
<td>{{ streamline_date_time_short($item->created_at) }}</td>
@if(Auth::user()->can('delete-payment-record'))
<td>
@if(is_payment_transaction_reconciled($item->id) == false)
<button class="btn btn-sm btn-rounded btn-danger" id="bank_{{ $item->id }}" onclick="undo_payment('{{ $item->transaction_id }}')"><i class="fa fa-undo"></i> {{ __('payments.undo_payment') }}</button>
@else
<a data-toggle="modal" data-target="#reconciledBillModal" class="btn btn-sm btn-rounded btn-danger" style="font-size: 12px; background-color:rgb(219 162 174)">{{ __('payments.undo_payment') }}</a>
@endif
</td>
@endif
</tr>
@php
$total += $item->amount;
@endphp
@endforeach
</tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td><strong>{{ __('payments.total') }}</strong></td>
<td>{{ ugandan_shillings($total) }}</td>
<td></td>
<td></td>
<td></td>
<td></td>
@if(Auth::user()->can('delete-payment-record'))
<td></td>
@endif
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="reconciledBillModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<span class="label label-info">Please note</span>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>
<div class="modal-body">
<div class="row" style="padding: 10px;">
<div class="col-sm-12">
<h3>{{ __('payments.payment_already_reconciled_message') }}</h3>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">{{ __('payments.close') }}</button>
</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/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">
$('.table').DataTable({
dom: 'Bfrtip',
});
</script>
<script type="text/javascript">
function printElementContent(elem,title){
var mywindow = window.open('', 'PRINT', 'height=400,width=600');
var css = '<link href="/elite/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">';
mywindow.document.write('<html><head><title></title>');
mywindow.document.write('</head><body >');
mywindow.document.write(css);
mywindow.document.write('<center><h3>' + title + '</h3></center>');
mywindow.document.write(document.getElementById(elem).innerHTML);
mywindow.document.write('</body></html>');
mywindow.document.close(); // necessary for IE >= 10
//mywindow.focus(); // necessary for IE >= 10*/
setTimeout(function () {
mywindow.focus();
mywindow.print();
mywindow.remove();
}, 500);
return true;
}
$("#print_btn").click(function(e){ var i = 0;
printElementContent('printableContent','Payments Voucher'); console.log(i++)
});
function undo_payment(payment_id) {
var check = confirm('Are You Sure You Want To Undo This Payment?');
if (check) {
$.ajax({
type: 'POST',
url: '/payments/undo_bill_payment/' + payment_id,
success: function(result) {
if (result == 'success') {
alert('This payment has been undone!');
location.reload();
return false;
} else {
alert('Failed to undo payment');
}
},
error: function(error) {
console.log(error)
alert('Something Went Wrong, Please Contact Support.')
}
});
}
}
</script>
@endpush