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.21.46.13
<?php
include("sys_connect.php");
include("sys_mainphp.php");
include("sys_session.php");
if($type_id=='CHIEF')
{
$mysql ="select fdeptcode,femplcode,";
$mysql.="sum(case when facnttype='receipt' then fexpnamnt end) as totl_recp, ";
$mysql.="sum(case when facnttype='payment' then fexpnamnt end) as totl_payt from expenses ";
$mysql.="where femplcode in (select femplcode from masempl where fdeptcode='$dept_id' and femplstat='T') ";
$mysql.="group by fdeptcode,femplcode";
}
else
{
$mysql ="select fdeptcode,femplcode,";
$mysql.="sum(case when facnttype='receipt' then fexpnamnt end) as totl_recp, ";
$mysql.="sum(case when facnttype='payment' then fexpnamnt end) as totl_payt from expenses ";
$mysql.="where femplcode='$empl_id' group by fdeptcode,femplcode";
}
$myres = mysqli_query($mycon,$mysql) or die(mysqli_error($mycon));
echo "<table class='table table-striped table-condensed'>";
while($row = mysqli_fetch_assoc($myres))
{
$curr_date = date('d-M-Y');
$totl_baln = $row['totl_recp']-$row['totl_payt'];
$totl_baln = number_format((float)$totl_baln,2,'.','');
$empl_name = get_empl_name($row['femplcode']);
$mysql1 = "select fexpndate from expenses where femplcode='$row[femplcode]' order by fexpndate desc limit 1";
$myres1 = mysqli_query($mycon,$mysql1);
while($row1 = mysqli_fetch_assoc($myres1))
{
$curr_date = date('d-M-Y');
$expn_date = date('d-M-Y',strtotime($row1['fexpndate']));
}
echo "<tr>";
echo "<td><span class='glyphicon glyphicon-stats'></span></td>";
echo "<td class='text-left'>$curr_date</td>";
echo "<td class='text-left'>$row[fdeptcode] - $empl_name</td>";
echo "<td class='text-right'>₹ $totl_baln/- </td>";
echo "<td class='text-left'>[Last updated on $expn_date]</td>";
echo "</tr>";
}
if($type_id=='ADMIN')
{
$mysql="select fdeptcode,sum(case when facnttype='receipt' then fexpnamnt end) as totl_recp, sum(case when facnttype='payment' then fexpnamnt end) as totl_payt from expenses group by fdeptcode";
}
elseif($type_id=='CHIEF')
{
$mysql="select fdeptcode,sum(case when facnttype='receipt' then fexpnamnt end) as totl_recp, sum(case when facnttype='payment' then fexpnamnt end) as totl_payt from expenses where fdeptcode='$dept_id' group by fdeptcode";
}
$myres = mysqli_query($mycon,$mysql) or die(mysqli_error($mycon));
while($row = mysqli_fetch_assoc($myres))
{
$curr_date = date('d-M-Y');
$totl_baln = $row['totl_recp']-$row['totl_payt'];
$totl_baln = number_format((float)$totl_baln,2,'.','');
$mysql1 = "select fexpndate from expenses where fdeptcode='$row[fdeptcode]' order by fexpndate desc limit 1";
$myres1 = mysqli_query($mycon,$mysql1);
while($row1 = mysqli_fetch_assoc($myres1))
{
$expn_date = date('d-M-Y',strtotime($row1['fexpndate']));
}
echo "<tr>";
echo "<td><span class='glyphicon glyphicon-stats'></span></td>";
echo "<td class='text-left'>$curr_date</td>";
echo "<td class='text-left'>$row[fdeptcode] - TOTAL</td>";
echo "<td class='text-right'>₹ $totl_baln/-</td>";
echo "<td class='text-left'>[Last updated on $expn_date]</td>";
echo "</tr>";
}
echo "</table>";
?>
|