<?php

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


include("config.inc.php");
include("functions_Logistics.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);
}

$querylog="SELECT FL_OperationLogisticApp as loginaccess, user_account, Language 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);
	}

if ($loginaccess=='' or $loginaccess==0)
	header("location:menu.php");


class tabs {
	var $name;
	var $tabs;
	var $active;
	var $current;
function start($name){
		if (empty($this->active)){ $this->active = $name; }
		$this->current = $name;
		ob_start();
	}
	function end(){
		$this->tabs[$this->current] = ob_get_contents();
		ob_end_clean();
	}
	function run(){
	
	
	
		if (count($this->tabs) > 0){
			echo "<DIV CLASS='tabs'>\n";
			$jsClear = "";
			foreach($this->tabs as $tabname => $tabcontent){
				$tabid = "tab_".$this->name."_$tabname";
				$contentid = "tabcontent_".$this->name."_$tabname";
				$jsClear .= "\tdocument.getElementById('$tabid').className = 'tab_inactive';\n";
				$jsClear .= "\tdocument.getElementById('$contentid').style.display = 'none';\n";
			}
			echo "<script type=\"text/javascript\">\n";
			echo "function tab_".$this->name."(id,fieldname){\n";
			echo "$jsClear";
			
			echo "\tdocument.getElementById('tab_".$this->name."_'+id).className = 'tab_active';\n";
			echo "\tdocument.getElementById('tabcontent_".$this->name."_'+id).style.display = '';\n";
			
			echo"	
				//alert(fieldname);
				if(fieldname!='' && fieldname!=undefined)
					
					document.clientdt[fieldname].focus();
				";
			echo "}\n";
			echo "</script>\n";
			foreach($this->tabs as $tabname => $tabcontent){
				$tabid = "tab_".$this->name."_$tabname";
				$contentid = "tabcontent_".$this->name."_$tabname";
				echo "<DIV CLASS='";
				if ($this->active == $tabname){ echo "tab_active"; }else{ echo "tab_inactive"; }
				echo "' ID='$tabid' ";
				echo "onClick=\"tab_".$this->name."('$tabname');\">$tabname</DIV>\n";
			}
			echo "<DIV STYLE='float: center; clear:both;'></DIV>\n";
			foreach($this->tabs as $tabname => $tabcontent){
				$contentid = "tabcontent_".$this->name."_$tabname";
				echo "<DIV ID = '$contentid' CLASS='tab_content' STYLE='display: ";
				if ($this->active == $tabname){ echo "block"; }else{ echo "none"; }
				echo ";'>$tabcontent</DIV>\n";
			}
			echo "</DIV>\n";
			echo "<DIV STYLE='clear: both;'></DIV>\n";
		}}
}	


$query_navigator = "SELECT LANGUAGE,
       ClearPage,
       Excel,
       Save,
       Print,
       Addd,
       SEARCH,
       Pending,
       CopyJV,
       PaymentRequests,
       ExportExcel
FROM ".$_SESSION['dbLabel'].".mainform_label
WHERE LANGUAGE = '".$Language."'";
$result_navigator = mysql_query($query_navigator, $connection);
$row_navigator    = mysql_fetch_array($result_navigator);
extract($row_navigator);

	
//Read From Setup Table							
$querysetup= " select grid_color1, grid_color2,maxperpage from setup ";
$resultsetup=mysql_query($querysetup,$connection) or die(mysql_error());
while($rowsetup=mysql_fetch_array($resultsetup)){
	extract($rowsetup);
}
	

if($mainmode=='')  		$mainmode	= 'insert';
if($startrange=='') 	$startrange = 0;
if($perpage == '' ) 	$perpage 	= $config['trowlimit'][0];
if($olStatus=='')  		$olStatus	= 'PENDING';
if($olOBLFrom=='')  	$olOBLFrom	= 'BANK';
if($olDate=='')  		$olDate		= date('d/m/Y');

$tab1 = "Commercial";
$tab2 = "Pre-Clearing";
$tab3 = "Clearing";
$tab4 = "Transport";
$tab5 = "Container";
$tab6 = "Status";

print <<<HERE

<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0"> 

<title>Operations Logistics</title>

<script type="text/javascript" language="javascript">

function SubmitRecord(){
	var x = document.oplog;
	if (x.olClientCode.value == ''){
		alert("Client is Empty!");
		return 0;
	} else if (x.olProjectCode.value == ''){
		alert("Client is Empty!");
		return 0;
	}
	else {
		x.action = 'Form_OperationsLogistics_Action.php';
		x.submit();
	}
}

function editRecord(volid){
	var x = document.oplog;
	x.olId.value = volid;
	x.mainmode.value = 'edit';
	x.submit();
}

function deleteRecord(volid){
	if(confirm('Are you sure you want to delete this Record?')){
		var x = document.oplog;
		x.olId.value = volid;
		x.mainmode.value = 'delete';
		x.action = 'Form_OperationsLogistics_Action.php';
		x.submit();
	}
}

function ClearPage(){
	var x = document.oplog;
	if (confirm ( "Are you sure you want to Clear Page?"))
	{
		x.mainmode.value 				= '';		
		x.message.value 				= '';		
		x.olId.value 					= '';		
				
		x.olDate.value 					= '';
		x.olClientCode.value 			= '';
		x.olClientDesc.value			= '';
		x.olServiceType.value			= '';
		x.olServiceTypeId.value	 		= '';
		x.olServiceSeqId.value 			= '';
		x.olClientRef.value				= '';
		x.olFreeDem.value				= '';
		x.olProjectCode.value 			= '';
		x.olProjectDesc.value			= '';
		x.olStatus.value 				= '';
		x.olDealer.value				= '';
		x.olDealerId.value				= '';
		x.olTeam.value					= '';
		x.olTeamId.value				= '';
		x.olShipCo.value				= '';
		x.olShipCoId.value				= '';
		x.olEtd.value					= '';
		x.olTwenty.value				= '';
		x.olForty.value					= '';
		x.olEta.value					= '';
		x.olRot.value					= '';
		x.olDob.value					= '';
		x.olDobDays.value				= '';
		x.olTerminal.value				= '';
		x.olTerminalId.value			= '';
		x.olCopyDocRc.value				= '';
		x.olDocsRcvd.value				= '';
		x.olOblRcvd.value				= '';
		x.olPaarRcvd.value				= '';
		x.olAssessment.value			= '';
		x.olCnumber.value				= '';
		x.olSonPaid.value				= '';
		x.olStamp1.value				= '';
		x.olStamp2.value				= '';
		x.olDutyPaid.value				= '';
		x.olDutyNbr.value				= '';
		x.olTerminalRatePer.value		= '';
		x.olTerminalPaid.value			= '';
		x.olTerminalAdd.value			= '';
		x.olShippingRatePer.value		= '';
		x.olShippingPaid.value			= '';
		x.olShippingAdd.value			= '';
		x.olExamBook.value				= '';
		x.olExamined.value				= '';
		x.olCustReleased.value			= '';
		x.olShipReleased.value			= '';
		x.olTdo.value					= '';
		x.olLoadingCompleted.value		= '';
		x.olDeliveryCompleted.value		= '';
		x.olWaybRcvd.value				= '';
		x.olContainerRcvd.value			= '';
		x.olDobDeliver.value			= '';
		x.olDutyDeliver.value			= '';
		x.olInvoiceIssuedOn.value		= '';
		x.olInvoiceBlanace.value		= '';
		x.olDslRef.value				= '';
		x.olProductionDesc.value		= '';
		x.olBLNbr.value					= '';
		x.olFormMValidate.value			= '';
		x.olFormMApproved.value			= '';
		x.olInsuranceRcvd.value			= '';
		x.olInsuranceRqst.value			= '';
		x.olMFNumber.value				= '';
		x.olPaarNbr.value				= '';
		x.olPaarRqsted.value			= '';
		x.olPFIDate.value				= '';
		x.olPFINbr.value				= '';
		x.olRegularDocRcvd.value		= '';
		x.olRegularDocRqst.value		= '';
		x.olRotNbr.value				= '';
		x.olVesselName.value			= '';
		x.olFileHandledClearing.value	= '';
		x.olContactName.value			= '';
		x.olContactPhone.value			= '';
		x.olDestination.value			= '';
		x.olDestinationId.value			= '';
		x.olLclNbr.value				= '';
		x.olRoroShipment.value			= '';
		x.olShipmentType.value			= '';
		x.olFormMRqstdate.value			= '';
		x.olClearingStatus.value		= '';
		x.olRepo.value					= '';
		x.olExamSchedule.value			= '';
		x.olTdoExpiry.value				= '';
		x.vTabFocus.value				= '';
		x.olRemark.value				= '';
		
		x.action='Form_OperationsLogistics.php';
		x.submit();
	}	
}

