<?
session_start();

if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}

include("../opendb.php");
include("../test.php");
?>
<script>

 function sms(a,b)
 {
   window.open('sendsms.php?code='+a+'&tp='+b);
 }

</script>
<head>
<style>
body,td{font-family:'arial narrow';letter-spacing:1;font-size:13}
th{background-color:c1d799}
.mnu{margin-left:5}
body{BACKGROUND-COLOR:fcfff1}
</style>
<fieldset>
<legend>Search</legend>
<center>
<form action='<?print $PHP_SELF?>'>
<?

if(!$sea&&$pswd!='attitude')
{
?>
<td>Pswd <input type=password name='psd'></td>
</tr>
<tr><td colspan=2 align=center><input type=submit name='show' value='Show'>
<?
}
 if($sea&&$pswd=='attitude'|| $show && $psd=='support')
  {
?>
<table border=0>
<th colspan=8 style={filter:flipH;}>SEARCH EMPLOYEE</TH>
<tr><td>Employee Name </td><td><input type=text name='empname'> </td>
    <td>Designation </td><td><input type=text name='desig'> </td>
</tr>
<tr>
    <td>Division </td><td><select name='divis'>
<option></option>
<?


 $rrr=mysqli_query($db,"select * from divmast order by divname");
  while($div_row=mysqli_fetch_array($rrr))
  {
    print "<option>$div_row[2]</option>";
  }
?>
</select>  
 </td>
    
<td>Branch</td><td>
<select name='br'>
<option>All</option>

<?
 $re=mysqli_query($db,"select code,brname from br_master where brcode='$brcode' order by brname");
 while($brrw=mysqli_fetch_array($re))
  {
    print "<option>$brrw[1]</option>";
  }
?>
</select>

</td>
</tr>
<tr><td>EmpId </td><td><input type=text name='empid'> </td>
</tr>
<tr><td><input type=checkbox name='conf' value='y'> Confirmed 
<input type=checkbox name='pay' value='y'> Salary
</td>
<td>Pswd <input type=password name='pswd'> <input type=submit value='Search' name='sea'></td>
<tr><td colspan=7 bgcolor='orange'></td></tr>
</table>
</form>     
</fieldset>
Birth day falls this month:
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>Name <th>D_O_B <th>Branch<th>Division
<?
$sq="select empname,dobactual,dayofmonth(dobactual) day ,br,divi,empcode  from empmaster where month(dobactual)=month(curdate()) and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
 print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td>";
 print "<td><input type=button value='sms' onClick=javascript:sms('$brow[5]','s0')></td></tr>";

}
?>
</table>

Marriage falls this month:
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>Name <th>D_O_Marriage <th>Branch<th>Division
<?
$sq="select empname,domarg,dayofmonth(domarg) day ,br,divi  from empmaster where month(domarg)=month(curdate()) and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
 print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td></tr>";
}
?>
</table>
<b>Probation Period ending this month:</b>
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>Name <th>Probation ends on <th>Branch<th>Division
<?
$sq="select empname,probdate,dayofmonth(probdate) day ,br,divi  from empmaster where month(probdate)=month(curdate()) and year(probdate)=year(curdate()) and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
 print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td></tr>";
}
?>
</table>

Insurance(1) falls this month:
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>Name <th>Renew Date <th>Branch<th>Division<th>Insurance<th>Type

<?

$sq="select empname,insurdate1,dayofmonth(insurdate1) day ,br,divi,insurname1,insurtype1,month(insurdate1)  from empmaster where month(insurdate1)=month(curdate()) and year(insurdate1)=year(curdate())and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
 print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td><td>".strtoupper($brow[5])."</td><td>".strtoupper($brow[6])."</td><td>".strtoupper($brow[7])."</td></tr>";
}

?>
</table>

