@php
$income_openning = App\Models\ChartofAccount::where('account_type', '!=', 'expense')
->where("account_type", '!=','fixed assets')
->sum("openning_balance");
@endphp
@if(isset($data['incomes']))
Income Reports
# |
Name |
Account Type |
Amount |
@php $total_income = 0; $i=0; @endphp
@foreach($data['incomes'] as $row)
@php
$amount = App\Models\Payment::where('account_id', $row->id)
->whereBetween('timestamp', [$fromDate, $toDate])
->sum('amount');
$total_income += $amount;
@endphp
{{++$i}} |
{{$row->name}} |
{{$row->account_type}} |
{{$amount}} |
@endforeach
{{-- @php $total_income += $data['vouchers']; @endphp --}}
Total: {{$total_income}} |
@endif
@if(isset($data['expenses']))
Expenses Reports
# |
Name |
Account Type |
Amount |
@php $total_expense = 0; $c=0; @endphp
@foreach($data['expenses'] as $row)
@php
$exp_amount = App\Models\Payment::where('account_id', $row->id)
->where('vochure_id', 0)
->whereBetween('timestamp', [$fromDate, $toDate])
->sum('amount');
$total_expense += $exp_amount;
@endphp
{{++$c}} |
{{$row->name}} |
{{$row->account_type}} |
{{$exp_amount}} |
@endforeach
{{ ++$c }} |
Voucher |
Expense |
{{$data['vouchers']}} |
@php $total_expense += $data['vouchers']; @endphp
Total: {{$total_expense}} |
@php
$totalBalance = ($total_income + $income_openning - $total_expense);
@endphp
Starting Balance |
{{$income_openning}} |
Today's Revenue |
{{ $total_income}} |
Today's Expenses |
{{ $total_expense }} |
Today's Balance |
{{$totalBalance}} |
Closing Balance |
{{ ($totalBalance) }} |
@endif