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.144.6.9
Current Path : /var/www/html/oums/src/ |
| Current File : /var/www/html/oums/src/home_note_count.php |
<?php
include("sys_connect.php");
include("sys_mainphp.php");
include("sys_session.php");
//attendance
$xattn = 0;
if ($type_id == 'ADMIN') {
$myqry = " ";
} elseif ($type_id == 'CHIEF') {
$myqry = " inner join masdept_user du on at.fdeptcode = du.fdeptcode and du.fusercode = '$user_id' ";
} else {
$myqry = " inner join masdept dp on at.fdeptcode = dp.fdeptcode and dp.fdeptcode = '$dept_id' ";
}
$mysql = "select
sum(case when fattnstat='PR' then 1 else 0 end) as totpr,
sum(case when fattnstat='CL' then 1 else 0 end) as totcl,
sum(case when fattnstat='AB' then 1 else 0 end) as totab
from attendance at " . $myqry . "
where fattndate=current_date";
$myres = mysqli_query($mycon, $mysql);
$myrow = mysqli_fetch_assoc($myres);
$xattn = "Pr : " . $myrow['totpr'] . " | Cl : " . $myrow['totcl'] . " | Ab : " . $myrow['totab'];
//work status
$xwork = 0;
if ($type_id == 'ADMIN') {
$mysql = "select count(*) as fworkpend from masempl em
inner join attendance ad on em.femplcode = ad.femplcode and ad.fattndate = current_date and fattnstat like 'PR'
left join workentry wk on wk.femplcode = em.femplcode and wk.fworkdate = current_date
where em.femplstat='T' and em.fworkentr='T' and em.fempltype='P' and wk.femplcode is null";
} elseif ($type_id == 'CHIEF') {
$mysql = "select count(*) as fworkpend from masempl em
inner join attendance ad on em.femplcode = ad.femplcode and ad.fattndate = current_date and fattnstat like 'PR'
left join workentry wk on wk.femplcode = em.femplcode and wk.fworkdate = current_date
where em.femplstat='T' and em.fworkentr='T' and em.fempltype='P' and em.frepthead='$empl_id' and wk.femplcode is null";
} else {
$mysql = "select count(*) as fworkpend from masempl em
inner join attendance ad on em.femplcode = ad.femplcode and ad.fattndate = current_date and fattnstat like 'PR'
left join workentry wk on wk.femplcode = em.femplcode and wk.fworkdate = current_date
where em.femplstat='T' and em.fworkentr='T' and em.fempltype='P' and em.femplcode='$empl_id' and wk.femplcode is null";
}
$myres = mysqli_query($mycon, $mysql);
$myrow = mysqli_fetch_assoc($myres);
$xwork = $myrow['fworkpend'] . " Pending";
//work review
$xview = 0;
if ($type_id == 'ADMIN') {
$mysql = "select count(*) as fviewpend from workentry where fviewstat='PENDING';";
} else {
$mysql = "select count(*) as fviewpend from workentry where fviewstat='PENDING' and freptempl = '$empl_id' and ifnull(fdelestat,'F')='F';";
}
$myres = mysqli_query($mycon, $mysql);
$myrow = mysqli_fetch_assoc($myres);
$xview = $myrow['fviewpend'] . " Pending";
//salary
$xsalr = 0;
if ($type_id == 'ADMIN') {
$mysql = "select count(distinct d.fdeptcode) as fsalrpend from masdept d
inner join attendance a on d.fdeptcode = a.fdeptcode and left(a.fattndate,7)=date_format(current_date-interval 1 month,'%Y-%m')
left join salary s on d.fdeptcode = s.fdeptcode and s.fsalrmnth=date_format(current_date-interval 1 month,'%Y-%m')
where fsalrenbl ='T' and s.fdeptcode is null";
} elseif ($type_id == 'CHIEF') {
$mysql = "select count(distinct d.fdeptcode) as fsalrpend from masdept d
inner join attendance a on d.fdeptcode = a.fdeptcode and left(a.fattndate,7)=date_format(current_date-interval 1 month,'%Y-%m')
left join salary s on d.fdeptcode = s.fdeptcode and s.fsalrmnth=date_format(current_date-interval 1 month,'%Y-%m')
inner join masdept_user u on d.fdeptcode = u.fdeptcode and u.fusercode='$user_id'
where fsalrenbl ='T' and s.fdeptcode is null";
} else {
$mysql = "select count(distinct d.fdeptcode) as fsalrpend from masdept d
inner join attendance a on d.fdeptcode = a.fdeptcode and left(a.fattndate,7)=date_format(current_date-interval 1 month,'%Y-%m')
left join salary s on d.fdeptcode = s.fdeptcode and s.fsalrmnth=date_format(current_date-interval 1 month,'%Y-%m')
where fsalrenbl ='T' and s.fdeptcode is null and d.fdeptcode ='$dept_id'";
}
$myres = mysqli_query($mycon, $mysql);
$myrow = mysqli_fetch_assoc($myres);
$xsalr = $myrow['fsalrpend'] . " Dept's";
//expenses
$xexpn = 0;
if ($type_id == 'ADMIN') {
$mysql = "select ex.femplcode,
sum(case when facnttype='receipt' then fexpnamnt else 0 end) - sum(case when facnttype='payment' then fexpnamnt else 0 end) as ftotlbaln
from expenses ex
left join masempl em on ex.femplcode=em.femplcode
left join masdept dp on ex.fdeptcode=dp.fdeptcode
where ex.fdeptcode='$dept_id' group by ex.femplcode having ftotlbaln<>0";
} elseif ($type_id == 'CHIEF') {
$mysql = "select ex.femplcode,
sum(case when facnttype='receipt' then fexpnamnt else 0 end) - sum(case when facnttype='payment' then fexpnamnt else 0 end) as ftotlbaln
from expenses ex
left join masempl em on ex.femplcode=em.femplcode
left join masdept dp on ex.fdeptcode=dp.fdeptcode
where ex.fdeptcode='$dept_id' group by ex.femplcode having ftotlbaln<>0";
} else {
$mysql = "select ex.femplcode,
sum(case when facnttype='receipt' then fexpnamnt else 0 end) - sum(case when facnttype='payment' then fexpnamnt else 0 end) as ftotlbaln
from expenses ex
left join masempl em on ex.femplcode=em.femplcode
left join masdept dp on ex.fdeptcode=dp.fdeptcode
where ex.femplcode='$empl_id' group by ex.femplcode having ftotlbaln<>0";
}
$myres = mysqli_query($mycon, $mysql);
$myrow = mysqli_num_rows($myres);
$xexpn = $myrow . " Person's";
//events
$xbday = 0;
$mysql = "select count(*) as fevntpend from masempl
where (date_format(fbrthdate,'%d-%m') = date_format(current_date,'%d-%m') or
(date_format(fjoindate,'%d-%m') = date_format(current_date,'%d-%m'))) and femplstat='T'";
$myres = mysqli_query($mycon, $mysql);
$myrow = mysqli_fetch_assoc($myres);
$xbday = $myrow['fevntpend'] . " Events";
//Movement
$xmove = 0;
$mysql = "select count(*) as fmovestat from staffmove where fstrtdate >= current_date";
$myres = mysqli_query($mycon, $mysql);
$myrow = mysqli_fetch_assoc($myres);
$xmove = $myrow['fmovestat'] . " Move's";
//Task status
$xtask = 0;
if ($type_id == 'ADMIN') {
$mysql = "select count(*) as ftaskpend from taskreminder where ftaskstat='PENDING' and ftaskasby<>'' and ftaskasto<>'' and fdeleted<>'T'";
} else {
$mysql = "select count(*) as ftaskpend from taskreminder where ftaskstat='PENDING' and ftaskasby<>'' and ftaskasto<>'' and ftaskasto='$empl_id' and fdeleted<>'T' ";
}
$myres = mysqli_query($mycon, $mysql);
$myrow = mysqli_fetch_assoc($myres);
$xtask = $myrow['ftaskpend'] . " Pending";
//appraisals
$xappr = 0;
echo json_encode(array("bday" => $xbday, "move" => $xmove, "task" => $xtask, "work" => $xwork, "view" => $xview, "attn" => $xattn, "salr" => $xsalr, "appr" => $xappr, "expn" => $xexpn));
|