@extends('Reports.template') @section('title') @php $reportTitle = 'Patient Wise Sales Report - With GST'; @endphp {{ $reportTitle }} @endsection @section('ExternalCss') @parent @endsection @section('Content') @if ($Report_Type=='D') @php $currentTime = \Carbon\Carbon::now(); @endphp @php $oldTrnType = ''; $oldTrnId = ''; $oldEntity = ''; $oldPatient = ''; $headerSr = 1; $transactionSr = 1; $patient_id = ''; $patient_name = ''; $ipd_reg_id = ''; $entity_name = ''; $totalMrp = 0; $totalquantity = 0; $totaldiscount_amt = 0; $totaltaxable_amt = 0; $totalgst=0; $totalAmt=0; $NetTotal=0; $grosstotalSaleMrp=0; $grosstotalquantity=0; $grosstotaldiscount_amt=0; $grosstotaltaxable_amt=0; $grosstotalgst=0; $grosstotalAmt=0; $grossNetTotal=0; $entitytotalquantity=0; $entitytotaldiscount_amt=0; $entitytotaltaxable_amt=0; $entitytotalgst=0; $entitytotalAmt=0; $entityNetTotal=0; @endphp {{-- @if ($Report_Type == 'D') --}} @if (!empty($productProfit)) @foreach ($productProfit as $profit) @php if (!empty($fromdate)) { $patient_id = $profit->patient_id; $patient_name = $profit->patient_name; $ipd_reg_id = $profit->ipd_reg_id; $entity_name = $profit->entity_name; } elseif (!empty($patientData)) { $patient_id = $patientData->patient_id; $patient_name = $patientData->patient_name; $ipd_reg_id = $patientData->ipd_reg_id; $entity_name = $patientData->entity_name; } if($profit->trn_type=="I") { $mrp=$profit->mrp; $discount=$profit->discount; $discount_amt=$profit->discount_amt; $taxable_amt=$profit->taxable_amt; $gst=floatval($profit->sgst_value) + floatval($profit->cgst_value); $total=$profit->total; } else { $mrp=$profit->mrp*-1; $discount=$profit->discount*-1; $discount_amt=$profit->discount_amt*-1; $taxable_amt=$profit->taxable_amt*-1; $gst= -1 * (floatval($profit->sgst_value) + floatval($profit->cgst_value)); $total=-1 * $profit->total; } @endphp @if ($profit->trn_type != $oldTrnType || $profit->trn_id != $oldTrnId) @if ($headerSr > 1) @endif @if ($headerSr > 1 && $patient_id != $oldPatient) @endif @if ($headerSr > 1 && $entity_name != $oldEntity && $ipId=='') @endif @php $transactionSr = 1; $totalMrp = 0; $totalquantity = 0; $totaldiscount_amt = 0; $totaltaxable_amt = 0; $totalgst=0; $totalAmt=0; $NetTotal=0; @endphp @if ($entity_name != '' && $entity_name != $oldEntity && $ipId=='') @php $entitytotalquantity=0; $entitytotaldiscount_amt=0; $entitytotaltaxable_amt=0; $entitytotalgst=0; $entitytotalAmt=0; $entityNetTotal=0; @endphp @endif @if ($patient_id != '' && $patient_id != $oldPatient) @php $patienttotalSaleMrp=0; $patienttotalquantity=0; $patienttotaldiscount_amt=0; $patienttotaltaxable_amt=0; $patienttotalgst=0; $patienttotalAmt=0; $patientNetTotal=0; @endphp @if($ipId=='') @endif @endif @endif @php $totalquantity += $profit->quantity; $totalMrp += $mrp; $totaldiscount_amt += $discount_amt; $totaltaxable_amt += $taxable_amt; $totalgst += ($gst); $totalAmt+= $total; $NetTotal += ($gst+$taxable_amt); if ($patient_id != '') { $patienttotalSaleMrp += $mrp; $patienttotalquantity += $profit->quantity; $patienttotaldiscount_amt += $discount_amt; $patienttotaltaxable_amt += $taxable_amt; $patienttotalgst += ($gst); $patienttotalAmt+= $total; $patientNetTotal += ($gst+$taxable_amt); } $entitytotalquantity += $profit->quantity; $entitytotaldiscount_amt += $discount_amt; $entitytotaltaxable_amt += $taxable_amt; $entitytotalgst += ($gst); $entitytotalAmt+= $total; $entityNetTotal += ($gst+$taxable_amt); $grosstotalSaleMrp += $mrp; $grosstotalquantity += $profit->quantity; $grosstotaldiscount_amt += $discount_amt; $grosstotaltaxable_amt += $taxable_amt; $grosstotalgst += ($gst); $grosstotalAmt+= $total; $grossNetTotal += ($gst+$taxable_amt); $oldTrnType = $profit->trn_type; $oldTrnId = $profit->trn_id; if ($patient_id != '') { $oldPatient = $patient_id; $oldEntity = $entity_name; } @endphp @endforeach @endif @if ($patient_id != '') @endif @if ($entity_name != '' && $ipId=='') @endif
@if ($businessEntityMasterData[0]->logo != null) Pharmacy Logo @endif
{{ $businessEntityMasterData[0]->name }}
{{ $businessEntityMasterData[0]->add1 . ' ' . $businessEntityMasterData[0]->add2 . ' ' . $businessEntityMasterData[0]->city . ' : ' . $businessEntityMasterData[0]->pincode }}
{{ 'Phone : ' . $businessEntityMasterData[0]->tel1 }}
{{ $reportTitle }} IP Bill Period : {{ \Helper::getDisplayDate($fromdate) }} TO {{ \Helper::getDisplayDate($todate) }}
 Sr No.  Trn No Trn Date Bill Type
