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.147.49.19
<?php
$servername = "97.74.228.93";
$username = "logisys3_logu";
$password = "Logisys@2106";
$conn = new mysqli($servername,$username,$password);
if(!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
$db = "logisys3_bcu";
$doe = $_GET['fdoe'];
$fsession = $_GET['fsession'];
// var_dump($fsession.'---'.$doe);die();
$Query = "select p.fqpcode, fsubname, pcount as tcount, ifnull(abcount,0) as abcount,
ifnull(mpcount,0) as mpcount, (pcount-ifnull(abcount,0)-ifnull(mpcount,0)) as prcount from
(select fqpcode, fsubname, count(fregno) as pcount from
(select s.fqpcode, s.fsubname, cd.fregno
from {$db}.canddet cd inner join {$db}.candsum cs on cd.fregno = cs.fregno
and cd.fdegree = cs.fdegree and cd.fcollcode = cs.fcollcode
inner join {$db}.subject s on s.fdegree = cd.fdegree and s.fexamno = cd.fexamno
and s.fsubcode = cd.fsubcode and ifnull(s.ftheory, '') = 'T' and ifnull(s.fintass,'') = 'F'
where ifnull(fpresent,'') = 'P' and ifnull(fpassmth,'') = ''
and ifnull(s.fdoe, '0000-00-00') = date_format(now(),'%Y-%m-%d')) m
group by fqpcode) p left join
(select a.fqpcode, sum(if(fabstype = 'QpA', 1, 0))as abcount, sum(if(fabstype = 'QpM', 1, 0))as mpcount
from {$db}.absent a
where a.fregno <> 'nil' and a.fregno <> '0'
and date_format(now(),'%Y-%m-%d') = date_format(a.fdoe,'%Y-%m-%d')
group by fqpcode) a
on p.fqpcode = a.fqpcode
order by pcount desc ";
$result = mysqli_query($conn, $Query);
$count = mysqli_num_rows($result);
$query1 = "select funivname, date_format(now(), '%d/%m/%Y') as fdate from {$db}.control";
$result1 = mysqli_query($conn, $query1);
$row1 = mysqli_fetch_assoc($result1);
$table = '<center><h2>'.$row1['funivname'].'<br>Exam Attendance on '.$row1['fdate'].'</center></h2><center>
<table border="1" style="margin-left:2px;text-align: left;width: 60%;font-size:14px;margin: auto;border-collapse:collapse;" align-self="middle" cellspacing="1" cellpadding="5" align="center" bgcolor="#505151">
<thead>
<tr style = "background-color:#8acc51">
<th width="8%"><center>Sl. No.</center></th>
<th><center>Qp Code</center></th>
<th><center>Subject Name</center></th>
<th><center>Total Count</center></th>
<th><center>Absent Count</center></th>
<th><center>M.P. Count</center></th>
<th><center>Present Count</center></th>
</tr>
</thead>';
$i = 0;
if($count > 0)
{
$c1 = 0;
$c2 = 0;
$c3 = 0;
$c4 = 0;
while($row = mysqli_fetch_assoc($result))
{
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td><center>".$row['fqpcode']."</center></td>";
$table .= "<td>".$row['fsubname']."</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['tcount'])."</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['abcount'])."</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['mpcount'])."</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['prcount'])."</td>";
$table .= "</tr>";
$c1 += $row['tcount'];
$c2 += $row['abcount'];
$c3 += $row['mpcount'];
$c4 += $row['prcount'];
}
$table .= "<tr bgcolor='#ffffff'>";
$table .= "<td colspan = '3'><center><b>Total</b></center></td>";
$table .= "<td align='right'><b>".moneyFormatIndia($c1)."</b></td>";
$table .= "<td align='right'><b>".moneyFormatIndia($c2)."</b></td>";
$table .= "<td align='right'><b>".moneyFormatIndia($c3)."</b></td>";
$table .= "<td align='right'><b>".moneyFormatIndia($c4)."</b></td>";
$table .= "</tr>";
}
else
{
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td colspan='4'><center>No Absentees found for Current Day</center></td>";
}
// $subject = "{$row['funivname']} Statistics as on ".$row['fdate'];
echo $table;
function moneyFormatIndia($num) {
$explrestunits = "" ;
if(strlen($num)>3) {
$lastthree = substr($num, strlen($num)-3, strlen($num));
$restunits = substr($num, 0, strlen($num)-3); // extracts the last three digits
$restunits = (strlen($restunits)%2 == 1)?"0".$restunits:$restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping.
$expunit = str_split($restunits, 2);
for($i=0; $i<sizeof($expunit); $i++) {
// creates each of the 2's group and adds a comma to the end
if($i==0) {
$explrestunits .= (int)$expunit[$i].","; // if is first value , convert into integer
} else {
$explrestunits .= $expunit[$i].",";
}
}
$thecash = $explrestunits.$lastthree;
} else {
$thecash = $num;
}
return $thecash; // writes the final format where $currency is the currency symbol.
}
?>
|