<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="org.apache.commons.lang.math.NumberUtils"%>
<%@page import="java.util.*"%>
<%@page import="sapphire.inventoryandfaultreports.*,sapphire.reports.*,com.sapphireims.web.i18n.SapphireI18nUtil"%>
<%@page import="org.xnap.commons.i18n.I18n"%>
<%@ page import="com.sapphireims.service.IConfigSettingService" %>
<%@ page import="com.sapphireims.service.impl.SpringContextUtil" %>
<%@ page import="com.sapphireims.web.filter.SapphireFilterUtil" %>
<%@ include file="SapphireStdIncludes.jsp" %>
<jsp:include page="sd_sessionTimeout.jsp" />
<jsp:include page="clearCache.jsp" />
<%@ include file="AJAXPopup.jsp" %>
<html>
    <head>
        <jsp:include page="SapphireStdCSS.jsp"/><jsp:include page="reportsConfigurationJS.jsp"/><jsp:include page="SapphireStdJs.jsp" />
    </head>
    <%  Connection conn = null;Statement stmt = null,stmt2 = null;ResultSet rs = null,rs2 = null;
        PreparedStatement pstmt = null;
        String telantName=(String) session.getAttribute("TELANTNAME");
        IConfigSettingService configSettingService = (IConfigSettingService) SpringContextUtil.getBeanByName("configSettingService",Sapphire.applicationScope);
		I18n i18n = SapphireI18nUtil.getI18nInstance((String) session.getAttribute("LANGUAGE_UNICODE"));
        try {
            boolean virtualSiteOnly = false;
            conn = new connection().getConnection(telantName);
            stmt = conn.createStatement();
            stmt2 = conn.createStatement();
            SapphireConfigsettings sappConfigSetting=new SapphireConfigsettings();
            String assetDisplayType = configSettingService.findBySettingKey("CMDB_ASSETTYPES_DISPLAY");
            int osDeployement = NumberUtils.toInt(configSettingService.findBySettingKey("SHOW_OSD_FEATURE_UI"));
            ArrayList combinedKeyValue = new ArrayList();
            Sapphire sappObj = new Sapphire();
            reportsDAO reportsObj=new reportsDAO();
            String mysqlTimezone=(String)session.getAttribute("MYSQL_USER_TIMEZONE");
            String key = "",value = "",pageType = "Save",pageType_view = i18n.tr("Save"),reportName = "",reportDesc = "",inventoryBlockDisplay = "none",assetBlockDisplay = "none",assetSummaryBlockDisplay = "none",assetcommonblock = "none",assetchartDisplay = "none",assetInvCustomDivDisplay = "none";
            String CompCustomDivDisplay = "none",ChangeLogDivDisplay = "none",str_TimePeriod = "",srt_query = "",reportTemplate = "GENERIC_ASSET",nodeBlockDisplay = "none",siteDisplay = "none",siteSelected = "selected",AntiVirusBlock = "none",hostsDisabled = "",reportTypeDisable = "", displaySummaryValue="none";
            String ChangeLogreportTypeDisable = "",chartType = "",displayType = "",AnalyticalBlockDisplay = "none",automationcommonblock = "block",CustomBlockDisplay = "none",tabName = i18n.tr("Asset and Inventory Reports"),formAction = "reportsOperations";
            int reportType = 0,complReportType = 1,ChangeLogReportType = 0;
            Set set = null;
            Iterator itr = null;
            ArrayList selectedHosts = new ArrayList();
            ArrayList filterData = new ArrayList();
            HashMap selectedFields = new HashMap();
            Map assetFixedFields = null,assetCustomFields = null,assetLyfeCycleFields = null,allocateToUserFields = null; 
            String PatchSummaryReportDisplay = "none",patchAnalyticalchartDisplay = "none",patchLevel = "",patchReportType = "",displayOfpatchLevel = "none",displayOfLinuxpatchLevel = "none",displayOfpatchReportType = "none",displayOfpatchSystemType = "none",patchSystemType = "";
            String patchcustomQuery = "",PatchSummaryQueryDivdisplay = "none",patchTimeFilter ="none",current_dbTime ="",ITAcharttypevalue = "block",ITAchartdisplaytypevalue = "block",displayOfArchiveLevel = "none",archiveTypeDisable="",archiveLevel="",ComplianceOUid = "1",AssetModuleID = "1",displaySoftwareMeteringReportLevel="none",softwareMetering="none";
            String NodeOrSoftwareOrExeLevel="0"; //0 for Host Based, 1 for Software Based, 2 for Exe based           
            List<String> business_Unit=new ArrayList();
            List<String> Compliance_Rule_IDs=new ArrayList();
            String compliance_Rule_ID = "0",licenseLabel="inline",agreementLabel="none",itLabel="none",comp_Business_Unit_Multi_Selection="block",comp_Business_Unit_Single_Selection="none";
            String defaultSelect = "";
            String assetContextFilterVisible="";
            if(request.getParameter("AssetModuleID")!=null && !request.getParameter("AssetModuleID").trim().equals("")){
                AssetModuleID = request.getParameter("AssetModuleID");
            }
            if(request.getParameter("archiveLevel")!=null){
                archiveLevel=request.getParameter("archiveLevel");
            }
            rs=stmt.executeQuery("select DATE_FORMAT(now(), '%Y-%m-%d %H:%i:%s')");
            while(rs.next()){
            current_dbTime = rs.getString(1);current_dbTime = sappObj.getUserTimeZoneDate(current_dbTime, mysqlTimezone,conn,telantName);
            }rs.close();
            
            if (Sapphire.isServer) {
                virtualSiteOnly = Sapphire.verifyIfOnlyVirtualProbe(telantName);
                if(virtualSiteOnly){
                    defaultSelect = "";siteDisplay = "none";hostsDisabled = "";
                }else{
                    defaultSelect = "selected";siteDisplay = "block";hostsDisabled = "disabled";siteSelected = ""; 
                }                              
            }
            int reportID = 0;
            List<String[]> reportAccessData=new ArrayList<>();
            String loggedInUserID=(String)session.getAttribute("LOGGEDUSERID");
            boolean isHavingAccess=true,isInbuiltReport=false;
            Sapphire1 sapp1=new Sapphire1();
            if (request.getParameter("ReportID") != null) {
                if(request.getParameter("isInbuiltReport") != null && request.getParameter("isInbuiltReport").equals("1")){
                    isInbuiltReport=true;
                }
				if(request.getParameter("isCopyReport") != null){
                   pageType = "Save";pageType_view = i18n.tr("Save");reportTypeDisable = "disabled";ChangeLogreportTypeDisable = "disabled";archiveTypeDisable="disabled";
                }else{
                   pageType = "Update";pageType_view = i18n.tr("Update");reportTypeDisable = "disabled";ChangeLogreportTypeDisable = "disabled";archiveTypeDisable="disabled";
                }
                
                if (request.getParameter("ReportID").contains("GENERIC_ASSET-")) {
                    reportType = 2;
                    reportID = Integer.parseInt(request.getParameter("ReportID").replace("GENERIC_ASSET-", ""));
                    assetBlockDisplay = "";assetcommonblock = "";assetchartDisplay = "";reportTemplate = "GENERIC_ASSET";
                    HashMap masterData = reportsObj.getMasterData(reportID, true,telantName);
                    reportName = (String) masterData.get("Name");
                    reportDesc = (String) masterData.get("Description");
                    chartType = (String) masterData.get("ReportType");
                    displayType = (String) masterData.get("DisplayType");
                    rs = stmt.executeQuery("select AssetContextFilter from saved_reports where SNo=" + reportID);
                    while (rs.next()) {                       
                        if(rs.getInt(1)==1){
                             assetContextFilterVisible="checked";
                        }   
                    }rs.close();
                } else if (request.getParameter("ReportID").contains("GENERIC_ASSET_SUMMARY-")) {
                    reportType = 3;
                    reportID = Integer.parseInt(request.getParameter("ReportID").replace("GENERIC_ASSET_SUMMARY-", ""));
                    assetSummaryBlockDisplay = "block";assetcommonblock = "block";reportTemplate = "GENERIC_ASSET_SUMMARY";
                    HashMap masterData = reportsObj.getMasterData(reportID, true,telantName);
                    reportName = (String) masterData.get("Name");
                    reportDesc = (String) masterData.get("Description");
                    chartType = (String) masterData.get("ReportType");
                    displayType = (String) masterData.get("DisplayType");
                    rs = stmt.executeQuery("select TimePeriod,AssetContextFilter from saved_reports where SNo=" + reportID);
                    while (rs.next()) {
                        str_TimePeriod = rs.getString(1);
                        if(rs.getInt(2)==1){
                             assetContextFilterVisible="checked";
                        }   
                    }rs.close();
                } else if (request.getParameter("ReportID").contains("GENERIC_ASSET_INV_CUSTOM-")) {
                    reportType = 4;
                    reportID = Integer.parseInt(request.getParameter("ReportID").replace("GENERIC_ASSET_INV_CUSTOM-", ""));
                    assetInvCustomDivDisplay = "block";reportTemplate = "GENERIC_ASSET_INV_CUSTOM";
                    HashMap masterData = reportsObj.getMasterData(reportID, true,telantName);
                    reportName = (String) masterData.get("Name");
                    reportDesc = (String) masterData.get("Description");
                    chartType = (String) masterData.get("ReportType");
                    displayType = (String) masterData.get("DisplayType");
                    rs = stmt.executeQuery("select TimePeriod,ParamID from saved_reports where SNo=" + reportID);
                    logger.info("JSP DEBUG 2 ::::::::: "+str_TimePeriod);
                    while (rs.next()) {
                        
                        str_TimePeriod = rs.getString(1);srt_query = rs.getString(2);
                    }rs.close();
                } else if (request.getParameter("ReportID").contains("GENERIC_COMPLIANCE_REPORTS-")) {
                    reportType = 6;
                    reportID = Integer.parseInt(request.getParameter("ReportID").replace("GENERIC_COMPLIANCE_REPORTS-", ""));                    
                    CompCustomDivDisplay = "block";                    
                    String compliance_Report_Data=reportsObj.getComplianceReportData(reportID,telantName);
                    selectedFields = reportsObj.getInventorySelectedFields(reportID,reportType,telantName);
                    complReportType=Integer.parseInt(compliance_Report_Data.split("\\$")[0]);
                    ComplianceOUid=compliance_Report_Data.split("\\$")[1];
                    compliance_Rule_ID=compliance_Report_Data.split("\\$")[2];
                    filterData = reportsObj.getInventorySelectedFilters(reportID,reportType,telantName);
                    String business_Unit_Array[]=ComplianceOUid.split(",");
                    for(String data : business_Unit_Array){
                        business_Unit.add(data);
                    }
                    business_Unit_Array=compliance_Rule_ID.split(",");
                    for(String data : business_Unit_Array){
                        Compliance_Rule_IDs.add(data);
                    }                    
                    reportTemplate = "GENERIC_COMPLIANCE_REPORTS";
                    HashMap masterData = reportsObj.getMasterData(reportID, false,telantName);
                    reportName = (String) masterData.get("Name");
                    reportDesc = (String) masterData.get("Description");
                    licenseLabel="none";agreementLabel="none";itLabel="none";
                    switch(complReportType){
                        case 1:{comp_Business_Unit_Multi_Selection="block";comp_Business_Unit_Single_Selection="none";licenseLabel="inline";}break;
                        case 2:{comp_Business_Unit_Multi_Selection="none";comp_Business_Unit_Single_Selection="block";licenseLabel="inline";}break;
                        case 3:{comp_Business_Unit_Multi_Selection="block";comp_Business_Unit_Single_Selection="none";itLabel="inline";}break;
                        case 4:{comp_Business_Unit_Multi_Selection="none";comp_Business_Unit_Single_Selection="block";itLabel="inline";}break;
                        case 5:{comp_Business_Unit_Multi_Selection="block";comp_Business_Unit_Single_Selection="none";agreementLabel="inline";}break;
                    }                    
                } else if (request.getParameter("ReportID").contains("GENERIC_OTHER_REPORT")) {
                    nodeBlockDisplay="block";
                    reportType = 13;
                    reportID = Integer.parseInt(request.getParameter("ReportID").replace("GENERIC_OTHER_REPORT-", ""));
                    ChangeLogreportTypeDisable = "block";
                    ChangeLogDivDisplay = "block";
                    String otherReportData=reportsObj.getOtherReportData(reportID,telantName);
                    ChangeLogReportType=NumberUtils.toInt(otherReportData.split("\\$")[0]);
                    str_TimePeriod=otherReportData.split("\\$")[1];
                    patchTimeFilter=otherReportData.split("\\$")[2];                    
                    reportTemplate = "GENERIC_OTHER_REPORT";
                    HashMap masterData = reportsObj.getMasterData(reportID, false,telantName);
                    reportName = (String) masterData.get("Name");
                    reportDesc = (String) masterData.get("Description");
                    selectedHosts = reportsObj.getSelectedHosts(reportID,telantName);
                } else if (request.getParameter("ReportID").contains("GENERIC_PATCH_MGMT-")) {
                    reportType = 9;
                    reportID = Integer.parseInt(request.getParameter("ReportID").replace("GENERIC_PATCH_MGMT-", ""));
                    reportTemplate = "GENERIC_PATCH_MGMT";
                    CustomBlockDisplay = "block";                    
                    nodeBlockDisplay = "block";
                    automationcommonblock = "none";
                    HashMap masterData = reportsObj.getReportData(reportID,telantName);
                    reportName = (String) masterData.get("Name");
                    reportDesc = (String) masterData.get("Description");
                    chartType = (String) masterData.get("ReportType");
                    displayType = (String) masterData.get("DisplayType");
                    AnalyticalBlockDisplay = "none";
                    rs = stmt.executeQuery("select TimePeriod,ParamID from saved_reports where SNo=" + reportID);
                    while (rs.next()) {
                        str_TimePeriod = rs.getString(1);
                        srt_query = rs.getString(2);
                    }rs.close();
                    formAction = "reportsOperations";
                    tabName = i18n.tr("IT Automation Reports");
                } else if (request.getParameter("ReportID").contains("GENERIC_AUTOMATION")) {
                    reportType = 8;
                    reportID = Integer.parseInt(request.getParameter("ReportID").replace("GENERIC_AUTOMATION-", ""));                    
                    nodeBlockDisplay = "block";
                    AnalyticalBlockDisplay = "block";
                    automationcommonblock = "";
                    assetchartDisplay = "";
                    reportTemplate = "GENERIC_AUTOMATION";
                    HashMap masterData = reportsObj.getMasterData(reportID, false,telantName);
                    reportName = (String) masterData.get("Name");
                    reportDesc = (String) masterData.get("Description");
                    selectedHosts = reportsObj.getSelectedHosts(reportID,telantName);
                   rs = stmt.executeQuery("select parametervalue from inventory_faultmanagement_reportdetails where reportid="+ reportID+" and parameterid=18");
                    while (rs.next()) {
                        chartType = rs.getString(1);
                    }rs.close();
                    rs = stmt.executeQuery("select parametervalue from inventory_faultmanagement_reportdetails where reportid="+ reportID+" and parameterid=19");
                    while (rs.next()) {
                        displayType = rs.getString(1);
                    }rs.close();
                    rs = stmt.executeQuery("select TimePeriod,ParamID from saved_reports where SNo=" + reportID);
                    while (rs.next()) {
                        str_TimePeriod = rs.getString(1);
                    }rs.close();
                    formAction = "reportsOperations";
                    tabName = i18n.tr("IT Automation Reports");
                    displayOfArchiveLevel="block";
                    rs = stmt.executeQuery("select ParameterValue from inventory_faultmanagement_reportdetails where ParameterID =23 and ReportID=" + reportID);
                        while (rs.next()) {
                            archiveLevel = rs.getString(1);
                        }rs.close();
                        if(archiveLevel.equals("1")){
                            reportType = 21;
                        }
                } else if (request.getParameter("ReportID").contains("GENERIC_ANTI_VIRUS")) {
                    reportType = 11;
                    reportID = Integer.parseInt(request.getParameter("ReportID").replace("GENERIC_ANTI_VIRUS-", ""));
                    nodeBlockDisplay = "block";
                    AntiVirusBlock = "block";
                    assetchartDisplay = "";
                    reportTemplate = "GENERIC_ANTI_VIRUS";
                    HashMap masterData = reportsObj.getMasterData(reportID, false,telantName);
                    reportName = (String) masterData.get("Name");
                    reportDesc = (String) masterData.get("Description");
                    selectedHosts = reportsObj.getSelectedHosts(reportID,telantName);
                    filterData = reportsObj.getInventorySelectedFilters(reportID,reportType,telantName);
                    selectedFields = reportsObj.getInventorySelectedFields(reportID,reportType,telantName);
                    tabName = i18n.tr("IT Automation Reports");
                }else if (request.getParameter("ReportID").contains("GENERIC_AUTO_SUMMARY")) {
                    reportType = 16;
                    reportID = Integer.parseInt(request.getParameter("ReportID").replace("GENERIC_AUTO_SUMMARY-", ""));
                    nodeBlockDisplay = "block";
                    AnalyticalBlockDisplay = "block";
                    automationcommonblock="block";
                    ITAcharttypevalue="none";
                    ITAchartdisplaytypevalue="none";
                    reportTemplate = "GENERIC_AUTO_SUMMARY";
                    HashMap masterData = reportsObj.getMasterData(reportID, false,telantName);
                    reportName = (String) masterData.get("Name");
                    reportDesc = (String) masterData.get("Description");
                    selectedHosts = reportsObj.getSelectedHosts(reportID,telantName);
                    tabName = i18n.tr("IT Automation Reports");
                    displayOfArchiveLevel="block";
                    rs = stmt.executeQuery("select ParameterValue from inventory_faultmanagement_reportdetails where ParameterID =23 and ReportID=" + reportID);
                        while (rs.next()) {
                            archiveLevel = rs.getString(1);
                        }rs.close();
                        if(archiveLevel.equals("1")){
                            reportType = 20;
                        }
                } else {
                    reportID = Integer.parseInt(request.getParameter("ReportID"));
                    HashMap masterData = reportsObj.getMasterData(reportID, false,telantName);
                    reportName = (String) masterData.get("Name");
                    reportDesc = (String) masterData.get("Description");
                    reportType = Integer.parseInt((String) masterData.get("ReportType"));
                    selectedHosts = reportsObj.getSelectedHosts(reportID,telantName);
                    selectedFields = reportsObj.getInventorySelectedFields(reportID,reportType,telantName);
                    filterData = reportsObj.getInventorySelectedFilters(reportID,reportType,telantName);
                    if (reportType == 1 || reportType == 5) {
                        inventoryBlockDisplay = "block";
                        nodeBlockDisplay = "block";
                    } else if (reportType == 9 || reportType == 18 || reportType == 22) {
                        tabName = i18n.tr("IT Automation Reports");
                        rs = stmt.executeQuery("select ParameterValue from inventory_faultmanagement_reportdetails where ParameterID =13 and ReportID=" + reportID);
                        while (rs.next()) {
                            patchLevel = rs.getString(1);
                        }rs.close();
                        if (patchLevel.equals("2")) {
                            PatchSummaryQueryDivdisplay = "block";
                            patchTimeFilter ="block";
                            rs = stmt.executeQuery("select ParameterValue from inventory_faultmanagement_reportdetails where ParameterID =16 and ReportID=" + reportID);
                            while (rs.next()) {
                                patchcustomQuery = rs.getString(1);
                            }rs.close();
                        }
                        rs = stmt.executeQuery("select ParameterValue from inventory_faultmanagement_reportdetails where ParameterID =14 and ReportID=" + reportID);
                        while (rs.next()) {
                            patchReportType = rs.getString(1);
                        }rs.close();
                        if(reportType == 22 || reportType == 23){
                            displayOfLinuxpatchLevel = "block";
                            displayOfpatchLevel = "none";
                        }else{
                            displayOfpatchLevel = "block";
                            displayOfLinuxpatchLevel = "none";
                        }
                        if (reportType == 18){
                            displayOfpatchReportType = "none";
                        }
                        if(reportType != 22){
                            rs = stmt.executeQuery("select ParameterValue from inventory_faultmanagement_reportdetails where ParameterID =23 and ReportID=" + reportID);
                            while (rs.next()) {
                                archiveLevel = rs.getString(1);
                            }rs.close();
                        }
                    }else if(reportType == 14 || reportType == 15 || reportType == 19 || reportType ==  23){
                        tabName = i18n.tr("IT Automation Reports");
                        rs=stmt.executeQuery("select ParameterValue from inventory_faultmanagement_reportdetails where ParameterID =18 and ReportID="+reportID);
                         while(rs.next()){
                            chartType  = rs.getString(1);
                        }rs.close();                        
                        rs=stmt.executeQuery("select ParameterValue from inventory_faultmanagement_reportdetails where ParameterID =19 and ReportID="+reportID);
                        while(rs.next()){
                            displayType  = rs.getString(1);
                        }rs.close();
                         if(reportType == 14 || reportType == 19)
                        {
                            pstmt=conn.prepareStatement("select ParameterValue from inventory_faultmanagement_reportdetails where ParameterID =? and ReportID=?");
                            pstmt.setInt(1, 13);
                            pstmt.setInt(2, reportID);
                            rs = pstmt.executeQuery();
                            while (rs.next()) {
                                patchLevel = rs.getString(1);
                            }
                            rs.close();
                            if (patchLevel.equals("2")) {
                                PatchSummaryQueryDivdisplay = "block";
                                patchTimeFilter ="block";                                
                                pstmt.setInt(1, 16);
                                pstmt.setInt(2, reportID);
                                rs = pstmt.executeQuery();
                                while (rs.next()) {
                                    patchcustomQuery = rs.getString(1);
                                }
                                rs.close();
                            }pstmt.close();
                        }
                        if(reportType == 15 || reportType == 23){
                            displayOfpatchLevel = "none";
                        }else{
                           displayOfpatchLevel = "block";
                        }
                        patchAnalyticalchartDisplay ="block";
                        if (reportType == 15){
                              PatchSummaryQueryDivdisplay = "block";
                               nodeBlockDisplay = "block";
                               rs = stmt.executeQuery("select ParameterValue from inventory_faultmanagement_reportdetails where ParameterID =16 and ReportID=" + reportID);
                                while (rs.next()) {
                                    patchcustomQuery = rs.getString(1);
                                }rs.close();
                        }
                    }
                    if(reportType == 9 || reportType == 14 || reportType == 18 || reportType == 19 || reportType ==  22 || reportType == 23){
                        nodeBlockDisplay = "block";
                        if(reportType == 14 && patchLevel.equalsIgnoreCase("2")){
                        PatchSummaryReportDisplay = "none";
                        displayOfpatchSystemType = "none";
                        }else{
                          PatchSummaryReportDisplay = "block";
                          displayOfpatchSystemType = "block";
                        }
                        tabName = i18n.tr("IT Automation Reports");
                        if(reportType != 22 && reportType != 23){
                            displayOfArchiveLevel="block";
                        }
                         rs=stmt.executeQuery("select ParameterValue from inventory_faultmanagement_reportdetails where ParameterID =15 and ReportID="+reportID);
                         while(rs.next()){
                            patchSystemType = rs.getString(1);
                         }rs.close();
                     }
                    if(reportType == 26){
                        displaySoftwareMeteringReportLevel="block";
                        softwareMetering="block";
                        nodeBlockDisplay="block";
                        reportTemplate = "";
                        String softwareMeterdata=reportsObj.getSoftwareMeterReportData(reportID,telantName);
                        NodeOrSoftwareOrExeLevel=softwareMeterdata.split("\\$")[0];
                        str_TimePeriod=softwareMeterdata.split("\\$")[1];                                
                    }
                }
                if(reportType == 2 || reportType == 3){
					if(request.getParameter("isCopyReport") == null){
						isHavingAccess=sapp1.checkReportViewEditDeleteAccessbility(2, 1, reportID, loggedInUserID, conn,telantName);
					}
                }else if(reportType == 4 || reportType == 10 || reportType == 12){
                    isHavingAccess=sapp1.checkReportViewEditDeleteAccessbility(2, 1, reportID, loggedInUserID, conn,telantName);
                }else{
                    isHavingAccess=sapp1.checkReportViewEditDeleteAccessbility(2, 0, reportID, loggedInUserID, conn,telantName);
                }
                if(!isHavingAccess){%>
                    <script type="text/javascript">
                        window.location.href="getITAMReportListView.do";
                    </script>
                <%}
                if(reportType == 2 || reportType == 3 || reportType == 4 || reportType == 10 || reportType == 12){
                    reportAccessData=sapp1.getReportAccessInfo(reportID, 1, i18n,telantName);
                }else{
                    reportAccessData=sapp1.getReportAccessInfo(reportID, 0, i18n,telantName);
                }
            }
            if (request.getParameter("reportType") != null) {
                if (request.getParameter("reportType").equalsIgnoreCase("8") || request.getParameter("reportType").equalsIgnoreCase("9") || request.getParameter("reportType").equalsIgnoreCase("11")|| request.getParameter("reportType").equalsIgnoreCase("14") || request.getParameter("reportType").equalsIgnoreCase("19") ||request.getParameter("reportType").equalsIgnoreCase("15")||request.getParameter("reportType").equalsIgnoreCase("16") || request.getParameter("reportType").equalsIgnoreCase("18") || request.getParameter("reportType").equalsIgnoreCase("20") || request.getParameter("reportType").equalsIgnoreCase("21") || request.getParameter("reportType").equalsIgnoreCase("22") || request.getParameter("reportType").equalsIgnoreCase("23")) {
                    tabName = i18n.tr("IT Automation Reports");
                    formAction="reportsOperations";
                }
            }
                    if(reportType == 9 || reportType == 11 || reportType == 8 || reportType == 16 || reportType == 20 || reportType == 21 || reportType == 18|| reportType == 19 || reportType == 22 || reportType == 23){
                         rs=stmt.executeQuery("select ParameterValue from inventory_faultmanagement_reportdetails where ParameterID =20 and ReportID="+reportID);
                            if(rs.next()){
                                 str_TimePeriod = rs.getString(1);
                            }rs.close();
                    }
                    reportName=reportName.replace("$$","");
                    if(reportType==8 || reportType==9 || reportType==14 || reportType==16){
                        archiveLevel="0";
                    }else if(reportType==18 || reportType==19 || reportType==20 || reportType==21){
                        archiveLevel="1";
                    }
             Integer module = NumberUtils.toInt(configSettingService.findBySettingKey("MODULES_Enabled"));
            boolean itomEnabled = (module == 2 || module == 3);
            boolean itsmEnabled = (module == 1 || module == 3);
    if (request.getParameter("ReportID") != null) {%>
        <body onload="onLoadReportSelection(<%=reportType%>);charttype('');filtersLoadOnUpdate();">
    <%}else{
        reportType=Integer.parseInt(request.getParameter("reportType"));%>
        <body onload="onLoadReportSelection(<%=reportType%>);showDiv(<%=reportType%>)">
    <%}%>    
        <jsp:include page="toptable.jsp" />
        <form name="ReportsForm" id="ReportsForm" method="post" action="<%=formAction%>">
        <security:csrfInput/>
            <div id="mainContentArea1" class="addNewReport gridAbsent">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td>
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td colspan="3" align="center" height="11">
                                        <table width="100%" border="0"  cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td valign="top">
                                                    <div style="width:99.5%" > 
                                                        <table width="140" border="0" cellspacing="0" cellpadding="0" id="subTabNavigation">
                                                            <tr>
                                                                <td><ul><li class="selected"><a href="#" ><%=tabName%></a><span></span></li></ul></td>
                                                            </tr>
                                                        </table>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="100%" align="center" valign="top">
                                        <div class="contentBlock noMargin"> 
                                            <div class="widgetOuterWrapper"> 
                                                <div class="widgetInnerWrapper">
                                                    <input type ="hidden" name="virtualSiteOnly" id="virtualSiteOnly" value="<%=virtualSiteOnly%>"/>
                                                    <input type="hidden" name="PageType" id="PageType" value="<%=pageType%>">
                                                    <input type="hidden" name="reportID" id="reportID" value="<%=reportID%>">
                                                    <input type="hidden" name="AssetModuleID" id="AssetModuleID" value="<c:out value="<%=AssetModuleID%>"/>"/>
                                                    <input type="hidden" name="screen" id="screen" value="FaultAndInventoryReport">
                                                    <input type="hidden" name="IsServer" id="IsServer" value="<%= Sapphire.isServer%>">
                                                    <%if (pageType.equalsIgnoreCase("Update")) {%>
                                                    <input type="hidden" name="edit" id="edit" value="true">
                                                    <%}%>
                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" valign="top">
                                                        <div class="confirmBlk" style="display: none;width: 95%;">
                                                        </div>
                                                        <tr>
                                                            <td class="formtext" width="20%">
                                                                <%=i18n.tr("Report Title")%><font color="red">*</font>
                                                            </td>
                                                            <td class="formfield posRelative" width="80%" colspan="4">
                                                               
                                                                <input type=<%=i18n.tr("text")%> name="title" id="title" maxlength="250"  class="mcopy wid350" style="width:320px" size="51" onclick="validateRemoveMessage(this.id)" oninput="validateRemoveMessage(this.id)" value="<%=i18n.tr(reportName)%>"/>
                                                                 
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td class="formtext" width="20%"><%= i18n.tr("Description")%></td>
                                                            <td class="formfield" width="80%" colspan="4">
                                                                <textarea name="desc" id="desc" class="mcopy wid350" cols="50" style="width:320px" rows="3"><%= i18n.tr(reportDesc)%></textarea>
                                                            </td>
                                                        </tr>
                                                        <tr class="bottomMargin20">
                                                            <td width="20%" align="right" class="formtext" ><%=i18n.tr("Report Type")%></td>
                                                            <td width="80%" align="left"  class="formfield posRelative" colspan="4">
                                                                <select id="ReportType" name="ReportType" class="mcopy" style="width:330px" onchange="showDiv(this.value)" <%= reportTypeDisable%> >
                                                                    <%if (reportType == 1 || reportType == 2 || reportType == 3 || reportType == 4 || reportType == 5 || reportType == 6 || reportType == 13 || reportType == 26 || reportType == 27) {%> 
                                                                    <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                    <% if(itomEnabled){ %>
                                                                    <option value="1" ><%=i18n.tr("Inventory Summary Report")%></option>
                                                                    <option value="5"><%=i18n.tr("Inventory Analytical Report")%></option>
                                                                    <option value="27"><%=i18n.tr("Inventory Chart Report")%></option>
                                                                    <%} if(itsmEnabled){ %>
                                                                    <option value="2"><%=i18n.tr("Asset Analytical Report")%></option>
                                                                    <option value="3"><%=i18n.tr("Asset Summary Report")%></option>
                                                                    <% } %>
                                                                    <option value="4"><%=i18n.tr("Custom Query Report")%></option>
                                                                    <% if(itomEnabled){ %>
                                                                    <option value="6"><%=i18n.tr("Compliance Reports")%></option>
                                                                    <option value="26"><%=i18n.tr("Software Metering Report")%></option>
                                                                    <option value="13"><%=i18n.tr("Other Reports")%></option>
                                                                    <% }} else if (reportType == 18 || reportType == 19 || reportType == 20 || reportType == 21) {%>
                                                                    <option value="">--<%=i18n.tr("choose")%>--</option>                                                                    
                                                                    <option value="16"><%=i18n.tr("IT Automation Summary Reports")%></option>
                                                                    <option value="20"><%=i18n.tr("IT Automation Summary Archive Reports")%></option>
                                                                    <option value="8"><%=i18n.tr("IT Automation Analytical Reports")%></option>
                                                                    <option value="21"><%=i18n.tr("IT Automation Analytical Archive Reports")%></option>
                                                                    <option value="9"><%=i18n.tr("Patch Summary Reports")%></option>
                                                                    <option value="18"><%=i18n.tr("Patch Summary Archive Reports")%></option>                                                                    
                                                                    <option value="14"><%=i18n.tr("Patch Analytical Reports")%></option>
                                                                    <option value="19"><%=i18n.tr("Patch Analytical Archive Reports")%></option>
                                                                    <option value="11" ><%=i18n.tr("Antivirus Summary Reports")%></option>
                                                                    <option value="15"><%=i18n.tr("Antivirus Analytical Reports")%></option>
                                                                    <option value="22"><%=i18n.tr("Linux Patch Summary Reports")%></option>
                                                                    <option value="23"><%=i18n.tr("Linux Patch Analytical Reports")%></option>
                                                                    <%} else {%>
                                                                    <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                    <option value="16"><%=i18n.tr("IT Automation Summary Reports")%></option>                                                                    
                                                                    <option value="8"><%=i18n.tr("IT Automation Analytical Reports")%></option>                                                                    
                                                                    <option value="9"><%=i18n.tr("Patch Summary Reports")%></option>
                                                                    <option value="14"><%=i18n.tr("Patch Analytical Reports")%></option>                                                                    
                                                                    <option value="11"><%=i18n.tr("Antivirus Summary Reports")%></option>
                                                                    <option value="15"><%=i18n.tr("Antivirus Analytical Reports")%></option>
                                                                    <option value="22"><%=i18n.tr("Linux Patch Summary Reports")%></option>
                                                                    <option value="23"><%=i18n.tr("Linux Patch Analytical Reports")%></option>
                                                                    <%}%>                                                                    
                                                                </select>                                                                
                                                                <input type="hidden" name="ReportTypeHidden" id="ReportTypeHidden" value="<%=reportType%>">
                                                            </td>
                                                        </tr>
                                                        <% if(module!=1){%>
                                                        <tr>
                                                            <td colspan="5" class="wid100">
                                                                <div id="ArchiveLevelDiv" style="display:<%=displayOfArchiveLevel%>">
                                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" valign="top">
                                                                        <tr>
                                                                            <td width="20%" align="right" class="formtext" ><%=i18n.tr("Data Level")%></td>
                                                                            <td width="80%" align="left"  class="formfield" colspan="4">
                                                                                <select id="Archivelevel" name="Archivelevel" class="mcopy" style="width:150px;" onchange="changeReportType(this.value)" <%=archiveTypeDisable%>>
                                                                                    <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                                    <%if (archiveLevel.equalsIgnoreCase("0")) {%>
                                                                                    <option value="0" selected><%=i18n.tr("Current Data")%></option>
                                                                                    <%}else{%>
                                                                                    <option value="0"><%=i18n.tr("Current Data")%></option>
                                                                                    <%}%>
                                                                                    <%if (archiveLevel.equalsIgnoreCase("1")) {%>
                                                                                    <option value="1" selected><%=i18n.tr("Archived Data")%></option>
                                                                                    <%}else{%>
                                                                                    <option value="1"><%=i18n.tr("Archived Data")%></option>
                                                                                    <%}%>
                                                                                </select>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="5" class="wid100">
                                                                <div id="LinuxReportLevelDiv" style="display:<%=displayOfLinuxpatchLevel%>">
                                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" valign="top">
                                                                        <tr>
                                                                            <td width="20%" align="right" class="formtext" ><%=i18n.tr("Report Level")%></td>
                                                                            <td width="80%" align="left"  class="formfield" colspan="4">
                                                                                <select id="LinuxPatchReportLevel" name="LinuxPatchReportLevel" class="mcopy" onchange="ShowMissing()" style="width:150px;">
                                                                                    <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                                    <%if (patchLevel.equalsIgnoreCase("0")) {%>
                                                                                    <option value="0" selected><%=i18n.tr("Patch Level")%></option>
                                                                                    <%} else {%>
                                                                                    <option value="0"><%=i18n.tr("Patch Level")%></option>
                                                                                    <%}if((reportType!=18) || (request.getParameter("reportType")!=null && !request.getParameter("reportType").equals("18"))){
                                                                                        if (patchLevel.equalsIgnoreCase("1")) {%>
                                                                                    <option value="1" selected><%=i18n.tr("Node Level")%></option> 
                                                                                    <%} else {%>
                                                                                    <option value="1"><%=i18n.tr("Node Level")%></option> 
                                                                                    <%}}if (patchLevel.equalsIgnoreCase("2")) {%>
                                                                                    <option value="2" selected><%=i18n.tr("Query Level")%></option> 
                                                                                    <%} else {%>
                                                                                    <option value="2"><%=i18n.tr("Query Level")%></option> 
                                                                                    <%}%>
                                                                                </select>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="5" class="wid100">
                                                                <div id="ReportLevelDiv" style="display:<%=displayOfpatchLevel%>">
                                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" valign="top">
                                                                        <tr>
                                                                            <td width="20%" align="right" class="formtext" ><%=i18n.tr("Report Level")%></td>
                                                                            <td width="80%" align="left"  class="formfield" colspan="4">
                                                                                <select id="PatchReportLevel" name="PatchReportLevel" class="mcopy" onchange="ShowInstalledorMissing()" style="width:150px;">
                                                                                    <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                                    <%if(reportType != 14 && reportType != 19){
                                                                                    if (patchLevel.equalsIgnoreCase("0")) {%>
                                                                                    <option value="0" selected><%=i18n.tr("Patch Level")%></option>
                                                                                    <%} else {%>
                                                                                    <option value="0"><%=i18n.tr("Patch Level")%></option>
                                                                                    <%}}if(reportType!=18 && (request.getParameter("reportType")!=null && !request.getParameter("reportType").equals("18"))){
                                                                                    if (patchLevel.equalsIgnoreCase("1")) {%>
                                                                                    <option value="1" selected><%=i18n.tr("Node Level")%></option> 
                                                                                    <%} else {%>
                                                                                    <option value="1"><%=i18n.tr("Node Level")%></option> 
                                                                                    <%}}if(reportType == 14 || reportType == 19 || reportType == 9){
                                                                                    if (patchLevel.equalsIgnoreCase("1")) {%>
                                                                                    <option value="1" selected><%=i18n.tr("Node Level")%></option> 
                                                                                    <%} else {%>
                                                                                    <option value="1"><%=i18n.tr("Node Level")%></option> 
                                                                                    <%}}if (reportType != 14 && patchLevel.equalsIgnoreCase("2")) {%>
                                                                                    <option value="2" selected><%=i18n.tr("Query Level")%></option>
                                                                                    <%} else if (reportType != 14){%>
                                                                                    <option value="2"><%=i18n.tr("Query Level")%></option>
                                                                                    <%}%>
                                                                                </select>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="5" class="wid100">
                                                                <div id="PatchSummaryQueryDiv" style="display:<%=PatchSummaryQueryDivdisplay%>">
                                                                    <table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
                                                                        <tr>
                                                                            <td class="formtext" width="20%"> <%=i18n.tr("Custom Query").replace(" ","&nbsp;")%></td>
                                                                            <td class="formfield" width="80%" colspan="4">
                                                                                <select id="PatchSummaryQuery" name="PatchSummaryQuery" class="mcopy" style="width:330px;">
                                                                                    <option value ="" >--<%=i18n.tr("choose")%>--</option>
                                                                                    <%if(request.getParameter("reportType")!=null){
                                                                                          reportType = Integer.parseInt(request.getParameter("reportType"));
                                                                                    }
                                                                                    if(reportType == 15){
                                                                                        pstmt=conn.prepareStatement("select Id,DisplayName from asset_inv_querybuilder where type=2 order by DisplayName");
                                                                                        rs = pstmt.executeQuery();
                                                                                    }else if(reportType==18){
                                                                                        pstmt=conn.prepareStatement("select Id,DisplayName from asset_inv_querybuilder where type=3 and query  like '%patch_jobdetails_archive%' and (displayname like '%patch%' or displayname like '%scan%' or displayname like '%deploy%'  or displayname like '%Top n%' ) order by DisplayName");
                                                                                        rs = pstmt.executeQuery();
                                                                                    }else if(reportType == 22){
                                                                                        pstmt=conn.prepareStatement("select Id,DisplayName from asset_inv_querybuilder where type=4 order by DisplayName");
                                                                                        rs = pstmt.executeQuery();
                                                                                    }else if(reportType == 14){
                                                                                        pstmt=conn.prepareStatement("select Id,DisplayName from asset_inv_querybuilder where type=5 order by DisplayName");
                                                                                        rs = pstmt.executeQuery();
                                                                                    }else if(reportType == 19){
                                                                                        pstmt=conn.prepareStatement("select Id,DisplayName from asset_inv_querybuilder where type=6 order by DisplayName");
                                                                                        rs = pstmt.executeQuery();
                                                                                    }else{
                                                                                        String query="";
                                                                                        if(osDeployement == 0){
                                                                                            query="select Id,DisplayName from asset_inv_querybuilder where type=1 and query not like '%patch_jobdetails_archive%' and (displayname like '%patch%' or displayname like '%scan%' or displayname like '%deploy%'  or displayname like '%Top n%' ) and DisplayName!='OS Deployment Reports' order by DisplayName";
                                                                                        }else{
                                                                                             query="select Id,DisplayName from asset_inv_querybuilder where type=1 and query not like '%patch_jobdetails_archive%' and (displayname like '%patch%' or displayname like '%scan%' or displayname like '%deploy%'  or displayname like '%Top n%' ) order by DisplayName";
                                                                                        }
                                                                                        pstmt=conn.prepareStatement(query);
                                                                                        rs = pstmt.executeQuery();
                                                                                    }                                                                                    
                                                                                        while (rs.next()) {
                                                                                            if (patchcustomQuery.equalsIgnoreCase("CustomQuery=" + rs.getString(1)) || patchcustomQuery.equalsIgnoreCase(rs.getString(1))) { %>
                                                                                    <option value="CustomQuery=<%=rs.getInt(1)%>" selected><%=i18n.tr(rs.getString(2))%></option>
                                                                                    <% } else {%>
                                                                                    <option value="CustomQuery=<%=rs.getString(1)%>"><%=i18n.tr(rs.getString(2))%></option>
                                                                                    <%}}rs.close(); pstmt.close();%>
                                                                                </select>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>       
                                                        <tr>
                                                            <td colspan="5" class="wid100">
                                                                <div id="Patch_InstalledorMissingDiv" style="display:<%=displayOfpatchReportType%>">
                                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" valign="top">
                                                                        <tr>
                                                                            <td width="20%" align="right" class="formtext" ><%= i18n.tr("Patch Report Type")%></td>
                                                                            <td width="80%" align="left"  class="formfield" colspan="4">
                                                                                <select id="PatchInstalledOrMissingReport" name="PatchInstalledOrMissingReport" class="mcopy" style="width:150px;">
                                                                                    <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                                    <%if(reportType != 22 && reportType != 23){
                                                                                        if (patchReportType.equalsIgnoreCase("1")) {%>
                                                                                    <option value="1" selected><%=i18n.tr("Installed Patch")%></option>
                                                                                    <%} else {%>
                                                                                    <option value="1"><%=i18n.tr("Installed Patch")%></option>
                                                                                    <%}}if (patchReportType.equalsIgnoreCase("0")) {%>
                                                                                    <option value="0" selected><%=i18n.tr("Missing Patch")%></option> 
                                                                                    <%} else {%>
                                                                                    <option value="0"><%=i18n.tr("Missing Patch")%></option> 
                                                                                    <%}%>
                                                                                </select>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="5" class="wid100">
                                                                <div id="SystemTypeDiv" style="display:<%= displayOfpatchSystemType%>">
                                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" valign="top">
                                                                        <tr>
                                                                            <td width="20%" align="right" class="formtext" ><%=i18n.tr("System Type")%></td>
                                                                            <td width="80%" align="left"  class="formfield" colspan="4">
                                                                                <select id="PatchReportSystemType" name="PatchReportSystemType" class="mcopy" style="width:150px;">
                                                                                    <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                                    <%if (patchSystemType.equalsIgnoreCase("2")) {%>
                                                                                    <option value="2" selected><%=i18n.tr("ALL")%></option>
                                                                                    <%} else {%>
                                                                                    <option value="2"><%=i18n.tr("ALL")%></option>
                                                                                    <%}if (patchSystemType.equalsIgnoreCase("0")) {%>
                                                                                    <option value="0" selected><%=i18n.tr("Normal")%></option>
                                                                                    <%} else {%>
                                                                                    <option value="0"><%=i18n.tr("Normal")%></option>
                                                                                    <%}if (patchSystemType.equalsIgnoreCase("1")) {%>
                                                                                    <option value="1" selected><%=i18n.tr("Critical")%></option> 
                                                                                    <%} else {%>
                                                                                    <option value="1"><%=i18n.tr("Critical")%></option> 
                                                                                    <%}%>
                                                                                </select>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                        <td colspan="5" class="wid100">
                                                            <div style="display:<%=patchAnalyticalchartDisplay%>" id="patchAnalyticalchartDisplay">
                                                             <table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
                                                               <tr>
                                                                <td class='formtext' width="20%"><%=i18n.tr("Chart Type")%></td>
                                                                <td class='formfield' width="80%">
                                                                    <select id="Patchcharttype" name="Patchcharttype" class="mcopy" style="width:150px;">
                                                                        <% if(chartType.equalsIgnoreCase("")){ %>
                                                                             <option value='' selected>--<%=i18n.tr("choose")%>--</option>
                                                                          <%}else{ %>
                                                                            <option value='' >--<%=i18n.tr("choose")%>--</option>
                                                                          <%} if(chartType.equalsIgnoreCase("summary")){ %>
                                                                             <option value='summary' selected><%=i18n.tr("Summary")%></option>
                                                                          <%}else{ %>
                                                                            <option value='summary'><%=i18n.tr("Summary")%></option>
                                                                          <%} if(chartType.equalsIgnoreCase("bar")){ %>
                                                                             <option value='bar' selected><%=i18n.tr("Bar")%></option>
                                                                          <%}else{ %>
                                                                            <option value='bar'><%=i18n.tr("Bar")%></option>
                                                                          <%} if(chartType.equalsIgnoreCase("treand")){ %>
                                                                             <option value='treand' selected><%=i18n.tr("Trend")%></option>
                                                                          <%}else{ %>
                                                                            <option value='treand'><%=i18n.tr("Trend")%></option>
                                                                          <%}  if(chartType.equalsIgnoreCase("stackedbar")){ %>
                                                                             <option value='stackedbar' selected><%=i18n.tr("Stacked Bar")%></option>
                                                                          <%}else{ %>
                                                                            <option value='stackedbar'><%=i18n.tr("Stacked Bar")%></option>
                                                                          <%}if(reportType == 14 || reportType == 19 || reportType == 23){
                                                                          if(chartType.equalsIgnoreCase("pie")){ %>
                                                                             <option value='pie' selected><%=i18n.tr("Pie")%></option>
                                                                          <%}else{ %>
                                                                            <option value='pie'><%=i18n.tr("Pie")%></option>
                                                                          <%}}%>
                                                                   </select>	                       	
                                                                </td>
                                                              </tr>
                                                                <tr>
                                                                  <td class='formtext' width="20%"><%=i18n.tr("Chart Display Type")%></td>
                                                                  <td class='formfield' colspan='2' width="80%">
                                                                       <select id="Patchchartrepresentation" name="Patchchartrepresentation" class="mcopy" style="width:150px;">
                                                                           <%if((reportType == 14 || reportType == 19 || reportType == 23) && chartType.equalsIgnoreCase("pie")){%>
                                                                                <option value='1' selected><%=i18n.tr("Multiple")%></option>
                                                                           <%}else{
                                                                           if(displayType.equals("")){%>
                                                                                <option value='' selected>--<%=i18n.tr("choose")%>--</option>
                                                                            <%}else{ %>
                                                                              <option value='' >--<%=i18n.tr("choose")%>--</option>
                                                                            <%} if( displayType.equalsIgnoreCase("0")){ %>
                                                                               <option value='0' selected><%=i18n.tr("Single")%></option>
                                                                              <%}else{ %>
                                                                               <option value='0' ><%=i18n.tr("Single")%></option>
                                                                           <%} if(displayType.equalsIgnoreCase("1")){ %>
                                                                               <option value='1' selected><%=i18n.tr("Multiple")%></option>
                                                                              <%}else{ %>
                                                                               <option value='1' ><%=i18n.tr("Multiple")%></option>
                                                                           <%}} %>
                                                                       </select>
                                                                  </td>
                                                              </tr>
                                                            </table>
                                                          </div>
                                                         </td>
                                                       </tr>
                                                        <tr>
                                                            <td colspan="5" class="wid100">
                                                                <div style="display:<%=CompCustomDivDisplay%>" id="CompInventoryReportDiv">
                                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" valign="top">
                                                                        <tr>
                                                                            <td>
                                                                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                                                    <tr>
                                                                                        <td width="20%" align="right" class="formtext"><%=i18n.tr("Compliance Report Type")%><font color="red">*</font></td>
                                                                                        <td width="80%" align="left"  class="formfield">
                                                                                            <select id="complReportType" name="complReportType" class="mcopy" style="width:330px;" <%=reportTypeDisable%>>
                                                                                                <% if (complReportType == 1) {%>
                                                                                                <option value="">--<%=i18n.tr("choose")%>--</option>                                                                                    
                                                                                                <option value="1" selected><%=i18n.tr("Software Compliance Detail")%></option>
                                                                                                <option value="2"><%=i18n.tr("Software Compliance Summary")%></option>
                                                                                                <option value="3"><%=i18n.tr("IT Compliance Detail")%></option>
                                                                                                <option value="4"><%=i18n.tr("IT Compliance Summary")%></option>
                                                                                                <option value="5"><%=i18n.tr("License Agreement")%></option>                                                                                  
                                                                                                <%} else if (complReportType == 2) {%>
                                                                                                <option value="">--<%=i18n.tr("choose")%>--</option>                                                                                    
                                                                                                <option value="1"><%=i18n.tr("Software Compliance Detail")%></option>
                                                                                                <option value="2" selected><%=i18n.tr("Software Compliance Summary")%></option>
                                                                                                <option value="3"><%=i18n.tr("IT Compliance Detail")%></option>
                                                                                                <option value="4"><%=i18n.tr("IT Compliance Summary")%></option>
                                                                                                <option value="5"><%=i18n.tr("License Agreement")%></option>
                                                                                                <%} else if (complReportType == 3) {%>
                                                                                                <option value="">--<%=i18n.tr("choose")%>--</option>                                                                                    
                                                                                                <option value="1"><%=i18n.tr("Software Compliance Detail")%></option>
                                                                                                <option value="2"><%=i18n.tr("Software Compliance Summary")%></option>
                                                                                                <option value="3" selected><%=i18n.tr("IT Compliance Detail")%></option>
                                                                                                <option value="4"><%=i18n.tr("IT Compliance Summary")%></option>
                                                                                                <option value="5"><%=i18n.tr("License Agreement")%></option>
                                                                                                <%} else if (complReportType == 4) {%>
                                                                                                <option value="">--<%=i18n.tr("choose")%>--</option>                                                                                    
                                                                                                <option value="1"><%=i18n.tr("Software Compliance Detail")%></option>
                                                                                                <option value="2"><%=i18n.tr("Software Compliance Summary")%></option>
                                                                                                <option value="3"><%=i18n.tr("IT Compliance Detail")%></option>
                                                                                                <option value="4" selected><%=i18n.tr("IT Compliance Summary")%></option>
                                                                                                <option value="5"><%=i18n.tr("License Agreement")%></option>
                                                                                                <%} else if (complReportType == 5) {%>
                                                                                                <option value="">--<%=i18n.tr("choose")%>--</option>                                                                                    
                                                                                                <option value="1"><%=i18n.tr("Software Compliance Detail")%></option>
                                                                                                <option value="2"><%=i18n.tr("Software Compliance Summary")%></option>
                                                                                                <option value="3"><%=i18n.tr("IT Compliance Detail")%></option>
                                                                                                <option value="4"><%=i18n.tr("IT Compliance Summary")%></option>
                                                                                                <option value="5" selected><%=i18n.tr("License Agreement")%></option>
                                                                                                <%} else {%>
                                                                                                <option value="" selected>--<%=i18n.tr("choose")%>--</option>                                                                                    
                                                                                                <option value="1"><%=i18n.tr("Software Compliance Detail")%></option>
                                                                                                <option value="2"><%=i18n.tr("Software Compliance Summary")%></option>
                                                                                                <option value="3"><%=i18n.tr("IT Compliance Detail")%></option>
                                                                                                <option value="4"><%=i18n.tr("IT Compliance Summary")%></option>
                                                                                                <option value="5"><%=i18n.tr("License Agreement")%></option>                                                                                    
                                                                                                <%}%>
                                                                                            </select>
                                                                                            <input type="hidden" name="CompReportTypeHidden" id="CompReportTypeHidden" value="<%=complReportType%>">
                                                                                        </td>
                                                                                    </tr>
                                                                                    <tr>
                                                                                        <td width="20%" align="right" class="formtext"><span id="softwareLicenseName" style="display:<%=licenseLabel%>" ><%=i18n.tr("License Name(s)")%></span><span id="itComplianceRuleName" style="display:<%=itLabel%>" ><%=i18n.tr("IT Policy Rule Name(s)")%></span><span id="licenseAgreementName" style="display:<%=agreementLabel%>" ><%=i18n.tr("Agreement Name(s)")%></span><font color="red">*</font></td>
                                                                                        <td width="80%" align="left"  class="formfield">
                                                                                            <select class="compliance_Rule_Selection_Dummy" id="compliance_Rule_Selection_Dummy" style="display:none;"><option value="0">--<%=i18n.tr("choose")%>--</option></select>
                                                                                            <select id="compliance_Rule_ID" name="compliance_Rule_ID" class="mcopy" multiple size="5" style="width:330px;margin-bottom: 10px;" onchange="selectComplianceRuleName(this.value)">
                                                                                                <%if(Compliance_Rule_IDs.contains("0") || Compliance_Rule_IDs.isEmpty()){%>
                                                                                                    <option value="0" selected><%=i18n.tr("All")%></option>                                                                                        
                                                                                                <%}else{%>
                                                                                                    <option value="0"><%=i18n.tr("All")%></option>
                                                                                                <%} StringBuilder selectQuery=new StringBuilder();
                                                                                                    if(complReportType == 3 || complReportType ==4){
                                                                                                        selectQuery.append("SELECT ComplianceConfigID,ConfigName FROM itcomplianceconfigmaster ORDER BY ConfigName");
                                                                                                    }else if(complReportType == 5){
                                                                                                        selectQuery.append("SELECT agreement_id,agreement_name FROM compliance_agreement_info ORDER BY agreement_name");
                                                                                                    }else{
                                                                                                        selectQuery.append("SELECT License_ID,License_Name FROM compliance_license_info ORDER BY License_Name");
                                                                                                    }
                                                                                                    pstmt=conn.prepareStatement(selectQuery.toString());
                                                                                                    rs=pstmt.executeQuery();
                                                                                                    while(rs.next()){                                                                                                
                                                                                                    if(Compliance_Rule_IDs.contains(rs.getString(1))){%>
                                                                                                        <option value="<%=rs.getString(1)%>" title="<%=rs.getString(2)%>" selected><%=rs.getString(2)%></option>
                                                                                                    <%}else{%>
                                                                                                        <option value="<%=rs.getString(1)%>" title="<%=rs.getString(2)%>"><%=rs.getString(2)%></option>
                                                                                                    <%}}rs.close();pstmt.close();%>
                                                                                            </select>
                                                                                        </td>
                                                                                    </tr>
                                                                                    <tr>
                                                                                        <td colspan="5">
                                                                                            <div id="businessUnit_Single_Selection" style="display:<%=comp_Business_Unit_Single_Selection%>">
                                                                                                <table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
                                                                                                    <tr>
                                                                                                        <td width="20%" align="right" class="formtext"><%=i18n.tr("Business Unit")%><font color="red">*</font></td>
                                                                                                        <td width="80%" align="left" class="formfield">
                                                                                                            <select id="businessUnit_Single" name="businessUnit_Single" class="mcopy" style="width:330px;">
                                                                                                                <%if(business_Unit.contains("1") || business_Unit.isEmpty()){%>
                                                                                                                    <option value="1" selected>--<%=i18n.tr("choose")%>--</option>
                                                                                                                <%}else{%>
                                                                                                                    <option value="1">--<%=i18n.tr("choose")%>--</option>
                                                                                                                <%} pstmt=conn.prepareStatement("SELECT locationid,oupath FROM locationviewmaster WHERE rootid In(SELECT locationid  FROM locationviewmaster WHERE DefaultOUForCompliance=1)");
                                                                                                                    rs=pstmt.executeQuery();
                                                                                                                    while(rs.next()){
                                                                                                                    if(business_Unit.contains(rs.getString(1))){%>
                                                                                                                        <option value="<%=rs.getString(1)%>" title="<%=rs.getString(2)%>" selected><%=i18n.tr(rs.getString(2))%></option>
                                                                                                                    <%}else{%>
                                                                                                                        <option value="<%=rs.getString(1)%>" title="<%=rs.getString(2)%>"><%=i18n.tr(rs.getString(2))%></option>
                                                                                                                    <%}}rs.close();pstmt.close();%>
                                                                                                            </select>
                                                                                                        </td>
                                                                                                    </tr>
                                                                                                </table>
                                                                                            </div>
                                                                                        </td>
                                                                                    </tr>
                                                                                    <tr>
                                                                                        <td colspan="5">
                                                                                            <div id="businessUnit_Multi_Selection" style="display:<%=comp_Business_Unit_Multi_Selection%>">
                                                                                                <table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
                                                                                                    <tr>
                                                                                                        <td width="20%" align="right" class="formtext"><%=i18n.tr("Business Unit(s)")%><font color="red">*</font></td>
                                                                                                        <td width="80%" align="left"  class="formfield">
                                                                                                            <select id="businessUnit_Multi" name="businessUnit_Multi" class="mcopy" multiple size="5" style="width:330px;margin-bottom: 10px;" onchange="selectComplianceBusinessUnit(this.value)">
                                                                                                                <%if(business_Unit.contains("1") || business_Unit.isEmpty()){%>
                                                                                                                    <option value="1" selected><%=i18n.tr("All")%></option>
                                                                                                                <%}else{%>
                                                                                                                    <option value="1"><%=i18n.tr("All")%></option>
                                                                                                                <%} pstmt=conn.prepareStatement("SELECT locationid,oupath FROM locationviewmaster WHERE rootid In(SELECT locationid  FROM locationviewmaster WHERE DefaultOUForCompliance=1)");
                                                                                                                    rs=pstmt.executeQuery();
                                                                                                                    while(rs.next()){
                                                                                                                    if(business_Unit.contains(rs.getString(1))){%>
                                                                                                                        <option value="<%=rs.getString(1)%>" title="<%=rs.getString(2)%>" selected><%=i18n.tr(rs.getString(2))%></option>
                                                                                                                    <%}else{%>
                                                                                                                        <option value="<%=rs.getString(1)%>" title="<%=rs.getString(2)%>"><%=i18n.tr(rs.getString(2))%></option>
                                                                                                                    <%}}rs.close();pstmt.close();%>
                                                                                                            </select>
                                                                                                        </td>
                                                                                                    </tr>
                                                                                                </table>
                                                                                            </div>
                                                                                        </td>
                                                                                    </tr>
                                                                                </table>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td colspan="5" class="wid100">
                                                                                <div id="complianceFieldsDiv">
                                                                                    <table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
                                                                                        <tr><td colspan="6" class="copyhdr leftPadd"><%= i18n.tr("Fields Selection")%></td></tr>
                                                                                        <tr class="formtext">
                                                                                            <td width="20%" align="right" class="formtext" ><%= i18n.tr("Fields")%></td>
                                                                                            <td width="21%" align="left"  class="formfield">
                                                                                                <select id="ComplianceField" name="ComplianceField" class="mcopy" multiple size="6" style="width:260px;margin-bottom: 5px;margin-top: 5px;">
                                                                                                   <% int compliance_ColumnID = 0;
                                                                                                        String compliance_Report_categore_Name="Software Compliance Detail";
                                                                                                        String subQuery="";
                                                                                                        if(complReportType == 1){
                                                                                                            compliance_Report_categore_Name="Software Compliance Detail";
                                                                                                            if(!Sapphire.isServer){
                                                                                                                subQuery=" AND displayname NOT IN('Site Name') ";
                                                                                                            }
                                                                                                            if(configSettingService.findBySettingKey("THIRD_PARTY_INTEGRATION").equals("1") || configSettingService.findBySettingKey("LICENSE_LINK_TO_NODES").equals("1")){
                                                                                                                subQuery += " AND displayname NOT IN('Asset Number','Asset Type','Asset Status','Asset Location','Allocated To','Logged In User') ";
                                                                                                            }
                                                                                                            subQuery +=" UNION SELECT CONCAT(config_id,'_',metadata_id,'_CUSTOM'),field_name FROM compliance_customfield_config WHERE field_type=11 ";
                                                                                                        }else if(complReportType == 2){
                                                                                                            compliance_Report_categore_Name="Software Compliance Summary";
                                                                                                        }else if(complReportType == 3){
                                                                                                            compliance_Report_categore_Name="IT Compliance Detail";
                                                                                                            if(!Sapphire.isServer){
                                                                                                                subQuery=" AND displayname NOT IN('Site Name') ";
                                                                                                            }
                                                                                                            if(configSettingService.findBySettingKey("THIRD_PARTY_INTEGRATION").equals("1") || configSettingService.findBySettingKey("ITCOMPLIANCE_LINK_TO_NODES").equals("1")){
                                                                                                                subQuery += " AND displayname NOT IN('Asset Number','Asset Type','Asset Status','Asset Location','Allocated To','Logged In User') ";
                                                                                                            }
                                                                                                        }else if(complReportType == 4){
                                                                                                            compliance_Report_categore_Name="IT Compliance Summary";
                                                                                                        }else if(complReportType == 5){
                                                                                                            compliance_Report_categore_Name="License Agreement";
                                                                                                            subQuery =" UNION SELECT CONCAT(config_id,'_',metadata_id,'_CUSTOM'),field_name FROM compliance_customfield_config WHERE field_type=9 ";
                                                                                                        }
                                                                                                        pstmt=conn.prepareStatement("select configid from inventoryreport_configmaster where ReportCategoryName=? and ModuleID=20");
                                                                                                        pstmt.setString(1, compliance_Report_categore_Name);
                                                                                                        rs = pstmt.executeQuery();
                                                                                                        if (rs.next()) {
                                                                                                            compliance_ColumnID = rs.getInt(1);
                                                                                                        }rs.close();pstmt.close();
                                                                                                        pstmt=conn.prepareStatement("SELECT configdetailsid,displayname FROM inventoryreport_configdetails WHERE configid=? "+subQuery);
                                                                                                        pstmt.setInt(1, compliance_ColumnID);
                                                                                                        rs = pstmt.executeQuery();
                                                                                                        while (rs.next()) {
                                                                                                            String SoftwareParams = rs.getString(1)+"|@@|"+rs.getString(2);
                                                                                                    %>
                                                                                                    <option value="<%=SoftwareParams%>"><%=i18n.tr(rs.getString(2))%></option>
                                                                                                    <%}rs.close();pstmt.close();%>
                                                                                                </select>
                                                                                            </td>
                                                                                            <td width="10%" align="center" class="formfield" >
                                                                                                <span onClick="addColumn()" ><img src="right-btn.gif"></span>
                                                                                                <br><br>
                                                                                                <span onClick="removeOption(document.ReportsForm.ComplianceColumns)"><img src="left-btn.gif"></span>
                                                                                            </td>
                                                                                            <td width="20%" align="left"  class="formfield">
                                                                                                <select id="ComplianceColumns" name="ComplianceColumns" class="mcopy" multiple size="6" style="width:260px;margin-bottom: 5px;margin-top: 5px;">
                                                                                                    <%  set = selectedFields.entrySet();
                                                                                                        itr = set.iterator();
                                                                                                        while (itr.hasNext()) {
                                                                                                            Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                            key = (String) (mEntry.getKey());
                                                                                                            value = (String) (mEntry.getValue());%>
                                                                                                    <option value="<%=key%>" selected><%=value%></option>
                                                                                                    <% }%>
                                                                                                </select>
                                                                                            </td>
                                                                                            <td width="10%" class="formfield" align="center">
                                                                                                <span onClick="moveOptionUp(document.ReportsForm.ComplianceColumns)" ><img src="up-btn.gif"></span>
                                                                                                <br><br>
                                                                                                <span onClick="moveOptionDown(document.ReportsForm.ComplianceColumns)"><img src="down-btn.gif"></span>
                                                                                            </td>
                                                                                            <td width="15%" >&nbsp;</td>
                                                                                        </tr>
                                                                                        <tr><td colspan="6" class="copyhdr leftPadd"><%= i18n.tr("Advanced Filter")%></td></tr>
                                                                                        <tr>
                                                                                            <td width="20%" align="right" class="formtext" ><%= i18n.tr("Filter")%></td>
                                                                                            <td width="21%" align="left"  class="formfield">
                                                                                                <select id="ComplianceFilter" name="ComplianceFilter" class="mcopy" style="width:260px">
                                                                                                    <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                                                    <option value="Compliance Fields"><%= i18n.tr("Compliance Filters")%></option>
                                                                                                </select>
                                                                                            </td>
                                                                                            <td width="20%" align="right" class="formtext" ><%= i18n.tr("Type")%></td>
                                                                                            <td width="21%" align="left"  class="formfield" colspan="4">
                                                                                                <select id="ComplianceFilterType" name="ComplianceFilterType" class="mcopy" style="width:260px">
                                                                                                    <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                                                </select>  
                                                                                            </td>    
                                                                                        </tr>  
                                                                                        <tr class="formtext">
                                                                                            <td width="20%" class="formtext"><%= i18n.tr("Criteria")%></td>
                                                                                            <td width="20%" align="left"  class="formfield">
                                                                                                <select id="ComplianceCriteria" name="ComplianceCriteria" class="mcopy" style="width:260px" onchange="displatNoteDiv(this.value)" >
                                                                                                    <option value="">--<%=i18n.tr("choose")%>--</option>                                                                            
                                                                                                </select>
                                                                                            </td>
                                                                                            <td width="10%" class="formtext"><%= i18n.tr("Value")%></td>
                                                                                            <td width="20%" align="left"  class="formfield" colspan="2">
                                                                                                <input type="text" id="ComplianceValueAdv" name="ComplianceValueAdv" class="mcopy wid350" size="40" style="width:252px">
                                                                                            </td>
                                                                                            <td width="30%" align="left"  class="formfield rightAlign" colspan="2">
                                                                                                <input  type="button"  value="<%=i18n.tr("Add")%>"  class="addbuttons greenBtn"  onclick="addComplianceFilter()">
                                                                                            </td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                            <td colspan="6" class="wid100">
                                                                                                <table border="0" width="100%">
                                                                                                    <tr class="tableHeader importantFlex">
                                                                                                        <td width="10%" class="copyhdr"  align="center">&nbsp;</td>
                                                                                                        <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Type")%></td>
                                                                                                        <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Criteria")%></td>
                                                                                                        <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Value")%></td>
                                                                                                    </tr>
                                                                                                    <tr>
                                                                                                        <td colspan="4" class="wid100">
                                                                                                            <div id="ComplianceAdvFilterDiv">
                                                                                                                <%for (int av = 0; av < filterData.size(); av++) {
                                                                                                                        String complianceData[] = (String[]) filterData.get(av);
                                                                                                                        String operatorText = complianceData[4];
                                                                                                                        if (operatorText.equals(">=")) {
                                                                                                                            operatorText = i18n.tr("Greater than or equal");
                                                                                                                        } else if (operatorText.equals("<=")) {
                                                                                                                            operatorText = i18n.tr("Less than or equal");
                                                                                                                        } else if (operatorText.equals("=")) {
                                                                                                                            operatorText = i18n.tr("Equals");
                                                                                                                        } %>
                                                                                                                <div id='ComplianceAdavnceEdit<%=av%>'>
                                                                                                                    <table border='0' width='100%' cellpadding="1" cellspacing="1">
                                                                                                                        <tr class="formfield ruleList applyWid50">
                                                                                                                            <td width='10%' class='formfield' align="center"><span style="cursor: pointer" class="skipStyle" onclick="removeDiv('ComplianceAdavnceEdit<%=av%>')"><img src="fault_x.gif" class="deleteRule" title="<%=i18n.tr("Delete filter")%>"> </span></td>
                                                                                                                            <td width='30%' class='formfield' align="center"><%=complianceData[1]%></td>
                                                                                                                            <td width='30%' class='formfield' align="center"><%=operatorText%></td>                                                                                                    
                                                                                                                            <td width='30%' class='formfield' align="center"><%=complianceData[5]%></td>                                                                                                   
                                                                                                                                <input type='hidden' name='ComplianceConfigDetailsID' id='ComplianceConfigDetailsID' value='<%=complianceData[0]%>'>                                                                                                        
                                                                                                                                <input type='hidden' name='ComplianceFilterDisplayName' id='ComplianceFilterDisplayName' value='<%=complianceData[1]%>'>
                                                                                                                                <input type='hidden' name='ComplianceFilterOperator' id='ComplianceFilterOperator' value='<%=complianceData[4]%>'>
                                                                                                                                <input type='hidden' name='ComplianceValue' id='ComplianceValue' value='<%=complianceData[5]%>'>                                                                                                        
                                                                                                                            </td>
                                                                                                                        </tr>
                                                                                                                    </table>
                                                                                                                </div>
                                                                                                            <%}%>                                                                                                                
                                                                                                            </div>
                                                                                                        </td>
                                                                                                    </tr> 
                                                                                                </table>
                                                                                            </td>
                                                                                        </tr>                                                                                          
                                                                                    </table>    
                                                                                </div>    
                                                                            </td>    
                                                                        </tr>                                                                        
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>                                                        
                                                        <tr>
                                                            <td colspan="5" class="wid100">
                                                                <div style="display:<%=ChangeLogDivDisplay%>" id="ChangeLogInventoryReportDiv">
                                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" valign="top">
                                                                        <tr>
                                                                            <td width="20%" align="left" class="formtext"><%=i18n.tr("Miscellaneous Inventory Reports").replace(" ","&nbsp;")%></td>
                                                                            <td width="80%" align="left"  class="formfield"colspan="4">
                                                                                <select id="ChangeLogReportType" name="ChangeLogReportType" style="width:330px;" class="mcopy" <%=ChangeLogreportTypeDisable%> onchange="OtherReportTimeFilter()">
                                                                                    <% if (ChangeLogReportType == 1) {%>
                                                                                    <option value="0">--<%=i18n.tr("choose")%>--</option>
                                                                                    <option value="1" selected><%=i18n.tr("Change Log Based on Hardware and Software")%></option>
                                                                                    <option value="2"><%=i18n.tr("Change Log Based on Hardware")%></option>
                                                                                    <option value="3"><%=i18n.tr("Change Log Based on Software")%></option>
                                                                                    <option value="4"><%=i18n.tr("VM Host Inventory")%></option>
                                                                                    <option value="5"><%=i18n.tr("VM Guest Inventory")%></option>
                                                                                    <option value="6"><%=i18n.tr("VM Cluster Summary")%></option>
                                                                                    <%} else if (ChangeLogReportType == 2) {%>
                                                                                    <option value="0">--<%=i18n.tr("choose")%>--</option>
                                                                                    <option value="1"><%=i18n.tr("Change Log Based on Hardware and Software")%></option>
                                                                                    <option value="2" selected><%=i18n.tr("Change Log Based on Hardware")%></option>
                                                                                    <option value="3"><%=i18n.tr("Change Log Based on Software")%></option>
                                                                                    <option value="4"><%=i18n.tr("VM Host Inventory")%></option>
                                                                                    <option value="5"><%=i18n.tr("VM Guest Inventory")%></option>
                                                                                    <option value="6"><%=i18n.tr("VM Cluster Summary")%></option>
                                                                                    <%} else if (ChangeLogReportType == 3) {%>
                                                                                    <option value="0">--<%=i18n.tr("choose")%>--</option>
                                                                                    <option value="1"><%=i18n.tr("Change Log Based on Hardware and Software")%></option>
                                                                                    <option value="2"><%=i18n.tr("Change Log Based on Hardware")%></option>
                                                                                    <option value="3" selected><%=i18n.tr("Change Log Based on Software")%></option>
                                                                                    <option value="4"><%=i18n.tr("VM Host Inventory")%></option>
                                                                                    <option value="5"><%=i18n.tr("VM Guest Inventory")%></option>
                                                                                    <option value="6"><%=i18n.tr("VM Cluster Summary")%></option>
                                                                                    <%} else if (ChangeLogReportType == 4) {%>
                                                                                    <option value="0">--<%=i18n.tr("choose")%>--</option>
                                                                                    <option value="1"><%=i18n.tr("Change Log Based on Hardware and Software")%></option>
                                                                                    <option value="2"><%=i18n.tr("Change Log Based on Hardware")%></option>
                                                                                    <option value="3"><%=i18n.tr("Change Log Based on Software")%></option>
                                                                                    <option value="4" selected><%=i18n.tr("VM Host Inventory")%></option>
                                                                                    <option value="5"><%=i18n.tr("VM Guest Inventory")%></option>
                                                                                    <option value="6"><%=i18n.tr("VM Cluster Summary")%></option>
                                                                                    <%} else if (ChangeLogReportType == 5) {%>
                                                                                    <option value="0">--<%=i18n.tr("choose")%>--</option>
                                                                                    <option value="1"><%=i18n.tr("Change Log Based on Hardware and Software")%></option>
                                                                                    <option value="2"><%=i18n.tr("Change Log Based on Hardware")%></option>
                                                                                    <option value="3"><%=i18n.tr("Change Log Based on Software")%></option>
                                                                                    <option value="4"><%=i18n.tr("VM Host Inventory")%></option>
                                                                                    <option value="5" selected><%=i18n.tr("VM Guest Inventory")%></option>
                                                                                    <option value="6"><%=i18n.tr("VM Cluster Summary")%></option>
                                                                                    <%}else if (ChangeLogReportType == 6) {%>
                                                                                    <option value="0">--<%=i18n.tr("choose")%>--</option>
                                                                                    <option value="1"><%=i18n.tr("Change Log Based on Hardware and Software")%></option>
                                                                                    <option value="2"><%=i18n.tr("Change Log Based on Hardware")%></option>
                                                                                    <option value="3"><%=i18n.tr("Change Log Based on Software")%></option>
                                                                                    <option value="4"><%=i18n.tr("VM Host Inventory")%></option>
                                                                                    <option value="5"><%=i18n.tr("VM Guest Inventory")%></option>
                                                                                    <option value="6" selected><%=i18n.tr("VM Cluster Summary")%></option>
                                                                                    <%}else {%>
                                                                                    <option value="0" selected>--<%=i18n.tr("choose")%>--</option>
                                                                                    <option value="1"><%=i18n.tr("Change Log Based on Hardware and Software")%></option>
                                                                                    <option value="2"><%=i18n.tr("Change Log Based on Hardware")%></option>
                                                                                    <option value="3"><%=i18n.tr("Change Log Based on Software")%></option>
                                                                                    <option value="4"><%=i18n.tr("VM Host Inventory")%></option>
                                                                                    <option value="5"><%=i18n.tr("VM Guest Inventory")%></option>
                                                                                    <option value="6"><%=i18n.tr("VM Cluster Summary")%></option>
                                                                                    <%}%>     
                                                                                </select>
                                                                                <input type="hidden" name="ChangeLogReportTypeHidden" id="ChangeLogReportTypeHidden" value="<%=ChangeLogReportType%>">
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="5" class="wid100">
                                                                <div id="SoftwareMeteringReportLevel" style="display:<%=displaySoftwareMeteringReportLevel%>">
                                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" valign="top">
                                                                        <tr>
                                                                            <td width="20%" align="right" class="formtext" ><%=i18n.tr("Report Level")%></td>
                                                                            <td width="80%" align="left"  class="formfield" colspan="4">
                                                                                <select id="SMReportlevel" name="SMReportlevel" class="mcopy" style="width:150px;" <%=archiveTypeDisable%>>                                                                                    
                                                                                    <%if (NodeOrSoftwareOrExeLevel.equalsIgnoreCase("0")) {%>
                                                                                    <option value="0" selected><%=i18n.tr("Node Level")%></option>
                                                                                    <%}else{%>
                                                                                    <option value="0"><%=i18n.tr("Node Level")%></option>
                                                                                    <%}if (NodeOrSoftwareOrExeLevel.equalsIgnoreCase("1")) {%>
                                                                                    <option value="1" selected><%=i18n.tr("Software Level")%></option>
                                                                                    <%}else{%>
                                                                                    <option value="1"><%=i18n.tr("Software Level")%></option>
                                                                                    <%}if (NodeOrSoftwareOrExeLevel.equalsIgnoreCase("2")) {%>
                                                                                    <option value="2" selected><%=i18n.tr("Executable Level")%></option>
                                                                                    <%}else{%>
                                                                                    <option value="2"><%=i18n.tr("Executable Level")%></option>
                                                                                    <%}%>
                                                                                </select>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr class="bottom10">
                                                            <td colspan="5" class="wid100">
                                                                <div id="NodeSelectionDiv" style="display: <%= nodeBlockDisplay%>">
                                                                    <div>
                                                                        <table  cellpadding="0" cellspacing="0" width="100%" border="0">
                                                                            <tr><td colspan="5" class="copyhdr leftPadd"><%= i18n.tr("Nodes Selection")%></td></tr>
                                                                            <tr>
                                                                                <td colspan="5">
                                                                                    <div style="display: <%= siteDisplay%>">
                                                                                        <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                                                                            <tr>
                                                                                                <td width="20%" align="right"  class="formtext"><%=new Sapphire().getSiteCaption(telantName)%></td>
                                                                                                <td width="80%" align="left"  class="formfield" colspan="4">
                                                                                                    <select id="SiteID" name="SiteID" class="mcopy" style="width:260px" multiple size="4" onclick="handelSite(this)">
                                                                                                        <%if (Sapphire.isServer) {%>
                                                                                                        <option value="All" <%=defaultSelect%> ><%= i18n.tr("All")%></option>
                                                                                                        <%}
                                                                                                            HashMap keyValue = reportsObj.getSites((String) session.getAttribute("LOGGEDUSERID"),telantName);
                                                                                                            set = keyValue.entrySet();
                                                                                                            itr = set.iterator();
                                                                                                            while (itr.hasNext()) {
                                                                                                                Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                                key = (String) (mEntry.getKey());
                                                                                                                value = (String) (mEntry.getValue());%>
                                                                                                        <option value="<%=key%>" <%= siteSelected%>><%=value%></option>
                                                                                                        <% }%>
                                                                                                    </select>
                                                                                                </td>
                                                                                            </tr>
                                                                                        </table>
                                                                                    </div>
                                                                                </td>
                                                                            </tr>
                                                                            <tr class="formfield whiteBg padding0 bottomMargin10">
                                                                                <td width="20%" align="right"  class="formtext"> <%= i18n.tr("Criteria")%></td>
                                                                                <td width="25%" align="left"  class="formfield posRelative">
                                                                                    <select id="HostsLevel1" name="HostsLevel1" class="mcopy" style="width:260px" <%= hostsDisabled%>>
                                                                                        <option value="-1">--<%=i18n.tr("choose")%>--</option>
                                                                                        <option value="0"><%= i18n.tr("All")%></option>
                                                                                        <option value="1"><%= i18n.tr("Node Level")%></option>
                                                                                        <option value="2"><%= i18n.tr("Domain Level")%></option>
                                                                                        <option value="3"><%= i18n.tr("Organization Unit Level")%></option>                                                                                        
                                                                                        <option value="4"><%= i18n.tr("Operating Systems")%></option>
                                                                                        <option value="5"><%= i18n.tr("Device Category")%></option>
                                                                                        <option value="6"><%= i18n.tr("Baseline Compliant Nodes")%></option>
                                                                                    </select>
                                                                                </td>
                                                                                <td colspan="3" class="wid100">
                                                                                    <div id="outreeDiv" style="display:none">
                                                                                        <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>
                                                                                            <td width="7%" class="formtext"><%= i18n.tr("Organization Unit Tree")%></td>
                                                                                            <td width="40%" class="formfield">
                                                                                                <select id="outree" name="outree" class="mcopy" style="width:260px">
                                                                                                    <option value="-1">--<%=i18n.tr("choose")%>--</option>
                                                                                                    <% rs = stmt.executeQuery("select locationid,locationname from locationviewmaster where locationparent = 1");
                                                                                                    while(rs.next()){%>
                                                                                                        <option value="<%=rs.getString(1)%>"><%=i18n.tr(rs.getString(2))%></option>
                                                                                                    <% }rs.close();%>
                                                                                                </select>
                                                                                            </td></tr></table>
                                                                                    </div>
                                                                                    <div id="nonOUDiv" class="hiddenDisplay">
                                                                                        <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>
                                                                                            <td width="20%" class="formtext">&nbsp;</td><td width="40%" class="formfield">&nbsp;</td>
                                                                                        </tr></table>
                                                                                    </div>
                                                                                </td>
                                                                            </tr>
                                                                            <tr class="formfield whiteBg padding0">
                                                                                <%if (reportType != 11) {%>
                                                                                <td id="domain_criteria" width="20%" align="right"  class="formtext"><%= i18n.tr("Organization Unit/Domain/OS/Device Category/Baseline Compliant Nodes")%></td>
                                                                                <%} else {%>
                                                                                <td id="domain_criteria" width="20%" align="right"  class="formtext"><%= i18n.tr("Organization Unit/Domain/Baseline Compliant Nodes")%></td>
                                                                                <%}%>
                                                                                <td width="25%" align="left"  class="formfield bottom10">
                                                                                    <select id="HostsLevel2" name="HostsLevel2" class="mcopy"  style="width:260px" <%= hostsDisabled%>>
                                                                                        <option value="">--<%= i18n.tr("choose")%>--</option>
                                                                                    </select>
                                                                                </td>
                                                                                <td width="10%" align="right" class="formtext" ><%= i18n.tr("Select&nbsp;Hosts")%> </td>
                                                                                <td width="20%"  align="left" class="formfield bottom10">
                                                                                    <select id="HostsLevel3" name="HostsLevel3" class="mcopy"  multiple size="4"  style="width:260px">
                                                                                        <%if (Sapphire.isServer && virtualSiteOnly == false) {%>
                                                                                        <option value="All&&All" selected><%= i18n.tr("All hosts of all sites")%></option>
                                                                                        <%}%>
                                                                                    </select>
                                                                                </td>
                                                                                <td align="left"  class="formfield rightAlign bottom10" valign="bottom">&nbsp;
                                                                                    <div id="SearchImg" style="display: none">
                                                                                        <span style="cursor:pointer" id="SearchHosts" onclick="showHostSearch()"><img src="search.gif" border="0" title="<%=i18n.tr("Custom node search")%>"/></span>
                                                                                    </div>
                                                                                    <input  type="button"  onClick="addNode()"  class="addbuttons greenBtn"  value="<%=i18n.tr("Add Host")%>">
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </div>
                                                                    <div>
                                                                        <table width="100%">
                                                                            <tr class="tableHeader importantFlex">
                                                                                <td width="10%" class="copyhdr">&nbsp;</td>
                                                                                <% int width = 60;
                                                     if (Sapphire.isServer) {%>
                                                                                <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Site")%></td>
                                                                                <% width = 30;
                                                     }%>
                                                                                <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Scope")%></td>
                                                                                <td width="<%= width%>%" class="copyhdr"  align="center"><%= i18n.tr("Value")%></td>
                                                                            </tr>
                                                                        </table>
                                                                    </div>
                                                                    <div id="AddHostsDiv" class="bottomMargin20">
                                                                        <%
    for (int i = 0; i < selectedHosts.size(); i++) {
        String data[] = (String[]) selectedHosts.get(i);%>
                                                                        <div id='HostsDivEdit<%=i%>'>
                                                                            <table border='0' width='100%' cellpadding="1" cellspacing="1">
                                                                                <tr class="formfield ruleList applyWid50">
                                                                                    <td width='10%' class='formfield' align="center"><span style="cursor: pointer" class="skipStyle" onclick="removeDiv('HostsDivEdit<%=i%>')"><img src="fault_x.gif" class="deleteRule" title="<%= i18n.tr("Delete Node")%>"> </span></td>
                                                                                    <%if (Sapphire.isServer) {%>
                                                                                    <td width='30%' class='formfield' align="center"><%=i18n.tr(data[1])%></td>
                                                                                    <%}%>
                                                                                    <td width='30%' class='formfield' align="center"><%=i18n.tr(data[2])%></td>
                                                                                      <%if (Sapphire.isServer) {%>
                                                                                    <td width='30%' class='formfield' align="center"><%=i18n.tr(data[3])%>
                                                                                        <%}else{%>
                                                                                      <td width='60%' class='formfield' align="center"><%=i18n.tr(data[3])%>  
                                                                                        <%}%>
                                                                                        <input type='hidden' name='SelectedHosts' id='SelectedHosts' value='<%=data[0]%>'>
                                                                                    </td>
                                                                                </tr>
                                                                            </table>
                                                                        </div>
                                                                        <%                                           }%>
                                                                    </div>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="5" class="wid100">
                                                                <div style="display:<%=patchTimeFilter%>" id ="patchTimeFilter">
                                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" valign="top">
                                                                         <tr><td colspan="5" class="copyhdr leftPadd"><%= i18n.tr("Time Filter")%></td></tr>
                                                                        <tr>
                                                                            <td align="right"  width="20%" class="formtext"><%= i18n.tr("Time Scale")%></td>
                                                                            <td width="80%"  class="formfield"  colspan="4">
                                                                                <select id="patchTimeScale" name="patchTimeScale" class="mcopy" onchange="clearPatchTimeFilter(1,'patchTimeScale','patchTimeFrom','patchTimeTo')" style="width:150px;">
                                                                                    <%  if (str_TimePeriod.equalsIgnoreCase("All")) {%>
                                                                                    <option value="All" selected><%= i18n.tr("All")%></option>
                                                                                    <%} else {%>
                                                                                    <option value="All"><%= i18n.tr("All")%></option>
                                                                                    <% }%>
                                                                                    <%= Sapphire.getTimescaleSelectList(str_TimePeriod,0,telantName,session) %>
                                                                                </select>
                                                                            </td>
                                                                        </tr>
                                                                        <%  String str_patchtime[] = {"", ""};
                                                                            if (str_TimePeriod.contains("and")) {
                                                                                str_patchtime = str_TimePeriod.split("and");                                                                                
                                                                                str_patchtime[0] = sappObj.getUserTimeZoneDate(str_patchtime[0].trim(), mysqlTimezone,conn,telantName);
                                                                                str_patchtime[1] = sappObj.getUserTimeZoneDate(str_patchtime[1].trim(), mysqlTimezone,conn,telantName);
                                                                            }%>
                                                                        <tr>
                                                                            <td align="right"  class="formtext"><%= i18n.tr("Custom")%>
                                                                                <%= i18n.tr("Time")%></td>
                                                                            <td width="300" height="35"  class="formfield">
                                                                                <label class="formtext onlyNewUI"><%= i18n.tr("From")%></label>
                                                                                <input class="mcopy" id="patchTimeFrom" type="text" name="patchTimeFrom" size="20" value="<%=str_patchtime[0]%> " onfocus="showCalendarControl(this);" onClick="clearPatchTimeFilter(2,'patchTimeScale','patchTimeFrom','patchTimeTo')">
                                                                                <label class="formtext onlyNewUI"><%= i18n.tr("To")%></label>
                                                                                <input class="mcopy" id="patchTimeTo" type="text" name="patchTimeTo" size="20" value="<%=str_patchtime[1]%> " onfocus="showCalendarControl(this);" onClick="clearPatchTimeFilter(2,'patchTimeScale','patchTimeFrom','patchTimeTo')">
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr class="bottom10">
                                                            <td colspan="5" class="wid100">
                                                                <div id="InventoryReportDiv" style="display: <%= inventoryBlockDisplay%>">
                                                                    <table cellpadding="0" cellspacing="0" width="100%" border="0">
                                                                        <tr><td colspan="6" class="copyhdr leftPadd"><%= i18n.tr("Fields Selection")%></td></tr>
                                                                        <tr>
                                                                            <td width="20%" align="right" class="formtext" ><%= i18n.tr("Filter")%></td>
                                                                            <td width="80%" align="left"  class="formfield posRelative" colspan="5">
                                                                                <select id="Filter" name="Filter" class="mcopy" style="width:260px">
                                                                                    <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                                    <%  combinedKeyValue = reportsObj.getInventoryFilters(1,telantName);
                                                                                        String groupLabel = "";
                                                                                        for (int i = 0; i < combinedKeyValue.size(); i++) {
                                                                                            String[] mEntry = (String[]) combinedKeyValue.get(i);
                                                                                            if (!groupLabel.equalsIgnoreCase(mEntry[0])) {
                                                                                                groupLabel = mEntry[0];
                                                                                                if (i > 0) {
                                                                                    %></optgroup><%                                                                 }
                                                                                    %>
                                                                                    <optgroup label="<%=i18n.tr(groupLabel)%>">
                                                                                        <%}
                                                                                            key = mEntry[1];
                                                                                            value = mEntry[2];%>
                                                                                        <option value="<%=key%>"><%=i18n.tr(value)%></option>
                                                                                        <% } %>
                                                                                    </optgroup>
                                                                                </select>
                                                                            </td>
                                                                        </tr>
                                                                        <tr class="formtext bottomMargin10">
                                                                            <td width="20%" align="right" class="formtext" ><%= i18n.tr("Type")%></td>
                                                                            <td width="21%" align="left"  class="formfield">
                                                                                <select id="Type" name="Type" class="mcopy" multiple size="4" style="width:260px"></select>
                                                                            </td>
                                                                            <td width="10%" align="center" class="formfield" >
                                                                                <span onClick="addColumn()" ><img src="right-btn.gif"></span>
                                                                                <br><br>
                                                                                <span onClick="removeOption(document.ReportsForm.SelectedColumns)"><img src="left-btn.gif"></span>
                                                                            </td>
                                                                            <td width="20%" align="left"  class="formfield">
                                                                                <select id="SelectedColumns" name="SelectedColumns" class="mcopy" multiple size="4" style="width:260px">
                                                                                    <%  set = selectedFields.entrySet();
                                                                                        itr = set.iterator();
                                                                                         if (itr.hasNext()) {
                                                                                            itr.next();
                                                                                        }
                                                                                        while (itr.hasNext()) {
                                                                                            Map.Entry mEntry = (Map.Entry) itr.next();
                                                         key = (String) (mEntry.getKey());
                                                         value = (String) (mEntry.getValue());%>
                                                                                    <option value="<%=key%>" selected><%=i18n.tr(value)%></option>
                                                                                    <%                                                }
                                                                                    %>
                                                                                </select>
                                                                            </td>
                                                                            <td width="10%" class="formfield" align="center">
                                                                                <span onClick="moveOptionUp(document.ReportsForm.SelectedColumns)" ><img src="up-btn.gif"></span>
                                                                                <br><br>
                                                                                <span onClick="moveOptionDown(document.ReportsForm.SelectedColumns)"><img src="down-btn.gif"></span>
                                                                            </td>
                                                                            <td width="15%" >&nbsp;</td>
                                                                        </tr>
                                                                        <tr><td colspan="6" class="copyhdr leftPadd"><%= i18n.tr("Advanced Filter")%></td></tr>
                                                                        <tr>
                                                                            <td width="20%" class="formtext"><%= i18n.tr("Filter")%></td>
                                                                            <td width="20%" align="left"  class="formfield">
                                                                                <select id="FilterAdv" name="FilterAdv" class="mcopy" style="width:260px">
                                                                                    <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                                    <%  combinedKeyValue = reportsObj.getInventoryFilters(2,telantName);
                                                                                        groupLabel = "";
                                                                                        for (int i = 0; i < combinedKeyValue.size(); i++) {
                                                                                            String[] mEntry = (String[]) combinedKeyValue.get(i);
                                                                                            if (!groupLabel.equalsIgnoreCase(mEntry[0])) {
                                                                                                groupLabel = mEntry[0];
                                                                                                if (i > 0) {
                                                                                    %></optgroup><%                                                                 }
                                                                                    %>
                                                                                    <optgroup label="<%=i18n.tr(groupLabel)%>">
                                                                                        <%}
                                                                                            key = mEntry[1];
                                                                                            value = mEntry[2];%>
                                                                                        <option value="<%=key%>"><%=i18n.tr(value)%></option>
                                                                                        <% } %>
                                                                                    </optgroup>
                                                                                </select>
                                                                            </td>
                                                                            <td width=10%" class="formtext top10"><%= i18n.tr("Type")%></td>
                                                                            <td width="20%" align="left"  class="formfield" colspan="2">
                                                                                <select id="TypeAdv" name="TypeAdv" class="mcopy" style="width:260px">
                                                                                    <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                                </select>
                                                                            </td>
                                                                            <td width=20%" class="formtext hiddenDisplay">&nbsp;</td>
                                                                        </tr>
                                                                        <tr class="formtext">
                                                                            <td width="20%" class="formtext"><%= i18n.tr("Criteria")%></td>
                                                                            <td width="20%" align="left"  class="formfield">
                                                                                <select id="Criteria" name="Criteria" class="mcopy" style="width:260px" onchange="displatNoteDiv(this.value)" >
                                                                                    <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                                </select>
                                                                            </td>
                                                                            <td width="10%" class="formtext top10"><%= i18n.tr("Value")%></td>
                                                                            <td width="20%" align="left"  class="formfield rightAlign wid100" colspan="2" align="left">
                                                                                    <div id="AdvFilterValue_TextBoxDiv" name="AdvFilterValue_TextBoxDiv" style="display: block;">
                                                                                        <input type="text" id="ValueAdv" name="ValueAdv" class="mcopy" size="45">
                                                                                        <input  type="button"  value=" <%=i18n.tr("Add")%> "  class="addbuttons greenBtn"  onclick="addAdvFilters()">
                                                                                    </div>
                                                                                    <div id="AdvFilterValue_SelectBoxDiv" name="AdvFilterValue_SelectBoxDiv" style="display: none;">
                                                                                        <select id="ValueAdv_selectBox" name="ValueAdv_selectBox" class="mcopy" style="width:260px">
                                                                                            <option value="" selected>--<%=i18n.tr("choose")%>--</option>
                                                                                            <option value="Yes"><%= i18n.tr("Yes")%></option>
                                                                                            <option value="No"><%= i18n.tr("No")%></option>
                                                                                        </select>
                                                                                        <input  type="button"  value=" <%=i18n.tr("Add")%> "  class="addbuttons"  onclick="addAdvFilters()">
                                                                                    </div>
                                                                            </td>
                                                                            <td class="">
                                                                                <div  id="noteDivsion" name="noteDivsion" style="display: none;">
                                                                                    <img src='Note.gif' /><%= i18n.tr("Note: Example search pattern is \"1 and 2\"")%>
                                                                                </div>
                                                                            </td>
                                                                        </tr>
                                                                        <tr class="bottomMargin10">
                                                                            <td colspan="6" class="wid100">
                                                                                <table border="0" width="100%">
                                                                                    <tr class="tableHeader importantFlex">
                                                                                        <td width="10%" class="copyhdr"  align="center">&nbsp;</td>
                                                                                        <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Type")%></td>
                                                                                        <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Criteria")%></td>
                                                                                        <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Value")%></td>
                                                                                    </tr>
                                                                                    <tr>
                                                                                        <td colspan="4" class="wid100">
                                                                                            <div id="InventoryReportAdvFilterDiv">
                                                                                                <%  for (int i = 0; i < filterData.size(); i++) {
                                                                                                        String data[] = (String[]) filterData.get(i);
                                                                                                        String operatorText = data[4];
                                                                                                        if (operatorText.equals(">")) {
                                                                                                            operatorText = i18n.tr("GREATER THAN");
                                                                                                        } else if (operatorText.equals("<")) {
                                                                                                            operatorText = i18n.tr("LESS THAN");
                                                                                                        } else if (operatorText.equals("=")) {
                                                                                                            operatorText = i18n.tr("EQUALS");
                                                                                                        } else if (operatorText.equals("!=")) {
                                                                                                            operatorText = i18n.tr("NOT EQUALS");
                                                                                                        }%>
                                                                                                <div id='FilterDivEdit<%=i%>'>
                                                                                                    <table border='0' width='100%' cellpadding="1" cellspacing="1">
                                                                                                        <tr class="formfield ruleList applyWid50">
                                                                                                            <td width='10%' class='formfield' align="center"><span style="cursor: pointer" class="skipStyle" onclick="removeDiv('FilterDivEdit<%=i%>')"><img src="fault_x.gif" class="deleteRule" title="<%=i18n.tr("Delete filter")%>"> </span></td>
                                                                                                            <td width='30%' class='formfield' align="left"><%=i18n.tr(data[1])%></td>
                                                                                                            <td width='30%' class='formfield' align="left"><%=operatorText.toUpperCase()%></td>
                                                                                                            <td width='30%' class='formfield' align="left"><%=i18n.tr(data[5])%>
                                                                                                                <input type='hidden' name='FilterConfigDetailsID' id='FilterConfigDetailsID' value='<%=data[0]%>'>
                                                                                                                <input type='hidden' name='FilterName' id='FilterName' value="<%=data[2]%>">
                                                                                                                <input type='hidden' name='FilterDisplayName' id='FilterDisplayName' value='<%=data[1]%>'>
                                                                                                                <input type='hidden' name='FilterOperator' id='FilterOperator' value='<%=data[4]%>'>
                                                                                                                <input type='hidden' name='FilterValue' id='FilterValue' value='<%=data[5]%>'>
                                                                                                                <input type='hidden' name='FilterTableName' id='FilterTableName' value='<%=data[3]%>'>
                                                                                                            </td>
                                                                                                        </tr>
                                                                                                    </table>
                                                                                                </div>
                                                                                                <%                                                             }%>
                                                                                            </div>
                                                                                        </td>
                                                                                    </tr>
                                                                                </table>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <% } %>
                                                        <tr>
                                                            <td colspan="5" class="wid100">
                                                                <div id="AssetReportsDiv" style="display: <%= assetBlockDisplay%>">
 <!-- ****************************************** Block For Asset Aalytical report Starts here******************************************************************* -->
                                                                    <input type="hidden" name="report_template" id="report_template" value="<%=reportTemplate%>">
                                                                    <table width='100%' cellpadding="5" cellspacing="0" border="0">
                                                                        <tr>
                                                                            <td class='formtext wid100' width="20%">
                       <%= i18n.tr("Level One Filter")%>
                                                                            </td>
                                                                            <td class='formfield wid100' width='33%'>
                                                                                <select id="Assetfilterone" name="Assetfilterone" class="gen assetInventorySingleSelect" style="width: 260px">
                                                                                    <option value="">-------- <%= i18n.tr("Select Filter")%> ---------</option>
                                                                                    <% String assetModuleName =new Sapphire().getAssetModuleName(AssetModuleID+"",telantName); %>
                                                                                    <optgroup label="<%=assetModuleName%> Fixed Fields">
                                                                                    <%  String data[] = reportsObj.getAssetSelectedFilters(reportID, 1,telantName);
                                                                                        String selectedFilter = data[0];
                                                                                        if ("assetmaster.AssetID".equalsIgnoreCase(selectedFilter)) {%>
                                                                                        <option value="assetmaster.AssetID" selected="selected"><%= i18n.tr("Asset Number")%></option>
                                                                                        <%} else {%>
                                                                                        <option value="assetmaster.AssetID"><%= i18n.tr("Asset Number")%></option>
                                                                                        <%}if ("assetmaster.assetCreationTime".equalsIgnoreCase(selectedFilter)) {%>
                                                                                        <option value="assetmaster.assetCreationTime" selected="selected"><%= i18n.tr("Asset Creation Time")%></option>
                                                                                        <%} else {%>
                                                                                        <option value="assetmaster.assetCreationTime"><%= i18n.tr("Asset Creation Time")%></option>
                                                                                        <%}if ("assetmaster.ItemTypeID".equalsIgnoreCase(selectedFilter)) {%>
                                                                                        <option value="assetmaster.ItemTypeID" selected="selected"><%= i18n.tr("Asset Type")%></option>
                                                                                        <%} else {%>
                                                                                        <option value="assetmaster.ItemTypeID"><%= i18n.tr("Asset Type")%></option>
                                                                                        <%} key = new String("");
                                                                                            value = new String("");
                                                                                            assetFixedFields = new ServiceDeskReportsDBUtil().getAssetDBFields("Asset Management Report",AssetModuleID,telantName);
                                                                                            set = assetFixedFields.entrySet();
                                                                                            itr = set.iterator();
                                                                                            while (itr.hasNext()) {
                                                                                                Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                key = (String) (mEntry.getKey());
                                                                                                value = (String) (mEntry.getValue());
                                                                                                if ((key).equalsIgnoreCase(selectedFilter)) {%>
                                                                                        <option value='<%=key%>' selected><%=i18n.tr(value)%></option>
                                                                                        <%} else {%>
                                                                                        <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                                        <%      }
                                                                                            }%>
                                                                                    </optgroup>
                                                                                    <%if(AssetModuleID.equalsIgnoreCase("1")){%>
                                                                                    <optgroup label="<%=i18n.tr("Asset Custom Fields")%>">
                                                                                        <%  assetCustomFields = new ServiceDeskReportsDBUtil().getAssetCustomFields("", "",AssetModuleID+"||Report",telantName);
                                                                                            set = assetCustomFields.entrySet();
                                                                                            itr = set.iterator();
                                                                                            while (itr.hasNext()) {
                                                                                                Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                key = (String) (mEntry.getKey());
                                                                                                value = (String) (mEntry.getValue());
                                                                                                if ((key).equalsIgnoreCase(selectedFilter)) {%>
                                                                                        <option value='<%=key%>' selected><%=i18n.tr(value)%></option>
                                                                                        <%} else {%>
                                                                                        <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                                        <%      }
                                                                                            }%>
                                                                                    </optgroup>
                                                                                    <% } %>
                                                                                    <%List userDefineAssetIds =new ServiceDeskReportsDBUtil().getUserDefinedAssets(telantName);
                                                                                                  if(!userDefineAssetIds.isEmpty())
                                                                                                  {
                                                                                                      for(Object moduleId:userDefineAssetIds)
                                                                                                      {
                                                                                                           assetModuleName =new Sapphire().getAssetModuleName(moduleId+"",telantName);
                                                                                                           if(AssetModuleID.equalsIgnoreCase(moduleId+"")){ %>
                                                                                                      <optgroup label="<%=assetModuleName%> Custom Fields">
                                                                                                           <%  assetCustomFields = new ServiceDeskReportsDBUtil().getUserDefineAssetdCustomFeilds("", "",moduleId+"||Report",telantName);
                                                                                                               set = assetCustomFields.entrySet();
                                                                                                               itr = set.iterator();
                                                                                                               while (itr.hasNext()) {
                                                                                                                      Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                                      key = (String) (mEntry.getKey());
                                                                                                                      value = (String) (mEntry.getValue());
                                                                                                    %>                                                                                                                                                                                                              
                                                                                                    <option value='ASSET_FIELDS-<%=key%>'><%=value%></option>
                                                                                                    <% } %>
                                                                                                    </optgroup>
                                                                                                <%
                                                                                                      }
                                                                                                  }}
                                                                                                %>
                                                                                    <% assetModuleName =new Sapphire().getAssetModuleName(AssetModuleID+"",telantName);%>
                                                                                    <optgroup label="<%=assetModuleName%> LifeCycle Fields">
                                                                                        <%  assetLyfeCycleFields = new ServiceDeskReportsDBUtil().getAssetLifeCycleFields("",AssetModuleID,telantName);
                                                                                            set = assetLyfeCycleFields.entrySet();
                                                                                            itr = set.iterator();
                                                                                            while (itr.hasNext()) {
                                                                                                Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                key = (String) (mEntry.getKey());
                                                                                                value = (String) (mEntry.getValue());
                                                                                                if ((key).equalsIgnoreCase(selectedFilter)) {%>
                                                                                        <option value='<%=key%>' selected><%=i18n.tr(value)%></option>
                                                                                        <%} else { %>
                                                                                        <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                                        <%      }
                                                                                            }%>
                                                                                    </optgroup>
                                                                                    <% if(!assetDisplayType.equalsIgnoreCase("0")){ %>
                                                                                    <optgroup label="<%=i18n.tr(assetModuleName+" Preshipped Fixed Fields")%>">
                                                                                        <%     assetCustomFields = new ServiceDeskReportsDBUtil().getAssetFixedFields("","",AssetModuleID,telantName);
                                                                                               set = assetCustomFields.entrySet();
                                                                                               itr = set.iterator();
                                                                                               while(itr.hasNext()){ 
                                                                                                  Map.Entry mEntry = (Map.Entry)itr.next();
                                                                                                  key   = (String)(mEntry.getKey() );
                                                                                                  value = (String)(mEntry.getValue());
                                                                                                  if ((key).equalsIgnoreCase(selectedFilter)) {%>
                                                                                               <option value='<%=key%>' selected><%=i18n.tr(value)%></option>
                                                                                               <%} else {%>
                                                                                               <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                                               <% }
                                                                                               }%>
                                                                                    </optgroup>
                                                                                    <% } %>
                                                                                    <optgroup label="<%=i18n.tr(assetModuleName+" Userdefined Fields")%>">
                                                                                        <%  assetLyfeCycleFields = new ServiceDeskReportsDBUtil().getAssetUserDefinedFields(telantName);
                                                                                            set = assetLyfeCycleFields.entrySet();
                                                                                            itr = set.iterator();
                                                                                            while (itr.hasNext()) {
                                                                                                Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                key = "ASSET_CUSTOMFIELDS-" + (String) (mEntry.getKey());
                                                                                                value = (String) (mEntry.getValue());
                                                                                                if ((key).equalsIgnoreCase(selectedFilter)) {%>
                                                                                        <option value='<%=key%>' selected><%=value%></option>
                                                                                        <%} else {%>
                                                                                        <option value='<%=key%>'><%=value%></option>
                                                                                        <%      }
                                                                                            }%>
                                                                                    </optgroup>
                                                                                     <optgroup label= "<%= i18n.tr("Allocate to User Fields")%>">
                                                                                                    <%  allocateToUserFields = new ServiceDeskReportsDBUtil().getUserFixedFields("",telantName);
                                                                                                        set = allocateToUserFields.entrySet();
                                                                                                        itr = set.iterator();
                                                                                                        while (itr.hasNext()) {
                                                                                                            Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                            key = (String) (mEntry.getKey());
                                                                                                            value = ((String)(mEntry.getValue())).trim();
                                                                                                            String key_2 = "USER_FIXEDFIELD-"+key;
                                                                                                                if ((key_2).equalsIgnoreCase(selectedFilter)) {%>
                                                                                                                   <option value='<%=key_2%>' selected><%=value%></option>
                                                                                                               <%}else {%>
                                                                                                                   <option value='USER_FIXEDFIELD-<%=key%>'><%=i18n.tr(value)%></option>
                                                                                                               <%}
                                                                                                        }allocateToUserFields = new ServiceDeskReportsDBUtil().getUserCustomFields("",telantName);
                                                                                                        set = allocateToUserFields.entrySet();
                                                                                                        itr = set.iterator();
                                                                                                        while (itr.hasNext()) {
                                                                                                            Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                            key = (String) (mEntry.getKey());
                                                                                                            value = ((String)(mEntry.getValue())).trim();%>
                                                                                                            <option value='USER_CUSTOMFIELD-<%=key%>'><%=i18n.tr(value)%></option>
                                                                                                        <%}%>
                                                                                    </optgroup>
                                                                                </select>
                                                                                <input type="hidden" name="Assetfilteronesub" id="Assetfilteronesub" value="<%=data[1]%>"/>
                                                                                <input type="hidden" name="Assetfilteronename" id="Assetfilteronename" value="<%=selectedFilter%>"/>
                                                                            </td>
                                                                            <td class='formfield wid100 topMargin30 importantFlex'>
                                                                                <select style='width:360px;' id="Assetfilteronevalues" name="Assetfilteronevalues" class="gen" size='5' multiple="multiple" >
                                                                                </select>	                       	
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td class='formtext wid100'>
                       	<%=i18n.tr("Level Two Filter")%>
                                                                            </td>
                                                                            <td class='formfield wid100'>
                                                                                <select id="Assetfiltertwo" name="Assetfiltertwo" class="gen assetInventorySingleSelect" style="width: 260px">
                                                                                    <option value="">-------- <%= i18n.tr("Select Filter")%> ---------</option>
                                                                                    <% assetModuleName =new Sapphire().getAssetModuleName(AssetModuleID+"",telantName);%>
                                                                                    <optgroup label="<%=assetModuleName%> Fixed Fields">
                                                                                        <% data = reportsObj.getAssetSelectedFilters(reportID, 2,telantName);
                                     selectedFilter = data[0];
                                     if ("assetmaster.AssetID".equalsIgnoreCase(selectedFilter)) {%>
                                                                                        <option value="assetmaster.AssetID" selected="selected"><%= i18n.tr("Asset Number")%></option>
                                                                                        <%} else {%>
                                                                                        <option value="assetmaster.AssetID"><%= i18n.tr("Asset Number")%></option>
                                                                                        <%}
                                     if ("assetmaster.assetCreationTime".equalsIgnoreCase(selectedFilter)) {%>
                                                                                        <option value="assetmaster.assetCreationTime" selected="selected"><%= i18n.tr("Asset Creation Time")%></option>
                                                                                        <%} else {%>
                                                                                        <option value="assetmaster.assetCreationTime"><%= i18n.tr("Asset Creation Time")%></option>
                                                                                        <%  }
                                     
                                     if ("assetmaster.ItemTypeID".equalsIgnoreCase(selectedFilter)) {%>
                                                                                        <option value="assetmaster.ItemTypeID" selected="selected"><%= i18n.tr("Asset Type")%></option>
                                                                                        <%} else {%>
                                                                                        <option value="assetmaster.ItemTypeID"><%= i18n.tr("Asset Type")%></option>
                                                                                        <%}                                                                                            
                                                                                            key = new String("");
                                                                                            value = new String("");
                                                                                            assetFixedFields = new ServiceDeskReportsDBUtil().getAssetDBFields("Asset Management Report",AssetModuleID,telantName);
                                                                                            set = assetFixedFields.entrySet();
                                                                                            itr = set.iterator();
                                                                                            while (itr.hasNext()) {
                                                                                                Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                key = (String) (mEntry.getKey());
                                                                                                value = (String) (mEntry.getValue());
                                                                                                if ((key).equalsIgnoreCase(selectedFilter)) {%>
                                                                                        <option value='<%=key%>' selected><%=i18n.tr(value)%></option>
                                                                                        <%} else {%>
                                                                                        <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                                        <%      }
                                                                                            }%>
                                                                                    </optgroup>
                                                                                    <%if(AssetModuleID.equalsIgnoreCase("1")){%>
                                                                                    <optgroup label="<%=i18n.tr("Asset Custom Fields")%>">
                                                                                        <%  assetCustomFields = new ServiceDeskReportsDBUtil().getAssetCustomFields("", "",AssetModuleID+"||Report",telantName);
                                                                                            set = assetCustomFields.entrySet();
                                                                                            itr = set.iterator();
                                                                                            while (itr.hasNext()) {
                                                                                                Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                key = (String) (mEntry.getKey());
                                                                                                value = (String) (mEntry.getValue());
                                                                                                if ((key).equalsIgnoreCase(selectedFilter)) {%>
                                                                                        <option value='<%=key%>' selected><%=i18n.tr(value)%></option>
                                                                                        <%} else {%>
                                                                                        <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                                        <%      }
                                                                                            }%>
                                                                                    </optgroup>
                                                                                    <% } %>
                                                                                    <% userDefineAssetIds =new ServiceDeskReportsDBUtil().getUserDefinedAssets(telantName);
                                                                                                  if(!userDefineAssetIds.isEmpty())
                                                                                                  {
                                                                                                      for(Object moduleId:userDefineAssetIds)
                                                                                                      {
                                                                                                           assetModuleName =new Sapphire().getAssetModuleName(moduleId+"",telantName);
                                                                                                           if(AssetModuleID.equalsIgnoreCase(moduleId+"")){ %>
                                                                                                      <optgroup label="<%=assetModuleName%> Custom Fields">
                                                                                                           <%  assetCustomFields = new ServiceDeskReportsDBUtil().getUserDefineAssetdCustomFeilds("", "",moduleId+"||Report",telantName);
                                                                                                               set = assetCustomFields.entrySet();
                                                                                                               itr = set.iterator();
                                                                                                               while (itr.hasNext()) {
                                                                                                                      Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                                      key = (String) (mEntry.getKey());
                                                                                                                      value = (String) (mEntry.getValue());
                                                                                                    %>                                                                                                                                                                                                              
                                                                                                    <option value='ASSET_FIELDS-<%=key%>'><%=value%></option>
                                                                                                    <% } %>
                                                                                                    </optgroup>
                                                                                                <%
                                                                                                      }
                                                                                                  }}
                                                                                                %>
                                                                                    <% assetModuleName =new Sapphire().getAssetModuleName(AssetModuleID+"",telantName);%>
                                                                                    <optgroup label="<%=assetModuleName%> LifeCycle Fields">
                                                                                        <%  assetLyfeCycleFields = new ServiceDeskReportsDBUtil().getAssetLifeCycleFields("",AssetModuleID,telantName);
                                                                                            set = assetLyfeCycleFields.entrySet();
                                                                                            itr = set.iterator();
                                                                                            while (itr.hasNext()) {
                                                                                                Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                key = (String) (mEntry.getKey());
                                                                                                value = (String) (mEntry.getValue());
                                                                                                if ((key).equalsIgnoreCase(selectedFilter)) {%>
                                                                                        <option value='<%=key%>' selected><%=i18n.tr(value)%></option>
                                                                                        <%} else {%>
                                                                                        <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                                        <%      }
                                                                                            }%>
                                                                                    </optgroup>
                                                                                    <% if(!assetDisplayType.equalsIgnoreCase("0")){ %>
                                                                                    
                                                                                    <optgroup label="<%=i18n.tr(assetModuleName+" Preshipped Fixed Fields")%>">
                                                                                        <%     assetCustomFields = new ServiceDeskReportsDBUtil().getAssetFixedFields("","",AssetModuleID,telantName);
                                                                                               set = assetCustomFields.entrySet();
                                                                                               itr = set.iterator();
                                                                                               while(itr.hasNext()){ 
                                                                                                    Map.Entry mEntry = (Map.Entry)itr.next();
                                                                                                    key   = (String)(mEntry.getKey() );
                                                                                                    value = (String)(mEntry.getValue());
                                                                                                    if ((key).equalsIgnoreCase(selectedFilter)) {
                                                                                                    %>
                                                                                                    <option value='<%=key%>' selected><%=i18n.tr(value)%></option>
                                                                                                    <%} else {
                                                                                                    %>
                                                                                                    <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                                                    <%}
                                                                                               }%>
                                                                                    </optgroup>
                                                                                    <% } %>
                                                                                    <optgroup label="<%= i18n.tr(assetModuleName+" User Defined Fields")%>">
                                                                                        <% assetLyfeCycleFields = new ServiceDeskReportsDBUtil().getAssetUserDefinedFields(telantName);
                                                                                            set = assetLyfeCycleFields.entrySet();
                                                                                            itr = set.iterator();
                                                                                            while (itr.hasNext()) {
                                                                                                Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                key = "ASSET_CUSTOMFIELDS-" + (String) (mEntry.getKey());
                                                                                                value = (String) (mEntry.getValue());
                                                                                                if ((key).equalsIgnoreCase(selectedFilter)) { %>
                                                                                        <option value='<%=key%>' selected><%=i18n.tr(value)%></option>
                                                                                        <% } else { %>
                                                                                        <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                                        <%      }
                                                                                            }%>
                                                                                    </optgroup>
                                                                                    
                                                                                     <optgroup label= "<%= i18n.tr("Allocate to User Fields")%>">
                                                                                          <%            allocateToUserFields = new ServiceDeskReportsDBUtil().getUserFixedFields("",telantName);
                                                                                                        set = allocateToUserFields.entrySet();
                                                                                                        itr = set.iterator();
                                                                                                        while (itr.hasNext()) {
                                                                                                            Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                            key = (String) (mEntry.getKey());
                                                                                                            value = ((String)(mEntry.getValue())).trim();
                                                                                                            String key_2 = "USER_FIXEDFIELD-"+key;
                                                                                                                if ((key_2).equalsIgnoreCase(selectedFilter)) {%>
                                                                                                                     <option value='<%=key_2%>' selected><%=value%></option>
                                                                                                               <%} else {%>
                                                                                                                     <option value='USER_FIXEDFIELD-<%=key%>'><%=i18n.tr(value)%></option>
                                                                                                               <%}
                                                                                                          }     
                                                                                                        allocateToUserFields = new ServiceDeskReportsDBUtil().getUserCustomFields("",telantName);
                                                                                                        set = allocateToUserFields.entrySet();
                                                                                                        itr = set.iterator();
                                                                                                        while (itr.hasNext()) {
                                                                                                            Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                            key = (String) (mEntry.getKey());
                                                                                                            value = ((String)(mEntry.getValue())).trim();
                                                                                                         %>
                                                                                                       <option value='USER_CUSTOMFIELD-<%=key%>'><%=i18n.tr(value)%></option>
                                                                                                       <%}%>
                                                                                    </optgroup>
                                                                                </select>
                                                                                <input type="hidden" name="Assetfiltertwosub" id="Assetfiltertwosub" value="<%=data[1]%>"/>
                                                                                <input type="hidden" name="Assetfiltertwoname" id="Assetfiltertwoname" value="<%=selectedFilter%>"/>
                                                                            </td>
                                                                            <td class='formfield wid100 topMargin30 importantFlex'>
                                                                                <select style='width:360px;' id="Assetfiltertwovalues" name="Assetfiltertwovalues" class="gen" size='5' multiple="multiple">
                                                                                </select>	                       	
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr class="noTopMargin">
                                                            <td colspan="5" class="wid100">
                                                                <div id="AssetSummaryDiv" style="display: <%= assetSummaryBlockDisplay%>">
                                                                    <table width="100%" cellpadding="0" cellspacing="0">
                                                                        <tr>
                                                                            <td colspan="2">
                                                                                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                                                                    <tr class="formfield bgTransparentImp">
                                                                                        <td align='right' bgcolor='#FFFFFF' class='formtext' width="20%" ><%= i18n.tr("Select Fields")%> &nbsp;&nbsp;</td>
                                                                                        <td bgcolor='#FFFFFF' class='formfield' width="10%" align="left">
                                                                                            <select id='report_defualt_fields' name='report_defualt_fields' class='gen' size='10' style='width:260px;' multiple >
                                                                                                <%  String data1[] = reportsObj.getAssetSelectedFilters(reportID, 3,telantName); 
                                                                                                assetModuleName =new Sapphire().getAssetModuleName(AssetModuleID+"",telantName);%>
                                                                                                <optgroup label="<%=assetModuleName%> Fixed Fields">
                                                                                                    <option value="ASSET_FIELDS-assetmaster.AssetID"><%= i18n.tr("Asset Number")%></option>
                                                                                                    <option value="ASSET_FIELDS-assetmaster.ItemTypeID"><%= i18n.tr("Asset Type")%></option>
                                                                                                     <option value="ASSET_FIELDS-assetmaster.assetCreationTime"><%= i18n.tr("Asset Creation Time")%></option>
                                                                                                        <% assetFixedFields = new ServiceDeskReportsDBUtil().getAssetDBFields("Asset Management Report",AssetModuleID,telantName);
                                                                                                        set = assetFixedFields.entrySet();
                                                                                                        itr = set.iterator();
                                                                                                        while (itr.hasNext()) {
                                                                                                            Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                            key = (String) (mEntry.getKey());
                                                                                                            value = (String) (mEntry.getValue());
                                                                                                    %>
                                                                                                    <option value='ASSET_FIELDS-<%=key%>'><%=i18n.tr(value)%></option>
                                                                                                    <%  } %>
                                                                                                </optgroup>
                                                                                                <%if(AssetModuleID.equalsIgnoreCase("1")){%>
                                                                                                <optgroup label="<%=i18n.tr("Asset Custom Fields")%>">
                                                                                                    <%  assetCustomFields = new ServiceDeskReportsDBUtil().getAssetCustomFields("", "",AssetModuleID+"||Report",telantName);
                                                                                                        set = assetCustomFields.entrySet();
                                                                                                        itr = set.iterator();
                                                                                                        while (itr.hasNext()) {
                                                                                                            Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                            key = (String) (mEntry.getKey());
                                                                                                            value = (String) (mEntry.getValue());
                                                                                                    %>
                                                                                                    <option value='ASSET_FIELDS-<%=key%>'><%=i18n.tr(value)%></option>
                                                                                                    <% } %>
                                                                                                </optgroup>
                                                                                                <% } %>
                                                                                                <%                                                                                                                                                                                                  
                                                                                                  userDefineAssetIds =new ServiceDeskReportsDBUtil().getUserDefinedAssets(telantName);
                                                                                                  if(!userDefineAssetIds.isEmpty())
                                                                                                  {
                                                                                                      for(Object moduleId:userDefineAssetIds)
                                                                                                      {
                                                                                                           assetModuleName =new Sapphire().getAssetModuleName(moduleId+"",telantName);
                                                                                                            if(AssetModuleID.equalsIgnoreCase(moduleId+"")){ %>
                                                                                                      <optgroup label="<%=assetModuleName%>-Custom Fields">
                                                                                                           <%  assetCustomFields = new ServiceDeskReportsDBUtil().getUserDefineAssetdCustomFeilds("", "",moduleId+"||Report",telantName);
                                                                                                               set = assetCustomFields.entrySet();
                                                                                                               itr = set.iterator();
                                                                                                               while (itr.hasNext()) {
                                                                                                                      Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                                      key = (String) (mEntry.getKey());
                                                                                                                      value = (String) (mEntry.getValue());
                                                                                                    %>                                                                                                                                                                                                              
                                                                                                    <option value='ASSET_FIELDS-<%=key%>'><%=value%></option>
                                                                                                    <% } %>
                                                                                                    </optgroup>
                                                                                                <%
                                                                                                     } }
                                                                                                      }
                                                                                                %>
                                                                                                <% assetModuleName =new Sapphire().getAssetModuleName(AssetModuleID+"",telantName);%>
                                                                                                <optgroup label="<%=assetModuleName%> LifeCycle Fields">
                                                                                                    <%  assetLyfeCycleFields = new ServiceDeskReportsDBUtil().getAssetLifeCycleFields("",AssetModuleID,telantName);
                                                                                                        set = assetLyfeCycleFields.entrySet();
                                                                                                        itr = set.iterator();
                                                                                                        while (itr.hasNext()) {
                                                                                                            Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                            key = (String) (mEntry.getKey());
                                                                                                            value = (String) (mEntry.getValue());
                                                                                                    %>
                                                                                                    <option value='ASSET_FIELDS-<%=key%>'><%=i18n.tr(value)%></option>
                                                                                                    <% } %>
                                                                                                </optgroup>
                                                                                                <% if(!assetDisplayType.equalsIgnoreCase("0")){ %>
                                                                                                <optgroup label="<%=i18n.tr(assetModuleName+" Preshipped Fixed Fields")%>">
                                                                                                    <%     assetCustomFields = new ServiceDeskReportsDBUtil().getAssetFixedFields("","",AssetModuleID,telantName);
                                                                                                           set = assetCustomFields.entrySet();
                                                                                                           itr = set.iterator();
                                                                                                           while(itr.hasNext()){ 
                                                                                                                Map.Entry mEntry = (Map.Entry)itr.next();
                                                                                                                key   = (String)(mEntry.getKey() );
                                                                                                                value = (String)(mEntry.getValue());
                                                                                                         %>
                                                                                                            <option value='ASSET_FIELDS-<%=key%>'><%=i18n.tr(value)%></option>
                                                                                                    <% } %>
                                                                                                </optgroup>
                                                                                                <% } %>
                                                                                                <optgroup label="<%=i18n.tr(assetModuleName+" User Defined Fields")%>">
                                                                                                    <%  assetLyfeCycleFields = new ServiceDeskReportsDBUtil().getAssetUserDefinedFields(telantName);
                                                                                                        set = assetLyfeCycleFields.entrySet();
                                                                                                        itr = set.iterator();
                                                                                                        while (itr.hasNext()) {
                                                                                                            Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                            key = (String) (mEntry.getKey());
                                                                                                            value = (String) (mEntry.getValue());
                                                                                                    %>
                                                                                                    <option value='ASSET_CUSTOMFIELDS-<%=key%>'><%=i18n.tr(value)%></option>
                                                                                                    <% } %>
                                                                                                </optgroup>
                                                                                                <optgroup label="<%= i18n.tr("Allocate To User Fields")%>">
                                                                                                    <%  allocateToUserFields = new ServiceDeskReportsDBUtil().getUserFixedFields("",telantName);
                                                                                                        set = allocateToUserFields.entrySet();
                                                                                                        itr = set.iterator();
                                                                                                        while (itr.hasNext()) {
                                                                                                            Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                            key = (String) (mEntry.getKey());
                                                                                                            value = ((String) (mEntry.getValue())).trim();
                                                                                                    %>
                                                                                                     <option value='USER_FIXEDFIELD-<%=key%>'><%=i18n.tr(value)%></option>
                                                                                                     <%}%>
                                                                                                     <% allocateToUserFields = new ServiceDeskReportsDBUtil().getUserCustomFields("",telantName);
                                                                                                        set = allocateToUserFields.entrySet();
                                                                                                        itr = set.iterator();
                                                                                                        while (itr.hasNext()) {
                                                                                                            Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                            key = (String) (mEntry.getKey());
                                                                                                            value = ((String) (mEntry.getValue())).trim();
                                                                                                    %>
                                                                                                     <option value='USER_CUSTOMFIELD-<%=key%>'><%=i18n.tr(value)%></option>
                                                                                                     <%}%>
                                                                                                </optgroup>
                                                                                            </select>
                                                                                            <input type="hidden" name="assetsummarysub" id="assetsummarysub" value="<%=data1[1]%>"/>
                                                                                        </td>
                                                                                        <td width='15%' align='center' bgcolor='#FFFFFF' class='formfield'>
                                                                                            <span onClick='addAssetSummaryField()' ><img src="right-btn.gif"></span>
                                                                                            <br class="hiddenDisplay"><br>
                                                                                            <span onClick="deleteAssetSummaryField()" ><img src="left-btn.gif"></span>
                                                                                        </td>
                                                                                        <td bgcolor='#FFFFFF' height='36' class='formfield' width="10%" align="left">
                                                                                            <select id='report_selected_fields' name='report_selected_fields' class='gen' size='10' style='width:260px;' multiple>
                                                                                                <%  if (request.getParameter("ReportID") != null) {
                                                                                                        String selected_fieldNames = "";
                                                                                                        String deualt_fieldNames = "";
                                                                                                        rs = stmt.executeQuery("select ParamID,systems from saved_reports where SNo=" + reportID + "");
                                                                                                        while (rs.next()) {
                                                                                                            deualt_fieldNames = rs.getString(1);
                                                                                                            selected_fieldNames = rs.getString(2);
                                                                                                        }rs.close();
                                                                                                        String[] default_strToken = deualt_fieldNames.split("\\,");
                                                                                                        String[] selected_strToken = selected_fieldNames.split("\\,");
                                                                                                        //taking column names from db
                                                                                                        Map dbKeyValueList = new ServiceDeskReportsDBUtil().getAssetDBFields("Asset Allocation Report",telantName);
                                                                                                        for (int i = 0; i < selected_strToken.length; i++) {
                                                                                                            int flag = 0;
                                                                                                            String columnID = selected_strToken[i].replace("ASSET_FIELDS-", "");
                                                                                                            String columnname = "";
                                                                                                            try {
                                                                                                                if (columnID.contains("ASSET_CUSTOMFIELDS-")) {
                                                                                                                    columnID = columnID.replace("ASSET_CUSTOMFIELDS-", "");
                                                                                                                    rs = stmt.executeQuery("select DisplayName from assetreport_configparams where report_type=1 and sno=" + columnID);
                                                                                                                    if (rs.next()) {
                                                                                                                        columnname = rs.getString(1);
                                                                                                                    }rs.close();
                                                                                                                } else  if (columnID.contains("USER_FIXEDFIELD-")) {
                                                                                                                    columnID = columnID.replace("USER_FIXEDFIELD-", "");
                                                                                                                    rs = stmt.executeQuery("SELECT Meaning from lookuptablesdetail where TableID=73  and value=" + columnID);
                                                                                                                    if (rs.next()) {
                                                                                                                        columnname = i18n.tr(rs.getString(1));
                                                                                                                    }rs.close();
                                                                                                                } else  if (columnID.contains("USER_CUSTOMFIELD-")) {
                                                                                                                    columnID = columnID.replace("USER_CUSTOMFIELD-", "");
                                                                                                                    rs = stmt.executeQuery("Select  FieldDisplayName from user_additionalfields where isVisible=0 and additionalFieldID=" + columnID);
                                                                                                                    if (rs.next()) {
                                                                                                                        columnname = rs.getString(1);
                                                                                                                    }rs.close();
                                                                                                                } else {
                                                                                                                    if (columnID.contains("|@@|")) {
                                                                                                                        String fieldName = columnID.split("\\|\\@\\@\\|")[0];
                                                                                                                        int fieldValue = Integer.parseInt(fieldName.trim());
                                                                                                                        rs = stmt.executeQuery("select ParameterName,AssetDetailsID from assetcontrolflowconfig_additionalparams where AssetDetailsID = " + fieldValue);
                                                                                                                        while (rs.next()) {
                                                                                                                            flag = 1;
                                                                                                                            columnname = i18n.tr(rs.getString(1));
                                                                                                                        }rs.close();
                                                                                                                        if (flag == 0) {
                                                                                                                            continue;
                                                                                                                        }
                                                                                                                    } else if (columnID.contains("|==|")) {
                                                                                                                        String tempFieldName = columnID.split("\\|\\=\\=\\|")[0];
                                                                                                                        String fieldName[]=tempFieldName.split("_");
                                                                                                                        int fieldValue = Integer.parseInt(fieldName[0].trim());
                                                                                                                        if(assetDisplayType.equalsIgnoreCase("0")){
                                                                                                                            continue;
                                                                                                                        }else{
                                                                                                                            rs = stmt.executeQuery("SELECT distinct(DisplayName) FROM assetcomponentfixedfields_mapping where FieldID="+ fieldValue);
                                                                                                                            while (rs.next()) {
                                                                                                                                columnname = i18n.tr(rs.getString(1));
                                                                                                                            }rs.close();
                                                                                                                        }
                                                                                                                    } else {
                                                                                                                        int fieldValue = Integer.parseInt(columnID.trim());
                                                                                                                        rs = stmt.executeQuery("select ParameterName,ItemDetailsID from assetitemtype_configuration where  ItemDetailsID = " + fieldValue+" group by ItemDetailsID");
                                                                                                                        while (rs.next()) {
                                                                                                                            flag = 1;
                                                                                                                            columnname = i18n.tr(rs.getString(1));
                                                                                                                        }rs.close();
                                                                                                                        if (flag == 0) {
                                                                                                                            continue;
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                            } catch (Exception e) {
                                                                                                                String fieldName = columnID.split("\\|\\@\\@\\|")[0];
                                                                                                                if (!columnID.contains("|@@|")) {
                                                                                                                    String ArrTableName[] = fieldName.split("\\.");
                                                                                                                    columnname = ArrTableName[0];
                                                                                                                    if (fieldName.contains(".")) {
                                                                                                                        if (fieldName.contains("ItemTypeID")) {
                                                                                                                            columnname = "Asset Type";
                                                                                                                        } else if (fieldName.contains("AssetID")) {
                                                                                                                            columnname = "Asset Number";
                                                                                                                        } else if (fieldName.contains("assetCreationTime")) {
                                                                                                                            columnname = "Asset Creation Time";
                                                                                                                        }  else if (fieldName.contains("SystemID")) {
                                                                                                                            columnname = "Host Name";
                                                                                                                        } else if (fieldName.contains("SiteID")) {
                                                                                                                            columnname = "Site";
                                                                                                                        } else if (fieldName.contains("FilterID")) {
                                                                                                                            columnname = "Status";
                                                                                                                        } else if (fieldName.contains("UserID")) {
                                                                                                                            columnname = "User Name";
                                                                                                                        } else {
                                                                                                                            if (dbKeyValueList.containsKey(fieldName)) //means that is not in db that is builtin field
                                                                                                                            {
                                                                                                                                columnname = dbKeyValueList.get(ArrTableName[0]).toString();//dbValueList.get(index).toString();
                                                                                                                            } else {
                                                                                                                                columnname = ArrTableName[1];
                                                                                                                            }
                                                                                                                        }
                                                                                                                    }
                                                                                                                } else {
                                                                                                                    String fieldID = columnID.split("\\|\\@\\@\\|")[1];
                                                                                                                    rs = stmt.executeQuery("select ParameterName from assetcontrolflowconfig_additionalparams where AssetDetailsID =" + fieldID);
                                                                                                                    while (rs.next()) {
                                                                                                                        columnname = rs.getString(1);
                                                                                                                    }rs.close();
                                                                                                                }
                                                                                                            }
                                                                                                %><option value="<%=selected_strToken[i]%>"><%=i18n.tr(columnname)%></option><%
                                                                                                    }
                                                                                                }%>
                                                                                            </select>
                                                                                        </td>
                                                                                        <td width='15%' align='center' bgcolor='#FFFFFF' class='formfield'>
                                                                                            <span onClick="moveUp(document.ReportsForm.report_selected_fields)" ><img src="up-btn.gif"></span>
                                                                                            <br class="hiddenDisplay"><br>
                                                                                            <span onClick="moveOptionDown(document.ReportsForm.report_selected_fields)" ><img src="down-btn.gif"></span>
                                                                                        </td>
                                                                                        <td width="9%">&nbsp;</td>
                                                                                    </tr>
                                                                                </table>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="5" class="wid100">
                                                                <div id="assetcommonblock" style="display:<%=assetcommonblock%>">
                                                                    <table width='100%' cellpadding="5" cellspacing="0" border="0">
                                                                        <tr align="left" > 
                                                                            <td height='25' class="copyhdr leftPadd" colspan="3"><%=i18n.tr("Advanced Filter")%>
                                                                            </td>
                                                                        </tr>                       	
                                                                        <tr>
                                                                            <td class='formtext' width="20%"><%=i18n.tr("Select Filter")%></td>                       	
                                                                            <td class='formfield wid100' width="33%">
                                                                                <select id="Assetadvfilter" name="Assetadvfilter" class="gen assetInventorySingleSelect" style="width: 260px">
                                                                                    <option value="">-------- <%=i18n.tr("Select Filter")%> ---------</option>
                                                                                    <%  String data2[] = reportsObj.getAssetSelectedFilters(reportID, 3,telantName); 
                                                                                       assetModuleName =new Sapphire().getAssetModuleName(AssetModuleID+"",telantName);%>
                                                                                    <optgroup label="<%=assetModuleName%> Fixed Fields">
                                                                                        <option value="assetmaster.AssetID"><%=i18n.tr("Asset Number")%></option>
                                                                                        <option value="assetmaster.ItemTypeID"><%=i18n.tr("Asset Type")%></option>
                                                                                         <option value="assetmaster.assetCreationTime"><%=i18n.tr("Asset Creation Time")%></option>
                                                                                        <%  assetFixedFields = new ServiceDeskReportsDBUtil().getAssetDBFields("Asset Management Report",AssetModuleID,telantName);
                                                                                            set = assetFixedFields.entrySet();
                                                                                            itr = set.iterator();
                                                                                            while (itr.hasNext()) {
                                                                                                Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                key = (String) (mEntry.getKey());
                                                                                                value = (String) (mEntry.getValue());
                                                                                        %>
                                                                                        <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                                        <% } %>
                                                                                    </optgroup>
                                                                                    <%if(AssetModuleID.equalsIgnoreCase("1")){  %>
                                                                                    <optgroup label="<%=i18n.tr("Asset Custom Fields")%>">
                                                                                        <%  assetCustomFields = new ServiceDeskReportsDBUtil().getAssetCustomFields("", "",AssetModuleID+"||Report",telantName);
                                                                                            set = assetCustomFields.entrySet();
                                                                                            itr = set.iterator();
                                                                                            while (itr.hasNext()) {
                                                                                                Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                key = (String) (mEntry.getKey());
                                                                                                value = (String) (mEntry.getValue());
                                                                                        %>
                                                                                        <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                                        <% } %>
                                                                                    </optgroup>
                                                                                    <% } %>
                                                                                    
                                                                                    <%             if(!AssetModuleID.equalsIgnoreCase("1")){                                                                                                                                                                                       
                                                                                                  userDefineAssetIds =new ServiceDeskReportsDBUtil().getUserDefinedAssets(telantName);
                                                                                                  if(!userDefineAssetIds.isEmpty())
                                                                                                  {
                                                                                                      for(Object moduleId:userDefineAssetIds)
                                                                                                      {
                                                                                                           assetModuleName =new Sapphire().getAssetModuleName(moduleId+"",telantName);
                                                                                                           if(AssetModuleID.equalsIgnoreCase(moduleId+"")){ %>
                                                                                                      <optgroup label="<%=assetModuleName%>-Custom Fields">
                                                                                                           <%  assetCustomFields = new ServiceDeskReportsDBUtil().getUserDefineAssetdCustomFeilds("", "",moduleId+"||Report",telantName);
                                                                                                               set = assetCustomFields.entrySet();
                                                                                                               itr = set.iterator();
                                                                                                               while (itr.hasNext()) {
                                                                                                                      Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                                      key = (String) (mEntry.getKey());
                                                                                                                      value = (String) (mEntry.getValue());
                                                                                                    %>                                                                                                                                                                                                              
                                                                                                    <option value='ASSET_FIELDS-<%=key%>'><%=value%></option>
                                                                                                    <% } %>
                                                                                                    </optgroup>
                                                                                                <%
                                                                                                      }}
                                                                                                  }
                                                                                     }
                                                                                                %>
                                                                                    <%  String data3[] = reportsObj.getAssetSelectedFilters(reportID, 3,telantName); 
                                                                                       assetModuleName =new Sapphire().getAssetModuleName(AssetModuleID+"",telantName);%>
                                                                                       <optgroup label="<%=assetModuleName%> LifeCycle Fields">
                                                                                        <%  assetLyfeCycleFields = new ServiceDeskReportsDBUtil().getAssetLifeCycleFields("",AssetModuleID,telantName);
                                                                                            set = assetLyfeCycleFields.entrySet();
                                                                                            itr = set.iterator();
                                                                                            while (itr.hasNext()) {
                                                                                                Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                key = (String) (mEntry.getKey());
                                                                                                value = (String) (mEntry.getValue());
                                                                                        %>
                                                                                        <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                                        <% } %>
                                                                                    </optgroup>
                                                                                    <% if(!assetDisplayType.equalsIgnoreCase("0")){ %>
                                                                                    <optgroup label="<%=i18n.tr(assetModuleName+" Preshipped Fixed Fields")%>">
                                                                                        <%     assetCustomFields = new ServiceDeskReportsDBUtil().getAssetFixedFields("","",AssetModuleID,telantName);
                                                                                               set = assetCustomFields.entrySet();
                                                                                               itr = set.iterator();
                                                                                               while(itr.hasNext()){ 
                                                                                                    Map.Entry mEntry = (Map.Entry)itr.next();
                                                                                                    key   = (String)(mEntry.getKey() );
                                                                                                    value = (String)(mEntry.getValue());
                                                                                             %>
                                                                                                <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                                        <% } %>
                                                                                    </optgroup>
                                                                                    <% } %>
                                                                                    <optgroup label="<%=i18n.tr(assetModuleName+" User Defined Fields")%>">
                                                                                        <%  assetLyfeCycleFields = new ServiceDeskReportsDBUtil().getAssetUserDefinedFields(telantName);
                                                                                            set = assetLyfeCycleFields.entrySet();
                                                                                            itr = set.iterator();
                                                                                            while (itr.hasNext()) {
                                                                                                Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                key = (String) (mEntry.getKey());
                                                                                                value = (String) (mEntry.getValue());
                                                                                        %>
                                                                                        <option value='ASSET_CUSTOMFIELDS-<%=key%>'><%=i18n.tr(value)%></option>
                                                                                        <% } %>
                                                                                    </optgroup>
                                                                                    <optgroup label="<%=i18n.tr("Allocate To User Fields")%>">
                                                                                                    <%  allocateToUserFields = new ServiceDeskReportsDBUtil().getUserFixedFields("",telantName);
                                                                                                        set = allocateToUserFields.entrySet();
                                                                                                        itr = set.iterator();
                                                                                                        while (itr.hasNext()) {
                                                                                                            Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                            key = (String) (mEntry.getKey());
                                                                                                            value = ((String) (mEntry.getValue())).trim();
                                                                                                    %>
                                                                                                     <option value='USER_FIXEDFIELD-<%=key%>'><%=i18n.tr(value)%></option>
                                                                                                     <%}%>
                                                                                                     <% allocateToUserFields = new ServiceDeskReportsDBUtil().getUserCustomFields("",telantName);
                                                                                                        set = allocateToUserFields.entrySet();
                                                                                                        itr = set.iterator();
                                                                                                        while (itr.hasNext()) {
                                                                                                            Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                                            key = (String) (mEntry.getKey());
                                                                                                            value = ((String)(mEntry.getValue())).trim();
                                                                                                    %>
                                                                                                     <option value='USER_CUSTOMFIELD-<%=key%>'><%=i18n.tr(value)%></option>
                                                                                                     <%}%>
                                                                                                </optgroup>
                                                                                </select>	                       	
                                                                            </td>
                                                                            <td class='formfield wid100 topMargin30 importantFlex' width="50%">
                                                                                <select style='width:290px;' id="Assetadvfiltervalues" name="Assetadvfiltervalues" class="gen" size='5' multiple="multiple">
                                                                                </select>	                       	
                                                                                &nbsp;
                                                                                <input  type='button'   class='addbuttons greenBtn'  value='<%= i18n.tr("Add")%>' onClick='addAdvFilter()' />
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td colspan="3" class="formtext">
                                                                                <table border="0" cellspacing="1" cellpadding="2" width="100%">
                                                                                    <tr class="tableHeader importantFlex">
                                                                                        <td width="10%" class="copyhdr" align="center">
                                                                                            <span ><%= i18n.tr("Delete")%></span>
                                                                                        </td>
                                                                                        <td width="90%" class="copyhdr"  align="center">
                                                                                            <span><%= i18n.tr("Selected Filter")%></span> 
                                                                                        </td>
                                                                                    </tr>			 
                                                                                    <tr>
                                                                                        <td class="formfield wid100" id="AssetreportTempleteDelRef" colspan="2">
                                                                                            <div id="AssetreportTemplatedynamicRow">
                                                                                                <%  //taking column names from db
                                                                                                    Map dbKeyValueList = new ServiceDeskReportsDBUtil().getAssetDBFields("Asset Allocation Report",telantName);
                                                                                                    rs = stmt.executeQuery("select ScopeID,Report_Values from reporttable_lookup where SiteID=3 and ReportID=" + reportID);
                                                                                                    int i = 0;
                                                                                                    while (rs.next()) {
                                                                                                        String hiddenValue = rs.getString(1) + "====" + rs.getString(2);
                                                                                                        String strScopeID = rs.getString(1);
                                                                                                        String strScopeValue = rs.getString(2);
                                                                                                        int flag = 0;
                                                                                                        String displayValue = "";
                                                                                                        try {
                                                                                                            if (strScopeID.contains("ASSET_CUSTOMFIELDS")) {
                                                                                                                strScopeID = strScopeID.replace("ASSET_CUSTOMFIELDS-", "");
                                                                                                                int val = Integer.parseInt(strScopeID.trim());
                                                                                                                rs2 = stmt2.executeQuery("select DisplayName from assetreport_configparams where Report_type=1 and sno=" + strScopeID);
                                                                                                                while (rs2.next()) {
                                                                                                                    displayValue = rs2.getString(1);
                                                                                                                }
                                                                                                                rs2.close();
                                                                                                            }else if (strScopeID.contains("USER_FIXEDFIELD")) {
                                                                                                                strScopeID = strScopeID.replace("USER_FIXEDFIELD-", "");
                                                                                                                int val = Integer.parseInt(strScopeID.trim());
                                                                                                                String displayName = "";
                                                                                                                rs2 = stmt2.executeQuery("SELECT meaning from lookuptablesdetail where TableID=73 and value=" + strScopeID);
                                                                                                                while (rs2.next()) {
                                                                                                                    displayValue = rs2.getString(1);

                                                                                                                }rs2.close();
                                                                                                            }else if (strScopeID.contains("USER_CUSTOMFIELD")) {
                                                                                                                strScopeID = strScopeID.replace("USER_CUSTOMFIELD-", "");
                                                                                                                int val = Integer.parseInt(strScopeID.trim());
                                                                                                                String displayName = "";
                                                                                                                rs2 = stmt2.executeQuery("Select fielddisplayname from user_additionalfields where isVisible=0 and additionalfieldid=" + strScopeID);
                                                                                                                while (rs2.next()) {
                                                                                                                    displayValue = rs2.getString(1);

                                                                                                                }rs2.close();
                                                                                                            } else {
                                                                                                                if (strScopeID.contains("|@@|")) {
                                                                                                                    String fieldName = strScopeID.split("\\|\\@\\@\\|")[0];
                                                                                                                    int val = Integer.parseInt(fieldName.trim());
                                                                                                                    rs2 = stmt2.executeQuery("select ParameterName,AssetDetailsID from assetcontrolflowconfig_additionalparams where AssetDetailsID = " + val);
                                                                                                                    while (rs2.next()) {
                                                                                                                        displayValue = rs2.getString(1);
                                                                                                                    }rs2.close();
                                                                                                                } else if (strScopeID.contains("|==|")) {
                                                                                                                        String tempFieldName = strScopeID.split("\\|\\=\\=\\|")[0];
                                                                                                                        String fieldName[]=tempFieldName.split("_");
                                                                                                                        int val = Integer.parseInt(fieldName[0].trim());
                                                                                                                        if(assetDisplayType.equalsIgnoreCase("0")){
                                                                                                                            flag=1;
                                                                                                                        }
                                                                                                                        rs2 = stmt2.executeQuery("SELECT distinct(DisplayName) FROM assetcomponentfixedfields_mapping where FieldID="+ val);
                                                                                                                        while (rs2.next()) {
                                                                                                                            displayValue = rs2.getString(1);
                                                                                                                        }rs2.close();
                                                                                                                } else {
                                                                                                                    int val = Integer.parseInt(strScopeID.trim());
                                                                                                                    rs2 = stmt2.executeQuery("select ParameterName,ItemDetailsID from assetitemtype_configuration where  ItemDetailsID = " + val+" group by ItemDetailsID");
                                                                                                                    while (rs2.next()) {
                                                                                                                        displayValue = rs2.getString(1);
                                                                                                                    }rs2.close();
                                                                                                                }
                                                                                                            }
                                                                                                        } catch (Exception e) {
                                                                                                            String fieldName = strScopeID.split("\\|\\@\\@\\|")[0];
                                                                                                            if (!strScopeID.contains("|@@|")) {
                                                                                                                String ArrTableName[] = fieldName.split("\\.");
                                                                                                                displayValue = ArrTableName[0];
                                                                                                                if (fieldName.contains(".")) {
                                                                                                                    if (fieldName.contains("ItemTypeID")) {
                                                                                                                        displayValue = "Asset Type";
                                                                                                                    } else if (fieldName.contains("AssetID")) {
                                                                                                                        displayValue = "Asset Number";
                                                                                                                    } else if (fieldName.contains("SystemID")) {
                                                                                                                        displayValue = "Host Name";
                                                                                                                    } else if (fieldName.contains("FilterID")) {
                                                                                                                        displayValue = "Status";
                                                                                                                    } else if (fieldName.contains("UserID")) {
                                                                                                                        displayValue = "User Name";
                                                                                                                    } else {
                                                                                                                        if (dbKeyValueList.containsKey(ArrTableName[0])) //means that is not in db that is builtin field
                                                                                                                        {
                                                                                                                            displayValue = dbKeyValueList.get(ArrTableName[0]).toString();//dbValueList.get(index).toString();
                                                                                                                        } else {
                                                                                                                            displayValue = ArrTableName[1];
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                            } else {
                                                                                                                String fieldID = strScopeID.split("\\|\\@\\@\\|")[1];
                                                                                                                rs2 = stmt2.executeQuery("select ParameterName from assetcontrolflowconfig_additionalparams where AssetDetailsID =" + fieldID);
                                                                                                                while (rs2.next()) {
                                                                                                                    displayValue = rs2.getString(1);
                                                                                                                }rs2.close();
                                                                                                            }
                                                                                                        }
                                                                                                        displayValue = "<b>" + i18n.tr(displayValue) + "</b> : ";
                                                                                                        try {
                                                                                                            int toThrowIfNoInteger = Integer.parseInt(strScopeID);
                                                                                                            displayValue += strScopeValue;
                                                                                                        } catch (Exception e) {
                                                                                                            String fieldName = strScopeID.split("\\|\\@\\@\\|")[0];
                                                                                                            if (fieldName.contains("\\.")) {
                                                                                                                fieldName = fieldName.split("\\.")[1];
                                                                                                            }
                                                                                                            String arrstr[] = strScopeValue.split("\\,");
                                                                                                            String commaString = "";
                                                                                                            for (int k = 0; k < arrstr.length; k++) {
                                                                                                                if (k > 0) {
                                                                                                                    commaString = ", ";
                                                                                                                }
                                                                                                                strScopeValue = arrstr[k];
                                                                                                                if (fieldName.contains("ItemTypeID")) {
                                                                                                                    rs2 = stmt2.executeQuery("select ItemType  from assetitemtype_master where ItemTypeID = " + strScopeValue);
                                                                                                                    while (rs2.next()) {
                                                                                                                        displayValue += commaString + i18n.tr(rs2.getString(1));
                                                                                                                    }rs2.close();
                                                                                                                } else if (fieldName.contains("AssetID")) {
                                                                                                                    rs2 = stmt2.executeQuery("select if(AssetNumber='',AssetID,AssetNumber)  from assetmaster where AssetID = " + strScopeValue);
                                                                                                                    while (rs2.next()) {
                                                                                                                        displayValue += commaString + rs2.getString(1);
                                                                                                                    }rs2.close();
                                                                                                                } else if (fieldName.contains("FilterID")) {
                                                                                                                    rs2 = stmt2.executeQuery("select value from assetflowdetails where FlowDetailsID=" + strScopeValue);
                                                                                                                    while (rs2.next()) {
                                                                                                                        displayValue += commaString + i18n.tr(rs2.getString(1));
                                                                                                                    }rs2.close();
                                                                                                                } else if (fieldName.contains("UserID")) {
                                                                                                                    rs2 = stmt2.executeQuery("select FullName from usermgmt_master where UserID=" + strScopeValue);
                                                                                                                    while (rs2.next()) {
                                                                                                                        displayValue += commaString + i18n.tr(rs2.getString(1));
                                                                                                                    }rs2.close();
                                                                                                                } else if (fieldName.contains("Project")) {
                                                                                                                    rs2 = stmt2.executeQuery("select CategoryValue from misc_details where CategoryID=" + strScopeValue);
                                                                                                                    while (rs2.next()) {
                                                                                                                        displayValue += commaString + i18n.tr(rs2.getString(1));
                                                                                                                    }rs2.close();
                                                                                                                } else if (fieldName.contains("SystemID")) {
                                                                                                                    rs2 = stmt2.executeQuery("select HostName from inventorymaster where SystemID=" + strScopeValue);
                                                                                                                    while (rs2.next()) {
                                                                                                                        displayValue += commaString + rs2.getString(1);
                                                                                                                    }rs2.close();
                                                                                                                } else if (fieldName.contains("Location")) {
                                                                                                                    rs2 = stmt2.executeQuery("select LocationName from servicedesklocationmaster where LocationID=" + strScopeValue);
                                                                                                                    while (rs2.next()) {
                                                                                                                        displayValue += commaString + i18n.tr(rs2.getString(1));
                                                                                                                    }rs2.close();
                                                                                                                } else if (fieldName.contains("Department")) {
                                                                                                                    rs2 = stmt2.executeQuery("select DepartmentName from departmentmaster where DepartmentID = " + strScopeValue);
                                                                                                                    while (rs2.next()) {
                                                                                                                        displayValue += commaString + rs2.getString(1);
                                                                                                                    }rs2.close();
                                                                                                                } else if (fieldName.equalsIgnoreCase("assetmaster.SiteName")) {
                                                                                                                    rs2 = stmt2.executeQuery("select CategoryValue from misc_details where CategoryID=" + strScopeValue);
                                                                                                                    while (rs2.next()) {
                                                                                                                        displayValue += commaString + i18n.tr(rs2.getString(1));
                                                                                                                    }rs2.close();
                                                                                                                } else if (fieldName.equalsIgnoreCase("assetmaster.SiteID")) {
                                                                                                                    rs2 = stmt2.executeQuery("select  SiteName from sitemaster where SiteID=" + strScopeValue);
                                                                                                                    while (rs2.next()) {
                                                                                                                        if (k == 0) {
                                                                                                                            displayValue = "<b>"+i18n.tr("Site")+"</b> : " + rs2.getString(1);
                                                                                                                        } else {
                                                                                                                            displayValue += commaString + rs2.getString(1);
                                                                                                                        }
                                                                                                                    }rs2.close();
                                                                                                                } else {
                                                                                                                    if(strScopeValue.contains("'")){
                                                                                                                        strScopeValue=strScopeValue.replaceAll("'",""); 
                                                                                                                    }
                                                                                                                    displayValue += commaString + strScopeValue;
                                                                                                                }
                                                                                                            }
                                                                                                        }
                                                                                                        String divIdName = "AssetDiv_" + i + "_ReportTemplate";                                                                                                        
                                                                                                        if(flag==0){
                                                                                                %>
                                                                                                <div id="<%=divIdName%>" >
                                                                                                    <table width="100%" border="0">
                                                                                                        <tr class="ruleList applyWid50Per">
                                                                                                            <td align="center" width="10%" class="gen">
                                                                                                                <a href="javascript:;" class="delete1" title="Delete" onclick="removeDiv('<%=divIdName%>')"><img border="0" src="fault_x.gif" width="12" height="12" class="deleteRule"></a></td>
                                                                                                            <td align="center" width="90%" class="gen"><input type='hidden' id='AssetadvFilters' name='AssetadvFilters' value="<%=hiddenValue%>" /><%=displayValue%></td>
                                                                                                        </tr>
                                                                                                    </table>
                                                                                                </div>
                                                                                                <% } i++;
                                                                                                    }rs.close();
                                                                                                %>
                                                                                            </div>
                                                                                        </td>
                                                                                    <input type="hidden" name="nAdvFilter" id="nAdvFilter" value="<%=i%>"/>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td class="formtext" width="20%"><%= i18n.tr("Context Filter")%></td>
                                                            <td class="formfield" colspan="2"><input type="checkbox" name="contextFilter" id="contextFilter" <%= assetContextFilterVisible%>/><label class="customRadCheck noTopMargin" for="contextFilter"><span><span></span></span></label></td>
                                                        </tr>
                                                        <td colspan="3" class="wid100"><div id="dateFilterBlk">                                               
                                                            <table style="width: 100%;">
                                                                <tbody>
                                                        
                                                        <tr><td colspan="6" class="copyhdr leftPadd"><%= i18n.tr("Date Filter")%></td></tr> 
                                                        <tr>
                                                            <td class='formtext' width="20%"><%=i18n.tr("Select Filter")%></td>                       	
                                                            <td class='formfield wid100' width="33%">
                                                                <select id="Assetadvdatefilter" name="Assetadvdatefilter" class="gen assetInventorySingleSelect" style="width: 260px">
                                                                    <option value="">-------- <%=i18n.tr("Select Filter")%> ---------</option>
                                                                  <%if(AssetModuleID.equalsIgnoreCase("1")){%>
                                                                    <optgroup label="<%=i18n.tr(assetModuleName+" Custom Fields")%>">
                                                                        <%  assetCustomFields = new ServiceDeskReportsDBUtil().getAssetCustomDateFields("", "",AssetModuleID+"||Report",telantName);
                                                                            set = assetCustomFields.entrySet();
                                                                            itr = set.iterator();
                                                                            while (itr.hasNext()) {
                                                                                Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                key = (String) (mEntry.getKey());
                                                                                value = (String) (mEntry.getValue());
                                                                        %>
                                                                        <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                        <% } %>
                                                                    </optgroup>
                                                                  <%}%>
                                                                   <% userDefineAssetIds =new ServiceDeskReportsDBUtil().getUserDefinedAssets(telantName);
                                                                    if(!userDefineAssetIds.isEmpty())
                                                                    {
                                                                        for(Object moduleId:userDefineAssetIds)
                                                                        {
                                                                             assetModuleName =new Sapphire().getAssetModuleName(moduleId+"",telantName);
                                                                              if(AssetModuleID.equalsIgnoreCase(moduleId+"")){ %>
                                                                        <optgroup label="<%=assetModuleName%>-Custom Fields">
                                                                             <%  assetCustomFields = new ServiceDeskReportsDBUtil().getAssetCustomDateFields("", "",moduleId+"||Report",telantName);
                                                                                 set = assetCustomFields.entrySet();
                                                                                 itr = set.iterator();
                                                                                 while (itr.hasNext()) {
                                                                                        Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                        key = (String) (mEntry.getKey());
                                                                                        value = (String) (mEntry.getValue());
                                                                      %>                                                                                                                                                                                                              
                                                                      <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                      <% } %>
                                                                      </optgroup>
                                                                    <%
                                                                         } }
                                                                          }
                                                                    %>
                                                                    <% assetModuleName =new Sapphire().getAssetModuleName(AssetModuleID+"",telantName);%>
                                                                    <optgroup label="<%=assetModuleName%> LifeCycle Fields">
                                                                        <%  assetLyfeCycleFields = new ServiceDeskReportsDBUtil().getAssetLifeCycleDateFields("",AssetModuleID,telantName);
                                                                            set = assetLyfeCycleFields.entrySet();
                                                                            itr = set.iterator();
                                                                            while (itr.hasNext()) {
                                                                                Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                key = (String) (mEntry.getKey());
                                                                                value = (String) (mEntry.getValue());
                                                                        %>
                                                                        <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                        <% } %>
                                                                    </optgroup>
                                                                    <% if(!assetDisplayType.equalsIgnoreCase("0")){ %>
                                                                    <optgroup label="<%=i18n.tr(assetModuleName+" Preshipped Fixed Fields")%>">
                                                                        <%     assetCustomFields = new ServiceDeskReportsDBUtil().getAssetFixedDateFields("","",AssetModuleID,telantName);
                                                                               set = assetCustomFields.entrySet();
                                                                               itr = set.iterator();
                                                                               while(itr.hasNext()){ 
                                                                                    Map.Entry mEntry = (Map.Entry)itr.next();
                                                                                    key   = (String)(mEntry.getKey() );
                                                                                    value = (String)(mEntry.getValue());
                                                                             %>
                                                                                <option value='<%=key%>'><%=i18n.tr(value)%></option>
                                                                        <% } %>
                                                                    </optgroup>
                                                                    <% } %>
                                                                </select>	                       	
                                                            </td>
                                                            <td class='formfield wid100 topMargin30 importantFlex' width="50%">
                                                                <select style='width:290px;' id="Assetadvdatefiltervalues" name="Assetadvdatefiltervalues" class="gen" size='5' multiple="multiple">
                                                                </select>	                       	
                                                                &nbsp;
                                                                <input  type='button'   class='addbuttons greenBtn'  value='<%= i18n.tr("Add")%>' onClick='addAdvDateFilter()' />
                                                            </td>
                                                         </tr>
                                                        <tr>
                                                                            <td colspan="3" class="formtext wid100">
                                                                                <table border="0" cellspacing="1" cellpadding="2" width="100%">
                                                                                    <tr class="tableHeader importantFlex">
                                                                                        <td width="10%" class="copyhdr" align="center">
                                                                                            <span ><%= i18n.tr("Delete")%></span>
                                                                                        </td>
                                                                                        <td width="90%" class="copyhdr"  align="center">
                                                                                            <span><%= i18n.tr("Selected Filter")%></span> 
                                                                                        </td>
                                                                                    </tr>			 
                                                                                    <tr>
                                                                                        <td class="formfield" id="AssetreportTempleteDelRef" colspan="2">
                                                                                            <div id="AssetreportDateTemplatedynamicRow">
                                                                                                <%  //taking column names from db
                                                                                                    Map dbKeyValueList1 = new ServiceDeskReportsDBUtil().getAssetDBFields("Asset Allocation Report",telantName);
                                                                                                    rs = stmt.executeQuery("select ScopeID,Report_Values from reporttable_lookup where SiteID=4 and ReportID=" + reportID);
                                                                                                    int j = 0;
                                                                                                    while (rs.next()) {
                                                                                                        String hiddenValue = rs.getString(1) + "====" + rs.getString(2);
                                                                                                        String strScopeID = rs.getString(1);
                                                                                                        String strScopeValue = rs.getString(2);
                                                                                                        int flag = 0;
                                                                                                        String displayValue = "";
                                                                                                        try {
                                                                                                            if (strScopeID.contains("ASSET_CUSTOMFIELDS")) {
                                                                                                                strScopeID = strScopeID.replace("ASSET_CUSTOMFIELDS-", "");
                                                                                                                int val = Integer.parseInt(strScopeID.trim());
                                                                                                                rs2 = stmt2.executeQuery("select DisplayName from assetreport_configparams where Report_type=1 and sno=" + strScopeID);
                                                                                                                while (rs2.next()) {
                                                                                                                    displayValue = rs2.getString(1);
                                                                                                                }
                                                                                                                rs2.close();
                                                                                                            } else {
                                                                                                                if (strScopeID.contains("|@@|")) {
                                                                                                                    String fieldName = strScopeID.split("\\|\\@\\@\\|")[0];
                                                                                                                    int val = Integer.parseInt(fieldName.trim());
                                                                                                                    rs2 = stmt2.executeQuery("select ParameterName,AssetDetailsID from assetcontrolflowconfig_additionalparams where AssetDetailsID = " + val);
                                                                                                                    while (rs2.next()) {
                                                                                                                        displayValue = rs2.getString(1);
                                                                                                                    }rs2.close();
                                                                                                                } else if (strScopeID.contains("|==|")) {
                                                                                                                        String tempFieldName = strScopeID.split("\\|\\=\\=\\|")[0];
                                                                                                                        String fieldName[]=tempFieldName.split("_");
                                                                                                                        int val = Integer.parseInt(fieldName[0].trim());
                                                                                                                        if(assetDisplayType.equalsIgnoreCase("0")){
                                                                                                                            flag=1;
                                                                                                                        }
                                                                                                                        rs2 = stmt2.executeQuery("SELECT distinct(DisplayName) FROM assetcomponentfixedfields_mapping where FieldID="+ val);
                                                                                                                        while (rs2.next()) {
                                                                                                                            displayValue = rs2.getString(1);
                                                                                                                        }rs2.close();
                                                                                                                } else {
                                                                                                                    int val = Integer.parseInt(strScopeID.trim());
                                                                                                                    rs2 = stmt2.executeQuery("select ParameterName,ItemDetailsID from assetitemtype_configuration where  ItemDetailsID = " + val+" group by ItemDetailsID");
                                                                                                                    while (rs2.next()) {
                                                                                                                        displayValue = rs2.getString(1);
                                                                                                                    }rs2.close();
                                                                                                                }
                                                                                                            }
                                                                                                        } catch (Exception e) {
                                                                                                            String fieldName = strScopeID.split("\\|\\@\\@\\|")[0];
                                                                                                            if (!strScopeID.contains("|@@|")) {
                                                                                                                String ArrTableName[] = fieldName.split("\\.");
                                                                                                                displayValue = ArrTableName[0];
                                                                                                                if (fieldName.contains(".")) {
                                                                                                                    if (fieldName.contains("ItemTypeID")) {
                                                                                                                        displayValue = "Asset Type";
                                                                                                                    } else if (fieldName.contains("AssetID")) {
                                                                                                                        displayValue = "Asset Number";
                                                                                                                    } else if (fieldName.contains("SystemID")) {
                                                                                                                        displayValue = "Host Name";
                                                                                                                    } else if (fieldName.contains("FilterID")) {
                                                                                                                        displayValue = "Status";
                                                                                                                    } else if (fieldName.contains("UserID")) {
                                                                                                                        displayValue = "User Name";
                                                                                                                    } else {
                                                                                                                        if (dbKeyValueList1.containsKey(ArrTableName[0])) //means that is not in db that is builtin field
                                                                                                                        {
                                                                                                                            displayValue = dbKeyValueList1.get(ArrTableName[0]).toString();//dbValueList.get(index).toString();
                                                                                                                        } else {
                                                                                                                            displayValue = ArrTableName[1];
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                            } else {
                                                                                                                String fieldID = strScopeID.split("\\|\\@\\@\\|")[1];
                                                                                                                rs2 = stmt2.executeQuery("select ParameterName from assetcontrolflowconfig_additionalparams where AssetDetailsID =" + fieldID);
                                                                                                                while (rs2.next()) {
                                                                                                                    displayValue = rs2.getString(1);
                                                                                                                }rs2.close();
                                                                                                            }
                                                                                                        }
                                                                                                        displayValue = "<b>" + i18n.tr(displayValue) + "</b> : ";
                                                                                                        try {
                                                                                                            int toThrowIfNoInteger = Integer.parseInt(strScopeID);
                                                                                                            displayValue += strScopeValue;
                                                                                                        } catch (Exception e) {
                                                                                                            String fieldName = strScopeID.split("\\|\\@\\@\\|")[0];
                                                                                                            if (fieldName.contains("\\.")) {
                                                                                                                fieldName = fieldName.split("\\.")[1];
                                                                                                            }
                                                                                                            String arrstr[] = strScopeValue.split("\\,");
                                                                                                            String commaString = "";
                                                                                                            for (int k = 0; k < arrstr.length; k++) {
                                                                                                                if (k > 0) {
                                                                                                                    commaString = ", ";
                                                                                                                }
                                                                                                                strScopeValue = arrstr[k];
                                                                                                                    if(strScopeValue.contains("'")){
                                                                                                                        strScopeValue=strScopeValue.replaceAll("'",""); 
                                                                                                                    }
                                                                                                                    displayValue += commaString + strScopeValue;
                                                                                                            }
                                                                                                        }
                                                                                                        String divIdName = "AssetDiv_Date" + j + "_ReportTemplate";                                                                                                        
                                                                                                        if(flag==0){
                                                                                                %>
                                                                                                <div id="<%=divIdName%>" >
                                                                                                    <table width="100%" border="0">
                                                                                                        <tr class="ruleList">
                                                                                                            <td align="center" width="10%" class="gen">
                                                                                                                <a href="javascript:;" class="delete1" title="Delete" onclick="removeDiv('<%=divIdName%>')"><img border="0" src="fault_x.gif" width="12" height="12"></a></td>
                                                                                                            <td align="center" width="90%" class="gen"><input type='hidden' id='AssetadvdateFilters' name='AssetadvdateFilters' value="<%=hiddenValue%>" /><%=displayValue%></td>
                                                                                                        </tr>
                                                                                                    </table>
                                                                                                        
                                                                                                </div>
                                                                                                <% } j++;
                                                                                                    }rs.close();
                                                                                                %>
                                                                                            </div>
                                                                                        </td>
                                                                                    <input type="hidden" name="nAdvFilter" id="nAdvFilter" value="<%=i%>"/>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr><td colspan="6" class="copyhdr leftPadd"><%= i18n.tr("Interval Time")%></td></tr> 
                                                        <tr>
                                                            <td colspan="6" class="wid100">
                                                                <table style="margin-left: 14%;" class="noLeftMargin"> 
                                                                    <tbody><tr>
                                                                            <td width="0%" align="" class="formtext wid100Div" style="width: 70px; text-align: left;"><%=i18n.tr("Time Period")%></td>
                                                                            <td width="5%" align=""  class="formfield" colspan="1" style="width: 100px; text-align: left;">
                                                                                   <select id="timescale" name="timescale" class="mcopy assetInventorySingleSelect" onchange="clearPatchTimeFilter(1,'timeScale','IntStartDate','IntEndDate');changeTimeDate()" style="width:150px;">
                                                                                    <%  logger.info("************************* "+str_TimePeriod);if(str_TimePeriod.equals("")){
                                                                                        str_TimePeriod="ALL";
                                                                                    }if (str_TimePeriod.equalsIgnoreCase("All")) {%>
                                                                                        <option value="All" selected><%= i18n.tr("All")%></option>
                                                                                    <%}  else if(!str_TimePeriod.equalsIgnoreCase("All") && !str_TimePeriod.equalsIgnoreCase("")) {%>
                                                                                       <option value="All"><%= i18n.tr("All")%></option>
                                                                                    
                                                                                    <% }%>
                                                                                   
                                                                                    <%= Sapphire.getTimescaleSelectList(str_TimePeriod,0,telantName,session) %>
                                                                                    <%if(!str_TimePeriod.contains("and")){%>
                                                                                       <option value="CustomDate"><%= i18n.tr("CustomDate")%></option>
                                                                                     <%}%>
                                                                                     <%if(str_TimePeriod.contains("and")){%>
                                                                                        <option value="CustomDate" selected><%= i18n.tr("CustomDate")%></option>
                                                                                    <%} %>
                                                                                </select>
                                                                            </td>
                                                                             <% 
                                                                                 String str_assettime[] = {"", ""};
                                                                            if (str_TimePeriod.contains("and")) {
                                                                                str_assettime = str_TimePeriod.split("and");                                                                                
                                                                                str_assettime[0] = sappObj.getUserTimeZoneDate(str_assettime[0].trim(), mysqlTimezone,conn,telantName);
                                                                                str_assettime[1] = sappObj.getUserTimeZoneDate(str_assettime[1].trim(), mysqlTimezone,conn,telantName);
                                                                                displaySummaryValue="";
                                                                             %>
                                                                                     
                                                                            <%}%>
                                                                            
                                                                            <td style="display:<%=displaySummaryValue%> " id="startDateLbl" width="0%" align="" class="formtext" ><%=i18n.tr("Start Date")%></td>
                                                                            <td style="display: <%=displaySummaryValue%>" id="startDateVal" width="0%" align=""  class="formfield" colspan="1">
                                                                                <input id="IntStartDate" name="IntStartDate" type="text" value="<%=str_assettime[0]%>"  class="mcopy" onfocus="showCalendarControl(this);" value="">
                                                                            </td>

                                                                            <td style="display: <%=displaySummaryValue%>" id="endDateLbl" width="0%" align="" class="formtext" ><%=i18n.tr("End Date")%></td>
                                                                            <td style="display: <%=displaySummaryValue%>" id="endDateVal" width="0%" align=""  class="formfield" colspan="1">
                                                                                <input id="IntEndDate" name="IntEndDate" type="text" value="<%=str_assettime[1]%>"  class="mcopy" onfocus="showCalendarControl(this);" value="">
                                                                            </td>
                                                                        </tr>
                                                                    </tbody>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                        </tbody></table></div>
                                                        <tr style="display: none;">
                                                            <td class='formtext'>
                                                        	<%=i18n.tr("Time Scale")%>
                                                            </td>
                                                            <td class='formfield' colspan='2'>
                                                                <table >
                                                                    <tr>
                                                                        <td class='gen'>
                                                                            <input type='radio' name='Assettimescaleradio' id='Assettimescaleradio' value="builtin" onclick='changeradio()' checked/><%=i18n.tr("Built In")%>
                                                                            <input type='radio' name='Assettimescaleradio' id='Assettimescaleradio' value='custom' onclick='changeradio()' /><%=i18n.tr("Custom")%>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>
                                                                            <div id='timescaleselected' style='display:block' >
                                                                                <select id="Assettimeselected" name="Assettimeselected" class="gen">
                                                                                    <option value='All' selected="selected"><%=i18n.tr("All")%></option>
                                                                                </select>	                      	
                                                                            </div>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td  id='customtimescalediv1' style='display:none' width="400" height="35"  class="gen">
                                                                            <%=i18n.tr("From")%> <input class="mcopy" id="AssetGENFROM" type="text" name="AssetGENFROM" size="20" value=" " onfocus="showCalendarControl(this);"> <%=i18n.tr("To")%>  <input class="mcopy" id="AssetGENTO" type="text" name="AssetGENTO" size="20" value=" " onfocus="showCalendarControl(this);">                                  
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="6">
                                                                <div style="display:<%=assetchartDisplay%>" id="assetchartDisplay">
                                                                    <table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
                                                                        <tr>
                                                                            <td class='formtext' width="20%">
                       	<%= i18n.tr("Chart Type")%>
                                                                            </td>
                                                                            <td class='formfield' width="80%">
                                                                                <select id="Assetcharttype" name="Assetcharttype" onchange="charttypeDis(this.value)" class="mcopy" style="width:150px;">
                                                                                    
                                                                                    <% if (chartType.equalsIgnoreCase("summary")) {%>
                                                                                    <option value='summary' selected><%= i18n.tr("Summary")%></option>
                                                                                    <%} else {%>
                                                                                    <option value='summary'><%= i18n.tr("Summary")%></option>
                                                                                    <%}%>
                                                                                    <% if (chartType.equalsIgnoreCase("bar")) {%>
                                                                                    <option value='bar' selected><%= i18n.tr("Bar")%></option>
                                                                                    <%} else {%>
                                                                                    <option value='bar'><%= i18n.tr("Bar")%></option>
                                                                                    <%}%>
                                                                                    <% if (chartType.equalsIgnoreCase("treand")) {%>
                                                                                    <option value='treand' selected><%= i18n.tr("Trend")%></option>
                                                                                    <%} else {%>
                                                                                    <option value='treand'><%= i18n.tr("Trend")%></option>
                                                                                    <%}%>
                                                                                    <% if (chartType.equalsIgnoreCase("stackedbar")) {%>
                                                                                    <option value='stackedbar' selected><%= i18n.tr("Stacked Bar")%></option>
                                                                                    <%} else {%>
                                                                                    <option value='stackedbar'><%= i18n.tr("Stacked Bar")%></option>
                                                                                    <%}%>
                                                                                    <% if (chartType.equalsIgnoreCase("pie")) {%>
                                                                                    <option value='pie' selected><%= i18n.tr("Pie")%></option>
                                                                                    <%} else {%>
                                                                                    <option value='pie'><%= i18n.tr("Pie")%></option>
                                                                                    <%}%>
                                                                                    <% if (chartType.equalsIgnoreCase("statisticalsummary")) {%>
                                                                                    <option value='statisticalsummary' selected><%= i18n.tr("Statistical Summary")%></option>
                                                                                    <%} else {%>
                                                                                    <option value='statisticalsummary'><%= i18n.tr("Statistical Summary")%></option>
                                                                                    <%}%>
                                                                                </select>	                       	
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td class='formtext' width="20%"><%= i18n.tr("Chart Display Type")%></td>
                                                                            <td class='formfield' colspan='2' width="80%">
                                                                                <select id="Assetchartrepresentation" name="Assetchartrepresentation" class="mcopy" style="width:150px;">
                                                                                    <% if (displayType.equalsIgnoreCase("0")) {%>
                                                                                    <option value='0' selected><%= i18n.tr("Single")%></option>
                                                                                    <option value='1'><%= i18n.tr("Multiple")%></option>
                                                                                    <%} else {%>
                                                                                    <option value='0' ><%= i18n.tr("Single")%></option>
                                                                                    <option value='1' selected><%= i18n.tr("Multiple")%></option>
                                                                                    <%}%>
                                                                                </select>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div> 
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </div>
                                                </td>
                                                </tr>
                                                <!-- ****************************************** Block For Asset Aalytical report Ends here******************************************************************* -->                       
                                                <!-- ****************************************** Block For Asset Inventory Custom Report Starts here******************************************************************* -->
                                                <tr class="noTopMargin">
                                                    <td colspan="5" class="wid100">
                                                        <div style="display:<%=assetInvCustomDivDisplay%>" id="AssetInvCustomDiv">
                                                            <table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
                                                                <tr>
                                                                    <td class='formtext'  width="20%"><%= i18n.tr("Custom Query")%></td>
                                                                    <td class='formfield' width="80%" colspan="4">
                                                                        <select id="InvAssetchartdisplaytype" name="InvAssetchartdisplaytype" class="mcopy"   style="width:330px;">
                                                                            <% pstmt=conn.prepareStatement("select ID,DisplayName from asset_inv_querybuilder where type = 0 ");
                                                                                rs = pstmt.executeQuery();
                                                                                while (rs.next()) {
                                                                                    if (srt_query.equalsIgnoreCase("CustomQuery=" + rs.getString(1))) { %>
                                                                            <option value="CustomQuery=<%=rs.getString(1)%>" selected><%=i18n.tr(rs.getString(2))%></option>
                                                                            <% } else { %>
                                                                            <option value="CustomQuery=<%=rs.getString(1)%>"><%=i18n.tr(rs.getString(2))%></option>
                                                                            <%  }
                                                                } rs.close();pstmt.close();%>
                                                                        </select>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td align="right"  width="20%" class="formtext topMargin10"><%= i18n.tr("Time Scale")%></td>
                                                                    <td width="80%"  class="formfield"  colspan="4">
                                                                        <select id="InvAssettimeselected" name="InvAssettimeselected" class="mcopy" onchange="clearPatchTimeFilter(1,'InvAssettimeselected','InvAssetGENFROM','InvAssetGENTO')" style="width:150px;">
                                                                            <%   if (str_TimePeriod.equalsIgnoreCase("All")) {%>
                                                                            <option value="All" selected><%= i18n.tr("All")%></option>
                                                                            <% } else {%>
                                                                            <option value="All"><%= i18n.tr("All")%></option>
                                                                            <%                                                               }%>
                                                                            <%= Sapphire.getTimescaleSelectList(str_TimePeriod,0,telantName,session) %>
                                                                        </select>
                                                                    </td>
                                                                </tr>
                                                                <%  String str_time[] = {"", ""};
                                                                    if (str_TimePeriod.contains("and")) {
                                                                        str_time = str_TimePeriod.split("and");
                                                                        str_time[0] = sappObj.getUserTimeZoneDate(str_time[0].trim(), mysqlTimezone,conn,telantName);
                                                                        str_time[1] = sappObj.getUserTimeZoneDate(str_time[1].trim(), mysqlTimezone,conn,telantName);
                                                                    }
                                                                    //Names Have been changed because it had been clashing with the other names
                                                                    //which are not visible in the other report
%>
                                                                <tr>
                                                                    <td align="right"  class="formtext topMargin10"><%= i18n.tr("Custom Time")%></td>
                                                                    <td width="300" height="35"  class="formfield">
                                                                        <div id="assetoverDiv" style="position:absolute; visibility:hidden; z-index:100;"></div>
                                                                        <label class="fontStyle noTopMargin"><%=i18n.tr("From")%></label>
                                                                        <input class="mcopy bottomMargin10 wid360PxImp" id="InvAssetGENFROM" type="text" name="InvAssetGENFROM" size="20" value="<%=str_time[0]%> " onfocus="showCalendarControl(this);" onclick="clearPatchTimeFilter(2,'InvAssettimeselected','InvAssetGENFROM','InvAssetGENTO')">
                                                                        <label class="fontStyle topMargin10 floatLeft"><%=i18n.tr("To")%></label>
                                                                        <input class="mcopy wid360PxImp" id="InvAssetGENTO" type="text" name="InvAssetGENTO" size="20" value="<%=str_time[1]%> " onfocus="showCalendarControl(this);" onclick="clearPatchTimeFilter(2,'InvAssettimeselected','InvAssetGENFROM','InvAssetGENTO')">
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td class='formtext topMargin10' width="20%"><%= i18n.tr("Chart Type")%>
                                                                        <input type="hidden" name="InvAssetchartrepresentation" id="InvAssetchartrepresentation" value="1"/>
                                                                    </td>
                                                                    <td class='formfield' width="80%">
                                                                        <select id="InvAssetcharttype" name="InvAssetcharttype" class="mcopy" style="width:150px;">
                                                                            <% if (chartType.equalsIgnoreCase("summary")) {%>
                                                                            <option value='summary' selected><%= i18n.tr("Summary")%></option>
                                                                            <%} else {%>
                                                                            <option value='summary'><%= i18n.tr("Summary")%></option>
                                                                            <%}%>
                                                                        </select>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <!-- ****************************************** Block For Asset Inventory Custom Report Ends here******************************************************************* -->
                                                <!-- ****************************************** Block For Patch Summary Reports starts ************************************************* -->
                                                <% if(module!=1){%>
                                                <tr>
                                                    <td colspan="5" class="wid100">
                                                        <div id="PatchSummaryReportDiv" style="display: <%=PatchSummaryReportDisplay%>">
                                                            <table cellpadding="0" cellspacing="0" width="100%" border="0">
                                                                 <select class="PatchDummyDiv1" id="PatchDummyDiv1" style="width:250px;display:none;">
                                                                    <option value="0">------<%= i18n.tr("choose")%>------</option>
                                                                </select>
                                                                <select class="PatchDummyDiv2" id="PatchDummyDiv2" style="width:250px;display:none;">
                                                                    <option value="0">------<%= i18n.tr("choose")%>------</option>
                                                                </select>
                                                                <select class="PatchDummyDiv3" id="PatchDummyDiv3" style="width:250px;display:none;">
                                                                    <option value="0">------<%= i18n.tr("choose")%>------</option>
                                                                </select>
                                                                <select class="PatchDummyDiv4" id="PatchDummyDiv4" style="width:250px;display:none;">
                                                                    <option value="0">------<%= i18n.tr("choose")%>------</option>
                                                                </select>
                                                                <select class="PatchDummyDiv5" id="PatchDummyDiv5" style="width:250px;display:none;">
                                                                    <option value="0">------<%= i18n.tr("choose")%>------</option>
                                                                </select>
                                                                <select class="PatchDummyDiv6" id="PatchDummyDiv6" style="width:250px;display:none;">
                                                                    <option value="0">------<%= i18n.tr("choose")%>------</option>
                                                                </select>
                                                                <select class="PatchDummyDiv7" id="PatchDummyDiv7" style="width:250px;display:none;">
                                                                    <option value="0">------<%= i18n.tr("choose")%>------</option>
                                                                </select>
                                                                <tr><td colspan="6" class="copyhdr leftPadd"><%= i18n.tr("Fields Selection")%></td></tr>
                                                                <tr>
                                                                    <td width="20%" align="right" class="formtext" ><%= i18n.tr("Filter")%></td>
                                                                    <td width="80%" align="left"  class="formfield" colspan="5">
                                                                        <select id="PatchSummaryFilter" name="PatchSummaryFilter" class="mcopy" style="width:260px">
                                                                            <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                        </select>
                                                                    </td>
                                                                </tr>
                                                                <tr class="formtext">
                                                                    <td width="20%" align="right" class="formtext" ><%= i18n.tr("Fields")%></td>
                                                                    <td width="21%" align="left"  class="formfield">
                                                                        <select id="PatchSummaryType" name="PatchSummaryType" class="mcopy" multiple size="4" style="width:260px">
                                                                            <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                        </select>
                                                                    </td>
                                                                    <td width="10%" align="center" class="formfield" >
                                                                        <span onClick="addColumn()" ><img src="right-btn.gif"></span>
                                                                        <br><br>
                                                                        <span onClick="removeOption(document.ReportsForm.PatchSummarySelectedColumns)"><img src="left-btn.gif"></span>
                                                                    </td>
                                                                    <td width="20%" align="left"  class="formfield">
                                                                        <select id="PatchSummarySelectedColumns" name="PatchSummarySelectedColumns" class="mcopy" multiple size="4" style="width:260px">
                                                                            <%  set = selectedFields.entrySet();
                                                                                itr = set.iterator();
                                                                                if (itr.hasNext()) {
                                                                                    itr.next();
                                                                                }
                                                                                while (itr.hasNext()) {
                                                                                    Map.Entry mEntry = (Map.Entry) itr.next();
                                                         key = (String) (mEntry.getKey());
                                                         value = (String) (mEntry.getValue());%>
                                                                            <option value="<%=key%>" selected><%=value%></option>
                                                                            <% } %>
                                                                        </select>
                                                                    </td>
                                                                    <td width="10%" class="formfield" align="center">
                                                                        <span onClick="moveOptionUp(document.ReportsForm.PatchSummarySelectedColumns)" ><img src="up-btn.gif"></span>
                                                                        <br><br>
                                                                        <span onClick="moveOptionDown(document.ReportsForm.PatchSummarySelectedColumns)"><img src="down-btn.gif"></span>
                                                                    </td>
                                                                    <td width="15%" >&nbsp;</td>
                                                                </tr>
                                                                <tr><td colspan="6" class="copyhdr leftPadd"><%= i18n.tr("Advanced Filter")%></td></tr>
                                                                <tr>
                                                                    <td width="20%" class="formtext"><%= i18n.tr("Filter")%></td>
                                                                    <td width="20%" align="left"  class="formfield">
                                                                        <select id="patchFilterAdv" name="patchFilterAdv" class="mcopy" style="width:260px">
                                                                            <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                        </select>
                                                                    </td>
                                                                    <td width=10%" class="formtext"><%= i18n.tr("Type")%></td>
                                                                    <td width="20%" align="left"  class="formfield" colspan="2">
                                                                        <select id="patchTypeAdv" name="patchTypeAdv" class="mcopy" style="width:260px">
                                                                            <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                        </select>
                                                                    </td>
                                                                    <td width=20%" class="formtext">&nbsp;</td>
                                                                </tr>
                                                                <tr class="formtext">
                                                                    <td width="20%" class="formtext"><%= i18n.tr("Criteria")%></td>
                                                                    <td width="20%" align="left"  class="formfield">
                                                                        <select id="patchCriteria" name="patchCriteria" class="mcopy" style="width:260px" onchange="displatNoteDiv(this.value)" >
                                                                            <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                        </select>
                                                                    </td>
                                                                    <td width="10%" class="formtext"><%= i18n.tr("Value")%></td>
                                                                    <td width="20%" align="left"  class="formfield" colspan="2">
                                                                        <div id="PatchAdvFilterValue_TextBoxDiv" name="PatchAdvFilterValue_TextBoxDiv" style="display: block;">
                                                                            <input type="text" id="patchValueAdv" name="patchValueAdv" class="mcopy" size="40">
                                                                        </div>
                                                                        <div id="PatchAdvFilterValue_SelectBoxDiv" name="PatchAdvFilterValue_SelectBoxDiv" style="display: none;">
                                                                            <select id="patchValueAdv_selectBox" name="patchValueAdv_selectBox" class="mcopy" style="width:260px">
                                                                                <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                            </select>
                                                                        </div>
                                                                    </td>
                                                                    <td width="30%" align="left"  class="formfield rightAlign" colspan="2">
                                                                        <input  type="button"  value=" <%=i18n.tr("Add")%> "  class="addbuttons greenBtn"  onclick="addAdvFilters()">
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td colspan="6" class="wid100">
                                                                        <table border="0" width="100%">
                                                                            <tr class="tableHeader importantFlex">
                                                                                <td width="10%" class="copyhdr"  align="center">&nbsp;</td>
                                                                                <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Type")%></td>
                                                                                <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Criteria")%></td>
                                                                                <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Value")%></td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td colspan="4" class="wid100">
                                                                                    <div id="PatchReportAdvFilterDiv">
                                                                                        <%  for (int p = 0; p < filterData.size(); p++) {
                                                                                                String patchdata[] = (String[]) filterData.get(p);
                                                                                                String operatorText = patchdata[4];
                                                                                                if (operatorText.equals(">")) {
                                                                                                    operatorText = i18n.tr("GREATER THAN");
                                                                                                } else if (operatorText.equals("<")) {
                                                                                                    operatorText = i18n.tr("LESS THAN");
                                                                                                } else if (operatorText.equals("=")) {
                                                                                                    operatorText = i18n.tr("EQUALS");
                                                                                                }
                                                                                                String valueToDisplay = patchdata[5];
                                                                                                if (patchdata[5].contains("|&&|")) {
                                                                                                    String tmpAdvFiltervalue[] = patchdata[5].split("\\|&\\&\\|");
                                                                                                    valueToDisplay = tmpAdvFiltervalue[1];
                                                                                                }
                                                                                        %>
                                                                                        <div id='PatchFilterDivEdit<%=p%>'>
                                                                                            <table border='0' width='100%' cellpadding="1" cellspacing="1">
                                                                                                <tr class='formfield ruleList applyWid50'>
                                                                                                    <td width='10%' class='formfield' align="center"><span style="cursor: pointer" class="skipStyle" onclick="removeDiv('PatchFilterDivEdit<%=p%>')"><img src="fault_x.gif" class="deleteRule" title="<%=i18n.tr("Delete filter")%>"> </span></td>
                                                                                                    <td width='30%' class='formfield' align="center"><%=i18n.tr(patchdata[1])%></td>
                                                                                                    <td width='30%' class='formfield' align="center"><%=operatorText.toUpperCase()%></td>
                                                                                                    <td width='30%' class='formfield' align="center"><%=i18n.tr(valueToDisplay)%>
                                                                                                        <input type='hidden' name='PatchFilterConfigDetailsID' id='PatchFilterConfigDetailsID' value='<%=patchdata[0]%>'>
                                                                                                        <input type='hidden' name='PatchFilterName' id='PatchFilterName' value='<%=patchdata[2]%>'>
                                                                                                        <input type='hidden' name='PatchFilterDisplayName' id='PatchFilterDisplayName' value='<%=patchdata[1]%>'>
                                                                                                        <input type='hidden' name='PatchFilterOperator' id='PatchFilterOperator' value='<%=patchdata[4]%>'>
                                                                                                        <input type='hidden' name='PatchFilterValue' id='PatchFilterValue' value='<%=patchdata[5]%>'>
                                                                                                        <input type='hidden' name='PatchFilterTableName' id='PatchFilterTableName' value='<%=patchdata[3]%>'>
                                                                                                    </td>
                                                                                                </tr>
                                                                                            </table>
                                                                                        </div>
                                                                                        <% }%>
                                                                                    </div>
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </div>
                                                    </td>
                                                </tr>                        
                                                <!-- ****************************************** Patch Summary Reports Ends ************************************************************* --> 
                                                <!--- **************************************** Block For IT Automation Analytical Report starts here ***************************************************************** -->                              
                                                <tr class="formfield whiteBg">
                                                    <td colspan="5" class="wid100">
                                                        <div id="AnalyticalReportsDiv" style="display: <%= AnalyticalBlockDisplay%>">
                                                            <table width='100%' cellpadding="0" cellspacing="0" border="0" >
                                                                <tr>
                                                                    <td colspan="3" class="wid100">
                                                                        <table width='100%' cellpadding="0" cellspacing="0" border="0">
                                                                            <tr>
                                                                    <td class='formtext' width="15%">
                                                                        <%= i18n.tr("Level One Filter")%>
                                                                    </td>
                                                                    <td class='formfield' width='30%'>
                                                                        <select id="ITAutofilterone" name="ITAutofilterone" class="mcopy" style="width: 260px">
                                                                            <option value="">-------- <%= i18n.tr("Select Filter")%> ---------</option>
                                                                            <optgroup label="<%= i18n.tr("IT Automation Tasks")%>">
                                                                                <%  data = null;
                                                                                    selectedFilter = "";
                                                                                    if (request.getParameter("ReportID") != null && (reportType == 16 || reportType == 8 || reportType==20 || reportType==21)) {
                                                                                        data = reportsObj.getITASelectedFilters(reportID, 4,telantName);
                                                                                        selectedFilter = data[0];
                                                                                    }
                                                        if (selectedFilter.equalsIgnoreCase("jobcategorymaster.All")) {%>
                                                                                <option value="jobcategorymaster.All" selected><%= i18n.tr("All")%></option>
                                                                                <%} else {%>
                                                                                <option value="jobcategorymaster.All"><%= i18n.tr("All")%></option>
                                                                                <% }
                                                                                    rs = stmt.executeQuery("SELECT JobCategoryID, JobCategoryName from jobcategorymaster where isVisible=1 and JobCategoryType=1 order by JobCategoryName");
                                                                                    while (rs.next()) {
                                                                    String key_val = "jobcategorymaster." + rs.getString(1);
                                                                    if (key_val.equalsIgnoreCase(selectedFilter)) {%>
                                                                                <option value="<%=key_val%>" selected><%=i18n.tr(rs.getString(2))%></option>
                                                                                <%} else {%>
                                                                                <option value="<%=key_val%>"><%=i18n.tr(rs.getString(2))%></option>
                                                                                <% }
                                                                            }rs.close();%>
                                                                            </optgroup>
                                                                        </select>
                                                                        <%if (data != null) {%>
                                                                        <input type="hidden" name="ITAutofilteronesub" id="ITAutofilteronesub" value="<%=data[1]%>"/>
                                                                        <%}%>
                                                                        <input type="hidden" name="ITAutofilteronename" id="ITAutofilteronename" value="<%=selectedFilter%>"/>
                                                                    </td>
                                                                    <td class='formfield' width='30%' align="left">
                                                                        <select style='width:360px;' id="ITAutofilteronevalues" name="ITAutofilteronevalues" class="mcopy" size='5' multiple="multiple" >
                                                                        </select>	
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td colsapn="3">&nbsp;</td>
                                                                </tr>
                                                                </table></td></tr>
                                                                <tr><td colspan="3" class="wid100">
                                                                        <table width='100%' cellpadding="0" cellspacing="0" border="0">
                                                                            <tr>
                                                                    <td class='formtext' width="15%"><%= i18n.tr("Level Two Filter")%></td>
                                                                    <td class='formfield' width="30%">
                                                                        <select id="ITAutofiltertwo" name="ITAutofiltertwo" class="mcopy" style="width: 260px">
                                                                            <%  data = reportsObj.getITASelectedFilters(reportID, 5,telantName);
                                                                                if (data[0] != null) {
                                                                                    selectedFilter = data[0];
                                                                                    if (selectedFilter.equalsIgnoreCase("")) {
                                                                            %>
                                                                            <option value="" selected>-------- <%= i18n.tr("Select Filter")%> ---------</option>
                                                                            <% } else {%>
                                                                            <option value="">-------- <%= i18n.tr("Select Filter")%> ---------</option>
                                                                            <% }
                                                      if (selectedFilter.equalsIgnoreCase("status.0")) {%>
                                                                            <option value="status.0" selected><%= i18n.tr("Job Status")%></option>
                                                                            <% } else {%>
                                                                            <option value="status.0"><%= i18n.tr("Job Status")%></option>
                                                                            <% }%>
                                                                            <%} else {%>
                                                                            <option value="" selected>-------- <%= i18n.tr("Select Filter")%> ---------</option>
                                                                            <option value="status.0"><%= i18n.tr("Job Status")%></option>
                                                                            <%}%>
                                                                        </select><span class="hiddenDisplay"&nbsp;&nbsp;></span>
                                                                        <input type="hidden" name="ITAutofiltertwosub" id="ITAutofiltertwosub" value="<%=data[1]%>"/>
                                                                        <input type="hidden" name="ITAutofiltertwoname" id="ITAutofiltertwoname" value="<%=selectedFilter%>"/>
                                                                    </td><td class='formfield' width='30%' align="left">
                                                                        <select style='width:360px;' id="ITAutofiltertwovalues" name="ITAutofiltertwovalues" class="mcopy" size='5' multiple="multiple">
                                                                        </select>
                                                                    </td>
                                                                </tr>
                                                                        </table></td></tr>
                                                                <tr>
                                                                    <td colspan="5">
                                                                        <div id="automationcommonblock" style="display:<%=automationcommonblock%>">
                                                                                <table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
                                                                                    <tr>
                                                                                        <td class='formtext' width="20%">
                                                                                            <%= i18n.tr("Time Scale").replace(" ","&nbsp;")%>
                                                                                        </td>
                                                                                        <td class='formfield'  width="80%">
                                                                                                            <select id="ITAutotimeselected" name="ITAutotimeselected" class="mcopy"  onchange="clearPatchTimeFilter(1,'ITAutotimeselected','ITAutoGENFROM','ITAutoGENTO')" style="width:150px;">
                                                                                                                    <%if (str_TimePeriod.equalsIgnoreCase("All")) { %>
                                                                                                                   <option value="All" selected><%= i18n.tr("All")%></option>
                                                                                                                    <%  } else {%>
                                                                                                                    <option value="All"><%= i18n.tr("All")%></option>
                                                                                                                    <%  }%>
                                                                                                                    <%= Sapphire.getTimescaleSelectList(str_TimePeriod,0,telantName,session) %>
                                                                                                            </select>	                      	
                                                                                        </td>
                                                                                    </tr>
                                                                <%  String  autoTime[] = {"", ""};
                                                                    if (str_TimePeriod.contains("and")) {
                                                                        autoTime = str_TimePeriod.split("and");
                                                                        autoTime[0] = sappObj.getUserTimeZoneDate(autoTime[0].trim(), mysqlTimezone,conn,telantName);
                                                                        autoTime[1] = sappObj.getUserTimeZoneDate(autoTime[1].trim(), mysqlTimezone,conn,telantName);
                                                                    } %>
                                                                <tr>
                                                                    <td align="right"  width="13%" class="formtext"><%= i18n.tr("Custom Time")%></td>
                                                                    <td width="10%" class="formfield wid250px">
                                                                        <label class="fieldLabelText"><%=i18n.tr("From")%></label>
                                                                        <input class="mcopy wid250px bottomMargin10" id="ITAutoGENFROM" type="text" name="ITAutoGENFROM" size="20" value="<%=autoTime[0]%> " onfocus="showCalendarControl(this);" onClick="clearPatchTimeFilter(2,'ITAutotimeselected','ITAutoGENFROM','ITAutoGENTO')">
                                                                        <label class="fieldLabelText"><%= i18n.tr("To")%></label>
                                                                        <input class="mcopy wid250px" id="ITAutoGENTO" type="text" name="ITAutoGENTO" size="20" value="<%=autoTime[1]%> " onfocus="showCalendarControl(this);" onClick="clearPatchTimeFilter(2,'ITAutotimeselected','ITAutoGENFROM','ITAutoGENTO')">
                                                                    </td>
                                                                </tr>
                                                                                            </table>
                                                                                        </td>
                                                                                    </tr>
                                                                                    <tr>
                                                                                        <td colspan="5">
                                                                                             <div  id="ITAcharttyperow" style="display:<%=ITAcharttypevalue%>">
                                                                                <table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
                                                                                    <tr>
                                                                                        <td class='formtext' width="20%"><%= i18n.tr("Chart Type")%></td>
                                                                                        <td class='formfield' width="80%">
                                                                                            <select id="ITAutocharttype" name="ITAutocharttype" class="mcopy" style="width:150px;">
                                                                                                <% if (chartType.equalsIgnoreCase("summary")) {%>
                                                                                                <option value='summary' selected><%= i18n.tr("Summary")%></option>
                                                                                                <%} else {%>
                                                                                                <option value='summary'><%= i18n.tr("Summary")%></option>
                                                                                                <%}%>
                                                                                                <% if (chartType.equalsIgnoreCase("bar")) {%>
                                                                                                <option value='bar' selected><%= i18n.tr("Bar")%></option>
                                                                                                <%} else {%>
                                                                                                <option value='bar'><%= i18n.tr("Bar")%></option>
                                                                                                <%}%>
                                                                                                <% if (chartType.equalsIgnoreCase("treand")) {%>
                                                                                                <option value='treand' selected><%= i18n.tr("Trend")%></option>
                                                                                                <%} else {%>
                                                                                                <option value='treand'><%= i18n.tr("Trend")%></option>
                                                                                                <%}%>
                                                                                                <% if (chartType.equalsIgnoreCase("stackedbar")) {%>
                                                                                                <option value='stackedbar' selected><%= i18n.tr("Stacked Bar")%></option>
                                                                                                <%} else {%>
                                                                                                <option value='stackedbar'><%= i18n.tr("Stacked Bar")%></option>
                                                                                                <%}%>
                                                                                                <% if (chartType.equalsIgnoreCase("pie")) {%>
                                                                                                <option value='pie' selected><%= i18n.tr("Pie")%></option>
                                                                                                <%} else {%>
                                                                                                <option value='pie'><%= i18n.tr("Pie")%></option>
                                                                                                <%}%>
                                                                                                <% if (chartType.equalsIgnoreCase("statisticalsummary")) {%>
                                                                                                <option value='statisticalsummary' selected><%= i18n.tr("Statistical Summary")%></option>
                                                                                                <%} else {%>
                                                                                                <option value='statisticalsummary'><%= i18n.tr("Statistical Summary")%></option>
                                                                                                <%}%>
                                                                                            </select>	                       	
                                                                                        </td>
                                                                                    </tr>
                                                                                    </table>
                                                                                            </div>
                                                                                     </td>
                                                                                    </tr> 
                                                                                    <tr>
                                                                                        <td colspan="5">
                                                                                             <div  id="ITAChartdisplaytyperow" style="display:<%=ITAchartdisplaytypevalue%>">
                                                                                             <table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
                                                                                                 <tr>
                                                                                        <td class='formtext' width="20%"><%= i18n.tr("Chart Display Type")%></td>
                                                                                        <td class='formfield'  width="80%">
                                                                                            <select id="ITAutochartrepresentation" name="ITAutochartrepresentation" class="mcopy" style="width:150px;">
                                                                                                <% if (displayType.equalsIgnoreCase("0")) {%>
                                                                                                <option value='0' selected><%= i18n.tr("Single")%></option>
                                                                                                <option value='1'><%= i18n.tr("Multiple")%></option>
                                                                                                <%} else {%>
                                                                                                <option value='0' ><%= i18n.tr("Single")%></option>
                                                                                                <option value='1' selected><%= i18n.tr("Multiple")%></option>
                                                                                                <%}%>
                                                                                            </select>
                                                                                        </td>
                                                                                    </tr>
                                                                                       </table>
                                                                                             </div>
                                                                                        </td>
                                                                                    </tr>
                                                                                </table>
                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                                <% } %>
                                                <!----**** IT Automation Custom Reports Starts here ***************-->
                                                <tr>
                                                    <td colspan="5">
                                                        <div id="CustomReportDiv" style="display:<%=CustomBlockDisplay%>">
                                                            <table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
                                                                <tr>
                                                                    <td class="formtext" width="20%"><%= i18n.tr("Custom Query").replace(" ","&nbsp;")%></td>
                                                                    <td class="formfield" width="80%" colspan="4">
                                                                        <select id="ITAchartdisplaytype" name="ITAchartdisplaytype" class="mcopy"   style="width:310px;">
                                                                            <%  rs = stmt.executeQuery("select Id,DisplayName from asset_inv_querybuilder where type=1 and displayname like '%patch%' order by DisplayName");
                                                                                while (rs.next()) {
                                                                                    if (srt_query.equalsIgnoreCase("CustomQuery=" + rs.getString(1))) {%>
                                                                            <option value="CustomQuery=<%=rs.getInt(1)%>" selected><%=i18n.tr(rs.getString(2))%></option>
                                                                            <% } else { %>
                                                                            <option value="CustomQuery=<%=rs.getString(1)%>"><%=i18n.tr(rs.getString(2))%></option>
                                                                            <% }
                                                                }rs.close();%>
                                                                        </select>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td align="right"  width="20%" class="formtext"><%= i18n.tr("Time Scale")%></td>
                                                                    <td width="80%"  class="formfield"  colspan="4">
                                                                        <select id="ITAtimeselected" name="ITAtimeselected" class="mcopy" onchange="clearPatchTimeFilter(1,'ITAtimeselected','ITAGENFROM','ITAGENTO')" style="width:150px;">
                                                                            <%  if (str_TimePeriod.equalsIgnoreCase("All")) {%>
                                                                            <option value="All" selected><%= i18n.tr("All")%></option>
                                                                            <% } else {%>
                                                                            <option value="All"><%= i18n.tr("All")%></option>
                                                                            <% }%>
                                                                            <%= Sapphire.getTimescaleSelectList(str_TimePeriod,0,telantName,session) %>
                                                                        </select>
                                                                    </td>
                                                                </tr>
                                                                <%  String str_time1[] = {"", ""};
                                                                    if (str_TimePeriod.contains("and")) {
                                                                        str_time1 = str_TimePeriod.split("and");
                                                                    }%>
                                                                <tr>
                                                                    <td class='formtext' width="20%"><%= i18n.tr("Custom  Time")%></td>
                                                                    <td width="80%" height="35"  class="formfield" colspan="4">
                                                                        <div id="ITAoverDiv" style="position:absolute; visibility:hidden; z-index:100;"></div>
                                                                        <label><%= i18n.tr("From")%></label>
                                                                        <input class="mcopy" id="ITAGENFROM" type="text" name="ITAGENFROM" size="20" value="<%=str_time1[0]%>" onfocus="showCalendarControl(this);" onclick="clearPatchTimeFilter(2,'ITAtimeselected','ITAGENFROM','ITAGENTO')">
                                                                        <label><%= i18n.tr("To")%></label>
                                                                        <input class="mcopy" id="ITAGENTO" type="text" name="ITAGENTO" size="20" value="<%=str_time1[1]%>" onfocus="showCalendarControl(this);" onclick="clearPatchTimeFilter(2,'ITAtimeselected','ITAGENFROM','ITAGENTO')">
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td class='formtext' width="20%"><%= i18n.tr("Chart Type")%>
                                                                        <input type="hidden" name="ITAchartrepresentation" id="ITAchartrepresentation" value="1"/>
                                                                    </td>
                                                                    <td class='formfield' width="80%" colspan="4">
                                                                        <select id="ITAcharttype" name="ITAcharttype" class="mcopy">
                                                                            <% if (chartType.equalsIgnoreCase("summary")) {%>
                                                                            <option value='summary' selected><%= i18n.tr("Summary")%></option>
                                                                            <%} else {%>
                                                                            <option value='summary'><%= i18n.tr("Summary")%></option>
                                                                            <%}%>
                                                                        </select>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <!----**** IT Automation Custom Reports ends here ***************-->
                                                <% if(module!=1){%>
                                                <tr>
                                                    <td colspan="5" class="wid100">
                                                        <div id="AntivirusFieldsDiv" style="display:<%=AntiVirusBlock%>" >
                                                            <table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
                                                                <tr><td colspan="6" class="copyhdr leftPadd"><%= i18n.tr("Fields Selection")%></td></tr>
                                                                <tr class="formtext">
                                                                    <td width="20%" align="right" class="formtext" ><%= i18n.tr("Fields")%></td>
                                                                    <td width="21%" align="left"  class="formfield">
                                                                        <select id="Field" name="Field" class="mcopy" multiple size="4" style="width:260px">
                                                                            <option value="All"><%= i18n.tr("All")%></option>
                                                                            <%int configid = 0;
                                                                                rs = stmt.executeQuery("select configid from inventoryreport_configmaster where ReportCategoryName='Antivirus Fields' and ModuleID=7");
                                                                                if (rs.next()) {
                                                                                    configid = rs.getInt(1);
                                                                                }rs.close();
                                                                                rs = stmt.executeQuery("select configdetailsid,displayname,columnname,tablename from inventoryreport_configdetails where configid=" + configid);
                                                                                while (rs.next()) {
                                                                                    String VirusParams = rs.getString(1) + "|@@|" + rs.getString(2) + "|@@|" + rs.getString(3) + "|@@|" + rs.getString(4);
                                                                            %>
                                                                            <option value="<%=VirusParams%>"><%=i18n.tr(rs.getString(2))%></option>
                                                                            <%}rs.close();%>
                                                                        </select>
                                                                    </td>
                                                                    <td width="10%" align="center" class="formfield" >
                                                                        <span onClick="addColumn()" ><img src="right-btn.gif"></span>
                                                                        <br><br>
                                                                        <span onClick="removeOption(document.ReportsForm.AntiVirusColumns)"><img src="left-btn.gif"></span>
                                                                    </td>
                                                                    <td width="20%" align="left"  class="formfield">
                                                                        <select id="AntiVirusColumns" name="AntiVirusColumns" class="mcopy" multiple size="4" style="width:260px">
                                                                            <%
                                                                                set = selectedFields.entrySet();
                                                                                itr = set.iterator();
                                                                                while (itr.hasNext()) {
                                                                                    Map.Entry mEntry = (Map.Entry) itr.next();
                                                         key = (String) (mEntry.getKey());
                                                         value = (String) (mEntry.getValue());%>
                                                                            <option value="<%=key%>" selected><%=value%></option>
                                                                            <% }%>
                                                                        </select>
                                                                    </td>
                                                                    <td width="10%" class="formfield" align="center">
                                                                        <span onClick="moveOptionUp(document.ReportsForm.AntiVirusColumns)" ><img src="up-btn.gif"></span>
                                                                        <br><br>
                                                                        <span onClick="moveOptionDown(document.ReportsForm.AntiVirusColumns)"><img src="down-btn.gif"></span>
                                                                    </td>
                                                                    <td width="15%" >&nbsp;</td>
                                                                </tr>
                                                                <tr><td colspan="6" class="copyhdr leftPadd"><%= i18n.tr("Advanced Filter")%></td></tr>
                                                                <tr>
                                                                    <td width="20%" align="right" class="formtext" ><%= i18n.tr("Filter")%></td>
                                                                    <td width="21%" align="left"  class="formfield">
                                                                        <select id="AntiVirusFilter" name="AntiVirusFilter" class="mcopy" style="width:260px">
                                                                            <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                            <option value="Antivirus Fields"><%= i18n.tr("Antivirus Filters")%></option>
                                                                        </select>
                                                                    </td>
                                                                    <td width="20%" align="right" class="formtext" ><%= i18n.tr("Type")%></td>
                                                                    <td width="21%" align="left"  class="formfield">
                                                                        <select id="AntiVirusFilterType" name="AntiVirusFilterType" class="mcopy" style="width:260px">
                                                                            <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                        </select>  
                                                                    </td>
                                                                    <td width="20%" align="right" class="formfield" colspan="2">&nbsp;</td>
                                                                </tr>  
                                                                <tr class="formtext">
                                                                    <td width="20%" class="formtext"><%= i18n.tr("Criteria")%></td>
                                                                    <td width="20%" align="left"  class="formfield">
                                                                        <select id="AntiVirusCriteria" name="AntiVirusCriteria" class="mcopy" style="width:260px" onchange="displatNoteDiv(this.value)" >
                                                                            <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                            <option value="Like"><%= i18n.tr("LIKE")%></option>
                                                                            <option value="Not Like"><%= i18n.tr("NOT LIKE")%></option>
                                                                        </select>
                                                                    </td>
                                                                    <td width="10%" class="formtext"><%= i18n.tr("Value")%></td>
                                                                    <td width="20%" align="left"  class="formfield" colspan="2">
                                                                        <div id="AntiVirusValueAdv_TextBoxDiv" name="AntiVirusValueAdv_TextBoxDiv" style="display: none;">
                                                                            <input type="text" id="AntiVirusValueAdv" name="AntiVirusValueAdv" class="mcopy" size="40">
                                                                        </div>
                                                                        <div id="AntiVirusValueAdv_selectBoxDiv" name="AntiVirusValueAdv_selectBoxDiv" style="display: block;">
                                                                            <select id="AntiVirusValueAdv_selectBox" name="AntiVirusValueAdv_selectBox" class="mcopy" style="width:260px">
                                                                                <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                            </select>
                                                                        </div>
                                                                    </td>
                                                                    <td width="30%" align="left"  class="formfield rightAlign" colspan="2">
                                                                        <input  type="button"  value=" Add "  class="addbuttons greenBtn"  onclick="addAntiVirusFilter()">
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td colspan="6" class="wid100">
                                                                        <table border="0" width="100%">
                                                                            <tr class="tableHeader importantFlex">
                                                                                <td width="10%" class="copyhdr"  align="center">&nbsp;</td>
                                                                                <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Type")%></td>
                                                                                <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Criteria")%></td>
                                                                                <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Value")%></td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td colspan="4" class="wid100">
                                                                                    <div id="AntivirusAdvFilterDiv">
                                                                                        <%for (int av = 0; av < filterData.size(); av++) {
                                                                                                String virusdata[] = (String[]) filterData.get(av);
                                                                                        %>
                                                                                        <div id='VirusFilterDivEdit<%=av%>'>
                                                                                            <table border='0' width='100%' cellpadding="1" cellspacing="1">
                                                                                                <tr class='formfield ruleList applyWid50'>
                                                                                                    <td width='10%' class='formfield' align="center"><span style="cursor: pointer" class="skipStyle" onclick="removeDiv('VirusFilterDivEdit<%=av%>')"><img src="fault_x.gif" class="deleteRule" title="<%=i18n.tr("Delete filter")%>"> </span></td>
                                                                                                    <td width='30%' class='formfield' align="center"><%=virusdata[1]%></td>
                                                                                                    <td width='30%' class='formfield' align="center"><%=virusdata[4]%></td>
                                                                                                    <%if((virusdata[1]).equalsIgnoreCase("Scan Enabled")){
                                                                                                       if((virusdata[5]).equalsIgnoreCase("true")){ %>
                                                                                                       <td width='30%' class='formfield' align="center"><%= i18n.tr("Scan Enabled")%></td>
                                                                                                       <%}else{%>
                                                                                                       <td width='30%' class='formfield' align="center"><%= i18n.tr("Scan Not Enabled")%></td>
                                                                                                    <%}
                                                                                                    }else if((virusdata[1]).equalsIgnoreCase("product Upto Date")){
                                                                                                        if((virusdata[5]).equalsIgnoreCase("true")){%>
                                                                                                        <td width='30%' class='formfield' align="center"><%= i18n.tr("Product Upto Date")%></td>
                                                                                                    <%}else{%>
                                                                                                    <td width='30%' class='formfield' align="center"><%= i18n.tr("Product Not Upto Date")%></td>
                                                                                                    <%}
                                                                                                    }else{%>
                                                                                                    <td width='30%' class='formfield' align="center"><%=virusdata[5]%>
                                                                                                    <%}%>
                                                                                                        <input type='hidden' name='VirusFilterConfigDetailsID' id='VirusFilterConfigDetailsID' value='<%=virusdata[0]%>'>
                                                                                                        <input type='hidden' name='VirusFilterName' id='VirusFilterName' value='<%=virusdata[2]%>'>
                                                                                                        <input type='hidden' name='VirusFilterDisplayName' id='VirusFilterDisplayName' value='<%=virusdata[1]%>'>
                                                                                                        <input type='hidden' name='VirusFilterOperator' id='VirusFilterOperator' value='<%=virusdata[4]%>'>
                                                                                                        <input type='hidden' name='VirusFilterValue' id='VirusFilterValue' value='<%=virusdata[5]%>'>
                                                                                                        <input type='hidden' name='VirusFilterTableName' id='VirusFilterTableName' value='<%=virusdata[3]%>'>
                                                                                                    </td>
                                                                                                </tr>
                                                                                            </table>
                                                                                        </div>
                                                                                        <%                                                             }%>
                                                                                    </div>
                                                                                </td>
                                                                            </tr> 
                                                                        </table>
                                                                    </td>
                                                                </tr> 
                                                                 <tr>
                                                            <td colspan="6" class="wid100">
                                                                <div  id ="avTimeFilter">
                                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" valign="top">
                                                                         <tr><td colspan="5" class="copyhdr leftPadd"><%= i18n.tr("Time Filter")%></td></tr>
                                                                        <tr>
                                                                            <td align="right"  width="20%" class="formtext"><%= i18n.tr("Time Scale")%></td>
                                                                            <td width="80%"  class="formfield"  colspan="4">
                                                                                <select id="avTimeScale" name="avTimeScale" class="mcopy" onchange="clearPatchTimeFilter(1,'avTimeScale','avTimeFrom','avTimeTo')" style="width:150px;">
                                                                                    <% if (str_TimePeriod.equalsIgnoreCase("All")) {%>
                                                                                    <option value="All" selected><%= i18n.tr("All")%></option>
                                                                                    <%} else {%>
                                                                                    <option value="All"><%= i18n.tr("All")%></option>
                                                                                    <% }%>
                                                                                    <%= Sapphire.getTimescaleSelectList(str_TimePeriod,0,telantName,session) %>
                                                                                </select>
                                                                            </td>
                                                                        </tr>
                                                                        <%  String str_avtime[] = {"", ""};
                                                                            if (str_TimePeriod.contains("and")) {
                                                                                str_avtime = str_TimePeriod.split("and");
                                                                                str_avtime[0] = sappObj.getUserTimeZoneDate(str_avtime[0].trim(), mysqlTimezone,conn,telantName);
                                                                                str_avtime[1] = sappObj.getUserTimeZoneDate(str_avtime[1].trim(), mysqlTimezone,conn,telantName);
                                                                            }  %>
                                                                        <tr>
                                                                            <td align="right"  class="formtext"><%= i18n.tr("Custom")%>
                                                                                <%= i18n.tr("Time")%></td>
                                                                            <td width="300" height="35"  class="formfield">
                                                                                <label class="formtext onlyNewUI"><%= i18n.tr("From")%></label>
                                                                                <input class="mcopy" id="avTimeFrom" type="text" name="avTimeFrom" size="20" value="<%=str_avtime[0]%> " onfocus="showCalendarControl(this);" onClick="clearPatchTimeFilter(2,'avTimeScale','avTimeFrom','avTimeTo')">
                                                                                <label class="formtext onlyNewUI"><%= i18n.tr("To")%></label>
                                                                                <input class="mcopy" id="avTimeTo" type="text" name="avTimeTo" size="20" value="<%=str_avtime[1]%> " onfocus="showCalendarControl(this);" onClick="clearPatchTimeFilter(2,'avTimeScale','avTimeFrom','avTimeTo')">
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                            </table>    
                                                        </div>    
                                                    </td>    
                                                </tr>
                                                <tr>
                                                    <td colspan="5" class="wid100">
                                                        <div id="softwareMeteringFieldsDiv" style="display:<%=softwareMetering%>" >
                                                            <table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
                                                                <tr><td colspan="6" class="copyhdr leftPadd"><%= i18n.tr("Fields Selection")%></td></tr>
                                                                <tr class="formtext">
                                                                    <td width="20%" align="right" class="formtext" ><%= i18n.tr("Fields")%></td>
                                                                    <td width="21%" align="left"  class="formfield">
                                                                        <select id="SoftwareField" name="SoftwareField" class="mcopy" multiple size="4" style="width:260px">                                                                            
                                                                            <% configid = 0;
                                                                                if(NodeOrSoftwareOrExeLevel.equals("0")){
                                                                                    pstmt=conn.prepareStatement("select configid from inventoryreport_configmaster where ReportCategoryName='Software Metering Node Fields' and ModuleID=19");
                                                                                }else if(NodeOrSoftwareOrExeLevel.equals("1")){
                                                                                    pstmt=conn.prepareStatement("select configid from inventoryreport_configmaster where ReportCategoryName='Software Metering Software Fields' and ModuleID=19");
                                                                                }else if(NodeOrSoftwareOrExeLevel.equals("2")){
                                                                                    pstmt=conn.prepareStatement("select configid from inventoryreport_configmaster where ReportCategoryName='Software Metering Executable Fields' and ModuleID=19");
                                                                                }
                                                                                rs = pstmt.executeQuery();
                                                                                if (rs.next()) {
                                                                                    configid = rs.getInt(1);
                                                                                }rs.close();pstmt.close();
                                                                                pstmt=conn.prepareStatement("select configdetailsid,displayname,columnname,tablename from inventoryreport_configdetails where configid=?");
                                                                                pstmt.setInt(1, configid);
                                                                                rs = pstmt.executeQuery();
                                                                                while (rs.next()) {
                                                                                    String SoftwareParams = rs.getString(1)+"|@@|"+rs.getString(2);
                                                                            %>
                                                                            <option value="<%=SoftwareParams%>"><%=i18n.tr(rs.getString(2))%></option>
                                                                            <%}rs.close();pstmt.close();%>
                                                                        </select>
                                                                    </td>
                                                                    <td width="10%" align="center" class="formfield" >
                                                                        <span onClick="addColumn()" ><img src="right-btn.gif"></span>
                                                                        <br><br>
                                                                        <span onClick="removeOption(document.ReportsForm.SoftwareColumns)"><img src="left-btn.gif"></span>
                                                                    </td>
                                                                    <td width="20%" align="left"  class="formfield">
                                                                        <select id="SoftwareColumns" name="SoftwareColumns" class="mcopy" multiple size="4" style="width:260px">
                                                                            <% set = selectedFields.entrySet();
                                                                                itr = set.iterator();
                                                                                while (itr.hasNext()) {
                                                                                    Map.Entry mEntry = (Map.Entry) itr.next();
                                                                                    key = (String) (mEntry.getKey());
                                                                                    value = (String) (mEntry.getValue());%>
                                                                            <option value="<%=key%>" selected><%=value%></option>
                                                                            <% }%>
                                                                        </select>
                                                                    </td>
                                                                    <td width="10%" class="formfield" align="center">
                                                                        <span onClick="moveOptionUp(document.ReportsForm.SoftwareColumns)" ><img src="up-btn.gif"></span><br><br>
                                                                        <span onClick="moveOptionDown(document.ReportsForm.SoftwareColumns)"><img src="down-btn.gif"></span>
                                                                    </td>
                                                                    <td width="15%" >&nbsp;</td>
                                                                </tr>
                                                                <tr><td colspan="6" class="copyhdr leftPadd"><%= i18n.tr("Advanced Filter")%></td></tr>
                                                                <tr>
                                                                    <td width="20%" align="right" class="formtext" ><%= i18n.tr("Filter")%></td>
                                                                    <td width="21%" align="left"  class="formfield">
                                                                        <select id="SoftwareMeteringFilter" name="SoftwareMeteringFilter" class="mcopy" style="width:260px">
                                                                            <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                            <option value="Software Metering Fields"><%= i18n.tr("Software Metering Filters")%></option>
                                                                        </select>
                                                                    </td>
                                                                    <td width="20%" align="right" class="formtext" ><%= i18n.tr("Type")%></td>
                                                                    <td width="21%" align="left"  class="formfield" colspan="4">
                                                                        <select id="SoftwareMeteringFilterType" name="SoftwareMeteringFilterType" class="mcopy" style="width:260px">
                                                                            <option value="">--<%=i18n.tr("choose")%>--</option>
                                                                        </select>  
                                                                    </td>    
                                                                </tr>  
                                                                <tr class="formtext">
                                                                    <td width="20%" class="formtext"><%= i18n.tr("Criteria")%></td>
                                                                    <td width="20%" align="left"  class="formfield">
                                                                        <select id="SoftwareMeteringCriteria" name="SoftwareMeteringCriteria" class="mcopy" style="width:260px" onchange="displatNoteDiv(this.value)" >
                                                                            <option value="">--<%=i18n.tr("choose")%>--</option>                                                                            
                                                                        </select>
                                                                    </td>
                                                                    <td width="10%" class="formtext"><%= i18n.tr("Value")%></td>
                                                                    <td width="20%" align="left"  class="formfield" colspan="2">
                                                                        <input type="text" id="SoftwareMeterValueAdv" name="SoftwareMeterValueAdv" class="mcopy" size="40">                                                                        
                                                                    </td>
                                                                    <td width="30%" align="left"  class="formfield rightAlign" colspan="2">
                                                                        <input  type="button"  value=" Add "  class="addbuttons greenBtn"  onclick="addSoftwareMeterFilter()">
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td colspan="6" class="wid100">
                                                                        <table border="0" width="100%">
                                                                            <tr class="tableHeader importantFlex">
                                                                                <td width="10%" class="copyhdr"  align="center">&nbsp;</td>
                                                                                <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Type")%></td>
                                                                                <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Criteria")%></td>
                                                                                <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Value")%></td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td colspan="4" class="wid100">
                                                                                    <div id="SoftwareMeterAdvFilterDiv">
                                                                                        <%for (int av = 0; av < filterData.size(); av++) {
                                                                                                String softwaredata[] = (String[]) filterData.get(av);
                                                                                                String operatorText = softwaredata[4];
                                                                                                if (operatorText.equals(">=")) {
                                                                                                    operatorText = i18n.tr("GREATER THAN OR EQUAL");
                                                                                                } else if (operatorText.equals("<=")) {
                                                                                                    operatorText = i18n.tr("LESS THAN  OR EQUAL");
                                                                                                } else if (operatorText.equals("=")) {
                                                                                                    operatorText = i18n.tr("EQUALS");
                                                                                                } else if (operatorText.equals("LAST")) {
                                                                                                    operatorText = i18n.tr("SINCE LAST");
                                                                                                }%>
                                                                                        <div id='SoftwareMeterDivEdit<%=av%>'>
                                                                                            <table border='0' width='100%' cellpadding="1" cellspacing="1">
                                                                                                <tr class="formfield ruleList applyWid50">
                                                                                                    <td width='10%' class='formfield' align="center"><span style="cursor: pointer" class="skipStyle" onclick="removeDiv('SoftwareMeterDivEdit<%=av%>')"><img src="fault_x.gif" class="deleteRule" title="<%=i18n.tr("Delete filter")%>"> </span></td>
                                                                                                    <td width='30%' class='formfield' align="center"><%=softwaredata[1]%></td>
                                                                                                    <td width='30%' class='formfield' align="center"><%=operatorText%></td>                                                                                                    
                                                                                                    <td width='30%' class='formfield' align="center"><%=softwaredata[5]%></td>                                                                                                   
                                                                                                        <input type='hidden' name='SoftwareMeterConfigDetailsID' id='SoftwareMeterConfigDetailsID' value='<%=softwaredata[0]%>'>                                                                                                        
                                                                                                        <input type='hidden' name='SoftwareMeterFilterDisplayName' id='SoftwareMeterFilterDisplayName' value='<%=softwaredata[1]%>'>
                                                                                                        <input type='hidden' name='SoftwareMeterFilterOperator' id='SoftwareMeterFilterOperator' value='<%=softwaredata[4]%>'>
                                                                                                        <input type='hidden' name='SoftwareMeterValue' id='SoftwareMeterValue' value='<%=softwaredata[5]%>'>                                                                                                        
                                                                                                    </td>
                                                                                                </tr>
                                                                                            </table>
                                                                                        </div>
                                                                                    <%}%>
                                                                                    </div>
                                                                                </td>
                                                                            </tr> 
                                                                        </table>
                                                                    </td>
                                                                </tr> 
                                                                 <tr>
                                                            <td colspan="6" class="wid100">
                                                                <div  id ="softwareTimeFilter">
                                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" valign="top">
                                                                         <tr><td colspan="5" class="copyhdr leftPadd"><%= i18n.tr("Time Filter")%></td></tr>
                                                                        <tr>
                                                                            <td align="right"  width="20%" class="formtext"><%= i18n.tr("Time Scale")%></td>
                                                                            <td width="80%"  class="formfield"  colspan="4">
                                                                                <select id="smTimeScale" name="smTimeScale" class="mcopy" onchange="clearPatchTimeFilter(1,'smTimeScale','smTimeFrom','smTimeTo')" style="width:150px;">
                                                                                    <%  if(str_TimePeriod.equals("")){
                                                                                        str_TimePeriod="ALL";
                                                                                    }if (str_TimePeriod.equalsIgnoreCase("All")) {%>
                                                                                    <option value="All" selected><%= i18n.tr("All")%></option>
                                                                                    <%} else {%>
                                                                                    <option value="All"><%= i18n.tr("All")%></option>
                                                                                    <% }%>
                                                                                    <%= Sapphire.getTimescaleSelectList(str_TimePeriod,0,telantName,session) %>
                                                                                </select>
                                                                            </td>
                                                                        </tr>
                                                                        <%  if (str_TimePeriod.contains("and")) {
                                                                                str_avtime = str_TimePeriod.split("and");
                                                                                str_avtime[0] = sappObj.getUserTimeZoneDate(str_avtime[0].trim(), mysqlTimezone,conn,telantName);
                                                                                str_avtime[1] = sappObj.getUserTimeZoneDate(str_avtime[1].trim(), mysqlTimezone,conn,telantName);
                                                                            }  %>
                                                                        <tr>
                                                                            <td align="right"  class="formtext"><%= i18n.tr("Custom")%>
                                                                                <%= i18n.tr("Time")%></td>
                                                                            <td width="300" height="35"  class="formfield">
                                                                                <label class="formtext onlyNewUI"><%= i18n.tr("From")%></label>
                                                                                <input class="mcopy" id="smTimeFrom" type="text" name="smTimeFrom" size="20" value="<%=str_avtime[0]%> " onfocus="showCalendarControl(this);" onClick="clearPatchTimeFilter(2,'smTimeScale','smTimeFrom','smTimeTo')">
                                                                                <label class="formtext onlyNewUI"><%= i18n.tr("To")%></label>
                                                                                <input class="mcopy" id="smTimeTo" type="text" name="smTimeTo" size="20" value="<%=str_avtime[1]%> " onfocus="showCalendarControl(this);" onClick="clearPatchTimeFilter(2,'smTimeScale','smTimeFrom','smTimeTo')">
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                            </table>    
                                                        </div>    
                                                    </td>    
                                                </tr>
                                                <%}%>
                                                <tr>
                                                    <td colspan="5" class="wid100">
                                                        <div id="reportsAccessDiv" style="display:block" >
                                                            <table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
                                                                <tr>
                                                                    <td class="copyhdr leftPadd"><%= i18n.tr("Access To")%></td>
                                                                    <%if(isInbuiltReport){%>
                                                                        <td class="copyhdr generalNoteImp whiteBg" align="right"><img src="Note.gif"><font color="red"><%=i18n.tr("Note")%></font>: <%=i18n.tr("Delete access permission not applicable for inbuilt report")%></td>
                                                                    <%}%>
                                                                </tr>
                                                                <tr>
                                                                    <td colspan="4">
                                                                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                                            <tr>
                                                                                <td width="20%" align="right" class="formtext"><%= i18n.tr("Roles")%></td>
                                                                                <td width="20%" align="left"  class="formfield">
                                                                                    <div id="reportRolesIDdiv">
                                                                                    <select id="reportRolesID" name="reportRolesID" class="mcopy" multiple size="5" style="width:260px;" onchange="reportAccessSelectionValidation(this.value,'reportRolesID')">
                                                                                        <option value="0"><%=i18n.tr("All")%></option>
                                                                                    </select>
                                                                                    </div>
                                                                                    <div id="reportRolesIDCMDBdiv">
                                                                                        <select id="reportRolesIDCMDB" name="reportRolesIDCMDB" class="mcopy" multiple size="5" style="width:260px;" onchange="reportAccessSelectionValidation(this.value,'reportRolesIDCMDB')">
                                                                                            <option value="0"><%=i18n.tr("All")%></option>
                                                                                        </select>
                                                                                    </div>


                                                                                </td>                                                                    
                                                                                <td width="11%" align="right" class="formtext top10" ><%= i18n.tr("Users")%></td>
                                                                                <td width="49%" align="left"  class="formfield">
                                                                                    <div class='formElem onbehalf' id='onBehalfDiv' style="width: 250px;">
                                                                                        <select id='reportUserID' name='reportUserID' multiple data-isMandatory='1' style="width: 250px;" keyPrefix='2|$$|' defaultText="<%=i18n.tr("All")%>" >
                                                                                            <option value='0'><%=i18n.tr("All")%></option>
                                                                                        </select>
                                                                                    </div>
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td colspan="6" class="wid100">
                                                                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                                            <tr>
                                                                                <td align="right" width="20%" class="formtext top10">
                                                                                    <%=i18n.tr("Access Permissions")%> 
                                                                                </td>
                                                                                <td class="formfield posRelativeInput top10" width="12%" align="left">
                                                                                    <input type="checkbox" class="gen" id="reportAccessPer" name="reportAccessPer" value="1" checked  onclick="reportAccessPermission(1)"><label class='customRadCheck'><span><span></span></span></label>&nbsp;<span><%=i18n.tr("View")%></span>
                                                                                </td>
                                                                                <td class="formfield posRelativeInput top10" width="12%" align="left">
                                                                                    <input type="checkbox" class="gen" id="reportAccessPer" name="reportAccessPer" value="2" onclick="reportAccessPermission(1)"><label class='customRadCheck'><span><span></span></span></label>&nbsp;<span><%=i18n.tr("Edit")%></span>
                                                                                </td>
                                                                                <td class="formfield posRelativeInput top10" width="12%" align="left">
                                                                                    <input type="checkbox" class="gen" id="reportAccessPer" name="reportAccessPer" value="3" onclick="reportAccessPermission(1)"><label class='customRadCheck'><span><span></span></span></label>&nbsp;<span><%=i18n.tr("Delete")%></span>
                                                                                </td>
                                                                                <td class="formfield posRelativeInput top10" width="15%" align="left">
                                                                                    <input type="checkbox" class="gen" id="reportAccessPer" name="reportAccessPer" value="0"  onclick="reportAccessPermission(2)"><label class='customRadCheck'><span><span></span></span></label>&nbsp;<span><%=i18n.tr("All")%></span>
                                                                                </td>
                                                                                <td width="29%" align="left" class="formfield wid100 rightAlign bottom10">
                                                                                    <input type="button" class="addbuttons greenBtn" value="<%=i18n.tr("Add Access")%>" onclick="addReportAccessPermissions()">
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </td>
                                                                </tr>
                                                                <tr class="bottomMargin10">
                                                                    <td colspan="7" class="wid100">
                                                                        <table border="0" width="100%">
                                                                            <tr class="tableHeader importantFlex">
                                                                                <td width="10%" class="copyhdr"  align="center"><%= i18n.tr("Delete")%></td>
                                                                                <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Access Type")%></td>
                                                                                <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Role/User Name")%></td>
                                                                                <td width="30%" class="copyhdr"  align="center"><%= i18n.tr("Permission(s)")%></td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td colspan="4" class="wid100">
                                                                                    <div id="reportAccessAppendDiv">
                                                                                        <%for(int av = 0; av < reportAccessData.size(); av++){
                                                                                                String accessData[] = (String[]) reportAccessData.get(av);%>
                                                                                        <div id='reportAccessEdit_<%=av%>'>
                                                                                            <table border='0' width='100%' cellpadding="1" cellspacing="1">
                                                                                                <tr class="formfield ruleList applyWid50">
                                                                                                    <td width='10%' class='formfield' align="center"><span style="cursor: pointer" class="skipStyle" onclick="removeDiv('reportAccessEdit_<%=av%>')"><img src="fault_x.gif" class="deleteRule" title="<%=i18n.tr("Delete permission")%>"> </span></td>
                                                                                                    <td width='30%' class='formfield' align="center"><%=accessData[0]%></td>
                                                                                                    <td width='30%' class='formfield' align="center"><%=accessData[1]%></td>                                                                                                    
                                                                                                    <td width='30%' class='formfield' align="center"><%=accessData[2]%></td>                                                                                                   
                                                                                                    <input type='hidden' name='reportAccessData' id='reportAccessData' value='<%=accessData[3]%>'/>
                                                                                                </tr>
                                                                                            </table>
                                                                                        </div>
                                                                                    <%}%>
                                                                                    </div>
                                                                                </td>
                                                                            </tr> 
                                                                        </table>
                                                                    </td>
                                                                </tr>
                                                            </table>    
                                                        </div>    
                                                    </td>    
                                                </tr>
                                                <tr class="basicButtonFooter">
                                                    <td colspan="5" align="center" class="applyNoMargin">
                                                        <br/>
                                                        <input  type="button"  name="SaveBtn" id="SaveBtn" value="<%=pageType_view%>"  class="addbuttons greenBtn"  onclick="saveReport()">&nbsp;
                                                        <input  type="button"  value="<%=i18n.tr("Cancel")%>"  class="addbuttons"  onclick="cancelReport()">
                                                         <input type="hidden" name="curr_time" id="curr_time" value="<%=current_dbTime%>" />
                                                         <input type="hidden" name="mysqlTimezone" id="mysqlTimezone" value="<%=mysqlTimezone%>">
                                                         <input type="hidden" name="utcoffset" id="utcoffset"  value="${TIMEZONE_OFFCET}" />
                                                         <input type="hidden" name="isCopyReport" id="isCopyReport" value="<c:out value="<%=request.getParameter("isCopyReport")%>"/>"/>
                                                    </td>
                                                </tr>
                                                </table>
                                            </div>
                                        </div>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <div class="widgetFooter"></div>                               
            </div>
            <jsp:include page="Sapphire_Footer.jsp" />
        </form>
    </div>
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="HostsLevel1"
        target="HostsLevel2"
        parameters="ParametersLevel1={HostsLevel1},|@@|-1,{SiteID}"
        postFunction="handleLevel1"
        parser="new ResponseXmlParser()" />
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="HostsLevel2"
        target="HostsLevel3"
        postFunction="handleLevel2"
        parameters="ParametersLevel2={HostsLevel1},{HostsLevel2},|@@|-1,{SiteID}"
        parser="new ResponseXmlParser()" />
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="outree"
        target="HostsLevel2"
        parameters="ParametersLevel3={outree},|@@|-1,{SiteID}|@@|HostProfile"
        parser="new ResponseXmlParser()" />
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="PatchSummaryFilter"
        target="PatchSummaryType"
        parameters="PatchSumamryParameterFilter={PatchSummaryFilter},0,patch,{ReportTypeHidden}"
        parser="new ResponseXmlParser()" />
    <%if(reportType == 22 || reportType == 23){%>
     <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="PatchDummyDiv2"
        target="PatchSummaryFilter"
        parameters="PatchReportLevelFilter={LinuxPatchReportLevel},0,{ReportTypeHidden}"
        preFunction="clearPatchSummaryFields"
        postFunction="loadPatchFilterAdv"
        parser="new ResponseXmlParser()" />
    <%}else{%>
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="PatchDummyDiv2"
        target="PatchSummaryFilter"
        parameters="PatchReportLevelFilter={PatchReportLevel},0,{ReportTypeHidden},{Archivelevel}"
        preFunction="clearPatchSummaryFields"
        postFunction="loadPatchFilterAdv"
        parser="new ResponseXmlParser()" />
    <%}if(reportType == 22 || reportType == 23){%>
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="PatchDummyDiv1"
        target="patchFilterAdv"
        parameters="PatchReportLevelFilter={LinuxPatchReportLevel},1,{ReportTypeHidden}"
        postFunction="loadSelectBoxes"
        parser="new ResponseXmlParser()" />
    <%}else{%>
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="PatchDummyDiv1"
        target="patchFilterAdv"
        parameters="PatchReportLevelFilter={PatchReportLevel},1,{ReportTypeHidden},{Archivelevel}"
        postFunction="loadSelectBoxes"
        parser="new ResponseXmlParser()" />
    <%}%>
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="patchFilterAdv"
        target="patchTypeAdv"
        parameters="ParameterFilter={patchFilterAdv},1,patchAdv"
        parser="new ResponseXmlParser()" />
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="patchTypeAdv"
        target="patchCriteria"
        parameters="CriteriaParam={patchTypeAdv}|$|patchAdv"
        postFunction="loadPatchcheckorTextboxAdv"
        parser="new ResponseXmlParser()" />
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="PatchDummyDiv3"
        target="patchValueAdv_selectBox"
        parameters="PatchAdvFilterValues={patchTypeAdv},{ReportTypeHidden}"
        postFunction="loadPatchcheckvalueAdv"
        parser="new ResponseXmlParser()" />
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="Filter"
        target="Type"
        parameters="ParameterFilter={Filter},0,Inv"
        parser="new ResponseXmlParser()" />
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="FilterAdv"
        target="TypeAdv"
        parameters="ParameterFilter={FilterAdv},1,Inv"
        parser="new ResponseXmlParser()" />
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="TypeAdv"
        target="Criteria"
        parameters="CriteriaParam={TypeAdv}|$|invAdv"
        postFunction="loadcheckorTextboxAdv"
        parser="new ResponseXmlParser()" />
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="AssetReportType"
        target="AssetReportTemplate"
        parameters="AssetReportTypeParam={AssetReportType}"
        parser="new ResponseXmlParser()" />
    <!-- For Asset analytical report -->
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/servicedeskCustomReportInstances?_csrf=${_csrf.token}"
        source="Assetfilterone"
        target="Assetfilteronevalues"
        parameters="make={report_template},{Assetfilterone},{AssetModuleID}"
        postFunction="selectFilteroneValues"
        parser="new ResponseXmlParser()" />
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/servicedeskCustomReportInstances?_csrf=${_csrf.token}"
        source="Assetfiltertwo"
        target="Assetfiltertwovalues"
        parameters="make={report_template},{Assetfiltertwo},{AssetModuleID}"
        postFunction="selectFiltertwoValues"
        parser="new ResponseXmlParser()" />
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/servicedeskCustomReportInstances?_csrf=${_csrf.token}"
        source="Assetadvfilter"
        target="Assetadvfiltervalues"
        parameters="make={report_template},{Assetadvfilter},{AssetModuleID}"
        parser="new ResponseXmlParser()" />
     <ajax:select
        baseUrl="${pageContext.request.contextPath}/servicedeskCustomReportInstances?_csrf=${_csrf.token}"
        source="Assetadvdatefilter"
        target="Assetadvdatefiltervalues"
        parameters="make={report_template},{Assetadvdatefilter},{AssetModuleID}&isDateFilter=yes"
        parser="new ResponseXmlParser()" />
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/servicedeskCustomReportInstances?_csrf=${_csrf.token}"
        source="ITAutofilterone"
        target="ITAutofilteronevalues"
        parameters="make={report_template},{ITAutofilterone}"
        postFunction="selectFilteroneValues"
        parser="new ResponseXmlParser()" />
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/servicedeskCustomReportInstances?_csrf=${_csrf.token}"
        source="ITAutofiltertwo"
        target="ITAutofiltertwovalues"
        parameters="make={report_template},{ITAutofiltertwo}"
        postFunction="selectFiltertwoValues"
        parser="new ResponseXmlParser()" />
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="AntiVirusFilter"
        target="AntiVirusFilterType"
        parameters="AntiVirusAdvFilterType={AntiVirusFilter}"
        parser="new ResponseXmlParser()" />
    <ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="AntiVirusFilterType"
        target="AntiVirusValueAdv_selectBox"
        parameters="AntiVirusAdvFilterValue={AntiVirusFilterType}"
        postFunction="antivirusselectortxt"
        parser="new ResponseXmlParser()" />
<ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="PatchDummyDiv4"
        target="PatchReportLevel"
        parameters="PatchSummaryReportLevel={ReportTypeHidden},{Archivelevel}"
        postFunction="loadSelectBoxes"
        parser="new ResponseXmlParser()" />
<%if(!pageType.equalsIgnoreCase("Update")){%>
<ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="PatchDummyDiv5"
        target="PatchSummaryQuery"
        parameters="PatchSummaryQueryLevel={ReportTypeHidden},{Archivelevel}"
        postFunction="loadSelectBoxes"
        parser="new ResponseXmlParser()" />
<%}%>
<ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="PatchDummyDiv7"
        target="Patchcharttype"
        parameters="PatchChartTypeRepresentation={ReportTypeHidden},{Patchcharttype}"
        parser="new ResponseXmlParser()" />
<ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="Patchcharttype"
        target="Patchchartrepresentation"
        parameters="PatchChartRepresentation={ReportTypeHidden},{Patchcharttype}"
        parser="new ResponseXmlParser()" />
<ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="SMReportlevel"
        target="SoftwareField"
        parameters="SoftwareMeteringFields={SMReportlevel}"
        postFunction="removeSoftwareColumns"
        parser="new ResponseXmlParser()" />
<ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="SoftwareMeteringFilter"
        target="SoftwareMeteringFilterType"
        parameters="SoftwareMeteringAdvFilterType={SMReportlevel}"
        parser="new ResponseXmlParser()" />
<ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="SoftwareMeteringFilterType"
        target="SoftwareMeteringCriteria"
        parameters="SoftwareMeteringAdvFilterCriteria={SoftwareMeteringFilterType}"
        parser="new ResponseXmlParser()" />
<ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="complReportType"
        target="ComplianceField"
        parameters="ComplianceFields={complReportType},columnsList"
        postFunction="removeComplianceColumns"
        parser="new ResponseXmlParser()" />
<ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="ComplianceFilter"
        target="ComplianceFilterType"
        parameters="ComplianceFields={complReportType},advanceFilterList"
        parser="new ResponseXmlParser()" />
<ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="ComplianceFilterType"
        target="ComplianceCriteria"
        parameters="ComplianceFields={ComplianceFilterType},advanceFilterOperatoreList"
        parser="new ResponseXmlParser()" />
<ajax:select
        baseUrl="${pageContext.request.contextPath}/reportsDropDown?_csrf=${_csrf.token}"
        source="compliance_Rule_Selection_Dummy"
        target="compliance_Rule_ID"
        parameters="complianceRuleName={complReportType}"
        postFunction="complianceRuleNameChange"
        parser="new ResponseXmlParser()" />
</body>
<script>
function filtersLoadOnUpdate(){
    <%if ((reportType == 2 || reportType == 8 || reportType == 9 || reportType == 14 || reportType == 16 || reportType == 18 || reportType == 19 || reportType == 20 || reportType == 21 || reportType == 22 || reportType == 23) && pageType.equalsIgnoreCase("Update")) {%>
            loadFilters();
    <%}else if(request.getParameter("isCopyReport")!=null){%>
         loadFilters();
        <%}%>
}
</script>
<%} catch (Exception e) {
        logger.error("Exception occurred in ReportsConfiguration.jsp ***** " + e.getMessage(),e);
        
    } finally {
        try {
            if(stmt != null){stmt.close();}
            if(stmt2 != null){stmt2.close();}
            if(pstmt != null){pstmt.close();}
            if(conn != null){conn.close();}
        } catch (Exception ex) {
            logger.error("Exception occurred in ReportsConfiguration.jsp(finally block) ***** " + ex.getMessage(),ex);
        }
    }
%>
        <c:if test="${NEW_UI_CHECK eq null}">
            <script type="text/javascript" src="assets/js/jquery.min.js" ></script>
        </c:if>
		<script type="text/javascript" src="assets/js/userSelectDropdownJqueryConflict.js"/></script>
        <script type="text/javascript" src="assets/js/i18n/messages_${LANGUAGE_UNICODE}.js"></script>
        <script type="text/javascript" src="assets/js/i18n/i18n.js"></script>
        <link rel="stylesheet" type="text/css" href="assets/css/multiple-select.min.css" />
        <link rel="stylesheet" type="text/css" href="assets/css/multiple-select-classic.css" />
        <script type="text/javascript" src="assets/js/multiple-select.min.js"></script>
		<script type="text/javascript">
            <c:choose>
                <c:when test="${NEW_UI_CHECK ne null}">
                jQuery(document).ready(function() {
                    loadRolesDropdownList('<%=SapphireFilterUtil.sapphireContextPath%>','reportRolesID',0, 0, '1|$$|', '');
                    jQuery('#reportRolesID').multipleSelect({filter: true,selectAll: false});
                    loadRolesDropdownList('<%=SapphireFilterUtil.sapphireContextPath%>','reportRolesIDCMDB',1, document.getElementById('AssetModuleID').value, '3|$$|', '');
                    jQuery('#reportRolesIDCMDB').multipleSelect({filter: true,selectAll: false});
                    jQuery('#reportUserID').multipleSelect({filter: true,selectAll: false,onOpen: function() { loadOnbehalfUser('<%=SapphireFilterUtil.sapphireContextPath%>','reportUserID','', '<%=i18n.tr("All")%>', 6, 0, '2|$$|'); } });
                });
                </c:when>
                <c:otherwise>
                $j = jQuery.noConflict();
                $j(document).ready(function() {
                    loadRolesDropdownList('<%=SapphireFilterUtil.sapphireContextPath%>','reportRolesID',0, 0, '1|$$|', '');
                    $j('#reportRolesID').multipleSelect({filter: true,selectAll: false});
                    loadRolesDropdownList('<%=SapphireFilterUtil.sapphireContextPath%>','reportRolesIDCMDB',1, document.getElementById('AssetModuleID').value, '3|$$|', '');
                    $j('#reportRolesIDCMDB').multipleSelect({filter: true,selectAll: false});
                    $j('#reportUserID').multipleSelect({filter: true,selectAll: false,onOpen: function() { loadOnbehalfUser('<%=SapphireFilterUtil.sapphireContextPath%>','reportUserID','', '<%=i18n.tr("All")%>', 6, 0, '2|$$|'); } });
                });
                </c:otherwise>
            </c:choose>
		</script>
</html>