
<?php
//thebarcodes.extended.php
	include("my_functions.php");

require_once __DIR__ . '/vendor/autoload.php';

$actual_link = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$parts = explode('thebarcodes/' , $actual_link);

 
$barcode = 0;
if(!empty($parts)){
    
      $barcode = $parts[1];
 
     

}else exit();
 
 
 
 

$html = '';

 

 
  

 

 

$categorydata = barcode_jobs_for_receipt($barcode);
if(!empty($categorydata)){
    

 $bill = 0;
 $html='  ';

$brks = 0;
$counts = sizeof($categorydata);
foreach ($categorydata as $row)
				 {
				     $brks += 1;
                    $html .='  
					 <table class="table table-bordered table-sm"  cellspacing="0" cellspadding="0" width="100%">
					 
					 <tr>   <td colspan="2"> <barcode code="'.$row['receipt_number'].'"  type="I25"  text="1"  size="1"/> <br />'.$row['receipt_number'].'  </td> </tr>
					<tr> <td> Customer </td> <td> '.$row['customer_name'].'</td> </tr>
					<tr> <td> Date </td> <td> '.$row['pickon'].'</td> </tr>
					<tr> <td> Tasks </td> <td> '.$row['jobdata'].'</td> </tr> 
					 
					 
					</table>
				 <br />
				    ';
                    
                    if( $brks < $counts){
                         $html .=' <pagebreak /> ';
                        
                    }
                    
                    
					 

                   
                    
                    }

                     


					
					
					
					 
				   
			 
				 }
     

$mpdf = new \Mpdf\Mpdf(['mode' => 'utf-8','format' =>  array(80, 60), 'setAutoTopMargin' => 'stretch'  
	,'margin_left' => 0, 'margin_top' => 0, 'margin_right' => 0,  'margin_bottom' => 0,  'margin_header' => 0  
	]); 
     
  $stylesheet2 = file_get_contents($base_url.'barcodeextended.css');  
    $mpdf->WriteHTML($stylesheet2,\Mpdf\HTMLParserMode::HEADER_CSS);
	
	 $stylesheet = file_get_contents('mpdfcss.css'); 
    $mpdf->WriteHTML($stylesheet,\Mpdf\HTMLParserMode::HEADER_CSS); 
     
     
    $mpdf->WriteHTML($html ); 
	 $mpdf->Output();
	exit;
?>