<?php

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


include("config.inc.php");


$connection = mysql_connect($config['dbServer'],$config['dbUser'],$config['dbPass'],true,65536) 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);
}

function drawContainerTable ($olId, $containerNo, $containerType, $connection){
	
		echo "<table width='100%' cellpadding=0 cellspacing=2 ><col width=5%><col width=15%><col width=65%><col width=15%>";
		echo "<tr height='20px' bgcolor='#a9a9a9'><td></td><td></td><td align='center'><span class='style1'>Description</span></td><td></td></tr>";
		$query = "select LC_Id, LC_Description from Logistic_ContainerNbr where LC_ContainerType = '$containerType' and LO_Id='$olId' order by LC_Id ;";
		$res = mysql_query($query, $connection);
		$nmr = mysql_num_rows($res);
		
		//$containerNo = $containerNo - $nmr;
		$i=1;
		while($row = mysql_fetch_array($res)){
			echo "<tr height='20px' bgcolor=''>
					<td>$i</td>
					<td align='center'><img src='img/c_delete.png' onclick=\"deleteContainer('$row[0]','$i','$containerType');\" style='cursor: pointer;width: 11px;'></td>
					<td align='center'><input type='text' name='lcRemark$containerType-$i' id='lcRemark$containerType-$i' value='".htmlentities($row[1],ENT_QUOTES)."' style='font-size:12px; width:90%; height:20px;' maxlength=200></td>
					<td align='center'><img src='img/confirm-1.png' onclick=\"saveContainer('$row[0]','$i','$containerType');\" style='cursor: pointer;'></td>
				</tr>";
			$i++;
		}
		
		for ($i=$nmr+1;$i<=$containerNo;$i++)
			echo "<tr height='20px' bgcolor=''>
					<td align='center'>$i</td>
					<td ></td>
					<td align='center'><input type='text' name='lcRemark$containerType-$i' id='lcRemark$containerType-$i' value='' style='font-size:12px; width:90%; height:20px;' maxlength=200></td>
					<td align='center'><img src='img/confirm-1.png' onclick=\"saveContainer('','$i','$containerType');\" style='cursor: pointer;'></td>
				</tr>";
		
		
		
		echo "</table>";
	
}

function drawRemarkTable ($olId, $connection){
	
	$lrtime = date('H:i');
	echo "<table width='100%' cellpadding=0 cellspacing=2 ><col width=5%><col width=15%><col width=23%><col width=42%><col width=5%>";
	echo "<tr height='20px' bgcolor='#a9a9a9'><td></td><td><span class='style1'>Type</span></td><td><span class='style1'>Date</span></td><td><span class='style1'>Remark</span></td><td></td></tr>";
	
	$i = 0;
	echo "<tr><td></td>
				<td><select name='lrType$i' id='lrType$i'>
					<option value='BOTH' ".($row[1]=='BOTH'?'selected':'').">Both</option>
					<option value='CLIENT' ".($row[1]=='CLIENT'?'selected':'').">Client View</option>
					<option value='OPERATION' ".($row[1]=='OPERATION'?'selected':'').">Operation View</option>
				</select></td>
				<td><input type='date' name='lrDate$i' id='lrDate$i' value='' style='font-size:12px; width:50%; height:20px;' >
					<input type='time' name='lrtime$i' id='lrtime$i' value='$lrtime' style='font-size:12px; width:40%; height:20px;' >
				</td>
				<td><input type='text' name='lrRemark$i' id='lrRemark$i' value='' style='font-size:12px; width:95%; height:20px;' maxlength=200></td>
				<td align='center'><img src='img/confirm-1.png' onclick=\"saveRemark('$row[0]','$i');\" style='cursor: pointer;'> </td>
			</tr>";
	$i++;		
	$queryRemark = "select LR_id, LR_Type, LR_Remark, date_format(LR_RemarkDate,'%Y-%m-%d'), date_format(LR_RemarkDate,'%H:%i') from Logistic_Remark where LO_id = $olId order by LR_RemarkDate";
	$resRemark = mysql_query($queryRemark, $connection);
	while ($row = mysql_fetch_array($resRemark)){
		
		echo "<tr><td align='center'><img src='img/c_delete.png' onclick=\"deleteRemark('$row[0]','$i');\" style='cursor: pointer;width: 11px;'> </td>
				<td><select name='lrType$i' id='lrType$i'>
					<option value='BOTH' ".($row[1]=='BOTH'?'selected':'').">Both</option>
					<option value='CLIENT' ".($row[1]=='CLIENT'?'selected':'').">Client View</option>
					<option value='OPERATION' ".($row[1]=='OPERATION'?'selected':'').">Operation View</option>
				</select></td>
				<td><input type='date' name='lrDate$i' id='lrDate$i' value='".htmlentities($row[3],ENT_QUOTES)."' style='font-size:12px; width:50%; height:20px;' >
					<input type='time' name='lrtime$i' id='lrtime$i' value='".htmlentities($row[4],ENT_QUOTES)."' style='font-size:12px; width:40%; height:20px;' >
				</td>
				<td><input type='text' name='lrRemark$i' id='lrRemark$i' value='".htmlentities($row[2],ENT_QUOTES)."' style='font-size:12px; width:95%; height:20px;' maxlength=200></td>
				<td align='center'><img src='img/confirm-1.png' onclick=\"saveRemark('$row[0]','$i');\" style='cursor: pointer;'> </td>
			</tr>";
		$i++;	
	}
	
	echo "</table>";
}

