<?
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");
$tbl1="payrolltmp".$brcode;
$tbl2='esipfbr'.$brcode;
$tbl3="ded_payrolltmp".$brcode;
$esires=mysqli_query($db,"select empesip from celmast where brcode='$brcode'");
$esipr=mysqli_fetch_row($esires);
$esip=$esipr[0];
?>
<head>
<style>
body,td{font-family:'arial narrow';letter-spacing:1;}
tr{background-color:e3ecd2}
th{background-color:c1d799}
.mnu{margin-left:5}
body{BACKGROUND-COLOR:fcfff1}
</style>
<center>
<?
if($show)
{
 	print "<fieldset><legend>$grow[0]</legend>";
 	print "<table border=1><th>No<th>Employee Name <th>Basic + DA<th>PF ";
 	$sq="select $tbl1.empcode,esi,pf,ename,ebasicda from $tbl1,$tbl3 where month(wdatefrm)='$month' and year(wdatefrm)=$year and $tbl1.brcode='$brcode' and $tbl3.empcode=$tbl1.empcode and $tbl3.wdateto=$tbl1.wgto order by $tbl1.empcode";
//	 $sq="select empcode,esi,pf from $tbl3 where month(wdatefrm)='$month' and year(wdatefrm)=$year and brcode = '$brcode' order by empcode";
 	$re3=mysqli_query($db,$sq)or die('Err'.mysqli_error($db));
 	$i=1;
 	$t1=0;
 	$t2=0;
 	$t3=0;
 	$t4=0;
 	$tgpay=0;
	$meb=0;
	$mpf=0;
 	while($row=mysqli_fetch_array($re3))
 	{
		$mename = $row[ename];
		$sq1="select esi,newesi  from esiinc where month(fordate)='$month' and year(fordate)=$year and ename = '$mename'";
		$re31=mysqli_query($db,$sq1)or die('Err'.mysqli_error($db));
		$row1=mysqli_fetch_array($re31);
		$mebasicda=$row[ebasicda];
		if ($row[ebasicda]>6500)
			$mebasicda=6500;
		print "<tr><td>".$i++."</td><td>".$mename."</td><td align=right>".putComa($mebasicda)."</td><td align=right>$row[pf]</td></tr>";
		$meb+=$mebasicda;
		$mpf+=$row[pf];
 	}
	$msq="select * from $tbl1 where month(wgto)='$month' and year(wgto)=$year and brcode='$brcode' and wdays = 0";
	$re31=mysqli_query($db,$msq)or die('Err'.mysqli_error($db));
	while($row1=mysqli_fetch_array($re31))
 	{
		print "<tr><td>".$i++."</td><td>".$row1[ename]."</td><td align=right>0.00</td><td align=right>0.00</td></tr>";
	}
 	print "<tr><td colspan=2><center><b>Total</td><td align=right>".putComa($meb)."</td><td>".putComa($mpf)."</td></tr>";
	print "</table></fieldset>";
	return;
} // end if show
//************
?>
<center>
<form action='<?print $PHP_SELF?>' method='post'> 
<table>
<tr><td>Select Month</td><td><select name='month'>
<?
for($i=1;$i<=12;$i++)
	print "<option>$i</option>";
?>
</select>
</td><td>Year <td><select name='year'>
<option>2012</option>
<option>2013</option>
<option>2014</option>
<option>2008</option>
<option>2009</option>
<option>2010</option>
<option>2011</option>
</select>
</td><td><input type=submit value='Show' name='show'></td></tr>
</table>
</form>

