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,181 @@
@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>
<div class="row">
<div class="col-sm-12">
@include('patient_discounts::family_accounts.menu')
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
<div class="row">
<div class="col-md-4">
{{ Form::open(['method'=>'post','route'=>'family_accounts.store_family_deposit']) }}
<div class="form-group">
{{ Form::label('family_head',__('family_accounts.family_head')) }}
{{ Form::text('family_head', get_full_name($family_account_details->family_head_id, "id", "first_name", "last_name", "patients"), ['class' => 'form-control col-sm-12 compulsory', 'readonly' => 'true']) }}
</div>
{{ Form::hidden('family_account_id', $family_account_details->id) }}
<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 class="help-block with-errors"></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('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 class="form-group">
{{ Form::label('deposited_by', __('family_accounts.deposited_by')) }}
{{ Form::text('deposited_by', '', ['class'=>'form-control required compulsory', 'required', 'id'=>'deposit_by']) }}
</div>
<div>
{{ Form::submit(__('family_accounts.save'),['class'=>'btn btn-success'])}}
{{ Form::reset(__('family_accounts.cancel'),['type'=>'reset','class'=>'btn btn-default'])}}
</div>
{{ Form::close() }}
</div>
<div class="col-md-8">
<h3>{{ __('family_accounts.family_members') }}</h3>
@php
$family_members_array = explode(",", $family_account_details->family_members_ids);
@endphp
<ol>
@for($i = 0; $i < count($family_members_array); $i++)
<li>
<a href="patients/{{ $family_members_array[$i] }}">{{ get_full_name($family_members_array[$i], "id", "first_name", "last_name", "patients") }}</a>
<br>
<strong>{{ __('family_accounts.number') }} </strong>{{ get_name($family_members_array[$i], "id", "number","patients") }}
<br>
<strong>{{ __('family_accounts.contact') }}</strong>{{ get_name($family_members_array[$i], "id", "phone","patients") }}<br>
<strong>{{ __('family_accounts.residence') }}</strong>{{ patient_residence($family_members_array[$i]) }}
</li>
@endfor
</ol>
</div>
</div>
</div>
</div>
</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,96 @@
@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">Cancel Family Account Deposit</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="/finance">Finance</a></li>
<li><a href="/family_accounts_deposits_report">Family Deposits</a></li>
<li class="active">Cancel Family Deposit</li>
</ol>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-body">
<div class="table-responsive">
<table id="table" class="table table-striped table-bordered">
<thead>
<tr>
<th>Family Members</th>
</tr>
</thead>
<tbody>
@php
$members_array = explode(",", $family_account->family_members_ids);
@endphp
@for($i=0; $i < count($members_array); $i++)
<tr>
<th><a href="patients/{{ $members_array[$i] }}">{{ get_full_name($members_array[$i], "id", "first_name", "last_name", "patients") }} ({{ get_name($members_array[$i], "id", "number", "patients") }})</a></th>
</tr>
@endfor
</tbody>
</table>
</div>
</div>
</div>
</div>
{{--<div class="col-md-1"></div>--}}
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-body">
{{ Form::open(['method'=>'post','url'=>'family_account_deposit_cancellation']) }}
{{ Form::hidden('deposit_id', $family_deposit->id) }}
<div class="form-group">
{{ Form::label('deposited_by', 'Deposited By') }}
{{ Form::text('deposited_by', $family_deposit->deposited_by, ['class'=>'form-control compulsory', 'readonly', ]) }}
</div>
<div class="form-group">
{{ Form::label('deposited_amount', 'Deposited Amount') }}
{{ Form::text('deposited_amount', ugandan_shillings($family_deposit->deposit_amount), ['class'=>'form-control compulsory', 'readonly', ]) }}
</div>
<div>
<div class="form-group">
{{ Form::label('received_by', "Received By") }}
{{ Form::text('received_by', get_full_name($family_deposit->created_by, "id", "first_name", "last_name", "users"), ['class'=>'form-control compulsory', 'readonly']) }}
</div>
</div>
<div>
<div class="form-group">
{{ Form::label('reason_name', 'Reason For Cancellation') }}
{{ Form::textarea('reason', '', ['class'=>'form-control compulsory required', 'rows'=>'5', 'cols' => '10', 'required']) }}
</div>
</div>
<div class="form-group">
{{ Form::submit('Cancel Deposit', ['class' => 'btn btn-success']) }}
</div>
{{ Form::close() }}
</div>
</div>
</div>
</div>
</div>
@endsection
@@ -0,0 +1,180 @@
@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.create_family_account') }}</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.create_family_account') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patient_discounts::family_accounts.menu')
</div>
</div>
<div class="white-box">
@include('flash::message')
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="row">
<div class="col-md-6">
{{ Form::open(['method'=>'post','route'=>'family_accounts.store', 'id' => 'family_account_form']) }}
<div class="form-group">
{{ Form::label('family_head', __('family_accounts.family_head')) }}
<select class="patient_name form-control" name="family_head" id="family_head_name"></select>
</div>
<div class="form-group">
{{ Form::label('family_members',__('family_accounts.family_members')) }}
<select class="patient_name form-control" name="family_members[]" id="patient_name" multiple="true"></select>
</div>
<div class="form-group">
{{ Form::label('deposit_amount', __('family_accounts.amount_deposited')) }}
{{ Form::number('deposit_amount',0,['class' => 'form-control', 'id' => 'deposit_amount']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group" id="initial_div" style="display: none;">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
<span>Is this amount part of the opening family account amounts on Stre@mline. This will affect Equity in case it is</span>
</div>
{{ Form::label('is_it_opening_family_amount', 'Is it the opening balance on Stre@mline for this family') }}
{{ Form::select('is_it_opening_family_amount', [0 => 'No', 1 => 'Yes'], null, ['class' => 'form-control compulsory','required', 'id' => 'is_it_opening_amt']) }}
<br>
<div class="form-group" id="opening_account_div" style="display: none;">
{{ Form::label('opening_account_id', 'Opening Account') }}
{{ Form::select('opening_account_id', $chart_of_accounts, null, ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="input-group" id="opening_date_div" style="display: none;">
<input type="text" name="opening_amount_date" placeholder="Opening amount deposit date" class="form-control col-sm-12" autocomplete="off" id="opening_amount_date">
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
<div class="form-group">
{{ Form::label('deposited_by', __('family_accounts.deposited_by')) }}
{{ Form::text('deposited_by', '', ['class'=>'form-control', 'id'=>'deposit_by']) }}
</div>
@if (Auth::user()->can('add-family-account-credit-limit'))
<div class="form-group">
{{ Form::label('credit_limit', __('family_accounts.credit_limit')) }}
{{ Form::number('credit_limit',0,['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
@endif
<div>
{{ Form::submit(__('family_accounts.save'),['class'=>'btn btn-success', 'id' => 'submitBtn'])}}
{{ Form::reset(__('family_accounts.cancel'),['type'=>'reset','class'=>'btn btn-default'])}}
</div>
{{ Form::close() }}
</div>
</div>
</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_amount').change(function(e) {
//if ($('#deposit_amount').val() > 0) {
$('#initial_div').show();
//}
});
$('#is_it_opening_amt').click(function(e){
var outcome = $("#is_it_opening_amt :selected").val();
if (outcome == 1) { //1=yes
$('#opening_account_div').show();
$('#opening_date_div').show();
$('#opening_account_id').attr("required", "true");
}
else{
$('#opening_account_div').hide();
$('#opening_date_div').hide();
$('#opening_account_id').removeAttr("required");
}
});
$('.patient_name').select2({
placeholder: "Search name",
ajax: {
url: '/search_family_account_name',
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.first_name + " " + item.last_name+ " - " + item.number+ " (" + item.phone + ")",
id: item.id
}
})
};
},
cache: true
}
});
$('#opening_amount_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
$('#submitBtn').click(function(e){
let deposit_amount = $('#deposit_amount').val();
let is_it_opening_balance = $('#is_it_opening_amt :selected').val();
if((deposit_amount < 0) && is_it_opening_balance == 0){
alert('Deposited amount can not be negative if it is not the opening balance of the family');
e.preventDefault();
}
});
});
</script>
@endpush
@@ -0,0 +1,161 @@
@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>{{ __('family_accounts.family_account_deposit_receipt') }}</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">{{ __('family_accounts.family_account_deposit_receipt') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patient_discounts::family_accounts.menu')
</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">
@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 }} @if(str_contains(url()->current(), 'family_deposit_reprint'))<span style="color:maroon; font-weight:900">(Reprinted Receipt)</span>@endif</span><br>
<span class="receipt-label"><b>{{ __('family_accounts.deposit_date') }}</b> {{ streamline_date($new_family_deposit->deposit_date) }}</span><br>
</p>
@php
$family_account_details = \Streamline\Models\FamilyAccount::find($new_family_deposit->family_account_id);
$family_head_name = get_full_name($family_account_details->family_head_id, "id", "first_name", "last_name", "patients");
@endphp
@if(should_members_display_on_deposit_receipt())
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('family_accounts.family_members') }}</b></th>
<th style="width: 20%"><b>{{ __('family_accounts.amount_deposited') }}</b></th>
</thead>
<tbody>
<tr>
<td><ol>
@for($i = 0; $i < count($family_members_array); $i++)
<li>
{{ get_full_name($family_members_array[$i], "id", "first_name", "last_name", "patients") }}({{ get_name($family_members_array[$i], "id", "number","patients") }})
</li>
@endfor
</ol></td>
<td><b>{{ ugandan_shillings($new_family_deposit->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 {{ ($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>
@else
<div>
<table class="table" id="receipt_table">
<tbody>
<tr>
<th>Family Head: </th>
<td>{{$family_head_name}}</td>
</tr>
<tr>
<th>Amount</th>
<td>
<b>{{ ugandan_shillings($new_family_deposit->deposit_amount) }}</b>
</td>
</tr>
</tbody>
</table>
</div>
@endif
</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,239 @@
@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">{{ __('family_accounts.family_account_deposit_report') }}</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.family_account_deposit_report') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patient_discounts::family_accounts.menu')
</div>
</div>
<div class="white-box">
@include('flash::message')
{{ Form::open(['url' => 'family_accounts_deposits_report', 'method' => 'ANY']) }}
<div class="row">
<div class="col-md-2">
<div class="form-group">
{{ Form::label('family_account_id', __('family_accounts.family_of')) }}
{{ Form::select('family_account_id', $family_accounts_array, '', ['class' => 'form-control compulsory']) }}
</div>
</div>
<div class="col-md-2">
<div class="form-group">
{{ Form::label('staff_member', 'Staff Member') }}
{{ Form::select('staff_member', $staff_members, null, ['class' => 'form-control', 'id' => 'staff_member', 'required']) }}
</div>
</div>
<div class="col-md-2">
<div class="form-group" id="searchby">
{{ Form::label('search_by', __('family_accounts.date')) }}
{{ Form::select('search_by', ['0'=>'Today','1'=>'Yesterday','2'=>'Custom Date','3'=>'Custom Range'], '', ['class' => 'form-control','id'=>'search_by', 'required']) }}
</div>
</div>
<div class="col-md-2" id="start_date_div" style="display: none">
<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'=>'start_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="col-md-2" id="end_date_div" style="display: none">
<div class="form-group">
{{ Form::label('end_date', __('family_accounts.to')) }}
<div class="input-group">
{{ Form::text('end_date','',['class' => 'form-control compulsory','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="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($search_text != "")
<h4><label class="label label-info">{{ $search_text }}</label></h4>
<br>
@endif
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>{{ __('family_accounts.family_head') }}</th>
<th>{{ __('family_accounts.total_deposits') }}</th>
<th>Received By</th>
<th>Deposited By</th>
<th>Deposit Date</th>
<th>Transaction Date</th>
<th colspan="2">{{ __('family_accounts.action') }}</th>
</tr>
</thead>
<tbody>
@php $counter = 1; $total_family_deposits = 0; @endphp
@foreach($family_deposits as $deposit)
<tr>
<td>{{ $counter }}</td>
@php $family_head_id = get_name($deposit->family_account_id, "id", "family_head_id", "family_accounts") @endphp
<td>
{{ get_full_name($family_head_id, "id", "first_name", "last_name", "patients") }} ({{ get_name($family_head_id, "id", "number","patients") }})
</td>
<td>
{{ ugandan_shillings($deposit->deposit_amount) }}
@php $total_family_deposits += $deposit->deposit_amount; @endphp
</td>
<td>{{ $deposit->user_first_name . " " . $deposit->user_last_name }}</td>
<td>{{ $deposit->deposited_by }}</td>
<td>{{ $deposit->deposit_date }}</td>
<td>{{ streamline_date_time($deposit->created_at) }}</td>
<td>
@if(Auth::user()->can('cancel-family-account-deposit') && $deposit->is_opening_amount != 1 && is_null($deposit->received))
{{ Form::open(['url'=>'family_deposit_cancellation_reason']) }}
{{ Form::hidden('deposit_id', $deposit->id) }}
{{ Form::submit('Cancel Deposit', ['class' => 'btn btn-danger btn-sm', 'onclick' => 'return confirm("Are you sure you want to cancel this family deposit?")']) }}
{{ Form::close() }}
@endif
</td>
<td>
<a href="/family_accounts/{{ $deposit->family_account_id }}/statement/" class="btn btn-primary btn-xs"><i class="fa fa-book"></i> Statement</a>
<br>
<a href="/family_deposit_reprint/{{ $deposit->id }}" class="btn btn-info btn-xs btn-rounded">Reprint</a>
</td>
</tr>
@php $counter++; @endphp
@endforeach
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td><strong>{{ __('family_accounts.total') }} Amount Deposited</strong></td>
<td><strong>{{ ugandan_shillings($total_family_deposits) }}</strong></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
</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>
$('#start_date,#end_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
$('#search_by').change(function () {
if($(this).val() == 2){
$("#end_date_div").hide();
$("#start_date_div").show();
} else if($(this).val() == 3){
$("#end_date_div").show();
$("#start_date_div").show();
} else {
$("#end_date_div").hide();
$("#start_date_div").hide();
}
});
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy',
{ extend: 'csv',
message: 'FAMILY CONSUMPTION'
},
{ extend: 'excel',
message: 'FAMILY CONSUMPTION',
exportOptions: {
columns: [ 0, 1, 2, 4 ]
},
sheetName: 'FAMILY CONSUMPTION'
},
{ extend: 'pdf',
message: 'LIST OF DRUGS',
orientation: 'landscape',
pageSize: 'LETTER',
exportOptions: {
columns: [ 0, 1, 2, 4 ]
},
customize: function(doc) {
doc.defaultStyle.fontSize = 10;
}
},
{ extend: 'print',
message: 'LIST OF DRUGS',
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');
}
}
]
});
</script>
@endpush
@@ -0,0 +1,181 @@
@extends('layouts.main')
@push('styles')
<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.edit_family_account') }}</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.edit_family_account') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patient_discounts::family_accounts.menu')
</div>
</div>
<div class="white-box">
@include('flash::message')
<div class="row">
<div class="col-md-6">
{{ Form::model($family_account, ['method' => 'PUT', 'route' => ['family_accounts.update',$family_account], 'data-toggle' => 'validator']) }}
<div class="form-group">
{{ Form::label('family_head',__('family_accounts.family_head')) }}
<select class="patient_name form-control" name="family_head" id="family_head_name">
<option value="{{ $family_head_id }}">{{ $family_head_name }}</option>
</select>
</div>
<div class="form-group">
{{ Form::label('family_members',__('family_accounts.family_members')) }}
<select class="patient_name form-control" name="family_members[]" multiple="true">
@foreach($family_members_array as $family_member)
<option value="{{ $family_member }}" selected>{{ get_full_name($family_member, 'id', 'first_name', 'last_name', 'patients') }}</option>
@endforeach
</select>
</div>
<div class="form-group">
{{ Form::label('current_balance',__('family_accounts.current_balance')) }}
{{ Form::number('current_balance', $current_balance,['class' => 'form-control', 'readonly' => 'true']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('opening_amount',__('family_accounts.opening_amount')) }}
{{ Form::number('opening_amount', $family_account->opening_amount,['class' => 'form-control','id' => 'opening_amount']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group" id="initial_div" @if(is_null($family_account->opening_account_id)) style="display: none;" @endif>
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
<span>
Select affected <b>equity account</b> if the opening amount is the opening balance of this family on Stre@mline
</span>
</div>
{{ Form::label('is_it_opening_family_amount', 'Is opening amount the opening balance on Stre@mline for this family') }}
{{ Form::select('is_it_opening_family_amount', [1 => 'Yes', 0 => 'No'], is_null($family_account->opening_account_id) ? null : 1, ['class' => 'form-control compulsory','required', 'id' => 'is_it_opening_amt']) }}
<br>
<div class="form-group" id="opening_account_div" @if(is_null($family_account->opening_account_id)) style="display: none;" @endif>
{{ Form::label('opening_account_id', 'Opening Account') }}
{{ Form::select('opening_account_id', $chart_of_accounts, $family_account->opening_account_id, ['class' => 'form-control opening_account_id']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group" @if(is_null($family_account->opening_account_id)) style="display: none;" @endif>
{{ Form::label('opening_account_date', 'Opening Amount Date') }}
<div class="input-group" id="opening_date_div" @if(is_null($family_account->opening_account_id)) style="display: none;" @endif>
<input type="text" name="opening_amount_date" value="{{ $family_account->opening_amount_date}}" placeholder="Opening amount deposit date" class="form-control col-sm-12" id="opening_amount_date">
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
<br>
</div>
<div class="form-group">
{{ Form::label('deposited_by', __('family_accounts.deposited_by')) }}
{{ Form::text('deposited_by', $opening_deposit_record ? $opening_deposit_record->deposited_by : '', ['class'=>'form-control', 'id'=>'deposit_by']) }}
</div>
</div>
@if (Auth::user()->can('add-family-account-credit-limit'))
<div class="form-group">
{{ Form::label('credit_limit', __('family_accounts.credit_limit')) }}
{{ Form::number('credit_limit',$family_account->credit_limit,['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
@endif
<div>
{{ Form::submit(__('family_accounts.save'),['class'=>'btn btn-success'])}}
{{ Form::reset(__('family_accounts.cancel'),['type'=>'reset','class'=>'btn btn-default'])}}
</div>
{{ Form::close() }}
</div>
</div>
</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');
$('#opening_amount').change(function(e) {
if ($('#opening_amount').val() > 0) {
$('#initial_div').show();
$('#opening_account_div').show();
$('#opening_date_div').show();
$('#opening_account_id').attr("required", "true");
}
});
$('#is_it_opening_amt').click(function(e){
var outcome = $("#is_it_opening_amt :selected").val();
if (outcome == 1) { //1=yes
$('#opening_account_div').show();
$('#opening_date_div').show();
$('#opening_account_id').attr("required", "true");
}
else{
$('#opening_account_div').hide();
$('#opening_date_div').hide();
$('#opening_account_id').removeAttr("required");
}
});
$('.patient_name').select2({
placeholder: "Search name",
ajax: {
url: '/search_family_account_name',
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.first_name + " " + item.last_name+ " - " + item.number+ " (" + item.phone + ")",
id: item.id
}
})
};
},
cache: true
}
});
$('#opening_amount_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
});
</script>
@endpush
@@ -0,0 +1,299 @@
@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">{{ __('family_accounts.family_account_consumption_report') }}</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.family_account_consumption_report') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patient_discounts::family_accounts.menu')
</div>
</div>
<div class="white-box">
@include('flash::message')
{{ Form::open(['url' => 'family_accounts_consumption_report', 'method' => 'ANY']) }}
<div class="row">
<div class="col-md-2">
<div class="form-group">
{{ Form::label('family_account_id', __('family_accounts.family_of')) }}
{{ Form::select('family_account_id', $family_accounts_array, '', ['class' => 'form-control compulsory']) }}
</div>
</div>
<div class="col-md-2">
<div class="form-group">
{{ Form::label('staff_member', 'Staff Member') }}
{{ Form::select('staff_member', $staff_members, null, ['class' => 'form-control', 'id' => 'staff_member', 'required']) }}
</div>
</div>
<div class="col-md-2">
<div class="form-group" id="searchby">
{{ Form::label('search_by', __('family_accounts.date')) }}
{{ Form::select('search_by', ['0'=>'Today','1'=>'Yesterday','2'=>'Custom Date','3'=>'Custom Range'], '', ['class' => 'form-control','id'=>'search_by', 'required']) }}
</div>
</div>
<div class="col-md-2" id="start_date_div" style="display: none">
<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'=>'start_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="col-md-2" id="end_date_div" style="display: none">
<div class="form-group">
{{ Form::label('end_date', __('family_accounts.to')) }}
<div class="input-group">
{{ Form::text('end_date','',['class' => 'form-control compulsory','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="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($search_text != "")
<h4><label class="label label-info">{{ $search_text }}</label></h4>
<br>
@endif
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>Patient Information</th>
<th>{{ __('family_accounts.family_head') }}</th>
<th>{{ __('family_accounts.reason') }}</th>
<th>{{ __('family_accounts.amount_consumed') }}</th>
<th>Received By</th>
<th>Receipt Number</th>
<th>{{ __('family_accounts.date') }}</th>
<th>{{ __('family_accounts.action') }}</th>
</tr>
</thead>
<tbody>
@php $counter = 1; $total_consumptions = 0; @endphp
@foreach($family_consumptions as $family_consumption)
@php
$expenditure_type = $family_consumption->expenditure_tag;
$items_received_array = [];
if (!is_null($family_consumption->receipt_number)) {
$filters = ['receipt_number' => $family_consumption->receipt_number];
} else {
$filters = ['patient_id' => $family_consumption->patient_id, 'episode_id' => $family_consumption->episode_id];
}
if($expenditure_type == "Services"){
$service_deposit_record = \Illuminate\Support\Facades\DB::table('service_deposits')->where($filters)->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($expenditure_type == "Treatment"){
$treatment_deposit_record = \Illuminate\Support\Facades\DB::table('treatment_deposits')->where($filters)->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($expenditure_type == "Sundries"){
$sundries_deposit_record = \Illuminate\Support\Facades\DB::table('sundries_deposits')->where($filters)->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($expenditure_type == "Investigations"){
$investigation_deposit_record = \Illuminate\Support\Facades\DB::table('investigation_deposits')->where($filters)->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($expenditure_type == "Procedures"){
$procedure_deposit_record = \Illuminate\Support\Facades\DB::table('procedure_deposits')->where($filters)->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
<tr>
<td>{{ $counter }}</td>
<td>{{ $family_consumption->first_name . " " . $family_consumption->last_name }} ({{ $family_consumption->number }})</td>
@php $family_head_id = get_name($family_consumption->family_account_id, "id", "family_head_id", "family_accounts") @endphp
<td>
{{ get_full_name($family_head_id, "id", "first_name", "last_name", "patients") }} ({{ get_name($family_head_id, "id", "number","patients") }})
</td>
<td>
<strong>{{ $family_consumption->expenditure_tag == "Services" ? "Consultation / Services" : $family_consumption->expenditure_tag }}</strong>
<ol>
@for($j = 0; $j < count($items_received_array); $j++)
<li>{{ $items_received_array[$j] }}</li>
@endfor
</ol>
</td>
<td>
{{ ugandan_shillings($family_consumption->amount_consumed) }}
@php $total_consumptions += $family_consumption->amount_consumed; @endphp
</td>
<td>{{ $family_consumption->user_first_name . " " . $family_consumption->user_last_name }}</td>
<td>{{ $family_consumption->receipt_number }}</td>
<td>{{ streamline_date_time($family_consumption->created_at) }}</td>
<td>
<a href="/family_accounts/{{ $family_consumption->family_account_id }}/statement/" class="btn btn-primary btn-sm"><i class="fa fa-book"></i> Statement</a>
</td>
</tr>
@php $counter++; @endphp
@endforeach
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<td><strong>{{ __('family_accounts.total') }} Amount Consumed</strong></td>
<td><strong>{{ ugandan_shillings($total_consumptions) }}</strong></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
</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>
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy',
{ extend: 'csv',
message: 'FAMILY CONSUMPTION'
},
{ extend: 'excel',
message: 'FAMILY CONSUMPTION',
exportOptions: {
columns: [ 0, 1, 2, 4 ]
},
sheetName: 'FAMILY CONSUMPTION'
},
{ extend: 'pdf',
message: 'FAMILY CONSUMPTION',
orientation: 'landscape',
pageSize: 'LETTER',
exportOptions: {
columns: [ 0, 1, 2, 4 ]
},
customize: function(doc) {
doc.defaultStyle.fontSize = 10;
}
},
{ extend: 'print',
message: 'FAMILY CONSUMPTION',
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');
}
}
]
});
$('#start_date,#end_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
$('#search_by').change(function () {
if($(this).val() == 2){
$("#end_date_div").hide();
$("#start_date_div").show();
} else if($(this).val() == 3){
$("#end_date_div").show();
$("#start_date_div").show();
} else {
$("#end_date_div").hide();
$("#start_date_div").hide();
}
});
</script>
@endpush
@@ -0,0 +1,101 @@
@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">{{ __('family_accounts.activate_family_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><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.activate_family_accounts') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patient_discounts::family_accounts.menu')
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
<div class="row">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('family_accounts.family_head') }}</th>
<th>{{ __('family_accounts.family_members') }}</th>
<th>{{ __('family_accounts.action') }}</th>
</tr>
</thead>
<tbody>
@foreach($family_accounts as $family_account)
<tr>
{{-- <td>{{ get_full_name($family_account->family_head_id, "id", "first_name", "last_name", "patients") }} </td> --}}
<td>
{{ get_full_name($family_account->family_head_id, "id", "first_name", "last_name", "patients") }} ({{ get_name($family_account->family_head_id, "id", "number", "patients") }})
</td>
<td>
@php
$members_array = explode(",", $family_account->family_members_ids);
@endphp
<ol>
@for($i=0; $i < count($members_array); $i++)
<li>{{ get_full_name($members_array[$i], "id", "first_name", "last_name", "patients") }} ({{ get_name($members_array[$i], "id", "number", "patients") }})</li>
@endfor
</ol>
</td>
<td>
{{ Form::model($family_account->id ,['method' => 'POST', 'route' => ['family_accounts.activate', $family_account->id]]) }}
<button type="submit" class="btn btn-warning" onclick="return confirm('<?php echo __('Are you sure ?');?>')"><i class="fa fa-check"></i> {{ __('family_accounts.activate') }}</button>
{{ Form::close() }}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</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>
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
</script>
@endpush
@@ -0,0 +1,284 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<link href="{{ asset('elite/bower_components/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">{{ __('family_accounts.family_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><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.view_family_accounts') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patient_discounts::family_accounts.menu')
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
{{ Form::open(['url' => 'family_accounts_search', 'method' => 'ANY']) }}
<div class="row">
<div class="col-md-3">
<div class="form-group">
{{ Form::label('family_account_id', __('family_accounts.family_of')) }}
{{ Form::select('family_account_id', $family_accounts_array, '', ['class' => 'form-control compulsory', 'id' => 'family_account_id_dropdown']) }}
<div class="help-block with-errors"></div>
</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('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_consumption_of') }}<font color="blue">{{ streamline_date($reg_date) }}</font></h4>
@elseif(!is_null($start_date) && !is_null($end_date))
<h4>{{ __('family_accounts.showing_consumption_from') }}<font color="blue">{{ streamline_date($start_date) }}</font> {{ __('family_accounts.to') }} <font color="blue">{{ streamline_date($end_date) }}</font></h4>
@endif
<div class="row">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>{{ __('family_accounts.family_head') }}</th>
<th>{{ __('family_accounts.family_members') }}</th>
<th>{{ __('family_accounts.last_deposit') }}</th>
<th>{{ __('family_accounts.current_balance') }}</th>
<th>{{ __('family_accounts.opening_amount') }}</th>
<th>{{ __('family_accounts.credit_limit') }}</th>
<th colspan="4">{{ __('family_accounts.action') }}</th>
</tr>
</thead>
<tbody>
@php $counter = 1; $current_balance_total = 0; @endphp
@if(count($family_accounts) > 0)
@foreach($family_accounts as $family_account)
<tr>
<td>{{ $counter }}</td>
<td>
<a href="patients/{{ $family_account->family_head_id }}">{{ get_full_name($family_account->family_head_id, "id", "first_name", "last_name", "patients") }} ({{ get_name($family_account->family_head_id, "id", "number", "patients") }})</a>
</td>
<td>
@php
$members_array = explode(",", $family_account->family_members_ids);
@endphp
<ol>
@for($i=0; $i < count($members_array); $i++)
<li><a href="patients/{{ $members_array[$i] }}">{{ get_full_name($members_array[$i], "id", "first_name", "last_name", "patients") }} ({{ get_name($members_array[$i], "id", "number", "patients") }})</a></li>
@endfor
</ol>
</td>
<td>
@php
$family_deposit_record = \Streamline\Models\FamilyAccountDeposit::where('family_account_id', $family_account->id)->orderBy('id', 'desc')->get();
$last_deposit_amount = 0;
if(count($family_deposit_record) > 0){
$last_deposit_record_amount = $family_deposit_record->first();
$last_deposit_amount = $last_deposit_record_amount->deposit_amount;
}
@endphp
{{ ugandan_shillings($last_deposit_amount) }}<br>
<small>(Date: {{ get_name($family_account->id, "family_account_id", "created_at", "family_account_deposits") != "N/A" ? streamline_date(get_name($family_account->id, "family_account_id", "deposit_date", "family_account_deposits")) : "N/A" }})</small>
</td>
<td>
{{ is_numeric($family_account->current_balance) ? ugandan_shillings($family_account->current_balance) : "N/A" }}
@php $current_balance_total += $family_account->current_balance; @endphp
</td>
<td>
{{ is_numeric($family_account->opening_amount) ? ugandan_shillings($family_account->opening_amount) : "" }}
</td>
<td>
{{ is_numeric($family_account->credit_limit) ? ugandan_shillings($family_account->credit_limit) : "" }}
</td>
<td>
<a href="/family_accounts/{{ $family_account->id }}/edit/" class="btn btn-info btn-sm"><i class="fa fa-pencil"></i> {{ __('family_accounts.edit') }}</a>
</td>
<td>
{{ Form::open(['url' => 'family_accounts/add_deposit']) }}
{{ Form::hidden('family_account_id', $family_account->id) }}
{{ Form::submit('Add deposit', ['class' => 'btn btn-success btn-sm']) }}
{{ Form::close() }}
</td>
<td>
<a href="/family_accounts/{{ $family_account->id }}/statement/" class="btn btn-primary btn-sm"><i class="fa fa-book"></i> Statement</a>
</td>
<td>
{{ Form::model($family_account->id, ['method' => 'DELETE', 'route' => ['family_accounts.destroy', $family_account->id], 'id' => 'delete_form_'.$family_account->id]) }}
<button type="submit" class="btn btn-danger btn-sm" id="{{$family_account->id}}"><i class="fa fa-trash"></i> {{ __('family_accounts.deactivate') }}</button>
{{ Form::close() }}
</td>
</tr>
@php $counter++; @endphp
@endforeach
@endif
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<td><strong>{{ __('family_accounts.total') }}</strong></td>
<td><strong>{{ ugandan_shillings($current_balance_total) }}</strong></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script>
$('.btn-danger').click(function(e){
let id = $(this).attr('id');
e.preventDefault();
let sure = confirm('Are you sure you want to remove this family account?');
if(sure){
$.ajax({
url: '/get_family_acc_balance/'+id,
data: {},
success: function(response){
console.log("family balance === "+response);
if(response != 0){
if(response > 0){
alert("The family account has a balance of "+response+". First make a refund to the family before deleting the account");
}
if(response < 0){
alert("The family account has a balance of "+response+". Let the family pay the excess balance before deleting the account");
}
return false;
} else{
$('#delete_form_'+id).submit();
}
},
error: function(response){
console.log(response);
return false;
}
});
}
return false;
});
</script>
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.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>
$('#family_account_id_dropdown').select2({
placeholder: "-- select --"
});
$('#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();
}
});
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
</script>
@endpush
@@ -0,0 +1,10 @@
<div class="panel panel-default">
<div class="panel-body">
<a href="{{ url('family_accounts/create') }}" class="nav-item btn btn-success" style="border-radius: 5px;"><i class="fa fa-plus"></i> <span style="margin-left: 10px">{{ __('family_accounts.create_family_account') }}</span></a>
<a href="{{ url('family_accounts') }}" class="nav-item btn btn-info" style="border-radius: 5px;"><i class="fa fa-pencil"></i> <span style="margin-left: 10px">{{ __('family_accounts.view_family_accounts') }}</span></a>
<a href="{{ url('family_accounts') }}" class="nav-item btn btn-info" style="border-radius: 5px;"><i class="fa fa-pencil"></i> <span style="margin-left: 10px">{{ __('family_accounts.add_family_account') }}</span></a>
<a href="{{ route('family_accounts.consumption_report') }}" class="nav-item btn btn-primary" style="border-radius: 5px;"><i class="fa fa-book"></i> <span style="margin-left: 10px">{{ __('family_accounts.family_account_consumption_report') }}</span></a>
<a href="{{ url('family_accounts_deposits_report') }}" class="nav-item btn btn-primary" style="border-radius: 5px;"><i class="fa fa-book"></i> <span style="margin-left: 10px">{{ __('family_accounts.family_account_deposit_report') }}</span></a>
<a href="{{ route('family_accounts.inactive_family_accounts') }}" class="nav-item btn btn-danger" style="border-radius: 5px;"><i class="fa fa-book"></i> <span style="margin-left: 8px">{{ __('family_accounts.inactive_family_accounts') }}</span></a>
</div>
</div>
@@ -0,0 +1,95 @@
<!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_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>{{ __('family_accounts.deposit_date') }}</b></td>
<td colspan="2">{{ $new_family_deposit->deposit_date }}</td>
</tr>
</table>
<table class="table table-bordered" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('family_accounts.family_members') }}</b></th>
<th style="width: 20%"><b>{{ __('family_accounts.amount_deposited') }}</b></th>
</thead>
<tbody>
<tr>
<td>
<ol>
@for($i = 0; $i < count($family_members_array); $i++)
<li>
{{ get_full_name($family_members_array[$i], "id", "first_name", "last_name", "patients") }}({{ get_name($family_members_array[$i], "id", "number","patients") }})
</li>
@endfor
</ol>
</td>
<td><b>{{ ugandan_shillings($new_family_deposit->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 {{ ($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,83 @@
<!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_finance.receipt_number') }}</b></td>
<td>{{ $receipt_number }}</td>
<td><b>Refund Date</b></td>
<td>{{ $refund_date }}</td>
</tr>
</table>
<table class="table table-bordered" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('family_accounts.family_members') }}</b></th>
<th style="width: 20%"><b>Amount Refunded</b></th>
</thead>
<tbody>
<tr>
<td>
<ol>
@for($i = 0; $i < count($family_members_array); $i++)
<li>
{{ get_full_name($family_members_array[$i], "id", "first_name", "last_name", "patients") }}({{ get_name($family_members_array[$i], "id", "number","patients") }})
</li>
@endfor
</ol>
</td>
<td><b>{{ ugandan_shillings($refund_amount) }}</b></td>
</tr>
</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,169 @@
@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">Refund Family 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><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> Refund Family Accounts</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patient_discounts::family_accounts.menu')
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@include('flash::message')
<div class="row">
<div class="col-md-4">
{{ Form::open(['method'=>'post','route'=>'family_accounts.store_family_refund']) }}
<div class="form-group">
{{ Form::label('family_head',__('family_accounts.family_head')) }}
{{ Form::text('family_head', get_full_name($family_account_details->family_head_id, "id", "first_name", "last_name", "patients"), ['class' => 'form-control col-sm-12 compulsory', 'readonly' => 'true']) }}
</div>
{{ Form::hidden('family_account_id', $family_account_details->id) }}
<div class="form-group">
{{ Form::label('current_balance', 'Current Balance') }}
{{ Form::number('current_balance', $family_account_details->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', 'Amount to refund') }}
{{ Form::number('refund_amount', '',['class' => 'form-control compulsory', 'id' => 'refund_amount', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('account_id','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','Account Balance') }}
{{ Form::text('account_balance', 0, ['class'=>'form-control compulsory', 'id'=>'account_balance', 'readonly']) }}
</div>
<div class="form-group">
{{ Form::label('refund_date', '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('refunded_to', 'Refunded To') }}
{{ Form::text('refunded_to', '', ['class'=>'form-control compulsory', 'required']) }}
</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>
<div class="col-md-8">
<h3>{{ __('family_accounts.family_members') }}</h3>
@php
$family_members_array = explode(",", $family_account_details->family_members_ids);
@endphp
<ol>
@for($i = 0; $i < count($family_members_array); $i++)
<li>
<a href="patients/{{ $family_members_array[$i] }}">{{ get_full_name($family_members_array[$i], "id", "first_name", "last_name", "patients") }}</a>
<br>
<strong>{{ __('family_accounts.number') }} </strong>{{ get_name($family_members_array[$i], "id", "number","patients") }}
<br>
<strong>{{ __('family_accounts.contact') }}</strong>{{ get_name($family_members_array[$i], "id", "phone","patients") }}<br>
<strong>{{ __('family_accounts.residence') }}</strong>{{ patient_residence($family_members_array[$i]) }}
</li>
@endfor
</ol>
</div>
</div>
</div>
</div>
</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,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>{{ __('family_accounts.family_account_deposit_receipt') }}</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">{{ __('family_accounts.family_account_deposit_receipt') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patient_discounts::family_accounts.menu')
</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">
@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(date('Y-m-d')) }}</span><br>
<span class="receipt-label"><b>{{ __('family_accounts.receipt_number') }}</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>Refund Date</b> {{ streamline_date($refund_date) }}</span><br>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('family_accounts.family_members') }}</b></th>
<th style="width: 20%"><b>Amount Refunded</b></th>
</thead>
<tbody>
<tr>
<td><ol>
@for($i = 0; $i < count($family_members_array); $i++)
<li>
{{ get_full_name($family_members_array[$i], "id", "first_name", "last_name", "patients") }}({{ get_name($family_members_array[$i], "id", "number","patients") }})
</li>
@endfor
</ol></td>
<td><b>{{ ugandan_shillings($refund_amount) }}</b></td>
</tr>
</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,507 @@
@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')
@if(session()->get("print_family_account_receipt_pdf") == 1)
{{ Form::hidden('print_family_account_receipt_pdf', 1, ['id' => 'print_family_account_receipt_pdf']) }}
@endif
@if(session()->get("print_family_account_refund_receipt_pdf") == 1)
{{ Form::hidden('print_family_account_refund_receipt_pdf', 1, ['id' => 'print_family_account_refund_receipt_pdf']) }}
@endif
<div class="row bg-title">
<div class="col-lg-6 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">Family Account Statement <font color="blue">{{ get_full_name($family_account_details->family_head_id, "id", "first_name", "last_name", "patients") }} ({{ get_name($family_account_details->family_head_id, "id", "number","patients") }})</font></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> Family Account Statement</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patient_discounts::family_accounts.menu')
</div>
</div>
<div class="white-box">
@include('flash::message')
@php $family_head_id = get_name($family_account_id, "id", "family_head_id", "family_accounts") @endphp
{{ Form::open(['url' => 'family_accounts/' . $family_account_id . '/statement/', 'method' => 'ANY']) }}
<div class="row">
<div class="col-md-2">
{{ Form::hidden('family_account_id', $family_account_id) }}
</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>
{{ Form::close() }}
<div class="col-md-1">
<div style="float: right;">
{{ Form::open(['url' => 'family_statement_print'])}}
{{ Form::hidden('family_account_id', $family_account_id) }}
{{ Form::hidden('reg_date', $reg_date) }}
{{ Form::hidden('start_date', $start_date) }}
{{ Form::hidden('end_date', $end_date) }}
<button type="submit" class="btn btn-rounded" style="background-color: #03C03C; color: white;">
<i class="fa fa-print"></i>
<span>Print Statement</span>
</button>
{{ Form::close() }}
<br>
</div>
</div>
</div>
@if(!is_null($reg_date))
<h2>Family Statement as at <font color="blue">{{ streamline_date($reg_date) }}</font></h2>
@elseif(!is_null($start_date) && !is_null($end_date))
<h2>Family statement as at <font color="blue">{{ streamline_date($start_date) }}</font> {{ __('family_accounts.to') }} <font color="blue">{{ streamline_date($end_date) }}</font></h2>
@endif
<h3>Family Deposits</h3>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>{{ __('family_accounts.deposited_on') }}</th>
<th>Received By</th>
<th>{{ __('family_accounts.family_head') }}</th>
<th>{{ __('family_accounts.deposited_by') }}</th>
<th>{{ __('family_accounts.amount_deposited') }}</th>
</tr>
</thead>
<tbody>
@php $counter = 1; $total_family_deposits = 0; $current_balance_total = 0; @endphp
@if(count($family_deposits) > 0)
@foreach($family_deposits as $deposit)
<tr>
<td>{{ $counter }}</td>
<td>{{ streamline_date($deposit->deposit_date) }}</td>
<td>{{ get_full_name($deposit->created_by, "id", "first_name", "last_name", "users") }}</td>
@php $family_head_id = get_name($deposit->family_account_id, "id", "family_head_id", "family_accounts") @endphp
<td>
{{ get_full_name($family_head_id, "id", "first_name", "last_name", "patients") }}
({{ get_name($family_head_id, "id", "number","patients") }})
</td>
@php
$family_members_array = [];
$family_account_details = \Streamline\Models\FamilyAccount::withTrashed()->find($deposit->family_account_id);
$family_members_array = explode(",", $family_account_details->family_members_ids);
@endphp
{{--<td>
@for($i = 0; $i < count($family_members_array); $i++)
<li>
<a href="patients/{{ $family_members_array[$i] }}">{{ get_full_name($family_members_array[$i], "id", "first_name", "last_name", "patients") }} ({{ get_name($family_members_array[$i], "id", "number","patients") }})</a>
</li>
@endfor
</td>--}}
<td>
{{ $deposit->deposited_by }}
</td>
<td>
@php $total_family_deposits += $deposit->deposit_amount; @endphp
{{ ugandan_shillings($deposit->deposit_amount) }}
</td>
</tr>
@php $counter++; @endphp
@endforeach
@else
<tr>
<td colspan="6" class="text-center"><code>No family deposits have been made</code></td>
</tr>
@endif
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<td><strong>{{ __('family_accounts.total') }}</strong></td>
<td></td>
<td><strong>{{ ugandan_shillings($total_family_deposits) }}</strong></td>
</tr>
</tfoot>
</table>
</div>
<h3>Family consumption</h3>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>{{ __('family_accounts.date') }}</th>
<th>Member</th>
<th>{{ __('family_accounts.reason') }}</th>
<th>{{ __('family_accounts.amount_consumed') }}</th>
</tr>
</thead>
<tbody>
@php $counter = 1; $total_consumptions = 0; @endphp
@if(count($family_consumptions) > 0)
@foreach($family_consumptions as $member_consumption)
@php
$expenditure_type = $member_consumption->expenditure_tag;
$items_received_array = [];
if($expenditure_type == "Services"){
$service_deposit_record = \Streamline\Models\ServiceDeposit::where(['patient_id' => $member_consumption->patient_id, 'episode_id' => $member_consumption->episode_id])->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($expenditure_type == "Treatment"){
$treatment_deposit_record = \Streamline\Models\TreatmentDeposits::where(['patient_id' => $member_consumption->patient_id, 'episode_id' => $member_consumption->episode_id])->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($expenditure_type == "Sundries"){
$sundries_deposit_record = \Streamline\Models\SundryDeposit::where(['patient_id' => $member_consumption->patient_id, 'episode_id' => $member_consumption->episode_id])->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($expenditure_type == "Investigations"){
$investigation_deposit_record = \Streamline\Models\InvestigationDeposit::where(['patient_id' => $member_consumption->patient_id, 'episode_id' => $member_consumption->episode_id])->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($expenditure_type == "Procedures"){
$procedure_deposit_record = \Streamline\Models\ProcedureDeposit::where(['patient_id' => $member_consumption->patient_id, 'episode_id' => $member_consumption->episode_id])->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
<tr>
<td>{{ $counter }}</td>
@php $family_head_id = get_name($member_consumption->family_account_id, "id", "family_head_id", "family_accounts") @endphp
<td>
{{ streamline_date($member_consumption->created_at) }}
</td>
<td>
{{ get_full_name($member_consumption->patient_id, "id", "first_name", "last_name", "patients") }}
</td>
<td>
<strong>{{ $member_consumption->expenditure_tag == "Services" ? "Consultation / Services" : $member_consumption->expenditure_tag }}</strong>
<ol>
@for($j = 0; $j < count($items_received_array); $j++)
<li>{{ $items_received_array[$j] }}</li>
@endfor
</ol>
</td>
<td>
{{ ugandan_shillings($member_consumption->amount_consumed) }}
@php
$total_consumptions += $member_consumption->amount_consumed;
@endphp
</td>
</tr>
@php $counter++; @endphp
@endforeach
@else
<tr>
<td colspan="6" class="text-center"><code>No family consumption has been recorded</code></td>
</tr>
@endif
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td><strong>{{ __('family_accounts.total') }}</strong></td>
<td></td>
<td><strong>{{ ugandan_shillings($total_consumptions) }}</strong></td>
</tr>
</tfoot>
</table>
</div>
<h3>Family Refunds</h3>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>Refunded On</th>
<th>Cashier</th>
<th>{{ __('family_accounts.family_head') }}</th>
<th>Refunded To</th>
<th>Amount Refunded</th>
</tr>
</thead>
<tbody>
@php $counter = 1; $total_family_refunds = 0; @endphp
@if(count($family_refunds) > 0)
@foreach($family_refunds as $refund)
<tr>
<td>{{ $counter }}</td>
<td>{{ streamline_date($refund->created_at) }}</td>
<td>{{ get_full_name($refund->created_by, "id", "first_name", "last_name", "users") }}</td>
@php $family_head_id = get_name($refund->family_account_id, "id", "family_head_id", "family_accounts") @endphp
<td>
{{ get_full_name($family_head_id, "id", "first_name", "last_name", "patients") }}
({{ get_name($family_head_id, "id", "number","patients") }})
</td>
<td>
{{ $refund->refund_to }}
</td>
<td>
@php $total_family_refunds += $refund->refund_amount; @endphp
{{ ugandan_shillings($refund->refund_amount) }}
</td>
</tr>
@php $counter++; @endphp
@endforeach
@else
<tr>
<td colspan="6" class="text-center"><code>No family refunds have been made</code></td>
</tr>
@endif
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<td><strong>{{ __('family_accounts.total') }}</strong></td>
<td></td>
<td><strong>{{ ugandan_shillings($total_family_refunds) }}</strong></td>
</tr>
</tfoot>
</table>
</div>
<div style="font-weight: bolder; font-size: 24px;">
<br><br>
<span><strong>Current Balance:</strong> {{ is_numeric($family_account_details->current_balance) ? ugandan_shillings($family_account_details->current_balance) : "N/A" }}</span>
<hr>
</div>
<br><br>
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-2">
<a href="/family_accounts/{{ $family_account_details->id }}/edit/" class="btn btn-info btn-block"><i class="fa fa-pencil"></i> {{ __('family_accounts.edit') }}</a>
</div>
<div class="col-md-2">
{{ Form::open(['url' => 'family_accounts/add_deposit']) }}
{{ Form::hidden('family_account_id', $family_account_details->id) }}
{{ Form::submit('Add deposit', ['class' => 'btn btn-success btn-block']) }}
{{ Form::close() }}
</div>
<div class="col-md-2">
<a href="/family_accounts/{{ $family_account_details->id }}/statement/" class="btn btn-primary btn-block"><i class="fa fa-book"></i> Statement</a>
</div>
<div class="col-md-2">
{{ Form::model($family_account_details->id ,['method' => 'DELETE', 'route' => ['family_accounts.destroy', $family_account_details->id]]) }}
<button type="submit" class="btn btn-danger btn-block" onclick="return confirm('Are you sure you want to remove this family account?')"><i class="fa fa-trash"></i> {{ __('family_accounts.deactivate') }}</button>
{{ Form::close() }}
</div>
<div class="col-md-2">
<a href="/family_accounts/refund/{{ $family_account_details->id }}" class="btn btn-default btn-block"> Refund Family Account</a>
</div>
<div class="col-md-1"></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>
if ($('#print_family_account_receipt_pdf').val() == 1) {
var win = window.open('/print_family_account_receipt_pdf_details', '_blank');
if (win) {
win.focus();
} else {
alert('Please allow popups for Stre@mline');
}
}
if ($('#print_family_account_refund_receipt_pdf').val() == 1) {
var win = window.open('/print_family_account_refund_receipt_pdf_details', '_blank');
if (win) {
win.focus();
} else {
alert('Please allow popups for Stre@mline');
}
}
var family_name = {!! json_encode(get_full_name($family_head_id, "id", "first_name", "last_name", "patients")) !!};
$('.table111').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy',
{ extend: 'csv',
message: 'CONSUMPTION DETAILS FOR THE FAMILY OF '+family_name
},
{ extend: 'excel',
message: 'CONSUMPTION DETAILS FOR THE FAMILY OF '+family_name,
exportOptions: {
columns: [ 0, 1, 2, 3, 4 ]
},
sheetName: 'CONSUMPTION DETAILS FOR THE FAMILY OF '+family_name
},
{ extend: 'pdf',
message: 'CONSUMPTION DETAILS FOR THE FAMILY OF '+family_name,
orientation: 'landscape',
pageSize: 'LETTER',
exportOptions: {
columns: [ 0, 1, 2, 3, 4 ]
},
customize: function(doc) {
doc.defaultStyle.fontSize = 10;
}
},
{ extend: 'print',
message: 'CONSUMPTION DETAILS FOR THE FAMILY OF '+family_name,
exportOptions: {
columns: [ 0, 1, 2, 3, 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,298 @@
<!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">
<style style="text-css">
body{
/*font-size: 1.2em;*/
}
thead {
/*display: table-header-group;*/
}
tfoot {
/*display: table-row-group;*/
}
tr {
page-break-inside: avoid;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">Family Account Statement for <font color="blue">{{ get_full_name($family_account_details->family_head_id, "id", "first_name", "last_name", "patients")}} ({{ get_name($family_account_details->family_head_id, "id", "number", "patients")}})</font></h5>
<hr><br>
<h5>Family Account Deposits</h5>
<div class="row">
<div class="col">
<table class="table table-sm color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>{{ __('family_accounts.deposited_on') }}</th>
<th>{{ __('family_accounts.received_by') }}</th>
<th>{{ __('family_accounts.family_head') }}</th>
<th>{{ __('family_accounts.deposited_by') }}</th>
<th>{{ __('family_accounts.amount_deposited') }}</th>
</tr>
</thead>
<tbody>
@php $counter = 1; $total_family_deposits = 0; $current_balance_total = 0; @endphp
@if(count($family_deposits) > 0)
@foreach($family_deposits as $deposit)
<tr>
<td>{{ $counter }}</td>
<td>{{ streamline_date($deposit->deposit_date) }}</td>
<td>{{ get_full_name($deposit->created_by, "id", "first_name", "last_name", "users") }}</td>
@php $family_head_id = get_name($deposit->family_account_id, "id", "family_head_id", "family_accounts") @endphp
<td>
{{ get_full_name($family_head_id, "id", "first_name", "last_name", "patients") }}
({{ get_name($family_head_id, "id", "number","patients") }})
</td>
@php
$family_members_array = [];
$family_account_details = \Streamline\Models\FamilyAccount::withTrashed()->find($deposit->family_account_id);
$family_members_array = explode(",", $family_account_details->family_members_ids);
@endphp
{{--<td>
@for($i = 0; $i < count($family_members_array); $i++)
<li>
<a href="patients/{{ $family_members_array[$i] }}">{{ get_full_name($family_members_array[$i], "id", "first_name", "last_name", "patients") }} ({{ get_name($family_members_array[$i], "id", "number","patients") }})</a>
</li>
@endfor
</td>--}}
<td>
{{ $deposit->deposited_by }}
</td>
<td>
@php $total_family_deposits += $deposit->deposit_amount; @endphp
{{ ugandan_shillings($deposit->deposit_amount) }}
</td>
</tr>
@php $counter++; @endphp
@endforeach
@endif
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<td><strong>{{ __('family_accounts.total') }}</strong></td>
<td></td>
<td><strong>{{ ugandan_shillings($total_family_deposits) }}</strong></td>
</tr>
</tfoot>
</table>
</div>
</div>
<hr><br>
<h5>Family Account Consumptions</h5>
<div class="row">
<table class="table table-sm color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>{{ __('family_accounts.date') }}</th>
<th>{{ __('family_accounts.family_member') }}</th>
<th>{{ __('family_accounts.reason') }}</th>
<th>{{ __('family_accounts.amount_consumed') }}</th>
</tr>
</thead>
<tbody>
@php $counter = 1; $total_consumptions = 0; @endphp
@if(count($family_consumptions) > 0)
@foreach($family_consumptions as $member_consumption)
@php
$expenditure_type = $member_consumption->expenditure_tag;
$items_received_array = [];
if($expenditure_type == "Services"){
$service_deposit_record = \Streamline\Models\ServiceDeposit::where(['patient_id' => $member_consumption->patient_id, 'episode_id' => $member_consumption->episode_id])->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($expenditure_type == "Treatment"){
$treatment_deposit_record = \Streamline\Models\TreatmentDeposits::where(['patient_id' => $member_consumption->patient_id, 'episode_id' => $member_consumption->episode_id])->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($expenditure_type == "Sundries"){
$sundries_deposit_record = \Streamline\Models\SundryDeposit::where(['patient_id' => $member_consumption->patient_id, 'episode_id' => $member_consumption->episode_id])->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($expenditure_type == "Investigations"){
$investigation_deposit_record = \Streamline\Models\InvestigationDeposit::where(['patient_id' => $member_consumption->patient_id, 'episode_id' => $member_consumption->episode_id])->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($expenditure_type == "Procedures"){
$procedure_deposit_record = \Streamline\Models\ProcedureDeposit::where(['patient_id' => $member_consumption->patient_id, 'episode_id' => $member_consumption->episode_id])->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
<tr>
<td>{{ $counter }}</td>
<td>
{{ streamline_date($member_consumption->created_at) }}
</td>
@php $family_head_id = get_name($member_consumption->family_account_id, "id", "family_head_id", "family_accounts") @endphp
<td>
{{ get_full_name($member_consumption->patient_id, "id", "first_name", "last_name", "patients") }}
</td>
<td>
<strong>{{ $member_consumption->expenditure_tag == "Services" ? "Consultation / Services" : $member_consumption->expenditure_tag }}</strong>
<ol>
@for($j = 0; $j < count($items_received_array); $j++)
<li>{{ $items_received_array[$j] }}</li>
@endfor
</ol>
</td>
<td>
{{ ugandan_shillings($member_consumption->amount_consumed) }}
@php
$total_consumptions += $member_consumption->amount_consumed;
@endphp
</td>
</tr>
@php $counter++; @endphp
@endforeach
@endif
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td><strong>{{ __('family_accounts.total') }}</strong></td>
<td></td>
<td><strong>{{ ugandan_shillings($total_consumptions) }}</strong></td>
</tr>
</tfoot>
</table>
</div>
<hr><br>
<h5>Family Refunds</h5>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>Refunded On</th>
<th>Cashier</th>
<th>{{ __('family_accounts.family_head') }}</th>
<th>Refunded To</th>
<th>Amount Refunded</th>
</tr>
</thead>
<tbody>
@php $counter = 1; $total_family_refunds = 0; @endphp
@if(count($family_refunds) > 0)
@foreach($family_refunds as $refund)
<tr>
<td>{{ $counter }}</td>
<td>{{ streamline_date($refund->created_at) }}</td>
<td>{{ get_full_name($refund->created_by, "id", "first_name", "last_name", "users") }}</td>
@php $family_head_id = get_name($refund->family_account_id, "id", "family_head_id", "family_accounts") @endphp
<td>
{{ get_full_name($family_head_id, "id", "first_name", "last_name", "patients") }}
({{ get_name($family_head_id, "id", "number","patients") }})
</td>
<td>
{{ $refund->refund_to }}
</td>
<td>
@php $total_family_refunds += $refund->refund_amount; @endphp
{{ ugandan_shillings($refund->refund_amount) }}
</td>
</tr>
@php $counter++; @endphp
@endforeach
@else
<tr>
<td colspan="6" class="text-center"><code>No family refunds have been made</code></td>
</tr>
@endif
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<td><strong>{{ __('family_accounts.total') }}</strong></td>
<td></td>
<td><strong>{{ ugandan_shillings($total_family_refunds) }}</strong></td>
</tr>
</tfoot>
</table>
</div>
<hr><br>
<div class="row" style="float: right; font-weight: bolder; font-size: 24px; padding-right: 50px; padding-bottom: 20px;">
<span><strong>Current Balance:</strong> {{ is_numeric($family_account_details->current_balance) ? ugandan_shillings($family_account_details->current_balance) : "N/A" }}</span>
<hr>
</div>
<h3>.</h3>
</div>
</body>
</html>