Current File : /home/inlingua/public_html/noida/icentex_noida/conveyance/ingl_conveyance_main.select.php |
<?php
session_start();
/*
$loggedUserNo = $_SESSION['loggedUserNo'];
if ($loggedUserNo == "")
{ echo "Please <a href='index.php'>login</a> first.";
exit(0);
}
*/
// Include header
include "header_conveyance.php";
if($_REQUEST['action']=="Save")
{
$head="Saved Conveyance";
}
elseif($_REQUEST['action']=="Send")
{
$head="Submitted Conveyance";
}
elseif($_REQUEST['action']=="cancel")
{
$head="Cancelled Conveyance";
}
?>
<h3><span class='pa-nor-navbar'><a href='index.php'>Home</a> >> <a href='ingl_conveyance_main.select.php?action='.$_REQUEST['action'].''><?php echo $head ?></a></span></h3>
<div id="contentnew">
<?php if ($_SESSION['dispMesg'][1] != "" && (date("U") - $_SESSION['dispMesg'][0] < 7))
{ ?>
<span id='mesgSpan'><font color='#da0000'><?php echo $_SESSION['dispMesg'][1];?></font></span>
<script>
setTimeout(function() { $('#mesgSpan').fadeOut('slow'); }, 4000); // <-- time in milliseconds
</script>
<br>
<?php
}
unset($_SESSION['dispMesg']);
?>
<?
// 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 ingl_conveyance_main where instructor='".$_SESSION['id']."'";
if($_REQUEST['action']=="Save" )
{
$sqlQuery .="&& (status='Save' || status='')";
}
else if($_REQUEST['action']=="Send")
{
$sqlQuery .="&& status='Send'";
}
else if($_REQUEST['action']=="cancel")
{
$sqlQuery .="&& status='cancel'";
}
$sqlQuery .= "order by sendDate desc";
// Prepare page navigation
$resultsPerPage = 20; // number of rows to return per page
// Prepare add on URL
$addOnUrl = "&action=".$_REQUEST['action']."";
$offset=$_REQUEST['offset'];
if ($resultsPerPage > 0)
{ $prev_next_links = $dbObject->prev123Next($sqlQuery, $resultsPerPage,$addOnUrl);
$sqlQuery .= " limit " . $offset . "," . $resultsPerPage ;
}
// Print navigation bar
function printArray($element) { echo "$element"; }
if ($resultsPerPage > 0 && $prev_next_links && count($prev_next_links) > 1)
{ echo "Page: ";
array_walk($prev_next_links, 'printArray');
}
// Select records from table
$selectedRecords = $dbObject->Select($sqlQuery);
?>
<table border='0' class='pa-nor pa-table' width="100%">
<tr valign='top' class='rowH'>
<th>S.No</th>
<th>Instructor</th>
<th>Month</th>
<th>Year</th>
<th>Action</th>
</tr>
<?php
// If no records selected, print message
if (!$selectedRecords)
{ ?>
<tr><td colspan='5'>There are no entries</td></tr>
<?php
}
$i=1;
while($objectData=$dbObject->SelectNext())
{
$queryU="select name from timesheet_user where recno='".$objectData['instructor']."'";
$resultU=mysql_query($queryU);
$numU=mysql_fetch_array($resultU);
if($i%2==0) $bgcolor='#F3F3F3';
else $bgcolor='#EBEBEB';
?>
<tr valign='top' style='background:<?php echo $bgcolor ?>;height:25px;' onmouseover="this.className='pa-row-highlight'" onmouseout="this.className='pa-nor'">
<td><?php echo $i;?></td>
<td><?php echo $numU['name'];?></td>
<td><?php echo $objectData['month'];?></td>
<td><?php echo $objectData['year'];?></td>
<td>
<?php
if($objectData['status']=="Save" || $objectData['status']=="")
{
?>
<a href='ingl_conveyance_main.main.php?aC=sM&kV=<?php echo $objectData['recNo'] ;?>' title='Modify entry'><img src='images/edit.png' border='0' hspace='2' style="border:none;"></a> |
<?php } ?>
<a href='ingl_conveyance_main.main.php?aC=sV&kV=<?php echo $objectData['recNo'] ;?>' title='View entry'><img src='images/view.png' border='0' hspace='2' style="border:none;"></a>
<?php
if($objectData['status']=="Save" || $objectData['status']=="")
{
?>
|
<a onclick='return confDel();' href='ingl_conveyance_main.main.php?aC=Delete&kV=<?php echo $objectData['recNo'] ;?>' title='Delete entry'><img src='images/delete.png' style="border:none;" border='0' hspace='2'></a>
<?php } ?>
</td>
</tr>
<?php
$i++;
}
?>
</table>
<?php
// Print navigation bar
if ($resultsPerPage > 0 && $prev_next_links && count($prev_next_links) > 1)
{ echo "Page: ";
array_walk($prev_next_links, 'printArray');
echo "<br>";
}
?>
<!--<br>
<a href="ingl_conveyance_main.main.php" title='Add entry'>Add new entry</a>
<br>-->
</div>
<script type="text/javascript">
function confDel()
{ var agree = confirm("Click OK to delete permanently or cancel");
if (agree)
return true;
else
return false;
}
</script>
<?php
$dbObject->CloseConnection();
// Include footer
include "footer_conveyance.php";
?>