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.77.51
<?php
/**
* import checksum generation utility
* You can get this utility from https://developer.paytm.com/docs/checksum/
*/
ini_set('display_errors', 'On');
error_reporting(E_ALL);
ini_set('max_execution_time', 300);
ini_set("memory_limit","500M");
include('HDFCAPI.php');
include ("/var/www/config.php");
$servername = SERVERNAME;
$username = USERNAME;
$password = PASSWORD;
$dbname = 'logisys3_sikkim';
$pconn = new mysqli($servername,$username,$password,$dbname);
if(!$pconn)
{
die("Connection failed: " . mysqli_connect_error());
}
$query = "select p.ftype, p.appno, p.fregno, p.forderid, p.fstatus2 as fstatus, p.fpaygateway, p.fcreatedate, DATE_SUB(now(), interval 15 MINUTE) from
(select appno from appcandsum where ifnull(fackdate,'') = '' and ifnull(fpaymentstatus,'') <> 'success') a inner join pgdet p on a.appno = p.appno
and ifnull(p.fstatus2,'') <> 'SHIPPED'
and fpaygateway = 'hdfc' and p.fcreatedate < DATE_SUB(now(), interval '30:0' MINUTE_SECOND)";
$res_rv=$pconn->query($query);
if (mysqli_num_rows($res_rv) > 0)
{
while (@ob_end_flush());
while($txn = mysqli_fetch_assoc($res_rv))
{
$forderid = @$txn['forderid'];
$productinfo = '';
$status = '';
$resfinal = getAPIRes("A09AC9FE6C4F6291596D0195E51A0556","AVQP87GI58AJ95PQJA",$forderid);
$b = json_decode($resfinal,true);
$productinfo = $b['param_value3'];
$regno = $b['param_value2'];
$txnid = $b['reference_no'];
$date = $b['order_date_time'];
$status = $b['order_status'];
$update_pg="update pgdet set ftxnid = '{$txnid}', fstatus2 = '{$status}', fupddate2 = now()
where appno = '{$productinfo}'
and forderid = '{$forderid}'
and ftype = 'exam'";
$result_pg=$pconn->query($update_pg);
if(strtoupper($status) == 'SHIPPED') {
$firstname = "HDFC_Order_API2";
$update="update appcandsum set FPAYMENTREMARKS='{$txnid}',FPAYMENTSTATUS='success',
FPAYMENTCONFIRM='success',FACKDATE='{$date}',FACKUSER='{$firstname}',
fremarks = '{$firstname}',
FPAYGATEWAY = '{$firstname}',
frecptdate = '{$date}'
where APPNO='{$productinfo}'";
$result=$pconn->query($update);
$get_app_cand_det="SELECT c.FDEGREE,c.FEXAMNO,c.FCOLLCODE,ifnull(c.FFRESHEXAM,'') as FFRESHEXAM,
c.FREGNO,c.FYEAR,c.FEXAMTYPE,'' as message
FROM appcandsum c
WHERE c.APPNO='{$productinfo}'";
$result = $pconn->query($get_app_cand_det);
if (mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_assoc($result))
{
$collcode = $row['FCOLLCODE'];
$degree = $row['FDEGREE'];
$regno = $row['FREGNO'];
$text = $row['message'];
$FFRESHEXAM = $row['FFRESHEXAM'];
}
}
$update_cand_sum = "UPDATE (SELECT c.FDEGREE AS fdegree, c.FREGNO AS fregno, c.FCOLLCODE AS fcollcode,
sum(ifnull(c.FEXAMFEEA,0)) AS fexamfeea,
sum(ifnull(c.FEXAMFEEB,0)) AS fexamfeeb,
sum(ifnull(c.FEXAMFEEC,0)) AS fexamfeec,
sum(ifnull(c.FEXAMFEED,0)) AS fexamfeed,
sum(ifnull(c.FEXAMFEEE,0)) AS fexamfeee,
sum(ifnull(c.FEXAMFEEF,0)) AS fexamfeef,
sum(ifnull(c.FEXAMFEEG,0)) AS fexamfeeg,
sum(ifnull(c.FEXAMFEEH,0)) AS fexamfeeh,
sum(ifnull(c.FEXAMFEEI,0)) AS fexamfeei,
sum(ifnull(c.FEXAMFEEJ,0)) AS fexamfeej,
sum(ifnull(c.FTOTALFEE,0)) AS ftotalfee,
FRECPTDATEA,
FRECPTDATEB,
FRECPTDATEC,
FRECPTDATED,
FRECPTDATEE,
FRECPTDATEF,
FRECPTDATEG,
FRECPTDATEH,
FRECPTDATEI,
FRECPTDATEJ
FROM appcandsum c where ((c.FPAYMENTSTATUS = 'success')
and (ifnull(c.FTOTALFEE,0) > 0) and (ifnull(c.FRECPTDATE,'') <> ''))
and c.fregno = '{$regno}'
group by c.FDEGREE,c.FREGNO,c.FCOLLCODE) a,candsum c
SET
c.FEXAMFEEA = a.FEXAMFEEA,
c.FEXAMFEEB = a.FEXAMFEEB,
c.FEXAMFEEC = a.FEXAMFEEC,
c.FEXAMFEED = a.FEXAMFEED,
c.FEXAMFEEE = a.FEXAMFEEE,
c.FEXAMFEEF = a.FEXAMFEEF,
c.FEXAMFEEG = a.FEXAMFEEG,
c.FEXAMFEEH = a.FEXAMFEEH,
c.FEXAMFEEI = a.FEXAMFEEI,
c.FEXAMFEEJ = a.FEXAMFEEJ,
c.FTOTALFEE = a.FTOTALFEE,
c.FRECPTDATEA = a.FRECPTDATEA,
c.FRECPTDATEB = a.FRECPTDATEB,
c.FRECPTDATEC = a.FRECPTDATEC,
c.FRECPTDATED = a.FRECPTDATED,
c.FRECPTDATEE = a.FRECPTDATEE,
c.FRECPTDATEF = a.FRECPTDATEF,
c.FRECPTDATEG = a.FRECPTDATEG,
c.FRECPTDATEH = a.FRECPTDATEH,
c.FRECPTDATEI = a.FRECPTDATEI,
c.FRECPTDATEJ = a.FRECPTDATEJ,
c.frecptdate = '{$date}'
WHERE a.fregno=c.FREGNO
AND c.fregno = '{$regno}'";
$result = $pconn->query($update_cand_sum);
$update_caste = "update candsum c, student s
set c.fcategory = s.fcaste,
c.ffeetype = if(ifnull(c.fconstype,'0123456789') <> '0123456789', 'Low Income', 'Normal Fee')
where s.fregno = c.fregno
and s.fregno = '{$regno}'";
$result = $pconn->query($update_caste);
$update_cand_appCand = "update canddet c, appcanddet t
set c.finserted = t.finserted,
c.fpresent = t.fpresent
where c.fdegree = t.fdegree
and c.fexamno = t.fexamno
and c.fregno = t.fregno
and c.fsubcode = t.fsubcode
and c.fdegree = '{$degree}' and c.fregno = '{$regno}'
and t.APPNO='{$productinfo}' and ifnull(c.fpresent,'') <> 'P'";
$result = $pconn->query($update_cand_appCand);
$insert_canddet ="insert into canddet(fdegree,FEXAMNO, FCOLLCODE, FREGNO, FSUBCODE, FINSERTED, FPRESENT, FYEAR, FEXAMTYPE)
select fdegree, FEXAMNO, FCOLLCODE,FREGNO, FSUBCODE,FINSERTED, FPRESENT, FYEAR,FEXAMTYPE from appcanddet where
fregno = '{$regno}' and appno ='{$productinfo}' and CONCAT(fdegree,fexamno,fregno,fsubcode)
not in(select CONCAT(fdegree,fexamno,fregno,fsubcode) from canddet where fregno = '{$regno}')
";
$result = $pconn->query($insert_canddet);
$update_studfee = "update studfee s, (select a.appno, a.fregno, a.fdegree, a.fexamno, a.fcollcode, a.ffeecode, sum(a.famount) as famount,
a.fyear, a.fexamtype, a.flogdate
from appstudfee a inner join appcandsum b on a.fregno = b.fregno and a.appno = b.appno
where ifnull(b.fpaymentstatus,'') = 'success'
and ifnull(fackdate,'') <> '' and b.fregno = '{$regno}'
group by a.fdegree, a.fexamno, a.fcollcode, a.fregno, a.ffeecode) a
set s.famount = a.famount,
s.flogdate = a.flogdate,
s.fyear = a.fyear,
s.fexamtype = a.fexamtype
where s.fdegree = a.fdegree
and s.fexamno = a.fexamno
and s.fregno = a.fregno
and s.ffeecode = a.ffeecode
and s.fregno = '{$regno}'";
$result = $pconn->query($update_studfee);
$insert_studfee = "insert into studfee(fdegree,fexamno,fcollcode,fregno,ffeecode,famount,flogdate,fyear,fexamtype)
select fdegree,fexamno,fcollcode,fregno,ffeecode,famount,flogdate,fyear,fexamtype from appstudfee where
fregno = '{$regno}' and appno ='{$productinfo}' and CONCAT(fdegree,fexamno,fregno,ffeecode)
not in(select CONCAT(fdegree,fexamno,fregno,ffeecode) from studfee where fdegree = '{$degree}'
and fregno = '{$regno}')";
$result = $pconn->query($insert_studfee);
$query = "select fdegree,fexamno,fcollcode,fregno,ffeecode,famount,flogdate,fyear,fexamtype
from appstudfee where
fregno = '{$regno}' and appno ='{$productinfo}' and ffeecode = '02 Provisional Certificate'";
$result1 = $pconn->query($query);
if(mysqli_num_rows($result1) > 0)
{
$query = "INSERT INTO studmiscfee (fdescpn, fregno,fremamount, forderid, fpaymentype, fpaymentstatus, fpaydate, FPAYMENTREMARKS)VALUES('PPC Fee', '{$regno}', '100', '{$txnid}', 'hdfc', 'success', now(),'{$txnid}')";
$result2 = $pconn->query($query);
}
}
//echo "ADM :- AppNo: $productinfo ---OrderID: $forderid ---Status: $status --Reason : $status<br/>";
flush();
}
}
$query = "select p.ftype, p.appno, p.fregno, p.forderid, p.fstatus, p.fpaygateway, p.fcreatedate, DATE_SUB(now(), interval 15 MINUTE) from
(select appno from res_stud where ifnull(fpaymentstatus,'') <> 'success') a inner join pgdet p on a.appno = p.appno
and ifnull(p.fstatus2,'') <> 'SHIPPED'
and ifnull(p.fstatus2,'') <> 'Unsuccessful'
and ifnull(p.fstatus2,'') <> 'Initiated'
and ifnull(p.fstatus2,'') <> 'Aborted'
and fpaygateway = 'hdfc' and p.fcreatedate < DATE_SUB(now(), interval '20:0' MINUTE_SECOND)";
$res_adm = $pconn->query($query);
if (mysqli_num_rows($res_adm) > 0)
{
while (@ob_end_flush());
while($txn = mysqli_fetch_assoc($res_adm))
{
$forderid = $txn['forderid'];
$productinfo = '';
$status = '';
$resfinal = getAPIRes("A09AC9FE6C4F6291596D0195E51A0556","AVQP87GI58AJ95PQJA",$forderid);
$b = json_decode($resfinal,true);
$productinfo = $b['param_value3'];
$regno = $b['param_value2'];
$txnid = $b['reference_no'];
$date = $b['order_date_time'];
$status = $b['order_status'];
$update_pg="update pgdet set ftxnid = '{$txnid}', fstatus2 = '{$status}', fupddate = now()
where appno = '{$productinfo}'
and forderid = '{$forderid}'
and ftype = 'res'";
$result_pg=$pconn->query($update_pg);
if(strtoupper($status) == 'SHIPPED') {
$firstname = "HDFC_Order_API2";
// $update="update res_stud set FPAYMENTREMARKS = '{$txnid}',
// FPAYMENTSTATUS = 'success',
// fpaymentdate='{$date}',FPAYMENTTYPE='{$firstname}'
// where fAPPNO='{$productinfo}'";
$update="update res_stud set FPAYMENTREMARKS='{$txnid}',FPAYMENTSTATUS='success',
FPAYMENTCONFIRM='success', fackdate = '{$date}', funivrecdate = '{$date}',
fackuser = '{$firstname}', FCHALLANNO = '{$txnid}'
where APPNO='{$productinfo}'";
$result=$pconn->query($update);
}
//echo "ADM :- AppNo: $productinfo ---OrderID: $forderid ---Status: $status --Reason : $status<br/>";
flush();
}
}
?>
|