Insurance(2) falls this month:
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>Name <th>Renew Date <th>Branch<th>Division<th>Insurance<th>Type
<?
$sq="select empname,insurdate2,dayofmonth(insurdate2) day ,br,divi,insurname2,insurtype2  from empmaster where month(insurdate2)=month(curdate()) and year(insurdate2)=year(curdate()) and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
 print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td><td>".strtoupper($brow[5])."</td><td>".strtoupper($brow[6])."</td></tr>";
}
?>
</table>

Insurance(3) falls this month:
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>Name <th>Renew Date <th>Branch<th>Division<th>Insurance<th>Type
<?
$sq="select empname,insurdate3,dayofmonth(insurdate3) day ,br,divi,insurname3,insurtype3  from empmaster where month(insurdate3)=month(curdate()) and year(insurdate3)=year(curdate())and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
 print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td><td>".strtoupper($brow[5])."</td><td>".strtoupper($brow[6])."</td></tr>";
}
?>
</table>
Insurance(4) falls this month:
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>Name <th>Renew Date <th>Branch<th>Division<th>Insurance<th>Type
<?
$sq="select empname,insurdate4,dayofmonth(insurdate4) day ,br,divi,insurname4,insurtype4  from empmaster where month(insurdate4)=month(curdate()) and year(insurdate4)=year(curdate()) and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
 print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td><td>".strtoupper($brow[5])."</td><td>".strtoupper($brow[6])."</td></tr>";
}
?>
</table>

Driving liscense M/C renew this month:
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>Name <th>Renew Date <th>Branch<th>Division<th>Driving liscence<th>Type
<?
$sq="select empname,drvdate1,dayofmonth(drvdate1) day ,br,divi,drvno1,drvtype1,month(drvdate1)  from empmaster where month(drvdate1)=month(curdate()) and year(drvdate1)=year(curdate())and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))


{
$x=$brow[7]+1;
$s=$x;
 print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td><td>".strtoupper($brow[5])."</td><td>".strtoupper($brow[6])."</td></tr>";

}
$s=$x;
?>

<?

$sq="select empname,drvdate1,dayofmonth(drvdate1) day ,br,divi,drvno1,drvtype1,month(drvdate1)  from empmaster where month(drvdate1)='$s' and year(drvdate1)=year(curdate())and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))


{

 print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td><td>".strtoupper($brow[5])."</td><td>".strtoupper($brow[6])."</td></tr>";

}


?>


</table>

Driving lisencse LMV renew this month:
<table cellspacing=1 cellpadding=1 bgcoloSear=silver>
<th>Name <th>Renew Date <th>Branch<th>Division<th>Driving liscence<th>Type
<?
$sq="select empname,drvdate2,dayofmonth(drvdate2) day ,br,divi,drvno2,drvtype2,month(drvdate2)  from empmaster where month(drvdate2)=month(curdate()) and year(drvdate2)=year(curdate()) and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
$x=$brow[7]+1;
$s=$x;
 print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td><td>".strtoupper($brow[5])."</td><td>".strtoupper($brow[6])."</td></tr>";
}
$s=$x;
?>

<?
$sq="select empname,drvdate2,dayofmonth(drvdate2) day ,br,divi,drvno2,drvtype2  from empmaster where month(drvdate2)='$s' and year(drvdate2)=year(curdate()) and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
 print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td><td>".strtoupper($brow[5])."</td><td>".strtoupper($brow[6])."</td></tr>";
}

?>
</table>
Driving lisencse HGMV renew this month:
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>Name <th>Renew Date <th>Branch<th>Division<th>Driving liscence<th>Type
<?
$sq="select empname,drvdate3,dayofmonth(drvdate3) day ,br,divi,drvno3,drvtype3,month(drvdate2)  from empmaster where month(drvdate3)=month(curdate()) and year(drvdate3)=year(curdate()) and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
$x=$brow[7]+1;
$s=$x;
 print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td><td>".strtoupper($brow[5])."</td><td>".strtoupper($brow[6])."</td></tr>";
}
$s=$x;
?>
<?
$sq="select empname,drvdate3,dayofmonth(drvdate3) day ,br,divi,drvno3,drvtype3  from empmaster where month(drvdate3)='$s' and year(drvdate3)=year(curdate()) and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
 print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td><td>".strtoupper($brow[5])."</td><td>".strtoupper($brow[6])."</td></tr>";
}
?>
</table>
Wife/Husband's Birth Date falls this month:
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>WifeName <th>D_O_Birth <th>Emp Name<th>Branch<th>Division
<?
$sq="select wifename,dobw,dayofmonth(dobw) day,empname ,br,divi  from empmaster where month(dobw)=month(curdate()) and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
 print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td><td>".strtoupper($brow[5])."</td></tr>";
}
?>

