<%@ page import="jet.web.dhtml.*" %>
<%@ page import="java.util.*" %>
<!-- include the jsp for check user login -->
<%@ include file="../dhtmljsp/AuthCheck.jsp" %>
<%	
	Hashtable htparams = new Hashtable();
	//set repor info
	htparams.put("jrs.cmd", "jrs.try_vw");
	htparams.put("jrs.result_type", "8");
	htparams.put("jrs.report", "/JinfonetGourmetJava/OrderListbyDate_Parameter.cls");
	htparams.put("jrs.catalog", "/JinfonetGourmetJava/JinfonetGourmetJava.cat");  
	
	// build the parameter value string pStartDate and pEndDate as a single value
	String paramStartDate = request.getParameter("StartDate");
	String paramEndDate = request.getParameter("EndDate");
	// set parameter, the parameter key value is DHTMLConstant.RUNRPTPARAMS appended by <PARAM_NAME> defined in the report
	// For more than one parameter, the usage is "paramName1=value1&paramName2=value2"
	String parameters = "pStartDate=" + paramStartDate + "&" + "pEndDate=" + paramEndDate;
    htparams.put(DHTMLConstant.RUNRPTPARAMS, parameters);
	
	htparams.put("jrs.enable_nls","true");
	htparams.put("jrs.rpt_language","en");
	
	Map tmpmap = DHTMLUtil.runReport(request, htparams);
	String targetURL = null;
	String errorMsg = null;
	
	if(tmpmap != null){
		errorMsg = (String)tmpmap.get(DHTMLConstant.ERROR_MSG);
		targetURL = (String)tmpmap.get(DHTMLConstant.TARGET_URI);
		if(errorMsg != null && !errorMsg.trim().equals("")){
			PrintWriter jwout = response.getWriter();
			jwout.print(errorMsg);
			return;
		}else{
			//forward to refresh jsp
			if(targetURL != null && !targetURL.trim().equals("")) {
				response.sendRedirect(targetURL);
			}
		}
	}
%>