<?php


session_start();
header("Content-type: text/html; charset=".$_SESSION['encodingmode']);
if($_SESSION['dbName']==""){
header("location:../index.php");
}

print <<< HERE

<HTML>
<HEAD>
<TITLE>Manifest </TITLE>

<style type="text/css">

/*
	body {
    font-size:9.5px;
}			  
	*/			  
@page {
    margin-top: 68px;
   // margin-top: 0px;
    margin-bottom: 0px;
    margin-right: 20px;
    margin-left:15px;
 }
 .classbody{
	 font-size:9px;
	 //color:red;
 }
.spacebeforegrid{
	height:232px;
}
.manifestgrid{
	height:290px;
}
		.classtitles{
			font-size:7px;
		}	 


.grid{
	position:absolute;
	
	 top: 1080px;
	
	//border:solid 1px black;
	width:100%;

	
}		



.classbody2{
	font-size:12;
}	

.classbody3{
	font-family: "Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace;
	font-size:9;
}	
</style>


</HEAD>

<body>
HERE;

include("config.inc.php");



$connection = mysql_connect($config['dbServer'],$config['dbUser'],$config['dbPass'])
		or die("Could not connect to DB");

mysql_select_db($_SESSION['dbName'],$connection) or die("Could not find DB");

if(	$_SESSION['encodingmode'] == 'utf8' || $_SESSION['encodingmode'] == 'utf-8'){
	mysql_query("SET NAMES 'utf8'"); 
	mysql_query('SET CHARACTER SET utf8'); 
	mysql_set_charset('utf8', $connection);
}					
$querysetup= " select DecimalBase, DecimalBase1, DecimalBase2, base1, base2, grid_color1, grid_color2, ".
             " Date_Format(Setup_VatStartDate,'%Y%m%d') As Setup_VatStartDate, ifNull(Setup_VatPercentage,0) As Setup_VatPercentage from setup ";
$resultsetup=mysql_query($querysetup,$connection) or die(mysql_error());
while($rowsetup=mysql_fetch_array($resultsetup)){
	extract($rowsetup);
}

//User Access
$querylog=" select ifNull(login_belongstogrp,0) As FI_BelongsToGrp from ".$_SESSION['dbLabel'].".login where user_account='".$_SESSION['useraccount']."' and Upper(Login_Schema) = Upper('".$_SESSION['dbName']."')  ";
$resultlog=mysql_query($querylog,$connection) or die(mysql_error());
while($rows=mysql_fetch_array($resultlog)){
	extract($rows);
}

	
$now=current_server_time($connection);
$dt=split(" ",$now[0]);
$printdate=split("-",$dt[0]);

	
	
$query_edit="select date_format(manifest_date,'%d-%m-%Y'), Voyage_year, voyage_number, voyage_destination, voyage_BOLnumber,
			BOL_type, BOL_identification,  Shipper1, shipper2, shipper3, shipper4, consignee1, consignee2, consignee3, consignee4,
			Notify1, Notify2, Notify3, Notify4,  Precarriage, PlaceofReceipt, Portofloading, PortofDischarge, Placeofdelivery, 
			BOL_freight, issued, date_format(date,'%d-%m-%Y'), Negotiable_BOL, term_of_carriage, 
			manifest_id ,BOL_pagenumber,Freight_type, tax1_amount,tax2_amount,tax3_amount,tax4_amount,tax5_amount,tax6_amount,
			tax1_desc, tax2_desc, tax3_desc, tax4_desc, tax5_desc, tax6_desc,evidence1, evidence2, evidence3, evidence4, evidence5, evidence6,No_of_tues,currency,
			Offernumber,freetimedays,linear_meters,vessel_id,agent_id,agent1_id,status1,client_code
			from manifest where manifest_auto='".$Manifest_Auto."'";
