@if($receipt_details->invoice_heading == 'QUOTATION')
    <!-- ============================================ -->
    <!-- QUOTATION BLOCK - Only shown when invoice_heading = 'QUOTATION' -->
    <!-- ============================================ -->
    <!-- ============================================ -->
    <!-- INVOICE BLOCK - Only shown when invoice_heading is NOT 'QUOTATION' -->
    <!-- ============================================ -->
    <div class="receipt-container" style="color: #000000 !important; margin-top:-10px;">

        {{-- Receipt Content --}}
        <div class="receipt-content">
            <!-- business information here -->
            <div class="row" style="color: #000000 !important;">
                <!-- Logo -->
                @if(empty($receipt_details->letter_head))
                    @if(!empty($receipt_details->logo))
                        <img style="max-height: auto; width: 100%;" src="{{$receipt_details->logo}}" class="img img-responsive center-block">
                    @endif
    <style>
        @media print {
            @page {
                margin: 10mm;
            }
            
            html, body {
                height: 100%;
                margin: 0;
                padding: 0;
            }
            
            .receipt-container {
                display: flex;
                flex-direction: column;
                min-height: 100vh;
                justify-content: space-between;
            }
            
            .receipt-content {
                flex: 1;
            }
            
            .receipt-footer {
                width: 100%;
                text-align: center;
                border-top: 0px solid #000;
                padding-top: 10px;
                margin-top: 20px;
                padding-bottom: 10px;
            }
        }
    </style>

                    <!-- Header text -->
                    @if(!empty($receipt_details->header_text))
                        <div class="col-xs-12">
                            {!! $receipt_details->header_text !!}
                        </div>
                    @endif

                    <!-- business information here -->
                    <div class="col-xs-12 text-center">
                        <h2 class="text-center">
                            <!-- Shop & Location Name  -->
                            @if(!empty($receipt_details->display_name))
                                {{$receipt_details->display_name}}
                            @endif
                        </h2>

                        <!-- Address -->
                        <p>
                        @if(!empty($receipt_details->address))
                                <small class="text-center">
                                {!! $receipt_details->address !!}
                                </small>
                        @endif
                        @if(!empty($receipt_details->contact))
                            <br/>{!! $receipt_details->contact !!}
                        @endif	
                        @if(!empty($receipt_details->contact) && !empty($receipt_details->website))
                            , 
                        @endif
                        @if(!empty($receipt_details->website))
                            {{ $receipt_details->website }}
                        @endif
                        @if(!empty($receipt_details->location_custom_fields))
                            <br>{{ $receipt_details->location_custom_fields }}
                        @endif
                        </p>
                        <p>
                        @if(!empty($receipt_details->sub_heading_line1))
                            {{ $receipt_details->sub_heading_line1 }}
                        @endif
                        @if(!empty($receipt_details->sub_heading_line2))
                            <br>{{ $receipt_details->sub_heading_line2 }}
                        @endif
                        @if(!empty($receipt_details->sub_heading_line3))
                            <br>{{ $receipt_details->sub_heading_line3 }}
                        @endif
                        @if(!empty($receipt_details->sub_heading_line4))
                            <br>{{ $receipt_details->sub_heading_line4 }}
                        @endif		
                        @if(!empty($receipt_details->sub_heading_line5))
                            <br>{{ $receipt_details->sub_heading_line5 }}
                        @endif
                        </p>
                        <p>
                        @if(!empty($receipt_details->tax_info1))
                            <b>{{ $receipt_details->tax_label1 }}</b> {{ $receipt_details->tax_info1 }}
                        @endif

                        @if(!empty($receipt_details->tax_info2))
                            <b>{{ $receipt_details->tax_label2 }}</b> {{ $receipt_details->tax_info2 }}
                        @endif
                        </p>
                    @endif


                    <!-- Title of receipt -->
                    <!--@if(!empty($receipt_details->invoice_heading))-->
                    <!--    <h3 class="text-center">-->
                    <!--        {!! $receipt_details->invoice_heading !!}-->
                    <!--    </h3>-->
                    <!--@endif-->
                </div>
                @if(!empty($receipt_details->letter_head))
                    <div class="col-xs-12 text-center">
                        <img style="width: 100%;margin-bottom: 10px;" src="{{$receipt_details->letter_head}}">
                    </div>
                @endif
            </div>

            {{-- START: All content after header with 15px padding --}}
            <div style="padding-left: 5px; padding-right: 5px; padding-bottom: 15px;">
              
            <div class="col-xs-12 text-center">
                <!-- Invoice  number, Date  -->
                <p style="width: 100% !important" class="word-wrap">
                    <span class="pull-left text-left word-wrap">
                        @if(!empty($receipt_details->invoice_no_prefix))
                            <b>{!! $receipt_details->invoice_no_prefix !!}</b>
                        @endif
                       <span style="border: 1px solid #000000; border-radius: 4px; padding: 2px 10px; display: inline-block;">
        {{ $receipt_details->invoice_no }}
    </span>

                        @if(!empty($receipt_details->types_of_service))
                            <br/>
                            <span class="pull-left text-left">
                                <strong>{!! $receipt_details->types_of_service_label !!}:</strong>
                                {{$receipt_details->types_of_service}}
                                <!-- Waiter info -->
                                @if(!empty($receipt_details->types_of_service_custom_fields))
                                    @foreach($receipt_details->types_of_service_custom_fields as $key => $value)
                                        <br><strong>{{$key}}: </strong> {{$value}}
                                    @endforeach
                                @endif
                            </span>
                        @endif

                        <!-- Table information-->
                        @if(!empty($receipt_details->table_label) || !empty($receipt_details->table))
                            <br/>
                            <span class="pull-left text-left">
                                @if(!empty($receipt_details->table_label))
                                    <b>{!! $receipt_details->table_label !!}</b>
                                @endif
                                {{$receipt_details->table}}

                                <!-- Waiter info -->
                            </span>
                        @endif

                      
                        @if(!empty($receipt_details->client_id_label))
                            <br/>
                            <b>{{ $receipt_details->client_id_label }}</b> {{ $receipt_details->client_id }}
                        @endif
                        @if(!empty($receipt_details->customer_tax_label))
                            <br/>
                            <b>{{ $receipt_details->customer_tax_label }}</b> {{ $receipt_details->customer_tax_number }}
                        @endif
                        <!--@if(!empty($receipt_details->customer_custom_fields))-->
                        <!--    <br/>{!! $receipt_details->customer_custom_fields !!}-->
                        <!--@endif-->
                        @if(!empty($receipt_details->sales_person_label))
                            <br/>
                            <b>{{ $receipt_details->sales_person_label }}</b> {{ $receipt_details->sales_person }}
                        @endif
                        @if(!empty($receipt_details->commission_agent_label))
                            <br/>
                            <strong>{{ $receipt_details->commission_agent_label }}</strong> {{ $receipt_details->commission_agent }}
                        @endif
                        @if(!empty($receipt_details->customer_rp_label))
                            <br/>
                            <strong>{{ $receipt_details->customer_rp_label }}</strong> {{ $receipt_details->customer_total_rp }}
                        @endif
                    </span>

                    <span class="pull-right text-left">
                        <b>{{$receipt_details->date_label}}</b>
                        @php
        $date_parts = explode('-', date('d-m-Y', strtotime($receipt_details->invoice_date)));
    @endphp

    <span style="display: inline-block;">
        <span style="border: 1px solid #000000; border-radius: 3px; padding: 3px 5px;">{{ $date_parts[0] }}</span>
        <span style="margin: 0 2px;"></span>
        <span style="border: 1px solid #000000; border-radius: 3px; padding: 3px 5px;">{{ $date_parts[1] }}</span>
        <span style="margin: 0 2px;"></span>
        <span style="border: 1px solid #000000; border-radius: 3px; padding: 3px 5px;">{{ $date_parts[2] }}</span>
    </span>

                        @if(!empty($receipt_details->due_date_label))
                        <br><b>{{$receipt_details->due_date_label}}</b> {{$receipt_details->due_date ?? ''}}
                        @endif

                        @if(!empty($receipt_details->brand_label) || !empty($receipt_details->repair_brand))
                            <br>
                            @if(!empty($receipt_details->brand_label))
                                <b>{!! $receipt_details->brand_label !!}</b>
                            @endif
                            {{$receipt_details->repair_brand}}
                        @endif


                        @if(!empty($receipt_details->device_label) || !empty($receipt_details->repair_device))
                            <br>
                            @if(!empty($receipt_details->device_label))
                                <b>{!! $receipt_details->device_label !!}</b>
                            @endif
                            {{$receipt_details->repair_device}}
                        @endif

                        @if(!empty($receipt_details->model_no_label) || !empty($receipt_details->repair_model_no))
                            <br>
                            @if(!empty($receipt_details->model_no_label))
                                <b>{!! $receipt_details->model_no_label !!}</b>
                            @endif
                            {{$receipt_details->repair_model_no}}
                        @endif

                        @if(!empty($receipt_details->serial_no_label) || !empty($receipt_details->repair_serial_no))
                            <br>
                            @if(!empty($receipt_details->serial_no_label))
                                <b>{!! $receipt_details->serial_no_label !!}</b>
                            @endif
                            {{$receipt_details->repair_serial_no}}<br>
                        @endif
                        @if(!empty($receipt_details->repair_status_label) || !empty($receipt_details->repair_status))
                            @if(!empty($receipt_details->repair_status_label))
                                <b>{!! $receipt_details->repair_status_label !!}</b>
                            @endif
                            {{$receipt_details->repair_status}}<br>
                        @endif
                        
                        @if(!empty($receipt_details->repair_warranty_label) || !empty($receipt_details->repair_warranty))
                            @if(!empty($receipt_details->repair_warranty_label))
                                <b>{!! $receipt_details->repair_warranty_label !!}</b>
                            @endif
                            {{$receipt_details->repair_warranty}}
                            <br>
                        @endif
                        
                        <!-- Waiter info -->
                        @if(!empty($receipt_details->service_staff_label) || !empty($receipt_details->service_staff))
                            <br/>
                            @if(!empty($receipt_details->service_staff_label))
                                <b>{!! $receipt_details->service_staff_label !!}</b>
                            @endif
                            {{$receipt_details->service_staff}}
                        @endif
                        @if(!empty($receipt_details->shipping_custom_field_1_label))
                            <br><strong>{!!$receipt_details->shipping_custom_field_1_label!!} :</strong> {!!$receipt_details->shipping_custom_field_1_value ?? ''!!}
                        @endif

                        @if(!empty($receipt_details->shipping_custom_field_2_label))
                            <br><strong>{!!$receipt_details->shipping_custom_field_2_label!!}:</strong> {!!$receipt_details->shipping_custom_field_2_value ?? ''!!}
                        @endif

                        @if(!empty($receipt_details->shipping_custom_field_3_label))
                            <br><strong>{!!$receipt_details->shipping_custom_field_3_label!!}:</strong> {!!$receipt_details->shipping_custom_field_3_value ?? ''!!}
                        @endif

                        @if(!empty($receipt_details->shipping_custom_field_4_label))
                            <br><strong>{!!$receipt_details->shipping_custom_field_4_label!!}:</strong> {!!$receipt_details->shipping_custom_field_4_value ?? ''!!}
                        @endif

                        @if(!empty($receipt_details->shipping_custom_field_5_label))
                            <br><strong>{!!$receipt_details->shipping_custom_field_2_label!!}:</strong> {!!$receipt_details->shipping_custom_field_5_value ?? ''!!}
                        @endif
                        {{-- sale order --}}
                        @if(!empty($receipt_details->sale_orders_invoice_no))
                            <br>
                            <strong>@lang('restaurant.order_no'):</strong> {!!$receipt_details->sale_orders_invoice_no ?? ''!!}
                        @endif

                        @if(!empty($receipt_details->sale_orders_invoice_date))
                            <br>
                            <strong>@lang('lang_v1.order_dates'):</strong> {!!$receipt_details->sale_orders_invoice_date ?? ''!!}
                        @endif

                        <!--@if(!empty($receipt_details->sell_custom_field_1_value))-->
                        <!--    <br>-->
                        <!--    <strong>{{ $receipt_details->sell_custom_field_1_label }}:</strong> {!!$receipt_details->sell_custom_field_1_value ?? ''!!}-->
                        <!--@endif-->

                        @if(!empty($receipt_details->sell_custom_field_2_value))
                            <br>
                            <strong>{{ $receipt_details->sell_custom_field_2_label }}:</strong> {!!$receipt_details->sell_custom_field_2_value ?? ''!!}
                        @endif

                        @if(!empty($receipt_details->sell_custom_field_3_value))
                            <br>
                            <strong>{{ $receipt_details->sell_custom_field_3_label }}:</strong> {!!$receipt_details->sell_custom_field_3_value ?? ''!!}
                        @endif

                        @if(!empty($receipt_details->sell_custom_field_4_value))
                            <br>
                            <strong>{{ $receipt_details->sell_custom_field_4_label }}:</strong> {!!$receipt_details->sell_custom_field_4_value ?? ''!!}
                        @endif

                    </span>
                </p>
            </div>
        </div>
        <div style="margin-top:-20px; padding-left: 20px; padding-right: 20px;">
      <!-- customer info -->
                       @if(!empty($receipt_details->customer_info))
        @php
            // Split by <br> tags
            $lines = array_filter(array_map('trim', explode('<br>', $receipt_details->customer_info)));
            
            $customer_name = '';
            $address = '';
            $mobile = '';
            
            foreach ($lines as $line) {
                // Check if line contains "Name:"
                if (stripos($line, 'Name:') !== false) {
                    $customer_name = trim(str_ireplace('Name:', '', $line));
                    // Remove any extra commas or spaces
                    $customer_name = trim($customer_name, ', ');
                }
                // Check if line contains "Mobile:" (with or without bold tags)
                elseif (stripos($line, 'Mobile:') !== false || stripos($line, '<b>Mobile</b>:') !== false) {
                    // Remove any HTML tags and "Mobile:" label
                    $mobile = strip_tags($line);
                    $mobile = trim(str_ireplace(['Mobile:', 'mobile:'], '', $mobile));
                }
                // Otherwise it's address
                else {
                    // Strip any HTML tags
                    $address = strip_tags($line);
                    $address = trim($address);
                }
            }
            
            // If name is still empty, try to get it from first line
            if (empty($customer_name) && isset($lines[0])) {
                $first_line = strip_tags($lines[0]);
                if (stripos($first_line, 'Name:') !== false) {
                    $customer_name = trim(str_ireplace('Name:', '', $first_line));
                    $customer_name = trim($customer_name, ', ');
                } else {
                    $customer_name = $first_line;
                }
            }
            
            // If address is empty, try second line
            if (empty($address) && isset($lines[1])) {
                $address = strip_tags($lines[1]);
                $address = trim($address);
            }
        @endphp
        
        <br/></br>
        <!-- Customer Name with rounded border - Full Width -->
    @if(!empty($customer_name))
        <div style="border: 1px solid #000000; border-radius: 4px; padding: 3px 8px; margin-top: 3px; display: block; width: 100%; box-sizing: border-box;">
            <strong>Name:</strong> {{ $customer_name }}
        </div>
    @endif

    <!-- Address with rounded border - Full Width -->
    @if(!empty($address))
        <div style="border: 1px solid #000000; border-radius: 4px; padding: 3px 8px; margin-top: 3px; display: block; width: 100%; box-sizing: border-box; margin-top:6px;">
            <strong>Address:</strong> {{ $address }}
        </div>
    @endif

    <!-- Mobile with rounded border - Full Width -->
    @if(!empty($mobile))
        <div style="border: 1px solid #000000; border-radius: 4px; padding: 3px 8px; margin-top: 3px; display: block; width: 30%; box-sizing: border-box;margin-top:6px;">
            <strong>Mobile:</strong> {{ $mobile }}
        </div>
    @endif
    @endif

    </div>
        <div class="row" style="color: #000000 !important; padding-left: 15px; padding-right: 15px;">
            @includeIf('sale_pos.receipts.partial.common_repair_invoice')
        </div>

        <div class="row" style="color: #000000 !important; padding-left: 20px; padding-right: 20px;">
            <div class="col-xs-12">
                <br/>
                @php
                    $p_width = 45;
                @endphp
                @if(!empty($receipt_details->item_discount_label))
                    @php
                        $p_width -= 10;
                    @endphp
                @endif
                @if(!empty($receipt_details->discounted_unit_price_label))
                    @php
                        $p_width -= 10;
                    @endphp
                @endif
              <table class="table table-responsive table-slim" style="border: 0px solid #000000; border-collapse: collapse;">
        <thead>
            <tr>
                <th width="{{$p_width}}%" style="border: 1px solid #000000; padding: 5px;">{{$receipt_details->table_product_label}}</th>
                <th class="text-right" width="15%" style="border: 1px solid #000000; padding: 5px;">{{$receipt_details->table_qty_label}}</th>
                <th class="text-right" width="15%" style="border: 1px solid #000000; padding: 5px;">{{$receipt_details->table_unit_price_label}}</th>
                @if(!empty($receipt_details->discounted_unit_price_label))
                    <th class="text-right" width="10%" style="border: 1px solid #000000; padding: 5px;">{{$receipt_details->discounted_unit_price_label}}</th>
                @endif
                @if(!empty($receipt_details->item_discount_label))
                    <th class="text-right" width="10%" style="border: 1px solid #000000; padding: 5px;">{{$receipt_details->item_discount_label}}</th>
                @endif
                <th class="text-right" width="15%" style="border: 1px solid #000000; padding: 5px;">{{$receipt_details->table_subtotal_label}}</th>
            </tr>
        </thead>
        <tbody style = "">
            @forelse($receipt_details->lines as $line)
                <tr>
                    <td style="border: 1px solid #000000; padding: 5px;">
                        @if(!empty($line['image']))
                            <img src="{{$line['image']}}" alt="Image" width="50" style="float: left; margin-right: 8px;">
                        @endif
                        @if(!empty($line['sell_line_note']))
                            {!!$line['sell_line_note']!!}
                            @if(!empty($line['sub_sku']))
                                - {{$line['sub_sku']}}
                            @endif
                        @elseif(!empty($line['product_description']))
                            {!!$line['product_description']!!}
                            @if(!empty($line['sub_sku']))
                                - {{$line['sub_sku']}}
                            @endif
                        @else
                            {{$line['name']}} {{$line['product_variation']}} {{$line['variation']}}
                            @if(!empty($line['sub_sku']))
                                - {{$line['sub_sku']}}
                            @endif
                            @if(!empty($line['brand'])), {{$line['brand']}} @endif 
                            @if(!empty($line['cat_code'])), {{$line['cat_code']}}@endif
                            @if(!empty($line['product_custom_fields'])), {{$line['product_custom_fields']}} @endif
                        @endif
                        @if(!empty($line['lot_number']))<br> {{$line['lot_number_label']}}:  {{$line['lot_number']}} @endif 
                        @if(!empty($line['product_expiry'])), {{$line['product_expiry_label']}}:  {{$line['product_expiry']}} @endif

                        @if(!empty($line['warranty_name'])) <br><small>{{$line['warranty_name']}} </small>@endif @if(!empty($line['warranty_exp_date'])) <small>- {{@format_date($line['warranty_exp_date'])}} </small>@endif
                        @if(!empty($line['warranty_description'])) <small> {{$line['warranty_description'] ?? ''}}</small>@endif

                        @if($receipt_details->show_base_unit_details && $line['quantity'] && $line['base_unit_multiplier'] !== 1)
                        <br><small>
                            1 {{$line['units']}} = {{$line['base_unit_multiplier']}} {{$line['base_unit_name']}} <br>
                            {{$line['base_unit_price']}} x {{$line['orig_quantity']}} = {{$line['line_total']}}
                        </small>
                        @endif
                    </td>
                    <td class="text-right" style="border: 1px solid #000000; padding: 5px;">
                        {{$line['quantity']}} {{$line['units']}} 

                        @if($receipt_details->show_base_unit_details && $line['quantity'] && $line['base_unit_multiplier'] !== 1)
                        <br><small>
                            {{$line['quantity']}} x {{$line['base_unit_multiplier']}} = {{$line['orig_quantity']}} {{$line['base_unit_name']}}
                        </small>
                        @endif
                    </td>
                    <td class="text-right" style="border: 1px solid #000000; padding: 5px;">{{$line['unit_price_before_discount']}}</td>
                    @if(!empty($receipt_details->discounted_unit_price_label))
                        <td class="text-right" style="border: 1px solid #000000; padding: 5px;">
                            {{$line['unit_price_inc_tax']}} 
                        </td>
                    @endif
                    @if(!empty($receipt_details->item_discount_label))
                        <td class="text-right" style="border: 1px solid #000000; padding: 5px;">
                            {{$line['total_line_discount'] ?? '0.00'}}

                            @if(!empty($line['line_discount_percent']))
                                ({{$line['line_discount_percent']}}%)
                            @endif
                        </td>
                    @endif
                    <td class="text-right" style="border: 1px solid #000000; padding: 5px;">{{$line['line_total']}}</td>
                </tr>
                @if(!empty($line['modifiers']))
                    @foreach($line['modifiers'] as $modifier)
                        <tr>
                            <td style="border: 1px solid #000000; padding: 5px;">
                                {{$modifier['name']}} {{$modifier['variation']}} 
                                @if(!empty($modifier['sub_sku'])), {{$modifier['sub_sku']}} @endif @if(!empty($modifier['cat_code'])), {{$modifier['cat_code']}}@endif
                                @if(!empty($modifier['sell_line_note']))({!!$modifier['sell_line_note']!!}) @endif 
                            </td>
                            <td class="text-right" style="border: 1px solid #000000; padding: 5px;">{{$modifier['quantity']}} {{$modifier['units']}} </td>
                            <td class="text-right" style="border: 1px solid #000000; padding: 5px;">{{$modifier['unit_price_inc_tax']}}</td>
                            @if(!empty($receipt_details->discounted_unit_price_label))
                                <td class="text-right" style="border: 1px solid #000000; padding: 5px;">{{$modifier['unit_price_exc_tax']}}</td>
                            @endif
                            @if(!empty($receipt_details->item_discount_label))
                                <td class="text-right" style="border: 1px solid #000000; padding: 5px;">0.00</td>
                            @endif
                            <td class="text-right" style="border: 1px solid #000000; padding: 5px;">{{$modifier['line_total']}}</td>
                        </tr>
                    @endforeach
                @endif
            @empty
                <tr>
                    <td colspan="4" style="border: 1px solid #000000; padding: 5px;">&nbsp;</td>
                    @if(!empty($receipt_details->discounted_unit_price_label))
                        <td style="border: 1px solid #000000; padding: 5px;"></td>
                    @endif
                    @if(!empty($receipt_details->item_discount_label))
                        <td style="border: 1px solid #000000; padding: 5px;"></td>
                    @endif
                </tr>
            @endforelse
        </tbody>
    </table>

       <div class="row" style="color: #000000 !important; padding-left: 0px; padding-right: 0px;">
        <!-- Left Column - Only Additional Notes -->
        <div class="col-xs-6">
            <table class="table table-slim" style="border-collapse: collapse;">
                <tr>
                    <td style="border: 1px solid #000; padding: 3px; vertical-align: top; min-height: 100px;">
                      
                      
                            <p style="margin: 5px 0 0 0; white-space: pre-line;">Transport Cost :{{ $receipt_details->additional_notes }}</p>
                       
                    </td>
                </tr>
                
                  @if(!empty($receipt_details->payments))
                        @foreach($receipt_details->payments as $payment)
                            
                            <tr>
                                <td style="padding: 5px 0; border: none;">
                                    {{ $payment['method'] }}
                                    <span style="float: right;">{{ $payment['amount'] }}</span>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0 0 4px 0; border: none; font-size: 11px; color: #888;">
                                    <span style="float: right;">{{ $payment['date'] }}</span>
                                </td>
                            </tr>
                        @endforeach
                    @endif
            </table>
        </div>

        <!-- Right Column - All Payments and Totals -->
        <div class="col-xs-6">
            <table class="table table-slim">
                <tbody>
                    <!-- Payments -->
                  

                    <!-- Subtotal -->
                    @if(!empty($receipt_details->subtotal_label))
                        <tr>
                            <td style="padding: 6px 0 2px 0; border-top: 1px solid #ddd;">
                                {!! $receipt_details->subtotal_label !!}
                                <span style="float: right;">{{ $receipt_details->subtotal }}</span>
                            </td>
                        </tr>
                    @endif

                    @if(!empty($receipt_details->total_quantity_label))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->total_quantity_label !!}
                                <span style="float: right;">{{ $receipt_details->total_quantity }}</span>
                            </td>
                        </tr>
                    @endif

                    @if(!empty($receipt_details->total_items_label))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->total_items_label !!}
                                <span style="float: right;">{{ $receipt_details->total_items }}</span>
                            </td>
                        </tr>
                    @endif

                    @if(!empty($receipt_details->total_exempt_uf))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                @lang('lang_v1.exempt')
                                <span style="float: right;">{{ $receipt_details->total_exempt }}</span>
                            </td>
                        </tr>
                    @endif

                    @if(!empty($receipt_details->shipping_charges))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->shipping_charges_label !!}
                                <span style="float: right;">{{ $receipt_details->shipping_charges }}</span>
                            </td>
                        </tr>
                    @endif

                    @if(!empty($receipt_details->packing_charge))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->packing_charge_label !!}
                                <span style="float: right;">{{ $receipt_details->packing_charge }}</span>
                            </td>
                        </tr>
                    @endif

                    @if( !empty($receipt_details->discount) )
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->discount_label !!}
                                <span style="float: right;">(-) {{ $receipt_details->discount }}</span>
                            </td>
                        </tr>
                    @endif

                    @if( !empty($receipt_details->total_line_discount) )
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->line_discount_label !!}
                                <span style="float: right;">(-) {{ $receipt_details->total_line_discount }}</span>
                            </td>
                        </tr>
                    @endif

                    @if( !empty($receipt_details->additional_expenses) )
                        @foreach($receipt_details->additional_expenses as $key => $val)
                            <tr>
                                <td style="padding: 2px 0; border: none;">
                                    {{ $key }}:
                                    <span style="float: right;">(+) {{ $val }}</span>
                                </td>
                            </tr>
                        @endforeach
                    @endif

                    @if( !empty($receipt_details->reward_point_label) )
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->reward_point_label !!}
                                <span style="float: right;">(-) {{ $receipt_details->reward_point_amount }}</span>
                            </td>
                        </tr>
                    @endif

                    @if( !empty($receipt_details->tax) )
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->tax_label !!}
                                <span style="float: right;">(+) {{ $receipt_details->tax }}</span>
                            </td>
                        </tr>
                    @endif

                    @if( $receipt_details->round_off_amount > 0)
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->round_off_label !!}
                                <span style="float: right;">{{ $receipt_details->round_off }}</span>
                            </td>
                        </tr>
                    @endif

                    <!-- Total -->
                   

                    <!-- Total Paid -->
                    @if(!empty($receipt_details->total_paid))
                        <tr>
                            <td style="padding: 6px 0 2px 0; border-top: 1px solid #ddd;">
                                <strong>{!! $receipt_details->total_paid_label !!}</strong>
                                <strong style="float: right;">{{ $receipt_details->total_paid }}</strong>
                            </td>
                        </tr>
                    @endif

                    <!-- Total Due -->
                    @if(!empty($receipt_details->total_due) && !empty($receipt_details->total_due_label))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->total_due_label !!}
                                <span style="float: right;">{{ $receipt_details->total_due }}</span>
                            </td>
                        </tr>
                    @endif

                    @if(!empty($receipt_details->total_previous_due))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->total_previous_due_label !!}
                                <span style="float: right;">{{ $receipt_details->total_previous_due }}</span>
                            </td>
                        </tr>
                    @endif

                    @if(!empty($receipt_details->all_due))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->all_bal_label !!}
                                <span style="float: right;">{{ $receipt_details->all_due }}</span>
                            </td>
                        </tr>
                    @endif
                     <tr>
                        <td style="padding:0px 0 2px 0; border-top: 0px solid #000; font-weight: bold;">
                            <!--{!! $receipt_details->total_label !!}-->
                            <!--<span style="float: right;">{{ $receipt_details->total }}</span>-->
                            @if(!empty($receipt_details->total_in_words))
                                <br>
                         <strong>  In word : </strong>{{ ucfirst($receipt_details->total_in_words) }}

                            @endif
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>

            <div class="border-bottom col-md-12" style="padding-left: 15px; padding-right: 15px;">
                @if(empty($receipt_details->hide_price) && !empty($receipt_details->tax_summary_label) )
                    <!-- tax -->
                    @if(!empty($receipt_details->taxes))
                        <table class="table table-slim table-bordered">
                            <tr>
                                <th colspan="2" class="text-center">{{$receipt_details->tax_summary_label}}</th>
                            </tr>
                            @foreach($receipt_details->taxes as $key => $val)
                                <tr>
                                    <td class="text-center"><b>{{$key}}</b></td>
                                    <td class="text-center">{{$val}}</td>
                                </tr>
                            @endforeach
                        </table>
                    @endif
                @endif
            </div>

           
        </div>
        <div class="row" style="color: #000000 !important; padding-left: 15px; padding-right: 15px;">
            @if(!empty($receipt_details->footer_text))
            <div class="@if($receipt_details->show_barcode || $receipt_details->show_qr_code) col-xs-8 @else col-xs-12 @endif">
                {!! $receipt_details->footer_text !!}
            </div>
            @endif
            @if($receipt_details->show_barcode || $receipt_details->show_qr_code)
                <div class="@if(!empty($receipt_details->footer_text)) col-xs-4 @else col-xs-12 @endif text-center">
                    @if($receipt_details->show_barcode)
                        {{-- Barcode --}}
                        <img class="center-block" src="data:image/png;base64,{{DNS1D::getBarcodePNG($receipt_details->invoice_no, 'C128', 2,30,array(39, 48, 54), true)}}">
                    @endif
                    
                    @if($receipt_details->show_qr_code && !empty($receipt_details->qr_code_text))
                        <img class="center-block mt-5" src="data:image/png;base64,{{DNS2D::getBarcodePNG($receipt_details->qr_code_text, 'QRCODE', 3, 3, [39, 48, 54])}}">
                    @endif
                </div>
            @endif
    <div style="position: fixed; bottom: 0; left: 0; right: 0; background: #ffffff; z-index: 999; padding: 10px 15px;">
    <div style="border: 0px solid #000; text-align: center; padding: 8px; padding-left: 15px; padding-right: 15px;">
        <span style="background-color: #000000; color: #ffffff; padding: 5px 10px; border-radius: 3px; border: 1px solid #000000;">
            বিঃদ্রঃ – বিক্রিত মাল ফেরত যোগ্য নহে।
        </span>
    </div>

    @if(!empty($receipt_details->sell_custom_field_1_value))
        <br>
        <!--<strong>{{ $receipt_details->sell_custom_field_1_label }}:</strong> {!!$receipt_details->sell_custom_field_1_value ?? ''!!}-->
    @endif

    @php
        $showSignature = false;
        $fieldValue = trim($receipt_details->sell_custom_field_1_value ?? '');
        
        if(!empty($fieldValue) && (stripos($fieldValue, 'Signature') !== false || stripos($fieldValue, 'Singnature') !== false)) {
            $showSignature = true;
        }
    @endphp

    <div class="receipt-footer" style="
        width: 100%; 
        text-align: center; 
        padding-top: 10px; 
        margin-top: 0px; 
        padding-bottom: 0px;
        font-family: 'Rajdhani', sans-serif !important;
        font-weight: 700 !important;
        font-size: 14px;
        padding-left: 15px;
        padding-right: 15px;
    ">
        <div style="display: flex; justify-content: space-between; align-items: flex-end; margin-left: 0.0in; margin-right: 0.0in;">
            <div style="
                font-family: 'Rajdhani', sans-serif !important;
                font-weight: 650 !important;
                font-size: 14px;
                text-align: left;
                border-top: 0px solid #000;
                padding-top: 10px;
                display: inline-block;
            ">
                Customer's Signature
            </div>
            <div style="
                font-family: 'Rajdhani', sans-serif !important;
                font-weight: 650 !important;
                font-size: 14px;
                text-align: right;
                display: inline-block;
            ">
                <div style="display: flex; flex-direction: column; align-items: flex-end; border-top: 0px solid #000; padding-top: 10px;">
                    @if($showSignature)
                        <img src="{{ url('img/sign.png') }}" alt="Signature" style="max-width: 120px; height: auto; margin-bottom: 5px;">
                    @endif
                    <span>On Behalf of Makka Cable Suppliers.</span>
                </div>
            </div>
        </div>
    </div>
