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

$message = ''; 

  if (isset($_POST['add'])) {
    $ppono = $_POST['ppono'];
    $name = $_POST['name'];
    $govcont = $_POST['govcont'];
    $empcon = $_POST['empcon'];
   
    $totalnps = $_POST['totalnps'];
    $source = $_POST['source'];
    $type = $_POST['type'];
    $credit = $_POST['credit'];
    $debit = $_POST['debit'];
    $date = $_POST['date'];
    
      $sql1 = "INSERT INTO `nps`( `ppono`, `name`, `govcont`, `empcon`, `totalnps`, `source`, `type`, `credit`, `debit`, `date`) VALUES ('$ppono','$name','$govcont','$empcon','$totalnps','$source','$type','$credit','$debit','$date')";
    $result1 = mysqli_query($con, $sql1);
    if ($result1) {
      echo "<script>alert('Success Add');
      window.location='nps.php'</script>";
    }
   

}


?>


<!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>Add NPS Data </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">Add NPS</h2>
          </div>
         
          <div class="col-md-8 col-md-offset-2">
           <form action="" method="POST" enctype="multipart/form-data">
             <div class="form-group">
               <label>PPO/PF No.</label>
               <!-- <input type="text" name="ppono" class="form-control" required=""> -->
                <?php 
                // $id = ;
                $sql="SELECT * FROM users";
$result = mysqli_query($con, $sql);
           if(mysqli_num_rows($result)>0){ 
            ?>
            <select name="ppono" class="form-control">
              <option disabled>Select</option>
              <?php

 $i=0;
                     while($row = mysqli_fetch_array($result)){
     
        ?><option  value="<?php echo $row['ppono'] ?>" ><?php echo $row['ppono'] ?></option>
          <?php 
                      $i++;
                    }
                ?>
            </select>
          <?php } ?>
             </div>

             <div class="form-group">
               <label>Name</label>
              
                <?php $sqls="SELECT * FROM users";
$results = mysqli_query($con, $sql);
               if(mysqli_num_rows($results)>0){ 
            ?>
            <select name="name" class="form-control">
              <option disabled>Select</option>
              <?php

 $i=0;
                     while($rows = mysqli_fetch_array($results)){
     
        ?><option  value="<?php  echo $rows['name'] ?>" ><?php echo $rows['name'] ?></option>
          <?php 
                      $i++;
                    }
                ?>
            </select>
          <?php } ?>
             </div>

             <div class="form-group">
               <label>Govt Contr</label>
               <input type="text" name="govcont" class="form-control" required="">
             </div>

             <div class="form-group">
               <label>Employee Contr</label>
               <input type="text" name="empcon" class="form-control" required="">
             </div>

             <div class="form-group">
               <label>Total NPS</label>
               <input type="text" name="totalnps" class="form-control" required="">
             </div>
             <div class="form-group">
               <label>Source</label>
               <input type="text" name="source" class="form-control" required="">
             </div>
             <div class="form-group">
               <label>Type</label>
               <input type="text" name="type" class="form-control" required="">
             </div>
             <div class="form-group">
               <label>Credit</label>
               <input type="text" name="credit" class="form-control" required="">
             </div>
             <div class="form-group">
               <label>Debit</label>
               <input type="text" name="debit" class="form-control" required="">
             </div>
             <div class="form-group">
               <label>Date</label>
               <input type="text" name="date" class="form-control" placeholder="DD/MM/YYYY" required="">
               <small>DD/MM/YYYY Format Should be like</small>
             </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="add">
             </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 } ?>