<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:decimal-format NaN="0"/>

<xsl:template match="/">

<html>
<script language="JavaScript" type="text/javascript">
<![CDATA[

var maxId = 0;
function gotBlur(obj) 
 {
	if((oldVal != obj.value) || (obj.ISCHANGED == "true"))
	{
		obj.ISCHANGED = "true"; 
	}
 }

function gotFocus( column )
{
	objCur=column.name; 
	oldVal=column.value; 
}
function upperCase(fieldId)
{

var fieldValue = document.getElementById(fieldId).value; 
document.getElementById(fieldId).value = fieldValue.toUpperCase();

}

function setItemFromPophelp()
{ 
	var seldbID ="";
	for( dbID = 1; dbID <= maxId; dbID++)
	{ 
			seldbID = dbID;
			itemCode = document.getElementById("DetailActCode."+dbID+".ITEM_CODE").value;
			itemDescr = document.getElementById("DetailActCode."+dbID+".ITEM_DESCR").value;
			unit= document.getElementById("DetailActCode."+dbID+".UNIT").value;
			detail2dom= document.getElementById("DetailActCode."+dbID+".DOMID").value;
			bomCode = document.getElementById("DetailActCode."+dbID+".BOM_CODE").value;
			batchQty = document.getElementById("DetailActCode."+dbID+".BATCH_QTY").value;
		
		
	}
	if( itemCode == "" )
	{
		alert("No Selection Made ! \nPlease Select itemCode !");
	}
	else
	{	
	window.opener.setItemCodeOnchange(seldbID, itemCode,detail2dom); 
	window.opener.setItemDescrOnchange(seldbID, itemDescr,detail2dom);  
	window.opener.setUnitOnchange(seldbID, unit,detail2dom);
	window.opener.setBomCodeOnchange(seldbID, bomCode,detail2dom);
	window.opener.setBatchQtyOnchange(seldbID, batchQty,detail2dom);
	window.close();
	
	}
}
function searchItem()
{
	var itemCode  ="";
	
	itemCode = document.getElementById("SEARCH_ITEM").value;
	siteCode = document.getElementById("site_code").value;
	detail2dom = document.getElementById("dbID").value;
	
	
	
	
}

function setChecked( obj )
{
	for( dbID = 1; dbID <= maxId; dbID++)
	{
		objCurr = document.getElementById("DetailActCode."+dbID+".selectbox");
		if( objCurr.value == 'true' )
		{
			objCurr.value ='false';
			objCurr.checked = false;
		}
	}
	if( obj.value == 'false' )
	{
		
		obj.value ='true';
		obj.checked = true;
	}
	else
	{
		obj.value = 'false';
		obj.checked = false;
	}
}

]]>
</script>
<body onload="setItemFromPophelp();">
<style type="text/css">

.tableClass
{margin-left:0px;margin-top:0px}