</div>
    </div> {{-- End of content wrapper with 15px padding --}}
    </div> {{-- End of receipt-container --}}
    </div> {{-- End of content wrapper with 15px padding --}}
    </div> {{-- End of receipt-container --}}

@else
<div class="receipt-container" style="color: #000000 !important; margin-top:-20px;">

        {{-- Receipt Content --}}
        <div class="receipt-content">
            <!-- business information here -->
            <div class="row" style="color: #000000 !important;">
                <!-- Logo -->
            @if(empty($receipt_details->letter_head))
        @if(!empty($receipt_details->logo))
            <div style="height: 1.5in; width: 100%;"></div>
        @endif
    <style>
        @media print {
            @page {
                margin: 10mm;
            }
            
            html, body {
                height: 100%;
                margin: 0;
                padding: 0;
            }
            
            .receipt-container {
                display: flex;
                flex-direction: column;
                min-height: 100vh;
                justify-content: space-between;
            }
            
            .receipt-content {
                flex: 1;
            }
            
            .receipt-footer {
                width: 100%;
                text-align: center;
                border-top: 0px solid #000;
                padding-top: 10px;
                margin-top: 20px;
                padding-bottom: 10px;
            }
        }
    </style>

    {{-- Wrap everything in receipt-container --}}


                    <!-- Header text -->
                    @if(!empty($receipt_details->header_text))
                        <div class="col-xs-12">
                            {!! $receipt_details->header_text !!}
                        </div>
                    @endif

                    <!-- business information here -->
                    <div class="col-xs-12 text-center">
                        <h2 class="text-center">
                            <!-- Shop & Location Name  -->
                            @if(!empty($receipt_details->display_name))
                                {{$receipt_details->display_name}}
                            @endif
                        </h2>

                        <!-- Address -->
                        <p>
                        @if(!empty($receipt_details->address))
                                <small class="text-center">
                                {!! $receipt_details->address !!}
                                </small>
                        @endif
                        @if(!empty($receipt_details->contact))
                            <br/>{!! $receipt_details->contact !!}
                        @endif	
                        @if(!empty($receipt_details->contact) && !empty($receipt_details->website))
                            , 
                        @endif
                        @if(!empty($receipt_details->website))
                            {{ $receipt_details->website }}
                        @endif
                        @if(!empty($receipt_details->location_custom_fields))
                            <br>{{ $receipt_details->location_custom_fields }}
                        @endif
                        </p>
                        <p>
                        @if(!empty($receipt_details->sub_heading_line1))
                            {{ $receipt_details->sub_heading_line1 }}
                        @endif
                        @if(!empty($receipt_details->sub_heading_line2))
                            <br>{{ $receipt_details->sub_heading_line2 }}
                        @endif
                        @if(!empty($receipt_details->sub_heading_line3))
                            <br>{{ $receipt_details->sub_heading_line3 }}
                        @endif
                        @if(!empty($receipt_details->sub_heading_line4))
                            <br>{{ $receipt_details->sub_heading_line4 }}
                        @endif		
                        @if(!empty($receipt_details->sub_heading_line5))
                            <br>{{ $receipt_details->sub_heading_line5 }}
                        @endif
                        </p>
                        <p>
                        @if(!empty($receipt_details->tax_info1))
                            <b>{{ $receipt_details->tax_label1 }}</b> {{ $receipt_details->tax_info1 }}
                        @endif

                        @if(!empty($receipt_details->tax_info2))
                            <b>{{ $receipt_details->tax_label2 }}</b> {{ $receipt_details->tax_info2 }}
                        @endif
                        </p>
                    @endif


                    <!-- Title of receipt -->
                    @if(!empty($receipt_details->invoice_heading))
                        <h3 class="text-center">
                            {!! $receipt_details->invoice_heading !!}
                        </h3>
                    @endif
                </div>
                @if(!empty($receipt_details->letter_head))
                    <div class="col-xs-12 text-center">
                        <img style="width: 100%;margin-bottom: 10px;" src="{{$receipt_details->letter_head}}">
                    </div>
                @endif
            </div>

            {{-- START: All content after header with 15px padding --}}
            <div style="padding-left: 5px; padding-right: 5px; padding-bottom: 15px;">
              
            <div class="col-xs-12 text-center">
                <!-- Invoice  number, Date  -->
                <p style="width: 100% !important" class="word-wrap">
                    <span class="pull-left text-left word-wrap">
                        @if(!empty($receipt_details->invoice_no_prefix))
                            <b>{!! $receipt_details->invoice_no_prefix !!}</b>
                        @endif
                       <span style="border: 1px solid #000000; border-radius: 4px; padding: 2px 10px; display: inline-block;">
        {{ $receipt_details->invoice_no }}
    </span>

                        @if(!empty($receipt_details->types_of_service))
                            <br/>
                            <span class="pull-left text-left">
                                <strong>{!! $receipt_details->types_of_service_label !!}:</strong>
                                {{$receipt_details->types_of_service}}
                                <!-- Waiter info -->
                                @if(!empty($receipt_details->types_of_service_custom_fields))
                                    @foreach($receipt_details->types_of_service_custom_fields as $key => $value)
                                        <br><strong>{{$key}}: </strong> {{$value}}
                                    @endforeach
                                @endif
                            </span>
                        @endif

                        <!-- Table information-->
                        @if(!empty($receipt_details->table_label) || !empty($receipt_details->table))
                            <br/>
                            <span class="pull-left text-left">
                                @if(!empty($receipt_details->table_label))
                                    <b>{!! $receipt_details->table_label !!}</b>
                                @endif
                                {{$receipt_details->table}}

                                <!-- Waiter info -->
                            </span>
                        @endif

                      
                        @if(!empty($receipt_details->client_id_label))
                            <br/>
                            <b>{{ $receipt_details->client_id_label }}</b> {{ $receipt_details->client_id }}
                        @endif
                        @if(!empty($receipt_details->customer_tax_label))
                            <br/>
                            <b>{{ $receipt_details->customer_tax_label }}</b> {{ $receipt_details->customer_tax_number }}
                        @endif
                        <!--@if(!empty($receipt_details->customer_custom_fields))-->
                        <!--    <br/>{!! $receipt_details->customer_custom_fields !!}-->
                        <!--@endif-->
                        @if(!empty($receipt_details->sales_person_label))
                            <br/>
                            <b>{{ $receipt_details->sales_person_label }}</b> {{ $receipt_details->sales_person }}
                        @endif
                        @if(!empty($receipt_details->commission_agent_label))
                            <br/>
                            <strong>{{ $receipt_details->commission_agent_label }}</strong> {{ $receipt_details->commission_agent }}
                        @endif
                        @if(!empty($receipt_details->customer_rp_label))
                            <br/>
                            <strong>{{ $receipt_details->customer_rp_label }}</strong> {{ $receipt_details->customer_total_rp }}
                        @endif
                    </span>

                    <span class="pull-right text-left">
                        <b>{{$receipt_details->date_label}}</b>
                        @php
        $date_parts = explode('-', date('d-m-Y', strtotime($receipt_details->invoice_date)));
    @endphp

    <span style="display: inline-block;">
        <span style="border: 1px solid #000000; border-radius: 3px; padding: 3px 5px;">{{ $date_parts[0] }}</span>
        <span style="margin: 0 2px;"></span>
        <span style="border: 1px solid #000000; border-radius: 3px; padding: 3px 5px;">{{ $date_parts[1] }}</span>
        <span style="margin: 0 2px;"></span>
        <span style="border: 1px solid #000000; border-radius: 3px; padding: 3px 5px;">{{ $date_parts[2] }}</span>
    </span>

                        @if(!empty($receipt_details->due_date_label))
                        <br><b>{{$receipt_details->due_date_label}}</b> {{$receipt_details->due_date ?? ''}}
                        @endif

                        @if(!empty($receipt_details->brand_label) || !empty($receipt_details->repair_brand))
                            <br>
                            @if(!empty($receipt_details->brand_label))
                                <b>{!! $receipt_details->brand_label !!}</b>
                            @endif
                            {{$receipt_details->repair_brand}}
                        @endif


                        @if(!empty($receipt_details->device_label) || !empty($receipt_details->repair_device))
                            <br>
                            @if(!empty($receipt_details->device_label))
                                <b>{!! $receipt_details->device_label !!}</b>
                            @endif
                            {{$receipt_details->repair_device}}
                        @endif

                        @if(!empty($receipt_details->model_no_label) || !empty($receipt_details->repair_model_no))
                            <br>
                            @if(!empty($receipt_details->model_no_label))
                                <b>{!! $receipt_details->model_no_label !!}</b>
                            @endif
                            {{$receipt_details->repair_model_no}}
                        @endif

                        @if(!empty($receipt_details->serial_no_label) || !empty($receipt_details->repair_serial_no))
                            <br>
                            @if(!empty($receipt_details->serial_no_label))
                                <b>{!! $receipt_details->serial_no_label !!}</b>
                            @endif
                            {{$receipt_details->repair_serial_no}}<br>
                        @endif
                        @if(!empty($receipt_details->repair_status_label) || !empty($receipt_details->repair_status))
                            @if(!empty($receipt_details->repair_status_label))
                                <b>{!! $receipt_details->repair_status_label !!}</b>
                            @endif
                            {{$receipt_details->repair_status}}<br>
                        @endif
                        
                        @if(!empty($receipt_details->repair_warranty_label) || !empty($receipt_details->repair_warranty))
                            @if(!empty($receipt_details->repair_warranty_label))
                                <b>{!! $receipt_details->repair_warranty_label !!}</b>
                            @endif
                            {{$receipt_details->repair_warranty}}
                            <br>
                        @endif
                        
                        <!-- Waiter info -->
                        @if(!empty($receipt_details->service_staff_label) || !empty($receipt_details->service_staff))
                            <br/>
                            @if(!empty($receipt_details->service_staff_label))
                                <b>{!! $receipt_details->service_staff_label !!}</b>
                            @endif
                            {{$receipt_details->service_staff}}
                        @endif
                        @if(!empty($receipt_details->shipping_custom_field_1_label))
                            <br><strong>{!!$receipt_details->shipping_custom_field_1_label!!} :</strong> {!!$receipt_details->shipping_custom_field_1_value ?? ''!!}
                        @endif

                        @if(!empty($receipt_details->shipping_custom_field_2_label))
                            <br><strong>{!!$receipt_details->shipping_custom_field_2_label!!}:</strong> {!!$receipt_details->shipping_custom_field_2_value ?? ''!!}
                        @endif

                        @if(!empty($receipt_details->shipping_custom_field_3_label))
                            <br><strong>{!!$receipt_details->shipping_custom_field_3_label!!}:</strong> {!!$receipt_details->shipping_custom_field_3_value ?? ''!!}
                        @endif

                        @if(!empty($receipt_details->shipping_custom_field_4_label))
                            <br><strong>{!!$receipt_details->shipping_custom_field_4_label!!}:</strong> {!!$receipt_details->shipping_custom_field_4_value ?? ''!!}
                        @endif

                        @if(!empty($receipt_details->shipping_custom_field_5_label))
                            <br><strong>{!!$receipt_details->shipping_custom_field_2_label!!}:</strong> {!!$receipt_details->shipping_custom_field_5_value ?? ''!!}
                        @endif
                        {{-- sale order --}}
                        @if(!empty($receipt_details->sale_orders_invoice_no))
                            <br>
                            <strong>@lang('restaurant.order_no'):</strong> {!!$receipt_details->sale_orders_invoice_no ?? ''!!}
                        @endif

                        @if(!empty($receipt_details->sale_orders_invoice_date))
                            <br>
                            <strong>@lang('lang_v1.order_dates'):</strong> {!!$receipt_details->sale_orders_invoice_date ?? ''!!}
                        @endif

                        <!--@if(!empty($receipt_details->sell_custom_field_1_value))-->
                        <!--    <br>-->
                        <!--    <strong>{{ $receipt_details->sell_custom_field_1_label }}:</strong> {!!$receipt_details->sell_custom_field_1_value ?? ''!!}-->
                        <!--@endif-->

                        @if(!empty($receipt_details->sell_custom_field_2_value))
                            <br>
                            <strong>{{ $receipt_details->sell_custom_field_2_label }}:</strong> {!!$receipt_details->sell_custom_field_2_value ?? ''!!}
                        @endif

                        @if(!empty($receipt_details->sell_custom_field_3_value))
                            <br>
                            <strong>{{ $receipt_details->sell_custom_field_3_label }}:</strong> {!!$receipt_details->sell_custom_field_3_value ?? ''!!}
                        @endif

                        @if(!empty($receipt_details->sell_custom_field_4_value))
                            <br>
                            <strong>{{ $receipt_details->sell_custom_field_4_label }}:</strong> {!!$receipt_details->sell_custom_field_4_value ?? ''!!}
                        @endif

                    </span>
                </p>
            </div>
        </div>
      
        @php
            // Split by <br> tags
            $lines = array_filter(array_map('trim', explode('<br>', $receipt_details->customer_info)));
            
            $customer_name = '';
            $address = '';
            $mobile = '';
            
            foreach ($lines as $line) {
                // Check if line contains "Name:"
                if (stripos($line, 'Name:') !== false) {
                    $customer_name = trim(str_ireplace('Name:', '', $line));
                    // Remove any extra commas or spaces
                    $customer_name = trim($customer_name, ', ');
                }
                // Check if line contains "Mobile:" (with or without bold tags)
                elseif (stripos($line, 'Mobile:') !== false || stripos($line, '<b>Mobile</b>:') !== false) {
                    // Remove any HTML tags and "Mobile:" label
                    $mobile = strip_tags($line);
                    $mobile = trim(str_ireplace(['Mobile:', 'mobile:'], '', $mobile));
                }
                // Otherwise it's address
                else {
                    // Strip any HTML tags
                    $address = strip_tags($line);
                    $address = trim($address);
                }
            }
            
            // If name is still empty, try to get it from first line
            if (empty($customer_name) && isset($lines[0])) {
                $first_line = strip_tags($lines[0]);
                if (stripos($first_line, 'Name:') !== false) {
                    $customer_name = trim(str_ireplace('Name:', '', $first_line));
                    $customer_name = trim($customer_name, ', ');
                } else {
                    $customer_name = $first_line;
                }
            }
            
            // If address is empty, try second line
            if (empty($address) && isset($lines[1])) {
                $address = strip_tags($lines[1]);
                $address = trim($address);
            }
        @endphp
        @php
        $customFieldValue = '';
        if(!empty($receipt_details->customer_custom_fields)) {
            $customFieldValue = strip_tags($receipt_details->customer_custom_fields);
            // Remove "Designation:" if it exists
            $customFieldValue = trim(str_ireplace('Designation:', '', $customFieldValue));
            $customFieldValue = trim($customFieldValue, ', ');
        }
    @endphp

    <!-- Display custom field value without label -->

        <br/></br>

    @if(!empty($customFieldValue))
        <div style="margin-top:-20px; padding-left: 20px; padding-right: 20px;">
           <div style="border: 0px solid #000000; border-radius: 4px; padding: 3px 8px; margin-top: 3px; display: block; width: 100%; box-sizing: border-box;">
          To</br>  {{ $customFieldValue }}
        </div>
    @endif
      
      
    
      <!-- customer info -->
                       @if(!empty($receipt_details->customer_info))
        <!-- Customer Name with rounded border - Full Width -->
    @if(!empty($customer_name))
        <div style="border: 0px solid #000000; border-radius: 4px; padding: 0px 8px; margin-top: 00px; display: block; width: 100%; box-sizing: border-box;">
             {{ $customer_name }}
        </div>
    @endif

    <!-- Address with rounded border - Full Width -->
    @if(!empty($address))
        <div style="border: 0px solid #000000; border-radius: 4px; padding: 0px 8px; margin-top: 0px; display: block; width: 100%; box-sizing: border-box;">
           {{ $address }}
        </div>
    @endif

    <!-- Mobile with rounded border - Full Width -->
    @if(!empty($mobile))
        <div style="border: 0px solid #000000; border-radius: 4px; padding: 0px 8px; margin-top:0px; display: block; width: 30%; box-sizing: border-box;">
            <strong>Mobile:</strong> {{ $mobile }}
        </div>
    @endif
    @endif
    <div style="border: 0px solid #000000; border-radius: 4px; padding: 0px 8px; margin-top:0px; display: block; width: 100%; box-sizing: border-box;">
        <p style="text-align: justify; margin: 0;">
            <span style="font-weight: bold; text-decoration: underline; display: block; text-align: left; padding=bottom:10px; padding-top:10px;">Sub: Price offer of Power Cable.</span> <br>
         <strong>   Dear Sir,</strong><br><br>
            We 'BANGLADESH CABLE SUPPLIERS' well recognized since 1992 having 34 years of experience exclusively as Shipping Cable Suppliers. We are operating our cable supplier units with name and fame, enjoying wide reputation in the market for our consistent quality, true commitment and sincere customer services.<br>
            In response to our telephonic conversation we are pleased to quote below our prices, terms & conditions for sales of Shipping Cables for the electrical work of your prestigious project at Chittagong.
        </p>
    </div>
    </div>
        <div class="row" style="color: #000000 !important; padding-left: 15px; padding-right: 15px;">
            @includeIf('sale_pos.receipts.partial.common_repair_invoice')
        </div>

        <div class="row" style="color: #000000 !important; padding-left: 20px; padding-right: 20px;">
            <div class="col-xs-12">
                <br/>
                @php
                    $p_width = 45;
                @endphp
                @if(!empty($receipt_details->item_discount_label))
                    @php
                        $p_width -= 10;
                    @endphp
                @endif
                @if(!empty($receipt_details->discounted_unit_price_label))
                    @php
                        $p_width -= 10;
                    @endphp
                @endif
                   <strong> 1. Price </strong>
              <table class="table table-responsive table-slim" style="border: 0px solid #000000; border-collapse: collapse;">
        <thead>
            <tr>
                <th class="text-left" width="3%" style="border: 1px solid #000000; padding: 5px;">SL.</th>
                <th width="{{$p_width}}%" style="border: 1px solid #000000; padding: 5px;text-align:center;">Cable Size/Items</th>
                <th class="text-right" width="10%" style="border: 1px solid #000000; padding: 5px;">{{$receipt_details->table_qty_label}}</th>
                    <th class="text-right" width="10%" style="border: 1px solid #000000; padding: 5px;">Unit</th>
                <th class="text-right" width="15%" style="border: 1px solid #000000; padding: 5px;">{{$receipt_details->table_unit_price_label}}</th>
                @if(!empty($receipt_details->discounted_unit_price_label))
                    <th class="text-right" width="10%" style="border: 1px solid #000000; padding: 5px;">{{$receipt_details->discounted_unit_price_label}}</th>
                @endif
                @if(!empty($receipt_details->item_discount_label))
                    <th class="text-right" width="10%" style="border: 1px solid #000000; padding: 5px;">{{$receipt_details->item_discount_label}}</th>
                @endif
                <th class="text-right" width="25%" style="border: 1px solid #000000; padding: 5px;">Total Taka</th>
            </tr>
        </thead>
        <tbody>
            @forelse($receipt_details->lines as $line)
                <tr>
                    <td style="border: 1px solid #000000; padding: 5px;">{{ $loop->iteration }}</td>
                    <td style="border: 1px solid #000000; padding: 5px;">
                        @if(!empty($line['image']))
                            <img src="{{$line['image']}}" alt="Image" width="50" style="float: left; margin-right: 8px;">
                        @endif
                        @if(!empty($line['sell_line_note']))
                            {!!$line['sell_line_note']!!}
                            @if(!empty($line['sub_sku']))
                                - {{$line['sub_sku']}}
                            @endif
                        @elseif(!empty($line['product_description']))
                            {!!$line['product_description']!!}
                            @if(!empty($line['sub_sku']))
                                - {{$line['sub_sku']}}
                            @endif
                        @else
                            {{$line['name']}} {{$line['product_variation']}} {{$line['variation']}}
                            @if(!empty($line['sub_sku']))
                                - {{$line['sub_sku']}}
                            @endif
                            @if(!empty($line['brand'])), {{$line['brand']}} @endif 
                            @if(!empty($line['cat_code'])), {{$line['cat_code']}}@endif
                            @if(!empty($line['product_custom_fields'])), {{$line['product_custom_fields']}} @endif
                        @endif
                        @if(!empty($line['lot_number']))<br> {{$line['lot_number_label']}}:  {{$line['lot_number']}} @endif 
                        @if(!empty($line['product_expiry'])), {{$line['product_expiry_label']}}:  {{$line['product_expiry']}} @endif

                        @if(!empty($line['warranty_name'])) <br><small>{{$line['warranty_name']}} </small>@endif @if(!empty($line['warranty_exp_date'])) <small>- {{@format_date($line['warranty_exp_date'])}} </small>@endif
                        @if(!empty($line['warranty_description'])) <small> {{$line['warranty_description'] ?? ''}}</small>@endif

                        @if($receipt_details->show_base_unit_details && $line['quantity'] && $line['base_unit_multiplier'] !== 1)
                        <br><small>
                            1 {{$line['units']}} = {{$line['base_unit_multiplier']}} {{$line['base_unit_name']}} <br>
                            {{$line['base_unit_price']}} x {{$line['orig_quantity']}} = {{$line['line_total']}}
                        </small>
                        @endif
                    </td>
                    <td class="text-right" style="border: 1px solid #000000; padding: 5px;">
                        {{$line['quantity']}} 
    </td>
    <td class="text-right" style="border: 1px solid #000000; padding: 5px;">
        {{$line['units']}} 
                        @if($receipt_details->show_base_unit_details && $line['quantity'] && $line['base_unit_multiplier'] !== 1)
                        <br><small>
                            {{$line['quantity']}} x {{$line['base_unit_multiplier']}} = {{$line['orig_quantity']}} {{$line['base_unit_name']}}
                        </small>
                        @endif
                    </td>
                    <td class="text-right" style="border: 1px solid #000000; padding: 5px;">{{$line['unit_price_before_discount']}}</td>
                    @if(!empty($receipt_details->discounted_unit_price_label))
                        <td class="text-right" style="border: 1px solid #000000; padding: 5px;">
                            {{$line['unit_price_inc_tax']}} 
                        </td>
                    @endif
                    @if(!empty($receipt_details->item_discount_label))
                        <td class="text-right" style="border: 1px solid #000000; padding: 5px;">
                            {{$line['total_line_discount'] ?? '0.00'}}

                            @if(!empty($line['line_discount_percent']))
                                ({{$line['line_discount_percent']}}%)
                            @endif
                        </td>
                    @endif
                    <td class="text-right" style="border: 1px solid #000000; padding: 5px;">{{$line['line_total']}}</td>
                </tr>
                @if(!empty($line['modifiers']))
                    @foreach($line['modifiers'] as $modifier)
                        <tr>
                            <td style="border: 1px solid #000000; padding: 5px;">
                                {{$modifier['name']}} {{$modifier['variation']}} 
                                @if(!empty($modifier['sub_sku'])), {{$modifier['sub_sku']}} @endif @if(!empty($modifier['cat_code'])), {{$modifier['cat_code']}}@endif
                                @if(!empty($modifier['sell_line_note']))({!!$modifier['sell_line_note']!!}) @endif 
                            </td>
                            <td class="text-right" style="border: 1px solid #000000; padding: 5px;">{{$modifier['quantity']}} {{$modifier['units']}} </td>
                            <td class="text-right" style="border: 1px solid #000000; padding: 5px;">{{$modifier['unit_price_inc_tax']}}</td>
                            @if(!empty($receipt_details->discounted_unit_price_label))
                                <td class="text-right" style="border: 1px solid #000000; padding: 5px;">{{$modifier['unit_price_exc_tax']}}</td>
                            @endif
                            @if(!empty($receipt_details->item_discount_label))
                                <td class="text-right" style="border: 1px solid #000000; padding: 5px;">0.00</td>
                            @endif
                            <td class="text-right" style="border: 1px solid #000000; padding: 5px;">{{$modifier['line_total']}}</td>
                        </tr>
                    @endforeach
                @endif
            @empty
                <tr>
                    <td colspan="4" style="border: 1px solid #000000; padding: 5px;">&nbsp;</td>
                    @if(!empty($receipt_details->discounted_unit_price_label))
                        <td style="border: 1px solid #000000; padding: 5px;"></td>
                    @endif
                    @if(!empty($receipt_details->item_discount_label))
                        <td style="border: 1px solid #000000; padding: 5px;"></td>
                    @endif
                </tr>
            @endforelse
        </tbody>
    </table>

       <div class="row" style="color: #000000 !important; padding-left: 0px; padding-right: 0px;">
        <!-- Left Column - Only Additional Notes -->
        <div class="col-xs-6">
            <table class="table table-slim" style="border-collapse: collapse;">
                  <tr>
                        <td style="padding:0px 0 2px 0; border-top: 0px solid #000; font-weight: bold;">
                            <!--{!! $receipt_details->total_label !!}-->
                            <!--<span style="float: right;">{{ $receipt_details->total }}</span>-->
                            @if(!empty($receipt_details->total_in_words))
                           
                         <strong>  In word : </strong>{{ ucfirst($receipt_details->total_in_words) }}

                            @endif
                        </td>
                    </tr>
                
                  @if(!empty($receipt_details->payments))
                        @foreach($receipt_details->payments as $payment)
                            
                            <tr>
                                <td style="padding: 5px 0; border: none;">
                                    {{ $payment['method'] }}
                                    <span style="float: right;">{{ $payment['amount'] }}</span>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 0 0 4px 0; border: none; font-size: 11px; color: #888;">
                                    <span style="float: right;">{{ $payment['date'] }}</span>
                                </td>
                            </tr>
                        @endforeach
                    @endif
            </table>
        </div>

        <!-- Right Column - All Payments and Totals -->
        <div class="col-xs-6">
            <table class="table table-slim">
                <tbody>
                 <!-- Subtotal -->
                    @if(!empty($receipt_details->subtotal_label))
                        <tr>
                            <td style="padding: 0px 0 0px 0; border-top: px solid #ddd; text-align:right;">
                             <strong>   Total Payable Amount :
                                <span style="float: right;">{{ $receipt_details->subtotal }}</span></strong>
                            </td>
                        </tr>
                    @endif

                    @if(!empty($receipt_details->total_quantity_label))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->total_quantity_label !!}
                                <span style="float: right;">{{ $receipt_details->total_quantity }}</span>
                            </td>
                        </tr>
                    @endif

                    @if(!empty($receipt_details->total_items_label))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->total_items_label !!}
                                <span style="float: right;">{{ $receipt_details->total_items }}</span>
                            </td>
                        </tr>
                    @endif

                    @if(!empty($receipt_details->total_exempt_uf))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                @lang('lang_v1.exempt')
                                <span style="float: right;">{{ $receipt_details->total_exempt }}</span>
                            </td>
                        </tr>
                    @endif

                    @if(!empty($receipt_details->shipping_charges))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->shipping_charges_label !!}
                                <span style="float: right;">{{ $receipt_details->shipping_charges }}</span>
                            </td>
                        </tr>
                    @endif

                    @if(!empty($receipt_details->packing_charge))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->packing_charge_label !!}
                                <span style="float: right;">{{ $receipt_details->packing_charge }}</span>
                            </td>
                        </tr>
                    @endif

                    @if( !empty($receipt_details->discount) )
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->discount_label !!}
                                <span style="float: right;">(-) {{ $receipt_details->discount }}</span>
                            </td>
                        </tr>
                    @endif

                    @if( !empty($receipt_details->total_line_discount) )
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->line_discount_label !!}
                                <span style="float: right;">(-) {{ $receipt_details->total_line_discount }}</span>
                            </td>
                        </tr>
                    @endif

                    @if( !empty($receipt_details->additional_expenses) )
                        @foreach($receipt_details->additional_expenses as $key => $val)
                            <tr>
                                <td style="padding: 2px 0; border: none;">
                                    {{ $key }}:
                                    <span style="float: right;">(+) {{ $val }}</span>
                                </td>
                            </tr>
                        @endforeach
                    @endif

                    @if( !empty($receipt_details->reward_point_label) )
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->reward_point_label !!}
                                <span style="float: right;">(-) {{ $receipt_details->reward_point_amount }}</span>
                            </td>
                        </tr>
                    @endif

                    @if( !empty($receipt_details->tax) )
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->tax_label !!}
                                <span style="float: right;">(+) {{ $receipt_details->tax }}</span>
                            </td>
                        </tr>
                    @endif

                    @if( $receipt_details->round_off_amount > 0)
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->round_off_label !!}
                                <span style="float: right;">{{ $receipt_details->round_off }}</span>
                            </td>
                        </tr>
                    @endif

                    <!-- Total -->
                   

                    <!-- Total Paid -->
                    @if(!empty($receipt_details->total_paid))
                        <tr>
                            <td style="padding: 6px 0 2px 0; border-top: 1px solid #ddd;">
                                <strong>{!! $receipt_details->total_paid_label !!}</strong>
                                <strong style="float: right;">{{ $receipt_details->total_paid }}</strong>
                            </td>
                        </tr>
                    @endif

                    <!-- Total Due -->
                    @if(!empty($receipt_details->total_due) && !empty($receipt_details->total_due_label))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->total_due_label !!}
                                <span style="float: right;">{{ $receipt_details->total_due }}</span>
                            </td>
                        </tr>
                    @endif

                    @if(!empty($receipt_details->total_previous_due))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->total_previous_due_label !!}
                                <span style="float: right;">{{ $receipt_details->total_previous_due }}</span>
                            </td>
                        </tr>
                    @endif

                    @if(!empty($receipt_details->all_due))
                        <tr>
                            <td style="padding: 2px 0; border: none;">
                                {!! $receipt_details->all_bal_label !!}
                                <span style="float: right;">{{ $receipt_details->all_due }}</span>
                            </td>
                        </tr>
                    @endif
                  
                </tbody>
            </table>
        </div>
    </div>
    <div class="terms-section">
        <div class="terms-item">
            <span class="terms-number">2.</span>
            <span class="terms-text"><strong>Payment :</strong> Advance payment to be made by pay order or A/C payee cheque with purchase order.</span>
        </div>
        <div class="terms-item">
            <span class="terms-number">3.</span>
            <span class="terms-text"><strong>Packing :</strong> Bundle of cable.</span>
        </div>
        <div class="terms-item">
            <span class="terms-number">4.</span>
            <span class="terms-text"><strong>Delivery :</strong> Delivery must be done within 3 (Three) days from the date hereof.</span>
        </div>
        <div class="terms-item">
            <span class="terms-number">5.</span>
            <span class="terms-text"><strong>Validity :</strong> Our offer will remain valid for 7 (Seven) days from the date hereof.</span>
        </div>
        <div class="terms-item">
            <span class="terms-number">6.</span>
            <span class="terms-text"><strong>Warranty/Replacement Facility :</strong> For 10 (Ten) Years.</span>
        </div>
        <br>
        <div class="terms-footer">
            <p>Should you require any further information or clarification, please do not hesitate to contact us.</p>
            <p>We assure you of our best services at all time.</p>
        </div>
    </div>
            <div class="border-bottom col-md-12" style="padding-left: 15px; padding-right: 15px;">
                @if(empty($receipt_details->hide_price) && !empty($receipt_details->tax_summary_label) )
                    <!-- tax -->
                    @if(!empty($receipt_details->taxes))
                        <table class="table table-slim table-bordered">
                            <tr>
                                <th colspan="2" class="text-center">{{$receipt_details->tax_summary_label}}</th>
                            </tr>
                            @foreach($receipt_details->taxes as $key => $val)
                                <tr>
                                    <td class="text-center"><b>{{$key}}</b></td>
                                    <td class="text-center">{{$val}}</td>
                                </tr>
                            @endforeach
                        </table>
                    @endif
                @endif
            </div>

           
        </div>

      
