2026-03-15 17:08:23 +07:00
|
|
|
@extends('layouts.business.pdf.pdf_layout')
|
|
|
|
|
|
|
|
|
|
@section('pdf_title')
|
|
|
|
|
<div class="table-header justify-content-center border-0 d-none d-block d-print-block text-center">
|
|
|
|
|
@include('business::print.header')
|
|
|
|
|
<h4 style="text-align: center; margin: 0; padding: 0; font-size: 16px;" class="">
|
|
|
|
|
@if (Request::get('type') == 'sales')
|
|
|
|
|
{{ __('Sale Tax Report List') }}
|
|
|
|
|
@elseif (Request::get('type') == 'purchases')
|
|
|
|
|
{{ __('Purchase Tax Report List') }}
|
|
|
|
|
@else
|
|
|
|
|
{{ __('Tax Report List') }}
|
|
|
|
|
@endif
|
|
|
|
|
</h4>
|
2026-05-14 11:55:22 +07:00
|
|
|
@if ($filter_from_date && $filter_to_date)
|
|
|
|
|
<p style="text-align: center; margin: 0; padding: 0; font-weight: 400; font-size: 14px;" class="">{{ __('Duration:') }}
|
|
|
|
|
@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
|
|
|
|
|
</p>
|
|
|
|
|
@endif
|
2026-03-15 17:08:23 +07:00
|
|
|
</div>
|
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
|
|
@section('pdf_content')
|
|
|
|
|
<table width="100%" cellpadding="6" cellspacing="0"
|
|
|
|
|
style="border-collapse: collapse; border: 1px solid gainsboro; font-size:12px;"
|
|
|
|
|
id="datatable">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr style="background-color: #C52127; color: white;">
|
|
|
|
|
<th style="font-size:12px; border:1px solid gainsboro; color: white" class="text-start">{{ __('Date') }}</th>
|
|
|
|
|
<th style="font-size:12px; border:1px solid gainsboro; color: white" class="text-start">{{ __('Invoice No') }}</th>
|
|
|
|
|
@if (Request::get('type') == 'sales')
|
|
|
|
|
<th style="font-size:12px; border:1px solid gainsboro; color: white" class="text-start">{{ __('Customer') }}</th>
|
|
|
|
|
@else
|
|
|
|
|
<th style="font-size:12px; border:1px solid gainsboro; color: white" class="text-start">{{ __('Supplier') }}</th>
|
|
|
|
|
@endif
|
2026-05-14 11:55:22 +07:00
|
|
|
<th style="font-size:12px; border:1px solid gainsboro; color: white" class="text-start">{{ __('Tax Number') }}</th>
|
2026-03-15 17:08:23 +07:00
|
|
|
<th style="font-size:12px; border:1px solid gainsboro; color: white" class="text-start">{{ __('Payment Type') }}</th>
|
|
|
|
|
<th style="font-size:12px; border:1px solid gainsboro; color: white" class="text-start">{{ __('Total Amount') }}</th>
|
|
|
|
|
<th style="font-size:12px; border:1px solid gainsboro; color: white" class="text-start">{{ __('Discount') }}</th>
|
|
|
|
|
@foreach ($vats as $vat)
|
2026-05-14 11:55:22 +07:00
|
|
|
<th style="font-size:12px; border:1px solid gainsboro; color: white" class="text-start">{{ $vat->name . '@' . $vat->rate . '%' }}</th>
|
2026-03-15 17:08:23 +07:00
|
|
|
@endforeach
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
@if (Request::get('type') == 'sales')
|
|
|
|
|
@foreach ($sales as $sale)
|
|
|
|
|
<tr style="background-color: {{ $loop->even ? '#F5F5F5' : '#FFFFFF' }};">
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center;">
|
|
|
|
|
{{ formatted_date($sale->saleDate) }}
|
|
|
|
|
</td>
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center;">
|
|
|
|
|
{{ $sale->invoiceNumber }}
|
|
|
|
|
</td>
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center;">
|
|
|
|
|
{{ $sale->party?->name }}
|
|
|
|
|
</td>
|
2026-05-14 11:55:22 +07:00
|
|
|
<td style="border:1px solid gainsboro; text-align:center;">
|
|
|
|
|
{{ $sale->party?->tax_no }}
|
|
|
|
|
</td>
|
2026-03-15 17:08:23 +07:00
|
|
|
<td style="border:1px solid gainsboro; text-align:center;" class="d-print-none">
|
|
|
|
|
@if ($sale->transactions && $sale->transactions->isNotEmpty())
|
|
|
|
|
{{ $sale->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 ($sale->payment_type_id)
|
|
|
|
|
{{ $sale->payment_type?->name }}
|
|
|
|
|
@else
|
|
|
|
|
{{ $sale->paymentType }}
|
|
|
|
|
@endif
|
|
|
|
|
</td>
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center;">
|
|
|
|
|
{{ currency_format($sale->totalAmount, currency: business_currency()) }}
|
|
|
|
|
</td>
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center;">
|
|
|
|
|
{{ currency_format($sale->discountAmount, currency: business_currency()) }}
|
|
|
|
|
</td>
|
|
|
|
|
@foreach ($vats as $vat)
|
2026-05-14 11:55:22 +07:00
|
|
|
@php
|
|
|
|
|
// Product VAT
|
|
|
|
|
$productVat = $saleVatRowMap[$sale->id][$vat->id] ?? 0;
|
|
|
|
|
|
|
|
|
|
// Returned VAT
|
|
|
|
|
$returnVat = $saleReturnVatRowMap[$sale->id][$vat->id] ?? 0;
|
|
|
|
|
|
|
|
|
|
// Invoice VAT
|
|
|
|
|
$invoiceVat = ($sale->vat_id == $vat->id) ? $sale->vat_amount : 0;
|
|
|
|
|
|
|
|
|
|
// Final VAT
|
|
|
|
|
$totalVat = $productVat + $invoiceVat - $returnVat;
|
|
|
|
|
@endphp
|
2026-03-15 17:08:23 +07:00
|
|
|
<td style="border:1px solid gainsboro; text-align:center;">
|
2026-05-14 11:55:22 +07:00
|
|
|
{{ currency_format($totalVat, currency: business_currency()) }}
|
2026-03-15 17:08:23 +07:00
|
|
|
</td>
|
|
|
|
|
@endforeach
|
|
|
|
|
</tr>
|
|
|
|
|
@endforeach
|
|
|
|
|
</tbody>
|
|
|
|
|
@if ($sales->count() > 0)
|
|
|
|
|
<tfoot>
|
|
|
|
|
<tr style="background-color:#C52127; color:#FFFFFF; font-weight:bold;">
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center; color: white">
|
|
|
|
|
{{ __('Total') }}
|
|
|
|
|
</td>
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center;"></td>
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center;"></td>
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center;"></td>
|
2026-05-14 11:55:22 +07:00
|
|
|
<td style="border:1px solid gainsboro; text-align:center;"></td>
|
2026-03-15 17:08:23 +07:00
|
|
|
<td style="border:1px solid gainsboro; text-align:center; color: white; font-weight: 600;">
|
|
|
|
|
{{ currency_format($sales->sum('totalAmount'), currency: business_currency()) }}
|
|
|
|
|
</td>
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center; color: white; font-weight: 600;">
|
|
|
|
|
{{ currency_format($sales->sum('discountAmount'), currency: business_currency()) }}
|
|
|
|
|
</td>
|
|
|
|
|
@foreach ($vats as $vat)
|
2026-05-14 11:55:22 +07:00
|
|
|
@php
|
|
|
|
|
$grandVatTotal = (($salesVatTotals[$vat->id] ?? 0)
|
|
|
|
|
- ($salesReturnVatTotals[$vat->id] ?? 0))
|
|
|
|
|
+ $sales->where('vat_id', $vat->id)->sum('vat_amount');
|
|
|
|
|
@endphp
|
2026-03-15 17:08:23 +07:00
|
|
|
<td style="border:1px solid gainsboro; text-align:center; color: white; font-weight: 600;">
|
2026-05-14 11:55:22 +07:00
|
|
|
{{ currency_format($grandVatTotal, currency: business_currency()) }}
|
2026-03-15 17:08:23 +07:00
|
|
|
</td>
|
|
|
|
|
@endforeach
|
|
|
|
|
</tr>
|
|
|
|
|
</tfoot>
|
|
|
|
|
@endif
|
|
|
|
|
@endif
|
|
|
|
|
|
|
|
|
|
@if (Request::get('type') == 'purchases')
|
|
|
|
|
@foreach ($purchases as $purchase)
|
|
|
|
|
<tr style="background-color: {{ $loop->even ? '#F5F5F5' : '#FFFFFF' }};">
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center;">
|
|
|
|
|
{{ formatted_date($purchase->purchaseDate) }}
|
|
|
|
|
</td>
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center;">
|
|
|
|
|
{{ $purchase->invoiceNumber }}
|
|
|
|
|
</td>
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center;">
|
|
|
|
|
{{ $purchase->party?->name }}
|
|
|
|
|
</td>
|
2026-05-14 11:55:22 +07:00
|
|
|
<td style="border:1px solid gainsboro; text-align:center;">
|
|
|
|
|
{{ $purchase->party?->tax_no }}
|
|
|
|
|
</td>
|
2026-03-15 17:08:23 +07:00
|
|
|
<td style="border:1px solid gainsboro; text-align:center;" class="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 style="border:1px solid gainsboro; text-align:center;">
|
|
|
|
|
{{ currency_format($purchase->totalAmount, currency: business_currency()) }}
|
|
|
|
|
</td>
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center;">
|
|
|
|
|
{{ currency_format($purchase->discountAmount, currency: business_currency()) }}
|
|
|
|
|
</td>
|
|
|
|
|
@foreach ($vats as $vat)
|
2026-05-14 11:55:22 +07:00
|
|
|
@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
|
2026-03-15 17:08:23 +07:00
|
|
|
<td style="border:1px solid gainsboro; text-align:center;">
|
2026-05-14 11:55:22 +07:00
|
|
|
{{ currency_format($totalVat, currency: business_currency()) }}
|
2026-03-15 17:08:23 +07:00
|
|
|
</td>
|
|
|
|
|
@endforeach
|
|
|
|
|
</tr>
|
|
|
|
|
@endforeach
|
|
|
|
|
</tbody>
|
|
|
|
|
@if ($purchases->count() > 0)
|
|
|
|
|
<tfoot>
|
|
|
|
|
<tr style="background-color:#C52127; color:#FFFFFF; font-weight:bold;">
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center; color: white">
|
|
|
|
|
{{ __('Total') }}
|
|
|
|
|
</td>
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center;"></td>
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center;"></td>
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center;"></td>
|
2026-05-14 11:55:22 +07:00
|
|
|
<td style="border:1px solid gainsboro; text-align:center;"></td>
|
2026-03-15 17:08:23 +07:00
|
|
|
<td style="border:1px solid gainsboro; text-align:center; color: white; font-weight: 600;">
|
|
|
|
|
{{ currency_format($purchases->sum('totalAmount'), currency: business_currency()) }}
|
|
|
|
|
</td>
|
|
|
|
|
<td style="border:1px solid gainsboro; text-align:center; color: white; font-weight: 600;">
|
|
|
|
|
{{ currency_format($purchases->sum('discountAmount'), currency: business_currency()) }}
|
|
|
|
|
</td>
|
|
|
|
|
@foreach ($vats as $vat)
|
2026-05-14 11:55:22 +07:00
|
|
|
@php
|
|
|
|
|
$grandVatTotal = (($purchasesVatTotals[$vat->id] ?? 0)
|
|
|
|
|
- ($purchaseReturnVatTotals[$vat->id] ?? 0))
|
|
|
|
|
+ $purchases->where('vat_id', $vat->id)->sum('vat_amount');
|
|
|
|
|
@endphp
|
2026-03-15 17:08:23 +07:00
|
|
|
<td style="border:1px solid gainsboro; text-align:center; color: white; font-weight: 600;">
|
2026-05-14 11:55:22 +07:00
|
|
|
{{ currency_format($grandVatTotal, currency: business_currency()) }}
|
2026-03-15 17:08:23 +07:00
|
|
|
</td>
|
|
|
|
|
@endforeach
|
|
|
|
|
</tr>
|
|
|
|
|
</tfoot>
|
|
|
|
|
@endif
|
|
|
|
|
@endif
|
|
|
|
|
</table>
|
|
|
|
|
@endsection
|
|
|
|
|
|