.header_td
{border:inset 0;background:#FFCCCC;font-family:verdana;font-size:9pt}

.input_editable
{border:inset 2;color:#102132;background:#D7E5F9;text-align:left;font-family:verdana;font-size:9pt}

.input_num_editable
{border:inset 2;color:#102132;background:#D7E5F9;text-align:right;font-family:verdana;font-size:9pt}

.td_leftAlign
{background:#D7E5F9;text-align:left;font-family:verdana;font-size:9pt}

.td_rightAlign
{background:#D7E5F9;text-align:right;font-family:verdana;font-size:9pt}

</style>

	<form name="Wizard_Activity" action="/ibase/webitm/jsp/ReqITMWizardItemCodeSet.jsp" method="post">

	<table class="tableClass" border="0" cellspacing="1" cellpadding="1">
	
		
		<tr>
			<td class="header_td" nowrap="true" valign="bottom" width="2%">
			</td>
		
			<td class="header_td" nowrap="true" valign="bottom" width="20%">
				<strong>Site Code</strong>
			</td>
			<td class="header_td" nowrap="true" valign="bottom" width="20%">
				<strong>Item Code</strong>
			</td>
			<td class="header_td" nowrap="true" valign="bottom" width="20%">
				<strong>Item Description</strong>
			</td>	
			<td class="header_td" nowrap="true" valign="bottom" width="20%">
				<strong>Unit</strong>
			</td>
			<td width="10%" class="header_td" nowrap="true" valign="bottom">
				<strong>Bom Code</strong>
			</td>
			<td width="10%" class="header_td" nowrap="true" valign="bottom">
				<strong>BATCH QUANTITY</strong>
			</td>
			
		</tr>

		<xsl:for-each select="//ITEM">
			<xsl:variable name="ITEM_CODE"><xsl:value-of select="ITEM_CODE"/></xsl:variable>
			<xsl:variable name="ITEM_DESCR"><xsl:value-of select="ITEM_DESCR"/></xsl:variable>
			<xsl:variable name="UNIT"><xsl:value-of select="UNIT"/></xsl:variable>
			<xsl:variable name="DOMID"><xsl:value-of select="DOMID"/></xsl:variable>
			<xsl:variable name="site_code"><xsl:value-of select="site_code"/></xsl:variable>
			<xsl:variable name="BOM_CODE"><xsl:value-of select="BOM_CODE"/></xsl:variable>
			<xsl:variable name="BATCH_QTY"><xsl:value-of select="BATCH_QTY"/></xsl:variable>
			<xsl:variable name="dbID"><xsl:value-of select="@domID"/></xsl:variable> 
			<SCRIPT>
				<![CDATA[ var qtyR ; qtyR ="]]>	<xsl:value-of select="$dbID"/>
				<![CDATA[";maxId= qtyR; ]]>
			</SCRIPT>
			<xsl:variable name="chkbox"><xsl:value-of select="@selected"/></xsl:variable>
			<tr>
			
				<td class="td_leftAlign">
					<xsl:choose>
						<xsl:when test="$chkbox ='Y'">
							<input  type="checkbox"  name="selectbox" id="DetailActCode.{normalize-space($dbID)}.selectbox" checked='true' value="true" onClick="setChecked(this)"/>
						</xsl:when>	
						<xsl:otherwise>
							<input  type="checkbox"  name="selectbox" id="DetailActCode.{normalize-space($dbID)}.selectbox" value="false" onClick="setChecked(this)"/>
						</xsl:otherwise>
					</xsl:choose>		
				</td>
				<td class="td_leftAlign">
					<xsl:value-of select="site_code"/>
					<!-- <input  type="hidden"  name="site_code" id = "site_code" value="{normalize-space($site_code)}" size="20" class="fieldcell_items" ISCHANGED="false"/> -->
					<input  type="hidden"  name="Detail4.{normalize-space($dbID)}.site_code" id = "DetailActCode.{normalize-space($dbID)}.site_code" value="{normalize-space($site_code)}" size="20" class="fieldcell_items" ISCHANGED="false"/>
				</td>
				<td class="td_leftAlign">
					<xsl:value-of select="ITEM_CODE"/>
					<input  type="hidden"  name="Detail4.{normalize-space($dbID)}.ITEM_CODE" id = "DetailActCode.{normalize-space($dbID)}.ITEM_CODE" value="{normalize-space($ITEM_CODE)}" size="20" class="fieldcell_items" ISCHANGED="false"/>
				</td>
				<td class="td_leftAlign">
				
					<xsl:value-of select="ITEM_DESCR"/>
					<input  type="hidden"  name="Detail4.{normalize-space($dbID)}.ITEM_DESCR" id = "DetailActCode.{normalize-space($dbID)}.ITEM_DESCR" value="{normalize-space($ITEM_DESCR)}" size="20" class="fieldcell_items" ISCHANGED="false"/>
				</td>
				<td class="td_leftAlign">
				
					<xsl:value-of select="UNIT"/>
					<input  type="hidden"  name="Detail4.{normalize-space($dbID)}.UNIT" id = "DetailActCode.{normalize-space($dbID)}.UNIT" value="{normalize-space($UNIT)}" size="20" class="fieldcell_items" ISCHANGED="false"/>
				</td>
				<td class="td_leftAlign">
					<xsl:value-of select="BOM_CODE"/>
					<input  type="hidden"  name="Detail4.{normalize-space($dbID)}.BOM_CODE" id = "DetailActCode.{normalize-space($dbID)}.BOM_CODE" value="{normalize-space($BOM_CODE)}" size="20" class="fieldcell_items" ISCHANGED="false"/>
				</td>
				<td class="td_leftAlign">
					<xsl:value-of select="BATCH_QTY"/>
					<input  type="hidden"  name="Detail4.{normalize-space($dbID)}.BATCH_QTY" id = "DetailActCode.{normalize-space($dbID)}.BATCH_QTY" value="{normalize-space($BATCH_QTY)}" size="20" class="fieldcell_items" ISCHANGED="false"/>
				</td>
					<input  type="hidden"  name="Detail4.{normalize-space($dbID)}.DOMID" id = "DetailActCode.{normalize-space($dbID)}.DOMID" value="{normalize-space($DOMID)}" size="20" class="fieldcell_items" ISCHANGED="false"/>
				
					<!-- <input  type="hidden"  name="Detail4.{normalize-space($dbID)}.site_code" id = "DetailActCode.{normalize-space($dbID)}.site_code" value="{normalize-space($site_code)}" size="20" class="fieldcell_items" ISCHANGED="false"/> -->
			</tr>
		</xsl:for-each>
</table>
</form>
</body>

</html>
</xsl:template>
</xsl:stylesheet>

