@include('admin.layout.title_header', ['title'=>'SALES SUMMERY(ITEM WISE)'])
{{--
--}}
{{--
Sales Report By Items
@if(Request()->showroom && Request()->showroom!=0)
{{$customers->where('id',Request()->showroom)->first()->name_eng}}
@else
All Showroom
@endif
@if(Request()->date_from)
{{ 'From '.date('d-M-Y',strtotime(Request()->date_from)).' To '.date('d-M-Y',strtotime(Request()->date_to))}}
@endif --}}
@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']!!}
| # |
PRODUCT |
Sales |
Sales Return |
NetSale |
{{-- @forelse ($showRooms as $party_id => $showRoom)
SHOWROOM :{{$showRoom->first()->showroom->name_eng}} Address :{{$showRoom->first()->showroom->address}} |
--}}
@php
$i=1;
@endphp
@forelse ($transactions->groupBy('product.cat_code') as $k=>$categoryProduct)
{{-- |
|
|
| --}}
{{$categoryProduct->first()->product->catByCatCode?$categoryProduct->first()->product->catByCatCode->name_eng:'N/A'}} |
@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','!=',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');
@endphp
@if($sales>0 || $sales_return>0)
| {{$i++}} |
{{$item->first()->product->name_eng}} |
{{number_format($sales,2)}}
|
{{number_format($sales_return,2)}} |
{{number_format(($sales-$sales_return),2)}} |
@endif
@empty
@endforelse
@empty
| No Data Available |
@endforelse
| Total |
{{number_format($sales_total=Request()->get_value==1
?$transactions->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;
}
})
:$transactions->where('transaction_type',3)->sum('quantity'),2)}} |
{{number_format($sales_return_total=Request()->get_value==1
?$transactions->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;
}
})
:$transactions->where('transaction_type','!=',3)->sum('quantity'),2)}} |
{{number_format(($sales_total-$sales_return_total),2)}} |
{{-- @empty
@endforelse --}}