111 lines
5.6 KiB
PHP
111 lines
5.6 KiB
PHP
@if ($filter_from_date && $filter_to_date)
|
|
<div class="mb-2 text-center fw-bold duration-display">
|
|
<strong>{{ __('Duration:') }}</strong>
|
|
@if ($duration === 'today')
|
|
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
|
@elseif ($duration === 'yesterday')
|
|
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
|
@else
|
|
{{ Carbon\Carbon::parse($filter_from_date)->format('d-m-Y') }}
|
|
{{ __('to') }}
|
|
{{ Carbon\Carbon::parse($filter_to_date)->format('d-m-Y') }}
|
|
@endif
|
|
</div>
|
|
@endif
|
|
<div class="responsive-table m-0">
|
|
<table class="table" id="datatable">
|
|
<thead>
|
|
<tr>
|
|
<th class="d-print-none">{{ __('SL') }}.</th>
|
|
<th class="text-start">{{ __('Date') }}</th>
|
|
<th class="text-center d-print-none">{{ __('Invoice') }}</th>
|
|
<th class="text-start">{{ __('Name') }}</th>
|
|
<th class="text-start d-print-none">{{ __('Type') }}</th>
|
|
<th class="text-center">{{ __('Cash In') }}</th>
|
|
<th class="text-center">{{ __('Cash Out') }}</th>
|
|
<th class="text-center">{{ __('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 class="d-print-none">{{ $cash_flows->firstItem() + $loop->index }}</td>
|
|
<td class="text-start">{{ formatted_date($cash_flow->date) }}</td>
|
|
<td class="text-center d-print-none">{{ $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 d-print-none">{{ $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 d-print-none">{{ ucwords(str_replace('_', ' ', $cash_flow->platform)) }}</td>
|
|
|
|
<td class="text-center {{ $cash_flow->type === 'credit' ? 'text-success' : '' }}">
|
|
{{ $cash_flow->type === 'credit' ? currency_format($cash_flow->amount, currency: business_currency()) : currency_format(0, currency: business_currency()) }}
|
|
</td>
|
|
|
|
<td class="text-center {{ $cash_flow->type === 'debit' ? 'text-danger' : '' }}">
|
|
{{ $cash_flow->type === 'debit' ? currency_format($cash_flow->amount, currency: business_currency()) : currency_format(0, currency: business_currency()) }}
|
|
</td>
|
|
|
|
<td class="text-center {{ $runningCash < 0 ? 'text-danger' : 'text-success' }}">
|
|
{{ currency_format($runningCash, currency: business_currency()) }}
|
|
</td>
|
|
|
|
<td class="text-end">
|
|
{{ $cash_flow->payment_type_id ? $cash_flow->paymentType?->name : ucfirst(explode('_', $cash_flow->transaction_type)[0]) }}
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
|
|
@php
|
|
$page_cash_in = $cash_flows->getCollection()->where('type', 'credit')->sum('amount');
|
|
$page_cash_out = $cash_flows->getCollection()->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>
|
|
</div>
|
|
|
|
<div class="mt-3">
|
|
{{ $cash_flows->links('vendor.pagination.bootstrap-5') }}
|
|
</div> |