<!DOCTYPE html>

<%
/*****************************************************************************
*	File name		: ErPrintUserActivityReport.jsp
*	Purpose			: This page Handles PrintUserActivityReport
*	Version			: Reporter 5.6
*	Author			:
*	design Changes	: Jaiwin
********************************************************************************/
%>
<%@ include file="ErTracker.jsp"%>
<%@ page import="egurkha.reporter.*"%>
<%@ page import="com.eg.EgDiscInfoHelper"%>
<%@ page import="java.util.*"%>
<%@ page import="egurkha.TransactionBean"%>
<%@ page import="egurkha.EgDbAdapterUI"%>
<%@ page import="com.eg.EgDbAdapterTypeUI"%>
<%@ page import="com.eg.*"%>
<%@ page import="com.eg.EgDbInfo"%>
<%@ page import="com.eg.IniFile"%>
<%@ page import="com.eg.EgInstallInfo,com.eg.EgTopoInfo,com.eg.EgSpecsInfo"%>
<%@ page import="egurkha.EgCrawler"%>
<%@ page import="com.eg.EgTopoInfo"%>
<%@ page import="com.eg.EgDateInfo"%>
<%@ page import="java.text.Format.*"%>
<%@ page import="java.text.DateFormat.*"%>
<%@ page import="java.text.*"%>
<%@ page import="java.net.*" %>
<%@ page import="com.eg.EgReportInfo"%>
<%@ page import="com.eg.EgMappingInfo"%>
<%@ page import="com.eg.EgTablesInfo"%>
<%@ page import="com.egurkha.util.DateUtil"%>
<%@ page import="com.egurkha.util.*"%>
<%@ page import="com.egurkha.util.DateTimeTokenizer"%>
<%@ page import="com.eg.EgTesterInfo"%>
<%@ page import="com.eg.EgTestInfo"%>
<%@ page import="com.eg.EgURLDecoder"%>
<%@ page import="com.eg.EgDbInfo"%>
<%@ page import="com.eg.EgConfigInfo"%>
<%@ page import="java.io.*"%>
<%@ page import="com.egurkha.util.StringUtils"%>
<%@ taglib prefix="egui" uri="../WEB-INF/eg-taglib.tld"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import = "com.egurkha.monitor.EgServiceMappingBean"%>
<%@ page import="com.egurkha.util.StringUtils"%>
<%@ page import = "net.sf.json.*" %>
<jsp:useBean id="esmb" scope="page" class="com.egurkha.monitor.EgServiceMappingBean" />

<%
	// For Service component mapping
	// by Saravanan.A
	String titleToDisplay=request.getParameter("er_RmDispName");
	String priority = request.getParameter("er_priority");

	Hashtable resultServiceNamesForComp=(Hashtable)esmb.getServiceNamesForComponentMap();