// Service Table
function drawService($connection){
	echo "<table cellpadding=0 cellspacing=2 width=100% class='subtable'><col width=10%><col width=30%><col width=35%><col width=15%><col width=10%>";
	echo "<tr height='20px' bgcolor='#a9a9a9'>
			<td></td>
			<td><span class='style1'>Code</span></td>
			<td><span class='style1'>Description</span></td>
			<td><span class='style1'>Sequence</span></td>
			<td></td>
		 </tr>";	
	$i=0;
	echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td></td>
			<td><input type='text' name='serviceCode$i' id='serviceCode$i' value='' ></td>
			<td><input type='text' name='serviceDesc$i' id='serviceDesc$i' value='' ></td>
			<td><input type='text' name='serviceSeq$i' id='serviceSeq$i' value='' ></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('','$i','service');\" style='cursor: pointer;'></td>
		 </tr>";
	
		
	$query = "select service_id, service_code, service_description, service_seqId from Logistic_Services order by service_code ";		
	$result = mysql_query($query, $connection);
	while ($row = mysql_fetch_array($result)){
		
		$i++;
		
		echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td align='center'><img src='img/c_delete.png' onclick=\"deleteRow('$row[0]','$i','service');\" style='cursor: pointer;width: 11px;'></td>
			<td><input type='text' name='serviceCode$i' id='serviceCode$i' value='$row[1]' ></td>
			<td><input type='text' name='serviceDesc$i' id='serviceDesc$i' value='$row[2]' ></td>
			<td><input type='text' name='serviceSeq$i' id='serviceSeq$i' value='$row[3]'></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('$row[0]','$i','service');\" style='cursor: pointer;'> </td>
		 </tr>";
		
	}
	echo "</table>";
}

// Dealer Table
function drawDealer($connection){
	echo "<table cellpadding=0 cellspacing=2 width=100% class='subtable'><col width=10%><col width=30%><col width=50%><col width=10%>";
	echo "<tr height='20px' bgcolor='#a9a9a9'>
			<td></td>
			<td><span class='style1'>Code</span></td>
			<td><span class='style1'>Description</span></td>
			<td></td>
		 </tr>";	
	$i=0;
	echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td></td>
			<td><input type='text' name='dealerCode$i' id='dealerCode$i' value='' ></td>
			<td><input type='text' name='dealerDesc$i' id='dealerDesc$i' value='' ></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('','$i','dealer');\" style='cursor: pointer;'></td>
		 </tr>";
	
		
	$query = "select Dealer_Id, Dealer_Code, Dealer_Description from Logistic_Dealer order by Dealer_Code ";		
	$result = mysql_query($query, $connection);
	while ($row = mysql_fetch_array($result)){
		
		$i++;
		
		echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td align='center'><img src='img/c_delete.png' onclick=\"deleteRow('$row[0]','$i','dealer');\" style='cursor: pointer;width: 11px;'></td>
			<td><input type='text' name='dealerCode$i' id='dealerCode$i' value='$row[1]' ></td>
			<td><input type='text' name='dealerDesc$i' id='dealerDesc$i' value='$row[2]' ></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('$row[0]','$i','dealer');\" style='cursor: pointer;'> </td>
		 </tr>";
		
	}
	echo "</table>";
}

