mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-12 03:01:32 +00:00
696 lines
52 KiB
PHP
Executable File
696 lines
52 KiB
PHP
Executable File
@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('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
|
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-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">{{ __('pharmacy.incoming_prescriptions') }}</h4>
|
|
</div>
|
|
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
|
<ol class="breadcrumb">
|
|
<li><a href="{{ route('home') }}">{{ __('pharmacy.dashboard') }}</a></li>
|
|
<li><a href="{{ route('pharmacy.index') }}">{{ __('pharmacy.pharmacist') }}</a></li>
|
|
<li class="active">{{ __('pharmacy.incoming_prescriptions') }}</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="panel panel-default" style="border-radius: 5px;">
|
|
<div class="panel-body">
|
|
{{ Form::open(['method'=>'post','route' => 'pharmacy.search', 'class' => 'typeahead']) }}
|
|
|
|
{{ Form::hidden('patient_id', 0, ['id' => 'patient_id']) }}
|
|
|
|
<div class="row">
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
<label>{{ __('pharmacy.select_date') }}:</label>
|
|
<select class="form-control compulsory required" name="dates" id="dates" required>
|
|
<option value="today">{{ __('pharmacy.today') }}</option>
|
|
<option value="yesterday">{{ __('pharmacy.yesterday') }}</option>
|
|
<option value="custom_date">{{ __('pharmacy.custom_date') }}</option>
|
|
<option value="custom_date_range">{{ __('pharmacy.date_range') }}</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2" id="sDate" style="display: none;">
|
|
<div class="form-group">
|
|
{{ Form::label('start_date', __('pharmacy.date_on')) }}
|
|
<div class="input-group">
|
|
{{ Form::text('start_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'start_date']) }}
|
|
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2" id="eDate" style="display: none;">
|
|
<div class="form-group">
|
|
{{ Form::label('end_date', __('pharmacy.end_date')) }}
|
|
<div class="input-group">
|
|
{{ Form::text('end_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'end_date']) }}
|
|
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
{{ Form::label('search_patient', __('pharmacy.search_by_patient')) }}
|
|
<div class="input-group">
|
|
<select class="form-control" name="patient_number" id="patient_number"></select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-2">
|
|
<div class="form-group" style="margin-top: 25px;">
|
|
{{ Form::submit(__('pharmacy.submit'), ['class'=>'btn btn-success pull-right']) }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{ Form::close() }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
@include('flash::message')
|
|
@if(isset($display))
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="panel" style="border-radius: 5px;">
|
|
<div class="panel-body">
|
|
<h3 class="label label-info col-lg-5"> {!! isset($display) ? $display : '' !!}</h3>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<ul class="nav nav-tabs" role="tablist">
|
|
<li role="presentation" class="active nav-item"> <a href="#pending_paid" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> {{ __('pharmacy.paid_but_pending') }}</a> </li>
|
|
<li role="presentation" class="nav-item"> <a href="#pending_unpaid" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> {{ __('pharmacy.unpaid_and_pending') }}</a> </li>
|
|
<li role="presentation" class="nav-item"> <a href="#paid_dispensed" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> {{ __('pharmacy.paid_and_dispensed') }}</a> </li>
|
|
<li role="presentation" class="nav-item"> <a href="#unpaid_dispensed" class="nav-link" aria-controls="home" role="tab" data-toggle="tab" aria-expanded="true"> {{ __('pharmacy.unpaid_but_dispensed') }}</a> </li>
|
|
</ul>
|
|
</div>
|
|
<div class="card-block">
|
|
<div class="tab-content">
|
|
<div id="pending_paid" class="tab-pane active">
|
|
<div class="table-responsive">
|
|
<table class="table table-striped color-bordered-table success-bordered-table">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ __('pharmacy.date') }}</th>
|
|
<th>{{ __('pharmacy.patient_number') }}</th>
|
|
<th>{{ __('pharmacy.patient_name') }}</th>
|
|
<th>{{ __('pharmacy.patient_category') }}</th>
|
|
<th>{{ __('pharmacy.payment') }}</th>
|
|
<th>{{ __('pharmacy.amount') }}</th>
|
|
<th>{{ __('pharmacy.ward') }}</th>
|
|
<th>{{ __('pharmacy.prescribed_by') }}</th>
|
|
<th>{{ __('pharmacy.actions') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@if(count($pending_paid_prescriptions) > 0)
|
|
@foreach($pending_paid_prescriptions as $prescription)
|
|
@php
|
|
$treatment_amount = 0;
|
|
$treatment_amount_total = 0;
|
|
$insurance_amount = 0;
|
|
$insurance_amount_total = 0;
|
|
$grand_total_for_treatment = 0;
|
|
|
|
// ids of the ordered drugs
|
|
$drug_ids = explode(",", $prescription->drugs);
|
|
|
|
// quantities of the ordered drugs
|
|
$drug_quantities = explode(",", $prescription->quantities_dispensed);
|
|
|
|
|
|
for ($i = 0; $i < count($drug_ids); $i++){
|
|
if(get_name($drug_ids[$i], "id", "name", "drugs") != "N/A"){
|
|
// get insurance status for drug
|
|
$drug_insurance_status = get_name($drug_ids[$i], "id", "insurance_coverage", "drugs");
|
|
|
|
// insurance flag
|
|
$is_insured = 0;
|
|
$insurance_amount = 0;
|
|
|
|
// get insurance status for drug
|
|
$drug_insurance_status = get_name($drug_ids[$i], "id", "insurance_coverage", "drugs");
|
|
|
|
// check if the patient category is attached to a price list
|
|
$price_list_id = is_patient_category_attached_to_price_list($prescription->patient_id);
|
|
if ($price_list_id) {
|
|
$treatment_amount = get_price_list_category_price($price_list_id, 3, $drug_ids[$i]);
|
|
} else {
|
|
// check if drug and patient is eligible for insurance
|
|
if($drug_insurance_status == 1 && patient_insurance_status($prescription->patient_id) == 1){
|
|
$treatment_amount = get_name($drug_ids[$i], "id", "insured_price", "drugs");
|
|
$insurance_amount = get_name($drug_ids[$i], "id", "non_insured_price", "drugs") - $treatment_amount;
|
|
$is_insured = 1;
|
|
} else {
|
|
$treatment_amount = get_name($drug_ids[$i], "id", "non_insured_price", "drugs");
|
|
}
|
|
}
|
|
|
|
if(isset($drug_quantities[$i]) && $drug_quantities[$i] != ""){
|
|
$treatment_subtotal = $drug_quantities[$i] * $treatment_amount;
|
|
$insurance_amount *= $drug_quantities[$i];
|
|
} else {
|
|
$treatment_subtotal = 0;
|
|
}
|
|
|
|
// add amounts to totals
|
|
$treatment_amount_total += $treatment_amount;
|
|
$insurance_amount_total += $insurance_amount;
|
|
$grand_total_for_treatment += $treatment_subtotal;
|
|
}
|
|
}
|
|
@endphp
|
|
<tr>
|
|
<td>{{ streamline_date_time_short($prescription->created_at) }}</td>
|
|
<td>{{ get_name($prescription->patient_id, 'id', 'number', 'patients') }}</td>
|
|
<td>{!! insurance_flag($prescription->patient_id) !!}</td>
|
|
<td>{{ isset($categories[get_name($prescription->patient_id, 'id', 'category_id', 'patients')]) ? $categories[get_name($prescription->patient_id, 'id', 'category_id', 'patients')] : "" }}</td>
|
|
<td>{!! $prescription->payment_status == 1 ? "<label class='label label-success'>Paid</label>" : "<label class='label label-danger'>Not Paid</label>" !!}</td>
|
|
<td>
|
|
{{ ugandan_shillings($grand_total_for_treatment) }}
|
|
</td>
|
|
<td>
|
|
@if($prescription->tta == 1)
|
|
{{ get_ward_name($prescription->patient_id, $prescription->episode_id) }}
|
|
@else
|
|
<label class="label label-info" style='font-size: x-small'>OPD</label>
|
|
@endif
|
|
</td>
|
|
<td>{{ get_full_name($prescription->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
|
|
@php
|
|
$episode = \Streamline\Models\PatientEpisode::where('id', $prescription->episode_id)->pluck('paid_over')->first();
|
|
@endphp
|
|
<td>
|
|
@if($prescription->payment_status == 1)
|
|
<div class="row">
|
|
<div class="col-8">
|
|
<form action="{{ url('view_dispensing_details') }}" method="post">
|
|
{{ csrf_field() }}
|
|
<input value="{{ $prescription->id }}" type="hidden" name="treatment_id"/>
|
|
<input value="{{ $prescription->patient_id }}" type="hidden" name="patient_id"/>
|
|
<input value="{{ $prescription->episode_id }}" type="hidden" name="episode_id"/>
|
|
<button type="submit" class="btn btn-success btn-rounded btn-sm">{{ __('pharmacy.dispense') }}</button>
|
|
</form>
|
|
</div>
|
|
<div class="col-4"></div>
|
|
</div>
|
|
@else
|
|
<button class="btn btn-success btn-rounded btn-sm" disabled>{{ __('pharmacy.dispense') }}</button>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
@else
|
|
<tr>
|
|
<td class="text-center" style="color: red" colspan="7">{{ __('pharmacy.no_incoming_prescriptions') }}</td>
|
|
</tr>
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div id="pending_unpaid" class="tab-pane">
|
|
<div class="table-responsive">
|
|
<table class="table table-striped color-bordered-table success-bordered-table table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ __('pharmacy.date') }}</th>
|
|
<th>{{ __('pharmacy.patient_number') }}</th>
|
|
<th>{{ __('pharmacy.patient_name') }}</th>
|
|
<th>{{ __('pharmacy.patient_category') }}</th>
|
|
<th>{{ __('pharmacy.payment') }}</th>
|
|
<th>{{ __('pharmacy.amount') }}</th>
|
|
<th>{{ __('pharmacy.ward') }}</th>
|
|
<th>{{ __('pharmacy.prescribed_by') }}</th>
|
|
<th>{{ __('pharmacy.actions') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@if(count($pending_unpaid_prescriptions) > 0)
|
|
@foreach($pending_unpaid_prescriptions as $prescription)
|
|
@php
|
|
$treatment_amount = 0;
|
|
$treatment_amount_total = 0;
|
|
$insurance_amount = 0;
|
|
$insurance_amount_total = 0;
|
|
$grand_total_for_treatment = 0;
|
|
|
|
// ids of the ordered drugs
|
|
$drug_ids = explode(",", $prescription->drugs);
|
|
|
|
// quantities of the ordered drugs
|
|
$drug_quantities = explode(",", $prescription->quantities_dispensed);
|
|
|
|
|
|
for ($i = 0; $i < count($drug_ids); $i++){
|
|
if(get_name($drug_ids[$i], "id", "name", "drugs") != "N/A"){
|
|
// get insurance status for drug
|
|
$drug_insurance_status = get_name($drug_ids[$i], "id", "insurance_coverage", "drugs");
|
|
|
|
// insurance flag
|
|
$is_insured = 0;
|
|
$insurance_amount = 0;
|
|
|
|
// get insurance status for drug
|
|
$drug_insurance_status = get_name($drug_ids[$i], "id", "insurance_coverage", "drugs");
|
|
|
|
// check if the patient category is attached to a price list
|
|
$price_list_id = is_patient_category_attached_to_price_list($prescription->patient_id);
|
|
if ($price_list_id) {
|
|
$treatment_amount = get_price_list_category_price($price_list_id, 3, $drug_ids[$i]);
|
|
} else {
|
|
// check if drug and patient is eligible for insurance
|
|
if($drug_insurance_status == 1 && patient_insurance_status($prescription->patient_id) == 1){
|
|
$treatment_amount = get_name($drug_ids[$i], "id", "insured_price", "drugs");
|
|
$insurance_amount = get_name($drug_ids[$i], "id", "non_insured_price", "drugs") - $treatment_amount;
|
|
$is_insured = 1;
|
|
} else {
|
|
$treatment_amount = get_name($drug_ids[$i], "id", "non_insured_price", "drugs");
|
|
}
|
|
}
|
|
|
|
if(isset($drug_quantities[$i]) && $drug_quantities[$i] != ""){
|
|
$treatment_subtotal = $drug_quantities[$i] * $treatment_amount;
|
|
$insurance_amount *= $drug_quantities[$i];
|
|
} else {
|
|
$treatment_subtotal = 0;
|
|
}
|
|
|
|
// add amounts to totals
|
|
$treatment_amount_total += $treatment_amount;
|
|
$insurance_amount_total += $insurance_amount;
|
|
$grand_total_for_treatment += $treatment_subtotal;
|
|
}
|
|
}
|
|
@endphp
|
|
<tr>
|
|
<td>{{ streamline_date_time_short($prescription->created_at) }}</td>
|
|
<td>{{ get_name($prescription->patient_id, 'id', 'number', 'patients') }}</td>
|
|
<td>{!! insurance_flag($prescription->patient_id) !!}</td>
|
|
<td>{{ isset($categories[get_name($prescription->patient_id, 'id', 'category_id', 'patients')]) ? $categories[get_name($prescription->patient_id, 'id', 'category_id', 'patients')] : "" }}</td>
|
|
<td>{!! ($prescription->inpatient_bill_generated == 1) ? "<label class='label label-success'>Added to Inpatient Bill</label>" : "<label class='label label-danger'>Not Paid</label>" !!}</td>
|
|
<td>
|
|
{{ ugandan_shillings($grand_total_for_treatment) }}
|
|
</td>
|
|
<td>
|
|
@if($prescription->tta == 1)
|
|
{{ get_ward_name($prescription->patient_id, $prescription->episode_id) }}
|
|
@else
|
|
<label class="label label-info" style='font-size: x-small'>OPD</label>
|
|
@endif
|
|
</td>
|
|
<td>{{ get_full_name($prescription->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
|
|
<td>
|
|
@if(is_dispense_unpaid_prescription_enabled($prescription->patient_id))
|
|
<form action="{{ url('view_dispensing_details') }}" method="post">
|
|
{{ csrf_field() }}
|
|
<input value="{{ $prescription->id }}" type="hidden" name="treatment_id"/>
|
|
<input value="{{ $prescription->patient_id }}" type="hidden" name="patient_id"/>
|
|
<input value="{{ $prescription->episode_id }}" type="hidden" name="episode_id"/>
|
|
<button type="submit" class="btn btn-success btn-rounded btn-sm">{{ __('pharmacy.dispense') }}</button>
|
|
</form>
|
|
@else
|
|
@if($prescription->payment_status == 1 || $prescription->inpatient_bill_generated == 1)
|
|
<form action="{{ url('view_dispensing_details') }}" method="post">
|
|
{{ csrf_field() }}
|
|
<input value="{{ $prescription->id }}" type="hidden" name="treatment_id"/>
|
|
<input value="{{ $prescription->patient_id }}" type="hidden" name="patient_id"/>
|
|
<input value="{{ $prescription->episode_id }}" type="hidden" name="episode_id"/>
|
|
<button type="submit" class="btn btn-success btn-rounded btn-sm">{{ __('pharmacy.dispense') }}</button>
|
|
</form>
|
|
@else
|
|
<button class="btn btn-success btn-rounded btn-sm" disabled>{{ __('pharmacy.dispense') }}</button>
|
|
@endif
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
@else
|
|
<tr>
|
|
<td class="text-center" style="color: red" colspan="8">{{ __('pharmacy.no_incoming_prescriptions') }}</td>
|
|
</tr>
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div id="paid_dispensed" class="tab-pane">
|
|
<div class="table-responsive">
|
|
<table class="table table-striped color-bordered-table success-bordered-table table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ __('pharmacy.date') }}</th>
|
|
<th>{{ __('pharmacy.patient_number') }}</th>
|
|
<th>{{ __('pharmacy.patient_name') }}</th>
|
|
<th>{{ __('pharmacy.patient_category') }}</th>
|
|
<th>{{ __('pharmacy.payment') }}</th>
|
|
<th>{{ __('pharmacy.amount') }}</th>
|
|
<th>{{ __('pharmacy.ward') }}</th>
|
|
<th>{{ __('pharmacy.prescribed_by') }}</th>
|
|
<th>{{ __('pharmacy.actions') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@if(count($confirmed_paid_prescriptions) > 0)
|
|
@foreach($confirmed_paid_prescriptions as $prescription)
|
|
@php
|
|
$treatment_amount = 0;
|
|
$treatment_amount_total = 0;
|
|
$insurance_amount = 0;
|
|
$insurance_amount_total = 0;
|
|
$grand_total_for_treatment = 0;
|
|
|
|
// ids of the ordered drugs
|
|
$drug_ids = explode(",", $prescription->drugs);
|
|
|
|
// quantities of the ordered drugs
|
|
$drug_quantities = explode(",", $prescription->quantities_dispensed);
|
|
|
|
|
|
for ($i = 0; $i < count($drug_ids); $i++){
|
|
if(get_name($drug_ids[$i], "id", "name", "drugs") != "N/A"){
|
|
// get insurance status for drug
|
|
$drug_insurance_status = get_name($drug_ids[$i], "id", "insurance_coverage", "drugs");
|
|
|
|
// insurance flag
|
|
$is_insured = 0;
|
|
$insurance_amount = 0;
|
|
|
|
// get insurance status for drug
|
|
$drug_insurance_status = get_name($drug_ids[$i], "id", "insurance_coverage", "drugs");
|
|
|
|
// check if the patient category is attached to a price list
|
|
$price_list_id = is_patient_category_attached_to_price_list($prescription->patient_id);
|
|
if ($price_list_id) {
|
|
$treatment_amount = get_price_list_category_price($price_list_id, 3, $drug_ids[$i]);
|
|
} else {
|
|
// check if drug and patient is eligible for insurance
|
|
if($drug_insurance_status == 1 && patient_insurance_status($prescription->patient_id) == 1){
|
|
$treatment_amount = get_name($drug_ids[$i], "id", "insured_price", "drugs");
|
|
$insurance_amount = get_name($drug_ids[$i], "id", "non_insured_price", "drugs") - $treatment_amount;
|
|
$is_insured = 1;
|
|
} else {
|
|
$treatment_amount = get_name($drug_ids[$i], "id", "non_insured_price", "drugs");
|
|
}
|
|
}
|
|
|
|
if(isset($drug_quantities[$i]) && $drug_quantities[$i] != ""){
|
|
$treatment_subtotal = $drug_quantities[$i] * $treatment_amount;
|
|
$insurance_amount *= $drug_quantities[$i];
|
|
} else {
|
|
$treatment_subtotal = 0;
|
|
}
|
|
|
|
// add amounts to totals
|
|
$treatment_amount_total += $treatment_amount;
|
|
$insurance_amount_total += $insurance_amount;
|
|
$grand_total_for_treatment += $treatment_subtotal;
|
|
}
|
|
}
|
|
@endphp
|
|
<tr>
|
|
<td>{{ streamline_date_time_short($prescription->created_at) }}</td>
|
|
<td>{{ get_name($prescription->patient_id, 'id', 'number', 'patients') }}</td>
|
|
<td>{!! insurance_flag($prescription->patient_id) !!}</td>
|
|
<td>{{ isset($categories[get_name($prescription->patient_id, 'id', 'category_id', 'patients')]) ? $categories[get_name($prescription->patient_id, 'id', 'category_id', 'patients')] : "" }}</td>
|
|
<td>{!! $prescription->payment_status == 1 ? "<label class='label label-success'>Paid</label>" : "<label class='label label-danger'>Not Paid</label>" !!}</td>
|
|
<td>
|
|
{{ ugandan_shillings($grand_total_for_treatment) }}
|
|
</td>
|
|
<td>
|
|
@if($prescription->tta == 1)
|
|
{{ get_ward_name($prescription->patient_id, $prescription->episode_id) }}
|
|
@else
|
|
<label class="label label-info" style='font-size: x-small'>OPD</label>
|
|
@endif
|
|
</td>
|
|
<td>{{ get_full_name($prescription->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
|
|
<td>
|
|
<form action="{{ url('dispensed_details_review') }}" method="post">
|
|
{{ csrf_field() }}
|
|
<input value="{{ $prescription->id }}" type="hidden" name="treatment_id">
|
|
<input value="{{ $prescription->patient_id }}" type="hidden" name="patient_id">
|
|
<input value="{{ $prescription->episode_id }}" type="hidden" name="episode_id">
|
|
<button type="submit" class="btn btn-info btn-rounded btn-sm">{{ __('pharmacy.view') }}</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
@else
|
|
<tr>
|
|
<td class="text-center" style="color: red" colspan="8">{{ __('pharmacy.no_incoming_prescriptions') }}</td>
|
|
</tr>
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div id="unpaid_dispensed" class="tab-pane">
|
|
<div class="table-responsive">
|
|
<table class="table table-striped color-bordered-table success-bordered-table table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ __('pharmacy.date') }}</th>
|
|
<th>{{ __('pharmacy.patient_number') }}</th>
|
|
<th>{{ __('pharmacy.patient_name') }}</th>
|
|
<th>{{ __('pharmacy.patient_category') }}</th>
|
|
<th>{{ __('pharmacy.payment') }}</th>
|
|
<th>{{ __('pharmacy.amount') }}</th>
|
|
<th>{{ __('pharmacy.ward') }}</th>
|
|
<th>{{ __('pharmacy.prescribed_by') }}</th>
|
|
<th>{{ __('pharmacy.actions') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@if(count($confirmed_unpaid_prescriptions) > 0)
|
|
@foreach($confirmed_unpaid_prescriptions as $prescription)
|
|
@php
|
|
$treatment_amount = 0;
|
|
$treatment_amount_total = 0;
|
|
$insurance_amount = 0;
|
|
$insurance_amount_total = 0;
|
|
$grand_total_for_treatment = 0;
|
|
|
|
// ids of the ordered drugs
|
|
$drug_ids = explode(",", $prescription->drugs);
|
|
|
|
// quantities of the ordered drugs
|
|
$drug_quantities = explode(",", $prescription->quantities_dispensed);
|
|
|
|
|
|
for ($i = 0; $i < count($drug_ids); $i++){
|
|
if(get_name($drug_ids[$i], "id", "name", "drugs") != "N/A"){
|
|
// get insurance status for drug
|
|
$drug_insurance_status = get_name($drug_ids[$i], "id", "insurance_coverage", "drugs");
|
|
|
|
// insurance flag
|
|
$is_insured = 0;
|
|
$insurance_amount = 0;
|
|
|
|
// get insurance status for drug
|
|
$drug_insurance_status = get_name($drug_ids[$i], "id", "insurance_coverage", "drugs");
|
|
|
|
// check if the patient category is attached to a price list
|
|
$price_list_id = is_patient_category_attached_to_price_list($prescription->patient_id);
|
|
if ($price_list_id) {
|
|
$treatment_amount = get_price_list_category_price($price_list_id, 3, $drug_ids[$i]);
|
|
} else {
|
|
// check if drug and patient is eligible for insurance
|
|
if($drug_insurance_status == 1 && patient_insurance_status($prescription->patient_id) == 1){
|
|
$treatment_amount = get_name($drug_ids[$i], "id", "insured_price", "drugs");
|
|
$insurance_amount = get_name($drug_ids[$i], "id", "non_insured_price", "drugs") - $treatment_amount;
|
|
$is_insured = 1;
|
|
} else {
|
|
$treatment_amount = get_name($drug_ids[$i], "id", "non_insured_price", "drugs");
|
|
}
|
|
}
|
|
|
|
if(isset($drug_quantities[$i]) && $drug_quantities[$i] != ""){
|
|
$treatment_subtotal = $drug_quantities[$i] * $treatment_amount;
|
|
$insurance_amount *= $drug_quantities[$i];
|
|
} else {
|
|
$treatment_subtotal = 0;
|
|
}
|
|
|
|
// add amounts to totals
|
|
$treatment_amount_total += $treatment_amount;
|
|
$insurance_amount_total += $insurance_amount;
|
|
$grand_total_for_treatment += $treatment_subtotal;
|
|
}
|
|
}
|
|
@endphp
|
|
<tr>
|
|
<td>{{ streamline_date_time_short($prescription->created_at) }}</td>
|
|
<td>{{ get_name($prescription->patient_id, 'id', 'number', 'patients') }}</td>
|
|
<td>{!! insurance_flag($prescription->patient_id) !!}</td>
|
|
<td>{{ isset($categories[get_name($prescription->patient_id, 'id', 'category_id', 'patients')]) ? $categories[get_name($prescription->patient_id, 'id', 'category_id', 'patients')] : "" }}</td>
|
|
<td>{!! $prescription->payment_status == 1 ? "<label class='label label-success'>Paid</label>" : "<label class='label label-danger'>Not Paid</label>" !!}</td>
|
|
<td>
|
|
{{ ugandan_shillings($grand_total_for_treatment) }}
|
|
</td>
|
|
<td>
|
|
@if($prescription->tta == 1)
|
|
{{ get_ward_name($prescription->patient_id, $prescription->episode_id) }}
|
|
@else
|
|
<label class="label label-info" style='font-size: x-small'>OPD</label>
|
|
@endif
|
|
</td>
|
|
<td>{{ get_full_name($prescription->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
|
|
<td>
|
|
<form action="{{ url('dispensed_details_review') }}" method="post">
|
|
{{ csrf_field() }}
|
|
<input value="{{ $prescription->id }}" type="hidden" name="treatment_id">
|
|
<input value="{{ $prescription->patient_id }}" type="hidden" name="patient_id">
|
|
<input value="{{ $prescription->episode_id }}" type="hidden" name="episode_id">
|
|
<button type="submit" class="btn btn-info btn-rounded btn-sm">{{ __('pharmacy.view') }}</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
@else
|
|
<tr>
|
|
<td class="text-center" style="color: red" colspan="8">{{ __('pharmacy.no_incoming_prescriptions') }}</td>
|
|
</tr>
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<!-- Date Picker Plugin JavaScript -->
|
|
<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>
|
|
|
|
$('#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
|
|
}
|
|
});
|
|
|
|
$('#dates').change(function (e) {
|
|
|
|
if($(this).val() === "custom_date"){
|
|
|
|
$("#eDate").hide();
|
|
$("#sDate").show();
|
|
|
|
}else if($(this).val() === "custom_date_range"){
|
|
|
|
$("#sDate").show();
|
|
$("#eDate").show();
|
|
}else{
|
|
|
|
$("#eDate").hide();
|
|
$("#sDate").hide();
|
|
}
|
|
});
|
|
|
|
$('#end_date').datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true,
|
|
format: 'dd-mm-yyyy'
|
|
});
|
|
|
|
$('#start_date').datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true,
|
|
format: 'dd-mm-yyyy'
|
|
});
|
|
|
|
$('.table').DataTable({
|
|
dom: 'Bfrtip',
|
|
buttons: [
|
|
'copy', 'csv', 'excel', 'pdf', 'print'
|
|
],
|
|
"aoColumnDefs": [{
|
|
"aTargets": [2,3],
|
|
"defaultContent": "",
|
|
}],
|
|
"pageLength": 25
|
|
});
|
|
|
|
$('#staff_member').select2({
|
|
placeholder: "-- select --"
|
|
});
|
|
$('#staff_member_accountant').select2({
|
|
placeholder: "-- select --"
|
|
});
|
|
</script>
|
|
@endpush
|
|
|
|
@push('styles')
|
|
<style type="text/css">
|
|
.nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link.active {
|
|
background-color: #a8b5b1;
|
|
border-color: #ddd #ddd #fff;
|
|
}
|
|
|
|
.nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link:hover {
|
|
background-color: #a8b5b1;
|
|
}
|
|
|
|
.nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus {
|
|
color: #555;
|
|
background-color: #a8b5b1;
|
|
}
|
|
</style>
|
|
@endpush |