@extends('backend.layouts.app') @section('title') {{ __($module_title) }} @endsection @section('content')
@foreach ($data as $info)

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

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

@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 }}

Clinic Info
image
{{ $info['cliniccenter']['name'] ?? '--' }}
{{ $info['cliniccenter']['email'] ?? '--' }}
{{ $info['cliniccenter']['address'] ?? '--' }}
{{ __('messages.patient_detail') }}
image
{{ $info['user']['first_name'] . '' . $info['user']['last_name'] ?? '--' }}
@if ($info['user']['gender'] !== null)
{{ $info['user']['gender'] ?? '--' }}
@endif @if ($info['user']['date_of_birth'] !== null)
{{ date($dateformate, strtotime($info['user']['date_of_birth'])) ?? '--' }}
@endif
{{ __('messages.service') }}
@if (!isset($info['patient_encounter']))
{{ __('messages.item_name') }} {{ $info['clinicservice']['name'] ?? '--' }}
{{ __('messages.price') }} {{ Currency::format($info['service_price']) ?? '--' }}
@endif @if (isset($info['patient_encounter']) && !empty($info['patient_encounter']['billingrecord']) && !empty($info['patient_encounter']['billingrecord']['billing_item'])) @foreach ($info['patient_encounter']['billingrecord']['billing_item'] as $billingItem)
avatar
{{ $billingItem['clinicservice']['name'] ?? 'N/A' }} {{ $billingItem['clinicservice']['description'] ?? ' ' }}
@php // Calculate the payable amount based on discount type if ($billingItem['discount_type'] === 'percentage') { $payable_Amount = $billingItem['service_amount'] - $billingItem['service_amount'] * ($billingItem['discount_value'] / 100); } else { $payable_Amount = $billingItem['service_amount'] - $billingItem['discount_value']; } @endphp @if ($billingItem['discount_value'] > 0)
{{ Currency::format($payable_Amount) }} @if ($billingItem['discount_type'] === 'percentage') ({{ $billingItem['discount_value'] ?? '--' }}%) off @else ({{ Currency::format($billingItem['discount_value']) ?? '--' }}) off @endif
{{ Currency::format($billingItem['service_amount']) }} @else
{{ Currency::format($billingItem['total_amount']) }}
@endif
@endforeach @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 $inclusiveTaxTotal = 0; $tax = $info['appointmenttransaction']['tax_percentage']; $taxData = json_decode($tax, true); if (is_array($taxData)) { foreach ($taxData as $t) { if ( (isset($t['tax_type']) && $t['tax_type'] === 'inclusive') || (isset($t['tax_scope']) && $t['tax_scope'] === 'inclusive') ) { if ($t['type'] === 'percent') { $inclusiveTaxTotal += $service_total_amount * ($t['value'] / 100); } elseif ($t['type'] === 'fixed') { $inclusiveTaxTotal += $t['value']; } } } } $total_amount = $info['service_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']; } $sub_total = $service_total_amount - $discount_amount; @endphp
{{ __('report.lbl_taxes') }}
{{ __('messages.total') }} @if ($inclusiveTaxTotal > 0) {{-- --}} @endif {{ Currency::format($service_total_amount - $inclusiveTaxTotal) }}
@if ($transaction['final_discount'] == 1)
{{ __('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 - $inclusiveTaxTotal) }}
@endif @foreach ($taxData as $taxPercentage) @php $taxTitle = $taxPercentage['title']; @endphp @if ($taxPercentage['type'] == 'fixed') @else @endif
@if ($taxPercentage['type'] == 'fixed') {{ $taxTitle }} ({{ Currency::format($taxPercentage['value']) ?? '--' }}) @else {{ $taxTitle }} ({{ $taxPercentage['value'] ?? '--' }}%) @endif @if ($taxPercentage['type'] == 'fixed') {{ Currency::format($taxPercentage['value']) ?? '--' }} @else {{ Currency::format($tax_amount) ?? '--' }} @endif
@endforeach @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 = $service_total_amount + $total_tax - $discount_amount; $remaining_payable_amount = $amount_due - $info['advance_paid_amount']; @endphp
{{ __('messages.grand_total') }} {{ Currency::format($amount_due - $inclusiveTaxTotal) ?? '--' }}
@if ($info['appointmenttransaction']['advance_payment_status'] == 1)
{{ __('service.advance_payment_amount') }}({{ $info['advance_payment_amount'] }}%) {{ Currency::format($info['advance_paid_amount']) ?? '--' }}
@endif @if ($info['appointmenttransaction']['advance_payment_status'] == 1 && $info['status'] == 'checkout')
  • {{ __('service.remaining_amount') }}{{ __('appointment.paid') }} {{ Currency::format($remaining_payable_amount) }}
  • @endif
    @endif
    @endforeach
    @endsection @push('after-styles') @endpush @push('after-scripts') @endpush