<?php
session_start();
if($_SESSION["username"]=="")
{
 	echo "You are not Logged in Please <a href='index.html'>Sign in </a> First ";
}
else
{




include 'dbc.php';


$userid=$_SESSION["userid"];
$month_name=$_POST["month"];
$marital=$_POST["marital"];
$btype=$_POST["btype"];
$sql = "SELECT * FROM paidsalary where month_name='$month_name' and status='$marital' and bname='$btype' and user_id='$userid' ORDER BY class_name";
$result=$conn->query($sql);
?>
 <strong class="card-title"> <center> <img src="logo1.jpg" align="middle" /></center></strong>
 <strong class="card-title"><center><h1><? echo $userid; ?></h1></center> </strong>
									 <strong class="card-title"><center><? echo $month_name; ?></center> </strong>
                                   <table id="bootstrap-data-table-export" border="1" class="table table-striped table-bordered">
                                    <thead>
									<?php
                                   
echo "<tr>";
echo "<th bgcolor=#0099FF> S.No</th>";
echo "<th bgcolor=#0099FF> Staff Name </th>";
echo "<th bgcolor=#0099FF> Department </th>";
echo "<th bgcolor=#0099FF> Desg </th>";
echo "<th bgcolor=#0099FF> J.Date </th>";
echo "<th bgcolor=#0099FF> I.Date </th>";
echo "<th bgcolor=#0099FF> Basic Salary</th>";
echo "<th bgcolor=#0099FF> T.Days</th>";
echo "<th bgcolor=#0099FF> A.Days</th>";
echo "<th bgcolor=#0099FF> P.Days</th>";
echo "<th bgcolor=#0099FF> Abs.Ded</th>";
echo "<th bgcolor=#0099FF> Adv.Ded</th>";
echo "<th bgcolor=#0099FF> Oth.Ded</th>";
echo "<th bgcolor=#0099FF> Sec.Ded</th>";
echo "<th bgcolor=#0099FF> Total Ded</th>";
echo "<th bgcolor=#0099FF> Gross Salary</th>";
echo "<th bgcolor=#0099FF> Annual Leave</th>";
echo "<th bgcolor=#0099FF> Increament</th>";
echo "<th bgcolor=#0099FF> Others</th>";
echo "<th bgcolor=#0099FF> Fuel Allow</th>";
echo "<th bgcolor=#0099FF> Cordinator Allow</th>";
echo "<th bgcolor=#0099FF> P.Dues</th>";
echo "<th bgcolor=#0099FF> Sec Ret</th>";
echo "<th bgcolor=#0099FF> Total Allownces</th>";
echo "<th bgcolor=#0099FF> Net Salary</th>";

echo "</tr>";
$sno=1;
?>
                                    </thead>
									
                                    <tbody>
									<?php
                                       while($row = $result->fetch_assoc())
 
  {
  $id = $row['id'];	
   echo "<tr>";
   echo "<td align=center>" .$sno . "</td>";
echo "<td align=center>" .$row['tech_name'] . "</td>";
  echo "<td align=center>" .$row['status'] .  "</td>";
 echo "<td align=center>" .$row['class_name'] .  "</td>";
 echo "<td align=center>" .$row['adm_date'] .  "</td>";
  echo "<td align=center>" .$row['idate'] .  "</td>";
  echo "<td align=center>" .$row['monthly_salary'] .  "</td>";
  
 echo "<td align=center>" .$row['tdays'] .  "</td>";
  echo "<td align=center>" .$row['adays'] .  "</td>";
  echo "<td align=center>" .$row['pdays'] .  "</td>";
   echo "<td align=center>" .round($row['absentded'],0) .  "</td>";
    echo "<td align=center>" .round($row['advded'],0) .  "</td>";
	 echo "<td align=center>" .round($row['oded'],0) .  "</td>";
	  echo "<td align=center>" .round($row['secded'],0) .  "</td>";
 echo "<td align=center>" .round($row['totalded'],0) .  "</td>";
  echo "<td align=center>" .round($row['gsalary'],0) .  "</td>";
   echo "<td align=center>" .round($row['leaveallow'],0) .  "</td>";
    echo "<td align=center>" .round($row['dailyallow'],0) .  "</td>";
	 echo "<td align=center>" .round($row['oallow'],0) .  "</td>";
	  echo "<td align=center>" .round($row['fallow'],0) .  "</td>";
	   echo "<td align=center>" .round($row['callow'],0) .  "</td>";
	    echo "<td align=center>" .round($row['pallow'],0) .  "</td>";
	 echo "<td align=center>" .round($row['secret'],0) .  "</td>";
 echo "<td align=center>" .round($row['totalallow'],0) .  "</td>";
  echo "<td align=center>" .round($row['netsalary'],0) .  "</td>";
		  
		  
$trecord=$trecord + 1;
$tmonthlysalary=$tmonthlysalary + round($row['monthly_salary'],0);
$tabsentded=$tabsentded + round($row['absentded'],0);
$tadvded=$tadvded + round($row['advded'],0);
$tsecded=$tsecded + round($row['secded'],0);
$toded=$toded + round($row['oded'],0);
$ttotalded=$ttotalded + round($row['totalded'],0);
$tgsalary=$tgsalary + round($row['gsalary'],0);
$tleaveallow=$tleaveallow + round($row['leaveallow'],0);
$tdailyallow=$tdailyallow + round($row['dailyallow'],0);
$toallow=$toallow + round($row['oallow'],0);
$tsecret=$tsecret + round($row['secret'],0);
$tfallow=$tfallow + round($row['fallow'],0);
$tcallow=$tcallow + round($row['callow'],0);
$tpallow=$tpallow + round($row['pallow'],0);

$ttotalallow=$ttotalallow + round($row['totalallow'],0);
$tnetsalary=$tnetsalary + round($row['netsalary'],0);
$sno=$sno + 1;
  }
   echo "<tr>";
	echo "<td colspan=6 align=right><b>" ."Total Records::". $trecord ."</b></td>";
	echo "<td><b>" .number_format($tmonthlysalary) . "</b></td>";
	echo "<td></td>";
	echo "<td></td>";
	echo "<td></td>";
	echo "<td><b>" .number_format($tabsentded) . "</b></td>";
	echo "<td><b>" .number_format($tadvded) . "</b></td>";
	echo "<td><b>" .number_format($toded) . "</b></td>";
	echo "<td><b>" .number_format($tsecded). "</b></td>";
	  	echo "<td><b>" .number_format($ttotalded) . "</b></td>";
		echo "<td><b>" .number_format($tgsalary) . "</b></td>";
		echo "<td><b>" .number_format($tleaveallow) . "</b></td>";
		echo "<td><b>" .number_format($tdailyallow) . "</b></td>";
		echo "<td><b>" .number_format($toallow) . "</b></td>";
		
		echo "<td><b>" .number_format($tfallow) . "</b></td>";
		echo "<td><b>" .number_format($tcallow) . "</b></td>";
		echo "<td><b>" .number_format($tpallow) . "</b></td>";
		echo "<td><b>" .number_format($tsecret) . "</b></td>";
		echo "<td><b>" .number_format($ttotalallow) . "</b></td>";
		echo "<td><b>" .number_format($tnetsalary) . "</b></td>";
	  echo "</tr>";
	   echo "<tr height=100>";
	echo "<td colspan=25 align=center valign=top><b> Stamp and Signature:</b></td>";
		
	  echo "</tr>";
  ?>
                                       
                                    </tbody>
                                </table>
                         
<?php
}
?>

<br />
<h3><br />
 
Prepared By:______________
<br />

<br />

<br />

<br />

<br />
