<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/displaytag-12.tld" prefix="display" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="http://ajaxtags.org/tags/ajax" prefix="ajax" %>
<%@ page import="com.ampiere.util.AmpiereUtil" %>
<jsp:include page="/ampiere/jsp/common/includeYAHOOUI.jsp" flush="true" /> 
<html>
<head>
<title><bean:write name="searchInfoFormProduct" property="title"/></title>
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/ampiere/css/import.css" />
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/ampiere/css/window.css"/>
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/ampiere/css/displaytag.css" />
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/ampiere/css/displaytagFixed.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/ampiere/ajax/js/prototype-1.4.0.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/ampiere/ajax/js/scriptaculous.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/ampiere/ajax/js/overlibmws.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/ampiere/ajax/js/ajaxtags-1.2-beta1.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/ampiere/js/window.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/ampiere/js/search.js"></script>
<style type="text/css">
<!--
    #attributeSearch {
		padding-left: 10px;
		margin-top: 0;
		padding-top: 0;
		cursor: pointer;
    }
-->
</style>
<script type="text/javascript">
function productAttribute() {
    var url = "/compiere/ampiere/InfoPAttributeAction.do";
    url = encodeURI(url);
    var childWnd = openPopup(url, "ProductAttributeInfo", 500, 450, 0);
	childWndArray[childWndCount++] = childWnd;
}

function clearPASearch() {
	document.infoProductForm.paSearchFlag.value = "false";
	document.infoProductForm.paSearchWhere.value = "";
}
</script>
</head>

<%!
String getColTitle(Object obj, int idx) {
	if (obj == null) { return "&nbsp;"; } else { String s = AmpiereUtil.sanitizing(((com.ampiere.search.ColBean)obj).getColTitle(idx)); if (s == null || "".equals(s) || " ".equals(s)) { return "&nbsp;"; } else { return s; } }
}
String getColData(Object obj, int idx) {
	if (obj == null) { return "&nbsp;"; } else { Object o = (((com.ampiere.search.ColBean)obj).getColData(idx)); if (o == null) { return "&nbsp;"; } else { String s = AmpiereUtil.sanitizing(o.toString()); if (s == null || "".equals(s) || " ".equals(s)) { return "&nbsp;"; } else { return s; } } }
}
%>

<body id="popup" <% if ("1".equals(request.getAttribute("doQuery"))) { %> onload="doQuery();" <% } %> onunload="closeMyChildren();">

	<table cellspacing="0" width="100%" border="0" cellpadding="0">
	<tr>
	<td class="windowHeader">
<div id="header">
		<h1><bean:write name="searchInfoFormProduct" property="title"/></h1>
</div>
	</td>
    <td valign="top" width="18">
    <div id="progressMsg" style="padding-top:1px;display:none;"><img src="${pageContext.request.contextPath}/ampiere/images/Loading-0.gif" /></div>
    </td>
    </tr>
	</table>

<div id="body">
<div class="search-box">

    <html:form styleId="infoLookupForm" style="margin:0;" target="_self" action="/ampiere/InfoProductSearchAction.do" enctype="application/x-www-form-urlencoded" focus="value">
    	<div>
    	<html:hidden name="searchInfoFormProduct" property="windowNo"/>
    	<html:hidden name="searchInfoFormProduct" property="columnName"/>
    	<html:hidden name="searchInfoFormProduct" property="column_ID"/>
    	<html:hidden name="searchInfoFormProduct" property="paSearchFlag"/>
    	<html:hidden name="searchInfoFormProduct" property="paSearchWhere"/>
		</div>
        <table class="popupInfoTable" cellspacing="4" cellpadding="0" border="0">
        <tr>
            <th scope="row"><bean:write name="searchInfoFormProduct" property="valueLabel"/></th>
            <td><html:text name="searchInfoFormProduct" property="value" size="30" /></td>
            <th><bean:write name="searchInfoFormProduct" property="upcLabel"/></th>
            <td><html:text name="searchInfoFormProduct" property="upc" size="30" /></td>
            <th><bean:write name="searchInfoFormProduct" property="warehouseLabel"/></th>
            <td>
				<html:select property="warehouse" name="searchInfoFormProduct" style="width:200px;">
				<html:options collection="warehouseListProduct" property="code" labelProperty="value"/>
				</html:select>
	            <html:img styleId="attributeSearch" src="${pageContext.request.contextPath}/ampiere/images/PAttribute16.png" alt="Product Attribute" onclick="productAttribute();"/>
			</td>
		</tr>
		<tr>
            <th scope="row"><bean:write name="searchInfoFormProduct" property="nameLabel"/></th>
            <td><html:text name="searchInfoFormProduct" property="name" size="30" /></td>
            <th><bean:write name="searchInfoFormProduct" property="skuLabel"/></th>
            <td><html:text name="searchInfoFormProduct" property="sku" size="30" /></td>
            <th><bean:write name="searchInfoFormProduct" property="priceListVersionLabel"/></th>
            <td>
				<html:select property="priceListVersion" name="searchInfoFormProduct" style="width:200px;">
				<html:options collection="priceListProduct" property="code" labelProperty="value"/>
				</html:select>
            </td>
        </tr>
        <tr>
            <td colspan="6" class="button-box align-right" scope="row">
            <html:submit property="search" onclick="clearPASearch();initProgress();bCancel=false;"><bean:write name="searchInfoFormProduct" property="searchBtnTitle"/></html:submit>
            </td>
        </tr>
        </table>
    </html:form>
