<?php
ini_set('display_errors', 0);
//error_reporting(E_ALL);
//ini_set('display_errors', 1);

session_start();
ob_start();

require_once('../../server_assets/server_connect.php');
require_once('../../server_assets/all_function.php');

$tr_no 		= $_REQUEST['tr_no'];

$grp_sql="SELECT * FROM user_group  WHERE id='".$_SESSION['user']['group']."'";
$grp_data = find_all_field_sql($conn,$grp_sql);
 
$ms_sql="SELECT * FROM employee_monthly_salary  WHERE tr_no='".$tr_no."'";
$ms_data = find_all_field_sql($conn,$ms_sql);

$addi_sql="SELECT sum(additional_amt) as additional_amt FROM employee_monthly_additional_salary_payment 
 WHERE emp_code='".$ms_data->emp_code."' and mon='".$ms_data->mon."' and year='".$ms_data->year."' group by emp_code";
$addi_data = find_all_field_sql($conn,$addi_sql);
 
$emp_sql="SELECT * FROM employee_info  WHERE emp_code='".$ms_data->emp_code."'";
$emp_data = find_all_field_sql($conn,$emp_sql);


		$sql = "select id, designation from designation where 1 group by id";
		 $query = mysqli_query($conn,$sql);
		 while($info=mysqli_fetch_object($query)){
  		 $designation[$info->id]=$info->designation;
		}
		
		$sql = "select id, department from department where 1 group by id";
		 $query = mysqli_query($conn,$sql);
		 while($info=mysqli_fetch_object($query)){
  		 $department[$info->id]=$info->department;
		}
		
		$sql = "select month_id, month_name from month where 1 group by month_id";
		 $query = mysqli_query($conn,$sql);
		 while($info=mysqli_fetch_object($query)){
  		 $month_name[$info->month_id]=$info->month_name;
		}

$page_title="Payslip";

?>



<!DOCTYPE html>
<html lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title><?php echo $page_title?></title>


<link href="../../logo/favicon.png" rel="icon">

 <link href="https://fonts.gstatic.com" rel="preconnect">
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Nunito:300,300i,400,400i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet">
 

  <!-- Vendor CSS Files -->

  <!-- Template Main CSS File -->
 
  
   
<style type="text/css">

<!--

.header table tr td table tr td table tr td table tr td {

	color: #000;

}

@font-face {

  font-family: 'MYRIADPRO-REGULAR';

  src: url('MYRIADPRO-REGULAR.OTF'); /* IE9 Compat Modes */



}



@font-face {

  font-family: 'TradeGothicLTStd-Extended';

  src: url('TradeGothicLTStd-Extended.otf'); /* IE9 Compat Modes */



}





@font-face {

  font-family: 'Humaira demo';

  src: url('Humaira demo.otf'); /* IE9 Compat Modes */



}



@media print {

  .brack {page-break-after: always;}

}





</style>

</head>

<body style="font-family:Tahoma, Geneva, sans-serif; font-size: 10px;">



<div class="page_brack" >



<table width="900" border="0" cellspacing="0" cellpadding="0" align="center">

  <tbody>

  <tr>

    <td><div class="header">

        <table width="100%" border="0" cellspacing="0" cellpadding="0">

          <tr>

            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">

                <tr>

                  <td><table width="100%" border="0" cellspacing="0" cellpadding="0">

                      <tr>

                        <td width="15%">

                       <!-- <img src="../../../logo/logo.png" width="100%" />-->

                        <td width="60%"><table  width="100%" border="0" align="center" cellpadding="3" cellspacing="0">

                            <tr>

                              <td style="text-align:center; color:#000; font-size:14px; font-weight:bold;">
