@extends('layouts.admin.master') @section('title', 'Sale Report') @section('vendor-style') @endsection @section('vendor-script') @endsection @section('content')
@if(count($errors) > 0) @endif @if($message = Session::get('success')) @endif
@csrf
@if(isset($reports) && count($reports) > 0)
@if(isset($reports['branch']) && !empty($reports['branch'])) Branch: {{ $reports['branch'] }} @endif
Date: {{ $reports['dates'] }}
@php $profitsum = 0; $billamtsum =0; @endphp @foreach($reports['saleData'] as $sale) @php $grossTotal = 0; $productCostTotal = 0; foreach($sale->saleClientDetails as $saleItems) { $grossTotal = $grossTotal + $saleItems->gross_amount; $productCostTotal = $productCostTotal + ($saleItems->quantity * $saleItems->product->price->cost); } $profitsum = $profitsum + ($sale->netvalue - $productCostTotal); $billamtsum = $billamtsum + $sale->grand_total; $profit = round(($sale->netvalue - $productCostTotal),2); @endphp @endforeach
# Date Invoice No Bill Amount Profit Customer
{{ $loop->iteration }} {{ $sale->sale_date }} {{ $sale->invoice_no }} {{ $sale->grand_total }} {{ $profit }} {{ $sale->customer->name }}
TOTAL {{ $billamtsum }} {{ round($profitsum,2) }}
@endif
@endsection