<%@ 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" 		%>
<jsp:include page="/ampiere/jsp/common/includeYAHOOUI.jsp" flush="true" /> 
<jsp:include page="/ampiere/jsp/common/includeCalendar.jsp" flush="true" /> 
<html>
<head>
	<title><bean:write name="MatchingForm" property="pageTitle"/></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" />
	<script type="text/javascript" src="${pageContext.request.contextPath}/ampiere/js/window.js"></script>
	<script type="text/javascript">
		top.document.title='<bean:write name="MatchingForm" property="mainWindowTitle"/>';
	</script>
</head>

<body id="main" onload="" onunload="closeMyChildren();">

<html:form	style	= "margin:0;"
			target	= "_self"
			action	= "/ampiere/MatchingAction.do"
			enctype	= "application/x-www-form-urlencoded"
			method	= "POST"
			onsubmit="document.getElementById('progressMsg').style.display='block'">

<html:hidden name="MatchingForm" property="changedColumn"/>
<input type="hidden" name="PCommand" value="MenuOnOff">
<html:hidden name="MatchingForm" property="matchFromCurrentId"/>
<html:hidden name="MatchingForm" property="matchFromCurrentLine"/>
<html:hidden name="MatchingForm" property="matchFromCurrentBusinessPartnerId"/>
<html:hidden name="MatchingForm" property="matchFromCurrentProductId"/>
<html:hidden name="MatchingForm" property="matchFromCurrentQuantity"/>
<html:hidden name="MatchingForm" property="matchFromCurrentMatchedQuantity"/>

<html:hidden name="MatchingForm" property="businessPartnerId"/>
<input id="C_BPartner_IDF" value="" name="C_BPartner_IDF" type="hidden"/>
<input	id="C_BPartner_IDD"
		value=""
		name="C_BPartner_IDD"
		type="hidden"
		onchange="document.MatchingForm.businessPartnerId.value=document.MatchingForm.C_BPartner_IDD.value;
				  document.MatchingForm.businessPartnerName.value=document.MatchingForm.C_BPartner_IDF.value;
				  document.MatchingForm.changedColumn.value='businessPartnerId';
			      document.MatchingForm.submit();
				 "
		/>

<html:hidden name="MatchingForm" property="productId"/>
<input id="M_Product_IDF" value="" name="M_Product_IDF" type="hidden"/>
<input	id="M_Product_IDD"
		value=""
		name="M_Product_IDD"
		type="hidden"
		onchange="document.MatchingForm.productId.value=document.MatchingForm.M_Product_IDD.value;
				  document.MatchingForm.productName.value=document.MatchingForm.M_Product_IDF.value;
				  document.MatchingForm.changedColumn.value='productId';
			      document.MatchingForm.submit();
				 "
		/>


	<table cellspacing="0" width="100%" border="0" cellpadding="0">
	<tr>
		<td>
		<div id="header">
			<h1><bean:write name="MatchingForm" property="pageTitle"/></h1>
		</div>
		</td>
	    <td valign="top" width="18">
	    	<div id="progressMsg" style="padding-top:1px;display:none;">
				<html:img alt="Wait a moment..." align="right" page = "/ampiere/images/Loading-0.gif"/>
	    	</div>
	    </td>
    </tr>
    <tr>
		<td>
			<img	src="/compiere/ampiere/images/MenuOnOff24.gif"
					onmouseout="btnMouseOut('MenuOnOff');"
					class="imgButton"
					id="MenuOnOff"
					name="MenuOnOff"
					onclick="document.MatchingForm.PCommand.value='MenuOnOff';menuSwitch();"
					alt="MenuOnOff"
					onmouseover="btnMouseOver('MenuOnOff');"/>
		</td>
    </tr>
	</table>