<p style="font-size:18px; color:#000000; margin:0; padding: 0 0 5px 0; text-transform:uppercase;  font-weight:700; font-family: 'TradeGothicLTStd-Extended';"><?php echo $grp_data->group_name?></p>
<p style="font-size:14px; font-weight:300; color:#000000; margin:0; padding:0;"><?php echo $grp_data->address?></p>

								<p style="font-size:12px; font-weight:300; color:#000000; margin:0; padding:10px;">Contact No: <?php echo $grp_data->contact_no?>,  Email:  <?php echo $grp_data->email?></p>                              </td>

                            </tr>

                            <tr>





        <!--<td bgcolor="#666666" style="text-align:center; color:#FFF; font-size:18px; font-weight:bold;">WORK ORDER </td>-->

      </tr>

                          </table>

                        <td width="20%"> 

						

					<table width="100%" border="0" cellspacing="0" cellpadding="0">

					

					<tr>
					  <td align="center">&nbsp;</td>
					  </tr>
					<tr>

					  

					  <td align="center"><h4 style="font-size:14px;">Employee's Copy</h4></td>
					  </tr>

                      

					  

					  <tr>

					  

					  <td>&nbsp;</td>
					  </tr>

					  

					  <tr>

					  

					  <td>&nbsp;</td>
					  </tr>
					  </table>						</td>

                      </tr>

                    </table></td>

                </tr>

              </table></td>

          </tr>

          <tr>          </tr>

        </table>

      </div></td>

  </tr>

  



 

 

 

 

 

 



 

  <tr> <td><hr /></td></tr>

 

  

  

  <tr> <td>

  <table width="100%" border="0" cellspacing="0" cellpadding="0"  style="font-size:12px">

  

  	<tr height="30">

  	  <td width="25%" valign="top"></td>

  	  <td width="50%"  style="text-align:center; color:#FFF; font-size:18px; padding:0px 0px 10px 0px; color:#000000; font-weight:bold; font-weight:700; font-family: 'TradeGothicLTStd-Extended';"><span style="text-decoration:underline; text-transform:uppercase;"><?php echo $page_title;?></span> </td>

  	  <td width="25%" align="right" valign="right">&nbsp;</td>

	  </tr>

  </table>

  

  </td></tr>

  

  

  <tr> <td>&nbsp;</td></tr>

  

  

  

 <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0">





		  <tr>





		    <td width="100%" valign="top">





		      <table width="100%" border="0" cellspacing="0" cellpadding="3"  style="font-size:14px;">

		        <tr>

		          <td width="13%"  style="font-size:14px;">EMP Name</td>

	              <td width="37%"><span style="font-size:14px; text-transform:uppercase;">: &nbsp;<?php echo $emp_data->emp_name?></span></td>
	              <td width="13%">Department</td>

	              <td width="37%">: &nbsp;<?php echo $department[$ms_data->department];?></td>
		        </tr>

		        <tr>

		          <td><span style="font-size:14px;">EMP Code </span></td>

	              <td><span style="font-size:14px;">: &nbsp;<?php echo $emp_data->emp_code?></span></td>
	              <td>Designation</td>

	              <td>: &nbsp;<?php echo $designation[$ms_data->designation];?></td>
		        </tr>
		        <tr>
		          <td><span style="font-size:14px;">Joining Date</span></td>
		          <td><span style="font-size:14px;">: &nbsp;<?php echo date('d-M-Y',strtotime($emp_data->emp_doj));?></span></td>
		          <td>Pay Period</td>
		          <td>: &nbsp;<?php echo $month_name[$ms_data->mon];?>, <?php echo $ms_data->year;?></td>
		          </tr>

		        <tr>

		          <td><span style="font-size:14px;">Mobile No</span></td>

	              <td><span style="font-size:14px;">: &nbsp;<?php echo $emp_data->mobile_no?></span></td>
	              <td>Email</td>

	              <td>: &nbsp;<?php echo $emp_data->email?></td>
		        </tr>
		        <tr>
		          <td>&nbsp;</td>
		          <td>&nbsp;</td>
		          <td>&nbsp;</td>
		          <td>&nbsp;</td>
		          </tr>
		        <tr>
		          <td colspan="4">
				  	<table  width="100%" border="1" bordercolor="#CCCCCC" cellspacing="0" cellpadding="5"  style="font-size:12px">
						<tr>
						  <td width="12%"><strong>Total Day </strong></td>
						  <td width="11%"><strong>Holidays</strong></td>
						  <td width="11%"><strong>Working Days</strong></td>
						  <td width="11%"><strong>Leave</strong></td>
						  <td width="11%"><strong>LWP</strong></td>
						  <td width="11%"><strong>Absence</strong></td>
						  <td width="11%"><strong>Attend</strong></td>
						  <td width="11%"><strong>Late</strong></td>
						  <td width="11%"><strong>Overtime</strong></td>
					    </tr>
						<tr>
					        <td><?php echo $ms_data->td;?></td>
							<td><?php echo $ms_data->hd;?></td>
							<td><?php echo $ms_data->wd;?></td>
							<td><?php echo $ms_data->lv;?></td>
							<td><?php echo $ms_data->lwp;?></td>
							<td><?php echo $ms_data->ab;?></td>
							<td><?php echo $ms_data->att;?></td>
							<td><?php echo $ms_data->lt;?></td>
							<td><?php echo $ms_data->ot;?></td>
						</tr>
					</table>				  </td>
		          </tr>
		        </table>		      </td>

		  </tr>





		</table>		</td></tr>

  

  

 

  <tr>

    <td>

      

      <table  width="100%" border="1" bordercolor="#CCCCCC" cellspacing="0" cellpadding="5"  style="font-size:12px">
                <thead>
                  <tr style="text-transform:uppercase;">
                    <th width="35%" scope="col">Earnings</th>
                    <th width="15%" scope="col">Amount</th>
                    <th width="35%" scope="col">Deductions</th>
                    <th width="15%" scope="col">Amount</th>
                  </tr>
                </thead>
                <tbody>
					
				
                  <tr>
                    <td>&nbsp;Basic Salary </td>
                    <td align="right"><?php echo number_format($ms_data->basic_salary,2);?>&nbsp;</td>
                    <td>&nbsp;Provident Fund </td>
                    <td align="right"><?php echo number_format($ms_data->pf_amt,2);?>&nbsp;</td>
                  </tr>
				  <tr>
                    <td>&nbsp;House Rent  </td>
                    <td align="right"><?php echo number_format($ms_data->house_rent,2);?>&nbsp;</td>
                    <td>&nbsp;Advance Deduction </td>
                    <td align="right"><?php echo number_format($ms_data->advance_deduction,2);?>&nbsp;</td>
                  </tr>
				  <tr>
                    <td>&nbsp;Conveyance </td>
                    <td align="right"><?php echo number_format($ms_data->conveyance,2);?>&nbsp;</td>
                    <td>&nbsp;Absence Deduction &nbsp; <?php if($ms_data->ab_deduction>0) {?><strong>(<?php echo $ms_data->ab+$ms_data->lwp;?>X<?php echo number_format($ms_data->day_salary,2);?>)</strong><?php }?></td>
                    <td align="right"><?php echo number_format($ms_data->ab_deduction,2);?>&nbsp;</td>
                  </tr>
				  <tr>
                    <td>&nbsp;Medical </td>
                    <td align="right"><?php echo number_format($ms_data->medical,2);?>&nbsp;</td>
                    <td>&nbsp;Late Deduction </td>
                    <td align="right"><?php echo number_format($ms_data->lt_deduction,2);?>&nbsp;</td>
                  </tr>
				  <tr>
                    <td>&nbsp;Others </td>
                    <td align="right"><?php echo number_format($ms_data->others,2);?>&nbsp;</td>
                    <td>&nbsp;TDS </td>
                    <td align="right"><?php echo number_format($ms_data->tds_amt,2);?>&nbsp;</td>
                  </tr>
				  <tr>
                    <td><strong>&nbsp;Gross Salary </strong></td>
                    <td align="right"><strong><?php echo number_format($ms_data->gross_salary,2);?>&nbsp;</strong></td>
                    <td>&nbsp;Other Deduction </td>
                    <td align="right"><?php echo number_format($ms_data->deduction,2);?>&nbsp;</td>
                  </tr>
				  <tr>
				    <td>&nbsp;Overtime Wages &nbsp;
                        <?php if($ms_data->ot_wages>0) {?>
				      <strong>(<?php echo $ms_data->ot;?>X<?php echo number_format($ms_data->day_salary,2);?>)</strong>
				      <?php }?></td>
				    <td align="right"><?php echo number_format($ms_data->ot_wages,2);?>&nbsp;</td>
                    <td>&nbsp; </td>
                    <td align="right">&nbsp;</td>
                  </tr>
				  <tr>
                    <td>&nbsp;Benefits </td>
                    <td align="right"><?php echo number_format($ms_data->benefits,2);?>&nbsp;</td>
                    <td>&nbsp; </td>
                    <td align="right">&nbsp;</td>
                  </tr>
				  
				   
                  <tr style="text-transform:uppercase;">
                    <td align="right"><strong>TOTAL Earnings</strong></td>
                    <td align="right"><strong><?php echo number_format($ms_data->total_earnings,2);?></strong>&nbsp;</td>
                    <td align="right"><strong>TOTAL Deductions</strong></td>
                    <td align="right"><strong><?php echo number_format($ms_data->total_deduction,2);?></strong>&nbsp;</td>
                  </tr>
				  <tr style="text-transform:uppercase;">
                    <td align="right">&nbsp;</td>
                    <td align="right">&nbsp;</td>
                    <td align="right"><strong>Net Pay </strong></td>
                    <td align="right"><strong><?php echo number_format($ms_data->net_salary,2);?></strong>&nbsp;</td>
                  </tr>
				  <?php if($addi_data->additional_amt>0){?>
				  <tr style="text-transform:uppercase;">
                    <td align="right">&nbsp;</td>
                    <td align="right">&nbsp;</td>
                    <td align="right"><strong>Additional Pay</strong></td>
                    <td align="right"><strong><?php echo number_format($addi_data->additional_amt,2);?></strong>&nbsp;</td>
                  </tr>
				  <?php }?>
                </tbody>
              </table> 
			  
			 
			  
			  
			  
        </td>

  </tr>

  

  

  

  

  <tr>

  

  	<td>&nbsp;</td>

  </tr>

  



  

  

  

	

	

	



	<tr>

		<td>

	

	

	<!-- style="border:1px solid #000; color: #000;"-->

	      <div class="footer"> 

	

	<table width="100%" cellspacing="0" cellpadding="0"  >

	


		<tr>

		  <td align="center"  width="34%">&nbsp;</td>

		  <td align="center"  width="33%">&nbsp;</td>

		  <td align="center" width="33%">&nbsp;</td>
		  </tr>

		<tr>

		  <td align="center" >&nbsp;</td>

		  <td align="center">&nbsp;</td>

		  <td align="center">&nbsp;</td>
		  </tr>
		  
		  
		  <tr>

		  <td align="center" >&nbsp;</td>

		  <td align="center">&nbsp;</td>

		  <td align="center">&nbsp;</td>
		  </tr>

		<tr>

		  <td align="center" >&nbsp;</td>

		  <td align="center">&nbsp;</td>

		  <td align="center">&nbsp;</td>
		  </tr>

		<tr>

		  <td align="center" >&nbsp;</td>

		  <td align="center">&nbsp;</td>

		  <td align="center">&nbsp;</td>
		  </tr>
		  
		  
		  <tr>

		  <td align="center" >&nbsp;</td>

		  <td align="center">&nbsp;</td>

		  <td align="center">&nbsp;</td>
		  </tr>

		<tr>

		  <td align="center" >&nbsp;</td>

		  <td align="center">&nbsp;</td>

		  <td align="center">&nbsp;</td>
		  </tr>

		<tr>

		  <td align="center" >&nbsp;</td>

		  <td align="center">&nbsp;</td>

		  <td align="center">&nbsp;</td>
		  </tr>
		  
		  
		  <tr>

		  <td align="center" >&nbsp;</td>

		  <td align="center">&nbsp;</td>

		  <td align="center">&nbsp;</td>
		  </tr>

		<tr>

		  <td align="center" >&nbsp;</td>

		  <td align="center">&nbsp;</td>

		  <td align="center">&nbsp;</td>
		  </tr>

		<tr style="font-size:12px">

		  <td align="center" ><?php echo find_a_field($conn,'user_management','fname','user_id="'.$ms_data->entry_by.'"');?></td>

		  <td align="center">&nbsp;</td>

		  <td align="center">&nbsp;</td>
		  </tr>
		  
		  

		   <tr>

		  <td align="center" ></td>

		  <td align="center">		  </td>

		  <td align="center"> </td>
		  </tr>

		<tr>

		  <td align="center" >---------------------------------</td>

		  <td align="center">---------------------------------</td>

		  <td align="center">---------------------------------</td>
		  </tr>

		<tr>

		  <td align="center"></td>

		  <td align="center"></td>

		  <td align="center"></td>
		  </tr>

		<tr style="font-size:12px">

            <td align="center" width="34%"><strong>Prepared By</strong></td>

			 <td  align="center" width="33%"><strong>Employer's Signature</strong></td>


		    <td  align="center" width="33%"><strong>Employee's Signature</strong></td>
		    </tr>

		<tr style="font-size:12px">

		  <td align="center">&nbsp;</td>

		  <td  align="center">&nbsp;</td>

		  <td  align="center">&nbsp;</td>
		  </tr>

		

		

		<tr>

            <td colspan="2" style="font-size:12px">This is an ERP generated payslip </td>

		    <td>&nbsp;</td>
		    </tr>

			

	

			<tr>

            <td colspan="3">&nbsp;  </td>
		</tr>

			

				<tr>

            <td colspan="3">&nbsp;  </td>
		</tr>
	</table>

	

<!--	<tr>

	  <td>&nbsp;</td>

	  </tr>

	<tr>

	  <td>&nbsp;</td>

	  </tr>

	<tr>-->

	  <td>&nbsp;</td>

	  </tr>

	<tr>

	  <td>&nbsp;</td>

	  </tr>

  </tbody>

</table>

</div>







</body>

</html>

