Where has the message been trigger?

Hi,
I did check the current .php file but I cannot find out how highlighted message would be trigger, within the Web page.

20u.png
LVL 11
HuaMin ChenProblem resolverAsked:
Who is Participating?
 
Ryan ChongCommented:
checked your codes:

<td><div id="vesselAutoComplete">
      <input type="text" name="vessel" id="vessel" value="*" maxlength="3">      
      <div id="vesselContainer"></div>
</tr></td>

try minimize the search where content of vesselContainer was being set.
0
 
Ryan ChongCommented:
you got to do the necessary debugging by viewing the page's source code, or go to Inspect of the web browser to see what condition has triggered the additional message to front interface.
0
 
HuaMin ChenProblem resolverAuthor Commented:
I checked the .php files but I really cannot find out the place, that triggers such message.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Ryan ChongCommented:
it could have some dynamic javascript that doing the event binding.

try find the id or name of that text field element, then do a search within the .js files.

or explore further using the web browser's Inspect feature as mentioned.
0
 
HuaMin ChenProblem resolverAuthor Commented:
I searched the whole folders (including sub-folders), and could not find out relevant places showing relevant message (highlighted in above).
0
 
kenfcampCommented:
Short of reviewing the code ourselves, all we can do is assure you it's in there... Somewhere
0
 
HuaMin ChenProblem resolverAuthor Commented:
Hi,
Here is acs01.php
<? //Author: Jack   Program ID: ACS01 Desc: Scheduled Voyages Mainliner Exclusion Registration
//Created Date: 10:09 25/06/09 Modified Date: 10:11 AM 9/30/2011

require_once("..\lib\db_fns.php");
require_once("..\lib\general.php");
require_once("..\lib\define_cons.php");
require_once("..\adm\user_auth_fns.php"); 
require_once("..\adm\output_fns.php");
require_once("..\lib\include_fns.php");
require_once("..\lib\display_page.php");

session_start(); 
check_valid_user();
$ups=check_ups("ACS01",$valid_user);
?>

<!DOCTYPE html> 
<html>
<head>
	<meta http-equiv="Content-Type" content="charset=iso-8859-1"/>
	<meta name="version" content="$Revision: 9 $ $Date: 2007-12-19 22:04:19 +0100 (Wed, 19 Dec 2007) $">
	<link href="abr/abr-style.css" rel="styleSheet" type="text/css"/>
	<script type="text/javascript" src="abr/mootools.v1.11.js"></script>
	<script type="text/javascript" src="abr/abr-main.js"></script>
	<script language="javascript" type="text/javascript" src="../ariacom/abr/datetimepicker.js"></script>		
	<script type="text/javascript" src="../ariacom/abr/mootools.v1.11.js"></script>
	<script type="text/javascript" src="../ariacom/abr/abr-main.js"></script>
	<script language="javascript" type="text/javascript" src="../ariacom/abr/datetimepicker.js"></script>	
	<link rel="stylesheet" type="text/css" href="../yui/build/fonts/fonts-min.css" />
	<link rel="stylesheet" type="text/css" href="../yui/build/autocomplete/assets/skins/sam/autocomplete.css" /> 
	<script type="text/javascript" src="../yui/build/yahoo-dom-event/yahoo-dom-event.js"></script>
	<script type="text/javascript" src="../yui/build/connection/connection-min.js"></script>
	<script type="text/javascript" src="../yui/build/animation/animation-min.js"></script>
	<script type="text/javascript" src="../yui/build/datasource/datasource-min.js"></script>
	<script type="text/javascript" src="../yui/build/autocomplete/autocomplete-min.js"></script>
	<script type="text/javascript" src="../yui/build/element/element-min.js"></script>
	<script type="text/javascript" src="../yui/build/json/json-min.js"></script>

<title>ACS101-Ancillary Cost Declaration </title>

<style type="text/css">
  body {
    background-color: #FFFFFF;
    color: #004080;
    font-family: Arial;
    font-size: 12px;
  }
  .categoryText {
    line-height: 25px;
    font-size: x-large;
	color: orange;
}
  .bd {
    background-color: #FFFFFF;
    color: #004080;
    font-family: Arial;
    font-size: 12px;
  }
  .tbl {
    background-color: #FFFFFF;
  }
  a:link { 
    color: #FF0000;
    font-family: Arial;
    font-size: 12px;
  }
  a:active { 
    color: #0000FF;
    font-family: Arial;
    font-size: 12px;
  }
  a:visited { 
    color: #800080;
    font-family: Arial;
    font-size: 12px;
  }
  .hr {
    background-color: #336699;
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  .edit {
    background-color: #F0FFFF;
    color: #336699;
    font-family: Arial;
    font-size: 12px;
  }
  .addhr {
    background-color: #336633;
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  .addedit {
    background-color: #F0FFF0;
    color: #336633;
    font-family: Arial;
    font-size: 12px;
  }
  a.hr:link {
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  a.hr:active {
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  a.hr:visited {
    color: #FFFFFF;
    font-family: Arial;
    font-size: 12px;
  }
  .dr {
    background-color: #FFFFFF;
    color: #000000;
    font-family: Arial;
    font-size: 12px;
  }
  .sr {
    background-color: #FFFFCF;
    color: #000000;
    font-family: Arial;
    font-size: 12px;
  }
</style>

<style type="text/css">
	#approverAutoComplete {
	width:10em; /* set width here or else widget will expand to fit its container */
	padding-bottom:2em;
	padding-right:8px;
	padding-top:2px;
	z-index:9008;
	}

	#currAutoComplete {
	width:10em; /* set width here or else widget will expand to fit its container */
	padding-bottom:2em;
	padding-right:8px;
	padding-top:2px;
	z-index:9009;
	}

	#vendorAutoComplete {
	width:30em; /* set width here or else widget will expand to fit its container */
	padding-bottom:2em;
	padding-right:8px;
	padding-top:2px;
	z-index:9010;
	}

	#agentAutoComplete {
	width:30em; /* set width here or else widget will expand to fit its container */
	padding-bottom:2em;
	padding-right:8px;
	padding-top:2px;
	z-index:9011;
	}

	#sailDateAutoComplete {
	width:10em;/* -- set width here or else widget will expand to fit its container */
	padding-bottom:2em;
	padding-right:8px;
	padding-top:2px;
	z-index:9012;
	}

	#arrDateAutoComplete {
	width:10em; /*-- set width here or else widget will expand to fit its container */
	padding-bottom:2em;
	padding-right:8px;
	padding-top:2px;
	z-index:9013;
	}

	#itemTypeAutoComplete {
	width:10em;/* -- set width here or else widget will expand to fit its container */
	padding-bottom:2em;
	padding-right:8px;
	padding-top:2px;
	z-index:9014;
	}

	#itemGroupAutoComplete {
	width:20em; /*-- set width here or else widget will expand to fit its container */
	padding-bottom:2em;
	padding-right:8px;
	padding-top:2px;
	z-index:9015;
	}

	#tradeAutoComplete {
	width:10em; /* set width here or else widget will expand to fit its container */
	padding-bottom:2em;
	padding-right:8px;
	padding-top:2px;
	z-index:9016;
	}

	#portAutoComplete {
	width:10em;/* -- set width here or else widget will expand to fit its container */
	padding-bottom:2em;
	padding-right:8px;
	padding-top:2px;
	z-index:9017;
	}

	#legAutoComplete {
	width:10em; /*-- set width here or else widget will expand to fit its container */
	padding-bottom:2em;
	padding-right:8px;
	padding-top:2px;
	z-index:9018;
	}

	#voyageAutoComplete {
	width:10em; /* set width here or else widget will expand to fit its container */
	padding-bottom:2em;
	padding-right:8px;
	padding-top:2px;
	z-index:9019;
	}

	#vesselAutoComplete {
	width:20em; /* set width here or else widget will expand to fit its container */
	padding-bottom:2em;
	padding-right:8px;
	padding-top:2px;
	z-index:9020;
	}
</style>


<script type="text/javascript">
function displaymessage()
{
//document.getElementById("mon_yy").value="";
document.getElementById("principal").value="";
document.getElementById("vessel").value="";
document.getElementById("voyage").value="";
document.getElementById("leg").value="";
document.getElementById("port_code").value="";
document.getElementById("port_sequence").value="";
document.getElementById("arrived_date").value="";
document.getElementById("type").value="";
document.getElementById("sailed_date").value="";
document.getElementById("trade").value="";
document.getElementById("ship_from").value="";
document.getElementById("ship_for").value="";
document.getElementById("date_of_issue").value="";
document.getElementById("currency_code").value="";
document.getElementById("agent_code").value="";
document.getElementById("vessel_name").value="";
document.getElementById("roe_to_usd").value="";
document.getElementById("freeze").value="";
document.getElementById("status").value="";
document.getElementById("remarks").value="";
document.getElementById("invalid").value="";
document.getElementById("invalidated_reason").value="";
document.getElementById("ac_reference").value="";
document.getElementById("source").value="";
document.getElementById("territory").value="";
document.getElementById("seth_ind").value="";
document.getElementById("dms_lock").value="";
document.getElementById("verification_type").value="";
document.getElementById("state_monyy").value="";
document.getElementById("activity_date").value="";
document.getElementById("item_group_code").value="";
document.getElementById("item_type_code").value="";
document.getElementById("vendor_code").value="";
document.getElementById("qty20_full_gp").value="";
document.getElementById("qty40_full_gp").value="";
document.getElementById("qty45_full_gp").value="";
document.getElementById("qty20_full_dg").value="";
document.getElementById("qty40_full_dg").value="";
document.getElementById("qty20_full_rf").value="";
document.getElementById("qty40_full_rh").value="";
document.getElementById("rate20_full_gp").value="";
document.getElementById("rate40_full_gp").value="";
document.getElementById("rate45_full_gp").value="";
document.getElementById("rate20_full_dg").value="";
document.getElementById("rate40_full_dg").value="";
document.getElementById("rate20_full_rf").value="";
document.getElementById("rate40_full_rh").value="";
document.getElementById("cost_amount_manual").value="";
document.getElementById("recover_cost").value="";
document.getElementById("explanation").value="";
document.getElementById("attachment_name").value="";
document.getElementById("create_datetime").value="";
document.getElementById("last_update_date").value="";
}
</script>
</head>

