බිල්පත
@php
$transaction = \App\Transaction::where('invoice_no', $receipt_details->invoice_no)->first();
$date = '';
$time = '';
if ($transaction) {
$carbon_date = \Carbon\Carbon::parse($transaction->transaction_date);
$date = $carbon_date->format('Y-m-d');
$time = $carbon_date->format('g:i A');
} else {
$date = date('Y-m-d');
$time = date('g:i A');
}
$sale_number = $transaction ? $transaction->id : '35';
$cashier_unit = $transaction ? $transaction->location_id : '2';
@endphp
@php
$total_original = 0;
$total_discount = 0;
$total_items = count($receipt_details->lines);
$total_qty = 0;
@endphp
@forelse($receipt_details->lines as $line)
@php
$product_name = $line['name'];
if (!empty($line['product_custom_field3']) && !empty($line['product_custom_fields']) && strpos($line['product_custom_fields'], (string)$line['product_custom_field3']) !== false) {
$product_name = $line['product_custom_field3'];
}
$qty = (float) preg_replace('/[^0-9.]/', '', $line['quantity'] ?? '0');
$total_qty += $qty;
// Unit price before discount
$unit_price_before_discount = 0;
if (!empty($line['unit_price_before_discount'])) {
$unit_price_before_discount = (float) preg_replace('/[^0-9.]/', '', $line['unit_price_before_discount']);
} else {
$unit_price_before_discount = (float) preg_replace('/[^0-9.]/', '', $line['unit_price_inc_tax']);
}
// Line total
$line_total = (float) preg_replace('/[^0-9.]/', '', $line['line_total']);
// Line discount
$line_discount = 0;
if (!empty($line['total_line_discount'])) {
$line_discount = (float) preg_replace('/[^0-9.]/', '', $line['total_line_discount']);
} else {
$expected_total = $unit_price_before_discount * $qty;
$line_discount = max(0, $expected_total - $line_total);
}
$total_original += ($unit_price_before_discount * $qty);
$total_discount += $line_discount;
$unit_price_formatted = number_format($unit_price_before_discount, 2);
$line_discount_formatted = $line_discount > 0 ? '-' . number_format($line_discount, 2) : '0.00';
$variation_details = '';
if (!empty($line['product_variation']) && $line['product_variation'] != 'Dummy') {
$variation_details .= ' ' . $line['product_variation'];
}
if (!empty($line['variation']) && $line['variation'] != 'Dummy') {
$variation_details .= ' ' . $line['variation'];
}
@endphp
|
{{ $loop->iteration }}. {{ $product_name }}{{ $variation_details }}
@if(!empty($line['brand']))
({{ $line['brand'] }})
@endif
|
|
{{ $unit_price_formatted }}
|
{{ $line['quantity'] }}
|
{{ $line_discount_formatted }}
|
{{ $line['line_total'] }}
|
@empty
| No items found |
@endforelse
@php
// Add invoice-level discount if any
$invoice_discount = 0;
if (!empty($receipt_details->discount)) {
$invoice_discount = (float) preg_replace('/[^0-9.]/', '', $receipt_details->discount);
}
$total_discount += $invoice_discount;
$final_payable = $total_original - $total_discount;
@endphp
මුළු එකතුව
{{ number_format($total_original, 2) }}
වට්ටම් මුදල
- {{ number_format($total_discount, 2) }}
ගෙවිය යුතු මුදල
{{ number_format($final_payable, 2) }}
ගෙවීම් විස්තර
@if(!empty($receipt_details->payments))
@foreach($receipt_details->payments as $payment)
▶ {{ strtoupper($payment['method'] == 'cash' ? 'CASH' : $payment['method']) }}
{{ $payment['amount'] }}
@endforeach
@else
▶ CASH
{{ number_format($final_payable, 2) }}
@endif
ඔබ ලැබූ ලාභය
Rs.{{ number_format($total_discount, 2) }}
(භාණ්ඩ ගණන) - {{ $total_items }}
(භාණ්ඩ ප්රමාණය) - {{ number_format($total_qty, 3) }}
ගැරන්ටි දින 3 ක් පමණි
බිල්පත රැගෙන ඒම අනිවාර්ය වේ
•------» ස්තූතියි නැවත පැමිණෙන්න «------•
@if(!empty($receipt_details->footer_text))
{!! $receipt_details->footer_text !!}
@else
APKHUB SOFTWARE SOLUTION ☎ 0701000044
@endif