Current File : /home/inlingua/public_html/faridabad/icentex/Backup/admin/timesheet.select.php |
<?php
// Copyright, Panalink Infotech Limited. Created on: 22-05-2010
// Include header
include "header.php";
//echo "<br>";
// 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 where status_send='1' && approve_status='1' && modify_status!='1' && modify_status!='3' order by count_send desc,recNo desc";
$offset=$_REQUEST['offset'];
// Prepare page navigation
$resultsPerPage = 20; // number of rows to return per page
// 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>
Timesheet
</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">
<?php
$queryM="select * from timesheet where modify_status=1";
$resultM=mysql_query($queryM) or die(mysql_error());
$countM=mysql_fetch_array($resultM);
if($countM >0)
{
echo"<font color='red'>*To Modify any timesheet please first clear the waited </font><a href='list_modify.php'><font color='red'>modify timesheets</font></a>. ";
}
?>
<table class="adminform">
<tbody><tr>
<td valign="top" width="100%">
<!--<a href="taxes.main.php">Add new tax</a>-->
<script language="javascript">
<!--
function delstatus(val)
{
if(confirm("Are you sure to delete?\nAll the timesheets after this period (if any) of the user will get deleted.\nInstructor will have to send all timesheet after this period (if any ) again."))
{
location.href="delet.timesheet.php?id="+val;
}
else
{
return false;
}
}
function modifystatus(val)
{
if(confirm("Are you sure to modify?\You will have to modify all timesheet after this period (if any ) again."))
{
location.href="modify.timesheet.php?id="+val;
}
else
{
return false;
}
}
-->
</script>
<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 border='0' class='pa-nor' cellspacing='0' width='100%'>";
echo "<tr valign='center' class='pa-sel-header' style='height:30px;'>";
//echo "<th><b>recNo</b></th>";
echo "<th><b>From Date</b></th>";
echo "<th><b>To Date</b></th>";
echo "<th><b>Name</b></th>";
echo "<th><b>Location</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())
{
if($i%2==0) $bgcolor='#F3F3F3';
else $bgcolor='#EBEBEB';
if($objectData[first_id])
{
$bgcolor='#C9C9C9';
$first_id=$objectData[first_id];
}
if($first_id==$objectData[recNo]) $bgcolor='#C9C9C9';
echo "<tr valign='top' style='background:$bgcolor;height:25px;' onmouseover=\"this.className='pa-row-highlight'\" onmouseout=\"this.className='pa-nor'\" >";
//echo "<td>$objectData[recNo]</td>";
echo "<td>$objectData[fromDate]</td>";
echo "<td>$objectData[toDate]</td>";
echo "<td>$objectData[Instname]</td>";
echo "<td>$objectData[location]</td>";
echo "<td>";
if($countM==0)
{
echo"<a href='#' onclick='modifystatus($objectData[recNo])'>Modify</a> | ";
}
echo "<a href='timesheet.main.php?aC=sV&kV=". $objectData['recNo'] ."'>View</a> | ";
echo " <a href='#' onclick='delstatus($objectData[recNo])'>Delete</a></td>";
echo "</tr>";
$i++;
}
print "</table>";
// Print navigation bar
if ($resultsPerPage > 0 && $prev_next_links)
{ echo "Page: ";
array_walk($prev_next_links, 'printArray');
}
?>
</div>
<br>
<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>
<?php
$dbObject->CloseConnection();
// Include footer
//include "footer.php";
?>