<?php
include 'includes/config.php';
session_start();
if (strlen($_SESSION['id']==0)) {
  header('location:logout.php');
  } else{
	
?>
<?php

$sqls = "SELECT * FROM users WHERE sid ='".$_GET['sid']."'";
$results = mysqli_query($con, $sqls);
$row = mysqli_fetch_array($results);
$message = ''; 

  if (isset($_POST['edit'])) {
     $gincome = $_POST['gincome'];
    $ldeduction = $_POST['ldeduction'];
    $cincome = $_POST['cincome'];
    $oincome = $_POST['oincome'];
   
    $tincome = $_POST['tincome'];
    $tdeduction = $_POST['tdeduction'];
    $taxincome = $_POST['taxincome'];
    $taxonincome = $_POST['taxonincome'];
    $educess = $_POST['educess'];
    $taxpay = $_POST['taxpay'];
    $ttd = $_POST['ttd'];
    $tttd = $_POST['tttd'];
    $rus = $_POST['rus'];
    $taxtodeduct = $_POST['taxtodeduct'];
    $pfbalance = $_POST['pfbalance'];
    $tcdy = $_POST['tcdy'];
    $tddy = $_POST['tddy'];
    $annualint = $_POST['annualint'];
    $tpfbalance = $_POST['tpfbalance'];
   
             $sql = "UPDATE `users` SET `gincome`='$gincome',`ldeduction`='$ldeduction',`cincome`='$cincome',`oincome`='$oincome',`tincome`='$tincome',`tdeduction`='$tdeduction',`taxincome`='$taxincome',`taxonincome`='$taxonincome',`educess`='$educess',`taxpay`='$taxpay',`ttd`='$ttd',`tttd`='$tttd',`rus`='$rus',`taxtodeduct`='$taxtodeduct',`pfbalance`='$pfbalance',`tcdy`='$tcdy',`tddy`='$tddy',`annualint`='$annualint',`tpfbalance`='$tpfbalance'  WHERE sid ='".$_GET['sid']."'";
           
 
     $result = mysqli_query($con, $sql);

     if ($result) {
      echo "<script>alert('Success Edit');
      window.location='salary-income.php'</script>";
    }else{
      echo "Error In Upload";
     // if want time add it date("Y/m/d"."h:i:sa")
    }


}

?>


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

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
<meta name="robots" content="noindex">
<meta name="googlebot" content="noindex">
  <link rel="stylesheet" href="css/bootstrap.css" crossorigin="anonymous">
    <title>Edit Salary </title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/heroic-features.css" rel="stylesheet">
    <!-- <link href="css/datatables.css" rel="stylesheet"> -->
    
  <link href="css/datatables/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" />
        
        <link href="css/datatables/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css" />
        <link href="css/datatables/responsive.bootstrap4.min.css" rel="stylesheet" type="text/css" />
        <link href="css/datatables/select.bootstrap4.min.css" rel="stylesheet" type="text/css" />




    <!-- <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.21/css/dataTables.bootstrap4.min.css"/> -->

    <style type="">
        .navbar-inverse{
            background-color: #0b0454!important;
        }
        a{
            color: #fdc010!important;
        }
    </style>
</head>
<body>
    <nav class="navbar navbar-inverse bg-success navbar-fixed-top" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                 <a class="navbar-brand" href="welcome.php"><i class="glyphicon glyphicon-home"></i> Home</a>
            </div>
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li>
                        <a href="profile.php"><i class="glyphicon glyphicon-user"></i> <?php echo $_SESSION['sname'];?></a>
                    </li>
                    <li>
                      <a href="employee-details.php"><i class="glyphicon glyphicon-folder-open"></i> Employee Data</a>
                    </li>
                    <li>
                      <a href="nps.php"><i class="glyphicon glyphicon-globe"></i> NPS</a>
                    </li>
                    <li>
                      <a href="salary-income.php"><i class="glyphicon glyphicon-screenshot"></i> Salary/Income tax </a>
                    </li>
                    <li>
                      <a href="loans.php"><i class="glyphicon glyphicon-screenshot"></i> Loans/Advance </a>
                    </li>
                    <li>
                        <a href="logout.php"><i class="glyphicon glyphicon-log-out"></i> Logout</a>
                    </li>
                  
                </ul>
            </div>
        </div>
    </nav>
    <div id="divToPrint">
    <div class="container">
        <div class="row">
          <div class="col-md-12">
            <h2 class="h2 text-center">Update Salary/Income tax details</h2>
          </div>
         
          <div class="col-md-8 col-md-offset-2">
           <form action="" method="POST" enctype="multipart/form-data">
             <div class="form-group">
               <label>Gross Income</label>
               <input type="text" name="gincome" value="<?php echo $row['gincome']; ?>" class="form-control" required="">
             </div>

             <div class="form-group">
               <label>Less Deduction</label>
               <input type="text" name="ldeduction" value="<?php echo $row['ldeduction']; ?>" class="form-control" required="">
             </div>

             <div class="form-group">
               <label>Chargeable Income</label>
               <input type="text" name="cincome" value="<?php echo $row['cincome']; ?>" class="form-control" required="">
             </div>

             <div class="form-group">
               <label>Other Income</label>
               <input type="text" name="oincome" value="<?php echo $row['oincome']; ?>" class="form-control" required="">
             </div>

             <div class="form-group">
               <label>Total Income</label>
               <input type="text" name="tincome" value="<?php echo $row['tincome']; ?>" class="form-control" required="">
             </div>

             

             <div class="form-group">
               <label>Total Deduction</label>
                <input type="text" name="tdeduction" value="<?php echo $row['tdeduction']; ?>" class="form-control" required="">
             </div>
             <div class="form-group">
               <label>Taxable Income</label>
                <input type="text" name="taxincome" value="<?php echo $row['taxincome']; ?>" class="form-control" required="">
             </div>
             <div class="form-group">
               <label>Tax on Income</label>
                <input type="text" name="taxonincome" value="<?php echo $row['taxonincome']; ?>" class="form-control" required="">
             </div>
             <div class="form-group">
               <label>Education CESS</label>
                <input type="text" name="educess" value="<?php echo $row['educess']; ?>" class="form-control" required="">
             </div>
             <div class="form-group">
               <label>Tax Payable</label>
                <input type="text" name="taxpay" value="<?php echo $row['taxpay']; ?>" class="form-control" required="">
             </div>
              <div class="form-group">
               <label>Total Tax Deducted</label>
                <input type="text" name="ttd" value="<?php echo $row['ttd']; ?>" class="form-control" required="">
             </div>
              <div class="form-group">
               <label>Total Tax to be Deducted</label>
                <input type="text" name="tttd" value="<?php echo $row['tttd']; ?>" class="form-control" required="">
             </div>
              <div class="form-group">
               <label>Rebate under section 89</label>
                <input type="text" name="rus" value="<?php echo $row['rus']; ?>" class="form-control" required="">
             </div>
              <div class="form-group">
               <label>Tax to be deducted</label>
                <input type="text" name="taxtodeduct" value="<?php echo $row['taxtodeduct']; ?>" class="form-control" required="">
             </div>
             <div class="form-group">
               <label>PF Opening Balance</label>
                <input type="text" name="pfbalance" value="<?php echo $row['pfbalance']; ?>" class="form-control" required="">
             </div>
             <div class="form-group">
               <label>Total Credit During Year</label>
                <input type="text" name="tcdy" value="<?php echo $row['tcdy']; ?>" class="form-control" required="">
             </div>
             <div class="form-group">
               <label>Total Debit During Year</label>
                <input type="text" name="tddy" value="<?php echo $row['tddy']; ?>" class="form-control" required="">
             </div>
             <div class="form-group">
               <label>Annual Interest</label>
                <input type="text" name="annualint" value="<?php echo $row['annualint']; ?>" class="form-control" required="">
             </div><div class="form-group">
               <label>Total PF balance</label>
                <input type="text" name="tpfbalance" value="<?php echo $row['tpfbalance']; ?>" class="form-control" required="">
             </div>
             <div class="form-group text-center">
               <input type="reset" class="btn btn-info" value="Reset" name="">
               <input type="submit" class="btn btn-primary" value="Submit" name="edit">
             </div>
           </form>
          </div>  
        </div>
    </div>
 
   </div> 

       

   <div id="foot">
     <script src="js/jquery.js"></script>
    <script src="js/bootstrap.min.js"></script>

 
<!-- <script type="text/javascript" src="js/datatables.js"></script> -->
<!-- Datatable plugin js -->
        <script src="js/datatables/jquery.dataTables.min.js"></script>
        <script src="js/datatables/dataTables.bootstrap4.min.js"></script>

        <script src="js/datatables/dataTables.responsive.min.js"></script>
        <script src="js/datatables/responsive.bootstrap4.min.js"></script>

        <script src="js/datatables/dataTables.buttons.min.js"></script>
        <script src="js/datatables/buttons.bootstrap4.min.js"></script>

        <script src="js/jszip/jszip.min.js"></script>
        <script src="js/pdfmake/pdfmake.min.js"></script>
        <script src="js/pdfmake/vfs_fonts.js"></script>

        <script src="js/datatables/buttons.html5.min.js"></script>
        <script src="js/datatables/buttons.print.min.js"></script>

        <script src="js/datatables/dataTables.keyTable.min.js"></script>
        <script src="js/datatables/dataTables.select.min.js"></script>

        <!-- Datatables init -->
        <script src="js/datatables/datatables.init.js"></script>

<script type="text/javascript">
  $(document).ready(function() {
    $('#datatables').DataTable();
} );
</script>
   </div>
   
</body>

</html>
<?php } ?>