//echo $query_edit;
	 $resultedit = mysql_query($query_edit, $connection);
	$row=mysql_fetch_row($resultedit);

	
	$manifest_date=$row[0];
	$voyage_year=$row[1];
	$voyage_number=$row[2];
	$voyage_destination=$row[3];
	$bol_number=$row[4];
	$voyage_type=$row[5];
	//$voyage_pagenumber=$row[30];

	$billoflading=$row[6];
	$shipper1=$row[7];
	$shipper2=$row[8];
	$shipper3=$row[9];
	$shipper4=$row[10];
	$consignee1=$row[11];
	$consignee2=$row[12];
	$consignee3=$row[13];
	$consignee4=$row[14];
	$notify1=$row[15];
	$notify2=$row[16];
	$notify3=$row[17];
	$notify4=$row[18];
	$precarriage=$row[19];
	//echo "kkkkkkkkkkkkkkkkkkkkk".$Manifest_Auto;
	$recieptplace=$row[20];
	$portlading=$row[21];
	$portdischarge=trim($row[22]);
	$placedelivery=$row[23];
	$freight=$row[24];
	$issuedat=$row[25];
	$issuedon=$row[26];
	$nonegotiable=$row[27];
	$termcarriage=trim($row[28]);
	$manifest_id=$row[29];
	$voyage_pagenumber=$row[30];
	$freight_type=$row[31];
	$amount1=$row[32];
	$amount2=$row[33];
	$amount3=$row[34];
	$amount4=$row[35];
	$amount5=$row[36];
	$amount6=$row[37];
	//$amount6=floatval($row[37]);
	$desc1=$row[38];
	$desc2=$row[39];
	$desc3=$row[40];
	$desc4=$row[41];
	$desc5=$row[42];
	$desc6=$row[43];
	$evidence1=$row[44];
	$evidence2=$row[45];
	$evidence3=$row[46];
	$evidence4=$row[47];
	$evidence5=$row[48];
	$evidence6=$row[49];
	$nbofteus=$row[50];
	$currency=$row[51];
	$offer_number=$row[52];
	$freetimedays=$row[53];
	$linearmeter=$row[54];
	$vessel_id=$row[55];
	$agent_id=$row[56];
	$carriersign=$row[57];
	$status=$row[58];
	$client_name=$row[59];

	
	