<br>
<? include_once("../adm/topMenuController.php"); ?>
</br><br><br>

<body  class="yui-skin-sam">

<?$conn = connect();
  $showrecs = 500;
  $pagerange = 10;
  $numrec = 20;

  $a = @$_GET["a"];
  
        if (isset($_POST["filter"])) $filter = @$_POST["filter"];
	  
   if (isset($_POST["filter_field"])) $filterfield = @$_POST["filter_field"];
   $wholeonly = false;
   if (isset($_POST["wholeonly"])) $wholeonly = @$_POST["wholeonly"];
   if (!isset($filter) && isset($_SESSION["filter"])) $filter = $_SESSION["filter"];
   if (!isset($filterfield) && isset($_SESSION["filter_field"])) $filterfield = $_SESSION["filter_field"];
  
  $recid = @$_GET["recid"];

  $page = @$_GET["page"];
  if (!isset($page)) $page = 1;

  $sql = @$_POST["sql"];

  switch ($sql) {
    case "insert":
      sql_insert();
      break;
    case "edit":
      sql_edit($valid_user);
      break;
    case "delete":
      sql_delete($valid_user);
      break;
  }
  
  switch ($a) {
    case "add":
      addrec($valid_user);
      break;
    case "edit":
      editrec($recid, $valid_user, $filter, $filterfield);
      break;
    case "del":
      deleterec($recid);
      break;
    default:
      select($valid_user,$ups);
      break;
  }

  odbc_close($conn);
?>
<?
echo "<br><br><br>";
echo "<a href=\"../adm/login_menu.php\">Back to Zimnet A4 Menu</a><img src=\"../images/loginmenu.gif\">";
?>
</body>
</html>

<? function select($valid_user,$ups)
  {
  global $a;
  global $showrecs;
  global $page;
  global $numrec;

  global $filter;
  global $filterfield;
  
  $res = sql_select();
  $count = sql_getrecordcount();
  /*
  $filter = "";
  $filterfield = "";
*/
  if ($count % $showrecs != 0) {
    $pagecount = intval($count / $showrecs) + 1;
  }
  else {
    $pagecount = intval($count / $showrecs);
  }
  $startrec = $showrecs * ($page - 1);
  if ($startrec < $count) {odbc_fetch_row($res, $startrec);}
  $reccount = min($showrecs * $page, $count);
  $fields = array(
    "track_id" => "Track ID",	
    "ac_reference" => "AC Ref",	
    "principal" => "Pri",	
    "vessel" => "Ves",
    "vessel_name" => "Ves Name",
    "voyage" => "Voy",
    "leg" => "Leg",
    "port_code" => "Port",
    "port_sequence" => "Port Seq",
    "type" => "Type",
    "item_group_code" => "Item Gp",
    "item_type_code" => "Item Type",
    "arrived_date" => "Arrived Date",
    "sailed_date" => "Sail Date",
    "activity_date" => "Activity Date",
    "trade" => "Trade",	
    "territory" => "Territory",
    "vendor_code" => "Vendor",
    "ship_from" => "Ship From",
    "ship_for" => "Ship For",
    "date_of_issue" => "Issue Date",
    "agent_code" => "Agent",
    "currency_code" => "Curr",
    "roe_to_usd" => "ROE",	
    "remarks" => "Remark",	
    "state_monyy" => "Statement Month(MM/YYYY)",
    "qty20_full_gp" => "DV20 Qty",
    "rate20_full_gp" => "DV20 Rate",
    "qty40_full_gp" => "DV40 Qty",
    "rate40_full_gp" => "DV40 Rate",
    "qty45_full_gp" => "DV45 Qty",
    "rate45_full_gp" => "DV45 Rate",
    "qty20_full_dg" => "DG20 Qty",
    "rate20_full_dg" => "DG20 Rate",
    "qty40_full_dg" => "DG40 Qty",
    "rate40_full_dg" => "DG40 Rate",
    "qty20_full_rf" => "RF20 Qty",
    "rate20_full_rf" => "RF20 Rate",
    "qty40_full_rh" => "RH40 Qty",
    "rate40_full_rh" => "RH40 Rate",
    "cost_amount_manual" => "Manual Cost Amt",	
    "recover_cost" => "Recover Cost",
    "explanation" => "Explanation",
    "approver_name" => "Approver",
	"applicant_name" => "Applicant Name",
    "freeze" => "Fz",
    "status" => "Status",
	"invalid" => "Invalid",
    "invalidated_reason" => "Reason",
    "source" => "Source",
    "seth_ind" => "Seth",
    "dms_lock" => "DMS",
    "verification_type" => "Vfy Type",
	"commit_status" => "Commit Status",
    "create_datetime" => "Create Date", 
    "last_update_date" => "Update Date",
    "last_update_user" => "Update User"      
		);
?>

<table class="bd" border="0" cellspacing="1" cellpadding="4">
<!--td>
Number of records:&nbsp;&nbsp;<input type="text" name="numRec" id="numRec" size=3 maxlength="3" value="20"></input>
</td>
<tr><td>  </td></tr!-->
<tr><td>Records : <? echo $startrec + 1 ?> - <? echo $reccount ?> of <? echo $count ?></td></tr>
</table>
<hr size="1" noshade>

<form action="ACS01.php" method="post">
<table class="bd" border="0" cellspacing="1" cellpadding="4">
<tr>
<td><b>Filter</b>&nbsp;</td>
<td><input type="text" name="filter" value="<? echo $filter ?>"></td>
<td><select name="filter_field">
<option value=""> </option> 
<?
  reset($fields);
  foreach($fields as $val => $caption) {
    if (($caption!="Updated date") OR($caption!="Arrival month(mm/yy)")) {
    if ($val == $filterfield) {$selstr = " selected"; } else {$selstr = ""; }
?>
<option value="<? echo $val ?>"<? echo $selstr ?>><? echo htmlspecialchars($caption) ?></option>
<? }} ?>
</select></td>
</td></tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="action" value="Retrieve"></td>
</tr>
<tr>
<td><?if ($ups["create"]=="Y") {echo "<a href=\"ACS01.php?a=add\">Add Record</a>&nbsp;";}?></td></tr>
</table>

</form>

<br>
<table class="tbl" border="0" cellspacing="1" cellpadding="5"width="100%">
<tr>
<!--td class="hr">&nbsp;</td!-->
<td class="hr">&nbsp;</td>
<?
  reset($fields);
  foreach($fields as $val => $caption) {
?>
<td class="hr"><? echo $caption ?></td>
<? } ?>
</tr>
<?
  for ($i = $startrec; $i < $reccount; $i++)
  {
    $row = odbc_fetch_array($res);
    $style = "dr";
    if ($i % 2 != 0) {
      $style = "sr";
  }
?>
<tr>
<!--td class="<? echo $style ?>"><a href="ACS01.php?a=del&recid=<? echo $i ?>"><?if ($ups["delete"]=="Y") {echo "Delete";}?></a></td!-->
<!--td class="<? echo $style ?>"><a href="ACS01.php?a=edit&recid=<? echo $i ?>"><?if ($ups["update"]=="Y") {echo "Edit";}?></a></td!-->
<td class="<? echo $style ?>"><a href="ACS01.php?a=edit&recid=<? echo $i ?>&filter=<? echo $filter ?>&filterfield=<? echo $filterfield ?>"><?if ($ups["update"]=="Y") {echo "Edit";}?></a></td>
<?
  reset($fields);
  foreach($fields as $val => $caption) {
    if ($val=="last_update_date") {$row[$val]=format_datetime($row[$val]);}
?>
<td class="<? echo $style ?>"><? echo htmlspecialchars($row[$val]) ?></td>
<? } ?>
</tr>

<?
  }
  odbc_free_result($res);
?>
</table>
<br>
<? showpagenav($page, $pagecount,$ups); ?>
<? } ?>

<?
function format_in_yyyymmdd($datetm)
{
$split_date = split ('/',$datetm);
$split_dy=split(' ',$split_date[2]);
$date =  $split_dy[0]."/".$split_date[1]."/".$split_date[0];
return $date;
}
?>

<? function showrow($row)
  {
?>
<table class="tbl" border="0" cellspacing="1" cellpadding="5" width="30%">
<input type="hidden" name="principal" value="<? echo $row["principal"] ?>">
<input type="hidden" name="vessel" value="<? echo $row["vessel"] ?>">
<input type="hidden" name="voyage" value="<? echo $row["voyage"] ?>">
<input type="hidden" name="leg" value="<? echo $row["leg"] ?>">
<input type="hidden" name="port_code" value="<? echo $row["port_code"] ?>">
<input type="hidden" name="port_sequence" value="<? echo $row["port_sequence"] ?>">

<tr>
<td class="hr"><? echo htmlspecialchars("AC Ref")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["ac_reference"]) ?></td> 
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Principal")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["principal"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Vessel")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["vessel"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Vessel Name")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["vessel_name"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Voyage")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["voyage"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Leg")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["leg"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Port")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["port_code"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Port Seq")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["port_sequence"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Arrived Date")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["arrived_date"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Sailed Date")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["sailed_date"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Type")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["type"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Item Group")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["item_group_code"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Item Type")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["item_type_code"]) ?></td>
</tr>
</table>
<? } ?>

