<%
/**
File Name :ErCitrixConnectionDetailPrint.jsp
Purpose   :To print the citrix data
*/
%>
<!DOCTYPE html>

<%@ include file = "ErTracker.jsp" %>
<%@ include file="ErRemoveUser.jsp"%>
<%@ page import="com.eg.EgConfigInfo"%>
<%@ page import="com.eg.EgDbInfo"%>
<%@ page import="com.eg.EgMappingInfo"%>
<%@ page import="com.eg.EgReportInfo"%>
<%@ page import="com.egurkha.util.DateUtil"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.List"%>
<%@ page import=" java.util.regex.Matcher"%>
<%@ page import=" java.util.regex.Pattern"%>
<%@ page import="com.egurkha.util.StringUtils"%>
<%@ page import="egurkha.reporter.ErCitrixConnectionDetailBean"%>
<%@ page import="egurkha.reporter.ErUtils"%>
<%@ page import="net.sf.json.JSONArray"%>

<%@ taglib prefix="egui" uri="../WEB-INF/eg-taglib.tld"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%
	String pdfPrint = request.getParameter("pdfPrint");
	String fontStyleDblSingl = "";
	ErUtils erUtils = new ErUtils();

	EgDbInfo dbInfo = new EgDbInfo("manager");
	com.egurkha.ini.IniUI ui = (com.egurkha.ini.IniUI) com.egurkha.ini.IniUI.getInstance();
	EgReportInfo reportInfo = new EgReportInfo("manager");

	if ((dbInfo.doubleByteEnabled || !thisuser.getLanguage().equals("en_US"))&& !(pdfPrint != null && pdfPrint.equalsIgnoreCase("yes")))
	{
		fontStyleDblSingl = "multi_font";
	}
	else
	{
		fontStyleDblSingl = "";
	}
	String strManagerURL = request.getScheme()+"://"+request.getServerName()+":"+ request.getServerPort();
	String controllerURL = strManagerURL+"/final/servlet/com.eg.ErCitrixConnectionDetailReportC;jsessionid=" + session.getId() + "?";
	EgMappingInfo intlmp = new EgMappingInfo(thisuser.getLanguage());
	Map allData =  null;
	Map selectParams =  (Map)session.getAttribute("selectionDetail");
	String reportBy = (String)selectParams.get("reportBy");
	String reportBySubType = (String)selectParams.get("reportBySubType");
	String startDate = (String)selectParams.get("startdate");
	String endDate = (String)selectParams.get("enddate");
	String starthr = (String)selectParams.get("starthr");
	String endhr = (String)selectParams.get("endhr");
	String startmin = (String)selectParams.get("startmin");
	String endmin = (String)selectParams.get("endmin");
	String weekends = (String)selectParams.get("weekends");
	String timeFrom = (String)selectParams.get("timeFrom");
	String timeTo   = (String)selectParams.get("toTime");
	String[] component   = (String[])selectParams.get("components");
	String currentDateFormat = strUserDateFormat;
	if("00:00:00".equals(timeFrom))
	{
		timeFrom  = timeFrom.substring(0,timeFrom.lastIndexOf(":"));
		timeTo    = timeTo.substring(0,timeTo.lastIndexOf(":"));
	}
	allData = (Map)session.getAttribute("allData");
	String strReportFor=null;
	boolean isDetailLineEnable=false;
	boolean isDetailTableEnable=false;
	if(allData.get("strReportFor") != null)
		strReportFor =(String)allData.get("strReportFor"); //..
	if(allData.get("isDetailLineEnable") != null)
	{
		isDetailLineEnable=(Boolean)allData.get("isDetailLineEnable");
	}
	if(allData.get("isDetailTableEnable") != null)
	{
		isDetailTableEnable=(Boolean)allData.get("isDetailTableEnable");
	}
	String er_RmDispName = reportInfo.getValue("CITRIX_CONNECTION_DETAIL","reportTitle");
	if(strReportFor != null && strReportFor.equalsIgnoreCase("ConnectionFailers"))
	{
		er_RmDispName= reportInfo.getValue("CITRIX_CONNECTION_DETAIL","Connection_Fail");
	}
	else if(strReportFor != null && strReportFor.equalsIgnoreCase("MachineFailers"))
	{
		er_RmDispName= reportInfo.getValue("CITRIX_CONNECTION_DETAIL","Machine_Fail");
	}
	String fileName=er_RmDispName;
	HashMap paramVal =new HashMap();
	paramVal.put("fileName",fileName);
	session.setAttribute("parameters", paramVal);
	String dispStart = startDate + " " + starthr  + ":" + startmin  ;
	String dispEnd   = endDate + " " + endhr + ":" + endmin ;
	ErCitrixConnectionDetailBean bean = new ErCitrixConnectionDetailBean();
	String strthroughSchedule = request.getParameter("throughSchedule");
	String uid = request.getParameter("uid");
	String stimefmt = bean.getDateStrInUserFormat(dispStart ,thisuser);
	String etimefmt =  bean.getDateStrInUserFormat(dispEnd ,thisuser);
	
	HashMap connection =(HashMap)allData.get("connection"); 
	HashMap desktopOS =(HashMap)allData.get("desktopOS"); 
	HashMap overviewPieChartData =(HashMap)allData.get("overviewPieChartData"); 
	TreeMap userconnectionFailure =(TreeMap)allData.get("userconnectionFailure");
	TreeMap serverOSBar = (TreeMap)allData.get("serverOSBar");
	TreeMap desktopOSBar = (TreeMap)allData.get("desktopOSBar");
	Map connectionDetailsMap =(Map)allData.get("connectionDetailsMap");
	Map serverDetailsMap =(Map)allData.get("serverDetailsMap");
	Map desktopDetailsMap =(Map)allData.get("desktopDetailsMap");
	String[] colunmArray = (String[])allData.get("colunmArray");
	Boolean isDataFoundCon = (Boolean)overviewPieChartData.get("isDataFoundCon");
	Boolean isDataFoundServer = (Boolean)overviewPieChartData.get("isDataFoundServer");
	Boolean isDataFoundDesktop = (Boolean)overviewPieChartData.get("isDataFoundDesktop");
