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.118.33.239
Current Path : /var/www/html/oums/src/ |
| Current File : /var/www/html/oums/src/home_salary.php |
<?php
include("sys_connect.php");
include("sys_mainphp.php");
include("sys_session.php");
?>
<div style="margin-bottom: 5px;" class="head_blue">Salary</div>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#menu1">Last Month Status</a></li>
<li><a data-toggle="tab" href="#menu2">This Month Status</a></li>
<li><a data-toggle="tab" href="#menu3">Last Month Deductions</a></li>
<li><a data-toggle="tab" href="#menu4">This Month Deductions</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
date_format(current_date - interval 1 month,'%b %Y') as fsalrmnth,
d.fdeptcode,d.fdeptname,d.fdeptshrt,count(distinct a.femplcode) as fsalrempl,sum(ifnull(s.ftotlsalr,0)) as fsalrtotl
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') and a.fattnstat like 'p%'
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
group by d.fdeptcode order by fdeptname";
} elseif ($type_id == 'CHIEF') {
$mysql = "select
date_format(current_date - interval 1 month,'%b %Y') as fsalrmnth,
d.fdeptcode,d.fdeptname,d.fdeptshrt,count(distinct a.femplcode) as fsalrempl,sum(ifnull(s.ftotlsalr,0)) as fsalrtotl
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') and a.fattnstat like 'p%'
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
group by d.fdeptcode order by fdeptname";
} else {
$mysql = "select
date_format(current_date - interval 1 month,'%b %Y') as fsalrmnth,
d.fdeptcode,d.fdeptname,d.fdeptshrt,count(distinct a.femplcode) as fsalrempl,sum(ifnull(s.ftotlsalr,0)) as fsalrtotl
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') and a.fattnstat like 'p%'
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'
group by d.fdeptcode order by fdeptname";
}
$myres = mysqli_query($mycon, $mysql);
echo "<table class='table table-striped table-condensed'>";
echo "<tr>";
echo "<th class='text-right'>#</th>";
echo "<th class='text-left col-sm-1'> Month</th>";
echo "<th class='text-left col-sm-7'> Client</th>";
echo "<th class='text-right col-sm-1'> Total Empl.</th>";
echo "<th class='text-right col-sm-1'> Total Salary</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[fsalrmnth]</td>";
echo "<td class='text-left'> [$myrow[fdeptcode]] $myrow[fdeptname]</td>";
echo "<td class='text-right'> $myrow[fsalrempl]</td>";
echo "<td class='text-right'> $myrow[fsalrtotl]</td>";
echo "<td class='text-left'>" . ($myrow['fsalrtotl'] > 0 ? 'Computed' : 'Not Computed') . "</td>";
echo "</tr>";
$i++;
}
echo "</table>";
?>
</div>
<div id="menu2" class="tab-pane fade">
<?php
if ($type_id == 'ADMIN') {
$mysql = "select
date_format(current_date,'%b %Y') as fsalrmnth,
d.fdeptcode,d.fdeptname,d.fdeptshrt,count(distinct a.femplcode) as fsalrempl,sum(ifnull(s.ftotlsalr,0)) as fsalrtotl
from masdept d
inner join attendance a on d.fdeptcode = a.fdeptcode and left(a.fattndate,7)=date_format(current_date,'%Y-%m') and a.fattnstat like 'p%'
left join salary s on d.fdeptcode = s.fdeptcode and s.fsalrmnth=date_format(current_date,'%Y-%m')
where fsalrenbl ='T' and s.fdeptcode is null
group by d.fdeptcode order by fdeptname";
} elseif ($type_id == 'CHIEF') {
$mysql = "select
date_format(current_date,'%b %Y') as fsalrmnth,
d.fdeptcode,d.fdeptname,d.fdeptshrt,count(distinct a.femplcode) as fsalrempl,sum(ifnull(s.ftotlsalr,0)) as fsalrtotl
from masdept d
inner join attendance a on d.fdeptcode = a.fdeptcode and left(a.fattndate,7)=date_format(current_date,'%Y-%m') and a.fattnstat like 'p%'
left join salary s on d.fdeptcode = s.fdeptcode and s.fsalrmnth=date_format(current_date,'%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
group by d.fdeptcode order by fdeptname";
} else {
$mysql = "select
date_format(current_date,'%b %Y') as fsalrmnth,
d.fdeptcode,d.fdeptname,d.fdeptshrt,count(distinct a.femplcode) as fsalrempl,sum(ifnull(s.ftotlsalr,0)) as fsalrtotl
from masdept d
inner join attendance a on d.fdeptcode = a.fdeptcode and left(a.fattndate,7)=date_format(current_date,'%Y-%m') and a.fattnstat like 'p%'
left join salary s on d.fdeptcode = s.fdeptcode and s.fsalrmnth=date_format(current_date,'%Y-%m')
where fsalrenbl ='T' and s.fdeptcode is null and d.fdeptcode ='$dept_id'
group by d.fdeptcode order by fdeptname";
}
$myres = mysqli_query($mycon, $mysql);
echo "<table class='table table-striped table-condensed'>";
echo "<tr>";
echo "<th class='text-right'>#</th>";
echo "<th class='text-left col-sm-1'> Month</th>";
echo "<th class='text-left col-sm-7'> Client</th>";
echo "<th class='text-right col-sm-1'> Total Empl.</th>";
echo "<th class='text-right col-sm-1'> Total Salary</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[fsalrmnth]</td>";
echo "<td class='text-left'> [$myrow[fdeptcode]] $myrow[fdeptname]</td>";
echo "<td class='text-right'> $myrow[fsalrempl]</td>";
echo "<td class='text-right'> $myrow[fsalrtotl]</td>";
echo "<td class='text-left'>" . ($myrow['fsalrtotl'] > 0 ? 'Computed' : 'Not Computed') . "</td>";
echo "</tr>";
$i++;
}
echo "</table>";
?>
</div>
<!-- Prev month salary deduct -->
<div id="menu3" class="tab-pane fade">
<?php
if ($type_id == "ADMIN") {
$mysql = "select
date_format(current_date - interval 1 month,'%b %Y') as fsalrmnth,
at.fdeptcode,fdeptname,fdeptshrt,at.femplcode,femplname,count(*) as ftotlabnt, count(*)-1 as ftotlless
from attendance at
inner join masdept dp on at.fdeptcode = dp.fdeptcode
inner join masempl em on at.femplcode = em.femplcode
where fattnstat in ('AB','CL') and date_format(fattndate,'%m-%Y') = date_format(current_date - interval 1 month ,'%m-%Y')
group by at.fdeptcode,at.femplcode having count(*)>1";
} else {
$mysql = "select
date_format(current_date - interval 1 month,'%b %Y') as fsalrmnth,
at.fdeptcode,fdeptname,fdeptshrt,at.femplcode,femplname,count(*) as ftotlabnt, count(*)-1 as ftotlless
from attendance at
inner join masdept dp on at.fdeptcode = dp.fdeptcode
inner join masempl em on at.femplcode = em.femplcode
inner join masdept_user du on ad.fdeptcode = du.fdeptcode and du.fusercode = '$user_id'
where fattnstat in ('AB','CL') and date_format(fattndate,'%m-%Y') = date_format(current_date - interval 1 month ,'%m-%Y')
group by at.fdeptcode,at.femplcode having count(*)>1";
}
$myres = mysqli_query($mycon, $mysql);
if (mysqli_num_rows($myres) != 0) {
echo "<table class='table table-striped table-condensed table-hover'>";
echo "<tr>";
echo "<th class='text-right'>#</th>";
echo "<th class='text-left col-sm-1'>Month</th>";
echo "<th class='text-left col-sm-6'>Client</th>";
echo "<th class='text-left col-sm-3'>Empl. Name</th>";
echo "<th class='text-right col-sm-1'>Total AB / CL</th>";
echo "<th class='text-right col-sm-1'>Deductions</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[fsalrmnth]</td>";
echo "<td class='text-left'> [$myrow[fdeptcode]] $myrow[fdeptname]</td>";
echo "<td class='text-left'> $myrow[femplname]</td>";
echo "<td class='text-right'> $myrow[ftotlabnt]</td>";
echo "<td class='text-right'> $myrow[ftotlless]</td>";
echo "</tr>";
$i++;
}
echo "</table>";
} else {
echo "<div class='alert alert-info'>No details found!</div>";
}
?>
</div>
<!-- This month salary deduct -->
<div id="menu4" class="tab-pane fade">
<?php
if ($type_id == "ADMIN") {
$mysql = "select
date_format(current_date,'%b %Y') as fsalrmnth,
at.fdeptcode,fdeptname,fdeptshrt,at.femplcode,femplname,count(*) as ftotlabnt, count(*)-1 as ftotlless
from attendance at
inner join masdept dp on at.fdeptcode = dp.fdeptcode
inner join masempl em on at.femplcode = em.femplcode
where fattnstat in ('AB','CL') and date_format(fattndate,'%m-%Y') = date_format(current_date,'%m-%Y')
group by at.fdeptcode,at.femplcode having count(*)>1";
} else {
$mysql = "select
date_format(current_date,'%b %Y') as fsalrmnth,
at.fdeptcode,fdeptname,fdeptshrt,at.femplcode,femplname,count(*) as ftotlabnt, count(*)-1 as ftotlless
from attendance at
inner join masdept dp on at.fdeptcode = dp.fdeptcode
inner join masempl em on at.femplcode = em.femplcode
inner join masdept_user du on ad.fdeptcode = du.fdeptcode and du.fusercode = '$user_id'
where fattnstat in ('AB','CL') and date_format(fattndate,'%m-%Y') = date_format(current_date,'%m-%Y')
group by at.fdeptcode,at.femplcode having count(*)>1";
}
$myres = mysqli_query($mycon, $mysql);
if (mysqli_num_rows($myres) != 0) {
echo "<table class='table table-striped table-condensed table-hover'>";
echo "<tr>";
echo "<th class='text-right'>#</th>";
echo "<th class='text-left col-sm-1'>Month</th>";
echo "<th class='text-left col-sm-6'>Client</th>";
echo "<th class='text-left col-sm-3'>Empl. Name</th>";
echo "<th class='text-right col-sm-1'>Total AB / CL</th>";
echo "<th class='text-right col-sm-1'>Deductions</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[fsalrmnth]</td>";
echo "<td class='text-left'> [$myrow[fdeptcode]] $myrow[fdeptname]</td>";
echo "<td class='text-left'> $myrow[femplname]</td>";
echo "<td class='text-right'> $myrow[ftotlabnt]</td>";
echo "<td class='text-right'> $myrow[ftotlless]</td>";
echo "</tr>";
$i++;
}
echo "</table>";
} else {
echo "<div class='alert alert-info'>No details found!</div>";
}
?>
</div>
</div>
|