@extends('layouts.app') @section('title', __('report.receipt_payment_summary')) @section('content')

{{ __('report.receipt_payment_summary')}}

@component('components.filters', ['title' => __('report.filters')]) {!! Form::open(['url' => '#','method' => 'get','id' => 'sell_payment_report_form']) !!}
{!! Form::label('location_id', __('purchase.business_location').':') !!}
{!! Form::select('location_id',$business_locations,request()->location_id, ['class'=>'form-control select2','style'=>'width:100%','placeholder'=>__('messages.all')]) !!}
{!! Form::label('spr_date_filter', __('report.date_range') . ':') !!} {!! Form::text('date_range',request()->date_range, ['placeholder'=>__('lang_v1.select_a_date_range'), 'class'=>'form-control', 'id'=>'sell_list_filter_date_range', 'readonly']) !!}
{!! Form::close() !!} @endcomponent
@php $totalsIncome = []; $totalsExpense = []; $grandTotalIncome = 0; $grandTotalExpense = 0; foreach($used_payment_types as $method_label){ $totalsIncome[$method_label] = 0; $totalsExpense[$method_label] = 0; } @endphp
@component('components.widget',['class'=>'box-primary'])

Income

@foreach($used_payment_types as $method_label) @endforeach {{-- Opening Balance --}} @foreach($used_payment_types as $method_label) @php $opening = openingBalance($business_id, $location_id, $method_label, $start_date, ['sell']) - openingBalance($business_id, $location_id, $method_label, $start_date, ['expense','purchanse']); $totalsIncome[$method_label] += $opening; $grandTotalIncome += $opening; @endphp @endforeach {{-- Customer Receipts --}} @php $sr = 1; @endphp @foreach($customers as $customer) @php $row_total = 0; $amounts = []; foreach($used_payment_types as $method_label){ $amount = getPaymentSum($business_id, $start_date, $end_date, $customer->id, '', $method_label, ['sell']) ?? 0; $amounts[$method_label] = $amount; $row_total += $amount; } @endphp @if($row_total > 0) @foreach($amounts as $method_label => $amount) @php $totalsIncome[$method_label] += $amount; $grandTotalIncome += $amount; @endphp @endforeach @endif @endforeach @foreach($used_payment_types as $method_label) @endforeach
@lang('report.sl') Receipt Detail{{ $payment_types[$method_label] ?? '' }}
1 Opening Balance{{ number_format($opening,2) }}
{{ ($sr++) + 1 }} {{ $customer->contact_type == 'business' ? $customer->supplier_business_name : $customer->name }}{{ number_format($amount,2) }}
Total{{ number_format($totalsIncome[$method_label],2) }}
Sub Total {{ number_format($grandTotalIncome,2) }}
@endcomponent
@component('components.widget',['class'=>'box-primary'])

Expense

@foreach($used_payment_types as $method_label) @endforeach @php $sr2 = 1; @endphp {{-- Supplier Purchases --}} @foreach($suppliers as $supplier) @php $row_total = 0; $amounts = []; foreach($used_payment_types as $method_label){ $amount = getPaymentSum($business_id, $start_date, $end_date, $supplier->id, '', $method_label, ['purchase']) ?? 0; $amounts[$method_label] = $amount; $row_total += $amount; } @endphp @if($row_total > 0) @foreach($amounts as $method_label => $amount) @php $totalsExpense[$method_label] += $amount; $grandTotalExpense += $amount; @endphp @endforeach @endif @endforeach {{-- Expenses by Category --}} @foreach($categories as $cat) @php $row_total = 0; $amounts = []; foreach($used_payment_types as $method_label){ $amount = getPaymentSum($business_id, $start_date, $end_date, '', '', $method_label, ['expense'], $cat->id) ?? 0; $amounts[$method_label] = $amount; $row_total += $amount; } @endphp @if($row_total > 0) @foreach($amounts as $method_label => $amount) @php $totalsExpense[$method_label] += $amount; $grandTotalExpense += $amount; @endphp @endforeach @endif @endforeach {{-- Closing Balance (Display Only) --}} {{-- Closing Balance --}} @foreach($used_payment_types as $method_label) @php $closing = closingBalance($business_id, $location_id, $method_label, $end_date, ['sell']) - closingBalance($business_id, $location_id, $method_label, $end_date, ['expense','purchanse']); // Add closing to totals $totalsExpense[$method_label] += $closing; $grandTotalExpense += $closing; @endphp @endforeach @foreach($used_payment_types as $method_label) @endforeach
@lang('report.sl') @lang('report.particular'){{ $payment_types[$method_label] ?? '' }}
{{ $sr2++ }} {{ $supplier->contact_type == 'business' ? $supplier->supplier_business_name : $supplier->name }}{{ number_format($amount,2) }}
{{ $sr2++ }} {{ $cat->name }}{{ number_format($amount,2) }}
{{ $sr2++ }} Closing Balance{{ number_format($closing,2) }}
Total{{ number_format($totalsExpense[$method_label],2) }}
Sub Total {{ number_format($grandTotalExpense,2) }}
@endcomponent
@endsection @section('javascript') @endsection