mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-12 11:11:31 +00:00
1004 lines
61 KiB
PHP
Executable File
1004 lines
61 KiB
PHP
Executable File
@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.wards_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.wards_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 Ward', 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.ward')) }}
|
|
{{ 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)
|
|
@if($report_by == 1)
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="white-box">
|
|
@if($search_complete)
|
|
<h4 style="color: #0060BF; font-weight: bolder;">Results for <b>{{ get_name($ward_id, "id", "name", "wards") }}</b> from {{ streamline_date($start_date) }} to {{ streamline_date($end_date) }}</h4>
|
|
@else
|
|
<h4 style="color: #0060BF; font-weight: bolder;"></h4>
|
|
@endif
|
|
<div class="table-responsive">
|
|
<table class="table color-bordered-table success-bordered-table">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Drug</th>
|
|
<th>Quantity issued to ward</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 $counter = 1; $issued_total_sum = 0; $dispensed_total_sum = 0; @endphp
|
|
@if(count($ward_drug_results) > 0)
|
|
@foreach($ward_drug_results as $drug_id => $drug_quantity)
|
|
<tr>
|
|
<td>{{ $counter }}</td>
|
|
|
|
<td>{{ get_name($drug_id, "id", "name", "drugs") }}</td>
|
|
|
|
@php $drug_quantity_issued_to_ward = 0; @endphp
|
|
|
|
@foreach($quantity_issued_to_ward as $ward_item_request_record)
|
|
@php
|
|
$items_ids_array = explode(",", $ward_item_request_record->item_ids);
|
|
$items_issued_array = explode(",", $ward_item_request_record->quantity_issued_out);
|
|
|
|
for($i=0; $i < count($items_ids_array); $i++){
|
|
if($items_ids_array[$i] == $drug_id){
|
|
$drug_quantity_issued_to_ward += isset($items_issued_array[$i]) ? (int)$items_issued_array[$i] : 0;
|
|
}
|
|
}
|
|
@endphp
|
|
@endforeach
|
|
|
|
<!-- add those issued by ward_dispensings table too -->
|
|
@foreach($quantity_issued_to_ward_using_ward_dispensing_table as $others_issued)
|
|
@php
|
|
$drugs_ids_array = explode(",", $others_issued->drug_id);
|
|
$drugs_issued_array = explode(",", $others_issued->quantity_dispensed);
|
|
|
|
for($i=0; $i < count($drugs_ids_array); $i++){
|
|
if($drugs_ids_array[$i] == $drug_id){
|
|
$drug_quantity_issued_to_ward += isset($drugs_issued_array[$i]) ? (int)$drugs_issued_array[$i] : 0;
|
|
}
|
|
}
|
|
@endphp
|
|
@endforeach
|
|
|
|
<td>{{ $drug_quantity_issued_to_ward }}</td>
|
|
|
|
@php
|
|
$drug_quantity_issued_to_ward = is_numeric($drug_quantity_issued_to_ward) ? $drug_quantity_issued_to_ward : 0;
|
|
|
|
$drug_cost_price = get_name($drug_id, "id", "cost_price", "drugs");
|
|
$drug_cost_price = is_numeric($drug_cost_price) ? $drug_cost_price : 0;
|
|
|
|
$issued_money_value = $drug_quantity_issued_to_ward * $drug_cost_price;
|
|
$issued_total_sum += $issued_money_value;
|
|
@endphp
|
|
|
|
<td>
|
|
{{ ugandan_shillings($issued_money_value) }}
|
|
</td>
|
|
|
|
{{--<td>{{ $drug_quantity }}</td>--}}<!-- This is quantity prescribed -->
|
|
|
|
<td>
|
|
{{ $drug_qty_dispensed = isset($drug_dispensation_results[$drug_id]) ? $drug_dispensation_results[$drug_id] : 0 }}
|
|
</td>
|
|
|
|
<td>
|
|
@php
|
|
$dispensed_money_value = $drug_qty_dispensed * $drug_cost_price;
|
|
|
|
$dispensed_total_sum += $dispensed_money_value;
|
|
@endphp
|
|
{{ ugandan_shillings($dispensed_money_value) }}
|
|
</td>
|
|
|
|
<td>
|
|
{{ $drug_quantity_issued_to_ward - $drug_qty_dispensed }}
|
|
</td>
|
|
|
|
<td>
|
|
<!-- <button class="btn btn-success">Details</button> -->
|
|
{{ Form::open(['method'=>'post','route' => 'wards_consumption.wards_consumption_details']) }}
|
|
|
|
{{ Form::hidden('report_by', "1") }}
|
|
{{ Form::hidden('search_by_details', $search_by) }}
|
|
{{ Form::hidden('drug_details_for', $drug_id) }}
|
|
{{ Form::hidden('ward_details_for', $ward_id) }}
|
|
{{ Form::hidden('start_date', $start_date) }}
|
|
{{ Form::hidden('end_date', $end_date) }}
|
|
{{ Form::submit('Details', ['class'=>'btn btn-success ']) }}
|
|
|
|
{{ Form::close() }}
|
|
</td>
|
|
</tr>
|
|
@php $counter++; @endphp
|
|
@endforeach
|
|
@elseif(count($quantity_issued_to_ward) > 0)
|
|
@foreach($quantity_issued_to_ward as $ward_item_request_record)
|
|
@php
|
|
$items_ids_array = explode(",", $ward_item_request_record->item_ids);
|
|
$items_issued_array = explode(",",$ward_item_request_record->quantity_issued_out);
|
|
$item_qty_ass_array = [];
|
|
|
|
for($i=0; $i < count($items_ids_array); $i++){
|
|
if (array_key_exists($items_ids_array[$i], $item_qty_ass_array)) {
|
|
$item_qty_ass_array[$items_ids_array[$i]] += isset($items_issued_array[$i]) ? (int)$items_issued_array[$i] : 0;
|
|
} else {
|
|
$item_qty_ass_array[$items_ids_array[$i]] = isset($items_issued_array[$i]) ? (int)$items_issued_array[$i] : 0;
|
|
}
|
|
}
|
|
@endphp
|
|
@endforeach
|
|
|
|
@foreach($item_qty_ass_array as $drug_id => $drug_quantity)
|
|
<tr>
|
|
<td>{{ $counter }}</td>
|
|
<td>{{ get_name($drug_id, "id", "name", "drugs") }}</td>
|
|
<td>{{ $drug_quantity }}</td>
|
|
@php
|
|
$drug_quantity = is_numeric($drug_quantity) ? $drug_quantity : 0;
|
|
|
|
$drug_cost_price = get_name($drug_id, "id", "cost_price", "drugs");
|
|
$drug_cost_price = is_numeric($drug_cost_price) ? $drug_cost_price : 0;
|
|
|
|
$issued_money_value = $drug_quantity * $drug_cost_price;
|
|
$issued_total_sum += $issued_money_value;
|
|
@endphp
|
|
|
|
<td>
|
|
{{ ugandan_shillings($issued_money_value) }}
|
|
</td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td>
|
|
<!-- <button class="btn btn-success">Details</button> -->
|
|
{{ Form::open(['method'=>'post','route' => 'wards_consumption.wards_consumption_details']) }}
|
|
|
|
{{ Form::hidden('report_by', "1") }}
|
|
{{ Form::hidden('search_by_details', $search_by) }}
|
|
{{ Form::hidden('drug_details_for', $drug_id) }}
|
|
{{ Form::hidden('ward_details_for', $ward_id) }}
|
|
{{ Form::hidden('start_date', $start_date) }}
|
|
{{ Form::hidden('end_date', $end_date) }}
|
|
{{ Form::submit('Details', ['class'=>'btn btn-success', 'disabled']) }}
|
|
|
|
{{ Form::close() }}
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
@endif
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<td>Total</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>
|
|
</div>
|
|
</div>
|
|
@elseif($report_by == 2)
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="white-box">
|
|
@if($search_complete)
|
|
<h4 style="color: #0060BF; font-weight: bolder;">Results for <b>{{ get_name($selected_drug_id, "id", "name", "drugs") }}</b> from {{ streamline_date($start_date) }} to {{ streamline_date($end_date) }}</h4>
|
|
@else
|
|
<h4 style="color: #0060BF; font-weight: bolder;"></h4>
|
|
@endif
|
|
<div class="table-responsive">
|
|
<table class="table color-bordered-table success-bordered-table">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Ward</th>
|
|
<th>Quantity issued to ward</th>
|
|
<th>Money value(Quantity Issued)</th>
|
|
<!-- <th>Quantity prescribed</th> -->
|
|
<th>Quantity dispensed to patients</th>
|
|
<th>Money Value(Quantity Dispensed)</th>
|
|
<th>Variance</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@php $counter = 1; $issued_total_sum = 0; $dispensed_total_sum = 0; @endphp
|
|
@if(count($ward_drug_results) > 0)
|
|
@foreach($ward_drug_results as $ward_id => $drug_quantity)
|
|
<tr>
|
|
<td>{{ $counter }}</td>
|
|
|
|
<td>{{ get_name($ward_id, "id", "name", "wards") }}</td>
|
|
|
|
@php $drug_quantity_issued_to_ward = 0; @endphp
|
|
|
|
@foreach($quantity_issued_to_ward as $ward_item_request_record)
|
|
@php
|
|
$items_ids_array = explode(",", $ward_item_request_record->item_ids);
|
|
$items_issued_array = explode(",", $ward_item_request_record->quantity_issued_out);
|
|
$row_ward_id = $ward_item_request_record->ward_id;
|
|
|
|
for($i=0; $i < count($items_ids_array); $i++){
|
|
if(($items_ids_array[$i] == $selected_drug_id) && ($ward_id == $row_ward_id)){
|
|
$drug_quantity_issued_to_ward += isset($items_issued_array[$i]) ? (int)$items_issued_array[$i] : 0;
|
|
}
|
|
}
|
|
@endphp
|
|
@endforeach
|
|
|
|
<!-- add those issued by ward_dispensings table too -->
|
|
@foreach($quantity_issued_to_ward_using_ward_dispensing_table as $others_issued)
|
|
@php
|
|
$drugs_ids_array = explode(",", $others_issued->drug_id);
|
|
$drugs_issued_array = explode(",", $others_issued->quantity_dispensed);
|
|
$row_ward_id = $others_issued->ward_id;
|
|
|
|
for($i=0; $i < count($drugs_ids_array); $i++){
|
|
if(($drugs_ids_array[$i] == $selected_drug_id) && ($ward_id == $row_ward_id)){
|
|
$drug_quantity_issued_to_ward += (int)$drugs_issued_array[$i];
|
|
}
|
|
}
|
|
@endphp
|
|
@endforeach
|
|
|
|
<td>{{ $drug_quantity_issued_to_ward }}</td>
|
|
|
|
@php
|
|
$issued_money_value = $drug_quantity_issued_to_ward * get_name($selected_drug_id, "id", "cost_price", "drugs");
|
|
$issued_total_sum += $issued_money_value;
|
|
@endphp
|
|
|
|
<td>
|
|
{{ ugandan_shillings($issued_money_value) }}
|
|
</td>
|
|
|
|
{{--<td>{{ $drug_quantity }}</td>--}}<!-- This is quantity prescribed commented out -->
|
|
|
|
<td>
|
|
{{ $drug_qty_dispensed = isset($drug_dispensation_results[$ward_id]) ? $drug_dispensation_results[$ward_id] : 0 }}
|
|
</td>
|
|
|
|
<td>
|
|
@php
|
|
$dispensed_money_value = $drug_qty_dispensed * get_name($drug_id, "id", "cost_price", "drugs");
|
|
$dispensed_total_sum += $dispensed_money_value;
|
|
@endphp
|
|
{{ ugandan_shillings($dispensed_money_value) }}
|
|
</td>
|
|
|
|
<td>
|
|
{{ $drug_quantity_issued_to_ward - $drug_qty_dispensed }}
|
|
</td>
|
|
|
|
<td>
|
|
<!-- <button class="btn btn-success">Details</button> -->
|
|
{{ Form::open(['method'=>'post','route' => 'wards_consumption.wards_consumption_details']) }}
|
|
|
|
{{ Form::hidden('report_by', "1") }}
|
|
{{ Form::hidden('search_by_details', $search_by) }}
|
|
{{ Form::hidden('ward_details_for', $ward_id) }}
|
|
{{ Form::hidden('drug_details_for', $selected_drug_id) }}
|
|
{{ Form::hidden('start_date', $start_date) }}
|
|
{{ Form::hidden('end_date', $end_date) }}
|
|
{{ Form::submit('Consumption details', ['class'=>'btn btn-success ']) }}
|
|
|
|
{{ Form::close() }}
|
|
</td>
|
|
</tr>
|
|
@php $counter++; @endphp
|
|
@endforeach
|
|
@elseif(count($quantity_issued_to_ward) > 0)
|
|
@foreach($quantity_issued_to_ward as $ward_item_request_record)
|
|
@php
|
|
$items_ids_array = explode(",", $ward_item_request_record->item_ids);
|
|
$items_issued_array = explode(",",$ward_item_request_record->quantity_issued_out);
|
|
$ward_id = $ward_item_request_record->ward_id;
|
|
$ward_qty_ass_array = [];
|
|
|
|
for($i=0; $i < count($items_ids_array); $i++){
|
|
if ($selected_drug_id == $items_ids_array[$i]) {
|
|
if (array_key_exists($ward_id, $ward_qty_ass_array)) {
|
|
$ward_qty_ass_array[$ward_id] += isset($items_issued_array[$i]) ? (int)$items_issued_array[$i] : 0;
|
|
} else {
|
|
$ward_qty_ass_array[$ward_id] = isset($items_issued_array[$i]) ? (int)$items_issued_array[$i] : 0;
|
|
}
|
|
}
|
|
}
|
|
@endphp
|
|
@endforeach
|
|
|
|
@foreach($ward_qty_ass_array as $ward_id => $drug_quantity)
|
|
<tr>
|
|
<td>{{ $counter }}</td>
|
|
<td>{{ get_name($ward_id, "id", "name", "wards") }}</td>
|
|
<td>{{ $drug_quantity }}</td>
|
|
@php
|
|
$drug_quantity = is_numeric($drug_quantity) ? $drug_quantity : 0;
|
|
|
|
$drug_cost_price = get_name($selected_drug_id, "id", "cost_price", "drugs");
|
|
$drug_cost_price = is_numeric($drug_cost_price) ? $drug_cost_price : 0;
|
|
|
|
$issued_money_value = $drug_quantity * $drug_cost_price;
|
|
$issued_total_sum += $issued_money_value;
|
|
@endphp
|
|
|
|
<td>
|
|
{{ ugandan_shillings($issued_money_value) }}
|
|
</td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td>
|
|
{{ Form::open(['method'=>'post','route' => 'wards_consumption.wards_consumption_details']) }}
|
|
|
|
{{ Form::hidden('report_by', "2") }}
|
|
{{ Form::hidden('search_by_details', $search_by) }}
|
|
{{ Form::hidden('drug_details_for', $selected_drug_id) }}
|
|
{{ Form::hidden('start_date', $start_date) }}
|
|
{{ Form::hidden('end_date', $end_date) }}
|
|
{{ Form::submit('Details', ['class'=>'btn btn-success', 'disabled']) }}
|
|
|
|
{{ Form::close() }}
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
@endif
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<td>Total</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>
|
|
</div>
|
|
</div>
|
|
@elseif($report_by == 3)
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="white-box">
|
|
@if($search_complete)
|
|
<h4 style="color: #0060BF; font-weight: bolder;">Results for <b>{{ get_name($selected_sundry_id, "id", "name", "sundries") }}</b> from {{ streamline_date($start_date) }} to {{ streamline_date($end_date) }}</h4>
|
|
@else
|
|
<h4 style="color: #0060BF; font-weight: bolder;"></h4>
|
|
@endif
|
|
<div class="table-responsive">
|
|
<table class="table color-bordered-table success-bordered-table">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Sundry</th>
|
|
<th>Quantity issued to ward</th>
|
|
<th>Money value(Quantity Issued)</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@php
|
|
$counter = 1;
|
|
$issued_total_sum = 0;
|
|
$dispensed_total_sum = 0;
|
|
@endphp
|
|
|
|
@if(count($ward_drug_results) > 0)
|
|
@foreach($ward_drug_results as $ward_id => $sundry_quantity)
|
|
<tr>
|
|
<td>{{ $counter }}</td>
|
|
|
|
<td>{{ get_name($ward_id, "id", "name", "wards") }}</td>
|
|
|
|
<td>{{ $sundry_quantity }}</td>
|
|
|
|
@php
|
|
$issued_money_value = $sundry_quantity * get_name($selected_sundry_id, "id", "cost_price", "sundries");
|
|
$issued_total_sum += $issued_money_value;
|
|
@endphp
|
|
|
|
<td>
|
|
{{ ugandan_shillings($issued_money_value) }}
|
|
</td>
|
|
|
|
<td>
|
|
<!-- <button class="btn btn-success">Details</button> -->
|
|
{{ Form::open(['method'=>'post','route' => 'wards_consumption.wards_consumption_details']) }}
|
|
|
|
{{ Form::hidden('report_by', "3") }}
|
|
{{ Form::hidden('search_by_details', $search_by) }}
|
|
{{ Form::hidden('ward_details_for', $ward_id) }}
|
|
{{ Form::hidden('sundries_details_for', $selected_sundry_id) }}
|
|
{{ Form::hidden('start_date', $start_date) }}
|
|
{{ Form::hidden('end_date', $end_date) }}
|
|
{{ Form::submit('Consumption details', ['class'=>'btn btn-success ']) }}
|
|
|
|
{{ Form::close() }}
|
|
</td>
|
|
</tr>
|
|
@php $counter++; @endphp
|
|
@endforeach
|
|
@endif
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<td>Total</td>
|
|
<td></td>
|
|
<td></td>
|
|
<td>{{ ugandan_shillings($issued_total_sum) }}</td>
|
|
<td></td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@elseif($report_by == 4)
|
|
@elseif($report_by == 5)
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="white-box">
|
|
@if($search_complete)
|
|
<h4 style="color: #0060BF; font-weight: bolder;">Results for <b>{{ get_name($selected_general_items_id, "id", "name", "general_items") }}</b> from {{ streamline_date($start_date) }} to {{ streamline_date($end_date) }}</h4>
|
|
@else
|
|
<h4 style="color: #0060BF; font-weight: bolder;"></h4>
|
|
@endif
|
|
<div class="table-responsive">
|
|
<table class="table color-bordered-table success-bordered-table">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>General Item</th>
|
|
<th>Quantity issued to ward</th>
|
|
<th>Money value(Quantity Issued)</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@php
|
|
$counter = 1;
|
|
$issued_total_sum = 0;
|
|
$dispensed_total_sum = 0;
|
|
@endphp
|
|
|
|
@if(count($ward_drug_results) > 0)
|
|
@foreach($ward_drug_results as $ward_id => $general_items_quantity)
|
|
<tr>
|
|
<td>{{ $counter }}</td>
|
|
|
|
<td>{{ get_name($ward_id, "id", "name", "wards") }}</td>
|
|
|
|
<td>{{ $general_items_quantity }}</td>
|
|
|
|
@php
|
|
$issued_money_value = $general_items_quantity * get_name($selected_general_items_id, "id", "cost_price", "general_items");
|
|
$issued_total_sum += $issued_money_value;
|
|
@endphp
|
|
|
|
<td>
|
|
{{ ugandan_shillings($issued_money_value) }}
|
|
</td>
|
|
|
|
<td>
|
|
<!-- <button class="btn btn-success">Details</button> -->
|
|
{{ Form::open(['method'=>'post','route' => 'wards_consumption.wards_consumption_details']) }}
|
|
|
|
{{ Form::hidden('report_by', "3") }}
|
|
{{ Form::hidden('search_by_details', $search_by) }}
|
|
{{ Form::hidden('ward_details_for', $ward_id) }}
|
|
{{ Form::hidden('general_items_details_for', $selected_general_items_id) }}
|
|
{{ Form::hidden('start_date', $start_date) }}
|
|
{{ Form::hidden('end_date', $end_date) }}
|
|
{{ Form::submit('Consumption details', ['class'=>'btn btn-success ']) }}
|
|
|
|
{{ Form::close() }}
|
|
</td>
|
|
</tr>
|
|
@php $counter++; @endphp
|
|
@endforeach
|
|
@endif
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<td>Total</td>
|
|
<td></td>
|
|
<td></td>
|
|
<td>{{ ugandan_shillings($issued_total_sum) }}</td>
|
|
<td></td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@elseif($report_by == 6)
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="white-box">
|
|
@if($search_complete)
|
|
<h4 style="color: #0060BF; font-weight: bolder;">Results for <b>{{ get_name($general_items_id, "id", "name", "general_items") }}</b> from {{ streamline_date($start_date) }} to {{ streamline_date($end_date) }}</h4>
|
|
@else
|
|
<h4 style="color: #0060BF; font-weight: bolder;"></h4>
|
|
@endif
|
|
<div class="table-responsive">
|
|
<table class="table color-bordered-table success-bordered-table">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>General Items</th>
|
|
<th>Quantity issued to ward</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 $counter = 1; $issued_total_sum = 0; $dispensed_total_sum = 0; @endphp
|
|
@if(count($general_items_dispensation_results) > 0)
|
|
@foreach($general_items_dispensation_results as $general_items_id => $drug_quantity)
|
|
<tr>
|
|
<td>{{ $counter }}</td>
|
|
|
|
<td>{{ get_name($general_items_id, "id", "name", "general_items") }}</td>
|
|
|
|
@php $general_items_quantity_issued_to_ward = 0; @endphp
|
|
|
|
@foreach($quantity_issued_to_ward as $ward_item_request_record)
|
|
@php
|
|
$items_ids_array = explode(",", $ward_item_request_record->item_ids);
|
|
$items_issued_array = explode(",", $ward_item_request_record->quantity_issued_out);
|
|
|
|
for($i=0; $i < count($items_ids_array); $i++){
|
|
if($items_ids_array[$i] == $general_items_id){
|
|
$general_items_quantity_issued_to_ward += isset($items_issued_array[$i]) ? (int)$items_issued_array[$i] : 0;
|
|
}
|
|
}
|
|
@endphp
|
|
@endforeach
|
|
|
|
<td>{{ $general_items_quantity_issued_to_ward }}</td>
|
|
|
|
@php
|
|
$general_items_quantity_issued_to_ward = is_numeric($general_items_quantity_issued_to_ward) ? $general_items_quantity_issued_to_ward : 0;
|
|
|
|
$general_items_cost_price = get_name($general_items_id, "id", "cost_price", "general_items");
|
|
$general_items_cost_price = is_numeric($general_items_cost_price) ? $general_items_cost_price : 0;
|
|
|
|
$issued_money_value = $general_items_quantity_issued_to_ward * $general_items_cost_price;
|
|
$issued_total_sum += $issued_money_value;
|
|
@endphp
|
|
|
|
<td>
|
|
{{ ugandan_shillings($issued_money_value) }}
|
|
</td>
|
|
|
|
<td>
|
|
{{ $drug_qty_dispensed = isset($general_items_dispensation_results[$general_items_id]) ? $general_items_dispensation_results[$general_items_id] : 0 }}
|
|
</td>
|
|
|
|
<td>
|
|
@php
|
|
$dispensed_money_value = $drug_qty_dispensed * $drug_cost_price;
|
|
|
|
$dispensed_total_sum += $dispensed_money_value;
|
|
@endphp
|
|
{{ ugandan_shillings($dispensed_money_value) }}
|
|
</td>
|
|
|
|
<td>
|
|
{{ $sundry_quantity_issued_to_ward - $drug_qty_dispensed }}
|
|
</td>
|
|
|
|
<td>
|
|
{{ Form::open(['method'=>'post','route' => 'wards_consumption.wards_consumption_details']) }}
|
|
|
|
{{ Form::hidden('report_by', "4") }}
|
|
{{ Form::hidden('search_by_details', $search_by) }}
|
|
{{ Form::hidden('general_items_details_for', $general_items_id) }}
|
|
{{ Form::hidden('ward_details_for', $ward_id) }}
|
|
{{ Form::hidden('start_date', $start_date) }}
|
|
{{ Form::hidden('end_date', $end_date) }}
|
|
{{ Form::submit('Details', ['class'=>'btn btn-success ']) }}
|
|
|
|
{{ Form::close() }}
|
|
</td>
|
|
</tr>
|
|
@php $counter++; @endphp
|
|
@endforeach
|
|
@elseif(count($quantity_issued_to_ward) > 0)
|
|
@foreach($quantity_issued_to_ward as $ward_item_request_record)
|
|
@php
|
|
$items_ids_array = explode(",", $ward_item_request_record->item_ids);
|
|
$items_issued_array = explode(",",$ward_item_request_record->quantity_issued_out);
|
|
$item_qty_ass_array = [];
|
|
|
|
for($i=0; $i < count($items_ids_array); $i++){
|
|
if (array_key_exists($items_ids_array[$i], $item_qty_ass_array)) {
|
|
$item_qty_ass_array[$items_ids_array[$i]] += isset($items_issued_array[$i]) ? (int)$items_issued_array[$i] : 0;
|
|
} else {
|
|
$item_qty_ass_array[$items_ids_array[$i]] = isset($items_issued_array[$i]) ? (int)$items_issued_array[$i] : 0;
|
|
}
|
|
}
|
|
@endphp
|
|
@endforeach
|
|
|
|
@foreach($item_qty_ass_array as $sundry_id => $sundry_quantity)
|
|
<tr>
|
|
<td>{{ $counter }}</td>
|
|
<td>{{ get_name($sundry_id, "id", "name", "sundries") }}</td>
|
|
<td>{{ $sundry_quantity }}</td>
|
|
@php
|
|
$sundry_quantity = is_numeric($sundry_quantity) ? $sundry_quantity : 0;
|
|
|
|
$drug_cost_price = get_name($sundry_id, "id", "cost_price", "sundries");
|
|
$drug_cost_price = is_numeric($drug_cost_price) ? $drug_cost_price : 0;
|
|
|
|
$issued_money_value = $sundry_quantity * $drug_cost_price;
|
|
$issued_total_sum += $issued_money_value;
|
|
@endphp
|
|
|
|
<td>
|
|
{{ ugandan_shillings($issued_money_value) }}
|
|
</td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td>
|
|
<!-- <button class="btn btn-success">Details</button> -->
|
|
{{ Form::open(['method'=>'post','route' => 'wards_consumption.wards_consumption_details']) }}
|
|
|
|
{{ Form::hidden('report_by', "1") }}
|
|
{{ Form::hidden('search_by_details', $search_by) }}
|
|
{{ Form::hidden('drug_details_for', $sundry_id) }}
|
|
{{ Form::hidden('ward_details_for', $ward_id) }}
|
|
{{ Form::hidden('start_date', $start_date) }}
|
|
{{ Form::hidden('end_date', $end_date) }}
|
|
{{ Form::submit('Details', ['class'=>'btn btn-success', 'disabled']) }}
|
|
|
|
{{ Form::close() }}
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
@endif
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<td>Total</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>
|
|
</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 __('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();
|
|
$('#general_items_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() == 2) {
|
|
$('#drugs_div').show();
|
|
$('#sundries_div').hide();
|
|
$('#wards_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) {
|
|
$('#wards_div').hide();
|
|
$('#drugs_div').hide();
|
|
$('#sundries_div').hide();
|
|
$('#general_items_div').show();
|
|
//$('.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();
|
|
$('#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 {
|
|
$('#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,#general_items_select,#sundries_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 |