@php // Determine payment status for seal $payment_status_seal = 'due'; $seal_text = 'DUE'; // Check payment status from receipt_details if (!empty($receipt_details->payment_status)) { $status = strtolower($receipt_details->payment_status); if ($status == 'paid') { $payment_status_seal = 'paid'; $seal_text = 'PAID'; } elseif ($status == 'partial') { $payment_status_seal = 'partial'; $seal_text = 'DUE'; } else { $payment_status_seal = 'due'; $seal_text = 'DUE'; } } else { // Check total_due amount $total_due_str = preg_replace('/[^0-9.]/', '', $receipt_details->total_due ?? '0.00'); $total_due_amount = floatval($total_due_str); // Also check previous due $previous_due_str = preg_replace('/[^0-9.]/', '', $receipt_details->previous_due ?? '0.00'); $previous_due_amount = floatval($previous_due_str); $combined_due = $total_due_amount + $previous_due_amount; if ($combined_due <= 0) { $payment_status_seal = 'paid'; $seal_text = 'PAID'; } else { $payment_status_seal = 'due'; $seal_text = 'DUE'; } } @endphp
{{$seal_text}}
@if(!empty($receipt_details->logo)) @endif
@if(!empty($receipt_details->display_name))
{{$receipt_details->display_name}}
@endif @if(!empty($receipt_details->address))
{!! $receipt_details->address !!}
@endif @if(!empty($receipt_details->contact))
{!! $receipt_details->contact !!}
@endif
@if(!empty($receipt_details->invoice_heading)) {!! $receipt_details->invoice_heading !!} @else Sales Invoice @endif
@if(!empty($receipt_details->customer_info))
Customer : {!! $receipt_details->customer_name ?? $receipt_details->customer_info !!}
@endif @if(!empty($receipt_details->customer_address))
Address : {{$receipt_details->customer_address}}
@endif @if(!empty($receipt_details->customer_mobile))
Mobile : {{$receipt_details->customer_mobile}}
@endif @if(!empty($receipt_details->attention))
Attention : {{$receipt_details->attention}}
@endif @if(!empty($receipt_details->destination))
Destination : {{$receipt_details->destination}}
@endif
@if(!empty($receipt_details->invoice_no_prefix)) {!! $receipt_details->invoice_no_prefix !!} @endif {{$receipt_details->invoice_no}}
Date {{$receipt_details->invoice_date}}
@if(!empty($receipt_details->entry_time))
Entry Time {{$receipt_details->entry_time}}
@endif @if(!empty($receipt_details->prepared_by))
Prepared By {{$receipt_details->prepared_by}}
@endif @if(!empty($receipt_details->sales_person))
Sales Person {{$receipt_details->sales_person}}
@endif @if(!empty($receipt_details->payment_status))
Bill Status {{strtoupper($receipt_details->payment_status)}}
@endif
@php $sl = 1; @endphp {{-- Purchase Lines (Exchange Products) --}} @if(!empty($receipt_details->purchase_lines)) @foreach ($receipt_details->purchase_lines as $purchase) @endforeach @endif {{-- Regular Sell Lines --}} @forelse($receipt_details->lines as $line) @if($line['not_for_selling'] != 1) {{-- Modifiers --}} @if(!empty($line['modifiers'])) @foreach($line['modifiers'] as $modifier) @endforeach @endif @endif @empty @endforelse
SL Product Description Warranty Qty U.Price Amount
{{$sl++}}
{{$purchase['name']}} {{$purchase['product_variation']}} {{$purchase['variation']}} @if(!empty($purchase['sub_sku'])) {{$purchase['sub_sku']}} @endif
@if(!empty($purchase['product_description']))
{!!$purchase['product_description']!!}
@endif {{-- Display SL, Color, and Storage on same line (for exchange products) --}} @php // Check if show_color_storage is enabled in invoice layout settings // Handle both array and object access, and check for truthy values (1, '1', true) $show_color_storage_setting = null; if (isset($receipt_details->common_settings)) { if (is_array($receipt_details->common_settings)) { $show_color_storage_setting = $receipt_details->common_settings['show_color_storage'] ?? null; } else { $show_color_storage_setting = $receipt_details->common_settings->show_color_storage ?? null; } } $show_color_storage = !empty($show_color_storage_setting) || $show_color_storage_setting === '1' || $show_color_storage_setting === 1 || $show_color_storage_setting === true; $has_serial = $receipt_details->show_serial_number && !empty(getPurchaseProductSerial($purchase['product_id'], $purchase['serial_purchase_code'])); $has_color = $show_color_storage && !empty($purchase['product_color']); $has_storage = $show_color_storage && !empty($purchase['product_storage']); $show_info_line = $has_serial || $has_color || $has_storage; @endphp @if($show_info_line)
@if($has_serial) SL: @foreach(getPurchaseProductSerial($purchase['product_id'], $purchase['serial_purchase_code']) as $serial_number) {{$serial_number->serial_number}}@if(!$loop->last), @endif @endforeach @endif @if($has_serial && ($has_color || $has_storage)) | @endif @if($has_color) Color: {{$purchase['product_color']}} @endif @if($has_color && $has_storage) | @endif @if($has_storage) Storage: {{$purchase['product_storage']}} @endif
@endif
@if(!empty($purchase['warranty_name'])) {{$purchase['warranty_name']}} @else - @endif {{$purchase['quantity']}} {{$purchase['unit_price_before_discount']}} {{$purchase['line_total']}}
{{$sl++}}
{{$line['name']}} {{$line['product_variation']}} {{$line['variation']}} @if(!empty($line['sub_sku'])) {{$line['sub_sku']}} @endif
@if(!empty($line['product_description']))
{!!$line['product_description']!!}
@endif @if(!empty($line['sell_line_note']))
{!!$line['sell_line_note']!!}
@endif {{-- Display SL, Color, and Storage on same line --}} @php // Check if show_color_storage is enabled in invoice layout settings // Handle both array and object access, and check for truthy values (1, '1', true) $show_color_storage_setting = null; if (isset($receipt_details->common_settings)) { if (is_array($receipt_details->common_settings)) { $show_color_storage_setting = $receipt_details->common_settings['show_color_storage'] ?? null; } else { $show_color_storage_setting = $receipt_details->common_settings->show_color_storage ?? null; } } $show_color_storage = !empty($show_color_storage_setting) || $show_color_storage_setting === '1' || $show_color_storage_setting === 1 || $show_color_storage_setting === true; $has_serial = $receipt_details->show_serial_number && !empty(getSellsProductSerial($line['product_id'], $receipt_details->product_Transaction_id)); $has_color = $show_color_storage && !empty($line['product_color']); $has_storage = $show_color_storage && !empty($line['product_storage']); $show_info_line = $has_serial || $has_color || $has_storage; @endphp @if($show_info_line)
@if($has_serial) SL: @foreach(getSellsProductSerial($line['product_id'], $receipt_details->product_Transaction_id) as $serial_number) {{$serial_number->serial_number}}@if(!$loop->last), @endif @endforeach @endif @if($has_serial && ($has_color || $has_storage)) | @endif @if($has_color) Color: {{$line['product_color']}} @endif @if($has_color && $has_storage) | @endif @if($has_storage) Storage: {{$line['product_storage']}} @endif
@endif
@if(!empty($line['warranty_name'])) {{$line['warranty_name']}} @else - @endif @if($receipt_details->show_only_sold_unit) {{$line['sell_unit_quantity']}} @else {{$line['quantity']}} @endif @if($receipt_details->show_only_sold_unit) {{$line['sell_unit_price_before_discount']}} @else {{$line['unit_price_before_discount']}} @endif {{$line['line_total']}}
{{$sl++}} {{$modifier['name']}} {{$modifier['variation']}} @if(!empty($modifier['sell_line_note']))
({!!$modifier['sell_line_note']!!})
@endif
- {{$modifier['quantity']}} {{$modifier['unit_price_inc_tax']}} {{$modifier['line_total']}}
No items found
{{-- Total Quantity --}}
Total Qty : {{$receipt_details->total_quantity ?? '0.00'}}
{{-- Taka In Word --}} @if(!empty($receipt_details->total_in_words))
Taka In Word :
{{$receipt_details->total_in_words}}.
@endif {{-- Narration --}}
Narration :
@if(!empty($receipt_details->additional_notes)) {!! nl2br($receipt_details->additional_notes) !!} @else   @endif
{{-- Return & Refund --}} @php $default_return_refund = '-No Return After Sales.' . PHP_EOL . '-Product Exchange Applies Only To Products.' . PHP_EOL . '-No Money Will Refund.' . PHP_EOL . '-Please Check Your Products Before Leave.'; $return_refund_text = !empty($receipt_details->common_settings['return_refund_text']) ? $receipt_details->common_settings['return_refund_text'] : $default_return_refund; @endphp
Return & Refund :
{!! nl2br(e($return_refund_text)) !!}
Total Amount {{$receipt_details->subtotal ?? '0.00'}}
Less Discount {{$receipt_details->discount ?? '0.00'}}
@if(!empty($receipt_details->total_line_discount))
Item Discount {{$receipt_details->total_line_discount}}
@endif @if(!empty($receipt_details->shipping_charges))
Shipping Charges {{$receipt_details->shipping_charges}}
@endif
Net Payable Amount {{$receipt_details->total ?? '0.00'}}
Previous Due {{$receipt_details->previous_due ?? '0.00'}}
Current Due Amount {{$receipt_details->total_due ?? '0.00'}}
{{-- Split Payment Details --}} @if(!empty($receipt_details->payments) && count($receipt_details->payments) > 0) @foreach($receipt_details->payments as $payment)
{{$payment['method']}} {{$payment['amount']}}
@endforeach @endif
Received Amount {{$receipt_details->total_paid ?? '0.00'}}
Total Due Amount @php // Total Due Amount = Previous Due + Current Due Amount // Parse formatted numbers by removing all non-numeric characters except decimal point $previous_due_str = preg_replace('/[^0-9.]/', '', $receipt_details->previous_due ?? '0.00'); $current_due_str = preg_replace('/[^0-9.]/', '', $receipt_details->total_due ?? '0.00'); $previous_due_amount = floatval($previous_due_str); $current_due_amount = floatval($current_due_str); $total_due_amount = $previous_due_amount + $current_due_amount; @endphp {{number_format($total_due_amount, 2)}}
@php $default_warranty_void = 'The Warranty Is Not Applicable To Adaptor, Remote Control, Sticker-removed Items, Burnt & Physically Damaged Item.'; $warranty_void_text = !empty($receipt_details->common_settings['warranty_void_text']) ? $receipt_details->common_settings['warranty_void_text'] : $default_warranty_void; @endphp
Warranty Void - {!! nl2br(e($warranty_void_text)) !!}
@if(!empty($receipt_details->customer_name) && $receipt_details->customer_name != 'Walk-In Customer') {{ $receipt_details->customer_name }}
@endif Customer Signature
Shop Owner Signature
@if($receipt_details->show_barcode)
Barcode
@endif @if($receipt_details->show_qr_code && !empty($receipt_details->qr_code_text))
QR Code
@endif