@php use Carbon\Carbon; @endphp
@if(isset($data->bannerUrl) && $data->bannerUrl != "") @endif

@if(isset($data->invoiceNo)) Invoice - {{$data->invoiceNo}} @endif
@if(isset($data->qrCode)) Invoice No @endif
@if(isset($data->customer->admission->bed->bedNo)) @endif @if(isset($data->customer->billToContact)) @endif
Name : @if(isset($data->customer->name)) {{$data->customer->name}}  @if (isset($data->customer->patientAnimal->species)) ({{$data->customer->patientAnimal->species}}) @endif (Reg- {{$data->customer->registrationNo}} ) @endif @if(isset($data->billingDate)) Date - {{dateFormatter($data->billingDate)}} @endif
Age : @if(isset($data->customer->dob)) {{\Carbon\Carbon::parse($data->customer->dob)->startOfDay()->diff(\Carbon\Carbon::now())->format('%yY %mM %dD')}}   Sex: @if(isset($data->customer->gender)) {{$data->customer->gender}} @endif @endif
Phone : @if(isset($data->customer->mobileNo)) {{$data->customer->mobileNo}} @endif
Referred By : @if(isset($data->beneficiaryName)) {{$data->beneficiaryName}} @endif
Cabin No : {{$data->customer->admission->bed->bedNo}}
Bill to Contact : {{$data->customer->billToContact->name}}  ( Reg-{{$data->customer->billToContact->billToRegistrationNo}} )
@foreach($data->groupedMap as $index => $list)

@if($list[0] != "INVESTIGATION") @endif @if($list[0] != "INVESTIGATION") @endif @if($list[0] === "INVESTIGATION") @endif @if($list[0] != "INVESTIGATION") @endif @if($list[0] != "INVESTIGATION") @endif @if($list[0] === "INVESTIGATION") @endif @if($list[0] === "INVESTIGATION") @endif @if($list[0] != "MEDICINE" && $list[0] != "INVESTIGATION") @endif @if($list[0] == "MEDICINE") @endif @php $total = 0; @endphp @foreach($list[1] as $i => $item) @if(isset($item->unitPrice) && $list[0] != "INVESTIGATION") @endif @if(isset($item->discountRate) && $list[0] != "INVESTIGATION") @endif @if($list[0] === "INVESTIGATION") @endif @if($list[0] === "INVESTIGATION") @endif @if(isset($item->saleAmount) && $list[0] != "INVESTIGATION") @endif @if(isset($item->quantity) && $list[0] != "INVESTIGATION") @endif @if($list[0] === "INVESTIGATION") @endif @if($list[0] != "MEDICINE" && $list[0] != "INVESTIGATION") @endif @if($list[0] == "MEDICINE") @endif @php $total += $item->netSales; @endphp @endforeach
{{capitalizeFirstChar($list[0])}}
Sl NameRateDis(%)Delivery TimePriceQuantityRoom NoTotalTotalTotal
{{$i+1}} @if(isset($item->productItem->name)) {{$item->productItem->name}} @else {{$item->itemName}} @endif @if(isset($item->partialDelivery)) @if($item->partialDelivery == true) (Partial) @endif @endif {{number_format($item->unitPrice, 2), 2}}{{number_format($item->discountRate, 2)}} @if(isset($item->productItem->deliveryTime) && isset($item->productItem->deliveryUom)) {{getDeliveryTime($item->productItem->deliveryTime, $item->productItem->deliveryUom, $data->createdDate)->format('d-M g:i A')}} @endif @if(isset($item->productItem->sampleCollectionRoom)) {{$item->productItem->sampleCollectionRoom}} @endif {{number_format($item->saleAmount, 2)}}{{$item->quantity}}{{number_format($item->netSales, 2), 2}}{{number_format($item->netSales, 2), 2}}{{number_format($item->netSales, 2), 2}}
Sub Total of {{capitalizeFirstChar($list[0])}} : {{number_format($total, 2), 2}}
{{--@if (count($data->groupedMap)-1 != $index)
@endif--}} @endforeach

@foreach($data->billingPaymentDetails as $index => $item) @endforeach
Payment Mode Transaction No Amount
{{capitalizeFirstChar($item->paymentMethod)}} {{$item->transactionId}} {{$item->payAmount - $item->returnAmount}}
Grand Total : {{number_format($data->totalSaleAmount, 2), 2}}
Discount Amount : {{number_format($data->totalDiscountAmount, 2), 2}}
Total : {{number_format($data->totalSaleAmount - $data->totalDiscountAmount, 2), 2}}
Paid : {{number_format($data->totalCashAmount + $data->totalCardAmount + $data->totalMFSAmount, 2), 2}}
Due : {{number_format($data->totalDue < 0 ? 0 : $data->totalDue, 2), 2}}
Return : {{number_format($data->totalReturn, 2), 2}}
{{-- --}} {{-- --}} {{-- --}} {{-- --}} {{--
--}} {{-- user {{$data->createdBy}}--}} {{--
--}}
User - {{$data->createdBy}}  D&T - {{ now()->timezone('Asia/Dhaka')->format('d-M-Y g:i A') }}    Powered By - {{$data->poweredBy}}  {PAGENO}/{nbpg}