<? function editrow($row)
  {
?>
<table class="tbl" border="0" cellspacing="1" cellpadding="5"width="80%">
<tr>
<input type="hidden" name="ac_reference" id="ac_reference" value="<? echo $row["ac_reference"] ?>">
<input type="hidden" name="principal" id="principal" value="<? echo $row["principal"] ?>">
<input type="hidden" name="vessel" id="vessel" value="<? echo $row["vessel"] ?>">
<input type="hidden" name="voyage" id="voyage" value="<? echo $row["voyage"] ?>">
<input type="hidden" name="leg" id="leg" value="<? echo $row["leg"] ?>">
<input type="hidden" name="port_code" id="port_code" value="<? echo $row["port_code"] ?>">
<input type="hidden" name="port_sequence" id="port_sequence" value="1">
<input type="hidden" name="item_group_code" id="item_group_code" value="<? echo $row["item_group_code"] ?>">
<input type="hidden" name="item_type_code" id="item_type_code" value="<? echo $row["item_type_code"] ?>">
<input type="hidden" name="type" id="type" value="<? echo $row["type"] ?>">
<input type="hidden" name="invalidated_reason" id="invalidated_reason" value="<? echo $row["invalidated_reason"] ?>">
<input type="hidden" name="source" id="source" value="<? echo $row["source"] ?>">
<input type="hidden" name="xzvl_id" id="xzvl_id" value="<? echo $row["zvl_id"] ?>">

<td class="hr"><? echo htmlspecialchars("AC Ref")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["ac_reference"]) ?></td> 
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Principal")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["principal"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Vessel")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["vessel"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Vessel Name")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["vessel_name"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Voyage")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["voyage"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Leg")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["leg"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Port")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["port_code"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Port Seq")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["port_sequence"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Activity-Category")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["item_group_code"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Activity-Status")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["item_type_code"]) ?></td>
</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Type")."&nbsp;" ?></td>
<td class="dr"><? echo htmlspecialchars($row["type"]) ?></td>
</tr>
<tr>
<td class="edit">Vessel Arrived Date (DD/MM/YYYY)</td>
<td>
<div id="arrDateAutoComplete">
	<input type="datetime" name="arrived_date" id="arrived_date" value="<? echo str_replace('"', '&quot;', trim($row["arrived_date"])) ?>">
	<div id="arrDateContainer"></div></td>		
</tr>
<tr>
<td class="edit">Vessel Sailed Date (DD/MM/YYYY)</td>
<td><div id="sailDateAutoComplete">
	<input type="text" name="sailed_date" id="sailed_date" value="<? echo str_replace('"', '&quot;', trim($row["sailed_date"])) ?>">
	<div id="sailDateContainer"></div></tr>
<tr>
<td class="edit">Activity Date (DD/MM/YYYY)</td>
<td><input name="activity_date" id="activity_date"  value="<? echo str_replace('"', '&quot;', trim($row["activity_date"])) ?>">&nbsp;
	<a href="javascript:NewCal('activity_date','ddmmyyyy',false,'24','English','/')"><img src="../ariacom/images/calendar.gif" width=16 height=16 border=0></a></td>
</tr>
<tr>
<td class="edit">Issue Date</td><td class="dr"> <? echo str_replace('"', '&quot;', trim($row["date_of_issue"])) ?></td>
<td><input type="hidden" name="date_of_issue" id="date_of_issue"  value="<? echo str_replace('"', '&quot;', trim($row["date_of_issue"])) ?>">&nbsp;
	<!--a href="javascript:NewCal('date_of_issue','ddmmyyyy',false,'24','English','/')"><img src="../ariacom/images/calendar.gif" width=16 height=16 border=0></a!--></td>
</tr>
<tr>
<td class="edit">Agent</td>
<td><div id="agentAutoComplete">
	<input type="text" name="agent_code" id="agent_code"  value="<? echo str_replace('"', '&quot;', trim($row["agent_code"])) ?>">	
	<div id="agentContainer"></div></td>
</tr>
<tr>
<td class="edit">Vendor ***</td>
<td><div id="vendorAutoComplete">
	<input type="text" name="vendor_code" id="vendor_code"  value="<? echo str_replace('"', '&quot;', trim($row["vendor_code"])) ?>">	
	<div id="vendorContainer"></div></td>
</tr>
<tr>
<td class="edit">Ship From (Zim PortCode)</td>
<td><input type="text" id="ship_from" name="ship_from" maxlength="30" value="<? echo str_replace('"', '&quot;', trim($row["ship_from"])) ?>"></td>
</tr>
<tr>
<td class="edit">Ship For (Zim PortCode)</td>
<td><input type="text" id="ship_for" name="ship_for" maxlength="30" value="<? echo str_replace('"', '&quot;', trim($row["ship_for"])) ?>"></td>
</tr>
<tr>
<td class="edit">Curr</td>
<td><div id="currAutoComplete">
	<input type="text" name="currency_code" id="currency_code"  value="<? echo str_replace('"', '&quot;', trim($row["currency_code"])) ?>">	
	<div id="currContainer"></div></td>
</tr>
<tr>
<td class="edit">ROE</td>
<td><input type="text" id="roe_to_usd" name="roe_to_usd" maxlength="10" value="<? echo str_replace('"', '&quot;', trim($row["roe_to_usd"])) ?>"></td>
</tr>
<tr>
<td class="edit">Remark</td>
<td><input type="text" id="remarks" name="remarks" maxlength="50" value="<? echo str_replace('"', '&quot;', trim($row["remarks"])) ?>"></td>
</tr>
<tr>
<td class="edit">Statement Month (MM/YYYY)</td>
<td><input type="text" id="state_monyy" name="state_monyy" maxlength="7" value="<? echo str_replace('"', '&quot;', trim($row["state_monyy"])) ?>"></td>
</tr>
<tr>
<td class="edit">DV20 Qty</td>
<td><input type="text" id="qty20_full_gp" name="qty20_full_gp" maxlength="5" value="<? echo str_replace('"', '&quot;', trim($row["qty20_full_gp"])) ?>"></td>
<td class="edit">Rate</td>
<td><input type="text" id="rate20_full_gp" name="rate20_full_gp" maxlength="18" value="<? echo str_replace('"', '&quot;', trim($row["rate20_full_gp"])) ?>"></td>
</tr>
<tr>
<td class="edit">DV40 Qty</td>
<td><input type="text" id="qty40_full_gp" name="qty40_full_gp" maxlength="5" value="<? echo str_replace('"', '&quot;', trim($row["qty40_full_gp"])) ?>"></td>
<td class="edit">Rate</td>
<td><input type="text" id="rate40_full_gp" name="rate40_full_gp" maxlength="18" value="<? echo str_replace('"', '&quot;', trim($row["rate40_full_gp"])) ?>"></td>
</tr>
<tr>
<td class="edit">DV45 Qty</td>
<td><input type="text" id="qty45_full_gp" name="qty45_full_gp" maxlength="5" value="<? echo str_replace('"', '&quot;', trim($row["qty45_full_gp"])) ?>"></td>
<td class="edit">Rate</td>
<td><input type="text" id="rate45_full_gp" name="rate45_full_gp" maxlength="18" value="<? echo str_replace('"', '&quot;', trim($row["rate45_full_gp"])) ?>"></td>
</tr>
<tr>
<td class="edit">DG20 Qty</td>
<td><input type="text" id="qty20_full_dg" name="qty20_full_dg" maxlength="5" value="<? echo str_replace('"', '&quot;', trim($row["qty20_full_dg"])) ?>"></td>
<td class="edit">Rate</td>
<td><input type="text" id="rate20_full_dg" name="rate20_full_dg" maxlength="18" value="<? echo str_replace('"', '&quot;', trim($row["rate20_full_dg"])) ?>"></td>
</tr>
<tr>
<td class="edit">DG40 Qty</td>
<td><input type="text" id="qty40_full_dg" name="qty40_full_dg" maxlength="5" value="<? echo str_replace('"', '&quot;', trim($row["qty40_full_dg"])) ?>"></td>
<td class="edit">Rate</td>
<td><input type="text" id="rate40_full_dg" name="rate40_full_dg" maxlength="18" value="<? echo str_replace('"', '&quot;', trim($row["rate40_full_dg"])) ?>"></td>
</tr>
<tr>
<td class="edit">RF20 Qty</td>
<td><input type="text" id="qty20_full_rf" name="qty20_full_rf" maxlength="5" value="<? echo str_replace('"', '&quot;', trim($row["qty20_full_rf"])) ?>"></td>
<td class="edit">Rate</td>
<td><input type="text" id="rate20_full_rf" name="rate20_full_rf" maxlength="18" value="<? echo str_replace('"', '&quot;', trim($row["rate20_full_rf"])) ?>"></td>
</tr>
<tr>
<td class="edit">RH40 Qty</td>
<td><input type="text" id="qty40_full_rh" name="qty40_full_rh" maxlength="5" value="<? echo str_replace('"', '&quot;', trim($row["qty40_full_rh"])) ?>"></td>
<td class="edit">Rate</td>
<td><input type="text" id="rate40_full_rh" name="rate40_full_rh" maxlength="18" value="<? echo str_replace('"', '&quot;', trim($row["rate40_full_rh"])) ?>"></td>
</tr>
<tr>
<td class="edit">Total Cost (user conclusion)</td>
<td><input type="text" id="cost_amount_manual" name="cost_amount_manual" maxlength="18" value="<? echo str_replace('"', '&quot;', trim($row["cost_amount_manual"])) ?>"></td>
</tr>
<tr>
<td class="edit">Recoverable Cost</td>
<td><input type="text" id="recover_cost" name="recover_cost" maxlength="18" value="<? echo str_replace('"', '&quot;', trim($row["recover_cost"])) ?>"></td>
</tr>
<tr>
<td class="edit">Explanation</td>
<td><textarea rows="4" cols="60" id="explanation" name="explanation"><? echo str_replace('"', '&quot;', trim($row["explanation"])) ?></textarea></td>
</tr>
<tr>
<td class="edit">Approver</td>
<td><div id="approverAutoComplete">
	<input type="text" name="approver_name" id="approver_name"  value="<? echo str_replace('"', '&quot;', trim($row["approver_name"])) ?>">	
	<div id="approverContainer"></div></td>
</tr>
<tr>
<td><input type="hidden" id="attachment_name" name="attachment_name" value="D:\EDI\PHP.INI"></td>
</tr>
<tr>
<td><input type="hidden" name="create_datetime" value="<? echo str_replace('"', '&quot;', trim($row["create_datetime"])) ?>"></td>
</tr>
<tr>
<td><input type="hidden" name="last_update_user" value="<? echo str_replace('"', '&quot;', trim($row["last_update_user"])) ?>"></td>
</tr>
<tr>
<td><input type="hidden" name="last_update_date" value="<? echo str_replace('"', '&quot;', trim($row["last_update_date"])) ?>"></td>
</tr>
</table>

<? } ?>


