@extends('admin.layout.master') @section('title','ORDER SHEET') @section('custom_style') @endsection @section ('content')

Order Sheet

 
{{-- --}}
{{-- --}}
{{--
--}}
{{--
--}} @if(count($orders))
@php $printData['start_date']=Request()->date_from?date('d-M-Y',strtotime(Request()->date_from)):date('d-M-Y'); $printData['end_date']=Request()->date_to?date('d-M-Y',strtotime(Request()->date_to)):date('d-M-Y'); $printData['warehouse']=Request()->warehouse_id && Request()->warehouse_id!=0?$warehouses->where('id',Request()->warehouse_id)->first()->name_eng:'All Showroom'; $routeName=Route::currentRouteName(); $printData=getPrintData($routeName,$printData); @endphp {!!$printData['head']!!} @php $th=''; $th1=''; $colspan=1; $rowspan=2; foreach($categories as $cc=>$subCategory){ $cat_sub_total[$subCategory->id]=0; $cat_sub_amountTotal[$subCategory->id]=0; if($rowspan==2){ $colspan=count($subCategory->product); $th1.=''; } foreach ($subCategory->product as $k=>$product){ $pro_sub_total[$product->id]=0; // $c_pro_sub_total[$product->id]=0; $th.=''; } $th.=''; } @endphp {{-- --}} {!!$rowspan==2?$th1:$th!!} @if($rowspan==2) {!!$th!!} @endif @php $p=1; $action_id=801; $isOrderShowedShopWise=[]; @endphp @forelse (Request()->shop_id?$shops->where('id',Request()->shop_id):$shops as $key=>$zone) @php $zone_group=array_filter(explode(',',($zone->officer?$zone->officer->group_ids:null))); $parties=$showroom->whereIn('group_id',$zone_group)->pluck('id')->toArray(); if(count($parties)){ $transactions=$orders->whereIn('party_id',$parties)->where('transaction_type',14); $isOrderShowedShopWise=array_merge($isOrderShowedShopWise,$transactions->pluck('id')->toArray()); }else{ $transactions=[]; } @endphp @forelse ($transactions as $i=>$item) @php $zonalTotal[$item->id]=0; $zonalTotalQty[$item->id]=0; $row=''; foreach($categories as $cc=>$subCategory){ $catAmount=0; $proWiseTotalAmount=0; foreach ($subCategory->product as $k=>$product){ $productTrans=$item->details->where('product_id',$product->id); $catAmount+=$amt=(count($productTrans)?$productTrans->sum(function($q) {return ($q->order_qty/$q->unit_qty);}):0); // $catAmount+=$amt=(count($productTrans)?$productTrans->sum('order_qty'):0); $proWiseTotalAmount+=(count($productTrans)?$productTrans->sum(function($q) {return ($q->order_qty*$q->order_price);}):0); // $proWiseTotalAmount+=(count($productTrans)?$productTrans->sum(function($q) {return ($q->order_qty*$q->order_price*$q->unit_qty);}):0); $pro_sub_total[$product->id]+=$amt; $row.=''; $zonalTotalQty[$item->id]+=$amt; } $zonalTotal[$item->id]+=$proWiseTotalAmount; $cat_sub_total[$subCategory->id]+=$catAmount; $cat_sub_amountTotal[$subCategory->id]+=$proWiseTotalAmount; $row.=''; } @endphp {!!$row!!} @empty @endforelse {{-- $transactions --}} @empty @endforelse {{-- $shops --}} @php $transactions=$orders->whereNotIn('id',$isOrderShowedShopWise)->where('transaction_type',14); @endphp {{-- IF NOT RM WISE --}} @forelse ($transactions as $i=>$item) @php $row=''; $zonalTotal[$item->id]=0; $zonalTotalQty[$item->id]=0; foreach($categories as $cc=>$subCategory){ $catAmount=0; $proWiseTotalAmount=0; foreach ($subCategory->product as $k=>$product){ $productTrans=$item->details->where('product_id',$product->id); $catAmount+=$amt=(count($productTrans)?$productTrans->sum(function($q) {return ($q->order_qty/$q->unit_qty);}):0); // $catAmount+=$amt=(count($productTrans)?$productTrans->sum('order_qty'):0); $proWiseTotalAmount+=(count($productTrans)?$productTrans->sum(function($q) {return ($q->order_qty*$q->order_price);}):0); // $proWiseTotalAmount+=(count($productTrans)?$productTrans->sum(function($q) {return ($q->order_qty*$q->order_price*$q->unit_qty);}):0); $pro_sub_total[$product->id]+=$amt; $row.=''; $zonalTotalQty[$item->id]+=$amt; } $zonalTotal[$item->id]+=$proWiseTotalAmount; $cat_sub_total[$subCategory->id]+=$catAmount; $cat_sub_amountTotal[$subCategory->id]+=$proWiseTotalAmount; $row.=''; } @endphp {!!$row!!} @empty @endforelse @php $row=''; foreach($categories as $cc=>$subCategory){ foreach ($subCategory->product as $k=>$product){ $amt=$pro_sub_total[$product->id]; $row.=''; } $catAmount=$cat_sub_total[$subCategory->id]; $row.=''; } @endphp {!!$row!!}
'.$subCategory->name_eng.''.$product->short_name.''.($rowspan==2?'Total':$subCategory->name_eng).'
# Dealer Group TotalDetails
Qty Amt
'.round($amt).''.round($catAmount).'
{{ ($p++).'--'.$item->id }} {{ $item->showroom?$item->showroom->name_eng:'N\A' }} {{ $item->showroom?($item->showroom->group_id?$groups->where('id',$item->showroom->group_id)->first()->name_eng:'no Group'):'' }} {{round($zonalTotalQty[$item->id])}} {{round($zonalTotal[$item->id])}}
'.round($amt).''.round($catAmount).'
{{ ($p++) }} {{ $item->showroom?$item->showroom->name_eng:'N\A' }} {{ $item->showroom?($item->showroom->group_id?$groups->where('id',$item->showroom->group_id)->first()->name_eng:'no Group'):'' }} {{round($zonalTotalQty[$item->id])}} {{round($zonalTotal[$item->id])}}
'.round($amt).''.round($catAmount).'
{{ 'TOTAL' }} {{round(array_sum($zonalTotalQty))}} {{round(array_sum($zonalTotal))}}
@forelse($categories as $cc=>$subCategory) @empty @endforelse @forelse($categories as $cc=>$subCategory) @empty @endforelse @forelse($categories as $cc=>$subCategory) @empty @endforelse
CATEGORY WISE ORDER SHEET
Category{{$subCategory->name_eng}}Total
Qty{{round($cat_sub_total[$subCategory->id])}}{{round(array_sum($cat_sub_total))}}
Amount{{round($cat_sub_amountTotal[$subCategory->id])}}{{round(array_sum($cat_sub_amountTotal))}}
@endif {{-- --}}
@include('inventory.order.detail_modal') @endsection @section('script') @stop