<?php
session_start();
require_once('../Connections/courier.php');
 $num = $_GET['num'];
$branch = strtolower($_SESSION['branch_name']);
$query = mysql_query("SELECT * FROM service_items WHERE id = '$num'");
$fetchResult = mysql_fetch_assoc($query);
$qrcode = $fetchResult['ins_com_code'];
$price = $fetchResult['price_'.$branch];



if ($qrcode == "" || is_null($qrcode)) {
    $dateNow = date("His");
    $letter = rand(65,90);
    $any_number = rand(1,100);
    $qrCode1 = $dateNow.$letter.$any_number.$fetchResult['id'];
    $unpdate = mysql_query("UPDATE service_items SET ins_com_code ='$qrCode1' WHERE id='$num'");
    
}else{
 $qrCode1 = $qrcode; 
}
?>
<style type="text/css">
	@media print {
        #printButton{
            display: none;
        }
    #printableArea12{
         align-content: center;
         margin-left:650px
    }
}
</style>
	<center>
		<div  class="qrframe" style="border:none;  width:110px; height:110px; text-align: center;" id="printableArea">
               <img style="float:left;" src="https://chart.googleapis.com/chart?chs=60x60&cht=qr&chl=<?php echo $qrCode1;?>&choe=UTF-8" title="Item Code" />
		</div>
        <div style="margin-left: -20px; margin-top: -20px; padding-left: 10px">GHC <?php echo number_format($price, 2) ?></div>
        <a class="btn btn-primary submitBtn" id="printButton" style="cursor: pointer; margin-left: -45px" onclick="window.print()">Print</a>
	</center>