%>
<!Doctype html>
<head>
<%
	if (pdfPrint != null && pdfPrint.equalsIgnoreCase("yes"))
	{
%>
<title>&nbsp; <egui:intnl text="reporter.common.Reporter" />
	&nbsp; &nbsp; <egui:intnl text="reporter.common.Print" /> &nbsp;
</title>
<%
	} else {
%>
<title>&nbsp; <egui:intnl text="reporter.common.Reporter" />
	&nbsp; &nbsp;
</title>
<%
	}
%>

<meta http-equiv="refresh">
<link rel="stylesheet" type="text/css" href="../../final/styles/eGLightThemeIcons.css" />
<link rel="stylesheet" type="text/css" href="../../final/reporter/styles/printpagestyle.css" />
<style>

@media print {body {-webkit-print-color-adjust: exact;}}
</style>
</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-top:10px"><img src="<%=imageName%>" border="0" /></div>
<%
	}
	else
	{
%>
		<div class="<%=strLogCls%>"><img src="<%=imageName%>" border="0" /></div>
<%
	}
%>
	<div class="printHeaderBox">
	<%
	if (!StringUtils.isNull(er_RmDispName))
	{
		%>
		<div class="printHeaderBoxTitle"><%= er_RmDispName %></div>
		<%
	}
	else
	{
		%>
		<div class="printHeaderBoxTitle"><egui:intnl text="reporter.common.User Logon Summary(Secs) " /></div>
		<%
	}
	if(pdfPrint !=null && pdfPrint.equalsIgnoreCase("yes"))
	{
	%>
		<div class="printHeaderBoxPrintIcon"><img class="iconPrinter mouse"  id="pri ntbt" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" border="0" onClick="javascript:window.print()" alt='<egui:intnl text="reporter.common.PRINT"/>' title='<egui:intnl text="reporter.common.PRINT"/>'/></div>
	<%
	}
	%>
	</div>
	<div class="printOuterBoxNoBorder"> 
	<%
	if(reportBy != null)
	{
		%>
		<div class="printSelectionFields"><egui:intnl text="reporter.common.Analyzed by"/>:<span class="bold"><%=reportBy%></span></div>
		<%
	}
	if (!"Component".equals(reportBy))
	{
		%>
		<div class="printSelectionFields"><%=reportBy%>:<span class="bold"><%=reportBySubType%></span></div>
		<%
	}
	if(weekends != null)
	{
		%>
		<div class="printSelectionFields"><egui:intnl text="reporter.common.Exclude Weekends"/>:<span class="bold"><%=weekends%></span></div>
		<%
	}
	if(timeFrom != null)
	{
		%>
		<div class="printSelectionFields"><egui:intnl text="reporter.common.Time Period"/>: <span class="bold"><%=timeFrom%>&nbsp;   <egui:intnl text="reporter.common.to "/>&nbsp; <%=timeTo%></span></div>
		<%
	}
	%>
		<div class="printSelectionFields">Timeline - <span class="bold"><%=stimefmt%> to <%=etimefmt%></span></div>
	</div>
