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.129.42.59
Current Path : /var/www/html/sms/ |
| Current File : /var/www/html/sms/admsumsendsms_bnu_29102018.php |
<?php
//lib16107 lib16103
ini_set('display_errors', 'on');
include("sendsmsapi.php");
include("sendGridMail.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());
}
$rgadmdb = ["logisys3_bnu", "logisys3_bcu","logisys3_dud"];
for($j=0;$j<count($rgadmdb);$j++)
{
$admdb = $rgadmdb[$j];
$username = 'logisyhttp';
$password = 'Logis986';
$from = 'UNISOL';
$category = 'bulk';
if($admdb != 'logisys3_dud')
{
$query = "select a.ftotstud, a.flogincted, a.floginpend,
(a.ftotstud - b.ffinsubcnt) as fregnpend,
b.fregncnt, b.ffinsubcnt, b.ffinsubpendcnt, b.fackcnt, b.faprcnt,
(b.fackcnt - b.faprcnt) as faprpendcnt,
(a.ftotstud - b.fackcnt) as fackpend,
c.fgrvcnt, c.fgrvcleared, c.fgrvpend,
control.funivmobile, control.funivname, control.funivemail,
date_format(now(), '%d/%m/%Y %r') as fdate from
(select '1' as id, count(fmobileno) as ftotstud,
sum(if(ifnull(factive,'') = 'T',1,0)) as flogincted,
sum(if(ifnull(factive,'') <> 'T',1,0)) as floginpend from {$admdb}.collstud) a
inner join ( select '1' as id, count(fcontact_no) as fregncnt,
sum(if(ifnull(ffinsub,'') = 'T', 1, 0)) as ffinsubcnt,
sum(if(ifnull(ffinsub,'') <> 'T', 1, 0)) as ffinsubpendcnt,
sum(if(ifnull(fappstatus,'') = 'verified', 1, 0)) as fackcnt,
sum(if(ifnull(fapprstatus,'') = 'approved', 1, 0)) as faprcnt from {$admdb}.studadm) b
on a.id = b.id inner join (select '1' as id, count(*) as fgrvcnt,
sum(if(ifnull(fgrvstatus,'') = 'C',1,0)) as fgrvcleared,
sum(if(ifnull(fgrvstatus,'') <> 'C',1,0)) as fgrvpend from logisys3_grv.grvhead g
inner join logisys3_grv.masuniv m on m.funivcode = g.funivcode
where m.fdbname = '{$admdb}') c
on b.id = c.id inner join {$admdb}.control";
$result = mysqli_query($conn,$query);
$count = mysqli_num_rows($result);
if($count >0)
{
$i = 0;
$row = mysqli_fetch_assoc($result);
$to = $row['funivmobile'];
$text = "{$row['funivname']}, Admission Statistics
Total Students Data Recieved from Colleges : {$row['ftotstud']}".chr(13)."
Students registered in the portal : {$row['flogincted']}".chr(13)."
Admission registration completed : {$row['ffinsubcnt']}".chr(13)."
Admission registration pending : {$row['fregnpend']}".chr(13)."
Acknowledgement Done by Colleges : {$row['fackcnt']}".chr(13)."
Acknowledgement Pending by Colleges : {$row['fackpend']}".chr(13)."
Approval Done : {$row['faprcnt']}".chr(13)."
Approval Pending : {$row['faprpendcnt']}".chr(13)."
Grievance received from students : {$row['fgrvcnt']}".chr(13)."
Grievance cleared / answered : {$row['fgrvcleared']}";
// var_dump($text);
$smsresp = sendsmaapi($username,$password,$from,$to,$text,$category);
// var_dump($smsresp);
$table = '<center><h2>'.$row['funivname'].'<br> Admission 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="15%"><center>Count</center></th>
</tr>
</thead>';
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Total Students Data Recieved from Colleges</td>";
$table .= "<td align='right'>".moneyFormatIndia( $row['ftotstud'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Students registered in the portal</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['flogincted'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Admission registration completed</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['ffinsubcnt'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Admission registration pending </td>";
$table .= "<td align='right'>".moneyFormatIndia($row['fregnpend'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Acknowledgement Done by Colleges</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['fackcnt'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Acknowledgement Pending by Colleges</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['fackpend'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Approval Done</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['faprcnt'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Approval Pending</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['faprpendcnt'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Grievance received from students</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['fgrvcnt'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Grievance cleared / answered</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['fgrvcleared'])."</td>";
$table .= "</tr>";
$table.="</table></center>";
$subject = "{$row['funivname']} Admission Statistics as on ".$row['fdate'];
echo $table;
// $emails = ['prashanth.k@logisys.org','arun.v@logisys.org', 'mohanlyrix@gmail.com', 'hnnagaraj@lordshire.com', 'hnramesh@logisys.org', 'nausheen@lordshire.com'];
$emails = explode(',', $row['funivemail']);
// var_dump($emails);
$cc = '';
for($i=0;$i< count($emails); $i++)
{
$emailid = $emails[$i];
$resp = sendGridMail($emailid,$subject,$table,'');
echo $resp;
}
}
}
else
{
$query = "select a.admcnt, logcnt,totstud,(totstud-logcnt) as pendcnt ,fgrvcnt,fgrvcleared,fgrvpend,control.funivmobile, control.funivname, control.funivemail from
(select '1' as id, COUNT(*) as admcnt from {$admdb}.studadm where IFNULL(fcollcode,'') <> '' and IFNULL(fdegree,'') <> '') a
inner join
(select '1' as id, COUNT(*) as logcnt from logisys3_comexam.masuser where funivcode = '023' and factive = 'T' ) b
on a.id = b.id
inner join
(select '1' as id, COUNT(*) as totstud from logisys3_comexam.pushstud where funivcode = '023') c on
a.id = c.id
inner join
(select '1' as id, COUNT(*) as fgrvcnt,
SUM(IF(IFNULL(fgrvstatus,'') = 'C',1,0)) as fgrvcleared,
SUM(IF(IFNULL(fgrvstatus,'') <> 'C',1,0)) as fgrvpend from logisys3_grv.grvhead g
inner join logisys3_grv.masuniv m on m.funivcode = g.funivcode
where m.fdbname = '{$admdb}') d
on a.id = d.id
inner join {$admdb}.control";
$result = mysqli_query($conn,$query);
$count = mysqli_num_rows($result);
$i = 0;
$row = mysqli_fetch_assoc($result);
$to = $row['funivmobile'];
$text = "{$row['funivname']}, Statistics
Admission Entry Done : {$row['admcnt']}".chr(13)."
Students registered in the Student Portal : {$row['logcnt']}".chr(13)."
Student Portal registration pending : {$row['pendcnt']}".chr(13)."
Grievance received : {$row['fgrvcnt']}".chr(13)."
Grievance cleared / answered : {$row['fgrvcleared']}";
$smsresp = sendsmaapi($username,$password,$from,$to,$text,$category);
continue;
$table = '<center><h2>'.$row['funivname'].'<br> Admission 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="15%"><center>Count</center></th>
</tr>
</thead>';
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Total Students Data Recieved from Colleges</td>";
$table .= "<td align='right'>".moneyFormatIndia( $row['ftotstud'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Students registered in the portal</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['flogincted'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Admission registration completed</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['ffinsubcnt'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Admission registration pending </td>";
$table .= "<td align='right'>".moneyFormatIndia($row['fregnpend'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Acknowledgement Done by Colleges</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['fackcnt'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Acknowledgement Pending by Colleges</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['fackpend'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Approval Done</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['faprcnt'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Approval Pending</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['faprpendcnt'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Grievance received from students</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['fgrvcnt'])."</td>";
$table .= "</tr>";
$table .= "<tr bgcolor='#ffffff' >";
$table .= "<td><center>".++$i."</center></td>";
$table .= "<td>Grievance cleared / answered</td>";
$table .= "<td align='right'>".moneyFormatIndia($row['fgrvcleared'])."</td>";
$table .= "</tr>";
$table.="</table></center>";
$subject = "{$row['funivname']} Admission Statistics as on ".$row['fdate'];
echo $table;
// $emails = ['prashanth.k@logisys.org','arun.v@logisys.org', 'mohanlyrix@gmail.com', 'hnnagaraj@lordshire.com', 'hnramesh@logisys.org', 'nausheen@lordshire.com'];
$emails = explode(',', $row['funivemail']);
// var_dump($emails);
$cc = '';
for($i=0;$i< count($emails); $i++)
{
$emailid = $emails[$i];
// $resp = sendGridMail($emailid,$subject,$table,'');
// echo $resp;
}
}
}
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.
}
?>
|