<?php
include('../headertop.php');
include('../datepicker.php');
include('../db.php');

$disp = '';
$pagetitle = 'View/Search Expenses';
//$disp .=' <div class="col-md-6">';

date_default_timezone_set('Asia/Kolkata');

$d = date('Y-m-d'); 
//$year = date("Y",strtotime($d));


/*
$q = "select academic_year from current_year";
$res = mysqli_query($dbcon,$q);
$row = mysqli_fetch_array($res);
$ay = $row['academic_year'];
*/

$q = "select * from work_type";
$res = mysqli_query($dbcon,$q) or die(mysqli_error($dbcon,$q));
if(mysqli_num_rows($res)<1)
{
$disp .= 'No work categories defined. First create a work category';
include('../template.php');
exit;
}
 
if(isset($_REQUEST['sm']))
$disp .= '<div class="smdiv">'.$_REQUEST['sm'].'</div>';
else
$disp .= '<div class="smdiv">View/Search Expenses </div>';

$disp .='<form role="form" id="dailyexpenseform" method="post" action="viewexpenses.php">
                                    <div class="row">
                                <div class="col-md-6">
                                    <ul><li><b>Select A Work Category or All Categories</b> </li>
									<li>Select 1 or 2 Dates, Leave Empty for Total Cost</li></ul>									
								
   
		
		 <div class="form-group">
										<label>Date1 </label><input type="text" class="form-control" name="date"  id="datep1" readonly   > 
										</div> 
										
										 <div class="form-group">
										<label>Date2 </label><input type="text" class="form-control" name="date2"  id="datep2" readonly > 
										</div> 
										
										<div class="form-group">
										<label>Work Cateogry *</label><select class="form-control" name="work_type" data-validation="required"> 
										<option value="all">All Work Categories</option>';
										
		while($row = mysqli_fetch_array($res))
	{
	$disp .= '<option value="'.$row['id'].'">'.$row['work_type'].'</option>';
	}									
		$disp .= '</select></div> 
		
<div class="col-md-12" style="text-align:center"><button type="submit" class="btn btn-primary" name="dailyexpensesubmit">Submit Button</button>
                                        
										</form></div>
                                    </div>';
									
									include('../template.php');
									include('../header.php');
                                    ?>
                                    <script>
                                    $.validate({
  form : '#dailyexpenseform'
});
</script>