<?php include 'inc_classes.php'; ?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Print Salary</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  
</head>
<body onload="window.print();"> <!--onload="window.print();"-->
<!-- Bootstrap 3.3.7 -->
  <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="bower_components/Ionicons/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/AdminLTE.min.css">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

  <!-- Google Font -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
<style>
.table > tbody > tr > td
{
	padding:2px !important;
}
.table1, .th1, .td1 {
    border: 1px solid black !important;
    border-collapse: collapse;
	border-right:1px solid black !important;
    /*padding: 4px;
	font-size:12px;*/
}
.td2 {
   text-align:center;
   /*border-right:1px solid black !important;
   border-collapse: collapse;*/
}

.table2 tr:first-child td {
  border-top: 0;
}
.table2 tr td:first-child {
  border-left: 0;
}
.table2 tr:last-child td {
  border-bottom: 0;
}
.table2 tr td:last-child {
  border-right: 1;
}

.table2 tr:first-child th {
  border-top: 0;
}
.table2 tr th:first-child {
  border-left: 0;
}
.table2 tr:last-child th {
  border-bottom: 0;
}
.table2 tr th:last-child {
  border-right: 0;
}
</style>
<div class="wrapper">
  <!-- Main content -->
  <?php 
	$month=$_REQUEST['m'];
	$year=$_REQUEST['y'];
	$emp_id=$_REQUEST['emp_id'];
	$cm_id=$_REQUEST['cm_id'];
	
	$monthName = date("F", mktime(0, 0, 0, $month, 10));
	
	$select_exc = "select * from pr_staff_salary_management where 1 and cm_id='".$cm_id."' AND month='".$month."' AND year='".$year."' AND employee_id='".$emp_id."' AND payment_action=1";
	$payment1 = mysql_query($select_exc);
	$payment = $db->fetch_array($db->query($select_exc));
	
	$select_staff = "select attendence_id,admin_id,name,company_name,contact_address,dob,joining_date,designation1,department from site_setting where admin_id='".$emp_id."' "; 
	$staff = $db->fetch_array($db->query($select_staff));
	
	if($staff['company_name']=='ISAS')
	{
		$address = "select * from branch where branch_name='".$payment['branch_name']."'"; 
		$add = $db->fetch_array($db->query($address));
		$address1=strip_tags($add['branch_address']);
		$company_name="ISAS Beauty School Pvt. Ltd.";
		$img='<img src="../faculty_login/images/logo.jpg" height="70" width="100"/>';
	}
	elseif($staff['company_name']=='Innocent')
	{
		$address = "select * from branch where branch_name='".$payment['branch_name']."'"; 
		$add = $db->fetch_array($db->query($address));
		$address1=strip_tags($add['innocent_address']);
		$company_name="Innocent Salon";
		$img='<img src="../faculty_login/images/innocent1.png" height="70" width="100"/>';
	}
	else
	if(trim($staff['company_name'])=='Frespa')
	{
		$address = "select * from branch where branch_name='".$payment['branch_name']."'"; 
		$add = $db->fetch_array($db->query($address));
		$address1=strip_tags($add['frespa_address']);
		$company_name="Frespa Consultancy";
		$img='<img src="../faculty_login/images/freshpa.png" height="70" width="100"/>';
	} 
	
	$rent = "select * from pr_add_salary_details where employee_id='".$emp_id."' "; 
	$rent_Detail = $db->fetch_array($db->query($rent));
	
	$leaves = "select * from pr_staff_leave_management where employee_id='".$emp_id."' AND month='".$month."' AND year='".$year."' order by staff_leave_id desc limit 0,1"; 
	$pre_leaves = $db->fetch_array($db->query($leaves));
	
	$staff_salary = "select * from pr_staff_salary_management where branch_name='".$payment['branch_name']."' AND employee_id='".$_REQUEST."' AND month='".$month."' AND year='".$year."'"; 
	$staff_sal = $db->fetch_array($db->query($staff_salary));
	
	$current_Month1 =date('Y').'-'.$month.'-01';
	$last_month=Date('m', strtotime('-1 month',strtotime($current_Month1)));
	$last_year=Date('Y', strtotime('-1 month',strtotime($current_Month1)));
	
	$leave_detail = "select * from pr_previous_leave_management where employee_id='".$emp_id."' AND month='".$last_month."' AND year='".$last_year."' order by previous_leave_id desc limit 0,1";     
	$leave = $db->fetch_array($db->query($leave_detail));
	$lev = mysql_query($leave_detail);
	$leav_count=mysql_num_rows($lev);
	$previous_balance_leaves=$leave['previous_balance_leaves'];
	
	?>
  <section class="invoice" style=" margin:0px !important">
      <!-- title row -->
      <div class="row">
        <div class="col-xs-2">
          <!--<h2 class="page-header">
            <i class="fa fa-globe"></i> AdminLTE, Inc.
            <small class="pull-right">Date: 2/10/2014</small>
          </h2>-->
          <?php //echo $img; ?>
        </div>
        <!--<div class="col-xs-10">
        	<h2 style="text-align:center; vertical-align:top; margin-top:5px !important">
            	<?php //echo $company_name; ?>
            </h2>
            <p>
            	<?php //echo $address1; ?>
            </p>
        </div>-->
        <!-- /.col -->
      </div>
      <!-- info row -->
      <!--<div class="box-header">
        <div class="box-title">
        	<?php //echo $address1; ?>
        </div>
      </div>-->
      <!-- /.row -->

      <!-- Table row -->
		<?php 
        if($_REQUEST['month']=='1'){ $month="January"; }
        if($_REQUEST['month']=='2'){ $month="February "; }
        if($_REQUEST['month']=='3'){ $month="March"; }
        if($_REQUEST['month']=='4'){ $month="April"; }
        if($_REQUEST['month']=='5'){ $month="May"; }
        if($_REQUEST['month']=='6'){ $month="June"; }
        if($_REQUEST['month']=='7'){ $month="July"; }
        if($_REQUEST['month']=='8'){ $month="Auguest"; }
        if($_REQUEST['month']=='9'){ $month="September"; }
        if($_REQUEST['month']=='10'){ $month="October"; }
        if($_REQUEST['month']=='11'){ $month="November"; }
        if($_REQUEST['month']=='12'){ $month="December"; }
        ?>
      <div class="row" id="printInv">
        <div class="col-xs-12 table-responsive">
          <table class="table table-striped table-bordered" style="margin-bottom:0px !important">
            <thead>
            <tr>
            	<th colspan="1" width="15%" class="td1 td2"><?php echo $img; ?>
                </th>
                <th colspan="2" width="85%" class="td1">
                    <h3 style="text-align:center; vertical-align:top; margin-top:5px !important">
                            <?php echo $company_name; ?>
                    </h3>
                    <p style="text-align:center; font-size:13px">
                        <?php echo $address1; ?>
                    </p>
                </th>
            </tr>
            </thead>
          </table>
          <table class="table table-striped table-bordered" style="margin-bottom:0px !important; border:1px solid black">
            <thead>
            <tr><th colspan="5" class="td1"><h4 style="text-align:center">PAYSLIP FOR THE MONTH OF <?php echo strtoupper($monthName).'  '.$year; ?>. </h4></th></tr>
            <!--<tr>
              <th>Qty</th>
              <th>Product</th>
              <th>Serial #</th>
              <th>Description</th>
              <th>Subtotal</th>
            </tr>-->
            </thead>
            <tbody >
            <tr>
                <td class="td1" width="50%">Emp Code: ISAS-EMP-APP-<?php echo $staff['attendence_id']; ?></td>
                <td class="td1" width="50%">Emp Name: <?php echo $staff['name']; ?></td>
            </tr>
            <tr>
                <td class="td1">Department: <?php echo $staff['department']; ?></td>
                <td class="td1">Designation: <?php echo $staff['designation1']; ?></td>
            </tr>
            <tr>
                <td class="td1">Location: <?php echo $staff['contact_address']; ?></td>
                <td class="td1 ">Employment Status: Confirmed</td>
            </tr>
            <tr>
                <td class="td1">Date Of Birth: <?php echo date('d-m-Y',strtotime($staff['dob'])); ?></td>
                <td class="td1 ">Salary Tenure: <?php echo "1-".$month."-".$year." To ".$payment['days_in_month']."-".$month."-".$year; ?></td>
            </tr>
            <tr>
                <td class="td1">Date of Joining: <?php echo $staff['joining_date']; ?></td>
                <td class="td1 ">PF No: <?php echo $rent_Detail['pf_number']; ?></td>
            </tr>
            <tr>
                <td class="td1">Pan No.:<?php echo $rent_Detail['pan_number']; ?></td>
                <td class="td1 "></td>
            </tr>
            </tbody>
          </table>
          <table class="table table-striped table-bordered" style="margin-bottom:0px !important">
            <thead>
            <!--<tr><th colspan="5" class="td1"><h4 style="text-align:center">PAYSLIP FOR THE MONTH OF <?php //echo strtoupper($monthName).'  '.$year; ?>. </h4></th></tr>-->
            <tr>
              <th class="th1" style="text-align:center">Total Working Days</th>
              <th class="th1" style="text-align:center">Present Days</th>
              <th class="th1" style="text-align:center">Extra Days</th>
              <th class="th1" style="text-align:center">LWP Days</th>
              <th class="th1" style="text-align:center">Balance Leaves</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td class="td1 td2"><?php echo $payment['days_in_month']; ?></td>
                <td class="td1 td2"><?php echo $pre_leaves['present_days']; ?></td>
                <td class="td1 td2"><?php echo $pre_leaves['extra_days']; ?></td>
                <td class="td1 td2"><?php echo $pre_leaves['leave_days']; ?></td>
                <td class="td1 td2"><?php echo $pre_leaves['final_leave_balance']; ?></td>
            </tr>
            <tr>
                <td class="td1 td2" colspan="3"><strong>CTC/Month</strong></td>
                <td class="td1 td2" colspan="2"><strong><?php echo $incentive+$payment['payable_salary'];?></strong></td>
            </tr>
            </tbody>
          </table>
          <table class="table table-striped table-bordered" style="border:1px solid black">
            <thead>
            <!--<tr><th colspan="5" class="td1"><h4 style="text-align:center">PAYSLIP FOR THE MONTH OF <?php //echo strtoupper($monthName).'  '.$year; ?>. </h4></th></tr>-->
            <tr>
              <th class="th1" style="text-align:center" width="30%">Earnings</th>
              <th class="th1" style="text-align:center" width="20%">Amount</th>
              <th class="th1" style="text-align:center" width="30%">Deductions</th>
              <th class="th1 td2" style="text-align:center" width="20%">Amount</th>
            </tr>
            </thead>
            <tbody >
            <tr>
                <td class="td1">Basic</td>
                <td class="td1 td2"><?php echo $rent_Detail['basic_salary']; ?></td>
                <td class="td1">Professional Tax</td>
                <td class="td1 td2"><?php echo $rent_Detail['proffessional_tax'];?></td>
            </tr>
            <tr>
                <td class="td1">House Rent Allowance</td>
                <td class="td1 td2"><?php echo $rent_Detail['house_rent_allowance'];?></td>
                <td class="td1">Income Tax (TDS)</td>
                <td class="td1 td2"><?php echo $rent_Detail['tds'];  ?></td>
            </tr>
            <tr>
                <td class="td1">Travelling Allowance</td>
                <td class="td1 td2"><?php echo $rent_Detail['travelling_allowance'];?></td>
                <td class="td1">Provident Fund</td>
                <td class="td1 td2"><?php echo $rent_Detail['pf'];  ?></td>
            </tr>
            <tr>
                <td class="td1">Medical Allowance</td>
                <td class="td1 td2"><?php echo $rent_Detail['medical_allowance'];?></td>
                <td class="td1">ESIC</td>
                <td class="td1 td2"><?php echo $rent_Detail['esic'];?></td>
            </tr>
            <tr>
                <td class="td1">Incentive</td>
                <td class="td1 td2"><?php echo $incentive=$staff_sal['incentive_on_service']+$staff_sal['incentive_on_product']+$staff_sal['event_incentive']+$staff_sal['course_incentive']+$staff_sal['other_incentive'];  ?></td>
                <td class="td1">Advance</td>
                <td class="td1 td2"><?php if($staff_sal['advance_deduction']!='')echo $staff_sal['advance_deduction']; else echo 0;?></td>
            </tr>

            <tr>
                <td class="td1">Special Allowance</td>
                <td class="td1 td2"><?php if($rent_Detail['specia_allowance1']!='')echo $rent_Detail['specia_allowance1'];else echo 0;?></td>
                <td class="td1">Fine / Deductions</td>
                <td class="td1 td2">0</td>
            </tr>
            <tr>
                <td class="td1">Company Allowance</td>
                <td class="td1 td2"><?php if($rent_Detail['specia_allowance2']!='') echo $rent_Detail['specia_allowance2'];else echo 0; ?></td>
                <td class="td1">Total Deductions</td>
                <td class="td1 td2"><?php echo $rent_Detail['proffessional_tax']+$rent_Detail['tds']+$staff_sal['advance_deduction']; ?></td>
            </tr>
            <tr>
                <td class="td1">Total Salary</td>
                <td class="td1 td2"><?php echo $incentive+$payment['payable_salary'];?></td>
            </tr>
            <tr>
                <td class="td1">Salary Adjustment</td>
                <td class="td1 td2"><?php if($staff_sal['adjustment']!='') echo $staff_sal['adjustment'];else echo 0;?></td>
            </tr>
            <!--<tr>
                <td class="td1">Total Deductions</td>
                <td class="td1 td2"><?php //echo $rent_Detail['proffessional_tax']+$rent_Detail['tds']+$staff_sal['advance_deduction'];?></td>
            </tr>-->
            <tr>
                <td class="td1">Expense Addition</td>
                <td class="td1 td2"><?php if($staff_sal['expence_deduction'])echo $staff_sal['expence_deduction']; else echo 0;  ?></td>
            </tr>
            <tr>
                <td class="td1 td2" colspan="2"><b style="font-size:14px;">Net Salary</b></td>
                <td class="td1 td2" colspan="3"><?php echo $payment['salary_to_be_paid']; ?></td>
            </tr>   
            <tr>
                <th class="th1" style="text-align:center">Bank Name</th>
                <th class="th1" style="text-align:center">Account No</th>
                <th class="th1 td2" style="text-align:center" colspan="2">Branch Description</th>
            </tr> 
            <tr>
                <td class="td1 td2"><?php echo $rent_Detail['bank_name'];?></td>
                <td class="td1 td2"><?php echo $rent_Detail['bank_account_number'];?></td>
                <td class="td1 td2" colspan="2">Koregaon Park, Pune - 411001.</td>
            </tr>
            <!--<tr>
                <td class="td1" colspan="4"><p class="text-muted well well-sm no-shadow" style="margin-top: 10px;">Note: This is system generated slip,it does not need stamp and signature.</p></td>
            </tr>-->
            </tbody>
          </table>
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
	  <div class="row no-print">
        <div class="col-xs-12">
          <!--<a href="invoice-print.html" target="_blank" class="btn btn-default"><i class="fa fa-print"></i> Print</a>-->
          <button type="button" onClick="PrintDiv();" name="btnPrint" id="btnPrint" class="btn btn-default pull-left"><i class="fa fa-print"></i> Print
          </button>
          <!--<button type="button" class="btn btn-primary pull-right" style="margin-right: 5px;">
            <i class="fa fa-download"></i> Generate PDF
          </button>-->
        </div>
      </div>
      <!--<div class="row">
        <!-- accepted payments column >
        <div class="col-xs-6">
          <p class="lead">Payment Methods:</p>
          <img src="dist/img/credit/visa.png" alt="Visa">
          <img src="dist/img/credit/mastercard.png" alt="Mastercard">
          <img src="dist/img/credit/american-express.png" alt="American Express">
          <img src="dist/img/credit/paypal2.png" alt="Paypal">

          <p class="text-muted well well-sm no-shadow" style="margin-top: 10px;">
            Etsy doostang zoodles disqus groupon greplin oooj voxy zoodles, weebly ning heekya handango imeem plugg
            dopplr jibjab, movity jajah plickers sifteo edmodo ifttt zimbra.
          </p>
        </div>
        <!-- /.col >
        <div class="col-xs-6">
          <p class="lead">Amount Due 2/22/2014</p>

          <div class="table-responsive">
            <table class="table">
              <tr>
                <th style="width:50%">Subtotal:</th>
                <td>$250.30</td>
              </tr>
              <tr>
                <th>Tax (9.3%)</th>
                <td>$10.34</td>
              </tr>
              <tr>
                <th>Shipping:</th>
                <td>$5.80</td>
              </tr>
              <tr>
                <th>Total:</th>
                <td>$265.24</td>
              </tr>
            </table>
          </div>
        </div>
        <!-- /.col >
      </div>-->
      <!-- /.row -->

      <!-- this row will not appear when printing -->
      
    </section>
  <!-- /.content -->
</div>
<!-- ./wrapper -->
</body>
</html>

<script type="text/javascript">
function PrintDiv() {
	$("#btnPrint").hide();
	var divContents = $(".invoice").html();
	var printWindow = window.open('', '', 'height=400,width=800');
	//   printWindow.document.write('<html><head><title>Bank Reconcilation Report</title>');
	printWindow.document.write('<link rel="stylesheet" href="https://isasbeautyschool.org/staff_login/bower_components/bootstrap/dist/css/bootstrap.min.css"><link rel="stylesheet" href="https://isasbeautyschool.org/staff_login/bower_components/font-awesome/css/font-awesome.min.css">  <link rel="stylesheet" href="https://isasbeautyschool.org/staff_login/bower_components/Ionicons/css/ionicons.min.css"><link rel="stylesheet" href="https://isasbeautyschool.org/staff_login/dist/css/AdminLTE.min.css">');
	printWindow.document.write('</head><body >');
	//	printWindow.document.write('<h4 style="text-align: left">Bank Reconcilation Report</h4>');
	printWindow.document.write(divContents);
	printWindow.document.write('</body></html>');
	printWindow.document.close();
	printWindow.print();
	$("#btnPrint").show();
}
</script>
<!-- jQuery 3 -->
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>