Files

65 lines
3.2 KiB
PHP

<table class="table" id="datatable">
<thead>
<tr>
<th class="d-print-none">{{ __('SL') }}.</th>
@if (auth()->user()->accessToMultiBranch())
<th class="text-start">{{ __('Branch') }}</th>
@endif
<th class="text-start">{{ __('Category') }}</th>
<th class="text-start">{{ __('Income For') }}</th>
<th class="text-start">{{ __('Payment Type') }}</th>
<th class="text-start">{{ __('Reference Number') }}</th>
<th class="text-start">{{ __('Income Date') }}</th>
<th class="text-end">{{ __('Amount') }}</th>
</tr>
</thead>
<tbody>
@foreach ($income_reports as $income_report)
<tr>
<td class="d-print-none">{{ $loop->iteration }}</td>
@if (auth()->user()->accessToMultiBranch())
<td class="text-start">{{ $income_report->branch->name ?? '' }}</td>
@endif
<td class="text-start">{{ $income_report->category?->categoryName }}</td>
<td class="text-start">{{ $income_report->incomeFor }}</td>
<td class="text-start">
@if ($income_report->transactions && $income_report->transactions->isNotEmpty())
{{ $income_report->transactions->map(function($transaction) {
if ($transaction->transaction_type === 'bank_payment' && !empty($transaction->paymentType?->name)) {
return $transaction->paymentType->name;
}
return $transaction->transaction_type
? ucfirst(explode('_', $transaction->transaction_type)[0])
: '';
})->unique()->implode(', ') }}
@elseif ($income_report->payment_type_id)
{{ $income_report->payment_type?->name }}
@else
{{ $income_report->paymentType }}
@endif
</td>
<td class="text-start">{{ $income_report->referenceNo }}</td>
<td class="text-start">{{ formatted_date($income_report->incomeDate) }}</td>
<td class="text-end">{{ currency_format($income_report->amount, currency: business_currency()) }}
</td>
</tr>
@endforeach
</tbody>
@if ($income_reports->count() > 0)
<tr class="table-footer">
<td class="d-print-none text-start">{{ __('Total') }}</td>
@if (auth()->user()->accessToMultiBranch())
<td></td>
@endif
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="text-end">
{{ currency_format($income_reports->sum('amount'), currency: business_currency()) }}
</td>
</tr>
@endif
</table>