<!DOCTYPE html>
<%
	/**
	 ********************************************************************************************
	 * File Name	: ErPrintReport.jsp
	 * vesion		: eG5.0.x
	 * purpose		: collect data for print.
	 ********************************************************************************************
	*/
%>

<%@ include file="ErTracker.jsp"%>
<%@ page import="egurkha.reporter.*"%>
<%@ page import="com.eg.EgDateInfo"%>
<%@ page import="com.eg.EgThresholdInfo"%>
<%@ page import="com.eg.EgReportInfo"%>
<%@ page import="java.net.*"%>
<%@ page import="java.util.*"%>
<%@ page import="com.eg.EgTablesInfo"%>
<%@ page import="com.egurkha.util.DateTimeTokenizer"%>
<%@ page import="com.egurkha.util.DateUtil"%>
<%@ page import="com.eg.* "%>
<%@ page import="com.eg.EgURLEncoder"%>
<%@ page import="com.egurkha.User"%>
<%@ page import="com.eg.EgDbInfo"%>
<%@ page import="com.eg.EgConfigInfo"%>
<%@ 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.util.StringUtils"%>

<%
	// karthikeyan 

	String titleToDisplay=request.getParameter("er_RmDispName");				

try
{
	EgMappingInfo intlmap = null;
	if(thisuser !=null)
	{
		intlmap = new EgMappingInfo(thisuser.getLanguage());
	}
	ErUtils erUtils=new ErUtils();
	EgTimeZoneConverter converterStart=null;
	EgTimeZoneConverter converterEnd=null;
	String select_farm = request.getParameter("select_farm");
	if(select_farm!=null && select_farm.equalsIgnoreCase("--Default--"))
	{
		select_farm=intlmap.getTextDescription("reporter.common."+select_farm);
	}
	String strManagerURL = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort();
	// To get the Request Parameters
	Hashtable hstable =null;
	if (request.getParameter("er_reportType") != null && 
	request.getParameter("reporttype") != null && 
	request.getParameter("er_reportType").equalsIgnoreCase("operation") && 
	request.getParameter("reporttype").equalsIgnoreCase("operation"))
	{
		String qry_StrProces = (String)session.getAttribute("Report_Query_String");
		if(qry_StrProces !=null)
		{
			hstable = new Hashtable(ErUtils.parseQueryString(qry_StrProces));
		}
	}
	else
	{
		session.removeAttribute("Report_Query_String");
	}
	//
		String er_option =request.getParameter("er_option");
		String er_site = request.getParameter("er_site");
		String headerKeyName="";
				if(er_option!=null && er_option.equalsIgnoreCase("Segment"))
			{
			headerKeyName=intlmap.getTextDescription("reporter.common."+er_option)+" : "+er_site;
			}
			else if(er_option!=null && er_option.equalsIgnoreCase("Service"))
			{
			headerKeyName=intlmap.getTextDescription("reporter.common."+er_option)+" : "+er_site;
			}
			else if(er_option!=null && er_option.equalsIgnoreCase("Group"))
			{
			headerKeyName=intlmap.getTextDescription("reporter.common."+er_option)+" : "+er_site;
			}
			else if(er_option!=null && er_option.equalsIgnoreCase("Component"))
			{
				if(request.getParameter("er_compType")!=null)
						headerKeyName=intlmap.getTextDescription("reporter.common."+er_option)+" : "+intlmap.getComponentTypeDescription(request.getParameter("er_compType"));
				else if(request.getParameter("er_select_server")!=null)
						headerKeyName=intlmap.getTextDescription("reporter.common."+er_option)+" : "+intlmap.getComponentTypeDescription(request.getParameter("er_select_server"));
				else
					headerKeyName=intlmap.getTextDescription("reporter.common."+er_option);
			}
			else
			{
					headerKeyName=intlmap.getTextDescription("reporter.common.Zone")+" : "+select_farm;
			}
	//

	ErReqData erd =  null;
	if(hstable !=null)
	{
		erd = new ErReqData(hstable);
	}
	else
	{
		erd = new ErReqData(request);
	}
	//ErReqData erd = new ErReqData(request);
	EgThresholdInfo hreshholdInfo = new EgThresholdInfo("manager");
	EgReportInfo reportInfo = new EgReportInfo("manager");
	EgTablesInfo tablesInfo = new EgTablesInfo("manager");
	

	String mngrIP= new IniFile(new EgConfigInfo("manager").getDbFile()).getValue("DB_PROPERTIES","ManagerUrl");
	String StrDaychart = request.getParameter("daychartfor");
	String StrPrint = request.getParameter("er_view");
	String StrServer =request.getParameter("select_server1");
	String serverName=request.getParameter("select_server");
	String s_server=request.getParameter("er_select_comp");
	String er_trgttype=request.getParameter("er_trgttype");
	String uiFile = "eg_ui.ini";
	String s_iniFile_dir = EgInstallInfo.getInstallDir()+ "/manager/config/";
	IniFile egUI = new IniFile(s_iniFile_dir + uiFile);
	String currentDateFormat = strUserDateFormat;
	if(erd.s_timeline==null)
	{
		erd.s_timeline=(String)session.getAttribute("timeline");
	}
	String strCombinedGraphValue = reportInfo.getValue("MISC","CombinedGraph");
	boolean isCombinedGraph = true;
	if(strCombinedGraphValue!=null && (strCombinedGraphValue.equalsIgnoreCase("False") || strCombinedGraphValue.equalsIgnoreCase("No")))
		isCombinedGraph = false;

	EgDbInfo dbInfo = new EgDbInfo("manager");
	String fontStyleDblSingl = "";
	String pdfPrint = request.getParameter("pdfPrint");
	String drillDown = request.getParameter("drillDown");
	String drilldownenabled = request.getParameter("drilldownenabled");
	String sample = request.getParameter("sample");
		if(sample == null)
		{
			sample = "no";
		}

	if(((dbInfo!=null && dbInfo.doubleByteEnabled) || (thisuser!=null &&  !thisuser.getLanguage().equals("en_US"))) && !(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes") || (sample != null && !sample.equalsIgnoreCase("yes") && drilldownenabled !=null && drilldownenabled.equalsIgnoreCase("yes"))))
	//if((dbInfo.doubleByteEnabled || !thisuser.getLanguage().equals("en_US")) && !(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes")))
	{
		fontStyleDblSingl = "multi_font";
	}
	else
	{
		fontStyleDblSingl = "";
	}
%>

<!Doctype html>
<!-- <pd4ml:page.header areaHeight="40">
<img src="../reporter/images/logo.gif"  width="48" height="40"/>
</pd4ml:page.header> -->
<head>
<%
	if(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes"))
	{
%>
	<title><egui:intnl text="reporter.common.Reporter" />&nbsp<egui:intnl text="reporter.common.Print" /> &nbsp;</title>
	<%
	}
	else
	{
%>
	<title>eG Reporter</title>
<%
	}
%>

<meta name="Author" content="">
<meta  charset="UTF-8">

	
<link rel="stylesheet" type="text/css" href="../../final/styles/eGLightThemeIcons.css" />
<link rel="stylesheet" type="text/css" href="../../final/reporter/styles/printpagestyle.css" />
<script language="JavaScript1.2" src="../reporter/scripts/er_imagesLite.js"></script>
<script src="/final/scripts/DD_roundies_0.0.2a-min.js"  type='text/javascript'></script>

<script>
	DD_roundies.addRule('.box', 5, true);
</script>

</head>

<body marginwidth="20" marginheight="20" bgcolor="#FFFFFF">

<%
	String strLogCls = "printHeaderBoxLogo";
	if(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes"))
	{
		strLogCls = "printHeaderBoxLogo";
	}
	else
		strLogCls = "printPdfHeaderBoxLogo";

	if(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes"))
	{
%>
		<div class="<%=strLogCls%>" style="padding:10px"><img src="<%=imageName%>" border="0" /></div>
<%
	}
	else
	{
%>
		<div class="<%=strLogCls%>"><img src="<%=imageName%>" border="0" /></div>
<%
	}

Vector v_qry_string = null;
String NoofServers = null;
String chartType = null;
String Days = "";
String d1 = "";
String d2 = "";

String reporttype = request.getParameter("er_rtype");
String chk = request.getParameter("er_check");
String opt = request.getParameter("opt");
String s_sDate = request.getParameter("startdate");
String s_eDate = request.getParameter("enddate");
String s_sHr = request.getParameter("starthr");
String s_eHr = request.getParameter("endhr");
String s_sMin = request.getParameter("startmin");
String s_eMin = request.getParameter("endmin");

s_sHr = (s_sHr==null || s_sHr.equals("")) ? "00" : s_sHr;
s_eHr = (s_eHr==null || s_eHr.equals("")) ? "00" : s_eHr;
s_sMin = (s_sMin==null || s_sMin.equals("")) ? "00" : s_sMin;
s_eMin = (s_eMin==null || s_eMin.equals("")) ? "00" : s_eMin;

d1 = s_sDate + " " + s_sHr + ":" + s_sMin;
d2 = s_eDate + " " + s_eHr + ":" + s_eMin;

converterStart = new EgTimeZoneConverter(s_sDate + " " + s_sHr + ":" + s_sMin,thisuser);
converterEnd = new EgTimeZoneConverter(s_eDate + " " + s_eHr + ":" + s_eMin,thisuser);
String s_d1 = converterStart.getDateTime();
String e_d2 = converterEnd.getDateTime();

String st_comp ="";
String st_comptype ="";
String st_component = erd.s_component;
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+":"+intlmap.getComponentTypeDescription(st_comptype);
}

if(reporttype!=null)
{
	if(reporttype.equals("Session"))
	{
		NoofServers = reportInfo.getNoOfBars("CITRIX SESSION REPORT","top");
		chartType = reportInfo.getChartTypeForDist("CITRIX SESSION REPORT");
	}
	else if(reporttype.equals("Farm"))
	{
		NoofServers = reportInfo.getNoOfBars("ZONE_REPORT","top");
		chartType = reportInfo.getChartTypeForDist("ZONE_REPORT");
	}
	else if(reporttype.equals("CtxApplication"))
	{
		NoofServers = reportInfo.getNoOfBars("CITRIX_APPLICATION_REPORT","top");
		chartType = reportInfo.getChartTypeForDist("CITRIX_APPLICATION_REPORT");
	}
}

if(request.getParameter("opt")!=null
	&& request.getParameter("opt").equals("chart")
	&& reporttype!=null && reporttype.equals("Session"))
{
	v_qry_string = (Vector)request.getAttribute("sessionchartdata");
}
else if(opt!=null && opt.equals("chart")
	&& reporttype!=null && reporttype.equals("Farm"))
{
	v_qry_string = (Vector)request.getAttribute("zonechartdata");
}
else if(opt!=null && opt.equals("chart")
	&& reporttype!=null && reporttype.equals("CtxApplication"))
{
	v_qry_string = (Vector)request.getAttribute("appChartData");
}
else
{
	v_qry_string = (Vector)request.getAttribute("chartData");
}


String s_title;
int flag = 0;
//X-Axis Label Change - Start
String new_format = "";
String req_er_graphtype = (String)request.getParameter("er_gtype");
String gTypeChk = (String)request.getParameter("er_gtype");
String reportPeriod = request.getParameter("er_period");
String graphtype = request.getParameter("er_graphtype");
ErUtils utils = new ErUtils();
if(graphtype!=null && !graphtype.equals("") && graphtype.equalsIgnoreCase("Multiple"))
{
	if (v_qry_string !=null && v_qry_string.size() >0)
	{
		if (req_er_graphtype!=null && !req_er_graphtype.equals("") && req_er_graphtype.equalsIgnoreCase("Comparison"))
		{
			req_er_graphtype = "Measure";
			reportPeriod = "";
		}
		new_format = utils.getXAxisLabel(req_er_graphtype,s_sDate,s_eDate,s_sHr,s_eHr,s_sMin,s_eMin,reportPeriod,thisuser);
	}
}
//X-Axis Label Change - End
if (request.getParameter("er_reportType") != null && 
	request.getParameter("reporttype") != null && 
	request.getParameter("er_reportType").equalsIgnoreCase("operation") && 
	request.getParameter("reporttype").equalsIgnoreCase("operation"))
{
		//X-Axis Label Change - Start
		try{
		new_format = utils.getXAxisLabel(req_er_graphtype,s_sDate,s_eDate,s_sHr,s_eHr,s_sMin,s_eMin,reportPeriod,thisuser);
		}catch(Throwable ttt)
		{
			ttt.printStackTrace();
		}
		//X-Axis Label Change - End
%>
				<!-- Enter this loop when you need to draw more then one graph to draw -->


	<div class="printHeaderBox">
<%
	if (!StringUtils.isNull(titleToDisplay))
	{
%>
		<div class="printHeaderBoxTitle"><egui:intnl text="<%="reporter.operation."+ titleToDisplay%>" /></div>
<%
	}
	else
	{
%>
		<div class="printHeaderBoxTitle"><egui:intnl text="reporter.operation.OPERATION REPORTS" /> - <egui:intnl text="<%="reporter.operation."+erd.s_rtype.toUpperCase()%>" /> - <egui:intnl type="<%=st_component%>" /></div>
<%
	}
%>
		<!-- <div class="printHeaderBoxContent">Content will display here if needed</div> -->
<%
	if(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes"))
	{
%>
		<div class="printHeaderBoxPrintIcon" style="float:left"><img class="iconPrinter mouse" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" border="0"  onClick="javascript:print()" alt='<egui:intnl text="reporter.common.PRINT"/>' title='<egui:intnl text="reporter.common.PRINT"/>'/></div>
<%
	}
%>
	</div>
	<div class="printOuterBoxNoBorder"> 
		<div class="printSelectionFields"><egui:intnl text="reporter.common.Report Type" /> - <span class="bold"><egui:intnl text="<%="reporter.operation."+erd.s_gtype%>" /></span></div>
		<div class="printSelectionFields"><egui:intnl text="reporter.common.Timeline" /> - <span class="bold"><%=s_d1%>&nbsp;<egui:intnl text="reporter.common.hrs" /> <egui:intnl text="reporter.common.to" /> <%=e_d2%>&nbsp;<egui:intnl text="reporter.common.hrs" /></span></div>
	</div>

<%
//		int l=0;
	if (v_qry_string !=null && v_qry_string.size() >0)
	{				
		for (int x=0; x<v_qry_string.size(); x=x+2)
		{
			String s_component = (String)v_qry_string.get(x);
			Vector v_query = (Vector)v_qry_string.get(x+1);
			for (int q=0; q < v_query.size(); q = q+2)
			{
				s_title = (String)v_query.get(q);
				if(s_title.length() > 44)
				{
					flag++;
				}
			}
			String pdfThresh="margin-top:2px;";
			if(pdfPrint != null && pdfPrint.equalsIgnoreCase("yes"))
				pdfThresh="";
%>

<!-- <div class="clearDiv printHeaderBox" style="padding:0px 10px 0px 0px;margin-bottom:10px"></div> -->

<table align="center" cellspacing="0" cellpadding="0" width="100%" border="0" valign="top">
	<tr>
		<td align="right"><%=new_format%></td>
	</tr>
	<tr>
		<td align="right" style="padding: 5px 0px 5px 0px;">
			<div style="display:flex;float:right;">
				<div style="float:left;<%=pdfThresh%>"><svg height="10" width="10"><circle cx="4" cy="6" r="3" fill="#7c7e1d" stoke-width="0" /></svg></div>
				<div style="float:left;margin-right:10px;margin-left:3px;"><egui:intnl text="reporter.common.Max Critical" /></div>
				<div style="float:left;<%=pdfThresh%>"><svg height="10" width="10"><circle cx="4" cy="6" r="3" fill="#a2a51f" stoke-width="0" /></svg></div>
				<div style="float:left;margin-right:10px;margin-left:3px;"><egui:intnl text="reporter.common.Max Major" /></div>
				<div style="float:left;<%=pdfThresh%>"><svg height="10" width="10"><circle cx="4" cy="6" r="3" fill="#ced059" stoke-width="0" /></svg></div>
				<div style="float:left;margin-right:10px;margin-left:3px;"><egui:intnl text="reporter.common.Max Minor" /></div>
				<div style="float:left;<%=pdfThresh%>"><svg height="10" width="10"><circle cx="4" cy="6" r="3" fill="#f28a16" stoke-width="0" /></svg></div>
				<div style="float:left;margin-right:10px;margin-left:3px;"><egui:intnl text="reporter.common.Min Critical" /></div>
				<div style="float:left;<%=pdfThresh%>"><svg height="10" width="10"><circle cx="4" cy="6" r="3" fill="#f5ba79" stoke-width="0" /></svg></div>
				<div style="float:left;margin-right:10px;margin-left:3px;"><egui:intnl text="reporter.common.Min Major" /></div>
				<div style="float:left;<%=pdfThresh%>"><svg height="10" width="10"><circle cx="4" cy="6" r="3" fill="#f8d3bb" stoke-width="0" /></svg></div>
				<div style="float:left;margin-right:10px;margin-left:3px;"><egui:intnl text="reporter.common.Min Minor" /></div>
			</div>
		</td>
	</tr>
</table>

<div class="print OuterBox" style="border-top: 1px solid #b0b1b2;">
	<div class="printOuterBoxHeader" style="padding-top:  10px;"><%=s_component%></div>
		<table cellspacing="0" cellpadding="0" width="100%" height="auto" border="0">
													<!-- X-Axis Label Change - End -->
<%
			if(v_query.size() > 2)
			{
					
				String s_qryString = "";
				String borderBottomStyle="border-bottom:1px solid #dedede";
				int val=0;
				if(v_query.size() > 0){
					if((v_query.size() % 4) > 0){
						val=v_query.size() - (v_query.size() % 4);
					}else
					val = v_query.size() -  4;
				}
				for(int i=0;i<v_query.size();i+=4)
				{
					if( val == i)
						borderBottomStyle="";
%>
												
<%
					s_title = (String)v_query.get(i);
					s_qryString = (String)v_query.get(i+1);
					String strtit = s_title.substring(0,s_title.indexOf("("));
					String Qstring="";
//					l=l+2;
					String ctrlServlet = s_qryString.substring(0,s_qryString.indexOf("?")+1);
					s_qryString = s_qryString.substring(s_qryString.indexOf("?")+1,s_qryString.length());
					if(s_qryString!=null)
					{
						StringTokenizer strtok = new StringTokenizer(s_qryString,"&");
						while(strtok.hasMoreTokens())
						{
							String parameter = strtok.nextToken();
							int ind = parameter.indexOf("=");
							if (ind < 0)
								continue;
							String reqparam =parameter.substring(0,ind);
							if(reqparam!=null && (reqparam.equalsIgnoreCase("fav_name") || reqparam.equalsIgnoreCase("er_options") || reqparam.equalsIgnoreCase("showFrom") || reqparam.equalsIgnoreCase("call")))
									continue;


							String value = parameter.substring(ind+1);
							if(reqparam!=null&&reqparam.equals("startdate"))
							{
								value=com.eg.EgURLEncoder.encode(value, "UTF-8");
							}
							else if(reqparam!=null&&reqparam.equals("er_component"))
							{
								value=com.eg.EgURLEncoder.encode(value, "UTF-8");
							}
							else if(reqparam!=null&&reqparam.equals("er_info_list"))
							{
								value=customReplaceAll(value,"%23","0eghash0");
								value=com.eg.EgURLEncoder.encode(value, "UTF-8");
							}
							else if(reqparam!=null&&reqparam.equals("er_selection"))
							{
								value=com.eg.EgURLEncoder.encode(value, "UTF-8");
							}
							else if(reqparam!=null&&reqparam.equals("enddate"))
							{
								value=com.eg.EgURLEncoder.encode(value, "UTF-8");
							}
							else if(reqparam!=null&&reqparam.equals("er_timeline"))
							{
								value=com.eg.EgURLEncoder.encode(value, "UTF-8");
							}
							else if(reqparam!=null&&reqparam.equals("inidate"))
							{
								value=com.eg.EgURLEncoder.encode(value, "UTF-8");
							}
							else if(reqparam!=null&&reqparam.equals("limitforbg"))
							{
								value=com.eg.EgURLEncoder.encode(value, "UTF-8");
							}
							else if(reqparam!=null&&reqparam.equals("er_stdate"))
							{
								value=com.eg.EgURLEncoder.encode(value, "UTF-8");
							}
							else if(reqparam!=null&&reqparam.equals("er_enddate"))
							{
								value=com.eg.EgURLEncoder.encode(value, "UTF-8");
							}
							else if(reqparam!=null&&reqparam.equals("pdfTime"))
							{
								value=com.eg.EgURLEncoder.encode(value, "UTF-8");
							}
							else if(reqparam!=null&&reqparam.equals("er_infos"))
							{
								value=com.eg.EgURLEncoder.encode(value, "UTF-8");
							}
							else if(reqparam!=null&&reqparam.equals("er_usertimeline"))
							{
								value=com.eg.EgURLEncoder.encode(value, "UTF-8");
							}
							else if(reqparam!=null&&(reqparam.equals("er_userid") || reqparam.equals("userID") || reqparam.equals("uid") || reqparam.equals("us_id") || reqparam.equals("eruserid")|| reqparam.equals("er_RmDispName")))
							{
								value=com.eg.EgURLEncoder.encode(value, "UTF-8");
							}
							else if(reqparam!=null&&reqparam.equals("strbg_id"))
							{
								value=com.eg.EgURLEncoder.encode(value, "UTF-8");
							}
							Qstring += reqparam+"="+value.trim()+"&";
						}
					}
//					if((i+2 >= 12) && (i%12 == 0))
//					{
//									out.println("<br><br><br>");
//					}
%>
	<tr class="newimg">
		<td width="50%" style="padding:10px 10px 10px 0px;border-right:1px solid #dedede;<%=borderBottomStyle%>;" align="left" height="auto"  valign="top">
			<div class="print OuterBox" style="height:auto">
<%
					String strTest = s_title.substring(0,s_title.indexOf("/"));
					String strMeasure = strtit.substring(0,strtit.indexOf("/")) + ":"
							+ strtit.substring(strtit.indexOf("/")+1);
					s_title = intlmap.getTestDescription(strTest) + " / " 
							+ intlmap.getMeasureDescription(strTest,strMeasure)
							+ s_title.substring(s_title.indexOf(" ("));
					//if(s_title.length() > 50 && isCombinedGraph)
						//s_title = s_title.substring(0,50)+"...";
					String strImgWidth="350";
					//String strGraphWidth="460";
					String strGraphWidth="476";
					String strGraphHeight="225";
					if(!isCombinedGraph)
					{
						strGraphWidth="750";
						strGraphHeight="320";
						strImgWidth="95%";
					}
					if(flag > 0)
					{
%>
					<div style="height:42px;white-space:pre-wrap;padding-top:10px;" class="printOuterBoxHeader" ><%=s_title%></div>
<%
					}
					else
					{
%>
					<div style="height:42px;white-space:pre-wrap;padding-top:10px;" class="printOuterBoxHeader" style="padding:10px;"><%=s_title%></div>
<%
					}
%>
				<div style="width:100%;overflow:auto;padding:0px;height:auto;vertical-align: middle" ><img src="<%=ctrlServlet+Qstring%>&print=yes&er_width=<%=strGraphWidth%>&er_height=<%=strGraphHeight%>&option=graph" width="<%=strGraphWidth%>px" border="0px" height="auto" hspace="0" vspace="0" alt=" <%=v_query.elementAt(i)%>" title=" <%=v_query.elementAt(i)%>"></img></div>
			</div>
		</td>
<%
					if(v_query.size() == (i + 2))
					{
%>
		<td width="50%">&nbsp;</td>
<%
					}
					else
					{
					
 						s_title = (String)v_query.elementAt(i+2);
						s_qryString = (String)v_query.elementAt(i+3);
						String Qstring1="";
						s_qryString = s_qryString.substring(s_qryString.indexOf("?")+1,s_qryString.length());
						if(s_qryString!=null)
						{
							StringTokenizer strtok = new StringTokenizer(s_qryString,"&");
							while(strtok.hasMoreTokens())
							{
								String parameter = strtok.nextToken();
								int ind = parameter.indexOf("=");
								if (ind < 0)
									continue;
								String reqparam =parameter.substring(0,ind);
								if(reqparam!=null && (reqparam.equalsIgnoreCase("fav_name") || reqparam.equalsIgnoreCase("er_options") || reqparam.equalsIgnoreCase("showFrom") || reqparam.equalsIgnoreCase("call")))
									continue;


								String value = parameter.substring(ind+1);
								if(reqparam!=null&&reqparam.equals("startdate"))
								{
									value=com.eg.EgURLEncoder.encode(value, "UTF-8");
								}
								else if(reqparam!=null&&reqparam.equals("er_component"))
								{
									value=com.eg.EgURLEncoder.encode(value, "UTF-8");
								}
								else if(reqparam!=null&&reqparam.equals("er_info_list"))
								{
								value=customReplaceAll(value,"%23","0eghash0");
									value=com.eg.EgURLEncoder.encode(value, "UTF-8");
								}
								else if(reqparam!=null&&reqparam.equals("er_selection"))
								{
									value=com.eg.EgURLEncoder.encode(value, "UTF-8");
								}
								else if(reqparam!=null&&reqparam.equals("enddate"))
								{
									value=com.eg.EgURLEncoder.encode(value, "UTF-8");
								}
								else if(reqparam!=null&&reqparam.equals("er_timeline"))
								{
									value=com.eg.EgURLEncoder.encode(value, "UTF-8");
								}
								else if(reqparam!=null&&reqparam.equals("inidate"))
								{
									value=com.eg.EgURLEncoder.encode(value, "UTF-8");
								}
								else if(reqparam!=null&&reqparam.equals("limitforbg"))
								{
									value=com.eg.EgURLEncoder.encode(value, "UTF-8");
								}
								else if(reqparam!=null&&reqparam.equals("er_stdate"))
								{
									value=com.eg.EgURLEncoder.encode(value, "UTF-8");
								}
								else if(reqparam!=null&&reqparam.equals("er_enddate"))
								{
									value=com.eg.EgURLEncoder.encode(value, "UTF-8");
								}
								else if(reqparam!=null&&reqparam.equals("pdfTime"))
								{
									value=com.eg.EgURLEncoder.encode(value, "UTF-8");
								}
								else if(reqparam!=null&&reqparam.equals("er_infos"))
								{
									value=com.eg.EgURLEncoder.encode(value, "UTF-8");
								}
								else if(reqparam!=null&&(reqparam.equals("er_userid") || reqparam.equals("userID") || reqparam.equals("uid") || reqparam.equals("us_id") || reqparam.equals("eruserid")|| reqparam.equals("er_RmDispName")))
								{
									value=com.eg.EgURLEncoder.encode(value, "UTF-8");
								}
								else if(reqparam!=null&&reqparam.equals("er_usertimeline"))
								{
									value=com.eg.EgURLEncoder.encode(value, "UTF-8");
								}
								else if(reqparam!=null&&reqparam.equals("strbg_id"))
								{
									value=com.eg.EgURLEncoder.encode(value, "UTF-8");
								}
								Qstring1 += reqparam+"="+value.trim()+"&";
							}
						}
					if(!isCombinedGraph)
					{
%>
	</tr>
	<tr class="newimg">
<%
					}
%>
		<td  width="50%"  style="padding:10px 0px 10px 10px;<%=borderBottomStyle%>;" align="left" valign="top">
			<div class="print OuterBox">
<%
//						if((i >= 12)&&(i%12 == 0))
//						{
//							out.println("<br><br><br><br><br><br><br><br><br><br><br><br>");
//						}
%>
			
<%
						String strtitlein = (String)v_query.elementAt(i+2);
						String strtit1 = s_title.substring(0,s_title.indexOf("("));
						strTest = strtitlein.substring(0,strtitlein.indexOf("/"));
						strMeasure = strtit1.substring(0,strtit1.indexOf("/")) + ":"
								+strtit1.substring(strtit1.indexOf("/")+1);
						s_title = intlmap.getTestDescription(strTest) + " / " 
								+ intlmap.getMeasureDescription(strTest,strMeasure)
								+s_title.substring(s_title.indexOf(" ("));
						//if(s_title.length()>50 && isCombinedGraph)
							//s_title = s_title.substring(0,50)+"...";
						if(flag > 0)
						{
%>
					<div style="height:42px;white-space:pre-wrap;padding-top:10px;" class="printOuterBoxHeader"><%=s_title%></div>
<%
						}
						else
						{
%>
					<div style="height:42px;white-space:pre-wrap;padding-top:10px;" class="printOuterBoxHeader" style="padding:10px;"><%=s_title%></div>
<%
						}
%>

					<div style="width:100%;overflow:auto;padding:0px;vertical-align: middle"><img src="<%=ctrlServlet+Qstring1%>&print=yes&er_width=<%=strGraphWidth%>&er_height=<%=strGraphHeight%>&option=graph" width="<%=strGraphWidth%>px" border="0"  height="auto" hspace="0" vspace="0" alt=" <%=(String)v_query.elementAt(i+2)%>" title=" <%=(String)v_query.elementAt(i+2)%>"></img></div>
			</div>
		</td>
<%
					}
%>
	</tr>
<%
				}
%>
</table>
</div>


<br>
<%
			}
			else if(v_query.size() == 2)
			{
//				l=l+2;
				String reportFor = request.getParameter("reportFor");
				String s_qryString = "";
				for(int j=0 ;j < v_query.size(); j=j+2)
				{
					s_title = (String)v_query.get(j);
					s_qryString = (String)v_query.get(j+1);
					String strtit = "";
					if(reportFor!=null && reportFor.equalsIgnoreCase("compareGraph"))
						strtit = s_title;//.substring(0,s_title.indexOf(""));
					else
						strtit = s_title.substring(0,s_title.indexOf("("));
					String Qstring2="";
					String valuestr ="";
					if(s_qryString!=null)
					{
						StringTokenizer strtok = new StringTokenizer(s_qryString,"&");
						while(strtok.hasMoreTokens())
						{
							String param = strtok.nextToken();
							if(param!=null && param.indexOf("=")>-1){
							String reqparam =param.substring(0,param.indexOf("="));
							valuestr = param.substring(param.indexOf("=")+1,param.length());
							Qstring2=Qstring2+reqparam+"="+EgURLEncoder.encode(valuestr,"UTF-8")+"&";
							}else
							Qstring2=Qstring2+param;
						}
					}
					Qstring2+="&option=graph&print=yes";
%> <!--GRAPH IMAGE  CONTAINER STARTS HERE-->
		<tr class="newimg">
			<td width="100%" style="padding:0px 10px 10px 0px" height="auto">
				<div class="printOuterBox" >
	
<%

				if(reportFor!=null && reportFor.equalsIgnoreCase("compareGraph")) {
%>

					<div class="printOuterBoxHeader"><span class="<%=fontStyleDblSingl%>"> <egui:intnl text="<%=s_title%>" /> </span></div>
<%
				}else {
%>
					<div class="printOuterBoxHeader"><span class="<%=fontStyleDblSingl%>"> <egui:intnl test="<%=s_title.substring(0,s_title.indexOf("/"))%>" />/ <egui:intnl measure="<%=strtit.substring(0,strtit.indexOf("/"))+":"+strtit.substring(strtit.indexOf("/")+1)%>" /> <%=s_title.substring(s_title.indexOf("("))%> </span></div>
<%
					}
%>
					<div  class="newimg" style="width:100%;overflow:auto;padding:0px" height="auto"><img src="<%=Qstring2%>&er_width=900&er_height=400&option=graph" hspace="0" height="auto" vspace="0" alt="<%=v_qry_string.get(j)%>" title="<%=v_qry_string.get(j)%>"/> </div>
				</div>
			</td>
		</tr>
							<!--GRAPH IMAGE CONTAINER ENDS HERE 1111111111-->

<%
				
//	if(l == 6)
//	{
%>
											<!--<pd4ml:page.break/>

												<pd4ml:page.header areaHeight="10"/> -->
<%
//	l=0;
//	}

				}
			}
		}
%>
<!--  here td and tr added by dine  -->
										<!-- 	</td>
										</tr> -->
<%
	}
	else
	{
%>
	<table width="100%" height="100%" height='100%' align="center" valign='middle' cellspacing="0" cellpadding="0" border="0">
		<tr>
			<td>
				<table width='100%' height='100%'>
					<tr>
						<td align='center' valign='middle'><div class="errorMsgBox"><img src='/final/images/Light/nomeasures_custom.png' /></div></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>	
<%
	}
}
else
{
	if(v_qry_string !=null)
	{
		for(int k=0;k<v_qry_string.size();k+=2) //New Fix
		{
			s_title = (String)v_qry_string.get(k);
			if(s_title.length() > 44)
			{
				flag++;
			}
		}
	}

	// set all print Report Title start
	if(v_qry_string != null && v_qry_string.size() > 2)
	{
%> <!-- Enter this loop when you need to draw more then one graph to draw --> 
<div class="printHeaderBox">

<%
		if(erd.s_gtype == null)
		{
			erd.s_gtype = (String) hstable.get("er_rtype");
		}
		
		if(erd.s_gtype != null && erd.s_rtype!=null && request.getParameter("er_trgttype")!=null && erd.s_rtype.equalsIgnoreCase("Micro") && (request.getParameter("er_trgttype")).equalsIgnoreCase("CitrixUser"))
		{
%>
			<div class="printHeaderBoxTitle"><egui:intnl text="reporter.common.Farm" /> -&nbsp; <%=select_farm%> &nbsp;<egui:intnl text="reporter.common.User"/>&nbsp;-&nbsp;
<%
			String user = request.getParameter("er_user");
			if(user == null)
				user = request.getParameter("er_tuser");
%> 
						<%=user%>&nbsp; </div>
<%
		}
		else if(erd.s_gtype!=null && erd.s_gtype.equals("Citrix"))
		{
			if(reporttype!=null && reporttype.equals("Farm") && request.getParameter("er_check").equalsIgnoreCase("CtxZone"))
			{
				Days = reportInfo.getExcludeWeekend("ZONE_REPORT");
%>

	<% if (!StringUtils.isNull(titleToDisplay)){ %>

			<div class="printHeaderBoxTitle"><%=titleToDisplay%> &nbsp; For &nbsp;<%=select_farm%></div>

	<% } else { %>

			<div class="printHeaderBoxTitle"><egui:intnl text="reporter.common.Thin Client Zone Report" /> &nbsp; : &nbsp;<%=select_farm%></div>
		<% } %>



<%
			}
			else if(reporttype!=null && reporttype.equals("Farm") && request.getParameter("er_check").equalsIgnoreCase("operation"))
			{
				Days = reportInfo.getExcludeWeekend("ZONE_REPORT");
%>
			<div class="printHeaderBoxTitle">

								<% if (!StringUtils.isNull(titleToDisplay)){ %>
			     	<%=titleToDisplay%> &nbsp; For
					&nbsp;<%=select_farm%></div>

							<% } else { %>
								 	<egui:intnl text="reporter.common.Consolidated Zone Report" /> &nbsp; : &nbsp;
					&nbsp;<%=select_farm%></div>
							<% } %>



<%
			}
			else if(reporttype!=null && reporttype.equals("CtxApplication"))
			{
					Days = reportInfo.getExcludeWeekend("APPLICATION_REPORT");
%>
			<div class="printHeaderBoxTitle">

								<% if (!StringUtils.isNull(titleToDisplay)){ %>
							
						<div style="float:left"><%=titleToDisplay%>&nbsp; For </div>
								<% } else { %>

						<egui:intnl text="reporter.common.Thin Client Application Activity  Report" />&nbsp; : 
										<% } %>

						<%=headerKeyName%></div>
<%
			}
			if(erd.s_gtype != null && erd.s_gtype.equalsIgnoreCase("Citrix") && erd.s_rtype!=null && erd.s_rtype.equalsIgnoreCase("Session"))
			{
				Days = reportInfo.getExcludeWeekend("CITRIX SESSION REPORT");
%>
				<div class="printHeaderBoxTitle">

				<% if (!StringUtils.isNull(titleToDisplay)){ %>
	<%=titleToDisplay%> For
								<% } else { %>

			<egui:intnl text="reporter.common.Thin Client Reports" /> - <egui:intnl text="reporter.common.Session" />
											<% } %>

									<%=headerKeyName%>

				</div>
<%
			}
		}
		else if(erd.s_gtype != null && erd.s_gtype.equalsIgnoreCase("Comparison"))
		{
			String type = request.getParameter("er_type");
			String tit = "";
			if(type != null && (type.equalsIgnoreCase("comparison")))
				tit = "reporter.executive.COMPONENTS";
			else
				tit = "reporter.executive.TESTS";
	if (!StringUtils.isNull(titleToDisplay)){
%>
				<div class="printHeaderBoxTitle"><%= titleToDisplay %></div>
<%
	} else {
%>
				<div class="printHeaderBoxTitle"><egui:intnl text="reporter.common.COMPARISON REPORTS" />&nbsp;-&nbsp;<egui:intnl text="<%=tit%>" /></div>
<%
	}
		}
		else if ("Micro".equalsIgnoreCase(request.getParameter("er_rtype")) && "CitrixUser".equalsIgnoreCase(request.getParameter("er_trgttype")))
		{
%>
				<div class="printHeaderBoxTitle"><egui:intnl text="reporter.common.Thin Client User Report" /> - <%=request.getParameter("er_component")%> &nbsp;</div>
<%
		}
		else if(erd.s_gtype != null && erd.s_gtype.equalsIgnoreCase("Citrix")&&erd.s_rtype!=null&&erd.s_rtype.equalsIgnoreCase("Session"))
		{
			 Days = reportInfo.getExcludeWeekend("CITRIX SESSION REPORT");
%>
				<div class="printHeaderBoxTitle"><egui:intnl text="reporter.common.Thin Client Reports" />-<egui:intnl text="reporter.session.Session" /> - <%=select_farm%> &nbsp;</div>
<%
		}
		else 
		{
%>
				<div class="printHeaderBoxTitle"><egui:intnl text="reporter.operation.OPERATION REPORTS" /> - <egui:intnl text="<%="reporter.operation."+erd.s_rtype.toUpperCase()%>" /> - <egui:intnl type="<%=st_component%>" /> &nbsp;</div>
<%
		}

		if(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes"))
		{
%>
			<div class="printHeaderBoxPrintIcon" ><img class="iconPrinter mouse" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" border="0"  onClick="javascript:print()" alt='<egui:intnl text="reporter.common.PRINT"/>' title='<egui:intnl text="reporter.common.PRINT"/>'/></div>
<%
		}
%>
</div>
<div class="printOuterBoxNoBorder"> 

<%
		if(!(erd.s_gtype!=null && erd.s_gtype.equalsIgnoreCase("comparison")))
		{
			if(chk == null || chk.equals("CtxZone"))
			{
%>
				
<%
				if(erd.s_gtype !=null && erd.s_gtype.equalsIgnoreCase("Citrix"))
				{
%>
				<div class="printSelectionFields"><egui:intnl text="reporter.common.Report Type" /> - <span class="bold"><egui:intnl text="reporter.common.Thin client" /></span></div>
<%
				}
				else
				{
%>
			
				<div class="printSelectionFields"><egui:intnl text="reporter.common.Report Type" /> - <span class="bold"><egui:intnl text="<%="reporter.operation."+erd.s_gtype%>" /></span></div>
<%
				}

			}
			else if(chk!=null && chk.equals("operation"))
			{
%>
				<div class="printSelectionFields"><egui:intnl text="reporter.common.Report Type" /> - <span class="bold"><egui:intnl text="reporter.consolidated.Consolidated" /></span></div>

<%
			}
		}

		// all print report Tile end here
		if(erd.s_timeline != null)
		{
			String s_stmonth = "";
			String s_styear = "";
			String s_endmonth = "";
			String s_endyear = "";
			String s_period = request.getParameter("er_period");
			EgDateInfo egDt = new EgDateInfo();
			long msecsPerHour = (long) 1000 * 60 * 60;
			String [] months = {"January","February","March","April","May","June","July","August","September","October","November","December"};

			if(erd.s_timeline.equalsIgnoreCase("Any"))
			{
				
				if(s_period == null || s_period.equals("") 
					|| s_period.equals("H") || s_period.equalsIgnoreCase("null"))
				{
					erd.s_enddate = erd.s_enddate + " " + erd.s_endhr + "hrs";
					erd.s_stdate = erd.s_stdate + " " + erd.s_sthr + "hrs";
				}
				else if(s_period.equals("M"))
				{
					Calendar cal_st = new GregorianCalendar();
					Calendar cal_end = new GregorianCalendar();
					java.util.Date dt_st = egDt.egetDateUS(erd.s_stdate);
					java.util.Date dt_end = egDt.egetDateUS(erd.s_enddate);
					cal_st.setTime(dt_st);
					cal_end.setTime(dt_end);
					int i_st = cal_st.get(Calendar.MONTH);
					s_stmonth = months[i_st];
					s_styear = "" + cal_st.get(Calendar.YEAR);
					int i_end = cal_end.get(Calendar.MONTH);
					s_endmonth = months[i_end];
					s_endyear = "" + cal_end.get(Calendar.YEAR);
					erd.s_stdate = s_stmonth + " " + s_styear;
					erd.s_enddate = s_endmonth + " " + s_endyear;
				}
			}
			else
			{
				int blankSpaceIndex = erd.s_timeline.indexOf(DateTimeTokenizer.BLANK_SPACE);
				String  value = erd.s_timeline.substring(0,erd.s_timeline.indexOf(" "));
				String unit = erd.s_timeline.substring(blankSpaceIndex+1).toLowerCase();
				int timeValue=0;
				if (unit.startsWith("h"))
				{//hours
					timeValue=Integer.parseInt(value);
				}
				else if (unit.startsWith("d"))
				{//days
					timeValue=Integer.parseInt(value) *24;
				}
				else if (unit.startsWith("w"))
				{//weeks
					timeValue= (7 * 24 *Integer.parseInt(value));
				}
				else if (unit.startsWith("mo"))
				{//months
					timeValue= (30 * 24 * Integer.parseInt(value));
				}
				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.HOUR_OF_DAY,1);
				java.util.Date dt_temp1 = cal_temp.getTime();
				long l_temp = dt_temp1.getTime();
				erd.s_enddate = egDt.egetDateUS(l_temp);
				erd.s_stdate = egDt.egetDateUS(l_temp-((timeValue* msecsPerHour)));
				if ((erd.s_gtype != null && erd.s_gtype.equals("Summary")) &&
					(s_period != null && s_period.equals("M")))
				{
					Calendar cal_prev = new GregorianCalendar();
					java.util.Date dt_tmp1 = egDt.egetDateUS(erd.s_stdate); 
					cal_prev.setTime(dt_tmp1);
					int xx = cal_temp.get(Calendar.MONTH);
					s_endmonth = months[xx];
					s_endyear = "" + cal_temp.get(Calendar.YEAR);
					int yy = cal_prev.get(Calendar.MONTH);
					s_stmonth = months[yy];
					s_styear = "" + cal_prev.get(Calendar.YEAR);
					erd.s_stdate = s_stmonth + " " + s_styear;
					erd.s_enddate = s_endmonth + " " + s_endyear;
				}
				else
				{
					if(erd.s_gtype != null && erd.s_gtype.equals("Summary")) 
					{
						erd.s_enddate = erd.s_enddate.substring(0,erd.s_enddate.indexOf(" "));
						erd.s_stdate =erd.s_stdate.substring(0,erd.s_stdate.indexOf(" "));
					}
					else
					{
						/*erd.s_enddate = erd.s_enddate.substring(0,erd.s_enddate.indexOf(":"));
						erd.s_stdate =erd.s_stdate.substring(0,erd.s_stdate.indexOf(":"));
						erd.s_stdate = erd.s_stdate + "Hrs";
						erd.s_enddate = erd.s_enddate + "Hrs";*/
					}
				}
			}
		}

		String timefrom=request.getParameter("timefrom");
		String timeto=request.getParameter("timeto");
		String minfrom=request.getParameter("minfrom");
		String minto=request.getParameter("minto");
		String StrExe=request.getParameter("er_excwe");
		if(StrExe!=null && !StrExe.equals("") && !StrExe.equals("null")) {
			StrExe = EgURLDecoder.decode(StrExe,"UTF-8");
		}
		if(StrExe!=null && StrExe.trim().equalsIgnoreCase("Yes"))
		{
%> 
			<div class="printSelectionFields"><egui:intnl text="reporter.common.Exclude WeekEnds" /> - <span class="bold"><%=Days%></span></div>
<%
		}
		String displayTitle="";
		String s_dataFrom=request.getParameter("er_dataFrom");
		if(s_dataFrom!=null && s_dataFrom.equalsIgnoreCase("Service"))
		{
			if(request.getParameter("sess_service")!=null)
			displayTitle=""+(request.getParameter("sess_service"));
			else
			displayTitle=""+(request.getParameter("er_service"));
%>
			<div class="printSelectionFields"><egui:intnl text="reporter.common.Service Name" /> - <span class="bold"><%=displayTitle%></span></div>
<%
		}
%>
		<div class="printSelectionFields"><egui:intnl text="reporter.common.Timeline" /> - <span class="bold"><%=s_d1%>&nbsp;<egui:intnl text="reporter.common.hrs" /> to <%=e_d2%>&nbsp;<egui:intnl text="reporter.common.hrs" /></span></div>

<%

		if(erd.s_gtype!=null && erd.s_gtype.equals("Citrix")|| chk!=null && chk.equals("operation"))
		{
%>	
			<!--<div style="clear:both;float:right;padding:4px;">
				<div style="float:left" class="formLabel"><egui:intnl text="reporter.common.Time Period" /></div>
				<div style="float:left;width:10px" align="center">:</div>
				<div style="float:left;" class="formValue"><%=timefrom+":"+minfrom%><egui:intnl text="reporter.common.hrs" />&nbsp;<egui:intnl text="reporter.common.to" />&nbsp;<%=timeto+":"+minto%><egui:intnl text="reporter.common.hrs" /> </div>
			</div>	 -->
			<div class="printSelectionFields" ><egui:intnl text="reporter.common.Time Period"/> - <span class="bold"><%=timefrom+":"+minfrom %>&nbsp;<egui:intnl text="reporter.common.to" />&nbsp;<%=timeto+":"+minto%></span></div>
<%
		}		
%>
</div>

	<!-- X-Axis Label Change - Start -->
			<%
				if(graphtype!=null && !graphtype.equals("") && graphtype.equalsIgnoreCase("Multiple"))
				{
			%>
<table class="cellbgdark" align="center" cellspacing="0" width="97%" border="0">
	<tr>
		<td align="right"><%=new_format%></td>
	</tr>
</table>
<%
				}
%>

										<!-- X-Axis Label Change - End -->
											<!--THE ROW THAT HAS TO BE REPEATED FOR SHOWING GRAPHS STARTS HERE-->
											<%
		String s_qryString = "";
		if(erd.s_gtype != null && erd.s_gtype.equalsIgnoreCase("Citrix"))
		{
			int count = 0;
			flag=0;
			if(v_qry_string !=null)
			{
				for(int k=0;k<v_qry_string.size();k+=2) //New Fix
				{
					s_title = (String)v_qry_string.get(k);
					if(s_title.length() > 44)
					{
						flag++;
					}
				}
			}

			String Str_units="";
			String Str_test="";
			String Str_mes="";
			for(int i=0; i<v_qry_string.size(); i+=4)
			{
				s_title= (String)v_qry_string.get(i);
				if(s_title.indexOf("*")>-1)
					s_title = s_title.replace('*','%');
				if(s_title!=null&&s_title.equals("CtxSessionTest/Active_sessions"))
					s_title ="CtxSessionTest/Active_sessions ";
				if(s_title!=null&&s_title.equals("CtxLogintest/DURATION"))
					s_title ="CtxLogintest/DURATION  (Mins)";
				if(s_title!=null&&s_title.equals("CtxSessionTest/USERNAME"))
					s_title ="CtxSessionTest/USERNAME (Number)";
				if(s_title!=null&&s_title.equals("No Of Sessions Completed"))
					s_title ="No Of Sessions Completed (Number)";

				String st_qryString = (String)v_qry_string.get(i+1);
				//Adding the title and the URL of the image for saving to PDF
				String theWidth = "";
				String theHeight = "";
				theWidth = "450";
				theHeight = "300";
				if(chartType!=null && chartType.equalsIgnoreCase("Pie"))
				{
					theWidth = "900";
					theHeight = "250";
				}
				else
				{
					theWidth = "930";
					theHeight = "370";
				}
				String queryString = "";
				String controlfile = st_qryString.substring(0,st_qryString.indexOf("?"));
				st_qryString = st_qryString.substring(st_qryString.indexOf("?")+1);
				HashMap param = ErUtils.parseQueryString(st_qryString);
				Set s_param = param.keySet();
				Iterator i_param = s_param.iterator();
				while(i_param.hasNext())
				{
					String st_key = (String)i_param.next();
					String value = "";//(String)param.get(st_key);

					try
					{
						value = (String)param.get(st_key);
						
					}catch (ClassCastException e)
					{
							value = ((String[])param.get(st_key))[0];

//						String [] compArray = ((String[])param.get(st_key));
//						for (int j = 0;j < compArray.length; j++)
//						{
//							if(compArray[j] != null && !compArray[j].equals(""))
//							{
//								try
//								{
//									queryString += st_key+ "=" +EgURLEncoder.encode(compArray[j],"UTF-8")+ "&";
//								}catch(Exception e1){}
//								
//							}
//						}
					}
					if(st_key!=null&&st_key.equals("er_test"))
					{
						Str_test = value;
					}
					else if(st_key!=null&&st_key.equals("er_meas"))
					{
						Str_mes=value;
					}
					queryString+=st_key+ "=" + URLEncoder.encode(value) + "&";
				}
				
				queryString = controlfile+"?"+queryString;
				String Qstring="";
				if(queryString!=null)
				{
					StringTokenizer strtok = new StringTokenizer(queryString,"&");
					while(strtok.hasMoreTokens())
					{
						String param1 = strtok.nextToken();
						if(param1!=null)
						{
							String reqparam = param1.substring(0,param1.indexOf("="));
							String value = param1.substring(param1.indexOf("=")+1,param1.length());
							if(reqparam.equals("er_component"))
							{
								value = request.getParameter(reqparam);
								if(value!=null)
									Qstring = Qstring+reqparam+"="+EgURLEncoder.encode(value,"UTF-8")+"&";
							}
							if(reqparam.equals("select_farm"))
							{
								value = request.getParameter(reqparam);
								if(value!=null)
									Qstring = Qstring+reqparam+"="+EgURLEncoder.encode(value,"UTF-8")+"&";
							}
							//new 
							if(reqparam.equals("er_dismeas"))
							{
								value = request.getParameter(reqparam);
								if(value!=null)
									Qstring = Qstring+reqparam+"="+erUtils.specialCharEncode(value);

							}
							if(reqparam.equals("er_view"))
							{
								value = request.getParameter(reqparam);
								if(value.equals("PRINT"))
								{
									continue;
								}
							}
//							else
//							{
								Qstring = Qstring+reqparam+"="+value+"&";
//							}
						}else
						{
							if(param1!=null && param1.startsWith("/final"))
								Qstring+=param1;
						}
					}
				}
				if(reporttype!=null&&!reporttype.equalsIgnoreCase("Session"))
				{
					Str_units = tablesInfo.getUnitForMeasure(Str_test,Str_mes);
					if(s_title!=null && s_title.equalsIgnoreCase("Number of unique users"))
					{
						s_title = s_title + " (Number)";
					}
					else
					{
					s_title = s_title + " ("+Str_units+")";
					}
				}
%>
	<table align="center" width="100%" cellspacing="0" cellpadding="0" border="0">

	<tr>
			<!--GRAPH IMAGE CONTAINER STARTS HERE-->
		<td >
			<div class="printOuterBox">
				<div class="printOuterBoxHeader"><%=s_title%></div>
			<table align="center" cellspacing="0" cellpadding="0" border="0"  width='<%=theWidth%>' height='<%=theHeight%>' class="printTable">
			<tr>
				<td align="center" width="50%">
					<div class="printOuterBox" >
					<!-- This img url has a parameter of er_view=PRINT when this url gets loaded, then for background-pdf, the image not gets added
					so changing the src queryString so that the image gets loaded in both normal pdf and background-pdf-->
						<!-- <img src="<%=queryString%>&optt=graph&er_view=IMAGE" border="0" hspace="0" vspace="0"/></img> -->
						<img src="<%=Qstring%>&optt=graph&er_view=IMAGE" border="0" hspace="0" vspace="0"/></img>
					</div>
					<div class="clearDiv">&nbsp;</div>
				</td>
			</tr>
				<!-- <tr>

<%
				if(flag>0)
				{
%>
					<td wrap class="printTableHeader"><%=s_title%></td>
<%
				}
				else
				{
%>
					<td wrap class="printTableHeader"> <%

					String stest_mes="";
					if(stest_mes.indexOf("(")>-1)
					{
						stest_mes = s_title.substring(0,s_title.indexOf("("));
					}
					else
					{
						stest_mes = s_title;
					}
					if(stest_mes.indexOf("/")>-1)
					{
						String stest = stest_mes.substring(0,stest_mes.indexOf("/"));
						String smeas = stest_mes.substring(stest_mes.indexOf("/")+1);
%>
									<!--<egui:intnl test="<%=stest%>" />/<egui:intnl measure="<%=stest+":"+smeas%>" /></td>--><!--
<%
					}
					else
					{
%>
									<egui:intnl test="<%=stest_mes%>" /></td>
<%
					}
				}
%>
				</tr> -->
				<!--<tr>-->

<%				if(chartType!=null && chartType.equalsIgnoreCase("Pie"))
				{
%>					<!--  <div class="printOuterBoxHeader"><%=s_title%></div>-->
<%				
				}
				else
				{
%>					
					<!--   <div class="printOuterBoxHeader"><%=s_title%></div>	 -->
<%					   
				}
				
%>
			<!--	</tr>								<!--GRAPH IMAGE CONTAINER ENDS HERE-->
													<%
				if(v_qry_string.size() == (i + 2))
				{
%>
					<td align="center" width="50%"><!--BLANK CELL OR NO GRAPH-->&nbsp;</td>
													<%
				}
				else
				{
					s_title = (String)v_qry_string.elementAt(i+2);
					if(s_title.indexOf("*")>-1)
					s_title = s_title.replace('*','%');
					if(s_title!=null && s_title.equals("CtxSessionTest/Active_sessions"))
						s_title ="CtxSessionTest/Active_sessions (Number)";
					if(s_title!=null && s_title.equals("CtxLogintest/DURATION"))
						s_title ="CtxLogintest/DURATION  (Mins)";
					if(s_title!=null && s_title.equals("CtxSessionTest/USERNAME"))
						s_title ="CtxSessionTest/USERNAME (Number)";
					if(s_title!=null && s_title.equals("No Of Sessions Completed"))
						s_title ="No Of Sessions Completed (Number)";

					s_qryString = (String)v_qry_string.elementAt(i+3); 
					String ertest = request.getParameter("er_test");
					String ermeas = request.getParameter("er_meas");
					String query_String="";
					controlfile = s_qryString.substring(0,s_qryString.indexOf("?"));
					query_String = s_qryString.substring(s_qryString.indexOf("?")+1);
					String qrydata = "";
					param  = ErUtils.parseQueryString(query_String);
					s_param = param.keySet();
					i_param = s_param.iterator();
					String Tinfos[]=null;
					String er_test="";
					String er_meas="";
					String qstr="";
					while(i_param.hasNext())
					{
						String st_key = (String)i_param.next();
						String value = "";//(String)param.get(st_key);
						try
						{
							value = (String)param.get(st_key);
							
						}catch (ClassCastException e)
						{
							value = ((String[])param.get(st_key))[0];
						}
						if(st_key.equals("er_test"))
							er_test = value;
						if(st_key.equals("er_meas"))
							er_meas = value;
						if(st_key.equals("select_farm"))
							value=EgURLEncoder.encode(value,"UTF-8");
						if(st_key.equals("er_trgttype"))
							value=EgURLEncoder.encode(value,"UTF-8");
						if(st_key.equals("er_priority"))
							value=EgURLEncoder.encode(value,"UTF-8");
						if(st_key.equals("er_timeline"))
							value=EgURLEncoder.encode(value,"UTF-8");
						if(st_key.equals("er_dismeas"))
							value = erUtils.specialCharEncode(value);//value=EgURLEncoder.encode(value,"UTF-8");
						if(st_key.equals("er_usertimeline"))
							value=EgURLEncoder.encode(value,"UTF-8");
						if(st_key.equals("startdate"))
							value=EgURLEncoder.encode(value,"UTF-8");
						if(st_key.equals("enddate"))
							value=EgURLEncoder.encode(value,"UTF-8");
						if(st_key.equals("inidate"))
							value=EgURLEncoder.encode(value,"UTF-8");
						if(st_key.equals("pdfTime"))
							value=EgURLEncoder.encode(value,"UTF-8");
						if(st_key.equals("er_enddate"))
							value=EgURLEncoder.encode(value,"UTF-8");
						if(st_key.equals("er_stdate"))
							value=EgURLEncoder.encode(value,"UTF-8");
						if(st_key.equals("select_testmes"))
							value=EgURLEncoder.encode(value,"UTF-8");
						if(st_key.equals("sel_mes"))
							value=EgURLEncoder.encode(value,"UTF-8");
						if(st_key.equals("er_RmDispName"))
							value=EgURLEncoder.encode(value,"UTF-8");
						if(st_key!=null&&(st_key.equals("er_userid") || st_key.equals("userID") || st_key.equals("uid") || st_key.equals("us_id") || st_key.equals("eruserid")))
							value=EgURLEncoder.encode(value,"UTF-8");

						if(st_key.equals("limitforbg"))
						{
							value=EgURLEncoder.encode(value,"UTF-8");
						}
						if(st_key.equals("userTimeline"))
						{
							value=EgURLEncoder.encode(value,"UTF-8");
						}
						
						if(st_key.equals("er_view"))
						{
							if(value.equals("PRINT"))
							{
								continue;
							}
						}
						//	prakash background-pdf encoding
						if(st_key!=null && st_key.equalsIgnoreCase("strbg_id"))
						{
							value = EgURLEncoder.encode(value, "UTF-8");
						}
						//
						qstr=qstr+st_key+"="+value+"&";
					}
					if(reporttype!=null&&!reporttype.equalsIgnoreCase("Session"))
					{
						Str_units = tablesInfo.getUnitForMeasure(er_test,er_meas);
						if(s_title!=null && s_title.equalsIgnoreCase("Number of unique users"))
						{
							s_title = s_title + " (Number)";
						}
						else
						{
							s_title = s_title + " ("+Str_units+")";
						}
					}
					query_String = controlfile+"?"+qstr;
//					query_String = "/final/servlet/com.eg.ErCtxServerReportC?uid=admin&schedule_id=null&er_dismeas=Num+procs&er_trgttype=Application+Report&er_mode=3D&endhr=14&starthr=14&sh_timeinuse=No&responseType=json&limitforbg=2+weeks&er_trenddata=No&minto=00&option=Citrix&inidate=MMM+dd%2C+yyyy&opt=chart&bgenabled=Yes&fromFavoriteModify=null&er_gtype=Citrix&er_test=TermAppTest&er_excwe=No&select_farm=--Default--&servletName=com.eg.ErCtxServerReportC&startdate=Feb+07%2C+2014&fromScheduleModify=null&er_timeline=1+day&isSubmit=true&er_check=null&timefrom=00&enddate=Feb+08%2C+2014&getMaxDaysInMonth=31&rtype=chart&er_rtype=CtxApplication&minfrom=00&pdfTime=Application+Report+From+null+null%3Anull+hrs+++To+null+null%3Anull+hrs&er_reportgenration=foreground&savereport=save&er_sortby=-1&er_compType=Terminal_server&servers=null&userTimeline=-1&er_application=-1&endmin=26&currTime=&startmin=26&chartFor=Top&timeto=24&forwardto=ErCtxApplicationReportJson&select_testmes=TermAppTest%2FNum_procs_running&er_meas=Num_procs_running&fromSchedule=null&er_perserver=Yes&userID=admin&er_type=Yes&er_bgreportfrom=Thin_Client_Application_Activity&printGraph=yes&er_application1=null&er_ViewName=ErThinClientApplication.jsp&er_server=-1&";
					qrydata = qrydata +"er_sortby=-1&optt=data";
					//Adding the title and the URL of the image for saving to PDF
					count++;
%>
													<!-- <pd4ml:page.break/> -->
													<pd4ml:page.header areaHeight="10" />
													<!--GRAPH IMAGE CONTAINER STARTS HERE-->
													
				<tr>
					<td align="center">
						<div class="printOuterBox">
						<img src="<%=query_String%>&optt=graph&er_view=IMAGE" border="0" hspace="0" vspace="0"></img>
						</div>
						
					</td>									<!--GRAPH IMAGE CONTAINER ENDS HERE-->
				</tr>
<%
				}
%>
				</tr>
			</table>
			</div>
		</td>
	</tr>
<%
			}
		}
		else
		{
%>
	<div class="printOuterBox">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
	
<%
			String bordrBootomStyle="border-bottom:1px solid #dedede";
			int val=0;
			if(v_qry_string.size() > 0){
				if(v_qry_string.size() % 4 > 0){
					val=(v_qry_string.size()-(v_qry_string.size() % 4));
				}else{
					val=v_qry_string.size() - 4;
				}
			}
			for(int i=0;i<v_qry_string.size();i+=4)
			{
				if(val == i)
					bordrBootomStyle="";
	%>
			<tr class="newimg">
	<%
				s_qryString = (String)v_qry_string.get(i+1);
				String Qstring="";
				if(s_qryString!=null)
				{
					StringTokenizer strtok = new StringTokenizer(s_qryString,"&");
					while(strtok.hasMoreTokens())
					{
						String param = strtok.nextToken();
						if(param!=null && param.indexOf("=")>-1)
						{
							String reqparam =param.substring(0,param.indexOf("="));
							String value = param.substring(param.indexOf("=")+1,param.length());
							if(reqparam.equals("er_component") ||reqparam.equals("er_selection")||reqparam.equals("er_nick"))
							{
								value=EgURLEncoder.encode(value,"UTF-8");
							}
							if(reqparam.equals("er_info_list"))
							{
							value=customReplaceAll(value,"%23","0eghash0");
								value= value;
							}
								if(reqparam!=null&& reqparam.equalsIgnoreCase("showLegend"))
							{
								if(value!= null&&value.indexOf("[")>-1)
									value="true";
							}
							if(value!= null)
										Qstring=Qstring+reqparam+"="+value+"&";
						}
						else
						{
							if(param!=null && param.startsWith("/final")){
								param = param.substring(0,param.length()-1);
								Qstring+=param+";jsessionid="+session.getId()+"?";
							}
						}
					}
				}
				String strImgWidth="50";
				String strGraphWidth="435";
				String strGraphHeight="225";
				if(!isCombinedGraph)
				{
					strGraphWidth="750";
					strGraphHeight="320";
					strImgWidth="100%";
				}
%>
	
		<!-- <div class="printOuterBox"> -->

<%
//				if((i+2 >= 12) && (i%12 == 0))
//				{
//										out.println("<br><br><br><br><br><br><br><br><br><br><br><br>");
//				}
%>
			
			<!-- 	<tr>	 -->
			<!-- <div class="printOuterBoxHeader">	 -->
<!-- <div class="printOuterBox">
<table cellspacing="0" cellpadding="0" border="0">
	<tr class="newimg"> -->

	<!-- <td width="50%" style="padding:10px 10px 10px 0px;border-right:1px solid #dedede;border-bottom:1px solid #dedede;" align="left" height="auto" valign="top">
 -->

		<td width="50%" align="left" style="padding:10px 10px 10px 0px;border-right:1px solid #dedede;<%=bordrBootomStyle%>;" align="left" height="auto" valign="top">
			<div class="print OuterBox">
				<div class="printOuterBoxHeader">
<%
		if(flag > 0)
		{
			String tmpData=(String)v_qry_string.get(i);
			tmpData=erUtils.findAndReplaceString(tmpData,"|amp|","&");
			if(tmpData.indexOf("/")>-1 && tmpData.indexOf("(")>-1)
			{
				String testStr=tmpData.substring(0,tmpData.indexOf("/"));
				String measureStr=testStr+":"+tmpData.substring(tmpData.indexOf("/")+1,tmpData.indexOf("("));
%>
				<egui:intnl test="<%=testStr%>" />/<egui:intnl measure="<%=measureStr%>" />
<%
			}
			else if(tmpData.indexOf(":")>-1)
			{
				String isthecomp = (String)v_qry_string.get(i);
				isthecomp=erUtils.findAndReplaceString(isthecomp,"|amp|","&");
				String compname="";
				if(isthecomp.indexOf(":NULL")>-1)
				{
					compname = isthecomp.substring(0,isthecomp.indexOf(":NULL"));
					compname = compname+isthecomp.substring(isthecomp.lastIndexOf(":NULL")+5);
				}
				else
				{
					compname=isthecomp;
				}
%>
				<%=compname.substring(0,compname.lastIndexOf(":")+1)%><egui:intnl type="<%=compname.substring(compname.lastIndexOf(":")+1)%>" />
<%
			}
			else
			{
%>
				<%=tmpData%>
<%
			}
		}
		else
		{
			s_title = (String)v_qry_string.get(i);
			s_title=erUtils.findAndReplaceString(s_title,"|amp|","&");
			if(s_title.indexOf(":")>-1)
			{
				String isthecomp=s_title;
				String compname="";
				if(isthecomp.indexOf(":NULL")>-1)
				{
					compname = isthecomp.substring(0,isthecomp.indexOf(":NULL"));
					compname = compname+isthecomp.substring(isthecomp.lastIndexOf(":NULL")+5);

				}
				else
				{
					compname = isthecomp;
				}
%>
				<%=compname.substring(0,compname.lastIndexOf(":")+1)%> <egui:intnl type="<%=compname.substring(compname.lastIndexOf(":")+1)%>" />
<%
			}
			else if(s_title.indexOf("/")>-1 && s_title.indexOf("(")>-1)
			{
				String testStr=s_title.substring(0,s_title.indexOf("/"));
				String measureStr=testStr+":"+s_title.substring(s_title.indexOf("/")+1,s_title.indexOf("("));
%>
				<egui:intnl test="<%=testStr%>" /> / <egui:intnl measure="<%=measureStr%>" />
<%
			}
			else
			{
%>
				<%=s_title%>	
<%
			}
%>
<%
		}
%>				 </div>
			<!-- </div>		  -->
				<!-- </tr>	   -->
		<!--GRAPH IMAGE CONTAINER STARTS HERE--> 
				<table class = "printTable" align="center" cellspacing="0" cellpadding="0" border="0" width="100%">
					<tr class="newimg">
<%
				if(erd.s_gtype != null && erd.s_gtype.equalsIgnoreCase("Citrix")&&erd.s_rtype!=null&&erd.s_rtype.equalsIgnoreCase("Session"))
				{
%>
						<td width="100%" NOWRAP align="left"><egui:intnl text="reporter.common.Thin Client Reports" />-<egui:intnl text="reporter.common.Session" />
<%
					String selectzone=request.getParameter("select_farm");
					if(selectzone.equalsIgnoreCase("--Default--"))
					{
%>							--<egui:intnl text="reporter.common.Default" />-- 
						</td>
<%
					}
					else
					{
%>
							- <%=selectzone%>
						</td>
<%
					}
				}
				else
				{
%>
						<td height="auto">
							<img src="<%=Qstring%>&throughSchedule=true&er_width=<%=strGraphWidth%>&er_height=<%=strGraphHeight%>&fromPrint=yes" width="<%=strGraphWidth%>px" border="0" height="auto" hspace="0" vspace="0" alt=" <%=v_qry_string.elementAt(i)%>" title=" <%=v_qry_string.elementAt(i)%>" />
						</td>
<%
				}
%>
					</tr>
				</table> 
			</div>	
		</td>
		<!--	<div class="clearDiv">&nbsp;</div>--><!--GRAPH IMAGE CONTAINER ENDS HERE-->
										<%
		if(v_qry_string.size() == (i + 2))
		{
%>
		<!-- <td align="center" width="<%=strImgWidth%>"><!--BLANK CELL OR NO GRAPH&nbsp;	</td>   -->
										<%
		}
		else
		{
			s_qryString = (String)v_qry_string.elementAt(i+3); 
			String Qstring1="";
			if(s_qryString!=null)
			{
				StringTokenizer strtok = new StringTokenizer(s_qryString,"&");
				while(strtok.hasMoreTokens())
				{
					String param = strtok.nextToken();
					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") ||reqparam.equals("er_selection")||reqparam.equals("er_nick"))
						{
							value=EgURLEncoder.encode(value,"UTF-8");
						}
						if(reqparam.equals("er_info_list"))
						{
						value=customReplaceAll(value,"%23","0eghash0");
							value= value;
						}
						if(reqparam!=null&& reqparam.equalsIgnoreCase("showLegend"))
						{
						if(value!= null&&value.indexOf("[")>-1)
							value="true";
						}
						if(value!=null)
							Qstring1 = Qstring1+reqparam+"="+value+"&";
					}
					else
					{
						if(param!=null && param.startsWith("/final")){
							param = param.substring(0,param.length()-1);
							Qstring1+=param+";jsessionid="+session.getId()+"?";
						}
					}
				}
			}
//					if((i >= 12)&&(i%12 == 0))
//					{
//									out.println("<br><br><br><br><br><br><br><br><br><br><br><br>");
//					}
			if(!isCombinedGraph)
			{
%>
	</tr>
	<tr class="newimg">
<%
			}
%>
		<!-- 	<div class="printOuterBoxHeader">	  -->

		<td width="50%" style="padding:10px 0px 10px 10px;<%=bordrBootomStyle%>;" align="left" valign="top">
		<!-- <td align="left" width="<%=strImgWidth%>" > --><!--GRAPH IMAGE CONTAINER STARTS HERE-->
			<div class="printOu terBox">
				<div class="printOuterBoxHeader">
<%
			if(flag > 0)
			{
				String tmpData=(String)v_qry_string.get(i+2);
				tmpData=erUtils.findAndReplaceString(tmpData,"|amp|","&");
				if(tmpData.indexOf("/")>-1 && tmpData.indexOf("(")>-1)
				{
					String testStr=tmpData.substring(0,tmpData.indexOf("/"));
					String measureStr=testStr+":"+tmpData.substring(tmpData.indexOf("/")+1,tmpData.indexOf("("));
%>
					<egui:intnl test="<%=testStr%>" />/<egui:intnl measure="<%=measureStr%>" />
										<%
				}
				else if(tmpData.indexOf(":")>-1)
				{
					String isthecomp = (String)v_qry_string.get(i+2);
					isthecomp=erUtils.findAndReplaceString(isthecomp,"|amp|","&");
					String compname="";
					if(isthecomp.indexOf(":NULL")>-1)
					{
						compname = isthecomp.substring(0,isthecomp.indexOf(":NULL"));
						compname = compname+isthecomp.substring(isthecomp.lastIndexOf(":NULL")+5);
					}
					else
					{
						compname=isthecomp;
					}
%>
					<%=compname.substring(0,compname.lastIndexOf(":")+1)%><egui:intnl type="<%=compname.substring(compname.lastIndexOf(":")+1)%>" />
												<%
				}
				else
				{
%>
					<%=tmpData%>
<%
				}
			}
			else
			{
				s_title = (String)v_qry_string.get(i+2);
				s_title=erUtils.findAndReplaceString(s_title,"|amp|","&");
				if(s_title.indexOf(":")>-1)
				{
					String isthecomp = s_title;
					String compname = "";
					if(isthecomp.indexOf(":NULL")>-1)
					{
						compname = isthecomp.substring(0,isthecomp.indexOf(":NULL"));
						compname = compname+isthecomp.substring(isthecomp.lastIndexOf(":NULL")+5);
					}
					else
					{
						compname=isthecomp;
					}
%>
						<%=compname.substring(0,compname.lastIndexOf(":")+1)%><egui:intnl type="<%=compname.substring(compname.lastIndexOf(":")+1)%>" />
				
<%
				}
				else if(s_title.indexOf("/")>-1)
				{
					String testmes="";
					String test="";
					String measure="";
					if(s_title.indexOf("(")>-1)
					{
						testmes=s_title.substring(0,s_title.indexOf("("));
					}
					else
					{
						testmes=s_title;
					}
					test=testmes.substring(0,testmes.indexOf("/"));
					measure=testmes.substring(testmes.indexOf("/")+1);
%>
					<egui:intnl test="<%=test%>" />	
					/
					<egui:intnl measure="<%=test+":"+measure%>" /><%=s_title.substring(s_title.indexOf("("))%>
				
<%
				}
				else
				{
%>
					<%=s_title%>
<%
				}
			}
%>				</div>
				<!-- </div> -->
				<!-- </tr> -->
				<table class = "printTable" align="center" cellspacing="0" cellpadding="0" border="0" width="100%">
					<tr>
						<td height="auto">
							<img src="<%=Qstring1%>&throughSchedule=true&&er_width=<%=strGraphWidth%>&er_height=<%=strGraphHeight%>&fromPrint=yes" width="<%=strGraphWidth%>px" border="0" hspace="0" vspace="0" height="auto" alt="<%=(String)v_qry_string.elementAt(i+2)%>" title=" <%=(String)v_qry_string.elementAt(i+2)%>" />
						</td>
					</tr>
				</table>
			</div>
			<!-- <div class="clearDiv">&nbsp;</div> -->
				<!--GRAPH IMAGE CONTAINER ENDS HERE-->
		</td>
<%
				}
	%>
			</tr>
	<%
			}
%>
	
	</table>
	</div>
<%
			
%>
	</div>
<%
		}
%>
									<!--THE ROW THAT HAS TO BE REPEATED FOR SHOWING GRAPHS ENDS HERE-->
</table>
		  
<%
	}
	else if(v_qry_string != null && v_qry_string.size() == 2)
	{
%>
<div class="printHeaderBox">

<%
		
		
		if(erd.s_gtype != null && erd.s_gtype.equalsIgnoreCase("Comparison"))
		{
			if (!StringUtils.isNull(titleToDisplay)){
%>
			<div class="printHeaderBoxTitle"><%=titleToDisplay%></div>
<%
			} else {
%>
			<div class="printHeaderBoxTitle"><egui:intnl text="reporter.common.Comparison Report" /></div>
<%
			}
		}
		else if ("Micro".equalsIgnoreCase(request.getParameter("er_rtype")) && "CitrixUser".equalsIgnoreCase(request.getParameter("er_trgttype")))
		{

	String queryString = ErUtils.prepareQueryString(request.getParameterMap());
	String qStringT="";

	if(queryString!=null)
	{
		StringTokenizer strtok = new StringTokenizer(queryString,"&");
		while(strtok.hasMoreTokens())
		{
			String parameter = strtok.nextToken();
			int ind = parameter.indexOf("=");
			if (ind < 0)
				continue;
			String reqparam =parameter.substring(0,ind);

			String value = parameter.substring(ind+1);
			if(reqparam!=null&&reqparam.equals("er_info_list"))
			{
			value=customReplaceAll(value,"%23","0eghash0");
				value=com.eg.EgURLEncoder.encode(value, "UTF-8");
			}
			
			if(reqparam!=null&&reqparam.equals("er_component"))
			{
				value=com.eg.EgURLEncoder.encode(value, "UTF-8");
			}
			if(reqparam!=null&& reqparam.equalsIgnoreCase("showLegend"))
			{
				if(value!= null&&value.indexOf("[")>-1)
					value="true";
			}
			qStringT += reqparam+"="+value.trim()+"&";
		}
	}
%>
			<div class="printHeaderBoxTitle"><egui:intnl text="reporter.common.Thin Client User Report" /> - <%=request.getParameter("er_component")%></div>
<%
		}
		else
		{
%>
			<div class="printHeaderBoxTitle"><egui:intnl text="reporter.common.Operation report" /> -<%=erd.s_rtype%> - <%=st_component%></div>
<%
		}

		if(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes"))
		{
%>
			<div class="printHeaderBoxPrintIcon"><img class="iconPrinter mouse" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" border="0" onClick="javascript:print()" alt='<egui:intnl text="reporter.common.PRINT"/>' title='<egui:intnl text="reporter.common.PRINT"/>'/></div>

<%
		}
%>
</div>

<div class="printOuterBoxNoBorder"> 


										<%
		if(!(erd.s_gtype.equalsIgnoreCase("comparison")) )
		{
%>

			<div class="printSelectionFields" style="float:left"><egui:intnl text="reporter.common.Report Type" /> - <span class="bold"><egui:intnl text="<%="reporter.title."+erd.s_gtype%>" /></span></div>
<%
		}
%>
														<td width="65%" align="center" nowrap>
<%
		String dispStartDate="";
		String dispEndDate="";
		if(erd.s_gtype != null && erd.s_rtype!=null && request.getParameter("er_trgttype")!=null && erd.s_rtype.equalsIgnoreCase("Micro") && (request.getParameter("er_trgttype")).equalsIgnoreCase("CitrixUser"))
		{
			erd.s_enddate = erd.s_enddate ;//+ " " + erd.s_endhr + ":" + erd.s_endmin + "Hrs";
			erd.s_stdate = erd.s_stdate;// + " " + erd.s_sthr + ":" + erd.s_startmin+ "Hrs";
		}
		else
		{
			if(er_trgttype!=null && !er_trgttype.equalsIgnoreCase("Tests"))
			{
				dispStartDate = DateUtil.changeDateFormat(erd.s_stdate,"MM/dd/yyyy",currentDateFormat);
				dispEndDate = DateUtil.changeDateFormat(erd.s_enddate,"MM/dd/yyyy",currentDateFormat);
				dispStartDate = erd.s_stdate+ " " + erd.s_sthr+ "hrs";
				dispEndDate = erd.s_enddate+" " + erd.s_endhr + "hrs";
			}
		}
		if(erd.s_gtype != null && erd.s_gtype.equals("Measure"))
		{
			if(erd.s_enddate.indexOf(":")>-1)
			{
				erd.s_enddate = erd.s_enddate.substring(0,erd.s_enddate.indexOf(":"));
				erd.s_stdate =erd.s_stdate.substring(0,erd.s_stdate.indexOf(":"));
			}
		}
		else if(erd.s_gtype != null && erd.s_gtype.equals("Summary"))
		{
			if(erd.s_enddate.indexOf(":")>-1)
			{
				erd.s_enddate = erd.s_enddate.substring(0,erd.s_enddate.lastIndexOf(" "));
				erd.s_stdate =erd.s_stdate.substring(0,erd.s_stdate.lastIndexOf(" "));
			}
		}
		String dispStart="";
		String dispEnd="";
		dispStart = erd.s_stdate.trim()+ " " + erd.s_sthr+":"+erd.s_startmin;
		dispEnd = erd.s_enddate.trim()+ " " + erd.s_endhr+":"+erd.s_endmin;
		converterStart = new EgTimeZoneConverter(dispStart,thisuser);
		converterEnd = new EgTimeZoneConverter(dispEnd,thisuser);
		String st_dateTime = converterStart.getDateTime()+" hrs";
		String en_dateTime = converterEnd.getDateTime()+" hrs";

		String displayTitle="";
		String s_dataFrom = request.getParameter("er_dataFrom");
		if(s_dataFrom!=null && s_dataFrom.equalsIgnoreCase("Service"))
		{
		//er_service
		if(request.getParameter("sess_service")!=null)
			displayTitle=""+(request.getParameter("sess_service"));
			else
			displayTitle=""+(request.getParameter("er_service"));
%>
			<div class="printSelectionFields"><egui:intnl text="reporter.common.Service Name" /> - <span class="bold"><%=displayTitle%></span></div>
<%
		}
%>
		<div class="printSelectionFields"><egui:intnl text="reporter.common.Timeline" /> - <span class="bold"><%=st_dateTime%> to <%=en_dateTime%> </span></div>
	</div>
<%
		String s_qryString = "";
		String s_qryString22 ="";
		for(int j=0;j < v_qry_string.size();j=j+2)
		{
			s_qryString = (String)v_qry_string.get(j+1);
			String graphType="";
			if(s_qryString.indexOf("&",s_qryString.indexOf("er_graphtype"))>-1)
			{
				graphType = s_qryString.substring(s_qryString.indexOf("er_graphtype")+"&er_graphtype".length(),s_qryString.indexOf("&",s_qryString.indexOf("er_graphtype")));
			}
			else
			{
				graphType = s_qryString.substring(s_qryString.indexOf("er_graphtype")+"&er_graphtype".length());
			}
			if(graphType!=null && !graphType.equals("") && graphType.equalsIgnoreCase("Single"))
			{
//				if (s_qryString!=null && s_qryString.indexOf("er_selection")>-1 )
//				{
//					s_qryString22 = s_qryString.substring(0,s_qryString.indexOf("er_selection")-1);
//				}
//				else{
					s_qryString22 = s_qryString;
			//	}
				if(erd.s_gtype != null && erd.s_gtype.equalsIgnoreCase("Comparison"))
					s_qryString22+="&option=graph&printGraph=yes";
			}else{
				s_qryString22 = s_qryString;
			}
	if(graphtype!=null && !graphtype.equals("") && graphtype.equalsIgnoreCase("Multiple"))
										{
									%>	
			<table cellspacing="0" cellpadding="0" border="0" width="100%" >
				<tr>
					<td align="right"><%=new_format%></td>
				</tr>
			</table>
									<%
										}
									%>
<table align="center" cellspacing="0" cellpadding="0" width="100%" border="0">
	<tr>
		<td align="center" width="100%" height="auto"> <div class="printOuterBox" align="center">
									
					<!--GRAPH IMAGE CONTAINER STARTS HERE-->
		<!-- 	<table align="center" cellspacing="0" cellpadding="0" border="0" width="100%" class="printTable">
				<tr>
					<td align="left" class="printTableHeader">	 -->
					
	
			<div class="printOuterBoxHeader"  align="left">

<%
			String dispname=(String)v_qry_string.get(j);
			dispname=erUtils.findAndReplaceString(dispname,"|amp|","&");
			if(dispname.indexOf(":")>-1)
			{
				String isthecomp = dispname;
				
				String compname="";
				if(isthecomp.indexOf(":NULL")>-1)
				{
					compname = isthecomp.substring(0,isthecomp.indexOf(":NULL"));
					compname = compname+isthecomp.substring(isthecomp.lastIndexOf(":NULL")+5);
				}
				else
				{
					compname = isthecomp;
				}
%>
					<%=compname.substring(0,compname.lastIndexOf(":")+1)%><egui:intnl type="<%=compname.substring(compname.lastIndexOf(":")+1)%>" /></div><!-- </td>	    -->
<%
			}
			else
			{
				s_title = (String)dispname;
				
				if(s_title.indexOf("/")>-1)
				{
%>
					<egui:intnl test="<%=s_title.substring(0,s_title.indexOf("/"))%>" /> / <egui:intnl measure="<%=s_title.substring(0,s_title.indexOf("/"))+":"+s_title.substring(s_title.indexOf("/")+1)%>" /></div><!--</td>  -->
<%
				}
				else
				{
%>
					<egui:intnl text="<%="reporter.common."+dispname%>" /></div> <!--</td>   -->
<%
				}
			}
%>					  
			<!-- 	</tr>
				<tr>
				<td align="center">		 -->
				
<%
			String Qstring2="";
			if(s_qryString22!=null)
			{
				StringTokenizer strtok = new StringTokenizer(s_qryString22,"&");
				while(strtok.hasMoreTokens())
				{
					String param = strtok.nextToken();
					if(param.indexOf("=")>-1)
					{
						String reqparam =param.substring(0,param.indexOf("="));
						String value =""; value=param.substring(param.indexOf("=")+1,param.length());
//						if(reqparam.equals("er_templateEnable") || reqparam.equals("inidate"))
//						{
//							continue;
//						}
						if(reqparam.equals("er_info_list"))
						{
						value=customReplaceAll(value,"%23","0eghash0");
						}
						if(value!=null && !reqparam.equals("er_selection"))
						{
							Qstring2 = Qstring2+reqparam+"="+EgURLEncoder.encode(URLDecoder.decode(value),"UTF-8")+"&";
						}
						else
						{
							Qstring2 = Qstring2+reqparam+"="+URLDecoder.decode(value)+"&";
						}
					} else
					{
						if(param!=null && param.startsWith("/final"))
							Qstring2+=param;
					}
				}
			}
			String qryP = Qstring2.substring(0,Qstring2.indexOf("?"));
			String qryProc = Qstring2.substring(Qstring2.indexOf("?")+1,Qstring2.length());
			String Qstring2Proc = null;
			HashMap reqmap = ErUtils.parseQueryString(qryProc);
			HashMap reqmap1 = ErUtils.parseQueryString(qryProc);
			reqmap1.put("er_width","870");
			reqmap1.put("er_height","420");
			reqmap.put("TempRequestFrom","ErPrintReport");
			if(throughSchedule !=null && throughSchedule.equalsIgnoreCase("True"))
			{
				
					reqmap1.put("showLegend","true");
					reqmap.put("showLegend","true");
										

			
			}
			reqmap1.put("userID",thisuser.getLoginID());
			session.setAttribute("printgraphparams1",reqmap1);
			reqmap.remove("er_selection");
			qryProc = ErUtils.prepareQueryString(reqmap);
		//	String s_user_id = request.getParameter("userID");
		System.out.println("<< fir > >"+reqmap1.toString());
			if(throughSchedule !=null && throughSchedule.equalsIgnoreCase("True"))
			{
				Qstring2Proc = qryP+";jsessionid="+session.getId()+"?"+qryProc;//+"&s_user_id="+s_user_id;
			
			}
			else
			{
			//	Qstring2Proc = qryP+";jsessionid="+request.getSession().getId()+qryProc;
				Qstring2Proc = qryP+";jsessionid="+session.getId()+"?"+qryProc;
			}
			//here i use Qstring2Proc it works fine but it's not a right way

			if(throughSchedule !=null && throughSchedule.equalsIgnoreCase("true"))
			{
				//&throughSchedule =true
%>
						<img src="<%=strManagerURL+Qstring2Proc%>&er_width=850&er_height=400&fromPrint=yes" hspace="0" vspace="0" alt=" <%=v_qry_string.get(j)%>" height="auto" title="<%=v_qry_string.get(j)%>"></img> 
					<!-- 	</td>
						</tr>  -->
<%
			}
			else
			{
%>
						<img src="<%=strManagerURL+Qstring2Proc%>&er_width=850&er_height=400&fromPrint=yes" hspace="0" vspace="0" alt=" <%=v_qry_string.get(j)%>" height="auto" title="<%=v_qry_string.get(j)%>"></img>
					<!-- 	</td>
						</tr>   -->
<%
			}
%>
</div>
<%
			ArrayList singleSelection = (ArrayList)session.getAttribute("singleSelection");
			ArrayList singleColors = (ArrayList)session.getAttribute("singleColors");
			if((singleSelection == null || singleSelection.size()==0) && request.getAttribute("singleSelection")!=null)
				singleSelection = (ArrayList)request.getAttribute("singleSelection");
			if((singleColors == null || singleColors.size()==0)&& request.getAttribute("singleColors")!=null)
				singleColors = (ArrayList)request.getAttribute("singleColors");

			String strselectioncount = reportInfo.getValue("MISC","RightDisplaySelectioncount");
			int selectioncount=10;
			if(strselectioncount !=null && !strselectioncount.equals(""))
			{
				try
				{
					selectioncount = Integer.parseInt(strselectioncount);
				}
				catch (Exception e)
				{
					selectioncount = 10;
				}
			}
			boolean needLegend=true;
			if(gTypeChk != null && gTypeChk.equalsIgnoreCase("Comparison"))
				needLegend=false;
			if (singleSelection != null && singleSelection.size() >=selectioncount && needLegend)
			{
%>
			<!-- 	 <tr>
					<td align="center" width="100%">   -->
				<!--GRAPH IMAGE CONTAINER STARTS HERE(singleselection=>gtype(single or multiple))-->
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%
				int count1=0;
				for (int k=0; k <singleSelection.size();k++)
				{
					String st_key = (String)singleColors.get(k);
					String value = (String)singleSelection.get(k);
					st_key = st_key.substring(1,st_key.length());
					if(k%2 ==0)
					{
%>
							<tr>
								<td width="5%" align="right"><img src="/final/servlet/com.eg.ErImageDrawC?req=<%=st_key%>" /></td>
								<td width="45%" align="left" nowrap >&nbsp;&nbsp;<%=value%></td>

<%
					}
					else if(k%2 !=0)
					{
%>
								<td width="5%" align="right"><img src="/final/servlet/com.eg.ErImageDrawC?req=<%=st_key%>" /></td> 
								<td width="45%" align="left" nowrap>&nbsp;&nbsp;<%=value%></td>
							</tr>

<%
					}
					else
					{
%>
								<td width="5%" align="right"><img src="/final/servlet/com.eg.ErImageDrawC?req=<%=st_key%>" /></td>
								<td width="95%" align="left" nowrap>&nbsp;&nbsp;<%=value%></td>

<%
					}
				}
				if(singleSelection.size()%2 !=0)
				{
%>
								<td width="50%" align="right" colspan="2">&nbsp;</td>
							</tr>
<%
				}

%>
						</table>
					</td>
				</tr>
<%
			}

%>
		<!-- 	</table>
			</td> --></div>
<%
		}
%>
			<!--THE ROW THAT HAS TO BE REPEATED FOR SHOWING GRAPHS ENDS HERE-->
	</tr>
</table>
<%
	}
	else if(StrDaychart!=null&&StrDaychart.equals("uniqueuser"))
	{
		String s_tit= "";
		String s_tit1= "";
		List lst = new LinkedList();
		List lst_dat1 = new LinkedList();
		Hashtable sen = new Hashtable();
		Hashtable ht = new Hashtable();
		Hashtable ht1 = new Hashtable();
		Vector vec1 = new Vector();

		String StrTrend =request.getParameter("er_trenddata");
		String StrTbound =request.getParameter("er_tbound");
		String StrTimeline =request.getParameter("er_timeline");
		String Strstdate =request.getParameter("startdate");
		String Strexcwe =request.getParameter("er_excwe");	
		String Strtimefrom =request.getParameter("timefrom");
		String Strtimeto =request.getParameter("timeto");
		String Strminfrom =request.getParameter("minfrom");
		String Strminto =request.getParameter("minto");
		String Strenddate =request.getParameter("enddate");
		String Strsthr =request.getParameter("starthr");
		String Strendhr =request.getParameter("endhr");
		String startmin=request.getParameter("startmin");
		String endmin=request.getParameter("endmin");
		String Struid =request.getParameter("uid");
		String server_select=request.getParameter("er_select_server");
		String st_server=request.getParameter("select_server");
		String st_inidate=request.getParameter("inidate");
		Strexcwe=Strexcwe.trim();
		Hashtable DaywiseUserData=(Hashtable)session.getAttribute("userData");
		if(DaywiseUserData == null || DaywiseUserData.size()==0)
			DaywiseUserData = (Hashtable)request.getAttribute("userChartData");
	
		if(erd.s_tbound.equalsIgnoreCase("Any"))
		{
			erd.s_enddate = erd.s_enddate ;//+ " " + erd.s_endhr + "Hrs";
			erd.s_stdate = erd.s_stdate ;//+ " " + erd.s_sthr + "Hrs";
		}
		else
		{
			erd.s_stdate = erd.s_stdate; //+ " Hrs";
			erd.s_enddate = erd.s_enddate; //+ " Hrs";
		}
%>
		<div class="printHeaderBox">	
<%
		if(erd.s_gtype != null && erd.s_gtype.equalsIgnoreCase("Citrix")&&erd.s_rtype!=null&&erd.s_rtype.equalsIgnoreCase("Session")&&StrDaychart!=null&&StrServer!=null&&!StrServer.equals(""))
		{
			s_tit=intlmap.getTextDescription("reporter.common.Thin Client Reports")+" -  "+intlmap.getTextDescription("reporter.common.Session")+"  ";
%>
						<div class="printHeaderBoxTitle"><egui:intnl text="reporter.common.Thin Client Reports" /> - <egui:intnl text="reporter.common.Session" /></div>
<%

		}
		else if(erd.s_gtype != null && erd.s_gtype.equalsIgnoreCase("Citrix")&&erd.s_rtype!=null&&erd.s_rtype.equalsIgnoreCase("Session")&&StrDaychart!=null&&StrServer!=null&&StrServer.equals(""))
		{
			s_tit=intlmap.getTextDescription("reporter.common.Thin Client Reports")+" -  "+intlmap.getTextDescription("reporter.common.Session")+"  ";
%>
		<div class="printHeaderBoxTitle"><egui:intnl text="reporter.common.Thin Client Reports" /> - <egui:intnl text="reporter.common.Session" /></div>
<%
		}
		lst.add(s_tit);
		String dispStart="";
		String dispEnd="";
		dispStart = erd.s_stdate.trim()+ " " + erd.s_sthr+":"+erd.s_startmin;
		dispEnd = erd.s_enddate.trim()+ " " + erd.s_endhr+":"+erd.s_endmin;
		converterStart = new EgTimeZoneConverter(dispStart,thisuser);
		converterEnd = new EgTimeZoneConverter(dispEnd,thisuser);
		String usr_startDate = converterStart.getDateTime()+" hrs";
		String usr_endDate = converterEnd.getDateTime()+" hrs";
		Vector dvec = new Vector();
		String stimefmt = "Start Date : "+usr_startDate+" "+intlmap.getTextDescription("reporter.common.hrs");
		String etimefmt = "End Date : "+usr_endDate+" "+intlmap.getTextDescription("reporter.common.hrs");;
		dvec.add('"'+stimefmt+'"');
		dvec.add('"'+etimefmt+'"');
		lst.add('"'+intlmap.getTextDescription("reporter.common.Time period")+":"+intlmap.getTextDescription("reporter.common.From")+" "+Strtimefrom+":"+Strminfrom+intlmap.getTextDescription("reporter.common.hrs")+" "+intlmap.getTextDescription("reporter.common.To")+" "+Strtimeto+":"+Strminto+intlmap.getTextDescription("reporter.common.hrs")+'"');
		lst.add(dvec);
		
%>
													
<%
		if(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes"))
		{
%>

			<div class="printHeaderBoxPrintIcon" style="float:left"><img class="iconPrinter mouse" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" border="0"  onClick="javascript:print()" alt='<egui:intnl text="reporter.common.PRINT"/>' title='<egui:intnl text="reporter.common.PRINT"/>'/></div>

		
					<!-- 	</td>
													</tr>
												</table>
											</td> -->
<%
		}
%>
	</div>
		<div class="printOuterBoxNoBorder">

									<!-- 	</tr>
									</table>
								</td>
							</tr>  -->  
						<!-- 	<tr>
								<td align="center" id="tableborder">
									<table align="center" cellspacing="0" cellpadding="4" width="98%" border="0">
										<tr>
											<td width="100%" align="center" nowrap>
												<table align="center" cellspacing="0" cellpadding="0" width="95%" class="tableborder" border="0">
												<br>
													<tr>
						<td align="center" height="22" class="tdborder" align="center"><span class="<%=fontStyleDblSingl%>"> &nbsp; <span class="subheader"><egui:intnl text="reporter.common.Start Date" /></span> :&nbsp;
						<span class="subheader1"><%=usr_startDate%></span>&nbsp; &nbsp; 
						<span class="subheader"><egui:intnl text="reporter.common.End Date" /></span>
						 :&nbsp; <span class="subheader1"><%=usr_endDate%></span>
						 &nbsp; </span></td>
													</tr>
												</table>
												<br> -->
													<!-- here i have to chek tr td -->
					<div class="printSelectionFields"><egui:intnl text="reporter.common.Timeline" /> - <span class="bold"><%=usr_startDate%> <egui:intnl text="reporter.common.to" /> <%=usr_endDate%></span></div>

					<!-- 	<table align="center" cellspacing="0" cellpadding="0" width="95%" border="0" id="tableborder">
													<tr>
					<!--<td align="center" height="22" class="tdborder" align="center"><span class="<%=fontStyleDblSingl%>"> &nbsp; &nbsp; &nbsp; <span class="subheader"><egui:intnl text="reporter.common.Time Period" /> </span>:&nbsp;<egui:intnl text="reporter.common.From" />:&nbsp;<span class="subheader1"><%=Strtimefrom+":"+Strminfrom%></span> &nbsp;<egui:intnl text="reporter.common.hrs" /> &nbsp; &nbsp; <egui:intnl text="reporter.common.To" />  <%=Strtimeto+":"+Strminto%>&nbsp;<egui:intnl text="reporter.common.hrs" /> </span></td>
					<div class="printSelectionFields" ><egui:intnl text="reporter.common.Time Period"/> - <span class="bold"><%=Strtimefrom+":"+Strminfrom %>&nbsp;<egui:intnl text="reporter.common.to" />&nbsp;<%=Strtimeto+":"+Strminto%></span></div>
													</tr>
												</table>    -->
					<div class="printSelectionFields"><egui:intnl text="reporter.common.Time Period" /> - <span class="bold"><%=Strtimefrom+":"+Strminfrom%>&nbsp;<egui:intnl text="reporter.common.hrs" /> <egui:intnl text="reporter.common.to" /> <%=Strtimeto+":"+Strminto%>&nbsp;<egui:intnl text="reporter.common.hrs" /></span></div>
<%
		if(Strexcwe!=null&&Strexcwe.equalsIgnoreCase("Yes"))
		{
			String ExDays = reportInfo.getExcludeWeekend("CITRIX SESSION REPORT");
%>											<!-- 	<br>
												<table align="center" cellspacing="0" cellpadding="0" width="95%" border="0" id="tableborder">
												<tr>
		<td align="center" id="er_submit" height="22" class="cellbgapplet" align="center"><span class="<%=fontStyleDblSingl%>">&nbsp; &nbsp; &nbsp; <egui:intnl text="reporter.common.Exclude WeekEnds" />:&nbsp;<%=ExDays%> &nbsp; &nbsp; &nbsp; </span></td>
													</tr>
												</table> -->
					<div class="printSelectionFields"><egui:intnl text="reporter.common.Exclude WeekEnds" /> - <span class="bold"><%=ExDays%></span></div>
<%
		}
%>
										<!-- 	</td>
										</tr>
										<br>  -->   
				
			
		</div>
		<div class="printOuterBox">
<%
						String usrCount_dispName = "Maximum Named User Count";
						usrCount_dispName = reportInfo.getValue("CITRIX SESSION REPORT","Max_Named_User_Count");
						if(usrCount_dispName == null || usrCount_dispName.length() ==0)
							usrCount_dispName = "Unique Users accessing the farm";
						lst.add("Summary");
						lst.add(intlmap.getTextDescription("reporter.common."+usrCount_dispName) +" : "+DaywiseUserData.size());
%>
									<!-- 	<tr>
											<td> -->
											<div class="newTable">
												<table align="center" width="80%" cellspacing="0" cellpadding="4" id="tableborder" border="0">
													<thead>
													 <tr>
														<th align="left" class="cellbgdark" width="65%" NOWRAP height="20" colspan="2"><egui:intnl text="reporter.common.Summary" /></th>
													</tr>   
													</thead>
													<tbody>
													<tr>
														<td id="tdborder" nowrap align="left" width="70%"><egui:intnl text="<%="reporter.operation."+ usrCount_dispName%>" /></td>
														<td id="tdborder" nowrap width="30%" class="newFont_bold30" align="left"> 
															<%=DaywiseUserData.size()%>
														</td> 
													</tr>
													</tbody>
												</table>
											</div>
									<div class="clearDiv">&nbsp;</div>
											<!-- </td>
										</tr>
										<tr>
								<td width="75%" align="center" nowrap> -->	 
		<%
		if(serverName!=null && !serverName.equalsIgnoreCase("null"))
		{
			String strDispHostname = serverName;
			if(serverName!=null && serverName.indexOf(":NULL")>-1)
			{
				strDispHostname = serverName.substring(0,serverName.indexOf(":NULL"));
			}
			else if(serverName!=null && serverName.indexOf(":")>-1)
			{
				strDispHostname = serverName.substring(0,serverName.lastIndexOf(":"));
			}
			String tempCmpType = "";
			if(serverName!=null && serverName.indexOf(":")>-1)
				tempCmpType = " - "+intlmap.getComponentTypeDescription(serverName.substring(serverName.lastIndexOf(":")+1));
%>
		<!-- <th class="cellbgdark" width="65%" NOWRAP height="20" colspan="3"><span class="<%=fontStyleDblSingl%>"> &nbsp; <egui:intnl text="reporter.common.Unique users for Zone" />&nbsp;<%=select_farm%> &nbsp;<egui:intnl text="reporter.common.and Server" /> &nbsp;<%=strDispHostname%> &nbsp; </span></th>  -->
		<div class="printOuterBoxHeader" style="text-align:center"><egui:intnl text="reporter.common.Unique users for " />&nbsp;
<%
		if(er_option!=null && !er_option.equalsIgnoreCase("Component")){
%>
			<%=intlmap.getTextDescription("reporter.common."+er_option)%>&nbsp;:&nbsp;<%=select_farm%>,&nbsp;
<%
		}
%>
		<egui:intnl text="reporter.common.Server" />&nbsp;:&nbsp;<%=strDispHostname+tempCmpType%></div>
<%
		}
		else
		{
%>
		<!-- <th class="cellbgdark" width="100%" NOWRAP height="20" colspan="3"><span class="<%=fontStyleDblSingl%>"> &nbsp; <egui:intnl text="reporter.common.Unique users for Zone" />&nbsp;<%=select_farm%></span></th> -->
		<div class="printOuterBoxHeader"><egui:intnl text="reporter.common.Unique users for Zone" />&nbsp;<%=select_farm%></div>
<%
		}
%>

						<table align="center" width="80%" cellspacing="0" cellpadding="0" border="0">
													<tr width="50%">
														<td align="center" nowrap width="50%">
						<div class="printOuterBox">
						<table width="700" height="300" border="0" id="appletborder" align="center" cellpadding="0" cellspacing="0">
															<!-- <br>
																<tr width="50%">   -->

															<!-- 	</tr>  -->
<%
		String strCompType=request.getParameter("select_compType");
		if(strCompType == null || strCompType.length()==0)
			strCompType = s_server;

		String strScheduleInfo ="";
		if(request.getParameter("schtype")!=null)
			strScheduleInfo="&er_userid="+Struid+"&schtype="+request.getParameter("schtype");
		if(erd.s_gtype != null && erd.s_gtype.equalsIgnoreCase("Citrix")&& erd.s_rtype!=null
		&&erd.s_rtype.equalsIgnoreCase("Session") && StrDaychart!=null&&StrServer!=null && !StrServer.equals(""))
		{
			if(strCompType!=null && strCompType.equalsIgnoreCase("All Types"))
			{
				String strTemp = (String)session.getAttribute("uniqueUserCompType");
				if(strTemp!=null && strTemp.length()>0)
					strCompType= strTemp;
			}
%>
																<tr>
																	<td height="300" width="700" align="right"><img src="<%=strManagerURL%>/final/servlet/com.eg.ErCtxServerReportC;jsessionid=<%=session.getId()%>?er_width=700&er_height=300&er_view=imageprint&er_rtype=Session&er_gtype=Citrix&er_tbound=<%=StrTbound%>&er_trgttype=<%=URLEncoder.encode("Session Report")%>&select_farm=<%=request.getParameter("select_farm")%>&select_compType=<%=strCompType%>&er_timeline=<%=com.eg.EgURLEncoder.encode(StrTimeline,"UTF-8")%>&er_trenddata=<%=StrTrend%>&startdate=<%=com.eg.EgURLEncoder.encode(Strstdate,"UTF-8")%>&er_excwe=<%=Strexcwe%>&enddate=<%=com.eg.EgURLEncoder.encode(Strenddate,"UTF-8")%>&timefrom=<%=Strtimefrom%>&timeto=<%=Strtimeto%>&starthr=<%=Strsthr%>&endhr=<%=Strendhr%>&daychartfor=<%=StrDaychart%>&select_server1=<%=StrServer%>&uid=<%=Struid%>&minfrom=<%=request.getParameter("minfrom")%>&minto=<%=request.getParameter("minto")%>&startmin=<%=startmin%>&endmin=<%=endmin%>&er_select_server=<%=URLEncoder.encode(server_select) %>&select_server=<%=st_server%>&inidate=<%=com.eg.EgURLEncoder.encode(st_inidate,"UTF-8")%><%=strScheduleInfo%>"></td>
																</tr>
<%
		}
		else
		{
%>
																<tr>
																	<td height="300" width="700" align="right"><img src="<%=strManagerURL%>/final/servlet/com.eg.ErCtxServerReportC;jsessionid=<%=session.getId()%>?er_width=700&er_height=300&er_option=<%=request.getParameter("er_option")%>&er_view=imageprint&er_rtype=Session&er_gtype=Citrix&er_tbound=<%=StrTbound%>&er_trgttype=<%=URLEncoder.encode("Session Report")%>&select_farm=<%=request.getParameter("select_farm")%>&er_timeline=<%=com.eg.EgURLEncoder.encode(StrTimeline,"UTF-8")%>&er_trenddata=<%=StrTrend%>&er_stdate=<%=com.eg.EgURLEncoder.encode(Strstdate,"UTF-8")%>&er_excwe=<%=Strexcwe%>&er_enddate=<%=com.eg.EgURLEncoder.encode(Strenddate,"UTF-8")%>&timefrom=<%=Strtimefrom%>&timeto=<%=Strtimeto%>&er_sthr=<%=Strsthr%>&er_endhr=<%=Strendhr%>&daychartfor=<%=StrDaychart%>&select_server1=&uid=<%=Struid%>&select_compType=<%=strCompType%>&minfrom=<%=request.getParameter("minfrom")%>&minto=<%=request.getParameter("minto")%>&startdate=<%=com.eg.EgURLEncoder.encode(Strstdate,"UTF-8")%>&enddate=<%=com.eg.EgURLEncoder.encode(Strenddate,"UTF-8")%>&starthr=<%=Strsthr%>&endhr=<%=Strendhr%>&startmin=<%=startmin%>&endmin=<%=endmin%>&er_select_server=<%=server_select%>&select_server=<%=st_server%>&inidate=<%=com.eg.EgURLEncoder.encode(st_inidate,"UTF-8")%><%=strScheduleInfo%>">
																	</td>
																</tr>
<%

		}
%>															
				</table>
				</div>
			<div class="clearDiv">&nbsp;</div>
														
		<%
		boolean serverEnable=true;
		if(serverName!=null && !serverName.equalsIgnoreCase("null") && serverName.length()>0)
		{
			String strDispHostname = serverName;
			if(serverName!=null && serverName.indexOf(":NULL")>-1)
			{
				strDispHostname = serverName.substring(0,serverName.indexOf(":NULL"));
			}
			else if(serverName!=null && serverName.indexOf(":")>-1)
			{
				strDispHostname = serverName.substring(0,serverName.lastIndexOf(":"));
			}
			String tempCmpTypeName = "";
			if(serverName!=null && serverName.indexOf(":")>-1)
				tempCmpTypeName = " - "+intlmap.getComponentTypeDescription(serverName.substring(serverName.lastIndexOf(":")+1));
			s_tit = intlmap.getTextDescription("reporter.common.Unique user details for Zone")+" "+ select_farm+" "+intlmap.getTextDescription("reporter.common.and Server")+" "+strDispHostname;
%>
	<!-- <th class="cellbgdark" width="100%" NOWRAP height="20" colspan="5"><span class="<%=fontStyleDblSingl%>">&nbsp;<egui:intnl text="reporter.common.Unique users for Zone" />&nbsp;<%=select_farm%> <egui:intnl text="reporter.common.and Server" /> <%=strDispHostname%> &nbsp; </span></th>  -->
	<div class="printOuterBoxHeader" style="text-align:left"> <egui:intnl text="reporter.common.Unique users for"/>&nbsp;
<%
		if(er_option!=null && !er_option.equalsIgnoreCase("Component")){
%>
			<%=intlmap.getTextDescription("reporter.common."+er_option)%>&nbsp;:&nbsp;<%=select_farm%>,&nbsp;
<%
		}
%>
	
		<egui:intnl text="reporter.common.Server" />&nbsp;<%=strDispHostname+tempCmpTypeName%> </div>
<%
		}
		else
		{
			s_tit = intlmap.getTextDescription("reporter.common.Unique user details for Zone")+" "+ select_farm+" ";
%>
	<!--	<th class="cellbgdark" width="100%" NOWRAP height="20" colspan="5"><span class="<%=fontStyleDblSingl%>">&nbsp;<egui:intnl text="reporter.common.Unique users for Zone" />&nbsp;<%=select_farm%></span></th>  -->
	<div class="newimg"> <!-- to push the graph header down to the next page -->
	<div class="printOuterBoxHeader"><egui:intnl text="reporter.common.Unique users for Zone" />&nbsp;<%=select_farm%> </div>
<%
		}
vec1.add(intlmap.getTestDescription("reporter.common.User name"));
%>
		<div class="newTable">
			<table  width="100%" cellspacing="0" cellpadding="4" border="0" id="tableborder">
			<thead>
			<tr>
			<th id="er_submit" nowrap
				align="left" colspan="5"><b><span
			class="<%=fontStyleDblSingl%>"><egui:intnl text="reporter.common.User" /></span> </b></th>
<%
		/*if(!serverEnable)
		{
																						out.println("<td id=\"cellbgapplet\" class=\"blackcontent\" nowrap align=\"center\"><b>Server</b></td>");	
		}*/
%>
																	<!-- <td id="cellbgapplet" class="blackcontent" nowrap align="center"><b>Date</b></td>
																<td id="cellbgapplet" class="blackcontent" nowrap align="center"><b>Login Duration</b></td> -->
			</tr>
			</thead>
<%
		Iterator itr=DaywiseUserData.keySet().iterator();
		int count=0;
		while(itr.hasNext())
		{
			String user=(String)itr.next();
			lst_dat1.add(user);
			Vector u_data=(Vector)DaywiseUserData.get(user);
			if((count%5)==0)
			{
				out.println("<tr>");
			}
			/*out.println("<td id=\"cellbgapplet\" class=\"blackcontent\" nowrap align=\"center\" rowspan=\""+(u_data.size()/3)+"\">"+user+"</td>");*/
			out.println("<td id=\"tdborder\" class=\"blackcontent\"  align=\"center\">"+user+"</td>");
			//for(int v=0; v<u_data.size(); v=v+3)
			/*for(int v=0; v<u_data.size(); v++)
			{
				//if(!serverEnable)
				out.println("<td id=\"cellbgapplet\" class=\"blackcontent\" nowrap align=\"center\">"+u_data.get(v)+"</td>");
				/*String date=(String)u_data.get(v+1);
				String duration=(String)u_data.get(v+2);
				out.println("<td id=\"cellbgapplet\" class=\"blackcontent\" nowrap align=\"center\">"+date+"</td>");
				out.println("<td id=\"cellbgapplet\" class=\"blackcontent\" nowrap align=\"center\">"+duration+"</td>");*/
				//out.println("</tr>");
				count++;
			//}
		}
		if((count%5)!=0)
		{
			out.println("<td id=\"tdborder\" class=\"blackcontent\" nowrap align=\"center\" colspan=\""+(5-(count%5))+"\">-</td>");
		}
		out.println("</tr>");
%>
															</table>
															</div>
															</div>
														</td>
													</tr>
												</table>
											</div>
										<!-- 	</td>
										</tr>
									</table> -->
							<!-- 	</td>
							</tr>
						</table>  -->
											<!--GRAPH IMAGE CONTAINER ENDS HERE--> <%
	//}
	ht.put(vec1,lst_dat1);
	ht1.put(s_tit,ht);
	lst.add(ht1);
	session.setAttribute("ScheduleCSVData",lst);

	}
}
	if(pdfPrint != null && pdfPrint.equalsIgnoreCase("yes"))
	{
%>

		<div class="printFooterText"><%=strPrintFooterText%></div>
<%
	}

}
catch(Throwable t)
{
	t.printStackTrace();
}
%>
</body>
</html>
<%@ include file="ErRemoveUser.jsp"%>


<%
// karthikeyan 

	 if(titleToDisplay!=null && !titleToDisplay.isEmpty())
	{
	//For Setting the PDf File Name
	String reportFileName=customReplaceAll(titleToDisplay," ","_");
	HashMap paramVal =new HashMap();
	paramVal.put("fileName",reportFileName);
	session.setAttribute("parameters", paramVal);
	}

%>

<%!
	// karthikeyan 
    public  String customReplaceAll(String source,String toReplace,String replacement) {
        int idx = source.lastIndexOf(toReplace);
        if (idx != -1) {
            StringBuffer ret = new StringBuffer(source);
            ret.replace(idx, idx + toReplace.length(), replacement);
            while ((idx = source.lastIndexOf(toReplace, idx - 1)) != -1) {
                ret.replace(idx, idx + toReplace.length(), replacement);
            }
            source = ret.toString();
        }
        return source;
    }
    //

%>

