<%@page import="java.rmi.RemoteException"%>
<%@page import="ibase.webitm.utility.ITMException"%>
<%@page contentType="text/html"%>
<%@page
	import="javax.xml.parsers.DocumentBuilderFactory,javax.xml.parsers.DocumentBuilder,org.w3c.dom.*"%>
<%@page import="ibase.utility.CommonConstants"%>
<%@page import="javax.naming.InitialContext"%>
<%@page import="javax.naming.Context"%>
<%@page import="org.w3c.dom.Node"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="org.w3c.dom.NodeList"%>
<%@page import="ibase.webitm.utility.GenericUtility"%>
<%@page import="ibase.webitm.bean.wms.*"%>
<jsp:useBean id = "replTaskBean" scope = "application" class = "ibase.webitm.bean.wms.ReplTaskBean" />	
<html>
<head>
<link rel="stylesheet" href="/ibase/wms/css/style.css"
	type="text/css" />
<link href="/ibase/jquery/css/jquery-ui.css" rel="stylesheet"
	type="text/css" />
<script src="/ibase/jquery/js/jquery.min.js"></script>
<script src="/ibase/jquery/js/jquery-ui.min.js"></script>
<script src="/ibase/jquery/js/jquery-1.9.1.js"></script>
<script src="/ibase/jquery/js/jquery-ui.js"></script>
<link rel="stylesheet" href="/ibase/webitm/css/default.css"
	type="text/css" />

<%!GenericUtility genericUtility = GenericUtility.getInstance();
	String xmlString = "";
	String objName = "";
	Document dom = null;
	NodeList dtlList = null;
	Node parentNode = null;
	NodeList childNodeList = null;
	Node currDetail = null;	
	String childNodeName = "";
	String replcreateCount ="";
	String replpendingCount = "";
	String replverifyCount = ""; 
	String pickcreateCount = "";
	String pickpendingCount = "";
	String pickverifyCount = "";
	String activecreateCount = "";
	String activependingCount = "";
	String activeverifyCount = "";
	String totalreplTasks = "";
	String totalpickTasks = "";
	String totalactiveTasks = "";
	String mpackcreateCount = "";
	String mpackpendingCount = "";
	String mpackverifyCount = "";
	String totalmpackTasks = "";
	String activereplcreateCount = ""; 
	String activereplpendingCount = "";
	String activereplverifyCount = ""; 
	String totalactivereplTasks = "";
	String mpickcreateCount = "";
	String mpickpendingCount = "";	
	String mpickverifyCount = "";	
	String totalmpickTasks = "";	
	String hazmetcreateCount = "";
	String hazmetpendingCount = "";
	String hazmetverifyCount = "";
	String totalhazmetTasks = "";
	NodeList rowList = null, stackList = null, columnList = null;
	Node childNode = null;
	Node rowNode = null, stackNode = null, columnNode = null;
	NodeList locationCodeList = null;
	Node locationNode = null;
	NodeList stockList = null;
%>
<%
	response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT");
	response.setHeader("Cache-Control", "no-store, no-cache,must-revalidate");
	response.addHeader("Cache-Control", "post-check=0, pre-check=0");
	response.setHeader("Pragma", "no-cache");
	int ctr = 0;	
%>

