<?php
date_default_timezone_set('Asia/Calcutta');
$out_date		= date("Y-m-d");
if(isset($_POST['okey']) && !empty($_POST['okey']))
{
	
$_SESSION['att_month']          = $_POST['month'];
$_SESSION['att_year']           = $_POST['year'];
$_SESSION['att_emp_name']       = $_POST['emp_name'];	
$_SESSION['att_state']     		= $_POST['state'];	
}
function attend_type($id)
{
	$sql_st	= mysql_query("SELECT `symbol` FROM `tbl_attend_type` where `id`='$id' ")or die(mysql_error());
	$row_st	= mysql_fetch_array($sql_st);
	return $row_st['symbol'];
}
?>
  <style>
  .table1 td{vertical-align: middle;text-align: center;}
  .color_1{background:#0C0 !important;color:#000 !important;}
  .color_2{background:#F00 !important;color:#fff !important;}
  .color_3{background:#33F !important;color:#FFF !important;}
  .color_4{background:#F39 !important;color:#FFF !important;}
  .color_5{background:#306 !important;color:#FFF !important;}
  .color_6{background:#90F !important;color:#FFF !important;}
  .color_7{background:#FF6 !important;color:#000 !important;}
  </style>
         
                <div class="span12" style="margin-left:0px;">
                    <div class="head clearfix">
                        <div class="isw-ok"></div>
                        <h1>RSPL Invoice Genrate</h1>                        
                    </div>                    
                    <div class="block-fluid">  
   					   <form target="_blank" method="POST" enctype="multipart/form-data" action="pages/DRIVER/invoicePrint.php" > 
						<div class="row-form clearfix">
                            <div class="span1">        
                                   <label>Month</label>		
                              	    <select name="month">
                                        <option value="">Month</option>
                                        <option value="01" <?php if(isset($_SESSION['att_month']) && $_SESSION['att_month']=='01') { echo "selected";}  ?>>Jan</option>
                                        <option value="02" <?php if(isset($_SESSION['att_month']) && $_SESSION['att_month']=='02') { echo "selected";}  ?>>Feb</option>
                                        <option value="03" <?php if(isset($_SESSION['att_month']) && $_SESSION['att_month']=='03') { echo "selected";}  ?>>Mar</option>
                                        <option value="04" <?php if(isset($_SESSION['att_month']) && $_SESSION['att_month']=='04') { echo "selected";}  ?>>Apr</option>
                                        <option value="05" <?php if(isset($_SESSION['att_month']) && $_SESSION['att_month']=='05') { echo "selected";}  ?>>May</option>
                                        <option value="06" <?php if(isset($_SESSION['att_month']) && $_SESSION['att_month']=='06') { echo "selected";}  ?>>Jun</option>
                                        <option value="07" <?php if(isset($_SESSION['att_month']) && $_SESSION['att_month']=='07') { echo "selected";}  ?>>Jul</option>
                                        <option value="08" <?php if(isset($_SESSION['att_month']) && $_SESSION['att_month']=='08') { echo "selected";}  ?>>Aug</option>
                                        <option value="09" <?php if(isset($_SESSION['att_month']) && $_SESSION['att_month']=='09') { echo "selected";}  ?>>Sep</option>
                                        <option value="10" <?php if(isset($_SESSION['att_month']) && $_SESSION['att_month']=='10') { echo "selected";}  ?>>Oct</option>
                                        <option value="11" <?php if(isset($_SESSION['att_month']) && $_SESSION['att_month']=='11') { echo "selected";}  ?>>Nov</option>
                                        <option value="12" <?php if(isset($_SESSION['att_month']) && $_SESSION['att_month']=='12') { echo "selected";}  ?>>Dec</option>
                                   </select>
                               </div>
                            <div class="span1">        
                                   <label>Year</label>		
                              	 <select name="year">
                                        <option value="">Year</option>
                                        <?php 
										for($i=2010;$i<2056;$i++){?>
                                        
                                        <option value="<?php echo $i;?>" <?php if(isset($_SESSION['att_year']) && $_SESSION['att_year']==$i) { echo "selected";}  ?> ><?php echo $i;?></option>
                                        <?php } ?>
                                   </select>
                               </div>      
                            
                            <div class="span3">        
                            <label>Employee Name</label>
                               <select name="emp_name" id="emp_name">
                               <option value='ALL'>ALL</option>
                               <?php
							   if(isset($_SESSION['att_state']))
								{
									
									$sql_st	= mysql_query("SELECT `emp_name`,`id` FROM `tbl_emp_driver` where `state`='".$_SESSION['att_state']."' and `status`='0' ORDER BY `emp_name` ASC ")or die(mysql_error());
									while($row_st= mysql_fetch_array($sql_st))
									{
									?>
                                    <option value="<?php echo $row_st['id'];?>" <?php if($row_st['id']==$_SESSION['att_emp_name']){echo "selected";}?>><?php echo $row_st['emp_name'];?></option>
                                    <?php	
									}
								}
								?>
	                           </select>
                           </div>                                                                    
                            <div class="span2"> 
                            <label>&nbsp;</label>
                     		<input type="submit" name="okey" value="Search"/>
                            </div>
                            </div>                       
                   </form>
                   </div>   
                   
                </div>
<script>
function get_driver_name(state)
{
	if (state == '') {
		alert("Please Select State !!!");
		return;
	} else {
		var xmlhttp = new XMLHttpRequest();
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
			{
				document.getElementById("emp_name").innerHTML=xmlhttp.responseText;
			}
		}
		xmlhttp.open("GET","ajax/get_driver_name.php?state="+state,true);
		xmlhttp.send();
	}
	
}
</script>