<div class="row border-bottom-1 text-uppercase mx-0 font-12 report-body" style="border-top: 1px solid #565656;border-bottom: 1px solid #565656;">
    <div class="col-4"><b>Voucher No : {!! $accountReceipt->receipt_no ?? '' !!}</b>
    </div>
    <div class="col-4 text-center"><b></b>
    </div>
    <div class="col-4 text-center">
        <b style="margin-left: -22px !important;">Voucher Date  : {!! $accountReceipt->receipt_date ? formatedDate($accountReceipt->receipt_date) : '' !!}</b>
    </div>
</div>

@php
    $date_of_birth = $accountReceipt->accountReceiptDetail->account->account_contact->date_of_birth ?? '';
    $age           = $date_of_birth != '' ? age($date_of_birth) : 0;
@endphp
<div class="row report-body">
    <div class="col-12 ">
        <table class="table table-borderless table-sm mb-1" id="account_to">
            <tbody>
                <tr>
                    <td>
                        <div class="row mx-0 " style="padding-top: 4px; padding-bottom: 4px;border-bottom: 1px solid #565656;">
                            <div class="col-5 border-right border-dark">
                                <table class="table table-borderless mb-1 w-100 table-line-height1-2">
                                    <tbody>
                                        @php $gender      = $accountReceipt->accountReceiptDetail->account->account_contact->gender->name ?? ''; @endphp
                                        @php $state       = $accountReceipt->accountReceiptDetail->account->first_account_address->state->name ?? ''; @endphp
                                        @php $city        = $accountReceipt->accountReceiptDetail->account->first_account_address->city->name ?? ''; @endphp
                                        @php $country     = $accountReceipt->accountReceiptDetail->account->first_account_address->country->name ?? ''; @endphp
                                        @php $whatsapp_no = $accountReceipt->accountReceiptDetail->account->account_contact->whatsapp_no ?? ''; @endphp
                                        <tr class="">
                                            <td colspan="5" style="padding-left: 2px">
                                                Received From:<br>
                                                <span class="font-14 fw-bold">{!! $accountReceipt->accountReceiptDetail->account->name ?? '' !!}
                                                @if($accountReceipt->accountReceiptDetail->account->primary_account != '1')
                                                    ({!! $accountReceipt->accountReceiptDetail->account->code ?? '' !!})
                                                @endif</span>
                                                @php
                                                $address = generate_comma_separated_string([
                                                'city'=>$patientAddress->city->name?? '',
                                                'state'=>$patientAddress->state->name?? '',
                                                'country'=>$patientAddress->country->name?? '']);
                                                @endphp
                                                <br>
                                                Address: {!! $accountReceipt->accountReceiptDetail->account->first_account_address->address_line1 ?? '' !!}{!! $city != '' ? ', '.$city : '' !!}{!! $state != '' ? ', '.$state : '' !!}{!! $country != '' ? ', '.$country : '' !!}
                                                <br>
                                                Phone: {!! $accountReceipt->accountReceiptDetail->account->account_contact->phone_no ?? '' !!}
                                                <br>
                                                Email: {!! $accountReceipt->accountReceiptDetail->account->account_contact->email ?? '' !!}
                                            </td>
                                        </tr>
                                        @foreach(accountLicenses($accountReceipt->accountReceiptDetail->account->id) as $value)
                                        <tr>
                                            <td>{!! $value->name !!}</td>
                                            <td>:</td>
                                            <td style="padding-left: 2px">{!! $value->license_number !!}</td>
                                        </tr>
                                        @endforeach
                                    </tbody>
                                </table>
                            </div>
                            <div class="col-4 line-height1-2">
                                <table class="table table-borderless mb-1 w-100 table-line-height1-2" style="margin-left: -3.9px;">
                                    <tbody>
                                        <tr class="">
                                            <td width="20%">Ref. No</td>
                                        </tr>
                                        <tr class="fw-bold font-16" >
                                            <td> 
                                                <span class="font-14">
                                                @if($accountReceipt->accountReceiptDetail->voucherType->name=="OPD Booking")
                                                    {{ $accountReceipt->opdBooking->booking_no ?? '' }}
                                                @else
                                                    {!! $accountReceipt->salesVoucher->main_invoice_no??'' !!}
                                                @endif</span>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td style="">Ref. Type</td>
                                        </tr>
                                        <tr>
                                            <td style="">{!! $accountReceipt->accountReceiptDetail->voucherType->name ?? '' !!}</td>
                                        </tr>

                                        <tr>
                                            <td style="">Ref. Date</td>
                                        </tr>
                                        <tr>
                                            <td style="">@if($accountReceipt->accountReceiptDetail->voucherType->name=="OPD Booking")
                                                    {{ formatedDate($accountReceipt->opdBooking->booking_date_time) ?? '' }}
                                                @else
                                                    {!! formatedDate(@$accountReceipt->salesVoucher->invoice_date)??'' !!}
                                                @endif</td>
                                        </tr>

                                    </tbody>
                                </table>
                            </div>
                            <div class="col-3 border-right border-dark my-auto line-height1-2">
                                <div class="text-end">
                                    <div class="text-center">
                                        @php
                                            $generatorPNG = new Picqer\Barcode\BarcodeGeneratorPNG();
                                        @endphp
                                        <img class="barcodeStyle" src="data:image/png;base64,{{ base64_encode($generatorPNG->getBarcode($accountReceipt->receipt_no ?? '', $generatorPNG::TYPE_CODE_128)) }}" height="120" width="200">
                                    </div>
                                    <div class="text-center">
                                        <span class="font-14"><b>{!! $accountReceipt->receipt_no ?? '' !!}</b></span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