<%
String urlValue=null;
String   infoVal = null;
int[] dataCon = null;
String infoVal1  ="";
Map tmAllData=null;
Set keySet=null;
Iterator ksItr=null;
if(strReportFor != null && strReportFor.equalsIgnoreCase("ConnectionFailers"))
{
	// urlValue =controllerURL+"&er_width=600&er_height=400&er_view=print&&cType=line&uid="+uid+"&throughSchedule="+strthroughSchedule+"&inidate="+currentDateFormat;
	 urlValue =controllerURL+"&er_view=print&&cType=line&uid="+uid+"&throughSchedule="+strthroughSchedule+"&inidate="+erUtils.specialCharEncode(currentDateFormat);
	tmAllData = new LinkedHashMap(connection);
	keySet        = tmAllData.keySet();
	ksItr    = keySet.iterator();
	%>
		<div class="clearDiv"></div>
		<%
		if(isDataFoundCon.booleanValue())
		{
		%>
		<table width="100%"  border="0">
			<tr>
				<td width="40%" style="padding:0px 10px 10px 0px">
					<div class="printOuterBox">
						<div class="printOuterBoxHeader">Total User Connection Failures</div>
						<div style="width:100%;overflow:auto;padding:10px">
							<table align="center">
								<tr>
									<td><div class="iconFailedSimulations"></div></td>
									<td align="center" style="padding-left:5px" class="newFont_bold28"><%=overviewPieChartData.get("totalValConnection")%></td>
								</tr>
								<tr>
									<td class="newFont_bold13" style="" align="center" colspan="2">Number</td>
								</tr>
							</table>
						</div>
					</div>
				</td>
				<td width="60%" style="padding:0px 0px 10px 0px" rowspan="2">
					<div class="printOuterBox" width="100%">
						<div class="printOuterBoxHeader">User Connection Failures Trend</div>
							<div style="width:100%;overflow:auto;padding:10px">
<%
								if(isDataFoundCon.booleanValue())
								{
%>
									<img src="<%=urlValue+"&er_width=500&er_height=410&chartFor=con"%>">
<%
								}
								else
								{
									out.println("No failures occurred ");
								}
%>
							</div>
					</div>
				</td>
			</tr>
			<tr>
				<td width="40%" style="padding:0px 10px 10px 0px">
					<div class="printOuterBox">
						<div class="printOuterBoxHeader">Types of User Connection Failures</div>
						<div style="width:100%;overflow:auto;padding:10px">
<%
							if(isDataFoundCon.booleanValue())
							{
								String displayName  ="Client connection failures,Configuration errors,Machine failures,Unavailable capacity,Unavailable licenses";
								String NamesArr="conClientConnFailures,conConfigErrors,conMachineFailures,conUnavailCapacity,conUnavailLicenses";
								String displayColor ="#1fc1b7 ,#f57e7e ,#AFBD0B ,#BD0B9A ,#230BBD";
								List displayNameList=ErUtils.egTokenizer(displayName, ",");
								List displayColorList=ErUtils.egTokenizer(displayColor, ",");
								List NamesArrList=ErUtils.egTokenizer(NamesArr, ",");
%>
								<table width="100%"><tr><td>
								<!--<img src="<%=controllerURL+"&inidate="+currentDateFormat+"&uid="+uid+"&throughSchedule="+strthroughSchedule%>&er_width=200&er_height=160&er_view=print&chartFor=con">-->
								<img src="<%=controllerURL+"&inidate="+erUtils.specialCharEncode(currentDateFormat)+"&uid="+uid+"&throughSchedule="+strthroughSchedule%>&er_width=300&er_height=200&er_view=print&chartFor=con">
								</td></tr>
								<tr>
								<td><div><table>
								<tr>
<%
								for(int l=0;l<displayNameList.size();l++)
								{
									String value=(String)overviewPieChartData.get(NamesArrList.get(l));
									if(!"0".equals(value))
									{
										if(l%2==0)
										{
											%>
											</tr>
											<tr>
											<%
										}
	%>
										<td>
										<svg height="10" width="10">
										  <circle cx="5" cy="5" r="4" fill="<%=displayColorList.get(l)%>" />
										</svg>
										<!--<div style="background-color:<%=displayColorList.get(l)%>;">&nbsp;</div>-->
										</td>
										<td style="padding:2px 2px 2px 5px;float:left" class="pieLegendFont"><div id="customLeg'+legIndex+'" style="cursor:pointer"><%=displayNameList.get(l)%></div></td>
									
<%
									}
								}
%>
								</tr>
								</table></div>
								</td>
								</tr></table>
<%
							}
							else
							{
								out.println("No failures occurred");
							}
%>
						</div>
					</div>
				</td>
			</tr>
		</table>
		<%
		}
		else
		{
			%>
			<div class="printOuterBox">
				<div class="printOuterBoxHeader">Total User Connection Failures</div>
				<div style="width:100%;overflow:auto;padding:10px">
				<%
					out.println("<table width='100%' height='100%'><tbody><tr><td align='center' valign='middle' class='font_normal12'><div class='iconNoalarms32'></div>No failures occurred</td></tr></tbody></table>");
				%>
				</div>
			</div>
			<%
		}
		%>
		<div class="clearDiv">&nbsp;</div>
		<div class="printOuterBox">
			<div class="printOuterBoxHeader" >Types of User Connection Failures by Delivery Group</div>
			<%
			if(isDataFoundCon.booleanValue())
			{
	%>
			<div class="newTable">
				<%
				out.println("<table  align='center'  width='100%' cellpadding='0' cellspacing='0'>");
				out.println("<thead>");
				out.println("<tr>");
				out.println("<th width='20%' align='left'>Delivery Group Name</th>");
				if(component!=null)
				{
					if(component.length>1 && !component[0].equalsIgnoreCase("All"))
					{
						out.println("<th align='left'>Directory</th>");
					}
				}
				out.println("<th style='text-align:center;'>Client connection failures</th>");
				out.println("<th style='text-align:center;'>Configuration errors</th>");
				out.println("<th style='text-align:center;'>Machine failures</th>");
				out.println("<th style='text-align:center;'>Unavailble capacity</th>");
				out.println("<th style='text-align:center;'>Unavailble licenses</th>");
				out.println("</tr>");
				out.println("</thead>");
				out.println("<tbody>");
                                             
				while (ksItr.hasNext())
				{
					infoVal = (String)ksItr.next();
					infoVal1 = infoVal;
					dataCon = (int[])connection.get(infoVal);
					String infoDirectory[] = infoVal.split("@#");
					infoVal=infoDirectory[0];
					infoVal=infoVal.substring(infoVal.indexOf(":")+1,infoVal.length());
					List detailData =null;
					if(!infoVal.endsWith("All"))
					{
						detailData=(List)connectionDetailsMap.get(infoVal1);
	%>
						<tr>
							<td><%=infoVal%></td>
	<%
							if(component!=null)
							{
								if(component.length>1 && !component[0].equalsIgnoreCase("All"))
								{
	%>
									<td><%=infoDirectory[1]%></td>
	<%
								}
							}
	%>
							<td style="text-align:center;"><%=this.getNumberFormat(dataCon[0])%></td>
							<td style="text-align:center;"><%=this.getNumberFormat(dataCon[1])%></td>
							<td style="text-align:center;"><%=this.getNumberFormat(dataCon[2])%></td>
							<td style="text-align:center;"><%=this.getNumberFormat(dataCon[3])%></td>
							<td style="text-align:center;"><%=this.getNumberFormat(dataCon[4])%></td>
						</tr>
	<%
					}
					if(detailData!=null)
					{
						int size = detailData.size();
						out.println("<tr><td colspan='6' style='padding:10px'><table border='0'  width='100%' cellpadding='0' cellspacing='0'>");
						StringTokenizer colTokens = new StringTokenizer(colunmArray[0],",");
						out.println("<thead>");
						out.println("<tr>");
						while(colTokens.hasMoreTokens())
						{
							out.println("<th align='left' >"+intlmp.getMeasureDescription("CTXXCXDFCONNTEST_DDD",colTokens.nextToken())+"</th>");
						}
						out.println("</tr>");
						out.println("</thead>");
						out.println("<tbody>");
						String dataVal [] = null;
						for(int i=0;i<size;i++)
						{
							out.println("<tr>");
							dataVal = (String[])detailData.get(i);
							if(dataVal!=null && dataVal.length>0)
							{
								int colCount = dataVal.length;
								for(int kk=0;kk<colCount;kk++)
									out.println("<td  class=\"tdClass\">"+dataVal[kk]+"</td>");
							}
							out.println("</tr>");
						}
						out.println("</tbody>");
						out.println("</table></td></tr>");
					}
				}
				out.println("</tbody>");
				out.println("</table>");
%>
			</div>
			<%
			}
			else
			{
				out.println("<table width='100%' height='100%'><tbody><tr><td align='center' valign='middle' class='font_normal12'><div class='iconNoalarms32'></div>No failures occurred</td></tr></tbody></table>");
			}
			%>
		</div>
	<%
}

