<?
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");

$sq="select * from empmaster where empcode='$empcode' and brcode='$brcode'";

$empres=mysqli_query($db,$sq)or die(mysqli_error());
$emprow=mysqli_fetch_array($empres)or die(mysqli_error());
?>
<style>
pre,tr,td{font-family:helvetica;font-size:14}
th{font-family:helvetica;font-size:13}
tr{background-color:white}
</style>
<table width=100% cellspacing=1 cellpadding=3 bgcolor='gray'>
<tr><td bgcolor='gray'><font color='white'><b><?print $emprow[empname].' (ID: '.$emprow[empid]?>)</td></tr>
<tr><td bgcolor='white'>
<table border=0 cellspacing=1 cellpadding=3>
<?  print"\n<tr><td><b>Sex</td><td>$emprow[sex]</td><td><b>Division</td><td>$emprow[divi]</td>";
print "<td><b>Branch</td><td>$emprow[br]</td><td><b>Desig</td><td>$emprow[design]</td>";
 print "<tr><td><b>Dept</td><td>".$emprow[dept]."</td>";
 print "<td><b>DoJ</td><td>".datetohtml($emprow[doj])."</td>";
 print "<td><b>D_Conf</td><td>".datetohtml($emprow[doconf])."</td>";
 print "<td><b>D_Ret</td>";
 if($emprow[doret]!='0000-00-00')
   print "<td>".datetohtml($emprow[doret])."</td>";
 else
  print "<td></td>";
?>
</table>
</td></tr>
<tr><td bgcolor='white'>
<table border=0 cellspacing=1 cellpadding=3>
<tr>
	<td><b>M_Status</td><td><?print $emprow[mstatus]?></td>
	<td><b>DOB</td><td><?print datetohtml($emprow[dob])?> Actual:<?print datetohtml($emprow[dobactual])?></td>
	<td><b>Father</td><td><?print $emprow[fname]?></td>
</tr><tr>
	<td><b>Permanent Address</td><td colspan=10><pre><?print $emprow[peraddr]?></td>
</tr><tr>
	<td><b>Present Address</td><td colspan=10><pre><?print $emprow[praddr]?></td>
</tr><tr>
	<td><b>Phone res</td><td><?print $emprow[resph]?></td>
	<td><b>Mobile</td><td><?print $emprow[mob]?></td>
	<td><b>Email</td><td><?print $emprow[email]?></td>
	<td><b>Pan</td><td><?print $emprow[pan]?></td>
</td></tr>
</table>
</td></tr>
<tr><td bgColor='gray'><font color='white'> ICE File Details</td></tr>
<tr><td bgcolor='white'>
<table border=0 cellspacing=1 cellpadding=3 bgcolor=gray>
<th>Name <th>Relation<th>Address <th>Phone <th>Mobile
<tr>
	<td><?print $emprow[icename1]?></td>
	<td><?print $emprow[icerel1]?></td>
	<td><?print $emprow[iceaddr1]?></td>
	<td><?print $emprow[icephone1]?></td>
	<td><?print $emprow[icemob1]?></td>
</td></tr>
<tr>
	<td><?print $emprow[icename2]?></td>
	<td><?print $emprow[icerel2]?></td>
	<td><?print $emprow[iceaddr2]?></td>
	<td><?print $emprow[icephone2]?></td>
	<td><?print $emprow[icemob2]?></td>
</td></tr>

</table>
<tr><td>
<?
//*************************************************
?>

<tr><td bgColor='gray'><font color='white'> Salary</td></tr>
<tr><td bgcolor='white'><center>
<table border=1>
<tr>
<?
 $payres=mysqli_query($db,"select * from emp_pay where brcode='$brcode' and empcode='$empcode' order by ondate desc");
