<?php include('parent/callMe.php');?>
<?php include('Sessioncheck.php');?>

<?php   
 
    $m->where("branch_id", $_SESSION['branch']);
    $m->where("session_id",$_GET['session']);
    $m->where("user_id", $_GET['user_id']);
    $m->where("month_id", $_GET['month']);
    $employeeSlip=$m->get("employee_payroll");

         
     $m->where("status", '0');
     $m->where("branch_id", $_SESSION['branch']);
     $m->where("user_id", $_GET['user_id']);
     $employeedata = $m->get("edu_user_config");

     $m->where("Month_Id", $_GET['month']);
     $month = $m->get("eduportal_month_config");

    $m->where("designation_id", $employeedata['0']['designation_id']);
    $designation=$m->get("eduportal_designation_config");

    $total_deduction= ($employeeSlip[0]['income_tax']+$employeeSlip[0]['provident_fund']+$employeeSlip[0]['personal_loan']+$employeeSlip[0]['other_deductions']+$employeeSlip[0]['leave_deduction']);
    $total_allowances= ($employeeSlip[0]['travelling_allowance']+$employeeSlip[0]['leave_encashment']+$employeeSlip[0]['incentive_commission']+$employeeSlip[0]['reimbursement']+$employeeSlip[0]['other_allowances']);

    $netPayble=($employeeSlip[0]['basic_salary']+$employeeSlip[0]['paid_again_amount'] + $total_allowances + $employeeSlip[0]['previous_balance']) - ($total_deduction);


// getting branch details

$m->where("branch_id", $_SESSION['branch']);
$branch=$m->get("edu_branch_config");

?>
 <!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Favicons-->
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />
<title>Employee Salary Slip</title>
<!-- Favicons-->
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />

<script type="text/javascript">
 //window.print();
</script>
<style> 
.section{width:45%; height:auto;float:left;padding-right:2%;margin-left:2%;margin-top:2%;}
     
tr th {background-color:gray; text-align:center;font-size:14px;border:1px solid black;padding:.8%;}
tr td {border-bottom:1px solid black;border-left:1px solid black;padding:.8%;}

