Mini Kabibi Habibi

Current Path : C:/xampp/htdocs/cid/fts/SDO/
Upload File :
Current File : C:/xampp/htdocs/cid/fts/SDO/leave_request.php

<?php 

@include '../database.php';


session_start();

//Checking User Logged or Not
if(!isset($_SESSION['username_ao'])){ 

 header('location:../index.php');
}



include('header.php');
include('script.php');
include('conn.php');
include('index1.php');
?>
<link rel="stylesheet" type="text/css" href="css/style2.css">
<body style="background-color: #FFFFFF">
<div class="dashboard-top" style="background-color: #FFFFFF">
    <div class="content">
    
                            <?php
            $sql = "SELECT * FROM employee WHERE username='$_SESSION[login_user]'";
            $result = mysqli_QUERY($conn,$sql) or die (mysql_error());
            while ($row = mysqli_fetch_assoc($result))
            {
                $username=$row['username'];
                $NAME=$row['SURNAME'];
                $FNAME=$row['FNAME'];
                 $MNAME=$row['MNAME'];
                  $EXNAME=$row['EXNAME'];
                $DESIGNATION=$row['DESIGNATION'];
                $POSITION=$row['posi'];
             
                
            }
          ?>
                           <form action="" method="POST" enctype="multipart/form-data">
                           
                            <h6 class="hidden"><b>Item Number:</b></h6>   <input class="form-control hidden" type="text" readonly="true"  name="USERNAME" value="<?php echo $username;?> "><br>
                         <input class="form-control hidden" type="text" readonly="true"  name="USERNAME" value="<?php echo $NAME,',',' ', $FNAME,',',' ',$MNAME,',',' ', $EXNAME;?> "><br>
                                        <div class="input-group">
                                            <span class="input-group-addon">
                                                LEAVE Type:
                                            </span>
                                            <select class="form-control show-tick" name="LEAVE_TYPE">
                                                <option>Maternity Leave</option>
                                                <option>Paternity Leave</option>
                                                <option>Long Term Leave</option>
                                               
                                            </select>
                                        </div>
                       <br>

                               <textarea name="leave_desc" cols="100" rows="5"></textarea>
                               <input class="form-control" type="text" readonly="true" hidden="" name="position" value="<?php echo $posi;?>">
                               <input class="form-control" type="text" readonly="true" hidden="" name="pangalan"  value="<?php echo $surname;?>">
                               <input class="form-control" type="text" readonly="true" hidden="" name="opisina" value="<?php echo $DESIGNATION;?>">
                             
                               <input type="submit" value="SAVE" name="save" style="margin-top: -28px;" class="btn solid">
                           </form>
                        </div>
            <?php
                    if (isset($_POST['save'])) {
               
                $leave_desc = $_POST['leave_desc'];
                  $LEAVE_TYPE = $_POST['LEAVE_TYPE'];
                $sql1="INSERT INTO leaves(username,NAME,DESIGNATION,LEAVE_TYPE,description,posi,DATE,status) 
                    SELECT username,SURNAME,DESIGNATION,'$LEAVE_TYPE','$leave_desc',POSITION,now(),'PENDING' FROM employee where username='$_SESSION[login_user]'"; 
                if (mysqli_query($conn, $sql1)) {
        echo "<script type='text/javascript'>alert('Successful -  Submitted!'); window.location.href = 'leave_request.php';</script>";
     } else {
        echo "Error: " . $sql1 . "
" . mysqli_error($conn);
     }
     mysqli_close($conn);
}

                    

            ?>       
                  
              <!-- Content -->
         <div class="content">
         <div class="wrapper">
            <h2> Pending Approval</h2>

       <div class="card-block table-border-style">

                    <div class="table-responsive">

                        <table class="table" style="margin: 10px">
                    
                                    <thead>
                                        <tr>
                                             
                                             <th width="250">leave Type</th> 
                                            <th width="400">Description</th> 
                                            <th width="200">Date</th> 
                                            <th>Status</th>

                                          
                                        </tr>
                                    </thead>
                                 
                                   
<?php 


