104 lines
5.2 KiB
PHP
104 lines
5.2 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>{{ __('SL') }}.</th>
|
|
@if (auth()->user()->accessToMultiBranch())
|
|
<th class="text-start">{{ __('Branch') }}</th>
|
|
@endif
|
|
<th class="text-start">{{ __('Invoice No') }}</th>
|
|
<th class="text-start">{{ __('Party Name') }}</th>
|
|
<th class="text-start">{{ __('Total') }}</th>
|
|
<th class="text-start d-print-none">{{ __('Discount') }}</th>
|
|
<th class="text-start">{{ __('Paid') }}</th>
|
|
<th class="text-start">{{ __('Due') }}</th>
|
|
<th class="text-start d-print-none">{{ __('Vat') }}</th>
|
|
<th class="text-start d-print-none">{{ __('Payment Type') }}</th>
|
|
<th class="text-start">{{ __('Purchase Date') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($purchases as $purchase)
|
|
<tr>
|
|
<td>{{ ($purchases->currentPage() - 1) * $purchases->perPage() + $loop->iteration }}</td>
|
|
@if (auth()->user()->accessToMultiBranch())
|
|
<td class="text-start">{{ $purchase->branch->name ?? '' }}</td>
|
|
@endif
|
|
<td class="text-start">{{ $purchase->invoiceNumber }}</td>
|
|
<td class="text-start">{{ $purchase->party?->name }}</td>
|
|
<td class="text-start">{{ currency_format($purchase->totalAmount, currency: business_currency()) }}
|
|
</td>
|
|
<td class="text-start d-print-none">
|
|
{{ currency_format($purchase->discountAmount, currency: business_currency()) }}</td>
|
|
<td class="text-start">{{ currency_format($purchase->paidAmount, currency: business_currency()) }}
|
|
</td>
|
|
<td class="text-start">{{ currency_format($purchase->dueAmount, currency: business_currency()) }}
|
|
</td>
|
|
<td class="text-start d-print-none">{{ currency_format($purchase->vat_amount, currency: business_currency()) }}
|
|
</td>
|
|
<td class="text-start d-print-none">
|
|
@if ($purchase->transactions && $purchase->transactions->isNotEmpty())
|
|
{{ $purchase->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 ($purchase->payment_type_id)
|
|
{{ $purchase->payment_type?->name }}
|
|
@else
|
|
{{ $purchase->paymentType }}
|
|
@endif
|
|
</td>
|
|
<td class="text-start">{{ formatted_date($purchase->purchaseDate) }}</td>
|
|
</tr>
|
|
@endforeach
|
|
|
|
</tbody>
|
|
@if ($purchases->count() > 0)
|
|
<tr class="table-footer">
|
|
<td class=" text-start">{{ __('Total') }}</td>
|
|
@if (auth()->user()->accessToMultiBranch())
|
|
<td></td>
|
|
@endif
|
|
<td></td>
|
|
<td></td>
|
|
<td class="text-start">
|
|
{{ currency_format($purchases->sum('totalAmount'), currency: business_currency()) }}
|
|
</td>
|
|
<td class="text-start d-print-none">
|
|
{{ currency_format($purchases->sum('discountAmount'), currency: business_currency()) }}
|
|
</td>
|
|
<td class="text-start">
|
|
{{ currency_format($purchases->sum('paidAmount'), currency: business_currency()) }}
|
|
</td>
|
|
<td class="text-start">
|
|
{{ currency_format($purchases->sum('dueAmount'), currency: business_currency()) }}
|
|
</td>
|
|
<td class="d-print-none">
|
|
{{ currency_format($purchases->sum('vat_amount'), currency: business_currency()) }}
|
|
</td>
|
|
<td class="d-print-none"></td>
|
|
<td></td>
|
|
</tr>
|
|
@endif
|
|
</table>
|
|
</div>
|
|
<div class="mt-3">
|
|
{{ $purchases->links('vendor.pagination.bootstrap-5') }}
|
|
</div>
|