
<?php 

//print_r($receipt_details);

$tax_id=[];
$tax_name=[];
$with_out_tax_total=[];
$tax_total=[];
$unit_prices=[];
$tax_gruop_details=[];
$final_amount=[];

$without_tax_t=0;
                    $n=0;
    foreach($receipt_details->lines as $liness){
            if (in_array($liness['tax_id'], $tax_id)) {
                $tax_total[$n]=+$liness['line_total'];
                
                
                $is=1;foreach($tax_id as $d){
                  
                  if($d==$liness['tax_id']){
                      $with_out_tax_total[$is]=$with_out_tax_total[$is]+str_replace(",","", $liness['unit_price'])*str_replace(",","", $liness['quantity']);
                      $without_tax_t=$without_tax_t+str_replace(",","", $liness['unit_price'])*str_replace(",","", $liness['quantity']);
                      $final_amount[$is]=$final_amount[$is]+str_replace(",","", $liness['line_total_uf']);
                  }
                  $is++;  
                }
                //echo "<br>Existng Tax id :".$liness['tax_id']."Tax Name :".$liness['tax_name']." Tax Subtotal : ".$liness['line_total'];
                
            }else{
                $n++;
                    $tax_id[$n]=$liness['tax_id'];
                    $tax_name[$n]=$liness['tax_name'];
                    $with_out_tax_total[$n]=str_replace(",","", $liness['unit_price'])*str_replace(",","", $liness['quantity']);
                    
                    $without_tax_t=$without_tax_t+$with_out_tax_total[$n];
                    if(isset($liness['group_tax_details'])){
                        $tax_gruop_details[$n]=$liness['group_tax_details'];
                    }else{
                        $tax_gruop_details[$n]=[];
                    }
                    $final_amount[$n]=str_replace(",","", $liness['line_total_uf']);
                    
                  // echo "<br>New Tax id :".$liness['tax_id']."Tax Name :".$tax_name[$n]." Tax Subtotal : ".$liness['line_total']." Unit Price : ".$liness['unit_price']." QTY".$liness['quantity'];
            }
        }
        
$ship_total=0;
$ship_t=0;$ship_a=0;

if(!empty($receipt_details->additional_expenses))  {
    foreach($receipt_details->additional_expenses as $k => $v){
        $ship_t=$v;
    }
    $ship_a=str_replace(",","", $receipt_details->shipping_charges);
$ship_t=str_replace(",","", $ship_t);

$ship_a=str_replace("₹ ","", $ship_a);
$ship_t=str_replace("₹ ","", $ship_t);

$ship_total=$ship_a+$ship_t;
} 



        
$dis=0;$taxed_subtotal=0;$disc_per=0;        
?>

@if( !empty($receipt_details->discount) )
    @php 
        $dis=str_replace(",","", str_replace("₹ ","", $receipt_details->discount));
        $taxed_subtotal=str_replace(",","", str_replace("₹ ","", $receipt_details->taxed_subtotal));
        $disc_per=$taxed_subtotal/$dis;
    @endphp
@endif




<style>
    @page {
  size: auto; 
  /* Chrome sets own margins, we change these printer settings */
  margin: 2mm 5mm -2mm 5mm; 
}
</style>
<!--<script src="https://code.jquery.com/jquery-1.9.1.js"></script>
<script>
    $(document).ready(function() {
        var newTab = window.open('{{$receipt_details->url}}', '_blank');
        newTab.location;
    });
