MMCT TEAM
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 (0755) :  /home2/imyrqtmy/public_html/dts/vendor/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/public_html/dts/vendor/report.php
<?php
session_start();
error_reporting(0); 
ini_set('display_errors', 0); 
$se = $_SESSION["id"];
if (!isset($_SESSION['id'])) {
    header("Location: login.php");
}
include("inc/config.php");
?>

<!DOCTYPE html>
<html lang="en">
    
<?php require "inc/head.php"; ?>

<body>
    <!-- header-->
    <?php require "inc/header.php"; ?>
    <!-- End header-->

    <div class="wrapper">
        <?php require "inc/sidebar.php"; ?>
        <div id="content">
            <div class="row mb-4">
                <div class="col-12 col-sm-12">
                    <div class="row">
                        <div class="col-12 col-md-12 mb-4">
                            <div class="card redial-border-light redial-shadow">
                                <div class="card-body">
                                    <table id="invoiceTable" class="table table-bordered">
                                        <thead>
                                            <tr>
                                                <td class="text-center" colspan="4"><b>Report</b></td>
                                            </tr>
                                            <tr>
                                                <td><b>Project Name</b></td>
                                                <td><b>Task Name</b></td>
                                                <td><b>Employee Name</b></td>
                                                <td><b>Total Cost</b></td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php
                                            $id = $_GET['id'];
                                            $query = "SELECT * FROM projects WHERE id='$id'";
                                            $query_run = mysqli_query($conn, $query);
                                            $sub_total = 0; // Variable to store the subtotal

                                            if (mysqli_num_rows($query_run) > 0) {
                                                foreach ($query_run as $row) {
                                                    $project_id = $row['id'];

                                                    $task_query = "
                                                        SELECT 
                                                            t.task_name, 
                                                            t.project_name, 
                                                            t.emp_name, 
                                                            t.grand_total 
                                                        FROM tasks t
                                                        LEFT JOIN employees e ON t.emp_name = CONCAT(e.femp_name, ' ', e.lemp_name)
                                                        WHERE t.project_name = '$project_id' AND t.status = 'Complete'
                                                    ";
                                                    $task_result = mysqli_query($conn, $task_query);

                                                    if (mysqli_num_rows($task_result) > 0) {
                                                        while ($task_row = mysqli_fetch_assoc($task_result)) {
                                                            $sub_total += $task_row['grand_total']; // Accumulate subtotal
                                                            ?>
                                                            <tr>
                                                                <td><?php echo $row['project_name']; ?></td>
                                                                <td><?php echo $task_row['task_name']; ?></td>
                                                                <td><?php echo $task_row['emp_name']; ?></td>
                                                                <td><?php echo number_format($task_row['grand_total'], 2); ?> Rs</td>
                                                            </tr>
                                                            <?php
                                                        }
                                                    } else {
                                                        echo "<tr><td colspan='4' class='text-center'>No tasks found for this project</td></tr>";
                                                    }
                                                }
                                            } else {
                                                echo "<tr><td colspan='4' class='text-center'>No projects found</td></tr>";
                                            }
                                            ?>
                                        </tbody>
                                        <tfoot>
                                            <tr>
                                                <td colspan="3" class="text-right"><b>Sub-Total:</b></td>
                                                <td><b><?php echo number_format($sub_total, 2); ?> Rs</b></td>
                                            </tr>
                                        </tfoot>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- End main-content-->

    <!-- Top To Bottom-->
    <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>
    <!-- End Top To Bottom-->

    <!-- jQuery -->
    <script src="dist/js/plugins.min.js"></script>       
    <script src="dist/js/common.js"></script>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/2.4.1/js/dataTables.buttons.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.print.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
</body>
</html>

MMCT - 2023