                                                                                                                                                                                                                               
var labelArray;
labelArray = [
			 	['Section :<span class="comp">*</span>'],
				['Year :<span class="comp">*</span>'],
				['Month :<span class="comp">*</span>']		
			];


Ext.onReady(function(){
    Ext.QuickTips.init();
    
  
	var sectionliststore = new Ext.data.ArrayStore({
		fields: ['section_id', 'section_name'],
		data: Ext.employee.section
   	});
	
	var yearstore = new Ext.data.ArrayStore({
		fields: ['year_name'],
    	data: Ext.employee.year        
  	});

Ext.namespace('Ext.month');
   Ext.month.list = [
    				[1, 'January'],
					[2, 'February'],
					[3, 'March'],
					[4, 'April'],
					[5, 'May'],
					[6, 'June'],
					[7, 'July'],    		
					[8, 'August'],
					[9, 'September'],
					[10, 'October'],
					[11, 'November'],
					[12, 'December']
   				   ];
	
	
   var monthliststore = new Ext.data.SimpleStore({
    fields: [{name:'monthid',type:'int'}, 'monthname'],
    data : Ext.month.list
   });
   
	
	var formallowanceswise = new Ext.FormPanel({
        labelWidth: 70, // label settings here cascade unless overridden
        url: 'report-form-salary-register-monthly-result.php',
		method:'post',
        frame:true,
		standardSubmit:true,
       
        bodyStyle:'padding:6px 6px 0',
        
		defaultType: 'textfield',
               items :[
					    {
							xtype: 'combo',
							labelSeparator:'',	
							fieldLabel :labelArray[0] ,
							name: 'sectionid',
							id:'section',
							hiddenName: 'sectionid',
							store: sectionliststore,
							displayField:'section_name',
							valueField: 'section_id',
							width: 170,
							hidden:true,
							typeAhead: true,
							selectOnFocus:true,
							forceSelection:true,							
							mode: 'local',
						//	triggerAction: 'all',
							emptyText:'Please select section...',
							editable:false,
							allowBlank:true,
							listeners:{select:{fn:function(combo, value) 
													{
												formallowanceswise.getForm().findField('sectionname').setValue(combo.getRawValue());	
														
														}
														 }
													}
                       },{
							xtype: 'combo',
							labelSeparator:'',	
							fieldLabel :labelArray[1] ,
							name: 'Year1',
							id:'Year1',
							store: yearstore,
							displayField:'year_name',
							valueField: 'year_name',
							width: 90,
							typeAhead: true,
							selectOnFocus:true,
							forceSelection:true,
							triggerAction: 'all',
							emptyText:'Year...',
							editable:true,
							allowBlank:false,
							mode:'local'
                       },
					   {
													xtype: 'combo',
													name: 'month_name',
													id:'month_name',
													labelSeparator:'',	
													fieldLabel :labelArray[2] ,
													forceSelection:true,
													editable:true,
													hiddenName:	'month_id',			
													displayField:'monthname',
													valueField:'monthid',
													typeAhead: true,
													labelWidth: 70,
													width:90,
													emptyText:'Month... ',
													allowBlank:false,
													triggerAction:'all',
													mode: 'local',
													store: monthliststore,
													listeners:{select:{fn:function(combo, value) 
													{
													formallowanceswise.getForm().findField('monthname').setValue(combo.getRawValue());	
														
														}
														 }
													}
													
												},
					   {
					xtype: 'textfield',
					name: 'monthname',
					id:'monthname',
					hidden:true
		    },
			 			{
					xtype: 'textfield',
					name: 'sectionname',
					id:'sectionname',
					hidden:true
		    }
			  		]	
    });
    
	var allowanceswiseWindow = new Ext.Window({
        title: 'Salary Register Monthly',
		width:300,		
		height:170,		
		border: false,
		modal:true,
		layout: 'fit',
		closeAction:'close',
		
		collapsible:true,
		items: formallowanceswise,
		buttonAlign: 'center',
	    buttons: [
						{
							text:'View Report',
							
							handler: function(b, e)
							{		
								formallowanceswise.getForm().submit();	
							}
						},
						{
						text: 'Reset', 
						handler: function () {   
												 formallowanceswise.getForm().reset();
												 	formallowanceswise.getForm().findField('section').focus(true,500);

											 }
						},
						{
					text: 'Close',
						handler: function () {   
						allowanceswiseWindow.close();
											 }
					   }
					]

	});
	var varWidth =  (screen.width - allowanceswiseWindow.width)/2;
	allowanceswiseWindow.setPosition(varWidth,((screen.height/4)-110));
	allowanceswiseWindow.show();

  SetSectionValue("add",sectionliststore,'section','section');

	
});