@if ($filter_from_date && $filter_to_date)
{{ __('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
@endif
@foreach ($vats as $vat) @endforeach @foreach ($sales as $sale) {{-- VAT Columns --}} @foreach ($vats as $vat) @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 @endforeach @endforeach @if ($sales->count() > 0) {{-- VAT Totals --}} @foreach ($vats as $vat) @php $grandVatTotal = (($salesVatTotals[$vat->id] ?? 0) - ($salesReturnVatTotals[$vat->id] ?? 0)) + $sales->where('vat_id', $vat->id)->sum('vat_amount'); @endphp @endforeach @endif
{{ __('Date') }} {{ __('Invoice') }} {{ __('Customer') }} {{ __('Tax Number') }} {{ __('Total Amount') }} {{ __('Payment Method') }} {{ __('Discount') }}{{ $vat->name . '@' . $vat->rate . '%' }}
{{ formatted_date($sale->created_at) }} {{ $sale->invoiceNumber }} {{ $sale->party->name ?? '' }} {{ $sale->party->tax_no ?? '' }} {{ currency_format($sale->totalAmount, currency: business_currency()) }} @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 {{ currency_format($sale->discountAmount, currency: business_currency()) }} $totalVat > 0])> {{ currency_format($totalVat, currency: business_currency()) }}
{{ $sales->links('vendor.pagination.bootstrap-5') }}