// ShipCo Table
function drawShipCo($connection){
	echo "<table cellpadding=0 cellspacing=2 width=100% class='subtable'><col width=10%><col width=30%><col width=50%><col width=10%>";
	echo "<tr height='20px' bgcolor='#a9a9a9'>
			<td></td>
			<td><span class='style1'>Code</span></td>
			<td><span class='style1'>Description</span></td>
			<td></td>
		 </tr>";	
	$i=0;
	echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td></td>
			<td><input type='text' name='shipCode$i' id='shipCode$i' value='' ></td>
			<td><input type='text' name='shipDesc$i' id='shipDesc$i' value='' ></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('','$i','ship');\" style='cursor: pointer;'></td>
		 </tr>";
	
		
	$query = "select Ship_Id, Ship_Code, Ship_Description from Logistic_ShipCo order by Ship_Code ";		
	$result = mysql_query($query, $connection);
	while ($row = mysql_fetch_array($result)){
		
		$i++;
		
		echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td align='center'><img src='img/c_delete.png' onclick=\"deleteRow('$row[0]','$i','ship');\" style='cursor: pointer;width: 11px;'></td>
			<td><input type='text' name='shipCode$i' id='shipCode$i' value='$row[1]' ></td>
			<td><input type='text' name='shipDesc$i' id='shipDesc$i' value='$row[2]' ></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('$row[0]','$i','ship');\" style='cursor: pointer;'> </td>
		 </tr>";
		
	}
	echo "</table>";
}

// Team Table
function drawTeam($connection){
	echo "<table cellpadding=0 cellspacing=2 width=100% class='subtable'><col width=10%><col width=30%><col width=50%><col width=10%>";
	echo "<tr height='20px' bgcolor='#a9a9a9'>
			<td></td>
			<td><span class='style1'>Code</span></td>
			<td><span class='style1'>Description</span></td>
			<td></td>
		 </tr>";	
	$i=0;
	echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td></td>
			<td><input type='text' name='teamCode$i' id='teamCode$i' value='' ></td>
			<td><input type='text' name='teamDesc$i' id='teamDesc$i' value='' ></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('','$i','team');\" style='cursor: pointer;'></td>
		 </tr>";
	
		
	$query = "select Team_Id, Team_Code, Team_Description from Logistic_Team order by Team_Code ";		
	$result = mysql_query($query, $connection);
	while ($row = mysql_fetch_array($result)){
		
		$i++;
		
		echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td align='center'><img src='img/c_delete.png' onclick=\"deleteRow('$row[0]','$i','team');\" style='cursor: pointer;width: 11px;'></td>
			<td><input type='text' name='teamCode$i' id='teamCode$i' value='$row[1]' ></td>
			<td><input type='text' name='teamDesc$i' id='teamDesc$i' value='$row[2]' ></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('$row[0]','$i','team');\" style='cursor: pointer;'> </td>
		 </tr>";
		
	}
	echo "</table>";
}


