ok
Direktori : /home/ngwcolle/public_html/mis/admin/ |
Current File : //home/ngwcolle/public_html/mis/admin/bill_aquittance.php |
<?php include('includes/checklogin.php'); check_login(); // error_reporting(E_ALL); // error_reporting(1); // if (isset($_GET['delid'])) { // $rid = intval($_GET['delid']); // $sql = "UPDATE tblemployee set status='0' where id=:rid"; // // echo $sql; // $query = $dbh->prepare($sql); // $query->bindParam(':rid', $rid, PDO::PARAM_STR); // $query->execute(); // if ($query->execute()) { // echo "<script>alert('User blocked');</script>"; // echo "<script>window.location.href = 'employee_register.php'</script>"; // } else { // echo '<script>alert("update failed! try again later")</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, shrink-to-fit=no"> <meta name="description" content=""> <meta name="author" content=""> <link href="img/logo/logo.png" rel="icon"> <title>Admin - Emplyee Register</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">Employee</h1> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="dashboard.php">Home</a></li> <li class="breadcrumb-item active" aria-current="page">employee Register</li> </ol> </div> <div class="row"> <div class="col-lg-12 mb-4"> <!-- Simple Tables --> <div class="card"> <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">Employee/HR/Staff Register</h6> <div class="card-tools" style="float: right;"> <!-- <button type="button" class="btn btn-sm btn-info" data-toggle="modal" data-target="#delete" ></i> Blocked users </button> --> <button type="button" class="btn btn-sm btn-success" data-toggle="modal" data-target="#registeruser"><i class="fas fa-plus"></i> Add New Employee </button> </div> </div> <div class="modal fade" id="registeruser"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">Add New Employee</h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <!-- <p>One fine body…</p> --> <?php @include("newemployee_form.php"); ?> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <div class="modal fade" id="delete"> <div class="modal-dialog modal-xl "> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">Deleted user</h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <!-- <p>One fine body…</p> --> <?php @include("deleted_users.php"); ?> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <!-- start modal --> <div id="editData" class="modal fade"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Edit Employee info</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body" id="info_update"> <?php @include("update_employee.php"); ?> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> </div> <!-- end modal --> <!-- search area --> <form class="form-group" action="" method="post"> <h5 class="p-0 text-center">Bill Process</h5> <div class="row p-3"> <div class="col-md-4"> <div class="form-group"> <select name="emptype" class="form-control" id="emptype" required> <option value="">--Select Employee Category--</option> <option value="Regular">Regular</option> <option value="Adhoc">Adhoc</option> <option value="Contractual">Contractual</option> <option value="Outsourcing">Outsourcing</option> <option value="Guest">Guest</option> </select> <!-- <input type="text" class="form-control" onfocus="(this.type='date')" name="pfrom" placeholder="Select Period from" required> --> </div> </div> <div class="col-md-4"> <div class="form-group "> <select name="empdept" class="form-control" id="empdept" required> <option value="">--Select Employee Type--</option> <option value="Teaching">Teaching</option> <option value="Non-Teaching">Non-Teaching</option> </select> <!-- <input type="text" class="form-control" onfocus="(this.type='date')" name="pto" placeholder="Select period To" required> --> </div> </div> <div class="col-md-4"><button type="submit" class="btn btn-dark" name="search">Search</button> <button type="button" onClick="window.location.href = 'bill_aquittance.php'" class="btn btn-danger" name="search">Reset</button> </div> </div> </form> <!-- search area --> <form class="form-inline" action="" method="post"> <div class="table-responsive p-2"> <table class="table table-sm table-hover" id="dataTableHover11"> <thead> <tr> <th><input type='checkbox' id='checkAll'></th> <th class="text-center">No.</th> <th class="">Emplyee Name</th> <th class="">Designation</th> <th class="">Category</th> <th class="">Dept</th> <th class="text-center">BasicPay</th> <?php // $sql = "SELECT tblaccount.accounthead as acchad,txdate,tbltrans.accounthead,remark,paidto,sum(IF(txtype = 'Dr', txamount, NULL)) AS `credit`,sum(IF(txtype = 'Cr', txamount, NULL)) AS `Debit` FROM tbltrans INNER join tblaccount on tbltrans.accounthead=tblaccount.id where tbltrans.isyearclose='0' GROUP BY txdate,tbltrans.accounthead"; if (isset($_POST['search'])) { $sql = ""; $pfrom = $_POST['emptype']; $pto = $_POST['empdept']; } $sql = "SELECT * FROM tblemployee WHERE emptype='$pfrom' AND empdept='$pto' AND status='1'"; // $sql="SELECT pmtdate,remark,pmtmode,txrefno,party,MAX(IF(drcr = '1', amount, NULL)) AS `credit`,MAX(IF(drcr = '2', amount, NULL)) AS `Debit` FROM tbltrans GROUP BY pmtdate"; $query = $dbh->prepare($sql); $query->execute(); $results = $query->fetchAll(PDO::FETCH_OBJ); $cnt = 1; if ($query->rowCount() > 0) { foreach ($results as $result) { ?> </tr> </thead> <tbody> <tr> <td> <input type='checkbox' name='update[]' value='<?php echo $result->id; ?>'> </td> <td><?php echo $cnt; ?></td> <td><?php echo htmlentities($result->empname); ?> <input type='text' name='fname_<?php echo $result->id ?>' value='<?php echo htmlentities($result->id) ?>'> </td> <td><?php echo htmlentities($result->designation); ?></td> <td><?php echo htmlentities($result->emptype); ?></td> <td><?php echo htmlentities($result->empdept); ?></td> <td><?php echo htmlentities($result->basicpay); ?> <input type='text' name='basicpay_<?php echo $result->id ?>' value='<?php echo $result->basicpay ?>'> </td> </tr> <?php $cnt = $cnt + 1; } } ?> </tbody> </table> </div> <div class="card-footer"> <div class="row p-3"> <label class="sr-only" for="inlineFormInputName2">Year</label> <select name="year" id="" class="form-control pr-2 mr-4 input-sm" required> <option value="">--Select Year--</option> <?php // get current year $curYear = date('Y'); // create range of required years and iterate over them foreach(range($curYear - 5, $curYear) as $year) { echo "<option value='$year'>$year</option>"; } ?> </select> <label class="sr-only" for="inlineFormInputGroupUsername2">Username</label> <div class="input-group mb-2 mr-2"> <select name="month" id="" class="form-control" required> <option value="">--Select Month--</option> <option value="January">January</option> <option value="February">February</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option> </select> </div> <input type='submit' value='Process Bill' name='but_update' class="btn btn-primary mb-2"> </div> </div> </form> </div> </div> </div> <?php if (isset($_POST['but_update'])) { $cart = array(); $year = $_POST['year']; if (isset($_POST['update'])) { foreach ($_POST['update'] as $updateid) { $fname = $_POST['fname_' . $updateid]; $basicpay = $_POST['basicpay_' . $updateid]; // $lname = $_POST['lname_'.$updateid]; // $age = $_POST['age_'.$updateid]; // $salary = $_POST['salary_'.$updateid]; // $email = $_POST['email_'.$updateid]; // echo $fname; $count = $dbh->prepare("select * from tblbill where year='$year' and empcode='$fname'"); //$count=$dbo->prepare("delete from pdo_admin where status='F'"); $count->execute(); $no = $count->rowCount(); if ($no > 0) { // echo $fname."Already exist"; array_push($cart, $fname); } else { $sql1 = "INSERT INTO tblbill(year,empcode,basicpay) VALUES('$year','$fname','$basicpay')"; $dbh->exec($sql1); } // if($fname !='' && $lname !='' && $age >0 && $salary >0 && $email != '' ){ // $updateUser = "UPDATE users SET // fname='".$fname."',lname='".$lname."', // age=".$age.",salary=".$salary.",email='".$email."' // WHERE id=".$updateid; // mysqli_query($con,$updateUser); // } } if(isset($cart)){ // echo $cart; echo '<div class="alert alert-danger">'; foreach ($cart as $key=>$item){ echo "Employee Code $item 's Bill already Processed<br>"; } echo '</div>'; } } else{ echo '<div class="alert alert-warning">'; echo "Select Employee for Bill Process"; echo '</div>'; } } ?> <!--Row--> <?php include('includes/modal.php'); ?> </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> <script src="vendor/datatables/jquery.dataTables.min.js"></script> <script src="vendor/datatables/dataTables.bootstrap4.min.js"></script> <script> $(document).ready(function() { $('#dataTable').DataTable(); // ID From dataTable $('#dataTableHover1').DataTable(); // ID From dataTable with Hover }); </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> </body> </html>