try
{
 	String queryString = ErUtils.prepareQueryString(request.getParameterMap());
	String qString=getEncodedQueryString(queryString);
	String mngrIP= new IniFile(new EgConfigInfo("manager").getDbFile()).getValue("DB_PROPERTIES","ManagerUrl");
	UBean = new ErUserData(urs,false);
	session.setAttribute("UBean",UBean);
	ErReqData erd = new ErReqData(request);
	EgDateInfo egDt =new EgDateInfo();
	ErUtils erUtils = new ErUtils();
	ErReportHelper erh=new ErReportHelper();

	EgUserRole userRole      = thisuser.getUserRole();
	boolean hasAllComponentAccess= userRole.hasAllComponentAccess();
	//added by chandrasekhar
	List userCompList=new LinkedList();
	if(!hasAllComponentAccess)
	{
		userCompList = getComponentsForUserNotAccessAllComponents(thisuser);
	}
	//ended here
	//For Time Zone Conversion
	EgTimeZoneConverter timeZoneConverterStart = null;
	EgTimeZoneConverter timeZoneConverterEnd = null;
	String startDateForDisplay = null;
	String startHourForDisplay = null;
	String endDateForDisplay = null;
	String endHourForDisplay = null;
	String startMinForDisplay = null;
	String endMinForDisplay = null;

	User userName=UserRegistry.getInstance().getUser(session.getId());

	String s_tit= "";
	String s_tit1= "";
	List lst = new LinkedList();
	List lst_dat = new LinkedList();
	Hashtable sen = new Hashtable();
	Hashtable ht = new Hashtable();
	Vector vec = new Vector();
	Hashtable ht1 = new Hashtable();
	List lst_dat1 = new LinkedList();
	Hashtable sen1 = new Hashtable();
	Vector vec2 = new Vector();
	Vector vec1 = new Vector();
	Vector vec3 = new Vector();
	List lst_dat2 = new LinkedList();
	Vector v_val1 = new Vector();
	EgMappingInfo intlmp=new EgMappingInfo(thisuser.getLanguage());
	ErComponentsUtils compUtil = new ErComponentsUtils(thisuser.getLoginID());
	List siteNames = new LinkedList();
	siteNames.addAll(compUtil.getUserServices(true));
	siteNames.addAll(compUtil.getUserSites());
	EgMappingInfo intlmap = new EgMappingInfo(thisuser.getLanguage());
	String reportType=request.getParameter("er_reportType");
	String er_option=request.getParameter("er_option");
	EgTablesInfo tablesInfo = new EgTablesInfo("manager");
	EgSpecsInfo specsInfo = new EgSpecsInfo("manager");
	EgTesterInfo testInfo = new EgTesterInfo("manager");
	EgTestInfo tokInfo = new EgTestInfo("manager");
	EgDbInfo dbInfo = new EgDbInfo("manager");
	EgReportInfo reportInfo=new EgReportInfo("manager");
	EgDiscInfoHelper  discInfoHelper=new EgDiscInfoHelper();
	String colSeparator = testInfo.getDDSeparator1();
	String rowSeparator = testInfo.getDDSeparator2();
	String server = "";
	String user = "";
	String Farmserver = "";
	com.egurkha.ini.IniUI ui = (com.egurkha.ini.IniUI)com.egurkha.ini.IniUI.getInstance();
	String installDir = EgInstallInfo.getInstallDir();
	Hashtable Hasservice=new Hashtable();
	Vector v_repdata = (Vector)session.getAttribute("Rep_data");
	Hashtable ht_Data = (Hashtable)session.getAttribute("TopNReportData");
	if(ht_Data == null)
	{
		ht_Data = (Hashtable)request.getAttribute("TopNReportData");
	}
	Hashtable Rep_data1 = (Hashtable) session.getAttribute("Farm_data");
	if(Rep_data1 == null || Rep_data1.equals(""))
	{
		Rep_data1 = (Hashtable)request.getAttribute("Form_Data");
	}
	Hashtable avg_data = (Hashtable) session.getAttribute("SummaryData");
	Hashtable Application_data = (Hashtable)session.getAttribute("htdat");
	Hashtable Session_data = (Hashtable)session.getAttribute("sessionData");
	if(avg_data == null)
	{
		avg_data = (Hashtable)request.getAttribute("SummaryData");
	}
	if(Session_data == null)
	{
		Session_data = (Hashtable)request.getAttribute("Report_data_ForSession");
	}
	if(Application_data == null)
	{
		Application_data = (Hashtable)request.getAttribute("htdat");
	}
	ArrayList apptop= (ArrayList)session.getAttribute("appForPrint");

	if(apptop== null && "true".equals(request.getParameter("throughSchedule")))
	{
		apptop =  (ArrayList)request.getAttribute("appForPrint");
	}
	ArrayList alistallMeasuresDisp=(ArrayList)request.getAttribute("alistallMeasuresDisp1");
	String st_apptopdata=  (String)session.getAttribute("titleapp");
	Hashtable htableMinMaxAvgPer =(Hashtable)request.getAttribute("htableMinMaxAvgPer1");
	Hashtable htableTargetHost =(Hashtable)request.getAttribute("htableTargetHost1");
	Hashtable htableSummaryAvgDisp=(Hashtable)request.getAttribute("htableSummaryAvgDisp1");

	String s_comptype = request.getParameter("avg");
	String titforsession = (String)session.getAttribute("title");
	Vector Session_data1 = (Vector)session.getAttribute("sessionData1");
	if(Session_data1 == null)
	{
		Session_data1 = (Vector)request.getAttribute("Report_data1");
	}
	ArrayList arrses_data = (ArrayList)session.getAttribute("sessionDatatop");
	if(arrses_data == null)
	{
		 arrses_data = (ArrayList)request.getAttribute("Report_data2");
	}
	ArrayList dataHash = (ArrayList) session.getAttribute("Event_data");//from ErCtxEventReporter for total alert
	if(dataHash == null)
	{
		dataHash = (ArrayList)request.getAttribute("RESULTPROC");
	}
	Vector a_list=(Vector)session.getAttribute("NO_ALERTS");//from ErCtxEventReporter.jsp for all alerts
	if(a_list ==null)
	{
		a_list=(Vector)request.getAttribute("ALERTS");
	}

	ArrayList Hash_repdata = (ArrayList) session.getAttribute("hash_data");
	ArrayList topAppsDataForFarm = (ArrayList)session.getAttribute("userTopAppsFarm");
	ArrayList topAppsDataForServer = (ArrayList)session.getAttribute("userTopAppsServ");
	ArrayList  perServerDispMaxAvgPer = (ArrayList)session.getAttribute("userMaxAvgPer");
	//ArrayList perServerDispMaxAvgPer = (ArrayList)request.getAttribute("userMaxAvgPer");
	ArrayList disconuser=(ArrayList)request.getAttribute("disconuserdeal");
	if(Hash_repdata == null)
	{
		Hash_repdata = (ArrayList) request.getAttribute("Report_data");
	}
	if(perServerDispMaxAvgPer == null)
	{
		   perServerDispMaxAvgPer = (ArrayList) request.getAttribute("perServerDispMaxAvgPer");
		// perServerDispMaxAvgPer = (ArrayList)session.getAttribute("perServerDispMaxAvgPer");
	}
	if(topAppsDataForFarm == null)
	{
		topAppsDataForFarm = (ArrayList) request.getAttribute("topAppsDataForFarm");
	}
	if(topAppsDataForServer == null)
	{
		topAppsDataForServer = (ArrayList) request.getAttribute("topAppsDataForServer");
	}
	if(disconuser == null)
	{
		disconuser=(ArrayList)request.getAttribute("disconnectuser");
	}
	Vector userReSum = (Vector)session.getAttribute("userReSummary");
	if(userReSum == null)
	{
		userReSum = (Vector)request.getAttribute("userReSummary");
		//userReSum = (Vector)request.getAttribute("userReSummaryControlProcess");
	}
	ArrayList Repserver_data = null;//(ArrayList)session.getAttribute("Repserver_data");
	if(Repserver_data == null)
	{
		Repserver_data = (ArrayList)request.getAttribute("Repserver_data");
	}

	HashMap powerMap=(HashMap)session.getAttribute("powerinfoMap");
	HashMap esxDataMapType=(HashMap)session.getAttribute("guestMap");
	HashMap osinfoMapType=(HashMap)session.getAttribute("osinfoMap");

	int maxInfo = erh.getMaxInfos("INFOS","MaxInfos");
	HashMap Report_data= new HashMap();
	Vector Report_data1= new Vector();
	Hashtable Repserver_hash = new Hashtable();
	String startDate="";
	String endDate="";
	long msecsPerHour = (long) 1000 * 60 * 60;

	String timefrom = request.getParameter("timefrom");
	String timeto = request.getParameter("timeto");
	String minfrom = request.getParameter("minfrom");
	String minto = request.getParameter("minto");
	String r_type = request.getParameter("er_rtype");
	String viewReport = (String)session.getAttribute("view");
	if(viewReport == null)
	{
		viewReport = request.getParameter("vw");
	}
	Hashtable h_data = new Hashtable();
	Vector time = new Vector();
	Vector print_data = new Vector();
	ArrayList arr_session = new ArrayList();
	Hashtable avgAcrosServerFinal=new Hashtable();
	h_data = (Hashtable)session.getAttribute("Report_data");
	time = (Vector)session.getAttribute("time");

	String ctype = request.getParameter("er_comptype");
	String rtype = request.getParameter("er_gtype");
	String ercontype =request.getParameter("ercontype");
	String subtype = request.getParameter("er_trgttype");
	String Strexcwe = request.getParameter("er_excwe");
	String erservice = request.getParameter("erservice");
	String typeisend= request.getParameter("typeisend");
	String chec= request.getParameter("er_check");
	String str_Comptype = request.getParameter("er_server");
	String drillDown = request.getParameter("drillDown");
	String isFromDrillDown = request.getParameter("isFromDrillDown");
	if(str_Comptype!=null && str_Comptype.lastIndexOf(":")>-1)
		str_Comptype = str_Comptype.substring(str_Comptype.lastIndexOf(":")+1);
	else if(str_Comptype!=null && str_Comptype.indexOf("All")>-1)
		str_Comptype = str_Comptype.substring(str_Comptype.indexOf("All")+4);


	String totalspan = "";
	ArrayList subjects=(ArrayList)reportInfo.getVariables("CITRIX_CHANNEL_RESOURCE");
	totalspan=(getColspanCount(subjects,"CITRIX_CHANNEL_RESOURCE",str_Comptype)+1)+"";

	if(erservice==null)
		erservice="";
	if(chec!=null && chec.equalsIgnoreCase("CtxZone"))
		avgAcrosServerFinal=(Hashtable)session.getAttribute("ctxavg");
	else if(subtype!=null && subtype.equalsIgnoreCase("Farm Report"))
		avgAcrosServerFinal=(Hashtable)session.getAttribute("avgdata");
	else
		avgAcrosServerFinal=(Hashtable)session.getAttribute("avg");
	if(Strexcwe!=null)
		Strexcwe=Strexcwe.trim();

	String dispStartDate = null;
	String dispEndDate = null;
	String uiFile = "eg_ui.ini";
	String s_iniFile_dir = EgInstallInfo.getInstallDir()+ "/manager/config/";
	IniFile egUI = new IniFile(s_iniFile_dir + uiFile);
	String currentDateFormat = strUserDateFormat;
	String thinzone="";
	
	String fontStyleDbl = "";
	String fontStyleDblSingl = "";
	String pdfPrint = request.getParameter("pdfPrint");
	if((dbInfo.doubleByteEnabled || !thisuser.getLanguage().equals("en_US")) && !(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes")))
	{
		fontStyleDbl = " multi_font";
		fontStyleDblSingl = "multi_font";
	}
	else
	{
		fontStyleDbl = "";
		fontStyleDblSingl = "";
	}
	String strWeb_sHelth =request.getParameter("select_report");
	String show_Transaction = request.getParameter("er_showTransaction");
	String strVmComp = reportInfo.getValue("MISC","VMWareComponent");
	String highlightedSummary = request.getParameter("highlightedSummary");
	ArrayList aListVmComponentType = new ArrayList();
	if(strVmComp!=null && strVmComp.length()>0)
	{
		StringTokenizer stToken = new StringTokenizer(strVmComp,",");
		while (stToken.hasMoreTokens())
		{
			String str = stToken.nextToken();
			str = str.trim();
		//	str = str.toUpperCase();
			aListVmComponentType.add(str);
		}
	}
	ArrayList aListSupportedComponentType = reportInfo.getComponentsList("CITRIX_CHANNEL_RESOURCE",false);
	ArrayList aListAlltype = new ArrayList();
	for(int kk=0;kk<aListSupportedComponentType.size();kk++)
	{
		aListAlltype.add("All "+aListSupportedComponentType.get(kk));
	}
	String strGraphViewType = request.getParameter("graphViewtype");
	boolean isEnglishLanguage=false;
	if(trackerLanguage!=null && trackerLanguage.equals("en_US"))
	{
		isEnglishLanguage=true;
	}


%>

<!Doctype html>
	<head>
<%
	if(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes"))
	{
%>

		<title>&nbsp; <egui:intnl text="reporter.common.Reporter" />&nbsp; &nbsp;-PDR- &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" />
		<style type="text/css" media="print">
			#printbt{ display:none}
			#newimg{page-break-inside:avoid}
			.newimg{page-break-inside:avoid}
		</style>
		<script language="JavaScript1.2" src="../reporter/scripts/er_imagesLite.js"></script>
		<script language="javascript" src="../reporter/scripts/jsrsClient.js"></script>
		<script language="javascript" src="../reporter/scripts/select.js"></script>
		<script language="JavaScript1.2" src="../scripts/<%=script_src%>"></script>
		<script language="javascript">
			var remoteURL = "/final/servlet/com.eg.ErRemoteScriptingServlet";
			var noItemText = "Not Applicable";
			var focusItem = null;
		</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>
<%
	}
	String subrtype=request.getParameter("subrtype");
	throughSchedule=request.getParameter("throughSchedule");
	if(throughSchedule!=null && throughSchedule.equalsIgnoreCase("true"))
	{
		subrtype=request.getParameter("er_subrtype");
	}
	else
		subrtype = subrtype;
	if(r_type!=null && r_type.equalsIgnoreCase("CtxChannelResource"))
	{
		//citrix report
		String temp_st="";
		if(rtype!=null && rtype.equalsIgnoreCase("Citrix"))
			temp_st="Thin Client";
		else
			temp_st=rtype;
		lst.add(intlmap.getTextDescription("reporter.thin.THIN CLIENT REPORTS")+" - "+intlmap.getTextDescription("reporter.common.CHANNEL RESOURCE"));

		if(titleToDisplay==null)
			titleToDisplay="ICA Virtual Channel Analytics"; 
%>
		<div class="printHeaderBox">
<%
		if (!StringUtils.isNull(titleToDisplay))
		{
%>
			<div class="printHeaderBoxTitle"><%= titleToDisplay %></div>
<%
		}
		else
		{
%>
			<div class="printHeaderBoxTitle">
				<header><%=temp_st%> <egui:intnl text="reporter.common.Reports - ICA Virtual Channel Analytics" /></header>
			</div>
<%
		}
	}

	if((Hash_repdata !=null && !Hash_repdata.isEmpty()) ||
		(v_repdata!=null && !v_repdata.isEmpty()) || (ht_Data !=null && !ht_Data.isEmpty()) ||
		(Rep_data1!=null && !Rep_data1.isEmpty()) || (h_data!=null && !h_data.isEmpty()) ||
		(apptop!=null && !apptop.isEmpty()) || (Session_data!=null && !Session_data.isEmpty()) || 
		(Session_data1!=null && !Session_data1.isEmpty()) ||
		(Repserver_data!=null &&!Repserver_data.isEmpty()) ||
		(dataHash!=null && !dataHash.isEmpty()) ||
		(Application_data!=null && !Application_data.isEmpty()) ||
		(arrses_data!=null && !arrses_data.isEmpty()) ||
		(topAppsDataForFarm!=null && !topAppsDataForFarm.isEmpty()) )
	{
		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>
<%
		}
	}
	else
	{
		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">
<%
	String start_date=erd.s_stdate;
	String end_date=erd.s_enddate;
	if(start_date!=null && end_date!=null)
	{
		if(erd.s_startmin !=null && !erd.s_startmin.equalsIgnoreCase("null"))
		{
			dispStartDate=start_date.trim()+" "+erd.s_sthr+":"+erd.s_startmin;
		}
		else
		{
			dispStartDate=start_date.trim()+" "+erd.s_sthr+":"+"00";
		}

		if(erd.s_endmin !=null && !erd.s_endmin.equalsIgnoreCase("null"))
		{
			dispEndDate=end_date.trim()+" "+erd.s_endhr+":"+erd.s_endmin;
		}
		else
		{
			dispEndDate=end_date.trim()+" "+erd.s_endhr+":"+"00";
		}
	}
	Vector v_qry_string = null;
	String opt = request.getParameter("opt");
	String s_title;
	String chartType = null;
	String NoofServers = null;
	int flag = 0;

	if(opt!=null && opt.equals("chart")&& r_type!=null && r_type.equals("CtxChannelResource"))
	{
		v_qry_string = (Vector)request.getAttribute("appChartData");
	}
	if(r_type!=null && r_type.equals("CtxChannelResource"))
	{
		NoofServers = reportInfo.getNoOfBars("CITRIX_CHANNEL_RESOURCE","top");
		chartType = reportInfo.getChartTypeForDist("CITRIX_CHANNEL_RESOURCE");
	}
	 if(rtype.equals("Citrix") && subtype.equals("User Channel Report"))
	{
		String Days = reportInfo.getExcludeWeekend("CITRIX_CHANNEL_RESOURCE");
%>
<%	//<%@  include file ="ErTimeFormatJSON.jsp" %>	
<%		String s_server1 = request.getParameter("er_server"); 
		String s_application1 = request.getParameter("er_application");
		String s_perserver=request.getParameter("er_perserver");
		String s_farmserver1 = request.getParameter("select_farm");
		String s_farmserver = request.getParameter("select_farm");
		String s_application = request.getParameter("er_application");
		if(s_farmserver1!=null && !s_farmserver1.equals("-1"))
		{
			lst.add(intlmap.getTextDescription("reporter.common.ICA Virtual Channel Analytics for ")+" "+er_option+" "+s_farmserver1);
%>
			<div class="printSelectionFields" ><egui:intnl text="reporter.common.ICA Virtual Channel Analytics for " /> <span class="bold"><%=" "+er_option+" : " %>&nbsp;<%=s_farmserver1%></span></div>
<%
		}
		else
		{
			lst.add(intlmap.getTextDescription("reporter.common.ICA Virtual Channel Analytics"));
%>
			<div class="printSelectionFields" ><egui:intnl text="reporter.common.ICA Virtual Channel Analytics" /></span></div>
<%
		}
		lst.add('"'+intlmp.getTextDescription("reporter.common.Time period")+":"+intlmp.getTextDescription("reporter.common.From")+" "+timefrom+":"+minfrom+intlmp.getTextDescription("reporter.common.Hrs")+" "+intlmp.getTextDescription("reporter.common.To")+" "+timeto+":"+minto+intlmp.getTextDescription("reporter.common.Hrs")+'"');
	
		timeZoneConverterStart = new EgTimeZoneConverter(dispStartDate ,userName);
		startDateForDisplay = (String) timeZoneConverterStart.getDate(false);
		startHourForDisplay = timeZoneConverterStart.getHour();
		startMinForDisplay = timeZoneConverterStart.getMinute();

		timeZoneConverterEnd = new EgTimeZoneConverter(dispEndDate ,userName);
		endDateForDisplay = (String) timeZoneConverterEnd.getDate(false);
		endHourForDisplay = timeZoneConverterEnd.getHour();
		endMinForDisplay = timeZoneConverterEnd.getMinute();

		String pdfStartDate=startDateForDisplay+" "+startHourForDisplay+":"+startMinForDisplay;
		String pdfEndDate = endDateForDisplay+" "+endHourForDisplay+":"+endMinForDisplay;
	
		Vector dvec = new Vector();
		String stimefmt =pdfStartDate;
		String etimefmt =pdfEndDate;

		dvec.add('"'+stimefmt+'"');
		dvec.add('"'+etimefmt+'"');
		lst.add(dvec);

		if(Strexcwe!=null&&Strexcwe.equalsIgnoreCase("Yes"))
		{
%>
			<div class="printSelectionFields" ><egui:intnl text="reporter.common.Exclude WeekEnds" />- <span class="bold"><egui:intnl text='<%=Days%>' /></span></div>
<%
		}
%>
			<div class="printSelectionFields">Timeline - <span class="bold"><%=stimefmt%>&nbsp;<egui:intnl text="reporter.common.hrs" /> to <%=etimefmt%>&nbsp;<egui:intnl text="reporter.common.hrs" /></span></div>
			<div class="printSelectionFields"><egui:intnl text="reporter.common.Time Period" /> : <span class="bold"><%=timefrom+":"+minfrom%>&nbsp;<egui:intnl text="reporter.common.hrs" /> to <%=timeto+":"+minto%>&nbsp;<egui:intnl text="reporter.common.hrs" /></span></div>
		</div>

<%
		if(v_qry_string != null && v_qry_string.size() >= 2)
		{
%>
	<!-- THE ROW THAT HAS TO BE REPEATED FOR SHOWING GRAPHS STARTS HERE-->
		<div class="printOuterBox">
		<%
			if(strGraphViewType != null && strGraphViewType.equalsIgnoreCase("Timeline")){
				String userNme=s_application;
				userNme = erUtils.specialCharDecode(userNme);
				if(userNme != null && userNme.contains("|slash|"))
					userNme= com.egurkha.util.StringUtils.replace(userNme, "|slash|","\\");
		%>
			<div class="printOuterBoxHeader"><egui:intnl text="reporter.application.User Channel Report" />&nbsp;-&nbsp;<%=userNme%>&nbsp;:&nbsp;<%=s_farmserver%></div> 
<%
			}
			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";
					String grphHeight="225";
					String grphWidth="435";
					if(drillDown!=null && drillDown.equalsIgnoreCase("yes")){
						grphHeight="250";
						grphWidth="700";
					}else if(isFromDrillDown != null && isFromDrillDown.equalsIgnoreCase("true")){
						grphHeight="250";
						grphWidth="850";
					}
					if(strGraphViewType != null && strGraphViewType.equalsIgnoreCase("distribution")){
						grphHeight="225";
						grphWidth="750";
					}
					if(chartType!=null && chartType.equalsIgnoreCase("Pie"))
					{
						theWidth = "400";
						theHeight = "240";
					}
					else
					{
						theWidth = "400";
						theHeight = "240";
					}
					String queryString1 = "";
					String controlfile = st_qryString.substring(0,st_qryString.indexOf("?"));
					st_qryString = st_qryString.substring(st_qryString.indexOf("?")+1);
					HashMap param = ErUtils.parseQueryString(st_qryString);
					if(param.containsKey("graphViewtype"))
					{
						if(param.get("graphViewtype").equals("timeline"))
						{
								theWidth = "600";
								theHeight = "250";
						}
					} 
					Set s_param = param.keySet();
					Iterator i_param = s_param.iterator();
					while(i_param.hasNext())
					{
						String st_key = (String)i_param.next();
						String value = "";
						
						try
						{
							value = (String)param.get(st_key);
							
						}
						catch (ClassCastException e)
						{
								value = ((String[])param.get(st_key))[0];
						}
						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;
						}
						
						queryString1+=st_key+ "=" + URLEncoder.encode(value) + "&";
					}
					if(r_type!=null&&!r_type.equalsIgnoreCase("Session"))
					{
						Str_units = tablesInfo.getUnitForMeasure(Str_test,Str_mes);
						s_title = s_title + " ("+Str_units+")";
					}
					queryString1 = controlfile+"?"+queryString1;
					if(strGraphViewType != null && strGraphViewType.equalsIgnoreCase("Timeline")){
						if(i == 0){
			%>
			<table align="center" width="100%" cellspacing="0" cellpadding="0" border="0">
			<%
						}
			%>
				<tr>
					<td align="center" width="50%" style="padding:0px 10px 10px 0px"> 
						<div class="printOuterBox"> 
<%
					}
					if(flag>0)
					{
%>
						<div class="printOuterBoxHeader" align="left"><%=s_title%></div>
<%
					}
					else
					{
%>
						<div class="printOuterBoxHeader" nowrap align="left"> 
<%
						String stest_mes="";
						if(s_title.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%>" />
<%
						}
						else
						{
%>
							<egui:intnl test="<%=stest_mes%>" />
<%
						}
%>
						</div>
<%
					}
					if(strGraphViewType != null && strGraphViewType.equalsIgnoreCase("Distribution"))
					{
						if(i == 0){
%>			
						<table align="center" width="100%" cellspacing="0" cellpadding="0" border="0">
<%
						}
%>
							<tr>
								<td align="center" width="50%" style="padding:0px 0px 10px 0px"> 
									<div class="printOuterBox">
<%
					}
					String Qstring="";
					if(queryString1!=null)
					{
						StringTokenizer strtok = new StringTokenizer(queryString1,"&");
						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")+"&";
								}else
								if(reqparam.equalsIgnoreCase("dsktp_searchTxt"))
								{
									value = request.getParameter(reqparam);
									if(value!=null)
										Qstring = Qstring+reqparam+"="+EgURLEncoder.encode(value,"UTF-8")+"&";
								}else
								if(reqparam.equals("select_farm"))
								{
									value = request.getParameter(reqparam);
									if(value!=null)
										Qstring = Qstring+reqparam+"="+EgURLEncoder.encode(value,"UTF-8")+"&";
								}else
								if(reqparam.equals("strbg_id"))
								{
									value = request.getParameter(reqparam);
									if(value!=null)
										Qstring = Qstring+reqparam+"="+EgURLEncoder.encode(value,"UTF-8")+"&";
								}else
								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(chartType!=null && chartType.equalsIgnoreCase("Pie"))
					{
%>
									<div align="center"><img src="<%=Qstring%>&optt=graph&er_view=IMAGE&er_width=<%=grphWidth%>&er_height=<%=grphHeight%>" border="0" hspace="0" vspace="0" alt="<%=s_title%>" title="<%=s_title%>"/></img></div>
								</div>
							</td>
<%
					}
					else
					{
%>
									<div align="center"><img src="<%=Qstring%>&optt=graph&er_view=IMAGE&er_width=<%=grphWidth%>&er_height=<%=grphHeight%>" border="0" hspace="0" vspace="0" alt=" <%=s_title%>" title=" <%=s_title%>"></img></div>
								</div>
							</td>
<%
					}
					if(strGraphViewType != null && strGraphViewType.equalsIgnoreCase("Distribution")){
%>
						</tr>
<%
					}
					if(v_qry_string.size() != (i + 2))
					{
						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="";
						if(strGraphViewType != null && strGraphViewType.equalsIgnoreCase("Distribution")){
					%>
						<tr>
					<%
						}
						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=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("dsktp_searchTxt"))
								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("userTimeline"))
								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!=null&&(st_key.equals("er_user") || st_key.equals("er_application") || st_key.equals("strbg_id")))
								value=EgURLEncoder.encode(value,"UTF-8");

							if(st_key.equals("limitforbg"))
							{
								value=EgURLEncoder.encode(value,"UTF-8");
							}
								if(st_key.equals("er_RmDispName") ||  st_key.equals("ReportName") || st_key.equals("bg_reportname"))
							{
								value=EgURLEncoder.encode(value,"UTF-8");
							}
							if(st_key.equals("er_view"))
							{
								if(value.equals("PRINT"))
								{
									continue;
								}
							}
							qstr=qstr+st_key+"="+value+"&";
						}
						if(r_type!=null&&!r_type.equalsIgnoreCase("Session"))
						{
							Str_units = tablesInfo.getUnitForMeasure(er_test,er_meas);
							s_title = s_title + " ("+Str_units+")";
						}

						query_String = controlfile+"?"+qstr;
						qrydata = qrydata +"er_sortby=-1&optt=data";
						if(query_String.indexOf("er_RmDispName")==-1)
							query_String+="&er_RmDispName="+EgURLEncoder.encode(titleToDisplay,"UTF-8");
						//Adding the title and the URL of the image for saving to PDF
						count++;

	%>
						<td class="newimg" align="center" width="50%" style="padding:0px 0px 10px 0px">
							<div class="printOuterBox">
	<%
						if(strGraphViewType != null && strGraphViewType.equalsIgnoreCase("Timeline"))
						{
							if(flag>0)
							{
		%>
								<div class="printOuterBoxHeader" nowrap align="left"><%=s_title%></div> 
		<%
							}
							else
							{
								String stest_mes="";
								if(s_title.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);
			%>
								<div class="printOuterBoxHeader" nowrap align="left"><egui:intnl test="<%=stest%>" />/<egui:intnl measure="<%=stest+":"+smeas%>" /></div> 
			<%
								}
								else
								{
			%>
								<div class="printOuterBoxHeader" nowrap align="left"><%=stest_mes%></div>
			<%
								}
							}
						}
						if(chartType!=null && chartType.equalsIgnoreCase("Pie"))
						{
	%>
							<div align="center"><img src="<%=query_String%>&optt=graph&er_view=IMAGE&er_width=<%=grphWidth%>&er_height=<%=grphHeight%>" border="0" hspace="0" vspace="0" alt="<%=s_title%>" title="<%=s_title%>"></img></div></div></td>
	<%
						}
						else
						{
	%>
							<div align="center"><img src="<%=query_String%>&optt=graph&er_view=IMAGE&er_width=<%=grphWidth%>&er_height=<%=grphHeight%>" border="0" hspace="0"  vspace="0" alt=" <%=s_title%>" title=" <%=s_title%>"></img></div></div></td>
	<%
						}
					}