<? //add record 
  function showroweditor($row)
  {
  global $conn;
?>
<table class="tbl" border="0" cellspacing="1" cellpadding="5"width="80%">

<tr><input type="hidden" id="ac_reference" name="ac_reference" maxlength="50" value=""></td></tr>
<tr>
<td class="addhr">Principal</td>
<td>
	<select name="principal" size="1" id="principal">
	<option value='GSL'>GSL</option>
	<option selected value='ZIM'>ZIM</option>
	</select>
</td>
</tr>
<tr>
<td class="addhr">Vessel</td>
<td><div id="vesselAutoComplete">
	<input type="text" name="vessel" id="vessel" value="*" maxlength="3">	
	<div id="vesselContainer"></div>			
</tr></td>
<tr>
<td class="addhr">Voyage</td>
<td><div id="voyageAutoComplete">
	<input type="text" name="voyage" id="voyage" value="*">	
	<div id="voyageContainer"></div></td>
</tr>
<tr>
<td class="addhr">Leg</td>
<td><div id="legAutoComplete">
	<input type="text" name="leg" id="leg" value="*">	
	<div id="legContainer"></div></td>
</tr>
<tr>
<td class="addhr">Port</td>
<td><div id="portAutoComplete">
	<input type="text" name="port_code" id="port_code" value="*">	
	<div id="portContainer"></div></td>
</tr>
<tr>
<td class="addhr">Port Seq</td>
<td><input type="text" id="port_sequence" name="port_sequence" disabled value="1"></td>
</tr>
<tr>
<td class="addhr">Activity-Category</td>
<td>
<div id="itemGroupAutoComplete">
	<input type="text" name="item_group_code" id="item_group_code" value="101">	
	<div id="itemGroupContainer"></div></td>
</tr>
<tr>
<td class="addhr">Activity-Status</td>
<td>
<div id="itemTypeAutoComplete">
	<input type="text" name="item_type_code" id="item_type_code" value="A">	
	<div id="itemTypeContainer"></div></td>
</tr>
<tr>
<td class="addhr">Type</td>
<td>
<!--input type="text" id="type" name="type" maxlength="4" value="<? echo str_replace('"', '&quot;', trim($row["type"])) ?>"!-->
	<select name="type" size="1" id="type">
	<option selected value='MAIN'>MAIN</option>
	<option value='SUPP'>SUPP</option>
	</select>
</td>
</tr>
<tr>
<td class="addedit">Vessel Arrived Date (DD/MM/YYYY)</td>
<td>
<div id="arrDateAutoComplete">
	<input type="datetime" name="arrived_date" id="arrived_date" value="">	
	<div id="arrDateContainer"></div></td>
</tr>
<tr>
<td class="addedit">Vessel Sailed Date (DD/MM/YYYY)</td>
<td><div id="sailDateAutoComplete">
	<input type="text" name="sailed_date" id="sailed_date" value="">	
	<div id="sailDateContainer"></div></td>
</tr>
<tr>
<td class="addedit">Activity Date (DD/MM/YYYY)</td>
<td><input name="activity_date" id="activity_date"  value="<? echo str_replace('"', '&quot;', trim($row["arrived_date"])) ?>">&nbsp;
	<a href="javascript:NewCal('activity_date','ddmmyyyy',false,'24','English','/')"><img src="../ariacom/images/calendar.gif" width=16 height=16 border=0></a></td>
</tr>
<tr>
<td class="addedit">Issue Date </td><td class="dr"> <? echo str_replace('"', '&quot;', trim($row["arrived_date"])) ?></td>
<td><input type="hidden" name="date_of_issue" id="date_of_issue"  value="<? echo str_replace('"', '&quot;', trim($row["arrived_date"])) ?>">&nbsp;
	<!--a href="javascript:NewCal('date_of_issue','ddmmyyyy',false,'24','English','/')"><img src="../ariacom/images/calendar.gif" width=16 height=16 border=0></a!--></td>
</tr>
<tr>
<td class="addedit">Agent</td>
<td><div id="agentAutoComplete">
	<input type="text" name="agent_code" id="agent_code"  value="4420">	
	<div id="agentContainer"></div></td>
</tr>
<tr>
<td class="addedit">Vendor ***</td>
<td><div id="vendorAutoComplete">
	<input type="text" name="vendor_code" id="vendor_code" value="">	
	<div id="vendorContainer"></div></td>
</tr>
<tr>
<td class="addedit">Ship From (Zim PortCode)</style></td>
<td><input type="text" id="ship_from" name="ship_from" maxlength="30" value=""></td>
</tr>
<tr>
<td class="addedit">Ship For (Zim PortCode)</td>
<td><input type="text" id="ship_for" name="ship_for" maxlength="30" value=""></td>
</tr>
<tr>
<td class="addedit">Curr</td>
<td><div id="currAutoComplete">
	<input type="text" name="currency_code" id="currency_code"  value="HKD">	
	<div id="currContainer"></div></td>
</tr>
<tr>
<td class="addedit">ROE</td>
<td><input type="text" id="roe_to_usd" name="roe_to_usd" maxlength="10" value="7.8"></td>
</tr>
<tr>
<td class="addedit">Remark</td>
<td><input type="text" id="remarks" name="remarks" maxlength="50" value="remark"></td>
</tr>
<tr>
<td class="addedit">Statement Month (MM/YYYY)</td>
<td><input type="text" id="state_monyy" name="state_monyy" maxlength="7" value="<? echo str_replace('"', '&quot;', trim($row["state_monyy"])) ?>"></td>
</tr>
<tr>
<td class="addedit">DV20 Qty</td>
<td><input type="text" id="qty20_full_gp" name="qty20_full_gp" maxlength="5" value="0"></td>
<td class="addedit">Rate</td>
<td><input type="text" id="rate20_full_gp" name="rate20_full_gp" maxlength="18" value="0.0000"></td>
</tr>
<tr>
<td class="addedit">DV40 Qty</td>
<td><input type="text" id="qty40_full_gp" name="qty40_full_gp" maxlength="5" value="0"></td>
<td class="addedit">Rate</td>
<td><input type="text" id="rate40_full_gp" name="rate40_full_gp" maxlength="18" value="0.0000"></td>
</tr>
<tr>
<td class="addedit">DV45 Qty</td>
<td><input type="text" id="qty45_full_gp" name="qty45_full_gp" maxlength="5" value="0"></td>
<td class="addedit">Rate</td>
<td><input type="text" id="rate45_full_gp" name="rate45_full_gp" maxlength="18" value="0.0000"></td>
</tr>
<tr>
<td class="addedit">DG20 Qty</td>
<td><input type="text" id="qty20_full_dg" name="qty20_full_dg" maxlength="5" value="0"></td>
<td class="addedit">Rate</td>
<td><input type="text" id="rate20_full_dg" name="rate20_full_dg" maxlength="18" value="0.0000"></td>
</tr>
<tr>
<td class="addedit">DG40 Qty</td>
<td><input type="text" id="qty40_full_dg" name="qty40_full_dg" maxlength="5" value="0"></td>
<td class="addedit">Rate</td>
<td><input type="text" id="rate40_full_dg" name="rate40_full_dg" maxlength="18" value="0.0000"></td>
</tr>
<tr>
<td class="addedit">RF20 Qty</td>
<td><input type="text" id="qty20_full_rf" name="qty20_full_rf" maxlength="5" value="0"></td>
<td class="addedit">Rate</td>
<td><input type="text" id="rate20_full_rf" name="rate20_full_rf" maxlength="18" value="0.0000"></td>
</tr>
<tr>
<td class="addedit">RH40 Qty</td>
<td><input type="text" id="qty40_full_rh" name="qty40_full_rh" maxlength="5" value="0"></td>
<td class="addedit">Rate</td>
<td><input type="text" id="rate40_full_rh" name="rate40_full_rh" maxlength="18" value="0.0000"></td>
</tr>
<tr>
<td class="addedit">Total Cost (user conclusion)</td>
<td><input type="text" id="cost_amount_manual" name="cost_amount_manual" maxlength="18" value="0"></td>
</tr>
<tr>
<td class="addedit">Recoverable Cost</td>
<td><input type="text" id="recover_cost" name="recover_cost" maxlength="18" value="0"></td>
</tr>
<tr>
<td class="addedit">Explanation</td>
<td><textarea rows="4" cols="60" id="explanation" name="explanation"> </textarea></td>
</tr>
<tr>
<td class="addedit">Approver</td>
<td><div id="approverAutoComplete">
	<input type="text" name="approver_name" id="approver_name"  value="<? echo str_replace('"', '&quot;', trim($row["approver_name"])) ?>">	
	<div id="approverContainer"></div></td>
</tr>
<tr>
<td><input type="hidden" id="attachment_name" name="attachment_name" value="D:\EDI\PHP.INI"></td>
</tr>
<tr>
<input type="hidden" id="vessel_name" name="vessel_name" maxlength="10" value=" "></td>
<input type="hidden" id="trade" name="trade" value=" "></td>
<input type="hidden" id="territory" name="territory" maxlength="4" value=" "></td>
<input type="hidden" id="invalidated_reason" name="invalidated_reason" maxlength="50" value=" "></td>
<input type="hidden" id="freeze" name="freeze" maxlength="1" value="N"></td>
<input type="hidden" id="status" name="status" maxlength="1" value="N"></td>
<input type="hidden" id="invalid" name="invalid" maxlength="1" value="N"></td>
<input type="hidden" id="seth_ind" name="seth_ind" maxlength="1" value="N"></td>
<input type="hidden" id="dms_lock" name="dms_lock" maxlength="1" value="N"></td>
<input type="hidden" id="verification_type" name="verification_type" maxlength="1" value="N"></td>
<input type="hidden" id="source" name="source" value="MANUAL"></td>
<input type="hidden" id="commit_status" name="commit_status" value="RCVOK"></td>
<input type="hidden" name="create_datetime" value="<? echo str_replace('"', '&quot;', trim($row["create_datetime"])) ?>"></td>
<input type="hidden" name="last_update_user" value="<? echo str_replace('"', '&quot;', trim($row["last_update_user"])) ?>"></td>
<input type="hidden" name="last_update_date" value="<? echo str_replace('"', '&quot;', trim($row["last_update_date"])) ?>"></td>
</tr>

</table>
<?
  }
