0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.145.65.133


Current Path : /var/www/html/oums/src/
Upload File :
Current File : /var/www/html/oums/src/home_task.php

<?php
include("sys_connect.php");
include("sys_mainphp.php");
include("sys_session.php");
?>

<div style="margin-bottom: 5px;" class="head_blue">Tasks</div>
<ul class="nav nav-tabs">
    <li class="active"><a data-toggle="tab" href="#menu1">Pending</a></li>
    <li><a data-toggle="tab" href="#menu2">Completed (Recent)</a></li>
</ul>

<div class="tab-content" id="home-content-note">
    <div id="menu1" class="tab-pane fade in active">
        <?php
        if ($type_id == "ADMIN") {
            $mysql = "select ftaskname,ftaskasby,e1.femplname as fnameasby,ftaskasto,e2.femplname as fnameasto,ftaskstat,
            date_format(fstrtdate,'%d/%m/%Y') as fstrtdate,
            date_format(flastdate,'%d/%m/%Y') as flastdate,
            date_format(fcompdate,'%d/%m/%Y') as fcompdate,
            (case when flastdate<current_date then 'Due date exeeded' else '' end) as ltaskstat
            from taskreminder tk
            inner join masempl e1 on tk.ftaskasby = e1.femplcode
            inner join masempl e2 on tk.ftaskasto = e2.femplcode
            where ftaskstat='PENDING' and tk.fdeleted<>'T'
            order by ftaskcode";
        } else {
            $mysql = "select ftaskname,ftaskasby,e1.femplname as fnameasby,ftaskasto,e2.femplname as fnameasto,ftaskstat,
            date_format(fstrtdate,'%d/%m/%Y') as fstrtdate,
            date_format(flastdate,'%d/%m/%Y') as flastdate,
            date_format(fcompdate,'%d/%m/%Y') as fcompdate,
            (case when flastdate<current_date then 'Due date exeeded' else '' end) as ltaskstat
            from taskreminder tk
            inner join masempl e1 on tk.ftaskasby = e1.femplcode
            inner join masempl e2 on tk.ftaskasto = e2.femplcode
            where ftaskstat='PENDING' and tk.fdeleted<>'T' and (ftaskasby = '$empl_id' or ftaskasto = '$empl_id')
            order by ftaskcode";
        }
        $myres = mysqli_query($mycon, $mysql);
        $mycnt = mysqli_num_rows($myres);
        if ($mycnt > 0) {
            echo "<table class='table table-striped table-condensed'>";
            echo "<tr>";
            echo "<th class='text-right'>#</th>";
            echo "<th class='text-left col-sm-1'> Task Date</th>";
            echo "<th class='text-left col-sm-4'> Task Name</th>";
            echo "<th class='text-left col-sm-2'> Assigned By</th>";
            echo "<th class='text-left col-sm-2'> Assigned To</th>";
            echo "<th class='text-left col-sm-1'> Due Date</th>";
            echo "<th class='text-left col-sm-2'> Remarks</th>";
            echo "</tr>";
            $i = 1;
            while ($myrow = mysqli_fetch_assoc($myres)) {
                echo "<tr>";
                echo "<td class='text-right'> $i.</td>";
                echo "<td class='text-left'> $myrow[fstrtdate]</td>";
                echo "<td class='text-left'> $myrow[ftaskname]</td>";
                echo "<td class='text-left'> $myrow[fnameasby]</td>";
                echo "<td class='text-left'> $myrow[fnameasto]</td>";
                echo "<td class='text-left'> $myrow[flastdate]</td>";
                echo "<td class='text-left'> $myrow[ltaskstat]</td>";
                echo "</tr>";
                $i++;
            }
            echo "</table>";
        } else {
            echo "<div class='alert alert-info'>No pending task's!</div>";
        }
        ?>
    </div>

    <div id="menu2" class="tab-pane fade">
        <?php
        if ($type_id == "ADMIN") {
            $mysql = "select ftaskname,ftaskasby,e1.femplname as fnameasby,ftaskasto,e2.femplname as fnameasto,ftaskstat,
            date_format(fstrtdate,'%d/%m/%Y') as fstrtdate,
            date_format(flastdate,'%d/%m/%Y') as flastdate,
            date_format(fcompdate,'%d/%m/%Y') as fcompdate
            from taskreminder tk
            inner join masempl e1 on tk.ftaskasby = e1.femplcode
            inner join masempl e2 on tk.ftaskasto = e2.femplcode
            where ftaskstat='COMPLETED' and tk.fdeleted<>'T'
            order by ftaskcode";
        } else {
            $mysql = "select ftaskname,ftaskasby,e1.femplname as fnameasby,ftaskasto,e2.femplname as fnameasto,ftaskstat,
            date_format(fstrtdate,'%d/%m/%Y') as fstrtdate,
            date_format(flastdate,'%d/%m/%Y') as flastdate,
            date_format(fcompdate,'%d/%m/%Y') as fcompdate
            from taskreminder tk
            inner join masempl e1 on tk.ftaskasby = e1.femplcode
            inner join masempl e2 on tk.ftaskasto = e2.femplcode
            where ftaskstat='COMPLETED' and tk.fdeleted<>'T' and (ftaskasby = '$empl_id' or ftaskasto = '$empl_id')
            order by ftaskcode";
        }
        $myres = mysqli_query($mycon, $mysql);
        $mycnt = mysqli_num_rows($myres);
        if ($mycnt > 0) {
            echo "<table class='table table-striped table-condensed'>";
            echo "<tr>";
            echo "<th class='text-right'>#</th>";
            echo "<th class='text-left col-sm-1'> Task Date</th>";
            echo "<th class='text-left col-sm-4'> Task Name</th>";
            echo "<th class='text-left col-sm-2'> Assigned By</th>";
            echo "<th class='text-left col-sm-2'> Assigned To</th>";
            echo "<th class='text-left col-sm-1'> Due Date</th>";
            echo "<th class='text-left col-sm-2'> Completed on</th>";
            echo "</tr>";
            $i = 1;
            while ($myrow = mysqli_fetch_assoc($myres)) {
                echo "<tr>";
                echo "<td class='text-right'> $i.</td>";
                echo "<td class='text-left'> $myrow[fstrtdate]</td>";
                echo "<td class='text-left'> $myrow[ftaskname]</td>";
                echo "<td class='text-left'> $myrow[fnameasby]</td>";
                echo "<td class='text-left'> $myrow[fnameasto]</td>";
                echo "<td class='text-left'> $myrow[flastdate]</td>";
                echo "<td class='text-left'> $myrow[fcompdate]</td>";
                echo "</tr>";
                $i++;
            }
            echo "</table>";
        } else {
            echo "<div class='alert alert-info'>No completed task's!</div>";
        }
        ?>
    </div>
</div>