%>
						</td>
					</tr>
<%
				}
			}
%>
				</table>
			</div>
<%
		}
		else
		{
			if(Application_data!=null && Application_data.size() > 0)
			{
				ArrayList sublist=(ArrayList)reportInfo.getVariables("CITRIX_CHANNEL_RESOURCE");
				String summaryStr=reportInfo.getValue("CITRIX_CHANNEL_RESOURCE_SUMMARY",ctype);
				String highlightedBlock = "";
				String s_server=request.getParameter("er_server");
				s_farmserver=request.getParameter("select_farm");
				s_application=request.getParameter("er_application");
				boolean haveSummary = false;
				LinkedHashMap summaryObj = new LinkedHashMap();
				if(summaryStr!=null && summaryStr.length()>0)
				{
					JSONArray summaryAry=new JSONArray();
					if ((s_server==null  || s_server.equals("-1") || aListAlltype.contains(s_server) || s_server.equals("")) &&  s_farmserver!=null && !s_farmserver.equals(""))
					{
						if(s_perserver!=null && s_perserver.equals("No"))
						{
							summaryAry.add(intlmap.getTextDescription("reporter.common.Server")+"/"+intlmap.getTextDescription("reporter.common.User"));
						}
						else
						{
							summaryAry.add(intlmap.getTextDescription("reporter.common.users"));
						}
					}
					else if ((s_server!=null || !s_server.equals("-1") || !s_server.equals("")) )
					{
						summaryAry.add(intlmap.getTextDescription("reporter.common.users"));
					}
					else
					{
						summaryAry.add(intlmap.getTextDescription("reporter.common.User Channel Report for User")+"-"+s_application);
					}
					summaryAry.add(intlmap.getTextDescription("reporter.common.Time in Session"));
					for(int m=0;m<sublist.size();m++)
					{
						String s_variable = (String)sublist.get(m);
						if(s_variable.startsWith(ctype+":"))
						{
							String s_unit = "";
							StringTokenizer tokens = new StringTokenizer(s_variable,":");
							String hi_value=reportInfo.getValue("CITRIX_CHANNEL_RESOURCE",s_variable);
							String meS = "";
							String displayname = "";
							while(tokens.hasMoreTokens())
							{
								String comS = tokens.nextToken();
								String s_testS = tokens.nextToken();
								String val2=tokens.nextToken();
								StringTokenizer meaS=new StringTokenizer(val2,"#");
								if(meaS.hasMoreTokens() )
									 meS=meaS.nextToken();
								else
									 meS=val2;
								if(meaS.hasMoreTokens() )
									displayname=meaS.nextToken();
								else
									displayname=val2;
								s_unit=tablesInfo.getUnitForMeasure(s_testS,meS);
							}
							tokens = new StringTokenizer(hi_value,",");
							while(tokens.hasMoreTokens())
							{
								displayname = intlmap.getTextDescription("reporter.thin."+displayname);
								if(displayname != null && displayname.indexOf("_") > -1)
									displayname= com.egurkha.util.StringUtils.replace(displayname, "_"," ");

								if(displayname != null && displayname.equals("Network latency"))
									s_unit = "Secs";

								summaryAry.add(displayname+"#"+tokens.nextToken()+"("+s_unit+")");
							}
							if(highlightedSummary!=null && s_variable.startsWith(ctype+":"+highlightedSummary))
							{
								if(hi_value.indexOf(",")>-1)
								{
									hi_value = hi_value.substring(0,hi_value.indexOf(","));
								}
								highlightedSummary = displayname+"#"+hi_value;
							}
						}
					}
					ArrayList dispSummaryLst = new ArrayList(Arrays.asList(summaryStr.split(","))); // From INI value
					JSONArray indexAry = new JSONArray(); // Filter the Required index for Summary panel
					for(int v=0;v<summaryAry.size();v++)
					{
						String summaryCol = (String)summaryAry.get(v);
						if(summaryCol!=null && summaryCol.indexOf("(")>-1)
						{
							summaryCol = summaryCol.substring(0,summaryCol.indexOf("("));
							summaryCol = summaryCol.trim();// Remove the unit
						}
						if(summaryCol!=null && dispSummaryLst.contains(summaryCol))
						{
							indexAry.add(v);
						}
					}
					Vector summarylst=new Vector();
					//new
					Vector v_data_temp = (Vector)session.getAttribute("app_data_temp");
					

					Enumeration enum1 = Application_data.keys();
					while(enum1.hasMoreElements())
					{
						String keys = (String)enum1.nextElement();
						summarylst=(Vector)Application_data.get(keys);
					}
					//new
					if(v_data_temp.size()>0)
					{
						summarylst = v_data_temp;
					}
					if(indexAry.size()>0)
					{
						LinkedHashMap SummaryMp = new LinkedHashMap();
						JSONArray dividerAry = new JSONArray();
						for(int u=0;u<summarylst.size();u++)
						{
							Vector summaryDataAry = (Vector)summarylst.get(u);
							for(int c=0;c<indexAry.size();c++)
							{
								int indexVal = indexAry.getInt(c);
								String columnValue = (String)summaryAry.get(indexVal);
								String data_val = null;
								if(summaryDataAry.size()>indexVal)
									data_val = summaryDataAry.get(indexVal)+"";
								// column highlighting block
								/*if(highlightedSummary!=null && columnValue.startsWith(highlightedSummary))
								{
									if(data_val!=null)
									{
										// 1 is added for skiping graph column
										// custom-column is CSS class
										summaryDataAry.set((indexVal),data_val+"$custom-column");
									}
								}*/
								//end
								ArrayList dataLst = null;
								if(SummaryMp.get(columnValue)==null)
								{
									dataLst = new ArrayList();
								}
								else
								{
									dataLst = (ArrayList)SummaryMp.get(columnValue);
								}
								boolean needIncrement = false;
								if(dividerAry.size()==c)
								{
									dividerAry.add(1);
								}
								else
								{
									needIncrement = true;
								}
								if(data_val!=null && !data_val.equals("-") && !data_val.startsWith("-"))
								{
									int oldIndex = dividerAry.getInt(c);
									if(needIncrement)
									{
										dividerAry.set(c,oldIndex+1);
									}
									try
									{
										if(dataLst.size()>0)
										{
											String oldValStr = (String)dataLst.get(dataLst.size()-1);
											double oldVal = Double.parseDouble(oldValStr);
											double oldVal_new = Double.parseDouble(data_val);
											dataLst.set(dataLst.size()-1,(oldVal+oldVal_new)+"");
										}
										else
										{
											dataLst.add(data_val);
										}
									}
									catch (Exception e)
									{
										if(!dataLst.contains(data_val))
											dataLst.add(data_val);
									}
								}
								SummaryMp.put(columnValue,dataLst);
							}
						}
						if(SummaryMp!=null && SummaryMp.size()>0)
						{
							Set SummaryMp_set = SummaryMp.keySet();
							Iterator SummaryMp_itr = SummaryMp_set.iterator();
							int count = 0;
							while(SummaryMp_itr.hasNext())
							{
								String summaryKey = (String)SummaryMp_itr.next();
								ArrayList dataLst = (ArrayList)SummaryMp.get(summaryKey);
								boolean ishighlight = false;
								if(highlightedSummary!=null && summaryKey.startsWith(highlightedSummary))
									ishighlight = true;
//								summaryKey = summaryKey.replace("#","-");
								String prefixStr = summaryKey;
								String sufixStr = "";
								if(summaryKey.indexOf("#")>-1)
								{
									prefixStr = summaryKey.substring(0,summaryKey.indexOf("#"));
									if(summaryKey.indexOf("(")>-1)
										 sufixStr = summaryKey.substring(summaryKey.indexOf("("),summaryKey.length());
									summaryKey = prefixStr+" "+sufixStr;
								}
								if(ishighlight)
								{
									highlightedBlock = summaryKey;
								}
								if(dataLst.size()==1)
								{
									String valStr = (String)dataLst.get(0);
									try
									{
										double summaryVal = (Double.parseDouble(valStr))/(dividerAry.getInt(count));
										summaryObj.put(summaryKey,erUtils.round(Float.parseFloat(summaryVal+""),2)+"");
									}
									catch (Exception e)
									{
										System.out.println("Error in Summary panel USER ACTIVITY ANALYSIS");
									}
								}
								else
								{
									summaryObj.put("Unique "+summaryKey,dataLst.size()+"");	
								}
								haveSummary = true;
								count++;
							}
						}
					}
				}
				Vector value2=new Vector();
				if (!Application_data.isEmpty())
				{
					Enumeration enum1 = Application_data.keys();
					while(enum1.hasMoreElements())
					{
						String key1 = (String)enum1.nextElement();
						value2=(Vector)Application_data.get(key1);
						s_server=request.getParameter("er_server");
						s_farmserver=request.getParameter("select_farm");
						s_application=request.getParameter("er_application");
						totalspan=(getColspanCount(subjects,"CITRIX_CHANNEL_RESOURCE",key1)+1)+"";
%>
			<div class="printOuterBox">
<%
						if(summaryObj!=null && summaryObj.size()>0)
						{
%>
				<div class="printOuterBoxHeader" width="100%" NOWRAP> <egui:intnl text="reporter.common.Summary" /></div>
				<table align="center" width="100%" cellspacing="0" cellpadding="0" border="0">
					<tbody>
						<tr>
<%
							Set SummaryMp_set = summaryObj.keySet();
							Iterator SummaryMp_itr = SummaryMp_set.iterator();
							int count = 0;
							while(SummaryMp_itr.hasNext())
							{
								String textS = (String)SummaryMp_itr.next();
								String valueS = (String)summaryObj.get(textS);
								if(count%5==0)
								{
%>
									</tr>
									<tr>
<%
								}
%>
							<td> 
								<div style="text-align:center;margin:20px 0px 10px 0px" class="newFont_bold28"><%=valueS%></div>
								<div style="text-align:center;margin:10px 0px 10px 0px" class="newFont_bold14"><%=textS%></div>
							</td>
<%
								count++;
							}
%>
					</tbody>
				</table>
				<div class="clearDiv">&nbsp;</div>
<%
						}
						if ((s_server==null  || s_server.equals("-1") || aListAlltype.contains(s_server) || s_server.equals("")) &&  s_farmserver!=null && !s_farmserver.equals(""))
						{
							if(priority != null && priority.equalsIgnoreCase("All"))
							{
								s_tit1 = intlmp.getTextDescription("reporter.common.ICA Virtual Channel Analytics for")+" - "+key1;
%>
								<div class="printOuterBoxHeader" width="100%" NOWRAP align="center" colspan="<%=totalspan%>"><egui:intnl text="reporter.common.ICA Virtual Channel Analytics for" /> - <egui:intnl type="<%=key1%>" /></div>
<%
							}
							else
							{
								s_tit1 = priority + " " + intlmp.getTextDescription("reporter.common.ICA Virtual Channel Analytics for")+" - "+key1;
%>
								<div class="printOuterBoxHeader" width="100%" NOWRAP align="center" colspan="<%=totalspan%>"><%=priority%>&nbsp;<egui:intnl text="reporter.common.ICA Virtual Channel Analytics for" /> - <egui:intnl type="<%=key1%>" /></div>
<%
							}
%>
				
				<div class="newTable">
					<table align="center" width="100%" cellspacing="0" cellpadding="0" border="0">
						<thead>
							<tr>
<%
							if(s_perserver!=null && s_perserver.equals("No"))
							{
%>
								<th align="center" nowrap><b><egui:intnl text="reporter.common.Server" /> / <egui:intnl text="reporter.common.User" /></b></th>
<%
							}
							else
							{
%>
								<th align="center" nowrap><b><egui:intnl text="reporter.common.User" /></b></th>
<%
							}
						}
						else if ((s_server!=null || !s_server.equals("-1") || !s_server.equals("")) )
						{
							if(priority != null && priority.equalsIgnoreCase("All"))
							{
								s_tit1 = intlmp.getTextDescription("reporter.common.ICA Virtual Channel Analytics for server");
%>
							<div class="printOuterBoxHeader" width="100%" NOWRAP colspan="<%=totalspan%>"><egui:intnl text="reporter.common.ICA Virtual Channel Analytics for Server" /> - 
<%
							}
							else
							{
								s_tit1 = priority + " " + intlmp.getTextDescription("reporter.common.ICA Virtual Channel Analytics for server");
%>
							<div class="printOuterBoxHeader" width="100%" NOWRAP colspan="<%=totalspan%>"><%=priority%>&nbsp;<egui:intnl text="reporter.common.ICA Virtual Channel Analytics for Server" /> - 
<%
							}
%>
<%
							if(s_server.indexOf(":")>-1)
							{
								String s_server_dup = s_server;

%> 
						<%=intlmap.getComponentTypeDescription(ctype)%>
<%
								s_tit1=s_tit1+" - "+intlmap.getComponentTypeDescription(ctype);
							}
							else
							{
							s_tit1=s_tit1+" - "+intlmap.getComponentTypeDescription(ctype);
%>
						<%=intlmap.getComponentTypeDescription(ctype)%>
<%
							}
						vec1.add(intlmap.getTextDescription("reporter.common.User"));
%>
				</div>
				<div class="newTable">
					<table align="center" width="100%" cellspacing="0" cellpadding="0" border="0">
						<thead>
							<tr>
								<th  align="center" nowrap><b><egui:intnl text="reporter.common.User" /></b></th>
<%
						}
						else
						{
							if(priority != null && priority.equalsIgnoreCase("All"))
							{
								s_tit1 = intlmp.getTextDescription("reporter.common.ICA Virtual Channel Analytics for User")+ " "+s_application;
							}
							else
							{
								s_tit1 = priority + " " + intlmp.getTextDescription("reporter.common.ICA Virtual Channel Analytics for User")+ " "+s_application;
							}
%>
				<div class="newTable">
				<table align="center" width="100%" cellspacing="0" cellpadding="0" border="0">
					<thead>
						<tr>
<%
							if(priority != null && priority.equalsIgnoreCase("All"))
							{
%>
								<th width="100%" NOWRAP align="center" colspan="<%=totalspan%>"><b><egui:intnl text="reporter.common.ICA Virtual Channel Analytics for User" /> - <%=s_application%></b></th>
<%
							}
							else
							{
%>
								<th width="100%" NOWRAP align="center" colspan="<%=totalspan%>"><b><%=priority%>&nbsp;<egui:intnl text="reporter.common.ICA Virtual Channel Analytics for User" /> - <%=s_application%></b></th>
<%
							}
						}
%>
							<th  align="center" nowrap><b><egui:intnl text="reporter.common.Time in Session" /></b></th>
<%
							vec1.add(intlmap.getTextDescription("reporter.common.Time in Session (mins)"));
						String s_var = "";
						String st_value="";
						String displayname="";
						String mes="";
						String testname="";
						String s_unit = "";
						Vector v_val = new Vector();
						int connectionIndeIndex=-1;
						int totalColumnval =0;
						ArrayList sublist1=(ArrayList)reportInfo.getVariables("CITRIX_CHANNEL_RESOURCE");
						for(int m=0;m<sublist1.size();m++)
						{
							s_var = (String)sublist1.get(m);
							String val2="";
							if (s_server==null || s_server.equals("-1"))
							{
								if(s_var.startsWith(key1)) 
								{
									StringTokenizer tok2 = new StringTokenizer(s_var,":");
									while(tok2.hasMoreTokens())
									{
										tok2.nextToken();
										testname=tok2.nextToken();
										val2=tok2.nextToken();
										StringTokenizer meas=new StringTokenizer(val2,"#");
 										if(meas.hasMoreTokens() )
											mes=meas.nextToken();
										else
											mes=val2;
										if(meas.hasMoreTokens() )
											displayname=meas.nextToken();
										else
											displayname=val2;
										s_unit=tablesInfo.getUnitForMeasure(testname,mes);
										String strTestname = (testname+":"+mes);
										if(strTestname!=null && strTestname.equalsIgnoreCase("CtxXcXAUserTest:Connection_strength"))
											connectionIndeIndex=totalColumnval;

										if(s_unit != null && !s_unit.equals(""))
											displayname = displayname+"("+s_unit+")";
									}
									st_value=reportInfo.getValue("CITRIX_CHANNEL_RESOURCE",s_var);
									v_val.add(st_value);
									totalColumnval = totalColumnval+1;
								}
							}
							else
							{
								String strCompType = null;
								if(s_server.lastIndexOf(":")>-1)
									strCompType = s_server.substring(s_server.lastIndexOf(":")+1);
								if(s_server.indexOf("All ")>-1)
									strCompType = s_server.substring(s_server.lastIndexOf("All ")+("All ".length()));

								if(strCompType!=null && s_var !=null && !s_var.startsWith(strCompType))
									continue;
								if(s_server.lastIndexOf(":")>-1)
									strCompType = s_server.substring(s_server.lastIndexOf(":")+1);
								if(strCompType!=null && s_var !=null && !s_var.startsWith(strCompType))
									continue;
								StringTokenizer tok2 = new StringTokenizer(s_var,":");
								if(s_var.indexOf(key1)>-1)
								{
									while(tok2.hasMoreTokens())
									{
										tok2.nextToken();
										testname=tok2.nextToken();
										val2=tok2.nextToken();
										StringTokenizer meas=new StringTokenizer(val2,"#");
										if(meas.hasMoreTokens() )
											 mes=meas.nextToken();
										else
											 mes=val2;
										if(meas.hasMoreTokens() )
											displayname=meas.nextToken();
										else
											displayname=val2;
										s_unit=tablesInfo.getUnitForMeasure(testname,mes);
										String strTestname = (testname+":"+mes);
										if(strTestname!=null && strTestname.equalsIgnoreCase("CtxXcXAUserTest:Connection_strength"))
											connectionIndeIndex=totalColumnval;

										if(s_unit != null && !s_unit.equals(""))
											displayname = displayname+"("+s_unit+")";
									}
									st_value=reportInfo.getValue("CITRIX_CHANNEL_RESOURCE",s_var);
									v_val.add(st_value);
								}
							}
							if (st_value.equals(""))
								st_value="Avg";
							StringTokenizer st_val=new StringTokenizer(st_value,",");
							int countTokens=st_val.countTokens();
							if(st_value.indexOf("Avg")>-1 && st_value.indexOf("Pct")>-1 
								&& st_value.indexOf("Max")  >-1 )
							{
								vec1.add(intlmap.getTextDescription("reporter.thin."+displayname)+" ("+st_val.nextToken()+")");
%>
							<th colspan="<%=countTokens%>" align="center"><b><egui:intnl text='<%="reporter.common."+displayname%>' /></b></th>
<%
							}
							else if((st_value.indexOf("Avg")>-1 && st_value.indexOf("Pct")>-1) 
								|| (st_value.indexOf("Avg")>-1 && st_value.indexOf("Max")>-1) 
								|| (st_value.indexOf("Max")>-1 && st_value.indexOf("Pct")>-1) )
							{
								if(!displayname.equals(""))
								{
									vec1.add(intlmap.getTextDescription("reporter.thin."+displayname)+" ("+st_val.nextToken()+")");
%>
							<th colspan="<%=countTokens%>" align="center"><b><egui:intnl text='<%="reporter.common."+ displayname%>' /></b></th>
<%
								}
							}
							else
							{
								if(!displayname.equals(""))
								{
									vec1.add(intlmap.getTextDescription("reporter.thin."+displayname)+" ("+st_val.nextToken()+")");
%>
							<th colspan="<%=countTokens%>"  align="center"><b><egui:intnl text='<%="reporter.common."+displayname%>' /></b></th>
<%
								}
							}
							displayname="";
						}
%>
						</tr>
						<tr>
							<th class="subHeader" align="center"></th>
							<th class="subHeader" align="center"><b><egui:intnl text='<%="reporter.common.Mins"%>' /></b></th>
<%
						int fieldsize=3;
						for(int v=0;v<v_val.size();v++)
						{
							String v_value = (String)v_val.get(v);
							StringTokenizer tokenizer=new StringTokenizer(v_value,",");
							while(tokenizer.hasMoreTokens())
							{
								String str1=tokenizer.nextToken();
%>
							<th class="subHeader" align="center"><b><egui:intnl text='<%="reporter.common."+str1%>' /></b></th>
<%
							}
						}
%>
						</tr>
					</thead>
					<tbody>
<%
						for (int z=0;z<value2.size();z++)
						{
							Vector v_data=(Vector)value2.get(z);
				%>
						<tr>
				<%
							for (int i=0;i<v_data.size();i++)
							{
								String strdata=v_data.get(i).toString();
								if (i==1)
								{
									strdata = (strdata == null || strdata.equals("")|| strdata.equals("-5.0")
									|| strdata.equals("-1.0"))? "-" : erUtils.round(Float.parseFloat(strdata),4);
								}
								else if (i==2)
								{
									strdata = (strdata == null || strdata.equals("")|| strdata.equals("-5.0")
										|| strdata.equals("-1.0"))? "-" : erUtils.round(Float.parseFloat(strdata),4);
								}
								else if(i>2)
								{
									strdata = (strdata == null || strdata.equals("")|| strdata.equals("-5.0")
									|| strdata.equals("-1.0"))? "-" : erUtils.round(Float.parseFloat(strdata),4);
								}
								if(connectionIndeIndex>-1 && (i==(connectionIndeIndex+2)))
								{
									if(!(strdata == null || strdata.equals("-") || strdata.equals("")))
									{
										try{
											double d = Double.parseDouble(strdata);
											d = Math.floor(d);
											strdata = getConnectionQulityString(d);
											}catch(Exception e){}
									}else
										strdata = "-";
								}

								if(strdata.indexOf(":NULL")>-1)
									strdata = strdata.substring(0,strdata.indexOf(":NULL"))+strdata.substring(strdata.indexOf(":NULL")+5);
								lst_dat1.add(strdata);
								if (i==0)
								{
%>
							<td class="tdClass" width="28%" height="30" align="left"><%=strdata%></td>
<%
								}
								else
								{
%>
							<td class="tdClass" width="9%" align="center"><%=strdata%></td>
<%
								}
							}
%>
						</tr>
<%
						}
%>
					</tbody>
				</table>
			</div>
		</div>
<%
					}
				}
			}
			else
			{
%>
		<table align="center" width="100%" cellspacing="0" cellpadding="4"   border="0">
				<tr>
					<!--<td id="er_submit" NOWRAP align="center" width="100%"> <egui:intnl text="reporter.application.No measures available for the current selection"/></td>-->
					<table width='100%' height='100%'><tr>	<td align='center' valign='middle'><img src='/images/Light/nomeasures_custom.png' /></td></tr></table>
				</tr>
		</table>
<%
			}
%>
		<br>
<%
		}
	}
	sen1 = new Hashtable();
	if(lst_dat1!=null && !lst_dat1.isEmpty())
	{
		sen1.put(vec1,lst_dat1);
		ht1=new Hashtable();
		ht1.put(s_tit1,sen1);
		lst.add(ht1);
		sen1 = new Hashtable();
		ht1 = new Hashtable();
		session.setAttribute("ScheduleCSVData",lst);
	}
	else 
	{
		session.setAttribute("ScheduleCSVData",lst);
	}
