<?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;
        <!--<a href="pickup-entry.php"><button class="btn btn-md btn-primary">Back</button></a>&ensp;-->
        <input type="button" class="btn btn-info" onclick="printDiv('printableArea')" value="Print Or Pdf" />&ensp;
        <a href="lable_print.php?list_id=<?php echo $list_id; ?>"><button class="btn btn-md btn-primary">Print Lable</button></a>
        </center><br>
     <?php
      foreach($li as $lid){
     $list_id1=100001;
            $i=0;
            /*SELECT pin.city as pin_city,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,pk.receiver_name as client_name,pk.receiver_address as client_address,pk.receiver_city as client_city,pk.receiver_state as client_state,
    		pk.receiver_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 INNER JOIN pincode as pin on pk.client_id=tu.id AND pk.customer_id=tcu.cust_id AND mat.id=pk.content_desc AND pk.receiver_pincode=pin.pin_code
    		WHERE pk.awb_no='$lid'*/
            
            
       		$statement = $pdo->prepare("SELECT pk.*,tbu.gst_no,tbu.full_name as branchName FROM `pickup_entry`pk INNER JOIN tbl_user tbu ON pk.client_id=tbu.id WHERE pk.id=$lid");
    		$statement->execute();
    		$result = $statement->fetchAll(PDO::FETCH_ASSOC);
     
     foreach ($result as $row) {
     $branchName=$row['branchName'];
     $pin_city=$row['consignee_city'];
     $cust_address=$row['rto_address'];
     $cust_phone=$row['rto_phone'];
     $cust_name=$row['rto_name'];
     $client_name=$row['consignee_name'];
     $client_address=$row['consignee_address'];
     $client_city=$row['consignee_city'];
     $client_state=$row['consignee_state'];
     $client_phone=$row['consignee_phone'];
     $pieces=$row['quantity'];
     $c_weights=$row['c_weight'];
     $gst=$row['gst_no'];
     $gst_amount=$row['gst_amount'];
     $a_weights=$row['a_weight'];
     $total_charges=$row['invoice_value'];
     $other_charges=$row['taxable_value'];
     $desc=$row['product_description'];
     $pay_mode=$row['gst_rate'];
     $dest=$row['consignee_city'];
     $day=date_create($row['date_added']);
     $date=date_format($day,'d-m-Y');
     $bar=$row['cscs_awb'];
     $code=$row['cscs_awb'];
     $mrp=$row['mrp'];
     }?>

	<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/cscs_logo.png" 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">Complete Supply Chain Solutions</span><br>
    		    	 No 4298/1779, <br>
    				 19th Main, Sector-2.<br> 
    			     Bangalore, Karnataka-560102<br>
    			     Ph:+91 9742147191<br>
    				 info@completescsolutions.com.<br>
    			<span style="font-weight: 800">	GST NO : 29AAICC8384N1ZQ</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 $pin_city; ?></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>
         </td>
    	</tr>
	</table>
	<table >
		<tr style="font-size: 11px;text-align:center;font-weight: 700">
			<td style="text-align:center">ACTUAL WEIGHT</td>
			<td style="text-align:center">CHARGED WEIGHT</td>
			<td style="text-align:center">INVOICE VALUE</td>
		</tr>
		<tr style="font-size: 11px;text-align:center">
			<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">&#8377;<?php echo $other_charges; ?></td>
		</tr>
	</table>
	<table>
		<tr>
			<td rowspan="2" style="font-size: 11px;width: 26%;">
				THE LIABILTY OF COMPLETE SUPPLY CHAIN SOLUTIONS 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 COMPLETE SUPPLY CHAIN SOLUTIONS</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/cscs_logo.png" 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">Complete Supply Chain Solutions</span><br>
    		    	 No 4298/1779, <br>
    				 19th Main, Sector-2.<br> 
    			     Bangalore, Karnataka-560102<br>
    			     Ph:+91 9742147191<br>
    				 info@completescsolutions.com.<br>
    			<span style="font-weight: 800">	GST NO : 29AAICC8384N1ZQ</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 $pin_city; ?></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>
         </td>
    	</tr>
	</table>
	<table >
		<tr style="font-size: 11px;text-align:center;font-weight: 700">
			<td style="text-align:center">ACTUAL WEIGHT</td>
			<td style="text-align:center">CHARGED WEIGHT</td>
			<td style="text-align:center">INVOICE VALUE</td>
		</tr>
		<tr style="font-size: 11px;text-align:center">
			<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">&#8377;<?php echo $other_charges; ?></td>
		</tr>
	</table>
	<table>
		<tr>
			<td rowspan="2" style="font-size: 11px;width: 26%;">
				THE LIABILTY OF COMPLETE SUPPLY CHAIN SOLUTIONS 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 COMPLETE SUPPLY CHAIN SOLUTIONS</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/cscs_logo.png" 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">Complete Supply Chain Solutions</span><br>
    		    	 No 4298/1779, <br>
    				 19th Main, Sector-2.<br> 
    			     Bangalore, Karnataka-560102<br>
    			     Ph:+91 9742147191<br>
    				 info@completescsolutions.com.<br>
    			<span style="font-weight: 800">	GST NO : 29AAICC8384N1ZQ</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 $pin_city; ?></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>
         </td>
    	</tr>
	</table>
	<table >
		<tr style="font-size: 11px;text-align:center;font-weight: 700">
			<td style="text-align:center">ACTUAL WEIGHT</td>
			<td style="text-align:center">CHARGED WEIGHT</td>
			<td style="text-align:center">INVOICE VALUE</td>
		</tr>
		<tr style="font-size: 11px;text-align:center">
			<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">&#8377;<?php echo $other_charges; ?></td>
		</tr>
	</table>
	<table>
		<tr>
			<td rowspan="2" style="font-size: 11px;width: 26%;">
				THE LIABILTY OF COMPLETE SUPPLY CHAIN SOLUTIONS 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 COMPLETE SUPPLY CHAIN SOLUTIONS</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>