අංකය (Inv):{{ $invoice->invoice_number }}
දිනය (Date):{{ $invoice->created_at->format('Y-m-d H:i') }}
අයකැමි (Cashier):{{ $invoice->user->name }}
@if($invoice->customer_name)
පාරිභෝගිකයා (Cust):{{ $invoice->customer_name }}
@endif
| විස්තරය (Description) |
ප්රමාණය Qty |
ඒකක මිල Unit |
අපේ මිල Price |
වටිනාකම Total |
@php
$totalSavings = 0;
@endphp
@foreach($invoice->items as $item)
@php
// Determine MRP: Use product selling_price if available, else unit_price
$mrp = $item->product ? $item->product->selling_price : $item->unit_price;
$ourPrice = $item->unit_price;
// If product was deleted or MRP not set, assume MRP = Our Price (No savings)
if ($mrp < $ourPrice)
$mrp = $ourPrice;
$savings = ($mrp - $ourPrice) * $item->quantity;
$totalSavings += $savings;
@endphp
|
@if($item->product && $item->product->name_si)
{{ $item->product->name_si }}
@else
{{ $item->product_name }}
@endif
|
|
{{ number_format($item->quantity, $item->quantity == (int) $item->quantity ? 0 : 3) }}
|
{{ number_format($mrp, 2) }} |
{{ number_format($ourPrice, 2) }} |
{{ number_format($item->line_total, 2) }} |
@if($item->discount > 0)
| වට්ටම්
(Discount) |
-{{ number_format($item->discount, 2) }} |
@endif
@endforeach
උප එකතුව (Subtotal):රු {{ number_format($invoice->subtotal, 2) }}
@if($invoice->item_discount > 0)
අයිතම වට්ටම් (Item Disc):-රු {{ number_format($invoice->item_discount, 2) }}
@endif
@if($invoice->bill_discount > 0)
බිල්පත් වට්ටම් (Bill Disc):-රු {{ number_format($invoice->bill_discount, 2) }}
@endif
@if($invoice->tax_amount > 0)
බදු (Tax):රු {{ number_format($invoice->tax_amount, 2) }}
@endif
එකතුව (TOTAL):රු {{ number_format($invoice->total, 2) }}
@php
$finalSavings = $totalSavings + ($invoice->item_discount ?: 0) + ($invoice->bill_discount ?: 0);
@endphp
@if($finalSavings > 0)
ඔබේ ලාභය (Your Savings):රු {{ number_format($finalSavings, 2) }}
@endif
ගෙවීම් (Payment):
@foreach($invoice->payments as $payment)
{{ ucfirst($payment->method) }}:
රු {{ number_format($payment->amount, 2) }}
@endforeach
@php
$totalPaid = $invoice->payments->sum('amount');
$change = $totalPaid - $invoice->total;
@endphp
@if($change > 0)
ඉතිරි (Change):රු {{ number_format($change, 2) }}
@endif