Ext.define("executive.controller.Executive",{extend:"Ext.app.Controller",views:["Main"],refs:[{selector:"main",ref:"main"},{selector:"executiveForm",ref:"executiveForm"},{selector:"executiveGraph",ref:"executiveGraph"},{selector:"eventsoverview",ref:"eventsoverview"},{selector:"columnchart",ref:"columnchart"},{selector:"topevents",ref:"topevents"},{selector:"eventsSummary",ref:"eventsSummary"},{selector:"newUtilities",ref:"newUtilities"},{selector:"print",ref:"print"},{selector:"data",ref:"data"},{selector:"sendmail",ref:"sendmail"},{selector:"executiveDetail",ref:"executiveDetail"},{selector:"nomeasurepanel",ref:"nomeasurepanel"},{selector:"backGroundPanel",ref:"backGroundPanel"}],init:function(){this.control({"main":{"beforerender":this.showLoadingIcon},"main":{"afterrender":this.loadForm,"boxready":this.loadDefaultData},"newUtilities":{"afterrender":this.hideTools},"newUtilities > #saveTool > button":{"click":this.saveFileTool},"newUtilities > #mailTool > button":{"click":this.sendMail},"executiveForm button[name=submit]":{"click":this.submitForm},"executiveForm button[name=save]":{"click":this.addTo},'timeline combo[name="er_mode"]':{"select":this.changeEr_mode},"newUtilities > #favoriteTool > button":{"click":this.addTo},"newUtilities > #scheduleTool > button":{"click":this.addTo},"newUtilities > #printTool > button":{"click":this.printFile},"newUtilities > #dataTool > button":{"click":this.dataFile},'executiveForm button[id="panelinsidetoggle"]':{"click":this.toggleForm},'executiveForm combo[id="reportGeneration"]':{"select":this.changeReportGenerationType}});
},changeReportGenerationType:function(){var a=Ext.getCmp("reportGeneration").getValue();if(a=="background"){Ext.getCmp("bgReportName").show();}else{Ext.getCmp("bgReportName").hide();}},toggleForm:function(b){Ext.getCmp("panelinsidetoggle").show();var a=Ext.getCmp("mainForm");if(a.isHidden()){a.show();
Ext.getCmp("selectionDetails").hide();}else{a.hide();Ext.getCmp("selectionDetails").show();}},changeEr_mode:function(d){var b=Ext.getCmp("main").hiddenFields;var a=b["favorite_id"];var c=b["fromScheduleModify"];if(!(a=="undefined"||a==undefined||a=="emty")||!(c==null||c=="null")){return;}this.submitForm();
},loadForm:function(b){var i=b;if(!Ext.isEmpty(appConstants.defaultJSON)){var h=appConstants.defaultJSON.screenLabels;if(appConstants.er_RmDispName!=null&&appConstants.er_RmDispName!="null"&&appConstants.er_RmDispName!="undefined"){this.getMain().setTitle(appConstants.er_RmDispName);}var j=this.getExecutiveForm().getForm();
this.setValueWithOptionInList(j,"reporttype",appConstants.defaultJSON.reporttypecombo,appConstants.defaultJSON.reporttypecombo_value,h["reportTypeComboLabel"]);this.setValueWithOptionInList(j,"er_timeline",appConstants.defaultJSON["timelineCombo"],appConstants.defaultJSON["timelineComboArray_value"],h["reporter.common.Timeline"]);
this.setValueWithOptionInList(j,"reportGeneration",appConstants.defaultJSON["reportGenCombo"],appConstants.defaultJSON["reportGenCombo_value"],h["reporter.consolidated.Report Generation"]);isTrend=true;var g=appConstants.defaultJSON.selectedStartHour;var c=appConstants.defaultJSON.selectedEndHour;var e=appConstants.defaultJSON.startDate;
var a=appConstants.defaultJSON.endDate;var d=Ext.getCmp("er_stdate");d.setValue(appConstants.defaultJSON.startDateForDisplay);d.dataArray=e;var k=Ext.getCmp("er_enddate");k.setValue(appConstants.defaultJSON.endDateForDisplay);k.dataArray=a;var l=Ext.getCmp("er_sthr");l.setValue(appConstants.defaultJSON.startHourForDisplay);
l.dataArray=g;var f=Ext.getCmp("er_endhr");f.setValue(appConstants.defaultJSON.endHourForDisplay);f.dataArray=c;stmin=appConstants.defaultJSON.startMinForDisplay;enmin=appConstants.defaultJSON.endMinForDisplay;mgr_stmin=appConstants.defaultJSON.startmin;mgr_enmin=appConstants.defaultJSON.endmin;i.hiddenFields=appConstants.defaultJSON.requestURL;
}},loadDefaultData:function(d){var b=d;if(!Ext.isEmpty(appConstants.defaultJSON)){var c=b.hiddenFields["fromScheduleModify"];var a=b.hiddenFields["fromFavoriteModify"];if((c!=null&&c=="Yes")||(a!=null&&a=="Yes")){Ext.getCmp("submit").hide();Ext.getCmp("save").show();Ext.getCmp("favoriteTool").setDisabled(true);
Ext.getCmp("scheduleTool").setDisabled(true);}else{Ext.getCmp("submit").show();Ext.getCmp("save").hide();}if(appConstants.isSubmit!=null&&appConstants.isSubmit=="true"&&c==null){this.submitForm();}else{if(appConstants.isForceSubmit=="true"){appConstants.isForceSubmit="false";this.submitForm();}}}if(!hideBackButton){Ext.getCmp("mainForm").add({xtype:"hidden",id:"ID",name:"ID",value:appConstants.defaultJSON["ID"]});
}},setValueWithOptionInList:function(b,f,d,c,a){var e=b.findField(f);if(!Ext.isEmpty(a)){e.setFieldLabel(a);}e.getStore().clearFilter(true);e.getStore().loadRawData(d);e.suspendEvents(false);if(Ext.isEmpty(c)){e.setValue(d[0].valueField);}else{e.setValue(c);}b.findField(f).resumeEvents();},showLoadingIcon:function(){initLdgMask.show();
},hideTools:function(){this.getNewUtilities().loadIcon(true,true,true,true,false,true,true,false,false,false,true);Ext.getCmp("favoriteTool").setDisabled(false);Ext.getCmp("scheduleTool").setDisabled(false);},sendToFavorite:function(){document.location="/final/reporter/ErSaveFavorite.jsp";},validateSettings:function(){var f="";
var d=Ext.getCmp("main").getForm();var a=Ext.getCmp("main").hiddenFields;var f=a["er_usertimeline"];var m=a["getMaxDaysInMonth"];var g=Ext.getCmp("er_stdate").getValue();g.setHours(Ext.getCmp("er_sthr").getValue());var i=Ext.getCmp("er_enddate").getValue();i.setHours(Ext.getCmp("er_endhr").getValue());
var n=checkDateTime(g,i);if(!n){return;}if(f!="-1"){var l=isUserTimelineLimitExceeded(f,m,g,i);if(!l){Ext.MessageBox.show({title:"Alert",msg:"The specified timeline should not be greater than the maximum timeline set in your profile",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}var c=a["limitforbg"];
var e,k;if(isSettingsEnabled){e=Ext.getCmp("reportGeneration").getValue();k=Ext.getCmp("bgReportName").getValue();}else{e=appConstants.defaultJSON["reportGenCombo_value"];k=appConstants.defaultJSON["bgReportName"];}var b="Foreground report generation will take some time. Do you want to proceed?";var h=true;
if(e=="foreground"){if(!Ext.isEmpty(c)){if(!checkTimeLineForBgLimit(c,m,g,i)){Ext.MessageBox.confirm("Confirm",b,this.showResult,this);h=false;}}}if(e=="background"){if(!validateTextBoxWithSpecialChars(k,"Attachment",true)){h=false;}}if(h&&isSettingsEnabled){var j=Ext.getCmp("submit");j.setDisabled(false);
Ext.get("configMod").animate({duration:500,to:{y:-500}});}return h;},submitForm:function(){Ext.getCmp("panelinsidetoggle").setDisabled(false);var M=Ext.getCmp("main").getForm();var V=Ext.getCmp("main").hiddenFields;var P=M.findField("reporttype").getValue();var d=V["er_trgttype"];if(P!=null&&P=="-1"){Ext.Msg.show({title:"Alert",msg:"Please select the "+d,buttons:Ext.Msg.OK});
return;}if(Ext.getCmp("reportGeneration").getValue()=="background"){var X=Ext.getCmp("bgReportName").getValue();var N=validateTextBoxWithSpecialChars(X,"Attachment",true);if(!N){return;}}var p=M.findField("er_timeline").getValue();var T=M.findField("er_sthr").dataArray;var R=M.findField("er_endhr").dataArray;
var s=M.findField("er_mode").getValue();var D=M.findField("reportGeneration").getValue();var i=M.findField("er_stdate").dataArray;var g=M.findField("er_enddate").dataArray;var q=V["startdate"];var G=V["enddate"];var f=V["eruserid"];mgr_stmin=appConstants.defaultJSON.startmin;mgr_enmin=appConstants.defaultJSON.endmin;
var S=V["servletName"];var K=V["savereport"];var y=V["schedule_id"];var w=V["limitforbg"];var o=V["inidate"];var r=V["fromSchedule"];var I=V["forwardto"];var d=V["er_trgttype"];var P=M.findField("reporttype").getValue();var W=V["er_ViewName"];var n=V["er_view"];var U=V["er_trenddata"];var k=V["er_search"];
var v=V["er_selection"];var b=V["er_specificComp"];var e=V["er_rtype"];var F=V["er_bgreportfrom"];var B=V["currTime"];var a=V["bgenabled"];var H=V["er_usertimeline"];var m=V["getMaxDaysInMonth"];var E=M.findField("er_stdate").parseDate(i);var j=M.findField("er_enddate").parseDate(g);var C=Ext.Date.dateFormat(E,clientDateFormat);
var x=Ext.Date.dateFormat(j,clientDateFormat);var O=new Date(x).getTime();var u=new Date(C).getTime();var z=formatDate(new Date(getDateFromFormat(C,appConstants.currdtFormat)),"MM/dd/yyyy");var J=formatDate(new Date(getDateFromFormat(x,appConstants.currdtFormat)),"MM/dd/yyyy");var c=checktime(z,J,T,R);
if(!c){Ext.Msg.show({title:"Alert",msg:appConstants.sdatealert,buttons:Ext.Msg.OK,icon:Ext.Msg.WARNING});return;}y=null;r=null;var d=V["er_trgttype"];if(D!=null&&D=="background"){I="ErExecutiveReports";}appConstants.paramValue="er_usertimeline="+H+"&bgenabled="+a+"&currTime="+B+"&enddate="+g+"&endhr="+R+"&endmin="+mgr_enmin+"&er_bgreportfrom="+F+"&er_reportgenration="+D+"&er_rtype="+e+"&er_search="+k+"&er_selection="+encodeURI(P)+"&er_specificComp="+b+"&er_timeline="+p+"&er_trenddata="+U+"&er_view="+n+"&er_ViewName="+W+"&er_trgttype="+encodeURI(d)+"&forwardto="+I+"&fromSchedule="+r+"&inidate="+o+"&isSubmit=true"+"&er_mode="+s+"&schedule_id="+y+"&savereport="+K+"&servletName="+S+"&startdate="+i+"&starthr="+T+"&startmin="+mgr_stmin+"&eruserid="+f;
appConstants.paramValue+="&er_RmDispName="+appConstants.er_RmDispName+"&treeCompType="+appConstants.rm_treeCompType;var h="";var l=null;var A=this;if(a=="Yes"||a=="yes"){var t="";var L="";if(p!=null&&(p=="Any"||p=="any")){t=getTimeVal(w,M,m);L=getTimeVal(p,M,m);}else{t=getTimeVal(w,M,m);L=getTimeVal(p,M,m);
}var Q=false;if((appConstants.isSubmit==null||appConstants.isSubmit=="null")&&L>t&&D=="foreground"){Ext.Msg.confirm("Confirm","Foreground report generation will take some time. Do you want to proceed?",function(Y){if(Y=="no"){M.findField("reportGeneration").setValue("background");D="background";Ext.getCmp("bgReportName").show();
validateTextBoxWithSpecialChars(Ext.getCmp("bgReportName").getValue(),"Attachment",true);}else{A.showResult();}},this);}else{if(this.validateSettings()){A.showResult();}}}else{if(this.validateSettings()){A.showResult();}}},showResult:function(){var e=Ext.getCmp("main").getForm();var c=e.findField("reportGeneration").getValue();
var a=Ext.getCmp("main").hiddenFields;var f=a["er_usertimeline"];var l=a["getMaxDaysInMonth"];var b=a["eruserid"];var d=a["limitforbg"];if(appConstants.selectedZone!="undefined"&&appConstants.selectedZone!="null"){appConstants.paramValue+="&select_farm="+appConstants.selectedZone;}if(appConstants.er_dataFrom!=undefined){appConstants.paramValue+="&er_dataFrom="+appConstants.er_dataFrom;
}if(appConstants.selectedChild!=undefined){appConstants.paramValue+="&selectedChild="+appConstants.selectedChild;}if(c!=null&&c=="background"){var k=e.findField("bgReportName").getValue();var h=validateTextBoxWithSpecialChars(k,"Attachment",true);if(h!=true){return;}var i=true;i=getTimeForcurrentuser(e,e,f,l);
var g=e.findField("reporttype").getValue();if(i){var j="";if(g!=null&&g=="Application"){j="Executive_Component";}else{if(g!=null&&g=="CompType"){j="Executive_Component_Type";}else{if(g!=null&&g=="Segment"){j="Executive_Segment";}else{if(g!=null&&g=="Service"){j="Executive_Service";}else{if(g!=null&&g=="Zone"){j="Executive_Zone";
}else{j="All Report Types";}}}}}url="/final/servlet/com.eg.ErStartBackGroundReportC";k=checkFileName(k);appConstants.paramValue+="&from=background&bg_reportname="+k+"&userID="+b+"&getMaxDaysInMonth="+l;loadMask=new Ext.LoadMask(Ext.getBody(),{msg:"Background Report Generation is in Progress..."});loadMask.show();
}else{return;}}else{loadMask=new Ext.LoadMask(Ext.getBody(),{msg:"Loading ..."});loadMask.show();var i=true;i=getTimeForcurrentuser(e,e,f,l);if(i){url="/final/servlet/ErMacroController";appConstants.paramValue+="&from=client";}else{return;}}Ext.Ajax.request({url:url,params:appConstants.paramValue,scope:this,method:"POST",success:function(n){loadMask.hide();
var s=n.responseText;var p=Ext.decode(s);if(c!=null&&c=="background"){if(!Ext.isEmpty(p)){var r=p.backgroundreport;var m=r["status"];if(m!=null&&m=="success"){var o='<table border="0px" width="100%" height="100%"><tr><td align="center" valign="middle"><table style="width:480px;"border="0px"><tr><td><div style="margin:0px 10px 0px 0px;display:block;width:32px;height:32px;float:right;" class="iconSuccess"></div></td><td><div style="line-height:1.5em" class="font_bold11">'+r.backgroundString+".</br>"+'<a class="backgroundMsgLink" href='+r.linkforBackGround+">"+r.displayMsg+"</a></div></td></tr></table></td></tr></table>";
}else{if(m=="duplicate"){var o='<table border="0px" width="100%" height="100%"><tr><td align="center" valign="middle"><table style="width:480px;"border="0px"><tr><td><div style="margin:0px 10px 0px 0px;display:block;width:32px;height:32px;float:right;" class="iconExclamation"></div></td><td><div style="line-height:1.5em" class="font_bold11">'+r.backgroundString+".</br>"+'<a class="backgroundMsgLink" href='+r.linkforBackGround+">"+r.displayMsg+"</a></div></td></tr></table></td></tr></table>";
}}this.getNomeasurepanel().hide();this.getBackGroundPanel().doLayout();this.getBackGroundPanel().update(o);this.getBackGroundPanel().show();Ext.getCmp("executiveDetailPanel").hide();}}else{if(!Ext.isEmpty(p)){var q=p.errMsg;if(!Ext.isEmpty(q.errorMsg)){var o='<div class="x-table" style="align:center"><div class="x-grid-cell-inner" style="align:center"><br/>'+q.errorMsg+"</div></div>";
var t=Ext.getCmp("executiveDetailPanel");this.getNomeasurepanel().doLayout();this.getNomeasurepanel().show();this.getBackGroundPanel().hide();this.getEventsoverview().removeAll();Ext.getCmp("executiveDetailPanel").hide();this.getColumnchart().removeAll();this.getTopevents().removeAll();this.getEventsSummary().removeAll();
Ext.getCmp("panelinsidetoggle").setDisabled(true);Ext.getCmp("saveTool").setDisabled(true);Ext.getCmp("bookletTool").setDisabled(true);Ext.getCmp("printTool").setDisabled(true);Ext.getCmp("mailTool").setDisabled(true);Ext.getCmp("dataTool").setDisabled(true);}else{Ext.getCmp("panelinsidetoggle").setDisabled(false);
this.getBackGroundPanel().hide();this.getNomeasurepanel().hide();Ext.getCmp("executiveDetailPanel").show();this.getEventsoverview().loadPieChart(p);this.getColumnchart().loadColumnChart(p);this.getTopevents().loadTopEventsTable(p,"controller");this.getEventsSummary().loadEventsSummaryTable(p,"controller");
Ext.getCmp("bookletTool").setDisabled(false);Ext.getCmp("saveTool").setDisabled(false);Ext.getCmp("printTool").setDisabled(false);Ext.getCmp("mailTool").setDisabled(false);Ext.getCmp("dataTool").setDisabled(false);Ext.getCmp("selectionDetails").setSelectionDetailsData(p.selectionDetails);}}}}});},saveFileTool:function(){var g=Ext.getCmp("main").getForm();
var c=Ext.getCmp("main").hiddenFields;var d=c["er_rtype"];var m=c["er_trgttype"];var o=g.findField("reporttype").getValue();var p=g.findField("er_timeline").getValue();var q=g.findField("er_sthr").dataArray;var e=g.findField("er_endhr").dataArray;mgr_stmin=appConstants.defaultJSON.startmin;mgr_enmin=appConstants.defaultJSON.endmin;
var k=g.findField("er_mode").getValue();var b=c["eruserid"];var n=g.findField("er_stdate").dataArray;var i=g.findField("er_enddate").dataArray;var f=g.findField("er_stdate").parseDate(n);var a=g.findField("er_enddate").parseDate(i);var h=Ext.Date.dateFormat(f,clientDateFormat);var j=Ext.Date.dateFormat(a,clientDateFormat);
var l;l="/final/reporter/ErHtmlToSavePdf.jsp?er_rtype=Macro&er_rType="+d+"&er_trgttype="+m+"&er_selection="+encodeURI(o)+"&er_timeline="+p+"&startdate="+n+"&enddate="+i+"&er_mode="+k+"&er_sthr="+q+"&er_endhr="+e+"&is_PDF=yes&er_view=PRINT&er_userid="+b+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin;if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");
}appConstants.erUtils.savePDF(l);},bookletQuery:function(h){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}var n=Ext.getCmp("main").getForm();var g=Ext.getCmp("main").hiddenFields;var l=g["er_rtype"];var p=g["er_trgttype"];var q=n.findField("reporttype").getValue();
var c=n.findField("er_timeline").getValue();var m=n.findField("er_sthr").dataArray;var r=n.findField("er_endhr").dataArray;mgr_stmin=appConstants.defaultJSON.startmin;mgr_enmin=appConstants.defaultJSON.endmin;var i=n.findField("er_mode").getValue();var a=g["eruserid"];var f=n.findField("er_stdate").dataArray;
var j=n.findField("er_enddate").dataArray;var o=n.findField("er_stdate").parseDate(f);var e=n.findField("er_enddate").parseDate(j);var k=Ext.Date.dateFormat(o,clientDateFormat);var b=Ext.Date.dateFormat(e,clientDateFormat);var d;d="er_rtype=Macro&er_rType="+l+"&er_trgttype="+p+"&er_selection="+appConstants.erUtils.specialCharEncode(q)+"&er_timeline="+c+"&startdate="+f+"&enddate="+j+"&er_mode="+i+"&er_sthr="+m+"&er_endhr="+r+"&is_PDF=yes&er_view=PRINT&er_userid="+a+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin;
return d;},bookletScheduleQuery:function(f){var x="";var E=Ext.getCmp("main").getForm();var F=E.findField("reporttype").getValue();var m=E.findField("er_timeline").getValue();var J=E.findField("er_sthr").dataArray;var H=E.findField("er_endhr").dataArray;var p=E.findField("er_mode").getValue();var w=E.findField("reportGeneration").getValue();
var h=E.findField("er_stdate").dataArray;var g=E.findField("er_enddate").dataArray;var M=Ext.getCmp("main").hiddenFields;var n=M["startdate"];var z=M["enddate"];var e=M["eruserid"];var L=appConstants.defaultJSON.startmin;var t=appConstants.defaultJSON.endmin;var I=M["servletName"];var D=M["savereport"];
var s=M["schedule_id"];var C=M["favorite_id"];var r=M["limitforbg"];var l=M["inidate"];var o=M["fromSchedule"];var B=M["forwardto"];var c=M["er_trgttype"];var N=M["er_ViewName"];var k=M["er_view"];var K=M["er_trenddata"];var i=M["er_search"];var q=M["er_selection"];var b=M["er_specificComp"];var d=M["er_rtype"];
var y=M["er_bgreportfrom"];var u=M["currTime"];var a=M["bgenabled"];var A=M["er_usertimeline"];var j=M["getMaxDaysInMonth"];var G=M["er_favorite"];var O=M["fromScheduleModify"];var v=M["fromFavoriteModify"];var c=M["er_trgttype"];x+="er_usertimeline="+A+"&bgenabled="+a+"&currTime="+u+"&enddate="+g+"&endhr="+H+"&endmin="+t+"&er_bgreportfrom="+y+"&er_reportgenration="+w+"&er_rtype="+d+"&er_search="+i+"&er_selection="+encodeURI(F)+"&er_specificComp="+b+"&er_timeline="+m+"&er_trenddata="+K+"&er_view="+k+"&er_ViewName="+N+"&er_trgttype="+encodeURI(c)+"&forwardto="+B+"&fromSchedule="+o+"&inidate="+l+"&isSubmit=true"+"&er_mode="+p+"&limitforbg="+encodeURI(r)+"&schedule_id="+s+"&FavoriteId="+C+"&id="+C+"&savereport="+D+"&servletName="+I+"&shareUsers="+G+"&publicUsers="+G+"&startdate="+h+"&starthr="+J+"&startmin="+L+"&eruserid="+e+"&from=client&fromFavoriteModify=yes";
return x;},bookletPreview:function(){this.printFile();},printFile:function(){var o=Ext.getCmp("main").getForm();var h=Ext.getCmp("main").hiddenFields;var q=o.findField("reporttype").getValue();var b=h["er_rtype"];var m=h["er_trgttype"];var j=q;var d=o.findField("er_timeline").getValue();var f=o.findField("er_stdate").dataArray;
var k=o.findField("er_enddate").dataArray;var n=o.findField("er_sthr").dataArray;var r=o.findField("er_endhr").dataArray;var i=o.findField("er_mode").getValue();mgr_stmin=appConstants.defaultJSON.startmin;mgr_enmin=appConstants.defaultJSON.endmin;var p=o.findField("er_stdate").parseDate(f);var g=o.findField("er_enddate").parseDate(k);
var c=Ext.Date.dateFormat(p,clientDateFormat);var l=Ext.Date.dateFormat(g,clientDateFormat);var a=h["eruserid"];var e="../servlet/com.eg.ErControllerServlet?er_rtype=Macro&er_rType="+b+"&er_trgttype="+m+"&er_selection="+encodeURI(j)+"&er_timeline="+d+"&startdate="+f+"&enddate="+k+"&er_mode="+i+"&er_sthr="+n+"&er_endhr="+r+"&er_view=PRINT&pdfPrint=yes&er_userid="+a+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin;
parent.printWindowFn(e);},sendMail:function(){Ext.widget("sendmail").show();},addTo:function(K,S,G){var C=K.getId();var h=C;var J=Ext.getCmp("main").getForm();var M=J.findField("reporttype").getValue();var o=J.findField("er_timeline").getValue();var Q=J.findField("er_sthr").dataArray;var O=J.findField("er_endhr").dataArray;
var r=J.findField("er_mode").getValue();var x=J.findField("reportGeneration").getValue();var j=J.findField("er_stdate").dataArray;var i=J.findField("er_enddate").dataArray;var T=Ext.getCmp("main").hiddenFields;var p=T["startdate"];var z=T["enddate"];var g=T["eruserid"];mgr_stmin=appConstants.defaultJSON.startmin;
mgr_enmin=appConstants.defaultJSON.endmin;var P=T["servletName"];var I=T["savereport"];var u=T["schedule_id"];var D=T["favorite_id"];var t=T["limitforbg"];var n=T["inidate"];var q=T["fromSchedule"];var B=T["forwardto"];var d=T["er_trgttype"];var M=J.findField("reporttype").getValue();var U=T["er_ViewName"];
var m=T["er_view"];var R=T["er_trenddata"];var k=T["er_search"];var s=T["er_selection"];var c=T["er_specificComp"];var f=T["er_rtype"];var y=T["er_bgreportfrom"];var v=T["currTime"];var b=T["bgenabled"];var A=T["er_usertimeline"];var l=T["getMaxDaysInMonth"];var N=T["er_favorite"];var V=T["fromScheduleModify"];
var w=T["fromFavoriteModify"];if(V!=null&&V=="Yes"){C="scheduleImg";}else{if(w!=null&&w=="Yes"){C="favoriteImg";}else{u=null;D=null;q=null;}}var d=T["er_trgttype"];var F=null;F="er_usertimeline="+A+"&bgenabled="+b+"&currTime="+v+"&enddate="+i+"&endhr="+O+"&endmin="+mgr_enmin+"&er_bgreportfrom="+y+"&er_reportgenration="+x+"&er_rtype="+f+"&er_search="+k+"&er_selection="+encodeURI(M)+"&er_specificComp="+c+"&er_timeline="+o+"&er_trenddata="+R+"&er_view="+m+"&er_ViewName="+U+"&er_trgttype="+encodeURI(d)+"&forwardto="+B+"&fromSchedule="+q+"&inidate="+n+"&isSubmit=true"+"&er_mode="+r+"&limitforbg="+encodeURI(t)+"&schedule_id="+u+"&FavoriteId="+D+"&id="+D+"&savereport="+I+"&servletName="+P+"&shareUsers="+N+"&publicUsers="+N+"&startdate="+j+"&starthr="+Q+"&startmin="+mgr_stmin+"&eruserid="+g+"&from=client&fromFavoriteModify=yes";
if(D==null){F+="&newFavorite=yes";}var a;if(C!=null&&C=="scheduleImg"){a="/final/reporter/ErSaveSchedule.jsp?"+F+"&com.eg.CSRF_NONCE="+csrfToken;if(h=="save"){a+="&showSchWindow=no";var H=a.substr(0,a.indexOf("?"));var L=a.substr(a.indexOf("?")+1,a.length-1);var E=Ext.create("Ext.form.Panel");E.submit({url:H,params:L,standardSubmit:true,method:"POST"});
}else{parent.scheduleWindowFn(a);}}else{a="../servlet/com.eg.ErFavoriteC?"+F+"&er_view=GRAPH&cmd=client"+"&er_RmDispName="+appConstants.er_RmDispName+"&com.eg.CSRF_NONCE="+csrfToken;if(h=="save"){a+="&showWindow=no"+"&FavoriteId="+D;var H=a.substr(0,a.indexOf("?"));var L=a.substr(a.indexOf("?")+1,a.length-1);
var E=Ext.create("Ext.form.Panel");E.submit({url:H,params:L,standardSubmit:true,method:"POST"});}else{parent.favouriteWindowFn(a);}}},dataFile:function(){var d=Ext.getCmp("main").getForm();var b=Ext.getCmp("main").hiddenFields;var h=d.findField("reporttype").getValue();var m=b["er_rtype"];var l=b["er_trgttype"];
var g=h;var q=d.findField("er_timeline").getValue();var p=d.findField("er_stdate").dataArray;var f=d.findField("er_enddate").dataArray;var e=d.findField("er_sthr").dataArray;var a=d.findField("er_endhr").dataArray;mgr_stmin=appConstants.defaultJSON.startmin;mgr_enmin=appConstants.defaultJSON.endmin;var i=d.findField("er_mode").getValue();
var c=d.findField("er_stdate").parseDate(p);var o=d.findField("er_enddate").parseDate(f);var j=Ext.Date.dateFormat(c,clientDateFormat);var n=Ext.Date.dateFormat(o,clientDateFormat);var k="../servlet/com.eg.ErControllerServlet?er_rtype=Macro&er_rType="+m+"&er_trgttype="+l+"&er_selection="+encodeURI(g)+"&er_timeline="+q+"&startdate="+p+"&enddate="+f+"&er_mode="+i+"&er_sthr="+e+"&er_endhr="+a+"&er_view=DATA"+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin;
k+="&er_RmDispName="+appConstants.er_RmDispName;parent.dataWindowFn(k);}});