@extends('Reports.template') @section('title') Pharmacy Outstanding Report @endsection @section('ExternalCss') @parent @endsection @section('Content') @php $currentTime = \Carbon\Carbon::now(); @endphp @php $sr = 1; $total = 0; $aging = array(); $agingAmount = array(); $customerAging = array(); $customerAgingAmount = array(); $totalRange1 = 0; $totalRange2 = 0; $totalRange3 = 0; $totalRange4 = 0; $totalAmount1 = 0; $totalAmount2 = 0; $totalAmount3 = 0; $totalAmount4 = 0; foreach($rate as $key=>$value){ $aging[$key] = array(0=>0,1=>0,2=>0,3=>0); $agingAmount[$key] = array(0=>0,1=>0,2=>0,3=>0); } $customerAging[0] = 0; $customerAging[1] = 0; $customerAging[2] = 0; $customerAging[3] = 0; $customerAgingAmount[0] = 0; $customerAgingAmount[1] = 0; $customerAgingAmount[2] = 0; $customerAgingAmount[3] = 0; @endphp @foreach($billData as $bill) @php if($bill->patient_name != ''){ $patOrCustName = " ".$bill->patient_id." / ".$bill->patient_name; }else{ $patOrCustName = '*'.$bill->ph_cust_id." / ".$bill->ph_cust_name; } $amount = 0; if($bill->trn_type === 'I'){ $total += $bill->total; $amount = $bill->total; }else{ $total -= $bill->total; $amount = -1*($bill->total); } $ageDay = abs(round((strtotime($toDate) - strtotime($bill->trn_date)) / 86400)); if($bill->patient_rate_card > 0 ){ if($ageDay > 30){ $aging[$bill->patient_rate_card][3]++; if($bill->trn_type === 'I'){ $agingAmount[$bill->patient_rate_card][3] += $bill->total; }else{ $agingAmount[$bill->patient_rate_card][3] -= $bill->total; } }elseif($ageDay <= 30 && $ageDay >= 16){ $aging[$bill->patient_rate_card][2]++; if($bill->trn_type === 'I'){ $agingAmount[$bill->patient_rate_card][2] += $bill->total; }else{ $agingAmount[$bill->patient_rate_card][2] -= $bill->total; } }elseif($ageDay <= 15 && $ageDay >= 8){ $aging[$bill->patient_rate_card][1]++; if($bill->trn_type === 'I'){ $agingAmount[$bill->patient_rate_card][1] += $bill->total; }else{ $agingAmount[$bill->patient_rate_card][1] -= $bill->total; } }elseif($ageDay <= 7 && $ageDay >= 0){ $aging[$bill->patient_rate_card][0]++; if($bill->trn_type === 'I'){ $agingAmount[$bill->patient_rate_card][0] += $bill->total; }else{ $agingAmount[$bill->patient_rate_card][0] -= $bill->total; } } }else{ if($ageDay > 30){ $customerAging[3]++; if($bill->trn_type === 'I'){ $customerAgingAmount[3] += $bill->total; }else{ $customerAgingAmount[3] -= $bill->total; } }elseif($ageDay <= 30 && $ageDay >= 16){ $customerAging[2]++; if($bill->trn_type === 'I'){ $customerAgingAmount[2] += $bill->total; }else{ $customerAgingAmount[2] -= $bill->total; } }elseif($ageDay <= 15 && $ageDay >= 8){ $customerAging[1]++; if($bill->trn_type === 'I'){ $customerAgingAmount[1] += $bill->total; }else{ $customerAgingAmount[1] -= $bill->total; } }elseif($ageDay <= 7 && $ageDay >= 0){ $customerAging[0]++; if($bill->trn_type === 'I'){ $customerAgingAmount[0] += $bill->total; }else{ $customerAgingAmount[0] -= $bill->total; } } } @endphp @if($bill->patient_rate_card > 0) @else @endif @if($bill->is_ptr_applicable == 'Y') @else @endif @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 Outstading Report Store : {{$storeName}} As On : {{\Helper::getDisplayDate($toDate)}}
Sr No   Bill No Bill Date Patient / Customer Details Patient Type Age Day Outstanding Bill Amount Created By
{{$sr++}}   {{$bill->trn_type."/".$bill->trn_fyear."/".$bill->trn_id}} {{\Helper::getDisplayDate($bill->trn_date)}} {{$patOrCustName}}{{$rate[$bill->patient_rate_card]}}{{$companyName}}{{$ageDay}} {{\Helper::customAmountFormat($amount)}} {{$bill->created_by}}
{{\Helper::customAmountFormat($total)}}
{{Config::get('constants.asterisk.WALK_CUST')}} {{ strtoupper(Session::get('userId'))." # ".$currentTime->format('d/m/Y H:i:s ')}}

