108 lines
5.4 KiB
PHP
108 lines
5.4 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 tax-report-table m-0">
|
|
<table class="table dashboard-table-content">
|
|
<thead class="thead-light">
|
|
<tr>
|
|
<th class="text-start" scope="col">{{ __('Date') }}</th>
|
|
<th class="text-center d-print-none" scope="col">{{ __('Invoice') }}</th>
|
|
<th class="text-center" scope="col">{{ __('Supplier') }}</th>
|
|
<th class="text-center" scope="col">{{ __('Tax Number') }}</th>
|
|
<th class="text-center" scope="col">{{ __('Total Amount') }}</th>
|
|
<th class="text-center d-print-none" scope="col">{{ __('Payment Method') }}</th>
|
|
<th class="text-center d-print-none" scope="col">{{ __('Discount') }}</th>
|
|
@foreach ($vats as $vat)
|
|
<th class="text-center">{{ $vat->name . '@' . $vat->rate . '%' }}</th>
|
|
@endforeach
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($purchases as $purchase)
|
|
<tr>
|
|
<td class="text-start">{{ formatted_date($purchase->created_at) }}</td>
|
|
<td class="text-center d-print-none">{{ $purchase->invoiceNumber }}</td>
|
|
<td class="text-center">{{ $purchase->party->name ?? '' }}</td>
|
|
<td class="text-center">{{ $purchase->party->tax_no ?? '' }}</td>
|
|
<td class="text-center">
|
|
{{ currency_format($purchase->totalAmount, currency: business_currency()) }}</td>
|
|
<td class="text-center 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-center d-print-none">
|
|
{{ currency_format($purchase->discountAmount, currency: business_currency()) }}
|
|
</td>
|
|
{{-- VAT Columns --}}
|
|
@foreach ($vats as $vat)
|
|
@php
|
|
// Product level VAT
|
|
$productVat = $purchaseVatRowMap[$purchase->id][$vat->id] ?? 0;
|
|
|
|
// Returned VAT
|
|
$returnVat = $purchaseReturnVatRowMap[$purchase->id][$vat->id] ?? 0;
|
|
|
|
// Invoice level VAT
|
|
$invoiceVat = ($purchase->vat_id == $vat->id) ? $purchase->vat_amount : 0;
|
|
|
|
// Final VAT
|
|
$totalVat = $productVat + $invoiceVat - $returnVat;
|
|
@endphp
|
|
|
|
<td @class(['text-center','fw-bold' => $totalVat > 0])>
|
|
{{ currency_format($totalVat, currency: business_currency()) }}
|
|
</td>
|
|
@endforeach
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
@if ($purchases->count() > 0)
|
|
<tr class="table-footer">
|
|
<td class="text-start fw-bold">{{ __('Total') }}</td>
|
|
<td class="d-print-none"></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td class="text-center fw-bold">{{ currency_format($purchases->sum('totalAmount'), currency: business_currency()) }}</th>
|
|
<td class="d-print-none"></td>
|
|
<td class="text-center fw-bold d-print-none">{{ currency_format($purchases->sum('discountAmount'), currency: business_currency()) }}</th>
|
|
{{-- VAT Totals --}}
|
|
@foreach ($vats as $vat)
|
|
@php
|
|
$grandVatTotal = (($purchasesVatTotals[$vat->id] ?? 0)
|
|
- ($purchaseReturnVatTotals[$vat->id] ?? 0))
|
|
+ $purchases->where('vat_id', $vat->id)->sum('vat_amount');
|
|
@endphp
|
|
|
|
<td class="text-center fw-bold">
|
|
{{ currency_format($grandVatTotal, currency: business_currency()) }}
|
|
</td>
|
|
@endforeach
|
|
</tr>
|
|
@endif
|
|
</table>
|
|
</div>
|
|
<div class="mt-3">
|
|
{{ $purchases->links('vendor.pagination.bootstrap-5') }}
|
|
</div>
|