@foreach($data as $info)

{{ $info['cliniccenter']['name'] ?? '--' }}

{{ __('messages.invoice_id') }} #{{ $info['id'] ?? '--' }}

@php $setting = App\Models\Setting::where('name', 'date_formate')->first(); $dateformate = $setting ? $setting->val : 'Y-m-d'; $setting = App\Models\Setting::where('name', 'time_formate')->first(); $timeformate = $setting ? $setting->val : 'h:i A'; $createdDate = date($dateformate, strtotime($info['appointment_date'] ?? '--' )); $createdTime = date($timeformate, strtotime($info['appointment_time'] ?? '--' )); @endphp

{{ __('messages.appointment_at') }}: {{ $createdDate }}

{{ __('messages.appointment_time') }}: {{ $createdTime }}

{{ $info['cliniccenter']['address'] ?? '--' }}

{{ $info['cliniccenter']['email'] ?? '--' }}

{{ __('messages.payment_status') }} @if($info['appointmenttransaction']['payment_status'] == 1) {{ __('messages.paid') }} @else {{ __('messages.unpaid') }} @endif


{{ __('messages.patient_detail') }}

@if($info['user']['date_of_birth'] !== null) @else @endif
{{ __('messages.patient_name') }} {{ __('messages.patient_gender') }} {{ __('messages.patient_dob') }}
{{ $info['user']['first_name'] .''.$info['user']['last_name'] ?? '--' }} {{ $info['user']['gender'] ?? '--' }}{{ date($dateformate, strtotime($info['user']['date_of_birth'])) ?? '--' }}-

@if(isset($info['patient_encounter']))

{{ __('messages.service') }}

@php $index = 1 @endphp @foreach ($info['patient_encounter']['billingrecord']['billing_item'] as $billingItem) @if($billingItem['discount_value'] != 0) @if ($billingItem['discount_type'] === 'percentage') @else @endif @else @endif @php $index++ @endphp @endforeach @if($info['clinicservice'] == null) @endif
{{ __('messages.sr_no') }} {{ __('messages.item_name') }} {{ __('messages.price') }} {{ __('service.inclusive_tax') }} {{ __('messages.total') }}
{{ $index }}{{ $billingItem['clinicservice']['name'] ?? '--' }} ({{ $billingItem['discount_value'] ?? '--' }}%){{ $billingItem['clinicservice']['name'] ?? '--' }} ({{ Currency::format($billingItem['discount_value']) ?? '--' }}){{ $billingItem['clinicservice']['name'] ?? '--' }}{{ Currency::format($billingItem['service_amount']) ?? '--' }} {{ Currency::format($billingItem['inclusive_tax_amount']) ?? '--' }} {{ Currency::format($billingItem['total_amount']) ?? '--' }}

{{ __('messages.no_record_found') }}

@endif
@php $service_total_amount = 0; $total_tax = 0; @endphp @foreach (optional(optional($info['patient_encounter'])['billingrecord'])['billing_item'] as $item) @php $service_total_amount += $item['total_amount']; @endphp @endforeach @if($info['appointmenttransaction']['tax_percentage'] !== null) @php $tax = $info['appointmenttransaction']['tax_percentage']; $taxData = json_decode($tax, true); $total_amount = $info['service_price'] ?? 0; $transaction = optional(optional($info['patient_encounter'])['billingrecord']) ? optional(optional($info['patient_encounter'])['billingrecord']) : null; if($transaction['final_discount_type'] == 'percentage'){ $discount_amount = $service_total_amount * ($transaction['final_discount_value'] / 100); }else{ $discount_amount = $transaction['final_discount_value']; } $sub_total = $service_total_amount - $discount_amount; @endphp

{{ __('report.lbl_tax_details') }}

@php $index = 1; $totalTax = 0; @endphp @foreach($taxData as $taxPercentage) @php $taxTitle = $taxPercentage['title']; @endphp @php $index++ @endphp @endforeach
{{ __('messages.sr_no') }} {{ __('messages.tax_name') }}
{{ __('messages.charges') }}
{{ $index }} @if($taxPercentage['type'] == 'fixed') {{ $taxTitle }} ({{ Currency::format($taxPercentage['value']) ?? '--' }}) @else {{ $taxTitle }} ({{ $taxPercentage['value'] ?? '--' }}%) @endif @if($taxPercentage['type'] == 'fixed') @php $totalTax += $taxPercentage['value']; @endphp {{ Currency::format($taxPercentage['value']) ?? '--' }} @else @php $tax_amount = $sub_total * $taxPercentage['value'] / 100; $totalTax += $tax_amount; @endphp {{ Currency::format($tax_amount) ?? '--' }} @endif
@endif

{{ __('report.lbl_taxes') }}

@php $amount_total = 0; $discount_amount = 0; $transaction = optional(optional($info['patient_encounter'])['billingrecord']) ? optional(optional($info['patient_encounter'])['billingrecord']) : null; if($transaction['final_discount_type'] == 'percentage'){ $discount_amount = $service_total_amount * ($transaction['final_discount_value'] / 100); }else{ $discount_amount = $transaction['final_discount_value']; } $amount_due = $sub_total + $totalTax; $remaining_payable_amount = $amount_due - $info['advance_paid_amount']; @endphp @if($transaction['final_discount'] == 1) @endif @if($info['appointmenttransaction']['advance_payment_status'] == 1) @endif @if($info['appointmenttransaction']['payment_status'] == 1) @endif
{{ __('messages.charges') }}
{{ __('messages.total') }} {{ Currency::format($service_total_amount) }}
{{ __('messages.discount') }} ( @if($transaction['final_discount_type'] === 'percentage') {{ $transaction['final_discount_value'] ?? '--' }}% @else {{ Currency::format($transaction['final_discount_value']) ?? '--' }} @endif ) {{ Currency::format($discount_amount) ?? '--' }}
{{ __('messages.sub_total') }} {{ Currency::format($sub_total) }}
{{ __('messages.total_tax') }} {{ Currency::format($totalTax) }}
{{ __('messages.grand_total') }} {{ Currency::format($amount_due) ?? '--' }}
{{ __('service.advance_payment_amount') }}({{ $info['advance_payment_amount'] }}%) {{ Currency::format($info['advance_paid_amount']) ?? '--' }}
{{ __('service.remaining_amount') }} {{ __('messages.paid') }} {{ Currency::format($remaining_payable_amount) }}
@endforeach