<%
	try 
   {
		System.out.println("in side try block xmlString["+xmlString+"]");
		if(xmlString == "" || xmlString == null)
		{
			System.out.println("CHECK");
			xmlString = replTaskBean.getTaskDetails();
			System.out.println("xmlString::::"+xmlString);
	    }
			
%>
</head>
<body>
<div>
	<table border = "1" align="left"  rel="stylesheet" class ="tableClass" >
		<tr>
			<th class = "tableHeaderBG">&nbsp Assign Task &nbsp </th>

			<th class = "tableHeaderBG">&nbsp Created &nbsp </th>

			<th class = "tableHeaderBG">&nbsp Held &nbsp </th>

			<th class = "tableHeaderBG">&nbsp Verified &nbsp </th>

			<th class = "tableHeaderBG">&nbsp Total Tasks &nbsp </th>
		</tr>

		          <% 
						if (xmlString != null && xmlString.trim().length() > 0) 
						{
								dom = genericUtility.parseString(xmlString);
								if (dom != null)
								{
									dtlList = dom.getElementsByTagName("Detail");
									for (int cntr = 0; cntr < dtlList.getLength(); cntr++) 
									{
										parentNode = dtlList.item(cntr);
										childNodeList = parentNode.getChildNodes();

										for (int nodCtr = 0; nodCtr < childNodeList .getLength(); nodCtr++) 
										{
											currDetail = childNodeList.item(nodCtr);
											childNodeName = currDetail.getNodeName();
											NodeList subChildNodeList = currDetail.getChildNodes();
											if(childNodeName != null && childNodeName.equalsIgnoreCase("Replenishments"))
											{
	
													for (int sCtr = 0; sCtr < subChildNodeList.getLength(); sCtr++) 
													{
														Node subChildNode = subChildNodeList.item(sCtr);
														String subchildNodeName = subChildNode.getNodeName();
														if (subchildNodeName.trim().equals("repl_create_count")) // Replenishment Tasks
														{
															replcreateCount = subChildNode.getFirstChild().getNodeValue();

															if (replcreateCount != "")
															{
																%>
																  <tr>
																  <td>&nbsp Replenishments &nbsp </td>
																  <td align = "right"><%=replcreateCount%></td>
																<%
															}
														}
														if (subchildNodeName.trim().equals("repl_pending_count"))
														{
															replpendingCount = subChildNode.getFirstChild().getNodeValue();

															if (replpendingCount != "")
															{
																%>
															  <td align = "right"><%=replpendingCount%></td>
															   <%
															}
														}
														if (subchildNodeName.trim().equals("repl_verify_count"))
														{
															replverifyCount = subChildNode.getFirstChild().getNodeValue();

															if (replverifyCount != "")
															{
																%>
															   <td align = "right"><%=replverifyCount%></td>
															   <%
															}
														}
														if (subchildNodeName.trim().equals("total_repl_tasks"))
														{
															totalreplTasks = subChildNode.getFirstChild().getNodeValue();

															if (totalreplTasks != "")
															{
																%>
															   <td align = "right"><%=totalreplTasks%></td>
															   </tr>
															   <%
															}
														}
													}
											}
											if(childNodeName != null && childNodeName.equalsIgnoreCase("Activereplenishments"))
											{
	
													for (int sCtr = 0; sCtr < subChildNodeList.getLength(); sCtr++) 
													{
														Node subChildNode = subChildNodeList.item(sCtr);
														String subchildNodeName = subChildNode.getNodeName();
														if (subchildNodeName.trim().equals("activerepl_create_count")) // Replenishment Tasks
														{
															activereplcreateCount = subChildNode.getFirstChild().getNodeValue();

															if (activereplcreateCount != "")
															{
																%>
																  <tr>
																  <td> &nbsp Active Replenishments &nbsp </td>
																  <td align = "right"><%=activereplcreateCount%></td>
																<%
															}
														}
														if (subchildNodeName.trim().equals("activerepl_pending_count"))
														{
															activereplpendingCount = subChildNode.getFirstChild().getNodeValue();

															if (activereplpendingCount != "")
															{
																%>
															  <td align = "right"><%=activereplpendingCount%></td>
															   <%
															}
														}
														if (subchildNodeName.trim().equals("activerepl_verify_count"))
														{
															activereplverifyCount = subChildNode.getFirstChild().getNodeValue();

															if (activereplverifyCount != "")
															{
																%>
															   <td align = "right"><%=activereplverifyCount%></td>
															   <%
															}
														}
														if (subchildNodeName.trim().equals("total_activerepl_tasks"))
														{
															totalactivereplTasks = subChildNode.getFirstChild().getNodeValue();

															if (totalactivereplTasks != "")
															{
																%>
															   <td align = "right"><%=totalactivereplTasks%></td>
															   </tr>
															   <%
															}
														}
													}
											}
											if(childNodeName != null && childNodeName.equalsIgnoreCase("pickings"))
											{
											
												
												for (int sCtr = 0; sCtr < subChildNodeList.getLength(); sCtr++) 
												{
												
													Node subChildNode = subChildNodeList.item(sCtr);
													String subchildNodeName = subChildNode.getNodeName();
														
													if (subchildNodeName.trim().equals("pick_create_count"))  //  pick tasks
													{
														pickcreateCount = subChildNode.getFirstChild().getNodeValue();

														if (pickcreateCount != "")
														{
															%>
															   <tr>
															   <td> &nbsp Case / Master / Parcel Picks &nbsp </td>
															   <td align = "right"><%=pickcreateCount%></td>
															<%
														}
													}
													if (subchildNodeName.trim().equals("pick_pending_count"))
													{
														pickpendingCount = subChildNode.getFirstChild().getNodeValue();

														if (pickpendingCount != "")
														{
															%>
														   <td align = "right"><%=pickpendingCount%></td>
														   <%
														}
													}
													if (subchildNodeName.trim().equals("pick_verify_count"))
													{
														pickverifyCount = subChildNode.getFirstChild().getNodeValue();

														if (pickverifyCount != "")
														{
															%>
														   <td align = "right"><%=pickverifyCount%></td>
														   <%
														}
													}
													if (subchildNodeName.trim().equals("total_pick_tasks"))
													{
														totalpickTasks = subChildNode.getFirstChild().getNodeValue();

														if (totalpickTasks != "")
														{
															%>
														   <td align = "right"><%=totalpickTasks%></td>
														   </tr>
														   <%
														}
													}
												}
											}
											if(childNodeName != null && childNodeName.equalsIgnoreCase("Activepickings"))
											{
											
												for (int sCtr = 0; sCtr < subChildNodeList.getLength(); sCtr++) 
												{
												
													Node subChildNode = subChildNodeList.item(sCtr);
													String subchildNodeName = subChildNode.getNodeName();
													
													if (subchildNodeName.trim().equals("active_create_count"))  //  pick tasks
													{
														activecreateCount = subChildNode.getFirstChild().getNodeValue();

														if (activecreateCount != "")
														{
															%>
															<tr>
															<td> &nbsp Active Picks &nbsp </td>
															<td align = "right"><%=activecreateCount%></td>
															<%
														}
													}
													if (subchildNodeName.trim().equals("active_pending_count"))
													{
														activependingCount = subChildNode.getFirstChild().getNodeValue();

														if (activependingCount != "")
														{
															%>
															<td align = "right"><%=activependingCount%></td>
															<%
														}
													}
													if (subchildNodeName.trim().equals("active_verify_count"))
													{
														activeverifyCount = subChildNode.getFirstChild().getNodeValue();

														if (activeverifyCount != "")
														{
															%>
															<td align = "right"><%=activeverifyCount%></td>	                                   
															<%
														}
													}
													if (subchildNodeName.trim().equals("total_active_tasks"))
													{
														totalactiveTasks = subChildNode.getFirstChild().getNodeValue();

														if (totalactiveTasks != "")
														{
															%>
														   <td align = "right"><%=totalactiveTasks%></td>
														   </tr>
														   <%
														}
													}
												}
											}
											if(childNodeName != null && childNodeName.equalsIgnoreCase("Masterpackings"))
											{
											
												for (int sCtr = 0; sCtr < subChildNodeList.getLength(); sCtr++) 
												{
												
													Node subChildNode = subChildNodeList.item(sCtr);
													String subchildNodeName = subChildNode.getNodeName();
													
													if (subchildNodeName.trim().equals("mpack_create_count"))  //  pick tasks
													{
														mpackcreateCount = subChildNode.getFirstChild().getNodeValue();

														if (mpackcreateCount != "")
														{
															%>
															<tr>
															<td> &nbsp Master Packs &nbsp </td>
															<td align = "right"><%=mpackcreateCount%></td>
															<%
														}
													}
													if (subchildNodeName.trim().equals("mpack_pending_count"))
													{
														mpackpendingCount = subChildNode.getFirstChild().getNodeValue();

														if (mpackpendingCount != "")
														{
															%>
															<td align = "right"><%=mpackpendingCount%></td>
															<%
														}
													}
													if (subchildNodeName.trim().equals("mpack_verify_count"))
													{
														mpackverifyCount = subChildNode.getFirstChild().getNodeValue();

														if (mpackverifyCount != "")
														{
															%>
															<td align = "right"><%=mpackverifyCount%></td>	                                   
															<%
														}
													}
													if (subchildNodeName.trim().equals("total_mpack_tasks"))
													{
														totalmpackTasks = subChildNode.getFirstChild().getNodeValue();

														if (totalmpackTasks != "")
														{
															%>
														   <td align = "right"><%=totalmpackTasks%></td>
														   </tr>
														   <%
														}
													}
												}
											}								       	
											if(childNodeName != null && childNodeName.equalsIgnoreCase("Hazmetpickings"))
											{
											
												for (int sCtr = 0; sCtr < subChildNodeList.getLength(); sCtr++) 
												{
												
													Node subChildNode = subChildNodeList.item(sCtr);
													String subchildNodeName = subChildNode.getNodeName();
													
													if (subchildNodeName.trim().equals("hazmet_create_count"))  //  pick tasks
													{
														hazmetcreateCount = subChildNode.getFirstChild().getNodeValue();

														if (hazmetcreateCount != "")
														{
															%>
															<tr>
															<td> &nbsp Hazmet Case Picks &nbsp </td>
															<td align = "right"><%=hazmetcreateCount%></td>
															<%
														}
													}
													if (subchildNodeName.trim().equals("hazmet_pending_count"))
													{
														hazmetpendingCount = subChildNode.getFirstChild().getNodeValue();

														if (hazmetpendingCount != "")
														{
															%>
															<td align = "right"><%=hazmetpendingCount%></td>
															<%
														}
													}
													if (subchildNodeName.trim().equals("hazmet_verify_count"))
													{
														hazmetverifyCount = subChildNode.getFirstChild().getNodeValue();

														if (hazmetverifyCount != "")
														{
															%>
															<td align = "right"><%=hazmetverifyCount%></td>	                                   
															<%
														}
													}
													if (subchildNodeName.trim().equals("total_hazmet_tasks"))
													{
														totalhazmetTasks = subChildNode.getFirstChild().getNodeValue();

														if (totalhazmetTasks != "")
														{
															%>
														   <td align = "right"><%=totalhazmetTasks%></td>
														   </tr>
														   <%
														}
													}
												}
											}
										}
									}
								}
							}
							xmlString = "";
					%>
					
			
			
</table>
	</div>

	<%
		} 
         catch (RemoteException ex) 
         {
			System.out .println("Exception :ReplTaskShowDetail:" + ex);
		 }
         catch (ITMException ex) 
         {
			System.out .println("Exception : ReplTaskShowDetail:" + ex); 
		 } 
         catch (Exception ex)
         {
			System.out .println("Exception : ReplTaskShowDetail:" + ex); 
		 }
	%>
</body>

</html>

