<?php 
	require "_header.php";
	require "data/combo_semester.php";
?>
<div id="main-content">
<script type="text/javascript">
var labelArray;
labelArray = [
	['Branch:<span class="comp">*</span>'],
	['Semester:<span class="comp"></span>'],
	['Student:'],
	['Enrollment Head:<span class="comp">*</span>']
];


var gtufeesheadstore = new Ext.data.ArrayStore({		
	fields: ['gtuhead_id','gtuhead_name','gtuhead_amount','max_amount','gtufee_type'],
	data:Ext.semester.gtufeeshead
});

var branchstore = new Ext.data.ArrayStore({		
	fields: ['branch_id','branch_name'],
	data:Ext.semester.branchall
});

var semesterstore = new Ext.data.ArrayStore({		
	fields: ['branch_id','semester_id', 'semester_name'],
	data:Ext.semester.semester
});
var divisionstore = new Ext.data.ArrayStore({
    	fields:['division_id','division_name'],
		data: Ext.semester.division
	});	
var head = new Ext.form.ComboBox({
	name: 'gtuhead_name',
	id:'gtuhead_name',
	hiddenName:'head_hidden',
	labelSeparator:'',	
	fieldLabel :labelArray[3] ,
	displayField:'gtuhead_name',
	valueField: 'gtuhead_id',
	editable:true,
	allowBlank:false,
	width:205,
	triggerAction:'all',
	mode:'local',
	store: gtufeesheadstore,
    listeners: {'select': function(cmb, rec, idx){
		Ext.getCmp('head_disp').setValue(this.getRawValue());
	}}
});

var branch = new Ext.form.ComboBox({
	name: 'branch_name',
	id:'branch_name',
	hiddenName:'branch_hidden',
	labelSeparator:'',	
	fieldLabel :labelArray[0] ,
	displayField:'branch_name',
	valueField: 'branch_id',
	editable:true,
	width:205,
	triggerAction:'all',
	mode:'local',
	allowBlank:false,
	store: branchstore,
    listeners: {'select': function(cmb, rec, idx){
		Ext.getCmp('branch_disp').setValue(this.getRawValue());
		semesterstore.filter('branch_id',cmb.getValue(),false,true,true);
		Ext.getCmp('semester_name').reset();
  	}}
});

var head_disp = new Ext.form.TextField({
	name: 'head_disp',
	id:'head_disp',
	hidden:true
});

var branch_disp = new Ext.form.TextField({
	name: 'branch_disp',
	id:'branch_disp',
	hidden:true
});

var semester_disp = new Ext.form.TextField({
	name: 'semester_disp',
	id:'semester_disp',
	hidden:true
});


var semester = new Ext.form.ComboBox({
	name: 'semester_id',
	id:'semester_id',
	hiddenName:'semester_hidden',
	labelSeparator:'',	
	fieldLabel :labelArray[1] ,
	displayField:'semester_name',
	valueField: 'semester_id',
	editable:true,
	lastQuery:'',
	triggerAction:'all',
	mode:'local',
	width:205,
	//allowBlank:false,
	store: semesterstore,
    listeners: {'select': function(cmb, rec, idx){
		Ext.getCmp('semester_disp').setValue(this.getRawValue());
		var branch=Ext.getCmp('branch_name').getValue();
			divisionstore.filter('division_id',branch+cmb.getValue(),false,true,true);
			var cnt=divisionstore.getCount();
			if(cnt==1)
				{
					Ext.getCmp('division_id').setValue('A');
				}
  	}}
});





Ext.onReady(function(){
    Ext.QuickTips.init();
	
	var sectionliststore = new Ext.data.Store({
			url: 'data/getsectionlist.php',          
	        reader: new Ext.data.JsonReader({			
                fields: ['section_id', 'section_name'],
                root: 'rows'
            })
        });
   
   var student_feesreceipt = new Ext.FormPanel({
        labelWidth: 80,
        url:'report-gtufees-dueamt-result.php',
		frame:true,
		standardSubmit:true,
        title: '',
        bodyStyle:'padding:6px 6px 0',
        layout:'form',
		defaultType: 'textfield',
        items :[head,branch,semester,{		
					xtype: 'combo',
					name: 'division_id',
					id:'division_id',
					labelSeparator:'',	
					fieldLabel :'Division :<span class="comp"></span>' ,
					forceSelection:true,				
					displayField:'division_name',
					valueField: 'division_name'
					,lastQuery:''
					//,allowBlank:false
					,triggerAction:'all'
					,mode:'local'
					,store:divisionstore
					,width:205
					,selectOnFocus: true,
					listeners: {'select': function(cmb, rec, idx){}}
				},branch_disp,semester_disp,head_disp]
    });
	 var FeesReceiptReportWindow = new Ext.Window({
        title: 'Student Enrollment Due Fees Report',
        height: 210,
        width: 340,
		modal:true,
        layout: 'fit',
		border: false,
		closeAction:'close',
		collapsible:'true',
		items: student_feesreceipt,
		buttonAlign: 'center',
	    buttons: [{
							text:'View Report',iconCls: 'new-tab',
							handler: function(b, e)
							{	
							var branch_hidden=student_feesreceipt.getForm().findField('branch_hidden').getValue();
							var semester_hidden=student_feesreceipt.getForm().findField('semester_hidden').getValue();
							var division_id=student_feesreceipt.getForm().findField('division_id').getValue();
						
							var branch_disp=student_feesreceipt.getForm().findField('branch_disp').getValue();
							var semester_disp=student_feesreceipt.getForm().findField('semester_disp').getValue();
							var head_hidden=student_feesreceipt.getForm().findField('head_hidden').getValue();
							var head_disp=student_feesreceipt.getForm().findField('head_disp').getValue();
			
			
		//	alert(show_mobile_no);
			
var redirect = 'report-gtufees-dueamt-result.php?branch_hidden='+branch_hidden + '&semester_hidden='+semester_hidden + '&division_id='+division_id + '&branch_disp='+branch_disp + '&semester_disp='+semester_disp + '&head_hidden='+head_hidden + '&head_disp='+head_disp; 
                window.location = redirect;
							}
						},
				  {
							text: 'Reset', iconCls: 'icon-reset',
							handler: function () {   
			                student_feesreceipt.getForm().reset();
							Ext.getCmp('branch_name').focus(true,500);
								
		               }
			        },
				  {
		   		           text: 'Close',iconCls: 'icon-close',
					       handler: function () {    
						   FeesReceiptReportWindow.close();
						
				          }
                       }
				 ]
    });
	 var varWidth =  (screen.width - FeesReceiptReportWindow.width)/2;
FeesReceiptReportWindow.setPosition(varWidth,((screen.height/4)-85));
FeesReceiptReportWindow.show();
Ext.getCmp('branch_name').focus(true,1000);
});
</script>
<div id="abcd" align="center"></div>
</div>
<?php require "_footer.php";?>