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

$sessionid;
$PaidDateSession;
    
    if($_GET["session"]!=NULL ){
      $sessionid= $_GET["session"];
      $PaidDateSession= $yr[0];
    }
    else{
      $sessionid= $_SESSION['current_session'];
      $PaidDateSession= date("Y");
    }
  
// getting branch details

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

$m->where("session_id", $_SESSION['current_session']);
$session=$m->get("edu_session_config");

if($_REQUEST['month']!=NULL){
$m->where("Month_Id", $_REQUEST['month']);
}else{
$m->where("Month_Id", date("m"));
}

$month=$m->get("eduportal_month_config");

?>


<?php   
  
 $branch=$_SESSION['branch'];
 

  if (!isset($_REQUEST['designation']) ) {
    
// $m->where("status", '0');
 $m->where("branch_id", $_SESSION['branch']);
 $m->orderBy("user_id", 'desc');
 $WorkAssignListings = $m->get("edu_user_config");

  } elseif ($_REQUEST['designation']=='All') {

 //$m->where("status", '0');
 $m->where("branch_id", $_SESSION['branch']);
 $m->orderBy("user_id", 'desc');
 $WorkAssignListings = $m->get("edu_user_config");

 
} else {

 //$m->where("status", '0');
 $m->where("branch_id", $_SESSION['branch']);
 //$m->where("designation_id!=14");
 $m->where("designation_id", $_REQUEST['designation']);
 $m->orderBy("user_id", 'desc');
 $WorkAssignListings = $m->get("edu_user_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">
<title>Print Salary Receipt</title>
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />
<script type="text/javascript">
// window.print();
</script>
<style type="text/css">

tr th {border-left:1px solid black;border-top:1px solid black;font-size:14px;}
tr td {border-bottom:1px solid black;border-left:1px solid black;font-size:16px;}
  
.border{border:1px solid black;}

.alignment{padding-left:1%;text-align:left;}

.borderbottom{
  border-bottom:1px solid black;
}



@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;
  }
}
.center{text-align:center;}
</style>
</head>

<body style="font-size:12px;padding-right:1%;padding-left:1%;padding-top:3%;padding-bottom:1%;">
<div style="text-align:center;font-size:24px;font-weight:bold;margin:0 auto;"><?php echo $branch1[0]['Branch_Name'];?> 
</div>

<br>

<div style="text-align:center;font-size:18px;font-weight:bold;"> EMPLOYEE SALARY SHEET

 </div>

<hr style="width:100%;">



<div style="width:33%; float:left;font-size:18px; margin-left:10px; "> <b> Month:</b> <?php echo $month[0]['Month_Name'];?> </div>

<div style="text-align:center;width:33%;float:right;font-size:18px;"> <b> Session:</b> <?php echo $session[0]['session_year']; ?> </div>

