<?php 
  session_start();
  if(empty($_SESSION['branch']) || $_SESSION['branch'] == ''){
    header("Location: index.php");
    die();
  }
    require_once 'system/conn.php';


if(empty($_SESSION['e_id'])){
    echo "<script> window.location.assign('index.php'); </script>";
}
extract($_POST);
$select=$conn->query("SELECT * FROM `emp_salary` WHERE `emp_id`='$ename' AND `month`='$month' AND `year`='$year'   AND `branch`='".$_SESSION['branch']."'");
$count=$select->num_rows;
if($count>0){
$row=$select->fetch_assoc();

$select_ot=$conn->query("SELECT * FROM `ot_details` WHERE `emp_id`='$ename' AND `month`='$month' AND `year`='$year'   AND `branch`='".$_SESSION['branch']."'");
$count_ot=$select_ot->num_rows;
if($count_ot>0)
$row_ot=$select_ot->fetch_assoc();


?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
	<title></title>
	<style type="text/css">
		@page { size: 8.5in 11in; margin: 0.5in }
		p { margin-bottom: 0.1in; direction: ltr; line-height: 100%; text-align: left; vertical-align: middle; }
	
	table {
  border-collapse: collapse;
}
table, th, tr, tbody {
  border: 2px solid black;
  vertical-align: middle;
}
td {
     border: 2px solid black;
  vertical-align: middle;
    position: relative;
  overflow: hidden;
  height: 2em;
}
</style>
</head>
<body lang="en-US" dir="ltr">
<table width="700px" cellpadding="7" cellspacing="0" style="border:1px solid black">

	<tbody>
		<tr>
			<td colspan="10" width="688" height="39" bgcolor="#c5e0b3" style="background: #c5e0b3; text-align:center; font-weight: bold; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				UTKAL TEAM CARE PVT LTD
			</td>
		</tr>
	
		<tr>
			<td colspan="10" width="688" valign="bottom" style="padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<p align="center"><font face="Times New Roman, serif"><font size="3" style="font-size: 10pt"><br>Viryatan, Ground Floor <br> Plot No : 777 , Saheed Nagar <br> Bhubaneswar - 751007</font></font></p>
 <!--<img src="assets/images/logo-icon.png" class="logo-icon" alt="utcpl" style="margin-left:400px;margin-top:-70px;height:70px">	-->
 <?php
$contactId = 1;

// Prepare and execute
$stmt = mysqli_prepare($con, "SELECT * FROM `contact_details` WHERE id = ? LIMIT 1");
mysqli_stmt_bind_param($stmt, "i", $contactId);
mysqli_stmt_execute($stmt);

// Fetch result
$result = mysqli_stmt_get_result($stmt);
$contact = mysqli_fetch_assoc($result);

// Close statement and connection
mysqli_stmt_close($stmt);
mysqli_close($con);
?>

<img src="admin/assets/images/<?php echo htmlspecialchars($contact['logo']); ?>" 
     class="logo-icon" 
     alt="utcpl" 
     style="margin-left:550px; margin-top:-70px; height:70px;">
 
 </td>
		</tr>
	
	</tbody>
	<tbody>
		<tr>
			<td colspan="10" width="688" valign="bottom" bgcolor="#c5e0b3"style="padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				Pay Slip For the Month of: <?php echo $month;?> <?php echo $year;?>
			</td>
		</tr>
	</tbody>

	<tbody>
		<tr>
			<td colspan="2" width="161" height="5" style="border-bottom: none; border-right: none; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in">
				Employee ID:
			</td>
			<td colspan="5" width="162" style="border-top: 1px solid #00000a; border-bottom: none; border-left: none; border-right: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0in; padding-right: 0.08in">
				<?php echo $ename?>
			</td>
			<td width="161" style="border-top: 1px solid #00000a; border-bottom: none; border-left: 1px solid #00000a; border-right: none; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in">
				Bank A/C No:
			</td>
			<td colspan="2" width="162" style="border-top: 1px solid #00000a; border-bottom: none; border-left: none; padding-top: 0in; padding-bottom: 0in; padding-left: 0in; padding-right: 0.08in">
				<?php echo $row['ac_no']?>
			</td>
		</tr>
	<tr>
			<td colspan="2" width="161" height="5" style="border-top: 1px solid #00000a; border-bottom: none; border-right: none; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in">
				Employee Name:
			</td>
			<td colspan="5" width="162" style="border-top: 1px solid #00000a; border-bottom: none; border-left: none; border-right: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0in; padding-right: 0.08in">
		<?php echo $row['name']?>
			</td>
			<td width="161" style="border-top: 1px solid #00000a; border-bottom: none; border-left: 1px solid #00000a; border-right: none; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in">
				No of working days :
			</td>
			<td colspan="2" width="162" style="border-top: 1px solid #00000a; border-bottom: none; border-left: none; padding-top: 0in; padding-bottom: 0in; padding-left: 0in; padding-right: 0.08in">
				<?php echo $row['attendance']?>
			</td>
		</tr>
		<tr>
			<td colspan="2" width="161" height="5" style="border-top: 1px solid #00000a; border-bottom: none; border-right: none; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in">
				Employee Designation:
			</td>
			<td colspan="5" width="162" style="border-top: 1px solid #00000a; border-bottom: none; border-left: none; border-right: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0in; padding-right: 0.08in">
				<?php echo $row['designation']?>
			</td>
			<td width="161" style="border-top: 1px solid #00000a; border-bottom: none; border-left: 1px solid #00000a; border-right: none; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0in">
				UAN:
			</td>
			<td colspan="2" width="162" style="border-top: 1px solid #00000a; border-bottom: none; border-left: none; padding-top: 0in; padding-bottom: 0in; padding-left: 0in; padding-right: 0.08in">
				<?php echo $row['uan']?>
			</td>
		</tr>
		
	</tbody>
	<tbody>
		<tr>
			<td colspan="7" width="331" bgcolor="#c5e0b3" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-right: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<b>GROSS</b>
			</td>
			<td colspan="3" width="343" bgcolor="#c5e0b3" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-left: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<b>DEDUCTIONS</b>
			</td>
		</tr>
	</tbody>
	<tbody>
		<tr>
			<td colspan="5" width="181" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-right: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				BASIC PAY
			</td>
			<td colspan="2" width="136" valign="top" style="border: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<?php echo $row['basic_pay']?>
			</td>
			<td colspan="2" width="147" style="border: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				PF
			</td>
			<td width="181" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-left: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<?php echo $row['pf']?>
			</td>
		</tr>
	</tbody>
	<tbody>
		<tr>
			<td colspan="5" width="181" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-right: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				HRA
			</td>
			<td colspan="2" width="136" style="border: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<?php echo $row['hra']?>
			</td>
			<td colspan="2" width="147" style="border: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
			ESIC
			</td>
			<td width="181" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-left: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<?php echo $row['esic']?>
			</td>
		</tr>
	</tbody>
	<tbody>
		<tr>
			<td colspan="5" width="181" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-right: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				CONVYANCE
			</td>
			<td colspan="2" width="136" style="border: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<?php echo $row['convyance']?>
			</td>
			<td colspan="2" width="147" style="border: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				ADVANCE
			</td>
			<td width="181" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-left: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<?php echo $row['advance']?>
			</td>
		</tr>
	</tbody>
	<tbody>
		<tr>
			<td colspan="5" width="181" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-right: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				MEDICAL
			</td>
			<td colspan="2" width="136" style="border: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<?php echo $row['medical']?>
			</td>
			<td colspan="2" width="147" style="border: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				PT
			</td>
			<td width="181" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-left: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
			<?php echo $row['tax']?>
			</td>
		</tr>
	</tbody>
		<tbody>
		<tr>
			<td colspan="5" width="181" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-right: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in"><b>GROSS PAY</b></td>
			<td colspan="2" width="136" style="border: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in"><b><?php echo $row['gross_pay']?></b></td>
			<td colspan="2" width="147" valign="top" style="border: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
		<b>DEDUCTIONS</b>
				
			</td>
			<td width="181" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-left: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<b><?php echo $row['deduction']?></b>
			</td>
		</tr>
	</tbody>
	<tbody>
		<tr>
			<td colspan="5" width="181" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-right: none; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<p><br/>

				</p>
			</td>
			<td colspan="2" width="136" valign="top" style="border-left: none; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<p><br/>

				</p>
			</td>
			<td colspan="2" width="147" valign="top" bgcolor="#c5e0b3" style="background: #c5e0b3" style="border: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<p align="right" style="margin-top: 0.19in"><font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>NET
				SALARY</b></font></font></p>
			</td>
			<td width="181" valign="top" bgcolor="#c5e0b3" style="background: #c5e0b3" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-left: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<b><?php echo $row['net_pay']?></b>
			</td>
		</tr>
		<tr>
		    <td colspan="5" width="181" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-right: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">No of OT Days</td>
			<td colspan="2" width="136" style="border: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in"><b><?php echo $row_ot['ot_days']?></b></td>
			<td colspan="2" width="147" valign="top" style="border: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
		<b>OT salary</b>
				
			</td>
			<td width="181" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-left: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<b><?php echo $row_ot['amount']?></b>
			</td>
			</tr><tr>
			    <td colspan="5" width="181" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-right: none; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<p><br/>

				</p>
			</td>
			<td colspan="2" width="136" valign="top" style="border-left: none; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<p><br/>

				</p>
			</td>
			<td colspan="2" width="147" valign="top" bgcolor="#c5e0b3" style="background: #c5e0b3" style="border: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<p align="right" style="margin-top: 0.19in"><font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>TOTAL
				SALARY</b></font></font></p>
			</td>
			<td width="181" valign="top" bgcolor="#c5e0b3" style="background: #c5e0b3" style="border-top: 1px solid #00000a; border-bottom: 1px solid #00000a; border-left: 1px solid #00000a; padding-top: 0in; padding-bottom: 0in; padding-left: 0.08in; padding-right: 0.08in">
				<b> <?php 
				    $total=$row['net_pay']+$row_ot['amount'];
				    echo $total;?></b>
			</td>
		</tr>
	</tbody>
	
</table>
</body>
</html>
<?php }else{ ?>

<h1  style="text-align: center">This employee don't have any Salary record for the selected month &amp; Year.</h1>

<?php }?>