$query="select Agent1,Agent2,Agent3,Agent4 from agent where code='$voyage_destination'";
//echo $query;
$resultedit = mysql_query($query, $connection);
	while($row=mysql_fetch_array($resultedit)){
		$agent1=$row[0];
		$agent2=$row[1];
		$agent3=$row[2];
		$agent4=$row[3];
	}

	echo "<table border =0 width=100% cellspacing=0 cellpadding=0>";
	echo "
			<col width=500px>
			<col width=500px>";
	echo "<tr>
			<td  >
				<table border=0 cellspacing=0 width=100%>
				<col width=90%>
					<tr height=78px><td >
						<table style='width:100%' >
						
							<tr><td><span class='classtitles'>&nbsp;</span></td></tr>
							<tr><td><span class='classbody'>$shipper1&nbsp;</span></span></td></tr>
							<tr><td><span class='classbody'>$shipper2&nbsp;</span></td></tr>
							<tr><td><span class='classbody'>$shipper3&nbsp;</span></td></tr>
							<tr><td><span class='classbody'>$shipper4&nbsp;</span></td></tr>";
							//<tr height=30></tr>
						echo "</table>
					</td></tr>
					<tr height=78px><td >
						<table style='width:100%'>
						<col width=100%>
						<tr><td><span class='classtitles'>&nbsp;</span></td></tr>
							<tr><td><span class='classbody'>$consignee1&nbsp;</span></td></tr>
							<tr><td><span class='classbody'>$consignee2&nbsp;</span></td></tr>
							<tr><td><span class='classbody'>$consignee3&nbsp;</span></td></tr>
							<tr><td><span class='classbody'>$consignee4&nbsp;</span></td></tr>";
							//<tr height=30></tr>
						echo "</table>
					</td></tr>
					<tr height=78px><td >
						<table style='width:100%;' >
						<col width=100%>
						<tr><td><span class='classtitles'>&nbsp;</span></td></tr>
							<tr><td><span class='classbody'>$notify1&nbsp;</span></td></tr>
							<tr><td><span class='classbody'>$notify2&nbsp;</span></td></tr>
							<tr><td><span class='classbody'>$notify3&nbsp;</span></td></tr>
							<tr><td><span class='classbody'>$notify4&nbsp;</span></td></tr>";
							//<tr height=30></tr>
					echo "	</table>
					</td></tr>
					<tr height=78px><td >
						<table style='width:100%'>
						<col width=100%>
						<tr><td><span class='classtitles'>&nbsp;</span></td></tr>
							<tr><td><span class='classbody'>$agent1&nbsp;</span></td></tr>
							<tr><td><span class='classbody'>$agent2&nbsp;</span></td></tr>
							<tr><td><span class='classbody'>$agent3&nbsp;</span></td></tr>
							<tr><td><span class='classbody'>$agent4&nbsp;</span></td></tr>";
							//<tr height=30></tr>
						echo "</table>
					</td></tr>
				</table>
			</td>
			<td  valign=top>
			
			<table border=0 cellspacing=0 width=100%>
			<col width=150><col width=150>
			
					<tr ><td colspan=2 valign=center >
						<table width=100% border=0>
						<col width=30%>
						<col width=70%>
							<tr height=45><td ></td>
							<td><span class='classbody'>$billoflading</span></td>
							</tr>
							
							
							
						</table>
					</td></tr>
					<tr height=125><tr>
					<tr height=20>
					<td align=center><br><span class='classbody'>$vessel_id</span></td>
					<td  align=center><br><span class='classbody'>$voyage_number</span></td>
					</tr>
					</table>
			
			
			</td>
		</tr>";
		echo "<tr height=15px></tr>";
		echo "<tr>
		<td colspan=2>
		<table style='width:100%'   border=0 cellspacing=0>
		<col width=250>
		<col width=200>
		<col width=180>
		<col width=180>
		<col width=175>
		
			<tr>
			<td  align=center><b>&nbsp; </b> <span class='classbody'><br>&nbsp;$precarriage</span></td>
			<td valign=top  align=center><b>&nbsp;</b> <span class='classbody'>&nbsp;$recieptplace</span></td>
			<td valign=top  align=center><b>&nbsp;</b><span class='classbody'> <br>&nbsp;$portlading</span></td>
			<td valign=top  align=center><b>&nbsp;</b> <span class='classbody'><br>&nbsp; $portdischarge</span></td>";
			$query="select Area_name from area where area_code='$placedelivery'";
			//echo $query;
			$resultedit = mysql_query($query, $connection);
			while($row=mysql_fetch_array($resultedit)){$area=$row[0];}
			echo "<td valign=top><b>&nbsp; </b><span class='classbody'>&nbsp;</span></td>
			
			</tr>
			
		</table>
		</td>
		</tr>";
		//echo "<tr height=250></tr>";
		echo "<tr><td colspan=5><div class='spacebeforegrid'>";
		//////////////////////////////////////////////////////////////////////////////////////////////
		echo "<table width=100% border=0>
		<tr height=10px></tr>
		";
		
	
$manifeststamp = " SELECT stampdesc1, stampdesc2, stampdesc3, stampdesc4, stampdesc5, stampdesc6, stampdesc7, stampdesc8, stampdesc9, stampdesc10, stampdesc11,
					stampdesc12, stampdesc13, stampdesc14, stampdesc15, stampdesc16, stampdesc17, stampdesc18, stampdesc19, stampdesc20, stampdesc21,
					stampdesc22 FROM MANIFESTSTAMP WHERE manifest_manifestauto='$Manifest_Auto'";
//echo $manifeststamp;
$j=1;
 $queryres=mysql_query($manifeststamp,$connection) or die(mysql_error());
