| Current Path : /var/www/html/mmishra/indem/lms/ |
| Current File : /var/www/html/mmishra/indem/lms/leavelist.php |
<?php
include "inc/functions.inc";
include "header.inc";
dbConnect();
//$breakup = $_REQUEST["breakup"];
//echo "<b><font color='red'>" .$breakup. "</font></b>" ;
$tbl="leaveRegister";
$per_page = 50;
//Calculating no of pages
$sql = "select * from $tbl where leavestatus!=1";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
$pages = ceil($count/$per_page);
echo "<center>";
for($i=1; $i<=$pages; $i++) {
//echo "<a href='breakup-leave.php?page=$i&breakup=$breakup'>$i</a> ";
}
echo"</center>";
if (!$page) $page=1;
$sno = ($page-1)*$per_page;
if($_GET) {
$page=$_GET['page'];
if (!$page) $page=1;
$sno = ($page-1)*$per_page;
}
echo "<input type='hidden' name='page' value='$page' />";
$start = ($page-1)*$per_page;
if ($_POST["submit"] == "FIND"){
$empid = $_POST["empid"];
$dob = $_POST["birthdd"]."-".$_POST["birthmm"]."-".$_POST["birthyy"];
$leaveyear = $_POST["leaveyear"];
}
echo "<center><font size=+1><b><i>Employee Leave Register</i></b></font></center>
<table><tr>
<td><img src='img/cal-2.jpg' height='50' width='50' /></td>
<td>Employee ID : </td><td><input type='text' name='empid' size='25' value='$empid' /><br></td>
<td>Date of Birth : </td><td><select name='birthdd'>";
foreach ($dates as $dt) {
echo "<option value='$dt'";
if ($dt == $birthdd) echo " selected";
echo ">$dt</option>";
}
echo "</select>
<select name='birthmm'>";
foreach ($dmonths as $mt) {
echo "<option value='$mt'";
if ($mt == $birthmm) echo " selected";
echo ">$mt</option>";
}
echo "</select>
<select name='birthyy'>";
foreach ($years as $yr) {
echo "<option value='$yr'";
if ($yr == $birthyy) echo " selected";
echo ">$yr</option>";
}
echo "</select></td>
<td>Leave Year : </td><td><input type='text' name='leaveyear' size='4' maxlength='4' value='$leveyear' /></td>
<td><input type='hidden' name='pg' value='$pg'>
<input type='submit' name='submit' value='FIND' /></td>
</tr>
</table>";
if (mysql_num_rows(mysql_query("select * from employeeMaster where empid='$empid' and dobirth='$dob'"))) {
//--listing of leave register of employee for the choosen calender year --
$rs = mysql_query("select * from $tbl where empid='$empid' and leaveyear='$leaveyear' order by leavetype");
//$rs = mysql_query("select * from $tbl where empid='$empid' order by leavetype");
}
echo "
<center><hr><br>
<table border=1 width=850>
<tr><td width=50 align=center><b>Sr No.</b></td>
<td width=125 align=center><b>Emp ID</b></td>
<td width=55 align=center><b>Employee Name</b></td>
<td width=55 align=center><b>Designation</b></td>
<td width=300 align=center><b>Leave From</b></td>
<td width=50 align=center><b>Leave To</b></td>
<td width=300 align=center><b>No. of Days</b></td>
<td width=300 align=center><b>Leave Type</b></td>
<td width=300 align=center><b>Station Leave</b></td>
<td width=300 align=center><b>Responsible Person Name</b></td>
<td width=300 align=center><b>Designation</b></td>
<td><b>Leave Status</b></td>
</tr>";
while ($o = mysql_fetch_object($rs)) {
$empid = $o->empid;
$rs1 = mysql_query("select * from employeeMaster where empid='$empid'");
while ($p = mysql_fetch_object($rs1)) {
$empname = $p->empname;
$designation = $p->designation;
}
if ($empname == strtoupper(trim($p->empname))) {
} else {
$id = $o->id;
$empid = $o->empid;
$leavefrom = $o->leavefrom;
$leaveto = $o->leaveto;
$leavedays = $o->leavedays;
$leavetype = $o->leavetype;
$stationleave = $o->stationleave;
$respname = $o->respname;
$respdesignation = $o->respdesignation;
$leavestatus = $o->leavestatus;
}
$sno = $sno + 1;
echo "<tr>
<td align=center>".$sno."</td>
<td align=center><b>".$empid."</b></td>
<td>".strtoupper($empname)."</td>
<td>".strtoupper($designation)."</td>
<td>".$leavefrom."</td>
<td>".$leaveto."</td>
<td>".$leavedays."</td>
<td>".$leavetype."</td>
<td>".$stationleave."</td>
<td>".$respname."</td>
<td>".$respdesignation."</td>
<td><b>".$leavestatus."</b></td>
</tr>";
}
echo "</table></center>
<br><br>
<br><br>
<br><br>
<br><br>
<br><br>";
echo "<br><center>";
for($i=1; $i<=$pages; $i++) {
//echo "<a href='breakup-leave.php?page=$i&breakup=$breakup'>$i</a> ";
}
echo"</center><br>";
//include "footer.inc";
?>