function saveRemark(remId, index){
	var x = document.oplog;
	let mainmode 					= x.mainmode.value;		
	let olId 						= x.olId.value;		
	let olDate 						= x.olDate.value;
	let olClientCode 				= x.olClientCode.value;
	let olServiceTypeId 	 		= x.olServiceTypeId.value;
	let olServiceSeqId 				= x.olServiceSeqId.value;
	let olClientRef 				= x.olClientRef.value;
	let olFreeDem					= x.olFreeDem.value;
	let olProjectCode	 			= x.olProjectCode.value;
	let olStatus 					= x.olStatus.value;
	let olDealerId 					= x.olDealerId.value;
	let olTeamId					= x.olTeamId.value;
	let olShipCoId					= x.olShipCoId.value;
	let olEtd 						= x.olEtd.value;
	let olTwenty					= x.olTwenty.value;
	let olForty						= x.olForty.value;
	let olEta 						= x.olEta.value;
	let olRot						= x.olRot.value;
	let olDob						= x.olDob.value;
	let olDobDays					= x.olDobDays.value;
	let olTerminalId				= x.olTerminalId.value;
	let olCopyDocRc					= x.olCopyDocRc.value;
	let olDocsRcvd					= x.olDocsRcvd.value;
	let olOblRcvd					= x.olOblRcvd.value;
	let olPaarRcvd					= x.olPaarRcvd.value;
	let olAssessment				= x.olAssessment.value;
	let olCnumber					= x.olCnumber.value;
	let olSonPaid					= x.olSonPaid.value;
	let olStamp1 					= x.olStamp1.value;
	let olStamp2					= x.olStamp2.value;
	let olDutyPaid					= x.olDutyPaid.value;
	let olDutyNbr					= x.olDutyNbr.value;
	let olTerminalRatePer			= x.olTerminalRatePer.value;
	let olTerminalPaid				= x.olTerminalPaid.value;
	let olTerminalAdd				= x.olTerminalAdd.value;
	let olShippingRatePer			= x.olShippingRatePer.value;
	let olShippingPaid				= x.olShippingPaid.value;
	let olShippingAdd				= x.olShippingAdd.value;
	let olExamBook					= x.olExamBook.value;
	let olExamined					= x.olExamined.value;
	let olCustReleased 				= x.olCustReleased.value;
	let olShipReleased				= x.olShipReleased.value;
	let olTdo						= x.olTdo.value;
	let olLoadingCompleted			= x.olLoadingCompleted.value;
	let olDeliveryCompleted 		= x.olDeliveryCompleted.value;
	let olWaybRcvd					= x.olWaybRcvd.value;
	let olContainerRcvd				= x.olContainerRcvd.value;
	let olDobDeliver 				= x.olDobDeliver.value;
	let olDutyDeliver				= x.olDutyDeliver.value;
	let olInvoiceIssuedOn			= x.olInvoiceIssuedOn.value;
	let olInvoiceBlanace			= x.olInvoiceBlanace.value;
	let olDslRef					= x.olDslRef.value;
	let olProductionDesc			= x.olProductionDesc.value;
	let olBLNbr 					= x.olBLNbr.value;
	let olFormMValidate				= x.olFormMValidate.value;
	let olFormMApproved				= x.olFormMApproved.value;
	let olInsuranceRcvd				= x.olInsuranceRcvd.value;
	let olInsuranceRqst				= x.olInsuranceRqst.value;
	let olMFNumber					= x.olMFNumber.value;
	let olPaarNbr					= x.olPaarNbr.value;
	let olPaarRqsted				= x.olPaarRqsted.value;
	let olPFIDate					= x.olPFIDate.value;
	let olPFINbr					= x.olPFINbr.value;
	let olRegularDocRcvd			= x.olRegularDocRcvd.value;
	let olRegularDocRqst			= x.olRegularDocRqst.value;
	let olRotNbr					= x.olRotNbr.value;
	let olVesselName				= x.olVesselName.value;
	let olFileHandledClearing 		= x.olFileHandledClearing.value;
	let olContactName				= x.olContactName.value;
	let olContactPhone				= x.olContactPhone.value;
	let olDestinationId				= x.olDestinationId.value;
	let olLclNbr					= x.olLclNbr.value;
	let olRoroShipment				= x.olRoroShipment.value;
	let olShipmentType				= x.olShipmentType.value;
	let olFormMRqstdate				= x.olFormMRqstdate.value;
	let	olClearingStatus			= x.olClearingStatus.value;
	let olRepo						= x.olRepo.value;
	let olExamSchedule				= x.olExamSchedule.value;
	let olTdoExpiry					= x.olTdoExpiry.value;
	let olRemark					= encodeURIComponent(x.olRemark.value);
	
	let lrType						= document.getElementById('lrType'+index).value;
	let lrRemark					= encodeURIComponent(document.getElementById('lrRemark'+index).value);
	let lrDate						= document.getElementById('lrDate'+index).value;
	let lrtime						= document.getElementById('lrtime'+index).value;
	
	if (lrRemark == ''){
		alert('Remark is Empty!');
		return 0;
	} else if (lrDate == ''){
		alert('Date is Empty!');
		return 0;
	} else {
		if (window.XMLHttpRequest)
			  {// code for IE7+, Firefox, Chrome, Opera, Safari
			  xmlhttp=new XMLHttpRequest();
			  }
			else
			  {// code for IE6, IE5
			  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			  }
			xmlhttp.onreadystatechange=function()
			  {
			  if (xmlhttp.readyState==4 && xmlhttp.status==200)
				{	
					var data = xmlhttp.responseText.split("[BRK]");
					if (data[1] != '') alert(data[1]);
					if (olId == ''){
						x.olId.value = data[2];
						if (data[2] != '') x.mainmode.value = 'edit';
							document.getElementById('lrRemark'+index).focus();
							x.vTabFocus.value = x.tab6.value;
							x.submit();
					} else {
						document.getElementById('remarkDiv').innerHTML = data[3];
						document.getElementById('lrRemark'+index).focus();
					}					
				}
			  }
		xmlhttp.open("GET",'Form_OperationsLogistics_Action.php?mainmode='+mainmode+'&modedt=saveRemark&remId='+remId+'&lrType='+lrType+'&lrRemark='+lrRemark+'&lrDate='+lrDate+'&lrtime='+lrtime
					+'&olId='+olId+'&olDate='+olDate+'&olClientCode='+olClientCode+'&olServiceTypeId='+olServiceTypeId+'&olServiceSeqId='+olServiceSeqId
					+'&olClientRef='+olClientRef+'&olFreeDem='+olFreeDem+'&olProjectCode='+olProjectCode+'&olStatus='+olStatus+'&olDealerId='+olDealerId
					+'&olTeamId='+olTeamId+'&olShipCoId='+olShipCoId+'&olEtd='+olEtd+'&olTwenty='+olTwenty+'&olForty='+olForty+'&olEta='+olEta
					+'&olRot='+olRot+'&olDob='+olDob+'&olDobDays='+olDobDays+'&olTerminalId='+olTerminalId+'&olCopyDocRc='+olCopyDocRc+'&olDocsRcvd='+olDocsRcvd
					+'&olOblRcvd='+olOblRcvd+'&olPaarRcvd='+olPaarRcvd+'&olAssessment='+olAssessment+'&olCnumber='+olCnumber+'&olSonPaid='+olSonPaid
					+'&olStamp1='+olStamp1+'&olStamp2='+olStamp2+'&olDutyPaid='+olDutyPaid+'&olDutyNbr='+olDutyNbr+'&olTerminalRatePer='+olTerminalRatePer
					+'&olTerminalPaid='+olTerminalPaid+'&olTerminalAdd='+olTerminalAdd+'&olShippingRatePer='+olShippingRatePer+'&olShippingPaid='+olShippingPaid
					+'&olShippingAdd='+olShippingAdd+'&olExamBook='+olExamBook+'&olExamined='+olExamined+'&olCustReleased='+olCustReleased+'&olShipReleased='+olShipReleased
					+'&olTdo='+olTdo+'&olLoadingCompleted='+olLoadingCompleted+'&olDeliveryCompleted='+olDeliveryCompleted+'&olWaybRcvd='+olWaybRcvd+'&olContainerRcvd='+olContainerRcvd
					+'&olDobDeliver='+olDobDeliver+'&olDutyDeliver='+olDutyDeliver+'&olInvoiceIssuedOn='+olInvoiceIssuedOn+'&olInvoiceBlanace='+olInvoiceBlanace+'&olDslRef='+olDslRef
					+'&olProductionDesc='+olProductionDesc+'&olBLNbr='+olBLNbr+'&olFormMValidate='+olFormMValidate+'&olFormMApproved='+olFormMApproved+'&olInsuranceRcvd='+olInsuranceRcvd
					+'&olInsuranceRqst='+olInsuranceRqst+'&olMFNumber='+olMFNumber+'&olPaarNbr='+olPaarNbr+'&olPaarRqsted='+olPaarRqsted+'&olPFIDate='+olPFIDate+'&olPFINbr='+olPFINbr
					+'&olRegularDocRcvd='+olRegularDocRcvd+'&olRegularDocRqst='+olRegularDocRqst+'&olRotNbr='+olRotNbr+'&olVesselName='+olVesselName+'&olFileHandledClearing='+olFileHandledClearing
					+'&olContactName='+olContactName+'&olContactPhone='+olContactPhone+'&olDestinationId='+olDestinationId+'&olLclNbr='+olLclNbr+'&olRoroShipment='+olRoroShipment+'&olShipmentType='+olShipmentType
					+'&olFormMRqstdate='+olFormMRqstdate+'&olClearingStatus='+olClearingStatus+'&olRepo='+olRepo+'&olExamSchedule='+olExamSchedule+'&olTdoExpiry='+olTdoExpiry+'&olRemark='+olRemark
					,true);
		xmlhttp.send();
	}
}


function deleteRemark(remId, index){
	var x = document.oplog;
	let olId = x.olId.value;		
	if(confirm('Delete Selected Remark?'))
	{
		if (window.XMLHttpRequest)
			  {// code for IE7+, Firefox, Chrome, Opera, Safari
			  xmlhttp=new XMLHttpRequest();
			  }
			else
			  {// code for IE6, IE5
			  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			  }
			xmlhttp.onreadystatechange=function()
			  {
			  if (xmlhttp.readyState==4 && xmlhttp.status==200)
				{	
					var data = xmlhttp.responseText.split("[BRK]");
					if (data[1] != '') alert(data[1]);
					document.getElementById('remarkDiv').innerHTML = data[2];
				}
			  }
		xmlhttp.open("GET",'Form_OperationsLogistics_Action.php?mainmode=&modedt=deleteRemark&remId='+remId+'&olId='+olId,true);
		xmlhttp.send();
	}
}

