@extends('front.layouts.main') @section('content') @php $total_main_product = DB::table('main_products')->get(); $totalstock = $total_main_product->sum('quantity'); $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'); $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
@if (Auth::user()->role == 'supmin')

{{ $profits }}

Total Profit

{{ $profits_this_month }}

Monthly Total Profit

{{ $order_this_month }}

Monthly Order

{{ $totalbuyings }}

Total purchase

{{ $totalsellings }}

Total sales

{{ $totalsellings - $totalbuyings }}

Target Profit

{{ $total_sell_count_this_month }}

Sales in {{ date('F')}}

@endif

{{ $total_sell_today }}

Today's Sales

@if (Auth::user()->role == 'supmin')

{{ $profit_today }}

Today's Profit

{{ $total_due }}

Customer's Due

{{ $totalbuyings }}

Payable for Suppliers

{{ $totalstock }}

Product's in Stock

@endif

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

Cash In Hand Today

Clear
@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