?>

<? function showpagenav($page, $pagecount,$ups)
{
?>
<table class="bd" border="0" cellspacing="1" cellpadding="4">
<tr>
<td><?if ($ups["create"]=="Y") {echo "<a href=\"ACS01.php?a=add\">Add Record</a>&nbsp;";}?></td>
<? if ($page > 1) { ?>
<td><a href="ACS01.php?page=<? echo $page - 1 ?>">&lt;&lt;&nbsp;Prev</a>&nbsp;</td>
<? } ?>
<?
  global $pagerange;

  if ($pagecount > 1) {

  if ($pagecount % $pagerange != 0) {
    $rangecount = intval($pagecount / $pagerange) + 1;
  }
  else {
    $rangecount = intval($pagecount / $pagerange);
  }
  for ($i = 1; $i < $rangecount + 1; $i++) {
    $startpage = (($i - 1) * $pagerange) + 1;
    $count = min($i * $pagerange, $pagecount);

    if ((($page >= $startpage) && ($page <= ($i * $pagerange)))) {
      for ($j = $startpage; $j < $count + 1; $j++) {
        if ($j == $page) {
?>
<td><b><? echo $j ?></b></td>
<? } else { ?>
<td><a href="ACS01.php?page=<? echo $j ?>"><? echo $j ?></a></td>
<? } } } else { ?>
<td><a href="ACS01.php?page=<? echo $startpage ?>"><? echo $startpage ."..." .$count ?></a></td>
<? } } } ?>
<? if ($page < $pagecount) { ?>
<td>&nbsp;<a href="ACS01.php?page=<? echo $page + 1 ?>">Next&nbsp;&gt;&gt;</a>&nbsp;</td>
<? } ?>
</tr>
</table>
<? } ?>

<? function showrecnav($a, $recid, $count)
{
?>
<table class="bd" border="0" cellspacing="1" cellpadding="4">
<tr>
<td><a href="ACS01.php">Listing of records</a></td>
</tr>
</table>
<hr size="1" noshade>
<? } ?>

<? function addrec($valid_user)
{
?>
<table class="bd" border="0" cellspacing="1" cellpadding="4">
<tr>
<td><a href="ACS01.php">Listing of records</a></td>
</tr>
</table>
<hr size="1" noshade>
<!--form action="ACS01.php" method="post"!-->
<form action="ACS01.php?a=add" method="post">
<h1>Add record</h1>
<p><input type="hidden" name="sql" value="insert">
<!--input type="button" name="clear" value="Clear parameters" onclick="displaymessage()"!-->
<input type="reset" name="clear" value="Clear parameters">
</p>
<?
$d_mon_yy="02/11";
//$d_principal="GSL";
$d_vessel="XYZ"; 
$d_voyage="111";
$d_leg="N";
$d_port_code="XXXXX"; //"MYPKL";
//$d_type="MAIN";
$d_item_gp="101";
$d_item_type="A";

$row = array(
  "ZVL_ID" => "",
  "principal" => $d_principal,	
  "vessel" => $d_vessel,
  "voyage" => $d_voyage,
  "leg" => $d_leg,
  "port_code" => $d_port_code,
  "port_sequence" => "1",
  "type" => $d_type,	
  "item_group_code" => $d_item_gp,
  "item_type_code" => $d_item_type,
  "state_monyy" =>  date("m/Y"),
  "arrived_date" => date("d/m/Y"),
  "create_datetime" => date("d/m/Y H:i:s"),
  "last_update_user" => $valid_user,
  "last_update_date" => date("d/m/Y H:i:s"));

showroweditor($row)
?>
<p><input type="submit" name="action" value="Submit"></p>
</form>
<? } ?>


<? function deleterec($recid)
{ 
  $res = sql_select();
  $count = sql_getrecordcount();
  odbc_fetch_row($res, $recid);
  $row = odbc_fetch_array($res);
  showrecnav("del", $recid, $count);
?>
<br>
<form action="ACS01.php" method="post">
<h1>Delete Record</h1>
<input type="hidden" name="sql" value="delete">
<input type="hidden" name="xzvl_id" value="<? echo $row["zvl_id"] ?>">
<? showrow($row) ?>
<p><input type="submit" name="action" value="Confirm"></p>
</form>
<?
  odbc_free_result($res);
} ?>


<? function editrec($recid, $valid_user, $filter, $filterfield)
{ 
  $res = sql_select();
//  echo "<span class=\"categoryText\">sp.</span>" . $res ; 

  $count = sql_getrecordcount();
 odbc_fetch_row($res, $recid);
  $row = odbc_fetch_array($res);


  showrecnav("edit", $recid, $count);

  if ($row["commit_status"]=='APPOK' or $row["commit_status"]=='CLOSE')
  {echo "<span class=\"categoryText\">Approved/Closed record Edit not allowed</span>";
  return;}   
//  echo "<span class=\"categoryText\">sp.</span>" . $row["applicant_name"] ; 
///*
  if (strtoupper($row["applicant_name"])!==strtoupper($valid_user))
  {echo "<span class=\"categoryText\">Only owner can edit the record!!!</span>";
  return;}   
//*/
?>
<table class="bd" border="0" cellspacing="1" cellpadding="4">
</table>
<!--form action="ACS01.php" method="post"!-->

<form action="ACS01.php?a=edit&recid=<? echo $recid ?>&filter=<? echo $filter ?>&filterfield=<? echo $filterfield ?>" method="post"  target="_top">

<h1>Edit Record</h1>
<input type="hidden" name="sql" value="edit">
<input type="hidden" name="xzvl_id" value="<? echo $row["zvl_id"] ?>">
<input type="hidden" name="commit_status" id="commit_status" value="<? echo $row["commit_status"] ?>">

<? editrow($row) ?>
<p><input type="submit" name="action" value="Save"></p>
<!--button onclick="sql_edit()">OK</button!-->

</form>
<?
  odbc_free_result($res);
} ?>



<? function connect()
{
  $conn = df_conn();
  return $conn;
}

function sqlvalue($val, $quote)
{
  if ($quote)
    $tmp = sqlstr($val);
  else
    $tmp = $val;
  if ($tmp == "")
    $tmp = "NULL";
  elseif ($quote)
    $tmp = "'".$tmp."'";
  return $tmp;
}

function sqlstr($val)
{
  return str_replace("'", "''", $val);
}

