update marketing
All checks were successful
All checks were successful
This commit is contained in:
@@ -19,11 +19,12 @@
|
||||
<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 }}</th>
|
||||
<th class="text-center">{{ $vat->name . '@' . $vat->rate . '%' }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -33,6 +34,7 @@
|
||||
<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">
|
||||
@@ -50,10 +52,26 @@
|
||||
@endif
|
||||
</td>
|
||||
<td class="text-center d-print-none">
|
||||
{{ currency_format($purchase->discountAmount, currency: business_currency()) }}</td>
|
||||
{{ currency_format($purchase->discountAmount, currency: business_currency()) }}
|
||||
</td>
|
||||
{{-- VAT Columns --}}
|
||||
@foreach ($vats as $vat)
|
||||
<td class="text-center">
|
||||
{{ $purchase->vat_id == $vat->id ? currency_format($purchase->vat_amount, currency: business_currency()) : '0' }}
|
||||
@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>
|
||||
@@ -64,12 +82,20 @@
|
||||
<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($purchasesVatTotals[$vat->id] ?? 0, currency: business_currency()) }}
|
||||
{{ currency_format($grandVatTotal, currency: business_currency()) }}
|
||||
</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@@ -77,5 +103,5 @@
|
||||
</table>
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
{{ $purchases->appends(['tab' => 'purchases'])->links('vendor.pagination.bootstrap-5') }}
|
||||
{{ $purchases->links('vendor.pagination.bootstrap-5') }}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user