<?php
 include 'includes/config.php';
session_start();
if (strlen($_SESSION['id']==0)) {
  header('location:logout.php');
  } else{
?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="robots" content="noindex">
<meta name="googlebot" content="noindex">
  <title>RESS Home Page</title>

  <link rel="stylesheet" href="css/bootstrap.css" crossorigin="anonymous">
  <link rel="stylesheet" href="css/style.css" crossorigin="anonymous">
  <link rel="stylesheet" href="css/propeller.min.css" crossorigin="anonymous">
  <link rel="stylesheet" href="css/style.css" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  <!--Google Icon Font-->
    <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  </head>
<body class="bg-grey">
<?php 
  $sql="SELECT * FROM users WHERE sid= '".$_SESSION['id']."' ";
$result = mysqli_query($con, $sql);
            $row = mysqli_fetch_array($result);
 ?>


<!-- Fixed Left Sidebar -->
<nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-gradient-custom pmd-navbar pmd-z-depth">
    <a href="javascript:void(0);" data-target="basicSidebar" data-placement="left" class="btn btn-sm pmd-btn-fab pmd-btn-flat pmd-ripple-effect pmd-sidebar-toggle"> <i class="fa fa-navicon"></i></a>
    <p class="text-center" style="margin: 0 auto;">
 <img src="../img/logo.png" width="50" height="50" style="float: left; padding-right: 10px; padding-top: 5px;">
      <a class="navbar-brand" href="#">RESS</a>
       <img src="../img/cris.png" width="50" height="50">
   </p>

    
    <!-- Navbar Right icon -->    
    <!-- <div class="pmd-navbar-right-icon ml-auto">
        <a href="javascript:void(0);" class="btn btn-sm pmd-btn-fab pmd-btn-flat pmd-ripple-effect"><i class="material-icons pmd-sm md-light">search</i></a>
    </div> -->
</nav>

<section id="pmd-main">

    <!-- Left sidebar -->
    <aside id="basicSidebar" class="pmd-sidebar bg-light pmd-z-depth" role="navigation">
        <ul class="nav flex-column pmd-sidebar-nav">
            <li class="nav-item pmd-user-info">
                <a data-toggle="collapse" href="#collapseExample" class="nav-link btn-user media align-items-center">
                    <img class="mr-3" src="../img/logo.png" width="40" height="40" alt="avatar">
                    <div class="media-body">
                       <?php echo $row['name']; ?>
                    </div>
                    <i class="fa fa-info-circle"></i>
                </a>
                <ul class="collapse" id="collapseExample" data-parent="#basicSidebar">
                    <li class="nav-item">
                        <a class="nav-link" href="profile.php">
                            <i class="fa fa-user"></i>
                            <span class="media-body"> View Profile</span>
                        </a>
                    </li>
                    <!-- <li class="nav-item">
                        <a class="nav-link" href="#">
                            <i class="material-icons pmd-list-icon pmd-sm">settings</i>
                            <span class="media-body">Settings</span>
                        </a>
                    </li> -->
                    <li class="nav-item">
                        <a class="nav-link" href="logout.php">
                            <i class="fa fa-power-off"></i>
                            <span class="media-body">Logout</span>
                        </a>
                    </li>
                </ul>
            </li>
            <li class="nav-item">
                <a class="nav-link active" href="profile.php">
                   <i class="fa fa-mobile"></i>
                    <span class="media-body">Mobile</span>
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="profile.php">
                    <i class="fa fa-envelope"></i>
                    <span class="media-body">Email</span>
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="profile.php">
                    <i class="fa fa-unlock"></i>
                    <span class="media-body">Password</span>
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">
                    <i class="fa fa-id-badge"></i>
                    <span class="media-body">Image</span>
                </a>
            </li>
            <li class="nav-item" style="border-top: 2px solid black;">
                <a class="nav-link" href="#">
                    <i class="fa fa-globe"></i>
                    <span class="media-body"> About Us</span>
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">
                   <i class="fa fa-question"></i>
                    <span class="media-body"> FAQ</span>
                </a>
            </li>
            <li class="nav-item" >
                <a class="nav-link" href="#">
                    <i class="fa fa-envelope"></i>
                    <span class="media-body">Contact Us</span>
                </a>
            </li>
        </ul>
    </aside>
    
    <!-- Sidebar Overlay -->
    <div class="pmd-sidebar-overlay"></div>
    
    <!-- Start Content -->
    <div class="pmd-content custom-pmd-content" id="content">
        <h1 class="headline text-center" style="font-weight: 900;">Railway Employee Self Service</h1>
        <p class="text-center" style="color: orange;">Indian Railways</p>
        
    </div>
    <div class="container">
      <div class="row">
        <div class="col-md-6 offset-md-3">
          <div class="card">
  <div class="card-header">
    <h2 class="text-center text-white text-bold">WELCOME <?php echo $row['name']; ?><br> Employee No. <?php echo $row['ppono']; ?></h2>
  </div>
  <div class="card-body">
    <blockquote class="blockquote mb-0">
      
      <img src="../img/logo.png" width="200" style="margin: 0 auto;">
    </blockquote>
  </div>
</div>
<p class="text-center px-2" style="color:red;">*ALL DATA PROVIDED HERE ARE PROVISIONAL</p>
        </div>
      </div>
    </div>
    <div class="container">
      <div class="row">
        <div class="col-md-4 col-4">
          <div class="card bg-skyblue">
            
            <div class="card-body">
              <blockquote class="blockquote mb-0">
                
                <img src="../img/user.png" width="60" style="margin: 0 auto; background: #fff; border-radius: 50%;display: grid; align-items: center;">
                <p class="text-center "><a class="text-black" href="bio-data.php">Bio Data</a></p>
              </blockquote>
            </div>
          </div>
        </div>
        <div class="col-md-4 col-4">
          <div class="card bg-skyblue">
            
            <div class="card-body">
              <blockquote class="blockquote mb-0">
                
                <img src="../img/salary.png" width="60" style="margin: 0 auto;">
                <p class="text-center "><a class="text-black" href="salary.php">Salary</a></p>
              </blockquote>
            </div>
          </div>
        </div>
        <div class="col-md-4 col-4">
          <div class="card bg-skyblue">
            
            <div class="card-body">
              <blockquote class="blockquote mb-0">
                
                <img src="../img/nps.png" width="60" style="margin: 0 auto; border-radius: 50%;">
                <p class="text-center "><a class="text-black" href="nps.php">NPS</a></p>
              </blockquote>
            </div>
          </div>
        </div>
      </div>
    </div>
<div class="container mt-3">
      <div class="row">
        <div class="col-md-4 col-4">
          <div class="card bg-skyblue">
            
            <div class="card-body">
              <blockquote class="blockquote mb-0">
                
                <img src="../img/tax.png" width="60" style="margin: 0 auto; background: #fff; border-radius: 50%; display: grid; align-items: center;">
                <p class="text-center "><a class="text-black" href="income-tax.php">Income Tax</a></p>
              </blockquote>
            </div>
          </div>
        </div>
        <div class="col-md-4 col-4">
          <div class="card bg-skyblue">
            
            <div class="card-body">
              <blockquote class="blockquote mb-0">
                
                <img src="../img/loan.png" width="60" style="margin: 0 auto; background:#fff; border-radius: 50%; display: grid; align-items: center;">
                <p class="text-center "><a class="text-black" href="loans.php">Loans/<br>Advances</a></p>
              </blockquote>
            </div>
          </div>
        </div>
        <div class="col-md-4 col-4">
          <div class="card bg-skyblue">
            
            <div class="card-body">
              <blockquote class="blockquote mb-0">
                
                <img src="../img/leave.png" width="60" height="60" style="margin: 0 auto; border-radius: 50%;">
                <p class="text-center "><a class="text-black" href="leaves.php">Leave</a></p>
              </blockquote>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="container mt-3 mb-4">
      <div class="row">
        <div class="col-md-1 col-1">
         
        </div>
        <div class="col-md-4 col-4">
          <div class="card bg-skyblue">
            
            <div class="card-body">
              <blockquote class="blockquote mb-0">
                
                <img src="../img/family.png" width="60" style="margin: 0 auto; background: #fff; border-radius: 50%; display: grid; align-items: center;">
                <p class="text-center "><a class="text-black" href="#">Family</a></p>
              </blockquote>
            </div>
          </div>
        </div>
        <div class="col-md-2 col-2">
         
        </div>
        <div class="col-md-4 col-4">
          <div class="card bg-skyblue">
            
            <div class="card-body">
              <blockquote class="blockquote mb-0">
                
                <img src="../img/retirement.png" width="60" height="60" style="margin: 0 auto; background: #fff; border-radius: 50%; display: grid; align-items: center;">
                <p class="text-center "><a class="text-black" href="#">Retirement Benefits</a></p>
              </blockquote>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="container">
      <div class="row">
        <div class="col-md-6 offset-md-3">
          <h2 class="text-center text-bold text-black">PROVIDENT FUND FOR 2023-2024</h2>
          <p style="background: #d98f06; border-radius:9px; margin-bottom: 2px;" class="text-center text-white">
           SUMMARY
          </p>
          <p style="background: #eadfdf; border-radius: 9px; padding: 2px; margin-bottom: 2px;"><span>PROVIDENT FUND OPENING BALANCE</span><span style="float:right;"><?php echo $row['pfbalance'] ?></span></p>
          <p style="background: #eadfdf; border-radius: 9px; padding: 2px; margin-bottom: 2px;"><span>TOTAL CREDIT DURING YEAR</span><span style="float:right;"><?php echo $row['tcdy'] ?></span></p>
          <p style="background: #eadfdf; border-radius: 9px; padding: 2px; margin-bottom: 2px;"><span>TOTAL DEBIT DURING YEAR</span><span style="float:right;"><?php echo $row['tddy'] ?></span></p>
          <p style="background: #eadfdf; border-radius: 9px; padding: 2px; margin-bottom: 2px;"><span>ANNUAL INTEREST</span><span style="float:right;"><?php echo $row['annualint'] ?></span></p>
          <p style="background: #eadfdf; border-radius: 9px; padding: 2px; margin-bottom: 2px;"><span>BALANCE</span><span style="float:right;"><?php echo $row['tpfbalance'] ?></span></p>
          <p style="background: #d98f06; border-radius:9px; margin-bottom: 2px;" class="text-center text-white">
           PF LEDGER
          </p>
          <table class="table " border="">
            <thead>
              <tr>
                <th>Date</th>
                <th>Type</th>
                <th>Credit</th>
                <th>Debit</th>
              </tr>
            </thead>
            <?php 
                // $id = ;
$ppono = $row['ppono'];
// echo $ppono;
                $sql1="SELECT * FROM nps WHERE ppono = '$ppono'";
$result1 = mysqli_query($con, $sql1);
           if(mysqli_num_rows($result1)>0){ 
            ?>
            <tbody>
              <?php

 $i=0;
                     while($row1 = mysqli_fetch_array($result1)){
     
        ?>
              <tr>
                <td><?php echo $row1['date'] ?></td>
                <td><?php echo $row1['type'] ?></td>
                <td><?php echo $row1['credit'] ?></td>
                <td><?php echo $row1['debit'] ?></td>
              </tr>
              <?php 
                      $i++;
                    }
                ?>
            </tbody>
            <?php 
                      
                    }
                ?>
          </table>
        </div>
      </div>
    </div>
</section>
<footer class="bg-dark">
  <div class="container">
    <div class="row">
      <div class="col-md-12">
        <p id="mid" class="text-muted text-center ">Copy right @2024 and designed by CIRS</p>
      </div>
    </div>
  </div>
</footer>
<script src="js/jquery.js" ></script>
<script src="js/popper.min.js"  ></script>
<script src="js/bootstrap.min.js" ></script>
<script src="js/propeller.min.js" ></script>
<script src="js/script.js" ></script>
</body>
</html>
<?php } ?>