Current File : /home/inlingua/public_html/noida/icentex/Backup/admin/timesheet_blockselect.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
$sqlQuery = "SELECT * FROM timesheet_user where usertype='user' && pay_type='Hourly' order by recNo desc";

// Prepare page navigation
$resultsPerPage = 20; // number of rows to return per page

$offset=$_REQUEST[offset];
// Prepare add on URL
$addOnUrl = "";

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>
Hourly 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">
				<table class="adminform">
					<tbody><tr>
												<td valign="top" width="100%">
											
<a href="timesheet_user.main.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&nbsp;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=mysql_query($query) or die(mysql_error());

$num=mysql_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>";
echo "<td>$objectData[email]</td>";
echo "<td>$objectData[startingHours]</td>";
echo "<td>".$totalHours1."</td>";
echo "<td>$objectData[status]</td>";

	echo "<td><a href='timesheet_user.main.php?aC=sM&kV=". $objectData['recNo'] ."&offset=".$_REQUEST[offset]."'>Modify</a> |";
	echo " <a href='timesheet_user.main.php?aC=sV&kV=". $objectData['recNo'] ."'>View</a> |";
	echo " <a href='timesheet_user.main.php?aC=sD&kV=". $objectData['recNo'] ."&offset=".$_REQUEST[offset]."'>Delete</a> |";
	echo " <a href='reset.php?kV=". $objectData['recNo'] ."'>Reset</a> 
	</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%">&nbsp;</td>
					</tr>
				</tbody></table>
			</div>
		</div>
		<div class="clear"></div>
		<p class="copyright">&nbsp;</p>
  </div>
</div>
</body></html>