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 : 18.191.120.103


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

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

<div style="margin-bottom: 5px;" class="head_blue">Work Entry</div>
<ul class="nav nav-tabs">
    <li class="active"><a data-toggle="tab" href="#work_pend_self">Pending Work Entry</a></li>
    <li><a data-toggle="tab" href="#work_pend_empl">Pending Work Entry (Staff)</a></li>
    <li><a data-toggle="tab" href="#work_entr_self">Recent Work Entry</a></li>
    <li><a data-toggle="tab" href="#work_entr_empl">Recent Work Entry (Staff)</a></li>
</ul>

<div class="tab-content" id="home-content-note">
    <div id="work_pend_self" class="tab-pane fade in active">
        <?php
        $mysql = "select 
        concat('[',em.femplcode,'] ',em.femplname) as femplname,
        concat('[',em.fdeptcode,'] ',dp.fdeptname) as fdeptname,
        date_format(fattndate,'%Y %M') as fattnmnth,count(*) as fworkpend
        from masempl em 
        inner join attendance ad on ad.femplcode = em.femplcode
        inner join masdept dp on em.fdeptcode = dp.fdeptcode
        left join workentry wk on ad.femplcode = wk.femplcode and ad.fattndate = wk.fworkdate and ifnull(wk.fdelestat,'F')='F' 
        where em.femplstat='T' and em.fworkentr='T' and fattnstat in ('PR','PH','HW') 
        and ad.fattndate > '2021-12-31' and em.femplcode='$empl_id' and wk.femplcode is null 
        group by em.femplcode,left(fattndate,7) desc;";
        $myres = mysqli_query($mycon, $mysql);
        if (mysqli_num_rows($myres) > 0) {
            echo "<table class='table table-default'>";
            echo "<tr>";
            echo "<th class='text-right'>#</th>";
            echo "<th class='text-left col-sm-2'>Month</th>";
            echo "<th class='text-left col-sm-4'>Empl Name</th>";
            echo "<th class='text-left col-sm-4'>Client</th>";
            echo "<th class='text-left col-sm-2'>Pending</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[fattnmnth]</td>";
                echo "<td class='text-left'> $myrow[femplname]</td>";
                echo "<td class='text-left'> $myrow[fdeptname]</td>";
                echo "<td class='text-left'> $myrow[fworkpend]</td>";
                echo "</tr>";
                $i++;
            }
            echo "</table>";
        }
        
        $mysql = "select 
        concat('[',em.femplcode,'] ',em.femplname) as femplname,
        concat('[',em.fdeptcode,'] ',dp.fdeptname) as fdeptname,
        date_format(ad.fattndate,'%d/%m/%Y') as fworkdate
        from masempl em 
        inner join attendance ad on em.femplcode = ad.femplcode and fattnstat in ('PR','PH','HW')
        inner join masdept dp on em.fdeptcode = dp.fdeptcode
        left join workentry wk on ad.femplcode = wk.femplcode and wk.fworkdate = ad.fattndate and ifnull(wk.fdelestat,'F')='F' 
        where em.femplstat='T' and em.fworkentr='T' and em.fempltype='P' and ad.fattndate > '2021-12-31'  and em.femplcode='$empl_id' and wk.femplcode is null
        order by ad.fattndate desc;";
        $myres = mysqli_query($mycon, $mysql);
        if (mysqli_num_rows($myres) != 0) {
            echo "<table class='table table-striped table-condensed'>";
            echo "<tr>";
            echo "<th class='text-right'>#</th>";
            echo "<th class='text-left col-sm-2'>Date</th>";
            echo "<th class='text-left col-sm-4'>Empl. Name</th>";
            echo "<th class='text-left col-sm-4'>Client</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[fworkdate]</td>";
                echo "<td class='text-left'> $myrow[femplname]</td>";
                echo "<td class='text-left'> $myrow[fdeptname]</td>";
                echo "<td class='text-left'> Work Entry Pending</td>";
                echo "</tr>";
                $i++;
            }
            echo "</table>";
        } else {
            echo "<div class='alert alert-info'>No work entry pending!</div>";
        }
        ?>
    </div>


    <div id="work_pend_empl" class="tab-pane fade">
        <?php
        $mysql = "select 
        concat('[',em.femplcode,'] ',em.femplname) as femplname,
        concat('[',em.fdeptcode,'] ',dp.fdeptname) as fdeptname,
        date_format(fattndate,'%Y %M') as fattnmnth,count(*) as fworkpend
        from masempl em 
        inner join attendance ad on ad.femplcode = em.femplcode
        inner join masdept dp on ad.fdeptcode = dp.fdeptcode
        left join workentry wk on ad.femplcode = wk.femplcode and ad.fattndate = wk.fworkdate and ifnull(wk.fdelestat,'F')='F' 
        where em.femplstat='T' and em.fworkentr='T' and fattnstat in ('PR','PH','HW') 
        and ad.fattndate > '2021-12-31' and em.frepthead='$empl_id' and wk.femplcode is null 
        group by em.femplcode,left(fattndate,7) desc,ad.fdeptcode;";
        $myres = mysqli_query($mycon, $mysql);
        if (mysqli_num_rows($myres) > 0) {
            echo "<table class='table table-default'>";
            echo "<tr>";
            echo "<th class='text-right'>#</th>";
            echo "<th class='text-left col-sm-2'>Month</th>";
            echo "<th class='text-left col-sm-4'>Empl Name</th>";
            echo "<th class='text-left col-sm-4'>Client</th>";
            echo "<th class='text-left col-sm-2'>Pending</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[fattnmnth]</td>";
                echo "<td class='text-left'> $myrow[femplname]</td>";
                echo "<td class='text-left'> $myrow[fdeptname]</td>";
                echo "<td class='text-left'> $myrow[fworkpend]</td>";
                echo "</tr>";
                $i++;
            }
            echo "</table>";
        } else {
            echo "<div class='alert alert-info'>No work entry pending!</div>";
        }
        ?>
    </div>

    <div id="work_pend_today" class="tab-pane fade">
        <?php
        $myqry = "";
        if ($type_id == 'ADMIN') {
            $myqry = "";
        } elseif ($type_id == 'CHIEF') {
            $myqry = " and em.frepthead='$empl_id'";
        } else {
            $myqry = " and em.femplcode='$empl_id'";
        }

        $mysql = "select date_format(ad.fattndate,'%d/%m/%Y') as fworkdate, em.fdeptcode,fdeptname,fdeptshrt,em.femplcode,femplname
        from masempl em 
        inner join attendance ad on em.femplcode = ad.femplcode and ad.fattndate = current_date and fattnstat like 'PR' 
        left join masdept dp on em.fdeptcode = dp.fdeptcode
        left join workentry wk on wk.femplcode = em.femplcode and wk.fworkdate = ad.fattndate and ifnull(wk.fdelestat,'F')='F' 
        where em.femplstat='T' and em.fworkentr='T' and em.fempltype='P' and wk.femplcode is null" . $myqry . " order by fattndate desc,fdeptcode,femplname,fworkname";
        $myres = mysqli_query($mycon, $mysql);
        if (mysqli_num_rows($myres) != 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'>Date</th>";
            echo "<th class='text-left col-sm-3'>Empl. Name</th>";
            echo "<th class='text-left col-sm-6'>Client</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[fworkdate]</td>";
                echo "<td class='text-left'> [$myrow[femplcode]] $myrow[femplname]</td>";
                echo "<td class='text-left'>  [$myrow[fdeptcode]] $myrow[fdeptname]</td>";
                echo "<td class='text-left'> Work Entry Pending</td>";
                echo "</tr>";
                $i++;
            }
            echo "</table>";
        } else {
            echo "<div class='alert alert-info'>No work entry pending today!</div>";
        }
        ?>
    </div>

    <div id="work_pend_month" class="tab-pane fade">
        <?php
        $myqry = "";
        if ($type_id == 'ADMIN') {
            $myqry = "";
        } elseif ($type_id == 'CHIEF') {
            $myqry = " and em.frepthead='$empl_id'";
        } else {
            $myqry = " and em.femplcode='$empl_id'";
        }

        $mysql = "select date_format(fattndate,'%d/%m/%Y') as fworkdate, em.fdeptcode,fdeptname,fdeptshrt,em.femplcode,femplname
        from masempl em 
        inner join attendance ad on em.femplcode = ad.femplcode and date_format(ad.fattndate,'%m/%Y') = date_format(current_date,'%m/%Y') and fattnstat like 'PR' 
        left join masdept dp on em.fdeptcode = dp.fdeptcode
        left join workentry wk on wk.femplcode = em.femplcode and wk.fworkdate = ad.fattndate and ifnull(wk.fdelestat,'F')='F' 
        where em.femplstat='T' and em.fworkentr='T' and em.fempltype='P' and wk.femplcode is null" . $myqry . " order by fattndate desc,fdeptcode,femplname,fworkname";
        $myres = mysqli_query($mycon, $mysql);
        if (mysqli_num_rows($myres) != 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'>Date</th>";
            echo "<th class='text-left col-sm-3'>Empl. Name</th>";
            echo "<th class='text-left col-sm-6'>Client</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[fworkdate]</td>";
                echo "<td class='text-left'> [$myrow[femplcode]] $myrow[femplname]</td>";
                echo "<td class='text-left'>  [$myrow[fdeptcode]] $myrow[fdeptname]</td>";
                echo "<td class='text-left'> Work Entry Pending</td>";
                echo "</tr>";
                $i++;
            }
            echo "</table>";
        } else {
            echo "<div class='alert alert-info'>No work entry pending in this month!</div>";
        }
        ?>
    </div>

    <div id="work_entr_today" class="tab-pane fade">
        <?php
        if ($type_id == 'ADMIN') {
            $myqry = "";
        } elseif ($type_id == 'CHIEF') {
            $myqry = " and em.frepthead='$empl_id'";
        } else {
            $myqry = " and em.femplcode='$empl_id'";
        }
        $mysql = "select date_format(wk.fworkdate,'%d/%m/%Y') as fworkdate, em.fdeptcode,fdeptname,fdeptshrt,em.femplcode,femplname,fworkname,fviewstat
        from workentry wk 
        left join masempl em on wk.femplcode = em.femplcode
        left join masdept dp on em.fdeptcode = dp.fdeptcode
        where wk.fworkdate = current_date  and ifnull(wk.fdelestat,'F')='F' " . $myqry . " 
        order by fworkdate desc,fdeptcode,femplname,fworkname";
        $myres = mysqli_query($mycon, $mysql);
        if (mysqli_num_rows($myres) != 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'>Date</th>";
            echo "<th class='text-left col-sm-3'>Empl. Name</th>";
            echo "<th class='text-left col-sm-2'>Location</th>";
            echo "<th class='text-left col-sm-4'>Work Name</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[fworkdate]</td>";
                echo "<td class='text-left'> [$myrow[femplcode]] $myrow[femplname]</td>";
                echo "<td class='text-left'> [$myrow[fdeptcode]] $myrow[fdeptshrt]</td>";
                echo "<td class='text-left'>$myrow[fworkname]</td>";
                echo "<td class='text-left'>$myrow[fviewstat]</td>";
                echo "</tr>";
                $i++;
            }
            echo "</table>";
        } else {
            echo "<div class='alert alert-info'>No work entry found today!</div>";
        }
        ?>
    </div>

    <div id="work_entr_month" class="tab-pane fade">
        <?php
        $myqry = "";
        if ($type_id == 'ADMIN') {
            $myqry = "";
        } elseif ($type_id == 'CHIEF') {
            $myqry = " and em.frepthead='$empl_id'";
        } else {
            $myqry = " and em.femplcode='$empl_id'";
        }
        $mysql = "select date_format(wk.fworkdate,'%d/%m/%Y') as fworkdate, em.fdeptcode,fdeptname,fdeptshrt,em.femplcode,femplname,fworkname,fviewstat
        from workentry wk 
        left join masempl em on wk.femplcode = em.femplcode
        left join masdept dp on em.fdeptcode = dp.fdeptcode
        where date_format(wk.fworkdate,'%m/%Y') = date_format(current_date,'%m/%Y') and ifnull(wk.fdelestat,'F')='F' " . $myqry . " 
        order by fworkdate desc,fdeptcode,femplname,fworkname";
        $myres = mysqli_query($mycon, $mysql);
        if (mysqli_num_rows($myres) != 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'>Date</th>";
            echo "<th class='text-left col-sm-3'>Empl. Name</th>";
            echo "<th class='text-left col-sm-2'>Client</th>";
            echo "<th class='text-left col-sm-4'>Work Name</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[fworkdate]</td>";
                echo "<td class='text-left'> [$myrow[femplcode]] $myrow[femplname]</td>";
                echo "<td class='text-left'> [$myrow[fdeptcode]] $myrow[fdeptshrt]</td>";
                echo "<td class='text-left'>$myrow[fworkname]</td>";
                echo "<td class='text-left'>$myrow[fviewstat]</td>";
                echo "</tr>";
                $i++;
            }
            echo "</table>";
        } else {
            echo "<div class='alert alert-info'>No work entry found in this month!</div>";
        }
        ?>
    </div>
</div>