<br>
   


    <form class="form-style-7" action="" method="get"  onSubmit="return student_check();"  enctype="multipart/form-data">


  
  
  <input type="hidden"  name="branch" value="<?php echo $_SESSION['branch']; ?>" />
  <input type="hidden" id="session"  name="session" value="<?php echo $_GET['session']; ?>" />
  <input type="hidden"  name="month" value="<?php echo $_GET['month']; ?>" />

    <table id="" data-page-length='100' class="table table-striped table-bordered" style="width:100%;font-size:11px;">
          
          <thead>
          
            <tr>
              <th colspan="6" style="font-size:18px;"><center>Emp Detail</center></th>
              
                
                <th colspan="5" style="font-size:18px;"><center>Deductions</center></th>
                <th colspan="3" style="font-size:18px;"><center>Allowances</center></th>
                <th colspan="2" style="border-right:1px solid black;"</th>
                                
            </tr>

            <tr>
                <th width="" class="borderbottom">SR</th>
                <th width="" class="borderbottom">Emp..  Name</th>
                <th width="" class="borderbottom">Designation</th>
                <th width="" class="borderbottom">P.Bal</th>
                <th width="" class="borderbottom" style="padding-left:1px;width: 56px;">Advance</th>
                <th width="" class="borderbottom">Basic Sal..</th>
                <th width="" class="borderbottom">Advance</th>
                <th width="" class="borderbottom">Security</th>
               <!--  <th width="" class="borderbottom">Income Tax.. </th>
                <th width="" class="borderbottom">Provi.. Fund</th>                
                <th width="" class="borderbottom">Pers.. Loan</th> -->
                <th width="" class="borderbottom">Other Deduc..</th>
                <th width="" class="borderbottom">Leave Deduc..</th>
                <th width="" class="borderbottom">Total Deduc..</th>
               <!--  <th width="" class="borderbottom">Trav.. Allow</th> -->
                <th width="" class="borderbottom">Leave Encash..</th>
               <!--  <th width="" class="borderbottom">Incentive</th>
                <th width="" class="borderbottom">Reimbersement</th> -->
                <th width="" class="borderbottom">Other Allow..</th>
                <th width="" class="borderbottom">Total Allow..</th>
                <th width="" class="borderbottom">Net Total</th>
                <th width="" class="borderbottom" style="border-right:1px solid black;">Signatures</th>

            </tr>
        </thead>
        <tbody>
     
     <?php
     
     $count=1; 

      foreach($WorkAssignListings as $WorkAssignListVal)
      { 

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

        $m->where("branch_id", $_SESSION['branch']);
        $m->where("session_id",$sessionid);
        $m->where("user_id", $WorkAssignListVal['user_id']);
        $m->where("month_id", $_GET['month']);
        $payrolldata=$m->get("employee_payroll");


        if ($payrolldata[0]['user_id']=="") {
          
          continue;
        }

      ?>


<tr>
        
  <td style="text-align:center; padding: 2px;"><?php echo $count++;?></td>

  <td style="padding-left:1px;" >
    
   <?php echo $WorkAssignListVal['user_fname']." ". $WorkAssignListVal['user_lname'];?>
    <input name="emppayrol[]" id="emppayrol[]" type="hidden" value="">
            
                     
  </td>

      
      
      <td style="padding-left:1px;"> <?php echo $designation[0]['designation_name'];?> </td>
      <td> <?php echo $payrolldata[0]['previous_balance'];?></td>
      <td> <?php echo $payrolldata[0]['paid_again_amount'];?></td>     
      <td> <?php echo $payrolldata[0]['basic_salary'];?> </td>
      <td> <?php echo $payrolldata[0]['advance_deductions'];?> </td>
      <td> <?php echo $payrolldata[0]['security_deductions'];?> </td>
      <!-- <td> <?php echo $payrolldata[0]['income_tax'];?></td>
      <td> <?php echo $payrolldata[0]['provident_fund'];?></td>
      <td> <?php echo $payrolldata[0]['personal_loan'];?></td> -->
      <td> <?php echo $payrolldata[0]['other_deductions'];?></td>
      <td> <?php echo $payrolldata[0]['leave_deduction'];?></td>
      <td> <?php echo $payrolldata[0]['security_deductions']+$payrolldata[0]['other_deductions']+$payrolldata[0]['leave_deduction']+$payrolldata[0]['advance_deductions'];?></td>

     
      <td> <?php echo $payrolldata[0]['leave_encashment'];?></td>
   
      <td> <?php echo $payrolldata[0]['other_allowances'];?></td>

      <td> <?php echo $payrolldata[0]['leave_encashment']+$payrolldata[0]['other_allowances'];?></td>      
      
      <td> <?php echo $payrolldata[0]['basic_salary']-$payrolldata[0]['advance_deductions']-$payrolldata[0]['security_deductions']-$payrolldata[0]['provident_fund']-$payrolldata[0]['personal_loan']-$payrolldata[0]['other_deductions']-$payrolldata[0]['leave_deduction']+$payrolldata[0]['travelling_allowance']+$payrolldata[0]['leave_encashment']+$payrolldata[0]['incentive_commission']+$payrolldata[0]['reimbursement']+$payrolldata[0]['other_allowances']+$payrolldata[0]['previous_balance'];?></td>

      <td style=""></td>

      <td>
      

      <div style="float:left;">
        
        

      </div>


      </td>
</tr>


              <?php
      } ?>



           
            
           
        </tbody>
        
    </table>

</form>

    

</body>
</html>
