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.188.245.104


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

<?php

include("sys_session.php");
include("sys_connect.php");
include("sys_mainphp.php");

$resp_mesg = "";
$resp_stat = "";
$resp_file = "";

if ($_POST["load_data"] == 'empl_data') {
    if ($type_id == 'ADMIN') {
        $mysql = "select distinct em.femplcode,femplname from masempl em
        inner join expenses ex on em.femplcode = ex.femplcode
        order by femplname";
    } elseif ($type_id == 'CHIEF') {
        $mysql = "select distinct em.femplcode,femplname from masempl em
        inner join expenses ex on em.femplcode = ex.femplcode
        inner join masdept_user du on em.fdeptcode = du.fdeptcode
        where du.fusercode='$user_id' order by femplname";
    } else {
        $mysql = "select femplcode,femplname from masempl where femplcode='$empl_id' order by femplname";
    }

    $myres = mysqli_query($mycon, $mysql);
    if (mysqli_num_rows($myres) > 1) {
        echo "<option value='%'>ALL [EMPLOYEES]</option>";
    }
    while ($myrow = mysqli_fetch_assoc($myres)) {
        echo "<option value='$myrow[femplcode]'>$myrow[femplname] [$myrow[femplcode]]</option>";
    }
}

if ($_POST["load_data"] == 'clnt_data') {
    $mysql = "select distinct ct.fclntcode as fclntcode,fclntname from masclient ct 
    inner join expenses ex on ex.fclntcode = ct.fclntcode 
    where ex.femplcode like '$_POST[empl_code]'
    order by fclntname;";
    $myres = mysqli_query($mycon, $mysql);
    if (mysqli_num_rows($myres) > 1) {
        echo "<option value='%'>ALL [CLIENTS]</option>";
    }
    while ($myrow = mysqli_fetch_assoc($myres)) {
        echo "<option value='$myrow[fclntcode]'>$myrow[fclntname] [$myrow[fclntcode]]</option>";
    }
}

if ($_POST["load_data"] == 'head_desc') {
    $acnt_type = $_POST["acnt_type"];
    if ($acnt_type != "") {
        $mysql = "select * from mashead where facnttype like '$acnt_type' order by facnttype,fheaddesc";
        $myres = mysqli_query($mycon, $mysql);
        if (mysqli_num_rows($myres) != 0) {
            echo "<option value='%'>ALL [HEADS]</option>";
            while ($myrow = mysqli_fetch_assoc($myres)) {
                echo "<option value='$myrow[fheaddesc]'>$myrow[fheaddesc] [$myrow[facnttype]]</option>";
            }
        }
    }
}

if ($_POST["load_data"] == 'expn_mnth') {
    $mysql = "select date_format(fexpndate,'%Y-%m') as fexpnmnth, date_format(fexpndate,'%Y %M') as fdispmnth 
    from expenses where femplcode like '$_POST[empl_code]'  
    group by fexpnmnth order by fexpnmnth desc;";
    $myres = mysqli_query($mycon, $mysql);
    if (mysqli_num_rows($myres) != 0) {
        echo "<option value=''>--SELECT--</option>";
        while ($myrow = mysqli_fetch_assoc($myres)) {
            echo "<option value='$myrow[fexpnmnth]'>$myrow[fdispmnth]</option>";
        }
    }
}

if ($_POST["load_data"] == 'expn_year') {
    $mysql = "select left(fexpndate,4) from expenses where femplcode like '$_POST[empl_code]' group by left(fexpndate,4)";
    $myres = mysqli_query($mycon, $mysql);
    if (mysqli_num_rows($myres) != 0) {
        echo "<option value=%>ALL [YEARS]</option>";
        while ($myrow = mysqli_fetch_assoc($myres)) {
            echo "<option value='$myrow[fheaddesc]'>$myrow[fheaddesc] [$myrow[facnttype]]</option>";
        }
    }
}