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
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,428 @@
@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/plugins/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">{{ __('ward_consumption.items_consumption_report') }}</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('stores.index') }}">{{ __('ward_consumption.stores_home') }}</a></li>
<li class="active">{{ __('ward_consumption.items_consumption_report') }}</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' => 'wards_consumption.ward_consumption_report', 'data-toggle' => 'validator']) }}
<div class="white-box">
<div class="row">
<div class="col-md-2">
<div class="form-group">
{{ Form::label('report_by', __('ward_consumption.report_by')) }}
{{ Form::select('report_by', ['' => '--Select--', 1 => 'Drugs Consumption Per Unit', 2 => 'Drug', 3 => 'Sundry', 4 => 'Sundries Consumption Per Unit', 5 => 'General Items', 6 => 'General Items Consumption Per Unit'], '', ['class' => 'form-control', 'id' => 'report_by', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-2">
<div id="wards_div" style="display: none;">
<div class="form-group">
{{ Form::label('ward_id', __('ward_consumption.unit')) }}
{{ Form::select('ward_id', $wards, '', ['class' => 'form-control col-sm-12', 'id' => 'wards_select']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div id="drugs_div" style="display: none;">
<div class="form-group">
{{ Form::label('drug_id', __('ward_consumption.drug')) }}
{{ Form::select('drug_id', $drugs, '', ['class' => 'form-control col-sm-12', 'id' => 'drugs_select']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div id="sundries_div" style="display: none;">
<div class="form-group">
{{ Form::label('sundry_id', 'Sundries') }}
{{ Form::select('sundry_id', $sundries, '', ['class' => 'form-control col-sm-12', 'id' => 'sundries_select']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div id="general_items_div" style="display: none;">
<div class="form-group">
{{ Form::label('general_items_id', 'General items') }}
{{ Form::select('general_items_id', $general_items, '', ['class' => 'form-control col-sm-12', 'id' => 'general_items_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>
@php
$grand_total_requested = $grand_cost_value = $grand_total_issued = 0;
@endphp
<div class="white-box">
<div class="table-responsive">
<h3>{{ $display }}</h3>
<hr>
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th style="width: 5%;">#</th>
<th>{{ __('stores.quantity_requested') }}</th>
<th>{{ __('stores.cost_value') }}</th>
<th>{{ __('stores.quantity_issued') }}</th>
<th>{{ __('stores.requested_by') }}</th>
<th>{{ __('stores.issued_by') }}</th>
<th>{{ __('stores.issued_on') }}</th>
<th></th>
</tr>
</thead>
<tbody>
@php $counter = 1; @endphp
@if(count($results) > 0)
@foreach($results as $result)
@php
$requested_item_id_explode = explode(",", $result->drug_id);
$item_id_explode = explode(",", $result->item_ids_issued_out);
$quantity_explode = explode(",", $result->quantity_requested);
$issued_out_explode = explode(",", $result->quantity_issued);
$item_cost_value_explode = explode(",", $result->cost_value);
@endphp
@for($x = 0; $x < count($item_id_explode); $x++)
@if($item_id_explode[$x] == $item_id)
<tr>
<td> {{ $counter }} </td>
<td>{{ $quantity_explode[$x] ?? "" }}</td>
<td>{{ ugandan_shillings($item_cost_value_explode[$x] ?? 0) }}</td>
<td>{{ $issued_out_explode[$x] ?? "" }}</td>
<td>{{ get_full_name($result->created_by, "id", "first_name", "last_name", "users") }}</td>
<td>{{ get_full_name($result->issued_by, "id", "first_name", "last_name", "users") }}</td>
<td>{{ streamline_date($result->issued_on) }}</td>
<td>
<form name="bill_form" action="{{ url('previous_issued_items_details') }}" method="post">
{{ csrf_field() }}
<input type="hidden" name="requisition_id" value="{{ $result->id }}"/>
<input type="hidden" name="item_type" value="{{ $item_type }}">
<button type="submit" name="add_bill_button" class="btn btn-sm btn-rounded btn-info">
<i class="fa fa-info-circle"></i>
<span style="margin-left: 10px;">{{ __('stores.details') }}</span>
</button>
</form>
</td>
</tr>
@php
$counter++;
$grand_total_requested += (int)$quantity_explode[$x] ?? 0;
$grand_total_issued += isset($issued_out_explode[$x]) ? (int)$issued_out_explode[$x] : 0;
$grand_cost_value += isset($item_cost_value_explode[$x]) ? (int)$item_cost_value_explode[$x] : 0;
@endphp
@endif
@endfor
@endforeach
@endif
{{-- start wards calculations --}}
@if(count($ward_results) > 0)
@foreach($ward_results as $ward_result)
@php
$item_id_explode = explode(",", $ward_result->item_ids_issued_out);
/* $quantity_explode = explode(",", $ward_result->item_quantities); */
$issued_out_explode = explode(",", $ward_result->quantity_issued_out);
/* $item_cost_value_explode = explode(",", $ward_result->cost_value); */
$requested_item_ids = explode(",", $ward_result->item_ids);
$requested_item_quantities = explode(",", $ward_result->item_quantities);
$requested_item_unit_costs = explode(",", $ward_result->item_unit_cost);
$item_ids = [];
for ($i=0; $i < count($requested_item_ids) ; $i++) {
if(!in_array($requested_item_ids[$i], $item_ids)) {$item_ids[] = $requested_item_ids[$i];}
if (isset($item_requests[$requested_item_ids[$i]])) {
$item_requests[$requested_item_ids[$i]] = (isset($requested_item_quantities[$i]) && is_numeric($requested_item_quantities[$i])) ? $requested_item_quantities[$i] : 0;
$item_costs[$requested_item_ids[$i]] = (isset($requested_item_unit_costs[$i]) && is_numeric($requested_item_unit_costs[$i])) ? $requested_item_unit_costs[$i] : 0;
} else {
$item_requests[$requested_item_ids[$i]] = (isset($requested_item_quantities[$i]) && is_numeric($requested_item_quantities[$i])) ? $requested_item_quantities[$i] : 0;
$item_costs[$requested_item_ids[$i]] = (isset($requested_item_unit_costs[$i]) && is_numeric($requested_item_unit_costs[$i])) ? $requested_item_unit_costs[$i] : 0;
}
}
@endphp
@for($x = 0; $x < count($item_id_explode); $x++)
@if($item_id_explode[$x] == $item_id)
<tr>
<td> {{ $counter }} </td>
<td>
{{ $item_requests[$item_id] ?? 0 }}
</td>
<td>
@php
$grand_total_requested += $item_requests[$item_id] ?? 0;
$cost_value = ($item_costs[$item_id] ?? 0) * ($item_requests[$item_id] ?? 0);
$grand_cost_value += $cost_value;
@endphp
{{ ugandan_shillings($cost_value) }}
</td>
<td>{{ $issued_out_explode[$x] ?? "" }}</td>
<td>{{ get_full_name($ward_result->created_by, "id", "first_name", "last_name", "users") }}</td>
<td>{{ get_full_name($ward_result->dispensed_by, "id", "first_name", "last_name", "users") }}</td>
<td>{{ streamline_date($ward_result->dispensation_date) }}</td>
<td>
<form name="bill_form" action="{{ url('previous_issued_items_details') }}" method="post">
{{ csrf_field() }}
<input type="hidden" name="requisition_id" value="{{ $ward_result->id }}"/>
<input type="hidden" name="item_type" value="{{ $item_type }}">
<button type="submit" name="add_bill_button" class="btn btn-sm btn-rounded btn-info">
<i class="fa fa-info-circle"></i>
<span style="margin-left: 10px;">{{ __('stores.details') }}</span>
</button>
</form>
</td>
</tr>
@php
$counter++;
$grand_total_issued += (int)$issued_out_explode[$x] ?? 0;
@endphp
@endif
@endfor
@endforeach
@endif
{{-- end wards calculations --}}
</tbody>
<tfoot>
<tr>
<td></td>
<td>{{ $grand_total_requested }}</td>
<td>{{ ugandan_shillings($grand_cost_value)}}</td>
<td>{{ $grand_total_issued }}</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/plugins/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,
order:[],
buttons: [
'copy',
{
extend: 'csv',
footer: true,
message: '<?php echo __('ward_consumption.ward_consumption_report'); ?>'
},
{
extend: 'excel',
message: '<?php echo __('ward_consumption.ward_consumption_report'); ?>',
footer: true,
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
sheetName: '<?php echo __('ward_consumption.ward_consumption_report'); ?>'
},
{
extend: 'pdf',
message: '<?php echo __('ward_consumption.ward_consumption_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 __('ward_consumption.ward_consumption_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) {
$('#wards_div').show();
$('#drugs_div').hide();
$('#sundries_div').hide();
$('#general_items_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) {
$('#drugs_div').show();
$('#wards_div').hide();
$('#sundries_div').hide();
$('#general_items_div').hide();
} else if ($(this).val() == 3) {
$('#sundries_div').show();
$('#wards_div').hide();
$('#drugs_div').hide();
$('#general_items_div').hide();
} else if ($(this).val() == 4) {
$('#wards_div').show();
$('#drugs_div').hide();
$('#sundries_div').hide();
$('#general_items_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() == 5) {
$('#general_items_div').show();
$('#wards_div').hide();
$('#drugs_div').hide();
$('#sundries_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() == 6) {
$('#wards_div').show();
$('#general_items_div').hide();
$('#drugs_div').hide();
$('#sundries_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 {
$('#wards_div,#drugs_div,#sundries_div,#general_items_div').hide();
}
});
/*
.form-control {
background-color: #fff;
border: 1px solid #e4e7ea;
border-radius: 0;
box-shadow: none;
color: #565656;
height: 38px;
max-width: 100%;
padding: 7px 12px;
transition: all 300ms linear 0s;
}
*/
$('#drugs_select,#wards_select,#sundries_select,#general_items_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,156 @@
@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">
<h5 class="page-title">Drug Consumption Details</h5>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">Dashboard</a></li>
<li><a href="{{ route('wards_consumption.index') }}">{{ __('stores.ward_consumption_report') }}</a></li>
<li class="active">Drug Consumption Details</li>
</ol>
</div>
</div>
<div class="white-box">
@include('flash::message')
<h3 class="heading" style="text-align: center; text-decoration: underline;">{{ ($name !== 'N/A')? $name:'Drug' }} Consumption Details</h3>
<div class="row">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th></th>
<th>Patient Number</th>
<th>Name</th>
<th>Gender</th>
<th>Age</th>
<th>Diagnosis</th>
<th>Quantity Given</th>
<th>Date Given</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@php $counter = 0; @endphp
@foreach($patients_results as $patient)
@php $dob = new Carbon\Carbon($patient->date_of_birth); $other_diagnoses =[];@endphp
<tr>
<td>{{ ++$counter }}.</td>
<td>{{ $patient->number }}</td>
<td>{!! insurance_flag($patient->id) !!}</td>
<td>{{ $patient->gender == 1 ? "Male" : "Female" }}</td>
<td>{{ $dob->diffInYears(Carbon\Carbon::now()) }}yrs</td>
<td>
@php
if(!empty($patient->primary_diagnosis)) echo '<b>Primary Diagnosis:</b> ' .get_name($patient->primary_diagnosis, 'id', 'name', 'diagnoses');
if(!empty($patient->other_diagnoses)) {
$diaganoses = unserialize($patient->other_diagnoses);
foreach ($diaganoses as $key => $diagnosis) $other_diagnoses[] = get_name($diagnosis, 'id', 'name', 'diagnoses');
echo '<br><b>Other Diagnoses:</b> ' . ucwords(implode(', ', $other_diagnoses));
}
if(!empty($patient->right_eye_diagnosis)) {
$diaganoses = explode(',', $patient->right_eye_diagnosis);
foreach ($diaganoses as $key => $diagnosis) $right_eye_diagnoses[] = get_name($diagnosis, 'id', 'name', 'diagnoses');
echo '<br><b>Right Eye Diagnoses:</b> ' . ucwords(implode(', ', $right_eye_diagnoses));
}
if(!empty($patient->left_eye_diagnosis)) {
$diaganoses = explode(',', $patient->left_eye_diagnosis);
foreach ($diaganoses as $key => $diagnosis) $left_eye_diagnoses[] = get_name($diagnosis, 'id', 'name', 'diagnoses');
echo '<br><b>Left Eye Diagnoses:</b> ' . ucwords(implode(', ', $left_eye_diagnoses));
}
@endphp
</td>
<td>{{ $patient->quantity_given }}</td>
<td>{{ streamline_date($patient->date_given) }}</td>
<td>
@if (!empty($patient->episode_id))
{{ Form::open(['route' => 'wards.route_patient_episode', 'target' => '_blank']) }}
<input type="hidden" name="episode_id" value="{{ $patient->episode_id }}">
@if(Auth::user()->can('view-inpatient-sheet'))
<button type="submit" name="submit" class="btn btn-success btn-block"
value="inpatient_sheet">{{ __('wards.inpatient_sheet') }}</button>
@endif
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
{{-- <strong>Total number of patients: <span id="total" style=" color:blue;">{{ count($patients_results) }}</span></strong> --}}
</div>
</div>
@endsection
@push('scripts')
<!-- Typehead Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/typeahead.js-master/dist/typeahead.bundle.min.js') }}"></script>
<!-- Data table javascript -->
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
jQuery('#datepicker-from, #datepicker-to').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
});
$('.table').DataTable({
dom: 'Bfrtip',
order: [],
buttons: [{
extend: 'copy',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5]
},
title: 'Drug Consumption Details'
},
{
extend: 'csv',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5]
},
title: 'Drug Consumption Details'
},
{
extend: 'pdf',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5]
},
title: 'Drug Consumption Details'
},
{
extend: 'print',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5]
},
title: 'Drug Consumption Details'
}
]
});
</script>
@endpush
@@ -0,0 +1,515 @@
@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">{{ __('ward_consumption.items_consumption_report') }}</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('stores.index') }}">{{ __('ward_consumption.stores_home') }}</a></li>
<li class="active">{{ __('ward_consumption.items_consumption_report') }}</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' => 'wards_consumption.ward_consumption_report', 'data-toggle' => 'validator']) }}
<div class="white-box">
<div class="row">
<div class="col-md-2">
<div class="form-group">
{{ Form::label('report_by', __('ward_consumption.report_by')) }}
{{ Form::select('report_by', ['' => '--Select--', 1 => 'Drugs Consumption Per Unit', 2 => 'Drug', 3 => 'Sundry', 4 => 'Sundries Consumption Per Ward', 5 => 'General Items', 6 => 'General Items Consumption Per Ward'], '', ['class' => 'form-control', 'id' => 'report_by', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-2">
<div id="wards_div" style="display: none;">
<div class="form-group">
{{ Form::label('ward_id', __('ward_consumption.unit')) }}
{{ Form::select('ward_id', $wards, '', ['class' => 'form-control col-sm-12', 'id' => 'wards_select']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div id="drugs_div" style="display: none;">
<div class="form-group">
{{ Form::label('drug_id', __('ward_consumption.drug')) }}
{{ Form::select('drug_id', $drugs, '', ['class' => 'form-control col-sm-12', 'id' => 'drugs_select']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div id="sundries_div" style="display: none;">
<div class="form-group">
{{ Form::label('sundry_id', 'Sundries') }}
{{ Form::select('sundry_id', $sundries, '', ['class' => 'form-control col-sm-12', 'id' => 'sundries_select']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div id="general_items_div" style="display: none;">
<div class="form-group">
{{ Form::label('general_items_id', 'General items') }}
{{ Form::select('general_items_id', $general_items, '', ['class' => 'form-control col-sm-12', 'id' => 'general_items_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)
<div class="white-box">
<h4 style="color: #0060BF; font-weight: bolder;">{!! $search_text !!}</h4>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>
@if ($report_by == 1)
Drug
@elseif($report_by == 2 || $report_by == 3 || $report_by == 5)
Unit
@elseif($report_by == 4)
Sundry
@elseif($report_by == 6)
General Items
@endif
</th>
<th>Quantity requested</th>
<th>Quantity issued</th>
<th>Money value(Quantity Issued)</th>
<th>Quantity dispensed to patients</th>
<th>Money Value(Quantity Dispensed)</th>
<th>Variance</th>
{{-- <th></th> --}}
</tr>
</thead>
<tbody>
@php
$issued_total_sum = 0;
$dispensed_total_sum = 0;
if ($report_by == 2 || $report_by == 3 || $report_by == 5) {
$item_ids = $array_of_wards_to_loop;
}
@endphp
@for ($i = 0; $i < count($item_ids); $i++)
@php
if($report_by == 1 || $report_by == 4){
$item_patient_ids = !empty($patient_ids[$item_ids[$i]])? array_unique($patient_ids[$item_ids[$i]]):[];
}
@endphp
<tr>
<td>
{{ $i + 1 }}
</td>
<td>
@if ($report_by == 1)
{{ get_name($item_ids[$i], 'id', 'name', 'drugs') }}
@elseif ($report_by == 2 || $report_by == 5)
{{ Form::hidden('item_id', $selected_drug_id) }}
{{ Form::hidden('ward_id', $array_of_wards_to_loop[$i]) }}
@elseif ($report_by == 3)
{{ Form::hidden('item_id', $selected_sundry_id) }}
{{ Form::hidden('ward_id', $array_of_wards_to_loop[$i]) }}
@if ($array_of_wards_to_loop[$i] == "pharmacy")
Pharmacy
@else
{{ get_name($array_of_wards_to_loop[$i], 'id', 'name', 'wards') }}
@endif
@elseif ($report_by == 4)
{{ get_name($item_ids[$i], 'id', 'name', 'sundries') }}
@elseif ($report_by == 6)
{{ get_name($item_ids[$i], 'id', 'name', 'general_items') }}
@endif
</td>
<td>
@php
$item_requests_total = $item_requests[$item_ids[$i]] ?? 0;
@endphp
{{ Form::open(['method'=>'post','route' => 'wards_consumption.issued_items_drill_down', 'target' => "_blank", 'id' =>'drill_down']) }}
{{ Form::hidden('report_by', $report_by) }}
{{ Form::hidden('start_date', $start_date) }}
{{ Form::hidden('end_date', $end_date) }}
{{ Form::hidden('wards',serialize($wards)) }}
@if ($report_by == 1 || $report_by == 4)
{{ Form::hidden('ward_id', $ward_id) }}
{{ Form::hidden('item_id', $item_ids[$i]) }}
@elseif ($report_by == 2 || $report_by == 3 || $report_by == 5)
{{ Form::hidden('item_id', $selected_drug_id) }}
{{ Form::hidden('ward_id', $array_of_wards_to_loop[$i]) }}
@else
{{ Form::hidden('ward_id', 0) }}
@endif
<button class="btn btn-link">{{ $item_requests_total }}</button>
</td>
<td>
@php
$item_issued_total = $item_consumption[$item_ids[$i]] ?? 0;
@endphp
</td>
<td>
@php
if ($report_by == 1) {
$cost_price = get_name($item_ids[$i], 'id', 'cost_price', 'drugs');
} elseif ($report_by == 2) {
$cost_price = get_name($selected_drug_id, 'id', 'cost_price', 'drugs');
} elseif ($report_by == 3) {
$cost_price = get_name($selected_sundry_id, 'id', 'cost_price', 'sundries');
} elseif ($report_by == 4) {
$cost_price = get_name($item_ids[$i], 'id', 'cost_price', 'sundries');
} elseif ($report_by == 5) {
$cost_price = get_name($selected_general_items_id, 'id', 'cost_price', 'general_items');
} elseif ($report_by == 6) {
$cost_price = get_name($item_ids[$i], 'id', 'cost_price', 'general_items');
}
$cost_price = is_numeric($cost_price) ? $cost_price : 0;
$issued_money_value = $item_issued_total * $cost_price;
$issued_total_sum += $issued_money_value;
@endphp
{{ ugandan_shillings($issued_money_value) }}
</td>
<td>
@php
$dispensations_to_patients_no = $patient_consumptions[$item_ids[$i]] ?? 0;
@endphp
@if (!empty($item_patient_ids))
{{ Form::open(['method'=>'post','route' => 'wards_consumption.patient_drill_down', 'target' => "_blank", 'id' =>'drill_down']) }}
{{ Form::hidden('item_id', $item_ids[$i]) }}
{{ Form::hidden('report_by', $report_by) }}
{{ Form::hidden('start_date', $start_date) }}
{{ Form::hidden('end_date', $end_date) }}
{{ Form::hidden('wards',serialize($wards)) }}
@if ($report_by == 1 || $report_by == 4)
{{ Form::hidden('ward_id', $ward_id) }}
@elseif ($report_by == 2 || $report_by == 3 || $report_by == 5)
{{ Form::hidden('ward_id', $array_of_wards_to_loop[$i]) }}
@else
{{ Form::hidden('ward_id', 0) }}
@endif
{{ Form::hidden('patient_ids', serialize($item_patient_ids)) }}
<button class="btn btn-link">{{ $dispensations_to_patients_no }}</button>
{{ Form::close() }}
@else
{{-- point to the diespensation report under pharmacy module --}}
@if ($report_by == 2 || $report_by == 3 || $report_by == 5)
@if ($array_of_wards_to_loop[$i] == "pharmacy")
{{-- Pharmacy --}}
@else
{{-- {{ get_name($array_of_wards_to_loop[$i], 'id', 'name', 'wards') }} --}}
@endif
@endif
@if ($report_by == 2)
{{ Form::open(['method'=>'post','route' => 'pharmacy.pharmacy_dispensation_report_drugs', 'target' => "_blank", 'id' =>'drill_down']) }}
{{ Form::hidden('search_by', 2) }}
{{ Form::hidden('drug_id', $selected_drug_id) }}
{{ Form::hidden('start_date', \Carbon\Carbon::parse($start_date)->format('d/m/Y')) }}
{{ Form::hidden('end_date', \Carbon\Carbon::parse($end_date)->format('d/m/Y')) }}
{{-- {{ Form::hidden('wards',serialize($wards)) }} --}}
<button class="btn btn-link">{{ $dispensations_to_patients_no }}</button>
{{ Form::close() }}
@elseif ($report_by == 3)
{{ Form::open(['method'=>'post','route' => 'wards_consumption.patient_drill_down', 'target' => "_blank", 'id' =>'drill_down']) }}
{{ Form::hidden('item_id', $selected_sundry_id) }}
{{ Form::hidden('report_by', $report_by) }}
{{ Form::hidden('start_date', $start_date) }}
{{ Form::hidden('end_date', $end_date) }}
{{ Form::hidden('wards',serialize($wards)) }}
{{ Form::hidden('ward_id', $array_of_wards_to_loop[$i]) }}
<button class="btn btn-link">{{ $dispensations_to_patients_no }}</button>
{{ Form::close() }}
@else
{{ $dispensations_to_patients_no }}
@endif
@endif
</td>
<td>
@php
$dispensed_money_value = $dispensations_to_patients_no * $cost_price;
$dispensed_total_sum += $dispensed_money_value;
@endphp
{{ ugandan_shillings($dispensed_money_value) }}
</td>
<td>
{{ $item_issued_total - $dispensations_to_patients_no }}
</td>
{{-- <td></td> --}}
</tr>
@endfor
</tbody>
<tfoot>
<tr>
<td>Total</td>
<td></td>
<td></td>
<td></td>
<td>{{ ugandan_shillings($issued_total_sum) }}</td>
<td></td>
<td>{{ ugandan_shillings($dispensed_total_sum) }}</td>
<td></td>
{{-- <td></td> --}}
</tr>
</tfoot>
</table>
</div>
</div>
@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,
order:[],
buttons: [
'copy',
{
extend: 'csv',
footer: true,
message: '<?php echo __('ward_consumption.ward_consumption_report'); ?>'
},
{
extend: 'excel',
message: '<?php echo __('ward_consumption.ward_consumption_report'); ?>',
footer: true,
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
sheetName: '<?php echo __('ward_consumption.ward_consumption_report'); ?>'
},
{
extend: 'pdf',
message: '<?php echo __('ward_consumption.ward_consumption_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 __('ward_consumption.ward_consumption_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) {
$('#wards_div').show();
$('#drugs_div').hide();
$('#sundries_div').hide();
$('#general_items_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) {
$('#drugs_div').show();
$('#wards_div').hide();
$('#sundries_div').hide();
$('#general_items_div').hide();
} else if ($(this).val() == 3) {
$('#sundries_div').show();
$('#wards_div').hide();
$('#drugs_div').hide();
$('#general_items_div').hide();
} else if ($(this).val() == 4) {
$('#wards_div').show();
$('#drugs_div').hide();
$('#sundries_div').hide();
$('#general_items_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() == 5) {
$('#general_items_div').show();
$('#wards_div').hide();
$('#drugs_div').hide();
$('#sundries_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() == 6) {
$('#wards_div').show();
$('#general_items_div').hide();
$('#drugs_div').hide();
$('#sundries_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 {
$('#wards_div,#drugs_div,#sundries_div,#general_items_div').hide();
}
});
/*
.form-control {
background-color: #fff;
border: 1px solid #e4e7ea;
border-radius: 0;
box-shadow: none;
color: #565656;
height: 38px;
max-width: 100%;
padding: 7px 12px;
transition: all 300ms linear 0s;
}
*/
$('#drugs_select,#wards_select,#sundries_select,#general_items_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,283 @@
@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" />
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.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">{{ __('ward_consumption.wards_consumption_details') }}</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('stores.index') }}">{{ __('ward_consumption.stores_home') }}</a></li>
<li><a href="{{ route('wards_consumption.index') }}">{{ __('ward_consumption.wards_consumption_report') }}</a></li>
<li class="active">{{ __('ward_consumption.wards_consumption_details') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('flash::message')
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
@if($report_by == 3)
<h4 style="color: #0060BF; font-weight: bolder;">Details for <b>{{ get_name($ward_id, "id", "name", "wards") }}</b> from <b>{{ streamline_date($start_date) }}</b> to <b>{{ streamline_date($end_date) }}</b></h4>
<div class="table-responsive">
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Quantity</th>
<th>Monetary Value</th>
<th>Issued on</th>
<th>Received by</th>
<th>Dispensed By</th>
</tr>
</thead>
<tbody>
@php
$sundries_ids_array = [];
$counter = 1;
$total_qty = 0;
$total_money = 0;
@endphp
@foreach ($ward_item_request_records as $record)
@php
$record_sundries_ids_array = explode(",", $record->item_ids);
$record_quantities_array = explode(",", $record->quantity_issued_out);
@endphp
@if (in_array($sundry_id, $record_sundries_ids_array))
@for ($i=0; $i < count($record_sundries_ids_array) ; $i++)
@if ($record_sundries_ids_array[$i] == $sundry_id)
@if($ward_id == $record->ward_id)
<tr>
<td>{{ $counter }}</td>
<td>{{ get_name($sundry_id, "id", "name", "sundries")}}</td>
<td>{{ $record_quantities_array[$i] }}</td>
<td>
@php
$total_money += $record_quantities_array[$i] * get_name($sundry_id, "id", "cost_price", "sundries");
@endphp
{{ ugandan_shillings($record_quantities_array[$i] * get_name($sundry_id, "id", "cost_price", "sundries")) }}
</td>
<td>{{ streamline_date($record->dispensation_date) }}</td>
<td>{{ get_full_name($record->received_by, "id", "first_name", "last_name", "users")}}</td>
<td>{{ get_full_name($record->dispensed_by, "id", "first_name", "last_name", "users")}}</td>
</tr>
@php
$total_qty += $record_quantities_array[$i];
$counter++;
@endphp
@endif
@endif
@endfor
@endif
@endforeach
</tbody>
<tfoot>
<tr>
<td><strong>Total</strong></td>
<td></td>
<td><strong>{{ $total_qty }}</strong></td>
<td><strong>{{ ugandan_shillings($total_money) }}</strong></td>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
@elseif($report_by == 4)
<h4 style="color: #0060BF; font-weight: bolder;">Details for <b>{{ get_name($ward_id, "id", "name", "wards") }}</b> from <b>{{ streamline_date($start_date) }}</b> to <b>{{ streamline_date($end_date) }}</b></h4>
<div class="table-responsive">
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>Patient Number</th>
<th>Patient Name</th>
<th>Quantity Dispensed</th>
<th>Dispensed By</th>
</tr>
</thead>
<tbody>
@if(count($ward_sundry_dispensations) > 0)
@php $counter = 1; $total_qty = 0; @endphp
@foreach($ward_sundry_dispensations as $record)
<tr>
<td>{{ $counter }}</td>
<td>{{ get_name($record->patient_id, "id", "number", "patients") }}</td>
<td>
{{ get_full_name($record->patient_id, "id", "first_name", "last_name", "patients") }}
</td>
<td>
{{ $record->quantity_given }}
@php
$total_qty += is_numeric($record->quantity_given) ? $record->quantity_given : 0;
@endphp
</td>
<td>
{{ get_full_name($record->created_by, "id", "first_name","last_name", "users") }}
</td>
</tr>
@php $counter++; @endphp
@endforeach
@endif
</tbody>
<tfoot>
<tr>
<td></td>
<td><strong>Total</strong></td>
<td></td>
<td><strong>{{ $total_qty }}</strong></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
@else
<h4 style="color: #0060BF; font-weight: bolder;">Details for <b>{{ get_name($ward_id, "id", "name", "wards") }}</b> from <b>{{ streamline_date($start_date) }}</b> to <b>{{ streamline_date($end_date) }}</b></h4>
<div class="table-responsive">
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>Patient Number</th>
<th>Patient Name</th>
<th>Quantity Dispensed</th>
<th>Dispensed By</th>
</tr>
</thead>
<tbody>
@if(count($ward_treatment_dispensations) > 0)
@php $counter = 1; $total_qty = 0; @endphp
@foreach($ward_treatment_dispensations as $record)
<tr>
<td>{{ $counter }}</td>
<td>{{ get_name($record->patient_id, "id", "number", "patients") }}</td>
<td>
{{ get_full_name($record->patient_id, "id", "first_name", "last_name", "patients") }}
</td>
<td>
{{ $record->quantity_given }}
@php
$total_qty += is_numeric($record->quantity_given) ? $record->quantity_given : 0;
@endphp
</td>
<td>
{{ get_full_name($record->created_by, "id", "first_name","last_name", "users") }}
</td>
</tr>
@php $counter++; @endphp
@endforeach
@endif
</tbody>
<tfoot>
<tr>
<td></td>
<td><strong>Total</strong></td>
<td></td>
<td><strong>{{ $total_qty }}</strong></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
@endif
</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>
$(document).ready(function() {
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
]
});
$('#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) {
$('#wards_div').show();
$('#drugs_div').hide();
}
else if ($(this).val() == 2) {
$('#drugs_div').show();
$('#wards_div').hide();
}
else {
$('#wards_div,#drugs_div').hide();
}
});
$('#drugs_select,#wards_select').select2({
placeholder: "-- select --"
});
$('.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