$sql = "SELECT * from leaves where username='$_SESSION[login_user]' ";
$data = mysqli_query($conn,$sql);
    while ($rows= mysqli_fetch_array($data)) {
            # code...
           
      ?>
       
                                        <tr>
                                           
                                              <td> <?php echo $rows['LEAVE_TYPE']; ?></td>
                                                 <td> <?php echo $rows['DESCRIPTION']; ?></td>
                                              <td> <?php echo $rows['DATE']; ?></td>
                                                 <td> <?php echo $rows['STATUS']; ?></td>
                                                  <?php } ?>
                                        </tr>
                                   
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
</body>
 <div class="pie-report" style="float: right;">
        <script src="js/jquery.min.js"></script>
        <?php include('script.php'); ?> 

        <!-- Educational Qualification -->
        <!-- Talisay -->
        <?php
          include('connect.php');
          $date = date("Y", strtotime("+ 8 HOURS"));
          $qosds = $con->prepare("SELECT COUNT('PLANTILLA') FROM `employee` WHERE `PLANTILLA` = 'OSDS'") or die(mysqli_error());
          $qosds->execute();
          $osds = $qosds->fetchAll();
          foreach($osds as $key => $row) { 
           $total = $row["COUNT('PLANTILLA')"];

            }?>


        <!-- Alijis -->
          <?php
          include('connect.php');
          $date = date("Y", strtotime("+ 8 HOURS"));
          $qtalisay = $con->prepare("SELECT COUNT('PLANTILLA') FROM `employee` WHERE `PLANTILLA` = 'SGOD'") or die(mysqli_error());
          $qtalisay->execute();
          $talisay = $qtalisay->fetchAll();
          foreach($talisay as $key => $row) { 
           $total = $row["COUNT('PLANTILLA')"];

            }?>



        <!-- Binalbagan -->
          <?php
          include('connect.php');
          $date = date("Y", strtotime("+ 8 HOURS"));
          $qtalisay = $con->prepare("SELECT COUNT('PLANTILLA') FROM `employee` WHERE `PLANTILLA` = 'CID'") or die(mysqli_error());
          $qtalisay->execute();
          $talisay = $qtalisay->fetchAll();
          foreach($talisay as $key => $row) { 
           $total = $row["COUNT('PLANTILLA')"];

            }?>



        <!-- Fortune Towne -->
           <?php
          include('connect.php');
          $date = date("Y", strtotime("+ 8 HOURS"));
          $qtalisay = $con->prepare("SELECT COUNT('PLANTILLA') FROM `employee` WHERE `PLANTILLA` = 'Elementary'") or die(mysqli_error());
          $qtalisay->execute();
          $talisay = $qtalisay->fetchAll();
          foreach($talisay as $key => $row) { 
           $total = $row["COUNT('PLANTILLA')"];

            }?>

         <?php
          include('connect.php');
          $date = date("Y", strtotime("+ 8 HOURS"));
          $qtalisay = $con->prepare("SELECT COUNT('PLANTILLA') FROM `employee` WHERE `PLANTILLA` = 'Junior High School'") or die(mysqli_error());
          $qtalisay->execute();
          $talisay = $qtalisay->fetchAll();
          foreach($talisay as $key => $row) { 
           $total = $row["COUNT('PLANTILLA')"];

            }?>

 <?php
          include('connect.php');
          $date = date("Y", strtotime("+ 8 HOURS"));
          $qtalisay = $con->prepare("SELECT COUNT('PLANTILLA') FROM `employee` WHERE `PLANTILLA` = 'Senior High Shcool'") or die(mysqli_error());
          $qtalisay->execute();
          $talisay = $qtalisay->fetchAll();
          foreach($talisay as $key => $row) { 
           $total = $row["COUNT('PLANTILLA')"];

            }?>
   
    <div id = "content" style="margin-bottom: 15px !important;">
        <br />
        <br />
        <br />
        <div class = "">
        <div id="chartContainer" style="height: 400px; width: 75%; float: right; margin-right: 10px; margin-top: 43px;"></div> 
        </div>
        
        <div id="bar2chartContainer" style="height: 300px; width: 75%; float: right; margin-top: 20px; margin-right: 10px;">
        </div>
    </div>
        </body>
</html>