resolved conflicts

This commit is contained in:
2025-03-31 03:46:05 +03:00
6454 changed files with 1520539 additions and 9 deletions
@@ -0,0 +1,59 @@
@extends('layouts.main')
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('wards.add_ward') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('wards.dashboard') }}</a></li>
<li><a href="{{ route('hmis_wards.index') }}">{{ __('wards.hmis_wards') }}</a></li>
<li class="active">{{ __('wards.create') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('ward_management::hmis_wards.menu')
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
{{ Form::open(['route' => 'hmis_wards.store', 'data-toggle' => 'validator']) }}
<div class="row" id="optionsList">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('name', __('wards.ward_name')) }}
{{ Form::text('name', '', ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('slug', __('wards.slug')) }}
{{ Form::text('slug', '', ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
</div>
{{ Form::button(__('wards.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10 submit-btn']) }}
{{ Form::button(__('wards.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
{{ Form::close() }}
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
@endpush
@@ -0,0 +1,62 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('wards.edit_ward') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('wards.dashboard') }}</a></li>
<li><a href="{{ route('hmis_wards.index') }}">{{ __('wards.hmis_wards') }}</a></li>
<li class="active">{{ __('wards.edit') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('ward_management::hmis_wards.menu')
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
{{ Form::model($ward, ['method' => 'PUT', 'route' => ['hmis_wards.update',$ward], 'data-toggle' => 'validator']) }}
<div class="form-group">
{{ Form::label('name', __('wards.ward_name')) }}
{{ Form::text('name', $ward->name, ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('slug', __('wards.slug')) }}
{{ Form::text('slug', $ward->slug, ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
{{ Form::button(__('wards.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
{{ Form::button(__('wards.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
{{ Form::close() }}
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
$('#type').select2();
</script>
@endpush
@@ -0,0 +1,91 @@
@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" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('wards.activate_wards') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('wards.dashboard') }}</a></li>
<li><a href="{{ route('hmis_wards.index') }}">{{ __('hmis_wards.wards') }}</a></li>
<li class="active">{{ __('wards.activate') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('ward_management::hmis_wards.menu')
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{ __('wards.ward_name') }}</th>
<th>{{ __('wards.slug') }}</th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>{{ __('wards.ward_name') }}</th>
<th>{{ __('wards.slug') }}</th>
<th></th>
</tr>
</tfoot>
<tbody>
@foreach($wards as $ward)
<tr>
<td>{{ $ward->name }}</td>
<td>{{ $ward->slug }}</td>
<td>
{{ Form::model($ward->id ,['method' => 'POST', 'route' => ['hmis_wards.activate', $ward->id]]) }}
<button type="submit" class="btn btn-warning"
onclick="return confirm('<?php echo __('wards.are_you_sure');?>')"><i
class="fa fa-check"></i> {{ __('wards.activate') }}</button>
{{ Form::close() }}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
</script>
@endpush
@@ -0,0 +1,134 @@
@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" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('wards.wards') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('wards.dashboard') }}</a></li>
<li class="active">{{ __('wards.hmis_wards') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('ward_management::hmis_wards.menu')
</div>
</div>
@include('flash::message')
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{ __('wards.ward_name') }}</th>
<th>{{ __('wards.slug') }}</th>
<th></th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>{{ __('wards.ward_name') }}</th>
<th>{{ __('wards.slug') }}</th>
<th></th>
<th></th>
</tr>
</tfoot>
<tbody>
@foreach($wards as $ward)
<tr>
<td>{{ $ward->name }}</td>
<td>{{ $ward->slug }}</td>
<td>
@if (Auth::user()->can('budget-edit'))
<a href="/hmis_wards/{{ $ward->id }}/edit/" class="btn btn-sm btn-warning btn-rounded"><i class="fa fa-pencil"></i> {{ __('wards.edit') }}</a>
@endif
</td>
<td>
@if (Auth::user()->can('budget-edit'))
{{ Form::model($ward->id ,['method' => 'DELETE', 'route' => ['hmis_wards.destroy', $ward->id]]) }}
<button type="submit" class="btn btn-sm btn-rounded btn-danger" onclick="return confirm('<?php echo __('wards.are_you_sure');?>')"><i class="fa fa-trash"></i> {{ __('wards.delete') }}</button>
{{ Form::close() }}
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<script type="text/javascript">
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy',
{extend: 'csv',
message: '<?php echo __('wards.list_of_wards');?>'
},
{extend: 'excel',
message: '<?php echo __('wards.list_of_wards');?>',
exportOptions: {
columns: [0, 1]
},
sheetName: '<?php echo __('wards.list_of_wards');?>'
},
{extend: 'pdf',
message: '<?php echo __('wards.list_of_wards');?>',
orientation: 'portrait',
pageSize: 'LETTER',
exportOptions: {
columns: [0, 1]
},
customize: function (doc) {
doc.defaultStyle.fontSize = 10;
// doc.styles.tableHeader.alignment = 'left';
}
},
{extend: 'print',
message: '<?php echo __('wards.list_of_wards');?>',
exportOptions: {
columns: [0, 1]
},
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 table-bordered')
.css('font-size', 'inherit');
}
}
]
});
</script>
@endpush
@@ -0,0 +1,19 @@
<div class="panel panel-default">
<div class="panel-body">
@if (Auth::user()->can('hmis-ward-create'))
<a href="{{ route('hmis_wards.create') }}" class="nav-item btn btn-success" style="border-radius: 5px;"><i
class="fa fa-plus" aria-hidden="true"></i> <span style="margin-left: 5px">{{ __('wards.hmis_create_ward')
}}</span></a>
@endif
@if (Auth::user()->can('hmis-ward-list'))
<a href="{{ route('hmis_wards.index') }}" class="nav-item btn btn-info" style="border-radius: 5px;"><i
class="fa fa-eye" aria-hidden="true"></i> <span style="margin-left: 5px">{{ __('wards.hmis_view_wards')
}}</span></a>
@endif
@if (Auth::user()->can('hmis-ward-delete'))
<a href="{{ route('hmis_wards.inactive') }}" class="nav-item btn btn-danger" style="border-radius: 5px;"><i
class="fa fa-undo" aria-hidden="true"></i> <span style="margin-left: 5px">{{ __('wards.hmis_inactive_wards')
}}</span></a>
@endif
</div>
</div>
@@ -0,0 +1,873 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Inpatient Bill - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
font-size: 0.8em;
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid !important;
}
</style>
</head>
@php
$total_deposits_paid = 0;
$total_amount_to_pay = 0;
$discount_amount = 0;
$insurance_hospital_stay = 0;
$insurance_investigations = 0;
$insurance_treatments = 0;
$insurance_sundries = 0;
$insurance_procedures = 0;
$insurance_tta = 0;
$insurance_services = 0;
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
$investigation_amount_total = 0;
@endphp
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;"> {{ __('inpatient.discharge_summary') }}</h5>
<div class="row">
<div class="col">
<table class="table table-light table-sm table-borderless">
<tr>
<th scope="row">{{ __('inpatient.patient_number') }}</th>
<td>{{ $patient->number}}</td>
<td width="60" style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.ward') }}</th>
<td>
{{ get_name($inpatient_info->ward_id, 'id', 'name', 'wards') }} &nbsp;|&nbsp;
@if(is_null($inpatient_info->bed_category_id))
@else
{{ get_name($inpatient_info->bed_category_id, 'id', 'name', 'inpatient_bed_categories') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.patient_names') }}</th>
<td>{{ $patient->first_name}} {{ $patient->last_name}}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.admitted') }}</th>
<td>
@if($inpatient_info->discharged == 1)
@php $end_date = new DateTime($inpatient_info->discharged_on) @endphp
@else
@php $end_date = new DateTime(date('Y-m-d')) @endphp
@endif
@php
$start_date = new DateTime($inpatient_info->admitted_on);
$days_spent_in_ward = ($end_date->diff($start_date)->format('%a'));
@endphp
{{ streamline_date($inpatient_info->admitted_on) }} ( {{ $days_spent_in_ward }} {{ __('inpatient.days') }})
{{ Form::hidden("duration", $days_spent_in_ward) }}
{{ Form::hidden("inpatient_info_id", $inpatient_info->id) }}
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.age') }}</th>
<td><?php echo get_patients_age($patient->date_of_birth); ?></td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.discharged') }}</th>
<td>
@if($inpatient_info->discharged == 1)
{{ streamline_date($inpatient_info->discharged_on) }}
@else
{{ __('inpatient.still_admitted') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.gender') }}</th>
<td>{{ $patient->gender == 1 ? __('inpatient.male') : __('inpatient.female') }}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th scope="row">{{ __('inpatient.category') }}</th>
<td>
{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}
@if(!is_null($patient_discount))
({{ $patient_discount["discount"] }} % {{ __('inpatient.discount') }})
@endif
</td>
</tr>
</table>
</div>
</div>
@if( Auth::user()->can('view-patient-episode-primary-diagnoses') && !$main_exam)
<div class="row">
<div class="col">
<strong>{{ __('inpatient.primary_diagnosis') }}</strong>
@php
$primary_diagnosis = \Streamline\Models\Diagnosis::withTrashed()->find($inpatient_info->primary_diagnosis);
@endphp
<table class="table table-light table-sm table-bordered">
<thead>
<tr>
<td>{{ $primary_diagnosis ? $primary_diagnosis->name : "" }}</td>
</tr>
</thead>
</table>
</div>
<div class="col">
@php $other_diagnoses = @unserialize($inpatient_info->other_diagnoses); @endphp
@if(!empty($other_diagnoses) && !(count($other_diagnoses) == 1 && $other_diagnoses[0] == ''))
<strong>{{ __('inpatient.secondary_diagnosis') }}</strong>
<table class="table table-light table-sm table-bordered">
<thead>
@foreach($other_diagnoses as $diagnosis)
@php
$other_diagnosis = \Streamline\Models\Diagnosis::withTrashed()->find($diagnosis);
@endphp
<tr>
<td>{{ $other_diagnosis ? $other_diagnosis->name : "" }}</td>
</tr>
@endforeach
</thead>
</table>
@endif
</div>
</div>
@endif
<br>
@if($cons_comments && ($cons_comments->comments || $cons_comments->history_comments || $cons_comments->clinic_examination_comments || $cons_comments->investigation_and_management_plan_comments))
<h4>{{ __('inpatient.opd_consultation_comments') }}</h4>
<table class="table table-light table-sm table-bordered">
@if($cons_comments->comments)
<tr>
<td><b>{{ __('inpatient.comments') }}</b></td>
<td>{{ $cons_comments->comments }}</td>
</tr>
@endif
@if($cons_comments->history_comments)
<tr>
<td><b>{{ __('inpatient.history') }}</b></td>
<td>{{ $cons_comments->history_comments }}</td>
</tr>
@endif
@if($cons_comments->clinic_examination_comments)
<tr>
<td><b>{{ __('consultations.clinical_examination') }}</b></td>
<td>{{ $cons_comments->clinic_examination_comments }}</td>
</tr>
@endif
@if($cons_comments->investigation_and_management_plan_comments)
<tr>
<td><b>{{ __('consultations.investigation_and_mgt_plan') }}</b></td>
<td>{{ $cons_comments->investigation_and_management_plan_comments }}</td>
</tr>
@endif
</table>
<br>
@endif
<strong>{{ __('inpatient.clinical_summary') }}</strong>
<table class="table table-light table-sm table-bordered">
<thead>
<tr>
<td>{{ $inpatient_info->clinical_summary }}</td>
</tr>
</thead>
</table>
<br>
<strong>{{ __('inpatient.investigations_done') }}</strong>
<table class="table table-light table-sm table-bordered">
<thead>
<tr>
<th>Investigation Name</th>
<th>Result</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
@if(count($ward_investigations) > 0)
@for($i = 0; $i < count($ward_investigations['name']); $i++)
@if(in_array($i, $ward_investigations_position))
<tr>
<td colspan="3" class="text-center" style="color: #0000FF; font-weight: small;">
{{ $ward_investigations_date[array_search($i, $ward_investigations_position)] }}
</td>
</tr>
@endif
<tr>
<td>{{ $ward_investigations['name'][$i] }}</td>
<input type="hidden" name="ward_investigation_ids[]" value="{{ $ward_investigations['id'][$i] }}">
<td>
@if($ward_investigations['type'][$i] == 1 && $ward_investigations['value'][$i] != "Pending")
<i style="color: blue"> {{ __('inpatient.refer_to_investigation_report') }} </i>
@else
{!! nl2br(e($ward_investigations['value'][$i])) !!}
@endif
</td>
<td>{!! nl2br(e($ward_investigations['comment'][$i])) !!}</td>
</tr>
@endfor
@else
<tr>
<td colspan="3">{{ __('inpatient.no_ward_invs') }}</td>
</tr>
@endif
</tbody>
</table>
{{-- if patient has any treatment to take home --}}
@if (count($treatment_to_take_away) > 0)
<br>
<strong>{{ __('inpatient.treatment_on_discharge') }}</strong>
<table class="table table-light table-sm table-bordered">
@foreach($treatment_to_take_away as $treatment)
@php
$tta_drugs_array = explode(",", $treatment->drugs);
$tta_dose_array = explode(",", $treatment->doses);
$tta_freq_array = explode(",", $treatment->frequencies);
$tta_duration_array = explode(",", $treatment->durations);
@endphp
<tr>
<td colspan="4" class="text-center" style="color: #0000FF; font-weight: small;">{{ __('inpatient.ordered_on') }} {{ streamline_date($treatment->created_at) }} by <b>{{ get_full_name($treatment->created_by, "id", "first_name", "last_name", "users") }}</b></td>
</tr>
@for($x = 0; $x < count($tta_drugs_array); $x++)
@php
$drug_name = get_name($tta_drugs_array[$x], 'id', "name", 'drugs');
$drug_unit = get_name(get_name($tta_drugs_array[$x], 'id', "unit_id", 'drugs'), "id", "name", "drug_units");
$frequency = get_name($tta_freq_array[$x], "id", "name", "dosage_frequencies");
@endphp
<tr class='gradeX'>
<td>{{ $drug_name }}</td>
<input type="hidden" name="tta_drugs[]" value="{{ $tta_drugs_array[$x] }}">
<td>{{ $tta_dose_array[$x] }} {{ $drug_unit }} {{ $frequency}} </td>
<td>{{ $tta_duration_array[$x] }}</td>
@if($treatment->dispense_status == 1)
<td style='color: green;'>{{ __('inpatient.dispensed') }}</td>
@else
<td style='color: maroon;'>{{ __('inpatient.pending_dispensing') }}</td>
@endif
</tr>
@endfor
@endforeach
</table>
@endif
<br>
@if($main_exam)
<div class="row"><div class="col"><strong>{{ __('patient_episode.eye_clinic') }} Main Exam</strong></div></div>
<div class="row">
<div class="col-6">
<table class='table table-sm'>
<thead class="thead-light">
<tr>
<th colspan="3" class="text-center">External</th>
</tr>
</thead>
<tbody>
<tr>
<th width="10%"></th>
<th width="45%" class="text-center">Right</th>
<th width="45%" class="text-center">Left</th>
</tr>
<tr>
<th>Ext</th>
<th class="text-center">{{ $main_exam->external_right }}</th>
<th class="text-center">{{ $main_exam->external_left }}</th>
</tr>
</tbody>
</table>
<table class='table table-sm'>
<thead class="thead-light">
<tr>
<th colspan="3" class="text-center">Slit Lamp</th>
</tr>
</thead>
<tbody>
<tr>
<th width="20%"><b>Section</b></th>
<th width="40%" class="text-right"><b>Right</b></th>
<th width="40%" class="text-right"><b>Left</b></th>
</tr>
@foreach($slit_lamp_test_areas as $area)
<tr>
<td><b>{{ $area->name }}</b></td>
@php
$right_slug = $area->slug."_right";
$left_slug = $area->slug."_left";
$left_other_slug = $area->slug."_other_left";
$right_other_slug = $area->slug."_other_right";
@endphp
<td class="text-center">
@if(in_array($main_exam->$right_slug, $slit_lamp_test_area_ids))
@php
$value_array = explode(',', $main_exam->$right_slug);
@endphp
@for($x = 0; $x < count($value_array); $x++)
- {{ $slit_lamp_test_area_values[$value_array[$x]] }} <br/>
@endfor
@endif
@if(isset($right_other_slug))
- {{ $main_exam->$right_other_slug }}
@endif
</td>
<td class="text-center">
@if(in_array($main_exam->$left_slug, $slit_lamp_test_area_ids))
@php
$value_array = explode(',', $main_exam->$left_slug);
@endphp
@for($x = 0; $x < count($value_array); $x++)
- {{ $slit_lamp_test_area_values[$value_array[$x]] }} <br/>
@endfor
@endif
@if(isset($left_other_slug))
- {{ $main_exam->$left_other_slug }}
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
@if (!empty($main_exam->doctors_notes))
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr><th>{{ __('inpatient.doctor_comments') }} (Main Exam)</th></tr>
</thead>
<tbody>
<tr><td>{!! nl2br(e($main_exam->doctors_notes)) !!}</td></tr>
</tbody>
</table>
@endif
</div>
<div class="col-6">
<table class='table table-sm'>
<thead class="thead-light">
<tr>
<th>EYE</th>
<th>SECTION</th>
<th>DIAGNOSIS</th>
</tr>
</thead>
<tbody>
@php
$right_diagnosis_array = explode(",", $main_exam->right_eye_diagnosis);
$left_diagnosis_array = explode(",", $main_exam->left_eye_diagnosis);
@endphp
@if(count($right_diagnosis_array) > 0)
@foreach($right_diagnosis_array as $id)
<tr>
<td>Right</td>
<td>{{ get_name(get_name($id, 'id', 'diagnosis_category', 'diagnoses'),'id','name','diagnosis_categories') }}</td>
<td>{{ get_name($id, 'id', 'name', 'diagnoses') }}</td>
</tr>
@endforeach
@else
<th>-</th>
<th>-</th>
<th>-</th>
@endif
@if(count($left_diagnosis_array) > 0)
@foreach($left_diagnosis_array as $id)
<tr>
<td>Left</td>
<td>{{ get_name(get_name($id, 'id', 'diagnosis_category', 'diagnoses'),'id','name','diagnosis_categories') }}</td>
<td>{{ get_name($id, 'id', 'name', 'diagnoses') }}</td>
</tr>
@endforeach
@else
<th>-</th>
<th>-</th>
<th>-</th>
@endif
</tbody>
</table>
<table class='table table-sm'>
<thead class="thead-light">
<tr>
<th colspan="2" class="text-center">IOP</th>
</tr>
</thead>
<tbody>
<tr>
<th width="45%" class="text-center">Right</th>
<th width="45%" class="text-center">Left</th>
</tr>
<tr>
<th class="text-center">{{ $main_exam->iop_right ?? '-' }}</th>
<th class="text-center">{{ $main_exam->iop_left ?? '-' }}</th>
</tr>
</tbody>
</table>
<table class='table table-sm'>
<thead class="thead-light">
<tr>
<th colspan="2" class="text-center">CDR</th>
</tr>
</thead>
<tbody>
<tr>
<th width="45%" class="text-center">Right</th>
<th width="45%" class="text-center">Left</th>
</tr>
<tr>
<th class="text-center">{{ $main_exam->cdr_right ?? '-' }}</th>
<th class="text-center">{{ $main_exam->cdr_left ?? '-' }}</th>
</tr>
</tbody>
</table>
</div>
</div>
@endif
@if($base_exam)
<br><br>
<div class="row"> <div class="col"><strong>{{ __('patient_episode.eye_clinic') }} Base Refraction Exam</strong></div></div>
<div class="row">
<div class="col-6">
<table class="table table-sm">
<thead class="thead-light">
<tr>
<th class="text-left">Visual Acuity</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<br>
<div class="row">
<div class="col-2">Distance</div>
<div class="col-5">Right</div>
<div class="col-5">Left</div>
</div>
<br>
<div class="row" style="margin-bottom: 10px">
<div class="col-2 text-center">sc</div>
<div class="col-5">
{{ Form::text('visual_acuity_distance_sc_right', $base_exam->visual_acuity_distance_sc_right, ['class' => 'form-control', 'readonly']) }}
</div>
<div class="col-5">
{{ Form::text('visual_acuity_distance_sc_left', $base_exam->visual_acuity_distance_sc_left, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-2 text-center">ph</div>
<div class="col-5">
{{ Form::text('visual_acuity_distance_ph_right', $base_exam->visual_acuity_distance_ph_right, ['class' => 'form-control', 'readonly']) }}
</div>
<div class="col-5">
{{ Form::text('visual_acuity_distance_ph_left', $base_exam->visual_acuity_distance_ph_left, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-2 text-center">cc</div>
<div class="col-5">
{{ Form::text('visual_acuity_distance_cc_right', $base_exam->visual_acuity_distance_cc_right, ['class' => 'form-control', 'readonly']) }}
</div>
<div class="col-5">
{{ Form::text('visual_acuity_distance_cc_left', $base_exam->visual_acuity_distance_cc_left, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
<div class="row">
<div class="col-2">Near</div>
<div class="col-10"></div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-2 text-center">sc</div>
<div class="col-5">
{{ Form::text('visual_acuity_near_sc_right', $base_exam->visual_acuity_near_sc_right, ['class' => 'form-control', 'readonly']) }}
</div>
<div class="col-5">
{{ Form::text('visual_acuity_near_sc_left', $base_exam->visual_acuity_near_sc_left, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
<div class="row">
<div class="col-2 text-center">cc</div>
<div class="col-5">
{{ Form::text('visual_acuity_near_cc_right', $base_exam->visual_acuity_near_cc_right, ['class' => 'form-control', 'readonly']) }}
</div>
<div class="col-5">
{{ Form::text('visual_acuity_near_cc_left', $base_exam->visual_acuity_near_cc_left, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
</td>
</tr>
</tbody>
</table>
Add
<div class="row">
<div class="col-md-12">
{{ Form::text('added_values',$base_exam->added_values, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
<br/>
<div class="row">
<div class="col-6 form-group">
<label>Best Vision Right Eye</label>
{{ Form::text('best_right_vision',$base_exam->best_right_vision, ['class' => 'form-control', 'readonly']) }}
</div>
<div class="col-6 form-group">
<label>Best Vision Left Eye</label>
{{ Form::text('best_left_vision',$base_exam->best_left_vision, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
<br/>
</div>
<div class="col-6">
<table class='table table-sm'>
<thead class="thead-light">
<tr>
<th class="text-center">Refraction</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="row">
<div class="col-6">
Autorefractor
</div>
</div>
<br>
<div class="row" style="margin-bottom: 10px">
<div class="col-1"></div>
<div class="col-11">
<div class="row">
<div class="col-4">Sphere</div>
<div class="col-4">Cylinder</div>
<div class="col-4">Axis</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">R</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->manifest_auto_right_sphere ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_auto_right_cylinder ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_auto_right_axis ?? "-" }}
</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">L</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->manifest_auto_left_sphere ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_auto_left_cylinder ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_auto_left_axis ?? "-" }}
</div>
</div>
</div>
</div>
Keratometry
<div class="row" style="margin-bottom: 10px">
<div class="col-1"></div>
<div class="col-11">
<div class="row">
<div class="col-4">K1</div>
<div class="col-4">K2</div>
<div class="col-4">Axis</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">R</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->keratometry_k1_right ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->keratometry_k2_right ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->keratometry_axis_right ?? "-" }}
</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">L</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->keratometry_k1_left ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->keratometry_k2_left ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->keratometry_axis_left ?? "-" }}
</div>
</div>
</div>
</div>
Retinoscope
<div class="row" style="margin-bottom: 10px">
<div class="col-1"></div>
<div class="col-11">
<div class="row">
<div class="col-4">Sphere</div>
<div class="col-4">Cylinder</div>
<div class="col-4">Axis</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">R</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->manifest_ret_right_sphere ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_ret_right_cylinder ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_ret_right_axis ?? "-" }}
</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">L</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->manifest_ret_left_sphere ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_ret_left_cylinder ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->manifest_ret_left_axis ?? "-" }}
</div>
</div>
</div>
</div>
Subjective
<div class="row" style="margin-bottom: 10px">
<div class="col-1"></div>
<div class="col-11">
<div class="row">
<div class="col-4">Sphere</div>
<div class="col-4">Cylinder</div>
<div class="col-4">Axis</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">R</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->subjective_right_sphere ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->subjective_right_cylinder ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->subjective_right_axis ?? "-" }}
</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px">
<div class="col-1">L</div>
<div class="col-11">
<div class="row">
<div class="col-4">
{{ $base_exam->subjective_left_sphere ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->subjective_left_cylinder ?? "-" }}
</div>
<div class="col-4">
{{ $base_exam->subjective_left_axis ?? "-" }}
</div>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col-6 form-group">
<label>PD for Right Eye</label>
{{ Form::text('pd_right_eye', $base_exam->pd_right_eye, ['class' => 'form-control', 'readonly']) }}
</div>
<div class="col-6 form-group">
<label>PD for Left Eye</label>
{{ Form::text('pd_left_eye', $base_exam->pd_left_eye, ['class' => 'form-control', 'readonly']) }}
</div>
</div>
<br/>
</div>
@if (!empty($base_exam->comment))
<div class="col">
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr><th>{{ __('inpatient.doctor_comments') }} (Base Refraction Exam)</th></tr>
</thead>
<tbody>
<tr><td>{!! nl2br(e($base_exam->comment)) !!}</td></tr>
</tbody>
</table>
</div>
@endif
</div>
@endif
<strong>{{ __('inpatient.discharge_summary') }}</strong>
<table class="table table-light table-sm table-bordered">
<tbody>
<tr><td>{{ $inpatient_info->discharge_summary }}</td></tr>
</tbody>
</table>
{{-- if a home with follow up show appointment details --}}
@if ($inpatient_info->outcome_id == 3)
@php
$patient_appointment = \Streamline\Models\PatientAppointment::where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->first();
@endphp
<br>
<strong>{{ __('inpatient.appointment_details') }}</strong>
<table class="table table-light table-sm table-bordered">
<tbody>
<tr>
<td><b>{{ __('inpatient.appointment_date') }}</b></td>
<td>{{ streamline_date($patient_appointment->appointment_date) }} {{ __('inpatient.at') }} {{ $patient_appointment->appointment_time }}</td>
</tr>
<tr>
<td><b>{{ __('inpatient.clinic') }}</b></td>
<td>{{ get_name($patient_appointment->clinic_allocation, "id", "name", "clinics") }}</td>
</tr>
<tr>
<td><b>{{ __('inpatient.doctor_to_see') }}</b></td>
<td>{{ get_full_name($patient_appointment->incharge_id, "id", "first_name", "last_name", "users") }}</td>
</tr>
</tbody>
</table>
@endif
<br>
<table class="table table-light table-sm table-bordered">
<tbody>
<tr>
<td><b>{{ __('inpatient.discharged_by') }}: </b></td>
<td>{{ get_full_name($inpatient_info->discharged_by, "id", "first_name", "last_name", "users")}} {{ __('inpatient.on') }} {{ streamline_date($inpatient_info->discharged_on)}}</td>
</tr>
</tbody>
</table>
<br>
<table class="table table-light table-bordered">
<tbody>
<tr>
<td><b>{{ __('inpatient.printed_by') }}: </b></td>
<td>{{ get_full_name(auth()->id(), "id", "first_name", "last_name", "users") }} {{ __('inpatient.on') }} {{ streamline_date_time(date("Y-m-d H:i:s")) }}</td>
{{-- @if (is_add_stamp_feature_enabled() && !empty($hospitalInfo->stamp))
<td><b>{{ __('inpatient.stamp') }}: </b></td>
@endif --}}
</tr>
<tr>
<td><b>{{ __('inpatient.printed_by_signature') }}:</b></td>
<td></td>
{{-- @if (is_add_stamp_feature_enabled() && !empty($hospitalInfo->stamp))
<td>
<img style="max-width: 300px; max-height: 140px;" src="{{ asset($hospitalInfo->stamp) }}" class="img-fluid mx-auto d-block mx-3" alt="{{ $hospitalInfo->name}} stamp">
</td>
@endif --}}
</tr>
</tbody>
</table>
@if (is_add_stamp_feature_enabled() && !empty($hospitalInfo->stamp))
<table class="table table-borderless">
<tbody>
<tr>
<td><b>{{ __('inpatient.stamp') }}: </b></td>
<td style="text-align: center">
<img style="max-width: 300px; max-height: 150px;" src="{{ asset($hospitalInfo->stamp) }}" class="img-fluid mx-auto d-block mx-3" alt="{{ $hospitalInfo->name}} stamp">
</td>
</tr>
</tbody>
</table>
@endif
</div>
</body>
</html>
@@ -0,0 +1,305 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/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" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4 class="page-title">{{ __('inpatient.incoming_inpatient_bills') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('inpatient.dashboard') }}</a></li>
<li class="active">{{ __('inpatient.incoming_inpatient_bills') }}</li>
</ol>
</div>
</div>
@include('flash::message')
<div class="white-box">
{{ Form::open(['route' => 'inpatient_bills.incoming', 'method' => 'POST']) }}
<div class="row">
<div class="col-md-3">
<div class="form-group">
{{ Form::label('ward_id', __('inpatient.wards')) }}
{{ Form::select('ward_id', $wards, '', ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
{{ Form::label('inpatient_status', __('inpatient.inpatient_status')) }}
{{ Form::select('inpatient_status', $inpatient_status, 0, ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-2">
<div class="form-group" id="searchby">
{{ Form::label('search_by', __('inpatient.date')) }}
{{ Form::select('search_by', ['0'=>__('inpatient.today'), '1' => __('inpatient.yesterday'),'2'=>__('inpatient.custom_date'),'3'=>__('inpatient.custom_date_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', __('inpatient.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', __('inpatient.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">
<div class="form-group" style="padding-top: 5px;"><br>
{{ Form::button(__('inpatient.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id'=>'select_patient']) }}
</div>
</div>
</div>
{{ Form::close() }}
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
<h4><label class="label label-info">{{ $search_text }}</label></h4>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table table-bordered">
<thead>
<tr>
<th style="display: none"></th>
<th>{{ __('inpatient.admission_day_ward_discharge') }}</th>
<th>{{ __('inpatient.patient_names') }}</th>
<th>{{ __('inpatient.admitted_by') }}</th>
<th>{{ __('inpatient.category') }}</th>
<th>{{ __('inpatient.ward') }}</th>
<th>{{ __('inpatient.total_saved_bill') }}</th>
<th>{{ __('inpatient.amount_paid_and_invoiced') }}</th>
<th>{{ __('inpatient.balance') }}</th>
<th>{{ __('inpatient.bill_last_updated') }}</th>
<th>{{ __('inpatient.action') }}</th>
</tr>
</thead>
<tbody>
@php
$amount_to_pay_grand_total = 0;
$amount_paid_grand_total = 0;
$total_bill_sum = 0;
@endphp
@if(count($inpatients_info) > 0)
@foreach($inpatients_info as $inpatient_info)
<tr>
<th style="display: none">{{ $inpatient_info->id }}</th>
<td>
{{ streamline_date_time($inpatient_info->admitted_on) }}
@php
$admitted_on = new Carbon\Carbon($inpatient_info->admitted_on);
if ($inpatient_info->discharged == 1) {
$days_on_ward = $admitted_on->diffInDays($inpatient_info->discharged_on);
} else {
$days_on_ward = $admitted_on->diffInDays(Carbon\Carbon::now());
}
@endphp
<br><br>
<span style='font-size: smaller; color: #0a776c; font-weight: bold;'>{{ $days_on_ward }} {{ __('inpatient.days_on_ward') }}</span>
@if($inpatient_info->discharged == 1)
<br><br><span style="color:green; font-weight:bold">{{ __('inpatient.discharged_on') }} {{ streamline_date($inpatient_info->discharged_on) }} {{ __('inpatient.by') }} {{ get_full_name($inpatient_info->discharged_by, 'id', 'first_name', 'last_name', 'users') }}</span>
@endif
</td>
<td>{!! insurance_flag($inpatient_info->patient_id) !!} ({{ $inpatient_info->patients_number }})</td>
<td>
{{ get_full_name($inpatient_info->created_by, "id", "first_name", "last_name", "users") }}
</td>
<td>{{ $patient_categories[$inpatient_info->patients_category_id] ?? "" }}</td>
<td>{{ $wards[$inpatient_info->ward_id] ?? "" }}</td>
@php
$amount_to_pay = $inpatient_info->bills_amount_to_pay ?? 0;
$bill_last_created_by = $inpatient_info->bills_created_by;
$bill_last_updated_by = $inpatient_info->bills_updated_by;
$bill_last_updated_by = $bill_last_updated_by ? get_full_name($bill_last_updated_by, 'id', 'first_name', 'last_name', 'users') : get_full_name($bill_last_created_by, 'id', 'first_name', 'last_name', 'users');
$amount_to_pay_grand_total += is_numeric($amount_to_pay) ? $amount_to_pay : 0;
$amount_to_pay = is_null($inpatient_info->bills_amount_to_pay) ? "<label class='label label-info'>Bill not yet saved</label>" : ugandan_shillings($amount_to_pay);
$invoices_amount = is_numeric($inpatient_info->bills_invoices_amount) ? $inpatient_info->bills_invoices_amount : 0;
$amount_paid = is_numeric($inpatient_info->bills_amount_paid) ? $inpatient_info->bills_amount_paid : 0;
$amount_paid_plus_invoices_to_pay = $amount_paid + $invoices_amount;
$amount_paid_grand_total += $amount_paid_plus_invoices_to_pay;
$original_bill = is_numeric($inpatient_info->bills_original_bill) ? $inpatient_info->bills_original_bill : 0;
$total_bill_sum += $original_bill;
@endphp
<td>{{ ugandan_shillings($original_bill) }}</td>
<td>{!! ugandan_shillings($amount_paid_plus_invoices_to_pay) !!}</td>
<td>
{!! $amount_to_pay !!}
</td>
<td>
{{ streamline_date_time($inpatient_info->updated_at) }} by {{ $bill_last_updated_by }}
@php
$inpatient_bill_record = \Streamline\Models\InpatientBill::where(['patient_id' => $inpatient_info->patient_id, 'episode_id' => $inpatient_info->episode_id])->first();
@endphp
@if ($inpatient_bill_record)
@php
$bill_authorized_by_array = is_null($inpatient_bill_record->bill_authorized_by) ? [] : explode(",", $inpatient_bill_record->bill_authorized_by);
$bill_authorized_at_array = is_null($inpatient_bill_record->bill_authorized_at) ? [] : explode(",",$inpatient_bill_record->bill_authorized_at);
@endphp
@if (count($bill_authorized_by_array) > 0)
<p>
<b style="color: blue">{{ __('inpatient.bill_authorized_by') }}:</b>
@for ($i = 0; $i < count($bill_authorized_by_array); $i++)
{{ get_full_name($bill_authorized_by_array[$i], "id", "first_name", "last_name", "users") }} {{ __('inpatient.on') }} {{ streamline_date_time($bill_authorized_at_array[$i]) }}
@endfor
</p>
@endif
@endif
</td>
<td>
<a class="btn btn-success btn-sm" href="patient_finance/set_patient_session{{ $inpatient_info->patient_id }}">Select Patient</a>
<br><br>
<a class="btn btn-primary btn-sm" href="patient_finance/view_inpatient_bill/{{ $inpatient_info->patient_id }}/{{ $inpatient_info->episode_id }}">View Inpatient Bill</a>
<br><br>
{{ Form::open(['url' => 'receive_inpatient_payment']) }}
{{ Form::hidden('patient_id', $inpatient_info->patient_id) }}
{{ Form::hidden('episode_id', $inpatient_info->episode_id) }}
{{ Form::submit('Receive Payment', ['class' => 'btn btn-info btn-sm btn-rounded'])}}
{{ Form::close() }}
</td>
</tr>
@endforeach
@else
<tr class="warning"><td class="center" colspan="10">{{ __('inpatient.no_records_found') }}</td></tr>
@endif
</tbody>
<tfoot>
<tr>
<th style="display: none"></th>
<th><strong>{{ __('inpatient.total') }}</strong></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>{{ ugandan_shillings($total_bill_sum) }}</th>
<th>{{ ugandan_shillings($amount_paid_grand_total) }}</th>
<th>{{ ugandan_shillings($amount_to_pay_grand_total) }}</th>
<th></th>
<th></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<style type="text/css">
#depositTable td{
border-left: 1px solid #dddddd;
}
</style>
@endpush
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
$('#datepicker-autoclose,#datepicker-autoclose-1,#datepicker-autoclose-2').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd'
});
$('#search_by').change(function () {
if ($(this).val() == 2) {
$('#date_search').show();
$('#date_range_search').hide();
} else if ($(this).val() == 3) {
$('#date_range_search').show();
$('#date_search').hide();
} else {
$('#date_search,#date_range_search').hide();
}
});
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy',
{ extend: 'csv',
message: 'INCOMING INPATIENT BILLS',
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
},
sheetName: 'INCOMING INPATIENT BILLS ON STREAMLINE'
},
{ extend: 'excel',
message: 'INCOMING INPATIENT BILLS',
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
},
sheetName: 'INPATIENT BILLS ON STREAMLINE'
},
{ extend: 'pdf',
message: 'INCOMING INPATIENT BILLS',
exportOptions: {
columns: [ 0, 1, 2 ]
},
sheetName: 'INPATIENT BILLS ON STREAMLINE'
},
'print'
]
});
</script>
@endpush
@@ -0,0 +1,116 @@
@extends('layouts.main')
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4 class="page-title">{{ __('inpatient.inpatient_attendant_pass') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('inpatient.dashboard') }}</a></li>
<li class="active">{{ __('inpatient.inpatient_attendant_pass') }}</li>
</ol>
</div>
</div>
<div class="white-box">
<div class="row">
<div class="col-md-4">
<h4>{{ __('inpatient.patient_information') }}</h4>
<div class="table-responsive">
<table class="table table-responsive table-bordered">
<tbody>
<tr>
<td><b>{{ __('inpatient.patient_names') }}</b></td>
<td>{!! insurance_flag($patient->id) !!}</td>
</tr>
<tr>
<td><b>{{ __('inpatient.patient_number') }}</b></td>
<td>{{ $patient->number }}</td>
</tr>
<tr>
<td><b>{{ __('inpatient.pay_later') }}</b></td>
<td>
@if(isset($discount->pay_later) && $discount->pay_later == 1)
{{ __('inpatient.yes') }}
{{ Form::hidden('pay_later', 1, ['id' => 'pay_later']) }}
@else
{{ __('inpatient.no') }}
{{ Form::hidden('pay_later', 0, ['id' => 'pay_later']) }}
@endif
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-8">
<h4>{{ __('inpatient.deposits_made') }}</h4>
<div class="table-responsive">
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<th>{{ __('inpatient.received_on') }}</th>
<th>{{ __('inpatient.receipt_number') }}</th>
<th>{{ __('inpatient.received_by') }}</th>
<th>{{ __('inpatient.amount_paid') }}</th>
</thead>
<tbody>
@if(count($inpatient_deposits) > 0)
@php $total_paid = 0; @endphp
@foreach($inpatient_deposits as $deposit)
<tr>
<td>{{ $deposit->receipt_number }}</td>
<td>{{ get_full_name($deposit->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>{{ streamline_date($deposit->created_at) }}</td>
@php $total_paid += $deposit->patient_amount_paid; @endphp
<td>{{ ugandan_shillings($deposit->patient_amount_paid) }}</td>
</tr>
@endforeach
<tr>
<td colspan="3"><b>{{ __('inpatient.total') }}</b></td>
<td>{{ ugandan_shillings($total_paid) }}</td>
</tr>
@else
<tr>
<td colspan="4" style="color: red" class="text-center">{{ __('inpatient.no_deposits_made_yet') }}</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>
{{ Form::open(['route' => 'store_inpatient_attendant_pass', 'data-toggle' => 'validator']) }}
<div class="white-box">
<div class="row">
@if(is_null($inpatient_bill))
<div class="col-md-12">
<h3><span class="label label-danger">{{ __('inpatient.no_patient_billing_generated') }}</span></h3>
</div>
@endif
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-4">
</div>
<div class="col-md-4">
<div class="form-group">
{{ Form::label('expiry_days', __('inpatient.expire_after_how_many_days')) }}
{{ Form::number('expiry_days', $number_of_days, ['class' => 'form-control compulsory', 'required']) }}
</div>
</div>
<div class="col-md-3">
<br>
{{ Form::button(__('inpatient.issue_pass'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'onclick' => 'return confirm("Are you sure you want to issue pass?")']) }}
{{ Form::button(__('inpatient.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
</div>
</div>
</div>
</div>
{{ Form::close() }}
@endsection
@@ -0,0 +1,116 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 12px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('inpatient.inpatient_attendant_pass') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('inpatient.dashboard') }}</a></li>
<li class="active">{{ __('inpatient.inpatient_attendant_pass') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
<div class="row" style="float:right;"><button class="btn btn-success glyphicon glyphicon-print" onclick="print_receipt()"> {{ __('inpatient.print') }}</button></div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>Tel:</b> {{ $hospital_information->phone_number }}</span><b>Email:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('inpatient.department') }}:</b> {{ get_name($inpatient_info->ward_id, "id", "name", "wards") }}</span><br>
<span class="receipt-label"><b>{{ __('inpatient.date') }}:</b> {{ streamline_date_time_short(\Carbon\Carbon::now()) }}</span><br>
<span class="receipt-label"><b>{{ __('inpatient.patient_names') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }} ({{ $patient->number }}) <b>-{{ get_name($patient->category_id, "id", "name", "patient_categories") }}</b></span>
</p>
<table class="table" id="receipt_table">
<tbody>
<tr>
<td>
<b>{{ __('inpatient.patient_pass_expires') }}<br>
{{ streamline_date_time(\Carbon\Carbon::now()->addDays($number_of_days)) }}</b>
</td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-3">
</div>
<div class="col-sm-4">
</div>
<div class="col-sm-4">
<div style="text-align: center;">
<small><strong>{{ __('inpatient.issued_by') }}:</strong> {{ get_full_name($attendant_pass_information->created_by, "id", "first_name", "last_name", "users") }}</small>
</div>
</div>
<div class="col-sm-4">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">&copy; Stre@mline</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,178 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Inpatient Consultation and Services - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
/*font-size: 1.2em;*/
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
.card-header{
padding: 5px;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">{{ __('inpatient.inpatient_consultation_and_services_details') }}</h5>
<div class="row">
<table class="table table-light table-sm table-borderless">
<tr>
<th scope="row">{{ __('inpatient.patient_number') }}</th>
<td>{{ $patient->number}}</td>
<td width="60" style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.ward') }}</th>
<td>
{{ get_name($inpatient_info->ward_id, 'id', 'name', 'wards') }} &nbsp;|&nbsp;
@if($inpatient_info->bed_category_id)
{{ get_name($inpatient_info->bed_category_id, 'id', 'name', 'inpatient_bed_categories') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.patient_names') }}</th>
<td>{{ $patient->first_name}} {{ $patient->last_name}}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.admitted') }}</th>
<td>
@if($inpatient_info->discharged == 1)
@php $end_date = new DateTime($inpatient_info->discharged_on) @endphp
@else
@php $end_date = new DateTime(date('Y-m-d')) @endphp
@endif
@php
$start_date = new DateTime($inpatient_info->admitted_on);
$days_spent_in_ward = ($end_date->diff($start_date)->format('%a'));
@endphp
{{ streamline_date($inpatient_info->admitted_on) }} ( {{ $days_spent_in_ward }} {{ __('inpatient.days') }})
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.age') }}</th>
<td><?php echo get_patients_age($patient->date_of_birth); ?></td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.discharged') }}</th>
<td>
@if($inpatient_info->discharged == 1)
{{ streamline_date($inpatient_info->discharged_on) }}
@else
{{ __('inpatient.still_admitted') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.gender') }}</th>
<td>{{ $patient->gender == 1 ? __('inpatient.male') : __('inpatient.female') }}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th scope="row">{{ __('inpatient.category') }}</th>
<td>
{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}
@if(!is_null($patient_discount))
({{ $patient_discount["discount"] }} % {{ __('inpatient.discount') }})
@endif
</td>
</tr>
</table>
</div>
<div class="row">
<div class="col">
<?php
$services_total_cost = 0;
$ward_services_quantities_given = DB::table('ward_consultations_and_services')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->groupBy('service_id')->selectRaw('*, sum(quantity_given) as quantity_given')->get();
?>
@if(count($ward_services_quantities_given) > 0)
<div class="card">
<div class="card-header">
{{ __('inpatient.consultation_and_services') }}
</div>
<table class="table table-light table-sm">
<thead>
<th>{{ __('inpatient.date') }}</th>
<th>{{ __('inpatient.name') }}</th>
<th>{{ __('inpatient.quantity') }}</th>
<th>{{ __('inpatient.unit_cost') }}</th>
<th>{{ __('inpatient.subtotal') }}</th>
</thead>
@foreach($ward_services_quantities_given as $record)
<?php
$dispensation_details = \Streamline\Models\WardConsultationsAndService::where(['patient_id' => $patient_id, 'episode_id' => $episode_id, 'service_id' => $record->service_id])->get();
?>
@foreach($dispensation_details as $dispensation)
@php
$services_cost = $record->unit_price;
@endphp
<tr>
<td>
{{ streamline_date($dispensation->created_at) }}
<br>
<font style="color: blue;">{{ __('inpatient.by') }}: {{ get_full_name($dispensation->created_by, "id", "first_name", "last_name", "users") }}</font>
</td>
<td>
{{ $service_items[$dispensation->service_id] }}
</td>
<td>
{{ $dispensation->quantity_given }}
</td>
<td>
{{ ugandan_shillings($services_cost) }}
</td>
<td>
{{ ugandan_shillings($services_cost * $dispensation->quantity_given) }}
</td>
@php
$single_service_cost = $services_cost * $dispensation->quantity_given;
$services_total_cost += $single_service_cost;
@endphp
</tr>
@endforeach
@endforeach
<tr>
<td colspan="3"><strong>{{ __('inpatient.services_total') }}</strong></td>
<td colspan="2"><strong>{{ ugandan_shillings($services_total_cost) }}</strong></td>
</tr>
</table>
</div>
@endif
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,148 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Inpatient Progress Notes - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
/*font-size: 1.2em;*/
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
.card-header{
padding: 5px;
}
h5{
text-decoration: underline;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">{{ __('inpatient.inpatient_details') }}</h5>
<div class="row">
<table class="table table-light table-sm table-borderless">
<tr>
<th scope="row">{{ __('inpatient.patient_number') }}</th>
<td>{{ $patient->number}}</td>
<td width="60" style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.ward') }}</th>
<td>
{{ get_name($inpatient_info->ward_id, 'id', 'name', 'wards') }} &nbsp;|&nbsp;
@if($inpatient_info->bed_category_id)
{{ get_name($inpatient_info->bed_category_id, 'id', 'name', 'inpatient_bed_categories') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.patient_names') }}</th>
<td>{{ $patient->first_name}} {{ $patient->last_name}}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.admitted') }}</th>
<td>
@if($inpatient_info->discharged == 1)
@php $end_date = new DateTime($inpatient_info->discharged_on) @endphp
@else
@php $end_date = new DateTime(date('Y-m-d')) @endphp
@endif
@php
$start_date = new DateTime($inpatient_info->admitted_on);
$days_spent_in_ward = ($end_date->diff($start_date)->format('%a'));
@endphp
{{ streamline_date($inpatient_info->admitted_on) }} ( {{ $days_spent_in_ward }} {{ __('inpatient.days') }})
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.age') }}</th>
<td><?php echo get_patients_age($patient->date_of_birth); ?></td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.discharged') }}</th>
<td>
@if($inpatient_info->discharged == 1)
{{ streamline_date($inpatient_info->discharged_on) }}
@else
{{ __('inpatient.still_admitted') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.gender') }}</th>
<td>{{ $patient->gender == 1 ? __('inpatient.male') : __('inpatient.female') }}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th scope="row">{{ __('inpatient.category') }}</th>
<td>
{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}
@if(!is_null($patient_discount))
({{ $patient_discount["discount"] }} % {{ __('inpatient.discount') }})
@endif
</td>
</tr>
</table>
</div>
<div class="row">
<div class="col">
<div class="card">
<h3>{{ __('inpatient.inpatient_detailed_notes') }}</h3>
@php $sheet_histories = DB::table('ward_inpatient_detailed_notes')->whereNull('deleted_at')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->get(); @endphp
@if(count($sheet_histories) > 0)
<table class="table color-bordered-table muted-bordered-table">
<tr>
<td></td>
</tr>
@foreach($sheet_histories as $comment_record)
<tr>
<td>
<h5 @if(is_null($comment_record->history)) style="display:none;"@endif>{{ __('inpatient.history') }}</h5>
{{ $comment_record->history }}
<h5 @if(is_null($comment_record->result)) style="display:none;"@endif>{{ __('inpatient.results') }}</h5>
{{ $comment_record->result }}
<h5 @if(is_null($comment_record->vitals)) style="display:none;"@endif>{{ __('inpatient.vitals_and_examination') }}</h5>
{{ $comment_record->vitals }}
<h5 @if(is_null($comment_record->impression)) style="display:none;"@endif>{{ __('inpatient.impression') }}</h5>
{{ $comment_record->impression }}
<h5 @if(is_null($comment_record->plan)) style="display:none;"@endif>{{ __('inpatient.plan') }}</h5>
{{ $comment_record->plan }}
<br>
<span style="color: blue">{{ get_full_name($comment_record->created_by, "id", "first_name", "last_name", "users") }} {{ __('inpatient.on') }} {{ streamline_date_time_short($comment_record->created_at) }}</span>
</td>
</tr>
@endforeach
</table>
@endif
</div>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,150 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Inpatient Extras - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
/*font-size: 1.2em;*/
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
.card-header{
padding: 5px;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">{{ __('inpatient.inpatient_extras_details') }}</h5>
<div class="row">
<table class="table table-light table-sm table-borderless">
<tr>
<th scope="row">{{ __('inpatient.patient_number') }}</th>
<td>{{ $patient->number}}</td>
<td width="60" style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.ward') }}</th>
<td>
{{ get_name($inpatient_info->ward_id, 'id', 'name', 'wards') }} &nbsp;|&nbsp;
@if($inpatient_info->bed_category_id)
{{ get_name($inpatient_info->bed_category_id, 'id', 'name', 'inpatient_bed_categories') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.patient_names') }}</th>
<td>{{ $patient->first_name}} {{ $patient->last_name}}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.admitted') }}</th>
<td>
@if($inpatient_info->discharged == 1)
@php $end_date = new DateTime($inpatient_info->discharged_on) @endphp
@else
@php $end_date = new DateTime(date('Y-m-d')) @endphp
@endif
@php
$start_date = new DateTime($inpatient_info->admitted_on);
$days_spent_in_ward = ($end_date->diff($start_date)->format('%a'));
@endphp
{{ streamline_date($inpatient_info->admitted_on) }} ( {{ $days_spent_in_ward }} {{ __('inpatient.days') }})
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.age') }}</th>
<td><?php echo get_patients_age($patient->date_of_birth); ?></td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.discharged') }}</th>
<td>
@if($inpatient_info->discharged == 1)
{{ streamline_date($inpatient_info->discharged_on) }}
@else
{{ __('inpatient.still_admitted') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.gender') }}</th>
<td>{{ $patient->gender == 1 ? __('inpatient.male') : __('inpatient.female') }}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th scope="row">{{ __('inpatient.category') }}</th>
<td>
{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}
@if(!is_null($patient_discount))
({{ $patient_discount["discount"] }} % {{ __('inpatient.discount') }})
@endif
</td>
</tr>
</table>
</div>
<div class="row">
<div class="col">
<?php
$ward_extras_given = DB::table('ward_extras')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->get();
$extras_total_cost = 0;
?>
@if(count($ward_extras_given) > 0)
<div class="card">
<table class="table table-light table-sm">
<thead>
<th>{{ __('inpatient.date') }}</th>
<th>{{ __('inpatient.name') }}</th>
<th>{{ __('inpatient.cost') }}</th>
</thead>
@foreach($ward_extras_given as $extras_record)
<tr>
<td>
{{ streamline_date($extras_record->created_at)}}
{{ __('inpatient.by') }}: <font color="blue">{{ get_full_name($extras_record->created_by, "id", "first_name", "last_name", "users")}}</font>
</td>
<td>
{{ $extras_record->extra_item }}
</td>
<td>
{{ ugandan_shillings($extras_record->extra_cost) }}
@php $extras_total_cost += $extras_record->extra_cost; @endphp
</td>
</tr>
@endforeach
<tr>
<td colspan="2"><strong>{{ __('inpatient.extras_total') }}</strong></td>
<td><strong>{{ ugandan_shillings($extras_total_cost) }}</strong></td>
</tr>
</table>
</div>
@endif
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,146 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Inpatient Procedures - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
/*font-size: 1.2em;*/
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
.card-header{
padding: 5px;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">{{ __('inpatient.inpatient_procedures_details') }}</h5>
<div class="row">
<table class="table table-light table-sm table-borderless">
<tr>
<th scope="row">{{ __('inpatient.patient_number') }}</th>
<td>{{ $patient->number}}</td>
<td width="60" style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.ward') }}</th>
<td>
{{ get_name($inpatient_info->ward_id, 'id', 'name', 'wards') }} &nbsp;|&nbsp;
@if($inpatient_info->bed_category_id)
{{ get_name($inpatient_info->bed_category_id, 'id', 'name', 'inpatient_bed_categories') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.patient_names') }}</th>
<td>{{ $patient->first_name}} {{ $patient->last_name}}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.admitted') }}</th>
<td>
@if($inpatient_info->discharged == 1)
@php $end_date = new DateTime($inpatient_info->discharged_on) @endphp
@else
@php $end_date = new DateTime(date('Y-m-d')) @endphp
@endif
@php
$start_date = new DateTime($inpatient_info->admitted_on);
$days_spent_in_ward = ($end_date->diff($start_date)->format('%a'));
@endphp
{{ streamline_date($inpatient_info->admitted_on) }} ( {{ $days_spent_in_ward }} {{ __('inpatient.days') }})
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.age') }}</th>
<td><?php echo get_patients_age($patient->date_of_birth); ?></td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.discharged') }}</th>
<td>
@if($inpatient_info->discharged == 1)
{{ streamline_date($inpatient_info->discharged_on) }}
@else
{{ __('inpatient.still_admitted') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.gender') }}</th>
<td>{{ $patient->gender == 1 ? __('inpatient.male') : __('inpatient.female') }}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th scope="row">{{ __('inpatient.category') }}</th>
<td>
{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}
@if(!is_null($patient_discount))
({{ $patient_discount["discount"] }} % {{ __('inpatient.discount') }})
@endif
</td>
</tr>
</table>
</div>
<div class="row">
<div class="col">
<div class="card">
<table class="table table-bordered">
<?php
$ward_investigation_pricings = DB::table('ward_investigation_pricings')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->get();
?>
@if(count($ward_investigation_pricings) > 0)
@php $total_modal_investigations_cost = 0; @endphp
@foreach($ward_investigation_pricings as $ward_inv_price)
<tr>
<td>
{{ __('inpatient.recorded_by') }}: <font color="blue">{{ get_full_name($ward_inv_price->created_by, "id", "first_name", "last_name", "users")}}</font><br>
{{ __('inpatient.on') }} <b>{{ streamline_date($ward_inv_price->created_at)}}</b>
</td>
<td>
{{ __('inpatient.name') }}:
{{ get_name($ward_inv_price->investigation_id, "id", "name", "investigations") }}
</td>
<td>
{{ __('inpatient.price') }}:{{ ugandan_shillings($ward_inv_price->price) }}
</td>
</tr>
@php $total_modal_investigations_cost += $ward_inv_price->price; @endphp
@endforeach
<tr>
<td colspan="2"><strong>{{ __('inpatient.total_cost_of_investigations') }}</strong></td>
<td colspan="2"><strong>{{ ugandan_shillings($total_modal_investigations_cost) }}</strong></td>
</tr>
@endif
</table>
</div>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,156 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Inpatient Progress Notes - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
/*font-size: 1.2em;*/
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
.card-header{
padding: 5px;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">{{ __('inpatient.inpatient_progress_notes_details') }}</h5>
<div class="row">
<table class="table table-light table-sm table-borderless">
<tr>
<th scope="row">{{ __('inpatient.patient_number') }}</th>
<td>{{ $patient->number}}</td>
<td width="60" style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.ward') }}</th>
<td>
{{ get_name($inpatient_info->ward_id, 'id', 'name', 'wards') }} &nbsp;|&nbsp;
@if($inpatient_info->bed_category_id)
{{ get_name($inpatient_info->bed_category_id, 'id', 'name', 'inpatient_bed_categories') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.patient_names') }}</th>
<td>{{ $patient->first_name}} {{ $patient->last_name}}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.admitted') }}</th>
<td>
@if($inpatient_info->discharged == 1)
@php $end_date = new DateTime($inpatient_info->discharged_on) @endphp
@else
@php $end_date = new DateTime(date('Y-m-d')) @endphp
@endif
@php
$start_date = new DateTime($inpatient_info->admitted_on);
$days_spent_in_ward = ($end_date->diff($start_date)->format('%a'));
@endphp
{{ streamline_date($inpatient_info->admitted_on) }} ( {{ $days_spent_in_ward }} {{ __('inpatient.days') }})
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.age') }}</th>
<td><?php echo get_patients_age($patient->date_of_birth); ?></td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.discharged') }}</th>
<td>
@if($inpatient_info->discharged == 1)
{{ streamline_date($inpatient_info->discharged_on) }}
@else
{{ __('inpatient.still_admitted') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.gender') }}</th>
<td>{{ $patient->gender == 1 ? __('inpatient.male') : __('inpatient.female') }}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th scope="row">{{ __('inpatient.category') }}</th>
<td>
{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}
@if(!is_null($patient_discount))
({{ $patient_discount["discount"] }} % {{ __('inpatient.discount') }})
@endif
</td>
</tr>
</table>
</div>
<div class="row">
<div class="col">
<div class="card">
<h3>{{ __('inpatient.doctor_progress_notes') }}</h3>
@php $sheet_comments = DB::table('ward_inpatient_sheet_comments')->whereNull('deleted_at')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->get(); @endphp
@if(count($sheet_comments) > 0)
<table class="table color-bordered-table muted-bordered-table">
@foreach($sheet_comments as $comment_record)
<tr>
<td>
<font color="blue">{{ get_full_name($comment_record->created_by, "id", "first_name", "last_name", "users") }}</font>
{{ __('inpatient.on') }}
<font color="blue">{{ streamline_date_time($comment_record->created_at) }}</font>
</td>
<td>
{{ $comment_record->ward_comments }}
</td>
</tr>
@endforeach
</table>
@endif
<h3>{{ __('inpatient.nurse_progress_notes') }}</h3>
@php $sheet_comments = DB::table('ward_inpatient_sheet_nurse_comments')->whereNull('deleted_at')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->get(); @endphp
@if(count($sheet_comments) > 0)
<table class="table color-bordered-table muted-bordered-table">
@foreach($sheet_comments as $comment_record)
<tr>
<td>
<font color="blue">{{ get_full_name($comment_record->created_by, "id", "first_name", "last_name", "users") }}</font>
{{ __('inpatient.on') }}
<font color="blue">{{ streamline_date_time($comment_record->created_at) }}</font>
</td>
<td>
{{ $comment_record->ward_comments }}
</td>
</tr>
@endforeach
</table>
@endif
</div>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,173 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Inpatient Procedures - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
/*font-size: 1.2em;*/
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
.card-header{
padding: 5px;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">{{ __('inpatient.inpatient_procedures_details') }}</h5>
<div class="row">
<table class="table table-light table-sm table-borderless">
<tr>
<th scope="row">{{ __('inpatient.patient_number') }}</th>
<td>{{ $patient->number}}</td>
<td width="60" style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.ward') }}</th>
<td>
{{ get_name($inpatient_info->ward_id, 'id', 'name', 'wards') }} &nbsp;|&nbsp;
@if($inpatient_info->bed_category_id)
{{ get_name($inpatient_info->bed_category_id, 'id', 'name', 'inpatient_bed_categories') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.patient_names') }}</th>
<td>{{ $patient->first_name}} {{ $patient->last_name}}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.admitted') }}</th>
<td>
@if($inpatient_info->discharged == 1)
@php $end_date = new DateTime($inpatient_info->discharged_on) @endphp
@else
@php $end_date = new DateTime(date('Y-m-d')) @endphp
@endif
@php
$start_date = new DateTime($inpatient_info->admitted_on);
$days_spent_in_ward = ($end_date->diff($start_date)->format('%a'));
@endphp
{{ streamline_date($inpatient_info->admitted_on) }} ( {{ $days_spent_in_ward }} {{ __('inpatient.days') }})
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.age') }}</th>
<td><?php echo get_patients_age($patient->date_of_birth); ?></td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.discharged') }}</th>
<td>
@if($inpatient_info->discharged == 1)
{{ streamline_date($inpatient_info->discharged_on) }}
@else
{{ __('inpatient.still_admitted') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.gender') }}</th>
<td>{{ $patient->gender == 1 ? __('inpatient.male') : __('inpatient.female') }}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th scope="row">{{ __('inpatient.category') }}</th>
<td>
{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}
@if(!is_null($patient_discount))
({{ $patient_discount["discount"] }} % {{ __('inpatient.discount') }})
@endif
</td>
</tr>
</table>
</div>
<table class="table table-bordered">
<?php
$ward_procedures = DB::table('ward_procedures')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->get();
$total_modal_procedures_cost = 0;
$inpatient_procedures = @unserialize($inpatient_info->procedures);
$inpatient_procedures_done_by = @unserialize($inpatient_info->procedures_done_by);
$inpatient_procedure_hospital_fees = @unserialize($inpatient_info->procedure_hospital_fee);
$inpatient_procedures_staff_fees = @unserialize($inpatient_info->procedure_staff_fee);
$procedures_staff_fee = DB::table('ward_procedures')->whereNull('deleted_at')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->pluck("staff_fee", "procedure_id")->toArray();
$procedures_hospital_fee = DB::table('ward_procedures')->whereNull('deleted_at')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->pluck("hospital_fee", "procedure_id")->toArray();
$procedures_counter = 0;
?>
<thead>
<tr>
<th>Recorded By</th>
<th>{{ __('inpatient.name') }}</th>
<th>{{ __('inpatient.hospital_fees') }}</th>
<th>{{ __('inpatient.staff_fees') }}</th>
<th>{{ __('inpatient.performed_by') }}</th>
</tr>
</thead>
<tbody>
@foreach($ward_procedures as $ward_procedure_record)
<tr>
<td>
<font color="blue">{{ get_full_name($ward_procedure_record->created_by, "id", "first_name", "last_name", "users")}}</font>
{{ __('inpatient.on') }} <b>{{ is_null($ward_procedure_record->procedure_date) ? streamline_date($ward_procedure_record->created_at) : streamline_date($ward_procedure_record->procedure_date) }}</b>
</td>
<td>
{{ get_name($ward_procedure_record->procedure_id, "id", "name", "procedures") }}
@php
$single_procedure_cost = 0;
if($ward_procedure_record->hospital_fee || $ward_procedure_record->staff_fee) {
$single_procedure_cost = $ward_procedure_record->hospital_fee + $ward_procedure_record->staff_fee;
}
@endphp
({{ __('inpatient.cost') }} : {{ugandan_shillings($single_procedure_cost) }})
</td>
<td>{{ ugandan_shillings($ward_procedure_record->hospital_fee) }}</td>
<td>{{ ugandan_shillings($ward_procedure_record->staff_fee) }}</td>
<td>
{{ get_full_name($ward_procedure_record->performed_by, "id", "first_name", "last_name", "users") }}
</td>
</tr>
@php $total_modal_procedures_cost += $single_procedure_cost; @endphp
@endforeach
<tr>
<td colspan="2">{{ __('inpatient.cost') }}</td>
<td colspan="3">{{ ugandan_shillings($total_modal_procedures_cost) }}</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,183 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Inpatient Sundries - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
/*font-size: 1.2em;*/
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
.card-header{
padding: 5px;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">{{ __('inpatient.inpatient_sundries_details') }}</h5>
<div class="row">
<table class="table table-light table-sm table-borderless">
<tr>
<th scope="row">{{ __('inpatient.patient_number') }}</th>
<td>{{ $patient->number}}</td>
<td width="60" style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.ward') }}</th>
<td>
{{ get_name($inpatient_info->ward_id, 'id', 'name', 'wards') }} &nbsp;|&nbsp;
@if($inpatient_info->bed_category_id)
{{ get_name($inpatient_info->bed_category_id, 'id', 'name', 'inpatient_bed_categories') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.patient_names') }}</th>
<td>{{ $patient->first_name}} {{ $patient->last_name}}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.admitted') }}</th>
<td>
@if($inpatient_info->discharged == 1)
@php $end_date = new DateTime($inpatient_info->discharged_on) @endphp
@else
@php $end_date = new DateTime(date('Y-m-d')) @endphp
@endif
@php
$start_date = new DateTime($inpatient_info->admitted_on);
$days_spent_in_ward = ($end_date->diff($start_date)->format('%a'));
@endphp
{{ streamline_date($inpatient_info->admitted_on) }} ( {{ $days_spent_in_ward }} {{ __('inpatient.days') }})
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.age') }}</th>
<td><?php echo get_patients_age($patient->date_of_birth); ?></td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.discharged') }}</th>
<td>
@if($inpatient_info->discharged == 1)
{{ streamline_date($inpatient_info->discharged_on) }}
@else
{{ __('inpatient.still_admitted') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.gender') }}</th>
<td>{{ $patient->gender == 1 ? __('inpatient.male') : __('inpatient.female') }}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th scope="row">{{ __('inpatient.category') }}</th>
<td>
{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}
@if(!is_null($patient_discount))
({{ $patient_discount["discount"] }} % {{ __('inpatient.discount') }})
@endif
</td>
</tr>
</table>
</div>
<?php
$ward_sundry_quantities_given = DB::table('ward_sundry_dispensations')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->groupBy('sundry_id')->selectRaw('*, sum(quantity_given) as quantity_given')->get();
$sundries_total_cost = $insurance_sundries = 0;
$patient_insurance_status = (patient_insurance_status($patient_id) == 1);
?>
<div class="row">
<table class="table table-light table-sm table-borderless">
<thead>
<tr>
<th>{{ __('inpatient.name') }}</th>
<th>{{ __('patient_finance.unit_cost') }}</th>
<th @if(!$patient_insurance_status) style="display: none" @endif>{{ __('inpatient.insurance_unit_price') }}</th>
<th>{{ __('inpatient.quantity') }}</th>
<th>{{ __('inpatient.patient_to_pay') }}</th>
<th @if(!$patient_insurance_status) style="display: none" @endif>{{ __('inpatient.insurance_to_pay') }}</th>
</tr>
</thead>
<tbody>
@foreach($ward_sundry_quantities_given as $sundry_record)
@php
$sundries_cost = $this_sundry_sp = 0;
$is_insured = 0;
$tariff_id = 0;
$benefit_id = 0;
$insurance_sundry_amount = 0;
if($patient_insurance_status){
$item_insurance_details = get_item_insurance_pricing($patient_id, $sundry_record->sundry_id, 5, true, $inpatient_info->ward_id);
$sundries_cost = $item_insurance_details[2];
$insurance_sundry_amount = $item_insurance_details[1];
$is_insured = $item_insurance_details[0];
$tariff_id = $item_insurance_details[3];
$benefit_id = $item_insurance_details[4];
} else {
$sundries_cost = get_name($sundry_record->sundry_id, "id", "non_insured_price", "sundries");
}
//get actual total costs incase the price of item changed after dispensation to allow retro billing
$this_sundry_total_price = 0;
$per_ward_sundry_given_rows = DB::table('ward_sundry_dispensations')->whereNull('deleted_at')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id, 'sundry_id' => $sundry_record->sundry_id])->get();
if (count($per_ward_sundry_given_rows) > 0) {
foreach ($per_ward_sundry_given_rows as $sundry_ward_record) {
$this_sundry_sp = ($sundry_ward_record->price != 0) ? $sundry_ward_record->price : $sundries_cost;
$this_sundry_total_price += ($this_sundry_sp * $sundry_ward_record->quantity_given);
$insurance_sundry_amount = $sundry_ward_record->chi_price;
}
} else {
$this_sundry_total_price = $sundry_record->quantity_given * $sundries_cost;
}
$sundries_total_cost += $this_sundry_total_price;
$insurance_sundries += ($sundry_record->quantity_given * $insurance_sundry_amount);
@endphp
<tr>
<td>{{ get_name($sundry_record->sundry_id, "id", "name", "sundries") }}</td>
<td>{{ $this_sundry_sp }}</td>
<td @if(!$patient_insurance_status) style="display: none" @endif>{{ $insurance_sundry_amount }}</td>
<td>{{ $sundry_record->quantity_given }}</td>
<td>{{ $this_sundry_total_price }}</td>
<td @if(!$patient_insurance_status) style="display: none" @endif>{{ $sundry_record->quantity_given * $insurance_sundry_amount }}</td>
</tr>
@endforeach
<tr>
<td colspan="4"><strong>{{ __('inpatient.sundries_total') }}</strong></td>
<td><strong>{{ ugandan_shillings($sundries_total_cost) }}</strong></td>
<td><strong>{{ ugandan_shillings($insurance_sundries) }}</strong></td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>
@@ -0,0 +1,189 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Inpatient Sundries - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
/*font-size: 1.2em;*/
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
.card-header{
padding: 5px;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">{{ __('inpatient.inpatient_treatment_details') }}</h5>
<div class="row">
<table class="table table-light table-sm table-borderless">
<tr>
<th scope="row">{{ __('inpatient.patient_number') }}</th>
<td>{{ $patient->number}}</td>
<td width="60" style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.ward') }}</th>
<td>
{{ get_name($inpatient_info->ward_id, 'id', 'name', 'wards') }} &nbsp;|&nbsp;
@if($inpatient_info->bed_category_id)
{{ get_name($inpatient_info->bed_category_id, 'id', 'name', 'inpatient_bed_categories') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.patient_names') }}</th>
<td>{{ $patient->first_name}} {{ $patient->last_name}}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.admitted') }}</th>
<td>
@if($inpatient_info->discharged == 1)
@php $end_date = new DateTime($inpatient_info->discharged_on) @endphp
@else
@php $end_date = new DateTime(date('Y-m-d')) @endphp
@endif
@php
$start_date = new DateTime($inpatient_info->admitted_on);
$days_spent_in_ward = ($end_date->diff($start_date)->format('%a'));
@endphp
{{ streamline_date($inpatient_info->admitted_on) }} ( {{ $days_spent_in_ward }} {{ __('inpatient.days') }})
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.age') }}</th>
<td><?php echo get_patients_age($patient->date_of_birth); ?></td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.discharged') }}</th>
<td>
@if($inpatient_info->discharged == 1)
{{ streamline_date($inpatient_info->discharged_on) }}
@else
{{ __('inpatient.still_admitted') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.gender') }}</th>
<td>{{ $patient->gender == 1 ? __('inpatient.male') : __('inpatient.female') }}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th scope="row">{{ __('inpatient.category') }}</th>
<td>
{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}
@if(!is_null($patient_discount))
({{ $patient_discount["discount"] }} % {{ __('inpatient.discount') }})
@endif
</td>
</tr>
</table>
</div>
<div class="row">
<div class="col">
<?php
//get the quantity given so far of this particular treatment
$ward_quantities_given_option2 = DB::table('ward_treatment_dispensations')->where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->groupBy('drug_id')->selectRaw('*, sum(quantity_given) as quantity_given')->get();
$treatment_total_cost = 0;
?>
@if(count($ward_quantities_given_option2) > 0)
<div class="card">
@if(get_ward_prescription_model() == 1)
<div class="card-header">
{{ __('inpatient.treatments') }}
</div>
<table class="table table-light table-sm">
<thead>
<th>{{ __('inpatient.date') }}</th>
<th>{{ __('inpatient.name') }}</th>
<th>{{ __('inpatient.quantity') }}</th>
<th>{{ __('inpatient.unit_cost') }}</th>
<th>{{ __('inpatient.subtotal') }}</th>
</thead>
@foreach($ward_quantities_given_option2 as $record)
<?php
$dispensation_details = \Streamline\Models\WardTreatmentDispensation::where(['patient_id' => $patient_id, 'episode_id' => $episode_id, 'drug_id' => $record->drug_id])->get();
?>
@foreach($dispensation_details as $dispensation)
@php
$drugs_cost = 0;
// check if drug and patient is eligible for insurance
if(get_name($dispensation->drug_id, "id", "insurance_coverage", "drugs") == 1 && patient_insurance_status($patient_id) == 1){
$drugs_cost = get_name($dispensation->drug_id, "id", "insured_price", "drugs");
//$insurance_amount = get_name($dispensation->drug_id, "id", "non_insured_price", "drugs") - $treatment_amount;
//$is_insured = 1;
} else {
$drugs_cost = get_name($dispensation->drug_id, "id", "non_insured_price", "drugs");
}
@endphp
<tr>
<td>
{{ streamline_date($dispensation->created_at) }}
<font style="color: blue;">{{ __('inpatient.by') }}: {{ get_full_name($dispensation->created_by, "id", "first_name", "last_name", "users") }}</font>
</td>
<td>
{{ get_name($record->drug_id, "id", "name", "drugs") }}
</td>
<td>
{{ $dispensation->quantity_given }}
</td>
<td>
{{ ugandan_shillings($drugs_cost) }}
</td>
<td>
{{ ugandan_shillings($drugs_cost * $dispensation->quantity_given) }}
</td>
@php
$single_drug_subtotal = $drugs_cost * $dispensation->quantity_given;
$treatment_total_cost += $single_drug_subtotal;
@endphp
</tr>
@endforeach
@endforeach
<tr>
<td colspan="4"><strong>{{ __('inpatient.treatment_total') }}</strong></td>
<td colspan="1"><strong>{{ ugandan_shillings($treatment_total_cost) }}</strong></td>
</tr>
</table>
@endif
</div>
@endif
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,426 @@
@push('styles')
<style type="text/css">
.btn-default-bluish {
background: #b6cce2;
border: 1px solid #e4e7ea;
}
</style>
@endpush
@php
$past_delivery_record = \Streamline\Models\MaternityDeliveryRecord::where(['patient_id' => $patient_id])->get();
$babies = \Streamline\Models\Patient::where(['parent_id' => $patient_id])->get();
@endphp
@if (count($past_delivery_record) > 0)
@if( Auth::user()->can('view-delivery-record'))
<div class="white-box" style="padding-top: 2px;">
<h3>{{ __('inpatient.delivery_record_details') }}</h3>
<div class="table-responsive">
<table class="table table-striped color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('prescriptions.date') }}</th>
<th>{{ __('inpatient.foetal_number') }}</th>
<th>{{ __('maternity.blood_loss') }}</th>
<th>{{ __('maternity.blood_loss_measurement') }}</th>
<th>{{ __('inpatient.recorded_by') }}</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($past_delivery_record as $past_delivery_record)
<tr>
<td>
{{ streamline_date_time($past_delivery_record->created_at) }}
<br>
@if(check_if_episode_is_a_followup($past_delivery_record->episode_id))
<small style="color: green"><br>({{ __('patient_episode.review_from') }} {{ streamline_date(get_name(get_name($past_delivery_record->episode_id, 'id', 'parent_episode_id', 'patient_episodes'), 'id', 'created_at', 'patient_episodes')) }})</small>
@endif
</td>
<td>
{{ $past_delivery_record->foetal_number }}
</td>
<td>{{ $past_delivery_record->blood_loss }} (mls)</td>
<td>{{ $past_delivery_record->bloodloss_measurement }}</td>
<td>{{ get_full_name($past_delivery_record->created_by, "id", "first_name", "last_name", "users") }}</td>
<td>
<a class="btn btn-rounded btn-xs btn-default-bluish view_detail_{{ $past_delivery_record->id }}" onclick="past_episode_row_details({{ $past_delivery_record->id }})">{{ __('inpatient.view_details') }}</a>
</td>
</tr>
<tr class="past_episode_row" id="past_episode_row{{ $past_delivery_record->id }}" style="display: none">
<td colspan="6">
<div class="row">
<div class="col-md-6">
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th></th>
<th>{{ __('maternity.baby') }} 1</th>
@if($past_delivery_record->foetal_number == 2)
<th>{{ __('maternity.baby') }} 2</th>
@elseif ($past_delivery_record->foetal_number == 3)
<th>{{ __('maternity.baby') }} 2</th>
<th>{{ __('maternity.baby') }} 3</th>
@endif
</tr>
</thead>
<tbody>
@php $foetal_number = $past_delivery_record->foetal_number; @endphp
<tr>
<th>{{ __('maternity.date_of_birth') }}</th>
@php
$date_of_birth_array = explode(",", $past_delivery_record->date_of_birth);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ $date_of_birth_array[$x] }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.delivery_time') }}</th>
@php
$delivery_time_array = explode(",", $past_delivery_record->delivery_time);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ $delivery_time_array[$x] }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.duration_1st') }}</th>
@php
$duration_first_array = explode(",", $past_delivery_record->duration_1);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ $duration_first_array[$x] }} {{ __('maternity.hours') }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.duration_2nd') }}</th>
@php
$duration_second_stage_array = explode(",", $past_delivery_record->duration_2);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
@php
$duration2_in_hrs_and_mins = explode("and", $duration_second_stage_array[$x]);
@endphp
<td>{{ $duration2_in_hrs_and_mins[0] }} {{ __('maternity.hours') }} {{ $duration2_in_hrs_and_mins[1] }} {{ __('maternity.minutes') }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.duration_3rd') }}</th>
@php
$duration_third_stage_array = explode(",", $past_delivery_record->duration_3);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
@php
$duration3_in_hrs_and_mins = explode("and", $duration_third_stage_array[$x]);
@endphp
<td>{{ $duration3_in_hrs_and_mins[0] }} {{ __('maternity.hours') }} {{ $duration2_in_hrs_and_mins[1] }} {{ __('maternity.minutes') }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.delivered_by_cadre') }}</th>
@php
$delivered_by_cadre_array = explode(",", $past_delivery_record->delivered_by_cadre);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ $delivered_by_cadre_array[$x] == 1 ? "Staff" : "Student" }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.delivered_by_name') }}</th>
@php
$delivered_by_name_array = explode(",", $past_delivery_record->delivered_by_name);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ isset($users[$delivered_by_name_array[$x]]) ? get_full_name($delivered_by_name_array[$x], "id", "first_name", "last_name", "users") : '' }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.supervised_by') }}</th>
@php
$supervised_by_array = explode(",", $past_delivery_record->supervised_by);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ isset($users[$supervised_by_array[$x]]) ? $users[$supervised_by_array[$x]] : '' }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.mode_of_delivery') }}</th>
@php
$mode_of_delivery_array = explode(",", $past_delivery_record->mode_of_delivery);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ isset($delivery_modes[$mode_of_delivery_array[$x]]) ? $delivery_modes[$mode_of_delivery_array[$x]] : '' }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.indication_for_cs') }}</th>
@php
$indication_for_cs_array = explode(",", $past_delivery_record->indication_for_cs);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ $indication_for_cs_array[$x] }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.location_of_delivery') }}</th>
@php
$location_of_delivery_array = explode(",", $past_delivery_record->location_of_delivery);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ isset($delivery_locations[$location_of_delivery_array[$x]]) ? $delivery_locations[$location_of_delivery_array[$x]] : '' }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.resuscitation_airway') }}</th>
@php
$resuscitation_airway_array = explode(",", $past_delivery_record->resuscitation_airway);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>
@if ($resuscitation_airway_array[$x] == "1")
{{ __('maternity.nil') }}
@elseif($resuscitation_airway_array[$x] == "2")
{{ __('maternity.bag') }}
@elseif($resuscitation_airway_array[$x] == "3")
{{ __('maternity.mask') }}
@endif
</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.resuscitation_suction') }}</th>
@php
$resuscitation_suction_array = explode(",", $past_delivery_record->resuscitation_suction);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ $resuscitation_suction_array[$x] }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.comments') }}</th>
@php
$delivery_comments_array = explode(",", $past_delivery_record->delivery_comments);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ $delivery_comments_array[$x] }}</td>
@endfor
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-6">
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th></th>
<th>{{ __('maternity.baby') }} 1</th>
@if($past_delivery_record->foetal_number == 2)
<th>{{ __('maternity.baby') }} 2</th>
@elseif ($past_delivery_record->foetal_number == 3)
<th>{{ __('maternity.baby') }} 2</th>
<th>{{ __('maternity.baby') }} 3</th>
@endif
</tr>
</thead>
<tbody>
<tr>
<th>{{ __('maternity.received_by') }}</th>
@php
$received_by_array = explode(",", $past_delivery_record->received_by);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ isset($users[$received_by_array[$x]]) ? get_full_name($received_by_array[$x], "id", "first_name", "last_name", "users") : '' }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.sex') }}</th>
@php
$gender_array = explode(",", $past_delivery_record->gender);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
@if($gender_array[$x] ==1 )
<td>{{ __('maternity.female') }}</td>
@elseif($gender_array[$x] == 2)
<td>{{ __('maternity.male') }}</td>
@else
<td>{{ __('maternity.other') }}</td>
@endif
@endfor
</tr>
<tr>
<th>{{ __('maternity.condition') }}</th>
@php
$baby_condition_array = explode(",", $past_delivery_record->baby_condition);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
@if($baby_condition_array[$x] == 1)
<td>{{ __('maternity.alive') }}</td>
@elseif($baby_condition_array[$x] == 2)
<td>{{ __('maternity.fresh_sb') }}</td>
@elseif($baby_condition_array[$x] == 3)
<td>{{ __('maternity.macerated_sb') }}</td>
@endif
@endfor
</tr>
<tr>
<th>{{ __('maternity.weight') }}</th>
@php
$weight_array = explode(",", $past_delivery_record->weight);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ $weight_array[$x] }} Kg</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.congenital_abnormalities_apparent') }}</th>
@php
$congenital_abnormalities_array = explode(",", $past_delivery_record->congenital_abnormalities);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ $congenital_abnormalities_array[$x] }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.birth_order') }}</th>
@php
$birth_order_array = explode(",", $past_delivery_record->birth_order);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ $birth_order_array[$x] }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.apgar_1') }}</th>
@php
$apgar_score_at_1_min_array = explode(",", $past_delivery_record->apgar_score_at_minute_1);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ $apgar_score_at_1_min_array[$x] }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.apgar_5') }}</th>
@php
$apgar_score_at_5_min_array = explode(",", $past_delivery_record->apgar_score_at_minute_5);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ $apgar_score_at_5_min_array[$x] }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.apgar_10') }}</th>
@php
$apgar_score_at_10_min_array = explode(",", $past_delivery_record->apgar_score_at_minute_10);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ $apgar_score_at_10_min_array[$x] }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.age_established_respiration') }}</th>
@php
$age_established_spontaneous_respiration_array = explode(",", $past_delivery_record->age_established_spontaneous_reg_respiration);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ $age_established_spontaneous_respiration_array[$x] }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.comments') }}</th>
@php
$baby_comments_array = explode(",", $past_delivery_record->baby_comments);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ $baby_comments_array[$x] }}</td>
@endfor
</tr>
<tr>
<th>{{ __('maternity.moved_to') }}</th>
@php
$moved_to_array = explode(",", $past_delivery_record->moved_to);
@endphp
@for($x = 0; $x < $foetal_number; $x++)
<td>{{ get_name($moved_to_array[$x], "id", "name", "wards") }}</td>
@endfor
</tr>
</tbody>
</table>
</div>
</div>
</div>
</td>
</tr>
@endforeach
@if (count($babies) > 0)
<tr>
<th colspan="6"><b>Baby details</b></th>
</tr>
@php $baby_counter = 1; @endphp
@foreach($babies as $baby)
<tr>
<td>{{ $baby_counter }}. {{ $baby->first_name." ".$baby->last_name }} ({{ $baby->number }}) <a href="/patient_episodes/set_patient_id/{{ $baby->id }}" class="btn btn-success btn-xs btn-rounded">{{ __('inpatient.select_baby_home') }}</a>
</td>
<td colspan="5"></td>
</tr>
@php $baby_counter++; @endphp
@endforeach
@endif
</tbody>
</table>
</div>
</div>
@endif
@endif
@push('scripts')
<script>
let current_past_episode = 0;
function past_episode_row_details(id) {
$('.past_episode_row').hide();
if (current_past_episode !== id) {
$('#past_episode_row' + id).show();
current_past_episode = id;
$('.view_detail_'+id).html("Hide Details");
} else {
current_past_episode = 0;
$('.view_detail_'+id).html("View Details");
}
}
</script>
@endpush
@@ -0,0 +1,267 @@
@if(Auth::user()->can('view-vitals-on-inpatient-sheet'))
<hr>
<h4>Vitals and Observations</h4>
<table class="table table-bordered color-bordered-table success-bordered-table">
<tbody>
@if(count($patient_vitals) > 0)
@foreach($patient_vitals as $key => $value)
<tr>
<td class="text-center"><span style="font-size: 18px; color: black">{{ $key }}</span></td>
<td>
<table class="table table-bordered color-bordered-table success-bordered-table">
<tbody>
<tr>
@php $vitals_counter = 0; @endphp
@foreach($value as $value_array)
@php
if($vitals_counter > 4) {
break;
}
$vitals_counter++;
@endphp
<td>
<span style="font-size: 15px; color: black">{{ $value_array["value"] }}</span>
<hr>
@php
try {
echo Carbon\Carbon::parse($value_array["time"])->toDateTimeString();
} catch (Exception) {}
@endphp
</td>
@endforeach
</tr>
</tbody>
</table>
</td>
</tr>
@endforeach
@else
<tr>
<td style="color: black" class="text-center">No Vitals Registered</td>
</tr>
@endif
</tbody>
</table>
<a class="btn btn-sm btn-rounded btn-primary" data-toggle="modal" data-target="#view_vitals">View All Vitals</a>
<a class="btn btn-sm btn-rounded btn-success" data-toggle="modal" data-target="#add_vitals">Add New Vitals</a>
@endif
<div class="modal fade" id="add_vitals" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="add_vitals_label">Add New Vitals</h4>
</div>
<div class="modal-body">
<input type='hidden' id="age_group" value="{{ $age_group }}">
<h4>Select Vitals</h4>
<input type='hidden' id="vitals_slug_0">
<table class='table color-bordered-table success-bordered-table'>
<thead>
<tr>
<th width="25%">Vitals</th>
<th>Value</th>
<th>Normal Ranges</th>
<th width="10%">NEWS</th>
<th>TIme and Date</th>
<th></th>
</tr>
</thead>
<tbody class='vitals_table'>
<tr>
<td>
<div class='form-group controls'>
<select name='vitals_observations[]' id='vitals_observation_0' class='form-control compulsory required' onchange='get_observation_info(0, this.value)'>@php echo $options_observations; @endphp</select>
<input type='hidden' id='vitals_slug_0'>
</div>
</td>
<td>
<div class='form-group controls'>
<input type='number' class='form-control' id='vitals_value_0' name='vitals_value[]' onchange='get_score(0, this.value)'>
</div>
</td>
<td>
<div class='form-group controls'>
<input type='text' class='form-control' id='vitals_normal_ranges_0' readonly>
</div>
</td>
<td>
<div id='vitals_news_0'></div>
</td>
<td>
<div class='form-group controls'>
<input type='datetime-local' name='vitals_datetime[]' id='vitals_datetime_0' class='form-control compulsory' />
</div>
</td>
<td>
<div class='form-group'>
<button type='button' class='btn btn-sm btn-rounded btn-success add_vitals_row' style='color: white;'><i class='fa fa-plus'></i></button>
</div>
</td>
</tr>
</tbody>
</table>
<br>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" onclick="save_vitals()">Save</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="view_vitals" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="view_vitals_label">View All Vitals</h4>
</div>
<div class="modal-body">
<div class="table-responsive">
<table class="table table-bordered color-bordered-table success-bordered-table">
<tbody>
@if(count($patient_vitals) > 0)
@foreach($patient_vitals as $key => $value)
<tr>
<td class="text-center"><span style="font-size: 18px; color: black">{{ $key }}</span></td>
<td>
<table class="table table-bordered color-bordered-table success-bordered-table">
<tbody>
<tr>
@foreach($value as $value_array)
<td>
<span style="font-size: 15px; color: black">{{ $value_array["value"] }}</span>
<hr>
@php
try {
echo Carbon\Carbon::parse($value_array["time"])->toDateTimeString();
} catch (Exception) {}
@endphp
</td>
@endforeach
</tr>
</tbody>
</table>
</td>
</tr>
@endforeach
@else
<tr>
<td style="color: black" class="text-center">No Vitals Registered</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
@push('scripts')
<script src="{{ asset('js/observations/all_age_groups.js') }}"></script>
<script>
let vitals_rows = 1;
$('.add_vitals_row').click(function (e) {
e.preventDefault();
$('.vitals_table').append("<tr id='vitals_row_" + vitals_rows + "'>\
<td><div class='form-group controls'>\
<select name='vitals_observations[]' id='vitals_observation_" + vitals_rows + "' class='form-control compulsory required' onchange='get_observation_info(" + vitals_rows + ", this.value)'>@php echo $options_observations; @endphp</select>\
<input type='hidden' id='vitals_slug_" + vitals_rows + "'></div></td><td><div class='form-group controls'>\
<input type='text' class='form-control' id='vitals_value_" + vitals_rows + "' name='vitals_value[]' onchange='get_score(" + vitals_rows + ", this.value)'>\
</div></td><td>\
<div class='form-group controls'><input type='text' class='form-control' id='vitals_normal_ranges_" + vitals_rows + "' readonly></div>\
</td><td><div id='vitals_news_" + vitals_rows + "'></div></td><td><div class='form-group controls'>\
<input type='datetime-local' name='vitals_datetime[]' id='vitals_datetime_" + vitals_rows + "' class='form-control compulsory'/>\
</div></td><td><div class='form-group'>\
<button type='button' class='btn btn-sm btn-rounded btn-danger' onclick='remove_vitals_row(" + vitals_rows + ")' style='color: white;'><i class='fa fa-trash'></i></button>\
</div></td></tr>");
vitals_rows++;
});
function remove_vitals_row(id) {
$('#vitals_row_' + id).remove();
}
function get_observation_info(id, value) {
$.ajax({
method: 'GET',
url: '/observations/get_observation_info/' + value,
success: function(response){
let responseArray = JSON.parse(response);
if (responseArray["error"] == 0) {
$('#vitals_normal_ranges_' + id).val(responseArray["normal_range"]);
$('#vitals_slug_' + id).val(responseArray["slug"]);
} else {
$('#vitals_normal_ranges_' + id).val();
$('#vitals_slug_' + id).val();
}
},
error: function(jqXHR, textStatus, errorThrown) {
//alert(JSON.stringify(jqXHR));
}
});
}
function save_vitals() {
let vitals_observations = $("select[name='vitals_observations[]'] option:selected" ).map(function(){
return this.value;
}).get();
let vitals_value = $("input[name='vitals_value[]']" ).map(function(){
return this.value;
}).get();
let vitals_datetime = $("input[name='vitals_datetime[]']" ).map(function(){
return this.value;
}).get();
let patient_id = $('#patient_id').val();
let episode_id = $('#episode_id').val();
let inpatient_id = $('#inpatient_id').val();
$.ajax({
url: '/save_patient_vitals',
data: {
"vitals_observations[]": vitals_observations, "vitals_value[]": vitals_value, "vitals_datetime[]": vitals_datetime,
"patient_id": patient_id, "episode_id": episode_id, "inpatient_id": inpatient_id
},
success: function(response){
if (response == "1") {
alert("Vitals successfully added");
window.location.reload();
} else {
alert("Please make sure all values are filled in correctly");
}
},
error: function(jqXHR, textStatus, errorThrown) {
//
}
});
}
</script>
@endpush
@@ -0,0 +1,388 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ public_path('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Inpatient Bill - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ public_path('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid !important;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">{{ __('patient_episode.treatment_sheet') }}</h5>
<table class="table table-light table-sm table-borderless">
<tr>
<th>{{ __('patient_file.patient_names') }}</th>
<td>{{ $patient->first_name}} {{ $patient->last_name}}</td>
<th>{{ __('patient_file.patient_number') }}</th>
<td>{{ $patient->number}}</td>
<th>{{ __('patient_file.gender') }}</th>
<td><?php echo $patient->gender == 1 ? __('patient_file.male') : __('patient_file.female') ?></td>
</tr>
<tr>
<th>{{ __('patient_file.category') }}</th>
<td>
{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}
</td>
<th>{{ __('inpatient.ward') }}</th>
<td>
{{ get_name($ward_id, 'id', 'name', 'wards') }}
</td>
<th>{{ __('layout.admission_date') }}</th>
<td>{{ streamline_date($admitted_on) }}</td>
</tr>
</table>
<hr>
@if(count($ordered_cancer_protocols) > 0)
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<tr>
<th>Section</th>
<th>Drug</th>
<th>Dose</th>
<th>Duration</th>
<th>Quantity Given</th>
<th>Given By</th>
<th>Given On</th>
</tr>
</thead>
<tbody>
@foreach($ordered_cancer_protocols as $ordered_cancer_protocol)
@php
$pre_chemo_drugs = json_decode($ordered_cancer_protocol->pre_chemo_drugs, true);
$chemo_drugs = json_decode($ordered_cancer_protocol->chemo_drugs, true);
$post_chemo_drugs = json_decode($ordered_cancer_protocol->post_chemo_drugs, true);
$pre_chemo_drugs_count = count($pre_chemo_drugs);
$chemo_drugs_count = count($chemo_drugs);
$post_chemo_drugs_count = count($post_chemo_drugs);
$pre_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $pre_chemo_drugs));
$chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $chemo_drugs));
$post_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $post_chemo_drugs));
$pre_chemo_doses_count += array_sum(array_map(function ($value) {return array_sum(array_map(function ($value_two) {return count($value_two['duration']);}, $value['dose']));}, $pre_chemo_drugs));
$chemo_doses_count += array_sum(array_map(function ($value) {return array_sum(array_map(function ($value_two) {return count($value_two['duration']);}, $value['dose']));}, $chemo_drugs));
$post_chemo_doses_count += array_sum(array_map(function ($value) {return array_sum(array_map(function ($value_two) {return count($value_two['duration']);}, $value['dose']));}, $post_chemo_drugs));
$protocol_details = \Streamline\Models\CancerProtocol::find($ordered_cancer_protocol->protocol_id);
$duration_counter = 0;
@endphp
<tr>
<td colspan="7">
<h3 class="text-center">{{ $protocol_details->name }} @if($ordered_cancer_protocol->protocol_status != 0) ({{ [1 => 'Stopped', 2 => 'Completed'][$ordered_cancer_protocol->protocol_status] ?? '' }}) @endif</h3>
</td>
</tr>
<tr>
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + 1 }}">Pre-Chemo</td>
</tr>
@for($x = 0; $x < $pre_chemo_drugs_count; $x++)
@php
$pre_chemo_duration_count = array_sum(array_map(function ($value_two) {return count($value_two['duration']);}, $pre_chemo_drugs[$x]['dose']));
@endphp
<tr>
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + $pre_chemo_duration_count + 1 }}">
{{ $drugs[$pre_chemo_drugs[$x]['drug_id']] ?? '' }}
<br><br>
Factor: {{ $factors[$pre_chemo_drugs[$x]['drug_factor']] ?? '' }}
<br>
Route: {{ $drug_routes[$pre_chemo_drugs[$x]['drug_route']] ?? '' }}
</td>
</tr>
@for($i = 0; $i < count($pre_chemo_drugs[$x]['dose']); $i++)
<tr>
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose'][$i]['duration']) + 1 }}">
@php
$drug_dosage = $drug_units[$drug_with_units[$pre_chemo_drugs[$x]['drug_id']]];
if ($pre_chemo_drugs[$x]['drug_factor'] == 1) {
$drug_dosage .= '/m<sup>2</sup>';
} else if ($pre_chemo_drugs[$x]['drug_factor'] == 2) {
$drug_dosage .= '/Kg';
}
@endphp
Dose: {{ $pre_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
@if(!empty($pre_chemo_drugs[$x]['dose'][$i]['instructions']))
<br><br>
<span style="color: red">{{ $pre_chemo_drugs[$x]['dose'][$i]['instructions'] }}</span>
@endif
@if(!empty($pre_chemo_drugs[$x]['dose'][$i]['weight_range']))
<br><br>
<span style="color: #0a776c">({{ $pre_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
@endif
</td>
</tr>
@for($p = 0; $p < count($pre_chemo_drugs[$x]['dose'][$i]['duration']); $p++)
<tr>
@if(is_null($pre_chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_by']))
<td>
{{ $pre_chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}
</td>
<td colspan="3"></td>
@else
<td>
{{ $pre_chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}
</td>
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['duration'][$p]['quantity_given'] }}</td>
<td style="color: #00AEEF">{{ $users_array[$pre_chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_by']] }}</td>
<td style="color: #00AEEF">{{ Carbon\Carbon::parse($pre_chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_on'])->toDateTimeString() }}</td>
@endif
</tr>
@php $duration_counter++; @endphp
@endfor
@endfor
@endfor
<tr>
<td rowspan="{{ $chemo_drugs_count + $chemo_doses_count + 1 }}">Chemo</td>
</tr>
@for($x = 0; $x < $chemo_drugs_count; $x++)
@php
$chemo_duration_count = array_sum(array_map(function ($value_two) {return count($value_two['duration']);}, $chemo_drugs[$x]['dose']));
@endphp
<tr>
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + $chemo_duration_count + 1 }}">
{{ $drugs[$chemo_drugs[$x]['drug_id']] ?? '' }}
<br><br>
Factor: {{ $factors[$chemo_drugs[$x]['drug_factor']] ?? '' }}
<br>
Route: {{ $drug_routes[$chemo_drugs[$x]['drug_route']] ?? '' }}
</td>
</tr>
@for($i = 0; $i < count($chemo_drugs[$x]['dose']); $i++)
<tr>
<td rowspan="{{ count($chemo_drugs[$x]['dose'][$i]['duration']) + 1 }}">
@php
$drug_dosage = $drug_units[$drug_with_units[$chemo_drugs[$x]['drug_id']]];
if ($chemo_drugs[$x]['drug_factor'] == 1) {
$drug_dosage .= '/m<sup>2</sup>';
} else if ($chemo_drugs[$x]['drug_factor'] == 2) {
$drug_dosage .= '/Kg';
}
@endphp
Dose: {{ $chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
@if(!empty($chemo_drugs[$x]['dose'][$i]['instructions']))
<br><br>
<span style="color: red">{{ $chemo_drugs[$x]['dose'][$i]['instructions'] }}</span>
@endif
@if(!empty($chemo_drugs[$x]['dose'][$i]['weight_range']))
<br><br>
<span style="color: #0a776c">({{ $chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
@endif
</td>
</tr>
@for($p = 0; $p < count($chemo_drugs[$x]['dose'][$i]['duration']); $p++)
<tr>
@if(is_null($chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_by']))
<td>
{{ $chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}
</td>
<td colspan="3"></td>
@else
<td>
{{ $chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}
</td>
<td>{{ $chemo_drugs[$x]['dose'][$i]['duration'][$p]['quantity_given'] }}</td>
<td style="color: #00AEEF">{{ $users_array[$chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_by']] }}</td>
<td style="color: #00AEEF">{{ Carbon\Carbon::parse($chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_on'])->toDateTimeString() }}</td>
@endif
</tr>
@php $duration_counter++; @endphp
@endfor
@endfor
@endfor
<tr>
<td rowspan="{{ $post_chemo_drugs_count + $post_chemo_doses_count + 1 }}">Post-Chemo</td>
</tr>
@for($x = 0; $x < $post_chemo_drugs_count; $x++)
@php
$post_chemo_duration_count = array_sum(array_map(function ($value_two) {return count($value_two['duration']);}, $post_chemo_drugs[$x]['dose']));
@endphp
<tr>
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + $post_chemo_duration_count + 1 }}">
{{ $drugs[$post_chemo_drugs[$x]['drug_id']] ?? '' }}
<br><br>
Factor: {{ $factors[$post_chemo_drugs[$x]['drug_factor']] ?? '' }}
<br>
Route: {{ $drug_routes[$post_chemo_drugs[$x]['drug_route']] ?? '' }}
</td>
</tr>
@for($i = 0; $i < count($post_chemo_drugs[$x]['dose']); $i++)
<tr>
<td rowspan="{{ count($post_chemo_drugs[$x]['dose'][$i]['duration']) + 1 }}">
@php
$drug_dosage = $drug_units[$drug_with_units[$post_chemo_drugs[$x]['drug_id']]];
if ($post_chemo_drugs[$x]['drug_factor'] == 1) {
$drug_dosage .= '/m<sup>2</sup>';
} else if ($post_chemo_drugs[$x]['drug_factor'] == 2) {
$drug_dosage .= '/Kg';
}
@endphp
Dose: {{ $post_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
@if(!empty($post_chemo_drugs[$x]['dose'][$i]['instructions']))
<br><br>
<span style="color: red">{{ $post_chemo_drugs[$x]['dose'][$i]['instructions'] }}</span>
@endif
@if(!empty($post_chemo_drugs[$x]['dose'][$i]['weight_range']))
<br><br>
<span style="color: #0a776c">({{ $post_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
@endif
</td>
</tr>
@for($p = 0; $p < count($post_chemo_drugs[$x]['dose'][$i]['duration']); $p++)
<tr>
@if(is_null($post_chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_by']))
<td>
{{ $post_chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}
</td>
<td colspan="3"></td>
@else
<td>
{{ $post_chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}
</td>
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['duration'][$p]['quantity_given'] }}</td>
<td style="color: #00AEEF">{{ $users_array[$post_chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_by']] }}</td>
<td style="color: #00AEEF">{{ Carbon\Carbon::parse($post_chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_on'])->toDateTimeString() }}</td>
@endif
</tr>
@php $duration_counter++; @endphp
@endfor
@endfor
@endfor
@endforeach
</tbody>
</table>
<hr>
@endif
@if(count($ward_prescriptions) > 0)
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<tr>
<th>Drug</th>
<th>Duration</th>
<th>Given By</th>
<th>Given On</th>
</tr>
</thead>
<tbody>
@foreach($ward_prescriptions as $ward_prescription)
@php
$ward_prescription_drugs = explode(",", $ward_prescription->drugs);
$ward_prescription_dose_array = isset($ward_prescription->doses) ? explode(",", $ward_prescription->doses) : [];
$ward_prescription_freq_array = isset($ward_prescription->frequencies) ? explode(",", $ward_prescription->frequencies) : [];
$ward_prescription_duration_array = isset($ward_prescription->durations) ? explode(",", $ward_prescription->durations) : [];
$ward_prescription_quantity_array = isset($ward_prescription->quantities_dispensed) ? explode(",", $ward_prescription->quantities_dispensed) : [];
@endphp
@for($x = 0; $x < count($ward_prescription_drugs); $x++)
@php
$drug_unit = get_name(get_name($ward_prescription_drugs[$x], 'id', "unit_id", 'drugs'), "id", "name", "drug_units");
$frequency = get_name($ward_prescription_freq_array[$x], "id", "name", "dosage_frequencies");
$current_factor = get_name($ward_prescription_freq_array[$x], "id", "factor", "dosage_frequencies");
try { $current_factor = (int)ceil($current_factor); } catch (ErrorException $e) { $current_factor = 1; }
$split_duration = explode(" ", $ward_prescription_duration_array[$x]);
$duration_counter = 0;
$opd_quantity_to_give_per_day = ceil($ward_prescription_quantity_array[$x] / ((int)$split_duration[0] * $current_factor));
@endphp
<tr>
<td rowspan="{{ ((int)$split_duration[0] * $current_factor) + 1 }}">
{{ $drugs[$ward_prescription_drugs[$x]] }}
<br><br>
{{ $ward_prescription_dose_array[$x] }} {{ $drug_unit }} {{ $frequency}}
</td>
</tr>
@for($p = 0; $p < $split_duration[0]; $p++)
@for($y = 0; $y < $current_factor; $y++)
@php
// get the dispensed so far
$treatment_sheet_dispensations = \Streamline\Models\TreatmentSheetDispensations::where('ward_treatment_id', $ward_prescription->id)
->where('drug_id', $ward_prescription_drugs[$x])->where('order_number', $duration_counter)->first();
@endphp
<tr>
@if($treatment_sheet_dispensations)
<td>Day {{ $p + 1 }} <br> Dose {{ $y + 1 }}</td>
<td style="color: #00AEEF">{{ $users_array[$treatment_sheet_dispensations->given_by] }}</td>
<td style="color: #00AEEF">{{ Carbon\Carbon::parse($treatment_sheet_dispensations->given_on)->toDateTimeString() }}</td>
@else
<td colspan="3" style="display: none">Day {{ $p + 1 }} &nbsp&nbsp&nbsp Dose {{ $y + 1 }}</td>
@endif
@php $duration_counter++; @endphp
</tr>
@endfor
@endfor
@endfor
@endforeach
</tbody>
</table>
@endif
</div>
</body>
</html>
@@ -0,0 +1,346 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Referral Notes - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
font-size: 0.8em;
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
.card-header{
padding: 5px;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;"> {{ __('inpatient.inpatient_referral_notes') }}</h5>
<div class="row col">
<table class="table table-light table-sm table-borderless">
<tr>
<th scope="row">{{ __('inpatient.patient_number') }}</th>
<td>{{ $patient->number}}</td>
<td width="60" style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.ward') }}</th>
<td>
{{ get_name($inpatient_info->ward_id, 'id', 'name', 'wards') }} &nbsp;|&nbsp;
@if(is_null($inpatient_info->bed_category_id))
@else
{{ get_name($inpatient_info->bed_category_id, 'id', 'name', 'inpatient_bed_categories') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.patient_names') }}</th>
<td>{{ $patient->first_name}} {{ $patient->last_name}}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.admitted') }}</th>
<td>
@if($inpatient_info->discharged == 1)
@php $end_date = new DateTime($inpatient_info->discharged_on) @endphp
@else
@php $end_date = new DateTime(date('Y-m-d')) @endphp
@endif
@php
$start_date = new DateTime($inpatient_info->admitted_on);
$days_spent_in_ward = ($end_date->diff($start_date)->format('%a'));
@endphp
{{ streamline_date($inpatient_info->admitted_on) }} ( {{ $days_spent_in_ward }} {{ __('inpatient.days') }})
{{ Form::hidden("duration", $days_spent_in_ward) }}
{{ Form::hidden("inpatient_info_id", $inpatient_info->id) }}
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.age') }}</th>
<td><?php echo get_patients_age($patient->date_of_birth); ?></td>
<td style="border-top: 0px;">&nbsp;</td>
<th>{{ __('inpatient.discharged') }}</th>
<td>
@if($inpatient_info->discharged == 1)
{{ streamline_date($inpatient_info->discharged_on) }}
@else
{{ __('inpatient.still_admitted') }}
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.gender') }}</th>
<td>{{ $patient->gender == 1 ? __('inpatient.male') : __('inpatient.female') }}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th scope="row">{{ __('inpatient.category') }}</th>
<td>
{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}
@if(!is_null($patient_discount))
({{ $patient_discount["discount"] }} % {{ __('inpatient.discount') }})
@endif
</td>
</tr>
</table>
</div>
<div class="row">
@if( Auth::user()->can('view-patient-episode-primary-diagnoses'))
<div class="col">
<div class="card">
<div class="card-header">
<strong>{{ __('inpatient.primary_diagnosis') }}</strong>
</div>
@php
$primary_diagnosis = \Streamline\Models\Diagnosis::withTrashed()->find($inpatient_info->primary_diagnosis);
@endphp
<table class="table table-light table-sm">
<thead>
<tr>
<td>{{ $primary_diagnosis ? $primary_diagnosis->name : "" }}</td>
</tr>
</thead>
</table>
</div>
@php
$other_diagnoses = @unserialize($inpatient_info->other_diagnoses);
@endphp
@if(!empty($other_diagnoses))
<div class="card">
<div class="card-header">
<strong>{{ __('inpatient.secondary_diagnosis') }}</strong>
</div>
<table class="table table-light table-sm">
<thead>
@foreach($other_diagnoses as $diagnosis)
@php
$other_diagnosis = \Streamline\Models\Diagnosis::withTrashed()->find($diagnosis);
@endphp
<tr>
<td>{{ $other_diagnosis ? $other_diagnosis->name : "" }}</td>
</tr>
@endforeach
</thead>
</table>
</div>
@endif
</div>
@endif
</div>
<br>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<strong>{{ __('inpatient.clinical_summary') }}</strong>
</div>
<table class="table table-light table-sm">
<thead>
<tr>
<td>{{ $inpatient_info->clinical_summary }}</td>
</tr>
</thead>
</table>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<strong>{{ __('inpatient.investigations_done') }}</strong>
</div>
<table class="table table-light table-sm">
<thead>
@if(count($ward_investigations) > 0)
@for($i = 0; $i < count($ward_investigations['name']); $i++)
@if(in_array($i, $ward_investigations_position))
<tr>
<td colspan="3">
<h5><code>{{ $ward_investigations_date[array_search($i, $ward_investigations_position)] }}</code></h5>
</td>
</tr>
@endif
<tr>
<td>{{ $ward_investigations['name'][$i] }}</td>
<input type="hidden" name="ward_investigation_ids[]" value="{{ $ward_investigations['id'][$i] }}">
<td>
@if($ward_investigations['type'][$i] == 1 && $ward_investigations['value'][$i] != "Pending")
<i style="color: blue"> {{ __('inpatient.refer_to_investigation_report') }} </i>
@else
{{ $ward_investigations['value'][$i] }}
@endif
</td>
<td>{{ $ward_investigations['comment'][$i] }}</td>
</tr>
@endfor
@else
<tr>
<td colspan="3">{{ __('inpatient.no_ward_invs') }}</td>
</tr>
@endif
</thead>
</table>
</div>
</div>
</div>
{{-- if patient has any treatment to take home --}}
@if (count($treatment_to_take_away) > 0)
<br>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<strong>{{ __('inpatient.treatment_on_discharge') }}</strong>
</div>
<table class="table table-light table-sm">
@foreach($treatment_to_take_away as $treatment)
@php
$tta_drugs_array = explode(",", $treatment->drugs);
$tta_dose_array = explode(",", $treatment->doses);
$tta_freq_array = explode(",", $treatment->frequencies);
$tta_duration_array = explode(",", $treatment->durations);
$altered = $treatment->altered;
@endphp
@if($altered == 0)
<tr>
<td colspan="4" class="text-center" style="color: #0000FF; font-weight: small;">{{ __('inpatient.ordered_on') }} {{ streamline_date($treatment->created_at) }}</td>
</tr>
@for($x = 0; $x < count($tta_drugs_array); $x++)
@php
$drug_name = get_name($tta_drugs_array[$x], 'id', "name", 'drugs');
$drug_unit = get_name(get_name($tta_drugs_array[$x], 'id', "unit_id", 'drugs'), "id", "name", "drug_units");
$frequency = get_name($tta_freq_array[$x], "id", "name", "dosage_frequencies");
@endphp
<tr class='gradeX'>
<td>{{ $drug_name }}</td>
<td>{{ $tta_dose_array[$x] }} {{ $drug_unit }} {{ $frequency}} </td>
<td>{{ $tta_duration_array[$x] }}</td>
</tr>
@endfor
@else
@php
$altered_dispensed_tta = \Streamline\Models\PatientDispensing::where(['treatment_id'=>$treatment->id, 'patient_id' => $patient->patient_id, 'tta' => 1])->first();
$tta_drugs_array = is_object($altered_dispensed_tta) ? explode(",", $altered_dispensed_tta->drugs) : [];
$tta_dose_array = is_object($altered_dispensed_tta) ? explode(",", $altered_dispensed_tta->dose) : [];
$tta_freq_array = is_object($altered_dispensed_tta) ?explode(",", $altered_dispensed_tta->drug_frequency) : [];
$tta_duration_array = is_object($altered_dispensed_tta) ? explode(",", $altered_dispensed_tta->duration) : [];
@endphp
<tr><td colspan=4 style='color: #0000FF; font-weight: small;'> {{ is_object($altered_dispensed_tta) ? streamline_date($altered_dispensed_tta->created_at) : "" }}</td></tr>
@for($x = 1; $x < count($tta_drugs_array); $x++)
@php
$drug_name = get_name($tta_drugs_array[$x], 'id', "name", 'drugs');
$drug_unit = get_name(get_name($tta_drugs_array[$x], 'id', "unit_id", 'drugs'), "id", "name", "drug_units");
$frequency = get_name($tta_freq_array[$x], "id", "name", "dosage_frequencies");
@endphp
<tr class='gradeX'>
<td>{{ $drug_name }}</td>
<td>{{ $tta_dose_array[$x] }} {{ $drug_unit }} {{ $frequency}} </td>
<td>{{ $tta_duration_array[$x] }}</td>
</tr>
@endfor
@endif
@endforeach
</table>
</div>
</div>
</div>
@endif
<br>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<strong>{{ __('inpatient.referral_notes') }}</strong>
</div>
<table class="table table-light table-sm">
<thead>
<tr>
<td>{{ $inpatient_info->referral_notes }}</td>
</tr>
</thead>
</table>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col">
<div class="card">
<table class="table table-light table-sm">
<thead>
<tr>
<td><b>{{ __('inpatient.referred_by') }}: </b></td>
<td>{{ get_full_name($inpatient_info->discharged_by, "id", "first_name", "last_name", "users")}} {{ __('inpatient.on') }} {{ streamline_date($inpatient_info->discharged_on)}} {{ __('inpatient.to') }} {{ get_name($inpatient_info->referred_to, 'id', 'name', 'referral_hospitals') }}</td>
</tr>
</thead>
</table>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
{{ __('inpatient.printed_by') }}
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">
<?php echo Auth::user()->first_name . ' ' . Auth::user()->last_name; ?>
&nbsp;&nbsp;&nbsp;....................................................
&nbsp;&nbsp;&nbsp;({{ streamline_date(date("Y-m-d")) }})
</li>
</ul>
</div>
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,581 @@
<div class="modal fade" id="treatment_sheet_details" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="treatment_sheet_details_label">Treatment Sheet</h4>
</div>
<div class="modal-body">
<a href="/treatment_sheet/print/{{ $episode_id }}" target="_blank" class="btn btn-sm btn-success">Print Treatment Sheet</a>
<hr>
@if(count($ordered_cancer_protocols) > 0)
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<tr>
<th>Section</th>
<th>Drug</th>
<th>Dose</th>
<th>Duration</th>
<th>Quantity Given</th>
<th>Given By</th>
<th>Given On</th>
</tr>
</thead>
<tbody>
@foreach($ordered_cancer_protocols as $ordered_cancer_protocol)
@php
$pre_chemo_drugs = json_decode($ordered_cancer_protocol->pre_chemo_drugs, true);
$chemo_drugs = json_decode($ordered_cancer_protocol->chemo_drugs, true);
$post_chemo_drugs = json_decode($ordered_cancer_protocol->post_chemo_drugs, true);
$pre_chemo_drugs_count = count($pre_chemo_drugs);
$chemo_drugs_count = count($chemo_drugs);
$post_chemo_drugs_count = count($post_chemo_drugs);
$pre_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $pre_chemo_drugs));
$chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $chemo_drugs));
$post_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $post_chemo_drugs));
$pre_chemo_doses_count += array_sum(array_map(function ($value) {return array_sum(array_map(function ($value_two) {return count($value_two['duration']);}, $value['dose']));}, $pre_chemo_drugs));
$chemo_doses_count += array_sum(array_map(function ($value) {return array_sum(array_map(function ($value_two) {return count($value_two['duration']);}, $value['dose']));}, $chemo_drugs));
$post_chemo_doses_count += array_sum(array_map(function ($value) {return array_sum(array_map(function ($value_two) {return count($value_two['duration']);}, $value['dose']));}, $post_chemo_drugs));
$protocol_details = \Streamline\Models\CancerProtocol::find($ordered_cancer_protocol->protocol_id);
$duration_counter = 0;
@endphp
<tr>
<td colspan="7">
<h3 class="text-center">{{ $protocol_details->name }} @if($ordered_cancer_protocol->protocol_status != 0) ({{ [1 => 'Stopped', 2 => 'Completed'][$ordered_cancer_protocol->protocol_status] ?? '' }}) @endif</h3>
</td>
</tr>
<tr>
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + 1 }}">Pre-Chemo</td>
</tr>
@for($x = 0; $x < $pre_chemo_drugs_count; $x++)
@php
$pre_chemo_duration_count = array_sum(array_map(function ($value_two) {return count($value_two['duration']);}, $pre_chemo_drugs[$x]['dose']));
@endphp
<tr>
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + $pre_chemo_duration_count + 1 }}">
{{ $drugs[$pre_chemo_drugs[$x]['drug_id']] ?? '' }}
<br><br>
Factor: {{ $factors[$pre_chemo_drugs[$x]['drug_factor']] ?? '' }}
<br>
Route: {{ $drug_routes[$pre_chemo_drugs[$x]['drug_route']] ?? '' }}
</td>
</tr>
@for($i = 0; $i < count($pre_chemo_drugs[$x]['dose']); $i++)
<tr>
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose'][$i]['duration']) + 1 }}">
@php
$drug_dosage = $drug_units[$drug_with_units[$pre_chemo_drugs[$x]['drug_id']]];
if ($pre_chemo_drugs[$x]['drug_factor'] == 1) {
$drug_dosage .= '/m<sup>2</sup>';
} else if ($pre_chemo_drugs[$x]['drug_factor'] == 2) {
$drug_dosage .= '/Kg';
}
@endphp
Dose: {{ $pre_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
@if(!empty($pre_chemo_drugs[$x]['dose'][$i]['instructions']))
<br><br>
<span style="color: red">{{ $pre_chemo_drugs[$x]['dose'][$i]['instructions'] }}</span>
@endif
@if(!empty($pre_chemo_drugs[$x]['dose'][$i]['weight_range']))
<br><br>
<span style="color: #0a776c">({{ $pre_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
@endif
</td>
</tr>
@for($p = 0; $p < count($pre_chemo_drugs[$x]['dose'][$i]['duration']); $p++)
<tr>
@if($inpatient_info->discharged == 1)
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}</td>
<td colspan="3">{{ __('inpatient.not_given') }}</td>
@elseif(is_null($pre_chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_by']))
@if($ordered_cancer_protocol->protocol_status == 0)
<td>
{{ $pre_chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}
<br><br>
{{ Form::checkbox('pre_chemo_day_given[]', $duration_counter, false, ['class' => 'treatment_sheet_remove duration_row_' . $duration_counter . $ordered_cancer_protocol->id, 'onchange' => 'highlight_duration_row("' . $duration_counter . $ordered_cancer_protocol->id . '", this.checked)']) }}
</td>
<td>
{{ Form::number('pre_chemo_quantity_given[]', 0, ['class' => 'form-control treatment_sheet_remove duration_row_' . $duration_counter . $ordered_cancer_protocol->id])}}
{{ $drug_forms[$drug_with_forms[$pre_chemo_drugs[$x]['drug_id']]] }}
</td>
<td>{{ Form::select('pre_chemo_given_by[]', $users_array, '', ['class' => 'form-control treatment_sheet_remove duration_row_' . $duration_counter . $ordered_cancer_protocol->id])}}</td>
<td><input type='datetime-local' name='pre_chemo_given_on[]' class='form-control treatment_sheet_remove duration_row_{{ $duration_counter . $ordered_cancer_protocol->id }}'/></td>
{{ Form::hidden('pre_chemo_tracker_num[]', $duration_counter, ['class' => 'treatment_sheet_remove duration_row_' . $duration_counter . $ordered_cancer_protocol->id]) }}
{{ Form::hidden('pre_chemo_order_id[]', $ordered_cancer_protocol->id, ['class' => 'treatment_sheet_remove duration_row_' . $duration_counter . $ordered_cancer_protocol->id]) }}
@else
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}</td>
<td colspan="3"></td>
@endif
@else
<td>
{{ $pre_chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}
</td>
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['duration'][$p]['quantity_given'] }}</td>
<td style="color: #00AEEF">{{ $users_array[$pre_chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_by']] }}</td>
<td style="color: #00AEEF">{{ Carbon\Carbon::parse($pre_chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_on'])->toDateTimeString() }}</td>
@endif
</tr>
@php $duration_counter++; @endphp
@endfor
@endfor
@endfor
<tr>
<td rowspan="{{ $chemo_drugs_count + $chemo_doses_count + 1 }}">Chemo</td>
</tr>
@for($x = 0; $x < $chemo_drugs_count; $x++)
@php
$chemo_duration_count = array_sum(array_map(function ($value_two) {return count($value_two['duration']);}, $chemo_drugs[$x]['dose']));
@endphp
<tr>
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + $chemo_duration_count + 1 }}">
{{ $drugs[$chemo_drugs[$x]['drug_id']] ?? '' }}
<br><br>
Factor: {{ $factors[$chemo_drugs[$x]['drug_factor']] ?? '' }}
<br>
Route: {{ $drug_routes[$chemo_drugs[$x]['drug_route']] ?? '' }}
</td>
</tr>
@for($i = 0; $i < count($chemo_drugs[$x]['dose']); $i++)
<tr>
<td rowspan="{{ count($chemo_drugs[$x]['dose'][$i]['duration']) + 1 }}">
@php
$drug_dosage = $drug_units[$drug_with_units[$chemo_drugs[$x]['drug_id']]];
if ($chemo_drugs[$x]['drug_factor'] == 1) {
$drug_dosage .= '/m<sup>2</sup>';
} else if ($chemo_drugs[$x]['drug_factor'] == 2) {
$drug_dosage .= '/Kg';
}
@endphp
Dose: {{ $chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
@if(!empty($chemo_drugs[$x]['dose'][$i]['instructions']))
<br><br>
<span style="color: red">{{ $chemo_drugs[$x]['dose'][$i]['instructions'] }}</span>
@endif
@if(!empty($chemo_drugs[$x]['dose'][$i]['weight_range']))
<br><br>
<span style="color: #0a776c">({{ $chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
@endif
</td>
</tr>
@for($p = 0; $p < count($chemo_drugs[$x]['dose'][$i]['duration']); $p++)
<tr>
@if($inpatient_info->discharged == 1)
<td>{{ $chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}</td>
<td colspan="3">{{ __('inpatient.not_given') }}</td>
@elseif(is_null($chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_by']))
@if($ordered_cancer_protocol->protocol_status == 0)
<td>
{{ $chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}
<br><br>
{{ Form::checkbox('chemo_day_given[]', $duration_counter, false, ['class' => 'treatment_sheet_remove duration_row_' . $duration_counter . $ordered_cancer_protocol->id, 'onchange' => 'highlight_duration_row("' . $duration_counter . $ordered_cancer_protocol->id . '", this.checked)']) }}
</td>
<td>
{{ Form::number('chemo_quantity_given[]', 0, ['class' => 'form-control treatment_sheet_remove duration_row_' . $duration_counter . $ordered_cancer_protocol->id])}}
{{ $drug_forms[$drug_with_forms[$chemo_drugs[$x]['drug_id']]] }}
</td>
<td>{{ Form::select('chemo_given_by[]', $users_array, '', ['class' => 'form-control treatment_sheet_remove duration_row_' . $duration_counter . $ordered_cancer_protocol->id])}}</td>
<td><input type='datetime-local' name='chemo_given_on[]' class='form-control treatment_sheet_remove duration_row_{{ $duration_counter . $ordered_cancer_protocol->id }}'/></td>
{{ Form::hidden('chemo_tracker_num[]', $duration_counter, ['class' => 'treatment_sheet_remove duration_row_' . $duration_counter . $ordered_cancer_protocol->id]) }}
{{ Form::hidden('chemo_order_id[]', $ordered_cancer_protocol->id, ['class' => 'treatment_sheet_remove duration_row_' . $duration_counter . $ordered_cancer_protocol->id]) }}
@else
<td>{{ $chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}</td>
<td colspan="3"></td>
@endif
@else
<td>
{{ $chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}
</td>
<td>{{ $chemo_drugs[$x]['dose'][$i]['duration'][$p]['quantity_given'] }}</td>
<td style="color: #00AEEF">{{ $users_array[$chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_by']] }}</td>
<td style="color: #00AEEF">{{ Carbon\Carbon::parse($chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_on'])->toDateTimeString() }}</td>
@endif
</tr>
@php $duration_counter++; @endphp
@endfor
@endfor
@endfor
<tr>
<td rowspan="{{ $post_chemo_drugs_count + $post_chemo_doses_count + 1 }}">Post-Chemo</td>
</tr>
@for($x = 0; $x < $post_chemo_drugs_count; $x++)
@php
$post_chemo_duration_count = array_sum(array_map(function ($value_two) {return count($value_two['duration']);}, $post_chemo_drugs[$x]['dose']));
@endphp
<tr>
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + $post_chemo_duration_count + 1 }}">
{{ $drugs[$post_chemo_drugs[$x]['drug_id']] ?? '' }}
<br><br>
Factor: {{ $factors[$post_chemo_drugs[$x]['drug_factor']] ?? '' }}
<br>
Route: {{ $drug_routes[$post_chemo_drugs[$x]['drug_route']] ?? '' }}
</td>
</tr>
@for($i = 0; $i < count($post_chemo_drugs[$x]['dose']); $i++)
<tr>
<td rowspan="{{ count($post_chemo_drugs[$x]['dose'][$i]['duration']) + 1 }}">
@php
$drug_dosage = $drug_units[$drug_with_units[$post_chemo_drugs[$x]['drug_id']]];
if ($post_chemo_drugs[$x]['drug_factor'] == 1) {
$drug_dosage .= '/m<sup>2</sup>';
} else if ($post_chemo_drugs[$x]['drug_factor'] == 2) {
$drug_dosage .= '/Kg';
}
@endphp
Dose: {{ $post_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
@if(!empty($post_chemo_drugs[$x]['dose'][$i]['instructions']))
<br><br>
<span style="color: red">{{ $post_chemo_drugs[$x]['dose'][$i]['instructions'] }}</span>
@endif
@if(!empty($post_chemo_drugs[$x]['dose'][$i]['weight_range']))
<br><br>
<span style="color: #0a776c">({{ $post_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
@endif
</td>
</tr>
@for($p = 0; $p < count($post_chemo_drugs[$x]['dose'][$i]['duration']); $p++)
<tr>
@if($inpatient_info->discharged == 1)
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}</td>
<td colspan="3">{{ __('inpatient.not_given') }}</td>
@elseif(is_null($post_chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_by']))
@if($ordered_cancer_protocol->protocol_status == 0)
<td>
{{ $post_chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}
<br><br>
{{ Form::checkbox('post_chemo_day_given[]', $duration_counter, false, ['class' => 'treatment_sheet_remove duration_row_' . $duration_counter . $ordered_cancer_protocol->id, 'onchange' => 'highlight_duration_row("' . $duration_counter . $ordered_cancer_protocol->id . '", this.checked)']) }}
</td>
<td>
{{ Form::number('post_chemo_quantity_given[]', 0, ['class' => 'form-control treatment_sheet_remove duration_row_' . $duration_counter . $ordered_cancer_protocol->id])}}
{{ $drug_forms[$drug_with_forms[$post_chemo_drugs[$x]['drug_id']]] }}
</td>
<td>{{ Form::select('post_chemo_given_by[]', $users_array, '', ['class' => 'form-control treatment_sheet_remove duration_row_' . $duration_counter . $ordered_cancer_protocol->id])}}</td>
<td><input type='datetime-local' name='post_chemo_given_on[]' class='form-control treatment_sheet_remove duration_row_{{ $duration_counter . $ordered_cancer_protocol->id }}'/></td>
{{ Form::hidden('post_chemo_tracker_num[]', $duration_counter, ['class' => 'treatment_sheet_remove duration_row_' . $duration_counter . $ordered_cancer_protocol->id]) }}
{{ Form::hidden('post_chemo_order_id[]', $ordered_cancer_protocol->id, ['class' => 'treatment_sheet_remove duration_row_' . $duration_counter . $ordered_cancer_protocol->id]) }}
@else
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}</td>
<td colspan="3"></td>
@endif
@else
<td>
{{ $post_chemo_drugs[$x]['dose'][$i]['duration'][$p]['name'] }}
</td>
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['duration'][$p]['quantity_given'] }}</td>
<td style="color: #00AEEF">{{ $users_array[$post_chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_by']] }}</td>
<td style="color: #00AEEF">{{ Carbon\Carbon::parse($post_chemo_drugs[$x]['dose'][$i]['duration'][$p]['given_on'])->toDateTimeString() }}</td>
@endif
</tr>
@php $duration_counter++; @endphp
@endfor
@endfor
@endfor
@endforeach
</tbody>
</table>
<hr>
@endif
@if(count($ward_prescriptions) > 0)
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<tr>
<th>Drug</th>
<th>Duration</th>
<th>Given By</th>
<th>Given On</th>
</tr>
</thead>
<tbody>
@foreach($ward_prescriptions as $ward_prescription)
@php
$ward_prescription_drugs = explode(",", $ward_prescription->drugs);
$ward_prescription_dose_array = isset($ward_prescription->doses) ? explode(",", $ward_prescription->doses) : [];
$ward_prescription_freq_array = isset($ward_prescription->frequencies) ? explode(",", $ward_prescription->frequencies) : [];
$ward_prescription_duration_array = isset($ward_prescription->durations) ? explode(",", $ward_prescription->durations) : [];
$ward_prescription_quantity_array = isset($ward_prescription->quantities_dispensed) ? explode(",", $ward_prescription->quantities_dispensed) : [];
@endphp
@for($x = 0; $x < count($ward_prescription_drugs); $x++)
@php
$drug_name = get_name($ward_prescription_drugs[$x], 'id', "name", 'drugs');
$drug_unit = get_name(get_name($ward_prescription_drugs[$x], 'id', "unit_id", 'drugs'), "id", "name", "drug_units");
$frequency = get_name($ward_prescription_freq_array[$x], "id", "name", "dosage_frequencies");
$current_factor = get_name($ward_prescription_freq_array[$x], "id", "factor", "dosage_frequencies");
try { $current_factor = (int)ceil($current_factor); } catch (ErrorException $e) { $current_factor = 1; }
$split_duration = explode(" ", $ward_prescription_duration_array[$x]);
$duration_counter = 0;
$opd_quantity_to_give_per_day = ceil($ward_prescription_quantity_array[$x] / ((int)$split_duration[0] * $current_factor));
@endphp
<tr>
<td rowspan="{{ ((int)$split_duration[0] * $current_factor) + 1 }}">
{{ $drug_name }}
<br><br>
{{ $ward_prescription_dose_array[$x] }} {{ $drug_unit }} {{ $frequency}}
</td>
</tr>
@for($p = 0; $p < $split_duration[0]; $p++)
@for($y = 0; $y < $current_factor; $y++)
@php
// get the dispensed so far
$treatment_sheet_dispensations = \Streamline\Models\TreatmentSheetDispensations::where('ward_treatment_id', $ward_prescription->id)
->where('drug_id', $ward_prescription_drugs[$x])->where('order_number', $duration_counter)->first();
@endphp
<tr>
@if($treatment_sheet_dispensations)
<td>Day {{ $p + 1 }} <br> Dose {{ $y + 1 }}</td>
<td style="color: #00AEEF">{{ $users_array[$treatment_sheet_dispensations->given_by] }}</td>
<td style="color: #00AEEF">{{ Carbon\Carbon::parse($treatment_sheet_dispensations->given_on)->toDateTimeString() }}</td>
@elseif($inpatient_info->discharged == 1)
<td>Day {{ $p + 1 }} <br> Dose {{ $y + 1 }}</td>
<td colspan="2">{{ __('inpatient.not_given') }}</td>
@else
@php
$opd_id = $ward_prescription->id . '-' . $ward_prescription_drugs[$x] . '-' . $duration_counter;
@endphp
<td>
Day {{ $p + 1 }} <br> Dose {{ $y + 1 }}
<br><br>
{{ Form::checkbox('opd_day_given[]', $duration_counter, false, ['class' => 'treatment_sheet_remove duration_row_' . $opd_id, 'onchange' => 'highlight_duration_row("' . $opd_id . '", this.checked)']) }}
</td>
<td>{{ Form::select('opd_given_by[]', $users_array, Auth::id(), ['class' => 'form-control select treatment_sheet_remove duration_row_' . $opd_id])}}</td>
<td><input type='datetime-local' name='opd_given_on[]' class='form-control treatment_sheet_remove duration_row_{{ $opd_id }}' value="{{ date('Y-m-d') }}T{{ date('H:i') }}" max="{{ date('Y-m-d') }}T{{ date('H:i') }}"/></td>
{{ Form::hidden('opd_order_number[]', $duration_counter, ['class' => 'treatment_sheet_remove duration_row_' . $opd_id]) }}
{{ Form::hidden('opd_ward_treatment_id[]', $ward_prescription->id, ['class' => 'treatment_sheet_remove duration_row_' . $opd_id]) }}
{{ Form::hidden('opd_drug_id[]', $ward_prescription_drugs[$x], ['class' => 'treatment_sheet_remove duration_row_' . $opd_id]) }}
{{ Form::hidden('opd_quantity_given[]', $opd_quantity_to_give_per_day, ['class' => 'treatment_sheet_remove duration_row_' . $opd_id]) }}
@endif
@php $duration_counter++; @endphp
</tr>
@endfor
@endfor
@endfor
@endforeach
</tbody>
</table>
@endif
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" id="close_treatment_sheet" data-dismiss="modal">{{ __('layout.close') }}</button>
<button type="button" class="btn btn-success" onclick="submitTreatmentSheet()">{{ __('layout.submit') }}</button>
</div>
</div>
</div>
</div>
@push('scripts')
<script>
function highlight_duration_row(id, status) {
if (status) {
$('.duration_row_' + id).each(function () {
$(this).removeClass('treatment_sheet_remove')
});
} else {
$('.duration_row_' + id).each(function () {
$(this).addClass('treatment_sheet_remove')
});
}
}
function submitTreatmentSheet() {
$(".treatment_sheet_remove").each(function () {
$(this).remove()
});
let pre_chemo_given_by = $("select[name='pre_chemo_given_by[]'] option:selected").map(function () {
return this.value;
}).get();
let pre_chemo_given_on = $("input[name='pre_chemo_given_on[]']").map(function () {
return this.value;
}).get();
let pre_chemo_tracker_num = $("input[name='pre_chemo_tracker_num[]']").map(function () {
return this.value;
}).get();
let pre_chemo_order_id = $("input[name='pre_chemo_order_id[]']").map(function () {
return this.value;
}).get();
let pre_chemo_quantity_given = $("input[name='pre_chemo_quantity_given[]']").map(function () {
return this.value;
}).get();
// chemo
let chemo_given_by = $("select[name='chemo_given_by[]'] option:selected").map(function () {
return this.value;
}).get();
let chemo_given_on = $("input[name='chemo_given_on[]']").map(function () {
return this.value;
}).get();
let chemo_tracker_num = $("input[name='chemo_tracker_num[]']").map(function () {
return this.value;
}).get();
let chemo_order_id = $("input[name='chemo_order_id[]']").map(function () {
return this.value;
}).get();
let chemo_quantity_given = $("input[name='chemo_quantity_given[]']").map(function () {
return this.value;
}).get();
// post
let post_chemo_given_by = $("select[name='post_chemo_given_by[]'] option:selected").map(function () {
return this.value;
}).get();
let post_chemo_given_on = $("input[name='post_chemo_given_on[]']").map(function () {
return this.value;
}).get();
let post_chemo_tracker_num = $("input[name='post_chemo_tracker_num[]']").map(function () {
return this.value;
}).get();
let post_chemo_order_id = $("input[name='post_chemo_order_id[]']").map(function () {
return this.value;
}).get();
let post_chemo_quantity_given = $("input[name='post_chemo_quantity_given[]']").map(function () {
return this.value;
}).get();
// opd treatments
let opd_given_by = $("select[name='opd_given_by[]'] option:selected").map(function () {
return this.value;
}).get();
let opd_given_on = $("input[name='opd_given_on[]']").map(function () {
return this.value;
}).get();
let opd_order_number = $("input[name='opd_order_number[]']").map(function () {
return this.value;
}).get();
let opd_ward_treatment_id = $("input[name='opd_ward_treatment_id[]']").map(function () {
return this.value;
}).get();
let opd_drug_id = $("input[name='opd_drug_id[]']").map(function () {
return this.value;
}).get();
let opd_quantity_given = $("input[name='opd_quantity_given[]']").map(function () {
return this.value;
}).get();
let patient_id = $("#patient_id").val();
let episode_id = $("#episode_id").val();
let ward_id = $("#ward_id").val();
$.ajax({
url: '/treatment_sheet/save',
data: {
"pre_chemo_given_by[]": pre_chemo_given_by,
"pre_chemo_given_on[]": pre_chemo_given_on,
"pre_chemo_tracker_num[]": pre_chemo_tracker_num,
"pre_chemo_order_id[]": pre_chemo_order_id,
"pre_chemo_quantity_given[]": pre_chemo_quantity_given,
"chemo_given_by[]": chemo_given_by,
"chemo_given_on[]": chemo_given_on,
"chemo_tracker_num[]": chemo_tracker_num,
"chemo_order_id[]": chemo_order_id,
"chemo_quantity_given[]": chemo_quantity_given,
"post_chemo_given_by[]": post_chemo_given_by,
"post_chemo_given_on[]": post_chemo_given_on,
"post_chemo_tracker_num[]": post_chemo_tracker_num,
"post_chemo_order_id[]": post_chemo_order_id,
"post_chemo_quantity_given[]": post_chemo_quantity_given,
"opd_given_by[]": opd_given_by,
"opd_given_on[]": opd_given_on,
"opd_order_number[]": opd_order_number,
"opd_ward_treatment_id[]": opd_ward_treatment_id,
"opd_drug_id[]": opd_drug_id,
"opd_quantity_given[]": opd_quantity_given,
"patient_id": patient_id,
"episode_id": episode_id,
"ward_id": ward_id
},
success: function (response) {
if (response === "self") {
alert("Treatment sheet saved successfully");
window.location.reload();
} else if (response === "patient_home") {
alert("Treatment sheet saved successfully");
window.location.href = '/patient_episodes';
} else if (response === "ward_home") {
alert("Treatment sheet saved successfully");
window.location.href = '/wards/select';
} else {
alert("An error occurred");
}
},
error: function (jqXHR, textStatus, errorThrown) {
//
}
});
}
</script>
@endpush
@@ -0,0 +1,49 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patient_episode.treatment_sheet') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_episode.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patient_episode.patients') }}</a></li>
<li class="active">{{ __('patient_episode.treatment_sheet') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patients::allergies.header')
</div>
</div>
<a type="button" data-toggle="modal" data-target="#treatment_sheet_details" id="treatment_sheet_btn" style="display: none">Treatment Sheet</a>
{{ Form::hidden('patient_id', $patient_id, ['id' => 'patient_id']) }}
{{ Form::hidden('episode_id', $episode_id, ['id' => 'episode_id']) }}
{{ Form::hidden('ward_id', $ward_id, ['id' => 'ward_id']) }}
@include('ward_management::inpatient.treatment_sheet_details')
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
$(document).ready(function () {
setTimeout(function() {
$('#treatment_sheet_btn').click();
}, 1000);
});
$('#close_treatment_sheet').click(function () {
window.location.href = '/treatment_sheet/redirect_back';
})
</script>
@endpush
@@ -0,0 +1,169 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-6 col-md-7 col-sm-7 col-xs-12">
<h4 class="page-title">Incoming ward requests</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">Dashboard</a></li>
<li class="active">Incoming ward requests</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' => 'ward_item_request.incoming_ward_requests' , 'data-toggle' => 'validator']) }}
<div class="white-box">
<div class="row">
<div class="col-md-3">
<div class="form-group">
{{ Form::label('ward_id', 'Wards') }}
{{ Form::select('ward_id', $wards, '', ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
{{ Form::label('item_type', 'Item type') }}
{{ Form::select('item_type',[''=>'--Select--', '1' => 'Drugs', '2' => 'Sundries', '3' => 'General Items'],'',['class' => 'form-control compulsory', 'required']) }}
</div>
</div>
<div class="col-md-2">
<div class="form-group">
{{ Form::label('start_date','Date From') }}
{{ Form::text('start_date','',['class' => 'form-control compulsory', 'required','readonly','id'=>'start_date']) }}
</div>
</div>
<div class="col-md-2">
<div class="form-group">
{{ Form::label('end_date','Date To') }}
{{ Form::text('end_date','',['class' => 'form-control compulsory', 'required','readonly','id'=>'end_date']) }}
</div>
</div>
<div class="col-md-3">
<br>
{{ Form::button('Search',['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
</div>
</div>
</div>
{{ Form::close() }}
</div>
</div>
@if($search_complete || !is_null($ward_item_requests))
<div class="row">
<div class="col-md-12">
<div class="white-box">
@if($search_complete)
<h4 style="color: #0060BF; font-weight: bolder;">{{ streamline_date($start_date) }} to {{ streamline_date($end_date) }}</h4>
@else
<h4 style="color: #0060BF; font-weight: bolder;">Item requests in the last 24 hours</h4>
@endif
<div class="table-responsive">
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<tr>
<th>Date</th>
<th>Ward</th>
<th>Items</th>
<th>Requested by</th>
<th>Approval status</th>
<th></th>
</tr>
</thead>
<tbody>
@if(count($ward_item_requests) > 0)
@foreach($ward_item_requests as $record)
@php
$item_type = $record->item_type;
$item_ids_array = explode(",", $record->item_ids);
$item_quantities_array = explode(",", $record->item_quantities);
@endphp
<tr>
<td>
{{ streamline_date($record->created_at) }}
</td>
<td>{{ get_name($record->ward_id, 'id', 'name', 'wards') }}</td>
<td>
{{ count($item_ids_array) }}
@if($record->item_type == "1") Drugs
@elseif($record->item_type == "2") Sundries
@else General Items
@endif
</td>
<td>
{{ get_full_name($record->created_by, 'id', 'first_name', 'last_name', 'users') }}
</td>
<td>{!! $record->approved_status == 1 ? "<font style='color: green'>Approved</font>" : "<font style='color: red'>Not approved</font>"!!}</td>
<td>
{{ Form::open(['route' => 'ward_item_request.ward_item_request_details']) }}
{{ Form::hidden('ward_item_request_id',$record->id) }}
@if($record->dispensation_status == 1 && $record->approved_status == 1)
<button class="btn btn-default" disabled>Items dispensed &nbsp;</button>
<a class="btn btn-success" href="print_ward_item_request_details/{{ $record->id }}">View Details &nbsp;</a>
@elseif($record->approved_status == 1)
@if( Auth::user()->can('dispense-ward-request'))
<button type="submit" class="btn btn-success">Dispense Items &nbsp;</button>
@else
<button class="btn btn-success" disabled>Dispense Request</button>
@endif
@else
@if( Auth::user()->can('approve-ward-request'))
<button type="submit" class="btn btn-info">Approve Request</button>
@else
<button class="btn btn-info" disabled>Approve Request</button>
@endif
@endif
{{ Form::close() }}
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="6" class="text-center">No records available for this search query</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</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 type="text/javascript">
$(document).ready(function() {
$('#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'
});
});
</script>
@endpush
@@ -0,0 +1,165 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
/*font-size: 1.2em;*/
}
thead {
/*display: table-header-group;*/
}
tfoot {
/*display: table-row-group;*/
}
tr {
page-break-inside: avoid;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">Ward request items receipt</h5>
<h5 class="heading" style="text-align: center; color: #0060BF; font-weight: bolder;">Request from <strong>{{ get_name($ward_request_record->ward_id, "id", "name", "wards") }}</strong> on {{ streamline_date($ward_request_record->created_at) }}</h5>
@php
$item_ids_array = explode(",", $ward_request_record->item_ids_issued_out);
$item_quantities_array = explode(",", $ward_request_record->item_quantities);
if($ward_request_record->approved_status == "1"){
$items_on_request_array = explode(",", $ward_request_record->item_ids);
$balance_returned_array = explode(",", $ward_request_record->balance_returned);
$quantity_approved_array = explode(",", $ward_request_record->item_quantities_approved);
$quantity_issued_out_array = explode(",", $ward_request_record->quantity_issued_out);
/* do this to create an ass array of items to balance returned */
$item_with_requests_associative_array = [];
$item_with_balance_associative_array = [];
for ($c=0; $c < count($items_on_request_array) ; $c++) {
$item_with_requests_associative_array[$items_on_request_array[$c]] = $item_quantities_array[$c];
$item_with_balance_associative_array[$items_on_request_array[$c]] = $balance_returned_array[$c];
}
/* ***** */
}
$total_items_cost = 0;
@endphp
<table class="table table-light table-sm table-borderless">
<thead>
<tr>
<th>No.</th>
<th>
@if($ward_request_record->item_type == "1")
Drug
@elseif($ward_request_record->item_type == "2")
Sundry
@else
General Item
@endif
</th>
<th>Balance returned</th>
<th>Quantity requested</th>
<th>Quantity issued</th>
<th>Unit cost</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
@for($i=0; $i < count($item_ids_array); $i++)
<tr>
<td>
{{ $i + 1 }}
</td>
<td>
@if($ward_request_record->item_type == "1")
{{ get_name($item_ids_array[$i], "id", "name", "drugs") }}
@elseif($ward_request_record->item_type == "2")
{{ get_name($item_ids_array[$i], "id", "name", "sundries") }}
@else
{{ get_name($item_ids_array[$i], "id", "name", "general_items") }}
@endif
</td>
<td>
{{ $item_with_balance_associative_array[$item_ids_array[$i]] ?? "" }}
</td>
<td>
{{ $item_with_requests_associative_array[$item_ids_array[$i]] ?? "" }}
</td>
<td>
{{ $quantity_issued_out_array[$i] }}
</td>
<td>
@if($ward_request_record->item_type == 1)
{{ ugandan_shillings_with_decimals(get_name($item_ids_array[$i], "id", "cost_price", "drugs")) }}
@elseif($ward_request_record->item_type == 2)
{{ ugandan_shillings_with_decimals(get_name($item_ids_array[$i], "id", "cost_price", "sundries")) }}
@elseif($ward_request_record->item_type == 3)
{{ ugandan_shillings_with_decimals(get_name($item_ids_array[$i], "id", "cost_price", "general_items")) }}
@endif
</td>
<td>
@if($ward_request_record->item_type == 1)
@php
$total_items_cost += $quantity_issued_out_array[$i] * get_name($item_ids_array[$i], "id", "cost_price", "drugs");
@endphp
{{ ugandan_shillings_with_decimals($quantity_issued_out_array[$i] * get_name($item_ids_array[$i], "id", "cost_price", "drugs")) }}
@elseif($ward_request_record->item_type == 2)
@php
$total_items_cost += $quantity_issued_out_array[$i] * get_name($item_ids_array[$i], "id", "cost_price", "sundries");
@endphp
{{ ugandan_shillings_with_decimals($quantity_issued_out_array[$i] * get_name($item_ids_array[$i], "id", "cost_price", "sundries")) }}
@elseif($ward_request_record->item_type == 3)
@php
$total_items_cost += $quantity_issued_out_array[$i] * get_name($item_ids_array[$i], "id", "cost_price", "general_items");
@endphp
{{ ugandan_shillings_with_decimals($quantity_issued_out_array[$i] * get_name($item_ids_array[$i], "id", "cost_price", "general_items")) }}
@endif
</td>
</tr>
@endfor
</tbody>
</table>
<br>
<strong>COMMENT:</strong><br>{{ $ward_request_record->comment }}
<br>
<div class="row">
<div class="col">
<strong>RECEIVED BY:</strong><br> {{ get_full_name($ward_request_record->received_by, 'id', 'first_name', 'last_name', 'users') }}
</div>
<div class="col">
<strong>ISSUED BY:</strong><br> {{ get_full_name($ward_request_record->dispensed_by, 'id', 'first_name', 'last_name', 'users') }}
</div>
<div class="col">
<strong>DISPENSED ON:</strong><br>{{ streamline_date($ward_request_record->dispensed_on) }}
</div>
<div class="col">
<strong>APPROVED BY:</strong><br>{{ get_full_name($ward_request_record->approved_by, 'id', 'first_name', 'last_name', 'users') }}
</div>
</div>
</div>
</body>
</html>
@@ -0,0 +1,181 @@
@extends('layouts.main')
@push('styles')
@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 request items receipt</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">Dashboard</a></li>
<li><a href="{{ url('incoming_ward_requests') }}">Incoming ward requests</a></li>
<li class="active">Ward request items receipt</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('flash::message')
<div style="float:right;"><a class="btn btn-success glyphicon glyphicon-print" href="/print_ward_item_request_details_pdf/{{ $ward_request_record->id }}" target="_blank"> Print</a></div><br><br>
</div>
</div>
<div class="row">
<div class="col-sm-12" id="divToPrint">
<div class="white-box">
@php
$item_ids_array = explode(",", $ward_request_record->item_ids_issued_out);
$item_quantities_array = explode(",", $ward_request_record->item_quantities);
if($ward_request_record->approved_status == "1"){
$items_on_request_array = explode(",", $ward_request_record->item_ids);
$balance_returned_array = explode(",", $ward_request_record->balance_returned);
$quantity_approved_array = explode(",", $ward_request_record->item_quantities_approved);
$quantity_issued_out_array = explode(",", $ward_request_record->quantity_issued_out);
/* do this to create an ass array of items to balance returned */
$item_with_requests_associative_array = [];
$item_with_balance_associative_array = [];
for ($c=0; $c < count($items_on_request_array) ; $c++) {
$item_with_requests_associative_array[$items_on_request_array[$c]] = $item_quantities_array[$c];
$item_with_balance_associative_array[$items_on_request_array[$c]] = $balance_returned_array[$c];
}
/* ***** */
}
$hospital_information = \Streamline\Models\HospitalInformation::first();
@endphp
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>Tel:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>Email:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>Department:</b> {{ get_name($ward_request_record->ward_id, "id", "name", "wards") }}</span><br>
<span class="receipt-label"><b>Authorized by:</b> {{ get_full_name($ward_request_record->approved_by, 'id', 'first_name', 'last_name', 'users') }}</span><br>
</p>
@php
$total_items_cost = 0;
@endphp
<div class="table-responsive">
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<tr>
<th style="text-align: left;">No.</th>
<th style="text-align: left;">
@if($ward_request_record->item_type == "1")
Drug
@elseif($ward_request_record->item_type == "2")
Sundry
@else
General Item
@endif
</th>
<th style="text-align: left;">Balance returned</th>
<th style="text-align: left;">Quantity requested</th>
<th style="text-align: left;">Quantity issued</th>
<th style="text-align: left;">Unit cost</th>
<th style="text-align: left;">Amount</th>
</tr>
</thead>
<tbody>
@for($i=0; $i < count($item_ids_array); $i++)
<tr>
<td style="text-align: left;">
{{ $i + 1 }}
</td>
<td style="text-align: left;">
@if($ward_request_record->item_type == "1")
{{ get_name($item_ids_array[$i], "id", "name", "drugs") }}
@elseif($ward_request_record->item_type == "2")
{{ get_name($item_ids_array[$i], "id", "name", "sundries") }}
@else
{{ get_name($item_ids_array[$i], "id", "name", "general_items") }}
@endif
</td>
<td style="text-align: left;">
{{ $item_with_balance_associative_array[$item_ids_array[$i]] ?? "" }}
</td>
<td style="text-align: left;">
{{ $item_with_requests_associative_array[$item_ids_array[$i]] ?? "" }}
</td>
<td style="text-align: left;">
{{ $quantity_issued_out_array[$i] }}
</td>
<td style="text-align: left;">
@if($ward_request_record->item_type == 1)
{{ ugandan_shillings_with_decimals(get_name($item_ids_array[$i], "id", "cost_price", "drugs")) }}
@elseif($ward_request_record->item_type == 2)
{{ ugandan_shillings_with_decimals(get_name($item_ids_array[$i], "id", "cost_price", "sundries")) }}
@elseif($ward_request_record->item_type == 3)
{{ ugandan_shillings_with_decimals(get_name($item_ids_array[$i], "id", "cost_price", "general_items")) }}
@endif
</td>
<td style="text-align: left;">
@if($ward_request_record->item_type == 1)
@php
$total_items_cost += $quantity_issued_out_array[$i] * get_name($item_ids_array[$i], "id", "cost_price", "drugs");
@endphp
{{ ugandan_shillings_with_decimals($quantity_issued_out_array[$i] * get_name($item_ids_array[$i], "id", "cost_price", "drugs")) }}
@elseif($ward_request_record->item_type == 2)
@php
$total_items_cost += $quantity_issued_out_array[$i] * get_name($item_ids_array[$i], "id", "cost_price", "sundries");
@endphp
{{ ugandan_shillings_with_decimals($quantity_issued_out_array[$i] * get_name($item_ids_array[$i], "id", "cost_price", "sundries")) }}
@elseif($ward_request_record->item_type == 3)
@php
$total_items_cost += $quantity_issued_out_array[$i] * get_name($item_ids_array[$i], "id", "cost_price", "general_items");
@endphp
{{ ugandan_shillings_with_decimals($quantity_issued_out_array[$i] * get_name($item_ids_array[$i], "id", "cost_price", "general_items")) }}
@endif
</td>
</tr>
@endfor
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><strong>Total</strong></td>
<td><strong>{{ ugandan_shillings_with_decimals($total_items_cost) }}</strong></td>
</tr>
</tfoot>
</table>
</div>
<div class="row">
<div class="col-sm-12">
<strong>COMMENT:</strong><br>{{ $ward_request_record->comment }}
</div>
<br><br>
<div class="col-sm-3">
<strong>RECEIVED BY:</strong><br> {{ get_full_name($ward_request_record->received_by, 'id', 'first_name', 'last_name', 'users') }}
</div>
<div class="col-sm-3">
<strong>ISSUED BY:</strong><br> {{ get_full_name($ward_request_record->dispensed_by, 'id', 'first_name', 'last_name', 'users') }}
</div>
<div class="col-sm-3">
<strong>DISPENSED ON:</strong><br>{{ streamline_date($ward_request_record->dispensed_on) }}
</div>
<div class="col-sm-3">
<strong>APPROVED BY:</strong><br>{{ get_full_name($ward_request_record->approved_by, 'id', 'first_name', 'last_name', 'users') }}
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
@endpush
@@ -0,0 +1,453 @@
@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" />
<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-7 col-sm-7 col-xs-12">
<h4 class="page-title">Ward request</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">Dashboard</a></li>
<li class="active">Ward request</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
@foreach ($errors->all() as $error)
<div>{{ $error }}</div>
@endforeach
<div class="white-box">
<h4 style="color: blue;">Request for ward items</h4>
<div class="row">
<div class="col-sm-4">
{{ Form::open(['route' => 'ward_item_request.ward_item_requests' , 'data-toggle' => 'validator']) }}
<div class="form-group">
{{ Form::label('ward', 'SELECT WARD') }}
{{ Form::select('ward',$wards,'',['id'=>'prescription-drugs','class' => 'form-control col-sm-8 compulsory ward_allocation']) }}
</div>
<div class="form-group">
{{ Form::label('item_type', 'ITEM TYPE') }}
{{ Form::select('item_type',['1' => 'Drugs', '2' => 'Sundries', '3' => 'General Items'],'',['id'=>'item_type','class' => 'form-control col-sm-8 compulsory']) }}
</div>
</div>
<div class="col-sm-8">
<div class="form-group" id="drugs_dropdown">
{{ Form::label('drugs', 'SELECT DRUGS') }}
{{ Form::select('drugs_requested[]', $drugs,'',['id'=>'prescription-drugs', 'multiple'=>true, 'class' => 'form-control prescription-drugs']) }}
</div>
<div class="form-group" style="display: none;" id="sundries_dropdown">
{{ Form::label('sundries', 'SELECT SUNDRIES') }}
{{ Form::select('sundries_requested[]',$sundries,'',['id'=>'prescription-sundries','multiple'=>true,'class' => 'form-control prescription-sundries']) }}
</div>
<div class="form-group" style="display: none;" id="general_items_dropdown">
{{ Form::label('general_items', 'SELECT GENERAL ITEMS') }}
{{ Form::select('general_items_requested[]',$general_items,'',['id'=>'prescription-general_items','multiple'=>true,'class' => 'form-control prescription-general_items']) }}
</div>
<div class="submit-button">
{{ Form::button('Confirm',['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10 confirmSelection','style'=>'padding: .6rem 1.2rem;']) }}
</div>
{{ Form::close() }}
</div>
</div>
</div>
</div>
</div>
@if(isset($drugs_requested) || isset($sundries_requested) || isset($general_items_requested))
<div class="white-box">
{{ Form::open(['route' => 'ward_item_request.store_ward_item_requests' , 'data-toggle' => 'validator']) }}
<div class="row">
<div class="col-sm-2">
<font color="blue">
<strong>{{ !is_null($ward_id) ? get_name($ward_id, "id", "name", "wards") : ""}}</strong> requests
</font>
</div>
<div class="col-sm-10">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>Items</th>
@if($item_type == "1" || $item_type == "2") <th>Pharmacy Stock</th> @endif
<th>Store stock</th>
<th>Last Dispensation to <strong>{{ !is_null($ward_id) ? get_name($ward_id, "id", "name", "wards") : ""}}</strong></th>
<th>Balance on ward</th>
<th>Quantity To Be Returned To Pharmacy</th>
<th>Quantity requested</th>
</tr>
</thead>
<tbody>
@if(isset($drugs_requested))
@for($i=0; $i < count($drugs_requested); $i++)
@php
$batch_records = \Streamline\Models\ItemBatchWatcher::where(['item_type' => 1, 'item_id' => $drugs_requested[$i]])->where(function ($query) {
$query->where('pharmacy_stock', '>', 0)
->orWhere('store_stock', '>', 0);
})->get();
$drug_pharmacy_stock = $drug_store_stock = 0;
if (count($batch_records) > 0) {
foreach ($batch_records as $record) {
$drug_store_stock += $record->store_stock;
$drug_pharmacy_stock += $record->pharmacy_stock;
}
}
@endphp
<tr>
<td>
{{ $i + 1 }}
</td>
<td>
<?php $item_unit_cost = DB::table('drugs')->where('id', $drugs_requested[$i])->pluck('cost_price')->first(); ?>
{{ $item_type == "1" ? get_name($drugs_requested[$i], "id", "name", "drugs") : ""}}
<input type="hidden" name="ward_id" value="{{ $ward_id }}">
<input type="hidden" name="item_type" value="{{ $item_type }}">
<input type="hidden" name="item_id[]" value="{{ $drugs_requested[$i] }}">
<input type="hidden" name="item_unit_cost[]" value="{{ $item_unit_cost }}"/>
</td>
<td>
{{ $item_type == "1" ? $drug_pharmacy_stock : "" }}
</td>
<td>
{{ $item_type == "1" ? $drug_store_stock : "" }}
</td>
<td>
{{-- last quantity given and when it was given --}}
@php
$last_dispensation_details_array = last_item_dispensation_to_ward($drugs_requested[$i], 1, $ward_id);
$last_qty_taken = $last_dispensation_details_array[0];
$date_taken = $last_dispensation_details_array[1];
$drug_form_name = "";
$drug_form_id = get_name($drugs_requested[$i], "id", "form_id", "drugs");
$drug_form_name = get_name($drug_form_id, "id", "name", "unit_of_measure");
@endphp
{{ $last_qty_taken }} {{ $drug_form_name }}
{!! is_null($date_taken) ? "" : "<br><br>Taken on: <b>".streamline_date($date_taken)."</b>" !!}
</td>
<td>
<input type="number" name="balance_returned[]" value="0" class="form-control" step=".01">
</td>
<td>
<input type="number" name="balance_on_ward_during_request[]" value="0" class="form-control" step=".01">
</td>
<td>
<input type="number" name="quantity_requested[]" class="form-control" step=".01">
</td>
</tr>
@endfor
@elseif(isset($sundries_requested))
@for($i=0; $i < count($sundries_requested); $i++)
@php
$batch_records = \Streamline\Models\ItemBatchWatcher::where(['item_type' => 2, 'item_id' => $sundries_requested[$i]])->where(function ($query) {
$query->where('pharmacy_stock', '>', 0)
->orWhere('store_stock', '>', 0);
})->get();
$sundry_pharmacy_stock = $sundry_store_stock = 0;
if (count($batch_records) > 0) {
foreach ($batch_records as $record) {
$sundry_store_stock += $record->store_stock;
$sundry_pharmacy_stock += $record->pharmacy_stock;
}
}
@endphp
<tr>
<td>
{{ $i + 1 }}
</td>
<td>
<?php $item_unit_cost = DB::table('sundries')->where('id', $sundries_requested[$i])->pluck('cost_price')->first(); ?>
{{ $item_type == "2" ? get_name($sundries_requested[$i], "id", "name", "sundries") : ""}}
<input type="hidden" name="ward_id" value="{{ $ward_id }}">
<input type="hidden" name="item_type" value="{{ $item_type }}">
<input type="hidden" name="item_id[]" value="{{ $sundries_requested[$i] }}">
<input type="hidden" name="item_unit_cost[]" value="{{ $item_unit_cost }}"/>
</td>
<td>
{{ $sundry_pharmacy_stock }}
</td>
<td>
{{ $sundry_store_stock }}
</td>
<td>
{{-- last quantity given and when it was given --}}
@php
$last_dispensation_details_array = last_item_dispensation_to_ward($sundries_requested[$i], 2, $ward_id);
$last_qty_taken = $last_dispensation_details_array[0];
$date_taken = $last_dispensation_details_array[1];
@endphp
{{ $last_qty_taken }}
{!! is_null($date_taken) ? "" : "<br><br>Taken on: <b>".streamline_date($date_taken)."</b>" !!}
</td>
<td>
<input type="number" name="balance_returned[]" value="0" class="form-control" step=".01">
</td>
<td>
<input type="number" name="balance_on_ward_during_request[]" value="0" class="form-control" step=".01">
</td>
<td>
<input type="number" name="quantity_requested[]" class="form-control" step=".01">
</td>
</tr>
@endfor
@elseif(isset($general_items_requested))
@for($i=0; $i < count($general_items_requested); $i++)
<tr>
<td>
{{ $i + 1 }}
</td>
<td>
<?php $item_unit_cost = DB::table('general_items')->where('id', $general_items_requested[$i])->pluck('cost_price')->first(); ?>
{{ $item_type == "3" ? get_name($general_items_requested[$i], "id", "name", "general_items") : "" }}
<input type="hidden" name="ward_id" value="{{ $ward_id }}">
<input type="hidden" name="item_type" value="{{ $item_type }}">
<input type="hidden" name="item_id[]" value="{{ $general_items_requested[$i] }}">
<input type="hidden" name="item_unit_cost[]" value="{{ $item_unit_cost }}"/>
</td>
{{-- <td>
{{ $item_type == "3" ? get_name($general_items_requested[$i], "id", "pharmacy_stock", "general_items") : ""}}
</td> --}}
<td>
{{ $item_type == "3" ? get_name($general_items_requested[$i], "id", "store_stock", "general_items") : ""}}
</td>
<td>
{{-- last quantity given and when it was given --}}
</td>
<td>
<input type="number" name="balance_on_ward_during_request[]" value="0" class="form-control" step=".01">
</td>
<td>
<input type="number" name="balance_returned[]" value="0" class="form-control" step=".01">
</td>
<td>
<input type="number" name="quantity_requested[]" class="form-control" step=".01">
</td>
</tr>
@endfor
@endif
</tbody>
</table>
<div class="comments-section">
<br>
{{ Form::label('order_comment', 'Order Comment', ['style' => 'font-size: bolder; font-weight: 600']) }}
{{ Form::textarea('order_comment',null,['class'=>'form-control', 'rows' => 5, 'cols' => 20]) }}
<br>
</div>
<input type="submit" name="submit_dispense" class = "btn btn-success pull-right" value="Submit Request"/>
{{ Form::close() }}
</div>
</div>
</div>
</div>
@else
<div class="white-box">
<h4>List of all wards' requests</h4>
<div class="table-responsive">
<table id="allItemRequests" class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<tr>
<th>Date</th>
<th>Ward</th>
<th>Quantity</th>
<th>Requested by</th>
<th>Approval status</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@if(count($all_ward_item_requests) > 0)
@foreach($all_ward_item_requests as $record)
@php
$item_type = $record->item_type;
$item_ids_array = explode(",", $record->item_ids);
$item_quantities_array = explode(",", $record->item_quantities);
@endphp
<tr>
<td>
{{ streamline_date($record->created_at) }}
</td>
<td>{{ get_name($record->ward_id, 'id', 'name', 'wards') }}</td>
<td>
{{ count($item_ids_array) }}
@if ($record->item_type == 1)
Drugs
@elseif($record->item_type == 2)
Sundries
@elseif($record->item_type == 3)
General Items
@endif
</td>
<td>
{{ get_full_name($record->created_by, 'id', 'first_name', 'last_name', 'users') }}
</td>
<td>
@if($record->dispensation_status == 1)
<font style='color: green'>Dispensed</font>
@elseif($record->approved_status == 1)
<font style='color: blue'>Approved</font>
@else
<font style='color: red'>Not approved</font>
@endif
</td>
<td>
{{ Form::open(['route' => 'ward_item_request.show_ward_item_request_details' , 'data-toggle' => 'validator']) }}
{{ Form::hidden('ward_request_id', $record->id)}}
{{ Form::button('Details',['type'=>'submit','class'=>'btn btn-success btn-rounded waves-effect waves-light m-r-10']) }}
{{ Form::close() }}
</td>
<td>
@if( Auth::user()->can('edit-ward-item-request'))
@if($record->dispensation_status != 1 && $record->approved_status != 1)
{{ Form::open(['route' => 'ward_item_request.edit' , 'data-toggle' => 'validator']) }}
{{ Form::hidden('ward_request_id', $record->id)}}
{{ Form::button('Edit Request',['type'=>'submit','class'=>'btn btn-warning btn-rounded waves-effect waves-light m-r-10']) }}
{{ Form::close() }}
@endif
@endif
</td>
<td>
@if( Auth::user()->can('delete-ward-item-request'))
{{ Form::open(['route' => 'ward_item_request.delete' , 'data-toggle' => 'validator']) }}
{{ Form::hidden('ward_request_id', $record->id)}}
{{ Form::button('Delete',['type'=>'submit','class'=>'btn btn-danger btn-rounded waves-effect waves-light m-r-10']) }}
{{ Form::close() }}
@endif
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
</div>
@endif
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<!-- data time picker dependency -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<!-- -->
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#allItemRequests').DataTable({
order: [ 1, "asc" ],
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy',
{ extend: 'csv',
message: 'LIST OF WARD ITEM REQUESTS'
},
{ extend: 'excel',
message: 'LIST OF WARD ITEM REQUESTS',
sheetName: 'LIST OF WARD ITEM REQUESTS ON STREAMLINE'
},
{ extend: 'pdf',
message: 'LIST OF WARD ITEM REQUESTS',
orientation: 'landscape',
pageSize: 'LETTER'
}
]
});
$('#datepicker-autoclose').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
setDate: new Date(),
readOnly: true
});
$('.prescription-drugs,.ward_allocation,.prescription-sundries,.prescription-general_items').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');//compulsory class css
$('.select2-selection.select2-selection--single.sec_d').css('border-left', '3px solid #aaa');
$('.select2-selection__arrow').css('top','3px');
$("#item_type").change(function(e) {
var item_id = $(this).val();
if (item_id == 2) {
$("#drugs_dropdown").hide();
$("#sundries_dropdown").show();
$("#general_items_dropdown").hide();
} else if(item_id == 3){
$("#general_items_dropdown").show();
$("#drugs_dropdown").hide();
$("#sundries_dropdown").hide();
}
else {
$("#drugs_dropdown").show();
$("#sundries_dropdown").hide();
$("#general_items_dropdown").hide();
}
});
$(".remove").on("click", function () {
$(this).parent().parent().remove();
});
$(".confirmSelection").click(function (e) { // make sure that all compulsory fields have been filled out
var empty_compulsory_fields = [];
$(".compulsory").each(function () {
if ($(this).val() == "") {
var textname = $(this).attr('name');
$(this).focus();
empty_compulsory_fields.push(textname);
$(this).css('border','1px solid #F08080');
}
});
/* check if the array containing empty compulsory fields is not empty then return false */
if (empty_compulsory_fields.length != 0) {
alert("Please fill in all compulsory fields");
console.log(empty_compulsory_fields);
e.preventDefault();
return false;
}
});
});
</script>
@endpush
@@ -0,0 +1,525 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-6 col-md-7 col-sm-7 col-xs-12">
<h4 class="page-title">Ward request details</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">Dashboard</a></li>
<li><a href="{{ url('incoming_ward_requests') }}">Incoming ward requests</a></li>
<li class="active">Ward request 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-2 offset-10 text-right">
<button class="btn btn-primary glyphicon glyphicon-print" id="print_agreement"> Print
</button>
</div>
</div><br>
<div class="row" id="divToPrint">
<div class="col-sm-12">
<div class="white-box">
<h4 style="color: #0060BF; font-weight: bolder;">Request from <strong>{{ get_name($ward_request_details->ward_id, "id", "name", "wards") }}</strong> on {{ streamline_date($ward_request_details->created_at) }}</h4>
@php
$item_ids_array = explode(",", $ward_request_details->item_ids);
$item_quantities_array = explode(",", $ward_request_details->item_quantities);
$balance_during_request_array = explode("," , $ward_request_details->balance_on_ward_during_request);
$balance_returned_array = explode(",", $ward_request_details->balance_returned);
if($ward_request_details->approved_status == "1"){
$quantity_approved_array = explode(",", $ward_request_details->item_quantities_approved);
}
$ward_id = $ward_request_details->ward_id;
@endphp
{{ Form::open(['route' => 'ward_item_request.store_ward_item_request_details', 'data-toggle' => 'validator']) }}
<div class="table-responsive">
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>
@if($ward_request_details->item_type == "1")
Drug
@elseif($ward_request_details->item_type == "2")
Sundry
@else
General Item
@endif
</th>
@if($ward_request_details->item_type == "1" || $ward_request_details->item_type == "2")
<th>Pharmacy Stock</th>
@endif
<th>Store stock</th>
<th>Quantity requested</th>
<th>Balance on ward</th>
<th>Quantity To Be Returned To Pharmacy</th>
<th>Last dispensation to <strong>{{ !is_null($ward_id) ? get_name($ward_id, "id", "name", "wards") : ""}}</strong>
</th>
<th>Quantity approved</th>
@if($ward_request_details->approved_status == "1")
<th>Quantity issued</th>
<th>Batch Number <span style="color:blue"> ({{ batch_tracking_method()}})</span></th>
@endif
</tr>
</thead>
<tbody>
@for($i=0; $i < count($item_ids_array); $i++)
@php
$item_type = $ward_request_details->item_type == 3 ? 6 : $ward_request_details->item_type; //change item_type to 6 if its general item since okellogum used 3 instead of 6
$item_batches_records = \DB::table('item_batch_watcher')->where(['item_id' => $item_ids_array[$i], 'item_type' => $item_type])->where(function ($query) {
$query->where('pharmacy_stock', '>', 0)
->orWhere('store_stock', '>', 0);
})->get();
$facade_batches_options = [];
$option_batches = "<option value=''>-select-</option>";
foreach ($item_batches_records as $item_batch) {
$option_batches .= "<option value='$item_batch->id'>". $item_batch->batch_number." (Expiry Date: ".$item_batch->expiry_date.")</option>";
$facade_batches_options[$item_batch->id] = $item_batch->batch_number." (Expiry Date: ".$item_batch->expiry_date.")";
}
$facade_batches_options = ['' => '- select -'] + $facade_batches_options;
//$needed_batches_from_pharm_array = get_pharmacy_batches_to_use_based_on_needed_quantity($item_ids_array[$i], $item_type, $quantity_approved_array[$i]??0);
$needed_batches_from_pharm_array = get_pharmacy_batch_watcher_ids_to_use_based_on_needed_quantity($item_ids_array[$i], $item_type, $quantity_approved_array[$i]??0);
$needed_batches_from_store_array = get_stores_batch_watcher_ids_to_use_based_on_needed_quantity($item_ids_array[$i], $item_type, $quantity_approved_array[$i]??0);
$default_batches_to_use = $ward_request_details->item_type == "1" ? $needed_batches_from_pharm_array : $needed_batches_from_store_array;
@endphp
@if (count($default_batches_to_use) > 0)
@foreach ($default_batches_to_use as $batch_to_dispense => $batch_qty_to_dispense)
<tr id="row_item_id_{{$item_ids_array[$i]}}">
<td>
{{ $i + 1 }}
</td>
<td>
@if($ward_request_details->item_type == "1")
{{ get_name($item_ids_array[$i], "id", "name", "drugs") }}
@php $item_name = get_name($item_ids_array[$i], "id", "name", "drugs"); @endphp
@elseif($ward_request_details->item_type == "2")
{{ get_name($item_ids_array[$i], "id", "name", "sundries") }}
@php $item_name = get_name($item_ids_array[$i], "id", "name", "sundries"); @endphp
@else
{{ get_name($item_ids_array[$i], "id", "name", "general_items") }}
@php $item_name = get_name($item_ids_array[$i], "id", "name", "general_items"); @endphp
@endif
{{ Form::hidden('item_name[]', $item_name, ['id' => 'item_name_'. $item_ids_array[$i], 'class' => 'item_name_'.$item_ids_array[$i]]) }}
</td>
@if($ward_request_details->item_type == "1" || $ward_request_details->item_type == "2")
<td>
@php
$batch_records = (new Streamline\Services\ItemsStockService())->getItemQuantityByArray($item_ids_array[$i], $item_type);
$item_pharmacy_stock = $batch_records[1];
$item_store_stock = $batch_records[0];
@endphp
{{ $item_pharmacy_stock }}
</td>
@endif
<td>
@if($ward_request_details->item_type == "1")
{{-- {{ get_name($item_ids_array[$i], "id", "store_stock", "drugs")}} --}}
{{ $item_store_stock }}
@elseif($ward_request_details->item_type == "2")
{{-- {{ get_name($item_ids_array[$i], "id", "store_stock", "sundries") }} --}}
{{ $item_store_stock }}
@else
{{ get_name($item_ids_array[$i], "id", "store_stock", "general_items")}}
@endif
</td>
<td>
{{ $item_quantities_array[$i] }}
<input type="hidden" name="ward_request_id" value="{{ $ward_request_details->id }}">
<input type="hidden" name="item_ids[]" value="{{ $item_ids_array[$i] }}">
</td>
<td>
@if($ward_request_details->approved_status == "1")
<input type="number" name="balance_returned[]" class="form-control" value="{{ $balance_returned_array[$i] }}" step=".01" readonly>
@else
<input type="number" name="balance_returned[]" class="form-control" value="{{ $balance_returned_array[$i]}}" step=".01">
@endif
</td>
<td>
@if($ward_request_details->approved_status == "1")
<input type="number" name="balance_on_ward_during_request[]" class="form-control" value="{{ $balance_during_request_array[$i] }}" step=".01" readonly>
@else
<input type="number" name="balance_on_ward_during_request[]" class="form-control" value="{{ $balance_during_request_array[$i]}}" step=".01">
@endif
</td>
<td>
{{-- last quantity given and when it was given --}}
@php
$last_dispensation_details_array = last_item_dispensation_to_ward($item_ids_array[$i], $ward_request_details->item_type, $ward_id);
$last_qty_taken = $last_dispensation_details_array[0];
$date_taken = $last_dispensation_details_array[1];
$drug_form_name = "";
if ($ward_request_details->item_type ==1) {
$drug_form_id = get_name($item_ids_array[$i], "id", "form_id", "drugs");
$drug_form_name = get_name($drug_form_id, "id", "name", "unit_of_measure");
}
@endphp
{{ $last_qty_taken }} {{ $drug_form_name }}
{!! is_null($date_taken) ? "" : "<br><br>Taken on: <b style='color:blue'>".streamline_date($date_taken)."</b>" !!}
</td>
<td>
@if($ward_request_details->approved_status == "1")
<input type="number" name="quantity_approved[]" class="form-control item_qty_approved_{{$item_ids_array[$i]}}" value="{{ $quantity_approved_array[$i] }}" step=".01" readonly>
@else
<input type="number" name="quantity_approved[]" class="form-control" value="{{ $item_quantities_array[$i] }}" step=".01">
@endif
</td>
@if($ward_request_details->approved_status == "1")
<td>
@if($ward_request_details->approved_status == "1")
<input type="number" name="quantity_issued_out[]" class="form-control item_qty_issued_{{$item_ids_array[$i]}}" value="{{ $batch_qty_to_dispense }}" step=".01">
@else
<div style="display: none;">
<input type="number" name="quantity_issued_out[]" class="form-control" value="{{ $item_quantities_array[$i] }}" step=".01">
</div>
@endif
</td>
<td>
{{ Form::select('dispensed_from_batch[]', $facade_batches_options, $batch_to_dispense, ['class' => 'form-control compulsory batchScan', 'required'])}}
<a href="#" id="addNewBatch_{{$item_ids_array[$i]}}">{{ __('stores.add_batch_small') }}</a>
&nbsp; &nbsp;
<a href="#" id="removeBatch_{{$item_ids_array[$i]}}" style="color: tomato">{{ __('stores.remove_small') }}</a>
</td>
@else
<input type="hidden" name="quantity_issued_out[]" class="form-control" value="{{ $item_quantities_array[$i] }}" step=".01">
@endif
</tr>
@endforeach
@else
<tr id="row_item_id_{{$item_ids_array[$i]}}">
<td>
{{ $i + 1 }}
</td>
<td>
@if($ward_request_details->item_type == "1")
{{ get_name($item_ids_array[$i], "id", "name", "drugs") }}
@php $item_name = get_name($item_ids_array[$i], "id", "name", "drugs"); @endphp
@elseif($ward_request_details->item_type == "2")
{{ get_name($item_ids_array[$i], "id", "name", "sundries") }}
@php $item_name = get_name($item_ids_array[$i], "id", "name", "sundries"); @endphp
@else
{{ get_name($item_ids_array[$i], "id", "name", "general_items") }}
@php $item_name = get_name($item_ids_array[$i], "id", "name", "general_items"); @endphp
@endif
{{ Form::hidden('item_name[]', $item_name, ['id' => 'item_name_'. $item_ids_array[$i], 'class' => 'item_name_'.$item_ids_array[$i]]) }}
</td>
@if($ward_request_details->item_type == "1" || $ward_request_details->item_type == "2")
<td>
@php
$batch_records = (new Streamline\Services\ItemsStockService())->getItemQuantityByArray($item_ids_array[$i], $item_type);
$item_pharmacy_stock = $batch_records[1];
$item_store_stock = $batch_records[0];
@endphp
{{ $item_pharmacy_stock }}
</td>
@endif
<td>
@if($ward_request_details->item_type == "1")
{{-- {{ get_name($item_ids_array[$i], "id", "store_stock", "drugs")}} --}}
{{ $item_store_stock }}
@elseif($ward_request_details->item_type == "2")
{{-- {{ get_name($item_ids_array[$i], "id", "store_stock", "sundries") }} --}}
{{ $item_store_stock }}
@else
{{ get_name($item_ids_array[$i], "id", "store_stock", "general_items")}}
@endif
</td>
<td>
{{ $item_quantities_array[$i] }}
<input type="hidden" name="ward_request_id" value="{{ $ward_request_details->id }}">
<input type="hidden" name="item_ids[]" value="{{ $item_ids_array[$i] }}">
</td>
<td>
@if($ward_request_details->approved_status == "1")
<input type="number" name="balance_returned[]" class="form-control" value="{{ $balance_returned_array[$i] }}" step=".01" readonly>
@else
<input type="number" name="balance_returned[]" class="form-control" value="{{ $balance_returned_array[$i]}}" step=".01">
@endif
</td>
<td>
@if($ward_request_details->approved_status == "1")
<input type="number" name="balance_on_ward_during_request[]" class="form-control" value="{{ $balance_during_request_array[$i] }}" step=".01" readonly>
@else
<input type="number" name="balance_on_ward_during_request[]" class="form-control" value="{{ $balance_during_request_array[$i]}}" step=".01">
@endif
</td>
<td>
{{-- last quantity given and when it was given --}}
@php
$last_dispensation_details_array = last_item_dispensation_to_ward($item_ids_array[$i], $ward_request_details->item_type, $ward_id);
$last_qty_taken = $last_dispensation_details_array[0];
$date_taken = $last_dispensation_details_array[1];
$drug_form_name = "";
if ($ward_request_details->item_type ==1) {
$drug_form_id = get_name($item_ids_array[$i], "id", "form_id", "drugs");
$drug_form_name = get_name($drug_form_id, "id", "name", "unit_of_measure");
}
@endphp
{{ $last_qty_taken }} {{ $drug_form_name }}
{!! is_null($date_taken) ? "" : "<br><br>Taken on: <b style='color:blue'>".streamline_date($date_taken)."</b>" !!}
</td>
<td>
@if($ward_request_details->approved_status == "1")
<input type="number" name="quantity_approved[]" class="form-control item_qty_approved_{{$item_ids_array[$i]}}" value="{{ $quantity_approved_array[$i] }}" step=".01" readonly>
@else
<input type="number" name="quantity_approved[]" class="form-control" value="{{ $item_quantities_array[$i] }}" step=".01">
@endif
</td>
@if($ward_request_details->approved_status == "1")
<td>
@if($ward_request_details->approved_status == "1")
<input type="number" name="quantity_issued_out[]" class="form-control item_qty_issued_{{$item_ids_array[$i]}}" value="{{ $quantity_approved_array[$i] }}" step=".01">
@else
<div style="display: none;">
<input type="number" name="quantity_issued_out[]" class="form-control" value="{{ $item_quantities_array[$i] }}" step=".01">
</div>
@endif
</td>
<?php
$batch_in_use = null;
$auto_deductable_batches_array = get_stores_batch_watcher_ids_to_use_based_on_needed_quantity($item_ids_array[$i], $ward_request_details->item_type, $item_quantities_array[$i]);
if($ward_request_details->item_type == "1"){
$drug_details = \Streamline\Models\Drug::withTrashed()->find($item_ids_array[$i]);
}elseif($ward_request_details->item_type == "2"){
$sundry_details = \Streamline\Models\Sundry::withTrashed()->find($item_ids_array[$i]);
}
?>
@if (batch_tracking_method() == "manual")
<td>
<select name="dispensed_from_batch[]" class="form-control compulsory batchScan" id="batch_scan_id_{{ $item_ids_array[$i] }}" required>
@php echo $option_batches; @endphp
</select>
<a href="#" id="addNewBatch_{{$item_ids_array[$i]}}">{{ __('stores.add_batch_small') }}</a>
</td>
@else
<td>
{{-- @if (count($auto_deductable_batches_array) > 0)
@foreach ($auto_deductable_batches_array as $deductable_batch => $quantity)
{{ Form::select('dispensed_from_batch[]', $facade_batches_options, $deductable_batch, ['class' => 'form-control compulsory batchScan']) }}
@endforeach
@else --}}
{{ Form::select('dispensed_from_batch[]', $facade_batches_options, "", ['class' => 'form-control compulsory batchScan', 'required']) }}
{{-- @endif --}}
<a href="#" id="addNewBatch_{{$item_ids_array[$i]}}">{{ __('stores.add_batch_small') }}</a>
&nbsp;&nbsp;
<a href="#" id="removeBatch_{{$item_ids_array[$i]}}" style="color: tomato">{{ __('stores.remove_small') }}</a>
</td>
@endif
@else
<input type="hidden" name="quantity_issued_out[]" class="form-control" value="{{ $item_quantities_array[$i] }}" step=".01">
@endif
</tr>
@endif
@endfor
</tbody>
</table>
</div>
@if (!is_null($ward_request_details->order_comment))
<div class="comments-section">
<br>
{{ Form::label('order_comment', 'Order Comment', ['style' => 'font-size: bolder; font-weight: 600']) }}
{{ Form::textarea('order_comment',$ward_request_details->order_comment,['class'=>'form-control', 'rows' => 5, 'cols' => 20, 'readonly']) }}
<br>
</div>
@endif
</div>
</div>
<div class="col-sm-12">
<div class="white-box">
<div class="row">
@if($ward_request_details->approved_status == "1")
<div class="col-sm-3">
<div class="form-group">
{{ Form::label('received_by', 'RECEIVED BY') }}
{{ Form::select('received_by', $staff_array, '', ['id'=>'received_by','class' => 'form-control col-sm-8 compulsory ward_allocation','required']) }}
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
{{ Form::label('received_from', 'RECEIVED FROM') }}
{{ Form::select('received_from', ['1' => 'Pharmacy', '2' => 'Stores'], $ward_request_details->item_type == "1" ? 1 : 2, ['class' => 'form-control col-sm-8 compulsory receivedFromOption','required']) }}
</div>
</div>
<div class="col-sm-3">
{{ Form::label('dispensation_date','DISPENSED ON') }}
<div class="input-group">
{{ Form::text('dispensation_date', '', ['class' => 'form-control compulsory', 'required','readonly','id'=>'datepicker-autoclose']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
<div class="col-sm-3">
Approved by <font style="color: blue; font-weight: bolder;">
<strong>{{ get_full_name($ward_request_details->approved_by, 'id', 'first_name', 'last_name', 'users') }}</strong></font>
</div>
@else
<div class="col-sm-12">
<div class="form-group">
{{ Form::label('comment', 'COMMENT') }}
{{ Form::textarea('comment', '', ['class' => 'form-control col-sm-8']) }}
</div>
</div>
@endif
<div class="col-sm-12">
@if($ward_request_details->approved_status == "1")
<input type="submit" name="dispense" class="btn btn-success pull-right dispenseBtn" value="Dispense to ward"/>
@else
<input type="submit" name="approve" class="btn btn-success pull-right" value="Approve"/>
@endif
{{ Form::close() }}
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
function printElementContent(elem,title){
var mywindow = window.open('', 'PRINT', 'height=400,width=600');
var css = '';
css += '<link href="elite/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">';
css += '<style type="text/css">div{display:block;}';
css += '.row {margin-right: -7.5px; margin-left: -7.5px;display: flex;flex-wrap: wrap;}';
css += '.col-sm-2 {padding-left: 7.5px;padding-right: 7.5px;-webkit-box-flex: 0;flex: 0 0 16.666667%;max-width: 16.666667%;}';
css += '.col-sm-4 {padding-left: 7.5px; padding-right: 7.5px; -webkit-box-flex: 0;flex: 0 0 33.333333%; max-width: 33.333333%; position: relative; width: 100%; min-height: 1px;}</style>';
mywindow.document.write('<html><head><title></title>');
mywindow.document.write('</head><body >');
mywindow.document.write(css);
mywindow.document.write('<center><h3>' + title + '</h3></center>');
mywindow.document.write(document.getElementById(elem).innerHTML);
mywindow.document.write('</body></html>');
mywindow.document.close(); // necessary for IE >= 10
//mywindow.focus(); // necessary for IE >= 10*/
setTimeout(function () {
mywindow.focus();
mywindow.print();
}, 500);
return true;
}
$(document).ready(function() {
$('#datepicker-autoclose').datepicker({
format:'mm/dd/yyyy',
endDate: new Date(),
autoclose: true,
todayHighlight: true,
}).datepicker("setDate",'now');
$('#received_by').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');
$("#print_agreement").click(function(e){
printElementContent('divToPrint','Approve Ward Item Request');
});
$(".dispenseBtn").click(function(e){
//check if received from stores and ask the batch numbers
if($(".receivedFromOption").val() == 2){
var empty_compulsory_fields = [];
$(".batchNumbers").each(function () {
if ($(this).val() == "") {
var textname = $(this).attr('name');
$(this).focus();
empty_compulsory_fields.push(textname);
$(this).css('border','1px solid #F08080');
}
});
/* check if the array containing empty compulsory fields is not empty then return false */
if (empty_compulsory_fields.length != 0) {
alert("<?php echo __('triage.compulsory_fields_warning') ?>");
console.log(empty_compulsory_fields);
e.preventDefault();
return false;
}
}
});
$(".batchScan").select2({
width: "100%"
});
$('.table').on('click', '[id^="addNewBatch"]', function (e) {
let id = /\d+(?=\D*$)/.exec($(this).attr('id'));
console.log("adding on for drug id "+id);
let item_name = $(".item_name_"+id).val();
let item_qty_issued = $(".item_qty_issued_"+id).val();
let item_qty_approved = $(".item_qty_approved_"+id).val();
e.preventDefault();
//create another <tr> that we are going to append to
$("<tr><td></td><td>"+item_name+"</td><td></td><td></td><td><input type='hidden' name='item_name[]' value='"+item_name+"'/><input type='hidden' name='ward_request_id' value='1'><input type='hidden' name='item_ids[]' value='"+id+"'></td><td><input type='number' name='balance_returned[]' class='form-control' value='0' step='.01' readonly=''></td><td><input type='number' name='balance_on_ward_during_request[]' class='form-control' value='0' step='.01' readonly=''></td><td></td><td><input type='number' name='quantity_approved[]' class='form-control' value='"+item_qty_approved+"' step='.01' readonly=''></td><td><input type='number' name='quantity_issued_out[]' class='form-control' value='' step='.01'></td><td><select class='form-control compulsory batchScan' name='dispensed_from_batch[]' required>@php echo $option_batches; @endphp</select></td></tr>").insertAfter( $("#row_item_id_"+id) );
generalSelect2Set('batchScan');
});
$('.table').on('click', '[id^="removeBatch"]', function (e) {
e.preventDefault();
console.log("this been clicked")
$(this).parent('td').parent('tr').remove();
});
function generalSelect2Set(id) {
$('.'+id).select2({
width: "100%"
});
}
})
</script>
@endpush
@@ -0,0 +1,332 @@
@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" />
<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-7 col-sm-7 col-xs-12">
<h4 class="page-title">Ward request edit</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">Dashboard</a></li>
<li><a href="{{ url('ward_item_requests')}}">Ward requests</a></li>
<li class="active">Ward request edit</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
@foreach ($errors->all() as $error)
<div>{{ $error }}</div>
@endforeach
</div>
</div>
@php
$item_ids_array = explode(",", $ward_request_details->item_ids);
$item_quantities_array = explode(",", $ward_request_details->item_quantities);
$balance_during_request_array = explode("," , $ward_request_details->balance_on_ward_during_request);
$balance_returned_array = explode(",", $ward_request_details->balance_returned);
if($ward_request_details->approved_status == "1"){
$quantity_approved_array = explode(",", $ward_request_details->item_quantities_approved);
}
@endphp
<div class="row">
<div class="col-sm-12">
<div class="white-box">
{{ Form::open(['route' => 'ward_item_request.edit_ward_item_request_search', 'method' => 'ANY', 'role' => 'search']) }}
<div class="row">
<div class="col-md-6">
<div class="form-group" id="drug_names">
<input type="hidden" name="ward_request_id" value="{{ $ward_request_details->id }}">
<input type="hidden" name="item_type" value="{{ $ward_request_details->item_type }}">
@if($ward_request_details->item_type == 1)
@php
$drugs = \Streamline\Models\Drug::where('available', 1)->orderby('name')->pluck('name', 'id');
@endphp
{{ Form::select('items_ids[]',$drugs,$search_status ? $selected_item_ids_array : $item_ids_array,['id'=>'drug_ids', 'multiple'=>true, 'class' => 'form-control col-sm-8 drug_ids']) }}
@elseif($ward_request_details->item_type == 2)
@php
$sundries = \Streamline\Models\Sundry::where('available', 1)->orderby('name')->pluck('name', 'id');
@endphp
{{ Form::select('items_ids[]',$sundries,$search_status ? $selected_item_ids_array : $item_ids_array,['id'=>'sundry_ids', 'multiple'=>true, 'class' => 'form-control col-sm-8 sundry_ids']) }}
@elseif($ward_request_details->item_type == 3)
@php
$general_items = \Streamline\Models\GeneralItem::orderBy('name')->pluck('name', 'id');
@endphp
{{ Form::select('items_ids[]',$general_items,$search_status ? $selected_item_ids_array : $item_ids_array,['id'=>'general_item_ids', 'multiple'=>true, 'class' => 'form-control col-sm-8 general_item_ids']) }}
@endif
</div>
</div>
<div class="col-md-6">
<button type="submit" class="btn btn-info"><span class="glyphicon glyphicon-search"></span> Select items to request</button>
</div>
<div class="col-sm-12">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
<span>
- <b>Note: </b>You can add more items by searching from them from the above search box<br>
</span>
</div>
</div>
</div>
@if(isset($criteria) && isset($resultCount))
<p>
{{ __('stores.search_criteria') }} <code>{{ $criteria }}</code> &nbsp;&nbsp;&nbsp;{{ __('stores.total_results') }} <code>{{ $resultCount }}</code> &nbsp;&nbsp;&nbsp;<a href="{{ route('drugs.index') }}">{{ __('stores.clear_search') }}</a>
</p>
@endif
{{ Form::close() }}
</div>
</div>
<div class="col-sm-12">
<div class="white-box">
{{ Form::open(['route' => 'ward_item_request.update_ward_item_requests' , 'data-toggle' => 'validator']) }}
<div class="row">
<input type="hidden" name="ward_request_id" value="{{ $ward_request_details->id }}">
<input type="hidden" name="item_type" value="{{ $ward_request_details->item_type }}">
<div class="table-responsive">
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>
@if($ward_request_details->item_type == "1") Drug
@elseif($ward_request_details->item_type == "2") Sundry
@else General Item
@endif
</th>
<th>Store stock</th>
<th>Quantity To Be Returned To Pharmacy</th>
<th>Balance on ward</th>
<th>Quantity requested</th>
</tr>
</thead>
<tbody>
@if ($search_status)
@for($i=0; $i < count($selected_item_ids_array); $i++)
<tr>
<td>
{{ $i + 1 }}
</td>
<td>
@if($ward_request_details->item_type == "1")
{{ get_name($selected_item_ids_array[$i], "id", "name", "drugs") }}
@php
$item_unit_cost = DB::table('drugs')->where('id', $selected_item_ids_array[$i])->pluck('cost_price')->first();
@endphp
@elseif($ward_request_details->item_type == "2")
{{ get_name($selected_item_ids_array[$i], "id", "name", "sundries") }}
@php
$item_unit_cost = DB::table('sundries')->where('id', $selected_item_ids_array[$i])->pluck('cost_price')->first();
@endphp
@else
{{ get_name($selected_item_ids_array[$i], "id", "name", "general_items") }}
@php
$item_unit_cost = DB::table('general_items')->where('id', $selected_item_ids_array[$i])->pluck('cost_price')->first();
@endphp
@endif
</td>
<td>
@if($ward_request_details->item_type == "1")
{{ get_name($selected_item_ids_array[$i], "id", "store_stock", "drugs") }}
@elseif($ward_request_details->item_type == "2")
{{ get_name($selected_item_ids_array[$i], "id", "store_stock", "sundries") }}
@else
{{ get_name($selected_item_ids_array[$i], "id", "store_stock", "general_items") }}
@endif
</td>
<td>
<input type="number" name="balance_returned[]" class="form-control">
</td>
<td>
<input type="number" name="balance_on_ward_during_request[]" class="form-control">
</td>
<td>
<input type="hidden" name="item_ids[]" value="{{ $selected_item_ids_array[$i] }}">
<input type="hidden" name="item_unit_cost[]" value="{{ $item_unit_cost }}"/>
<input type="number" name="item_quantities[]" class="form-control" value="">
</td>
</tr>
@endfor
@else
@for($i=0; $i < count($item_ids_array); $i++)
<tr>
<td>
{{ $i + 1 }}
</td>
<td>
@if($ward_request_details->item_type == "1")
{{ get_name($item_ids_array[$i], "id", "name", "drugs") }}
@php
$item_unit_cost = DB::table('drugs')->where('id', $item_ids_array[$i])->pluck('cost_price')->first();
@endphp
@elseif($ward_request_details->item_type == "2")
{{ get_name($item_ids_array[$i], "id", "name", "sundries") }}
@php
$item_unit_cost = DB::table('sundries')->where('id', $item_ids_array[$i])->pluck('cost_price')->first();
@endphp
@else
{{ get_name($item_ids_array[$i], "id", "name", "general_items") }}
@php
$item_unit_cost = DB::table('general_items')->where('id', $item_ids_array[$i])->pluck('cost_price')->first();
@endphp
@endif
</td>
<td>
@if($ward_request_details->item_type == "1")
{{ get_name($item_ids_array[$i], "id", "store_stock", "drugs") }}
@elseif($ward_request_details->item_type == "2")
{{ get_name($item_ids_array[$i], "id", "store_stock", "sundries") }}
@else
{{ get_name($item_ids_array[$i], "id", "store_stock", "general_items") }}
@endif
</td>
<td>
@if($ward_request_details->approved_status == "1")
<input type="number" name="balance_returned[]" class="form-control" value="{{ $balance_returned_array[$i] }}" readonly>
@else
<input type="number" name="balance_returned[]" class="form-control" value="{{ $balance_returned_array[$i] }}">
@endif
</td>
<td>
@if($ward_request_details->approved_status == "1")
<input type="number" name="balance_on_ward_during_request[]" class="form-control" value="{{ $balance_during_request_array[$i] }}" readonly>
@else
<input type="number" name="balance_on_ward_during_request[]" class="form-control" value="{{ $balance_during_request_array[$i] }}">
@endif
</td>
<td>
<input type="hidden" name="item_ids[]" value="{{ $item_ids_array[$i] }}">
<input type="hidden" name="item_unit_cost[]" value="{{ $item_unit_cost }}"/>
<input type="number" name="item_quantities[]" class="form-control" value="{{ $item_quantities_array[$i] }}">
</td>
</tr>
@endfor
@endif
</tbody>
</table>
</div>
</div>
Requested by <font color="blue">{{ get_full_name($ward_request_details->created_by, "id", "first_name", "last_name", "users") }}</font>
{{ Form::submit('Update Request', ['class' => 'btn btn-success', 'style' => 'float: right;']) }}
{{ Form::close() }}
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<!-- data time picker dependency -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<!-- -->
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#allItemRequests').DataTable({
order: [ 1, "asc" ],
dom: 'Bfrtip',
buttons: [
'copy',
{ extend: 'csv',
message: 'LIST OF WARD ITEM REQUESTS'
},
{ extend: 'excel',
message: 'LIST OF WARD ITEM REQUESTS',
sheetName: 'LIST OF WARD ITEM REQUESTS ON STREAMLINE'
},
{ extend: 'pdf',
message: 'LIST OF WARD ITEM REQUESTS',
orientation: 'landscape',
pageSize: 'LETTER'
}
]
});
$('#datepicker-autoclose').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
setDate: new Date(),
readOnly: true
});
$('.prescription-drugs,.ward_allocation,.prescription-sundries').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');//compulsory class css
$('.select2-selection.select2-selection--single.sec_d').css('border-left', '3px solid #aaa');
$('.select2-selection__arrow').css('top','3px');
$("#item_type").change(function(e) {
var item_id = $(this).val();
if (item_id == 2) {
$("#drugs_dropdown").hide();
$("#sundries_dropdown").show();
} else {
$("#drugs_dropdown").show();
$("#sundries_dropdown").hide();
}
});
$('.drug_ids,.sundry_ids,.general_item_ids').select2({
placeholder: "Select"
});
$(".remove").on("click", function () {
$(this).parent().parent().remove();
});
$(".confirmSelection").click(function (e) { // make sure that all compulsory fields have been filled out
var empty_compulsory_fields = [];
$(".compulsory").each(function () {
if ($(this).val() == "") {
var textname = $(this).attr('name');
$(this).focus();
empty_compulsory_fields.push(textname);
$(this).css('border','1px solid #F08080');
}
});
/* check if the array containing empty compulsory fields is not empty then return false */
if (empty_compulsory_fields.length != 0) {
alert("Please fill in all compulsory fields");
console.log(empty_compulsory_fields);
e.preventDefault();
return false;
}
});
});
</script>
@endpush
@@ -0,0 +1,207 @@
@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" />
<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-7 col-sm-7 col-xs-12">
<h4 class="page-title">Ward request details</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">Dashboard</a></li>
<li><a href="{{ url('ward_item_requests')}}">Ward requests</a></li>
<li class="active">Ward request details</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
@foreach ($errors->all() as $error)
<div>{{ $error }}</div>
@endforeach
</div>
</div>
@php
$item_ids_array = explode(",", $ward_request_details->item_ids);
$item_quantities_array = explode(",", $ward_request_details->item_quantities);
$balance_during_request_array = explode("," , $ward_request_details->balance_on_ward_during_request);
if($ward_request_details->approved_status == "1"){
$balance_returned_array = explode(",", $ward_request_details->balance_returned);
$quantity_approved_array = explode(",", $ward_request_details->item_quantities_approved);
}
@endphp
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<div class="table-responsive">
<table class="table table-bordered color-bordered-table success-bordered-table">
<thead>
<tr>
<th>#</th>
<th>
@if($ward_request_details->item_type == "1") Drug
@elseif($ward_request_details->item_type == "2") Sundry
@else General Item
@endif
</th>
<th>Quantity requested</th>
<th>Balance returned from ward</th>
@if($ward_request_details->approved_status == "1")
<th>Quantity given</th>
@endif
</tr>
</thead>
<tbody>
@for($i=0; $i < count($item_ids_array); $i++)
<tr>
<td>
{{ $i + 1 }}
</td>
<td>
@if($ward_request_details->item_type == "1")
{{ get_name($item_ids_array[$i], "id", "name", "drugs") }}
@elseif($ward_request_details->item_type == "2")
{{ get_name($item_ids_array[$i], "id", "name", "sundries") }}
@else
{{ get_name($item_ids_array[$i], "id", "name", "general_items") }}
@endif
</td>
<td>
{{ $item_quantities_array[$i] }}
<input type="hidden" name="ward_request_id" value="{{ $ward_request_details->id }}">
<input type="hidden" name="item_ids[]" value="{{ $item_ids_array[$i] }}">
</td>
<td>
@if($ward_request_details->approved_status == "1")
<input type="number" name="balance_returned[]" class="form-control" value="{{ $balance_returned_array[$i] }}" readonly>
@else
<input type="number" name="balance_returned[]" class="form-control" value="{{ $balance_during_request_array[$i] }}" readonly>
@endif
</td>
@if($ward_request_details->approved_status == "1")
<td>
@if($ward_request_details->approved_status == "1")
<input type="number" name="quantity_approved[]" class="form-control" value="{{ $quantity_approved_array[$i] }}" readonly>
@else
<input type="number" name="quantity_approved[]" class="form-control" value="{{ $item_quantities_array[$i] }}" readonly>
@endif
</td>
@endif
</tr>
@endfor
</tbody>
</table>
</div>
Requested by <font color="blue">{{ get_full_name($ward_request_details->created_by, "id", "first_name", "last_name", "users") }}</font>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<!-- data time picker dependency -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<!-- -->
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#allItemRequests').DataTable({
order: [ 1, "asc" ],
dom: 'Bfrtip',
buttons: [
'copy',
{ extend: 'csv',
message: 'LIST OF WARD ITEM REQUESTS'
},
{ extend: 'excel',
message: 'LIST OF WARD ITEM REQUESTS',
sheetName: 'LIST OF WARD ITEM REQUESTS ON STREAMLINE'
},
{ extend: 'pdf',
message: 'LIST OF WARD ITEM REQUESTS',
orientation: 'landscape',
pageSize: 'LETTER'
}
]
});
$('#datepicker-autoclose').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
setDate: new Date(),
readOnly: true
});
$('.prescription-drugs,.ward_allocation,.prescription-sundries').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');//compulsory class css
$('.select2-selection.select2-selection--single.sec_d').css('border-left', '3px solid #aaa');
$('.select2-selection__arrow').css('top','3px');
$("#item_type").change(function(e) {
var item_id = $(this).val();
if (item_id == 2) {
$("#drugs_dropdown").hide();
$("#sundries_dropdown").show();
} else {
$("#drugs_dropdown").show();
$("#sundries_dropdown").hide();
}
});
$(".remove").on("click", function () {
$(this).parent().parent().remove();
});
$(".confirmSelection").click(function (e) { // make sure that all compulsory fields have been filled out
var empty_compulsory_fields = [];
$(".compulsory").each(function () {
if ($(this).val() == "") {
var textname = $(this).attr('name');
$(this).focus();
empty_compulsory_fields.push(textname);
$(this).css('border','1px solid #F08080');
}
});
/* check if the array containing empty compulsory fields is not empty then return false */
if (empty_compulsory_fields.length != 0) {
alert("Please fill in all compulsory fields");
console.log(empty_compulsory_fields);
e.preventDefault();
return false;
}
});
});
</script>
@endpush
@@ -0,0 +1,207 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/icheck/skins/all.css') }}" rel="stylesheet">
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('wards.add_ward') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('wards.dashboard') }}</a></li>
<li><a href="{{ route('wards.index') }}">{{ __('wards.wards') }}</a></li>
<li class="active">{{ __('wards.create') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('ward_management::wards.menu')
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
@if (session()->has('streamline_setup'))
<h3><font color="blue">{{ __('wards.streamline_setup') }}</font></h3>
<div class="row">
<div class="col-sm-6">
{{ Form::open(['route' => 'wards.store']) }}
<div class="row" id="optionsList">
<div class="col-sm-3">
<div class="form-group">
{{ Form::label('name', __('wards.ward_name')) }}
{{ Form::text('name', '', ['class' => 'form-control',]) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
{{ Form::label('beds', __('wards.ward_beds')) }}
{{ Form::number('beds', '', ['class' => 'form-control',]) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
{{ Form::label('type', __('wards.hmis_ward')) }}
{{-- {{ Form::number('type', 0, ['class' => 'form-control',]) }} --}}
<select class="form-control " id="type" name="type" >
<option value="" selected disabled>{{ __('wards.select_type') }}</option>
@foreach ($ward_types as $ward_type)
<option value="{{ $ward_type['id'] }}">{{ $ward_type['name'] }}</option>
@endforeach
</select>
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
{{ Form::label("ward_type", __("wards.type")) }}
<select class="form-control" id="ward_type" name="ward_type">
<option value="" selected disabled>{{ __("wards.select_ward_type") }}</option>
@foreach ($actual_ward_types as $key => $actual_ward_type)
<option value="{{ $key }}">{{ $actual_ward_type }}</option>
@endforeach
</select>
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<a href="#" id="addOption">{{ __('wards.add_another') }}</a><br><br>
</div>
<div class="col-sm-6" style="background: #eceeef;">
<h4>{{ __('wards.select_any') }}</h4>
@for($i=0; $i < count($wards); $i++)
<div class="form-group">
{{ Form::checkbox('selected_wards[]', $wards[$i], false) }} {{ $wards[$i] }} &nbsp;&nbsp;
</div>
@endfor
</div>
</div>
{{ Form::button(__('wards.next'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10 next']) }}
{{ Form::button(__('wards.skip'),['type'=>'submit','name' => 'skip', 'value' => 'skip','class'=>'btn btn-default waves-effect waves-light m-r-10']) }}
@else
{{ Form::open(['route' => 'wards.store', 'data-toggle' => 'validator']) }}
<div class="row" id="optionsList">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('name', __('wards.ward_name')) }}
{{ Form::text('name', '', ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('beds', __('wards.ward_beds')) }}
{{ Form::number('beds', '', ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('type', __('wards.hmis_ward')) }}
<select class="form-control compulsory required" id="type" name="type" required>
<option value="" selected disabled>{{ __('wards.select_type') }}</option>
@foreach ($ward_types as $ward_type)
<option value="{{ $ward_type['id'] }}">{{ $ward_type['name'] }}</option>
@endforeach
</select>
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('available',__('wards.is_ward_available'), ["class"=>'col-md-12']) }}
&nbsp;&nbsp;{{ __('wards.yes') }} {{ Form::radio('available', 1, false, ['class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
&nbsp;&nbsp;{{ __('wards.no') }} {{ Form::radio('available', 0, false, ['class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('ward_type', __('wards.type')) }}
<select class="form-control" id="ward_type" name="ward_type">
<option value="" selected disabled>{{ __('wards.select_ward_type') }}</option>
@foreach ($actual_ward_types as $key => $actual_ward_type)
<option value="{{ $key }}">{{ $actual_ward_type }}</option>
@endforeach
</select>
<div class="help-block with-errors"></div>
</div>
</div>
</div>
{{ Form::button(__('wards.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10 submit-btn']) }}
{{ Form::button(__('wards.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
{{ Form::close() }}
@endif
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<!-- icheck -->
<script src="{{ asset('elite/bower_components/icheck/icheck.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/icheck/icheck.init.js') }}"></script>
<script type="text/javascript">
$('#type, #ward_type').select2();
var ward_types= {!! json_encode($ward_types) !!};
var actual_ward_types = {!! json_encode($actual_ward_types) !!};
$(function() {
$("#addOption").click(function(e) {
e.preventDefault();
$("#optionsList").append("<br>");
$("#optionsList").append("<div class='col-sm-3'><div class='form-group'> <input type='text' name='other_wards[]' placeholder='' class='form-control compulsory'/></div></div>");
$("#optionsList").append("<div class='col-sm-3'><div class='form-group'> <input type='number' name='other_ward_beds[]' value='0' class='form-control compulsory'/></div></div>");
$("#optionsList").append(`<div class='col-sm-3'><div class='form-group'> <select class="form-control compulsory required" id="type" name="other_ward_types[]" required>
<option value="" selected disabled>{{ __('wards.select_type') }}</option>
@foreach ($ward_types as $ward_type)<option value="{{ $ward_type['id'] }}">{{ $ward_type['name'] }}</option>
@endforeach</select></div></div>`);
$("#optionsList").append(`<div class="col-sm-3"><div class="form-group">{{ Form::label("ward_type", __("wards.type")) }}
<select class="form-control" id="ward_type" name="ward_type"><option value="" selected disabled>{{ __("wards.select_ward_type") }}</option>
@foreach ($actual_ward_types as $key => $actual_ward_type)<option value="{{ $key }}">{{ $actual_ward_type }}</option>@endforeach
</select><div class="help-block with-errors"></div></div></div>`);
});
$(".next,.submit-btn").click(function (e) { // make sure that all compulsory fields have been filled out
var empty_compulsory_fields = [];
$(".compulsory").each(function () {
if ($(this).val() == "") {
var textname = $(this).attr('name');
$(this).focus();
empty_compulsory_fields.push(textname);
$(this).css('border','1px solid #F08080');
}
});
/* check if the array containing empty compulsory fields is not empty then return false */
if (empty_compulsory_fields.length != 0) {
alert("Please fill in all compulsory fields");
console.log(empty_compulsory_fields);
e.preventDefault();
return false;
}
});
});
</script>
@endpush
@@ -0,0 +1,240 @@
@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/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">Ward Drugs Stock Sheet</h4>
</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 class="active">Ward Drugs Stock Sheet</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
<div class="row">
<div class="col-sm-12">
{{ Form::open(['url' => 'ward_drugs_stock_sheet', 'method'=>'ANY', 'role'=>'search']) }}
<div class="row">
<div class="col-md-4">
<div class="form-group">
{{ Form::label('ward_id', 'Wards') }}
{{ Form::select('ward_id', $wards, '', ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-4">
<div class="form-group" style="padding-top: 5px;"><br>
{{ Form::button('Submit',['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id'=>'select_patient']) }}
</div>
</div>
<div class="col-md-4">
Showing results from :
<br><h3 style="color: #0060BF; font-weight: bolder;"> {{ is_null($ward_id) ? 'No ward selected' : get_name($ward_id, 'id', 'name', 'wards') }} </h3>
</div>
</div>
{{ Form::close() }}
</div>
<div class="col-sm-12">
<form action="{{ route('wards.update_drugs_stock_sheet') }}" method="POST" name="stock_form" id="stock_form" style="width: 100%">
{{ csrf_field() }}
<input type="hidden" name="ward_id" value="{{ $ward_id }}">
<p class="text-muted m-b-30">Export data to Copy, CSV, Excel, PDF & Print</p>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table table-hover table-striped">
<thead>
<tr>
<th>Drug Name</th>
<th>Batch Details</th>
<th>{{ !is_null($ward_id) ? get_name($ward_id, "id", "name", "wards") : "" }} Stock</th>
<th>Cost Value</th>
<th>Cash Price</th>
<th>Sale Value</th>
</tr>
</thead>
<tbody>
@php $total_cost_value=0; $total_sale_value=0; @endphp
@foreach($ward_stock_records as $record)
@php
$drug = \Streamline\Models\Drug::withTrashed()->find($record->item_id);
$batch_records = \Streamline\Models\ItemBatchWatcher::where(['item_type' => 1, 'item_id' => $record->item_id])->whereRaw('FIND_IN_SET(' . $ward_id . ',ward_id)')->get();
$drug_ward_stock = 0;//dd($batch_records);
$item_cost_value = 0;
@endphp
<tr>
<td>
@if($drug->insurance_coverage == 1)
<span style="color: green;"> {{ $drug->name }} </span>
@else
<span style="color: orange;"> {{ $drug->name }} </span>
@endif
</td>
<td>
@if (count($batch_records) > 0)
@foreach ($batch_records as $record)
@php
$exploded_ward_stocks = $record->ward_stock ? explode(",",$record->ward_stock) : [];
$exploded_ward_ids = $record->ward_id ? explode(",", $record->ward_id) : [];
$ward_id_key = array_search($ward_id, $exploded_ward_ids);
$this_wardz_stock = 0;
if($ward_id_key !== false){
//the ward stock already exists so get it and add this amount
$this_wardz_stock = $exploded_ward_stocks[$ward_id_key] ?? 0;
}
@endphp
<div class="row shown_input" style="background-color: #e1e1ef; border-radius: 5px 5px; border: 2px #c4b7b7 solid; margin-bottom: 2px;">
<div class="col-sm-12" style="word-wrap: break-word; padding: 0px; font-size: 10px">
<b>{{ __('stores.batch') }}: </b>{{ $record->batch_number }}
</div>
<div class="col-sm-12" style="word-wrap: break-word; padding: 0px; font-size: 10px">
<b>{{ __('stores.quantity') }}: </b>{{ $this_wardz_stock }}<br>
@php
$drug_ward_stock += $this_wardz_stock;
$item_cost_value += $record->cost_price * $this_wardz_stock;
@endphp
<b>{{ __('stores.expiry_date') }}: </b>{{ $record->expiry_date }}
</div>
<div class="col-sm-12" style="word-wrap: break-word; padding: 0px; font-size: 10px">
<b>{{ __('stores.unit_cost') }}: </b>{{ $record->cost_price }}
</div>
</div>
<div class="hidden_input" style="display: none;">
<input type="hidden" name="batch_drug_id[]" value="{{ $drug->id }}">
<div class="col-sm-6" style="word-wrap: break-word; padding: 0px; font-size: 10px">
<b>{{ __('stores.batch') }}: </b>{{ $record->batch_number }}
<input type="hidden" name="batch_number[]" value="{{ $record->batch_number }}">
<input type="hidden" name="item_batch_watcher_id[]" value="{{ $record->id }}">
<input type="hidden" name="batch_unit_cost[]" value="{{ $record->cost_price }}">
<input type="hidden" name="batch_expiry_date[]" value="{{ $record->expiry_date }}">
</div>
<div class="col-sm-6" style="word-wrap: break-word; padding: 0px; font-size: 10px">
<input type="text" name="batch_quantity[]" class="form-control" value="{{ $this_wardz_stock }}">
</div>
</div>
@endforeach
@endif
</td>
<td>
<div class="">
{{ $drug_ward_stock }}
</div>
{{-- <div class="hidden_input" style="display: none;">
<input type="hidden" name="drug_id[]" value="{{ $drug->id }}">
<input type="text" name="quantity[]" class="form-control" value="{{ $drug_ward_stock }}">
</div> --}}
</td>
<td>
{{ ugandan_shillings($item_cost_value) }}
</td>
<td>{{ ugandan_shillings($drug->non_insured_price) }}</td>
<td>
{{ ugandan_shillings($drug->non_insured_price * $drug_ward_stock) }}
</td>
@php
$total_cost_value += $item_cost_value;
$total_sale_value += ($drug->non_insured_price * $drug_ward_stock);
@endphp
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<th>Drug Name</th>
<th>Batch Details</th>
<th>{{ !is_null($ward_id) ? get_name($ward_id, "id", "name", "wards") : "" }} Stock</th>
<th>Cost Value</th>
<th>Cash Price</th>
<th>Sale Value</th>
</tr>
<tr>
<th></th>
<th></th>
<th>Total:</th>
<th>{{ ugandan_shillings($total_cost_value) }}</th>
<th></th>
<th>{{ ugandan_shillings($total_sale_value) }}</th>
</tr>
</tfoot>
</table>
<div class="hidden_input" style="display: none;">
<br>
{{ Form::label('account_id', __('stores.general_comment')) }}
{{ Form::textarea('general_comment','',['class' => 'form-control', 'placeholder' => __('pharmacy.add_general_comment'), 'rows' => 4]) }}
</div>
<div style="padding: 10px; float: right;">
@if( Auth::user()->can('edit-ward-drug-stock-sheet'))
<button class="btn btn-rounded btn-default" id="cancel_edit" style="display: none;">Cancel</button>
<button class="btn btn-rounded btn-success" id="edit_stock">Edit stock</button>
<input type="submit" value="Save stock" class="btn btn-rounded btn-success" id="save_stock" style="display: none;">
@endif
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
$('#edit_stock').click(function(e){
e.preventDefault();
$('.hidden_input,#save_stock').show();
$('.shown_input').hide();
$(this).hide();
});
$('.expiry_date_input').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
</script>
@endpush
@@ -0,0 +1,102 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/icheck/skins/all.css') }}" rel="stylesheet">
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('wards.edit_ward') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('wards.dashboard') }}</a></li>
<li><a href="{{ route('wards.index') }}">{{ __('wards.wards') }}</a></li>
<li class="active">{{ __('wards.edit') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('ward_management::wards.menu')
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
{{ Form::model($ward, ['method' => 'PUT', 'route' => ['wards.update',$ward], 'data-toggle' => 'validator']) }}
<div class="form-group">
{{ Form::label('name', __('wards.ward_name')) }}
{{ Form::text('name', $ward->name, ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('beds', __('wards.ward_beds')) }}
{{ Form::text('beds', $ward->beds, ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('type', __('wards.hmis_ward')) }}
{{-- {{ Form::text('type', $ward->slug, ['class' => 'form-control compulsory', 'required']) }} --}}
<select class="form-control compulsory required" id="type" name="type" required>
@if (empty($selected_ward_type))
<option value="" selected disabled>{{ __('wards.select_type') }}</option>
@else
@foreach ($selected_ward_type as $selected_ward )
<option value="{{ $selected_ward['id'] }}" selected>{{ $selected_ward['name'] }}</option>
@endforeach
@endif
@foreach ($other_ward_types as $ward_type)
<option value="{{ $ward_type['id'] }}">{{ $ward_type['name'] }}</option>
@endforeach
</select>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('', __('wards.is_ward_available'), ["class"=>'col-md-12']) }}
&nbsp;&nbsp;{{ __('wards.yes') }} {{ Form::radio('available', 1, $ward->available == 1, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
&nbsp;&nbsp;{{ __('wards.no') }} {{ Form::radio('available', 0, $ward->available == 0, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('ward_type', __('wards.type')) }}
<select class="form-control" id="ward_type" name="ward_type">
@if (empty($ward->type))
<option value="" selected disabled>{{ __('wards.select_ward_type') }}</option>
@endif
@foreach ($actual_ward_types as $key => $actual_ward_type)
<option value="{{ $key }}" @php if($key == $ward->type) echo 'selected' @endphp>{{ $actual_ward_type }}</option>
@endforeach
</select>
<div class="help-block with-errors"></div>
</div>
{{ Form::button(__('wards.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
{{ Form::button(__('wards.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
{{ Form::close() }}
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<!-- icheck -->
<script src="{{ asset('elite/bower_components/icheck/icheck.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/icheck/icheck.init.js') }}"></script>
<script type="text/javascript">
$('#type, #ward_type').select2();
</script>
@endpush
@@ -0,0 +1,92 @@
@extends('layouts.main')
@section('content')
<div class="row bg-title">
<div class="col-md-4">
<h4 class="page-title">{{ __('wards.wards_home') }}</h4>
</div>
<div class="col-md-8">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}"><i class="fa fa-boxes"></i> {{ __('home.dashboard') }}</a></li>
<li class="active">{{ __('wards.wards_home') }}</li>
</ol>
</div>
</div>
<div class="white-box">
@include('flash::message')
<div class="row">
<div class="col-md-4">
<h3 class="box-title">{{ __('wards.patient_management') }}</h3>
<ul class="feeds">
@if( Auth::user()->can('ward-list'))
<a href="{{ route('wards.select') }}">
<li>
<div class="bg-success"><i class="fa fa-plus-circle text-white"></i></div> {{ __('wards.ward_patient_list') }}<i class="fa fa-angle-right float-right" style="padding-top: 12.5px;"></i>
</li>
</a>
@endif
@if( Auth::user()->can('pharmacy-ward-dispensing-per-chart'))
<a href="{{ route('pharmacy.ward_dispensing_per_chart') }}">
<li>
<div class="bg-success"><i class="fa fa-plus-circle text-white"></i></div> {{ __('layout.ward_dispensing_per_chart') }}<i class="fa fa-angle-right float-right" style="padding-top: 12.5px;"></i>
</li>
</a>
@endif
</ul>
</div>
<div class="col-md-4">
<h3 class="box-title">{{ __('stores.stock_management') }}</h3>
<ul class="feeds">
@if( Auth::user()->can('create-ward-item-request'))
<a href="{{ route('ward_item_request.ward_item_requests') }}">
<li>
<div class="bg-info"><i class="fa fa-medkit text-white"></i></div> {{ __('layout.ward_item_request') }}<i class="fa fa-angle-right float-right" style="padding-top: 12.5px;"></i>
</li>
</a>
@endif
@if( Auth::user()->can('view-incoming-ward-dispensing-per-chart'))
<a href="{{ url('incoming_ward_charts') }}">
<li>
<div class="bg-info"><i class="fa fa-medkit text-white"></i></div> {{ __('layout.incoming_ward_charts') }}<i class="fa fa-angle-right float-right" style="padding-top: 12.5px;"></i>
</li>
</a>
@endif
@if( Auth::user()->can('view-incoming-ward-item-requests'))
<a href="{{ route('ward_item_request.incoming_ward_requests') }}">
<li>
<div class="bg-info"><i class="fa fa-medkit text-white"></i></div> {{ __('layout.incoming_ward_item_request') }}<i class="fa fa-angle-right float-right" style="padding-top: 12.5px;"></i>
</li>
</a>
@endif
</ul>
</div>
<div class="col-md-4">
<h3 class="box-title">{{ __('stores.reports') }}</h3>
<ul class="feeds">
@if( Auth::user()->can('view-ward-drug-stock-sheet'))
<a href="{{ url('ward_drugs_stock_sheet') }}">
<li>
<div class="bg-info"><i class="fa fa-book text-white"></i></div> Ward Drugs Stock Sheet<i class="fa fa-angle-right float-right" style="padding-top: 12.5px;"></i>
</li>
</a>
@endif
@if( Auth::user()->can('view-ward-sundry-stock-sheet'))
<a href="{{ url('ward_sundries_stock_sheet') }}">
<li>
<div class="bg-info"><i class="fa fa-book text-white"></i></div> Ward Sundries Stock Sheet<i class="fa fa-angle-right float-right" style="padding-top: 12.5px;"></i>
</li>
</a>
@endif
</ul>
</div>
</div>
</div>
@endsection
@@ -0,0 +1,91 @@
@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" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('wards.activate_wards') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('wards.dashboard') }}</a></li>
<li><a href="{{ route('wards.index') }}">{{ __('wards.wards') }}</a></li>
<li class="active">{{ __('wards.activate') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('ward_management::wards.menu')
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{ __('wards.ward_name') }}</th>
<th>{{ __('wards.ward_beds') }}</th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>{{ __('wards.ward_name') }}</th>
<th>{{ __('wards.ward_beds') }}</th>
<th></th>
</tr>
</tfoot>
<tbody>
@foreach($wards as $ward)
<tr>
<td>{{ $ward->name }}</td>
<td>{{ $ward->beds }}</td>
<td>
{{ Form::model($ward->id ,['method' => 'POST', 'route' => ['wards.activate', $ward->id]]) }}
<button type="submit" class="btn btn-warning" onclick="return confirm('<?php echo __('wards.are_you_sure');?>')"><i class="fa fa-check"></i> {{ __('wards.activate') }}</button>
{{ Form::close() }}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
</script>
@endpush
@@ -0,0 +1,141 @@
@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" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('wards.wards') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('wards.dashboard') }}</a></li>
<li class="active">{{ __('wards.wards') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('ward_management::wards.menu')
</div>
</div>
@include('flash::message')
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{ __('wards.ward_name') }}</th>
<th>{{ __('wards.hmis_ward') }}</th>
<th>{{ __('wards.type') }}</th>
<th>{{ __('wards.ward_beds') }}</th>
<th></th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>{{ __('wards.ward_name') }}</th>
<th>{{ __('wards.hmis_ward') }}</th>
<th>{{ __('wards.type') }}</th>
<th>{{ __('wards.ward_beds') }}</th>
<th></th>
<th></th>
</tr>
</tfoot>
<tbody>
@foreach($wards as $ward)
<tr>
<td>{{ $ward->name }}</td>
<td>{{ $ward->hmis_ward }}</td>
<td>{{ $ward_types[$ward->type]?? '' }}</td>
<td>{{ $ward->beds }}</td>
<td>
<a href="/wards/{{ $ward->id }}/edit/" class="btn btn-info"><i class="fa fa-pencil"></i> {{ __('wards.edit') }}</a>
</td>
<td>
@if (empty($inpatient_wards[$ward->id]))
{{ Form::model($ward->id ,['method' => 'DELETE', 'route' => ['wards.destroy', $ward->id]]) }}
<button type="submit" class="btn btn-danger" onclick="return confirm('<?php echo __('wards.are_you_sure');?>')"><i class="fa fa-trash"></i> {{ __('wards.delete') }}</button>
{{ Form::close() }}
@else
<b class="text-success">Ward in use</b>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<script type="text/javascript">
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 20,
order: [],
buttons: [
'copy',
{extend: 'csv',
message: '<?php echo __('wards.list_of_wards');?>'
},
{extend: 'excel',
message: '<?php echo __('wards.list_of_wards');?>',
exportOptions: {
columns: [0, 1]
},
sheetName: '<?php echo __('wards.list_of_wards');?>'
},
{extend: 'pdf',
message: '<?php echo __('wards.list_of_wards');?>',
orientation: 'portrait',
pageSize: 'LETTER',
exportOptions: {
columns: [0, 1]
},
customize: function (doc) {
doc.defaultStyle.fontSize = 10;
// doc.styles.tableHeader.alignment = 'left';
}
},
{extend: 'print',
message: '<?php echo __('wards.list_of_wards');?>',
exportOptions: {
columns: [0, 1]
},
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 table-bordered')
.css('font-size', 'inherit');
}
}
]
});
</script>
@endpush
@@ -0,0 +1,7 @@
<div class="panel panel-default">
<div class="panel-body">
<a href="{{ route('wards.create') }}" class="nav-item btn btn-default ti-plus"> {{ __('wards.add_ward') }}</a>
<a href="{{ route('wards.index') }}" class="nav-item btn btn-default ti-pencil"> {{ __('wards.view_wards') }}</a>
<a href="{{ route('wards.inactive') }}" class="nav-item btn btn-default ti-trash"> {{ __('wards.activate_wards') }}</a>
</div>
</div>
@@ -0,0 +1,724 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet"
type="text/css" />
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet"
type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('js/gritter/css/jquery.gritter.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<style type="text/css">
.color-tr {
background: #FFFF99;
}
/* The container */
.contained {
display: block;
position: relative;
/*padding-left: 35px;*/
/*margin-bottom: 12px;*/
cursor: pointer;
/*font-size: 22px;*/
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* Hide the browser's default radio button */
.contained input {
/*position: absolute;*/
opacity: 0;
cursor: pointer;
}
/* Create a custom radio button */
.checkmark {
position: absolute;
top: 0;
left: 0;
height: 25px;
width: 25px;
background-color: #eee;
border-radius: 50%;
}
/* On mouse-over, add a grey background color */
.contained:hover input~.checkmark {
background-color: #ccc;
}
/* When the radio button is checked, add a blue background */
.contained input:checked~.checkmark {
background-color: #2196F3;
}
/* Create the indicator (the dot/circle - hidden when not checked) */
.checkmark:after {
content: "";
position: absolute;
display: none;
}
/* Show the indicator (dot/circle) when checked */
.contained input:checked~.checkmark:after {
display: block;
}
/* Style the indicator (dot/circle) */
.contained .checkmark:after {
top: 9px;
left: 9px;
width: 8px;
height: 8px;
border-radius: 50%;
background: white;
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('wards.select_ward') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('wards.dashboard') }}</a></li>
<li><a href="{{ route('wards.index') }}">{{ __('wards.wards') }}</a></li>
<li class="active">{{ __('wards.select') }}</li>
</ol>
</div>
</div>
@include('flash::message')
@include ('errors.list')
<div class="row">
<div class="col-sm-12">
<div class="white-box">
{{ Form::open(['route' => 'wards.select', 'class' => 'typeahead', 'method' => 'ANY', 'role' => 'search']) }}
{{ Form::hidden('patient_id', 0, ['id' => 'patient_id']) }}
<div class="row">
<div class="col-md-3">
<div class="form-group">
{{ Form::label('ward_id', __('wards.wards')) }}
{{ Form::select('ward_id', $wards, '', ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-2">
<div class="form-group" id="searchby">
{{ Form::label('search_by', __('wards.date')) }}
{{ Form::select('search_by', ['' => '--select--', 0 => 'All Records', 1 => __('wards.today'), 2 => __('wards.yesterday'), 3 => __('wards.custom_date'), 4 => __('wards.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', __('wards.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', __('wards.to')) }}
<div class="input-group">
{{ Form::text('end_date','',['class' => 'form-control
compulsory','readonly','id'=>'datepicker-autoclose-2']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-3">
{{ Form::label('search_patient', __('investigations.search_by_patient')) }}
<div class="input-group">
<select class="form-control" name="patient_number" id="patient_number"></select>
</div>
</div>
<div class="col-md-1">
<div class="form-group" style="padding-top: 5px;"><br>
{{ Form::button(__('wards.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect
waves-light m-r-10', 'id'=>'select_patient']) }}
</div>
</div>
</div>
<br>
<h3 style="color: #0060BF; font-weight: bolder;">{{ $search_text }}</h3>
{{ Form::close() }}
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
{{ Form::open(['route' => 'wards.route_patient_episode']) }}
<div class="white-box">
<div class="table-responsive">
<table class="table color-table success-table table-sm">
<thead>
<tr>
<th width="5%">{{ __('wards.bed') }}</th>
<th style="display: none">{{ __('wards.bed') }}</th>
<th width="16%" style="padding-left: 1px; padding-right: 1px;">{{ __('wards.bed_category')
}}</th>
<th width="5%" style="padding-left: 0px; padding-right: 0px;">{{ __('wards.admission') }}
</th>
<th width="20%">{{ __('wards.names') }}</th>
<th width="2%">{{ __('wards.sex') }}</th>
<th width="2%">{{ __('wards.age') }}</th>
<th width="10%">{{ __('wards.triage') }}</th>
<th width="17%">{{ __('wards.primary_diagnosis') }}</th>
<th width="22%">{{ __('wards.comments') }}</th>
<th style="display: none">{{ __('wards.comments') }}</th>
<th width="1%">&nbsp;</th>
</tr>
</thead>
<tbody>
@foreach($inpatients as $inpatient)
@if(\Streamline\Models\PatientEpisode::find($inpatient->episode_id))
<tr id="my_row{{ $inpatient->episode_id }}">
<td style="padding-left: 0px;">
<!-- used for ordering this column -->
<p style="display: none">{{ $inpatient->bed_no }}</p>
<input type="hidden" class="inpatient_id" value="{{ $inpatient->id }}">
<input type="hidden" class="bed_patient_id" value="{{ $inpatient->patient_id }}">
<input class="android-input" name="bed_no" value="{{ $inpatient->bed_no }}" id="bed_no"
onchange="change_bed_number(this.value, <?php echo $inpatient->id ?>)"
style="width: 100%; color: maroon; font-weight: bold; height: 60px; text-align: center;">
<input type="hidden" class="bed_episode_id" value="{{ $inpatient->episode_id }}">
</td>
<td style="display: none">
<!-- used for the print -->
<p>{{ $inpatient->bed_no }}</p>
</td>
<td>
<!-- used for ordering this column -->
<p style="display: none">{{ $inpatient->bed_category }}</p>
<select name="bed_category" class="android-input-select"
onchange="update_bed_category(this.value, <?php echo $inpatient->id ?>)"
style="width: 100%; height: 60px; color: maroon; text-align: center;">
{!! custom_dropdown_selected("inpatient_bed_categories", "id", "name",
$inpatient->bed_category_id) !!}
</select>
</td>
<td style="padding-left: 0px; padding-right: 0px;">
<?php
$admitted_on = new Carbon\Carbon($inpatient->admitted_on);
echo streamline_date($inpatient->admitted_on) . '<br>';
echo "<span style='font-size: smaller; color: #0a776c; font-weight: bold;'>" . $admitted_on->diffInDays(Carbon\Carbon::now()) . ' days</span>';
?>
</td>
<td style="padding-left: 0px;">
<?php
echo insurance_flag($inpatient->patient_id) . '<br>';
echo "<span style='font-size: smaller; color: #0a776c; font-weight: bold;'>" . $inpatient->number . '</span>';
?>
</td>
<td>{{ $inpatient->gender == 1 ? __('wards.male') : __('wards.female') }}</td>
<td>{{ get_patients_age($inpatient->date_of_birth) }}</td>
<td>
@php
$severe_grade = !empty($inpatient->severe_grade)?
severe_grade($inpatient->severe_grade):'N/A';
echo $severe_grade;
@endphp
</td>
<td style="padding-left: 0px; padding-right: 0px;">{{ $inpatient->primary_diagnosis_name ??
'N/A' }}</td>
<td>
<!-- used for ordering this column -->
<p style="display: none">{{ $inpatient->comments }}</p>
<input type="hidden" class="bed_patient_id" value="{{ $inpatient->patient_id }}">
<!--<input value="" >-->
<textarea class="change_comments android-input"
style="color: maroon; width: 100%; padding: 0px; margin: 0px; height: 60px">{{ $inpatient->comments }}</textarea>
<input type="hidden" class="bed_episode_id" value="{{ $inpatient->episode_id }}">
</td>
<td style="display: none">
<!-- used for the print -->
<p>{{ $inpatient->comments }}</p>
</td>
<td>
@if($inpatient->slug == "maternity")
<input type="radio" onchange="show('menu_maternity'), hide('inpatient_buttons_menu')"
class="radio-option-inpatient center" name="episode_id" id="episode_id"
value="{{ $inpatient->episode_id }}" />
@else
<input class="radio-option-inpatient"
onchange="show('inpatient_buttons_menu'), hide('menu_maternity')" type="radio"
name="episode_id" id="episode_id" value="{{ $inpatient->episode_id }}">
@endif
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
</div>
<!-- start the show menu buttons divs when a patient is selected -->
<div id="inpatient_buttons_menu" style="display: none;">
<div class="row">
@if(Auth::user()->can('perform-triage') && !is_add_attendance_to_consultation_enabled())
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-success btn-block btn-sm" value="triage">{{
__('wards.triage') }}</button>
</div>
@endif
@if(Auth::user()->can('create-consultation'))
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-success btn-block btn-sm" value="consultation">{{
__('wards.consultation') }}</button>
</div>
@endif
@if(Auth::user()->can('view-inpatient-sheet'))
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-success btn-block btn-sm"
value="inpatient_sheet">{{ __('wards.inpatient_sheet') }}</button>
</div>
@endif
@if(Auth::user()->can('view-inpatient-billing'))
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-success btn-block btn-sm"
value="inpatient_billing">{{ __('wards.inpatient_billing') }}</button>
</div>
@endif
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-primary btn-block btn-sm"
value="treatment_sheet">{{ __('patient_episode.treatment_sheet') }}</button>
</div>
</div>
</div>
<div class="white-box" id="menu_maternity" style="display: none;">
{{--
<div class="row">
@if(Auth::user()->can('view-maternity-admission'))
<div class="col-sm-3">
<button name="submit" value="maternity_admission" class="btn btn-success pull-right col-sm-12">{{
__('wards.maternity_admission') }}</button>
</div>
@endif
@if(Auth::user()->can('view-delivery-record'))
<div class="col-sm-2">
<button name="submit" value="delivery_record" class="btn btn-success col-sm-12">{{
__('wards.delivery_record') }}</button>
</div>
@endif
@if(Auth::user()->can('view-inpatient-billing'))
<div class="col-sm-3">
<button name="submit" value="maternity_summary" class="btn btn-success col-sm-12">{{
__('wards.inpatient_sheet') }}</button>
</div>
@endif
<div class="col-sm-2"></div>
<div class="col-sm-2">
@if(Auth::user()->can('create-theatre-surgery') || Auth::user()->can('create-theatre-anaesthesia'))
<div class="btn-group dropup m-r-10 col-sm-12">
<button aria-expanded="false" data-toggle="dropdown"
class="btn btn-info dropdown-toggle waves-effect waves-light col-sm-12" type="button">{{
__('patient_episode.theatre') }} <span class="caret"></span></button>
<ul role="menu" class="dropdown-menu">
<li><button type="submit" name="submit" value="create_anaesthetics"
class="btn btn-default btn-sm btn-link">{{
__('patient_episode.theatre_anaesthetics') }}</button></li>
<li><button type="submit" name="submit" value="anaesthetics_history"
class="btn btn-default btn-sm btn-link">{{
__('patient_episode.historical_anaesthetics') }}</button></li>
<li><button type="submit" name="submit" value="create_surgery"
class="btn btn-default btn-sm btn-link">{{ __('patient_episode.theatre_surgery')
}}</button></li>
<li><button type="submit" name="submit" value="surgery_index"
class="btn btn-default btn-sm btn-link">{{
__('patient_episode.historical_surgeries') }}</button></li>
</ul>
</div>
@endif
</div>
</div>
--}}
{{-- Maternity and delivery buttons --}}
{{-- maternity buttons row 1 --}}
<div class="row">
@if (Auth::user()->can('view-maternity-admission'))
<div class="col-sm-2">
<button name="submit" value="maternity_admission" class="btn btn-success btn-sm btn-block">{{
__('patient_episode.maternity_admission') }}</button>
</div>
@endif
@if (Auth::user()->can('view-delivery-record'))
<div class="col-sm-2">
<button name="submit" value="delivery_record" class="btn btn-success btn-sm btn-block">{{
__('patient_episode.delivery_record') }}</button>
</div>
@endif
@if (Auth::user()->can('view-inpatient-sheet'))
<div class="col-sm-2">
<button name="submit" value="maternity_summary" class="btn btn-success btn-sm btn-block">{{
__('patient_episode.inpatient_sheet') }}</button>
</div>
@endif
@if (Auth::user()->can('view-birth-report'))
<div class="col-sm-2">
<button name="submit" value="birth_report" class="btn btn-sm btn-inverse btn-block">NIRA
{{ __('patient_episode.birth_report') }}</button>
</div>
@endif
<div class="col-sm-2"></div>
<div class="col-sm-2">
<div class="btn-group dropup m-r-10 col-sm-12">
<button aria-expanded="false" data-toggle="dropdown"
class="btn btn-sm btn-info dropdown-toggle waves-effect waves-light btn-block"
type="button">{{ __('patient_episode.theatre') }} <span class="caret"></span></button>
<ul role="menu" class="dropdown-menu">
@if (Auth::user()->can('create-anaesthetics'))
<li><button type="submit" name="submit" value="create_anaesthetics"
class="btn btn-default btn-sm btn-link">{{
__('patient_episode.theatre_anaesthetics') }}</button>
</li>
@endif
@if (Auth::user()->can('view-anaesthetics-history'))
<li><button type="submit" name="submit" value="anaesthetics_history"
class="btn btn-default btn-sm btn-link">{{
__('patient_episode.historical_anaesthetics') }}</button>
</li>
@endif
@if (Auth::user()->can('create-surgery'))
<li><button type="submit" name="submit" value="create_surgery"
class="btn btn-default btn-sm btn-link">{{ __('patient_episode.theatre_surgery')
}}</button>
</li>
@endif
@if (Auth::user()->can('view-surgery'))
<li><button type="submit" name="submit" value="surgery_index"
class="btn btn-default btn-sm btn-link">{{
__('patient_episode.historical_surgeries') }}</button>
</li>
@endif
</ul>
</div>
</div>
</div>
{{-- end of maternity buttons row 1 --}}
{{-- maternity buttons row 2 --}}
<div class="row" style="margin-top:10px;">
@php
$episode_id_id = session()->get('episode_id');
$patient_episode_details = \Streamline\Models\PatientEpisode::find($episode_id_id);
// $patient_id_id = $patient_episode_details->patient_id;
$check_if_labour_admission_exists = \Streamline\Models\LabourWardAdmission::where(
'patient_id',
$patient_id ?? '',
)
->where('episode_id', $episode_id_id)
->first();
@endphp
@if (Auth::user()->can('labour-ward-admission'))
{{-- <div class="col-sm-2">
<button name="submit" value="labour_ward_admission" class="btn btn-success btn-sm btn-block">{{
__('patient_episode.labour_ward_admission') }}</button> --}}
<div class="col-sm-2">
{{-- <button name="submit" value="labour_ward_admission"
class="btn btn-success btn-sm btn-block">{{ __('patient_episode.labour_ward_admission') }}
</button> --}}
{{-- @if (!empty($check_if_labour_admission_exists->complete))
@if ($check_if_labour_admission_exists->complete == 0)
<button name="submit" value="edit_labour_ward_admission_sheet"
class="btn btn-success btn-sm btn-block">
{{ __('patient_episode.labour_ward_admission') }}</button>
@endif
@if ($check_if_labour_admission_exists->complete == 1)
<button name="submit" value="labour_ward_admission_sheet_details"
class="btn btn-success btn-sm btn-block">
{{ __('patient_episode.labour_ward_admission') }}</button>
@endif
@else
<button name="submit" value="labour_ward_admission" class="btn btn-success btn-sm btn-block">
{{ __('patient_episode.labour_ward_admission') }}</button>
@endif --}}
{{--
@if ($check_if_labour_admission_exists->complete == 0)
<button name="submit" value="edit_labour_ward_admission_sheet"
class="btn btn-success btn-sm btn-block">
{{ __('patient_episode.labour_ward_admission') }}</button>
@elseif ($check_if_labour_admission_exists->complete == 1)
<button name="submit" value="labour_ward_admission_sheet_details"
class="btn btn-success btn-sm btn-block">
{{ __('patient_episode.labour_ward_admission') }}</button>
@else
<button name="submit" value="labour_ward_admission" class="btn btn-success btn-sm btn-block">
{{ __('patient_episode.labour_ward_admission') }}</button>
@endif --}}
@if ($check_if_labour_admission_exists !== null)
@if ($check_if_labour_admission_exists->complete == 0)
<button name="submit" value="edit_labour_ward_admission_sheet"
class="btn btn-success btn-sm btn-block">
{{ __('patient_episode.labour_ward_admission') }}
</button>
@elseif ($check_if_labour_admission_exists->complete == 1)
<button name="submit" value="labour_ward_admission_sheet_details"
class="btn btn-success btn-sm btn-block">
{{ __('patient_episode.labour_ward_admission') }}
</button>
@else
<button name="submit" value="labour_ward_admission" class="btn btn-success btn-sm btn-block">
{{ __('patient_episode.labour_ward_admission') }}
</button>
@endif
@else
<!-- Handle the case where $check_if_labour_admission_exists is null -->
<button name="submit" value="labour_ward_admission" class="btn btn-success btn-sm btn-block">
{{ __('patient_episode.labour_ward_admission') }}
</button>
@endif
</div>
@endif
@if (Auth::user()->can('safe-delivery'))
<div class="col-sm-2">
<button name="submit" value="delivery_record" class="btn btn-success btn-sm btn-block">{{
__('patient_episode.safe_delivery') }}</button>
</div>
@endif
@if (Auth::user()->can('partogram'))
<div class="col-sm-2">
<button name="submit" value="maternity_summary" class="btn btn-success btn-sm btn-block">{{
__('patient_episode.partogram') }}</button>
</div>
@endif
@if (Auth::user()->can('labour-ward-overview'))
<div class="col-sm-2">
<button name="submit" value="birth_report" class="btn btn-sm btn-inverse btn-block">{{
__('patient_episode.labour_ward_overview') }}</button>
</div>
@endif
</div>
{{-- End maternity buttons row 2 --}}
{{-- End of Maternity and delivery buttons --}}
</div>
<!-- end of buttons divs that show when a patient is selected -->
{{ Form::close() }}
</div>
</div>
@endsection
@push('scripts')
<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/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
$('#search_by').change(function () {
if ($(this).val() == 3) {
$('#date_search').show();
$('#date_range_search').hide();
} else if ($(this).val() == 4) {
$('#date_range_search').show();
$('#date_search').hide();
} else {
$('#date_search,#date_range_search').hide();
}
});
$('#patient_number').change(function () {
let id = $('#patient_number').val();
$('#patient_id').val(id);
});
$('#patient_number').select2({
placeholder: 'Search by patient details (names and number)',
ajax: {
url: '/patients/search_patient_by_name_number',
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.first_name + " " + item.last_name + " (" + item.number + ")",
id: item.id
}
})
};
},
cache: true
}
});
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 50,
buttons: [
{extend: 'print',
exportOptions: {
stripHtml: false,
columns: [1, 3, 4, 5, 6, 7, 8, 10]
},
title: '{{ __('wards.ward_patient_list') }}'
},
{
extend: 'pdf',
exportOptions: {
columns: [1, 3, 4, 5, 6, 7, 8, 10]
},
title: '{{ __('wards.ward_patient_list') }}'
}
]
});
$('.sorting').removeClass('sorting');//remove the sorting class
$('.sorting_asc').removeClass('sorting_asc');//remove the sorting class
$('#datepicker-autoclose,#datepicker-autoclose-1,#datepicker-autoclose-2').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy'
});
$('.radio-option-inpatient').change(function(){
//this is to highlight the clicked episode row
let episode_id = $(this).val();
if (this.checked) {
// remove the class that highlights the selected row
$('[id^=my_row]').css("background-color", "transparent");
$('#my_row'+episode_id).css("background", "#FFFF99");
}
});
$('#datepicker-autoclose').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy'
});
function change_bed_number(bed_no, inpatient_id) {
var data = "bed_no=" + bed_no + "&inpatient_id=" + inpatient_id;
$.ajax({
type: "POST",
url: "/submit_bed_number",
data: data,
cache: false,
success: function (result) {
if (result === "success") {
alert('<?php echo __('wards.bed_no_saved'); ?>');
} else {
alert("<?php echo __('wards.error_occurred'); ?>");
}
}
});
}
//start update of ward comment
$('.change_comments').each(function () {
$(this).change(function () {
var comment = $(this).val();
var patient_id = $(this).prev(".bed_patient_id").val();
var episode_id = $(this).next(".bed_episode_id").val();
var data = "comment=" + comment + "&patient_id=" + patient_id + "&episode_id=" + episode_id;
$.ajax({
type: "POST",
url: "/submit_ward_message",
data: data,
cache: false,
success: function (result) {
if (result === "success") {
alert('<?php echo __('wards.comments_saved'); ?>');
} else {
alert("<?php echo __('wards.error_occurred'); ?>");
}
}
});
});
});
//end update of ward comment
function update_bed_category(category_id, inpatient_id) {
var data = "bed_category=" + category_id + "&inpatient_id=" + inpatient_id;
$.ajax({
type: "POST",
url: "/submit_bed_category",
data: data,
cache: false,
success: function (result) {
if (result === "success") {
alert("<?php echo __('wards.bed_category_saved'); ?>");
} else {
alert("<?php echo __('wards.error_occurred'); ?>");
}
}
});
}
function show(id) {
if (document.getElementById(id).style.display === 'none') {
document.getElementById(id).style.display = '';
}
}
function hide(id) {
document.getElementById(id).style.display = 'none';
}
</script>
@endpush
@@ -0,0 +1,156 @@
@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/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">Ward Sundries Stock Sheet</h4>
</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 class="active">Ward Sundries Stock Sheet</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
<div class="row">
<div class="col-sm-12">
{{ Form::open(['url' => 'ward_sundries_stock_sheet','method'=>'ANY','role'=>'search']) }}
<div class="row">
<div class="col-md-4">
<div class="form-group">
{{ Form::label('ward_id', 'Wards') }}
{{ Form::select('ward_id', $wards, '', ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-4">
<div class="form-group" style="padding-top: 5px;"><br>
{{ Form::button('Submit',['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id'=>'select_patient']) }}
</div>
</div>
<div class="col-md-4">
Showing results from :
<br><h3 style="color: #0060BF; font-weight: bolder;"> {{ is_null($ward_id) ? 'No ward selected' : get_name($ward_id, 'id', 'name', 'wards') }} </h3>
</div>
</div>
{{ Form::close() }}
</div>
<div class="col-sm-12">
<form action="{{ route('wards.update_sundries_stock_sheet') }}" method="POST" name="stock_form" id="stock_form" style="width: 100%">
{{ csrf_field() }}
<input type="hidden" name="ward_id" value="{{ $ward_id }}">
<p class="text-muted m-b-30">Export data to Copy, CSV, Excel, PDF & Print</p>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table table-hover table-striped">
<thead>
<tr>
<th>Sundry Name</th>
<th>{{ !is_null($ward_id) ? get_name($ward_id, "id", "name", "wards") : "" }} Stock</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Sundry Name</th>
<th>{{ !is_null($ward_id) ? get_name($ward_id, "id", "name", "wards") : "" }} Stock</th>
</tr>
</tfoot>
<tbody>
@foreach($ward_stock_records as $record)
@php
$sundry = \Streamline\Models\Sundry::withTrashed()->find($record->item_id);
if (!$sundry) {
continue;
}
@endphp
<tr>
<td>
@if($sundry->insurance_coverage == 1)
<span style="color: green;"> {{ $sundry->name }} </span>
@else
<span style="color: orange;"> {{ $sundry->name }} </span>
@endif
</td>
<td>
<div class="shown_input">
{{ $record->ward_item_stock }}
</div>
<div class="hidden_input" style="display: none;">
<input type="hidden" name="sundry_id[]" value="{{ $sundry->id }}">
<input type="text" name="quantity[]" class="form-control" value="{{ $record->ward_item_stock }}">
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
<div style="padding: 10px; float: right;">
@if( Auth::user()->can('edit-ward-sundry-stock-sheet'))
<button class="btn btn-rounded btn-default" id="cancel_edit" style="display: none;">Cancel</button>
<button class="btn btn-rounded btn-success" id="edit_stock">Edit stock</button>
<input type="submit" value="Save stock" class="btn btn-rounded btn-success" id="save_stock" style="display: none;">
@endif
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
$('#edit_stock').click(function(e){
e.preventDefault();
$('.hidden_input,#save_stock').show();
$('.shown_input').hide();
$(this).hide();
});
$('.expiry_date_input').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
</script>
@endpush
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