function sql_select()
{global $filter;
  $filterstr = sqlstr($filter);
  
  global $filterfield;
  
  global $conn;
 
  $sql = "SELECT TOP 20 h.ZVL_ID as zvl_id
      ,h.principal as  principal
      ,h.vessel as vessel
      ,h.voyage as voyage
      ,h.leg as leg
      ,h.port_code as port_code
      ,h.port_sequence as port_sequence
      ,convert(char, h.arrived_date, 103) as arrived_date
      ,h.type as type
      ,convert(char,h.sailed_date, 103) as sailed_date
      ,h.trade as trade
      ,h.ship_from as ship_from
      ,h.ship_for as ship_for
      ,convert(char, h.date_of_issue, 103) as date_of_issue
      ,h.currency_code as currency_code
      ,h.agent_code as agent_code
      ,h.vessel_name as vessel_name
      ,h.roe_to_usd as roe_to_usd
      ,h.freeze as freeze
      ,h.status as status
      ,h.remarks as remarks
      ,h.invalid as invalid
      ,h.invalidated_reason as invalidated_reason
, case when substring(isnull(rtrim(ac_reference),''),1,2)<>'AC' then '' else ac_reference end ac_reference
      ,h.source as source
      ,h.territory as territory
      ,h.seth_ind as seth_ind
      ,h.dms_lock as dms_lock
      ,h.verification_type as verification_type
      ,LEFT(convert(nvarchar(10),h.statement_monyy,101),2)+'/'+RIGHT(convert(nvarchar(10),h.statement_monyy,103),4) as state_monyy
      ,convert(char, h.activity_date, 103) as activity_date
      ,h.item_group_code  as item_group_code
      ,h.item_type_code as item_type_code
      ,h.vendor_code as vendor_code
      ,h.qty20_full_gp as qty20_full_gp
      ,h.qty40_full_gp as qty40_full_gp
      ,h.qty45_full_gp as qty45_full_gp
      ,h.qty20_full_dg as qty20_full_dg
      ,h.qty40_full_dg as qty40_full_dg
      ,h.qty20_full_rf as qty20_full_rf
      ,h.qty40_full_rh as qty40_full_rh
      ,h.rate20_full_gp as rate20_full_gp
      ,h.rate40_full_gp as rate40_full_gp
      ,h.rate45_full_gp as rate45_full_gp
      ,h.rate20_full_dg as rate20_full_dg
      ,h.rate40_full_dg as rate40_full_dg
      ,h.rate20_full_rf as rate20_full_rf
      ,h.rate40_full_rh as rate40_full_rh
      ,h.cost_amount_manual as cost_amount_manual
      ,h.recover_cost as recover_cost
      ,h.explanation as explanation
      ,h.attachment_name as attachment_name
      ,h.create_datetime as create_datetime
      ,h.commit_status as commit_status
      ,h.applicant_name as applicant_name
      ,ltrim(rtrim(h.applicant_name)) as applicant_name
      ,ltrim(rtrim(h.approver_name)) as approver_name
      ,h.last_update_date as last_update_date
      ,h.last_update_user as last_update_user
,principal+rtrim(vessel)+rtrim(voyage)+rtrim(leg)+rtrim(port_code)+ltrim(rtrim(convert(varchar,port_sequence)))+rtrim(type)+ltrim(rtrim(convert(varchar,type_seq)))+rtrim(item_group_code)+rtrim(item_type_code) as track_id
  FROM dbo.tb_ac_report_header h ";

   if (isset($filterstr) && $filterstr!='' && isset($filterfield) && $filterfield!='') {
    $tmp_filterfield=$filterfield;
	$tmp_filterstr=$filterstr;
	if ($filterfield=="state_monyy") {
	$tmp_filterfield="statement_monyy";
	/*$split_date=split ('/',$filterstr);
	$tmp_filterstr =  "01/".$split_date[0]."/".$split_date[1];
	*/
	$split_date=split ('/',$filterstr);
	$tmp_filterstr =  $split_date[1]."/".$split_date[0]."/01";
	}

	if ($filterfield=="track_id") {
	$tmp_filterfield=" ( principal+rtrim(vessel)+rtrim(voyage)+rtrim(leg)+rtrim(port_code)+ltrim(rtrim(convert(varchar,port_sequence)))+rtrim(type)+ltrim(rtrim(convert(varchar,type_seq)))+rtrim(item_group_code)+rtrim(item_type_code) ) ";
	}
  $sql .= " where " .sqlstr($tmp_filterfield) ." = '" .$tmp_filterstr ."'";

//  $sql .= " WHERE " .sqlstr("h".$tmp_filterfield) ." = '" .$tmp_filterstr ."'";
//echo "<span class=\"categoryText\">sp.</span>" . $sql ; 
//return;	

  } 
	$sql .=" order by last_update_date desc";
  $res = odbc_exec($conn,$sql);
    $row = odbc_fetch_array($res);

return $res;
//  return $row;

}