if($row=mysql_fetch_array($queryres)){
	$stampdesc1=$row[0];
	$stampdesc2=$row[1];
	$stampdesc3=$row[2];
	$stampdesc4=$row[3];
	$stampdesc5=$row[4];
	$stampdesc6=$row[5];
	$stampdesc7=$row[6];
	$stampdesc8=$row[7];
	$stampdesc9=$row[8];
	$stampdesc10=$row[9];
	$stampdesc11=$row[10];
	$stampdesc12=$row[11];
	$stampdesc13=$row[12];
	$stampdesc14=$row[13];
	$stampdesc15=$row[14];
	$stampdesc16=$row[15];
	$stampdesc17=$row[16];
	$stampdesc18=$row[17];
	$stampdesc19=$row[18];
	$stampdesc20=$row[19];
	$stampdesc21=$row[20];
	$stampdesc22=$row[21];
	
	


echo "<tr>
<td colspan=3 align=left><span class='classbody3'>$stampdesc1</span></td>
<td colspan=3 align=left><span class='classbody3'>$stampdesc2</span></td>
</tr>";
echo "<tr>
<td colspan=3 align=left><span class='classbody3'>$stampdesc3</span></td>
<td colspan=3 align=left><span class='classbody3'>$stampdesc4</span></td>
</tr>";
echo "<tr>
<td colspan=3 align=left><span class='classbody3'>$stampdesc5</span></td>
<td colspan=3 align=left><span class='classbody3'>$stampdesc6</span></td>
</tr>";
echo "<tr>
<td colspan=3 align=left><span class='classbody3'>$stampdesc7</span></td>
<td colspan=3 align=left><span class='classbody3'>$stampdesc8</span></td>
</tr>";
echo "<tr>
<td colspan=3 align=left><span class='classbody3'>$stampdesc9</span></td>
<td colspan=3 align=left><span class='classbody3'>$stampdesc10</span></td>
</tr>";
echo "<tr>
<td colspan=3 align=left><span class='classbody3'>$stampdesc11</span></td>
<td colspan=3 align=left><span class='classbody3'>$stampdesc12</span></td>
</tr>";
echo "<tr>
<td colspan=3 align=left><span class='classbody3'>$stampdesc13</span></td>
<td colspan=3 align=left><span class='classbody3'>$stampdesc14</span></td>
</tr>";
echo "<tr>
<td colspan=3 align=left><span class='classbody3'>$stampdesc15</span></td>
<td colspan=3 align=left><span class='classbody3'>$stampdesc16</span></td>
</tr>";
echo "<tr>
<td colspan=3 align=left><span class='classbody3'>$stampdesc17</span></td>
<td colspan=3 align=left><span class='classbody3'>$stampdesc18</span></td>
</tr>";
echo "<tr>
<td colspan=3 align=left><span class='classbody3'>$stampdesc19</span></td>
<td colspan=3 align=left><span class='classbody3'>$stampdesc20</span></td>
</tr>";
echo "<tr>
<td colspan=3 align=left><span class='classbody3'>$stampdesc21</span></td>
<td colspan=3 align=left><span class='classbody3'>$stampdesc22</span></td>
</tr>";

}


echo "</table>";
////////////////////////////////////////////////////////////////////////////////
		
		
		
		echo "</div></td></tr>";
		echo "<tr><td colspan=2>
		<div class='manifestgrid'>
		<table style='width:100%' cellpadding=0 cellspacing=0 border=0>
		<col width='120'>
		<col width='140'>
		<col width='120'>
		<col width='340'>
		<col width='150'>
		<col width='100'>";
		/*
			<tr><th style='border-top:solid 0px black;border-bottom:solid 0px black;border-right:solid 0px black;'>
				<span class='classbody'>Total N of Container </span>
			</th>
			<th style='border-top:solid 0px black;border-bottom:solid 0px black;border-right:solid 0px black;'><span class='classbody'>Marks And Nos Of Goods </span></th>
			<th style='border-top:solid 0px black;border-bottom:solid 0px black;border-right:solid 0px black;'><span class='classbody'>Packages </span></th>
			<th style='border-top:solid 0px black;border-bottom:solid 0px black;border-right:solid 0px black;'><span class='classbody'>Gross Weight </span></th>
			<th style='border-top:solid 0px black;border-bottom:solid 0px black;'><span class='classbody'>Measurement</span></th>
			
			
			</tr>*/
			echo "<tr height=20></tr>";
			echo"<tr height=20 >
			<td  style='border-right:solid 0px black;'></td>
			<td  style='border-right:solid 0px black;'></td>
			<td  style='border-right:solid 0px black;'></td>
			<td  style='border-right:solid 0px black;'></td>
			<td  style='border-right:solid 0px black;'></td>
			</tr>";
			
	$query=	"select Container, Marks, Packages, 
			Container_Weight, CubeMeters,manifestdt.auto,
			descriptiongood,
			manifestdt.detailsequence,ctrflag
			from manifestdt
			inner join manifestdesc on 
			#manifestdt.Voyage_year=manifestdesc.Voyage_year
			#and manifestdt. voyage_number=manifestdesc.voyage_number
			#and  manifestdt.voyage_destination=manifestdesc.voyage_destination
			#and  manifestdt.voyage_BOLnumber=manifestdesc.voyage_BOLnumber
			#and  manifestdt.BOL_type=manifestdesc.BOL_type
			#and  manifestdt.BOL_pagenumber=manifestdesc.BOL_pagenumber
			manifestdt.manifest_manifestauto=manifestdesc.manifest_manifestauto
			and
			manifestdesc.detailsequence=manifestdt.detailsequence
			where 
	
			manifestdt.manifest_manifestauto='$Manifest_Auto'";
			//echo $query;
			
			
			
			
			$querycount = "select count(ctrflag)
			from manifestdt
			
			where manifest_manifestauto='$Manifest_Auto'
			
			and ctrflag!='*'";
			
			//echo $querycount;