function ShowlistProject(){
	var vProjectCode = encodeURIComponent(document.getElementById('olProjectCode').value);
	window.open('List_SorProject.php?frm=45&item=&PProject_Code='+vProjectCode,'mywindow','width=850,height=550,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
}


function ShowlistClient(){
	var vLedger = encodeURIComponent(document.getElementById('olClientCode').value);
	var vDate = document.getElementById('olDate').value;
	
	window.open('List_SorClient.php?frm=20&item=1&PLedger_number='+vLedger+'&TransDate='+vDate,'Clients','width=850,height=550,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
}

function ShowlistLogisticOp(vFrm, vItem, vCode){
	var vCode = encodeURIComponent(document.getElementById(vCode).value);
	
	window.open('List_LogisticOpSetup.php?frm='+vFrm+'&item='+vItem+'&PCode='+vCode,'List','width=850,height=550,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
}

function SetNextPage(startrange,perpage){
	document.oplog.action='Form_OperationsLogistics.php?PRef=&startrange='+startrange+'&perpage='+perpage;
	document.oplog.submit();
}

function SetPrvPage(startrange,perpage){
	document.oplog.action='Form_OperationsLogistics.php?PRef=&startrange='+startrange+'&perpage='+perpage;
	document.oplog.submit();
}

function set_limit(){

	perpage=document.oplog.perpage.value;
	document.oplog.action='Form_OperationsLogistics.php?perpage='+perpage+'&startrange=0';
	document.oplog.submit();
}

function showContainer(vtype){
	
	var x = document.oplog;
	let mainmode 					= x.mainmode.value;		
	let olId 						= x.olId.value;	
	let olDate 						= x.olDate.value;
	let olClientCode 				= x.olClientCode.value;
	let olServiceTypeId 	 		= x.olServiceTypeId.value;
	let olServiceSeqId 				= x.olServiceSeqId.value;
	let olClientRef 				= x.olClientRef.value;
	let olFreeDem					= x.olFreeDem.value;
	let olProjectCode	 			= x.olProjectCode.value;
	let olStatus 					= x.olStatus.value;
	let olDealerId 					= x.olDealerId.value;
	let olTeamId					= x.olTeamId.value;
	let olShipCoId					= x.olShipCoId.value;
	let olEtd 						= x.olEtd.value;
	let olTwenty					= x.olTwenty.value;
	let olForty						= x.olForty.value;
	let olEta 						= x.olEta.value;
	let olRot						= x.olRot.value;
	let olDob						= x.olDob.value;
	let olDobDays					= x.olDobDays.value;
	let olTerminalId				= x.olTerminalId.value;
	let olCopyDocRc					= x.olCopyDocRc.value;
	let olDocsRcvd					= x.olDocsRcvd.value;
	let olOblRcvd					= x.olOblRcvd.value;
	let olPaarRcvd					= x.olPaarRcvd.value;
	let olAssessment				= x.olAssessment.value;
	let olCnumber					= x.olCnumber.value;
	let olSonPaid					= x.olSonPaid.value;
	let olStamp1 					= x.olStamp1.value;
	let olStamp2					= x.olStamp2.value;
	let olDutyPaid					= x.olDutyPaid.value;
	let olDutyNbr					= x.olDutyNbr.value;
	let olTerminalRatePer			= x.olTerminalRatePer.value;
	let olTerminalPaid				= x.olTerminalPaid.value;
	let olTerminalAdd				= x.olTerminalAdd.value;
	let olShippingRatePer			= x.olShippingRatePer.value;
	let olShippingPaid				= x.olShippingPaid.value;
	let olShippingAdd				= x.olShippingAdd.value;
	let olExamBook					= x.olExamBook.value;
	let olExamined					= x.olExamined.value;
	let olCustReleased 				= x.olCustReleased.value;
	let olShipReleased				= x.olShipReleased.value;
	let olTdo						= x.olTdo.value;
	let olLoadingCompleted			= x.olLoadingCompleted.value;
	let olDeliveryCompleted 		= x.olDeliveryCompleted.value;
	let olWaybRcvd					= x.olWaybRcvd.value;
	let olContainerRcvd				= x.olContainerRcvd.value;
	let olDobDeliver 				= x.olDobDeliver.value;
	let olDutyDeliver				= x.olDutyDeliver.value;
	let olInvoiceIssuedOn			= x.olInvoiceIssuedOn.value;
	let olInvoiceBlanace			= x.olInvoiceBlanace.value;
	let olDslRef					= x.olDslRef.value;
	let olProductionDesc			= x.olProductionDesc.value;
	let olBLNbr 					= x.olBLNbr.value;
	let olFormMValidate				= x.olFormMValidate.value;
	let olFormMApproved				= x.olFormMApproved.value;
	let olInsuranceRcvd				= x.olInsuranceRcvd.value;
	let olInsuranceRqst				= x.olInsuranceRqst.value;
	let olMFNumber					= x.olMFNumber.value;
	let olPaarNbr					= x.olPaarNbr.value;
	let olPaarRqsted				= x.olPaarRqsted.value;
	let olPFIDate					= x.olPFIDate.value;
	let olPFINbr					= x.olPFINbr.value;
	let olRegularDocRcvd			= x.olRegularDocRcvd.value;
	let olRegularDocRqst			= x.olRegularDocRqst.value;
	let olRotNbr					= x.olRotNbr.value;
	let olVesselName				= x.olVesselName.value;
	let olFileHandledClearing 		= x.olFileHandledClearing.value;
	let olContactName				= x.olContactName.value;
	let olContactPhone				= x.olContactPhone.value;
	let olDestinationId				= x.olDestinationId.value;
	let olLclNbr					= x.olLclNbr.value;
	let olRoroShipment				= x.olRoroShipment.value;
	let olShipmentType				= x.olShipmentType.value;
	let olFormMRqstdate				= x.olFormMRqstdate.value;
	let	olClearingStatus			= x.olClearingStatus.value;
	let olRepo						= x.olRepo.value;
	let olExamSchedule				= x.olExamSchedule.value;
	let olTdoExpiry					= x.olTdoExpiry.value;
	
	if(olTwenty == '' && vtype == '20'){
		alert('Number of Foot is Empty!');
		return 0;
	}
	else if(olForty == '' && vtype == '40'){
		alert('Number of Foot is Empty!');
		return 0;
	}
	else
	{
		if (window.XMLHttpRequest)
			  {// code for IE7+, Firefox, Chrome, Opera, Safari
			  xmlhttp=new XMLHttpRequest();
			  }
			else
			  {// code for IE6, IE5
			  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			  }
			xmlhttp.onreadystatechange=function()
			  {
			  if (xmlhttp.readyState==4 && xmlhttp.status==200)
				{	
					var data = xmlhttp.responseText.split("[BRK]");
					if (data[1] != '') alert(data[1]);
					if (olId == ''){
						x.olId.value = data[2];
						if (data[2] != '') x.mainmode.value = 'edit';
							x.vTabFocus.value = x.tab5.value;
							x.submit();
					} else {
						document.getElementById('container20').innerHTML = data[3];
						document.getElementById('container40').innerHTML = data[4];
					}
				}
			  }
		xmlhttp.open("GET",'Form_OperationsLogistics_Action.php?mainmode='+mainmode+'&modedt=showContainer'
					+'&olId='+olId+'&olDate='+olDate+'&olClientCode='+olClientCode+'&olServiceTypeId='+olServiceTypeId+'&olServiceSeqId='+olServiceSeqId
					+'&olClientRef='+olClientRef+'&olFreeDem='+olFreeDem+'&olProjectCode='+olProjectCode+'&olStatus='+olStatus+'&olDealerId='+olDealerId
					+'&olTeamId='+olTeamId+'&olShipCoId='+olShipCoId+'&olEtd='+olEtd+'&olTwenty='+olTwenty+'&olForty='+olForty+'&olEta='+olEta
					+'&olRot='+olRot+'&olDob='+olDob+'&olDobDays='+olDobDays+'&olTerminalId='+olTerminalId+'&olCopyDocRc='+olCopyDocRc+'&olDocsRcvd='+olDocsRcvd
					+'&olOblRcvd='+olOblRcvd+'&olPaarRcvd='+olPaarRcvd+'&olAssessment='+olAssessment+'&olCnumber='+olCnumber+'&olSonPaid='+olSonPaid
					+'&olStamp1='+olStamp1+'&olStamp2='+olStamp2+'&olDutyPaid='+olDutyPaid+'&olDutyNbr='+olDutyNbr+'&olTerminalRatePer='+olTerminalRatePer
					+'&olTerminalPaid='+olTerminalPaid+'&olTerminalAdd='+olTerminalAdd+'&olShippingRatePer='+olShippingRatePer+'&olShippingPaid='+olShippingPaid
					+'&olShippingAdd='+olShippingAdd+'&olExamBook='+olExamBook+'&olExamined='+olExamined+'&olCustReleased='+olCustReleased+'&olShipReleased='+olShipReleased
					+'&olTdo='+olTdo+'&olLoadingCompleted='+olLoadingCompleted+'&olDeliveryCompleted='+olDeliveryCompleted+'&olWaybRcvd='+olWaybRcvd+'&olContainerRcvd='+olContainerRcvd
					+'&olDobDeliver='+olDobDeliver+'&olDutyDeliver='+olDutyDeliver+'&olInvoiceIssuedOn='+olInvoiceIssuedOn+'&olInvoiceBlanace='+olInvoiceBlanace+'&olDslRef='+olDslRef
					+'&olProductionDesc='+olProductionDesc+'&olBLNbr='+olBLNbr+'&olFormMValidate='+olFormMValidate+'&olFormMApproved='+olFormMApproved+'&olInsuranceRcvd='+olInsuranceRcvd
					+'&olInsuranceRqst='+olInsuranceRqst+'&olMFNumber='+olMFNumber+'&olPaarNbr='+olPaarNbr+'&olPaarRqsted='+olPaarRqsted+'&olPFIDate='+olPFIDate+'&olPFINbr='+olPFINbr
					+'&olRegularDocRcvd='+olRegularDocRcvd+'&olRegularDocRqst='+olRegularDocRqst+'&olRotNbr='+olRotNbr+'&olVesselName='+olVesselName+'&olFileHandledClearing='+olFileHandledClearing
					+'&olContactName='+olContactName+'&olContactPhone='+olContactPhone+'&olDestinationId='+olDestinationId+'&olLclNbr='+olLclNbr+'&olRoroShipment='+olRoroShipment+'&olShipmentType='+olShipmentType
					+'&olFormMRqstdate='+olFormMRqstdate+'&olClearingStatus='+olClearingStatus+'&olRepo='+olRepo+'&olExamSchedule='+olExamSchedule+'&olTdoExpiry='+olTdoExpiry
					,true);
		xmlhttp.send();
	}
}

function saveContainer(contId, index, cntr_type){
	var lcRemark = 'lcRemark'+cntr_type+'-'+index;
	var lcRemark = encodeURIComponent(document.getElementById(lcRemark).value);
	
	var x = document.oplog;
	let olId 						= x.olId.value;	
	let olTwenty					= x.olTwenty.value;
	let olForty						= x.olForty.value;
	
	if(olTwenty == '' && cntr_type == '20'){
		alert('Number of Foot is Empty!');
		return 0;
	}
	else if(olForty == '' && cntr_type == '40'){
		alert('Number of Foot is Empty!');
		return 0;
	}
	else
	{
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp.onreadystatechange=function()
		  {
		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{	
					var data = xmlhttp.responseText.split("[BRK]");
					if (data[1] != '') alert(data[1]);
				
					document.getElementById('container20').innerHTML = data[3];
					document.getElementById('container40').innerHTML = data[4];
			}
		}
		xmlhttp.open("GET",'Form_OperationsLogistics_Action.php?mainmode=&modedt=saveContainer'+'&olId='+olId+'&contId='+contId+'&lcRemark='+lcRemark+'&cntr_type='+cntr_type
		 +'&olTwenty='+olTwenty+'&olForty='+olForty,true);
		xmlhttp.send();
	}
	
}


function deleteContainer(contId, index, cntr_type){
	
	var x = document.oplog;
	let olId 						= x.olId.value;	
	let olTwenty					= x.olTwenty.value;
	let olForty						= x.olForty.value;
	
	
	if(confirm('Delete Selected Container?'))
	{
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp.onreadystatechange=function()
		  {
		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{	
					var data = xmlhttp.responseText.split("[BRK]");
					if (data[1] != '') alert(data[1]);
				
					document.getElementById('container20').innerHTML = data[3];
					document.getElementById('container40').innerHTML = data[4];
			}
		}
		xmlhttp.open("GET",'Form_OperationsLogistics_Action.php?mainmode=&modedt=deleteContainer'+'&olId='+olId+'&contId='+contId+'&cntr_type='+cntr_type+'&olTwenty='+olTwenty+'&olForty='+olForty,true);
		xmlhttp.send();
	}
	
}

function searchPage(){
	document.oplog.submit();
}
function clearKeyword(){
	document.oplog.keyword.value = '';
	document.oplog.submit();
}
</script>
<style type="text/css">

body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
}
body {
	margin-top: 2px;
	margin-left: 1px;
}
a:link {
	text-decoration: none;
	color: #0000FF;
}
a:visited {
	text-decoration: none;
	color: #0000FF;
}
a:hover {
	text-decoration: none;
	color: #0000FF;
}
a:active {
	text-decoration: none;
	color: #0000FF;
}
.style1 {color: #999999; font-weight: bold; }
.style12 {
	font-size: 9px;
	color: #999999;
	font-weight: bold;
}
.style15 {color: #5151FF; font-size: 10px;}
.style16 {
	font-size: 16px;
	color: #FF0000;
	font-weight: bold;
	font-family: "Times New Roman", Times, serif;
}
.style17 {font-size: 9px}
.style25 {color: #999999; font-weight: bold; font-size: 10px; }
.style26 {color: #FF0000}
.style27 {color: #999999 ;font-size: 10px;}
.style28 {color: #FFFFFF ;font-size: 10px;}

input:focus, select:focus {
	border: 2px solid #008b8b;
}
input:hover, select:hover {
	border: 1px solid #008b8b;
}
</style>
<link type="text/css" rel="stylesheet" href="dhtmlgoodies_calendar.css?random=20051112" media="screen"></LINK>
<SCRIPT type="text/javascript" src="dhtmlgoodies_calendar.js?random=20060118"></script>
<LINK REL="stylesheet" TYPE="text/css" MEDIA="all" HREF="css/tabs.css">
<link rel="stylesheet" type="text/css" media="all" href="css-v2/style.css">
</head>
<body >
<form name='oplog' method='post' enctype='multipart/form-data' >
<input type='hidden' name='mainmode' value='$mainmode'>
<input type=hidden name='message' value='$message'>
<input type=hidden name='olId' value='$olId'>
<input type=hidden name='vTabFocus' value='$vTabFocus'>
<input type=hidden name='tab5' value='$tab5'>
<input type=hidden name='tab6' value='$tab6'>

HERE;

if ($mainmode == 'edit' && $olId != ''){
	$queryEdit = "select date_format(LO_CreationDate,'%d/%m/%Y') as CreationDate, logistic_operations.client_code as client_code, clients.Ledger_name as Ledger_name, service_code, LO_ServiceTypeId, LO_SeqId, LO_ClientRef,
				LO_FreeDemarrage, logistic_operations.project_code as project_code, project_name, LO_Status, Dealer_Code, LO_DealerId, Team_code, LO_TeamId, ship_code, LO_ShipCoId, date_format(LO_ETDDate,'%d/%m/%Y') as ETDDate,
				date_format(LO_ETADate,'%d/%m/%Y') as ETADate,LO_twenty, LO_Forty, date_format(LO_ROTDate,'%d/%m/%Y') as ROTDate, date_format(LO_DOBDate,'%d/%m/%Y') as DOBDate, LO_DOBDays, Terminal_code,
				LO_TerminalID, date_format(LO_CopyDocReceivedDate,'%d/%m/%Y') as CopyDocReceivedDate, date_format(LO_AllDocReceivedDate,'%d/%m/%Y') as AllDocReceivedDate,
				date_format(LO_OBLReceivedDate,'%d/%m/%Y') as OBLReceivedDate, date_format(LO_PAARReceivedDate,'%d/%m/%Y') as PAARReceivedDate, 
				date_format(LO_AssessmentDate,'%d/%m/%Y') as AssessmentDate, LO_CNumber, date_format(LO_SONPaidDate,'%d/%m/%Y') as SONPaidDate, date_format(LO_Stamp1Date,'%d/%m/%Y') as Stamp1Date,
				date_format(LO_Stamp2Date,'%d/%m/%Y') as Stamp2Date, date_format(LO_DutyPaidDate,'%d/%m/%Y') as DutyPaidDate, LO_DutyDays, date_format(LO_TerminalRatePerDate,'%d/%m/%Y') as TerminalRatePerDate, 
				date_format(LO_TerminalPaidDate,'%d/%m/%Y') as TerminalPaidDate, date_format(LO_terminalAdditionalDate,'%d/%m/%Y') as terminalAdditionalDate,date_format(LO_ShippingRatePerDate,'%d/%m/%Y') as ShippingRatePerDate,
				date_format(LO_ShippingPaidDate,'%d/%m/%Y') as ShippingPaidDate, date_format(LO_ShippingAdditionalDate,'%d/%m/%Y') as ShippingAdditionalDate, 
				date_format(LO_ExaminationBookDate,'%d/%m/%Y') as ExaminationBookDate, date_format(LO_ExaminedDate,'%d/%m/%Y') as ExaminedDate, date_format(LO_custReleasedDate,'%d/%m/%Y') as custReleasedDate,
				date_format(LO_ShipCoReleaseDate,'%d/%m/%Y') as ShipCoReleaseDate, date_format(LO_TDODate,'%d/%m/%Y') as TDODate, date_format(LO_LoadingCompleteDate,'%d/%m/%Y') as LoadingCompleteDate,
				date_format(LO_DeliveryCompletedDate,'%d/%m/%Y') as DeliveryCompletedDate, date_format(LO_WayBillReceivedDate,'%d/%m/%Y') as WayBillReceivedDate, 
				date_format(LO_ContainerCardReceivedDate,'%d/%m/%Y') as ContainerCardReceivedDate, LO_DOBDeliver, LO_DutyDeliver, date_format(LO_InvoiceIssuedOnDate,'%d/%m/%Y') as InvoiceIssuedOnDate,
				LO_InvoiceBalance, LO_DslReference, LO_ProductionDescription, LO_BLNumber, date_format(LO_FormMValidateDate,'%d/%m/%Y') as FormMValidateDate, date_format(LO_FormMApprovedDate,'%d/%m/%Y') as FormMApprovedDate, 
				date_format(LO_InsuranceReceivedDate,'%d/%m/%Y') as InsuranceReceivedDate, date_format(LO_InsuranceRequestedDate,'%d/%m/%Y') as InsuranceRequestedDate, LO_MFNumber, LO_OBLReceivedFrom,
				LO_PAARNumber, date_format(LO_PAARRquestedDate,'%d/%m/%Y') as PAARRquestedDate, date_format(LO_PFIDate,'%d/%m/%Y') as PFIDate, LO_PFINumber, date_format(LO_RegularDocReceivedDate,'%d/%m/%Y') as RegularDocReceivedDate,
				date_format(LO_RegularDocRquestedDate,'%d/%m/%Y') as RegularDocRquestedDate, LO_ROTNumber, LO_VesselName, date_format(LO_FileHandledDate,'%d/%m/%Y') as FileHandledDate, LO_ContactName, LO_ContactPhoneNbr,
				date_format(LO_DutyRcvdPaidDate,'%d/%m/%Y') as DutyRcvdPaidDate, LO_DestinationId, Destination_Code, LO_LCLNumber, date_format(LO_ROROShipmentDate,'%d/%m/%Y') as ROROShipmentDate, LO_ShipmentType,
				date_format(LO_FormMRqstDate,'%d/%m/%Y') as FormMRqstDate, LO_ClearingStatus, date_format(LO_RepositionDate,'%d/%m/%Y') as RepositionDate, date_format(LO_ExamScheduleDate,'%d/%m/%Y') as ExamScheduleDate, 
				date_format(LO_TDOExpiryDate,'%d/%m/%Y') as TDOExpiryDate,LO_Remark
				from logistic_operations
				left join clients on clients.ledger_number = client_code
				left join project on project.project_code = logistic_operations.project_code
				left join Logistic_Services on service_id = LO_ServiceTypeId
				left join Logistic_Dealer on Dealer_Id = LO_DealerId
				left join Logistic_Team on Team_Id = LO_TeamId
				left join Logistic_ShipCo on Ship_Id = LO_ShipCoId
				left join Logistic_Terminal on Terminal_Id = LO_TerminalID
				left join logistic_destination on Destination_Id = LO_DestinationId
				where lo_id = $olId "; //echo $queryEdit;
	$resEdit = mysql_query($queryEdit, $connection);
	while($rowEdit = mysql_fetch_array($resEdit)){
		extract($rowEdit);
		$olDate 				= $CreationDate;
		$olClientCode 			= $client_code;
		$olClientDesc			= $Ledger_name;
		$olServiceType			= $service_code;
		$olServiceTypeId 		= $LO_ServiceTypeId;
		$olServiceSeqId 		= $LO_SeqId;
		$olClientRef			= $LO_ClientRef;
		$olFreeDem		 		= $LO_FreeDemarrage;
		$olProjectCode 			= $project_code;
		$olProjectDesc 			= $project_name;
		$olStatus 				= $LO_Status;
		$olDealer				= $Dealer_Code;
		$olDealerId				= $LO_DealerId;
		$olTeam					= $Team_code;
		$olTeamId				= $LO_TeamId;
		$olShipCo				= $ship_code;
		$olShipCoId				= $LO_ShipCoId;
		$olEtd					= $ETDDate;
		$olTwenty				= $LO_twenty;
		$olForty				= $LO_Forty;
		$olEta					= $ETADate;
		$olRot					= $ROTDate;
		$olDob					= $DOBDate;
		$olDobDays				= $LO_DOBDays;
		$olTerminal				= $Terminal_code;
		$olTerminalId			= $LO_TerminalID;
		$olCopyDocRc			= $CopyDocReceivedDate;
		$olDocsRcvd				= $AllDocReceivedDate;
		$olOblRcvd				= $OBLReceivedDate;
		$olPaarRcvd				= $PAARReceivedDate;
		$olAssessment			= $AssessmentDate;
		$olCnumber				= $LO_CNumber;
		$olSonPaid				= $SONPaidDate;
		$olStamp1				= $Stamp1Date;
		$olStamp2				= $Stamp2Date;
		$olDutyPaid				= $DutyPaidDate;
		$olDutyNbr				= $LO_DutyDays;
		$olTerminalRatePer		= $TerminalRatePerDate;
		$olTerminalPaid			= $TerminalPaidDate;
		$olTerminalAdd			= $terminalAdditionalDate;
		$olShippingRatePer		= $ShippingRatePerDate;
		$olShippingPaid			= $ShippingPaidDate;
		$olShippingAdd			= $ShippingAdditionalDate;
		$olExamBook				= $ExaminationBookDate;
		$olExamined				= $ExaminedDate;
		$olCustReleased			= $custReleasedDate;
		$olShipReleased			= $ShipCoReleaseDate;
		$olTdo					= $TDODate;
		$olLoadingCompleted		= $LoadingCompleteDate;
		$olDeliveryCompleted	= $DeliveryCompletedDate;
		$olWaybRcvd				= $WayBillReceivedDate;
		$olContainerRcvd		= $ContainerCardReceivedDate;
		$olDobDeliver			= $LO_DOBDeliver;
		$olDutyDeliver			= $LO_DutyDeliver;
		$olInvoiceIssuedOn		= $InvoiceIssuedOnDate;
		$olInvoiceBlanace		= $LO_InvoiceBalance;
		$olDslRef				= $LO_DslReference;
		$olProductionDesc		= $LO_ProductionDescription;
		$olBLNbr				= $LO_BLNumber;
		$olFormMValidate		= $FormMValidateDate;
		$olFormMApproved		= $FormMApprovedDate;
		$olInsuranceRcvd		= $InsuranceReceivedDate;
		$olInsuranceRqst		= $InsuranceRequestedDate;
		$olMFNumber				= $LO_MFNumber;
		$olOBLFrom				= $LO_OBLReceivedFrom;
		$olPaarNbr				= $LO_PAARNumber;
		$olPaarRqsted			= $PAARRquestedDate;
		$olPFIDate				= $PFIDate;
		$olPFINbr				= $LO_PFINumber;
		$olRegularDocRcvd		= $RegularDocReceivedDate;
		$olRegularDocRqst		= $RegularDocRquestedDate;
		$olRotNbr				= $LO_ROTNumber;
		$olVesselName			= $LO_VesselName;
		$olFileHandledClearing	= $FileHandledDate;
		$olContactName			= $LO_ContactName;
		$olContactPhone			= $LO_ContactPhoneNbr;
		$olDutyRcvdPaid			= $DutyRcvdPaidDate;
		$olDestinationId		= $LO_DestinationId;
		$olDestination			= $Destination_Code;
		$olLclNbr				= $LO_LCLNumber;
		$olRoroShipment			= $ROROShipmentDate;
		$olShipmentType			= $LO_ShipmentType;
		
		$olFormMRqstdate		= $FormMRqstDate;
		$olClearingStatus		= $LO_ClearingStatus;
		$olRepo					= $RepositionDate;
		$olExamSchedule			= $ExamScheduleDate;
		$olTdoExpiry			= $TDOExpiryDate;
		$olRemark				= $LO_Remark;
		
		
	}
}

echo"<table cellpadding='0' cellspacing='0' border='0'  align='center' class='layout-width'>";
include_once("header.php");
echo" <tr><td  valign='top'>";

include_once("sidemenu.php");
echo"  </td></tr>";


echo" <tr style='height:26px;'>
		<td  valign='top' id='content-top'>";

	echo "<table border='0' cellpadding='0' cellspacing='0' style='table-layout:fixed; height:26px;' class='layout-width'>
			<tr style='height:26px;'>
				<td style='width:38px; height:26px;'>&nbsp;</td>
				<td valign='middle' style='width:300px; height:26px;'><span class='title' style='text-transform: uppercase'>Operations Logistics</span></td>
				<td class='message' valign='middle' style='height:26px;'>".htmlspecialchars($message, ENT_QUOTES)."</td>
			</tr></table>
		</td>
	  </tr>";


echo"<tr>
		<td  height='34'  valign='top' id='content-top2'>
			<table border='0' cellpadding='0' cellspacing='0' class='layout-width'>
			<tr>
				<td width='38'  height='34'>&nbsp;</td>
				<td valign='middle' height='34' width='620px'>";
echo"		<button type='button' id='btnClear' name='btnClear' onclick='ClearPage(); return false;' title='Clear Page'><span><span>$ClearPage</span></span></button>";


echo"		<button type='button' id='btnPost' name='btnPost' onclick=\"SubmitRecord();return false;\" title='Save Changes'><span><span>$Save</span></span></button>";
			
echo"   </td><td align='left' width='340px'><input type='text' name='keyword' id='keyword' value='$keyword'>
			<button type='button' id='btnSearch' name='btnSearch' onclick='searchPage(); return false;' title='Search Page'><span><span>Find</span></span></button>
			<button type='button' id='btnClear2' name='btnClear2' onclick='clearKeyword(); return false;' title='Clear Keyword'><span><span>Clear</span></span></button>
		</td>
			<td align='left'><span class='style1'><b>Results/page</b> <select name='perpage' id='perpage'  onchange=set_limit();>";
	foreach ($config['trowlimit'] as $value) {
		echo "<option value='$value' ".($value==$perpage?'selected':'')."  >$value</option>";
	}
		
echo "</select></td></tr>";
echo"	</table>";
echo"</td></tr>";

echo"<tr><td id='content-body'>";	

echo"<table border='0'  align='center' valign='top' width=100% class='tablecontent'>
	<col width=100%>";
		
	echo"   <tr bgcolor='#F7F7F7'><td valign='top'  align='left'>";	  
		$tabs = new tabs("Logistics");	
$tabs->start($tab1);		
echo"<table border='0' style='table-layout:fixed' align='left' valign='top' width='100%'>
      <col width=10%><col width=20%><col width=10%><col width=20%><col width=10%><col width=20%>";

//1st row	  
echo"<tr bgcolor='#F7F7F7' height='25'>
     <td valign='center' align='left' ><span class='style1'>Creation Date<span class='style26'>*</span></span>";
	echo"</td>";
	echo"<td ><input type='text' name='olDate' id='olDate' value='$olDate' style='font-size:12px; width:120px; height:20px;' maxlength='10' />
	        <a href='#' onclick=\"displayCalendar(document.oplog.olDate,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>";
	
echo"<td><span class='style1'>Client<span class='style26'>*</span></span></td>
	<td colspan='3'><input type='text' name='olClientCode' id='olClientCode' value='$olClientCode' style='font-size:12px; width:150px; height:20px;' maxlength='20' />
		<input type='text' name='olClientDesc' id='olClientDesc' value='".htmlspecialchars($olClientDesc,ENT_QUOTES)."' style='font-size:12px; width:200px; height:20px;' />
		<img src='img/btnopen.jpg' weight='15' height='20' onclick=\"ShowlistClient();\" title='Select Client' onmouseover=\"style.cursor='hand';\">
	</td>
	</tr>";

//2nd row
echo"<tr bgcolor='#F7F7F7' height='25'>
		<td valign='center' align='left' ><span class='style1'>Service Type</span></td>
		<td ><input type='text' name='olServiceType' id='olServiceType' value='$olServiceType' style='font-size:12px; width:120px; height:20px;' readonly />
			<input type='hidden' name='olServiceTypeId' id='olServiceTypeId' value='$olServiceTypeId'  />
			<img src='img/btnopen.jpg' weight='15' height='20' onclick=\"ShowlistLogisticOp('1','1','olServiceType');\" title='Select Service' onmouseover=\"style.cursor='hand';\"></td>
		<td><span class='style1'>File<span class='style26'>*</span></span></td>
		<td colspan='3'><input type='text' name='olProjectCode' id='olProjectCode' value='$olProjectCode' style='font-size:12px; width:150px; height:20px;' maxlength='20' />
			<input type='text' name='olProjectDesc' id='olProjectDesc' value='$olProjectDesc' style='font-size:12px; width:200px; height:20px;' />
			<img src='img/btnopen.jpg' weight='15' height='20' onclick=\"ShowlistProject();\" title='Select File' onmouseover=\"style.cursor='hand';\">
		</td>
	</tr>";
	
//3nd row
echo"<tr bgcolor='#F7F7F7' height='25'>
		<td valign='center' align='left' ><span class='style1'>Dealer</span></td>
		<td ><input type='text' name='olDealer' id='olDealer' value='$olDealer' style='font-size:12px; width:120px; height:20px;' readonly />
			<input type='hidden' name='olDealerId' id='olDealerId' value='$olDealerId'  />
			<img src='img/btnopen.jpg' weight='15' height='20' onclick=\"ShowlistLogisticOp('2','1','olDealer');\" title='Select Dealer' onmouseover=\"style.cursor='hand';\"></td>
		<td><span class='style1'>ID</span></td>
		<td ><input type='text' name='olServiceSeqId' id='olServiceSeqId' value='$olServiceSeqId' style='font-size:12px; width:150px; height:20px;' readonly /></td>
		<td><span class='style1'>Client Ref</span></td>
		<td ><input type='text' name='olClientRef' id='olClientRef' value='$olClientRef' style='font-size:12px; width:120px; height:20px;'  /></td>
	</tr>";	

//row 4
echo"<tr bgcolor='#F7F7F7' height='25'>
		<td valign='center' align='left' ><span class='style1'>Dsl Reference</span></td>
		<td ><input type='text' name='olDslRef' id='olDslRef' value='$olDslRef' style='font-size:12px; width:120px; height:20px;' /></td>
		<td><span class='style1'>Status</span></td>
		<td colspan='1'><select  name='olStatus' id='olStatus' style='font-size:12px; width:150px; height:20px;'>
		<option value='PENDING' ".( $olStatus == 'PENDING'?'selected':'')." >Pending</option>
		<option value='ACTIVE' ".( $olStatus == 'ACTIVE'?'selected':'').">Active</option>
		<option value='COMPLETED' ".( $olStatus == 'COMPLETED'?'selected':'').">Completed</option>
		</td>
		<td valign='center' align='left' ><span class='style1'>Team</span></td>
		<td><input type='text' name='olTeam' id='olTeam' value='$olTeam' style='font-size:12px; width:120px; height:20px;' readonly />
			<input type='hidden' name='olTeamId' id='olTeamId' value='$olTeamId'  />
			<img src='img/btnopen.jpg' weight='15' height='20' onclick=\"ShowlistLogisticOp('3','1','olTeam');\" title='Select Team' onmouseover=\"style.cursor='hand';\">
		</td>
	</tr>";	

//row 5
echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>Production Description</span></td>
		<td colspan='3'><textarea cols='66' name='olProductionDesc' id='olProductionDesc' style='font-size:12px;'>".htmlspecialchars($olProductionDesc,ENT_QUOTES)."</textarea>
		</td>
		<td><span class='style1'>Shipment Type</span></td>
		<td ><select name='olShipmentType' id='olShipmentType' style='font-size:12px; width:120px; height:20px;'/>
				<option value='' ".($olShipmentType==''?'selected':'')."></option>
				<option value='AIR' ".($olShipmentType=='AIR'?'selected':'').">Air</option>
				<option value='SEA' ".($olShipmentType=='SEA'?'selected':'').">Sea</option>			
			</select>
		</td>
		
	</tr>";	

//row 6
echo"<tr bgcolor='#F7F7F7' height='25'>
		<td valign='center' align='left' ><span class='style1'>Invoice Balance</span></td>
		<td ><input type='text' name='olInvoiceBlanace' id='olInvoiceBlanace' value='$olInvoiceBlanace' style='font-size:12px; width:120px; height:20px;'  /></td>
		<td><span class='style1'>Invoice Issued On</span></td>
		<td ><input type='text' name='olInvoiceIssuedOn' id='olInvoiceIssuedOn' value='$olInvoiceIssuedOn' style='font-size:12px; width:120px; height:20px;'  />
			<a href='#' onclick=\"displayCalendar(document.oplog.olInvoiceIssuedOn,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td valign='center' align='left' ><span class='style1'>RORO Shipment</span></td>
		<td ><input type='text' name='olRoroShipment' id='olRoroShipment' value='$olRoroShipment' style='font-size:12px; width:120px; height:20px;'  />
			<a href='#' onclick=\"displayCalendar(document.oplog.olRoroShipment,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
	</tr>";	

//row 7
echo"<tr height='20'><td><span class='style1'>Remark</span></td><td colspan='4'><input type='text' name='olRemark' id='olRemark' value='$olRemark' maxlength=256 style='font-size:12px; width:488px; height:20px;' ></td></tr>";
echo"<tr height='20'><td colspan='5'>&nbsp;</td></tr>";

echo"<tr height='20'><td colspan='5' align='center'></td></tr>";

echo"</table>";
	$tabs->end();
	$tabs->start($tab2);
	echo"<table border='0' style='table-layout:fixed' align='left' valign='top' width='100%'>
      <col width=10%><col width=20%><col width=10%><col width=20%><col width=10%><col width=20%>";
	
	//row 1 
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>PFI Date</span></td>
		<td ><input type='text' name='olPFIDate' id='olPFIDate' value='$olPFIDate' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olPFIDate,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>PFI Number</span> </td>
		<td ><input type='text' name='olPFINbr' id='olPFINbr' value='$olPFINbr' style='font-size:12px; width:120px; height:20px;' maxlength=50  /></td>
		<td><span class='style1'>Insurance Date Requested</span> </td>
		<td ><input type='text' name='olInsuranceRqst' id='olInsuranceRqst' value='$olInsuranceRqst' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olInsuranceRqst,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
	</tr>";		
	
	//row 2 
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>Insurance Date Recceived</span></td>
		<td ><input type='text' name='olInsuranceRcvd' id='olInsuranceRcvd' value='$olInsuranceRcvd' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olInsuranceRcvd,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>	
		<td><span class='style1'>Regulatory Docs Date Requested</span></td>
		<td ><input type='text' name='olRegularDocRqst' id='olRegularDocRqst' value='$olRegularDocRqst' style='font-size:12px; width:120px; height:20px;'maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olRegularDocRqst,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td valign='center' align='left' ><span class='style1'>Regulatory Docs Date Received</span></td>
		<td ><input type='text' name='olRegularDocRcvd' id='olRegularDocRcvd' value='$olRegularDocRcvd' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olRegularDocRcvd,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
	</tr>";		
	
	//row 3 
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>Form M Requested Date</span> </td>
		<td ><input type='text' name='olFormMRqstdate' id='olFormMRqstdate' value='$olFormMRqstdate' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olFormMRqstdate,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>Form M Validated Date</span> </td>
		<td ><input type='text' name='olFormMValidate' id='olFormMValidate' value='$olFormMValidate' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olFormMValidate,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td valign='center' align='left' ><span class='style1'>Form M Approved Date</span></td>
		<td ><input type='text' name='olFormMApproved' id='olFormMApproved' value='$olFormMApproved' style='font-size:12px; width:120px; height:20px;' maxlength=10  />
			<a href='#' onclick=\"displayCalendar(document.oplog.olFormMApproved,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
	</tr>";	
	
	//row 4 
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td valign='center' align='left' ><span class='style1'>MF Number</span></td>
		<td ><input type='text' name='olMFNumber' id='olMFNumber' value='$olMFNumber' style='font-size:12px; width:120px; height:20px;' maxlength=50  /></td>
		<td><span class='style1'>LCL No </span></td>
		<td ><input type='text' name='olLclNbr' id='olLclNbr' value='$olLclNbr' style='font-size:12px; width:120px; height:20px;' maxlength=50 /></td>
		<td valign='center' align='left' ><span class='style1'>ETD</span></td>
		<td ><input type='text' name='olEtd' id='olEtd' value='$olEtd' style='font-size:12px; width:120px; height:20px;' maxlength=10  />
			<a href='#' onclick=\"displayCalendar(document.oplog.olEtd,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		 </td>
	</tr>";		
	
	//row 5
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>ETA</span></td>
		<td ><input type='text' name='olEta' id='olEta' value='$olEta' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olEta,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>BL Number</span></td>
		<td ><input type='text' name='olBLNbr' id='olBLNbr' value='$olBLNbr' style='font-size:12px; width:120px; height:20px;' maxlength=50 /></td>
		<td><span class='style1'>Copy Docs Rec.</span></td>
		<td ><input type='text' name='olCopyDocRc' id='olCopyDocRc' value='$olCopyDocRc' style='font-size:12px; width:120px; height:20px;'maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olCopyDocRc,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
	</tr>";		
	
	//row 6
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>PAAR Requested Date</span> </td>
		<td ><input type='text' name='olPaarRqsted' id='olPaarRqsted' value='$olPaarRqsted' style='font-size:12px; width:120px; height:20px;'maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olPaarRqsted,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>PAAR Rec.</span></td>
		<td ><input type='text' name='olPaarRcvd' id='olPaarRcvd' value='$olPaarRcvd' style='font-size:12px; width:120px; height:20px;'maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olPaarRcvd,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td valign='center' align='left' ><span class='style1'>PAAR Number </span></td>
		<td ><input type='text' name='olPaarNbr' id='olPaarNbr' value='$olPaarNbr' style='font-size:12px; width:120px; height:20px;' maxlength=50 /></td>
	</tr>";
	
	//row 7
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td valign='center' align='left' ><span class='style1'>O BL Rec.</span></td>
		<td ><input type='text' name='olOblRcvd' id='olOblRcvd' value='$olOblRcvd' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olOblRcvd,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>O BL Received From</span></td>
		<td ><select name='olOBLFrom' id='olOBLFrom' style='font-size:12px; width:120px; height:20px;'>
				<option value='BANK' ".($olOBLFrom=='BANK'?'selected':'').">Bank</option>
				<option value='CLIENT' ".($olOBLFrom=='CLIENT'?'selected':'').">Client</option>
			</select></td>
		<td><span class='style1'>D.O.B.</span></td>
		<td ><input type='text' name='olDob' id='olDob' value='$olDob' style='font-size:12px; width:120px; height:20px;'maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olDob,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>	
	</tr>";		
	
	//row 8 
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td valign='center' align='left' ><span class='style1'>Date File Handled over to clearing</span></td>
		<td ><input type='text' name='olFileHandledClearing' id='olFileHandledClearing' value='$olFileHandledClearing' style='font-size:12px; width:120px; height:20px;'maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olFileHandledClearing,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>Days since D.O.B.</span></td>
		<td ><input type='text' name='olDobDays' id='olDobDays' value='$olDobDays' style='font-size:12px; width:150px; height:20px;' /></td>
		<td><span class='style1'>SON Paid</span></td>
		<td ><input type='text' name='olSonPaid' id='olSonPaid' value='$olSonPaid' style='font-size:12px; width:120px; height:20px;'maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olSonPaid,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
	</tr>";	 

	
	echo "</table>";  
	$tabs->end();
	$tabs->start($tab3);
	echo"<table border='0' style='table-layout:fixed' align='left' valign='top' width='100%'>
      <col width=10%><col width=20%><col width=10%><col width=20%><col width=10%><col width=20%>";
	
		//row 1  
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>Ship Co</span></td>
		<td ><input type='text' name='olShipCo' id='olShipCo' value='$olShipCo' style='font-size:12px; width:120px; height:20px;' readonly />
			<input type='hidden' name='olShipCoId' id='olShipCoId' value='$olShipCoId'  />
			<img src='img/btnopen.jpg' weight='15' height='20' onclick=\"ShowlistLogisticOp('4','1','olShipCo');\" title='Select Ship' onmouseover=\"style.cursor='hand';\">
		</td>
		<td valign='center' align='left' ><span class='style1'>Vessel Name</span></td>
		<td ><input type='text' name='olVesselName' id='olVesselName' value='$olVesselName' style='font-size:12px; width:120px; height:20px;' maxlength=50 />
		</td>
		<td valign='center' align='left' ><span class='style1'>ROT No</span></td>
		<td ><input type='text' name='olRotNbr' id='olRotNbr' value='$olRotNbr' style='font-size:12px; width:120px; height:20px;' maxlength=50 />
		</td>
	</tr>";	 
	
	//row 2  
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>ROT Date</span> </td>
		<td ><input type='text' name='olRot' id='olRot' value='$olRot' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olRot,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td valign='center' align='left' ><span class='style1'>Assesment</span></td>
		<td ><input type='text' name='olAssessment' id='olAssessment' value='$olAssessment' style='font-size:12px; width:120px; height:20px;'maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olAssessment,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>C Number</span></td>
		<td ><input type='text' name='olCnumber' id='olCnumber' value='$olCnumber' style='font-size:12px; width:120px; height:20px;' maxlength=10 /></td>
	</tr>";	 
	
	//row 3  
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>NAFDAC 1st Stamping</span></td>
		<td ><input type='text' name='olStamp1' id='olStamp1' value='$olStamp1' style='font-size:12px; width:120px; height:20px;'maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olStamp1,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td valign='center' align='left' ><span class='style1'>Shipping Paid</span></td>
		<td ><input type='text' name='olShippingPaid' id='olShippingPaid' value='$olShippingPaid' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olShippingPaid,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>ShipCo Date Released</span></td>
		<td ><input type='text' name='olShipReleased' id='olShipReleased' value='$olShipReleased' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olShipReleased,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
	</tr>";	 
	
	//row 4  
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>Shipping Rate Period</span></td>
		<td ><input type='text' name='olShippingRatePer' id='olShippingRatePer' value='$olShippingRatePer' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olShippingRatePer,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>Shipping Additional</span> </td>
		<td ><input type='text' name='olShippingAdd' id='olShippingAdd' value='$olShippingAdd' style='font-size:12px; width:120px; height:20px;'  />
			<a href='#' onclick=\"displayCalendar(document.oplog.olShippingAdd,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td valign='center' align='left' ><span class='style1'>Terminal</span></td>
		<td ><input type='text' name='olTerminal' id='olTerminal' value='$olTerminal' style='font-size:12px; width:120px; height:20px;' readonly />
			<input type='hidden' name='olTerminalId' id='olTerminalId' value='$olTerminalId' >
			<img src='img/btnopen.jpg' weight='15' height='20' onclick=\"ShowlistLogisticOp('5','1','olTerminal');\" title='Select Terminal' onmouseover=\"style.cursor='hand';\">
		</td>
	</tr>";	 
	
	//row 5  
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>Terminal Paid</span></td>
		<td ><input type='text' name='olTerminalPaid' id='olTerminalPaid' value='$olTerminalPaid' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olTerminalPaid,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td valign='center' align='left' ><span class='style1'>Terminal Rate Period</span></td>
		<td ><input type='text' name='olTerminalRatePer' id='olTerminalRatePer' value='$olTerminalRatePer' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olTerminalRatePer,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>Terminal Additional</span></td>
		<td ><input type='text' name='olTerminalAdd' id='olTerminalAdd' value='$olTerminalAdd' style='font-size:12px; width:120px; height:20px;'  />
			<a href='#' onclick=\"displayCalendar(document.oplog.olTerminalAdd,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
	</tr>";	 
	
	//row 6  
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>Date Duty Paid</span></td>
		<td ><input type='text' name='olDutyPaid' id='olDutyPaid' value='$olDutyPaid' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olDutyPaid,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td valign='center' align='left' ><span class='style1'>Date Duty Received Paid</span></td>
		<td ><input type='text' name='olDutyRcvdPaid' id='olDutyRcvdPaid' value='$olDutyRcvdPaid' style='font-size:12px; width:120px; height:20px;'  />
			<a href='#' onclick=\"displayCalendar(document.oplog.olDutyRcvdPaid,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td valign='center' align='left' ><span class='style1'>Clearing Status</span></td>
		<td ><select name='olClearingStatus' id='olClearingStatus' style='font-size:12px; width:120px; height:20px;'  />
			<option value='' ".($olClearingStatus == ''?'selected':'' )."></option>
			<option value='FAST TRACK' ".($olClearingStatus == 'FAST TRACK'?'selected':'' ).">Fast Track</option>
			<option value='SCANNING' ".($olClearingStatus == 'SCANNING' ?'selected':'').">Scanning</option>
			<option value='PHYSICAL' ".($olClearingStatus == 'PHYSICAL' ?'selected':'').">Physical</option>
			<option value='DIPLOMATIC' ".($olClearingStatus == 'DIPLOMATIC' ?'selected':'').">Diplomatic</option>
			</select>
		</td>
	</tr>";	 
	
	//row 7  
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>Block Starking/Repositioning Date</span></td>
		<td ><input type='text' name='olRepo' id='olRepo' value='$olRepo' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olRepo,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>Exam/Scanning Book. Date </span></td>
		<td ><input type='text' name='olExamBook' id='olExamBook' value='$olExamBook' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olExamBook,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>Exam/Scanning Schedule Date </span></td>
		<td ><input type='text' name='olExamSchedule' id='olExamSchedule' value='$olExamSchedule' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olExamSchedule,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
	</tr>";	 
	
	//row 8  
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>Examination/Scanning Date</span></td>
		<td ><input type='text' name='olExamined' id='olExamined' value='$olExamined' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olExamined,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>Custom Date Released</span></td>
		<td ><input type='text' name='olCustReleased' id='olCustReleased' value='$olCustReleased' style='font-size:12px; width:120px; height:20px;'  />
			<a href='#' onclick=\"displayCalendar(document.oplog.olCustReleased,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>NAFDAC 2nd Stamping</span></td>
		<td ><input type='text' name='olStamp2' id='olStamp2' value='$olStamp2' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olStamp2,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
	</tr>";	 
	
	//row 9 
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>TDO</span></td>
		<td ><input type='text' name='olTdo' id='olTdo' value='$olTdo' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olTdo,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>TDO Expiry Date</span></td>
		<td ><input type='text' name='olTdoExpiry' id='olTdoExpiry' value='$olTdoExpiry' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olTdoExpiry,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>free demurrage</span></td>
		<td ><input type='text' name='olFreeDem' id='olFreeDem' value='$olFreeDem' style='font-size:12px; width:120px; height:20px;'  /></td>
	</tr>";	 
	
	//row 10 
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td valign='center' align='left' ><span class='style1'>Since Duty</span></td>
		<td ><input type='text' name='olDutyNbr' id='olDutyNbr' value='$olDutyNbr' style='font-size:12px; width:120px; height:20px;'  />
		</td>
		<td valign='center' align='left' ><span class='style1'>All Documents Receieved</span></td>
		<td ><input type='text' name='olDocsRcvd' id='olDocsRcvd' value='$olDocsRcvd' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olDocsRcvd,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
	</tr>";	 
	
	
	echo "</table>";
	$tabs->end();
	
	$tabs->start($tab4);
	echo"<table border='0' style='table-layout:fixed' align='left' valign='top' width='100%'>
      <col width=10%><col width=20%><col width=10%><col width=20%><col width=10%><col width=20%>";
	//row 1
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>Contact Name</span></td>
		<td ><input type='text' name='olContactName' id='olContactName' value='$olContactName' style='font-size:12px; width:150px; height:20px;' maxlength=50 /></td>
		<td><span class='style1'>Contact Phone No</span></td>
		<td ><input type='text' name='olContactPhone' id='olContactPhone' value='$olContactPhone' style='font-size:12px; width:120px; height:20px;' maxlength=50  /></td>
		<td valign='center' align='left' ><span class='style1'>Container Card Received</span></td>
		<td ><input type='text' name='olContainerRcvd' id='olContainerRcvd' value='$olContainerRcvd' style='font-size:12px; width:120px; height:20px;'  />
			<a href='#' onclick=\"displayCalendar(document.oplog.olContainerRcvd,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
	</tr>";	
	
	//row 3 
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td><span class='style1'>Delivery Completed</span></td>
		<td ><input type='text' name='olDeliveryCompleted' id='olDeliveryCompleted' value='$olDeliveryCompleted' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olDeliveryCompleted,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'>Destination </span></td>
		<td ><input type='text' name='olDestination' id='olDestination' value='$olDestination' style='font-size:12px; width:120px; height:20px;' maxlength=50 />
			<input type='hidden' name='olDestinationId' id='olDestinationId' value='$olDestinationId' >
			<img src='img/btnopen.jpg' width='15' height='15' onclick=\"ShowlistLogisticOp('6','1','olDestination');\" title='Select Destination' onmouseover=\"style.cursor='hand';\">
		</td>
		<td valign='center' align='left' ><span class='style1'>Loading Completed</span></td>
		<td ><input type='text' name='olLoadingCompleted' id='olLoadingCompleted' value='$olLoadingCompleted' style='font-size:12px; width:120px; height:20px;'  />
			<a href='#' onclick=\"displayCalendar(document.oplog.olLoadingCompleted,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
	</tr>";	
	
	//row 4 
	/* echo"<tr bgcolor='#F7F7F7' height='25'>
		<td valign='center' align='left' ><span class='style1'>DOB to Delivery</span></td>
		<td ><input type='text' name='olDobDeliver' id='olDobDeliver' value='$olDobDeliver' style='font-size:12px; width:120px; height:20px;'  />
		</td>
		<td><span class='style1'>Duty to Delivery</span></td>
		<td ><input type='text' name='olDutyDeliver' id='olDutyDeliver' value='$olDutyDeliver' style='font-size:12px; width:120px; height:20px;' />
		</td>
		<td><span class='style1'> </span></td>
		<td ></td>
		<td valign='center' align='left' ><span class='style1'></span></td>
		<td ></td>
	</tr>";	 */
	
	echo "<input type='hidden' name='olDobDeliver' id='olDobDeliver' value='$olDobDeliver'/>
		<input type='hidden' name='olDutyDeliver' id='olDutyDeliver' value='$olDutyDeliver'/>";
	//row 5 
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td valign='center' align='left' ><span class='style1'>Waybill Received</span></td>
		<td ><input type='text' name='olWaybRcvd' id='olWaybRcvd' value='$olWaybRcvd' style='font-size:12px; width:120px; height:20px;' maxlength=10 />
			<a href='#' onclick=\"displayCalendar(document.oplog.olWaybRcvd,'dd/mm/yyyy',this);  return false;\" name='anchor1' id='anchor1'><img src='./img/cal.gif' border='0' align='center'></a>
		</td>
		<td><span class='style1'></span></td>
		<td ></td>
		<td><span class='style1'></span></td>
		<td ></td>
	</tr>";	
	
	echo "</table>";
	$tabs->end();
	
	$tabs->start($tab5);
	echo"<table border='0' style='table-layout:fixed' align='left' valign='top' width='100%'>
      <col width=10%><col width=20%><col width=10%><col width=20%><col width=10%><col width=20%>";
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td valign='center' align='left' ><span class='style1'>20 ft</span></td>
		<td ><input type='text' name='olTwenty' id='olTwenty' value='$olTwenty' style='font-size:12px; width:90px; height:20px;' />
			<img src='img/show.png' width='16px' height=16px' style='cursor: pointer;' title='Add Container'  onclick=\"showContainer('20');\">
		</td>
		<td ></td><td ></td>
		<td><span class='style1'>40 ft</span></td>
		<td ><input type='text' name='olForty' id='olForty' value='$olForty' style='font-size:12px; width:90px; height:20px;' />
			<img src='img/show.png' width='16px' height=16px' style='cursor: pointer;' title='Add Container' onclick=\"showContainer('40');\">
		</td>
		<td ></td>
	</tr>";	  
	
	echo "<tr><td colspan='2'><div id='container20' style='height: 150px; overflow-x: hidden; overflow-y: scroll;'>";
		drawContainerTable ($olId, $olTwenty, '20', $connection);	
	echo "</div></td><td ></td><td ></td>";
	
	echo "<td colspan='2'><div id='container40' style='height: 150px; overflow-x: hidden; overflow-y: scroll;'>";
		drawContainerTable ($olId, $olForty, '40', $connection);	
	echo "</div></td></tr>";
	echo "</table>";
	$tabs->end();
	
	$tabs->start($tab6);
	echo"<table border='0' style='table-layout:fixed' align='left' valign='top' width='100%'>
      <col width=100%>";
	echo"<tr bgcolor='#F7F7F7' height='25'>
		<td ><div id ='remarkDiv' style='width: 100%; height: 250px; overflow-x: hidden; overflow-y: scroll;'>";
		drawRemarkTable ($olId, $connection);	
	echo "</div></td>
		</tr>";	  
	echo "</table>";
	$tabs->end();
	
	$tabs->run();
echo "</td></tr>";

$queryAll = "select LO_id, date_format(LO_CreationDate, '%d/%m/%Y') as creationDate, ledger_name as clientName, service_code, LO_SeqId, LO_FreeDemarrage as FreeDemarrage,
			logistic_operations.Project_Code as Project_Code,Dealer_Code, Team_Code, Ship_Code,
			date_format(LO_ETDDate, '%d/%m/%Y') as ETDDate, date_format(LO_ETADate, '%d/%m/%Y') as ETADate,date_format(LO_ROTDate, '%d/%m/%Y') as ROTDate,
			date_format(LO_DOBDate, '%d/%m/%Y') as DOBDate, Terminal_Code, LO_CNumber, date_format(LO_SONPaidDate, '%d/%m/%Y') as SONPaidDate,
			date_format(LO_Stamp1Date, '%d/%m/%Y') as Stamp1Date, date_format(LO_Stamp2Date, '%d/%m/%Y') as Stamp2Date,
			date_format(LO_TerminalRatePerDate, '%d/%m/%Y') as TerminalRatePerDate, date_format(LO_TerminalPaidDate, '%d/%m/%Y') as TerminalPaidDate,
			date_format(LO_terminalAdditionalDate, '%d/%m/%Y') as terminalAdditionalDate,
			date_format(LO_ShippingRatePerDate, '%d/%m/%Y') as ShippingRatePerDate, date_format(LO_ShippingPaidDate, '%d/%m/%Y') as ShippingPaidDate,
			date_format(LO_ShippingAdditionalDate, '%d/%m/%Y') as ShippingAdditionalDate,
			date_format(LO_LoadingCompleteDate, '%d/%m/%Y') as LoadingCompleteDate, date_format(LO_DeliveryCompletedDate, '%d/%m/%Y') as DeliveryCompletedDate,
			date_format(LO_WayBillReceivedDate, '%d/%m/%Y') as WayBillReceivedDate,
			LO_DOBDeliver as DOBDeliver, LO_DutyDeliver as DutyDeliver,
			date_format(LO_InvoiceIssuedOnDate, '%d/%m/%Y') as InvoiceIssuedOnDate, LO_InvoiceBalance as InvoiceBalance

			from logistic_operations
			left join clients on clients.ledger_number = client_code
			left join Logistic_Services on service_id = LO_ServiceTypeId
			left join Logistic_Dealer on Dealer_Id = LO_DealerId
			left join Logistic_Team on Team_Id = LO_TeamId
			left join Logistic_ShipCo on Ship_Id = LO_ShipCoId
			left join Logistic_Terminal on Terminal_Id = LO_TerminalID
			where ( logistic_operations.Project_Code like '%$keyword%' or client_code like '%$keyword%' or ledger_name like '%$keyword%' or LO_CNumber like '%$keyword%' or LO_ROTNumber like '%$keyword%')
			order by LO_CreationDate desc ";

$resAll= mysql_query($queryAll,$connection) or die(mysql_error());
$totalrows = mysql_num_rows($resAll);
	
$queryAll .= " limit ".$startrange.",".$perpage;	

echo "<tr><td colspan='3' valign='top'><div style='width:100%;height:400px;overflow-y:scroll;overflow-x:scroll;'>";

// header
echo"<div style='width:2780px'><table border='0' cellspacing=0 style='border:1px solid gray;'>";				
echo"<tr height='30px' style='background-color:#D8D8D8;'> 
	 <td width='20px'>&nbsp;</td>
	 <td width='20px'>&nbsp;</td>
	 <td width='100px' align='left' ><span class='style1'><b>Creation Date</b></td>
	 <td width='120px' align='left' ><span class='style1'><b>File</b></td>
	 <td width='120px' align='left' ><span class='style1'><b>Client</b></td>
	 <td width='120px' align='left' ><span class='style1'><b>Service Type</b></td>
	 <td width='120px' align='left' ><span class='style1'><b>ID</b></td>
	 <td width='120px' align='left' ><span class='style1'><b>Demarrage</b></td>
	 <td width='120px' align='left' ><span class='style1'><b>Dealer</b></td>
	 <td width='120px' align='left' ><span class='style1'><b>Team</b></td>
	 <td width='120px' align='left' ><span class='style1'><b>Ship Co</b></td>
	 <td width='100px' align='left' ><span class='style1'><b>ETD</b></td>
	 <td width='100px' align='left' ><span class='style1'><b>ETA</b></td>
	 <td width='100px' align='left' ><span class='style1'><b>ROT</b></td>
	 <td width='100px' align='left' ><span class='style1'><b>D.O.B.</b></td>
	 <td width='120px' align='left' ><span class='style1'><b>Terminal</b></td>
	 <td width='120px' align='left' ><span class='style1'><b>C Number</b></td>
	 <td width='100px' align='left' ><span class='style1'><b>SON Paid</b></td>
	 <td width='100px' align='left' ><span class='style1'><b>Loading Completed</b></td>
	 <td width='100px' align='left' ><span class='style1'><b>Delivery Completed</b></td>
	 <td width='100px' align='left' ><span class='style1'><b>Waybill Received</b></td>
	 <td width='120px' align='left' ><span class='style1'><b>DOB to Delivery</b></td>
	 <td width='120px' align='left' ><span class='style1'><b>Duty to Delivery</b></td>
	 <td width='100px' align='left' ><span class='style1'><b>Invoice Issued on</b></td>
	 <td width='120px' align='left' ><span class='style1'><b>Invoice Balance</b></td>
	 </tr>";
echo "</table></div>";
	
$resAll= mysql_query($queryAll,$connection);

//Body
echo"<div style='width:2780px;'><table border='0' cellspacing=0 style=''>";				
while ($rows = mysql_fetch_array($resAll)){
	extract($rows);
	$ct+=1;
	$stylefont='style15';
	if($ct%2==0)
		$Color="style='background-color:".$grid_color1."'";
	else			
		$Color="style='background-color:".$grid_color2."'";	
			
	if($olId==$rows[0]){
		
		$Color="style='background-color:#1e87a5'";
		$stylefont='style28';
	}
	
	echo"<tr height='15px' $Color> 
		 <td width='20px' align='center'><img border='0' src='img/button_edit.png' width='9' height='10' title='Edit Detail' onmouseover=\"this.style.cursor='pointer'\" OnClick=\"editRecord('$rows[0]')\"></td>
		 <td width='20px' align='center'><img border='0' src='img/c_delete.png' width='9' height='10' title='Delete Detail' onmouseover=\"this.style.cursor='pointer'\" OnClick=\"deleteRecord('$rows[0]')\"></td>
		 <td width='100px' align='left' ><span class='$stylefont'>$creationDate</td>
		 <td width='120px' align='left' ><span class='$stylefont'>$Project_Code</td>
		 <td width='120px' align='left' ><span class='$stylefont'>$clientName</td>
		 <td width='120px' align='left' ><span class='$stylefont'>$service_code</td>
		 <td width='120px' align='left' ><span class='$stylefont'>$LO_SeqId</td>
		 <td width='120px' align='left' ><span class='$stylefont'>$FreeDemarrage</td>
		 <td width='120px' align='left' ><span class='$stylefont'>$Dealer_Code</td>
		 <td width='120px' align='left' ><span class='$stylefont'>$Team_Code</td>
		 <td width='120px' align='left' ><span class='$stylefont'>$Ship_Code</td>
		 <td width='100px' align='left' ><span class='$stylefont'>$ETDDate</td>
		 <td width='100px' align='left' ><span class='$stylefont'>$ETADate</td>
		 <td width='100px' align='left' ><span class='$stylefont'>$ROTDate</td>
		 <td width='100px' align='left' ><span class='$stylefont'>$DOBDate</td>
		 <td width='120px' align='left' ><span class='$stylefont'>$Terminal_Code</td>
		 <td width='120px' align='left' ><span class='$stylefont'>$LO_CNumber</td>
		 <td width='100px' align='left' ><span class='$stylefont'>$SONPaidDate</td>
		 <td width='100px' align='left' ><span class='$stylefont'>$LoadingCompleteDate</td>
		 <td width='100px' align='left' ><span class='$stylefont'>$DeliveryCompletedDate</td>
		 <td width='100px' align='left' ><span class='$stylefont'>$WayBillReceivedDate</td>
		 <td width='120px' align='left' ><span class='$stylefont'>$DOBDeliver</td>
		 <td width='120px' align='left' ><span class='$stylefont'>$DutyDeliver</td>
		 <td width='100px' align='left' ><span class='$stylefont'>$InvoiceIssuedOnDate</td>
		 <td width='120px' align='left' ><span class='$stylefont'>$InvoiceBalance</td>
		</tr>";
}
echo"</table></div>";
echo "</div></td></tr>";


echo"<tr><td >&nbsp;</td><td align='center'>";
		
		$diff= $startrange - $perpage;
		
		if (($diff) >= 0 ){
			$prvstartrange = $startrange - $perpage;
			echo"<img src='img/arrowleft.jpg' title='Previous' onMouseOver=\"style.cursor='hand'\"  onclick=SetPrvPage('".$prvstartrange."','".$perpage."')>";
		}
		else
			echo "&nbsp;";
		
		echo"</td><td  align='center'>";
		
		
		if ($startrange <= $totalrows){
			$startrange = $startrange + $perpage;
			if  ($startrange <= $totalrows)
				echo"<img src='img/arrowright.jpg' title='Next' onMouseOver=\"style.cursor='hand'\" onclick=SetNextPage('".$startrange."','".$perpage."')>";
		} else
			echo "&nbsp;";
			
		echo"</td></tr>";
echo "</table></td></tr>";		
  
echo" <tr height='30'><td align='center' id='content-bottom' ></td></tr>";
include("footer.php");	

print <<< HERE
      
	  </table>
	  </form>
HERE;

if($vTabFocus!=''){
	echo'<script type="text/javascript" language="javascript">';
	echo"tab_('$vTabFocus','');";
	echo'</script>';	
}	


print <<<HERE

</body>

HERE;

?>