updated streamline-setup v2

This commit is contained in:
2025-01-15 08:53:49 -08:00
committed by alec.turner
parent a2ce9248f0
commit 4b569f81b0
20228 changed files with 2932048 additions and 63204 deletions
@@ -0,0 +1,328 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<style>
.no-padding {
padding: 0px;
}
</style>
<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-4 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('general_settings.create_staff_payment_configuration') }} {!! (is_null($price_list_category_id) || $price_list_category_id == 0) ? "<font color='blue'>Cash</font>" : "<font color='blue'>".get_name(get_name($price_list_category_id, 'id', 'patient_category_id', 'price_list_categories'), 'id', 'name', 'patient_categories')."</font>" !!}</h4>
</div>
<div class="col-lg-8 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('general_settings.dashboard') }}</a></li>
<li><a href="{{ route('staff_payment_configuration.index') }}">{{ __('general_settings.view_staff_payment_configurations') }}</a></li>
<li class="active">{{ __('general_settings.create_staff_payment_configuration') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('flash::message')
</div>
</div>
{{ Form::open(['route' => 'staff_payment_configuration.store']) }}
<div class="white-box">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-sm-4">
{{ Form::label('staff', 'Staff:') }}
{{ Form::select('user_id', $users_array, '', ['class' => 'form-control', 'id' => 'staff_id']) }}
</div>
<div class="col-sm-4">
{{ Form::label('price_list', 'Price List:') }}
<select name="price_list_category_id" class="form-control" id="price_list_id">
<option value="0"> {{ __('general_settings.cash') }} </option>
@foreach($price_list_categories as $record)
<option value="{{ $record->id }}" {!! (!is_null($price_list_category_id) && $price_list_category_id == $record->id) ? 'selected' : '' !!}>{{ get_name($record->patient_category_id, 'id', 'name', 'patient_categories') }}</option>
@endforeach
</select>
</div>
<div class="col-sm-2">
{{ Form::label('payment_type', 'Payment Type:') }}<br>
{{ Form::radio('payment_type', 0, false, ['id'=> 'fixed_amount','onclick'=>'setRangeOrOptions()']) }}&nbsp;{{ __('general_settings.fixed_amount') }}&nbsp;&nbsp;
{{ Form::radio('payment_type', 1, false, ['id'=> 'percentage','onclick'=>'setRangeOrOptions()']) }}&nbsp;{{ __('general_settings.percentage') }}
</div>
<div class="col-sm-2">
<br>
{{ Form::button('Change Price List',['type'=>'submit','class'=>'btn btn-success btn-rounded','name'=>'submit-btn','value'=>'change_pricing']) }}
</div>
</div>
<div class="row">
<div class="col-sm-12">
<br>
<h5><b>You are setting price for category :</b><font color='blue'> {!! (is_null($price_list_category_id) || $price_list_category_id == 0) ? "Cash" : get_name(get_name($price_list_category_id, 'id', 'patient_category_id', 'price_list_categories'), 'id', 'name', 'patient_categories') !!}</font></h5>
</div>
</div>
<br>
<div class="card">
<div class="card-header">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active nav-item"> <a href="#procedures_section" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> Procedures</a> </li>
<li role="presentation" class="nav-item"> <a href="#consultations_section" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> Consultation and services</a> </li>
<li role="presentation" class="nav-item"> <a href="#investigations_section" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> Investigations</a> </li>
</ul>
</div>
<div class="card-block">
<div class="tab-content">
<div id="procedures_section" class="tab-pane active">
<div class="table-responsive">
<table class="table table-striped color-bordered-table success-bordered-table table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
<th class="staff_fixed_amount">Staff Fee</th>
<th style="display: none;" class="staff_percentage">Staff Percentage</th>
</tr>
</thead>
<tbody>
@if(count($procedures) > 0)
@foreach($procedures as $procedure)
<tr>
<td>
{{ $procedure->name }}
</td>
<td>
@if(!is_null($price_list_category_id))
@php
$key = array_search($price_list_category_id, explode(",", $procedure->price_list_category));
$price_list_price_array = explode(",", $procedure->price_list_price);
$price_list_price = isset($price_list_price_array[$key]) ? $price_list_price_array[$key] : 0;
@endphp
{{ ugandan_shillings($price_list_price) }}
<input type="hidden" name="selected_price_list_category_id" value="{{ $price_list_category_id }}">
@else
{{ ugandan_shillings($procedure->non_insured_price) }}
@endif
</td>
<td class="staff_fixed_amount">
{{ Form::hidden('procedure_id[]', $procedure->id) }}
{{ Form::number('procedure_fee[]', '', ['class' => 'form-control']) }}
</td>
<td style="display: none" class="staff_percentage">
{{ Form::number('procedure_percentage[]', '', ['class' => 'form-control', 'max' => '100']) }}
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
</div>
<div id="consultations_section" class="tab-pane">
<div class="table-responsive">
<table class="table table-striped color-bordered-table success-bordered-table table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
<th class="staff_fixed_amount">Staff Fee</th>
<th style="display: none;" class="staff_percentage">Staff Percentage</th>
</tr>
</thead>
<tbody>
@if(count($services) > 0)
@foreach($services as $service)
<tr>
<td>
{{ $service->name }}
</td>
<td>
@if(!is_null($price_list_category_id))
@php
$key = array_search($price_list_category_id, explode(",", $service->price_list_category));
$price_list_price_array = explode(",", $service->price_list_price);
$price_list_price = isset($price_list_price_array[$key]) ? $price_list_price_array[$key] : 0;
@endphp
{{ ugandan_shillings($price_list_price) }}
<input type="hidden" name="selected_price_list_category_id" value="{{ $price_list_category_id }}">
@else
{{ ugandan_shillings($service->cost_price) }}
@endif
</td>
<td class="staff_fixed_amount">
{{ Form::hidden('service_id[]', $service->id) }}
{{ Form::number('service_fee[]', '', ['class' => 'form-control']) }}
</td>
<td style="display: none" class="staff_percentage">
{{ Form::number('service_percentage[]', '', ['class' => 'form-control', 'max' => '100']) }}
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
</div>
<div id="investigations_section" class="tab-pane">
<div class="table-responsive">
<table class="table table-striped color-bordered-table success-bordered-table table-bordered">
<thead>
<tr>
<tr>
<th>Name</th>
<th>Price</th>
<th class="staff_fixed_amount">Staff Fee</th>
<th style="display: none;" class="staff_percentage">Staff Percentage</th>
</tr>
</thead>
<tbody>
@if(count($investigations) > 0)
@foreach($investigations as $investigation)
<tr>
<td>
{{ $investigation->name }}
</td>
<td>
@if(!is_null($price_list_category_id))
@php
$key = array_search($price_list_category_id, explode(",", $investigation->price_list_category));
$price_list_price_array = explode(",", $investigation->price_list_price);
$price_list_price = isset($price_list_price_array[$key]) ? $price_list_price_array[$key] : 0;
@endphp
{{ ugandan_shillings($price_list_price) }}
<input type="hidden" name="selected_price_list_category_id" value="{{ $price_list_category_id }}">
@else
{{ ugandan_shillings($investigation->non_insured_price) }}
@endif
</td>
<td class="staff_fixed_amount">
{{ Form::hidden('investigation_id[]', $investigation->id) }}
{{ Form::number('investigation_fee[]', '', ['class' => 'form-control']) }}
</td>
<td style="display: none" class="staff_percentage">
{{ Form::number('investigation_percentage[]', '', ['class' => 'form-control', 'max' => '100']) }}
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
</div>
{{ Form::button('Save Fees', ['type' => 'submit', 'name' => 'submit_fees', 'class' => 'btn btn-success', 'id' => 'save_fees']) }}
</div>
</div>
</div>
</div>
</div>
</div>
{{ Form::close() }}
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/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/js/validator.js') }}"></script>
<script>
$('#staff_id,#procedures,#investigations,#price_list_id').select2({
placeholder: "Select",
width: "100%"
});
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy',
{ extend: 'csv',
message: 'STAFF PAYMENTS'
},
{ extend: 'excel',
message: 'STAFF PAYMENTS',
exportOptions: {
columns: [ 0, 1, 2, 4, 5 ]
},
sheetName: 'STAFF PAYMENTS ON STREAMLINE'
},
{ extend: 'pdf',
message: 'STAFF PAYMENTS',
orientation: 'landscape',
pageSize: 'LETTER',
exportOptions: {
columns: [ 0, 1, 2, 4, 5 ]
},
customize: function(doc) {
doc.defaultStyle.fontSize = 10;
}
},
{ extend: 'print',
message: 'STAFF PAYMENTS',
exportOptions: {
columns: [ 0, 1, 2, 4, 5 ]
},
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');
}
}
]
});
function setRangeOrOptions() {
if (document.getElementById("fixed_amount").checked) {
$(".staff_fixed_amount").show();
$(".staff_percentage").hide();
}
if (document.getElementById("percentage").checked) {
$(".staff_percentage").show();
$(".staff_fixed_amount").hide();
}
}
$('#save_fees').click(function() {
if (!$("input[name='payment_type']:checked").val() || $("#staff_id").val() == "") {
alert('Please make sure you select the payment type and staff');
return false;
}
});
</script>
@endpush
@@ -0,0 +1,555 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<style>
.no-padding {
padding: 0px;
}
</style>
<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-6 col-md-6 col-sm-6 col-xs-12">
<h4 class="page-title">
{{ __('general_settings.view_staff_payment_configurations') }} <font color="blue">{{ isset($searched_staff_name) ? $searched_staff_name : "" }}</font> {!! (is_null($price_list_category_id) || $price_list_category_id == 0) ? "" : " for <font color='blue'>".get_name(get_name($price_list_category_id, 'id', 'patient_category_id', 'price_list_categories'), 'id', 'name', 'patient_categories')."</font>" !!}
<!-- display cash category -->
{!! $price_list_category_id == 0 ? "for <font color='blue'>Cash</font>" : "" !!}
</h4>
</div>
<div class="col-lg-6 col-sm-6 col-md-6 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('general_settings.dashboard') }}</a></li>
<li><a href="{{ route('staff_payment_configuration.create') }}">{{ __('general_settings.create_staff_payment_configuration') }}</a></li>
<li class="active">{{ __('general_settings.view_staff_payment_configurations') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('flash::message')
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-body">
{{ Form::open(['method'=>'post','route' => 'staff_payment_configuration.search']) }}
<div class="form-group">
{{ Form::label('staff_id', 'Staff') }}
{{ Form::select('staff_id', $users_array, null, ['class' => 'form-control', 'id' => 'staff_member', 'required']) }}
</div>
<div class="form-group">
{{ Form::label('price_list', 'Price List:') }}
<select name="price_list_category_id" class="form-control" id="price_list_id">
<option value="0">{{ __('general_settings.cash') }}</option>
@foreach($price_list_categories as $record)
<option value="{{ $record->id }}">{{ get_name($record->patient_category_id, 'id', 'name', 'patient_categories') }}</option>
@endforeach
</select>
</div>
<div class="form-group">
{{ Form::submit('Submit', ['class'=>'btn btn-success pull-right']) }}
</div>
{{ Form::close() }}
</div>
</div>
</div>
<div class="col-md-9">
<div class="row">
<div class="panel panel-default col-md-12">
<div class="panel-body panel-primary">
<div class="card">
<div class="card-header">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active nav-item"> <a href="#procedures_section" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> Procedures</a> </li>
<li role="presentation" class="nav-item"> <a href="#consultations_section" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> Consultation and services</a> </li>
<li role="presentation" class="nav-item"> <a href="#investigations_section" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> Investigations</a> </li>
</ul>
</div>
@php
$counter = 0;
$consultations_counter = 0;
$invs_counter = 0;
@endphp
<div class="card-block">
<div class="tab-content">
<div id="procedures_section" class="tab-pane active">
<div class="table-responsive">
<table class="table table-striped color-bordered-table success-bordered-table table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
<th class="staff_fixed_amount">Staff Fee</th>
<th style="display: none;" class="staff_percentage">Staff Percentage</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<!-- procedures -->
@if(isset($search_complete))
@if(count($staff_payment_configurations) > 0)
@foreach($staff_payment_configurations as $config_record)
@if($config_record->item_category == 1)
@php
$procedure = \Streamline\Models\Procedure::withTrashed()->find($config_record->item_id);
@endphp
@if(!is_null($procedure))
<tr>
<td>
{{ $procedure->name }}
</td>
<td>
@if(!is_null($price_list_category_id) && $price_list_category_id != 0)
@php
$key = array_search($price_list_category_id, explode(",", $procedure->price_list_category));
$price_list_price_array = explode(",", $procedure->price_list_price);
$price_list_price = isset($price_list_price_array[$key]) ? $price_list_price_array[$key] : 0;
@endphp
{{ ugandan_shillings($price_list_price) }}
@else
{{ ugandan_shillings($procedure->non_insured_price) }}
@endif
</td>
<td @if(is_null($config_record->amount_fee)) style="display: none" @endif class="staff_fixed_amount">
{{ Form::hidden('procedure_id[]', $procedure->id) }}
{{ Form::number('procedure_fee[]', $config_record->amount_fee, ['class' => 'form-control', 'readonly', 'id' => 'procedures' . $counter]) }}
</td>
<td @if(is_null($config_record->amount_percentage)) style="display: none" @endif class="staff_percentage">
Percentage
{{ Form::number('procedure_percentage[]', $config_record->amount_percentage, ['class' => 'form-control', 'max' => '100', 'readonly']) }}
</td>
<td>
<div class="row" id="procedures_button_group{{$counter}}">
<div class="col-md-6">
<a class="btn btn-sm btn-info" onclick="edit_configuration({{ $counter }})">Edit</a>
</div>
<div class="col-md-6">
<a class="btn btn-sm btn-danger" onclick="delete_staff_payment({{ $config_record->id }})">Delete</a>
</div>
</div>
<div class="row" style="display: none" id="procedures_save_button{{$counter}}">
<div class="col-md-12">
<a class="btn btn-success btn-block" onclick="save_edited_staff_config({{ $config_record->id }})">Save</a>
</div>
</div>
</td>
</tr>
@php $counter++; @endphp
@endif
@endif
@endforeach
@endif
@endif
</tbody>
</table>
</div>
</div>
<div id="consultations_section" class="tab-pane">
<div class="table-responsive">
<table class="table table-striped color-bordered-table success-bordered-table table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
<th class="staff_fixed_amount">Staff Fee</th>
<th style="display: none;" class="staff_percentage">Staff Percentage</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@if(isset($search_complete))
@if(count($staff_payment_configurations) > 0)
@foreach($staff_payment_configurations as $config_record)
@if($config_record->item_category == 3)
@php
$service = \Streamline\Models\Services::withTrashed()->find($config_record->item_id);
@endphp
@if(!is_null($service))
<tr>
<td>
{{ $service->name }}
</td>
<td>
@if(!is_null($price_list_category_id) && $price_list_category_id != 0)
@php
$key = array_search($price_list_category_id, explode(",", $service->price_list_category));
$price_list_price_array = explode(",", $service->price_list_price);
$price_list_price = isset($price_list_price_array[$key]) ? $price_list_price_array[$key] : 0;
@endphp
{{ ugandan_shillings($price_list_price) }}
@else
{{ ugandan_shillings($service->cost_price) }}
@endif
</td>
<td @if(is_null($config_record->amount_fee)) style="display: none" @endif class="staff_fixed_amount">
{{ Form::hidden('service_id[]', $service->id) }}
{{ Form::number('service_fee[]', $config_record->amount_fee, ['class' => 'form-control', 'readonly','id' => 'consultations' . $consultations_counter]) }}
</td>
<td @if(is_null($config_record->amount_percentage)) style="display: none" @endif class="staff_percentage">
{{ Form::number('service_percentage[]', $config_record->amount_percentage, ['class' => 'form-control', 'max' => '100', 'readonly']) }}
</td>
<td>
<div class="row" id="consultations_button_group{{$consultations_counter}}">
<div class="col-md-6">
<a class="btn btn-sm btn-info" onclick="edit_consultation_configuration({{ $consultations_counter }})">Edit</a>
</div>
<div class="col-md-6">
<a class="btn btn-sm btn-danger" onclick="delete_consultation_staff_payment({{ $config_record->id }})">Delete</a>
</div>
</div>
<div class="row" style="display: none" id="consultations_save_button{{$consultations_counter}}">
<div class="col-md-12">
<a class="btn btn-success btn-block" onclick="save_edited_consultation_staff_config({{ $config_record->id }})">Save</a>
</div>
</div>
</td>
</tr>
@endif
@endif
@php $consultations_counter++; @endphp
@endforeach
@endif
@endif
</tbody>
</table>
</div>
</div>
<div id="investigations_section" class="tab-pane">
<div class="table-responsive">
<table class="table table-striped color-bordered-table success-bordered-table table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
<th class="staff_fixed_amount">Staff Fee</th>
<th style="display: none;" class="staff_percentage">Staff Percentage</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@if(isset($search_complete))
@if(count($staff_payment_configurations) > 0)
@foreach($staff_payment_configurations as $config_record)
@if($config_record->item_category == 2)
@php
$investigation = \Streamline\Models\Investigation::withTrashed()->find($config_record->item_id);
@endphp
@if(!is_null($investigation))
<tr>
<td>
{{ $investigation->name }}
</td>
<td>
@if(!is_null($price_list_category_id) && $price_list_category_id != 0)
@php
$key = array_search($price_list_category_id, explode(",", $investigation->price_list_category));
$price_list_price_array = explode(",", $investigation->price_list_price);
$price_list_price = isset($price_list_price_array[$key]) ? $price_list_price_array[$key] : 0;
@endphp
{{ ugandan_shillings($price_list_price) }}
@else
{{ ugandan_shillings($investigation->non_insured_price) }}
@endif
</td>
<td @if(is_null($config_record->amount_fee)) style="display: none" @endif class="staff_fixed_amount">
{{ Form::hidden('investigation_id[]', $investigation->id) }}
{{ Form::number('investigation_fee[]', $config_record->amount_fee, ['class' => 'form-control', 'readonly','id' => 'investigations' . $invs_counter]) }}
</td>
<td @if(is_null($config_record->amount_percentage)) style="display: none" @endif class="staff_percentage">
{{ Form::number('investigation_percentage[]', $config_record->amount_percentage, ['class' => 'form-control', 'max' => '100', 'readonly']) }}
</td>
<td>
<div class="row" id="investigations_button_group{{$invs_counter}}">
<div class="col-md-6">
<a class="btn btn-sm btn-info" onclick="edit_investigation_configuration({{ $invs_counter }})">Edit</a>
</div>
<div class="col-md-6">
<a class="btn btn-sm btn-danger" onclick="delete_investigation_staff_payment({{ $config_record->id }})">Delete</a>
</div>
</div>
<div class="row" style="display: none" id="investigations_save_button{{$counter}}">
<div class="col-md-12">
<a class="btn btn-success btn-block" onclick="save_edited_investigation_staff_config({{ $config_record->id }})">Save</a>
</div>
</div>
</td>
</tr>
@endif
@endif
@php $invs_counter++; @endphp
@endforeach
@endif
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</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/select2/select2.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/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/js/validator.js') }}"></script>
<script>
// is there any config under edit 0 - no, any other is the id
let is_edit_active = 0;
$('#staff_id,#procedures,#investigations,#staff_member').select2({
placeholder: "Select",
width: "100%"
});
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy',
{ extend: 'csv',
message: 'STAFF PAYMENTS'
},
{ extend: 'excel',
message: 'STAFF PAYMENTS',
exportOptions: {
columns: [ 0, 1, 2, 4, 5 ]
},
sheetName: 'STAFF PAYMENTS ON STREAMLINE'
},
{ extend: 'pdf',
message: 'STAFF PAYMENTS',
orientation: 'landscape',
pageSize: 'LETTER',
exportOptions: {
columns: [ 0, 1, 2, 4, 5 ]
},
customize: function(doc) {
doc.defaultStyle.fontSize = 10;
}
},
{ extend: 'print',
message: 'STAFF PAYMENTS',
exportOptions: {
columns: [ 0, 1, 2, 4, 5 ]
},
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');
}
}
]
});
function setRangeOrOptions() {
if (document.getElementById("fixed_amount").checked) {
$(".staff_fixed_amount").show();
$(".staff_percentage").hide();
}
if (document.getElementById("percentage").checked) {
$(".staff_percentage").show();
$(".staff_fixed_amount").hide();
}
}
function delete_staff_payment(config_id) {
if (confirm("Are you sure you want to delete this record?")) {
$.ajax({
url: '/delete_staff_configuration',
data: {'config_id':config_id},
success: function(response){
if (response == 1) {
alert("Staff configuration record has been deleted");
window.location.reload();
} else {
alert("Staff configuration record deletion failed");
}
}
});
}
}
function edit_configuration(id) {
if (is_edit_active === 0) {
is_edit_active = id;
} else {
$(".under_edit").attr("readonly", true);
$("#procedures" + is_edit_active).removeClass('under_edit');
$('#procedures_button_group' + is_edit_active).show();
$('#procedures_save_button' + is_edit_active).hide();
}
$('#procedures_save_button' + id).show();
$('#procedures_button_group' + id).hide();
$("#procedures" + id).attr("readonly", false);
$("#procedures" + id).addClass('under_edit');
}
function save_edited_staff_config(config_id) {
let amount_fee = $("#procedures" + is_edit_active).val();
$.ajax({
url: '/edit_staff_configuration',
data: {'config_id':config_id, 'amount_fee':amount_fee},
success: function(response){
if (response == 1) {
alert("Staff configuration record has been edited");
window.location.reload();
} else {
alert("Staff configuration record editing failed");
}
}
});
}
function delete_consultation_staff_payment(config_id) {
if (confirm("Are you sure you want to delete this record?")) {
$.ajax({
url: '/delete_staff_configuration',
data: {'config_id':config_id},
success: function(response){
if (response == 1) {
alert("Staff configuration record has been deleted");
window.location.reload();
} else {
alert("Staff configuration record deletion failed");
}
}
});
}
}
function edit_consultation_configuration(id) {
if (is_edit_active === 0) {
is_edit_active = id;
} else {
$(".under_edit").attr("readonly", true);
$("#consultations" + is_edit_active).removeClass('under_edit');
$('#consultations_button_group' + is_edit_active).show();
$('#consultations_save_button' + is_edit_active).hide();
}
$('#consultations_save_button' + id).show();
$('#consultations_button_group' + id).hide();
$("#consultations" + id).attr("readonly", false);
$("#consultations" + id).addClass('under_edit');
}
function save_edited_consultation_staff_config(config_id) {
let amount_fee = $("#consultations" + is_edit_active).val();
$.ajax({
url: '/edit_staff_configuration',
data: {'config_id':config_id, 'amount_fee':amount_fee},
success: function(response){
if (response == 1) {
alert("Staff configuration record has been edited");
window.location.reload();
} else {
alert("Staff configuration record editing failed");
}
}
});
}
function delete_investigation_staff_payment(config_id) {
if (confirm("Are you sure you want to delete this record?")) {
$.ajax({
url: '/delete_staff_configuration',
data: {'config_id':config_id},
success: function(response){
if (response == 1) {
alert("Staff configuration record has been deleted");
window.location.reload();
} else {
alert("Staff configuration record deletion failed");
}
}
});
}
}
function edit_investigation_configuration(id) {
if (is_edit_active === 0) {
is_edit_active = id;
} else {
$(".under_edit").attr("readonly", true);
$("#investigations" + is_edit_active).removeClass('under_edit');
$('#investigations_button_group' + is_edit_active).show();
$('#investigations_save_button' + is_edit_active).hide();
}
$('#investigations_save_button' + id).show();
$('#investigations_button_group' + id).hide();
$("#investigations" + id).attr("readonly", false);
$("#investigations" + id).addClass('under_edit');
}
function save_edited_investigation_staff_config(config_id) {
let amount_fee = $("#investigations" + is_edit_active).val();
$.ajax({
url: '/edit_staff_configuration',
data: {'config_id':config_id, 'amount_fee':amount_fee},
success: function(response){
if (response == 1) {
alert("Staff configuration record has been edited");
window.location.reload();
} else {
alert("Staff configuration record editing failed");
}
}
});
}
</script>
@endpush
@@ -0,0 +1,382 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/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-6 col-md-7 col-sm-7 col-xs-12">
<h4 class="page-title">{{ __('general_settings.payments_report') }}</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li class="active">{{ __('general_settings.payments_report') }}</li>
@if(Auth::user()->can('record-staff-service-performance'))
<li><a href="{{ url('record_staff_service_performance') }}">Record staff performance</a></li>
@endif
<li><a href="{{ url('finance') }}">Finance Home</a></li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('flash::message')
</div>
</div>
<div class="row">
<div class="col-sm-12">
{{ Form::open(['route' => 'staff_payments.payments_report' , 'data-toggle' => 'validator']) }}
<div class="white-box">
<div class="row">
<div class="col-md-2">
<div class="form-group">
{{ Form::label('report_by', __('general_settings.report_by')) }}
{{ Form::select('report_by', ['' => __('ward_consumption.select'), 1 => __('general_settings.staff'), 2 => __('general_settings.services')], '', ['class' => 'form-control', 'id'=>'report_by', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-2">
<div id="staff_div" style="display: none;">
<div class="form-group">
{{ Form::label('staff', __('general_settings.staff')) }}
{{ Form::select('staff', $users_array, '', ['class' => 'form-control col-sm-12', 'id' => 'staff_select']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div id="services_div" style="display: none;">
<div class="form-group">
{{ Form::label('services_rendered_id', __('general_settings.services')) }}
{{ Form::select('services_rendered_id', $services_rendered_array, '', ['class' => 'form-control col-sm-12', 'id' => 'services_select']) }}
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="searchby">
{{ Form::label('search_by', __('ward_consumption.date')) }}
{{ Form::select('search_by', ['0'=>__('ward_consumption.last_24_hours'),'1'=>__('ward_consumption.custom_date'),'2'=>__('ward_consumption.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', __('ward_consumption.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', __('ward_consumption.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-2">
<br>
{{ Form::button(__('ward_consumption.search'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
</div>
</div>
</div>
{{ Form::close() }}
</div>
</div>
@if($search_complete)
@if($report_by == 1)
<!-- show the report based on staff -->
<div class="row">
<div class="col-md-12">
<div class="white-box">
<!-- show the lable -->
<div><h3 style="color: blue">{{ $search_text }}</h3></div>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>Staff</th>
<th>Amount</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@php
$grand_total = 0;
$counter = 1;
@endphp
@if(count($staff_performed_items_array) > 0)
@foreach($staff_performed_items_array as $staff_id => $amount)
<tr>
<td>{{ $counter }}</td>
<td>
{{ get_full_name($staff_id, "id", "first_name", "last_name", "users") }}
</td>
<td>
{{ ugandan_shillings((int)$amount) }}
</td>
<td>
{{ Form::open(['route' => 'staff_payments.payments_details_report']) }}
{{ Form::hidden('details_report_by', $details_report_by) }}
{{ Form::hidden('details_staff', $staff_id) }}
{{ Form::hidden('details_services_rendered_id', $details_services_rendered_id) }}
{{ Form::hidden('details_search_by', $details_search_by) }}
{{ Form::hidden('details_reg_date', $details_reg_date) }}
{{ Form::hidden('details_start_date', $details_start_date) }}
{{ Form::hidden('details_end_date', $details_end_date) }}
<button type="submit" class="btn btn-success">Details</button>
{{ Form::close() }}
</td>
</tr>
@php
$grand_total += $amount;
$counter++;
@endphp
@endforeach
@endif
</tbody>
<tfoot>
<td></td>
<td><strong>Total</strong></td>
<td><strong>{{ ugandan_shillings((int)$grand_total) }}</strong></td>
<td></td>
</tfoot>
</table>
</div>
</div>
</div>
</div>
@elseif($report_by == 2)
<div class="row">
<div class="col-md-12">
<div class="white-box">
<!-- show the label for search -->
<div><h3 style="color: blue">{{ $search_text }}</h3></div>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>Category</th>
<th>Amount</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@php
$grand_total = 0;
$counter = 1;
@endphp
@if(count($staff_performed_items_array) > 0)
@foreach($staff_performed_items_array as $item_category => $amount)
<tr>
<td>{{ $counter }}</td>
<td>
@if($item_category == 1)
Procedures
@elseif($item_category == 2)
Investigations
@elseif($item_category == 3)
Consultations
@endif
</td>
<td>
{{ ugandan_shillings((int)$amount) }}
</td>
<td>
{{ Form::open(['route' => 'staff_payments.payments_details_report']) }}
{{ Form::hidden('details_report_by', $details_report_by) }}
{{ Form::hidden('details_staff', $details_staff) }}
{{ Form::hidden('details_services_rendered_id', $item_category) }}
{{ Form::hidden('details_search_by', $details_search_by) }}
{{ Form::hidden('details_reg_date', $details_reg_date) }}
{{ Form::hidden('details_start_date', $details_start_date) }}
{{ Form::hidden('details_end_date', $details_end_date) }}
<button type="submit" class="btn btn-success">Details</button>
{{ Form::close() }}
</td>
</tr>
@php
$grand_total += $amount;
$counter++;
@endphp
@endforeach
@endif
</tbody>
<tfoot>
<tr>
<td></td>
<td><strong>Total</strong></td>
<td><strong>{{ ugandan_shillings((int)$grand_total) }}</strong></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
@endif
@endif
@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 src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<script>
$(document).ready(function() {
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
footer: true,
buttons: [
'copy',
{ extend: 'csv',
footer: true,
message: '<?php echo __('general_settings.staff_payments_report');?>'
},
{ extend: 'excel',
message: '<?php echo __('general_settings.staff_payments_report');?>',
footer: true,
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6 ]
},
sheetName: '<?php echo __('general_settings.staff_payments_report');?>'
},
{ extend: 'pdf',
message: '<?php echo __('general_settings.staff_payments_report');?>',
footer: true,
orientation: 'landscape',
pageSize: 'LETTER',
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6 ]
},
customize: function(doc) {
doc.defaultStyle.fontSize = 10;
// doc.styles.tableHeader.alignment = 'left';
}
},
{ extend: 'print',
message: '<?php echo __('general_settings.staff_payments_report');?>',
footer: true,
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6 ]
},
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: 'yyyy-mm-dd'
});
$('#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();
}
});
$('#start_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy/mm/dd',
orientation: 'bottom'
});
$('#end_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy/mm/dd',
orientation: 'bottom'
});
$('#report_by').change(function () {
if ($(this).val() == 1) {
$('#staff_div').show();
$('#services_div').hide();
//$('.select2-selection.select2-selection--single').css('height','calc(3.85rem)');
$('.select2-selection.select2-selection--single').css('max-width','100%');
$('.select2-selection.select2-selection--single').css('padding','7px 12px');
}
else if ($(this).val() == 2) {
$('#services_div').show();
$('#staff_div').hide();
}
else {
$('#staff_div,#services_div').hide();
}
});
$('#services_select,#staff_select').select2({
placeholder: "-- select --",
width: "100%"
});
$('.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');
});
</script>
@endpush
@@ -0,0 +1,336 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/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-6 col-md-7 col-sm-7 col-xs-12">
<h4 class="page-title">{{ __('general_settings.payments_report_details') }}</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('staff_payments.payments_report') }}">{{ __('general_settings.payments_report') }}</a></li>
<li class="active">{{ __('general_settings.payments_report_details') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('flash::message')
</div>
</div>
<!-- show the report based on staff -->
<div class="row">
<div class="col-md-12">
<div class="white-box">
{!! $search_string ?? $search_string !!}
<!-- show the lable -->
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>{{ __('general_settings.patient_name') }}</th>
<th>{{ __('general_settings.patient_category') }}</th>
<th>{{ __('general_settings.staff_payment_status') }}</th>
<th>{{ __('general_settings.patient_payment_status') }}</th>
<th>{{ __('general_settings.date') }}</th>
<th>{{ __('general_settings.item_name') }}</th>
<th>{{ __('general_settings.item_price') }}</th>
<th>{{ __('general_settings.staff_name') }}</th>
<th>{{ __('general_settings.amount_for_staff') }}</th>
</tr>
</thead>
<tbody>
@php
$grand_staff_amount_total = 0;
$grand_prices_amount_total = 0;
$counter = 1;
@endphp
@if(count($staff_performed_services) > 0)
@foreach($staff_performed_services as $record)
@php
if ($record->item_category == 1){
$procedure = \Streamline\Models\Procedure::withTrashed()->find($record->item_id);
$non_insured_price = $procedure->non_insured_price;
$item_name = $procedure->name;
}elseif ($record->item_category == 2){
$investigation = \Streamline\Models\Investigation::withTrashed()->find($record->item_id);
$non_insured_price = $investigation->non_insured_price;
$item_name = $investigation->name;
}elseif ($record->item_category == 3){
$service = \Streamline\Models\Services::withTrashed()->find($record->item_id);
$non_insured_price = $service->cost_price;
$item_name = $service->name;
}
@endphp
<tr>
<td>{{ $counter }}</td>
<td>
{{ get_full_name($record->patient_id, "id", "first_name", "last_name", "patients") }} ({{ get_name($record->patient_id, "id", "number", "patients") }})
</td>
<td>
{{ get_name(get_name($record->patient_id, "id", "category_id", "patients"), "id", "name", "patient_categories") }}
</td>
<td>
@if($record->is_staff_paid == 0)
<font color='red'>{{ __('investigations.not_paid') }}</font>
@else
<font color='green'>{{ __('investigations.paid') }}</font>
@endif
</td>
<td>
@if(is_null($record->patient_receipt_number))
<font color='red'>{{ __('investigations.not_paid') }}</font>
@else
<font color='green'>{{ __('investigations.paid') }}</font>
@endif
</td>
<td>
{{ streamline_date($record->created_at) }}
</td>
<td>
{{ $item_name }}
</td>
<td>
@php
//handle previous records b4 i added performace fee column
$item_price = 0;
if(is_null($record->item_price)){
$item_price = $non_insured_price;
} else {
$item_price = $record->item_price;
}
@endphp
{{ ugandan_shillings((int)$item_price) }}
@php
$grand_prices_amount_total += $item_price;
@endphp
</td>
<td>
{{ get_full_name($record->performed_by, "id", "first_name", "last_name", "users") }}
</td>
<td>
<?php
//$staff_fee_amount = $record->performance_fee;
//handle previous records b4 i added performace fee column
if(is_null($record->performance_fee)){
if ($report_based_on_staff_or_category == 1 /*staff*/) {
$staff_fee_amount = get_fee_owed_to_staff_for_perfomed_service($record->item_id, $record->item_category, $record->performed_by);
}
if ($report_based_on_staff_or_category == 2 /*item_categ*/) {
$staff_fee_amount = get_fee_owed_to_staff_for_perfomed_service_based_on_category($record->item_id, $record->performed_by, $record->item_category);
}
$staff_fee_amount = is_numeric($staff_fee_amount) ? $staff_fee_amount : 0;
} else {
$staff_fee_amount = $record->performance_fee;
}
$grand_staff_amount_total += $staff_fee_amount;
?>
{{ ugandan_shillings((int)$staff_fee_amount) }}
</td>
</tr>
@php
$counter++;
@endphp
@endforeach
@endif
@if (count($ward_procedures_records) > 0)
@foreach ($ward_procedures_records as $ward_procedure)
<tr>
<td>{{ $counter }}</td>
<td>
{{ get_full_name($ward_procedure->patient_id, "id", "first_name", "last_name", "patients") }} ({{ get_name($ward_procedure->patient_id, "id", "number", "patients") }})
</td>
<td>
{{ get_name(get_name($ward_procedure->patient_id, "id", "category_id", "patients"), "id", "name", "patient_categories") }}
</td>
<td>
<span class="label label-info">{{ get_name($ward_procedure->ward_id, "id", "name", "wards") }}</span>
</td>
<td>
</td>
<td>
{{ streamline_date($ward_procedure->created_at) }}
</td>
<td>
{{ get_name($ward_procedure->procedure_id, "id", "name", "procedures") }}
</td>
<td>
{{ ugandan_shillings($ward_procedure->hospital_fee + $ward_procedure->staff_fee) }}
</td>
<td>
{{ get_full_name($ward_procedure->performed_by, "id", "first_name", "last_name", "users") }}
</td>
<td>
{{ ugandan_shillings((int)$ward_procedure->staff_fee) }}
</td>
</tr>
@php
$ward_procedure_cost = $ward_procedure->hospital_fee + $ward_procedure->staff_fee;
$grand_prices_amount_total += $ward_procedure_cost;
$grand_staff_amount_total += $ward_procedure->staff_fee;
$counter++;
@endphp
@endforeach
@endif
@if (count($ward_services_records) > 0)
@foreach ($ward_services_records as $ward_service)
<tr>
<td>{{ $counter }}</td>
<td>
{{ get_full_name($ward_service->patient_id, "id", "first_name", "last_name", "patients") }} ({{ get_name($ward_service->patient_id, "id", "number", "patients") }})
</td>
<td>
{{ get_name(get_name($ward_service->patient_id, "id", "category_id", "patients"), "id", "name", "patient_categories") }}
</td>
<td>
<span class="label label-info">{{ get_name($ward_service->ward_id, "id", "name", "wards") }}</span>
</td>
<td>
</td>
<td>
{{ streamline_date($ward_service->created_at) }}
</td>
@php
$service_consumed = $ward_service->service_id;
$performed_by = null;
if (str_contains($service_consumed, '__')){
$service_and_performed_by_array = explode("__", $service_consumed);
$service_id = $service_and_performed_by_array[0];
$performed_by = $service_and_performed_by_array[1];
} else{
$service_id = $service_consumed;
}
@endphp
<td>
{{ get_name($service_id, "id", "name", "services") }}
</td>
<td>
{{ ugandan_shillings($ward_service->unit_price) }}
</td>
<td>
{{ get_full_name($performed_by, "id", "first_name", "last_name", "users") }}
</td>
<td>
{{ ugandan_shillings((int)$ward_service->staff_fee) }}
</td>
</tr>
@php
$ward_service_cost = $ward_service->unit_price;
$grand_prices_amount_total += $ward_service_cost;
$grand_staff_amount_total += $ward_service->staff_fee;
$counter++;
@endphp
@endforeach
@endif
</tbody>
<tfoot>
<td></td>
<td><strong>Total</strong></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><strong>{{ ugandan_shillings($grand_prices_amount_total) }}</strong></td>
<td></td>
<td><strong>{{ ugandan_shillings($grand_staff_amount_total) }}</strong></td>
</tfoot>
</table>
</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 src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<script>
$(document).ready(function() {
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
footer: true,
buttons: [
'copy',
{ extend: 'csv',
footer: true,
message: '<?php echo __('general_settings.staff_payments_report');?>'
},
{ extend: 'excel',
message: '<?php echo __('general_settings.staff_payments_report');?>',
footer: true,
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
},
sheetName: '<?php echo __('general_settings.staff_payments_report');?>'
},
{ extend: 'pdf',
message: '<?php echo __('general_settings.staff_payments_report');?>',
footer: true,
orientation: 'landscape',
pageSize: 'LETTER',
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
},
customize: function(doc) {
doc.defaultStyle.fontSize = 10;
}
},
{ extend: 'print',
message: '<?php echo __('general_settings.staff_payments_report');?>',
footer: true,
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
},
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');
}
}
]
});
$('.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');
});
</script>
@endpush
@@ -0,0 +1,478 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/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-6 col-md-7 col-sm-7 col-xs-12">
<h4 class="page-title">Record performed services</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li class="active">Record performed services</li>
<li><a href="{{ url('staff_payments_report') }}">Staff payments report</a></li>
<li><a href="{{ url('finance') }}">Finance Home</a></li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('flash::message')
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="white-box">
{{ Form::open(['method'=>'post','url' => 'store_recorded_performed_service']) }}
@php $patient_insurance_status = patient_insurance_status($patient_id); @endphp
{{ Form::hidden('patient_id', $patient_id, ['id' => 'patient_id'])}}
{{ Form::hidden('patient_insurance_status', $patient_insurance_status, ['id' => 'patient_insurance_status'])}}
<div class='row'>
<div class='col-md-12'>
<div id='payments_items'>
<table class='table color-bordered-table success-bordered-table'>
<thead>
<tr>
<th>
<div class='row'>
<div class='col-2'>Item Category</div>
<div class='col-2'>Performed Item</div>
<div class='col-1'>Item Unit Price</div>
<div class='col-1'>Item Total Price</div>
<div class='col-1'>Quantity</div>
<div class='col-2'>Performed By</div>
<div class='col-2'>Performance Fee</div>
<div class='col-1'></div>
</div>
</th>
</tr>
</thead>
@php
$option_employees = "<option value=''>-select-</option>";
foreach ($employees as $employee){
$employee_first_name = str_replace("'", '', $employee->first_name);
$employee_first_name = str_replace("\"", '', $employee_first_name);
$employee_last_name = str_replace("'", '', $employee->last_name);
$employee_last_name = str_replace("\"", '', $employee_last_name);
$option_employees .= "<option value='$employee->id'>$employee_first_name $employee_last_name</option>";
}
$option_procedures = "<option value=''>-select-</option>";
foreach ($procedures as $procedure){
$procedure_name = str_replace("'", '', $procedure->name);
$procedure_name = str_replace("\"", '', $procedure_name);
$procedure_name = preg_replace('/[^A-Za-z0-9\-]/', '', $procedure_name);
$option_procedures .= "<option value='$procedure->id'>$procedure_name</option>";
}
$option_investigations = "<option value=''>-select-</option>";
foreach ($investigations as $investigation){
$inv_name = str_replace("'", '', $investigation->name);
$inv_name = str_replace("\"", '', $inv_name);
$inv_name = preg_replace('/[^A-Za-z0-9\-]/', '', $inv_name);
$option_investigations .= "<option value='$investigation->id'>$inv_name</option>";
}
$option_services = "<option value=''>-select-</option>";
foreach ($services as $service){
$service_name = str_replace("'", '', $service->name);
$service_name = str_replace("\"", '', $service_name);
$service_name = str_replace("+", '', $service_name);
$service_name = preg_replace('/[^A-Za-z0-9\-]/', '', $service_name);
$option_services .= "<option value='$service->id'>$service_name</option>";
}
$option_sundries = "<option value=''>-select-</option>";
foreach ($sundries as $sundry){
$sundry_name = str_replace("'", '', $sundry->name);
$sundry_name = str_replace("\"", '', $sundry_name);
$sundry_name = preg_replace('/[^A-Za-z0-9\-]/', '', $sundry_name);
$option_sundries .= "<option value='$sundry->id'>$sundry->name</option>";
}
@endphp
<tbody class='input_fields_wrap'>
<tr>
<td>
<div class='row'>
<div class='col-2'>
<div class='control-group'>
<div class='form-group'>
<select name='item_category[]' id='item_category_0' class='form-control compulsory required item_category_select' required>
<option value=''>-Select-</option>
<option value='1'>Procedure</option>
<option value='2'>Investigation</option>
<option value='3'>Service Or Consultation</option>
<option value='4'>Sundry</option>
</select>
</div>
</div>
</div>
<div class='col-2'>
<div class='form-group'>
<div class='controls' id="investigations_div_0">
<select name='performed_investigation_item[]' id='performed_inv_item_0' class='form-control compulsory required performed_item_select'>
@php echo $option_investigations; @endphp
</select>
</div>
<div class='controls' id="procedures_div_0" style="display: none;">
<select name='performed_procedure_item[]' id='performed_pro_item_0' class='form-control compulsory required performed_item_select'>
@php echo $option_procedures; @endphp
</select>
</div>
<div class='controls' id="services_div_0" style="display: none;">
<select name='performed_service_item[]' id='performed_serv_item_0' class='form-control compulsory required performed_item_select'>
@php echo $option_services; @endphp
</select>
</div>
<div class='controls' id="sundries_div_0" style="display: none;">
<select name='performed_sundry_item[]' id='performed_sundry_item_0' class='form-control compulsory required performed_item_select'>
@php echo $option_sundries; @endphp
</select>
</div>
</div>
</div>
<div class='col-1'>
<div class='form-group'>
<div class='controls'>
<input type='number' name='item_price[]' id='item_price_0' class='form-control item_price compulsory' required/>
</div>
</div>
</div>
<div class='col-1'>
<div class='form-group'>
<div class='controls'>
<input type='number' name='item_total_price[]' id='item_total_price_0' class='form-control item_total_price compulsory' required readonly/>
</div>
</div>
</div>
<div class='col-1'>
<div class='form-group'>
<div class='controls'>
<input type='number' name='item_quantity[]' id='item_quantity_0' class='form-control item_quantity compulsory' required/>
</div>
</div>
</div>
<div class='col-2'>
<div class='control-group'>
<div id='performed_by_div_0' class='form-group'>
<select name='performed_by_id[]' id='performed_by_0' class='form-control performed_by_select'>
@php echo $option_employees; @endphp
</select>
</div>
</div>
</div>
<div class='col-2'>
<div class='control-group'>
<div id='performance_fee_0' class='form-group name_select'>
<input name='performance_fee[]' id='performance_fee_0' class='form-control item_select'>
</div>
</div>
</div>
<div class='col-1'>
<div class='form-group' style='margin-top: 10px;'>
<button class='btn btn-sm btn-rounded btn-success add_item' style='color: white; margin-left: 25px;'><i class='fa fa-plus'></i></button>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<br/>
<div class='row'>
<div style="float: right;">
<h3>Total:<span id="itemGrandTotal"></span></h3>
</div>
</div>
<div class='row'>
<div class='col-md-9'>
</div>
<div class='col-md-3'>
<button class='btn btn-rounded btn-info pull-right' id='save_performances_action' name='save_performances_action' value='save'>Save Performances</button>
</div>
</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 src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<script>
var max_rows = 20;
var wrapper = $(".input_fields_wrap"); //Fields wrapper
var add_button = $(".add_item");
var x = 1; // initial row count
add_button.click(function (e) { // on add input button click
e.preventDefault();
if (x < max_rows) {
$(wrapper).append("\
\<tr>\
<td>\
<div class='row'>\
\
<div class='col-2'>\
<div class='control-group'>\
<div class='form-group'>\
<select name='item_category[]' id='item_category_" + x + "' class='form-control compulsory required item_category_select' required><option value=''>-Select-</option><option value='1'>Procedure</option><option value='2'>Investigation</option><option value='3'>Service Or Consultation</option><option value='4'>Sundry</option>" +
"</select>\
</div>\
</div>\
</div>\
\
<div class='col-2'>\
<div class='form-group'>\
<div class='controls' id='investigations_div_" + x + "'>\
<div id='performed_item_div_" + x + "' class='form-group'>\
<select name='performed_investigation_item[]' id='performed_inv_item_" + x + "' class='form-control compulsory required performed_item_select'>" +
"<?php echo $option_investigations ?>" +
"</select>\
</div>\
</div>\
<div class='controls' id='procedures_div_" + x + "' style='display:none;'>\
<div id='performed_item_div_" + x + "' class='form-group'>\
<select name='performed_procedure_item[]' id='performed_pro_item_" + x + "' class='form-control compulsory required performed_item_select'>" +
"<?php echo $option_procedures ?>" +
"</select>\
</div>\
</div>\
<div class='controls' id='services_div_" + x + "' style='display:none;'>\
<div id='performed_item_div_" + x + "' class='form-group'>\
<select name='performed_service_item[]' id='performed_serv_item_" + x + "' class='form-control compulsory required performed_item_select'>" +
"<?php echo $option_services ?>" +
"</select>\
</div>\
</div>\
<div class='controls' id='sundries_div_" + x + "' style='display:none;'>\
<div id='performed_item_div_" + x + "' class='form-group'>\
<select name='performed_sundry_item[]' id='performed_sundry_item_" + x + "' class='form-control compulsory required performed_item_select'>" +
"<?php echo $option_sundries ?>" +
"</select>\
</div>\
</div>\
</div>\
</div>\
\
<div class='col-1'>\
<div class='form-group'>\
<div class='controls'>\
<input type='number' name='item_price[]' id ='item_price_" + x + "' class='form-control item_price compulsory' required>\
</div>\
</div>\
</div>\
<div class='col-1'>\
<div class='form-group'>\
<div class='controls'>\
<input type='number' name='item_total_price[]' id ='item_total_price_" + x + "' class='form-control item_total_price compulsory' required readonly>\
</div>\
</div>\
</div>\
\
<div class='col-1'>\
<div class='form-group'>\
<div class='controls'>\
<input type='number' name='item_quantity[]' id ='item_quantity_" + x + "' class='form-control item_quantity compulsory' required>\
</div>\
</div>\
</div>\
\
<div class='col-2'>\
<div class='control-group'>\
<div id='performed_by_div_" + x + "' class='form-group'>\
<select name='performed_by_id[]' id='performed_by_" + x + "' class='form-control performed_by_select'>" +
"<?php echo $option_employees ?>" +
"</select>\
</div>\
</div>\
</div>\
\
<div class='col-2'>\
<div class='control-group'>\
<div id='performance_fee_" + x + "' class='form-group name_select'>\
<input type='number' name='performance_fee[]' id='performance_fee_" + x + "' class='form-control item_select'>\
</div>\
</div>\
</div>\
\
<div class='col-1'>\
<div class='form-group' style='margin-top: 10px;'>\
<button class='remove_field btn btn-sm btn-rounded btn-danger' style='color: white; margin-left: 25px;'><i class='fa fa-trash'></i></button>\
</div>\
</div>\
</div>\
</td>\
</tr>"); // add row
generalSelect2Set('performed_by_'+x);
generalSelect2Set('performed_inv_item_'+x);
generalSelect2Set('performed_pro_item_'+x);
generalSelect2Set('performed_serv_item_'+x);
generalSelect2Set('performed_sundry_item_'+x);
$("select.item_select").change(function(){
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var name_selected = $(this).children("option:selected").val();
$("#name_" + id).val(parseInt(name_selected));
});
x++;
}
});
$(wrapper).on("click", ".remove_field", function (e) {
e.preventDefault();
$(this).parent('div').parent('div').parent('div').parent('td').parent('tr').remove();
// x--; // decrementing messes up the id referencing. If you're decrementing in this way, you're probably not submitting some data!!!!!!
});
$(".input_fields_wrap").on('change', ".performed_item_select", function () {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var category = $("#item_category_" + id).val();
var item = 0;
if(category === "1"){
item = $("#performed_pro_item_" + id).val();
} else if(category === "2"){
item = $("#performed_inv_item_" + id).val();
} else if(category === "3"){
item = $("#performed_serv_item_" + id).val();
} else if(category === "4"){
item = $("#performed_sundry_item_" + id).val();
}
let patient_id = $('#patient_id').val();
let patient_insurance_status = $('#patient_insurance_status').val();
$.ajax({
url: '/get_item_price',
data: {'category':category, 'item':item, 'patient_id': patient_id, 'patient_insurance_status': patient_insurance_status},
success: function(response){
$("#item_price_"+id).val(response);
$("#item_total_price_"+id).val(response);
calculateItemsTotal();
}
});
});
$(".performed_item_select,.performed_by_select").select2({
width: "100%"
});
$(".input_fields_wrap").on('change', ".item_category_select", function () {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
console.log("The selected category row id ==" + id);
//change the drop down options
var category = $("#item_category_" + id).val();
if (category === "1") {
$("#procedures_div_"+id).show();
$("#investigations_div_"+id).hide();
$("#services_div_"+id).hide();
$("#sundries_div_"+id).hide();
$("#item_quantity_"+id).attr('readonly', 'true');
$("#item_quantity_"+id).attr('value', 1);
} else if(category === "2"){
$("#procedures_div_"+id).hide();
$("#investigations_div_"+id).show();
$("#services_div_"+id).hide();
$("#sundries_div_"+id).hide();
$("#item_quantity_"+id).attr('readonly', 'true');
$("#item_quantity_"+id).attr('value', 1);
} else if(category === "3"){
$("#procedures_div_"+id).hide();
$("#investigations_div_"+id).hide();
$("#services_div_"+id).show();
$("#sundries_div_"+id).hide();
$("#item_quantity_"+id).removeAttr('readonly');
} else if(category === "4"){
$("#sundries_div_"+id).show();
$("#procedures_div_"+id).hide();
$("#investigations_div_"+id).hide();
$("#services_div_"+id).hide();
$("#item_quantity_"+id).removeAttr('readonly');
}
var item1 = $("#performed_inv_item_" + id).val();
var item2 = $("#performed_pro_item_" + id).val();
var item3 = $("#performed_serv_item_" + id).val();
});
$(".input_fields_wrap").on('change', ".item_quantity", function () {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var quantity = $("#item_quantity_" + id).val();
var unit_price = $("#item_price_" + id).val();
var total_price = quantity * unit_price;
$("#item_total_price_" + id).val(total_price);
calculateItemsTotal();
});
$(".input_fields_wrap").on('keyup', ".item_price", function () {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var quantity = $("#item_quantity_" + id).val();
var unit_price = $("#item_price_" + id).val();
var total_price = quantity * unit_price;
$("#item_total_price_" + id).val(total_price);
calculateItemsTotal();
});
function calculateItemsTotal() {
//loop through the prices
var auto_price_grand_total = 0;
$("[id^=item_total_price_]").each(function(){
var auto_price = $(this).val();
auto_price_grand_total += parseInt(auto_price);
});
//recalculate the grand total
$("#itemGrandTotal").html(auto_price_grand_total);
}
function generalSelect2Set(id) {
$('#'+id).select2({
width: "100%"
});
}
</script>
@endpush