urlValue =controllerURL+"&er_view=print&&cType=line&uid="+uid+"&throughSchedule="+strthroughSchedule+"&inidate="+erUtils.specialCharEncode(currentDateFormat);
if(strReportFor != null && strReportFor.equalsIgnoreCase("MachineFailers"))
{	 
%>
<div class="clearDiv"></div>
<table width="100%">
	<tr>
		<%
		if(isDataFoundServer.booleanValue())
		{
	%>
		<td width="50%" style="padding:0px 10px 0px 0px">
		<div class="printOuterBox">
			<div class="printOuterBoxHeader">Server OS Failures By Type</div>
				<div style="width:100%;overflow:auto;padding:10px">
					<img src="<%=controllerURL+"&inidate="+erUtils.specialCharEncode(currentDateFormat)+"&uid="+uid+"&throughSchedule="+strthroughSchedule%>&er_width=400&er_height=230&er_view=print&chartFor=servers&noNeedLegend=true">
				</div>
		</div>
		</td>
	<%
		}
		else
		{
	%>
			<td width="50%" style="padding:0px 10px 0px 0px">
				<div class="printOuterBox" style="height:310px;">
				<div class="printOuterBoxHeader">Server OS Failures By Type</div>
					<div style="width:100%;overflow:auto;padding:10px;height:100%;">
	<%
						out.println("<table width='100%' height='100%'><tbody><tr><td align='center' valign='middle' class='font_normal12'><div class='iconNoalarms32'></div>No failures occurred</td></tr></tbody></table>");
	%>
					</div>
				</div>
			</td>
	<%
		}
	if(isDataFoundDesktop.booleanValue())
	{
		%>
		<td width="50%" style="padding:0px 0px 0px 0px">
			<div class="printOuterBox">
			<div class="printOuterBoxHeader">Desktop OS Failures By Type</div>
				<div style="width:100%;overflow:auto;padding:10px">
					<img src="<%=controllerURL+"&inidate="+erUtils.specialCharEncode(currentDateFormat)+"&uid="+uid+"&throughSchedule="+strthroughSchedule%>&er_width=400&er_height=230&er_view=print&chartFor=desktop&noNeedLegend=true">
				</div>
			</div>
		</td>
			<%
	}
	else
	{
		%>
		<td width="50%" style="padding:0px 0px 0px 0px">
		<div class="printOuterBox" style="height:310px;">
		<div class="printOuterBoxHeader">Desktop OS Failures By Type</div>
			<div style="width:100%;overflow:auto;padding:10px;height:100%;">
		<%
			out.println("<table width='100%' height='100%'><tbody><tr><td align='center' valign='middle' class='font_normal12'><div class='iconNoalarms32'></div>No failures occurred</td></tr></tbody></table>");
		%>
			</div>
		</div>
		</td>
		<%
	}
	%>	
	</tr>    
</table>

<div class="clearDiv"></div>
<table width="100%" >
	<tr>
	<%
	if(isDataFoundServer.booleanValue())
	{
	%>
		<td width="50%" style="padding:0px 10px 0px 0px">
			<div class="printOuterBox">
				<div class="printOuterBoxHeader">Server OS Failures By Delivery Group</div>
				<div style="width:100%;overflow:auto;padding:10px">
					<img src="<%=urlValue+"&er_width=400&er_height=310&chartFor=servers&type=stacked&changeHeight=true"%>" >
				</div>
			</div>
		</td>
	<%
	}					
	else
	{
	%>
		<td width="50%" style="padding:0px 10px 0px 0px">
			<div class="printOuterBox" style="height:310px;">
			<div class="printOuterBoxHeader">Server OS Failures By Delivery Group</div>
				<div style="width:100%;overflow:auto;padding:10px;height:100%;">
	<%
					out.println("<table width='100%' height='100%'><tbody><tr><td align='center' valign='middle' class='font_normal12'><div class='iconNoalarms32'></div>No failures occurred</td></tr></tbody></table>");
	%>
				</div>
			</div>
		</td>
	<%
	}
	if(isDataFoundDesktop.booleanValue())
	{%>
		<td width="50%" style="padding:0px 0px 0px 0px">
			<div class="printOuterBox">
			<div class="printOuterBoxHeader">Desktop OS Failures By Delivery Group</div>
				<div style="width:100%;overflow:auto;padding:10px">
					<img src="<%=urlValue+"&er_width=400&er_height=310&chartFor=desktop&type=stacked&changeHeight=true"%>">
				</div>
			</div>
		</td>
	<%
	}
	else
	{
	%>
			<td width="50%" style="padding:0px 0px 0px 0px">
			<div class="printOuterBox" style="height:310px;">
				<div class="printOuterBoxHeader">Desktop OS Failures By Delivery Group</div>
				<div style="width:100%;overflow:auto;padding:10px;height:100%;">
	<%
					out.println("<table width='100%' height='100%'><tbody><tr><td align='center' valign='middle' class='font_normal12'><div class='iconNoalarms32'></div>No failures occurred</td></tr></tbody></table>");
	%>
				</div>
			</div>
			</td>
	<%
	}
	%>
	</tr>
</table>

<div class="clearDiv"></div>
<table width="100%" >
	<tr>
	<%
	if(isDataFoundServer.booleanValue())
	{
	%>
		<td width="50%" style="padding:0px 10px 0px 0px">
			<div class="printOuterBox">
				<div class="printOuterBoxHeader">Server OS Failures Trend</div>
				<div style="width:100%;overflow:auto;padding:10px">
				<img src="<%=urlValue+"&er_width=400&er_height=310&chartFor=servers&type=rawLine"%>" >
				</div>
			</div>
		</td>
	<%
	}					
	else
	{
	%>
			<td width="50%" style="padding:0px 10px 0px 0px">
				<div class="printOuterBox" style="height:310px;">
				<div class="printOuterBoxHeader">Server OS Failures Trend</div>
					<div style="width:100%;overflow:auto;padding:10px;height:100%;">
	<%
					out.println("<table width='100%' height='100%'><tbody><tr><td align='center' valign='middle' class='font_normal12'><div class='iconNoalarms32'></div>No failures occurred</td></tr></tbody></table>");
	%>
					</div>
				</div>
			</td>
	<%
	}
	if(isDataFoundDesktop.booleanValue())
	{%>
		<td width="50%" style="padding:0px 0px 0px 0px">
			<div class="printOuterBox">
				<div class="printOuterBoxHeader">Desktop OS Failures Trend</div>
				<div style="width:100%;overflow:auto;padding:10px">
					<img src="<%=urlValue+"&er_width=400&er_height=310&chartFor=desktop&type=rawLine"%>">
				</div>
			</div>
		</td>
				<%
	}
	else
	{
	%>
			<td width="50%" style="padding:0px 0px 0px 0px">
				<div class="printOuterBox" style="height:100%">
					<div class="printOuterBoxHeader">Desktop OS Failures Trend</div>
					<div style="width:100%;overflow:auto;padding:10px;height:100%;">
	<%
						out.println("<table width='100%' height='100%'><tbody><tr><td align='center' valign='middle' class='font_normal12'><div class='iconNoalarms32'></div>No failures occurred</td></tr></tbody></table>");
	%>
					</div>
				</div>
			</td>
	<%
	}
	%>
	</tr>
</table>

<%
}
if(strReportFor != null && strReportFor.equalsIgnoreCase("MachineFailersDetail"))
{
	JSONArray headingArry=(JSONArray)allData.get("heading");
	JSONArray headingSelCol=(JSONArray)allData.get("headingSelCol");
	Map desktopDetailsMapNew=(Map)allData.get("desktopDetailsMapNew");
	Iterator itrServer=desktopDetailsMapNew.keySet().iterator();
	JSONArray subDataArry=null;
	JSONArray dataArrNew=new JSONArray();
	while(itrServer.hasNext())
	{	
		String info=(String)itrServer.next();
		List eachInfoList=(List)desktopDetailsMapNew.get(info);
		for(int e=0;e<eachInfoList.size();e++)
		{
			subDataArry=new JSONArray();
			String[] infoArry=(String[])eachInfoList.get(e);
			for(int s=0;s<infoArry.length;s++)
			{
				subDataArry.add(infoArry[s]);
			}
			dataArrNew.add(subDataArry);
		}
	}	
	%>
	<div class="clearDiv"></div>
	<table width="100%" >
		<%
		if(isDetailLineEnable)
		{
			%>
			<tr>
				<td width="100%" style="padding:0px 0px 0px 0px">
					<div class="printOuterBox">
						<div class="printOuterBoxHeader">Server OS Machine Failures Trend</div>
							<div style="width:100%;overflow:auto;padding:10px">
								<img src="<%=urlValue+"&er_width=880&er_height=310&chartFor=detail&type=rawLine"%>">
							</div>
					</div>
				</td>
			</tr>
			<%
		}
		else
		{
			%>
			<tr>
				<td width="100%" style="padding:0px 0px 0px 0px">
					<div class="printOuterBox">
						<div class="printOuterBoxHeader">Server OS Machine Failures Trend</div>
							<div style="width:100%;overflow:auto;padding:10px">
							<%
								out.println("<table width='100%' height='100%'><tbody><tr><td align='center' valign='middle' class='font_normal12'><div class='iconNoalarms32'></div>No failures occurred </td></tr></tbody></table>");
							%>
							</div>
					</div>
				</td>
			</tr>
			<%
		}
		%>
	</table>
	<div class="clearDiv">&nbsp;</div>
	<div class="printOuterBox">
		<div class="printOuterBoxHeader" >Desktop OS Machine Failure Details</div>
		<%
		if(isDetailTableEnable)
		{
			JSONArray selCoPosArry=new JSONArray();
			if(headingSelCol != null && headingSelCol.size() > 0)
			{
				for(int j=0;j<headingSelCol.size();j++)
				{
					String eachCol=(String)headingSelCol.get(j);
					String pos=eachCol.substring(0,eachCol.indexOf("|"));
					selCoPosArry.add(pos);
				}
			}
			else
			{
				for(int j=0;j<headingArry.size();j++)
				{
					String eachCol=(String)headingArry.get(j);
					String pos=eachCol.substring(0,eachCol.indexOf("|"));
					selCoPosArry.add(pos);
				}
			}
		%>
		<div class="newTable">
			<table align="center" width="100%" cellpadding="0" cellspacing="0" >
				<thead>
					<tr>
						<%
						for(int j=0;j<headingArry.size();j++)
						{
							String eachHeader=(String)headingArry.get(j);
							if(eachHeader != null && eachHeader.indexOf("$") != -1)
							{
								eachHeader=eachHeader.substring(0,eachHeader.indexOf("$"));								
							}
							if(eachHeader.indexOf("|") != -1)
								eachHeader=eachHeader.substring(eachHeader.indexOf("|")+1);
							if(selCoPosArry.contains(j+""))
							{
								%>
								<th><%=eachHeader%></th>
								<%
							}
						}
						%>
					</tr>
				</thead>
				<tbody>
					<%
					for(int d=0;d<dataArrNew.size();d++)
					{
						JSONArray eachRow=(JSONArray)dataArrNew.get(d);
						%>
						<tr>
						<%
						for(int e=0;e<eachRow.size();e++)
						{
							if(selCoPosArry.contains(e+""))
							{
								String eachData=(String)eachRow.get(e);
								%>
									<td><%=eachData%></td>
								<%
							}
						}
						%>
						</tr>
						<%
					}
					%>
				</tbody>
			</table>
		</div>
		<%
		}
		else
		{
			%>
				<div style="width:100%;overflow:auto;padding:10px">
				<%
					out.println("<table width='100%' height='100%'><tbody><tr><td align='center' valign='middle' class='font_normal12'><div class='iconNoalarms32'></div>No failures occurred</td></tr></tbody></table>");
				%>
				</div>
			<%
		}
		%>
	</div>
	<%
}

%>
<%!
	public String getNumberFormat(Object value)
	{
		if(value!=null)
		{
			String valueStr = value.toString();
			String pattern = "(^[\"]?\\d+[\"]?$)|(^[\"]?\\d+(\\.\\d*)[\"]?$)";
			Pattern r = Pattern.compile(pattern);
			Matcher m = r.matcher(valueStr);
			boolean isNumber = false;
			if (m.find()) {
				isNumber = true;
			}
			if (isNumber) 
			{
				if(valueStr.indexOf(".")>-1)
				{
					String strDecimal = valueStr.substring(valueStr.indexOf("."));
					String str = valueStr.substring(0,valueStr.indexOf("."));
					valueStr="<span class='decimal-align'>"+str+"</span><span class='decimal-align2'>"+strDecimal+"</span>";
				}
				else
				{
					valueStr="<span class='decimal-align'>"+valueStr+"</span>";
				}
			}
			return valueStr;
		}
		return value.toString();
	}
%>
</div>
<%
	if(pdfPrint!=null && pdfPrint.equalsIgnoreCase("yes"))
	{
%>
		<div class="printFooterText"><%=strPrintFooterText%></div>
<%
	}
%>
</body>
</html>