<?php 
	require "_header.php";
	
?>
<script type="text/javascript">

var labelArray;
labelArray = [
			 	
				['Date :<span class="comp">*</span>']
				
		];	
var districtsore = new Ext.data.Store({
			url: 'data/getdistrictcode.php',          
	        reader: new Ext.data.JsonReader({			
                fields: ['dist_id','dist_nameeng'],
                root: 'rows'
            }),autoLoad:true
 });
var bill_startdate = new Ext.form.DateField({
    id: 'bill_startdate',
	labelSeparator:'',	
	fieldLabel :labelArray[0] ,
	name: 'bill_startdate',
	emptyText :'From',
	allowBlank:false,
	vtype: 'daterange',
	endDateField:'bill_enddate'
});	


var bill_enddate = new Ext.form.DateField({
    id: 'bill_enddate',
	fieldLabel: '',
	name: 'bill_enddate',
	emptyText :'To',
	allowBlank:false,
	vtype: 'daterange',
	startDateField: 'bill_startdate' 
});	

	
	
Ext.onReady(function(){
    Ext.QuickTips.init();
    
  
 	
    var customerbill_summary = new Ext.FormPanel({
        labelWidth: 70, // label settings here cascade unless overridden
        url:'report-customerinvoicesummary-result.php',
		method:'post',
        frame:true,
		standardSubmit:true,
        autoHeight: true,
        items :[
		  	    {
						xtype       : 'container',
						autoEl      : {},
						border      : false,
						layout      : 'column',
						anchor      : '100%',
						defaultType : 'field',
						items       : [{
										xtype  : 'container',
										autoEl : {},
										layout : 'form',
										columnWidth : .55,
										items  : [bill_startdate]
									   },
									   {
										xtype       : 'container',
										autoEl      : {},
										layout      : 'form',
										columnWidth : .45,
										labelWidth  : 1,
										items       : [bill_enddate]
									   }]
		             },
					 {
					  xtype: 'combo',
					   name: 'district_id',
					   id:'district_id',
					   hiddenName: 'hiddendist_code',
					   tabIndex:2,
					   labelSeparator:'',	
					   fieldLabel :'District :<span class="comp"></span>',
					   displayField:'dist_nameeng',
					   valueField: 'dist_id',
					   width: 200,
					   blankText: '',
					   emptyText:'',
					   value:'All',
					  // allowBlank:false,
					   triggerAction:'all',
					   mode:'local',			
					   selectOnFocus: true,	
					   store: districtsore,
					   forceSelection:true,
					   editable:true
					}
			   ]		
    });
	
	 var customerbillWindow = new Ext.Window({
        title: 'Customerbill Report Datewise',
        autoHeight: true,
        width: 340,
		border: false,
		modal:true,
        layout: 'fit',
		closeAction:'close',
   	 	collapsible:'true',
		items: customerbill_summary,
		buttonAlign: 'center',
	    buttons: [{
							text:'View Report',
							iconCls:'icon-view',
							handler: function()
							{ 
							
							     var bill_startdate=customerbill_summary.getForm().findField('bill_startdate').getValue().format('d/m/Y');
							var bill_enddate=customerbill_summary.getForm().findField('bill_enddate').getValue().format('d/m/Y');
							var hiddendist_code=customerbill_summary.getForm().findField('hiddendist_code').getValue();
							
							
							  var redirect = 'report-customerinvoicesummary-result.php?bill_startdate='+bill_startdate + '&bill_enddate='+bill_enddate + '&hiddendist_code='+hiddendist_code; 
							  window.location = redirect;	
							}
				  },
				  {
							text: 'Reset', 
							iconCls:'icon-reset',
							handler: function () {   
			                customerbill_summary.getForm().reset();
							Ext.getCmp('section_name').focus(true,500);
		                    }
			      },
				  {
		   		           text: 'Close',
						   iconCls:'icon-close',
					       handler: function () {    
						   
						   customerbillWindow.close();
				           }
                  }
				 ]
    });



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

});
</script>
<div id="main-content" align="center"></div>
<?php require "_footer.php";?>