</script>-->
<!-- business information here -->
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <!-- <link rel="stylesheet" href="style.css"> -->
        <title>Receipt-{{$receipt_details->invoice_no}}</title>
    </head>
    <body>
        
        <?php //print_r($receipt_details); ?>
        <div class="ticket">
        	@if(!empty($receipt_details->logo))

        		<div class="text-box centered">
        			<img style="max-height: 100px; width: 90%;" src="{{$receipt_details->logo}}" alt="Logo">
        		</div>
   
        	@endif




        	<div class="text-box">
        	<!-- Logo -->
            <p class="centered" style="padding-left: 4px;padding-right: 9px;">
            	<!-- Header text -->
            	@if(!empty($receipt_details->header_text))
            		<span class="headings">{!! $receipt_details->header_text !!}</span>
					<br/>
				@endif
				<!-- business information here -->
				@if(!empty($receipt_details->display_name))
					<span class="headings" style="font-size: 16px;">
						{{$receipt_details->display_name}}
					</span>
					<br/>					
				@endif
				
				@if(!empty($receipt_details->address))
					{!! $receipt_details->address !!}
					<br/>
				@endif

				@if(!empty($receipt_details->contact))
					{!! $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

				@if(!empty($receipt_details->sub_heading_line1))
					{{ $receipt_details->sub_heading_line1 }}<br/>
				@endif
				@if(!empty($receipt_details->sub_heading_line2))
					{{ $receipt_details->sub_heading_line2 }}<br/>
				@endif
				@if(!empty($receipt_details->sub_heading_line3))
					{{ $receipt_details->sub_heading_line3 }}<br/>
				@endif
				@if(!empty($receipt_details->sub_heading_line4))
					{{ $receipt_details->sub_heading_line4 }}<br/>
				@endif		
				@if(!empty($receipt_details->sub_heading_line5))
					{{ $receipt_details->sub_heading_line5 }}<br/>
				@endif

				@if(!empty($receipt_details->tax_info1))
					<br><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>
			</div>
			
			
			<table style="width:100%">
			    
			
			@if(empty($receipt_details->invoice_no_prefix))
			    <tr>
			        <td colspan="2" class="f-left"><strong>@if(!empty($receipt_details->invoice_no_prefix)){!! $receipt_details->invoice_no_prefix !!} @endif @if(empty($receipt_details->invoice_no_prefix)) Order No @endif : {{$receipt_details->invoice_no}}</strong></td>
			    </tr>
			    <tr>
			        <td colspan="2" class="f-left"><strong>@if(empty($receipt_details->invoice_no_prefix)) Order @endif{!! $receipt_details->date_label !!}</strong> {{$receipt_details->sell_custom_field_1_value}}	</td>

			    </tr>

		    @endif	
		    @if(!empty($receipt_details->invoice_no_prefix))
			    <tr>
			        <td class="f-left"><strong>@if(!empty($receipt_details->invoice_no_prefix)){!! $receipt_details->invoice_no_prefix !!} @endif @if(empty($receipt_details->invoice_no_prefix)) O.No @endif : {{$receipt_details->invoice_no}}</strong></td>
			        <td class="f-right"><strong>{!! $receipt_details->date_label !!}</strong>
			        
			        <?php $old_date_timestamp = strtotime($receipt_details->invoice_date);
$new_date = date('d/m/Y h:i A', $old_date_timestamp); ?>
			        {{$receipt_details->invoice_date}}</td>
			    </tr>
			    
		    @endif	
			    <tr>
			        <td class="f-left" colspan="2">
			            <strong>{{$receipt_details->customer_label ?? ''}}  {!! $receipt_details->customer_info !!}</strong></td>
			    </tr>
			    
			</table>
			
			
			
			@if(!empty($receipt_details->due_date_label))
				<div class="textbox-info">
					<p class="f-left"><strong>{{$receipt_details->due_date_label}}</strong></p>
					<p class="f-right">{{$receipt_details->due_date ?? ''}}</p>
				</div>
			@endif

			@if(!empty($receipt_details->sales_person_label))
				<div class="textbox-info">
					<p class="f-left"><strong>{{$receipt_details->sales_person_label}}</strong></p>
				
					<p class="f-right">{{$receipt_details->sales_person}}</p>
				</div>
			@endif
			@if(!empty($receipt_details->commission_agent_label))
				<div class="textbox-info">
					<p class="f-left"><strong>{{$receipt_details->commission_agent_label}}</strong></p>
				
					<p class="f-right">{{$receipt_details->commission_agent}}</p>
				</div>
			@endif

			@if(!empty($receipt_details->brand_label) || !empty($receipt_details->repair_brand))
				<div class="textbox-info">
					<p class="f-left"><strong>{{$receipt_details->brand_label}}</strong></p>
				
					<p class="f-right">{{$receipt_details->repair_brand}}</p>
				</div>
			@endif

			@if(!empty($receipt_details->device_label) || !empty($receipt_details->repair_device))
				<div class="textbox-info">
					<p class="f-left"><strong>{{$receipt_details->device_label}}</strong></p>
				
					<p class="f-right">{{$receipt_details->repair_device}}</p>
				</div>
			@endif
			
			@if(!empty($receipt_details->model_no_label) || !empty($receipt_details->repair_model_no))
				<div class="textbox-info">
					<p class="f-left"><strong>{{$receipt_details->model_no_label}}</strong></p>
				
					<p class="f-right">{{$receipt_details->repair_model_no}}</p>
				</div>
			@endif
			
			@if(!empty($receipt_details->serial_no_label) || !empty($receipt_details->repair_serial_no))
				<div class="textbox-info">
					<p class="f-left"><strong>{{$receipt_details->serial_no_label}}</strong></p>
				
					<p class="f-right">{{$receipt_details->repair_serial_no}}</p>
				</div>
			@endif

			@if(!empty($receipt_details->repair_status_label) || !empty($receipt_details->repair_status))
				<div class="textbox-info">
					<p class="f-left"><strong>
						{!! $receipt_details->repair_status_label !!}
					</strong></p>
					<p class="f-right">
						{{$receipt_details->repair_status}}
					</p>
				</div>
        	@endif

        	@if(!empty($receipt_details->repair_warranty_label) || !empty($receipt_details->repair_warranty))
	        	<div class="textbox-info">
	        		<p class="f-left"><strong>
	        			{!! $receipt_details->repair_warranty_label !!}
	        		</strong></p>
	        		<p class="f-right">
	        			{{$receipt_details->repair_warranty}}
	        		</p>
	        	</div>
        	@endif

        	<!-- Waiter info -->
			@if(!empty($receipt_details->service_staff_label) || !empty($receipt_details->service_staff))
	        	<div class="textbox-info">
	        		<p class="f-left"><strong>
	        			{!! $receipt_details->service_staff_label !!}
	        		</strong></p>
	        		<p class="f-right">
	        			{{$receipt_details->service_staff}}
					</p>
	        	</div>
	        @endif

	        @if(!empty($receipt_details->table_label) || !empty($receipt_details->table))
	        	<div class="textbox-info">
	        		<p class="f-left"><strong>
	        			@if(!empty($receipt_details->table_label))
							<b>{!! $receipt_details->table_label !!}</b>
						@endif
	        		</strong></p>
	        		<p class="f-right">
	        			{{$receipt_details->table}}
	        		</p>
	        	</div>
	        @endif

	       
			
			@if(!empty($receipt_details->client_id_label))
				<div class="textbox-info">
					<p class="f-left"><strong>
						{{ $receipt_details->client_id_label }}
					</strong></p>
					<p class="f-right">
						{{ $receipt_details->client_id }}
					</p>
				</div>
			@endif
			
			@if(!empty($receipt_details->customer_tax_label))
				<div class="textbox-info">
					<p class="f-left"><strong>
						{{ $receipt_details->customer_tax_label }}
					</strong></p>
					<p class="f-right">
						{{ $receipt_details->customer_tax_number }}
					</p>
				</div>
			@endif

			@if(!empty($receipt_details->customer_custom_fields))
				<div class="textbox-info">
					<p class="centered">
						{!! $receipt_details->customer_custom_fields !!}
					</p>
				</div>
			@endif
			
			@if(!empty($receipt_details->customer_rp_label))
				<div class="textbox-info">
					<p class="f-left"><strong>
						{{ $receipt_details->customer_rp_label }}
					</strong></p>
					<p class="f-right">
						{{ $receipt_details->customer_total_rp }}
					</p>
				</div>
			@endif
			@if(!empty($receipt_details->shipping_custom_field_1_label))
				<div class="textbox-info">
					<p class="f-left"><strong>
						{!!$receipt_details->shipping_custom_field_1_label!!} 
					</strong></p>
					<p class="f-right">
						{!!$receipt_details->shipping_custom_field_1_value ?? ''!!}
					</p>
				</div>
			@endif
			@if(!empty($receipt_details->shipping_custom_field_2_label))
				<div class="textbox-info">
					<p class="f-left"><strong>
						{!!$receipt_details->shipping_custom_field_2_label!!} 
					</strong></p>
					<p class="f-right">
						{!!$receipt_details->shipping_custom_field_2_value ?? ''!!}
					</p>
				</div>
			@endif
			@if(!empty($receipt_details->shipping_custom_field_3_label))
				<div class="textbox-info">
					<p class="f-left"><strong>
						{!!$receipt_details->shipping_custom_field_3_label!!} 
					</strong></p>
					<p class="f-right">
						{!!$receipt_details->shipping_custom_field_3_value ?? ''!!}
					</p>
				</div>
			@endif
			@if(!empty($receipt_details->shipping_custom_field_4_label))
				<div class="textbox-info">
					<p class="f-left"><strong>
						{!!$receipt_details->shipping_custom_field_4_label!!} 
					</strong></p>
					<p class="f-right">
						{!!$receipt_details->shipping_custom_field_4_value ?? ''!!}
					</p>
				</div>
			@endif
			@if(!empty($receipt_details->shipping_custom_field_5_label))
				<div class="textbox-info">
					<p class="f-left"><strong>
						{!!$receipt_details->shipping_custom_field_5_label!!} 
					</strong></p>
					<p class="f-right">
						{!!$receipt_details->shipping_custom_field_5_value ?? ''!!}
					</p>
				</div>
			@endif
			@php $dis=0; @endphp
                @foreach($receipt_details->lines as $line)
                    <?php if($line['total_line_discount']!='0.00') $dis=1;  ?>
                @endforeach


<?php $discount=0;$line_discount_uf=0 ?>



            <table style="margin-top: 5px !important" style="font-size:6px;" class="width-100 table-f-7">
                <thead class=" border-top-dotted">
                    <tr>
                        <th class="description" style="width:10%;">
                        	{{$receipt_details->table_product_label}}
                        </th>
                        <th class="quantity text-center" style="width:6%;">
                        	{{$receipt_details->table_qty_label}}
                        </th>
<th class="text-center" style="width:5%;">MRP</th>

                        @if(empty($receipt_details->hide_price))
                        
                        <!-- <th class="text-right" style="width:10%;">{{$receipt_details->line_tax_label}}</th> -->
                        @if(!empty($receipt_details->discounted_unit_price_label))
							<th class="text-center" style="width:10%;">
								{{$receipt_details->discounted_unit_price_label}}
							</th>
						@endif


                        @if(!empty($receipt_details->item_discount_label))
							<th class="text-center" style="width:5%;">{{$receipt_details->item_discount_label}}</th>
						@endif

						<th class="unit_price text-center" style="width:10%;">
                        	{{$receipt_details->table_unit_price_label}}
                        </th>


                        <th class="price text-right" style="width:20%;">{{$receipt_details->table_subtotal_label}}</th>
                        @endif
                    </tr>
                </thead>
                <?php $line_subtotal=0;$pro_qty=0; $tax_saving=0; ?>
                <tbody class="border-top-dotted">
                	@forelse($receipt_details->lines as $line)
	                    <tr >
	                      
	                        <td colspan="7" class="description">
	                        	{{$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
	                        	@if(!empty($line['sell_line_note']))
	                        	<br>
	                        	<span class="f-8">
	                        	{{$line['sell_line_note']}}
	                        	</span>
	                        	@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
	                        </td>
	                        
	                    </tr>
	                    <tr >
	                    	<td>&nbsp;</td>
	                        <td class="quantity text-center">{{number_format($line['quantity'],0)}} {{$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>
	                        @if(empty($receipt_details->hide_price))
	                        <td class="unit_price text-center">
	                        {{number_format($line['mrp'],0) ?? '0'}}
	                        <!-- {{$line['unit_price_inc_tax']}} -->

	                    </td>

	                    <td class="unit_price text-center">
	               
	                        <?php 
							//print_r($line);
							$disc=0;$d=0;
							    if($line['mrp']!='' && $line['mrp']>0){
							        $disc=($line['mrp']-$line['unit_price_before_discount'])*$line['quantity_uf'];
							        $d=($line['mrp']-$line['unit_price_before_discount']);
							    }
							$discount=$discount+$disc;
							$line_discount_uf=$line_discount_uf+$line['line_discount_uf'];
							?>
							
							{{number_format(($line['line_discount_uf']+$d),0) ?? 00}}

	                    </td>

	                        @if(!empty($receipt_details->discounted_unit_price_label))
								<td class="text-center">
								{{number_format($line['unit_price_inc_tax'],0)}}
								</td>
							@endif

							<!-- <td class="text-right"> -->
								<!-- {{$line['tax']}} --> <!-- {{$line['tax_name']}} --> <!-- {{$line['tax_percent']}}% -->
							<!-- </td> -->
	                        @if(!empty($receipt_details->item_discount_label))
								<td class="text-center">
									<!-- {{$line['total_line_discount'] ?? '0.00'}}
									@if(!empty($line['line_discount_percent']))
								 		({{$line['line_discount_percent']}}%)
									@endif -->
									 {{number_format($line['unit_price_before_discount'],0)}}
								</td>
							@endif
	                        <td class="price text-right">{{number_format($line['line_total'],0)}}</td>
	                        @endif
	                    </tr>
	                    @if(!empty($line['modifiers']))
							@foreach($line['modifiers'] as $modifier)
								<tr>
									<td>
										&nbsp;
									</td>
									<td>
			                            {{$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">{{$modifier['quantity']}} {{$modifier['units']}} </td>
									@if(empty($receipt_details->hide_price))
									<td class="text-right">{{$modifier['unit_price_inc_tax']}}</td>
									@if(!empty($receipt_details->item_discount_label))
										<td class="text-right">0.00</td>
									@endif
									<td class="text-right">{{$modifier['line_total']}}</td>
									@endif
								</tr>
							@endforeach
						@endif
                    @endforeach
                    <!--<tr>
                    	<td @if(!empty($receipt_details->item_discount_label)) colspan="6" @else colspan="5" @endif>&nbsp;</td>
                    </tr>-->
                </tbody>
            </table>
			@if(!empty($receipt_details->total_quantity_label))
				<div class="flex-box">
					<p class="left text-right">
						{!! $receipt_details->total_quantity_label !!}
					</p>
					<p class="width-50 text-right">
						({{$receipt_details->total_quantity}})
					</p>
				</div>
			@endif
			@if(empty($receipt_details->hide_price))
                <div class="flex-box border-top-dotted" >
                    <p class="left text-right sub-headings">
                    	{!! $receipt_details->subtotal_label !!}
                    </p>
                    <p class="width-50 text-right sub-headings">
                    	{{$receipt_details->subtotal}}
                    </p>	
                </div>

                <!-- Shipping Charges -->
				@if(!empty($receipt_details->shipping_charges))
					<div class="flex-box">
						<p class="left text-right">
							{!! $receipt_details->shipping_charges_label !!}
						</p>
						<p class="width-50 text-right">
							{{$receipt_details->shipping_charges}}
						</p>
					</div>
				@endif

				@if(!empty($receipt_details->packing_charge))
					<div class="flex-box">
						<p class="left text-right">
							{!! $receipt_details->packing_charge_label !!}
						</p>
						<p class="width-50 text-right">
							{{$receipt_details->packing_charge}}
						</p>
					</div>
				@endif

				

				@if( !empty($receipt_details->total_line_discount) || $discount>0)
					<div class="flex-box">
						<p class="width-50 text-right">
							Your Saving
						</p>

						<p class="width-50 text-right">
							 (-) {{number_format($discount+$line_discount_uf,2)}}
						</p>
					</div>
				@endif

			<!-- Discount -->
				@if( !empty($receipt_details->discount) )
					<div class="flex-box">
						<p class="width-50 text-right">
							<!-- {!! $receipt_details->discount_label !!} -->Discount
						</p>

						<p class="width-50 text-right">
							(-) {{number_format($receipt_details->discount,0)	}}
						</p>
					</div>
				@endif

				@if( !empty($receipt_details->additional_expenses) )
					@foreach($receipt_details->additional_expenses as $key => $val)
						<div class="flex-box">
							<p class="width-50 text-right">
								{{$key}}:
							</p>

							<p class="width-50 text-right">
								(+) {{$val}}
							</p>
						</div>
					@endforeach
				@endif

				@if(!empty($receipt_details->reward_point_label) )
					<div class="flex-box">
						<p class="width-50 text-right">
							{!! $receipt_details->reward_point_label !!}
						</p>

						<p class="width-50 text-right">
							(-) {{$receipt_details->reward_point_amount}}
						</p>
					</div>
				@endif

@if(!empty($receipt_details->group_tax_details))
					@foreach($receipt_details->group_tax_details as $key => $value)
					<div class="flex-box">
							<p class="width-50 text-right">
								{!! $key !!}
							</p>
						<p class="width-50 text-right">
								(+) {{$value}}
						</p>
					</div>
					@endforeach
@endif
				@if( !empty($receipt_details->tax) )
					<div class="flex-box">
						<p class="width-50 text-right">
							{!! $receipt_details->tax_label !!}
						</p>
						<p class="width-50 text-right">
							(+) {{$receipt_details->tax}}
						</p>
					</div>
				@endif

				@if( $receipt_details->round_off_amount > 0)
					<div class="flex-box">
						<p class="width-50 text-right">
							{!! $receipt_details->round_off_label !!} 
						</p>
						<p class="width-50 text-right">
							{{$receipt_details->round_off}}
						</p>
					</div>
				@endif
	
				<div class="flex-box">
					<p class="width-50 text-right main-headings">
						{!! $receipt_details->total_label !!}
					</p>
					<p class="width-50 text-right main-headings">
						{{$receipt_details->total}}
					</p>
				</div>
			
				@if(!empty($receipt_details->total_in_words))
				<p colspan="2" class="text-right mb-0">
					<small>
					({{$receipt_details->total_in_words}})
					</small>
				</p>
				@endif
				@if(!empty($receipt_details->payments))
					@foreach($receipt_details->payments as $payment)
						<div class="flex-box">
							<p class="width-50 text-right">{{$payment['method']}} <!--({{$payment['date']}})--> </p>
							<p class="width-50 text-right">{{$payment['amount']}}</p>
						</div>
					@endforeach
				@endif

				<!-- Total Paid-->
				@if(!empty($receipt_details->total_paid))
					<!--<div class="flex-box border-bottom-dotted">
						<p class="width-50 text-right">
							{!! $receipt_details->total_paid_label !!}
						</p>
						<p class="width-50 text-right">
							{{$receipt_details->total_paid}}
						</p>
					</div>-->
				@endif

				<!-- Total Due-->
				@if(!empty($receipt_details->total_due) && !empty($receipt_details->total_due_label))
					<div class="flex-box">
						<p class="width-50 text-right">
							{!! $receipt_details->total_due_label !!}
						</p>
						<p class="width-50 text-right">
							{{$receipt_details->total_due}}
						</p>
					</div>
				@endif

				@if(!empty($receipt_details->all_due))
					<div class="flex-box">
						<p class="width-50 text-right">
							{!! $receipt_details->all_bal_label !!}
						</p>
						<p class="width-50 text-right">
							{{$receipt_details->all_due}}
						</p>
					</div>
				@endif
			@endif
            
            @if(empty($receipt_details->hide_price) && !empty($receipt_details->tax_summary_label) )
	            <!-- tax -->
	            @if(!empty($receipt_details->taxes))
	            	<table class="border-bottom width-100 table-f-12">
	            		<tr>
	            			<th colspan="2" class="text-center">{{$receipt_details->tax_summary_label}}</th>
	            		</tr>
	            		@foreach($receipt_details->taxes as $key => $val)
	            			<tr>
	            				<td class="left">{{$key}}</td>
	            				<td class="right">{{$val}}</td>
	            			</tr>
	            		@endforeach
	            	</table>
	            @endif
            @endif


            @if(!empty($receipt_details->additional_notes))
	            <p class="centered">
	                
	            	{!! nl2br($receipt_details->additional_notes) !!}
	            </p>
            @endif


<!-- <center>Tax Details</center> -->

<!-- <?php $w_t=0;$f_t=0;$t_a=0;$i=1;foreach($tax_name as $tax){ ?>

{{$tax}} ,<b>Without Tax : {{number_format($with_out_tax_total[$i],2)}}</b>,

<?php foreach($tax_gruop_details[$i] as $t_g){ ?>
 
 {{$t_g['name']}} : {{number_format(($final_amount[$i]-$with_out_tax_total[$i])/count($tax_gruop_details[$i]),2)}}

<?php  } ?>
<b>Total Amount : {{number_format($final_amount[$i],2)}}</b><br>
<?php $i++; } ?> -->

           

			@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')}}">
			@endif
		
			
			@if(!empty($receipt_details->footer_text))
				<p class="centered border-bottom-dotted" >
					{!! $receipt_details->footer_text !!}
				</p>
			@endif
			 {{-- Barcode --}}
			@if($receipt_details->show_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
			
			
        </div>
        <!-- <button id="btnPrint" class="hidden-print">Print</button>
        <script src="script.js"></script> -->
    </body>
</html>

<style type="text/css">
.f-8 {
	font-size: 8px !important;
}
body {
	color: #000000;
}
@media print {
	* {
    	font-size: 12px;
    	font-weight:600;
    	font-family: 'Times New Roman';
    	word-break: break-all;
	}
	.f-8 {
		font-size: 12px !important;
	}
	
.headings{
	font-size: 20px;
	font-weight: 700;
	text-transform: uppercase;
	white-space: nowrap;
}

.sub-headings{
	font-size: 20px !important;
	font-weight: 700 !important;
}
.main-headings{
	font-size: 22px !important;
	font-weight: 800 !important;
}


.border-top{
    border-top: 1px solid black;
}
.border-bottom{
	border-bottom: 1px solid black;
}

.border-bottom-dotted{
	border-bottom: 1px dotted black;
}
.border-top-dotted{
	border-top: 1px dotted black;
}

td.serial_number, th.serial_number{
	width: 5%;
    max-width: 5%;
}

td.description,
th.description {
    width: 35%;
    max-width: 35%;
}

td.quantity,
th.quantity {
    width: 15%;
    max-width: 15%;
    word-break: break-all;
}
td.unit_price, th.unit_price{
	width: 25%;
    max-width: 25%;
    word-break: break-all;
}

td.price,
th.price {
    width: 20%;
    max-width: 20%;
    word-break: break-all;
}

.centered {
    text-align: center;
    align-content: center;
}

.ticket {
    width: 100%;
    max-width: 100%;
}

img {
    max-width: inherit;
    width: auto;
}

    .hidden-print,
    .hidden-print * {
        display: none !important;
    }
}
.table-info {
	width: 100%;
}
.table-info tr:first-child td, .table-info tr:first-child th {
	padding-top: 8px;
}
.table-info th {
	text-align: left;
}
.table-info td {
	text-align: right;
}
.logo {
	float: left;
	width:35%;
	padding: 10px;
}

.text-with-image {
	float: left;
	width:65%;
}
.text-box {
	width: 100%;
	height: auto;
}

.textbox-info {
	clear: both;
}
.textbox-info p {
	margin-bottom: 0px
}
.flex-box {
	display: flex;
	width: 100%;
	padding-right:15px;
}
.flex-box p {
	width: 50%;
	margin-bottom: 0px;
	white-space: nowrap
	padding-right:15px;
}

.table-f-12 th, .table-f-12 td {
	font-size: 10px;
	word-break: break-word;
}

.bw {
	word-break: break-word;
}
</style> 