</div>


    <ajax:displayTag id="displayTagFrame" ajaxFlag="displayAjax">
      <display:table id="oneObject" name="searchResultProduct" class="displaytag" pagesize="10" scope="session"
        defaultsort="3" defaultorder="ascending" export="true" excludedParams="ajax" sort="list" cellpadding="0" cellspacing="0">
<logic:equal name="searchInfoFormProduct" property="viewOnly" value="N">
        <display:column title="<%=getColTitle(oneObject, 0)%>" media="html" class="align-center" sortable="false">
            <input type="radio" id="radioSelect" name="radioSelect" value="<bean:write name='oneObject' property='colId'/>________<bean:write name='oneObject' property='colName'/>" ondblclick="updateInfo('<bean:write name="searchInfoFormProduct" property="columnName"/>');return false;"/>
        </display:column>
</logic:equal>
        <%-- Discontinued --%>
        <display:column title="<%=getColTitle(oneObject, 1)%>" class="align-center"><%=getColData(oneObject, 1)%></display:column>
        <%-- Value --%>
        <display:column title="<%="&nbsp;&nbsp;" + getColTitle(oneObject, 2) + "&nbsp;&nbsp;"%>" sortable="true" headerClass="sortable"><%=getColData(oneObject, 2)%></display:column>
        <%-- Name --%>
        <display:column title="<%="&nbsp;&nbsp;" + getColTitle(oneObject, 3) + "&nbsp;&nbsp;"%>" sortable="true" headerClass="sortable"><%=getColData(oneObject, 3)%></display:column>
        <%-- Available --%>
        <display:column title="<%=getColTitle(oneObject, 4)%>" class="rightalign"><%=getColData(oneObject, 4)%></display:column>
        <%-- List price --%>
        <display:column title="<%=getColTitle(oneObject, 5)%>" class="rightalign"><%=getColData(oneObject, 5)%></display:column>
        <%-- Standard price --%>
        <display:column title="<%=getColTitle(oneObject, 6)%>" class="rightalign"><%=getColData(oneObject, 6)%></display:column>
        <%-- On hand quantity --%>
        <display:column title="<%=getColTitle(oneObject, 7)%>" class="rightalign"><%=getColData(oneObject, 7)%></display:column>
        <%-- Reserved quantity --%>
        <display:column title="<%=getColTitle(oneObject, 8)%>" class="rightalign"><%=getColData(oneObject, 8)%></display:column>
        <%-- Ordered quantity --%>
        <display:column title="<%=getColTitle(oneObject, 9)%>" class="rightalign"><%=getColData(oneObject, 9)%></display:column>
        <%-- Unconfirmed qty --%>
        <display:column title="<%=getColTitle(oneObject, 10)%>" class="rightalign"><%=getColData(oneObject, 10)%></display:column>
        <%-- Unconfirmed move --%>
        <display:column title="<%=getColTitle(oneObject, 11)%>" class="rightalign"><%=getColData(oneObject, 11)%></display:column>
        <%-- Margin --%>
        <display:column title="<%=getColTitle(oneObject, 12)%>" class="rightalign"><%=getColData(oneObject, 12)%></display:column>
        <%-- Limit price --%>
        <display:column title="<%=getColTitle(oneObject, 13)%>" class="rightalign"><%=getColData(oneObject, 13)%></display:column>
        <%-- Instance attribute --%>
        <display:column title="<%=getColTitle(oneObject, 14)%>" class="align-center"><%=getColData(oneObject, 14)%></display:column>
      </display:table>
    </ajax:displayTag>

<!-- body-footer -->
<div class="bottomMenuRight">
    <table>
    <tr>
    <td>
    <font color="#EE0000"><i><bean:write name='searchInfoFormProduct' property='largeRecords'/></i></font>
    </td>
    <td class="lbl" style="padding-right:5px;">
<logic:equal name="searchInfoFormProduct" property="viewOnly" value="N">
	<input id="ok" type="image" src="${pageContext.request.contextPath}/ampiere/images/Ok32.png" onclick="updateInfo('<bean:write name="searchInfoFormProduct" property="columnName"/>');return false;" alt="<bean:write name='searchInfoFormProduct' property='submitBtnTitle'/>"/>
</logic:equal>
	<input id="cancel" type="image" src="${pageContext.request.contextPath}/ampiere/images/Cancel32.png" onclick="window.close();return false;" alt="<bean:write name='searchInfoFormProduct' property='closeBtnTitle'/>"/>

    </td>
    </tr>
    </table>
</div>
<!-- /body-footer -->
</div>
<!-- /body -->
</body>
</html>