Outstanding Report Summary

@foreach($aging as $key=>$value) @php $totalRange1 += $value[0]; $totalRange2 += $value[1]; $totalRange3 += $value[2]; $totalRange4 += $value[3]; $totalAmount1 += $agingAmount[$key][0]; $totalAmount2 += $agingAmount[$key][1]; $totalAmount3 += $agingAmount[$key][2]; $totalAmount4 += $agingAmount[$key][3]; @endphp @endforeach @php $totalRange1 += $customerAging[0]; $totalRange2 += $customerAging[1]; $totalRange3 += $customerAging[2]; $totalRange4 += $customerAging[3]; $totalAmount1 += $customerAgingAmount[0]; $totalAmount2 += $customerAgingAmount[1]; $totalAmount3 += $customerAgingAmount[2]; $totalAmount4 += $customerAgingAmount[3]; @endphp
Patient Category 0-7 day 8-15 day 16-30 day >30 day Total
Count Amount Count Amount Count Amount Count Amount Total Count Total Amount
{{$rate[$key]}} {{\Helper::zeroValueToNbspSpace($value[0])}} {{\Helper::customAmountFormat($agingAmount[$key][0])}} {{\Helper::zeroValueToNbspSpace($value[1])}} {{\Helper::customAmountFormat($agingAmount[$key][1])}} {{\Helper::zeroValueToNbspSpace($value[2])}} {{\Helper::customAmountFormat($agingAmount[$key][2])}} {{\Helper::zeroValueToNbspSpace($value[3])}} {{\Helper::customAmountFormat($agingAmount[$key][3])}} {{\Helper::zeroValueToNbspSpace($value[0]+$value[1]+$value[2]+$value[3])}} {{\Helper::customAmountFormat($agingAmount[$key][0]+$agingAmount[$key][1]+$agingAmount[$key][2]+$agingAmount[$key][3])}}
Patient / Customer {{\Helper::zeroValueToNbspSpace($customerAging[0])}} {{\Helper::customAmountFormat($customerAgingAmount[0])}} {{\Helper::zeroValueToNbspSpace($customerAging[1])}} {{\Helper::customAmountFormat($customerAgingAmount[1])}} {{\Helper::zeroValueToNbspSpace($customerAging[2])}} {{\Helper::customAmountFormat($customerAgingAmount[2])}} {{\Helper::zeroValueToNbspSpace($customerAging[3])}} {{\Helper::customAmountFormat($customerAgingAmount[3])}} {{\Helper::zeroValueToNbspSpace($customerAging[0]+$customerAging[1]+$customerAging[2]+$customerAging[3])}} {{\Helper::customAmountFormat($customerAgingAmount[0]+$customerAgingAmount[1]+$customerAgingAmount[2]+$customerAgingAmount[3])}}
Total {{\Helper::zeroValueToNbspSpace($totalRange1)}} {{\Helper::customAmountFormat($totalAmount1)}} {{\Helper::zeroValueToNbspSpace($totalRange2)}} {{\Helper::customAmountFormat($totalAmount2)}} {{\Helper::zeroValueToNbspSpace($totalRange3)}} {{\Helper::customAmountFormat($totalAmount3)}} {{\Helper::zeroValueToNbspSpace($totalRange4)}} {{\Helper::customAmountFormat($totalAmount4)}} {{\Helper::zeroValueToNbspSpace($totalRange1+$totalRange2+$totalRange3+$totalRange4)}} {{\Helper::customAmountFormat($totalAmount1+$totalAmount2+$totalAmount3+$totalAmount4)}}


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