97 lines
4.6 KiB
PHP
97 lines
4.6 KiB
PHP
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ __('SL') }}.</th>
|
|
<th class="text-start">{{ __('Date') }}</th>
|
|
<th class="text-center">{{ __('Invoice') }}</th>
|
|
<th class="text-start">{{ __('Name') }}</th>
|
|
<th class="text-start">{{ __('Type') }}</th>
|
|
<th class="text-start">{{ __('Cash In') }}</th>
|
|
<th class="text-start">{{ __('Cash Out') }}</th>
|
|
<th class="text-start">{{ __('Running Cash') }}</th>
|
|
<th class="text-end">{{ __('Payment') }}</th>
|
|
</tr>
|
|
</thead>
|
|
@php $runningCash = $opening_balance; @endphp
|
|
<tbody>
|
|
@foreach ($cash_flows as $cash_flow)
|
|
@php
|
|
if ($cash_flow->type === 'credit') {
|
|
$runningCash += $cash_flow->amount;
|
|
} else {
|
|
$runningCash -= $cash_flow->amount;
|
|
}
|
|
@endphp
|
|
<tr>
|
|
<td>{{ $loop->index + 1 }}</td>
|
|
<td class="text-start">{{ formatted_date($cash_flow->date) }}</td>
|
|
<td class="text-center">{{ $cash_flow->invoice_no }}</td>
|
|
|
|
@if ($cash_flow->platform == 'sale')
|
|
<td class="text-start">{{ $cash_flow->sale?->party?->name ?? 'Guest' }}</td>
|
|
@elseif ($cash_flow->platform == 'sale_return')
|
|
<td class="text-start">{{ $cash_flow->saleReturn?->sale?->party?->name ?? 'Guest' }}</td>
|
|
@elseif ($cash_flow->platform == 'purchase')
|
|
<td class="text-start">{{ $cash_flow->purchase?->party?->name ?? 'Guest' }}</td>
|
|
@elseif ($cash_flow->platform == 'purchase_return')
|
|
<td class="text-start">{{ $cash_flow->purchaseReturn?->purchase?->party?->name ?? 'Guest' }}</td>
|
|
@elseif ($cash_flow->platform == 'due_collect' || $cash_flow->platform == 'due_pay')
|
|
<td class="text-start">{{ $cash_flow->dueCollect?->party?->name ?? 'Guest' }}</td>
|
|
@else
|
|
<td class="text-start">N/A</td>
|
|
@endif
|
|
|
|
<td class="text-start">{{ ucwords(str_replace('_', ' ', $cash_flow->platform)) }}</td>
|
|
|
|
@if ($cash_flow->type === 'credit')
|
|
<td class="text-start text-success">{{ currency_format($cash_flow->amount, currency: business_currency()) }}
|
|
</td>
|
|
@else
|
|
<td class="text-start">{{ currency_format(0, currency: business_currency()) }}</td>
|
|
@endif
|
|
|
|
@if ($cash_flow->type === 'debit')
|
|
<td class="text-start text-danger">{{ currency_format($cash_flow->amount, currency: business_currency()) }}
|
|
</td>
|
|
@else
|
|
<td class="text-start">{{ currency_format(0, currency: business_currency()) }}</td>
|
|
@endif
|
|
|
|
<td class="text-start {{ $runningCash < 0 ? 'text-danger' : 'text-success' }}">
|
|
{{ currency_format($runningCash, currency: business_currency()) }}
|
|
</td>
|
|
|
|
@if ($cash_flow->payment_type_id)
|
|
<td class="text-end">{{ $cash_flow->paymentType?->name }}</td>
|
|
@else
|
|
<td class="text-end">{{ ucfirst(explode('_', $cash_flow->transaction_type)[0]) }}</td>
|
|
@endif
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
@php
|
|
$page_cash_in = $cash_flows->where('type', 'credit')->sum('amount');
|
|
$page_cash_out = $cash_flows->where('type', 'debit')->sum('amount');
|
|
$page_running_cash = $opening_balance + $page_cash_in - $page_cash_out;
|
|
@endphp
|
|
|
|
@if ($cash_flows->count() > 0)
|
|
<tfoot>
|
|
<tr class="table-footer">
|
|
<td class="text-start fw-bold">{{__('Total')}}</td>
|
|
<td class="d-print-none"></td>
|
|
<td class="d-print-none"></td>
|
|
<td></td>
|
|
<td class="d-print-none text-start"></td>
|
|
<td class="text-center text-success">{{ currency_format($page_cash_in, currency: business_currency()) }}
|
|
</td>
|
|
<td class="text-center text-danger">{{ currency_format($page_cash_out, currency: business_currency()) }}
|
|
</td>
|
|
<td class="text-center {{ $page_running_cash < 0 ? 'text-danger' : 'text-success' }}">
|
|
{{ currency_format($page_running_cash, currency: business_currency()) }}
|
|
</td>
|
|
<td></td>
|
|
</tr>
|
|
</tfoot>
|
|
@endif
|
|
</table> |