$countres=mysql_query($querycount,$connection);
				if($rows=mysql_fetch_array($countres)){
					$count=$rows[0];
				}
			
		//	echo $count."dfg";
			if($count<=1){
			$resultdt=mysql_query($query,$connection);
				while($row=mysql_fetch_array($resultdt)){
					echo "<tr height=5></tr>";
			
			echo "<tr>
			
			<td align=center style='border-right:solid 0px black;'><span class='classbody3'>$row[0] </span></td>
			<td align=center style='border-right:solid 0px black;'><span class='classbody3'>$row[1] </span></td>
			<td align style='border-right:solid 0px black;'><span class='classbody3'>&nbsp;&nbsp; $row[2] </span></td>
			<td align style='border-right:solid 0px black;'><span class='classbody3'> $row[6] </span></td>
			<td align=left style='border-right:solid 0px black;'><span class='classbody3'>";
			if ($row[8]!='*'){ echo "$row[3]&nbsp; KOS </span></td>";
			}
			//else 
				//echo "GW &nbsp;$row[3]&nbsp; KOS </span></td>";
			echo "<td align=center style='border-right:solid 0px black;'><span class='classbody3'>";
			if ($row[8]!='*'){ echo "$row[4]</span></td>";}
			echo " </span></td>
			
			</tr>";
				}
			}
			else echo "<tr><td colspan=6 align=center><span class='classbody3'>AS PER ATTACHED LIST</span></td></tr>";
			//echo "<tr height=30></tr>
		echo "</table>
		</div>
		</td></tr>";
	//	echo "<tr height=150></tr>";
		
		echo "<tr><td colspan=2>
					<table  border =0 cellpadding=0 cellspacing=0 width=100%>
					<col width=35%>
					<col width=65%>
					<tr height=3px></tr>
						<tr height=28>
						<td valign=bottom style='border-bottom:solid 0px black; border-right:solid 0px black;'><span class='classbody'> <br>&nbsp;&nbsp; $freight</span></td>
						<td style='border-bottom:solid 0px black; '> </td>
			</tr>";
			
				$withprice=$_GET['withprice'];
		echo "<tr><td colspan=2 valign=bottom >
					<table  border=0 style='width:100%'  cellspacing=0>
					<col width=35%>
					<col width=65%>
						<tr>
						<td valign='center' style=' border-right:solid 0px black;'>";
						if ($withprice==1){
					echo "	<table>
			<col width=150>
			<col width=150>
			<col width=150>
			<tr height=2px></tr>
			<tr>
					<td> <span class='classbody'>$desc1</span></td>
					<td> <span class='classbody'>$currency</span></td>
					<td><span class='classbody'>$amount1</span><td>
			</tr>
					<tr>
					<td> <span class='classbody'>$desc2</span></td>
					<td> <span class='classbody'>$currency</span></td>
					<td><span class='classbody'>$amount2</span><td>
			</tr>
					<tr>
					<td> <span class='classbody'>$desc3</span></td>
					<td> <span class='classbody'>$currency</span></td>
					<td><span class='classbody'>$amount3</span><td>
		</tr>
					<tr>
					<td> <span class='classbody'>$desc4</span></td>
					<td> <span class='classbody'>$currency</span></td>
					<td><span class='classbody'>$amount4</span><td>
		</tr>
					<tr>
					<td> <span class='classbody'>$desc5</span></td>
					<td> <span class='classbody'>$currency</span></td>
					<td><span class='classbody'>$amount5</span><td>
		</tr>
					<tr>
					<td><span class='classbody'> $desc6</span></td>
					<td><span class='classbody'> $currency</span></td>
					<td><span class='classbody'>$amount6</span><td>
		</tr>
		
					
			</table>";
						}
						
						
						
						echo "</td>
						<td >

