@extends('admin.layouts.form') @section('custom_page_style') @endsection @section('content')
Portal | Particular | @foreach($week_list as $week){{ \Carbon\Carbon::now()->setISODate(substr($week, 0, 4), substr($week, 4))->startOfWeek()->format('d M') }} - {{ \Carbon\Carbon::now()->setISODate(substr($week, 0, 4), substr($week, 4))->endOfWeek()->format('d M') }} | @endforeach
---|---|---|
Revenue Summary | ||
Total Revenue | @foreach($week_list as $week)@php $total_revenue = collect($sales_portal)->flatMap(function ($item) { return $item['revenue']; })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('revenue_after_commission'); @endphp {!! $total_revenue !!} | @endforeach|
Physical Store Revenue | @foreach($week_list as $week)@php $total_revenue = collect($sales_portal)->flatMap(function ($item) { if($item['name'] == 'Store'){ return $item['revenue']; } })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('revenue_after_commission'); @endphp {!! $total_revenue !!} | @endforeach|
Online Revenue After Commission | @foreach($week_list as $week)@php $total_revenue = collect($sales_portal)->flatMap(function ($item) { if($item['name'] != 'Store'){ return $item['revenue']; } })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('revenue_after_commission'); @endphp {!! $total_revenue !!} | @endforeach|
Physical Store Revenue % | @foreach($week_list as $week)@php $store_revenue = collect($sales_portal)->flatMap(function ($item) { if($item['name'] == 'Store'){ return $item['revenue']; } })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('revenue_after_commission'); $total_revenue = collect($sales_portal)->flatMap(function ($item) { return $item['revenue']; })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('revenue_after_commission'); @endphp {!! $total_revenue > 0 ? round(($store_revenue/$total_revenue) * 100, 2) : $total_revenue !!} % | @endforeach|
Online Revenue % | @foreach($week_list as $week)@php $online_revenue = collect($sales_portal)->flatMap(function ($item) { if($item['name'] != 'Store'){ return $item['revenue']; } })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('revenue_after_commission'); $total_revenue = collect($sales_portal)->flatMap(function ($item) { return $item['revenue']; })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('revenue_after_commission'); @endphp {!! $total_revenue > 0 ? round(($online_revenue/$total_revenue) * 100, 2) : $total_revenue !!} % | @endforeach|
Number of Transaction | @foreach($week_list as $week)@php $number_of_transaction = collect($sales_portal)->flatMap(function ($item) { return $item['revenue']; })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('number_of_transaction'); @endphp {!! $number_of_transaction !!} | @endforeach|
Per Transaction Revenue | @foreach($week_list as $week)@php $total_revenue = collect($sales_portal)->flatMap(function ($item) { return $item['revenue']; })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('revenue_after_commission'); $number_of_transaction = collect($sales_portal)->flatMap(function ($item) { return $item['revenue']; })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('number_of_transaction'); @endphp {!! $number_of_transaction > 0 ? round($total_revenue / $number_of_transaction, 2) : $total_revenue !!} | @endforeach|
Staff Cost % | @foreach($week_list as $week)@php $total_expense = $expense->filter(function($exp) use($week) { return \Carbon\Carbon::parse($exp['expense_date'])->format('YW') == $week; })->sum('amount'); $staff_cost = $expense->whereIn('expense_head_id',$staff_cost_id)->filter(function($exp) use($week) { return \Carbon\Carbon::parse($exp['expense_date'])->format('YW') == $week; })->sum('amount'); @endphp {!! $total_expense > 0 ? round(($staff_cost/$total_expense) * 100, 2): $total_expense !!} % | @endforeach|
Food Cost % | @foreach($week_list as $week)@php $total_expense = $expense->filter(function($exp) use($week) { return \Carbon\Carbon::parse($exp['expense_date'])->format('YW') == $week; })->sum('amount'); $food_cost = $expense->whereIn('expense_head_id',$food_cost_id)->filter(function($exp) use($week) { return \Carbon\Carbon::parse($exp['expense_date'])->format('YW') == $week; })->sum('amount'); @endphp {!! $total_expense > 0 ? round(($food_cost/$total_expense) * 100, 2): $total_expense !!} % | @endforeach|
Online | ||
Number of transaction | @foreach($week_list as $week)@php $no_of_transaction_online = collect($sales_portal)->flatMap(function ($item) { if($item['name'] != 'Store'){ return $item['revenue']; } })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('number_of_transaction'); @endphp {!! $no_of_transaction_online !!} | @endforeach|
Revenue after commission | @foreach($week_list as $week)@php $total_revenue_online = collect($sales_portal)->flatMap(function ($item) { if($item['name'] != 'Store'){ return $item['revenue']; } })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('revenue_after_commission'); @endphp {!! $total_revenue_online !!} | @endforeach|
Per transaction revenue | @foreach($week_list as $week)@php $no_of_transaction_online = collect($sales_portal)->flatMap(function ($item) { if($item['name'] != 'Store'){ return $item['revenue']; } })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('number_of_transaction'); $total_revenue_online = collect($sales_portal)->flatMap(function ($item) { if($item['name'] != 'Store'){ return $item['revenue']; } })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('revenue_after_commission'); @endphp {!! $no_of_transaction_online > 0 ? round($total_revenue_online/$no_of_transaction_online, 2) : $total_revenue_online !!} | @endforeach|
{!! $portal->name !!} | ||
Number of Transaction | @foreach($week_list as $week){!! $portal->revenue->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('number_of_transaction') !!} | @endforeach|
Revenue After Commission | @foreach($week_list as $week){!! $portal->revenue->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('revenue_after_commission') !!} | @endforeach|
Per transaction revenue | @foreach($week_list as $week) @php $total_no_of_transaction = $portal->revenue->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('number_of_transaction'); $total_revenue_after_commission = $portal->revenue->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue['revenue_date'])->format('YW') == $week; })->sum('revenue_after_commission'); @endphp{!! $total_no_of_transaction > 0 ? round($total_revenue_after_commission / $total_no_of_transaction) : $total_revenue_after_commission !!} | @endforeach|
Cost | ||
Total Cost | @foreach($week_list as $week){!! $expense->filter(function($exp) use($week) { return \Carbon\Carbon::parse($exp['expense_date'])->format('YW') == $week; })->sum('amount') !!} | @endforeach|
Staff Cost | @foreach($week_list as $week){!! $expense->whereIn('expense_head_id',$staff_cost_id)->filter(function($exp) use($week) { return \Carbon\Carbon::parse($exp['expense_date'])->format('YW') == $week; })->sum('amount') !!} | @endforeach|
Food Cost | @foreach($week_list as $week){!! $expense->whereIn('expense_head_id',$food_cost_id)->filter(function($exp) use($week) { return \Carbon\Carbon::parse($exp['expense_date'])->format('YW') == $week; })->sum('amount') !!} | @endforeach|
Operation Cost | @foreach($week_list as $week){!! $expense->whereIn('expense_head_id', $operation_cost_ids)->filter(function($exp) use($week) { return \Carbon\Carbon::parse($exp['expense_date'])->format('oW') == $week; })->sum('amount') !!} | @endforeach|
Staff Cost - Per Transaction | @foreach($week_list as $week)@php $staff_cost = $expense->whereIn('expense_head_id',$staff_cost_id)->filter(function($exp) use($week) { return \Carbon\Carbon::parse($exp->expense_date)->format('oW') == $week; })->sum('amount'); $number_of_transaction = collect($sales_portal)->flatMap(function ($item) { return $item['revenue']; })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue->revenue_date)->format('oW') == $week; })->sum('number_of_transaction'); echo $number_of_transaction > 0 ? round( ($staff_cost/$number_of_transaction) , 2) : $number_of_transaction; @endphp | @endforeach|
Food Cost - Per Transaction | @foreach($week_list as $week)@php $food_cost = $expense->whereIn('expense_head_id',$food_cost_id)->filter(function($exp) use($week) { return \Carbon\Carbon::parse($exp->expense_date)->format('oW') == $week; })->sum('amount'); $number_of_transaction = collect($sales_portal)->flatMap(function ($item) { return $item['revenue']; })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue->revenue_date)->format('oW') == $week; })->sum('number_of_transaction'); echo $number_of_transaction > 0 ? round( ($food_cost/$number_of_transaction) , 2) : $number_of_transaction; @endphp | @endforeach|
Operation Cost - Per Transaction | @foreach($week_list as $week)@php $operation_cost = $expense->whereIn('expense_head_id',$operation_cost_ids)->filter(function($exp) use($week) { return \Carbon\Carbon::parse($exp->expense_date)->format('oW') == $week; })->sum('amount'); $number_of_transaction = collect($sales_portal)->flatMap(function ($item) { return $item['revenue']; })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue->revenue_date)->format('oW') == $week; })->sum('number_of_transaction'); echo $number_of_transaction > 0 ? round( ($operation_cost/$number_of_transaction) , 2) : $number_of_transaction; @endphp | @endforeach|
Per Transaction Total cost | @foreach($week_list as $week)@php $total_cost = $expense->filter(function($exp) use($week) { return \Carbon\Carbon::parse($exp->expense_date)->format('oW') == $week; })->sum('amount'); $number_of_transaction = collect($sales_portal)->flatMap(function ($item) { return $item['revenue']; })->filter(function($revenue) use($week) { return \Carbon\Carbon::parse($revenue->revenue_date)->format('oW') == $week; })->sum('number_of_transaction'); echo $number_of_transaction > 0 ? round( ($total_cost/$number_of_transaction) , 2) : $number_of_transaction; @endphp | @endforeach