@php $sno = 1; $Plan_price = $telephone = $customer_id = $plan_id = $customerInfo = $cusName = ''; @endphp @foreach($orders as $key => $row) @foreach($row->orderProducts as $products) @php $voucherVal = $mrp = 0; $isSpsOrder = $row->isSPSOrder(); if(!empty($products->warehouseProd)){ $mrpProduct = \DB::table('oc_warehouse_product')->select('mrp')->where('barcode',$products->barcode)->first(); if(!empty($mrpProduct)) { $mrp = $mrpProduct->mrp; } } $Plan_price = $telephone = $customer_id = $plan_id = $customerInfo = $cusName = ''; if($isSpsOrder == 1) { $planinfo = $row->getManipulatedMrpForSpsOrder; $customerInfo = $planinfo->customerInfo; $cusName = $customerInfo->firstname.' '.$customerInfo->lastname; $telephone = $customerInfo->telephone; $customer_id = $planinfo->customer_id; $plan_id = $planinfo->plan_id; $plan_name = \DB::table('oc_plan_description')->select('plan_name')->where('plan_id',$plan_id)->first(); $plan_name = $plan_name->plan_name; $Plan_price = $planinfo->Plan->price; $plan_date = $planinfo->start_date; if(!empty($planinfo)) { $defaultDiscount = $planinfo->discount; $bdayDiscount = $planinfo->bdaydiscount; $annDiscount = $planinfo->anndiscount; $aptDiscount = 5; $bapplied = false; $birthres = $products->orderByBirthday; if($birthres) { $bapplied = true; } $annApplied = false; $annverres = $products->orderByAnn; if($annverres) { $annApplied = true; } $aptApplied = false; $appoinres = $products->orderByAppointment; if($appoinres) { $aptApplied = true; } $vouchRes = $products->orderByVoucher; if($vouchRes) { $voucherVal = $vRow['value']; $totProds = $row->orderProducts->count(); if($voucherVal > 0) { $voucherVal = $voucherVal / $totProds; } } $mrpp = $mrp <= 0 ? 0 : $mrp - ( $products->offer + $products->discount ); if($mrpp == 0) { $smrp = $mrpp; } else { $tempMrp = $mrpp - $voucherVal; $tempMrp = $tempMrp - (($defaultDiscount/100) * $tempMrp); if($bapplied == true) { $tempMrp = $tempMrp - (($bdayDiscount/100) * $tempMrp); } if($annApplied == true) { $tempMrp = $tempMrp - (($annDiscount/100) * $tempMrp); } if($aptApplied == true) { $tempMrp = $tempMrp - (($aptDiscount/100) * $tempMrp); } $smrp = number_format($tempMrp,2,'.',''); } }else { $tax = $products->tax; $mrpp = $mrp <= 0 ? 0 : $mrp; $calMrp1 = ($tax * 100)/5; $calMrp2 = ($tax * 100)/12; $mixMrp1 = abs($mrpp - $calMrp1); $mixMrp2 = abs($mrpp - $calMrp2); if($mixMrp1 < $mixMrp2) { $smrp = abs($calMrp1 + $tax); } else { $smrp = abs($calMrp2 + $tax); } } }else{ $smrp = 0; } if($isSpsOrder == 1) { $gst = $smrp <= 999 ? 5 : 12; }else{ $gst = $mrp <= 999 ? 5 : 12; } if($isSpsOrder){ if($smrp > 0){ $rate = ($smrp/($gst + 100)) * 100; $baseval = ($smrp/($gst + 100)) * 100; $taxamt = $smrp - $rate; //$row['tax']; }else{ $rate = $baseval = $taxamt = 0; } }else{ if($mrp <= 0){ $rate = $baseval = $taxamt = 0; }else{ $rate = ($mrp/($gst + 100)) * 100; $baseval = ($mrp/($gst + 100)) * 100; $taxamt = $products->tax; } } if($taxamt <= 0) { $total =number_format(0,2); }else{ if($isSpsOrder == 1){ $total = number_format(($smrp * $products->quantity),3); }else{ $mrpdis = $mrp - ( $products->offer + $products->discount ) ; $total = number_format(($mrpdis * $products->quantity),3); } } @endphp @endforeach @endforeach
S.No. store BILL Date HSN Section Sub Section Color Size Qty Style Name Telephone SPS SPS On MRP SPS
MRP
Discount Offer Rate Base
Value
CGST (%) CGST
Amt
SGST (%) SGST
Amt
Tax (%) Tax
Amt
Total (₹)
{{ $sno }} {{ $row->warehouse->name }} {{ $row['pos_order_suffix'] }} {{ \Helper::humanDate($row['date_added']) }} {{ !empty($products->fabric) ? $products->fabric : 'N/A' }} {{ !empty($products->warehouseProd) ? $products->warehouseProd->section : 'N/A' }} {{ !empty($products->warehouseProd) ? $products->warehouseProd->subsection : 'N/A' }} {{ $products->color}} {{ $products->size}} {{ $products->quantity}} {{ !empty($products->warehouseProd) ? $products->warehouseProd->article : 'N/A' }} {{ !empty($cusName) ? $cusName : $row->customerInfo->firstname.' '.$row->customerInfo->lastname }} {{ !empty($telephone) ? $telephone : $row->customerInfo->telephone }} {{ !empty($Plan_price) ? $plan_name : 0 }} @if(!empty($Plan_price)) {{ ( date('Y-m-d',strtotime($row['date_added'])) == $plan_date ) ? 'New' : 'Old' }} @else {{ 'none' }} @endif {{ !empty($products->price) ? $mrp : 'N/A' }} {{ !empty($isSpsOrder) ? number_format($smrp,3) : '0.00' }} {{ $products->discount}} {{ $products->offer}} {{ number_format($rate,3)}} {{ number_format($baseval,3)}} @if($taxamt <= 0) {{ 0 }} @else {{number_format(($gst/2),2)}} @endif @if($taxamt <= 0) {{ 0 }} @else {{number_format(($taxamt/2),2)}} @endif @if($taxamt <= 0) {{ 0 }} @else {{number_format(($gst/2),2)}} @endif @if($taxamt <= 0) {{ 0 }} @else {{number_format(($taxamt/2),2)}} @endif {{$gst}} {{number_format($taxamt,3)}} {{$total}}