Current File : /home/inlingua/public_html/noida/icentex/admin_oral/reports.php |
<?php
// Created on: 18-02-2015
session_start();
/*
$loggedUserNo = $_SESSION['loggedUserNo'];
if ($loggedUserNo == "")
{ echo "Please <a href='index.php'>login</a> first.";
exit(0);
}
*/
// Include header
include "header_oral.php";
?>
<h3>Reports</h3>
<?php
// Include the database connection details
require('../dbConnection.php');
// Include common functions
require('../commonFunc.php');
// Include common functions
require('../globalVars.php');
// Include the table handler class
require('../dbHandler.class.php');
// Init and connect to database
$dbObject = new dbHandler();
$dbObject->connect();
function getInstructor($inst)
{
$query='select recNo, name from timesheet_user where (usertype="user" || usertype="FD") and status="Active" order by name';
$res=mysqli_query($conn,$query);
$option .="<select name='customer_detailing'><option value=''>Select</option>";
while($result=mysqli_fetch_array($res))
{
if($inst==$result[recNo]){
$option .="<option selected value='".$result[recNo]."'>".$result[name]."</option>";
}
else{$option .="<option value='".$result[recNo]."'>".$result[name]."</option>";}
}
$option .="</select>";
return $option;
}
?>
<div id="contentnew">
<form action="reports_result.php" method="post" name="myform" id="myform" onsubmit=" return validate();">
<table border='0' width='90%'>
<tr>
<td>Centre</td><td>
<select name='location'>
<option value="">All Location</option>
<?php
$querylocation="select primarycenter from timesheet_user where recNo='".$_SESSION['id']."'";
$resultlocation=mysqli_query($conn,$querylocation) or die(mysql_error($conn));
$numlocation=mysqli_fetch_array($resultlocation);
$queryloc="select * from timesheet_location where status='1'";
$resultloc=mysqli_query($conn,$queryloc) or die(mysql_error($conn));
while ($numloc=mysqli_fetch_array($resultloc))
{
echo"<option value='".$numloc[recNo]."' ";
if($numlocation[primarycenter]==$numloc[location])
{
//echo"selected";
}
echo">".$numloc[location]."</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td>Oral Done By</td><td><?php echo getInstructor('') ?></td>
</tr>
<tr>
<td>From</td><td><input type='text' name='startdate' value="" size='12' maxlength='10' id="datepicker3"></td>
</tr>
<tr>
<td>To</td><td><input type='text' name='enddate' value="" size='12' maxlength='10' id="datepicker4"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Search"></td>
</tr>
</table>
</form>
</div>
<br><br><br><br><br>
<?php
$dbObject->CloseConnection();
// Include footer
include "footer_oral.php";
?>
<script language="javascript">
$(function() {
$('#datepicker3').datepicker({
changeMonth: true,
changeYear: true
});
});
$(function() {
$('#datepicker4').datepicker({
changeMonth: true,
changeYear: true
});
});
</script>
<script>
function validate(){
//alert(document.myform.startdate);
if(document.myform.startdate.value==""){
alert("Please select Start Date");
document.myform.startdate.focus();
return false;
}
if(document.myform.enddate.value==""){
alert("Please select End Date");
document.myform.enddate.focus();
return false;
}
//alert("aa");
return true;
}
</script>