<?php 
	require "_header.php";
	
?>
<div id="main-content">
<script type="text/javascript">
var startdate = new Ext.form.DateField({
    id: 'startdate',
	labelSeparator:'',	
	fieldLabel :'Date :<span class="comp">*</span>',
	name: 'startdate',
	allowBlank:false,
	value:'<?php  echo date('Y-m-01');?>'
});	

var enddate = new Ext.form.DateField({
    id: 'enddate',
	fieldLabel: '',
	name: 'enddate',
	allowBlank:false,
	value:'<?php  echo date('Y-m-t');?>'
});	

var orderbystore = new Ext.data.ArrayStore({
	fields: ['order_by2','order_by1'],
	data: [['ASC','Date ASC'],['DESC','Date DESC']]
});

var orderby = new Ext.form.ComboBox({
	name: 'orderby',
	id:'orderby',
	hiddenName:'hid_orderby',
	labelSeparator:'',	
	fieldLabel :'Order :<span class="comp">*</span>' ,
	displayField:'order_by1',
	valueField: 'order_by2',
	editable:true,
	width:210,
	triggerAction:'all',
	mode:'local',
	store:orderbystore
});

Ext.onReady(function(){
	Ext.QuickTips.init();
	
	var AttendenceForm = new Ext.FormPanel({
    	labelWidth: 80,
        url:'report-send-sms-result.php',
		frame:true,
		standardSubmit:true,
        title: '',
        bodyStyle:'padding:6px 6px 0',
        layout:'form',
		defaultType: 'textfield',
		autoHeight:true,
        items :[{
			xtype:'container',
			autoEl:{},
			border:false,
			layout:'column',
			anchor:'100%',
			defaultType:'field',
			items:[{
				xtype:'container',
				autoEl:{},
				layout:'form',
				columnWidth:.62,
				items:[startdate]
			},{
				xtype:'container',
				autoEl:{},
				layout:'form',
				columnWidth:.38,
				labelWidth:1,
				items:[enddate]
			}]
		},orderby]
		
 	});
	
	var AttendenceWindow = new Ext.Window({
        title: 'Send SMS Report',
        autoHeight:true,
        width: 340,
		modal:true,
        layout: 'fit',
		border: false,
		closeAction:'close',
		collapsible:'true',
		items: AttendenceForm,
		buttonAlign: 'center',
		 onEsc : function(k, e){
        e.stopEvent();
       
    },
	    buttons: [{
			text:'View Report',
			iconCls: 'new-tab',
			handler: function(b, e){
				
			var startdate=AttendenceForm.getForm().findField('startdate').getValue().format('Y-m-d');
			var enddate=AttendenceForm.getForm().findField('enddate').getValue().format('Y-m-d');
			var hid_orderby=AttendenceForm.getForm().findField('hid_orderby').getValue();
			
			
			
		//	alert(show_mobile_no);
			
var redirect = 'report-send-sms-result.php?startdate='+startdate + '&enddate='+enddate + '&hid_orderby='+hid_orderby ; 
                window.location = redirect;
			}
		},{
			text: 'Reset', 
			iconCls: 'icon-reset',
			handler: function(){   
			  	AttendenceForm.getForm().reset();
				Ext.getCmp('branch_name').focus(true,500);
				Ext.getCmp('batch_id').setValue(0);
	Ext.getCmp('batch_id').setRawValue('All');
			}
		},{
		  	text: 'Close',
			iconCls: 'icon-close',
			handler: function () {    
				AttendenceWindow.close();
			}
      	}]
	});
	
	var varWidth =  (screen.width - AttendenceWindow.width)/2;
	AttendenceWindow.setPosition(varWidth,((screen.height/4)-85));
	AttendenceWindow.show();
	Ext.getCmp('orderby').setValue('DESC');

});
</script>
<div id="abcd"></div>
</div>
<?php require "_footer.php";?>
