<%
/*******************************************************************************
*	File name		:	ErMeasure.jsp
*	Purpose			:	This page Handles a single Line chart
*	Version			:	Reporter 1.0
*	Creation Date	:	29/01/2003 - (dd/mm/yyyy)
*	Author			:	Krishnakumar.C
*	Last Modified	:
							7/12/05 - Citrix Report Changes-09/08/2004  M.Saravanan
							bug fixed-02/08/2004  M.Saravanan
							Table border changed & Mail Feature added-30/07/2004  M.Saravanan
							Descriptor alignment changed---20/07/2004  M.Saravanan
							TimeLine Selection added,Icon Added
							22/05/2004 - solomon - enhanced to support filtering infos.
							7/1/2004	 - Solomon //javascript:saveMe() function is changed
*							22/10/2003  Karthick -Snap shot specific changes
*							21/02/2003	Arun	Add PDF-saving support
*							17/07/2003	Gopi/Karthick Comparison feature specific changes

*******************************************************************************/
%>

<%@ include file="ErReporterTracker.jsp" %>
<%@ page import = "java.util.*" %>
<%@ page import = "java.text.SimpleDateFormat" %>
<%@ page import = "egurkha.reporter.*" %>
<%@ page import = "com.eg.EgDateInfo"%>
<%@ page import = "com.eg.EgTablesInfo" %>
<%@ page import = "com.eg.IniFile" %>
<%@ page import = "com.eg.EgInstallInfo" %>
<%@ page import = "com.eg.EgURLEncoder" %>
<%@ page import = "com.eg.EgURLDecoder"%>
<%@ page import = "com.eg.EgExternalInfo" %>
<%@ page import = "com.eg.EgSpecsInfo" %>
<%@ page import = "com.eg.ErDbServer" %>
<%@ page import = "com.eg.EgMappingInfo" %>
<%@ page import = "egurkha.TestBean" %>
<%@ page import = "java.net.URLEncoder" %>
<%@ page import = "java.net.URLDecoder" %>
<%@ page import = "egurkha.reporter.ErReportHelper" %>
<%@ page import = "com.eg.EgThresholdInfo" %>
<%@ page import = "com.egurkha.util.StringUtils" %>
<%@ page import = "com.egurkha.util.DateTimeTokenizer" %>
<%@ page import = "com.eg.EgDbInfo" %>
<%@ page import = "com.egurkha.util.DateUtil" %>
<%@ page import = "com.eg.EgConfigInfo"%>
<%@ page import = "net.sf.json.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="egui" uri="../WEB-INF/eg-taglib.tld" %>
<%@ page import = "com.egurkha.ini.IniUI" %>
<%
try
{
	response.setContentType("application/json");
	System.out.println("request is 1111 "+request.getQueryString());
	JSONObject rootJson = new JSONObject();
	JSONObject labelObj = new JSONObject();
	String queryString = ErUtils.prepareQueryString(request.getParameterMap());
	String st_componentNew = request.getParameter("er_component");
	request.setCharacterEncoding("UTF-8");
	com.egurkha.ini.IniUI ui = (com.egurkha.ini.IniUI)com.egurkha.ini.IniUI.getInstance();
	UserRegistry mregistry = UserRegistry.getInstance();
	User muser = mregistry.getUser(session.getId());
	String thisLanguage = ui.getDefaultLanguage();
	EgDbInfo dbInfo=new EgDbInfo("manager");
	String pdfPrint = request.getParameter("pdfPrint");
	String drillDown = request.getParameter("drillDown");
	String drilldownenabled = request.getParameter("drilldownenabled");
	IniFile egFormat = new IniFile(EgInstallInfo.getInstallDir()+ "/manager/config/eg_format.ini");
	String mngrIProc = new IniFile(new EgConfigInfo("manager").getDbFile()).getValue("DB_PROPERTIES","ManagerUrl");
	if (muser!=null)
	{
		String userLang = muser.getLanguage();
		if (userLang!=null && !userLang.equalsIgnoreCase("NULL"))
		{
			thisLanguage=userLang;
		}
	}
	String sample = request.getParameter("sample");
	if(sample == null)
	{
		sample = "no";
	}
	ArrayList singleColors = new ArrayList();
	ArrayList singleSelection = new ArrayList();
	Map reqMap = request.getParameterMap();
	Hashtable erComparisonMap = new Hashtable(reqMap);
	ErReqData erd = new ErReqData(request);

	if(erd.s_gtype !=null && erd.s_gtype.equalsIgnoreCase("Comparison"))
	{
		ErComparisonBean erc = new ErComparisonBean();
		erc.initRequest(request);
 		erc.processData();
		singleColors = erc.singleColors;
		singleSelection = erc.singleSelection;
	}
	else if(erd.s_gtype != null && erd.s_gtype.equalsIgnoreCase("Measure"))
	{
		ErMicroTime ermicro = new ErMicroTime();
		ermicro.initRequest(request);
		ermicro.initRequest(erComparisonMap);
		ermicro.processData();
		singleColors = ermicro.singleColors;
		singleSelection = ermicro.singleSelection;
	}
	else if(erd.s_gtype !=null && (erd.s_gtype.equalsIgnoreCase("interSnap")||erd.s_gtype.equalsIgnoreCase("intrasnap")||erd.s_gtype.equalsIgnoreCase("Citrix")))
	{
		ErSnapshot ersnap = new ErSnapshot();
		ersnap.initRequest(request);
 		ersnap.initRequest(erComparisonMap);
		//ersnap.processData("");
		ersnap.snapShotProcessGraph();
		singleColors = ersnap.singleColors;
		singleSelection = ersnap.singleSelection;

	}
	EgMappingInfo mappingInfo=new EgMappingInfo(thisLanguage);
	TestBean testBean = new TestBean();
	EgExternalInfo extInfo=new EgExternalInfo("Manager");
	ErInfo erInfo=new ErInfo();
	int count = 0;
	double d_min = 0;
	double d_max = Double.MAX_VALUE;
	int maxInfo = (new ErReportHelper()).getMaxInfos("INFOS","MaxInfos");
	boolean showFilter = false;
	String strCommonMax = request.getParameter("er_commonMax");
	String strCommonMaxRangeValue = request.getParameter("er_commonMaxRange");
	String strAutoCommonMax = request.getParameter("er_AutoCommonMax");

	String s_filter = request.getParameter("er_filter");
	if(s_filter == null || s_filter.equals("")) s_filter = "INFO";

	String s_min ="";
	String s_max ="";

	if ("RANGE".equalsIgnoreCase(s_filter))
	{
		s_min = request.getParameter("er_range_min");
		s_max = request.getParameter("er_range_max");
	}

	String s_priority = request.getParameter("er_priority");
	EgSpecsInfo eSpec = new EgSpecsInfo("manager");
	EgInstallInfo installInfo = new EgInstallInfo();
	EgTablesInfo tablesInfo = new EgTablesInfo("manager");
	ErUtils erUtils = new ErUtils();
	ErReportHelper er_rpthelper = new ErReportHelper();
	String s_qry_string = request.getQueryString();
	String info=request.getParameter("er_info_list");
	int i_serv_port = request.getServerPort();
	String s_serv_name = installInfo.getUrlPrefix()+"//" +request.getServerName();
	String s_serv_pdf = installInfo.getUrlPrefix()+"//" +eSpec.getEGServer() + ":" + i_serv_port;

	String uiFile = "eg_ui.ini";
	String s_iniFile_dir = EgInstallInfo.getInstallDir()+ "/manager/config/";
	IniFile egUI = new IniFile(s_iniFile_dir + uiFile);
	String currentDateFormat = egUI.getValue("CURRENT_DATE_FORMAT","selectedDateFormat");
	EgDateInfo egDt = new EgDateInfo();

	String[] options = {"Any","10 mins","15 mins","30 mins","45 mins","1 hour", "2 hours", "3 hours", "6 hours", "12 hours", "18 hours", "1 day", "2 days", "3 days", "4 days", "5 days", "6 days"};

	String s_st_time = request.getParameter("startdate");
	String s_en_time = request.getParameter("enddate");
	String s_st_hr = request.getParameter("starthr");
	String s_en_hr = request.getParameter("endhr");
	String startMin = request.getParameter("startmin");
	String endMin = request.getParameter("endmin");
	String er_timeline=request.getParameter("er_timeline");
	String trendenable=request.getParameter("er_trend");
	String s_trenddata=request.getParameter("er_trenddata");
	String strStartTime = s_st_time+" "+s_st_hr+":"+startMin+":00";
	String strEndTime = s_en_time+" "+s_en_hr+":"+endMin+":00";
	if(s_trenddata==null)
		s_trenddata="No";


	String disable="";
	String dispDate = null;
	String comFormat = null;
	String startDateTime="";
	String endDateTime="";
	String port ="";

	if(er_timeline!=null)
		er_timeline=URLDecoder.decode(er_timeline);
	if(er_timeline==null)
	{
		er_timeline="1 Day";
	}
	String[] opt=new String[21];
	String gtype=request.getParameter("er_gtype");
	String snaptim=request.getParameter("snaptime");
	String period=request.getParameter("er_period");
	String er_time=request.getParameter("er_time");
	String isOnlyVMAssigned=request.getParameter("isOnlyVMAssigned");
	String isFromAlarmHistory=request.getParameter("isFromAlarmHistory");
	String strScreenWidth = request.getParameter("screenWidth");
	int screenWidth = 990;
	try{
		screenWidth = Integer.parseInt(strScreenWidth);
	}
	catch(Exception e)
		{screenWidth = 990;}
	
	if(isOnlyVMAssigned==null || isOnlyVMAssigned.equals(""))
		isOnlyVMAssigned="false";
	if(isFromAlarmHistory==null || isFromAlarmHistory.equals(""))
		isFromAlarmHistory="false";
	if(period==null ||er_time==null)
	{
		period="";
		er_time="";
	}
	if("Summary".equalsIgnoreCase(gtype))
	{
		if("M".equalsIgnoreCase(request.getParameter("er_period")))
		{
			opt=new String[]{"Any","3 months","6 months","9 months","12 months"};
		}
		else
		{
			opt=new String[]{"Any","1 day", "2 days", "3 days", "4 days", "5 days", "6 days","1 week","2 weeks","3 weeks","4 weeks","1 month"};
		}

	}
	else
	{
		if("intrasnap".equalsIgnoreCase(gtype)&& snaptim!=null && snaptim.equals("Yes"))
		{
			opt=new String[]{"Any","10 mins","15 mins","30 mins","45 mins","1 hour", "3 hours", "6 hours", "9 hours", "12 hours", "15 hours", "18 hours", "21 hours","1 day", "2 days", "3 days", "4 days", "5 days", "6 days","1 week","2 weeks","3 weeks","4 weeks","1 month"};
		}
		else
		{
			if(s_trenddata.equals("Yes"))
			{
				opt=new String[]{"Any","1 day", "2 days", "3 days", "4 days", "5 days", "6 days","1 week","2 weeks","3 weeks","4 weeks","1 month"};
			}
			else
			{
				opt=new String[]{"Any","1 hour", "3 hours", "6 hours", "9 hours", "12 hours", "15 hours", "18 hours", "21 hours","1 day", "2 days", "3 days", "4 days", "5 days", "6 days","1 week","2 weeks","3 weeks","4 weeks","1 month"};
			}
		}
	}
	List alist = Arrays.asList(opt);
	String loginName = muser.getLoginID();
	String strUsrTimeline = er_rpthelper.getUserTimeline(loginName);
	int len;
	if(strUsrTimeline != null && !strUsrTimeline.equals("") && !strUsrTimeline.equalsIgnoreCase("-1"))
	{
		len = alist.indexOf(strUsrTimeline)+1;
	}
	else
	{
		len = opt.length;
	}

	if(er_timeline!=null&&!er_timeline.equals("Any"))
	{
		disable ="disabled";
	}

	long msecsPerHour = (long) 1000 * 60 * 60;
	int blankSpaceIndex =0;
	long val=0;
	String unit="";
	if(er_timeline!=null&&!er_timeline.equals("Any"))
	{
		blankSpaceIndex = er_timeline.indexOf(DateTimeTokenizer.BLANK_SPACE);
		val= Integer.parseInt(er_timeline.substring(0, blankSpaceIndex));
		unit = er_timeline.substring(blankSpaceIndex+1).toLowerCase();
	}
	if(er_timeline!=null&&!er_timeline.equals("Any")&& gtype!=null && !gtype.equals("Summary"))
	{
		if(blankSpaceIndex > 0)
		{
			SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm");
			java.util.Date today = egDt.egetRealDate();
			endDateTime = sdf.format(today);

			if(s_trenddata!=null && s_trenddata.equals("No") && !"Summary".equalsIgnoreCase(gtype))
			{
				endDateTime = sdf.format(today);
			}
			else
			{
				endDateTime = sdf.format(today);
			}
			if(unit.startsWith("mi"))
			{
				val *= (60);
			}
			else if (unit.startsWith("h"))
			{//hours
				val *= 3600;
			}
			else if (unit.startsWith("d"))
			{//days
				val *= (24 * 3600);
			}
			else if (unit.startsWith("w"))
			{//weeks
				val *= (7 * 24 * 3600);
			}
			else if (unit.startsWith("mo"))
			{//months
				if(s_trenddata != null && s_trenddata.equals("No"))
				{
					java.util.Date dt_temp = new java.util.Date(egDt.egetUTCDate());
					Calendar cal_temp = new GregorianCalendar();
					cal_temp.setTime(dt_temp);
					//cal_temp.add(Calendar.DATE,-1);
					cal_temp.add(Calendar.HOUR_OF_DAY,0);
					java.util.Date dt_temp1 = cal_temp.getTime();
					long l_temp = dt_temp1.getTime();
					int totalDays = 24*(ErUtils.getMaxDaysInMonth());
					startDateTime = egDt.egetDate(l_temp -(long)( (val*totalDays * msecsPerHour)));
					startDateTime = DateUtil.changeDateFormat(startDateTime,"dd/MM/yyyy HH:mm","MM/dd/yyyy HH:mm");
				}
				else
				{
					java.util.Date dt_temp = new java.util.Date(endDateTime);
					Calendar cal_temp = new GregorianCalendar();
					cal_temp.setTime(dt_temp);
					cal_temp.add(Calendar.HOUR_OF_DAY,0);
					java.util.Date dt_temp1 = cal_temp.getTime();
					long l_temp = dt_temp1.getTime();
					int  totalDays=24*(ErUtils.getMaxDaysInMonth());
					startDateTime = egDt.egetDate(l_temp -(long)( (val*totalDays * msecsPerHour)));
					startDateTime = DateUtil.changeDateFormat(startDateTime,"dd/MM/yyyy HH:mm","MM/dd/yyyy HH:mm");
				}
			}
			if (unit!= null && !unit.startsWith("mo"))
			{
				java.util.Date start = new java.util.Date();
				start.setTime(today.getTime() - (val * 1000));
				startDateTime = sdf.format(start);
			}
		}
		if ((startDateTime != null) && (endDateTime != null))
		{
			int shr = Integer.parseInt(startDateTime.substring(startDateTime.indexOf(DateTimeTokenizer.BLANK_SPACE)+1, startDateTime.indexOf(":")));
			int en_hr = Integer.parseInt(endDateTime.substring(endDateTime.indexOf(DateTimeTokenizer.BLANK_SPACE)+1, endDateTime.indexOf(":")));
			s_en_time=endDateTime.substring(0, endDateTime.indexOf(DateTimeTokenizer.BLANK_SPACE));
			s_st_time=startDateTime.substring(0, startDateTime.indexOf(DateTimeTokenizer.BLANK_SPACE));
			startMin = String.valueOf(startDateTime.substring(startDateTime.indexOf(":")+1));
			endMin = String.valueOf(endDateTime.substring(endDateTime.indexOf(":")+1));


			rootJson.put("starthr", String.valueOf(shr));

			rootJson.put("endhr", String.valueOf(en_hr));


			System.out.println("startDateTime--->"+startDateTime);
			System.out.println("endDateTime--->"+endDateTime);

			if(s_trenddata!=null)
			{
				if(s_trenddata.trim().equals("Yes")|| gtype.equalsIgnoreCase("Summary"))
				{
					s_st_hr  = String.valueOf(0);
					s_en_hr  = String.valueOf(0);
					startMin = "00";
					endMin   = "00";
				}
			}
		}
	}
	else if(er_timeline!=null&&!er_timeline.equals("Any")&&gtype!=null &&gtype.equals("Summary"))
	{
		String stHr = "", enHr = "";
		System.out.println("er_timeline--->"+er_timeline);
		if (unit.startsWith("d"))
		{
			val= 24*val;
		}
		if (unit.startsWith("w"))
		{
			val=168*val;
		}
		if (unit.startsWith("mo"))
		{
			SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm");
			java.util.Date thisDay = egDt.egetRealDate();
			String endDatTime = sdf.format(thisDay);
			val = (ErUtils.getTotalDays(endDatTime,val))*24;
		}
		erd.s_end_time = egDt.egetDate(egDt.egetUTCDate());
		if(erd.s_period.equalsIgnoreCase("H"))
		{
			erd.s_start_time = egDt.egetDate(egDt.egetUTCDate() - ((long)((long)val * (long)msecsPerHour)));
			erd.s_start_time = (erd.s_start_time.substring(0, erd.s_start_time.indexOf(":"))) + ":00:00";
			erd.s_end_time = (erd.s_end_time.substring(0, erd.s_end_time.indexOf(":"))) + ":00:00";
			long i_timeline = 0;
			if(er_time !=null)
			{
				i_timeline = val;
			}
			if((i_timeline < 24))
			{
				erd.s_sthr = erd.s_start_time.substring(erd.s_start_time.indexOf(" ")+1,erd.s_start_time.indexOf(":"));
				erd.s_endhr = erd.s_end_time.substring(erd.s_end_time.indexOf(" ")+1,erd.s_end_time.indexOf(":"));
				System.out.println("erd.s_sthr--->"+erd.s_sthr);
				System.out.println("erd.s_endhr--->"+erd.s_endhr);
				stHr = erd.s_sthr;
				enHr = erd.s_endhr;
			}else
			{
				long l_temp = (long)((long)egDt.egetUTCDate(erd.s_start_time)+(long)(24l * (long)msecsPerHour));
				erd.s_start_time = (erd.s_start_time.substring(0, erd.s_start_time.indexOf(" "))) + " 00:00:00";
				erd.s_end_time = (erd.s_end_time.substring(0, erd.s_end_time.indexOf(" "))) + " 00:00:00";
				s_st_hr = "0";
				s_en_hr = "0";
				System.out.println("s_st_hr--->"+s_st_hr);
				System.out.println("s_en_hr--->"+s_en_hr);
				stHr = s_st_hr;
				enHr = s_en_hr;
			}
		}
		else if(erd.s_period.equalsIgnoreCase("D"))
		{
			erd.s_start_time = egDt.egetDate(egDt.egetUTCDate() - ((long)((long)val * (long)msecsPerHour)));
			erd.s_end_time = egDt.egetDate(egDt.egetUTCDate());
			erd.s_start_time = (erd.s_start_time.substring(0,
			erd.s_start_time.indexOf(" "))) + " 00:00:00";
			erd.s_end_time = (erd.s_end_time.substring(0, erd.s_end_time.indexOf(" "))) + " 00:00:00";
			s_st_hr = "0";
			s_en_hr = "0";
			stHr = s_st_hr;
			enHr = s_en_hr;
		}
		else if(erd.s_period.equalsIgnoreCase("M"))
		{
			erd.s_start_time = egDt.egetDate(egDt.egetUTCDate() - ((long)((long)val * (long)msecsPerHour)));
			erd.s_start_time = (erd.s_start_time.substring(0, erd.s_start_time.indexOf(" "))) + " 00:00:00";
			long l_st = egDt.egetUTCDate(erd.s_start_time);
			long l_end = egDt.egetUTCDate(erd.s_end_time);
			erd.s_end_time = erd.s_end_time = egDt.egetDate(egDt.egetUTCDate());
			erd.s_end_time = (erd.s_end_time.substring(0, erd.s_end_time.indexOf(" "))) + " 00:00:00";
			erd.s_sthr="0";
			erd.s_endhr="0";
			erd.s_startmin="0";
			erd.s_endmin="0";
			stHr = erd.s_sthr;
			enHr = erd.s_endhr;
		}
		s_st_time = erd.s_start_time.substring(0,erd.s_start_time.indexOf(" "));
		s_en_time = erd.s_end_time.substring(0,erd.s_end_time.indexOf(" "));
		s_st_time = DateUtil.changeDateFormat(s_st_time,"dd/MM/yyyy","MM/dd/yyyy");
		s_en_time = DateUtil.changeDateFormat(s_en_time,"dd/MM/yyyy","MM/dd/yyyy");
		s_st_hr = "0";
		s_en_hr = "0";
		startMin= "0";
		endMin  = "0";

		rootJson.put("starthr", stHr);
		rootJson.put("endhr", enHr);
	}


	if(er_timeline!=null&&er_timeline.equals("Any"))
	{
		String StrDate="";
		try
		{
			java.text.SimpleDateFormat df=new java.text.SimpleDateFormat("MM/dd/yyyy k 'at' hh:mm");
			StrDate =df.format(new java.util.Date());
		}
		catch(Exception ee)
		{
			System.out.println("Exception is"+ee);
		}
		String SDate =StrDate.substring(0,StrDate.indexOf(" "));
		String shour =StrDate.substring(StrDate.indexOf(" "),StrDate.lastIndexOf(""));
		shour = shour.substring(0,3);
		if(s_st_time==null)
		{
			s_st_time=SDate;
		}
		if(s_en_time==null)
		{
			s_en_time=SDate;
		}
		if(s_st_hr==null)
		{
			shour =shour.trim();
			int starthr = Integer.parseInt(shour);
			starthr = starthr-1;
			s_st_hr=String.valueOf(starthr);
		}
		if(s_en_hr==null)
		{
			shour =shour.trim();
			s_en_hr =shour;
		}
		if(gtype.trim().equalsIgnoreCase("intrasnap"))
		{
			if(startMin==null)
				startMin = StrDate.substring(StrDate.indexOf(":")+1);
			if(endMin==null)
				endMin = StrDate.substring(StrDate.indexOf(":")+1);
		}
		else
		{
			startMin = "00";
			endMin   = "00";
		}
		rootJson.put("starthr", s_st_hr);
		rootJson.put("endhr", s_en_hr);
	}


	String s_control_servlet = "/final/servlet/com.eg.";
	String compType = "";
	String er_info = "";
	Enumeration ew=request.getParameterNames();
	StringBuffer sb=new StringBuffer();
	String site=request.getParameter("er_site");

	try
	{
		while(ew.hasMoreElements())
		{
			String name=ew.nextElement().toString();
			sb.append(name).append("=").append(request.getParameter(name)).append("&");
		}
	}catch(Exception e)
	{
		e.printStackTrace();
	}

	String s_timeline=erd.s_timeline;
	int timeline=0;

	if((erd.s_gtype != null && erd.s_gtype.equalsIgnoreCase("Measure")|| erd.s_gtype.equalsIgnoreCase("Trend"))|| erd.s_gtype !=null && erd.s_gtype.equalsIgnoreCase("Comparison"))
	{

		if (erd.s_gtype.equalsIgnoreCase("Measure"))
			s_qry_string = s_control_servlet +"ErMicroTimeC?er_filter=" + s_filter+"&"+sb;
		else if(erd.s_gtype.equalsIgnoreCase("Trend"))
			s_qry_string = s_control_servlet +"ErTrendC?er_filter=" + s_filter+"&"+sb;
		else if (erd.s_gtype.equalsIgnoreCase("Comparison"))
			s_qry_string = s_control_servlet + "ErCompareServersC?er_filter=" + s_filter+"&" + sb;

		if (erd.s_gtype.equalsIgnoreCase("Comparison"))
		{
			s_qry_string +="&er_commonMax="+strCommonMax+"&er_commonMaxRange="+strCommonMaxRangeValue+"&er_AutoCommonMax="+strAutoCommonMax; 
		}

		String trgttype = request.getParameter("er_trgttype");
		boolean showTop = true;
		String st_day="";
		String end_day="";
		if(trgttype!=null && trgttype.equals("CitrixUser"))
			showTop= false;
		if(showTop)
		{
			EgDbAdapterR egDb = ErDbServer.getObject();
			EgSpecsInfo specsInfo = new EgSpecsInfo("manager");
			boolean portReleventForTest = specsInfo.isPortRelevantForTest(erd.s_test);
			boolean siteReleventForTest = specsInfo.isSiteRelevantForTest(erd.s_test);
			if(er_timeline!=null&&!er_timeline.equals("Any"))
			{
				st_day=DateUtil.changeDateFormat(s_st_time,"MM/dd/yyyy","dd/MM/yyyy");
				end_day=DateUtil.changeDateFormat(s_en_time,"MM/dd/yyyy","dd/MM/yyyy");
			}
			else
			{
				st_day=DateUtil.changeDateFormat(s_st_time,currentDateFormat,"dd/MM/yyyy");
				end_day=DateUtil.changeDateFormat(s_en_time,currentDateFormat,"dd/MM/yyyy");
			}
			erd.range_stdate=st_day+" "+s_st_hr+ ":00:00";
			erd.range_enddate=end_day+" "+s_en_hr+ ":00:00";
			strStartTime = st_day+" "+s_st_hr+ ":00:00";
			strEndTime = end_day+" "+s_en_hr+ ":00:00";
			try
			{
				egDb.set_Connection();
				if (erd.s_tbound.equalsIgnoreCase("Fixed") || erd.s_tbound.equalsIgnoreCase("Any") && erd.s_stdate!=null && erd.s_enddate!=null)
				{
					egDb.dbsel(egDb.buildInfoDetails(erd,portReleventForTest,siteReleventForTest));
					if(egDb.rs.next())
					{
						count = egDb.rs.getInt(1);
						d_min = egDb.rs.getDouble(2);
						d_max = egDb.rs.getDouble(3);
					}
				}
			}catch(Exception e){
				System.out.println("Info "+e);
			}
			egDb.release_Connection(false);
			ErDbServer.releaseObject(egDb);
			showFilter = Math.min(5,maxInfo)<count;
			if (s_priority == null || s_priority.equals(""))
			{
				if(maxInfo < count)
				{
					//s_priority="TOP-" + maxInfo;
					EgThresholdInfo threshInfo = new EgThresholdInfo("manager");
					port = portReleventForTest?erd.s_port:"NULL";
					if(erd.s_dataFrom!=null && erd.s_dataFrom.equalsIgnoreCase("Service"))
					{
						//EgDbInfo dbInfo=new EgDbInfo("manager");
						String temp_measure=dbInfo.getMeasureForColumn(erd.s_test,erd.s_disp_meas);
						if(temp_measure!=null && !temp_measure.equals(""))
							erd.s_disp_meas=temp_measure;
					}
					String s_thresh[]= threshInfo.getThresholdAttributes(erd.s_test,erd.s_disp_meas,erd.s_host,port + (erd.s_info!=null && !erd.s_info.equals("")?":" + erd.s_info:""));
					s_priority = "TOP-" + maxInfo;
					if(!s_thresh[1].equals("-1") && s_thresh[2].equals("-1"))
						s_priority = "LAST-" + maxInfo;
				}
				else
				{
					s_priority = "ALL";
				}
			}

			if("RANGE".equalsIgnoreCase(request.getParameter("er_filter")))
			{
				s_qry_string += "&er_range_min=" + s_min + "&er_range_max=" + s_max;
			}
			else
			{
				s_qry_string += "&er_priority=" + s_priority;
			}
		}
	}
	else if(erd.s_gtype != null && erd.s_gtype.equalsIgnoreCase("Summary"))
	{
		s_qry_string = s_control_servlet + "ErSummaryC?" + sb;


	}
	else if(erd.s_gtype != null && erd.s_gtype.equalsIgnoreCase("intrasnap"))
	{
		if (s_priority == null || s_priority.equals(""))
		{
			EgSpecsInfo specsInfo = new EgSpecsInfo("manager");
			boolean portReleventForTest = specsInfo.isPortRelevantForTest(erd.s_test);
			if(maxInfo < count)
			{
				//s_priority="TOP-" + maxInfo;
				EgThresholdInfo threshInfo = new EgThresholdInfo("manager");
				port = portReleventForTest?erd.s_port:"NULL";
				if(erd.s_dataFrom!=null && erd.s_dataFrom.equalsIgnoreCase("Service"))
				{
					//EgDbInfo dbInfo=new EgDbInfo("manager");
					String temp_measure=dbInfo.getMeasureForColumn(erd.s_test,erd.s_disp_meas);
					if(temp_measure!=null && !temp_measure.equals(""))
						erd.s_disp_meas=temp_measure;
				}
				String s_thresh[]= threshInfo.getThresholdAttributes(erd.s_test,erd.s_disp_meas,erd.s_host,port + (erd.s_info!=null && !erd.s_info.equals("")?":" + erd.s_info:""));
				s_priority = "TOP-" + maxInfo;
				if(!s_thresh[1].equals("-1") && s_thresh[2].equals("-1"))
					s_priority = "LAST-" + maxInfo;
			}
			else
			{
				s_priority = "ALL";
			}
		}
	}

	/*	if(erd.s_gtype !=null && erd.s_gtype.equalsIgnoreCase("Comparison")){
		s_qry_string = s_control_servlet + "ErCompareServersC?" + sb;
	}*/

	if(erd.s_gtype !=null && (erd.s_gtype.equalsIgnoreCase("interSnap")||erd.s_gtype.equalsIgnoreCase("intrasnap")||erd.s_gtype.equalsIgnoreCase("Citrix")))
	{
		s_qry_string = s_control_servlet + "ErSnapshotC?" + sb;

	}
	Vector v_qry_string = new Vector();
	Vector v_pdf_qry = new Vector();

	String st_component = erd.s_component;
	String st_comp ="";
	String st_comptype ="";
	if(st_component!=null && st_component.indexOf(":")>-1)
	{
		st_comp = st_component.substring(0,st_component.lastIndexOf(":"));
		if(st_comp.indexOf(":NULL") >-1) {
			st_comp = st_comp.substring(0,st_comp.indexOf(":"));
		}
		st_comptype = st_component.substring(st_component.lastIndexOf(":")+1);
		st_component = st_comp+":"+mappingInfo.getComponentTypeDescription(st_comptype);
	}
	if(st_component == null)
	{
		st_component = request.getParameter("er_component");
	}
	String s_mes_unit = "";
	if(erd.s_test != null && erd.s_disp_meas != null)
	{
		if (erd.s_test.endsWith("_trend"))
		{
			erd.s_test=erd.s_test.substring(0,erd.s_test.lastIndexOf("_"));
			erd.s_measure=erd.s_measure.substring(0,erd.s_measure.lastIndexOf("_"));
		}
		s_mes_unit = tablesInfo.getUnitForMeasure(erd.s_test,erd.s_disp_meas);
	}
	if(erd.s_gtype!=null && erd.s_gtype.equalsIgnoreCase("Comparison"))
	{
		if(request.getParameter("er_nick")!= null && request.getParameter("er_nick").length()>0 && !request.getParameter("er_nick").equalsIgnoreCase("null"))
		{
			v_qry_string.add(request.getParameter("er_nick"));
			v_pdf_qry.add(request.getParameter("er_nick"));
		}
		else if(erd.s_component!=null)
		{
			v_qry_string.add(erd.s_component);
			v_pdf_qry.add(st_component);
		}
	}
	else
	{
		v_qry_string.add(erd.s_test + "/" + erd.s_disp_meas + " (" + s_mes_unit + ")");
		v_pdf_qry.add(mappingInfo.getTestDescription(erd.s_test) + "/" + mappingInfo.getMeasureDescription(erd.s_test,erd.s_disp_meas) + " (" + s_mes_unit + ")");
	}
	//s_qry_string += "&er_priority=" + s_priority;
	v_qry_string.add(s_qry_string);
	//v_pdf_qry.add(s_serv_pdf + s_qry_string+"&option=graph&er_legendPosition=right");
	String fontStyleDbl = "";
	String fontStyleDblSingl = "";
	if((dbInfo.doubleByteEnabled || !thisuser.getLanguage().equals("en_US")) && !(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes") || (sample != null && !sample.equalsIgnoreCase("yes") && drilldownenabled !=null && drilldownenabled.equalsIgnoreCase("yes"))))
	{
		fontStyleDbl = " multi_font";
		fontStyleDblSingl = "multi_font";
	}
	else
	{
		fontStyleDbl = "";
		fontStyleDblSingl = "";
	}
	session.setAttribute("DRILLDOWN_PDF_URL", mngrIProc+"/final/reporter/ErMeasure.jsp");
	JSONArray hiddenArr = new JSONArray();

	JSONObject hiddenObj = new JSONObject();
	hiddenObj.put("er_timeline_change", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_gtype", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_rtype", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_period", request.getParameter("er_period"));
	hiddenArr.add( hiddenObj);

	if(isFromAlarmHistory!=null && (isFromAlarmHistory.equalsIgnoreCase("true") || isFromAlarmHistory.equalsIgnoreCase("Yes"))&& request.getParameter("info_list")!=null)
	{
	info=request.getParameter("info_list");
	}
	if(info != null)
	{
		hiddenObj = new JSONObject();
		hiddenObj.put("er_info_list", info);
		hiddenArr.add( hiddenObj);
	}

	hiddenObj = new JSONObject();
	hiddenObj.put("enlarged", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_chartcolor", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_graphtype", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_test", request.getParameter("er_test"));
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_disp_meas", request.getParameter("er_disp_meas"));
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_measure", request.getParameter("er_measure"));
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_component", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_nick", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("option", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_site", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("select_farm", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("snaptime", request.getParameter("snaptime"));
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_graph", request.getParameter("er_graph"));
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_trenddata", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_dataFrom", request.getParameter("er_dataFrom"));
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_service", request.getParameter("er_service"));
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("drilldownenabled", request.getParameter("drilldownenabled"));
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_user", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_excwe", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("timefrom", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("timeto", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("minfrom", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("minto", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_trgttype", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_compType", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("currTime", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_muser", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("inidate", currentDateFormat);
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("userID", request.getParameter("userID"));
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_commonMax", strCommonMax);
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_commonMaxRange", strCommonMaxRangeValue);
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_AutoCommonMax", strAutoCommonMax);
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_usertimeline", strUsrTimeline);
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("getMaxDaysInMonth", String.valueOf(ErUtils.getMaxDaysInMonth()));
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("er_msmthost", "");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("reportName", "ErMeasure");
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("isOnlyVMAssigned", isOnlyVMAssigned);
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("select_vm", request.getParameter("select_vm"));
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("isFromAlarmHistory", isFromAlarmHistory);
	hiddenArr.add( hiddenObj);

	String strer_info= request.getParameter("er_infos");
	if(strer_info != null)
	{
		hiddenObj = new JSONObject();
		hiddenObj.put("er_infos", strer_info);
		hiddenArr.add( hiddenObj);
	}
	String s_qryString = "";
	String Qstring="";
	for(int j=0;j < v_qry_string.size();j=j+2)
	{
		s_qryString = (String)v_qry_string.get(j+1);
		if(s_qryString!=null)
		{
			StringTokenizer strtok = new StringTokenizer(s_qryString,"&");
			while(strtok.hasMoreTokens())
			{
				String param = strtok.nextToken();
				//param=java.net.URLDecoder.decode(param);
				if(param.indexOf("=")>-1)
				{
					String reqparam =param.substring(0,param.indexOf("="));
					String value = param.substring(param.indexOf("=")+1,param.length());
					if(reqparam.equals("er_component"))
					{
						value=request.getParameter("er_component");
					}
					if(request.getParameter("er_graphtype") != null && request.getParameter("er_graphtype").equalsIgnoreCase("single"))
					{
						if(reqparam!=null && reqparam.equalsIgnoreCase("er_width"))
							value="450";
						if(reqparam!=null && reqparam.equalsIgnoreCase("er_height"))
							value="200";
					}
					if(request.getParameter("er_gtype") != null && request.getParameter("er_gtype").equalsIgnoreCase("Summary"))
					{
						if(reqparam!=null && reqparam.equalsIgnoreCase("er_width"))
							value="350";
						if(reqparam!=null && reqparam.equalsIgnoreCase("er_height"))
							value="350";
					}
					if(reqparam.equals("info_list"))
						continue;

					if(reqparam.equals("er_info_list") || reqparam.equals("select_vm") )
					{
						value=request.getParameter(reqparam);
						if( value != null)
						{
							try {
								if(value.indexOf("+")>-1){
								value=StringUtils.replace(value,"+","|plus|");
							} if (value.indexOf("&")>-1){
								value=StringUtils.replace(value,"&","|amp|");
							} if (value.indexOf("%")>-1){
								value=StringUtils.replace(value,"%","|pct|");
							} if (value.indexOf("#")>-1){
								value=StringUtils.replace(value,"#","|hash|");
							}
 								value = java.net.URLDecoder.decode(value);
							} catch (Exception e1) {e1.printStackTrace();}
						}
					}
						Qstring=Qstring+reqparam+"="+EgURLEncoder.encode(value,"UTF-8")+"&";
				}else
					Qstring=Qstring+param+"&";
			}
		}
		v_pdf_qry.add(s_serv_pdf+Qstring+"&option=graph&er_legendPosition=right");
	if(!(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes") || (sample != null && !sample.equalsIgnoreCase("yes") && drilldownenabled !=null && drilldownenabled.equalsIgnoreCase("yes"))))
	{
	}

		if(erd.s_gtype != null && erd.s_gtype.equalsIgnoreCase("Comparison"))
		{
			labelObj.put("reporter.common.reportfor" ,mappingInfo.getTextDescription("reporter.common.report for"));

		}
		else if(erd.s_gtype != null && (erd.s_gtype.equalsIgnoreCase("interSnap")||erd.s_gtype.equalsIgnoreCase("intrasnap")))
		{

			String trgttype=request.getParameter("er_trgttype");
			if (trgttype==null)
			{
				labelObj.put("reporter.common.Snapshot Report for" ,mappingInfo.getTextDescription("reporter.common.Snapshot Report for"));

			}
			else
			{
				if(isOnlyVMAssigned!=null && isOnlyVMAssigned.equalsIgnoreCase("true"))
				{
					labelObj.put("reporter.common.Report for VM" ,mappingInfo.getTextDescription("reporter.common.Report for VM"));
				}
				else
				{
					labelObj.put("reporter.common.Server Report for" ,mappingInfo.getTextDescription("reporter.common.Server Report for"));
				}
			}
		}//new code for snapshot
		else if ("Micro".equalsIgnoreCase(request.getParameter("er_rtype")) && "CitrixUser".equalsIgnoreCase(request.getParameter("er_trgttype")))
		{
			compType = request.getParameter("er_compType");
			er_info = request.getParameter("er_user");
			if(er_info == null)
			{
				er_info = request.getParameter("er_tuser");
			}
			labelObj.put("reporter.common.Citrix Farm User Report" ,mappingInfo.getTextDescription("reporter.common.Citrix Farm User Report"));

		}
		else if("User Report".equalsIgnoreCase(request.getParameter("er_trgttype")))
		{
			labelObj.put("reporter.common.CitrixUserReport" ,mappingInfo.getTextDescription("reporter.common.Citrix User Report - Farm -")+" "+request.getParameter("select_farm")+" "+mappingInfo.getTextDescription("reporter.measure.User")+" - "+request.getParameter("er_user"));
		}
		else
		{
					labelObj.put("reporter.common.Operation reports" ,mappingInfo.getTextDescription("reporter.common.Operation reports")+" "+mappingInfo.getTextDescription("reporter.common."+erd.s_rtype)+" "+request.getParameter("er_component"));
		}
		if(!"yes".equalsIgnoreCase(request.getParameter("print")))
		{
			if(!("yes".equalsIgnoreCase(request.getParameter("er_timeline_change"))))
			{
				rootJson.put("drillDownSaveURL", Qstring+"&print=yes&is_pdf=yes");
			}
			else
			{
			}
		}
		if(erd.s_gtype !=null)
		{
			if("yes".equalsIgnoreCase(request.getParameter("print")))
			{
				//String pdfPrint = request.getParameter("pdfPrint");
				if(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes"))
				{
				}
			}
			else
			{
				if(!("yes".equalsIgnoreCase(request.getParameter("er_timeline_change"))))
				{
					rootJson.put("drillDownPrintURL", Qstring+"&print=yes&is_pdf=yes");
					rootJson.put("mailurl", "../reporter/ErSendMail.jsp?keyPrefix=enlarged&DrillDown=yes");

					rootJson.put("drillDownDataURL", Qstring+"&option=data");

					String s_test=erd.s_test;
					String s_measure =erd.s_disp_meas;
					if(erd.s_dataFrom!=null && erd.s_dataFrom.equalsIgnoreCase("Service"))
					{
						//EgDbInfo dbInfo=new EgDbInfo("manager");
						s_measure=dbInfo.getMeasureForColumn(s_test,s_measure);
					}
					if(!("Summary".equalsIgnoreCase(erd.s_gtype)) && testBean.isDdEnabled(s_test,s_measure))
					{
						String s_site = erd.s_site;
						if (s_site ==null || s_site.length()==0 || s_site.equals("null") || s_site.equals("NONE") )
							s_site ="NULL";
						String s_component = erd.s_component;
						String s_info =request.getParameter("er_info_list");
						if(s_info!=null && !s_info.equals(""))
							s_info=EgURLEncoder.encode(s_info,"UTF-8");
						if (s_info==null || s_info.equals("")|| s_info.equals("null"))
						{
							Vector v_infos=erInfo.getInfosForTest(s_site,s_test,s_component,strStartTime,strEndTime,s_measure,"",s_trenddata,s_priority,maxInfo);
							if (v_infos!=null && v_infos.size()>0)
							{
								for (int m=0;m<v_infos.size();m++)
								{
									String s1=(String)v_infos.get(m);
									if (m==0)
									{
										s_info=s1.substring(s1.indexOf("+"));
									}else
									{
										s_info+="|"+s1.substring(s1.indexOf("+"));
								}
							}
						}
					}

					boolean isSnapshot =(erd.s_gtype !=null && (erd.s_gtype.equalsIgnoreCase("interSnap")||erd.s_gtype.equalsIgnoreCase("intrasnap")));

					if(isSnapshot && (s_info==null || s_info.length()==0))
						s_info = "|";

					if(s_info!=null && s_info.length()>0 && !s_info.equals("null"))
					{
						if(s_info.indexOf("|")>-1)
						{
							s_info=s_info.substring(0,s_info.indexOf("|"));
						}
						if(s_info.length()>0 && s_info.charAt(0)=='+')
							if(s_info.length() > 1 )
							{
								s_info = s_info.substring(1);
							}
							else
							{
								s_info="";
							}
							s_info = (erd.s_info==null?"":erd.s_info) + "*" +s_info;
						}else
						{
							StringTokenizer st=new StringTokenizer(s_component,":");
							if (st.countTokens()>3)
							{
								st.nextToken();
								st.nextToken();
								s_info=st.nextToken()+"*";
							}else
								s_info="*";
						}

						String s_sdate=erd.s_stdate;
						String s_shr=erd.s_sthr;
						String s_edate=erd.s_enddate;
						String s_ehr=erd.s_endhr;
						String  tmpComp=s_component;
						String strTempCompType = "";
						if (tmpComp!=null && tmpComp.indexOf(":")>-1)
							tmpComp = s_component.substring(0,s_component.indexOf(":"));
						//modified on 16/11/07 stalin to display DD page
						if (s_component!=null && s_component.lastIndexOf(":")>-1)
							strTempCompType = s_component.substring(s_component.lastIndexOf(":")+1);

						if(s_component.indexOf(":") > 0 && s_component.lastIndexOf(":") > 0)
						{
							int firstIndex = s_component.indexOf(":");
							port = s_component.substring(firstIndex+1, s_component.indexOf(":",firstIndex+1));
						}
						if(s_component.indexOf(":") > 0)
						{
							s_component = s_component.substring(0,s_component.indexOf(":"));
						}
						if(port == null || port.equals(""))
						{
							port = "NULL";
						}
						String s_infovalue="";
						String servertype=request.getParameter("er_trgttype");
						if(servertype!=null && servertype.trim().equalsIgnoreCase("Server Report"))
							s_infovalue=s_info;
						else
							s_infovalue=EgURLDecoder.decode(s_info,"UTF-8");
						String mhost="";
						if(eSpec.isExternalTest(s_test,strTempCompType))//to ensure whether mgmt_host coming with info or not
						{
							if (s_infovalue!=null && s_infovalue.lastIndexOf("(") >-1 && s_infovalue.lastIndexOf(")") >-1 )
							{
								mhost=s_infovalue.substring(s_infovalue.lastIndexOf("(")+1,s_infovalue.lastIndexOf(")"));
								s_infovalue=s_infovalue.substring(0,s_infovalue.lastIndexOf("("));
							} 
						}
						if(request.getParameter("er_option")!=null)
						{
							String er_opt=request.getParameter("er_option");
							if(er_opt.equalsIgnoreCase("Group") || er_opt.equalsIgnoreCase("Segment") || er_opt.equalsIgnoreCase("Zone") )
								s_site="";
						}
						if(s_test.equalsIgnoreCase("JvmThreadTest"))
						{
							String strComponent = erd.s_component;
							Vector v_infos = erInfo.getMsmtHostForGraph(s_site,s_test,strComponent);
							if(v_infos!=null && v_infos.size() >0 )
								mhost = (String)v_infos.get(0);
						}
 						if(s_infovalue.indexOf("\\")>-1)
						{
							s_infovalue = StringUtils.replace(s_infovalue,"\\","\\\\");
						}	
						String tempTimeline = "Any";
//String dd_url = "/final/monitor/EventsGraph.jsp?pageToShow=diagnosis&url=EgDiagnosis.jsp?site="+s_site+"&host="+EgURLEncoder.encode(s_component,"UTF-8")+"&port="+port+"&test="+s_test+"&info="+s_infovalue+"&msmt_host="+mhost+"&from=0&measure="+s_measure+"&firsttime=true&flag=0 &starttime="+request.getParameter("startdate")+"&endtime="+request.getParameter("enddate")+"&starthr="+s_shr+"&endhr="+ s_ehr+"&startmin="+request.getParameter("startmin")+"&endmin="+request.getParameter("endmin")+"&fromPage=alarm&comeFrom=Reporter&newWindow=true&timeline="+tempTimeline+"&inidate="+request.getParameter("inidate")+"&comptype="+strTempCompType+"&isVM="+isOnlyVMAssigned;


String dd_url = "/final/monitor/componentMeasureTabSet.jsp?type="+EgURLEncoder.encode(strTempCompType,"UTF-8")+"&site="+site+"&host="+EgURLEncoder.encode(s_component,"UTF-8")+"&port="+port+"&info="+EgURLEncoder.encode(s_infovalue,"UTF-8")+"&state=&messy="+s_measure+"&msmt_host="+EgURLEncoder.encode(mhost,"UTF-8")+"&userID="+EgURLEncoder.encode(urs,"UTF-8")+"&test="+ s_test+"&comptype="+strTempCompType+"&measureDisp="+s_measure+"&starttime="+request.getParameter("startdate")+"&endtime="+request.getParameter("enddate")+"&starthr="+s_shr+"&endhr="+ s_ehr+"&startmin="+request.getParameter("startmin")+"&endmin="+request.getParameter("endmin")+"&from=measurespage&dd=yes&clicked=dd&newWindow=true&fromReporterHis=true&popup=true&fromPage=eveHist&isVM="+isOnlyVMAssigned;

						rootJson.put("ddURL", dd_url);

						StringBuffer key = new StringBuffer(32);
						key.append(s_test);
						key.append(":");
						key.append(s_measure);
						String tm = key.toString();
						String disInfo = egFormat.getValue("Tests_For_DDWithoutInfos",tm);
						if(disInfo!=null && disInfo.equalsIgnoreCase("Yes"))
						{
							s_infovalue = "+";
						}
						else
						{
							if(s_infovalue!=null)
							{
								if(s_infovalue.indexOf("+")>-1)
								{
									s_infovalue=com.egurkha.util.StringUtils.replace(s_infovalue,"+","|plus|");
								}
								if(s_infovalue.indexOf("&")>-1)
								{
									s_infovalue=com.egurkha.util.StringUtils.replace(s_infovalue,"&","|amp|");
								}
								if(s_infovalue.indexOf("%")>-1)
								{
									s_infovalue=com.egurkha.util.StringUtils.replace(s_infovalue,"%","|pct|");
								}
								if(s_infovalue.indexOf("#")>-1)
								{
									s_infovalue=com.egurkha.util.StringUtils.replace(s_infovalue,"#","|hash|");
								}
								if(s_infovalue.indexOf("*")>-1)
								{
									int numChar=s_infovalue.length();
									char[] charArray=new char[numChar];
									s_infovalue.getChars(0, numChar, charArray,0);
									for(int i=0;i<charArray.length;i++)
									{
										if(charArray[i]=='*')
										{
											charArray[i]='+';
											break;
										}
									}
									s_infovalue = new String(charArray);
								}
							}
						}
					}
				}
			}
		}
		String tgttype=request.getParameter("er_trgttype");
		if(erd.s_rtype!=null && erd.s_rtype.equalsIgnoreCase("Micro") && tgttype!=null && tgttype.equalsIgnoreCase("CitrixUser"))
		{
			String temp_user = request.getParameter("er_user");
			if(temp_user == null)
			{
				temp_user = request.getParameter("er_tuser");
			}
		}
		else if(!(erd.s_gtype!=null && erd.s_gtype.equalsIgnoreCase("comparison")) )
		{
			String trgttyppe=request.getParameter("er_trgttype");
			labelObj.put("reporter.common.Report Type", mappingInfo.getTextDescription("reporter.common.Report Type"));
			if(trgttyppe==null || trgttyppe.equals(""))
			{
				if("yes".equalsIgnoreCase(request.getParameter("print")))
				{
				}
			}
			else
			{
				if("yes".equalsIgnoreCase(request.getParameter("print")))
				{
					String reporttype="";
					String servertype=request.getParameter("er_trgttype");
					if(servertype!=null &&   servertype.trim().equalsIgnoreCase("Server Report"))
						reporttype="Consolidated";
					else if(gtype.equalsIgnoreCase("Measure")|| gtype.equalsIgnoreCase("Trend"))
						reporttype="Operation Measure";
					else if(gtype.equalsIgnoreCase("Summary"))
						reporttype="Operation Summary";
					else
					reporttype="Citrix";
												if(isOnlyVMAssigned==null || isOnlyVMAssigned.equalsIgnoreCase("false"))
												{
													labelObj.put("reporter.common.Report Type", mappingInfo.getTextDescription("reporter.common.Report Type"));

												}
				}
			}
		}

		if("yes".equalsIgnoreCase(request.getParameter("print")))
		{
			String d1="";
			String d2="";
			String startdate = request.getParameter("startdate");
			String enddate  = request.getParameter("enddate");
			String starthr  = request.getParameter("starthr");
			String endhr    = request.getParameter("endhr");
			String startmin = request.getParameter("startmin");
			String endmin   = request.getParameter("endmin");
			startdate = startdate==null ? "" : URLDecoder.decode(startdate);
			enddate = enddate==null ? " " : URLDecoder.decode(enddate);
			d1 = startdate + " " + starthr + ":" + startmin + " Hrs";
			d2 = enddate + " " + endhr + ":" + endmin + " Hrs";

			labelObj.put("reporter.common.Start Date", mappingInfo.getTextDescription("reporter.common.Start Date"));
			labelObj.put("reporter.common.End Date", mappingInfo.getTextDescription("reporter.common.End Date"));
		}
		if( showFilter && !"yes".equalsIgnoreCase(request.getParameter("print")))
		{
			labelObj.put("reporter.common.Descriptor", mappingInfo.getTextDescription("reporter.common.Descriptor"));
			JSONArray topArr = new JSONArray();
			int k = 1;
			for(;k<=10; k++)
			{
				JSONObject topObj = new JSONObject();
				topObj.put("displayField", mappingInfo.getTextDescription("reporter.common.TOP")+" - "+k);
				topObj.put("valueField", "TOP-"+k);
				topArr.add(topObj);
				if(count-1<k)break;

			}
			if(maxInfo >10 && maxInfo < count && s_priority.startsWith("TOP"))
			{
				JSONObject topnObj = new JSONObject();
				topnObj.put("displayField", mappingInfo.getTextDescription("reporter.common.TOP")+" - "+maxInfo);
				topnObj.put("valueField", s_priority);
				topArr.add(topnObj);
				rootJson.put("topcomboselected", s_priority);
			}
			JSONObject allObj = new JSONObject();
			allObj.put("displayField", mappingInfo.getTextDescription("reporter.common.ALL"));
			allObj.put("valueField", "ALL");
			topArr.add(allObj);
			if ( s_priority.equalsIgnoreCase("ALL") )
			{
				rootJson.put("topcomboselected", "ALL");
			}
			if(maxInfo >10 && maxInfo < count && s_priority.startsWith("LAST"))
			{
				rootJson.put("topcomboselected", s_priority);
				JSONObject lastObj = new JSONObject();
				lastObj.put("displayField", mappingInfo.getTextDescription("reporter.common.LAST")+" - "+maxInfo);
				lastObj.put("valueField", s_priority);
				topArr.add(lastObj);

				if ( s_priority.equalsIgnoreCase("LAST-" + maxInfo) )
				{
					rootJson.put("topcomboselected", s_priority);
				}
			}
			for(k--;k>0; k--)
			{
				JSONObject lastObj = new JSONObject();
				lastObj.put("displayField", mappingInfo.getTextDescription("reporter.common.LAST")+" - "+k);
				lastObj.put("valueField", "LAST-"+k);
				topArr.add(lastObj);

				if ( s_priority.equalsIgnoreCase("LAST-"+k) )
				{
					rootJson.put("topcomboselected", "LAST-"+k);
				}
			}
			rootJson.put("topcombo", topArr);
			labelObj.put("reporter.common.Range", mappingInfo.getTextDescription("reporter.common.Range"));
			if ( s_filter.equalsIgnoreCase("RANGE") )
			{
				rootJson.put("er_filter_radio_checked","checked");
			}
			else
			{
				rootJson.put("er_filter_radio_checked","");
			}
			rootJson.put("er_range_min", s_min);
			labelObj.put("reporter.common.To", mappingInfo.getTextDescription("reporter.common.To"));
			rootJson.put("er_range_max", s_max);
		}
		if(!"yes".equalsIgnoreCase(request.getParameter("print")))
		{

			if(erd.s_gtype !=null && (erd.s_gtype.equalsIgnoreCase("interSnap")||erd.s_gtype.equalsIgnoreCase("intrasnap")||erd.s_gtype.equalsIgnoreCase("Citrix")))
			{
				if (erd.s_startmin!=null && !erd.s_startmin.equals("") && Integer.parseInt(erd.s_startmin)<10 && erd.s_startmin.length()==2)
					erd.s_startmin=erd.s_startmin.substring(1);
				if (erd.s_endmin!=null && !erd.s_endmin.equals("") && Integer.parseInt(erd.s_endmin)<10 && erd.s_endmin.length()==2)
					erd.s_endmin=erd.s_endmin.substring(1);
				Vector vec_infos=erInfo.getInfosForTest(erd.s_site,erd.s_test,erd.s_component);
																		if(isFromAlarmHistory!=null && (isFromAlarmHistory.equalsIgnoreCase("true") || isFromAlarmHistory.equalsIgnoreCase("Yes")) && vec_infos!=null && vec_infos.size()>0)
																		{
				labelObj.put("reporter.common.Descriptor", mappingInfo.getTextDescription("reporter.common.Descriptor"));

																				JSONArray descArr = new JSONArray();
																				for(int i=0;vec_infos.size()>i;i++)
																				{	
																					JSONObject descObj = new JSONObject();
																					String str_selected="";
																					String tmp_info=(String)vec_infos.get(i);
																					if(tmp_info.indexOf("+")>-1 && tmp_info.indexOf("+")==0)
																						tmp_info=tmp_info.substring(1);
																					if(tmp_info.equals(info))
																					{
																						str_selected="selected";
																						rootJson.put("descriptorcomboselected", tmp_info);
																					}
																					descObj.put("displayField", tmp_info);
																					descObj.put("valueField", tmp_info);
																					descArr.add(descObj);
																				}
																				rootJson.put("descriptorcombo", descArr);
																		}
				labelObj.put("reporter.common.Timeline", mappingInfo.getTextDescription("reporter.common.Timeline"));
				JSONArray timeArr = new JSONArray();
				for(int e_ctr=0; e_ctr < len;e_ctr++)
				{
					JSONObject timeObj = new JSONObject();
					timeObj.put("displayField", mappingInfo.getTextDescription("reporter.measure."+er_timeline));
					timeObj.put("valueField", er_timeline);
					timeArr.add(timeObj);

					if(er_timeline!=null&&er_timeline.equals((String)opt[e_ctr]))
					{
						rootJson.put("timelinecomboselected", er_timeline);
					}
					else
					{
																					
					}
				}
				rootJson.put("timelinecombo", timeArr);
				labelObj.put("reporter.common.From", mappingInfo.getTextDescription("reporter.common.From"));
			if(er_timeline!=null&&!er_timeline.equals("Any"))
			{
				if(DateUtil.isDate(s_st_time,"MM/dd/yyyy"))
				{
					comFormat = "MM/dd/yyyy";
				}
				else
				{
					comFormat = currentDateFormat;
				}
				dispDate = DateUtil.changeDateFormat(s_st_time,comFormat,currentDateFormat);
			}
			else
			{
				dispDate = s_st_time;
			}
			rootJson.put("er_stdate", dispDate);
			labelObj.put("reporter.common.Hr", mappingInfo.getTextDescription("reporter.common.Hr"));
				JSONArray stHrArr = new JSONArray();
				for(int s_ctr=0; s_ctr < 24 ;s_ctr++)
				{
					JSONObject stHrObj = new JSONObject();
					stHrObj.put("displayField", stHrObj);
					stHrObj.put("valueField", stHrObj);
					stHrArr.add(stHrObj);
					s_st_hr = s_st_hr.trim();

					if(s_st_hr!=null&&s_ctr == Integer.parseInt(s_st_hr))
					{
						rootJson.put("sthrcomboselected", s_st_hr);
																							
					}
					else
					{
																							
					}
				}
				rootJson.put("sthrcombo", stHrArr);
				JSONArray stMinArr = new JSONArray();
				for(int s_ctr=0; s_ctr < 60 ;s_ctr++)
				{
					JSONObject stMinObj = new JSONObject();
					startMin = startMin.trim();
					String stmin=s_ctr+"";
					if(s_trenddata!=null && !s_trenddata.equalsIgnoreCase("Yes"))
					{
						if (s_ctr<10)
							stmin="0"+s_ctr;
					}
					stMinObj.put("displayField", stmin);
					stMinObj.put("valueField", stmin);
					stMinArr.add(stMinObj);
					if(startMin!=null && s_ctr == Integer.parseInt(startMin))
					{
						rootJson.put("stmincomboselected", stmin);
					}
					else
					{
					}
				}
				rootJson.put("stmincombo", stMinArr);
			if(er_timeline!=null&&!er_timeline.equals("Any"))
			{
				if(DateUtil.isDate(s_en_time,"MM/dd/yyyy"))
				{
					comFormat = "MM/dd/yyyy";
				}
				else
				{
					comFormat = currentDateFormat;
				}
				dispDate = DateUtil.changeDateFormat(s_en_time,comFormat,currentDateFormat);
			}
			else
			{
				dispDate = s_en_time;
			}
			rootJson.put("er_enddate",dispDate);
				JSONArray endArr = new JSONArray();
				for(int e_ctr=0; e_ctr < 24 ;e_ctr++)
				{
					JSONObject endObj = new JSONObject();
					endObj.put("displayField", String.valueOf(e_ctr));
					endObj.put("valueField", String.valueOf(e_ctr));
					s_en_hr=s_en_hr.trim();
					if(s_en_hr!=null&&e_ctr == Integer.parseInt(s_en_hr))
					{
						rootJson.put("er_endhr_selected", s_en_hr);
					}
					else
					{
					}
					endArr.add(endObj);
				}
				rootJson.put("er_endhr",endArr);
				JSONArray endMinArr = new JSONArray();
				for(int s_ctr=0; s_ctr < 60 ;s_ctr++)
				{
					endMin = endMin.trim();
					String emin=s_ctr+"";
					if(s_trenddata!=null && !s_trenddata.equalsIgnoreCase("Yes"))
					{
						if (s_ctr<10)
							emin="0"+s_ctr;
					}
					JSONObject endMinObj = new JSONObject();
					endMinObj.put("displayField", emin);
					endMinObj.put("valueField", emin);
					if(endMin!=null&&s_ctr == Integer.parseInt(endMin))
					{
						rootJson.put("er_endmin_selected", endMin);
					}
					else
					{
					}
					endMinArr.add(endMinObj);
				}
				rootJson.put("er_endmin", endMinArr);
				JSONArray modeArr = new JSONArray();
				JSONObject modeObj = new JSONObject();
				modeObj.put("displayField", mappingInfo.getTextDescription("reporter.common.2D"));
				modeObj.put("valueField", "2D");
				modeArr.add(modeObj);

				modeObj = new JSONObject();
				modeObj.put("displayField", mappingInfo.getTextDescription("reporter.common.3D"));
				modeObj.put("valueField", "3D");
				modeArr.add(modeObj);

				rootJson.put("mode", modeArr);
				String mode = request.getParameter("er_mode");
				boolean use3DGraphs = ui.use3DGraphs(IniUI.REPORTER);
				String select2d="";
				String select3d="";
				if(mode!=null&&!mode.equals(""))
				{
					if(mode.equals("2D"))
						select2d="selected";
					if(mode.equals("3D"))
						select3d="selected";
				}
				else
				{

					if(use3DGraphs)
						select3d="selected";
					else
						select2d="selected";
				}
				if ( select3d.equalsIgnoreCase("selected") )
				{
					rootJson.put("modeselected", "3D");
				}
				else if ( select2d.equalsIgnoreCase("selected") )
				{
					rootJson.put("modeselected", "2D");
				}
			}
			else
			{
				JSONArray timeArr = new JSONArray();
				for(int e_ctr=0; e_ctr < len;e_ctr++)
				{
					JSONObject timeObj = new JSONObject();
					timeObj.put("displayField", mappingInfo.getTextDescription("reporter.measure."+er_timeline));
					timeObj.put("valueField", er_timeline);
					if(er_timeline!=null&&er_timeline.equals((String)opt[e_ctr]))
					{
						rootJson.put("timelinecomboselected", er_timeline);
					}else
					{
					}
					timeArr.add(timeObj);
				}
				rootJson.put("timelinecombo", timeArr);
				labelObj.put("reporter.common.From", mappingInfo.getTextDescription("reporter.common.From"));
			if(er_timeline!=null&&!er_timeline.equals("Any"))
			{
				if(DateUtil.isDate(s_st_time,"MM/dd/yyyy"))
				{
					comFormat = "MM/dd/yyyy";
				}
				else
				{
					comFormat = currentDateFormat;
				}
				dispDate = DateUtil.changeDateFormat(s_st_time,comFormat,currentDateFormat);
			}
			else
			{
				dispDate = s_st_time;
			}
			rootJson.put("er_stdate", dispDate);
			labelObj.put("reporter.common.Hr", mappingInfo.getTextDescription("reporter.common.Hr"));
				JSONArray stHrArr = new JSONArray();
				for(int s_ctr=0; s_ctr < 24 ;s_ctr++)
				{
					s_st_hr = s_st_hr.trim();
					JSONObject stHrObj = new JSONObject();
					stHrObj.put("displayField", String.valueOf(s_ctr));
					stHrObj.put("valueField", String.valueOf(s_ctr));
					if(s_st_hr!=null&&s_ctr == Integer.parseInt(s_st_hr))
					{
						rootJson.put("sthrcomboselected", s_st_hr);
					}
					else
					{
					}
					stHrArr.add(stHrObj);
				}
				rootJson.put("sthrcombo", stHrArr);
				labelObj.put("reporter.common.To", mappingInfo.getTextDescription("reporter.common.To"));
			if(er_timeline!=null&&!er_timeline.equals("Any"))
			{
				if(DateUtil.isDate(s_en_time,"MM/dd/yyyy"))
				{
					comFormat = "MM/dd/yyyy";
				}
				else
				{
					comFormat = currentDateFormat;
				}
				dispDate = DateUtil.changeDateFormat(s_en_time,comFormat,currentDateFormat);
			}
			else
			{
				dispDate = s_en_time;
			}
			rootJson.put("er_enddate", dispDate);
				JSONArray endHrArr = new JSONArray();
				for(int e_ctr=0; e_ctr < 24 ;e_ctr++)
				{
					s_en_hr=s_en_hr.trim();
					JSONObject endHrObj = new JSONObject();
					endHrObj.put("displayField", String.valueOf(e_ctr));
					endHrObj.put("valueField", String.valueOf(e_ctr));
					if(s_en_hr!=null&&e_ctr == Integer.parseInt(s_en_hr))
					{
						rootJson.put("endhrcomboselected", s_en_hr);
					}else
					{
					}
					endHrArr.add(endHrObj);
				}
				rootJson.put("endhrcombo", endHrArr);
				labelObj.put("reporter.common.Graph", mappingInfo.getTextDescription("reporter.common.Graph"));
				String mode = request.getParameter("er_mode");
				boolean use3DGraphs = ui.use3DGraphs(IniUI.MONITOR);
				String select2d="";
				String select3d="";
				JSONArray modeArr = new JSONArray();
				JSONObject modeObj = new JSONObject();
				modeObj.put("displayField", mappingInfo.getTextDescription("reporter.common.2D"));
				modeObj.put("valueField", "2D");
				modeArr.add(modeObj);

				modeObj = new JSONObject();
				modeObj.put("displayField", mappingInfo.getTextDescription("reporter.common.3D"));
				modeObj.put("valueField", "3D");
				modeArr.add(modeObj);

				rootJson.put("mode", modeArr);
				if(mode!=null&&!mode.equals(""))
				{
					if(mode.equals("2D"))
						select2d="selected";
					if(mode.equals("3D"))
						select3d="selected";
				}
				else
				{
					if(use3DGraphs)
						select3d="selected";
					else
						select2d="selected";
				}
				if ( select3d.equalsIgnoreCase("selected") )
				{
					rootJson.put("modeselected", "3D");
				}
				else if ( select2d.equalsIgnoreCase("selected") )
				{
					rootJson.put("modeselected", "2D");
				}
			}
			if(showFilter)
			{
			}
			else
			{
			}
		}
String strImgWidth="650";
String strGraphWidth="650";
String strImgHeight="400";
String strGraphHeight="400";
if(screenWidth>1200)
{
	try{
		strImgWidth = (Integer.parseInt(strImgWidth)+300)+"";
		strImgHeight = (Integer.parseInt(strImgHeight)+100)+"";

	}catch(Exception e){}
	try{
		strGraphWidth = (Integer.parseInt(strGraphWidth)+300)+"";
		strGraphHeight = (Integer.parseInt(strGraphHeight)+100)+"";

	}catch(Exception e){}
}	
		if(!("yes".equalsIgnoreCase(request.getParameter("er_timeline_change"))))
		{
			rootJson.put("dataURL", Qstring+"&option=data");
			String strTodispLay ="";
			String stokstrok=(String)v_qry_string.get(j);
			if(stokstrok.indexOf("/")>-1)
			{
				String s_distest= stokstrok.substring(0,stokstrok.indexOf("/"));
				String s_dismeas=stokstrok.substring(stokstrok.indexOf("/")+1);
				String struni="";	if(s_dismeas.indexOf("(")>-1)
				{
					struni=s_dismeas.substring(s_dismeas.indexOf("("));	s_dismeas=s_dismeas.substring(0,s_dismeas.indexOf("("));
				}
				rootJson.put("test", mappingInfo.getTestNameDescription(s_distest));
				rootJson.put("measure", mappingInfo.getMeasureDescription(s_distest, s_dismeas.trim()));

				strTodispLay =mappingInfo.getTestDescription(s_distest) + "/" + mappingInfo.getMeasureDescription(s_distest,s_dismeas) +" " + struni ;
			}
			else if(stokstrok.indexOf(":")>-1)
			{
				if(stokstrok.indexOf("NULL:")>-1)
				{
					rootJson.put("type", mappingInfo.getComponentTypeDescription(stokstrok.substring(stokstrok.lastIndexOf(":")+1)));
					//s_component.substring(0,s_component.lastIndexOf(":NULL"))+s_component.substring(s_component.lastIndexOf(":"));
					strTodispLay =stokstrok.substring(0,stokstrok.lastIndexOf("NULL:"))+mappingInfo.getComponentTypeDescription(stokstrok.substring(stokstrok.lastIndexOf(":")+1));
				}
				else
				{
					strTodispLay =stokstrok.substring(0,stokstrok.lastIndexOf(":"))+mappingInfo.getComponentTypeDescription(stokstrok.substring(stokstrok.lastIndexOf(":")+1));
					rootJson.put("type", mappingInfo.getComponentTypeDescription(stokstrok.substring(stokstrok.lastIndexOf(":")+1)));
				}
			}
			else
			{
				strTodispLay =mappingInfo.getTextDescription("reporter.measure."+stokstrok);
				labelObj.put("reporter.common."+stokstrok, mappingInfo.getTextDescription(stokstrok));
			}
			String printOption = request.getParameter("print");
			if(!(gtype !=null && gtype.equalsIgnoreCase("Summary")) || (printOption != null && printOption.equalsIgnoreCase("yes")))
			{
				rootJson.put("imageURL", Qstring+"&er_width="+strImgWidth+"&er_height="+strImgHeight+"&option=graph&er_legendPosition=right");
			}
			else
			{
				Map requestMap = new HashMap(request.getParameterMap());
				if (requestMap.containsKey("drilldownenabled")) {
					requestMap.remove("drilldownenabled");
				}
				if (requestMap.containsKey("er_width")) {
					requestMap.remove("er_width");
				}
				if (requestMap.containsKey("er_height")) {
					requestMap.remove("er_height");
				}
				String qstring = ErUtils.prepareQueryString(requestMap);
				qstring = "/final/servlet/com.eg.ErSummaryC?"+qstring;

				rootJson.put("chartURL", qstring+"&er_width="+strGraphWidth+"&er_height="+strImgHeight+"&er_align=center&option=graph&er_view=APPLET");
			}

	com.eg.EgReportInfo reportinfo = new com.eg.EgReportInfo("manager");
	String strselectioncount = reportinfo.getValue("MISC","RightDisplaySelectioncount");
	int selectioncount=10;
	if(strselectioncount !=null && !strselectioncount.equals(""))
	{
		try
		{
			selectioncount = Integer.parseInt(strselectioncount);
		}
		catch (Exception e)
		{
			selectioncount = 10;
		}
	}
			if (singleSelection != null && singleSelection.size() >selectioncount)
			{
					int count1=0;
					for (int k=0; k <singleSelection.size();k++)
					{
						String st_key = (String)singleColors.get(k);
						String value = (String)singleSelection.get(k);
						if(st_key != null && st_key.indexOf("#") > -1)
						{
							st_key = st_key.substring(1,st_key.length());
						}
						//vec.add("http://192.168.10.48:7777/final/servlet/com.eg.ErImageDrawC?req="+st_key);
						//vec.add(value);
					if(k%2 ==0)
					{
					}
					else if(k%2 !=0)
					{
					}
					else
					{
					}
					}
					if(singleSelection.size()%2 !=0)
					{
					}
			}
		}
		rootJson.put("REPORT_PARAM", request.getQueryString());
		rootJson.put("REPORT_DATA", v_pdf_qry);
		HashMap param =new HashMap();
		param.put("REPORT_PARAM",ErUtils.parseQueryString(ErUtils.prepareQueryString(request.getParameterMap())));
		param.put("REPORT_DATA",v_pdf_qry);
		session.setAttribute("enlargedparameters", param);
	}
	rootJson.put("startdate", DateUtil.changeDateFormat(s_st_time,comFormat,currentDateFormat));

	rootJson.put("enddate", DateUtil.changeDateFormat(s_en_time,comFormat,currentDateFormat));

	hiddenObj = new JSONObject();
	hiddenObj.put("startmin", startMin);
	hiddenArr.add( hiddenObj);

	hiddenObj = new JSONObject();
	hiddenObj.put("endmin", endMin);
	hiddenArr.add( hiddenObj);
	rootJson.put("hiddens", hiddenArr);
	session.setAttribute("DrillDownPage","yes");
	String qryValue = Qstring.substring(Qstring.indexOf("?")+1,Qstring.length());
	String dataProcess =  mngrIProc+ "/final/reporter/ErMeasure.jsp"+";jsessionid="+ session.getId()+"?"+qryValue+"&print=yes&sample=yes&drillSes=yes&";
	session.setAttribute("DRILLDOWN_MAIL_URL",dataProcess);

	rootJson.put("DRILLDOWN_MAIL_URL",dataProcess);
	rootJson.put("screenLabels", labelObj);
	out.println(rootJson.toString());
	System.out.println("rootJson--->_______ 12345 "+rootJson);
}catch(Throwable e)
{
	e.printStackTrace();
}
%>