<!-- body -->
<div id="body" >
    <table class="popupInfoTable">
    <tr>
    	<td>&nbsp;</td>
    </tr>
    <tr>
    	<td align="center">
		    <table class="windowTable" align="left">
		    <tr>
			    <td align="right" valign="middle">
			    	<bean:write name='MatchingForm' property='matchFromLabel'/>
			    </td>
			    <td align="left" valign="middle">
			    	<html:select property="matchFrom"
			    				 styleClass="w240"
			    				 onchange="document.MatchingForm.changedColumn.value=this.name;
			    				 		   document.MatchingForm.submit();
			    				 		   ">
			    		<html:optionsCollection	name="MatchingForm"
			    								property="matchFromList"
			    								value="key"
			    								label="value"/>
			    	</html:select>
			    </td>
			    <td></td>
			    <td align="right" valign="middle">
			    	<bean:write name='MatchingForm' property='matchToLabel'/>
			    </td>
			    <td align="left" valign="middle">
			    	<html:select property="matchTo"			    				 
			    				 styleClass="w240"
			    				 onchange="">
			    		<html:optionsCollection	name="MatchingForm"
			    								property="matchToList"
			    								value="key"
			    								label="value"/>
			    	</html:select>
			    </td>
			    <td></td>
			    <td></td>
			    <td></td>
			    <td></td>
		    </tr>
		    <tr>
			    <td align="right" valign="middle">
			    	<bean:write name='MatchingForm' property='matchModeLabel'/>
			    </td>
			    <td align="left" valign="middle">
			    	<html:select property="matchMode"			    				 
			    				 styleClass="w240"
			    				 onchange="">
			    		<html:optionsCollection	name="MatchingForm"
			    								property="matchModeList"
			    								value="key"
			    								label="value"/>
			    	</html:select>
			    </td>
			    <td></td>
			    <td></td>
			    <td></td>
			    <td></td>
			    <td></td>
		    </tr>
		    <tr>
			    <td align="right" valign="middle" nowrap>
			    	<bean:write name='MatchingForm' property='businessPartnerLabel'/>
			    </td>
			    <td align="left" valign="middle">
			    	<html:text	name="MatchingForm"
			    				property="businessPartnerName"
			    				styleClass="w240"
								onchange="if ( this.value == '' ) {;
				    				 		  document.MatchingForm.businessPartnerId.value=0;
				    				 		  document.MatchingForm.changedColumn.value='businessPartnerId';
			    				 		  } else {
				    				 		  document.MatchingForm.changedColumn.value=this.name;
				    				 	  }
			    				 		  document.MatchingForm.submit();
			    				 		 "
			    				/>
			    </td>
			    <td align="left" valign="middle">
					<html:img	align="left"
								page = "/ampiere/images/BPartner16.png"
								onclick="startLookup('C_BPartner_ID',0,501,'C_BPartner_ID', 'N',null);
										 return false;
										"
								/>
			    </td>
			    <td align="right" valign="middle" nowrap>
			    	<bean:write name='MatchingForm' property='productLabel'/>
			    </td>
			    <td align="left" valign="middle">
			    	<html:text	name="MatchingForm"
			    				property="productName"
			    				styleClass="w240"
								onchange="if ( this.value == '' ) {;
				    				 		  document.MatchingForm.productId.value=0;
				    				 		  document.MatchingForm.changedColumn.value='productId';
			    				 		  } else {
				    				 		  document.MatchingForm.changedColumn.value=this.name;
				    				 	  }
			    				 		  document.MatchingForm.submit();
			    				 		 "
			    				/>
			    </td>
			    <td align="left" valign="middle">
					<html:img	align="left"
								page = "/ampiere/images/Product16.gif"
								onclick="startLookup('M_Product_ID',7,481,'M_Product_ID', 'N',null);
										 return false;
										"
								/>
			    </td>
			    <td></td>
		    </tr>
		    <tr>
			    <td align="right" valign="middle">
			    	<bean:write name='MatchingForm' property='dateFromLabel'/>
			    </td>
			    <td align="left" valign="middle">
			    	<html:text	name="MatchingForm"
			    				property="dateFrom"
			    				styleClass="w240"
			    				styleId = "startDateText"
			    				onchange="checkDateValidation(this, paraInvalidDateMsg);startUpdate(this);
										  document.PaymentSelectionForm.changedColumn.value=this.name;
				    				 	  document.PaymentSelectionForm.submit();
				    				 	  "/>
				</td>
				<td>
					<img	src="/compiere/ampiere/images/Calendar16.png"
							class="popupButton"
							name="DateSelectorFrom"
							id = "startDateImg"
							/>
					<div>
					<script type="text/javascript" language="JavaScript1.2">
					InputCalendar.createOnLoaded('startDateText',{format: 'yyyy/mm/dd',enableHourMinute: false,lang: 'ja',triggers: ['startDateImg'],inputReadOnly: true});
					</script>
					</div>
			    </td>
			    <td align="right" valign="middle">
			    	<bean:write name='MatchingForm' property='dateToLabel'/>
			    </td>
			    <td align="left" valign="middle">
			    	<html:text	name="MatchingForm"
			    				property="dateTo"
			    				styleId = "endDateText"
			    				styleClass="w240"
			    				onchange="checkDateValidation(this, paraInvalidDateMsg);startUpdate(this);
										  document.PaymentSelectionForm.changedColumn.value=this.name;
				    				 	  document.PaymentSelectionForm.submit();
				    				 	  "/>
				</td>
				<td>
					<img	src="/compiere/ampiere/images/Calendar16.png"
							class="popupButton"
							name="DateSelectorTo"
							id = "endDateImg"
							/>
					<div>
					<script type="text/javascript" language="JavaScript1.2">
					InputCalendar.createOnLoaded('endDateText',{format: 'yyyy/mm/dd',enableHourMinute: false,lang: 'ja',triggers: ['endDateImg'],inputReadOnly: true});
					</script>
					</div>
			    </td>
			    <td>
					<html:button	property="search"
									onclick="document.MatchingForm.changedColumn.value=this.name;
			    				 			 document.MatchingForm.submit();
			    				 			">
						<bean:write name="MatchingForm" property="searchLabel"/>
					</html:button>
			    </td>
			</tr>
		    </table>
		</td>
    </tr>
    <tr>
    	<td align="center">
		    <table align="center" cellspacing="0" class="displaytag" border="0">
		    	<tr>
		    		<th colspan="2">
		    			<bean:write name="MatchingForm" property="matchFromText"/>
		    		</th>
		    	</tr>
			<logic:iterate	name="MatchingForm"
							id="data"
							property="matchFromDataList"
							scope="request"
							type="java.util.HashMap">
				<logic:equal name="data" property="RowType" value="title">
				<tr>
					<th>&nbsp;</th>
					<th><bean:write name="data" property="DocumentNo"/></th>
					<th><bean:write name="data" property="Date"/></th>
					<th><bean:write name="data" property="BusinessPartner"/></th>
					<th><bean:write name="data" property="Line"/></th>
					<th><bean:write name="data" property="Product"/></th>
					<th><bean:write name="data" property="Quantity"/></th>
					<th><bean:write name="data" property="Matched"/></th>
				</tr>
				</logic:equal>
				<logic:equal name="data" property="RowType" value="current">
				<tr class="current">
					<td>
						<img	src="/compiere/ampiere/images/Go.gif"
								class="imgButton"
								id="matchFromRowChanged"
								name="matchFromRowChanged"
								onclick='document.MatchingForm.changedColumn.value=this.name;
		    				 			 document.MatchingForm.matchFromCurrentId.value=<bean:write name="data" property="ID"/>;
		    				 			 document.MatchingForm.matchFromCurrentLine.value=<bean:write name="data" property="Line"/>;
		    				 			 document.MatchingForm.matchFromCurrentBusinessPartnerId.value=<bean:write name="data" property="BusinessPartnerId"/>;
		    				 			 document.MatchingForm.matchFromCurrentProductId.value=<bean:write name="data" property="ProductId"/>;
		    				 			 document.MatchingForm.matchFromCurrentQuantity.value=<bean:write name="data" property="Quantity"/>;
		    				 			 document.MatchingForm.matchFromCurrentMatchedQuantity.value=<bean:write name="data" property="Matched"/>;
		    				 			 document.MatchingForm.submit();
		    				 			'/>
					</td>
					<td><bean:write name="data" property="DocumentNo"/></td>
					<td><bean:write name="data" property="Date"/></td>
					<td><bean:write name="data" property="BusinessPartner"/></td>
					<td><bean:write name="data" property="Line"/></td>
					<td><bean:write name="data" property="Product"/></td>
					<td><bean:write name="data" property="Quantity"/></td>
					<td><bean:write name="data" property="Matched"/></td>
				</tr>
				</logic:equal>
				<logic:equal name="data" property="RowType" value="even">
				<tr class="even">
					<td>
						<img	src="/compiere/ampiere/images/Go.gif"
								class="imgButton"
								id="matchFromRowChanged"
								name="matchFromRowChanged"
								onclick='document.MatchingForm.changedColumn.value=this.name;
		    				 			 document.MatchingForm.matchFromCurrentId.value=<bean:write name="data" property="ID"/>;
		    				 			 document.MatchingForm.matchFromCurrentLine.value=<bean:write name="data" property="Line"/>;
		    				 			 document.MatchingForm.matchFromCurrentBusinessPartnerId.value=<bean:write name="data" property="BusinessPartnerId"/>;
		    				 			 document.MatchingForm.matchFromCurrentProductId.value=<bean:write name="data" property="ProductId"/>;
		    				 			 document.MatchingForm.matchFromCurrentQuantity.value=<bean:write name="data" property="Quantity"/>;
		    				 			 document.MatchingForm.matchFromCurrentMatchedQuantity.value=<bean:write name="data" property="Matched"/>;
		    				 			 document.MatchingForm.submit();
		    				 			'/>
					</td>
					<td><bean:write name="data" property="DocumentNo"/></td>
					<td><bean:write name="data" property="Date"/></td>
					<td><bean:write name="data" property="BusinessPartner"/></td>
					<td><bean:write name="data" property="Line"/></td>
					<td><bean:write name="data" property="Product"/></td>
					<td><bean:write name="data" property="Quantity"/></td>
					<td><bean:write name="data" property="Matched"/></td>
				</tr>
				</logic:equal>
				<logic:equal name="data" property="RowType" value="odd">
				<tr class="odd">
					<td>
						<img	src="/compiere/ampiere/images/Go.gif"
								class="imgButton"
								id="matchFromRowChanged"
								name="matchFromRowChanged"
								onclick='document.MatchingForm.changedColumn.value=this.name;
		    				 			 document.MatchingForm.matchFromCurrentId.value=<bean:write name="data" property="ID"/>;
		    				 			 document.MatchingForm.matchFromCurrentLine.value=<bean:write name="data" property="Line"/>;
		    				 			 document.MatchingForm.matchFromCurrentBusinessPartnerId.value=<bean:write name="data" property="BusinessPartnerId"/>;
		    				 			 document.MatchingForm.matchFromCurrentProductId.value=<bean:write name="data" property="ProductId"/>;
		    				 			 document.MatchingForm.matchFromCurrentQuantity.value=<bean:write name="data" property="Quantity"/>;
		    				 			 document.MatchingForm.matchFromCurrentMatchedQuantity.value=<bean:write name="data" property="Matched"/>;
		    				 			 document.MatchingForm.submit();
		    				 			'/>
					</td>
					<td><bean:write name="data" property="DocumentNo"/></td>
					<td><bean:write name="data" property="Date"/></td>
					<td><bean:write name="data" property="BusinessPartner"/></td>
					<td><bean:write name="data" property="Line"/></td>
					<td><bean:write name="data" property="Product"/></td>
					<td><bean:write name="data" property="Quantity"/></td>
					<td><bean:write name="data" property="Matched"/></td>
				</tr>
				</logic:equal>
			</logic:iterate>
		    	<tr>
		    		<td colspan="8" align="center" valign="middle" height="40">
		    			<html:checkbox	name="MatchingForm"
		    							property="sameBusinessPartner"
										onclick="document.MatchingForm.changedColumn.value=this.name;
		    				 			 		 document.MatchingForm.submit();
		    									">
		    				<bean:write name="MatchingForm" property="sameBusinessPartnerLabel"/>
		    			</html:checkbox>
		    			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		    			<html:checkbox	name="MatchingForm"
		    							property="sameProduct"
										onclick="document.MatchingForm.changedColumn.value=this.name;
		    				 			 		 document.MatchingForm.submit();
		    									">
		    				<bean:write name="MatchingForm" property="sameProductLabel"/>
		    			</html:checkbox>
		    			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		    			<html:checkbox	name="MatchingForm"
		    							property="sameQuantity"
										onclick="document.MatchingForm.changedColumn.value=this.name;
		    				 			 		 document.MatchingForm.submit();
		    									">
		    				<bean:write name="MatchingForm" property="sameQuantityLabel"/>
		    			</html:checkbox>
		    		</td>
		    	</tr>
		    	<tr>
		    		<th colspan="2">
		    			<bean:write name="MatchingForm" property="matchToText"/>
		    		</th>
		    	</tr>
			<logic:iterate	name="MatchingForm"
							id="data"
							property="matchToDataList"
							scope="request"
							type="java.util.HashMap">
				<logic:equal name="data" property="RowType" value="title">
				<tr>
					<th>&nbsp;</th>
					<th><bean:write name="data" property="DocumentNo"/></th>
					<th><bean:write name="data" property="Date"/></th>
					<th><bean:write name="data" property="BusinessPartner"/></th>
					<th><bean:write name="data" property="Line"/></th>
					<th><bean:write name="data" property="Product"/></th>
					<th><bean:write name="data" property="Quantity"/></th>
					<th><bean:write name="data" property="Matched"/></th>
				</tr>
				</logic:equal>
				<logic:equal name="data" property="RowType" value="even">
				<tr class="even">
					<td>
						<logic:equal name="data" property="disabled" value="true">
						<html:multibox	name="MatchingForm"
										property="matchToIdList"
		    							disabled="true">
							<bean:write name="data" property="ID"/>
						</html:multibox>
						</logic:equal>
						<logic:notEqual name="data" property="disabled" value="true">
						<html:multibox	name="MatchingForm"
										property="matchToIdList"
										onclick="document.MatchingForm.changedColumn.value=this.name;
		    				 			 		 document.MatchingForm.submit();
		    				 			 		">
							<bean:write name="data" property="ID"/>
						</html:multibox>
						</logic:notEqual>
					</td>
					<td><bean:write name="data" property="DocumentNo"/></td>
					<td><bean:write name="data" property="Date"/></td>
					<td><bean:write name="data" property="BusinessPartner"/></td>
					<td><bean:write name="data" property="Line"/></td>
					<td><bean:write name="data" property="Product"/></td>
					<td><bean:write name="data" property="Quantity"/></td>
					<td><bean:write name="data" property="Matched"/></td>
				</tr>
				</logic:equal>
				<logic:equal name="data" property="RowType" value="odd">
				<tr class="odd">
					<td>
						<logic:equal name="data" property="disabled" value="true">
						<html:multibox	name="MatchingForm"
										property="matchToIdList"
		    							disabled="true">
							<bean:write name="data" property="ID"/>
						</html:multibox>
						</logic:equal>
						<logic:notEqual name="data" property="disabled" value="true">
						<html:multibox	name="MatchingForm"
										property="matchToIdList"
										onclick="document.MatchingForm.changedColumn.value=this.name;
		    				 			 		 document.MatchingForm.submit();
		    				 			 		">
							<bean:write name="data" property="ID"/>
						</html:multibox>
						</logic:notEqual>
					</td>
					<td><bean:write name="data" property="DocumentNo"/></td>
					<td><bean:write name="data" property="Date"/></td>
					<td><bean:write name="data" property="BusinessPartner"/></td>
					<td><bean:write name="data" property="Line"/></td>
					<td><bean:write name="data" property="Product"/></td>
					<td><bean:write name="data" property="Quantity"/></td>
					<td><bean:write name="data" property="Matched"/></td>
				</tr>
				</logic:equal>
			</logic:iterate>
		    	<tr>
		    		<td colspan="8" align="center" valign="middle" height="40">
	    				<bean:write name="MatchingForm" property="toBeMatchedLabel"/>
		    			<html:text name="MatchingForm" property="toBeMatchedCount" readonly="true" size="10" style="text-align:right;"/>
		    			&nbsp;&nbsp;
	    				<bean:write name="MatchingForm" property="matchingLabel"/>
		    			<html:text name="MatchingForm" property="matchingCount" readonly="true" size="10" style="text-align:right;"/>
		    			&nbsp;&nbsp;
	    				<bean:write name="MatchingForm" property="matchDifferenceLabel"/>
		    			<html:text name="MatchingForm" property="matchDifferenceCount" readonly="true" size="10" style="text-align:right;"/>
		    			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

		    			<logic:notEqual name="MatchingForm" property="processButtonDisabled" value="true">
						<html:button	property="process"
										onclick="document.MatchingForm.changedColumn.value=this.name;
				    				 			 document.MatchingForm.submit();
				    				 			">
							<bean:write name="MatchingForm" property="processLabel"/>
						</html:button>
						</logic:notEqual>

		    			<logic:equal name="MatchingForm" property="processButtonDisabled" value="true">
						<html:button	property="process" disabled="true">
							<bean:write name="MatchingForm" property="processLabel"/>
						</html:button>
						</logic:equal>
		    		</td>
		    	</tr>
			</table>
    	</td>
    </tr>
    </table>
</div>
<!-- /body -->
</html:form>

</body>
</html>
