ok
Direktori : /home/ngwcolle/www/LIBRARY-NGWC/admin/ |
Current File : /home/ngwcolle/www/LIBRARY-NGWC/admin/libcard-renewal.php |
<?php session_start(); //DB conncetion date_default_timezone_set('Asia/Kolkata'); include_once('includes/config.php'); error_reporting(0); //validating Session if (strlen($_SESSION['aid']==0)) { header('location:logout.php'); } else{ //Code for record deletion if($_GET['teamid']){ $tid=$_GET['teamid']; mysqli_query($con,"delete from tblteams where id ='$tid'"); echo "<script>alert('Data Deleted');</script>"; echo "<script>window.location.href='manage-teams.php'</script>"; } // $school_number = $_GET['school_number']; // $user_query = mysqli_query($con,"SELECT * FROM tbl_students WHERE rollno = '$school_number' "); // $user_row = mysqli_fetch_array($user_query); //get current login user name $adid=$_SESSION['aid']; $ret1=mysqli_query($con,"select AdminName from tbladmin where ID='$adid'"); while($row1=mysqli_fetch_array($ret1)){ $cuser=$row1['AdminName']; } // add deprmtnet if(isset($_POST['submit'])) { $tname=strtoupper($_POST['dname']); $tlname=$_POST['cno']; $mobno=strtoupper($_POST['scode']); // $tmember=$_POST['teammember']; $query=mysqli_query($con, "insert into tbl_department(name,shortcode,classno) values('$tname','$mobno','$tlname')"); if ($query) { echo '<script>alert("Department Created.")</script>'; echo "<script>window.location.href ='manage-department.php'</script>"; }else{ echo '<script>alert("Something Went Wrong. Please try again.")</script>'; } } //end addition if(isset($_POST["but_update"])){ $admfee= $_POST["renewdate"]; // echo "<script>alert(' ".$admfee." ".'Books Allowed per User!'." '); </script>"; if(isset($_POST["update"])){ foreach($_POST["update"] as $updateid){ if($admfee !=''){ // echo "<script>alert(' ".$updateid." ".'Books Allowed per User!'." ');</script>"; mysqli_query($con,"UPDATE tbl_libcard SET renewal2 = '$admfee' WHERE rollno= '$updateid'") or die (mysqli_error()); } } } echo "<script> alert('Renewal done successfully!!!.'); window.location.href='libcard-renewal.php'; </script>"; } //update cfee ends ?> <!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=""> <title>Library Card Renewal</title> <link rel="icon" type="image/x-icon" href="../assets/favicon.ico" /> <!-- Custom fonts for this template --> <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css"> <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet"> <!-- Custom styles for this template --> <link href="css/sb-admin-2.min.css" rel="stylesheet"> <!-- Custom styles for this page --> <link href="vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet"> </head> <body id="page-top"> <!-- Page Wrapper --> <div id="wrapper"> <!-- Sidebar --> <?php include_once('includes/sidebar.php');?> <!-- End of Sidebar --> <!-- Content Wrapper --> <div id="content-wrapper" class="d-flex flex-column"> <!-- Main Content --> <div id="content"> <!-- Topbar --> <?php include_once('includes/topbar.php');?> <!-- End of Topbar --> <!-- Begin Page Content --> <div class="container-fluid"> <!-- Page Heading --> <div class="d-sm-flex align-items-center justify-content-between mb-4"> <h1 class="h3 mb-0 text-gray-800">Library Card Renewal</h1> </div> <!-- DataTales Example --> <?php $sql = mysqli_query($con,"SELECT tbl_students.*,tbl_department.* FROM tbl_students INNER JOIN tbl_department ON tbl_students.department=tbl_department.id WHERE tbl_students.rollno = '$school_number' "); $row = mysqli_fetch_array($sql); ?> <div class="card shadow mb-4"> <div class="card-header py-3"> <div class="float-left"> <h6 class="m-0 py-2 font-weight-bold text-primary"> Library Card Renewal( For 2nd Year Students) </h6> <input type="hidden" name="cuser" value="<?php echo $cuser;?>"/> </div> <div class="float-right"><a href="libcard-renewal1.php" class="float-right mt-0 btn btn-warning">3rd Year</a></div> </div> <div class="card-body"> <!-- issue area starts --> <div class="row"> <div class="form-group col-md-4"> <form action="" method="post"> <label for="inputEmail4">Admission Year</label> <select name="admyear" id="admyear" class="form-control" required> <option value="">--Select Admission Year--</option> <?php $starting_year =date('Y', strtotime('-3 year')); $ending_year = date('Y'); for($starting_year; $starting_year <= $ending_year; $starting_year++) { echo '<option value="'.$starting_year.'">'.$starting_year.'</option>'; } ?> </select> </div> <div class="form-group col-md-4"> <label for="inputEmail4">Department</label> <select name="dept" id="dept" class="form-control" required> <option value="">--Select Department--</option> <?php $sqli = "SELECT * FROM tbl_department"; $result = mysqli_query($con, $sqli); while ($row = mysqli_fetch_array($result)) { echo '<option value="'.$row['id'].'">'.$row['name'].'</option>'; } ?> </select> </div> <div class="form-group col-md-4"> <div class="clearfix mt-4 p-1"></div> <button type="submit" class="btn btn-primary" name="search"> <i class="fa fa-search" aria-hidden="true"></i> SEARCH</button> </div> </form> </div> <hr> <!-- issue area ends` --> <!-- outstanding area --> <div class="table-responsive"> <form method="post" action=""> <table class="table table-bordered" id="dataTablenull" width="100%" cellspacing="0"> <thead> <tr> <th><input type='checkbox' id='checkAll'> All</th> <th>Sl.</th> <th>Roll No.</th> <th>Name </th> <th>Dept.</th> <th>Library Card No</th> <th>Year-1</th> <th>Year-2</th> <!-- <th>Reporting Time</th> --> </tr> </thead> <!-- <tfoot> <tr> <th>Sno.</th> <th>Name</th> <th>Mobile Number</th> <th>Location </th> <th>Message</th> <th>Reporting Time</th> <th>Action</th> </tr> </tfoot> --> <tbody> <?php // $barcode = $_GET['barcode']; if(isset($_POST['search'])){ $admyear = $_POST['admyear']; $dept = $_POST['dept']; $query=mysqli_query($con,"select tbl_students.*,tbl_libcard.*,tbl_department.* from tbl_students inner join tbl_libcard on tbl_students.rollno=tbl_libcard.rollno inner join tbl_department on tbl_students.department=tbl_department.id where tbl_students.department='$dept' and tbl_students.admyear='$admyear'"); $cnt=1; $borrow_count = mysqli_num_rows($query); while($row=mysqli_fetch_array($query)){ $timezone = "Asia/Kolkata"; if(function_exists('date_default_timezone_set')) date_default_timezone_set($timezone); ?> <tr> <td><input type='checkbox' name="update[]" value="<?php echo $row['rollno']; ?>"> </td> <td><?php echo $cnt;?></td> <td><?php echo strtoupper($row['rollno']);?></td> <td><?php echo strtoupper($row['stname']);?></td> <td><?php echo $row['shortcode'];?></td> <td><?php echo $row['libcardno'];?></td> <td><?php echo $row['renewal1'];?></td> <td> <?php if ($row['renewal2']==0) { echo '<span class="badge badge-danger text-small">Not Renewed</span>';; } else{ echo $row['renewal2']; } ?></td> <td> </td> </tr> <?php $cnt++; } }?> <!-- return area starts --> <!-- return area ends --> </tbody> </table> </div> <!-- outstanding area ends --> <div class="row"> <div class="col-sm-4"> <label for="mm">Select Renewal Date <span class="text-danger">*</span></label> </div> <div class="col-sm-4"> <input type="date" class="form-control" name="renewdate" id="renewdate" required max="<?php echo date("Y-m-d"); ?>"> </div> <div class="col-sm-4"> <button type="submit" name="but_update" id="but_update" class="btn btn-success">UPDATE</button> </div> </div> </div> </div> </div></form> <!-- /.container-fluid --> </div> <!-- End of Main Content --> <!-- Footer --> <?php include_once('includes/footer.php');?> <!-- End of Footer --> </div> <!-- End of Content Wrapper --> </div> <!-- End of Page Wrapper --> <!-- Scroll to Top Button--> <?php include_once('includes/footer2.php');?> <!-- Bootstrap core JavaScript--> <script src="vendor/jquery/jquery.min.js"></script> <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script> <!-- Core plugin JavaScript--> <script src="vendor/jquery-easing/jquery.easing.min.js"></script> <!-- Custom scripts for all pages--> <script src="js/sb-admin-2.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 src="js/demo/datatables-demo.js"></script> <script type="text/javascript"> $(document).ready(function(){ // Check/Uncheck ALl $('#checkAll').change(function(){ if($(this).is(':checked')){ $('input[name="update[]"]').prop('checked',true); }else{ $('input[name="update[]"]').each(function(){ $(this).prop('checked',false); }); } }); // Checkbox click $('input[name="update[]"]').click(function(){ var total_checkboxes = $('input[name="update[]"]').length; var total_checkboxes_checked = $('input[name="update[]"]:checked').length; if(total_checkboxes_checked == total_checkboxes){ $('#checkAll').prop('checked',true); }else{ $('#checkAll').prop('checked',false); } }); }); </script> <script> $(document).ready( function () { $("#but_update").click(function(){ // var favorite = []; if($('#renewdate').val() == "") { alert("Select Date of Renewal"); return false; } // $.each($("input[name='sport']:checked"), function(){ // favorite.push($(this).val()); // }); var count_checked = $("[name='update[]']:checked").length; // count the checked rows if(count_checked == 0) { alert("Please select atlease one student to Renew Library card."); return false; } if(count_checked == 1) { alert("Student Selected: "+count_checked); } else { alert("Student Selected: "+count_checked); } // alert("My favourite sports are: " + favorite.join(", ")); }); }); </script> </body> </html> <?php } ?>