<table border=0  cellspacing=0 width=100%>
		<col width=50%>
			<col width=50%>
			
		<tr height=30><td style='border-bottom:solid 0px black; ' align='center' valign=bottom ><span class='classbody'>
		<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b> &nbsp;&nbsp; $issuedat</span></td> 
		<td style='border-bottom:solid 0px black; ' align=center valign=bottom><span class='classbody' >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;$issuedon</span></td>
		</tr>
		<tr height=45><td style='border-bottom:solid 0px black; ' align='center'  valign=bottom><span class='classbody'>
		 &nbsp;&nbsp;<br>&nbsp;&nbsp; $nonegotiable</span></td>
		<td style='border-bottom:solid 0px black; ' align='center' valign=bottom ><span class='classbody'> &nbsp;&nbsp;<br>&nbsp;&nbsp;$termcarriage</span></td>
		</tr>
		<tr height=28><td colspan=2  align='center' valign=bottom >
		<span class='classbody'> &nbsp;&nbsp;<br><br>&nbsp;&nbsp; $carriersign</span></td>
		
		</tr>
		
		</table>


						</td>
			</tr>";
	
		echo "</table>
		
		
		</td></tr>";
	 
echo "</table>";
echo "</table><br>";
		  
		if ($count>=2){
		echo "<br>";
		echo "<div class='grid'>";
		echo "<table style='width:100%' cellpadding=0 cellspacing=0>
		<col width='150'>
		<col width='140'>
		<col width='120'>
		<col width='340'>
		<col width='150'>
		<col width='100'>";
	
			
	$query=	"select Container, Marks, Packages, 
			Container_Weight, CubeMeters,manifestdt.auto,descriptiongood,manifestdt.detailsequence,ctrflag
			from manifestdt
			inner join manifestdesc on 
			#manifestdt.Voyage_year=manifestdesc.Voyage_year
			#and manifestdt. voyage_number=manifestdesc.voyage_number
			#and  manifestdt.voyage_destination=manifestdesc.voyage_destination
			#and  manifestdt.voyage_BOLnumber=manifestdesc.voyage_BOLnumber
			#and  manifestdt.BOL_type=manifestdesc.BOL_type
			#and  manifestdt.BOL_pagenumber=manifestdesc.BOL_pagenumber
			manifestdt.manifest_manifestauto=manifestdesc.manifest_manifestauto
			and
			manifestdesc.detailsequence=manifestdt.detailsequence
			where 
	
			manifestdt.manifest_manifestauto='$Manifest_Auto'
			group by manifestdt.auto
			
			";
			//echo $query;
			
			
			
			
			$querys="select 
			
			Voyage_year, voyage_number, voyage_destination, voyage_BOLnumber
			, BOL_pagenumber, BOL_identification,BOL_type
			
			from manifest
			where 
			Voyage_year='$voyage_year' and voyage_number='$voyage_number' and 
			voyage_destination='$voyage_destination'
			and voyage_BOLnumber='$bol_number' 
			and BOL_type='$voyage_type' and BOL_pagenumber='$voyage_pagenumber'
			";
			//echo $querys;
			$resultdt=mysql_query($querys,$connection);
			while($row=mysql_fetch_array($resultdt)){
				$year=$row[0];
				$vnumber=$row[1];
				$vdes=$row[2];
				$boln=$row[3];
				$vpagen=$row[4];
				$BOL_identification=$row[5];
				$voyagetype=$row[6];
				
			}
			//echo $querycount;
	echo "<tr><td colspan=6>
	<table border=0 width=100%>
	<col width=120px>
	<col width=50px>
	<col width=50px>
	<col width=80px>
	
	<col width=110>
	<col width=90>
	<col width=130>

	
	<tr><td>
		<span class='classbody'>Attached list Of: </span></td>
		<td><span class='classbody'>&nbsp;&nbsp; &nbsp;&nbsp; $year</span></td> <td><span class='classbody'>&nbsp;&nbsp;&nbsp;&nbsp; $vnumber</span> </td>
		
		<td><span class='classbody'>&nbsp;&nbsp;&nbsp;&nbsp;/ $vdes</span> </td>
		<td><span class='classbody'>&nbsp;&nbsp; B/L Ref. N°: </span></td><td>
		<span class='classbody'>$voyagetype&nbsp;&nbsp;$boln/
		 $vpagen</span> </td><td><span class='classbody'>&nbsp;&nbsp; &nbsp;&nbsp; Bill of Lading:</span></td>
		 <td> <span class='classbody'>$BOL_identification </span>
		</td>
		</tr></table></td>
		</tr>";
		
		echo "<tr height=40></tr>";
			
		echo "	<tr><th style='border-top:solid 0px black;border-bottom:solid 0px black;border-right:solid 0px black;'>
				<span class='classbody2'>Container/Packages </span>
			</th>
			<th style='border-top:solid 0px black;border-bottom:solid 0px black;border-right:solid 0px black;'><span class='classbody'>Marks And Nos Of Goods </span></th>
			<th style='border-top:solid 0px black;border-bottom:solid 0px black;border-right:solid 0px black;'><span class='classbody'>&nbsp; </span></th>
			<th style='border-top:solid 0px black;border-bottom:solid 0px black;border-right:solid 0px black;' align=left colspan=1><span class='classbody'>description of Goods </span></th>
			<th style='border-top:solid 0px black;border-bottom:solid 0px black;border-right:solid 0px black;'><span class='classbody'>Gross Weight </span></th>
			<th style='border-top:solid 0px black;border-bottom:solid 0px black;'><span class='classbody'>Measurement</span></th>
			
			
			</tr>";
			echo "<tr height=20></tr>";
			
			$resultdt=mysql_query($query,$connection);
				while($row=mysql_fetch_array($resultdt)){
			if ($row[8]!='*'){echo "<tr height=10></tr>";}
			
			if ($row[3]==0.00)$gwei='';
			else $gwei=$row[3];
			if ($row[4]==0.00)$measu='';
			else $measu=$row[4];
			echo "<tr>
			
			<td align=center style='border-right:solid 0px black;'><span class='classbody'>$row[0] </span></td>
			<td align=center style='border-right:solid 0px black;'><span class='classbody'>$row[1] </span></td>
			<td align ><span class='classbody'>&nbsp;&nbsp; $row[2] </span></td>
			<td align style='border-right:solid 0px black;'><span class='classbody'> $row[6] </span></td>
			<td align=center style='border-right:solid 0px black;'><span class='classbody'> $gwei </span></td>
			<td align=center style='border-right:solid 0px black;'><span class='classbody'>$measu </span></td>
			
			</tr>";
			 
				}
			
			//echo "<tr height=30></tr>
		echo "</table></div>";
	}


	

function current_server_time($connection){

  $string="Select date_format(NOW(),'%Y-%m-%d %h:%i %p') ";
  $result=mysql_query($string,$connection) or die(mysql_error());
  $now=mysql_fetch_row($result);

  return $now;
}


print <<< HERE

<script language=javascript>
if (typeof(window.print) != 'undefined')
{
    window.print();
}
</script>
</BODY>
</HTML>
HERE;
?>
	


				 
				  
				  