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.133.109.141
Current Path : /var/www/html/dud/ |
| Current File : /var/www/html/dud/htsum.php |
<?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_dud";
$Query = "SELECT SUM(IF(ifnull(fhtstatus,'') = 'C',1,0)) AS fcollcount,
SUM(IF(ifnull(fhtstatus,'')= 'S',1,0)) AS fstcount, COUNT(fregno) as ftotfeepaid,
funivcode, funivname, date_format(now(), '%d/%m/%Y %r') as fdate
FROM (select distinct cd.fdegree, cd.fexamno, cd.fregno,
cs.fhtstatus from {$db}.canddet cd inner join {$db}.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, {$db}.control c";
$result = mysqli_query($conn, $Query);
$row = mysqli_fetch_assoc($result);
$table = '<center><h2>'.$row['funivname'].'<br> Hall Ticket Statistics as on '.$row['fdate'].'</center></h2><center><table style="margin-left:2px;text-align: left;width: 60%;font-size:14px;margin: auto;" align-self="middle" cellspacing="1" cellpadding="5" border="0" align="center" bgcolor="#505151">
<thead>
<tr style = "background-color:#8acc51">
<th width="8%"><center>Sl. No.</center></th>
<th><center>Title</center></th>
<th width="35%"><center>Count</center></th>
</tr>
</thead>';
$i = 0;
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Students Fee Paid</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['ftotfeepaid'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>College Downloads</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['fcollcount'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Student Downloads</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['fstcount'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Total Downloads</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['fcollcount']+$row['fstcount'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Pending Downloads</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['ftotfeepaid']-$row['fcollcount']-$row['fstcount'])."</td>";
$table .= "</tr>";
$table.="</table></center>";
// $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.
}
?>
|