
<?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 .=' <p align="center" style="font-size:10px;">'.$row['jobdata'].' </p>
                    <barcode code="'.$row['receipt_number'].'"  type="I25"  text="1"  size="0.85"/> 
                    <p  align="center"  style="  letter-spacing: 2px;  font-size:10px;">    '.$row['receipt_number'].'    </p> ';
                    
                    if( $brks < $counts){
                         $html .=' <pagebreak /> ';
                        
                    }
                    
                    
					 

                   
                    
                    }

                     


					
					
					
					 
				   
			 
				 }
     

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