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

{{ __('inpatient.incoming_inpatient_bills') }}

@include('flash::message')
{{ Form::open(['route' => 'inpatient_bills.incoming', 'method' => 'POST']) }}
{{ Form::label('ward_id', __('inpatient.wards')) }} {{ Form::select('ward_id', $wards, '', ['class' => 'form-control compulsory', 'required']) }}
{{ Form::label('inpatient_status', __('inpatient.inpatient_status')) }} {{ Form::select('inpatient_status', $inpatient_status, 0, ['class' => 'form-control compulsory', 'required']) }}
{{ 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']) }}

{{ Form::button(__('inpatient.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id'=>'select_patient']) }}
{{ Form::close() }}

@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) @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) ? "" : 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 @endforeach @else @endif
{{ __('inpatient.admission_day_ward_discharge') }} {{ __('inpatient.patient_names') }} {{ __('inpatient.admitted_by') }} {{ __('inpatient.category') }} {{ __('inpatient.ward') }} {{ __('inpatient.total_saved_bill') }} {{ __('inpatient.amount_paid_and_invoiced') }} {{ __('inpatient.balance') }} {{ __('inpatient.bill_last_updated') }} {{ __('inpatient.action') }}
{{ $inpatient_info->id }} {{ 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

{{ $days_on_ward }} {{ __('inpatient.days_on_ward') }} @if($inpatient_info->discharged == 1)

{{ __('inpatient.discharged_on') }} {{ streamline_date($inpatient_info->discharged_on) }} {{ __('inpatient.by') }} {{ get_full_name($inpatient_info->discharged_by, 'id', 'first_name', 'last_name', 'users') }} @endif
{!! insurance_flag($inpatient_info->patient_id) !!} ({{ $inpatient_info->patients_number }}) {{ get_full_name($inpatient_info->created_by, "id", "first_name", "last_name", "users") }} {{ $patient_categories[$inpatient_info->patients_category_id] ?? "" }} {{ $wards[$inpatient_info->ward_id] ?? "" }}{{ ugandan_shillings($original_bill) }} {!! ugandan_shillings($amount_paid_plus_invoices_to_pay) !!} {!! $amount_to_pay !!} {{ 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)

{{ __('inpatient.bill_authorized_by') }}: @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

@endif @endif
Select Patient

View Inpatient Bill

{{ 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() }}
{{ __('inpatient.no_records_found') }}
{{ __('inpatient.total') }} {{ ugandan_shillings($total_bill_sum) }} {{ ugandan_shillings($amount_paid_grand_total) }} {{ ugandan_shillings($amount_to_pay_grand_total) }}
@endsection @push('styles') @endpush @push('scripts') @endpush