Ext.ns("org.piercecountywa.salaryclassification.view");
org.piercecountywa.salaryclassification.view.PrintSelectWindow = Ext.extend(Ext.Window, {
	initComponent: function(){
        printSelectWindow = this;
//        this.applyTo     = 'copy-win';
      //   this.style = 'text-align:left';
		this.layout      = 'form';
        this.title       = 'Pierce County Salary Classification Plan Report';
        this.x           = 600;
        this.y           = 1;
        this.width       = 400;
        this.height      = 170;
        this.closeAction ='hide';
        this.plain       = true;
        this.labelWidth  = 1;
		this.jobTitle 	 	= this.formValues.job_title_search;
	    this.jobClass 	 	= this.formValues.job_class_search;
	    this.bargUnit 	 	= this.formValues.barg_unit_search;
		this.fullTitleSearch= this.formValues.full_title_search;
		if(this.formValues.external_user=='true') {this.itIsAnExternalUser=true} else {this.itIsAnExternalUser=false}
		this.exporttype  	= 'pdf';  
        this.radio1 = new Ext.form.Radio({
                        labelSeparator:'',
						boxLabel: 'Job Title, Rate Year, and Pay Rates',
						name: 'dog',
						listeners: {
                        "check": function (cbx,value) {
					    if (value) {
							
							var reportName = 'SalClassPlan_rptTYR';
					        printSelectWindow.fnLaunchReport('SalClassPlan_rpt',"","SalClassPlan_rptTYR",600, 800, 112, 25);
							//printSelectWindow.printReport('SalClassPlan_report');
							
						}
                          },
						  scope:this
                          } 
	
        });         
		

        this.radio2 = new Ext.form.Radio({
			           labelSeparator:'',
						boxLabel: 'Job Title, Rate Year, Pay Rates, Job Class Number, Bargaining Unit ID, and Range',
                        name: 'dog',
						
					listeners: {
                        "check": function (cbx,value) {
					    if (value) {
							var reportName = 'SalClassPlanRpttyrjbr';
							printSelectWindow.fnLaunchReport('SalClassPlan_rpt',"","SalClassPlanRpttyrjbr",600, 800, 112, 25);
							
						}
                          },
						  scope:this
                          }  
        });

        this.radio3 = new Ext.form.Radio({
			            labelSeparator:'',
						boxLabel: 'All Fields',
                        name: 'dog',
						listeners: {
                        "check": function (cbx,value) {
					    if (value) {
							var reportName = 'SalClassPlan_report';
							printSelectWindow.fnLaunchReport('SalClassPlan_rpt',"","SalClassPlan_report",600, 800, 112, 25);
							
						}
                          },
						  scope:this
                          }  
						
        });
        this.radio4 = new Ext.form.Radio({
			            labelSeparator:'',
						boxLabel: 'Export to Excel',
                        name: 'dog',
						hidden:false,
						listeners: {
                        "check": function (cbx,value) {
					    if (value) {
							var reportName = 'SalClassPlan_xls';
							var exporttype = 'xls';
							printSelectWindow.fnLaunchReport('SalClassPlan_xls',"","SalClassPlan_xls",600, 800, 112, 25,exporttype);
							
						}
                          },
						  scope:this
                          }  
						
        });
        /*
        this.radio5 = new Ext.form.Radio({
			            labelSeparator:'',
						boxLabel: 'COLA',
						hidden:this.itIsAnExternalUser,
                        name: 'dog',
						listeners: {
                        "check": function (cbx,value) {
					    if (value) {
							var reportName = 'SalClassPlan_xls';
							var exporttype = 'xls';
							printSelectWindow.ColaClicked();
							
						}
                          },
						  scope:this
                          }  
						
        });       
		*/
this.items=[                   
                           this.radio1,
                            this.radio2,
                            this.radio3,
                            this.radio4
                            //,this.radio5            
            ];
            org.piercecountywa.salaryclassification.view.PrintSelectWindow.superclass.initComponent.call(this);
},

			fnLaunchReport: 	function fnLaunchReport(strReportName,windowName,reportName,height,width,left,top,exporttype){
		                         var href = strReportName + ".cfm?jobclass=" + this.jobClass + "&jobTitle=" + this.jobTitle + "&bargain_unit=" 
								 + this.bargUnit + "&reportName=" + reportName + "&full_title_search=" + this.fullTitleSearch + "&external_user=" + this.externalUser
								 + "&exportType=" + exporttype;
								 var height = 600;
								
								 var options = "height=" + height + ",width=" + width + ",left=" + left + ",top=" + top;
		                         options += ",resizable,scrollbars,toolbar";
		                          
								 popup = window.open(href,windowName,options);
		                         popup.focus();
		                         printSelectWindow.radio1.reset()
								 printSelectWindow.radio2.reset();
						         printSelectWindow.radio3.reset();
						         printSelectWindow.radio4.reset();
						     //    printSelectWindow.radio5.reset();									
                 	       },
			   ColaClicked:function(){
		                        colaWindow = window.open("http://hrweb.co.pierce.wa.us/admin/hrgcolastatus.pdf","colaWind","left=300,top=300");
		                          colaWindow.focus();
		                      //    printSelectWindow.radio5.reset();
		                          },		   
	            setFormValues:function(formValues){
		         this.jobTitle = formValues.job_title_search;
	             this.jobClass = formValues.job_class_search;
	             this.bargUnit = formValues.barg_unit_search;
				 this.fullTitleSearch = formValues.full_title_search;
				 this.externalUser 	  = formValues.external_user;          
	            
	            
	            
	            
	            
	            }
});