</table>
Child(1) Birth Date falls this month:
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>ChildName <th>D_O_Birth <th>Emp Name<th>Branch<th>Division
<?
$sq="select c1name,dobc1,dayofmonth(dobc1) day,empname ,br,divi  from empmaster where month(dobc1)=month(curdate()) and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
 print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td><td>".strtoupper($brow[5])."</td></tr>";
}
?>
</table>
Child(2) Birth Date falls this month:
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>ChildName <th>D_O_Birth <th>Emp Name<th>Branch<th>Division
<?
$sq="select c2name,dobc2,dayofmonth(dobc2) day,empname ,br,divi  from empmaster where month(dobc2)=month(curdate()) and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
 	print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
 	print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td><td>".strtoupper($brow[5])."</td></tr>";
}
?>
</table>
Child(3) Birth Date falls this month:
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>ChildName <th>D_O_Birth <th>Emp Name<th>Branch<th>Division
<?
$sq="select c3name,dobc3,dayofmonth(dobc3) day,empname ,br,divi  from empmaster where month(dobc3)=month(curdate()) and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
	print "<tr bgcolor=white><td>".strtoupper($brow[0])."</td><td>".datetohtml($brow[1])."</td>";
	print "<td>$brow[3]</td><td>".strtoupper($brow[4])."</td><td>".strtoupper($brow[5])."</td></tr>";
}
?>
</table>
5 Year Completed (Joining Date falls this month)
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>Employee Name<th>D_O_Join <th>Branch<th>Division
<?
$sq="select dayofmonth(doj) day,empname ,br,divi,doj  from empmaster where month(doj)=month(curdate()) and year(doj)=year(curdate())-5 and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
//	if (date('Y',$brow[4])<=date('Y',time()))
//	{
		print "<tr bgcolor=white><td>".strtoupper($brow[1])."</td><td>".datetohtml($brow[4])."</td>";
		print "<td>$brow[2]</td><td>".strtoupper($brow[3])."</td></tr>";
//	}
}
?>
</table>
10 Year Completed (Joining Date falls this month)
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>Employee Name<th>D_O_Join <th>Branch<th>Division
<?
$sq="select dayofmonth(doj) day,empname ,br,divi,doj  from empmaster where month(doj)=month(curdate()) and year(doj)=year(curdate())-10 and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
//	if (date('Y',$brow[4])<=date('Y',time()))
//	{
		print "<tr bgcolor=white><td>".strtoupper($brow[1])."</td><td>".datetohtml($brow[4])."</td>";
		print "<td>$brow[2]</td><td>".strtoupper($brow[3])."</td></tr>";
//	}
}
?>
</table>
15 Year Completed (Joining Date falls this month)
<table cellspacing=1 cellpadding=1 bgcolor=silver>
<th>Employee Name<th>D_O_Join <th>Branch<th>Division
<?
$sq="select dayofmonth(doj) day,empname ,br,divi,doj  from empmaster where month(doj)=month(curdate()) and year(doj)=year(curdate())-15 and brcode='$brcode' and emp_status='Active' and doret='0000-00-00' order by day";
$bres=mysqli_query($db,$sq)or die(mysqli_error($db));
while($brow=mysqli_fetch_row($bres))
{
//	if (date('Y',$brow[4])<=date('Y',time()))
//	{
		print "<tr bgcolor=white><td>".strtoupper($brow[1])."</td><td>".datetohtml($brow[4])."</td>";
		print "<td>$brow[2]</td><td>".strtoupper($brow[3])."</td></tr>";
//	}
}
?>
</table>