%>
</form>
<%
	if(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes"))
	{
		%>
		<div class="printFooterText"><%=strPrintFooterText%></div>
		<%}

}
catch(Throwable e)
{
	e.printStackTrace();
}
%>
<%!
	public List getComponentsForUserNotAccessAllComponents(User thisuser)
	{
		ErComponentsUtils compUtils = new ErComponentsUtils(thisuser.getLoginID());
		Vector v_CompTemp = compUtils.getAllUserComponents1();
		List tmpList = new ArrayList(compUtils.getTypeModifyComponents(v_CompTemp,2));
		if(tmpList!=null && tmpList.size()>0)
		{
			List userCompList_host=new LinkedList();
			for(int r=0; r<tmpList.size(); r++)
			{
				String s = (String) tmpList.get(r);
				if(s!=null && !s.endsWith(":NULL"))
				{
					StringTokenizer st=new StringTokenizer(s,":");
					String ctype=st.nextToken();
					String cname=st.nextToken();
					if(ctype!=null && cname!=null && ctype.trim().length()>0 && cname.trim().length()>0)
						userCompList_host.add(ctype+":"+cname+":NULL");
				}
			}
			if(userCompList_host!=null && userCompList_host.size()>0)
				tmpList.addAll(userCompList_host);
		}
		return tmpList;
	}
	public int getColspanCount(ArrayList aListVariable,String subject,String strCompType)
	{
		EgReportInfo egReportInfo = new EgReportInfo("manager");
		EgSpecsInfo specsInfo = new EgSpecsInfo("manager");
		int returnVal=0;
		ArrayList allMeasures = new ArrayList();
		if(aListVariable!=null && aListVariable.size()>0)
		{
			for (int j = 0; j < aListVariable.size(); j++)
			{
				String strMeasureVariable = (String)aListVariable.get(j);
				if(strCompType!=null)
				{
					if(!strMeasureVariable.startsWith(strCompType) && !strMeasureVariable.startsWith("Default"))
					{
						if(strMeasureVariable.indexOf("Total:")>-1)
						{
							StringTokenizer colon_st_temp=new StringTokenizer(strMeasureVariable,":");
							colon_st_temp.nextToken();
							colon_st_temp.nextToken();
							String totalMeasure=colon_st_temp.nextToken();
							if(totalMeasure.indexOf("+")>-1)
								totalMeasure = totalMeasure.substring(0,totalMeasure.indexOf("+"));
							if(allMeasures!=null && !allMeasures.contains(totalMeasure))
								continue;
						}else
							continue;
					}
					else
					{
						StringTokenizer tok1 = new StringTokenizer(strMeasureVariable,":");
						String test="";
						if(tok1.countTokens()>2)
						{
							tok1.nextToken();
							test=tok1.nextToken();
						}
						if (!specsInfo.isTestRelevantForServer(strCompType,test))
						{
							continue;
						}
						if(tok1.hasMoreTokens())
						{
							String strMeasure = tok1.nextToken();
							if(strMeasure!=null && strMeasure.indexOf("#")>-1)
								allMeasures.add(strMeasure.substring(0,strMeasure.indexOf("#")));
						}
					}
				}
				String strValue=egReportInfo.getValue(subject,strMeasureVariable);
				if(strValue==null || strValue.equals(""))
					strValue = egReportInfo.getValue("SERVICES_REPORT",strMeasureVariable);
				if(strValue!=null && !strValue.equals(""))
				{
					StringTokenizer strToken = new StringTokenizer(strValue,",");
					returnVal+=strToken.countTokens();
				}
			}
		}
		return returnVal;
	}
	public String getEncodedQueryString(String queryString)
	{
		String qString ="";
		try{
		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_timeline"))
				{
					value=com.eg.EgURLEncoder.encode(value, "UTF-8");
				}
				else if(reqparam!=null&&reqparam.equals("er_trgt"))
				{
					value=com.eg.EgURLEncoder.encode(value, "UTF-8");
				}
				else if(reqparam!=null&&reqparam.equals("er_trgttype"))
				{
					value=com.eg.EgURLEncoder.encode(value, "UTF-8");
				}
				else if(reqparam!=null&&reqparam.equals("er_time"))
				{
					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_priority"))
				{
					value=com.eg.EgURLEncoder.encode(value, "UTF-8");
				}
				else if(reqparam!=null&&reqparam.equals("er_uptimetest"))
				{
					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("inidate"))
				{
					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("startdate"))
				{
					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_rtype"))
				{
					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("er_component"))
				{
					value=com.eg.EgURLEncoder.encode(value, "UTF-8");
				}else if(reqparam!=null&&reqparam.equals("subevent"))
				{
					value=com.eg.EgURLEncoder.encode(value, "UTF-8");
				}
				else if(reqparam!=null&&reqparam.equals("compNameList"))
				{
					value=com.eg.EgURLEncoder.encode(value, "UTF-8");
				}
				else if(reqparam!=null&&reqparam.equals("vw"))
				{
					value=com.eg.EgURLEncoder.encode(value, "UTF-8");
				}
				else if(reqparam!=null&&reqparam.equals("insubzone"))
				{
					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_template"))
				{
					value=com.eg.EgURLEncoder.encode(value, "UTF-8");
				}
				else if(reqparam!=null&&reqparam.equals("er_userid") || reqparam.equals("eruserid") || reqparam.equals("userID") || reqparam.equals("uid") ||reqparam.equals("er_RmDispName") )
				{
					value=com.eg.EgURLEncoder.encode(value, "UTF-8");					
				}
				if(reqparam!=null&&(reqparam.equals("er_sthr") || reqparam.equals("chartformat") || reqparam.equals("st_date") || reqparam.equals("Minto") || reqparam.equals("stmin") || reqparam.equals("er_startmin") || reqparam.equals("throughSchedule") || reqparam.equals("scheduleType") || reqparam.equals("er_views") || reqparam.equals("endate") || reqparam.equals("enmin") || reqparam.equals("er_endhr")))
				{
					continue;
				}
				qString += reqparam+"="+value.trim()+"&";
			}
		}
		}catch(Exception e)
		{
			e.printStackTrace();
		}
		return qString;
	}

%>
	</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;
    }
    //

%>
<%!
	public String getConnectionQulityString(double dd)
	{
		String strReturn ="";
		if(dd>0 && dd==1.0)
			strReturn = "Poor connection";
		else if(dd>0 && dd==2.0)
			strReturn = "Weak connection";
		else if(dd>0 && dd==3.0)
			strReturn = "Strong connection";
		else
			strReturn = "None";
		return strReturn;

	}

%>