Server IP : 162.214.80.37 / Your IP : 216.73.216.83 Web Server : Apache System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : imyrqtmy ( 2189) PHP Version : 8.2.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0750) : /home2/imyrqtmy/public_html/thesmarthands/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php session_start(); if (!isset($_SESSION['id'])) { header("Location: login.php"); exit; } include("inc/config.php"); ?> <!DOCTYPE html> <html lang="en"> <?php require "inc/head.php"; ?> <body> <?php require "inc/header.php"; ?> <div class="wrapper"> <?php require "inc/sidebar.php"; ?> <div id="content"> <div class="row"> <div class="col-12 col-sm-12"> <form method="GET" class="mb-3"> <div class="row"> <div class="col-md-3"> <label for="start_date">Start Date:</label> <input type="date" name="start_date" id="start_date" class="form-control" value="<?php echo isset($_GET['start_date']) ? $_GET['start_date'] : ''; ?>"> </div> <div class="col-md-3"> <label for="end_date">End Date:</label> <input type="date" name="end_date" id="end_date" class="form-control" value="<?php echo isset($_GET['end_date']) ? $_GET['end_date'] : ''; ?>"> </div> <div class="col-md-3"> <label for="search">Search:</label> <input type="text" name="search" id="search" class="form-control" value="<?php echo isset($_GET['search']) ? $_GET['search'] : ''; ?>" placeholder="Enter keyword..."> </div> <div class="col-md-3 d-flex align-items-end mt-2"> <button type="submit" class="btn btn-primary">Filter</button> </div> </div> </form> <div class="row mb-4"> <div class="col-12 col-md-12"> <div class="card redial-border-light redial-shadow mb-4"> <div class="card-body"> <h6 class="header-title pl-3 redial-relative">Data Table</h6> <table id="example" class="table table-bordered" cellspacing="0" width="100%"> <thead> <tr> <th>#</th> <th>Task Name</th> <th>Employee</th> <th>Project</th> <th>PO No.</th> <th>Grand Total</th> <th>Actions</th> </tr> </thead> <tbody> <?php // Base query $query = " SELECT t.*, p.project_name, e.photo, e.mileage AS emp_mileage, e.trvl_rate, (e.mileage * e.trvl_rate) AS travel_amount FROM tasks t LEFT JOIN projects p ON t.project_name = p.id LEFT JOIN employees e ON t.emp_name = CONCAT(e.femp_name, ' ', e.lemp_name) WHERE 1 = 1"; // Apply date filter if (!empty($_GET['start_date']) && !empty($_GET['end_date'])) { $start_date = mysqli_real_escape_string($conn, $_GET['start_date']); $end_date = mysqli_real_escape_string($conn, $_GET['end_date']); $query .= " AND DATE(t.end_datetime) BETWEEN '$start_date' AND '$end_date'"; } // Apply search filter if (!empty($_GET['search'])) { $search = mysqli_real_escape_string($conn, $_GET['search']); $query .= " AND (t.task_name LIKE '%$search%' OR p.project_name LIKE '%$search%' OR t.emp_name LIKE '%$search%' OR t.po_no LIKE '%$search%')"; } $query_run = mysqli_query($conn, $query); if (!$query_run) { die("Query Error: " . mysqli_error($conn)); } if (mysqli_num_rows($query_run) > 0) { foreach ($query_run as $row) { $grand_total = (int)$row['total_amt'] + (int)$row['travel_amount']; ?> <tr> <td><?php echo $row['id']; ?></td> <td><?php echo htmlspecialchars($row['task_name']); ?></td> <td> <?php echo htmlspecialchars($row['emp_name']); ?> </td> <td><?php echo htmlspecialchars($row['project_name']); ?></td> <td><?php echo htmlspecialchars($row['po_no']); ?></td> <td>$ <?php echo number_format($grand_total, 2); ?></td> <td> <a href="info-task.php?id=<?php echo $row['id']; ?>" class="btn btn-info"> <i class="icofont icofont-info-circle"></i> </a> <a href="update-task.php?id=<?php echo $row['id']; ?>" class="btn btn-success"> <i class='fa fa-pencil'></i> </a> <form action="add_task.php" method="post" style="display:inline-block;"> <input type="hidden" name="delete_id" value="<?php echo $row['id']; ?>"> <input type="hidden"name="del_task" value="<?php echo $row['photo']; ?>"> <button type="submit" name="delete_task" class="btn btn-danger"> <i class='fa fa-trash'></i> </button> </form> </td> </tr> <?php }} else { ?> <tr> <td colspan="7" class="text-center text-danger">No records found.</td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> </div> </div> <a href="#" class="scrollup text-center redial-bg-primary redial-rounded-circle-50"> <h4 class="text-white mb-0"><i class="icofont icofont-long-arrow-up"></i></h4> </a> <script src="dist/js/plugins.min.js"></script> <script src="dist/js/common.js"></script> </body> </html>