while($payrow=mysqli_fetch_array($payres))
{
print "<td>";
?>
<table border=0 cellspacing=1 cellpadding=3 bgcolor='Silver'>
<tr><td colspan=10 bgcolor='silver'>On Date: <?print datetohtml($payrow[ondate])?></td>
	<tr><td><b>Total Salary</td><td><?print $payrow[totsal]?></td>
	<tr><td><b>Basic</td><td><?print $payrow[basic]?></td>
	<!-- <tr><td><b>Pf</td><td><?print $payrow[bapf]?></td>-->
	<tr><td><b>DA</td><td><?print $payrow[da]?></td>
	<!-- <tr><td><b>DA PF</td><td><?print $payrow[dapf]?></td>
	<tr><td><b>DA ESI</td><td><?print $payrow[daesi]?></td> -->
	<tr><td><b>TA</td><td><?print $payrow[ta]?></td>
	<!-- <tr><td><b>TA PF</td><td><?print $payrow[tapf]?></td>
	<tr><td><b>TA ESI</td><td><?print $payrow[taesi]?></td> -->
	<tr><td><b>HRA</td><td><?print $payrow[hra]?></td>
</tr>
<tr>
	<td><b>HRA PF</td><td><?print $payrow[hrapf]?></td>
	<tr><td><b>HRA ESI</td><td><?print $payrow[hresi]?></td>
	<tr><td><b>Rent</td><td><?print $payrow[rent]?></td>
	<tr><td><b>Rent PF</td><td><?print $payrow[rentpf]?></td>
	<tr><td><b>Rent ESI</td><td><?print $payrow[rentesi]?></td>
	<tr><td><b>Mobile</td><td><?print $payrow[mob]?></td>
	<tr><td><b>D Allow</td><td><?print $payrow[dallow]?></td>
	<tr><td><b>TTA</td><td><?print $payrow[tta]?></td>
	<tr><td><b>Convay</td><td><?print $payrow[convay]?></td>
</tr>
</table>
<?
print "\n\n</td>";
}
?>
</td></tr>
</table>
<tr><td bgColor='gray'><font color='white'> Allowances</td></tr>
<tr><td><center>
<table border=1>
<th>On Date <th>Allowance <th>Amount
<?
$q="select * from emp_pay_allow where  empcode='$empcode' order by ondata desc";
 $payres1=mysqli_query($db,$q)or die(mysqli_error());
$cnt=1;
while($payrow=mysqli_fetch_array($payres1))
{
print "<tr><td>".datetohtml($payrow[ondata])."</td><td>$payrow[allow]</td>";
print "<td align=right>$payrow[amt]</td></tr>";
/*
?>
<table border=0 cellspacing=1 cellpadding=3 bgcolor='Silver' width=300>
<tr><td colspan=10 bgcolor='silver'>On Date: <?print datetohtml($payrow[ondata])?></td>
	<tr><td><b>Allow</td><td><?print $payrow[allow]?></td>
	<tr><td><b>Amount</td><td><?print $payrow[amt]?></td>
</tr>
</table>
<?
print "\n\n</td>";
if($cnt%3==0)
 print "<tr>";
$cnt++;
*/
}
?>
</td></tr>
</table>


<tr><td bgColor='gray'><font color='white'> Deductions</td></tr>
<tr><td><center>
<table border=1>
<tr>
<?
$q="select * from emp_pay_ded where  empcode='$empcode' order by ondata desc";
 $payres2=mysqli_query($db,$q)or die(mysqli_error());
$cnt=1;
while($payrow=mysqli_fetch_array($payres2))
{
print "<td>";
?>
<table border=0 cellspacing=1 cellpadding=3 bgcolor='Silver' width=300>
<tr><td colspan=10 bgcolor='silver'>On Date: <?print datetohtml($payrow[ondata])?></td>
	<tr><td><b>Deduction</td><td><?print $payrow[allow]?></td>
	<tr><td><b>Amount</td><td><?print $payrow[amt]?></td>
</tr>
</table>
<?
print "\n\n</td>";
if($cnt%3==0)
 print "<tr>";
$cnt++;
}
?>
</td></tr></table>
<tr><td bgColor='gray'><font color='white'> Qualifications</td></tr>
<tr><td align=left>
<table border=1>
<th>Qualification <th>Course <th>Subject <th>% of marks
<tr>
	<td><?print $emprow[quali1]?></td>
	<td><?print $emprow[course1]?></td>
	<td><?print $emprow[sub1]?></td>
	<td><?print $emprow[mark1]?></td>
</td></tr>
<tr>
	<td><?print $emprow[quali2]?></td>
	<td><?print $emprow[course2]?></td>
	<td><?print $emprow[sub2]?></td>
	<td><?print $emprow[mark2]?></td>
</td></tr>
<tr>
	<td><?print $emprow[quali3]?></td>
	<td><?print $emprow[course3]?></td>
	<td><?print $emprow[sub3]?></td>
	<td><?print $emprow[mark3]?></td>
</td></tr>

</table>
</td></tr>
<tr><td bgColor='gray'><font color='white'> Insurance</td></tr>
<tr><td align=left>
<table border=1>
<th>Name <th>Date <th>Type
<tr>
	<td><?print $emprow[insurname1]?></td>
	<td><?print $emprow[insurdate1]?></td>
	<td><?print $emprow[insurtype1]?></td>
</tr>

<tr>
	<td><?print $emprow[insurname2]?></td>
	<td><?print $emprow[insurdate2]?></td>
	<td><?print $emprow[insurtype2]?></td>
</tr>

<tr>
	<td><?print $emprow[insurname3]?></td>
	<td><?print $emprow[insurdate3]?></td>
	<td><?print $emprow[insurtype3]?></td>
</tr>
</table>
</td></tr>
<tr><td bgColor='gray'><font color='white'> Other Allowances</td></tr>
<tr><td align=left>
<table border=1>
	<tr><td><?print $emprow[oallow]?></td></tr>
</table>
</td></tr>
</table>