Sr No.  Product Name Category Batch Qty MRP Gross Total Disc% Disc Taxable GST% GST Net Total
Total : {{ $totalquantity }} {{ \Helper::customAmountFormat($totalAmt) }} {{ \Helper::customAmountFormat($totaldiscount_amt) }} {{ \Helper::customAmountFormat($totaltaxable_amt) }} {{ \Helper::customAmountFormat($totalgst) }} {{ \Helper::customAmountFormat($NetTotal) }}
Patient Total : {{ $patienttotalquantity }} {{ \Helper::customAmountFormat($patienttotalAmt) }} {{ \Helper::customAmountFormat($patienttotaldiscount_amt) }} {{ \Helper::customAmountFormat($patienttotaltaxable_amt) }} {{ \Helper::customAmountFormat($patienttotalgst) }} {{ \Helper::customAmountFormat($patientNetTotal) }}
Entity Total : {{ $entitytotalquantity }} {{ \Helper::customAmountFormat($entitytotalAmt) }} {{ \Helper::customAmountFormat($entitytotaldiscount_amt) }} {{ \Helper::customAmountFormat($entitytotaltaxable_amt) }} {{ \Helper::customAmountFormat($entitytotalgst) }} {{ \Helper::customAmountFormat($entityNetTotal) }}
Entity : {{ $entity_name }}
Patient : {{ $patient_id . ' / ' . $patient_name }}   IP ID : {{ $ipd_reg_id }} Discharge Date : @if ($profit->discharge_date!="0000-00-00") {{ \Helper::getDisplayDate($profit->discharge_date) }} @endif
 {{ $headerSr++ }}  {{ $profit->trn_type."/".$profit->trn_fyear."/". $profit->trn_id }} {{ \Helper::getDisplayDate($profit->trn_date) }} {{ $profit->is_credit_bill=="N"?'CASH':'' }}
{{ $transactionSr++ }}  {{ $profit->product_name }} {{ $profit->category_abbrev }} {{ $profit->batch_no }} {{ $profit->quantity }} {{ \Helper::customAmountFormat($mrp) }} {{ \Helper::customAmountFormat($total) }} {{ \Helper::customAmountFormat($discount) }} {{ \Helper::customAmountFormat($discount_amt) }} {{ \Helper::customAmountFormat($taxable_amt) }} {{ \Helper::customAmountFormat(floatval($profit->sgst_percentage) + floatval($profit->cgst_percentage)) }} {{ \Helper::customAmountFormat($gst) }} {{ \Helper::customAmountFormat($taxable_amt+$gst) }}
Total : {{ $totalquantity }} {{ \Helper::customAmountFormat($totalAmt) }} {{ \Helper::customAmountFormat($totaldiscount_amt) }} {{ \Helper::customAmountFormat($totaltaxable_amt) }} {{ \Helper::customAmountFormat($totalgst) }} {{ \Helper::customAmountFormat($NetTotal) }}
Patient Total : {{ $patienttotalquantity }} {{ \Helper::customAmountFormat($patienttotalAmt) }} {{ \Helper::customAmountFormat($patienttotaldiscount_amt) }} {{ \Helper::customAmountFormat($patienttotaltaxable_amt) }} {{ \Helper::customAmountFormat($patienttotalgst) }} {{ \Helper::customAmountFormat($patientNetTotal) }}
Entity Total : {{ $entitytotalquantity }} {{ \Helper::customAmountFormat($entitytotalAmt) }} {{ \Helper::customAmountFormat($entitytotaldiscount_amt) }} {{ \Helper::customAmountFormat($entitytotaltaxable_amt) }} {{ \Helper::customAmountFormat($entitytotalgst) }} {{ \Helper::customAmountFormat($entityNetTotal) }}
Bill Total : {{ $grosstotalquantity }} {{ \Helper::customAmountFormat($grosstotalAmt) }} {{ \Helper::customAmountFormat($grosstotaldiscount_amt) }} {{ \Helper::customAmountFormat($grosstotaltaxable_amt) }} {{ \Helper::customAmountFormat($grosstotalgst) }} {{ \Helper::customAmountFormat($grossNetTotal) }}
{{ strtoupper(Session::get('userId')) . ' # ' . $currentTime->format('d/m/Y H:i:s ') }}
@elseif ($Report_Type=='S') @php $currentTime = \Carbon\Carbon::now(); @endphp @php $oldTrnType = ''; $oldTrnId = ''; $oldEntity = ''; $oldPatient = ''; $headerSr = 1; $transactionSr = 1; $patient_id = ''; $patient_name = ''; $ipd_reg_id = ''; $entity_name = ''; $totalMrp = 0; $totalquantity = 0; $totaldiscount_amt = 0; $totaltaxable_amt = 0; $totalgst=0; $totalAmt=0; $NetTotal=0; $grosstotalSaleMrp=0; $grosstotalquantity=0; $grosstotaldiscount_amt=0; $grosstotaltaxable_amt=0; $grosstotalgst=0; $grosstotalAmt=0; $grossNetTotal=0; $entitytotalquantity=0; $entitytotaldiscount_amt=0; $entitytotaltaxable_amt=0; $entitytotalgst=0; $entitytotalAmt=0; $entityNetTotal=0; @endphp {{-- @if ($Report_Type == 'D') --}} @if (!empty($productProfit)) @foreach ($productProfit as $profit) @php if (!empty($fromdate)) { $patient_id = $profit->patient_id; $patient_name = $profit->patient_name; $ipd_reg_id = $profit->ipd_reg_id; $entity_name = $profit->entity_name; } elseif (!empty($patientData)) { $patient_id = $patientData->patient_id; $patient_name = $patientData->patient_name; $ipd_reg_id = $patientData->ipd_reg_id; $entity_name = $patientData->entity_name; } if($profit->trn_type=="I") { $mrp=$profit->mrp; $discount=$profit->discount; $discount_amt=$profit->discount_amt; $taxable_amt=$profit->taxable_amt; $gst=floatval($profit->sgst_value) + floatval($profit->cgst_value); $total=$profit->total; } else { $mrp=$profit->mrp*-1; $discount=$profit->discount*-1; $discount_amt=$profit->discount_amt*-1; $taxable_amt=$profit->taxable_amt*-1; $gst= -1 * (floatval($profit->sgst_value) + floatval($profit->cgst_value)); $total=-1 * $profit->total; } @endphp @if ($profit->trn_type != $oldTrnType || $profit->trn_id != $oldTrnId) @if ($headerSr > 1) @endif @if ($headerSr > 1 && $patient_id != $oldPatient) @endif @if ($headerSr > 1 && $entity_name != $oldEntity && $ipId=='') @endif @php $transactionSr = 1; $totalMrp = 0; $totalquantity = 0; $totaldiscount_amt = 0; $totaltaxable_amt = 0; $totalgst=0; $totalAmt=0; $NetTotal=0; @endphp @if ($entity_name != '' && $entity_name != $oldEntity && $ipId=='') @php $entitytotalquantity=0; $entitytotaldiscount_amt=0; $entitytotaltaxable_amt=0; $entitytotalgst=0; $entitytotalAmt=0; $entityNetTotal=0; @endphp @endif @if ($patient_id != '' && $patient_id != $oldPatient) @php $patienttotalSaleMrp=0; $patienttotalquantity=0; $patienttotaldiscount_amt=0; $patienttotaltaxable_amt=0; $patienttotalgst=0; $patienttotalAmt=0; $patientNetTotal=0; @endphp @if($ipId=='') @endif @endif @endif @php $totalquantity += $profit->quantity; $totalMrp += $mrp; $totaldiscount_amt += $discount_amt; $totaltaxable_amt += $taxable_amt; $totalgst += ($gst); $totalAmt+= $total; $NetTotal += ($gst+$taxable_amt); if ($patient_id != '') { $patienttotalSaleMrp += $mrp; $patienttotalquantity += $profit->quantity; $patienttotaldiscount_amt += $discount_amt; $patienttotaltaxable_amt += $taxable_amt; $patienttotalgst += ($gst); $patienttotalAmt+= $total; $patientNetTotal += ($gst+$taxable_amt); } $entitytotalquantity += $profit->quantity; $entitytotaldiscount_amt += $discount_amt; $entitytotaltaxable_amt += $taxable_amt; $entitytotalgst += ($gst); $entitytotalAmt+= $total; $entityNetTotal += ($gst+$taxable_amt); $grosstotalSaleMrp += $mrp; $grosstotalquantity += $profit->quantity; $grosstotaldiscount_amt += $discount_amt; $grosstotaltaxable_amt += $taxable_amt; $grosstotalgst += ($gst); $grosstotalAmt+= $total; $grossNetTotal += ($gst+$taxable_amt); $oldTrnType = $profit->trn_type; $oldTrnId = $profit->trn_id; if ($patient_id != '') { $oldPatient = $patient_id; $oldEntity = $entity_name; } @endphp @endforeach @endif @if ($patient_id != '') @endif @if ($entity_name != '' && $ipId=='') @endif
@if ($businessEntityMasterData[0]->logo != null) Pharmacy Logo @endif
{{ $businessEntityMasterData[0]->name }}
{{ $businessEntityMasterData[0]->add1 . ' ' . $businessEntityMasterData[0]->add2 . ' ' . $businessEntityMasterData[0]->city . ' : ' . $businessEntityMasterData[0]->pincode }}
{{ 'Phone : ' . $businessEntityMasterData[0]->tel1 }}
{{ $reportTitle }} IP Bill Period : {{ \Helper::getDisplayDate($fromdate) }} TO {{ \Helper::getDisplayDate($todate) }}
 Sr No.  Trn No Trn Date Bill Type Gross Total Disc Amt Taxable GST Net Total
{{ \Helper::customAmountFormat($totalAmt) }} {{ \Helper::customAmountFormat($totaldiscount_amt) }} {{ \Helper::customAmountFormat($totaltaxable_amt) }} {{ \Helper::customAmountFormat($totalgst) }} {{ \Helper::customAmountFormat($NetTotal) }}
Patient Total : {{ \Helper::customAmountFormat($patienttotalAmt) }} {{ \Helper::customAmountFormat($patienttotaldiscount_amt) }} {{ \Helper::customAmountFormat($patienttotaltaxable_amt) }} {{ \Helper::customAmountFormat($patienttotalgst) }} {{ \Helper::customAmountFormat($patientNetTotal) }}
Entity Total : {{ \Helper::customAmountFormat($entitytotalAmt) }} {{ \Helper::customAmountFormat($entitytotaldiscount_amt) }} {{ \Helper::customAmountFormat($entitytotaltaxable_amt) }} {{ \Helper::customAmountFormat($entitytotalgst) }} {{ \Helper::customAmountFormat($entityNetTotal) }}
Entity : {{ $entity_name }}
Patient : {{ $patient_id . ' / ' . $patient_name }}   IP ID : {{ $ipd_reg_id }} Discharge Date : @if ($profit->discharge_date!="0000-00-00") {{ \Helper::getDisplayDate($profit->discharge_date) }} @endif
 {{ $headerSr++ }}  {{ $profit->trn_type."/".$profit->trn_fyear."/" . $profit->trn_id }} {{ \Helper::getDisplayDate($profit->trn_date) }} {{ $profit->is_credit_bill=="N"?'CASH':'' }}{{ \Helper::customAmountFormat($totalAmt) }} {{ \Helper::customAmountFormat($totaldiscount_amt) }} {{ \Helper::customAmountFormat($totaltaxable_amt) }} {{ \Helper::customAmountFormat($totalgst) }} {{ \Helper::customAmountFormat($NetTotal) }}
