@extends('layouts.admin.master')
@section('title', 'Sale Report')
@section('vendor-style')
@endsection
@section('vendor-script')
@endsection
@section('content')
@if(count($errors) > 0)
Error!!
@foreach ($errors->all() as $error)
{{ $error }}
@endforeach
@endif
@if($message = Session::get('success'))
@endif
@if(isset($reports) && count($reports) > 0)
# |
Date |
Invoice No |
Bill Amount |
Profit |
Customer |
@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
{{ $loop->iteration }} |
{{ $sale->sale_date }} |
{{ $sale->invoice_no }} |
{{ $sale->grand_total }} |
{{ $profit }} |
{{ $sale->customer->name }} |
@endforeach
TOTAL |
{{ $billamtsum }} |
{{ round($profitsum,2) }} |
@endif
@endsection