// Terminal Table
function drawTerminal($connection){
	echo "<table cellpadding=0 cellspacing=2 width=100% class='subtable'><col width=10%><col width=30%><col width=50%><col width=10%>";
	echo "<tr height='20px' bgcolor='#a9a9a9'>
			<td></td>
			<td><span class='style1'>Code</span></td>
			<td><span class='style1'>Description</span></td>
			<td></td>
		 </tr>";	
	$i=0;
	echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td></td>
			<td><input type='text' name='terminalCode$i' id='terminalCode$i' value='' ></td>
			<td><input type='text' name='terminalDesc$i' id='terminalDesc$i' value='' ></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('','$i','terminal');\" style='cursor: pointer;'></td>
		 </tr>";
	
		
	$query = "select Terminal_Id, Terminal_Code, Terminal_Description from Logistic_Terminal order by Terminal_Code ";		
	$result = mysql_query($query, $connection);
	while ($row = mysql_fetch_array($result)){
		
		$i++;
		
		echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td align='center'><img src='img/c_delete.png' onclick=\"deleteRow('$row[0]','$i','terminal');\" style='cursor: pointer;width: 11px;'></td>
			<td><input type='text' name='terminalCode$i' id='terminalCode$i' value='$row[1]' ></td>
			<td><input type='text' name='terminalDesc$i' id='terminalDesc$i' value='$row[2]' ></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('$row[0]','$i','terminal');\" style='cursor: pointer;'> </td>
		 </tr>";
		
	}
	echo "</table>";
}

// Destination Table
function drawDestination($connection){
	echo "<table cellpadding=0 cellspacing=2 width=100% class='subtable'><col width=10%><col width=30%><col width=50%><col width=10%>";
	echo "<tr height='20px' bgcolor='#a9a9a9'>
			<td></td>
			<td><span class='style1'>Code</span></td>
			<td><span class='style1'>Description</span></td>
			<td></td>
		 </tr>";	
	$i=0;
	echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td></td>
			<td><input type='text' name='destinationCode$i' id='destinationCode$i' value='' maxlength='50'></td>
			<td><input type='text' name='destinationDesc$i' id='destinationDesc$i' value='' ></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('','$i','destination');\" style='cursor: pointer;'></td>
		 </tr>";
	
		
	$query = "select Destination_Id, Destination_Code, Destination_Description from Logistic_Destination order by Destination_Code ";		
	$result = mysql_query($query, $connection);
	while ($row = mysql_fetch_array($result)){
		
		$i++;
		
		echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td align='center'><img src='img/c_delete.png' onclick=\"deleteRow('$row[0]','$i','destination');\" style='cursor: pointer;width: 11px;'></td>
			<td><input type='text' name='destinationCode$i' id='destinationCode$i' value='$row[1]' maxlength='50'></td>
			<td><input type='text' name='destinationDesc$i' id='destinationDesc$i' value='$row[2]' ></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('$row[0]','$i','destination');\" style='cursor: pointer;'> </td>
		 </tr>";
		
	}
	echo "</table>";
}

// Transporter Table
function drawTransporter($connection){
	echo "<table cellpadding=0 cellspacing=2 width=100% class='subtable'><col width=10%><col width=30%><col width=50%><col width=10%>";
	echo "<tr height='20px' bgcolor='#a9a9a9'>
			<td></td>
			<td><span class='style1'>Code</span></td>
			<td><span class='style1'>Description</span></td>
			<td></td>
		 </tr>";	
	$i=0;
	echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td></td>
			<td><input type='text' name='transporterCode$i' id='transporterCode$i' value='' maxlength='50'></td>
			<td><input type='text' name='transporterDesc$i' id='transporterDesc$i' value='' ></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('','$i','transporter');\" style='cursor: pointer;'></td>
		 </tr>";
	
		
	$query = "select Transporter_Id, Transporter_Code, Transporter_Description from Logistic_Transporter order by Transporter_Code ";		
	$result = mysql_query($query, $connection);
	while ($row = mysql_fetch_array($result)){
		
		$i++;
		
		echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td align='center'><img src='img/c_delete.png' onclick=\"deleteRow('$row[0]','$i','transporter');\" style='cursor: pointer;width: 11px;'></td>
			<td><input type='text' name='transporterCode$i' id='transporterCode$i' value='$row[1]' maxlength='50'></td>
			<td><input type='text' name='transporterDesc$i' id='transporterDesc$i' value='$row[2]' ></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('$row[0]','$i','transporter');\" style='cursor: pointer;'> </td>
		 </tr>";
		
	}
	echo "</table>";
}

