@extends('admin.layout.master') @section('title','Sales Summery') @section('custom_style') @endsection @section ('content')
@include('admin.layout.title_header', ['title'=>'SALES SUMMERY(ITEM WISE)'])
@php $r_types=[3=>'Sales',4=>'Return',0=>'Sales & Return']; @endphp
{!!getDateInput('date_from','date_from',Request()->date_from)!!} {!!getDateInput('date_to','date_to',Request()->date_to)!!} {{-- --}}
@php $printData['title']='SALES SUMMERY'; $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['search_by']=$r_types[$type]; $printData['showroom']=Request()->showroom && Request()->showroom!=0?$customers->where('id',Request()->showroom)->first()->name_eng:'All Showroom'; $routeName=Route::currentRouteName(); $printData=getPrintData($routeName,$printData); @endphp {!!$printData['head']!!} @php $tr=''; $tr2=''; @endphp @forelse ($transactions->groupBy('product.sub_category_id') as $cc=>$categoryProduct) @if($cc!=null) @php if(Request()->get_value==1){ $tr.='{{__("obs.qty")}}'; if($type==0){ $tr2.=''; $tr2.=''; $tr2.=''; } }else if(Request()->get_value==2){ $tr.='{{__("obs.amount")}}'; if($type==0){ $tr2.=''; $tr2.=''; $tr2.=''; } }else{ $tr.='{{__("obs.qty")}}{{__("obs.amount")}}'; if($type==0){ $tr2.=''; $tr2.=''; $tr2.=''; $tr2.=''; $tr2.=''; $tr2.=''; } } @endphp @endif @empty @endforelse @php if(Request()->get_value==1){ $tr.='{{__("obs.qty")}}'; if($type==0){ $tr2.=''; $tr2.=''; $tr2.=''; } }else if(Request()->get_value==2){ $tr.='{{__("obs.amount")}}'; if($type==0){ $tr2.=''; $tr2.=''; $tr2.=''; $tr2.=''; }else{ $tr.=''; $tr.=''; } }else{ $tr.='{{__("obs.qty")}}{{__("obs.amount")}}'; if($type==0){ $tr2.=''; $tr2.=''; $tr2.=''; $tr2.=''; $tr2.=''; $tr2.=''; $tr2.=''; }else{ $tr.=''; $tr.=''; } } @endphp {!! newBladeStringCompiler($tr.'', []) !!} {{-- {!! $tr.'' !!} --}} @if($type==0) {!! newBladeStringCompiler($tr2.'', []) !!} {{-- {!! $tr2.'' !!} --}} @endif @php $i=1; $total_oc_gt=0; @endphp @forelse ($transactions->groupBy('party_id') as $key=>$showroom) @if($key!=null) @php $total_cat_qty=0; $total_cat_sum=0; $total_cat_r_qty=0; $total_cat_r_sum=0; @endphp @forelse ($transactions->groupBy('product.sub_category_id') as $m=>$categoryProduct) @if($m!=null) @php $cat_qty=0; $cat_sum=0; $cat_r_qty=0; $cat_r_sum=0; @endphp {{-- product Category --}} @forelse ($categoryProduct->groupBy('product_id') as $k=>$transacted_product) @php $filtered_transaction= $transacted_product->where('party_id',$key)->where('product_id',$k); $cat_qty+=$filtered_transaction->where('transaction_type','=',3)->sum('quantity'); // $cat_sum+=$filtered_transaction->where('transaction_type','=',3)->sum(function($t){ return ($t->quantity * $t->avg_price)-(($t->quantity * $t->avg_price * $t->dc_price)/100);}); $cat_sum+=$filtered_transaction->where('transaction_type','=',3) ->sum(function($t){ $a=($t->quantity * $t->avg_price); $p=($a*((100-$t->dc_price)/100)); $inv=$t->invoice; if($inv->other_dc_percentage!=0){ return ($p+($p*$inv->other_dc_percentage)/100); }else{ return $p; } }); $cat_r_qty+=$filtered_transaction->where('transaction_type','!=',3)->sum('quantity'); // $cat_r_sum+=$filtered_transaction->where('transaction_type','!=',3)->sum(function($t){ return ($t->quantity * $t->avg_price)-(($t->quantity * $t->avg_price * $t->dc_price)/100);}); $cat_r_sum+=$filtered_transaction->where('transaction_type','!=',3) ->sum(function($t){ $a=($t->quantity * $t->avg_price); $p=($a*((100-$t->dc_price)/100)); $inv=$t->invoice; if(($t->transaction_type==7) && ($t->dr_cr==0)){ $p=($p*($inv->party_return_percentage/100)); } if($inv->other_dc_percentage!=0){ return ($p+($p*$inv->other_dc_percentage)/100); }else{ return $p; } }); @endphp @empty @endforelse {{-- product Category --}} @php $total_cat_qty+=$cat_qty; $total_cat_sum+=$cat_sum; $total_cat_r_qty+=$cat_r_qty; $total_cat_r_sum+=$cat_r_sum; @endphp @if(Request()->get_value==1) @if($type==0) @elseif($type==3) @elseif($type==4) @endif @elseif(Request()->get_value==2) @if($type==0) @elseif($type==3) @elseif($type==4) @endif @else @if($type==0) @elseif($type==3) @elseif($type==4) @endif @endif @endif @empty @endforelse @php $total_oc=$showRoomWiseInvoices[$key]->sum('other_charge'); $total_oc_gt+=$total_oc; @endphp @if(Request()->get_value==1) @if($type==0) @elseif($type==3) @elseif($type==4) @endif @elseif(Request()->get_value==2) @if($type==0) @elseif($type==3) {{-- --}} @elseif($type==4) {{-- --}} @endif @else @if($type==0) @elseif($type==3) {{-- --}} @elseif($type==4) {{-- --}} @endif @endif @endif @empty @endforelse @php $gtotal_cat_qty=0; $gtotal_cat_sum=0; $gtotal_cat_r_qty=0; $gtotal_cat_r_sum=0; @endphp @forelse ($transactions->groupBy('product.sub_category_id') as $m=>$categoryProduct) @if($m!=null) @php $cat_qty_gt=0; $cat_sum_gt=0; $cat_r_qty_gt=0; $cat_r_sum_gt=0; @endphp @forelse ($categoryProduct->groupBy('product_id') as $k=>$transacted_product) @php $sales_transaction=$transacted_product->where('product_id',$k)->where('transaction_type','=',3); $sales__return_transaction=$transacted_product->where('product_id',$k)->where('transaction_type','!=',3); $cat_qty_gt+=$sales_transaction->sum('quantity'); // $cat_sum_gt+=$sales_transaction->sum(function($t){ return ($t->quantity * $t->avg_price)-(($t->quantity * $t->avg_price * $t->dc_price)/100);}); $cat_sum_gt+=$sales_transaction->sum(function($t){ $a=($t->quantity * $t->avg_price); $p=($a*((100-$t->dc_price)/100)); $inv=$t->invoice; if($inv->other_dc_percentage!=0){ return ($p+($p*$inv->other_dc_percentage)/100); }else{ return $p; } }); $cat_r_qty_gt+=$sales__return_transaction->sum('quantity'); // $cat_r_sum_gt+=$sales__return_transaction->sum(function($t){ return ($t->quantity * $t->avg_price)-(($t->quantity * $t->avg_price * $t->dc_price)/100);}); $cat_r_sum_gt+=$sales__return_transaction->sum(function($t){ $a=($t->quantity * $t->avg_price); $p=($a*((100-$t->dc_price)/100)); $inv=$t->invoice; if(($t->transaction_type==7) && ($t->dr_cr==0)){ $p=($p*($inv->party_return_percentage/100)); } if($inv->other_dc_percentage!=0){ return ($p+($p*$inv->other_dc_percentage)/100); }else{ return $p; } }); @endphp @empty @endforelse @php $gtotal_cat_qty+=$cat_qty_gt; $gtotal_cat_sum+=$cat_sum_gt; $gtotal_cat_r_qty+=$cat_r_qty_gt; $gtotal_cat_r_sum+=$cat_r_sum_gt; @endphp @if(Request()->get_value==1) @if($type==0) @elseif($type==3) @elseif($type==4) @endif @elseif(Request()->get_value==2) @if($type==0) @elseif($type==3) @elseif($type==4) @endif @else @if($type==0) @elseif($type==3) @elseif($type==4) @endif @endif @endif @empty @endforelse @if(Request()->get_value==1) @if($type==0) @elseif($type==3) @elseif($type==4) @endif @elseif(Request()->get_value==2) @if($type==0) @elseif($type==3) {{-- --}} @elseif($type==4) {{-- --}} @endif @else @if($type==0) @elseif($type==3) {{-- --}} @elseif($type==4) {{-- --}} @endif @endif
# {{__("obs.showroom")}}{{$categoryProduct->first()->product->subCategory?$categoryProduct->first()->product->subCategory->name_eng:'N/A'}}{{__("obs.sales")}}{{__("obs.sales_return")}}{{__("obs.net")}}{{__("obs.sales")}}{{__("obs.sales_return")}}{{__("obs.net")}}{{__("obs.sales")}}{{__("obs.sales_return")}}{{__("obs.net")}}{{__("obs.sales")}}{{__("obs.sales_return")}}{{__("obs.net")}}{{__("obs.total")}}{{__("obs.sales")}}{{__("obs.sales_return")}}{{__("obs.net")}}{{__("obs.sales")}}{{__("obs.sales_return")}}{{__("obs.other_charge")}}{{__("obs.net")}}{{__("obs.other_charge")}}{{__("obs.net")}}{{__("obs.sales")}}{{__("obs.sales_return")}}{{__("obs.net")}}{{__("obs.sales")}}{{__("obs.sales_return")}}{{__("obs.other_charge")}}{{__("obs.net")}}{{__("obs.other_charge")}}{{__("obs.net")}}
{{$i++}} {{$showroom->first()->showroom->name_eng}}{{number_format($cat_qty,2)}} {{number_format($cat_r_qty,2)}} {{number_format(($cat_qty-$cat_r_qty),2)}}{{number_format($cat_qty,2)}}{{number_format($cat_r_qty,2)}}{{number_format($cat_sum,2)}} {{number_format($cat_r_sum,2)}} {{number_format(($cat_sum-$cat_r_sum),2)}}{{number_format($cat_sum,2)}}{{number_format($cat_r_sum,2)}}{{number_format($cat_qty,2)}} {{number_format($cat_r_qty,2)}} {{number_format(($cat_qty-$cat_r_qty),2)}} {{number_format($cat_sum,2)}} {{number_format($cat_r_sum,2)}} {{number_format(($cat_sum-$cat_r_sum),2)}}{{number_format($cat_qty,2)}} {{number_format($cat_sum,2)}}{{number_format($cat_r_qty,2)}} {{number_format($cat_r_sum,2)}}{{number_format($total_cat_qty,2)}} {{number_format($total_cat_r_qty,2)}} {{number_format(($total_cat_qty-$total_cat_r_qty),2)}}{{number_format($total_cat_qty,2)}}{{number_format($total_cat_r_qty,2)}}{{number_format($total_cat_sum,2)}} {{number_format($total_cat_r_sum,2)}} {{number_format($total_oc,2)}} {{number_format(($total_oc+$total_cat_sum-$total_cat_r_sum),2)}}{{number_format($total_cat_sum,2)}}{{number_format($total_oc,2)}} {{number_format(($total_oc+$total_cat_sum),2)}}{{number_format($total_cat_r_sum,2)}}{{number_format($total_oc,2)}} {{number_format(($total_oc+$total_cat_r_sum),2)}}{{number_format($total_cat_qty,2)}} {{number_format($total_cat_r_qty,2)}} {{number_format(($total_cat_qty-$total_cat_r_qty),2)}} {{number_format($total_cat_sum,2)}} {{number_format($total_cat_r_sum,2)}} {{number_format($total_oc,2)}} {{number_format(($total_oc+$total_cat_sum-$total_cat_r_sum),2)}}{{number_format($total_cat_qty,2)}} {{number_format($total_cat_sum,2)}}{{number_format($total_oc,2)}} {{number_format(($total_oc+$total_cat_sum),2)}}{{number_format($total_cat_r_qty,2)}} {{number_format($total_cat_r_sum,2)}}{{number_format($total_oc,2)}} {{number_format(($total_oc+$total_cat_r_sum),2)}}
{{__("obs.total")}}{{number_format($cat_qty_gt,2)}} {{number_format($cat_r_qty_gt,2)}} {{number_format(($cat_qty_gt-$cat_r_qty_gt),2)}}{{number_format($cat_qty_gt,2)}}{{number_format($cat_r_qty_gt,2)}}{{number_format($cat_sum_gt,2)}} {{number_format($cat_r_sum_gt,2)}} {{number_format(($cat_sum_gt-$cat_r_sum_gt),2)}}{{number_format($cat_sum_gt,2)}}{{number_format($cat_r_sum_gt,2)}}{{number_format($cat_qty_gt,2)}} {{number_format($cat_r_qty_gt,2)}} {{number_format(($cat_qty_gt-$cat_r_qty_gt),2)}} {{number_format($cat_sum_gt,2)}} {{number_format($cat_r_sum_gt,2)}} {{number_format(($cat_sum_gt-$cat_r_sum_gt),2)}}{{number_format($cat_qty_gt,2)}} {{number_format($cat_sum_gt,2)}}{{number_format($cat_r_qty_gt,2)}} {{number_format($cat_r_sum_gt,2)}}{{number_format($gtotal_cat_qty,2)}} {{number_format($gtotal_cat_r_qty,2)}} {{number_format(($gtotal_cat_qty-$gtotal_cat_r_qty),2)}}{{number_format($gtotal_cat_qty,2)}}{{number_format($gtotal_cat_r_qty,2)}}{{number_format($gtotal_cat_sum,2)}} {{number_format($gtotal_cat_r_sum,2)}} {{number_format($total_oc_gt,2)}} {{number_format(($total_oc_gt+$gtotal_cat_sum-$gtotal_cat_r_sum),2)}}{{number_format($gtotal_cat_sum,2)}}{{number_format($total_oc_gt,2)}} {{number_format(($total_oc_gt+$gtotal_cat_sum-$gtotal_cat_r_sum),2)}}{{number_format($gtotal_cat_r_sum,2)}}{{number_format($total_oc_gt,2)}} {{number_format(($total_oc_gt+$gtotal_cat_sum-$gtotal_cat_r_sum),2)}}{{number_format($gtotal_cat_qty,2)}} {{number_format($gtotal_cat_r_qty,2)}} {{number_format(($gtotal_cat_qty-$gtotal_cat_r_qty),2)}} {{number_format($gtotal_cat_sum,2)}} {{number_format($gtotal_cat_r_sum,2)}} {{number_format($total_oc_gt,2)}} {{number_format(($total_oc_gt+$gtotal_cat_sum-$gtotal_cat_r_sum),2)}}{{number_format($gtotal_cat_qty,2)}} {{number_format($gtotal_cat_sum,2)}}{{number_format($total_oc_gt,2)}} {{number_format(($total_oc_gt+$gtotal_cat_sum),2)}}{{number_format($gtotal_cat_r_qty,2)}} {{number_format($gtotal_cat_r_sum,2)}}{{number_format($total_oc_gt,2)}} {{number_format(($total_oc_gt+$gtotal_cat_r_sum),2)}}

{{-- @include('inventory.order.detail_modal') --}} @endsection @section('script') @stop