@media print {
    #Header, #Footer { display: none !important; }
}
@media screen
   {
      p.bodyText {font-family:verdana, arial, sans-serif;}
   }

   @media print
   {
      p.bodyText {font-family:georgia, times, serif;}
   }
   @media screen, print
   {
      p.bodyText {font-size:10pt}
   }
   @media print {
  a[href]:after {
    content: none !important;
  }
}
</style>
</head>
<body>
<?php

 $array1=array("Institute Copy","Staff Copy");

 for($i=0; $i<2;$i++){ ?>

 <!-- Vouchere Fist -->
<div class="section" style="<?php if($i<1){echo 'border-right: 2px solid black;border-right-style:dotted;';}?>">
   
   <div style="width:100%; text-align:center; height:auto;font-size:12px;">
            <?php echo $array1[$i]; ?>

   </div>
   
     




   <div style="width:20%;font-size:13px;text-align:center;float:left;height:80px;">

          <?php if($brid[0]['logo']!=NULL){ ?>

         <img src="<?php echo DOMAIN.AgentDirectory;?>img/<?php echo $brid[0]['logo'];?>" style="height:80px;width:80px;" />

         <?php } else { ?>   

           <img src="http://cdn.onlinewebfonts.com/svg/img_234957.png" id="preview" style="height:80px;width:80px;" class="img-thumbnail" />


       <?php } ?>

      </div>


   <div style="width:60%; float:left;text-align:center;">

         <span style="font-size:20px; font-weight:bold;">  <?php echo $branch[0]['Branch_Name'];?> </span>

         <br>


         <span style="font-size:14px; text-align:center;">  <?php echo $branch[0]['Branch_Location'];?> </span>

      </div>


   <div style="width:20%;font-size:15px;text-align:center;float:right;height:80px;">

          <?php if($employeedata[0]['attach_image']!=NULL){ ?>
      
      <img src="<?php echo DOMAIN;?>Production/staff_pics/<?php echo $employeedata[0]['attach_image'];?>" id="preview" class="img-thumbnail" style="width:80px;height:80px;"   />

       <?php } else { ?>   

           <img src="https://image.flaticon.com/icons/png/512/67/67902.png" id="preview" height="80px" class="img-thumbnail" width="80px"  />


       <?php } ?> 
       
      </div>



<div style="font-size:20px; text-align:center;margin-top:10%;">  

   <strong> <u> Employee Salary Slip of (<?php echo $month[0]['Month_Name'];?>) </u>  </strong> </div>

   <br>

<table width="100%" border="1" cellspacing="0">  
   
   
      <tr>  
         <td width="15%" style="text-align:left;"> Name:-   </td>
         <td width="35%" style="text-align:center;">  <?php echo $employeedata[0]['user_fname'];?></td>
         <td width="20%" style="text-align:left;"> Father/Husband  Name:-   </td>
         <td width="30%" style="text-align:center;"><?php echo $employeedata[0]['user_lname'];?></td>

      </tr>
   
      <tr>  
         <td width="15%" style="text-align:left;"> Designation:-   </td>
         <td width="35%" style="text-align:center;"> 
         <?php echo $designation[0]['designation_name'];?> </td>

         <td width="15%" style="text-align:left;"> Employee Id:-   </td>
         <td width="35%" style="text-align:center;"><?php echo $employeedata[0]['user_id'];?> </td>


      </tr>
      
   
   </table>

   <br>      
   <?php if ($employeedata[0]['account_no']!="") { ?>
      
      <div style="width:100%; font-size:12px;text-align:left; height:25px; float:left;">

        <b> Account Title: <?php echo $employeedata[0]['account_holder'];?></b> 
      </div>

      <div style="width:100%; font-size:12px;text-align:left; height:25px; float:left;">

            <b>Bank: (<?php echo $employeedata[0]['bank_name'];?>) 
             <?php echo $employeedata[0]['account_no'];?> </b>
      </div>

   <?php } ?>


  <div style="<!-- background: linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,.5)), url(<?php echo DOMAIN;?>AgentPanel/img/<?php echo $branch[0]['logo']; ?>);background-size:100%; -->">

   <table width="100%" style="font-size:16px;" cellspacing="0" border="1">  
   
   
         <tr>  
                   
            <th width="50%" colspan="2" class="tdalign"> Allownces </th>

            <th width="50%" colspan="2" class="tdalign"> Deductions </th>
                                
         </tr>

         <tr>  
                   
            <td width="50" colspan="" class="tdalign"> Traveling Allowance </td>
            <td width="50" colspan="" class="tdalign"> <?php echo $employeeSlip[0]['travelling_allowance']; ?> </td>

            <td width=""  class="tdalign"> Income Tax </td>
            <td width=""  class="tdalign"> <?php echo $employeeSlip[0]['income_tax']; ?> </td>
                                
         </tr>
         <tr>  
                   
            <td width="" colspan="" class="tdalign"> Leave Allowance </td>
            <td width="" colspan="" class="tdalign"> <?php echo $employeeSlip[0]['leave_encashment']; ?> </td>
            <td width=""  class="tdalign"> Security </td>
            <td width=""  class="tdalign"> <?php echo $employeeSlip[0]['security_deductions']; ?> </td>
                                
         </tr>
         <tr>  
                   
            <td width="" colspan="" class="tdalign"> Incentive Allowance </td>
            <td width="" colspan="" class="tdalign"> <?php echo $employeeSlip[0]['incentive_commission']; ?> </td>
            <td width=""  class="tdalign"> Advance Salary </td>
            <td width=""  class="tdalign"> <?php echo $employeeSlip[0]['advance_deductions']; ?> </td>
                                
         </tr>
         <tr>  
                   
            <td width="" colspan="" class="tdalign"> Reimbursement Allowance </td>
            <td width="" colspan="" class="tdalign"> <?php echo $employeeSlip[0]['reimbursement']; ?> </td>
            <td width=""  class="tdalign"> Leave Deduction </td>
            <td width=""  class="tdalign"> <?php echo $employeeSlip[0]['leave_deduction']; ?> </td>
                                
         </tr>

         <tr>  
                   
            <td width="" colspan="" class="tdalign"> Other Allowance </td>
            <td width="" colspan="" class="tdalign"> <?php echo $employeeSlip[0]['other_allowances']; ?> </td>
            <td width=""  class="tdalign"> Other Deduction </td>
            <td width=""  class="tdalign"> <?php echo $employeeSlip[0]['other_deductions']; ?> </td>
                                
         </tr>


          <tr>  
                   
            <td width="" style="background-color: lightgray;" colspan="" class="tdalign"> Total </td>
            <td width="" style="background-color: lightgray;"colspan="" class="tdalign"> <?php echo $employeeSlip[0]['travelling_allowance']+$employeeSlip[0]['leave_encashment']+$employeeSlip[0]['incentive_commission']+$employeeSlip[0]['reimbursement']+$employeeSlip[0]['other_allowances'];  ?> </td>


            <td width="" style="background-color: lightgray;" class="tdalign"> Total </td>
            <td width="" style="background-color: lightgray;" class="tdalign"> <?php echo $employeeSlip[0]['income_tax']+$employeeSlip[0]['advance_deductions']+$employeeSlip[0]['security_deductions']+$employeeSlip[0]['leave_deduction']+$employeeSlip[0]['other_deductions']; ?> </td>
                                
         </tr>
         <tr>

            <td width="" colspan="3" class="tdalign"> Basic Salary </td>
            <td width="" colspan="" class="tdalign"> <?php echo number_format($employeeSlip[0]['basic_salary']); ?> </td>
         </tr>

         <tr>

            <td width="" colspan="3" class="tdalign"> Advance Salary </td>
            <td width="" colspan="" class="tdalign"> <?php echo number_format($employeeSlip[0]['paid_again_amount']); ?> </td>
         </tr>

         
          <tr>

            <td width="" colspan="3" class="tdalign"> Previous Balance </td>
            <td width="" colspan="" class="tdalign"> <?php echo $employeeSlip[0]['previous_balance']; ?> </td>
         </tr>

         <tr style="background-color: lightgray; font-size: 16px;font-weight: bold;">  
                   
            <td width="" colspan="3" class="tdalign"> Net Salary </td>
            <td width="" colspan="" class="tdalign"> <?php echo number_format($netPayble-$employeeSlip[0]['security_deductions']-$employeeSlip[0]['advance_deductions']); ?> </td>            
                                
         </tr>

         <tr style="background-color: lightgray; font-size: 16px;font-weight: bold;">  
                   
            <td width="" colspan="3" class="tdalign"> Paid Salary <?php if ($employeeSlip[0]['paid_date']!=NULL) {?>
              (Dated: <?php echo date("d-M-Y",strtotime($employeeSlip[0]['paid_date']));?>) <?php } ?>  </td>
            <td width="" colspan="" class="tdalign"> <?php echo number_format($employeeSlip[0]['paid_amount']+$employeeSlip[0]['paid_again_amount']+$employeeSlip[0]['paid_again_salary_amount']); ?> </td>
            
                                
         </tr>

         <tr style="background-color: lightgray; font-size: 16px;font-weight: bold;">  
                   
            <td width="" colspan="3" class="tdalign"> Remaning Salary </td>
            <td width="" colspan="" class="tdalign"> <?php echo number_format($netPayble-$employeeSlip[0]['security_deductions']-$employeeSlip[0]['advance_deductions']-$employeeSlip[0]['paid_amount']-$employeeSlip[0]['paid_again_salary_amount']); ?> </td>
            
                                
         </tr>
         <tr></tr>
       
   </table>
        <br><br><br>
      <tr>
      <td>  Employee Signature:  ___________<td>
      <td>  Director/Principal Signature:  ___________<td>
      </tr>
      <br><br>

    </div>



   

</div>


</div>


<?php } ?>

</body>
</html>
