Current File : /home/inlingua/public_html/noida/icentex/admin/timesheet_user.select1.php |
<?php include("header.php");
// Include header
// 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();
// Records selection sql
if($_REQUEST[loc]!="") $addq .=" and primarycenter='".$_REQUEST[loc]."'";
if($_REQUEST[search_name]!="") $addq .=" and name like '".$_REQUEST[search_name]."%'";
$sqlQuery = "SELECT * FROM timesheet_user where usertype='user' && pay_type='Fixed salaried' && status='Active'";
$sqlQuery .=$addq;
$sqlQuery .=" order by name asc";
// Prepare page navigation
$resultsPerPage = 20; // number of rows to return per page
$offset=$_REQUEST[offset];
// Prepare add on URL
$addOnUrl = "&loc=".$_REQUEST[loc]."&search_name=".$_REQUEST[search_name];
if ($resultsPerPage > 0)
{ $prev_next_links = $dbObject->prev123Next($sqlQuery, $resultsPerPage,$addOnUrl);
$sqlQuery .= " limit " . $offset . "," . $resultsPerPage ;
}
?>
<div class="clear"></div>
<?php include("left.php"); ?>
<div id="content-wrap" style="padding-top:20px;" >
<div id="content-box" >
<div id="toolbar-title" >
<h3>
Fixed User Manager
</h3>
<div class="clear"></div>
</div>
<div id="toolbar-box">
<div class="toolbar" id="toolbar"></div>
<div class="clear"></div>
</div>
<div class="clear"></div>
<div id="element-box">
<div class="m">
<form name="search_timesheet" method="post" action="timesheet_user.select1.php">
<table cellpadding="3" cellspacing="3" class="searchtable" align="left"><tr><td>Primary Center:</td><td><?php
$queryloc="select * from timesheet_location where status='1' order by location";
$resultloc=mysqli_query($conn,$queryloc) or die(mysqli_query($conn,));
?>
<select name='loc'>
<option value="">All Primary Center</option>
<?php
while($num=mysqli_fetch_array($resultloc))
{
if($num['location']=="S.Extn")
{
echo"<option value='".$num[location]."' ";
if($_REQUEST['loc']==$num[location])
{
echo"selected";
}
echo">South Extension</option>";
}
else
{
echo"<option value='".$num[location]."' ";
if($_REQUEST['loc']==$num[location])
{
echo"selected";
}
echo">".$num[location]."</option>";
}
}
?>
</select>
</td><td>Name:</td><td><input type="text" name="search_name" value="<?php echo $_REQUEST[search_name]?>" /></td>
<td ><input type="submit" name="search_timesheet" value="Search" /></td>
</table>
</form>
<table class="adminform">
<tbody><tr>
<td valign="top" width="100%">
<a href="timesheet_user.main1.php">Add new user</a>
<br>
<?php
// Print navigation bar
function printArray($element) { echo "$element"; }
if ($resultsPerPage > 0 && $prev_next_links)
{ echo "Page: ";
array_walk($prev_next_links, 'printArray');
}
// Select records from table
$selectedRecords = $dbObject->Select($sqlQuery);
echo "<table width='100%' border='1' class='pa-nor' cellspacing='0'>";
echo "<tr valign='top' class='pa-sel-header'>";
echo "<th><b>name</b></th>";
//echo "<th><b>Email</b></th>";
//echo "<th><b>Contact Number</b></th>";
//echo "<th><b>Pay Type</b></th>";
echo "<th><b>E-Mail</b></th>";
echo "<th><b>S.Hours</b></th>";
echo "<th><b>T.Hours</b></th>";
echo "<th><b>Status</b></th>";
echo "<th>Action</th>";
echo "</tr>";
// If no records selected, print message
if (!$selectedRecords)
{ echo "<tr><td colspan='5'>There are no selected records</td></tr>"; }
$i=1;
while($objectData=$dbObject->SelectNext())
{
$totalHours1=$objectData[startingHours];
$query="select (sum(hours1) + sum(hours2) + sum(hours3) + sum(hours4) + sum(hours5) + sum(hours7) + sum(hours8) + sum(hours9)) as totalhrs from timesheet where instructorId='".$objectData[recNo]."' && status_send=1 && approve_status=1 && modify_status!='1' && modify_status!='3'";
$result=mysqli_query($conn,$query) or die(mysql_error($conn));
$num=mysqli_fetch_array($result);
$totalHours1=$totalHours1+$num[totalhrs];
if($i%2==0) $bgcolor='#F3F3F3';
else $bgcolor='#EBEBEB';
echo "<tr valign='top' style='background:$bgcolor' onmouseover=\"this.className='pa-row-highlight'\" onmouseout=\"this.className='pa-nor'\">";
echo "<td>$objectData[name]</td>";
//echo "<td>$objectData[email]</td>";
//echo "<td>$objectData[contact_no]</td>";
//echo "<td>$objectData[pay_type]</td>";
if($objectData['status']=="Deactive")
{
$status="Deactivated";
}
else
{
$status=$objectData['status'];
}
echo "<td>$objectData[email]</td>";
echo "<td>$objectData[startingHours]</td>";
echo "<td>".$totalHours1."</td>";
echo "<td>$status</td>";
echo "<td><a href='timesheet_user.main1.php?aC=sM&kV=". $objectData['recNo'] ."&offset=".$_REQUEST[offset]."'>Modify</a> |";
echo " <a href='timesheet_user.main1.php?aC=sV&kV=". $objectData['recNo'] ."'>View</a> |";
echo " <a href='timesheet_user.main1.php?aC=sD&kV=". $objectData['recNo'] ."&offset=".$_REQUEST[offset]."'>Delete</a> |";
echo " <a href='reset.php?kV=". $objectData['recNo'] ."'>Reset</a> <br>
<font size='1'><a href='timesheet.select.php?user=".$objectData[recNo]."' target='_blank'>Timesheet</a></font>
</td>";
echo "</tr>";
$i++;
}
print "</table>";
// Print navigation bar
if ($resultsPerPage > 0 && $prev_next_links)
{ echo "Page: ";
array_walk($prev_next_links, 'printArray');
}
?>
<?php
$dbObject->CloseConnection();
// Include footer
?>
<div id="cpanel">
<div style="float: left;">
<div class="icon"></div>
</div>
<div style="float: left;">
<div class="icon"></div>
</div>
<div style="float: left;"></div>
</div>
</td>
<td valign="top" width="45%"> </td>
</tr>
</tbody></table>
</div>
</div>
<div class="clear"></div>
<p class="copyright"> </p>
</div>
</div>
</body></html>