@extends('layouts.bill_pdf') @section('content') {{--

{{ $billing->branch->name }}

--}} @php $arr = []; @endphp {{-- @foreach ($billing->invoices as $inv) @php $inv = $inv->invoice; @endphp @if ($inv->institution) @php $arr[] = $inv->institution->name; @endphp @endif @endforeach @if (count($arr) > 0) @php $arr = array_unique($arr); @endphp @foreach ($arr as $item)

{{ $item }}

@endforeach @endif --}}
@if ($billing->billing_month)

Billing for Month of {{ date('F Y', strtotime($billing->billing_month)) }}

@else

@endif @php $institute = ''; @endphp @foreach ($billing->inv as $inst) @if ($inst->institution == $billing->inv[0]->institution) @php $institute = $inst->institution ? $inst->institution->name : ''; @endphp @else @php $institute = ''; @endphp @endif @endforeach

{{ $institute }}


@if ($billing->branch_id == 3) @else @endif @php $overall_cost = 0; @endphp @if ($billing->branch_id == 3) @foreach ($billing->invoices as $inv) @php $inv = $inv->invoice; $total_cost = 0; $overall_cost += $inv->total; @endphp @endforeach @else @foreach ($billing->invoices as $inv) @php $inv = $inv->invoice; $total_cost = 0; @endphp @php $overall_cost += $total_cost; @endphp @endforeach @endif @if ($billing->branch_id == 3) @else @endif
PATIENT ID PATIENT NAME MOTHERS NAME DATE OF BIRTH BARCODE ACCESSION NO. DATE OF SAMPLE RECEPTION COST OTHER/REMARK/S TOTAL COST AMOUNT PAID DATE PREPARED/ GENERATED
REQUEST NO. SURNAME FIRST NAME MOTHER'S NAME DATE OF BIRTH REFERENCE NO. DATE OF SAMPLE RECEPTION TESTS COST OTHERS/REMARKS TOTAL COST
{{ $inv->patient->code }} {{ $inv->patient->name . ' ' . $inv->patient->last_name }} {{ $inv->patient->mother_name }} {{ date('F d, Y', strtotime($inv->patient->dob)) }} {{ $inv->invoice_no }} @foreach ($inv->all_tests->where('cancelled', '!=', 1) as $gt) @if ($gt->sample)

{{ $gt->sample->barcode }}

@else No Sample @endif @endforeach
@foreach ($inv->all_tests->where('cancelled', '!=', 1) as $gt) @if ($gt->sample) @if ($gt->sample->lab_receive_date)

{{ date('F d, Y', strtotime($gt->sample->lab_receive_date)) }}

@else

No Lab Received Date

@endif @else No Sample @endif @endforeach
@php $package_arr = []; @endphp @foreach ($inv->all_tests->where('cancelled', '!=', 1) as $gt) {{-- IF PACKAGE --}} @if ($gt->package) @php if (!in_array($gt->package_id, $package_arr)) { $package_arr[] = $gt->package_id; $total_cost += $gt->package->price; } @endphp

({{ $gt->package->shortcut }}) {{ number_format($gt->package->price, 2) }}

@else @php $total_cost += $gt->price; @endphp

{{ number_format($gt->price, 2) }}

@endif @endforeach {{-- MAILING FEE AND DUPLICATE FEE --}} @php $total_cost += $inv->mailing_fee; $total_cost += $inv->duplicate_fee; @endphp {{ $inv->mailing_fee ? 'Mailing Fee: ' . number_format($inv->mailing_fee, 2) : '' }} {!! $inv->duplicate_fee ? '

Duplicate Fee: ' . number_format($inv->duplicate_fee, 2) . '

' : '' !!}
{{ $inv->bill_remarks }}

{{ number_format($total_cost, 2) }}

{{ date('F d, Y', strtotime($billing->created_at)) }}

{{ $inv->invoice_no }} {{ $inv->patient->last_name }} {{ $inv->patient->name }} {{ $inv->patient->mother_name }} {{ date('F d, Y', strtotime($inv->patient->dob)) }} @foreach ($inv->all_tests->where('cancelled', '!=', 1) as $gt) @if ($gt->sample)

{{ $gt->sample->barcode }}

@else No Sample @endif @endforeach
@foreach ($inv->all_tests->where('cancelled', '!=', 1) as $gt)

{{ $gt->collection_date ? date('F d, Y', strtotime($gt->collection_date)) : '' }}

@endforeach
@foreach ($inv->all_tests->where('cancelled', '!=', 1) as $gt)

{{ $gt->test->name }}

@if ($loop->last) {{ $inv->mailing_fee ? 'Mailing Fee:' : '' }} {!! $inv->duplicate_fee ? '
Duplicate Fee:' : '' !!} @endif @endforeach
@php $package_arr = []; @endphp @foreach ($inv->all_tests->where('cancelled', '!=', 1) as $gt) {{-- IF PACKAGE --}} @if ($gt->package) @php if (!in_array($gt->package_id, $package_arr)) { $package_arr[] = $gt->package_id; $total_cost += $gt->package->price; } @endphp

({{ $gt->package->shortcut }}) {{ number_format($gt->package->price, 2) }}

@else @php $total_cost += $gt->price; @endphp

{{ number_format($gt->price, 2) }}

@endif @if ($loop->last) @php $total_cost += $inv->mailing_fee; $total_cost += $inv->duplicate_fee; @endphp {{ $inv->mailing_fee ? number_format($inv->mailing_fee, 2) : '' }} {!! $inv->duplicate_fee ? '

' . number_format($inv->duplicate_fee, 2) . '

' : '' !!} @endif @endforeach
{{ $inv->bill_remarks }} {{ number_format($total_cost, 2) }}
Nothing FollowsNothing FollowsTOTAL Php {{ number_format($overall_cost, 2) }}
Prepared By Reviewed By Approved By
@if ($billing->generated_by_user) img @endif @if ($billing->reviewed_by_user) img @endif @if ($billing->approved_by_user) img @endif
___________________ ___________________ ___________________
{{ $billing->generated_by_user ? $billing->generated_by_user->name . ' ' . $billing->generated_by_user->last_name : '' }} {{ $billing->reviewed_by_user ? $billing->reviewed_by_user->name . ' ' . $billing->reviewed_by_user->last_name : '' }} {{ $billing->approved_by_user ? $billing->approved_by_user->name . ' ' . $billing->approved_by_user->last_name : '' }}
@endsection