// PickUp Table
function drawPickUp($connection){
	echo "<table cellpadding=0 cellspacing=2 width=100% class='subtable'><col width=10%><col width=30%><col width=50%><col width=10%>";
	echo "<tr height='20px' bgcolor='#a9a9a9'>
			<td></td>
			<td><span class='style1'>Code</span></td>
			<td><span class='style1'>Description</span></td>
			<td></td>
		 </tr>";	
	$i=0;
	echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td></td>
			<td><input type='text' name='pickupCode$i' id='pickupCode$i' value='' maxlength='50'></td>
			<td><input type='text' name='pickupDesc$i' id='pickupDesc$i' value='' ></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('','$i','pickup');\" style='cursor: pointer;'></td>
		 </tr>";
	
		
	$query = "select PickUp_Id, PickUp_Code, PickUp_Description from Logistic_PickUp order by PickUp_Code ";		
	$result = mysql_query($query, $connection);
	while ($row = mysql_fetch_array($result)){
		
		$i++;
		
		echo "<tr height='18px' bgcolor='#dcdcdc'>
			<td align='center'><img src='img/c_delete.png' onclick=\"deleteRow('$row[0]','$i','pickup');\" style='cursor: pointer;width: 11px;'></td>
			<td><input type='text' name='pickupCode$i' id='pickupCode$i' value='$row[1]' maxlength='50'></td>
			<td><input type='text' name='pickupDesc$i' id='pickupDesc$i' value='$row[2]' ></td>
			<td align='center'><img src='img/confirm-1.png' onclick=\"saveRow('$row[0]','$i','pickup');\" style='cursor: pointer;'> </td>
		 </tr>";
		
	}
	echo "</table>";
}

