<?php
ob_start();
session_start();
include("inc/config.php");
include("inc/functions.php");
include("inc/CSRF_Protect.php");
$csrf = new CSRF_Protect();
$error_message = '';
$success_message = '';
$error_message1 = '';
$success_message1 = '';

$pickup_entry_ids=0;
if(isset($_GET['list_id'])){
    $pickup_entry_ids=$_GET['list_id'];
}


// Check if the user is logged in or not
if(!isset($_SESSION['user'])) {
	header('location: login.php');
	exit;
}
?>

<body onload="window.print();setTimeout(window.close, 0);">
<?php 

$statement = $pdo->prepare("SELECT * FROM `pickup_entry` WHERE pickup_entry.id in ($pickup_entry_ids)");
$statement->execute();
$pickup_result = $statement->fetchAll(PDO::FETCH_ASSOC);

foreach($pickup_result as $pr){  ?>
<?php for($t=1;$t<=2;$t++){ ?>
<div>
<table>
    <tr>
        <td style="width:10%;border-right:none;" rowspan="2">
            <img src="https://firstmatrix.cfd/venus_cargo/admin/img/sri-hari-logo.png" style="width:120px;" />
        </td>
        <td style="width:40%;border-left:none;font-size:14px;" rowspan="2">
            Venus Cargo & Logistics Pvt. Ltd.<br>
            REG OF: U 2069, Akshar Business Park,<br>
            Plot No 3, Sector 25, Vashi, Navi<br>
            Mumbai-400703<br>
            Gstn: 27AACCV0183G1ZF
        </td>
        <td style="width:50%;text-align:center;" colspan="2">
            <img src="https://firstmatrix.cfd/venus_cargo/admin/barcode/barcode.php?codetype=Code39&size=40&text=<?=$pr['cscs_awb']?>"/>
        </td>
    </tr>
    <tr>
        <td style="width:25%;text-align:center;">
            <?=date("d-M-Y", strtotime($pr['date_added']))?>
        </td>
        <td style="width:25%;text-align:center;">
            <?=$pr['cscs_awb']?>
        </td>
    </tr>
</table> 
<table>
    <tr>
        <td style="width:37.5%;border-top:none;font-weight:bold;"> Consignor / Sender (Name & Address) </td>
        <td style="width:37.5%;border-top:none;font-weight:bold;"> Consignee / Receiver (Name & Address)</td>
        <td style="width:25%;text-align:center;border-top:none;font-weight:bold;">
            Mode
        </td>
    </tr>
    <tr>
        <td style="font-size:11px;" >
            <p style="height: 100px;display: flex;align-items: center;">
            <?php if(isset($pr['shipper_name'])){ echo $pr['shipper_name'];}?>
            <?php if(isset($pr['shipper_address'])){ echo "<br>".$pr['shipper_address'];}?>
            <?php if(isset($pr['shipper_city'])){ echo "<br>".$pr['shipper_city'];}?>
            <?php if(isset($pr['shipper_pincode'])){ echo "-".$pr['shipper_pincode'];}?>
            <?php if(isset($pr['shipper_state'])){ echo "<br>".$pr['shipper_state'];}?>
            <?php if(isset($pr['shipper_phone'])){ echo "<br>Mobile : ".$pr['shipper_phone'];}?>
            </p>
        </td>
        <td style="font-size:11px;" >
            <p style="height: 100px;display: flex;align-items: center;">
            <?php if(isset($pr['consignee_name'])){ echo $pr['consignee_name'];}?>
            <?php if(isset($pr['consignee_address'])){ echo "<br>".$pr['consignee_address'];}?>
            <?php if(isset($pr['consignee_city'])){ echo "<br>".$pr['consignee_city'];}?>
            <?php if(isset($pr['consignee_pincode'])){ echo "-".$pr['consignee_pincode'];}?>
            <?php if(isset($pr['consignee_state'])){ echo "<br>".$pr['consignee_state'];}?>
            <?php if(isset($pr['consignee_phone'])){ echo "<br>Mobile : ".$pr['consignee_phone'];}?>
            </p>
        </td>
        <td style="width:25%;text-align:center;vertical-align:top;padding:0px;" rowspan="5">
                <table style="border:none;">
                    <tr>
                        <td colspan="2" style="text-align:center;border:none;padding:10px 5px;"><?=strtoupper($pr['business_mode'])?></td>
                    </tr> 
                    <tr>
                        <td style="width:50%;padding:7px 5px;border-left:none;">Freight</td>
                        <td style="border-right:none;"></td>
                    </tr>
                    <tr>
                        <td style="padding:7px 5px;border-left:none;">Docket</td>
                        <td style="border-right:none;"></td>
                    </tr>
                    <tr>
                        <td style="padding:7px 5px;border-left:none;">ODA</td>
                        <td style="border-right:none;"></td>
                    </tr>
                    <tr>
                        <td style="padding:7px 5px;border-left:none;">Fov</td>
                        <td style="border-right:none;"></td>
                    </tr>
                    <tr>
                        <td style="padding:7px 5px;border-left:none;">Total</td>
                        <td style="border-right:none;"></td>
                    </tr>
                    <tr>
                        <td style="padding:7px 5px;border-left:none;">GST Tax</td>
                        <td style="border-right:none;"></td>
                    </tr>
                    <tr>
                        <td style="padding:7px 5px;border-left:none;border-bottom:none;">Grant Total</td>
                        <td style="border-bottom:none;border-right:none;"></td>
                    </tr>
                </table>
            
        </td>
    </tr>
    <tr>
        <td>From : <?=strtoupper($pr['shipper_location'])?></td>
        <td>To : <?=strtoupper($pr['consignee_location'])?></td>
    </tr>
    <tr>
        <td>GST NO : <?=strtoupper($pr['seller_gst'])?></td>
        <td>GST NO : <?=strtoupper($pr['buyer_gst'])?></td>
    </tr>
    <tr>
        <td colspan="2" style="padding:0px;vertical-align:top;">
            <table>
                <tr>
                    <td style="width:20%;border-top:none;border-left:none;">Contain</td>
                    <td style="width:20%;border-top:none;"><?=strtoupper($pr['product_description'])?></td>
                    <td style="text-align:center;font-weight:bold;border-top:none;border-right:none;">Acnowledgment</td>
                </tr>
                <tr>
                    <td style="width:20%;border-left:none;">PCS</td>
                    <td style="width:20%;"><?=$pr['boxes']?></td>
                    <td rowspan="4" style="border-right:none;border-bottom:none;padding-left:30px;">
                        Name
                        
                        <br><br><br>Stamp
                        
                    </td>
                </tr>
                <tr>
                    <td style="width:20%;border-left:none;">Book Type</td>
                    <td style="width:20%;"><?=strtoupper($pr['order_type'])?></td>
                </tr>
                <tr>
                    <td style="width:20%;border-left:none;">Amount</td>
                    <td style="width:20%;"><?=$pr['taxable_value']?></td>
                </tr>
                <tr>
                    <td style="width:20%;border-bottom:none;border-left:none;">Weight</td>
                    <td style="width:20%;border-bottom:none;"><?=$pr['c_weight']?></td>
                </tr>
            </table>
            
        </td>
    </tr>
</table>
<table>
    <tr>
        <td style="width:20%;border-top:none;">Remark</td>
        <td colspan="3" style="border-top:none;">20FT CBT</td>
    </tr>
    <tr>
        <td colspan="2" style="border-bottom:none;font-size:12px;text-align:center;">
            I/We declare that this consignment does not contain personal mail, cash, jewellery, contraband, illegal drugs,
            any prohibited items and commodities which can cause safety hazards while transporting declared value of
            goods is true and accurate.
        </td>
        <td style="width:30%;" rowspan="3">
            Invoice No  : <br>
            Invoice Value  : <br>
            Eway Bill  : 
        </td>
    </tr>
    <tr>
        <td colspan="2" style="border-top:none;font-size:10px;">
            <b>Consignor Signature :</b>
        </td>
    </tr>
    <tr>
        <td colspan="2" style="font-size:12px;text-align:center;">
            <b>T & C: </b>Incase the Consigments value is more than Rs: 1000/- The Venus Cargo recomends to get the same
            insured. the company liability on this shipment is limited to Rs. 100/- or cost of the reconstruction whichever is
            lower. customer are requested to please put right Pincode of Destination for timely delivery. weight taken in
            our company's permises. Actual or Valuemetric weight whichever is higher will be considered as the final
            weight.
        </td>
    </tr>
</table>
</div>
<?php if($t==1) { echo '<hr class="dashed">'; } ?>
<?php } ?>


<?php } ?>
</body>
<style>
    table{
        width:100%;
        border-collapse:collapse;
        font-size:14px;
    }
    td{
        border:1px solid black;
        border-collapse:collapse;
        padding:2px 5px;
    }
    .dashed {border-style: dashed;
    margin-top: 12px;
    margin-bottom: 12px;
   }
    
@page  
{    margin: 5mm 5mm 5mm 5mm;  } 
body  
{  margin: 0px;  } 
</style>
