<?php 
ob_start();
session_start();
include("inc/config.php");
include("inc/functions.php");
include("inc/CSRF_Protect.php");
$csrf = new CSRF_Protect();
?>
<?php 
$list_id=array();
$list_id=$_GET['list_id'];


$li=explode(",",$list_id);
?>
<!DOCTYPE html>
<html>
<head>
	<title>CSCS</title>
	<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<script>
function goBack() {
  window.history.back();
}
</script>
<style>
table, td, th {  
  border: 1px solid #000;
  text-align: left;
}

table {
  border-collapse: collapse;
  width: 100%;
  height:60%;
}
p.test2 {
  writing-mode: vertical-rl; 
}

</style>

</head>
<body style="font-weight:700">
    <center>
        <button class="btn btn-md btn-success" onclick="goBack()">&laquo; Back</button>&ensp;
        <input type="button" class="btn btn-info" onclick="printDiv('printableArea')" value="Print Or Pdf" />&ensp;
        <a href="pk_lable_print.php?list_id=<?php echo $list_id; ?>"><button class="btn btn-md btn-success">Print Lable</button></a>
        </center><br>
     <?php
      foreach($li as $lid){
     $list_id1=100001;
            $i=0;
    
            
    		$statement = $pdo->prepare("SELECT tu.address as cust_address,tcu.cust_code as code,pk.ref_no as bar,tcu.destination_city as dest,mat.short_desc as content,
    		tu.phone as cust_phone,tu.full_name as cust_name,tcu.cust_name as client_name,pk.address as client_address,pk.city as client_city,pk.state as client_state,
    		pk.phone as client_phone, pk.pics as pieces,pk.c_weight as c_weights,pk.a_weight as a_weights,pk.created_at as created,pk.content_desc as descrp,
    		pk.total_charges as tc,pk.other_charges as oc,pk.payment_mode as pay_mode,pk.gst_no as gst FROM pickup_entry as pk INNER JOIN tbl_user as tu 
    		INNER JOIN tbl_customer as tcu INNER JOIN material_desc as mat on pk.client_id=tu.id AND pk.customer_id=tcu.cust_id AND mat.id=pk.content_desc WHERE pk.awb_no='$lid'");
    		$statement->execute();
    		$result = $statement->fetchAll(PDO::FETCH_ASSOC);
     
     foreach ($result as $row) {
     $cust_address=$row['cust_address'];
     $cust_phone=$row['cust_phone'];
     $cust_name=$row['cust_name'];
     $client_name=$row['client_name'];
     $client_address=$row['client_address'];
     $client_city=$row['client_city'];
     $client_state=$row['client_state'];
     $client_phone=$row['client_phone'];
     $pieces=$row['pieces'];
     $c_weights=$row['c_weights'];
     $gst=$row['gst'];
     $a_weights=$row['a_weights'];
     $total_charges=$row['tc'];
     $other_charges=$row['oc'];
     $desc=$row['content'];
     $pay_mode=$row['pay_mode'];
     $dest=$row['dest'];
     $day=date_create($row['created']);
     $date=date_format($day,'d-m-Y');
     $bar=$row['bar'];
     $code=$row['code'];
     }?>

	<div id="printableArea">
	    
	<table>
    	<tr>
    		<td rowspan="2" style="padding-left: 10px;width: 42%;font-size: 14px;">
    			<div class="row">
    				<div class="col-md-4">
    					<img src="img/speed_logo.jpg" style="margin-top: 10px" width="150px" height="100px">
    				</div>
    				<div class="col-md-8" style="font-size:13px">
    					<p><span style="font-size:15px;font-weight: 800">SPEED LINK SERVICE</span><br>
    		    	#93/44, 2nd Main, 8th Cross,<br>
    				Wison Garden,Bengalore-560027<br>
    				Mb No:+91 9809963232 <br>
    				E-speedlinkblr@gmail.com.<br>
    			<span style="font-weight: 800">	GST NO : 29ALUPM9087C1ZB</span></p>
    					
    				</div>
    			</div>
    		</td>
    		<td style="height: 31px;font-weight: 900;text-align:center;">
    			ORGIN
    		</td>
    		<td style="height: 31px;font-weight: 900;width: 20%;text-align:center;">
    			DEST
    		</td>
    		<td style="height: 31px;font-weight: 900;width: 10%;text-align:center;">
    			DATE
    		</td>
    	<td rowspan="2" style="height: 31px;font-weight: 900;width: 22%;text-align:center;">
    	    
    		<?php 
                 echo "<img alt='testing' src='barcode/barcode.php?codetype=Code39&size=40&text=".$bar."&print=true' style='width: 150px;'/>";
    		    ?><br>
    		   AWB NO : <span style="font-size: 28px;font-weight: 900;"><?php echo $bar; ?></span>
    		    
    		</td>
    		
    	</tr>
    	<tr>

    		<td style="padding-left: 10px;font-size: 28px;font-weight: 900;text-align:center;">BLR</td>
    		<td style="font-weight: 900;font-size: 28px;text-align:center;"><?php echo $dest; ?></td>
    		<td style="text-align:center;font-size:17px;font-weight: 800;"><?php echo $date; ?></td>
    		
        	</tr>

</table>
<table>
    	<tr>
    		<td style="font-size: 15px;font-weight: 800;width: 1px;"><p class="test2">CONSIGNOR</p></td>
    		
      <td style="padding-left: 10px;width: 50%;font-size: 13px"> 
      	  
      	  	<span style="font-weight: 700;font-size: 15px">FROM :</span><br>
      	  	<?php echo $cust_name;  ?><br>
      	  	<?php echo $cust_address;  ?><br>
      	  	<span style="font-weight: 700;font-size: 15px">PHONE : <?php echo $cust_phone;  ?></span>
      	  	<span style="font-weight: 700;font-size: 15px;float:right">GST NO: <?php echo $gst;  ?></span>
      	

         </td>
         <td style="font-size: 15px;font-weight: 800;width: 1px;"><p class="test2">CONSIGNEE</p></td>
         <td style="font-size: 13px;padding-left: 10px;"> 
      	
      	  	<span style="font-weight: 700;font-size: 15px;">TO :</span><br>
      	  		<?php echo $client_name;  ?><br>
      	  			<?php echo $client_address;  ?><br>
      	  				<?php echo $client_city;  ?><br>
      	  					<?php echo $client_state;  ?><br>
      	  
      	  	<span style="font-weight: 700;font-size: 15px">PHONE : <?php echo $client_phone;  ?></span>&emsp;&emsp;
      	  	<span style="font-weight: 700;font-size: 15px">DP CODE : <?php echo $code;  ?></span>
      	  

         </td>

    	</tr>

	</table>
	<table >
		<tr style="font-size: 11px;text-align:center;font-weight: 700">
			
			<td style="width: 18%;text-align:center">BOOKING BRANCH</td>
			<td style="text-align:center">CONTENT-DESCRIPTION</td>
			<td style="text-align:center">NO.OF PIECES</td>
			<td style="text-align:center">ACTUAL WEIGHT</td>
			<td style="text-align:center">CHARGED WEIGHT</td>
			<td style="width: 10%;text-align:center">PAYMENT MODE</td>
			<td style="text-align:center">OTHER CHARGES</td>
			<td style="text-align:center">TOTAL</td>
		</tr>
		<tr style="font-size: 11px;text-align:center">
			<td style="text-align:center;font-weight: 700">Head Office</td>
			<td style="text-align:center;font-weight: 700"><?php echo $desc;  ?></td>
			<td style="text-align:center;font-weight: 900;font-size:17px"><?php echo $pieces;  ?></td>
			<td style="text-align:center;font-weight: 900;font-size:17px"><?php echo $a_weights;  ?></td>
			<td style="text-align:center;font-weight: 900;font-size:17px"><?php echo $c_weights;  ?></td>
			<td style="text-align:center;font-weight: 700"><?php echo $pay_mode;  ?></td>
			<td style="text-align:center;font-weight: 700">&#8377;<?php echo $other_charges;  ?></td>
			<td style="text-align:center;font-weight: 700">&#8377;<?php echo $total_charges;  ?></td>
		</tr>
	</table>
	<table>
		<tr>
			<td rowspan="2" style="font-size: 11px;width: 26%;">
				THE LIABILTY OF SPEED LINK SERVICE FOR THE SHIPMENT IS RESTRICTED TO VALUE DECLARED OR MAXIMUM RS. 100/- WHICHEVER IS LESS I HEREBY AGREE TO THE CONDITIONS OF CARRIAGE ON THE BACK OF THIS AIRWAY BILLS CORRECT.
			</td>
			<td style="font-size: 13px;padding-left: 15px">SENDERS SIGNATURE</td>
			<td rowspan="2" style="font-size: 13px">
				<center style="font-weight: 600">RECEIVED IN GOOD CONDITION</center><br>
				<div class="row">
					<div class="col-md-6" style="padding-left: 15px">
						<span style="font-size: 14px;font-weight: 600">STAMP</span><br>
						SIGNATURE<br>
						NAME<br>
						RELATIONSHIP<br>
					</div>
					<div class="col-md-6">
						DATE<br>
						TIME
					</div>
				</div>
			</td>

		</tr>
		<tr>
			<td style="font-size: 13px;padding-left: 15px">For SPEED LINK SERVICE</td>
		</tr>
	</table>
<br><br>
	<table>
    	<tr>
    		<td rowspan="2" style="padding-left: 10px;width: 42%;font-size: 14px;">
    			<div class="row">
    				<div class="col-md-4">
    					<img src="img/speed_logo.jpg" style="margin-top: 10px" width="150px" height="100px">
    				</div>
    				<div class="col-md-8" style="font-size:13px">
    					<p><span style="font-size:15px;font-weight: 800">SPEED LINK SERVICE</span><br>
    		    	#93/44, 2nd Main, 8th Cross,<br>
    				Wison Garden,Bengalore-560027<br>
    				Mb No:+91 9809963232 <br>
    				E-speedlinkblr@gmail.com.<br>
    			<span style="font-weight: 800">	GST NO : 29ALUPM9087C1ZB</span></p>
    					
    				</div>
    			</div>
    		</td>
    		<td style="height: 31px;font-weight: 900;text-align:center;">
    			ORGIN
    		</td>
    		<td style="height: 31px;font-weight: 900;width: 20%;text-align:center;">
    			DEST
    		</td>
    		<td style="height: 31px;font-weight: 900;width: 10%;text-align:center;">
    			DATE
    		</td>
    	<td rowspan="2" style="height: 31px;font-weight: 900;width: 22%;text-align:center;">
    	    
    		<?php 
                 echo "<img alt='testing' src='barcode/barcode.php?codetype=Code39&size=40&text=".$bar."&print=true' style='width: 150px;'/>";
    		    ?><br>
    		   AWB NO : <span style="font-size: 28px;font-weight: 900;"><?php echo $bar; ?></span>
    		    
    		</td>
    		
    	</tr>
    	<tr>

    		<td style="padding-left: 10px;font-size: 28px;font-weight: 900;text-align:center;">BLR</td>
    		<td style="font-weight: 900;font-size: 28px;text-align:center;"><?php echo $dest; ?></td>
    		<td style="text-align:center;font-size:17px;font-weight: 800;"><?php echo $date; ?></td>
    		
        	</tr>

</table>
<table>
    	<tr>
    		<td style="font-size: 15px;font-weight: 800;width: 1px;"><p class="test2">CONSIGNOR</p></td>
    		
      <td style="padding-left: 10px;width: 50%;font-size: 13px"> 
      	  
      	  	<span style="font-weight: 700;font-size: 15px">FROM :</span><br>
      	  	<?php echo $cust_name;  ?><br>
      	  	<?php echo $cust_address;  ?><br>
      	  	<span style="font-weight: 700;font-size: 15px">PHONE : <?php echo $cust_phone;  ?></span>
      	  	<span style="font-weight: 700;font-size: 15px;float:right">GST NO: <?php echo $gst;  ?></span>
      	

         </td>
         <td style="font-size: 15px;font-weight: 800;width: 1px;"><p class="test2">CONSIGNEE</p></td>
         <td style="font-size: 13px;padding-left: 10px;"> 
      	
      	  	<span style="font-weight: 700;font-size: 15px;">TO :</span><br>
      	  		<?php echo $client_name;  ?><br>
      	  			<?php echo $client_address;  ?><br>
      	  				<?php echo $client_city;  ?><br>
      	  					<?php echo $client_state;  ?><br>
      	  
      	  	<span style="font-weight: 700;font-size: 15px">PHONE : <?php echo $client_phone;  ?></span>&emsp;&emsp;
      	  	<span style="font-weight: 700;font-size: 15px">DP CODE : <?php echo $code;  ?></span>
      	  

         </td>

    	</tr>

	</table>
	<table >
		<tr style="font-size: 11px;text-align:center;font-weight: 700">
			
			<td style="width: 18%;text-align:center">BOOKING BRANCH</td>
			<td style="text-align:center">CONTENT-DESCRIPTION</td>
			<td style="text-align:center">NO.OF PIECES</td>
			<td style="text-align:center">ACTUAL WEIGHT</td>
			<td style="text-align:center">CHARGED WEIGHT</td>
			<td style="width: 10%;text-align:center">PAYMENT MODE</td>
			<td style="text-align:center">OTHER CHARGES</td>
			<td style="text-align:center">TOTAL</td>
		</tr>
		<tr style="font-size: 11px;text-align:center">
			<td style="text-align:center;font-weight: 700">Head Office</td>
			<td style="text-align:center;font-weight: 700"><?php echo $desc;  ?></td>
			<td style="text-align:center;font-weight: 900;font-size:17px"><?php echo $pieces;  ?></td>
			<td style="text-align:center;font-weight: 900;font-size:17px"><?php echo $a_weights;  ?></td>
			<td style="text-align:center;font-weight: 900;font-size:17px"><?php echo $c_weights;  ?></td>
			<td style="text-align:center;font-weight: 700"><?php echo $pay_mode;  ?></td>
			<td style="text-align:center;font-weight: 700">&#8377;<?php echo $other_charges;  ?></td>
			<td style="text-align:center;font-weight: 700">&#8377;<?php echo $total_charges;  ?></td>
		</tr>
	</table>
	<table>
		<tr>
			<td rowspan="2" style="font-size: 11px;width: 26%;">
				THE LIABILTY OF CSCS SERVICE FOR THE SHIPMENT IS RESTRICTED TO VALUE DECLARED OR MAXIMUM RS. 100/- WHICHEVER IS LESS I HEREBY AGREE TO THE CONDITIONS OF CARRIAGE ON THE BACK OF THIS AIRWAY BILLS CORRECT.
			</td>
			<td style="font-size: 13px;padding-left: 15px">SENDERS SIGNATURE</td>
			<td rowspan="2" style="font-size: 13px">
				<center style="font-weight: 600">RECEIVED IN GOOD CONDITION</center><br>
				<div class="row">
					<div class="col-md-6" style="padding-left: 15px">
						<span style="font-size: 14px;font-weight: 600">STAMP</span><br>
						SIGNATURE<br>
						NAME<br>
						RELATIONSHIP<br>
					</div>
					<div class="col-md-6">
						DATE<br>
						TIME
					</div>
				</div>
			</td>

		</tr>
		<tr>
			<td style="font-size: 13px;padding-left: 15px">For CSCS</td>
		</tr>
	</table>
<br><br>
	<table>
    	<tr>
    		<td rowspan="2" style="padding-left: 10px;width: 42%;font-size: 14px;">
    			<div class="row">
    				<div class="col-md-4">
    					<img src="img/speed_logo.jpg" style="margin-top: 10px" width="150px" height="100px">
    				</div>
    				<div class="col-md-8" style="font-size:13px">
    					<p><span style="font-size:15px;font-weight: 800">CSCS</span><br>
    		    	#93/44, 2nd Main, 8th Cross,<br>
    				Wison Garden,Bengalore-560027<br>
    				Mb No:+91 9809963232 <br>
    				E-completescsolution@gmail.com.<br>
    			<span style="font-weight: 800">	GST NO : 29ALUPM9087C1ZB</span></p>
    					
    				</div>
    			</div>
    		</td>
    		<td style="height: 31px;font-weight: 900;text-align:center;">
    			ORGIN
    		</td>
    		<td style="height: 31px;font-weight: 900;width: 20%;text-align:center;">
    			DEST
    		</td>
    		<td style="height: 31px;font-weight: 900;width: 10%;text-align:center;">
    			DATE
    		</td>
    	<td rowspan="2" style="height: 31px;font-weight: 900;width: 22%;text-align:center;">
    	    
    		<?php 
                 echo "<img alt='testing' src='barcode/barcode.php?codetype=Code39&size=40&text=".$bar."&print=true' style='width: 150px;'/>";
    		    ?><br>
    		   AWB NO : <span style="font-size: 28px;font-weight: 900;"><?php echo $bar; ?></span>
    		    
    		</td>
    		
    	</tr>
    	<tr>

    		<td style="padding-left: 10px;font-size: 28px;font-weight: 900;text-align:center;">BLR</td>
    		<td style="font-weight: 900;font-size: 28px;text-align:center;"><?php echo $dest; ?></td>
    		<td style="text-align:center;font-size:17px;font-weight: 800;"><?php echo $date; ?></td>
    		
        	</tr>

</table>
<table>
    	<tr>
    		<td style="font-size: 15px;font-weight: 800;width: 1px;"><p class="test2">CONSIGNOR</p></td>
    		
      <td style="padding-left: 10px;width: 50%;font-size: 13px"> 
      	  
      	  	<span style="font-weight: 700;font-size: 15px">FROM :</span><br>
      	  	<?php echo $cust_name;  ?><br>
      	  	<?php echo $cust_address;  ?><br>
      	  	<span style="font-weight: 700;font-size: 15px">PHONE : <?php echo $cust_phone;  ?></span>
      	  	<span style="font-weight: 700;font-size: 15px;float:right">GST NO: <?php echo $gst;  ?></span>
      	

         </td>
         <td style="font-size: 15px;font-weight: 800;width: 1px;"><p class="test2">CONSIGNEE</p></td>
         <td style="font-size: 13px;padding-left: 10px;"> 
      	
      	  	<span style="font-weight: 700;font-size: 15px;">TO :</span><br>
      	  		<?php echo $client_name;  ?><br>
      	  			<?php echo $client_address;  ?><br>
      	  				<?php echo $client_city;  ?><br>
      	  					<?php echo $client_state;  ?><br>
      	  
      	  	<span style="font-weight: 700;font-size: 15px">PHONE : <?php echo $client_phone;  ?></span>&emsp;&emsp;
      	  	<span style="font-weight: 700;font-size: 15px">DP CODE : <?php echo $code;  ?></span>
      	  

         </td>

    	</tr>

	</table>
	<table >
		<tr style="font-size: 11px;text-align:center;font-weight: 700">
			
			<td style="width: 18%;text-align:center">BOOKING BRANCH</td>
			<td style="text-align:center">CONTENT-DESCRIPTION</td>
			<td style="text-align:center">NO.OF PIECES</td>
			<td style="text-align:center">ACTUAL WEIGHT</td>
			<td style="text-align:center">CHARGED WEIGHT</td>
			<td style="width: 10%;text-align:center">PAYMENT MODE</td>
			<td style="text-align:center">OTHER CHARGES</td>
			<td style="text-align:center">TOTAL</td>
		</tr>
		<tr style="font-size: 11px;text-align:center">
			<td style="text-align:center;font-weight: 700">Head Office</td>
			<td style="text-align:center;font-weight: 700"><?php echo $desc;  ?></td>
			<td style="text-align:center;font-weight: 900;font-size:17px"><?php echo $pieces;  ?></td>
			<td style="text-align:center;font-weight: 900;font-size:17px"><?php echo $a_weights;  ?></td>
			<td style="text-align:center;font-weight: 900;font-size:17px"><?php echo $c_weights;  ?></td>
			<td style="text-align:center;font-weight: 700"><?php echo $pay_mode;  ?></td>
			<td style="text-align:center;font-weight: 700">&#8377;<?php echo $other_charges;  ?></td>
			<td style="text-align:center;font-weight: 700">&#8377;<?php echo $total_charges;  ?></td>
		</tr>
	</table>
	<table>
		<tr>
			<td rowspan="2" style="font-size: 11px;width: 26%;">
				THE LIABILTY OF CSCS SERVICE FOR THE SHIPMENT IS RESTRICTED TO VALUE DECLARED OR MAXIMUM RS. 100/- WHICHEVER IS LESS I HEREBY AGREE TO THE CONDITIONS OF CARRIAGE ON THE BACK OF THIS AIRWAY BILLS CORRECT.
			</td>
			<td style="font-size: 13px;padding-left: 15px">SENDERS SIGNATURE</td>
			<td rowspan="2" style="font-size: 13px">
				<center style="font-weight: 600">RECEIVED IN GOOD CONDITION</center><br>
				<div class="row">
					<div class="col-md-6" style="padding-left: 15px">
						<span style="font-size: 14px;font-weight: 600">STAMP</span><br>
						SIGNATURE<br>
						NAME<br>
						RELATIONSHIP<br>
					</div>
					<div class="col-md-6">
						DATE<br>
						TIME
					</div>
				</div>
			</td>

		</tr>
		<tr>
			<td style="font-size: 13px;padding-left: 15px">For CSCS</td>
		</tr>
	</table>
<br>













<?php 
 }
?>
</div>

</body>
<!-- page script -->
<script>

var doc = new jsPDF();
var specialElementHandlers = {
    '#print-btn': function (element, renderer) {
        return true;
    }
};

$('#submit').click(function () {
    doc.fromHTML($('#print').html(), 15, 15, {
        'width': 1070,
            'elementHandlers': specialElementHandlers
    });
    doc.save('pdf-version.pdf');
});
 
  function printDiv(divName) {
     var printContents = document.getElementById(divName).innerHTML;
     var originalContents = document.body.innerHTML;

     document.body.innerHTML = printContents;

     window.print();

     document.body.innerHTML = originalContents;
}

  $(function () {
    $("#example1").DataTable();
    $('#example2').DataTable({
      "paging": true,
      "lengthChange": false,
      "searching": false,
      "ordering": true,
      "info": true,
      "autoWidth": false,
    });
  });
</script>
</html>