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.119.123.10
<?php
//lib16107 lib16103
ini_set('display_errors', 'on');
ini_set('memory_limit','900M');
ini_set('max_execution_time',0);
$servername = "97.74.228.93";
$username = "logisys3_logu";
$password = "Logisys@2106";
/*$servername = "localhost";
$username = "root";
$password = "";*/
$conn = new mysqli($servername,$username,$password);
if(!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
$admdb = "logisys3_bnu";
$query = "select DATE_FORMAT(sysdate(), '%M %d %Y, %h:%m %p') as ftime, funivname from {$admdb}.control";
$result = mysqli_query($conn,$query);
while($row = mysqli_fetch_assoc($result))
{
$ftime=$row['ftime'];
$funivname=$row['funivname'];
}
$query = "select c.fdegree,d.fdescpn, c.fexamno, c.fcollcount, c.fstcount, a.ftotfeepaid, (c.fcollcount + c.fstcount) AS fhtdwtotcnt,
(a.ftotfeepaid-c.fcollcount-c.fstcount) AS fpendhtcnt FROM
(SELECT fdegree, fexamno, SUM(IF(ifnull(fhtstatus,'') = 'C',1,0)) AS fcollcount,
SUM(IF(ifnull(fhtstatus,'') = 'S',1,0)) AS fstcount FROM (select distinct cd.fdegree, cd.fexamno, cd.fregno,
cs.fhtstatus from {$admdb}.canddet cd inner join {$admdb}.candsum cs
on cd.fregno = cs.fregno
and cd.fdegree = cs.fdegree and cd.fcollcode = cs.fcollcode
where ifnull(fpresent,'') = 'P' and ifnull(fpassmth,'') = '') s
GROUP BY fdegree, fexamno) c
INNER JOIN
(SELECT fdegree, fexamno, COUNT(distinct fregno, fexamno) AS ftotfeepaid
FROM {$admdb}.canddet WHERE ifnull(fpresent,'') = 'P' and ifnull(fpassmth,'') = '' GROUP BY fdegree, fexamno) a ON a.fdegree = c.fdegree
AND a.fexamno = c.fexamno
INNER JOIN {$admdb}.degree d ON c.fdegree = d.fdegree AND c.fexamno = d.fexamno
order by fdegree, fexamno";
// var_dump($query);
$result = mysqli_query($conn,$query);
$count = mysqli_num_rows($result);
if($count >0)
{
$table = '<center><h2>'.$funivname.'</h2>
<h2>Hall Ticket Download Statistics as on '.$ftime.'</h2>';
echo $table;
$table = '
<style>
table{
width:100%;
table-layout: fixed;
}
</style>
<table style="text-align: left;width: 100%;" border="1" cellpadding="10" cellspacing="0">
<thead style = "">
<tr style = "background-color:#8acc51">
<th width="5%" align="center"><b>Sl. No.</b></th>
<th width="5%" align="center"><b>Degree Code</b></th>
<th width="30%" align="left"><b>Degree Name</b></th>
<th align="center"><b>Semester</b></th>
<th align="center"><b>Students Fee Paid</b></th>
<th align="center"><b>College Downloads</b></th>
<th align="center"><b>Student Downloads</b></th>
<th align="center"><b>Total Downloads</b></th>
<th align="center"><b>Pending Downloads</b></th>
</tr>
</thead>
</table>
<table style="text-align: left;width: 100%;" border="1" cellpadding="10" cellspacing="0">
<tbody >';
$i = 1;
$c1=0;
$c2=0;
$c3=0;
$c4=0;
$c5=0;
while($row = mysqli_fetch_assoc($result))
{
$table .= '<tr><td width="5%" align="center">'.$i.'</td>
<td width="5%" align="center">'.$row['fdegree'].'</td>
<td width="30%" align="left">'.$row['fdescpn'].'</td>
<td align="center">'.$row['fexamno'].'</td>
<td align="center">'.moneyFormatIndia($row['ftotfeepaid']).'</td>
<td align="center">'.moneyFormatIndia($row['fcollcount']).'</td>
<td align="center">'.moneyFormatIndia($row['fstcount']).'</td>
<td align="center">'.moneyFormatIndia($row['fhtdwtotcnt']).'</td>
<td align="center">'.moneyFormatIndia($row['fpendhtcnt']).'</td>
</tr>';
$c1 += $row['ftotfeepaid'];
$c2 += $row['fcollcount'];
$c3 += $row['fstcount'];
$c4 += $row['fhtdwtotcnt'];
$c5 += $row['fpendhtcnt'];
$i++;
}
$table .= '<tr><td align="center" colspan = "4"><b>Total</b></td>
<td align="center"><b>'.moneyFormatIndia($c1).'</b></td>
<td align="center"><b>'.moneyFormatIndia($c2).'</b></td>
<td align="center"><b>'.moneyFormatIndia($c3).'</b></td>
<td align="center"><b>'.moneyFormatIndia($c4).'</b></td>
<td align="center"><b>'.moneyFormatIndia($c5).'</b></td>
</tr>';
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.
}
?>
|