@extends('admin.layout.master') @section('title','SALES SUMMERY') @section('custom_style') @endsection @section ('content')
@include('admin.layout.title_header', ['title'=>'SALES SUMMERY(ITEM WISE)'])
{{-- --}}
{!!getDateInput('date_from','date_from',Request()->date_from)!!} {!!getDateInput('date_to','date_to',Request()->date_to)!!} {{-- --}}
{{-- @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['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 $i=1; $sales_total=0; $sales_return_total=0; $sales_return_fd_total=0; @endphp @forelse ($transactions->groupBy('product.cat_code') as $k=>$categoryProduct) @php $sales_total_g=0; $sales_return_total_g=0; $sales_return_fd_total_g=0; $cat_name=$categoryProduct->first()->product->catByCatCode?$categoryProduct->first()->product->catByCatCode->name_eng:'N/A'; @endphp @forelse ($categoryProduct->groupBy('product_id') as $key=>$item) @php $sales=Request()->get_value==1 ?$item->where('transaction_type',3) // ->sum(function($t){ return ($t->quantity * $t->avg_price)-(($t->quantity * $t->avg_price * $t->dc_price)/100);}) ->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; } }) :$item->where('transaction_type',3)->sum('quantity'); $sales_return=Request()->get_value==1?$item->where('transaction_type','=',4) ->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; } }) :$item->where('transaction_type','=',4)->sum('quantity'); $sales_return_fd=Request()->get_value==1?$item->where('transaction_type','=',7) ->sum(function($t){ $a=($t->quantity * $t->avg_price); $p=($a*((100-$t->dc_price)/100)); $inv=$t->invoice; if(($t->dr_cr==0) && (!Request()->fd_type)){ $p=($p*($inv->party_return_percentage/100)); } if($inv->other_dc_percentage!=0){ return ($p+($p*$inv->other_dc_percentage)/100); }else{ return $p; } }) :$item->where('transaction_type','=',7)->sum('quantity'); @endphp @if($sales>0 || $sales_return>0 || $sales_return_fd>0) @php $sales_total_g+=$sales; $sales_return_total_g+=$sales_return; $sales_return_fd_total_g+=$sales_return_fd; $sales_total+=$sales; $sales_return_total+=$sales_return; $sales_return_fd_total+=$sales_return_fd; @endphp @endif @empty @endforelse @empty @endforelse
# {{__('obs.product')}} {{__('obs.sales')}} {{__('obs.sales')}} {{__('obs.return')}} {{__('obs.netsale')}}
{{__('obs.sd')}} {{__('obs.fd')}}
{{$cat_name}}
{{$i++}} {{$item->first()->product->name_eng}} {{number_format($sales,2)}} {{number_format($sales_return,2)}} {{number_format($sales_return_fd,2)}} {{number_format(($sales-$sales_return-$sales_return_fd),2)}}
Total {{$cat_name}} {{number_format(($sales_total_g),2)}} {{number_format(($sales_return_total_g),2)}} {{number_format(($sales_return_fd_total_g),2)}} {{number_format(($sales_total_g-$sales_return_total_g-$sales_return_fd_total_g),2)}}
{{__('obs.no')}} {{__('obs.data')}} {{__('obs.available')}}
{{__('obs.total')}} {{number_format(($sales_total),2)}} {{number_format(($sales_return_total),2)}} {{number_format(($sales_return_fd_total),2)}} {{number_format(($sales_total-$sales_return_total-$sales_return_fd_total),2)}}
--}}

@include('admin.global.loader') @endsection @section('script') @stop