<?

$i=1;
//include ("../test.php");
if($sea&&$pswd=='attitude')
{
$psd='support';
  if(strlen($empname)>0 && $br=='All')
   $sql="select * from empmaster where empname like '%$empname%' and brcode='$brcode' order by br";
 else if(strlen($empname)==0 && $br=='All' && $conf=='y')
  $sql="select * from empmaster where empname like '%' and brcode='$brcode' and doconf>0 and doret='0000-00-00' order by br";
  else if(strlen($desig)>0 && $br=='All')
   $sql="select * from empmaster where design like '%$desig%' and brcode='$brcode' and  doret='0000-00-00' order by br";
  else if(strlen($divis)>0 && $br=='All' &&$conf=='y')
   $sql="select * from empmaster where divi ='$divis' and brcode='$brcode'  and doconf>0 order by br";
  else if(strlen($divis)>0 && $br=='All')
   $sql="select * from empmaster where divi ='$divis' and brcode='$brcode' and doret='0000-00-00' order by br";
  else if(strlen($desig)>0 && $br!='All')
   $sql="select * from empmaster where design like '%$desig%' and brcode='$brcode' and br='$br' order by br";
  else if(strlen($divis)>0 && $br!='All')
   $sql="select * from empmaster where divi ='$divis' and brcode='$brcode' and br='$br' and doret='0000-00-00' order by br";
else if(strlen($empid)>0 && $br=='All')
   $sql="select * from empmaster where empid ='$empid' and brcode='$brcode' and doret='0000-00-00' order by br";
  else if($br!='All' && $conf=='y')
   $sql="select * from empmaster where brcode='$brcode'  and doconf>0 and br='$br' order by br";
  else if($br!='All')
   $sql="select * from empmaster where brcode='$brcode'  and br='$br' and doret='0000-00-00' order by br";
  else
   $sql="select * from empmaster where brcode='$brcode' and doret='0000-00-00' order by br";
//print $sql;
  $res=mysqli_query($db,$sql);
 if($pay=='y')
  {
   while($pay_row=mysqli_fetch_array($res))
   {
     $emp_res=mysqli_query($db,"select * from emp_pay where empcode='$pay_row[empcode]'  order by ondate desc limit 1"); 
	if(mysqli_num_rows($emp_res)>0)
	{     
print "<br><center><b><font color=red>****</font></center><table border=1><th>Name <th>Tot Sal<th>Basic<th>inc in<br> Pf <th>inc in <br>esi <th>DA<th> inc in<br> pf<th>inc in<br> esi<th>TA<th>inc in <br>pf<th>inc in<br>esi<th>HRA<th>inc in<br> pf<th>inc in<br> esi<th>ON DATE ";

	$e_row=mysqli_fetch_array($emp_res);
     print "<tr><td>$pay_row[empname]</td><td>$e_row[totsal]</td><td>$e_row[basic]</td>";
     print "<td align=center>";
 if($e_row[bapf]=='y')
  print "<img src='../img/yes-bl.gif'>";
 else
  print "<img src='../img/x-bl.gif'>";

print "</td><td align=center>";
 if($e_row[baesi]=='y')
  print "<img src='../img/yes-bl.gif'>";
 else
  print "<img src='../img/x-bl.gif'>";

print "</td><td>$e_row[da]</td><td align=center>";
if($e_row[dapf]=='y')
  print "<img src='../img/yes-bl.gif'>";
 else
  print "<img src='../img/x-bl.gif'>";
print "</td><td align=center>";
if($e_row[daesi]=='y')
  print "<img src='../img/yes-bl.gif'>";
 else
  print "<img src='../img/x-bl.gif'>";

 print "</td><td>$e_row[ta]</td><td align=center>";
 if($e_row[tapf]=='y')
  print "<img src='../img/yes-bl.gif'>";
 else
  print "<img src='../img/x-bl.gif'>";
print "</td><td align=center>";
if($e_row[taesi]=='y')
  print "<img src='../img/yes-bl.gif'>";
 else
  print "<img src='../img/x-bl.gif'>";
print "</td><td>$e_row[hra]</td><td align=center>";
 if($e_row[hrapf]=='y')
  print "<img src='../img/yes-bl.gif'>";
 else
  print "<img src='../img/x-bl.gif'>";
print "</td><td align=center>";
if($e_row[hraesi]=='y')
  print "<img src='../img/yes-bl.gif'>";
 else
  print "<img src='../img/x-bl.gif'>";

print "</td><td>".datetohtml($e_row[ondate])."</td>";
print "<tr><th colspan=8><center><b>Allowances</td><th colspan=8><b>Deductions</td></tr>";
print "<tr><td colspan=8><table border=1 width=100%><th>Name <th>Amount";
	$alres=mysqli_query($db,"select * from emp_pay_allow where empcode='$e_row[empcode]' and ondata='$e_row[ondate]' order by ondata desc ")or die(mysqli_error($db));
	while($alrow=mysqli_fetch_array($alres))
        {
          print "<tr><td>$alrow[1]</td><td align=right>$alrow[2]</td></tr>";
        }
     print "</table></td><td width=100% colspan=10 valign=top><center>";

print "<table border=1 width=100%><th>Name <th>Amount";
	$alres=mysqli_query($db,"select * from emp_pay_ded where empcode='$e_row[empcode]'  and ondata='$e_row[ondate]' order by ondata desc ")or die(mysqli_error($db));
	while($alrow=mysqli_fetch_array($alres))
        {
          print "<tr><td>$alrow[1]</td><td align=right>$alrow[2]</td></tr>";
        }
     print "</table></td></tr></table>";
	}
   }
    return;
  }

if(mysqli_num_rows($res)<=0)
{
 print "<center><font color=red> Record does not exist</font></center>";
 return;
}
print "<font color=red><b>*</b></font> Indicates confirmed staff";
print "<hr><table style={font-size:.91em} width=100%> <th>No <th>Name <th>ID <th>Branch <th>Division <th>Designation<th>Mobile <th>Resi<th>PF No.<th>ESI No.<th>Email<th>B Grp<th>DOJ ";
print "<th>Dob ";
if($level<6)
{
	print "<th colspan=2 width=100>Action";
}
$i=1;
while($row=mysqli_fetch_array($res))
{
	$spdate=explode('-',$row[doconf]);
	$chdt=$spdate[1]+$spdate[2]+$spdate[0];
	print "<form action='editemp.php'><input type=hidden name=code value='$row[empcode]'>";
 	print "<tr bgColor='e3ecd2' onMouseOver=bgColor='gold' onMouseOut=bgColor='e3ecd2'><td>".$i++."</td><td>";
	if($chdt>0)
  		print "<font color=red><b>*</b> </font>";
	print strtoupper($row[empname])."</td><td><center>$row[empid]</td>".
  	"<td align=center>$row[br]</td><td>$row[divi]</td><td>$row[design]</td>";
	print "<td>$row[mob]</td><td>$row[resph]</td><td>$row[pf]</td><td>$row[esi]<td>$row[email]</td></td><td>$row[bgrp]</td><td>".datetohtml($row[doj])."</td><td>".datetohtml($row[dob])."</td>";
	if($level<6)
	{
		 print "<td><input type=submit value='Edit'> </td><td><input type=button value='Del' onClick=javascript:del('$row[empcode]')> </td>";
	}
	print "</tr></form>";
	}
	print "</table>";
}
}
//***************************************** retired
?>
<script>
 function del(x)
 {
   if(confirm('Do you want to delete the record?'))
     document.location='delemp.php?code='+x;
 }
</script>