Patient Total : {{ \Helper::customAmountFormat($patienttotalAmt) }} {{ \Helper::customAmountFormat($patienttotaldiscount_amt) }} {{ \Helper::customAmountFormat($patienttotaltaxable_amt) }} {{ \Helper::customAmountFormat($patienttotalgst) }} {{ \Helper::customAmountFormat($patientNetTotal) }}
Entity Total : {{ \Helper::customAmountFormat($entitytotalAmt) }} {{ \Helper::customAmountFormat($entitytotaldiscount_amt) }} {{ \Helper::customAmountFormat($entitytotaltaxable_amt) }} {{ \Helper::customAmountFormat($entitytotalgst) }} {{ \Helper::customAmountFormat($entityNetTotal) }}
Bill Total : {{ \Helper::customAmountFormat($grosstotalAmt) }} {{ \Helper::customAmountFormat($grosstotaldiscount_amt) }} {{ \Helper::customAmountFormat($grosstotaltaxable_amt) }} {{ \Helper::customAmountFormat($grosstotalgst) }} {{ \Helper::customAmountFormat($grossNetTotal) }}
{{ strtoupper(Session::get('userId')) . ' # ' . $currentTime->format('d/m/Y H:i:s ') }}
@endif
@if ($ipId=='') @if (!empty($productProfit)) @php $qty=0; $old_sr=0; $old_mrp = 0; $old_discount_amt = 0; $old_taxable_amt = 0; $old_gst = 0; $old_total= 0; $vdiscount_amt=0; $vtaxable_amt=0; $vgst=0; $vtotal=0; $cash_bill=0; $credit_bill=0; $totaldiscount_amt=0; $totaltaxable_amt=0; $totalgst=0; $nettotal=0; $netcash_bill=0; $netcredit_bill=0; $next=-1; @endphp @foreach ($productProfit as $profit) @php if($profit->trn_type=="I") { $discount_amt=$profit->discount_amt; $taxable_amt=$profit->taxable_amt; $gst=floatval($profit->sgst_value) + floatval($profit->cgst_value); $total=$profit->total; } else { $discount_amt=$profit->discount_amt*-1; $taxable_amt=$profit->taxable_amt*-1; $gst=(floatval($profit->sgst_value) + floatval($profit->cgst_value))*-1; $total=$profit->total*-1; } if($next==-1) { $oldEntity=$productProfit[0]->entity_name; } $old_discount_amt = $discount_amt; $old_taxable_amt = $taxable_amt; $old_gst = ($gst); $old_total= $total; @endphp @if($profit->entity_name == $oldEntity) @php $next=0; @endphp @else @php $next=1; @endphp @endif @if($next==1) @php $vdiscount_amt=0; $vtotal=0; $cash_bill=0; $credit_bill=0; $vtaxable_amt=0; $vgst=0; @endphp @endif @php $vdiscount_amt += $old_discount_amt; $vtaxable_amt += $old_taxable_amt; $vgst += $old_gst; $vtotal+= $old_total; if($profit->is_credit_bill=="N") { $cash_bill += $old_total; } else { $credit_bill += $old_total; } $totaldiscount_amt += $old_discount_amt; $totaltaxable_amt += $old_taxable_amt; $totalgst += $old_gst; $nettotal += $old_total; if($profit->is_credit_bill=="N") { $netcash_bill += $old_total; } else { $netcredit_bill += $old_total; } $oldEntity = $profit->entity_name; @endphp @endforeach @if($next==0) @endif @endif
Entity Wise Summery IP Bill Period : {{ \Helper::getDisplayDate($fromdate) }} TO {{ \Helper::getDisplayDate($todate) }}
Entity Name Gross Total Cash Bill Total Credit Bill Total Disc Taxable GST Net Total
{{ $oldEntity }} {{ \Helper::customAmountFormat($vtotal) }} {{ \Helper::customAmountFormat($cash_bill) }} {{ \Helper::customAmountFormat($credit_bill) }} {{ \Helper::customAmountFormat($vdiscount_amt) }} {{ \Helper::customAmountFormat($vtaxable_amt) }} {{ \Helper::customAmountFormat($vgst) }} {{ \Helper::customAmountFormat($vgst+$vtaxable_amt) }}
{{ $oldEntity }} {{ \Helper::customAmountFormat($vtotal) }} {{ \Helper::customAmountFormat($cash_bill) }} {{ \Helper::customAmountFormat($credit_bill) }} {{ \Helper::customAmountFormat($vdiscount_amt) }} {{ \Helper::customAmountFormat($vtaxable_amt) }} {{ \Helper::customAmountFormat($vgst) }} {{ \Helper::customAmountFormat($vtaxable_amt+$vgst) }}
Total : {{ \Helper::customAmountFormat($nettotal) }} {{ \Helper::customAmountFormat($netcash_bill) }} {{ \Helper::customAmountFormat($netcredit_bill) }} {{ \Helper::customAmountFormat($totaldiscount_amt) }} {{ \Helper::customAmountFormat($totaltaxable_amt) }} {{ \Helper::customAmountFormat($totalgst) }} {{ \Helper::customAmountFormat($totaltaxable_amt+$totalgst) }}
{{ strtoupper(Session::get('userId')) . ' # ' . $currentTime->format('d/m/Y H:i:s ') }}
@endif
Back
@endsection @section('BootstrapModals') @endsection @section('ExternalJs') @endsection