</div>
<div style="margin-top: 30px;">
    <div style="padding-left: 15px; padding-right: 15px; padding-top: 10px; border-bottom: 0px solid #000;">
        <strong>Best Regards</strong>
    </div>
</div>
        <div class="row" style="color: #000000 !important; padding-left: 15px; padding-right: 15px;">
            @if(!empty($receipt_details->footer_text))
            <div class="@if($receipt_details->show_barcode || $receipt_details->show_qr_code) col-xs-8 @else col-xs-12 @endif">
                {!! $receipt_details->footer_text !!}
            </div>
            @endif
            @if($receipt_details->show_barcode || $receipt_details->show_qr_code)
                <div class="@if(!empty($receipt_details->footer_text)) col-xs-4 @else col-xs-12 @endif text-center">
                    @if($receipt_details->show_barcode)
                        {{-- Barcode --}}
                        <img class="center-block" src="data:image/png;base64,{{DNS1D::getBarcodePNG($receipt_details->invoice_no, 'C128', 2,30,array(39, 48, 54), true)}}">
                    @endif
                    
                    @if($receipt_details->show_qr_code && !empty($receipt_details->qr_code_text))
                        <img class="center-block mt-5" src="data:image/png;base64,{{DNS2D::getBarcodePNG($receipt_details->qr_code_text, 'QRCODE', 3, 3, [39, 48, 54])}}">
                    @endif
                </div>
            @endif

  <!-- Footer -->
<div class="footer" style="
    width: 100%; 
    text-align: center; 
    padding-top: 10px; 
    padding-bottom: 0px;
    border-top: 1px solid #ddd;
    margin-bottom: 0px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    z-index: 999;
">
    <!--<img src="{{ asset('img/bfooter.png') }}" alt="Footer" style="max-width: 100%; height: auto; max-height: auto;">-->
   
</div>
            </div>
        </div>
    </div>

    </div> {{-- End of content wrapper with 15px padding --}}
    </div> {{-- End of receipt-container --}}
    </div> {{-- End of content wrapper with 15px padding --}}
    </div> {{-- End of receipt-container --}}   

@endif