@extends('front.layouts.main') @section('content')

{{ $profits }}

Total Profit

{{ $profits_this_month }}

Monthly Total Profit

{{ $order_this_month }}

Monthly Order

@php $total_main_product = DB::table('main_products')->get(); $total_buying_price = $total_main_product->sum('cost'); $total_selling_price = $total_main_product->sum('price'); @endphp

{{ $totalbuyings }}

Total Buying Price

{{ $totalsellings }}

Total Selling Price

{{ $totalsellings - $totalbuyings }}

Approx Profit

@php $month = Carbon\Carbon::now()->format('m'); $total_sell = DB::table('orders')->whereMonth('created_at', $month)->get(); $total_sell_count_this_month = $total_sell->sum('total'); $total_sell_today = DB::table('orders')->whereDate('created_at', Carbon\Carbon::today())->sum('total'); @endphp

{{ $total_sell_count_this_month }}

Total Sell This Month

{{ $total_sell_today }}

Total Sell Today

{{ $profit_today }}

Today Profit

@php $total_due = DB::table('orders')->sum('due'); $today_due = DB::table('orders')->whereDate('created_at', Carbon\Carbon::today())->sum('due'); $purchased = DB::table('main_products')->whereDate('created_at', Carbon\Carbon::today())->sum('cost'); @endphp

{{ $total_due }}

Total Due

{{ $handcash + $total_sell_today - $purchased - $today_due}}

Cash In Hand Today

@if (Auth::user()->role == 'supmin') @php $partners = DB::table('profit_partners')->get(); @endphp @foreach ($partners as $item)

{{ ($profits/100)*$item->share }}

{{ $item->name }}'s Total Profit

{{ ($profits_this_month/100)*$item->share }}

{{ $item->name }}'s Profit This Month

@endforeach @endif @if (Auth::user()->role == 'manager')
@php $supply = DB::table('products')->where('status', 1 )->count(); @endphp

{{ $supply }}

Sorted Supply

@php $unsupply = DB::table('products')->where('status', 0 )->count(); @endphp

{{ $unsupply }}

Unsorted Supply

@endif
{{--

Sales Of The Year

--}} @php $month = Carbon\Carbon::now()->format('m'); $completed = DB::table('orders')->whereMonth('created_at',$month)->where('status',1)->count(); $unpaid = DB::table('orders')->whereMonth('created_at',$month)->where('status',0)->count(); @endphp {{--

Sales Overview

--}}

Sold by Units

@foreach ($top_products as $item) @php $top_product_count = 0; foreach($item->orders as $order) { $top_product_count += $order->quantity; } @endphp @endforeach
{{ $item->name }}{{ $top_product_count }}

New Customers

@foreach ($customers as $item) @endforeach
{{ $item->name }}
{{ $item->email }}
{{ $item->orders->count() }} Orders {{ $item->orders->sum('total') }} BDT

Recent Orders

@foreach ($orders as $item) @endforeach
Order ID Order Date Order Cost
{{ $item->id }} {{ Carbon\Carbon::parse($item->created_at)->format('d M, Y') }} {{ $item->total }} BDT
@endsection