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.217.89.130
<?php
function pushStudExamFee($aobj_context)
{
include("genToken.php");
include("const.php");
$tokenArry = getToken(client_id,client_secret,username,password,grant_type);
$tokendet = json_decode($tokenArry,true);
$token = $tokendet['access_token'];
$iurl = $tokendet['instance_url'];
$username = username;
$password = password;
$hbody = 'Basic '.base64_encode((username.':'.password));
$headers = array
(
"Authorization:Bearer $token",
"Content-Type: application/json"
);
$query = "select a.appno,a.fregno,d.fexamdate,date_format(a.fapplastdate,'%d/%m/%Y') as applastdate,
a.ftotalfee
from appcandsum a inner join degree d on a.fdegree = d.fdegree and d.fexamno = 'A'
where appno = '130221210118'";
$res1 = $aobj_context->mobj_db->getRow($query);
$finalarry = [];
$subarry = [];
$subarry['StudentExamAppNo'] = $res1['appno'];
$subarry['StudentSrnNumber'] = 'R20EJ033';//$res1['fregno'];
$subarry['FeeName'] = $res1['fexamdate'];
$subarry['DueDate'] = '15/07/2022';//$res1['applastdate'];
$subarry['Amount'] = $res1['ftotalfee'];
array_push($finalarry,$subarry);
$req['studentfee'] = $finalarry;
$url = $iurl."/services/apexrest/StudentExamFeeAPI";
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, $url);
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $req ) );
$result2 = curl_exec($ch);
//var_dump($result2);
$res = json_decode($result2,true);
if($res['status'] == 'Success')
{
$resarry = $res['result'];
$appno = $resarry[0]['studentExamAppNo'];
$upd = "update appcandsum set fstype = 'E', fepushdate = now()
where appno = '{$appno}'";
$res1 = $aobj_context->mobj_db->Execute($upd);
echo $appno." - ".$res['status'];
}
curl_close( $ch );
//130201129679 - R21MCS01
//130221211755 - R21MCS01;
//130221210183 - R21MCS02;
}
function updateStudExamFee($aobj_context)
{
$data_json = file_get_contents("php://input");
$data = json_decode($data_json,true);
if($_SERVER['PHP_AUTH_USER'] == 'revaapiuser' && $_SERVER['PHP_AUTH_PW'] == 'reva@124')
{
}else
{
$arry='Unauthorized User';
echo $aobj_context->mobj_output->ToJSONEnvelope($arry,-1,"Failure");
return;
}
if(count($data) <=0)
{
$arry='Kindaly Pass Data';
echo $aobj_context->mobj_output->ToJSONEnvelope($arry,-1,"Failure");
return;
}
$resrayy = [];
$error = 0;
$succes = 0;
foreach($data['studentFeePayment'] as $val)
{
$appno = $val['StudentApplicationNo'];
$regno = $val['StudentSrnNumber'];
$amount = $val['PaidAmount'];
$paygateway = $val['PaymentGateway'];
$tranid = $val['TransactionId'];
$ackdate = $val['TransactionDateTime'];
$paytype = $val['PaymentType'];
$paymode = $val['PaymentMode'];
$paystatus = $val['PaymentStatus'];
if($val['StudentApplicationNo'] == '' || $val['StudentApplicationNo'] == NULL)
{
$res['status'] = "F";
$res['msg'] = "Pass Application No.";
$res['StudentApplicationNo'] =$appno;
$res['StudentSrnNumber'] =$regno;
$error++;
}else if($val['StudentSrnNumber'] == '' || $val['StudentSrnNumber'] == NULL)
{
$res['status'] = "F";
$res['msg'] = "Pass Register No.";
$res['StudentApplicationNo'] =$appno;
$res['StudentSrnNumber'] =$regno;
}
else
{
if($paystatus == 'Success')
{
$query = "update candsum set frecptdate = now(), ftotalfee = '{$amount}'
where fregno = '{$regno}'";
$result1 = $aobj_context->mobj_db->Execute($query);
$error++;
$res['status'] = "T";
$res['msg'] = "Updated Successfully";
$res['StudentApplicationNo'] =$appno;
$res['StudentSrnNumber'] =$regno;
$succes++;
}else
{
$res['status'] = "F";
$res['msg'] = "Updatetion Failure";
$res['StudentApplicationNo'] =$appno;
$res['StudentSrnNumber'] =$regno;
$error++;
}
}
array_push($resrayy,$res);
}
$msg = "success";
if($succes >'0' && $error == '0')
{
$msg = "success";
}else if($error>'0' && $succes == '0')
{
$msg = "Failure";
}else if($succes >'0' && $error>'0')
{
$msg = "Partial";
}
$arry['resdata'] = $resrayy;
echo $aobj_context->mobj_output->ToJSONEnvelope($arry,0,$msg);
return;
}
function updateStudExamSub($aobj_context)
{
$data_json = file_get_contents("php://input");
$data = json_decode($data_json,true);
if($_SERVER['PHP_AUTH_USER'] == 'revaapiuser' && $_SERVER['PHP_AUTH_PW'] == 'reva@124')
{
}else
{
$arry='Unauthorized User';
echo $aobj_context->mobj_output->ToJSONEnvelope($arry,-1,"Failure");
return;
}
if(count($data) <=0)
{
$arry='Kindaly Pass Data';
echo $aobj_context->mobj_output->ToJSONEnvelope($arry,-1,"Failure");
return;
}
$i = 0;
$resrayy = [];
$error = 0;
$succes = 0;
$sem=["1"=>"A","2"=>"B","3"=>"C","4"=>"D","5"=>"E","6"=>"F","7"=>"G","8"=>"H","9"=>"I","10"=>"J"];
foreach($data['studentExamApp'] as $val)
{
$query = "select fdegree,FMEYEAR,FMEEXAMTYP from degree where fedegcode = '{$val['degcode']}' and fexamno = 'A'";
$res1 = $aobj_context->mobj_db->getRow($query);
$fdegree = $res1['fdegree'];
$year = $res1['FMEYEAR'];
$examtype = $res1['FMEEXAMTYP'];
if($res1)
{
$semvalue = $sem[$val['sem']];
$query = "select fsubcode from subject where fdegree = '{$fdegree}'
and fexamno = '{$semvalue}'
and fesubcode = '{$val['subcode']}'";
// var_dump($query);
// die();
$res3 = $aobj_context->mobj_db->getRow($query);
$fsubcode = $res3['fsubcode'];
if($res3)
{
if($fsubcode == '')
{
$res['status'] = "F";
$res['logisysextid'] = $val['logisysextid'];
$res['msg'] = "Subject Code cant be Empty";
$error++;
}else
{
$query = "select * from canddet where fdegree = '{$fdegree}' and fsubcode = '{$fsubcode}'
and fregno = '{$val['regno']}' and ifnull(fpassmth,'') = ''";
$res2 = $aobj_context->mobj_db->getRow($query);
if($res2)
{
$status = $val['status'];
$upd = "update canddet set fpresent = '{$status}', fmoddate = now(), fmoduser = 'salesforce'
where fdegree = '{$fdegree}' and fsubcode = '{$fsubcode}'
and fregno = '{$val['regno']}'";
$result = $aobj_context->mobj_db->Execute($upd);
$upd = "update candsum set FTOTALFEE = '1', FRECPTDATE = NOW()
where fregno = '{$val['regno']}'";
$result = $aobj_context->mobj_db->Execute($upd);
$res['status'] = "T";
$res['logisysextid'] = $val['logisysextid'];
$res['regno'] = $val['regno'];
$res['msg'] = "Inserted Successfully";
$succes++;
}else
{
$res['status'] = "F";
$res['logisysextid'] = $val['logisysextid'];
$res['regno'] = $val['regno'];
$res['msg'] = "Student did not taken this subject";
$error++;
}
}
}else
{
$res['status'] = "F";
$res['logisysextid'] = $val['logisysextid'];
$res['msg'] = "Subject Master Not Mached";
$error++;
}
}else
{
$res['status'] = "F";
$res['logisysextid'] = $val['logisysextid'];
$res['msg'] = "Degree Master Not Mached";
$error++;
}
// var_dump($res);
// die();
$i++;
array_push($resrayy,$res);
}
$msg = "success";
if($succes >'0' && $error == '0')
{
$msg = "success";
}else if($error>'0' && $succes == '0')
{
$msg = "Failure";
}else if($succes >'0' && $error>'0')
{
$msg = "Partial";
}
$arry['resdata'] = $resrayy;
echo $aobj_context->mobj_output->ToJSONEnvelope($arry,0,$msg);
return;
}
?>
|