  <%
/*
*	NAME : EgReporterback.jsp
*/
  %>

  <%@ page import = "java.util.ArrayList" %>
  <%@ page import = "java.util.HashMap" %>
  <%@ page import = "egurkha.reporter.ErHelperUtils" %>
  <%@ page import = "egurkha.reporter.ErUtils" %>
  <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>


<%
	try
	{
		String strReq = request.getParameter("backQnumber");

		String back_temp = request.getParameter("back_temp");

		//for CitrixXenApp Drilldown back button
		if(back_temp!=null && back_temp.equalsIgnoreCase("yes"))
		{
			if(strReq!=null)
			{
					int temp = Integer.parseInt(strReq);
					temp = temp-2;
					strReq = Integer.toString(temp);
			}
		}

		String er_gtype11 = (String)request.getParameter("er_gtype");
		er_gtype11 = (String)request.getQueryString();
		HashMap mapppedQ = (HashMap)session.getAttribute("backQuery");
		String backQstr ="";
		String strservletname="";
		ArrayList listQ = new ArrayList();
		if(strReq != null && !strReq.equals("") && !strReq.equals("null"))
		{
			listQ = (ArrayList)mapppedQ.get(strReq);
			if(listQ == null)
			{
				try
				{
				ErHelperUtils erhelputils = new ErHelperUtils(mapppedQ,null);
%>
				<jsp:forward page='<%="EgReporterback.jsp?backQnumber="+erhelputils.getBackID()+"&"+erhelputils.getQueryString()%>'/>
<%
				}catch(Exception e)
				{
					e.printStackTrace();
				}
			}
		}
		else if (mapppedQ != null && mapppedQ.size() ==0)
		{
			if(mapppedQ.containsKey("1"))
 			{
				listQ = (ArrayList)mapppedQ.get("1");
			}
			
			ErHelperUtils erhelputils = new ErHelperUtils(mapppedQ,null);
			String strQuery ="EgReporterback.jsp?backQnumber="+erhelputils.getBackID()+"&"+erhelputils.getQueryString();
		}
		try{
			ErHelperUtils erhelputils = new ErHelperUtils(mapppedQ,null);
			int pageId = Integer.parseInt(erhelputils.getBackID());
			mapppedQ.remove(pageId+"");
			mapppedQ.remove((pageId+1)+"");
		}catch(Exception e){}
		
		session.setAttribute("backQuery",mapppedQ);

		if(listQ != null && listQ.size() == 2)
		{
			strservletname = (String)listQ.get(0);
		}
		String strservletname1 = "";
		if(strservletname != null && strservletname.indexOf(".jsp")>-1)
		{
			String backUrl=null;
			strservletname1 = strservletname+"?"+request.getQueryString();
			
			ArrayList listbackvar=(ArrayList)mapppedQ.get(strReq);
			if(listbackvar!=null)
				backUrl=(String)listbackvar.get(1);
			else
				backUrl=request.getQueryString();
			
			
%>
			<jsp:forward page='<%=strservletname+"?"+backUrl%>'/>
<%
		}
		else
		{
			try
			{
				RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(strservletname); 
				dispatcher.forward(request,response);

			}
			catch (Exception e)
			{
%>
			<jsp:forward page="../servlet/com.eg.ErControllerServlet?er_rtype=HOMEPAGE&er_mode=3D"/>
<%
			}
		}
	}
	catch (Exception e)
	{
 
		e.printStackTrace();
	}





%>