<?php require "_header.php";?>

<script type="text/javascript" src="js/employeeformitems.js"></script>
<script language="javascript" type="text/javascript">
var labelArray;
labelArray = [
			 	['Section :<span class="comp">*</span>'],
				['Product :<span class="comp">*</span>'],
];
Ext.onReady(function() {
var productstore = new Ext.data.Store({
			url:'data/getproduct.php', 
	        reader: new Ext.data.JsonReader({			
                fields: ['product_id', 'product_name'],
                root: 'product'
            })
        });  
		productstore.load();  
   var employeeidentity= new Ext.FormPanel({
        id: 'employeeidentity',
        frame: true,
        labelAlign: 'left',
		standardSubmit:true,
        bodyStyle: 'padding:5px',
        url:"report-current-stock-result.php",
	    draggable: true,
		layout:'column',
		items:[
			  {columnWidth: .3,
                            layout: 'form',				
										items:[
											   {
												  xtype: 'radio',
												  hideLabel: true,
												  name: 'radiotype',
												  checked:true,
												  inputValue: '1',												  
												  boxLabel: labelArray[1],
												  handler:function(){
													  if(this.checked) {
												    productstore.load();	
											        productstore.removeAll();	
													  }													  	
												  }												  
											   }
											]
						},
				{columnWidth:.7,
		         labelWidth:1,  
				  layout:'form',
				  items:[{
				        xtype: 'combo',
						name:'product',
						id:'product',
						hiddenName:'ID',
						store:productstore,
						displayField: 'product_name',
						valueField: 'product_id',
						editable:true,
						mode: 'local',
						allowBlank:false, 
						triggerAction: 'all',
						emptyText: 'Select Product ...',
						width:180
					}
					 ]
			   },
			  	{columnWidth: .17,
                            layout: 'form',				
										items:[
											    {
											      xtype: 'radio',
												  hideLabel: true,
											      name: 'radiotype',
											      inputValue: '2',
											      boxLabel: 'All',
												   handler:function(){
													if(this.checked) {
													employeeidentity.getForm().findField('product').disable();	
													 employeeidentity.getForm().findField('product').reset();	
													  }	
													  else
													  {
													  	employeeidentity.getForm().findField('product').enable();	
													  }										  	
												  }	
												  
											    }
											]
						}
			]
    });
	
	
	var EmpReportWindow = new Ext.Window({
        title: "Stock Information Report",
		width:300,		
		height:150,		
		border: false,
		modal:true,
		layout: 'fit',
		closeAction:'close',
		collapsible:true,
		
		items: employeeidentity,
		buttonAlign: 'center',
	    buttons: [ {
					text: 'View Report',
					iconCls:'icon-view',
					handler: function () { 
					
				
							var ID=employeeidentity.getForm().findField('ID').getValue();
							
							  var redirect = 'report-current-stock-result.php?ID='+ID; 
							  window.location = redirect;

					}
                   },
				    {
					text: 'Reset', 
					iconCls:'icon-reset',
					handler: function () {   
											 employeeidentity.getForm().reset();
				                         }
			        },
   	 	            {
		   		text: 'Close',
				iconCls:'icon-close',
					handler: function () {   
						EmpReportWindow.close();
				                         }
                   }
			     ]

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

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