ok

Mini Shell

Direktori : /home/ngwcolle/www/mis/admin/
Upload File :
Current File : /home/ngwcolle/www/mis/admin/sch_entry.php

<?php
include('includes/checklogin.php');
check_login();
error_reporting(E_ALL);
?>
<!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, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">
  <link href="img/logo/logo.png" rel="icon">
  <title>Daily Collection/Expense Report</title>
  <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
  <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
  <link href="css/ruang-admin.min.css" rel="stylesheet">
  <link href="vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
</head>

<body id="page-top">
  <div id="wrapper">
    <!-- Sidebar -->
    <?php include('includes/sidebar.php'); ?>
    <!-- Sidebar -->
    <div id="content-wrapper" class="d-flex flex-column">
      <div id="content">
        <!-- TopBar -->
        <?php include('includes/header.php'); ?>
        <!-- Topbar -->
        <!-- Container Fluid-->
        <div class="container-fluid" id="container-wrapper">
          <div class="d-sm-flex align-items-center justify-content-between mb-4">
            <h1 class="h3 mb-0 text-gray-800">Scholarship</h1>
            <ol class="breadcrumb">
              <li class="breadcrumb-item"><a href="dashboard.php">Home</a></li>
              <li class="breadcrumb-item active" aria-current="page">Scholarship</li>
            </ol>
          </div>

          <!-- Row -->
          <div class="row">
            <!-- Datatables -->
            <!-- DataTable with Hover -->
            <div class="col-lg-12">
              <div class="card mb-4">
                <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
                  <h6 class="m-0 font-weight-bold text-primary">No. of Scholarship beneficiary</h6>
                  <h6><a href="manage_Scholarship.php" class="btn btn-dark btn-sm">Back to Dashboard </a>
                    <a href="sch_report.php" class="btn btn-info btn-sm">Reports </a>
                  </h6>
                </div>

                <!-- search area -->
                <form class="form-group" action="" method="post">
                  <h5 class="p-0 text-center">Search</h5>
                  <div class="row p-3">

                    <div class="col-md-3 pt-3">
                      <div class="form-group ">
                        <select id="inputState " name="schyear" class="form-control" required>
                          <option selected required value="">Year</option>
                          <?php
                          // get current year
                          $curYear = date('Y');

                          // create range of required years and iterate over them
                          foreach (range($curYear - 10, $curYear) as $year) {
                            echo "<option value='$year'>$year</option>";
                          }
                          ?>
                        </select>
                      </div>
                    </div>
                    <div class="col-md-3 pt-3">
                      <div class="form-group">
                        <select id="inputState" name="course" class="form-control" required>
                          <option selected value="">Course Name</option>
                          <?php
                          $smt = $dbh->prepare("SELECT DISTINCT coursename from tbl_subject order by coursename");
                          $smt->execute();
                          $data = $smt->fetchAll(PDO::FETCH_OBJ);
                          foreach ($data as $row) {
                          ?>
                            <option value="<?php echo $row->coursename; ?>"><?php echo strtoupper($row->coursename); ?></option>
                          <?php } ?>
                        </select>
                      </div>
                    </div>
                    <div class="col-md-3 pt-3">
                      <div class="form-group">
                        <select id="inputState" name="schname" class="form-control" required>
                          <option selected value="">Scholarship Name</option>
                          <?php
                          $smt = $dbh->prepare(" select * from tbl_scholarship order by id desc");
                          $smt->execute();
                          $data = $smt->fetchAll(PDO::FETCH_OBJ);
                          foreach ($data as $row) {
                          ?>
                            <option value="<?php echo $row->schname; ?>"><?php echo strtoupper($row->schname); ?></option>
                          <?php } ?>
                        </select>
                      </div>
                    </div>
                    <div class="col-md-2 p-3">
                      <button type="submit" class="btn btn-primary btn-block" name="search">Search</button>
                    </div>
                    <!-- <div class="col-md-4"><button type="submit" class="btn btn-dark" name="search">Search</button>
                  <button type="button" onClick="window.location.href = 'manage_dcr.php'" class="btn btn-danger" name="search">Reset</button>
                </div> -->

                  </div>
                </form>
                <!-- search area -->
                <?php
                if (isset($_POST['search'])) {
                  $schname = $_POST['schname'];
                  $course = $_POST['course'];
                  $schyear = $_POST['schyear'];
                  echo  '<h6 class="text-danger pl-3"> You are submitting details for the year' . $schyear . " in " . $course . " course of " . $schname . ' scheme.</h6>';
                  $smt = $dbh->prepare("SELECT sum(admitted) as total from tblstudents where coursename='$course' and year='$schyear'");
                  $smt->execute();
                  $data = $smt->fetchAll(PDO::FETCH_OBJ);
                  foreach ($data as $row) {
                    $total = $row->total;
                  }
                  echo '<h6 class="text-danger pl-3">Total no of students admitted in this year is ' . $total . '</h6>';
                }
                if (isset($_POST['submit'])) {
                  $hdnschname = $_POST['hdnschname'];
                  $hdncourse = $_POST['hdncourse'];
                  $hdnyear = $_POST['hdnyear'];
                  $scb = $_POST['scb'];
                  $scg = $_POST['scg'];
                  $stb = $_POST['stb'];
                  $stg = $_POST['stg'];
                  $obcb = $_POST['obcb'];
                  $obcg = $_POST['obcg'];
                  $pwdb = $_POST['pwdb'];
                  $pwdg = $_POST['pwdg'];
                  $genb = $_POST['genb'];
                  $geng = $_POST['geng'];
                  $minb = $_POST['minorityb'];
                  $ming = $_POST['minorityb'];
                  $sql = "SELECT * from tblschstudents where coursename='$hdncourse' and year='$hdnyear' and schname='$hdnschname'";
                  $query = $dbh->prepare($sql);
                  // $query->bindParam(':aid', $aid, PDO::PARAM_STR);
                  $query->execute();
                  $results = $query->fetchAll(PDO::FETCH_OBJ);
                  if ($query->rowCount() > 0) {
                    echo "<script>alert('Scholarship data already inserted for the year.Check for another session..');</script>";
                  }
                  else{ 
                  $sql1 = "INSERT INTO tblschstudents(year,schname,coursename,scb,scg,stb,stg,obcb,obcg,pwdb,pwdg,genb,geng,minb,ming) 
        VALUES('$hdnyear','$hdnschname','$hdncourse','$scb','$scg','$stb','$stg','$obcb','$obcg','$pwdb','$pwdg','$genb','$geng','$minb','$ming')";
                  $dbh->exec($sql1);
                  echo "<script>alert('Scholarship data inserted successfully');</script>";
                  echo "<script>window.location.href = 'manage_Scholarship.php'</script>";
                }
              }
                ?>
               
                <!--  start  modal -->
             
                <!--   end modal -->

                <div class="table-responsive">
                  <form action="" method="post">
                  <input type="hidden" name="hdnyear" id="hdnyear"  value="<?php echo $schyear; ?>">
                <input type="hidden" name="hdnschname" id="hdnschname" value="<?php echo $schname; ?>">
                <input type="hidden" name="hdncourse" id="hdncourse" value="<?php echo $course; ?>">
                    <table class="table   table-hover table-sm">

                      <tbody>
                        <tr>
                          <th>Category</th>
                          <th>Boys</th>
                          <th>Girls</th>
                          <th>Total</th>
                        </tr>
                        <tr>
                          <th><input type="text" name="sc" class="form-control" value="SC" readonly></th>
                          <th><input type="number" min="0" name="scb" id="scb" onblur='if(this.value==""){this.value=0;}' class="form-control boy" required onkeyup="sum();"></th>
                          <th><input type="number" name="scg" id="scg" onblur='if(this.value==""){this.value=0;}' class="form-control girl" required onkeyup="sum();"></th>
                          <th><input type="number" name="sctot" readonly id="sctot" class="form-control total" value="0" required></th>
                        </tr>
                        <tr>
                          <th><input type="text" name="st" class="form-control" value="ST" readonly></th>
                          <th><input type="number" name="stb" onblur='if(this.value==""){this.value=0;}' id="stb" class="form-control boy" onkeyup="sum1();" required></th>
                          <th><input type="number" name="stg" id="stg" onblur='if(this.value==""){this.value=0;}' class="form-control girl" onkeyup="sum1();" required></th>
                          <th><input type="number" name="sttot" id="sttot" value="0" readonly class="form-control"></th>
                        </tr>
                        <tr>
                          <th><input type="text" name="obc" class="form-control" value="OBC/SEBC" readonly></th>
                          <th><input type="number" name="obcb" id="obcb" onblur='if(this.value==""){this.value=0;}' onkeyup="sum2()" class="form-control boy"></th>
                          <th><input type="number" name="obcg" id="obcg" onblur='if(this.value==""){this.value=0;}' onkeyup="sum2()" class="form-control girl"></th>
                          <th><input type="number" name="obctot" id="obctot" value="0" readonly class="form-control"></th>
                        </tr>
                        <tr>
                          <th><input type="text" name="pwd" id="pwd" class="form-control" value="PWD" readonly></th>
                          <th><input type="text" name="pwdb" id="pwdb" onblur='if(this.value==""){this.value=0;}' onkeyup="sum3()" class="form-control boy"></th>
                          <th><input type="text" name="pwdg" id="pwdg" onblur='if(this.value==""){this.value=0;}' onkeyup="sum3()" class="form-control girl"></th>
                          <th><input type="text" name="pwdtot" id="pwdtot" value="0" readonly class="form-control" value="0"></th>
                        </tr>
                        <tr>
                          <th><input type="text" name="gen" id="gen" class="form-control" value="GENERAL" readonly></th>
                          <th><input type="text" name="genb" id="genb" onblur='if(this.value==""){this.value=0;}' onkeyup="sum4()" class="form-control boy"></th>
                          <th><input type="text" name="geng" id="geng" onblur='if(this.value==""){this.value=0;}' onkeyup="sum4()" class="form-control girl"></th>
                          <th><input type="text" name="gentot" id="gentot" value="0" class="form-control"></th>
                        </tr>
                        <tr>
                          <th><input type="text" name="minority" id="minority" class="form-control" value="Minority" readonly></th>
                          <th><input type="text" name="minorityb" id="minorityb" onblur='if(this.value==""){this.value=0;}' onkeyup="sum5()" class="form-control boy"></th>
                          <th><input type="text" name="minorityg" id="minorityg" onblur='if(this.value==""){this.value=0;}' onkeyup="sum5()" class="form-control girl"></th>
                          <th><input type="text" name="minoritytot" id="minoritytot" value="0" class="form-control"></th>
                        </tr>
                        <tr>
                          <th><input type="text" name="total" id="total" class="form-control" value="Total" readonly></th>
                          <th><input type="text" name="totalb" id="totalb" value="0" class="form-control"></th>
                          <th><input type="text" name="totalg" id="totalg" value="0" class="form-control"></th>
                          <th><input type="text" name="totaltot" id="totaltot" value="0" class="form-control"></th>
                        </tr>
                      </tbody>
                    </table>
                </div>
                </br>
                <input type="submit" value="Submit" name="submit" id="submit" class="btn btn-primary col-md-3 m-auto" style="margin-bottom:10px">
                </br>
              </div>
            </div>
          </div>
          <!--Row-->
          </form>
          <!-- Modal Logout -->
        
        </div>
        <!---Container Fluid-->
      </div>

      <!-- Footer -->
      <?php include('includes/footer.php'); ?>
      <!-- Footer -->
    </div>
  </div>

  <!-- Scroll to top -->
  <a class="scroll-to-top rounded" href="#page-top">
    <i class="fas fa-angle-up"></i>
  </a>

  <script src="vendor/jquery/jquery.min.js"></script>
  <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="vendor/jquery-easing/jquery.easing.min.js"></script>
  <script src="js/ruang-admin.min.js"></script>
  <!-- Page level plugins -->
  <script src="vendor/datatables/jquery.dataTables.min.js"></script>
  <script src="vendor/datatables/dataTables.bootstrap4.min.js"></script>
  <!-- Page level custom scripts -->
  <script>
    $(document).ready(function() {
      $('#dataTable').DataTable(); // ID From dataTable 
      $('#dataTableHover').DataTable(); // ID From dataTable with Hover
    });
  </script>
  <!-- <script type="text/javascript">
    $(document).ready(function() {
      $(document).on('click', '.edit_data4', function() {
        var edit_id4 = $(this).attr('id');
        $.ajax({
          url: "edit_ticket.php",
          type: "post",
          data: {
            edit_id4: edit_id4
          },
          success: function(data) {
            $("#info_update4").html(data);
            $("#editData4").modal('show');
          }
        });
      });
    });
  </script> -->
  <script>
    function sum() {
      var txtscb = document.getElementById('scb').value;
      //   if (txtscb.length == 0) {
      //    txtscb.value=0;
      // }
      var txtscg = document.getElementById('scg').value;
      var result = parseInt(txtscb) + parseInt(txtscg);
      if (!isNaN(result)) {
        document.getElementById('sctot').value = result;
      }
    }

    function sum1() {
      var txtscb = document.getElementById('stb').value;
      var txtscg = document.getElementById('stg').value;
      var result = parseInt(txtscb) + parseInt(txtscg);
      if (!isNaN(result)) {
        document.getElementById('sttot').value = result;
      }
    }

    function sum2() {
      var txtscb = document.getElementById('obcb').value;
      var txtscg = document.getElementById('obcg').value;
      var result = parseInt(txtscb) + parseInt(txtscg);
      if (!isNaN(result)) {
        document.getElementById('obctot').value = result;
      }
    }

    function sum3() {
      var txtscb = document.getElementById('pwdb').value;
      var txtscg = document.getElementById('pwdg').value;
      var result = parseInt(txtscb) + parseInt(txtscg);
      if (!isNaN(result)) {
        document.getElementById('pwdtot').value = result;
      }
    }

    function sum4() {
      var txtscb = document.getElementById('genb').value;
      var txtscg = document.getElementById('geng').value;
      var result = parseInt(txtscb) + parseInt(txtscg);
      if (!isNaN(result)) {
        document.getElementById('gentot').value = result;
      }
    }

    function sum5() {
      var txtscb = document.getElementById('minorityb').value;
      var txtscg = document.getElementById('minorityg').value;
      var result = parseInt(txtscb) + parseInt(txtscg);
      if (!isNaN(result)) {
        document.getElementById('minoritytot').value = result;
      }
    }
  </script>
  <script>
    $(document).ready(function() {
      //iterate through each textboxes and add keyup
      //handler to trigger sum event
      $(".boy").each(function() {

        $(this).keyup(function() {
          calculateSum();
        });
      });
      $(".girl").each(function() {

        $(this).keyup(function() {
          calculateSum();
        });
      });

    });

    function calculateSum() {
      var sum = 0;
      var sum1 = 0;
      //iterate through each textboxes and add the values
      $(".boy").each(function() {

        //add only if the value is number
        if (!isNaN(this.value) && this.value.length != 0) {
          sum += parseInt(this.value);
        }
      });
      $(".girl").each(function() {

        //add only if the value is number
        if (!isNaN(this.value) && this.value.length != 0) {
          sum1 += parseInt(this.value);
        }
      });


      //.toFixed() method will roundoff the final sum to 2 decimal places
      $("#totalb").val(sum);
      $("#totalg").val(sum1);
      $("#totaltot").val(parseInt($("#totalb").val()) + parseInt($("#totalg").val()));
    }
  </script>
  <script>
    $(document).ready(function() {
      $('#submit').on("click", function(e) {
        //clean divmessage
        // name="hdnyear" value="
        //         <input type="text" name="hdnschname" 
               
       var course=$("#hdncourse").val();
       var year=$("#hdnyear").val();
       var scheme=$("#hdnschname").val();
        //or use $("#div_main form input") to check all inputs
        if(!course){
          alert("Select Course Name");
          return false;
        }
        if(!year){
          alert("Select Scholarship Year");
          return false;
        }
        if(!scheme){
          alert("Select Scholarship Scheme");
          return false;
        }
        // e.preventDefault();
      });
    });
  </script>
</body>

</html>

Zerion Mini Shell 1.0