function drawTransporterDt($containerType, $tlId, $connection) {
	echo "<table cellpadding=0 cellspacing=2 class='subtable' width=3000px>";
	echo "<tr height='30px' bgcolor='#a9a9a9'>
			<td width='30px'></td>
			<td width='30px'></td>
			<td width='120px'><span class='style1'>Container No.</span></td>
			<td width='100px'><span class='style1'>Container Size</span></td>
			<td width='100px'><span class='style1'>Truck No.</span></td>
			<td width='120px'><span class='style1'>Transporter</span></td>
			<td width='120px'><span class='style1'>Pick up Point</span></td>
			<td width='120px'><span class='style1'>Status</span></td>
			<td width='250px'><span class='style1'>Time Date Out of Port</span></td>
			<td width='250px'><span class='style1'>Arrival At Client</span></td>
			<td width='250px'><span class='style1'>Date Offload</span></td>
			<td width='250px'><span class='style1'>Date Dropped Empty</span></td>
			<td width='250px'><span class='style1'>Date Time TDO</span></td>
			<td width='120px'><span class='style1'>Days to Reach Client</span></td>
			<td width='120px'><span class='style1'>Days to Offload at Client</span></td>
			<td width='120px'><span class='style1'>Days to Drop Empty</span></td>
			<td width='120px'><span class='style1'>Driver Name</span></td>
			<td width='120px'><span class='style1'>Driver Phone</span></td>
			<td width='250px'><span class='style1'>Container Card/Waybill Returned</span></td>
			<td width='30px'></td>	
		</tr>";
	
	$i=1;
	$query = "select LTdt_id, LTdt_ContainerNo as ContainerNo, LTdt_ContainerSize as ContainerSize, LTdt_TruckNo as TruckNo, LTdt_TransporterId as TransporterId, 
			transporter_code, LTdt_PickUpPointId as PickUpPointId, pickup_code, LTdt_Status, date_format(LTdt_OutofPortDate,'%Y-%m-%d') as OutofPortDate,
			date_format(LTdt_OutofPortDate,'%H:%i') as OutofPortTime,
			date_format(LTdt_ArrivalatClientDate,'%Y-%m-%d') as ArrivalatClientDate, date_format(LTdt_ArrivalatClientDate,'%H:%i') as ArrivalatClientTime, 
			date_format(LTdt_OffLoadDate,'%Y-%m-%d') as OffLoadDate, date_format(LTdt_OffLoadDate,'%H:%i') as OffLoadTime,
			date_format(LTdt_DroppedEmptyDate,'%Y-%m-%d') as DroppedEmptyDate, date_format(LTdt_DroppedEmptyDate,'%H:%i') as DroppedEmptyTime,
			date_format(LTdt_TdoDate,'%Y-%m-%d') as TdoDate, date_format(LTdt_TdoDate,'%H:%i') as TdoTime,
			LTdt_DaysToReachClient, LTdt_DaysToOffload, LTdt_DaysToDropEmpty, LTdt_ContainerId, LTdt_DriverName, LTdt_DriverPhone,
			 date_format(LTdt_CardWaybillReturnDate,'%Y-%m-%d') as CardWaybillReturnDate, date_format(LTdt_CardWaybillReturnDate,'%H:%i') as CardWaybillReturnTime
			from logistic_transportdt
			left join logistic_transporter on transporter_id = LTdt_TransporterId
			left join logistic_pickup on pickup_id = LTdt_PickUpPointId
			where LT_id=$tlId and LTdt_containerSize='$containerType' ";
	$result=mysql_query($query, $connection);
	while ($row = mysql_fetch_array($result)){
		extract($row);
		echo "<tr height='25px' bgcolor='#dcdcdc'>
				<td width='30px' align='center'>$i</td>
				<td width='30px' align='center'><img src='img/c_delete.png' onclick=\"deleteRow('$LTdt_id','$i','$containerType');\" style='cursor: pointer;width: 11px;' ></td>
				<td width='120px'><input type='text' name='tlCntrNo$containerType-$i' id='tlCntrNo$containerType-$i' value='$ContainerNo' readonly></td>
				<td width='100px'><input type='text' name='tlCntrSize$containerType-$i' id='tlCntrSize$containerType-$i' value='$ContainerSize' readonly></td>
				<td width='100px'><input type='text' name='tlTruckNo$containerType-$i' id='tlTruckNo$containerType-$i' value='$TruckNo'></td>
				<td width='120px'><input type='text' name='tlTransporter$containerType-$i' id='tlTransporter$containerType-$i' value='$transporter_code'  style='width:100px;'>
					<input type='hidden' name='tlTransporterId$containerType-$i' id='tlTransporterId$containerType-$i' value='$TransporterId'>
					<img src='img/btnopen.jpg' width='15' height='15' onclick=\"ShowlistLogisticOp('7','1','tlTransporter$containerType-$i','$containerType-$i');\" title='Select Transporter' onmouseover=\"style.cursor='hand';\">
				</td>
				<td width='120px'><input type='text' name='tlPickUpPnt$containerType-$i' id='tlPickUpPnt$containerType-$i' value='$pickup_code' style='width:100px;'>
					<input type='hidden' name='tlPickUpPntId$containerType-$i' id='tlPickUpPntId$containerType-$i' value='$PickUpPointId'>
					<img src='img/btnopen.jpg' width='15' height='15' onclick=\"ShowlistLogisticOp('8','1','tlPickUpPnt$containerType-$i','$containerType-$i');\" title='Select Pick Up' onmouseover=\"style.cursor='hand';\">
				</td>
				<td width='120px'><select name='tlStatus$containerType-$i' id='tlStatus$containerType-$i'>
					<option value='PENDING' ".($LTdt_Status=='PENDING'?'selected':'').">Pending</option>
					<option value='ACTIVE' ".($LTdt_Status=='ACTIVE'?'selected':'').">Active</option>
					<option value='COMPLETED' ".($LTdt_Status=='COMPLETED'?'selected':'').">Completed</option>
				</select></td>
				<td width='250px'><input type='date' name='tlOutPortD$containerType-$i' id='tlOutPortD$containerType-$i' value='$OutofPortDate' onchange=\"getLogisticDays('$containerType','$i');\" style='width:125px;'>
					<input type='time' name='tlOutPortT$containerType-$i' id='tlOutPortT$containerType-$i' value='$OutofPortTime' onchange=\"getLogisticDays('$containerType','$i');\" style='width:95px;'>
				</td>
				<td width='250px'><input type='date' name='tlArrivalClientD$containerType-$i' id='tlArrivalClientD$containerType-$i' value='$ArrivalatClientDate' onchange=\"getLogisticDays('$containerType','$i');\"style='width:125px;'>
					<input type='time' name='tlArrivalClientT$containerType-$i' id='tlArrivalClientT$containerType-$i' value='$ArrivalatClientTime' onchange=\"getLogisticDays('$containerType','$i');\" style='width:95px;'>
				</td>
				<td width='250px'><input type='date' name='tlOffloadD$containerType-$i' id='tlOffloadD$containerType-$i' value='$OffLoadDate' onchange=\"getLogisticDays('$containerType','$i');\" style='width:125px;'>
					<input type='time' name='tlOffloadT$containerType-$i' id='tlOffloadT$containerType-$i' value='$OffLoadTime' onchange=\"getLogisticDays('$containerType','$i');\" style='width:95px;'>
				</td>
				<td width='250px'><input type='date' name='tlDropEmptyD$containerType-$i' id='tlDropEmptyD$containerType-$i' value='$DroppedEmptyDate' onchange=\"getLogisticDays('$containerType','$i');\" style='width:125px;'>
					<input type='time' name='tlDropEmptyT$containerType-$i' id='tlDropEmptyT$containerType-$i' value='$DroppedEmptyTime' onchange=\"getLogisticDays('$containerType','$i');\" style='width:95px;'>
				</td>
				<td width='250px'><input type='date' name='tlTimeTDOD$containerType-$i' id='tlTimeTDOD$containerType-$i' value='$TdoDate' style='width:125px;'>
					<input type='time' name='tlTimeTDOT$containerType-$i' id='tlTimeTDOT$containerType-$i' value='$TdoTime' style='width:95px;'>
				</td>
				<td width='120px'><input type='text' name='tlDaysReach$containerType-$i' id='tlDaysReach$containerType-$i' value='$LTdt_DaysToReachClient' readonly></td>
				<td width='120px'><input type='text' name='tlDaysOffload$containerType-$i' id='tlDaysOffload$containerType-$i' value='$LTdt_DaysToOffload' readonly></td>
				<td width='120px'><input type='text' name='tlDaysDrop$containerType-$i' id='tlDaysDrop$containerType-$i' value='$LTdt_DaysToDropEmpty' readonly></td>
				<td width='120px'><input type='text' name='tlDriverName$containerType-$i' id='tlDriverName$containerType-$i' value='$LTdt_DriverName' maxlength=150></td>
				<td width='120px'><input type='text' name='tlDriverPhone$containerType-$i' id='tlDriverPhone$containerType-$i' value='$LTdt_DriverPhone' maxlength=150></td>
				<td width='250px'><input type='date' name='tlCardWaybillReturnD$containerType-$i' id='tlCardWaybillReturnD$containerType-$i' value='$CardWaybillReturnDate' onchange=\"getLogisticDays('$containerType','$i');\"style='width:125px;'>
					<input type='time' name='tlCardWaybillReturnT$containerType-$i' id='tlCardWaybillReturnT$containerType-$i' value='$CardWaybillReturnTime' onchange=\"getLogisticDays('$containerType','$i');\" style='width:95px;'>
				</td>
				<td width='30px' align='center'><img src='img/confirm-1.png' onclick=\"saveRow('$LTdt_id','$i','$containerType');\" style='cursor: pointer;'></td>	
			</tr>";	
		$i++;
	}
	echo "</table>";
}
?>