Invoice #{{ $addedInvoice->invoice_id ?? '' }}
Invoice Date: {{ $addedInvoice->invoice_date ? \Carbon\Carbon::parse($addedInvoice->invoice_date)->format('d-m-Y') : '' }}

Invoice From:

{{ $settings->company_name ?? '' }}

{{ $settings->address ?? '' }}

{{ $settings->email ?? '' }}

(+91) {{ $settings->phone ?? '' }}

Invoice To:

{{ $addedInvoice->client->user->name ?? '' }}

(+91) {{ $addedInvoice->client->user->phone ?? '' }}

@php $sumQty = 0; $totalTax = 0; $subtotal = 0; @endphp @foreach ($addedInvoice->invoiceItems as $index => $data) @php $productTax = 0; $price = $data->price; $rowTotal = 0; // Check if price includes tax and GST is applicable if ($settings->price_tax_flag == 'A' && $addedInvoice->gst != 'N') { if (!empty($data->invoiceItemTaxes)) { foreach ($data->invoiceItemTaxes as $tax) { $productTax += ($data->price * $tax->tax) / 100; } } $price += $productTax; $totalTax += $productTax; } // Calculate row total $rowTotal = $price * $data->quantity; $subtotal += $rowTotal; @endphp @php $sumQty += $data->quantity ?? 0; @endphp @endforeach {{-- Subtotal --}} @if($settings->price_tax_flag == 'A') @else @endif {{-- Tax (if applicable) --}} @if ($settings->price_tax_flag != 'A') @php foreach ($addedInvoice->invoiceItems as $item) { if (!empty($item->invoiceItemTaxes)) { foreach ($item->invoiceItemTaxes as $tax) { $totalTax += ($item->total * $tax->tax) / 100; } } } @endphp @endif {{-- Discount --}} @php $totalDiscount = 0; $totalBeforeDiscount = $settings->price_tax_flag == 'A' ? $subtotal : ($addedInvoice->amount ?? 0) + $totalTax; if ($addedInvoice->discount_type == 1) { $totalDiscount = $addedInvoice->discount ?? 0; } elseif ($addedInvoice->discount_type == 2) { $totalDiscount = ($totalBeforeDiscount * ($addedInvoice->discount ?? 0)) / 100; } @endphp {{-- Redeemed Loyalty --}} @php $redeemed = ($settings->loyalty_config == 'A') ? ($redeemed_value ?? 0) : 0; @endphp @if($settings->loyalty_config == 'A') @endif {{-- Grand Total --}} @php $grandTotal = floor($totalBeforeDiscount - $totalDiscount - $redeemed); @endphp {{-- Total Quantity --}}
No. Item Description Price Quantity Amount
{{ $index + 1 }} {{ $data->product_name ?? '' }}{{ number_format($price ?? 0, 2) }} {{ $data->quantity ?? 0 }} {{ number_format($rowTotal ?? 0, 2) }}
SubTotal{{ number_format($subtotal ?? 0, 2) }}{{ number_format($addedInvoice->amount ?? 0, 2) }}
Tax ₹{{ number_format($totalTax, 2) }}
Discount ₹{{ number_format($totalDiscount, 2) }}
Redeemed Amount ₹{{ number_format($redeemed, 2) }}
Grand Total ₹{{ number_format($grandTotal, 2) }}
Total Purchased Product Qty {{ $sumQty }}
@if ($settings->whatsapp_config == 'A') Send Invoice @endif Back