@extends('layouts.main') @push('styles') @endpush @section('content')

{{ __('pharmacy.incoming_prescriptions') }}

{{ Form::open(['method'=>'post','route' => 'pharmacy.search', 'class' => 'typeahead']) }} {{ Form::hidden('patient_id', 0, ['id' => 'patient_id']) }}
{{ Form::label('search_patient', __('pharmacy.search_by_patient')) }}
{{ Form::submit(__('pharmacy.submit'), ['class'=>'btn btn-success pull-right']) }}
{{ Form::close() }}
@include('flash::message') @if(isset($display))

{!! isset($display) ? $display : '' !!}

@endif
@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 @php $episode = \Streamline\Models\PatientEpisode::where('id', $prescription->episode_id)->pluck('paid_over')->first(); @endphp @endforeach @else @endif
{{ __('pharmacy.date') }} {{ __('pharmacy.patient_number') }} {{ __('pharmacy.patient_name') }} {{ __('pharmacy.patient_category') }} {{ __('pharmacy.payment') }} {{ __('pharmacy.amount') }} {{ __('pharmacy.ward') }} {{ __('pharmacy.prescribed_by') }} {{ __('pharmacy.actions') }}
{{ streamline_date_time_short($prescription->created_at) }} {{ get_name($prescription->patient_id, 'id', 'number', 'patients') }} {!! insurance_flag($prescription->patient_id) !!} {{ isset($categories[get_name($prescription->patient_id, 'id', 'category_id', 'patients')]) ? $categories[get_name($prescription->patient_id, 'id', 'category_id', 'patients')] : "" }} {!! $prescription->payment_status == 1 ? "" : "" !!} {{ ugandan_shillings($grand_total_for_treatment) }} @if($prescription->tta == 1) {{ get_ward_name($prescription->patient_id, $prescription->episode_id) }} @else @endif {{ get_full_name($prescription->created_by, 'id', 'first_name', 'last_name', 'users') }} @if($prescription->payment_status == 1)
{{ csrf_field() }}
@else @endif
{{ __('pharmacy.no_incoming_prescriptions') }}
@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 @endforeach @else @endif
{{ __('pharmacy.date') }} {{ __('pharmacy.patient_number') }} {{ __('pharmacy.patient_name') }} {{ __('pharmacy.patient_category') }} {{ __('pharmacy.payment') }} {{ __('pharmacy.amount') }} {{ __('pharmacy.ward') }} {{ __('pharmacy.prescribed_by') }} {{ __('pharmacy.actions') }}
{{ streamline_date_time_short($prescription->created_at) }} {{ get_name($prescription->patient_id, 'id', 'number', 'patients') }} {!! insurance_flag($prescription->patient_id) !!} {{ isset($categories[get_name($prescription->patient_id, 'id', 'category_id', 'patients')]) ? $categories[get_name($prescription->patient_id, 'id', 'category_id', 'patients')] : "" }} {!! ($prescription->inpatient_bill_generated == 1) ? "" : "" !!} {{ ugandan_shillings($grand_total_for_treatment) }} @if($prescription->tta == 1) {{ get_ward_name($prescription->patient_id, $prescription->episode_id) }} @else @endif {{ get_full_name($prescription->created_by, 'id', 'first_name', 'last_name', 'users') }} @if(is_dispense_unpaid_prescription_enabled($prescription->patient_id))
{{ csrf_field() }}
@else @if($prescription->payment_status == 1 || $prescription->inpatient_bill_generated == 1)
{{ csrf_field() }}
@else @endif @endif
{{ __('pharmacy.no_incoming_prescriptions') }}
@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 @endforeach @else @endif
{{ __('pharmacy.date') }} {{ __('pharmacy.patient_number') }} {{ __('pharmacy.patient_name') }} {{ __('pharmacy.patient_category') }} {{ __('pharmacy.payment') }} {{ __('pharmacy.amount') }} {{ __('pharmacy.ward') }} {{ __('pharmacy.prescribed_by') }} {{ __('pharmacy.actions') }}
{{ streamline_date_time_short($prescription->created_at) }} {{ get_name($prescription->patient_id, 'id', 'number', 'patients') }} {!! insurance_flag($prescription->patient_id) !!} {{ isset($categories[get_name($prescription->patient_id, 'id', 'category_id', 'patients')]) ? $categories[get_name($prescription->patient_id, 'id', 'category_id', 'patients')] : "" }} {!! $prescription->payment_status == 1 ? "" : "" !!} {{ ugandan_shillings($grand_total_for_treatment) }} @if($prescription->tta == 1) {{ get_ward_name($prescription->patient_id, $prescription->episode_id) }} @else @endif {{ get_full_name($prescription->created_by, 'id', 'first_name', 'last_name', 'users') }}
{{ csrf_field() }}
{{ __('pharmacy.no_incoming_prescriptions') }}
@endsection @push('scripts') @endpush @push('styles') @endpush