@extends('Reports.template') @section('title') Pharmacy User Wise Collection Report @endsection @section('ExternalCss') @parent @endsection @section('Content') @php $currentTime = \Carbon\Carbon::now(); $columnCount = count($paymentModeData); @endphp @foreach ($paymentModeData as $paymentMode) @endforeach @php $sr = 1; $grandTotalAmount = array(); @endphp @foreach ($paymentModeData as $paymentMode) @php $grandTotalAmount[$paymentMode] = 0; @endphp @endforeach @php $groupedBills = []; // Initialize the array to group bills $sr = 1; // Reset counter if needed @endphp @foreach($billData as $bill) @php $totalAmount = array(); foreach ($paymentModeData as $paymentMode) { $totalAmount[$paymentMode] = 0; } if ($bill->patient_name != '') { $patOrCustName = $bill->patient_id . " / " . $bill->patient_name; } else if ($bill->ph_cust_name != '') { $patOrCustName = '*' . $bill->ph_cust_id . " / " . $bill->ph_cust_name; } else { $patOrCustName = $bill->supplier_name . "( " . $bill->purchase_bill_no . " )"; } $headerBillAmount = ($bill->trn_type == 'I' || $bill->trn_type == 'PR') ? $bill->amount_received_b : $bill->amount_received_b * (-1); $totalAmount[$bill->gm_description] = $headerBillAmount; $grandTotalAmount[$bill->gm_description] += $headerBillAmount; if (strtoupper($bill->payment_number_b) != '') { $message = $bill->gm_description . "," . strtoupper($bill->payment_agency_b) . "," . strtoupper($bill->payment_number_b); } else { $message = $bill->gm_description; } // Group payments by bill if (!isset($groupedBills[$bill->trn_id])) { $groupedBills[$bill->trn_id] = [ 'sr' => $sr++, 'bill_no' => $bill->trn_type ."/". $bill->trn_fyear. "/". $bill->trn_id, 'date_time' => \Helper::getDisplayDateTime($bill->trn_date ." ". $bill->ph_created_time), 'name' => $patOrCustName, 'payments' => [], 'user_id' => $bill->created_by, 'message' => [] ]; } $groupedBills[$bill->trn_id]['payments'][$bill->gm_description] = $headerBillAmount; $groupedBills[$bill->trn_id]['message'][] = $message; @endphp @endforeach @foreach($groupedBills as $bill) @foreach ($paymentModeData as $paymentMode) @endforeach @endforeach @foreach($receiptData as $receipt) @php $totalReceiptAmount = array(); foreach ($paymentModeData as $paymentMode) { $totalReceiptAmount[$paymentMode] = 0; } $patOrCustName = ($receipt->patient_name != '') ? $receipt->patient_id." / ".$receipt->patient_name : '*'.$receipt->ph_cust_id." / ".$receipt->ph_cust_name; $receiptAmount = $receipt->receipt_amount; $totalReceiptAmount[$receipt->gm_description] = $receiptAmount; $grandTotalAmount[$receipt->gm_description] += $receiptAmount; if(strtoupper($receipt->payment_agency != '')){ $message = $receipt->gm_description . "," . strtoupper($receipt->payment_agency) . "," . strtoupper($receipt->payment_number) . " towards Bills " . $receipt->bill_no ; }else{ $message = $receipt->gm_description . " towards Bills " . $receipt->bill_no; } @endphp @foreach ($paymentModeData as $paymentMode) @endforeach @endforeach @foreach ($paymentModeData as $paymentMode) @endforeach
@if($businessEntityMasterData[0]->logo != null) Pharmacy Logologo )}}"/> @endif
{{ $businessEntityMasterData[0]->name }}
{{$businessEntityMasterData[0]->add1. " " .$businessEntityMasterData[0]->add2 ." ".$businessEntityMasterData[0]->city." : " .$businessEntityMasterData[0]->pincode }}
{{"Phone : ".$businessEntityMasterData[0]->tel1}}
Pharmacy User Wise Collection Report @if($fromTime != "" && $toTime != "") Period : {{\Helper::getDisplayDateTime($fromDate." ".$fromTime)}} TO {{\Helper::getDisplayDateTime($toDate." ".$toTime)}} @else Period : {{\Helper::getDisplayDate($fromDate)}} TO {{\Helper::getDisplayDate($toDate)}} @endif
Sr No Bill No   Bill Date Time Patient / Supplier Name Payment Details {{ strtoupper($paymentMode) }}  User Id
{{ $bill['sr'] }} {{ $bill['bill_no'] }}  {{ $bill['date_time'] }} {{ $bill['name'] }} @foreach($bill['message'] as $msg) {{ $msg }}
@endforeach  
{{ isset($bill['payments'][$paymentMode]) ? \Helper::customAmountFormat($bill['payments'][$paymentMode]) : '' }}   {{ $bill['user_id'] }}
{{ $sr++ }} {{ $receipt->trn_receipt_no }}  {{ \Helper::getDisplayDateTime($receipt->trn_receipt_date ." ". $receipt->created_time) }} {{ $patOrCustName }} {{ $message }} {{ \Helper::customAmountFormat($totalReceiptAmount[$paymentMode]) }}  {{ $receipt->created_by }}
Total :{{ \Helper::customAmountFormat($grandTotalAmount[$paymentMode]) }}
{{Config::get('constants.asterisk.WALK_CUST')}} {{ strtoupper(Session::get('userId'))." # ".$currentTime->format('d/m/Y H:i:s ')}}


Back
@endsection @section('BootstrapModals') @endsection @section('ExternalJs') @endsection