@extends('layouts.admin') @section('title', 'Product | Mintavia Admin') @section('css') @endsection @section('content')
@if (isset($message) && $message) @switch($message['status']) @case('success') @break @case('error') @break @endswitch @endif

Bill & Item wise profit/ loss

{{-- Filter Value --}}
@php $totalQty = collect($sales)->sum(function ($sale) { return (float) preg_replace('/[^\d.\-]/', '', $sale['total_qty']); }); $totalValue = collect($sales)->sum(function ($sale) { return (float) preg_replace('/[^\d.\-]/', '', $sale['total_value']); }); $totalCost = collect($sales)->sum(function ($sale) { return (float) preg_replace('/[^\d.\-]/', '', $sale['total_cost']); }); $totalProfit = collect($sales)->sum(function ($sale) { return (float) preg_replace('/[^\d.\-]/', '', $sale['total_profit_loss']); }); @endphp
@foreach ($sales as $sale) {{-- Summary Row --}} {{-- Detail Items Row --}} @endforeach
Date Bill No. Total Qty Sale Value Purchase Cost Profit/Loss Profit/Loss % Action
{{ \Carbon\Carbon::parse($sale['date'])->format('d-m-Y') }} {{ $sale['bill_no'] }} {{ $sale['total_qty'] }} {{ $sale['total_value'] }} {{ $sale['total_cost'] }} {{ $sale['total_profit_loss'] }} {{ $sale['total_profit_percent'] }}
Total Qty
{{ $totalQty }}
Sale Value
{{ $totalValue }}
Purchase Cost
{{ $totalCost }}
Total Profit/Loss
{{ $totalProfit }}
Total Profit/Loss %
{{ $totalValue > 0 ? number_format(($totalProfit / $totalValue) * 100, 2) . '%' : '0%' }}
@endsection @section('js') @endsection