function sql_getrecordcount()
{ global $filter;
  $filterstr = sqlstr($filter);
  
  global $filterfield;
  
  global $conn;
  $sql = "select count(zvl_id) 
			from dbo.tb_ac_report_header
			where zvl_id in (select top 20 zvl_id from dbo.tb_ac_report_header 	";
  
    if (isset($filterstr) && $filterstr!='' && isset($filterfield) && $filterfield!='') {
    $tmp_filterfield=$filterfield;
	$tmp_filterstr=$filterstr;
	if ($filterfield=="state_monyy") {
	$tmp_filterfield="statement_monyy"; 
	$split_date=split ('/',$filterstr);
	$tmp_filterstr =  $split_date[1]."/".$split_date[0]."/01"; }

	if ($filterfield=="track_id") {
	$tmp_filterfield=" ( principal+rtrim(vessel)+rtrim(voyage)+rtrim(leg)+rtrim(port_code)+ltrim(rtrim(convert(varchar,port_sequence)))+rtrim(type)+ltrim(rtrim(convert(varchar,type_seq)))+rtrim(item_group_code)+rtrim(item_type_code) ) "; }

    $sql .= " where " .sqlstr($tmp_filterfield) ." = '" .$tmp_filterstr ."'";
  } 
   $sql .= " ) " ;

//  echo "<span class=\"categoryText\">sp.</span>" . $sql ; 

  $res = odbc_exec($conn,$sql);
  $row = odbc_fetch_array($res);
  reset($row);
  return current($row);
}


function sql_insert()
{
  global $conn;
  global $_POST;

  if (//$_POST["mon_yy"]=="" or
  $_POST["principal"]==""
  or $_POST["vessel"]==""
  or $_POST["voyage"]==""
  or $_POST["leg"]=="" 
  or $_POST["port_code"]==""
//  or $_POST["port_sequence"]=="" 
  or $_POST["type"]=="" 
  or $_POST["item_group_code"]=="" 
  or $_POST["item_type_code"]=="" 
  )
  {echo "Missing value!!!" ;
  return;}


  $in_vessel = substr($_POST["vessel"],0,3); 
  $in_vessel_name = substr($_POST["vessel"],6);
  $in_item_group = substr($_POST["item_group_code"],0,3); 
  $in_item_type = substr($_POST["item_type_code"],0,2);
  $in_agent = split('-',@$_POST["agent_code"]);
  $in_vendor = split('-',@$_POST["vendor_code"]);

  $state_monyy=  "01/".$_POST["state_monyy"];  

 //echo $state_monyy; return;
 
  if (check_dt($state_monyy)==FALSE)
	{echo "<span class=\"categoryText\">Incorrect Statement Month '".$_POST["state_monyy"]."' or Format (MM/YYYY). Please input again!</span>";
	return;
	}	 
 

	$in_ind = "A";
	$in_pri=strtoupper(@$_POST["principal"]);  
//	$in_vessel=strtoupper(@$_POST["vessel"]);
	$in_voyage=strtoupper(@$_POST["voyage"]);
	$in_leg=strtoupper(@$_POST["leg"]);
	$in_port_code=strtoupper(@$_POST["port_code"]);
	$in_last_update_user=strtoupper(@$_POST["last_update_user"]);


$proc="dbo.p_ac_header_ins";

$sql = "Declare @para_message nvarchar(300),@return_value int; set @para_message=null;
exec @return_value = $proc ".sqlvalue($in_ind, true).", 0, ".sqlvalue($in_pri, true).", ".sqlvalue($in_vessel, true).", " .sqlvalue($in_voyage, true).", " .sqlvalue($in_leg, true).", " .sqlvalue($in_port_code, true) .", " .sqlvalue('1', false) .", " .sqlvalue(format_in_yyyymmdd(@$_POST["arrived_date"]), true) .", " .sqlvalue(@$_POST["type"], true) .", " .sqlvalue(format_in_yyyymmdd(@$_POST["sailed_date"]), true) .", " .sqlvalue(@$_POST["ship_from"], true) .", "  .sqlvalue(@$_POST["ship_for"], true) .", " .sqlvalue(format_in_yyyymmdd(@$_POST["date_of_issue"]), true).", " .sqlvalue(@$_POST["currency_code"], true).", " .sqlvalue($in_agent[0], false) .", " .sqlvalue(@$_POST["roe_to_usd"], false) .", " .sqlvalue(@$_POST["remarks"], true).", " .sqlvalue(@$_POST["invalidated_reason"], true) .", "  .sqlvalue(@$_POST["ac_reference"], true) .", " .sqlvalue(@$_POST["source"], true) .", " .sqlvalue(format_in_yyyymmdd($state_monyy), true) .", "  .sqlvalue(format_in_yyyymmdd(@$_POST["activity_date"]), true) .", " .sqlvalue($in_item_group, true).", " .sqlvalue($in_item_type, true).", " .sqlvalue($in_vendor[0], false).", " .sqlvalue(@$_POST["qty20_full_gp"], false).", " .sqlvalue(@$_POST["qty40_full_gp"], false).", ".sqlvalue(@$_POST["qty45_full_gp"], false).", ".sqlvalue(@$_POST["qty20_full_dg"], false).", " .sqlvalue(@$_POST["qty40_full_dg"], false).", ".sqlvalue(@$_POST["qty20_full_rf"], false).", ".sqlvalue(@$_POST["qty40_full_rh"],false).", " .sqlvalue(@$_POST["rate20_full_gp"], false).", ".sqlvalue(@$_POST["rate40_full_gp"],false).", ".sqlvalue(@$_POST["rate45_full_gp"],false).", " .sqlvalue(@$_POST["rate20_full_dg"],false).", ".sqlvalue(@$_POST["rate40_full_dg"],false).", ".sqlvalue(@$_POST["rate20_full_rf"],false).", ".sqlvalue(@$_POST["rate40_full_rh"],false).", ".sqlvalue(@$_POST["cost_amount_manual"],false).", ".sqlvalue(@$_POST["recover_cost"],false).", ".sqlvalue(@$_POST["explanation"], true).", ".sqlvalue($in_last_update_user, true).", ".sqlvalue($in_last_update_user, true).", ".sqlvalue(@$_POST["approver_name"], true).", @para_message OUTPUT ;
SELECT @para_message AS N'@message', @return_value AS N'@Return Value' ;
" ;
/*
echo "<span class=\"categoryText\">sp.</span>" . $sql ; 
return;
*/
/*
$res = runStoredProc($sql);
if(!$res)
{return;
	echo "<span class=\"categoryText\">sp.</span>" . $sql ; 
    die('MSSQL error!!!');
}
//echo $res["@message"]."\n\n";
 echo "<span class=\"categoryText\">Record added successfully as 1st row.</span>";
*/


$sp = odbc_prepare ($conn, $sql); 
$res = odbc_execute($sp); 

$message = odbc_result($sp, '@message') ;

//echo"<span class=\"categoryText\">".$message."</span>";
echo "<script>confirm('$message')</script>";
return;
//odbc_close( $con );

}

function sql_delete($valid_user)
{
  global $conn;
  global $_POST;
  
  $sql = "select * from dbo.tb_ac_report_header where " ."(ZVL_ID =" .sqlvalue(@$_POST["xzvl_id"], false) .")";
  $isOwner=FALSE;
  $res=odbc_exec($conn,$sql);
  while ($qry = odbc_fetch_array($res)) {
		$tmpOwner=$qry[last_update_user];
		if (strtoupper($tmpOwner)==strtoupper($valid_user)) {$isOwner=TRUE;}
	  } 

if ($isOwner==FALSE) {
  echo "<span class=\"categoryText\">Only owner can delete the registered record!!!</span>";
  return;
}
  
  $sql = "delete from dbo.tb_ac_report_header where " ."(ZVL_ID=" .sqlvalue(@$_POST["xzvl_id"], false) .")";

   odbc_exec($conn,$sql);
   echo "<span class=\"categoryText\">Record deleted.</span>";
}

function sql_edit($valid_user)
{
  global $conn;
  global $_POST;
/*

	{echo "<span class=\"categoryText\"> xzvl_id =  '".$_POST["xzvl_id"]."'  </span>";
	return;
	}	 
*/
	
   $in_ind = "U";
   $in_pri=strtoupper(@$_POST["principal"]);  
   $in_vessel = substr($_POST["vessel"],0,3); 
   $in_voyage=strtoupper(@$_POST["voyage"]);
   $in_leg=strtoupper(@$_POST["leg"]);
   $in_port_code=strtoupper(@$_POST["port_code"]);
   $in_item_group = substr($_POST["item_group_code"],0,3); 
   $in_item_type = substr($_POST["item_type_code"],0,2);
   $in_agent = split('-',@$_POST["agent_code"]);
   $in_vendor = split('-',@$_POST["vendor_code"]);
   $in_last_update_user=strtoupper(@$_POST["last_update_user"]);

   $state_monyy=  "01/".$_POST["state_monyy"];  
   if (check_dt($state_monyy)==FALSE)
	{echo "<span class=\"categoryText\">Incorrect Statement Month '".$_POST["state_monyy"]."' or Format (MM-YY). Please input again!</span>";
	return;
	}	 
	
//   $conn = @odbc_pconnect("zimglobalda_qa0", "sahkg", "manager2008"); 
   
  $proc="dbo.p_ac_header_ins";

  $sql = "Declare @para_message nvarchar(300),@return_value int; set @para_message=null;
  exec @return_value = $proc ".sqlvalue($in_ind, true).",".sqlvalue($_POST["xzvl_id"], false).",".sqlvalue($in_pri, true).", ".sqlvalue($in_vessel, true).", " .sqlvalue($in_voyage, true).", " .sqlvalue($in_leg, true).", " .sqlvalue($in_port_code, true) .", " .sqlvalue('1', false) .", " .sqlvalue(format_in_yyyymmdd(@$_POST["arrived_date"]), true) .", " .sqlvalue(@$_POST["type"], true) .", " .sqlvalue(format_in_yyyymmdd(@$_POST["sailed_date"]), true) .", " .sqlvalue(@$_POST["ship_from"], true) .", "  .sqlvalue(@$_POST["ship_for"], true) .", " .sqlvalue(format_in_yyyymmdd(@$_POST["date_of_issue"]), true).", " .sqlvalue(@$_POST["currency_code"], true).", " .sqlvalue($in_agent[0], false) .", " .sqlvalue(@$_POST["roe_to_usd"], false) .", " .sqlvalue(@$_POST["remarks"], true).", " .sqlvalue(@$_POST["invalidated_reason"], true) .", "  .sqlvalue(@$_POST["ac_reference"], true) .", " .sqlvalue(@$_POST["source"], true) .", " .sqlvalue(format_in_yyyymmdd($state_monyy), true) .", "  .sqlvalue(format_in_yyyymmdd(@$_POST["activity_date"]), true) .", " .sqlvalue($in_item_group, true).", " .sqlvalue($in_item_type, true).", " .sqlvalue($in_vendor[0], false).", " .sqlvalue(@$_POST["qty20_full_gp"], false).", " .sqlvalue(@$_POST["qty40_full_gp"], false).", ".sqlvalue(@$_POST["qty45_full_gp"], false).", ".sqlvalue(@$_POST["qty20_full_dg"], false).", " .sqlvalue(@$_POST["qty40_full_dg"], false).", ".sqlvalue(@$_POST["qty20_full_rf"], false).", ".sqlvalue(@$_POST["qty40_full_rh"],false).", " .sqlvalue(@$_POST["rate20_full_gp"], false).", ".sqlvalue(@$_POST["rate40_full_gp"],false).", ".sqlvalue(@$_POST["rate45_full_gp"],false).", " .sqlvalue(@$_POST["rate20_full_dg"],false).", ".sqlvalue(@$_POST["rate40_full_dg"],false).", ".sqlvalue(@$_POST["rate20_full_rf"],false).", ".sqlvalue(@$_POST["rate40_full_rh"],false).", ".sqlvalue(@$_POST["cost_amount_manual"],false).", ".sqlvalue(@$_POST["recover_cost"],false).", ".sqlvalue(@$_POST["explanation"], true).", ".sqlvalue($valid_user, true).", ".sqlvalue($valid_user, true).", ".sqlvalue(@$_POST["approver_name"], true).", @para_message OUTPUT ;
 SELECT @para_message AS N'@message', @return_value AS N'@Return Value' ;
 " ;

 /*
 echo "<span class=\"categoryText\">sp.</span>" . $sql ; 
 return;
 */
 $sp = odbc_prepare ($conn, $sql); 
 $res = odbc_execute($sp); 
/*
 echo "<span class=\"categoryText\">sp.</span>" . $res ; 
 return;
*/
 $message = odbc_result($sp, '@message') ;
// prompt("Hello! I am an alert box!".$message);

echo "<script>confirm('$message')</script>";
return;
 
//echo"<span class=\"categoryText\">".$message."</span>";

// odbc_close( $con );
//return;


/*	echo "<span class=\"categoryText\">sp.</span>" . $sql ; 
return;

	$res = runStoredProc($sql);

	//echo $res["0"]["msg"]."\n\n";
//	return;

$query=odbc_exec($conn,$sql);
if(!$query)
{return;

    die('MSSQL error!!!');
}

 echo "<span class=\"categoryText\">Record updated successfully.</span>";
 */
}


?>


<script type="text/javascript">

acVessel = function() {
    var myDataSource = new YAHOO.util.XHRDataSource("../acs/autocomplete/acVessel.php");
    myDataSource.responseSchema = {
         recordDelim: "\n",
         fieldDelim: "\t"
    };
    myDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
    var myAutoComp = new YAHOO.widget.AutoComplete("vessel","vesselContainer",myDataSource);
	myAutoComp.maxResultsDisplayed=15;
    myAutoComp.minQueryLength = 0;  
	myAutoComp.queryDelay= 0;

	var counter=new Date();
	var Dom = YAHOO.util.Dom;
    myAutoComp.generateRequest = function(sQuery) {
        return "?&counter="+counter+"&principal="+Dom.get('principal').value+"&query="+ sQuery ;  
	}
    return {
        oDS: myDataSource,
        oAC: myAutoComp
    }
}();

acVoyage = function() {
    var myDataSource = new YAHOO.util.XHRDataSource("../acs/autocomplete/acVoyage.php");
    myDataSource.responseSchema = {
         recordDelim: "\n",
         fieldDelim: "\t"
    };
    myDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
    var myAutoComp = new YAHOO.widget.AutoComplete("voyage","voyageContainer",myDataSource);
	myAutoComp.maxResultsDisplayed=15;
    myAutoComp.minQueryLength = 0;  
	myAutoComp.queryDelay= 0;

	var counter=new Date();
	var Dom = YAHOO.util.Dom;
    myAutoComp.generateRequest = function(sQuery) {
        return "?&counter="+counter+"&principal="+Dom.get('principal').value+"&vessel="+Dom.get('vessel').value.substr(0,4)+"&query=" + sQuery ;  
	}	
    return {
        oDS: myDataSource,
        oAC: myAutoComp
    }
}();

acLeg = function() {
    var myDataSource = new YAHOO.util.XHRDataSource("../acs/autocomplete/acLeg.php");
    myDataSource.responseSchema = {
         recordDelim: "\n",
         fieldDelim: "\t"
    };
    myDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
    var myAutoComp = new YAHOO.widget.AutoComplete("leg","legContainer",myDataSource);
	myAutoComp.maxResultsDisplayed=8;
    myAutoComp.minQueryLength = 0;  
	myAutoComp.queryDelay= 0;
	
	var counter=new Date();
	var Dom = YAHOO.util.Dom;
    myAutoComp.generateRequest = function(sQuery) {
        return "?&counter="+counter+"&principal="+Dom.get('principal').value+"&vessel="+Dom.get('vessel').value.substr(0,4)+"&voyage="+
			Dom.get('voyage').value+"&query=" + sQuery ;  
	}
    return {
        oDS: myDataSource,
        oAC: myAutoComp
    }
}();

acPort = function() {
    var myDataSource = new YAHOO.util.XHRDataSource("../acs/autocomplete/acPort.php");
    myDataSource.responseSchema = {
         recordDelim: "\n",
         fieldDelim: "\t"
    };
    myDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
    var myAutoComp = new YAHOO.widget.AutoComplete("port_code","portContainer",myDataSource);
	myAutoComp.maxResultsDisplayed=8;
    myAutoComp.minQueryLength = 0;  
	myAutoComp.queryDelay= 0;
	
	var counter=new Date();
	var Dom = YAHOO.util.Dom;
    myAutoComp.generateRequest = function(sQuery) {
        return "?&counter="+counter+"&principal="+Dom.get('principal').value+"&vessel="+Dom.get('vessel').value.substr(0,4)+"&voyage="+Dom.get('voyage').value+"&leg="+Dom.get('leg').value+"&query=" + sQuery ;  
	}
    return {
        oDS: myDataSource,
        oAC: myAutoComp
    }
}();

/*
acTrade = function() {
    var myDataSource = new YAHOO.util.XHRDataSource("../acs/autocomplete/acTrade.php");
    myDataSource.responseSchema = {
         recordDelim: "\n",
         fieldDelim: "\t"
    };
    myDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
    var myAutoComp = new YAHOO.widget.AutoComplete("trade","tradeContainer",myDataSource);
	myAutoComp.maxResultsDisplayed=8;
    myAutoComp.minQueryLength = 0;  
	myAutoComp.queryDelay= 0;
	
	var counter=new Date();
	var Dom = YAHOO.util.Dom;
    myAutoComp.generateRequest = function(sQuery) {
        return "?&counter="+counter+"&principal="+Dom.get('principal').value+"&query="+ sQuery ;  
	}
    return {
        oDS: myDataSource,
        oAC: myAutoComp
    }
}();
*/

acArrDate = function() {
    var myDataSource = new YAHOO.util.XHRDataSource("../acs/autocomplete/acArrDate.php");
    myDataSource.responseSchema = {
         recordDelim: "\n",
         fieldDelim: "\t"
    };
    myDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
    var myAutoComp = new YAHOO.widget.AutoComplete("arrived_date","arrDateContainer",myDataSource);
	myAutoComp.maxResultsDisplayed=8;
    myAutoComp.minQueryLength = 0;  
	myAutoComp.queryDelay= 0;
	
	var counter=new Date();
	var Dom = YAHOO.util.Dom;
    myAutoComp.generateRequest = function(sQuery) {
        return "?&counter="+counter+"&principal="+Dom.get('principal').value+"&vessel="+Dom.get('vessel').value.substr(0,4)+"&voyage="+Dom.get('voyage').value+"&leg="+Dom.get('leg').value+"&port_code="+Dom.get('port_code').value ;  
	}
    return {
        oDS: myDataSource,
        oAC: myAutoComp
    }
}();

acSailDate = function() {
    var myDataSource = new YAHOO.util.XHRDataSource("../acs/autocomplete/acSailDate.php");
    myDataSource.responseSchema = {
         recordDelim: "\n",
         fieldDelim: "\t"
    };
    myDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
    var myAutoComp = new YAHOO.widget.AutoComplete("sailed_date","sailDateContainer",myDataSource);
	myAutoComp.maxResultsDisplayed=8;
    myAutoComp.minQueryLength = 0;  
	myAutoComp.queryDelay= 0;
	
	var counter=new Date();
	var Dom = YAHOO.util.Dom;
    myAutoComp.generateRequest = function(sQuery) {
        return "?&counter="+counter+"&principal="+Dom.get('principal').value+"&vessel="+Dom.get('vessel').value.substr(0,4)+"&voyage="+Dom.get('voyage').value+"&leg="+Dom.get('leg').value+"&port_code="+Dom.get('port_code').value ;  
	}
    return {
        oDS: myDataSource,
        oAC: myAutoComp
    }
}();

acItemGroup = function() {
    var myDataSource = new YAHOO.util.XHRDataSource("../acs/autocomplete/acItemGroup.php");
    myDataSource.responseSchema = {
         recordDelim: "\n",
         fieldDelim: "\t"
    };
    myDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
    var myAutoComp = new YAHOO.widget.AutoComplete("item_group_code","itemGroupContainer",myDataSource);
	myAutoComp.maxResultsDisplayed=20;
    myAutoComp.minQueryLength = 0;  
	myAutoComp.queryDelay= 0;
	
	var counter=new Date();
	var Dom = YAHOO.util.Dom;
    myAutoComp.generateRequest = function(sQuery) {
        return "?&counter="+counter+"&query=" + sQuery ;  
	}
    return {
        oDS: myDataSource,
        oAC: myAutoComp
    }
}();

acItemType = function() {
    var myDataSource = new YAHOO.util.XHRDataSource("../acs/autocomplete/acItemType.php");
    myDataSource.responseSchema = {
         recordDelim: "\n",
         fieldDelim: "\t"
    };
    myDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
    var myAutoComp = new YAHOO.widget.AutoComplete("item_type_code","itemTypeContainer",myDataSource);
	myAutoComp.maxResultsDisplayed=8;
    myAutoComp.minQueryLength = 0;  
	myAutoComp.queryDelay= 0;
	
	var counter=new Date();
	var Dom = YAHOO.util.Dom;
    myAutoComp.generateRequest = function(sQuery) {
        return "?&counter="+counter+"&query=" + sQuery ;  
	}
    return {
        oDS: myDataSource,
        oAC: myAutoComp
    }
}();

acAgent = function() {
    var myDataSource = new YAHOO.util.XHRDataSource("../acs/autocomplete/acAgent.php");
    myDataSource.responseSchema = {
         recordDelim: "\n",
         fieldDelim: "\t"
    };
    myDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
    var myAutoComp = new YAHOO.widget.AutoComplete("agent_code","agentContainer",myDataSource);
	myAutoComp.maxResultsDisplayed=25;
    myAutoComp.minQueryLength = 0;  
	myAutoComp.queryDelay= 0;
	
	var counter=new Date();
	var Dom = YAHOO.util.Dom;
    myAutoComp.generateRequest = function(sQuery) {
        return "?&counter="+counter+"&principal="+Dom.get('principal').value+"&port_code="+Dom.get('port_code').value+"&query=" + sQuery ;  
	}
    return {
        oDS: myDataSource,
        oAC: myAutoComp
    }
}();

acVendor = function() {
    var myDataSource = new YAHOO.util.XHRDataSource("../acs/autocomplete/acVendor.php");
    myDataSource.responseSchema = {
         recordDelim: "\n",
         fieldDelim: "\t"
    };
    myDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
    var myAutoComp = new YAHOO.widget.AutoComplete("vendor_code","vendorContainer",myDataSource);
	myAutoComp.maxResultsDisplayed=8;
    myAutoComp.minQueryLength = 0;  
	myAutoComp.queryDelay= 0;
	
	var counter=new Date();
	var Dom = YAHOO.util.Dom;
    myAutoComp.generateRequest = function(sQuery) {
        return "?&counter="+counter+"&agent_code="+Dom.get('agent_code').value.substr(0,4)+"&query=" + sQuery ;  
	}
    return {
        oDS: myDataSource,
        oAC: myAutoComp
    }
}();

acCurr = function() {
    var myDataSource = new YAHOO.util.XHRDataSource("../acs/autocomplete/acCurr.php");
    myDataSource.responseSchema = {
         recordDelim: "\n",
         fieldDelim: "\t"
    };
    myDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
    var myAutoComp = new YAHOO.widget.AutoComplete("currency_code","currContainer",myDataSource);
	myAutoComp.maxResultsDisplayed=15;
    myAutoComp.minQueryLength = 0;  
	myAutoComp.queryDelay= 0;
	
	var counter=new Date();
	var Dom = YAHOO.util.Dom;
    myAutoComp.generateRequest = function(sQuery) {
        return "?&counter="+counter+"&query=" + sQuery ;  
	}
    return {
        oDS: myDataSource,
        oAC: myAutoComp
    }
}();

acApprover = function() {
    var myDataSource = new YAHOO.util.XHRDataSource("../acs/autocomplete/acApprover.php");
    myDataSource.responseSchema = {
         recordDelim: "\n",
         fieldDelim: "\t"
    };
    myDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
    var myAutoComp = new YAHOO.widget.AutoComplete("approver_name","approverContainer",myDataSource);
	myAutoComp.maxResultsDisplayed=25;
    myAutoComp.minQueryLength = 0;  
	myAutoComp.queryDelay= 0;
	
	var counter=new Date();
	var Dom = YAHOO.util.Dom;
    myAutoComp.generateRequest = function(sQuery) {
        return "?&counter="+counter+"&agent_code="+Dom.get('agent_code').value.substr(0,4)+"&item_group_code="+Dom.get('item_group_code').value.substr(0,3)+"&item_type_code="+Dom.get('item_type_code').value.substr(0,2)+"&cost_amount_manual="+Dom.get('cost_amount_manual').value+"&recover_cost="+Dom.get('recover_cost').value+"&roe_to_usd="+Dom.get('roe_to_usd').value+"&query=" + sQuery ;  
	}
    return {
        oDS: myDataSource,
        oAC: myAutoComp
    }
}();


</script>

Open in new window

0
 
kenfcampCommented:
I'd look in these files

require_once("..\lib\db_fns.php");
require_once("..\lib\general.php");
require_once("..\lib\define_cons.php");
require_once("..\adm\user_auth_fns.php"); 
require_once("..\adm\output_fns.php");
require_once("..\lib\include_fns.php");
require_once("..\lib\display_page.php");

Open in new window


If I didn't find it in these, I'd start looking in the .js files

Searching for "you must enter" should be enough to find the file in question
0
 
Ryan ChongCommented:
try check: ../acs/autocomplete/acVessel.php
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.