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.117.72.24
<?php
function uGetRevalutionDetails($aobj_context)
{
$revalution_regno=$aobj_context->mobj_data["regno"];
$revalution_exam=trim($aobj_context->mobj_data['examno']);
$query = "select fdegree, fregno, fname,fenroll fcollcode from student
where (fregno = '{$revalution_regno}' or fenroll = '{$revalution_regno}')";
$results = $aobj_context->pobj_db->GetRow($query);
if(count($results)==0)
{
$send_data->error_code =-1;
$send_data->status="false";
$send_data->errMsg ="No data found!";
echo json_encode($send_data);
}
$revalution_regno = $results['fregno'];
$enroll = $results['fenroll'];
$fcollcode = $results['fcollcode'];
$fdegree = $results['fdegree'];
$lobj_get_univcode = $aobj_context->mobj_data["univcode"];
if($lobj_get_univcode == '041' || $lobj_get_univcode == '042')
{
$xr_query = "select fregno, group_concat(fsubcode separator '*') as fxrsubs
from res_stud where fregno = '{$revalution_regno}' and fdegree = '{$fdegree}'
and fexamno = '{$revalution_exam}'
and ifnull(fpaymentstatus,'') = 'success'";
$lobj_xr_subs = $aobj_context->pobj_db->GetRow($xr_query);
$xr_subs = '';
if(count($lobj_xr_subs) > 0)
{
$xr_subs = $lobj_xr_subs['fxrsubs'];
}
}
$get_data="select date_format(current_date(),'%d/%m/%Y') as curr_date,
rf.FDEGREE,concat(s.FSUBCODE,'',s.FSSUBCODE) as FSUBCODE,
concat(s.FSUBNAME ,' ',s.FSSUBNAME) as FSUBNAME,
st.FNAME, IFNULL(rf.FRVFEE,0) as FRVFEE, IFNULL(rf.FRTFEE,0) as FRTFEE,
IFNULL(rf.FXRFEE,0) as FXRFEE, IFNULL(rf.FCVFEE,0) as FCVFEE,
IF(CURRENT_DATE()<=IFNULL(FRVLASTDATE,'0000-00-00'),'1',0) AS is_rv,
IF(IFNULL(CURRENT_DATE()<=FRTLASTDATE,'0000-00-00'),'1',0) AS is_rt,
IF(IFNULL(CURRENT_DATE()<=FXEROXLASTDATE,'0000-00-00'),'1',0) AS is_xr,
IF(IFNULL(CURRENT_DATE()<=FCVLASTDATE,'0000-00-00'),'1',0) AS is_cv,
ifnull(dg.fxrappfee,0) as fxrappfee, ifnull(dg.frvappfee,0) as frvappfee
from resmarks rm inner join subject s on s.FDEGREE=rm.FDEGREE
and s.FEXAMNO=rm.FEXAMNO and s.FSUBCODE=rm.FSUBCODE
inner join resmarksdet rmd on rmd.fdegree = rm.fdegree
and rmd.fregno = rm.fregno and s.fcsubcode = rmd.fsubcode
inner join student st on st.FREGNO=rm.FREGNO
inner join res_fee rf on rf.FREGNO=rm.FREGNO and rf.FEXAMNO=rm.FEXAMNO
inner join degree dg on dg.fdegree = rf.fdegree and dg.fexamno = rf.fexamno
where rm.FREGNO = '{$revalution_regno}'
and rm.fexamno = '{$revalution_exam}' and (ifnull(rm.fthpassmth,'') = 'Pass'
or ifnull(rm.fthpassmth,'') = 'Fail' or length(rm.fthpassmth) < 4) and ifnull(frvblock,'') <> 'T'
and ifnull(rmd.fmarks,-1) > -1 and s.FTHEORY='T' and s.FINTASS <> 'T'
and ifnull(fmarks,'') <> 'Ab.'
group by FCSUBCODE
order by ifnull(s.FPRINTORD,''),s.FSUBCODE";
$send_data="";
$lobj_get_data = $aobj_context->pobj_db->GetAll($get_data);
if(sizeof($lobj_get_data)==0)
{
$send_data->error_code =-1;
$send_data->status="false";
$send_data->errMsg ="No data found!";
echo json_encode($send_data);
return;
}
$is_rv =$lobj_get_data[0]['is_rv'];
$is_rt =$lobj_get_data[0]['is_rt'];
$is_xr =$lobj_get_data[0]['is_xr'];
$is_cv =$lobj_get_data[0]['is_cv'];
$xrappfee = $lobj_get_data[0]['fxrappfee'];
$rvappfee = $lobj_get_data[0]['frvappfee'];
$FRVFEE =$lobj_get_data[0]['FRVFEE'];
$FRTFEE =$lobj_get_data[0]['FRTFEE'];
$FXRFEE =$lobj_get_data[0]['FXRFEE'];
$FCVFEE =$lobj_get_data[0]['FCVFEE'];
$reval_arr["rv"]['ele']=$is_rv;
$reval_arr["rv"]['fee']=$FRVFEE;
$reval_arr["rv"]['H']="RV";
$reval_arr["rt"]['ele']=$is_rt;
$reval_arr["rt"]['fee']=$FRTFEE;
$reval_arr["rt"]['H']="RT";
$reval_arr["xr"]['ele']=$is_xr;
$reval_arr["xr"]['fee']=$FXRFEE;
$reval_arr["xr"]['H']="PC";
$reval_arr["cv"]['ele']=$is_cv;
$reval_arr["cv"]['fee']=$FCVFEE;
$reval_arr["cv"]['H']="Challenge Val";
$tableHeader = array(); // to be sent in response
array_push($tableHeader,"Sl No","Sub. Code","Subject Name");
foreach($reval_arr as $ak=>$av)
{
if($av['ele']=='1')
{
$name=$av['H'];
$tot_col++;
array_push($tableHeader,$name);
}
}
//array_push($tableHeader,"Total");
$sl_no=1;
$total_val=0;
$name=$lobj_get_data[0]['FNAME'];
$curr_date=$lobj_get_data[0]['curr_date'];
$k=1;
$internal_code=1;
$table_data = array();
foreach($lobj_get_data as $k=>$val)
{
$row_obj = "";
//print_r($lobj_get_data); die();
if($k%2==0)
$class='tbl_row1';
else
$class='tbl_row_alter1';
$is_selected_checked='';
$FSUBCODE =$val['FSUBCODE'];
$FSUBNAME =$val['FSUBNAME'];
$row_obj->sl_no = $sl_no;
$row_obj->FSUBCODE = $FSUBCODE;
$row_obj->FSUBNAME = $FSUBNAME;
array_push($table_data,$row_obj);
foreach($reval_arr as $ak=>$av)
{
if($av['ele']=='1')
{
$name=$av['H'];
$fee=$av['fee'];
$row_obj->$name = $fee;
}
}
$sl_no++;$internal_code++;
}
$get_data="SELECT payment_type, bank_name FROM acc_mas
where ifnull(fsuspend,'') <> 'T'";
$lobj_payment_type= $aobj_context->pobj_db->GetAll($get_data);
//var_dump($lobj_payment_type); // to be sent in response
if(sizeof($table_data)==0)
{
$send_data->error_code =-1;
$send_data->status="false";
$send_data->errMsg ="No data found!";
echo json_encode($send_data);
return;
}
$send_data->tableHeader = $tableHeader;
$send_data->tableData = $table_data;
$send_data->payment_type = $lobj_payment_type;
if($lobj_get_univcode == '041' || $lobj_get_univcode == '042')
{
$send_data->rvappfee = $rvappfee;
$send_data->xrappfee = $xrappfee;
}
$send_data->error_code =0;
$send_data->status="success";
echo json_encode($send_data);
}
function uSaveRevalution($aobj_context){
$req = $aobj_context->req_body;
//var_dump($req['regno']);
include_once($aobj_context->main_src."src/json.php");
$json = new Services_JSON();
$grand_total = $req["grand_total"];
$fpaymode = $req["fpaymode"];
$isRazorPay = $req['isRazorPay'];
$isPaytm = $req['isPaytm'];
$reg_no = strtoupper($req["regno"]);
$FEXAMNO = strtoupper($req["examno"]);
$folder_name = $req['folder_name'];
$query = "select fdegree, fregno, fname,fenroll,fcollcode from student
where (fregno = '{$reg_no}' or fenroll = '{$reg_no}')";
$results = $aobj_context->pobj_db->GetRow($query);
$reg_no = $results['fregno'];
$fdegree = $results['fdegree'];
$fcollcode = $results['fcollcode'];
$lstr_param_reval = $req["myJSONText"];
$mobj_json_reval_data = $lstr_param_reval;
$reval_arr_data = $mobj_json_reval_data;
$int_codes_arr=array();
$get_college_code=" select date_format(current_date,'%d/%m/%Y') as curr_date,FRVLASTDATE,FRTLASTDATE,FXEROXLASTDATE,FCVLASTDATE from res_fee
where fregno = '{$reg_no}' and fexamno = '{$FEXAMNO}'";
$lobj_get_college_code = $aobj_context->pobj_db->GetRow($get_college_code);
$curr_date = $lobj_get_college_code['curr_date'];
$FRVLASTDATE = $lobj_get_college_code['FRVLASTDATE'];
$FRTLASTDATE = $lobj_get_college_code['FRTLASTDATE'];
$FXEROXLASTDATE = $lobj_get_college_code['FXEROXLASTDATE'];
$FCVLASTDATE = $lobj_get_college_code['FCVLASTDATE'];
$app_number=GetNextNumber($aobj_context,$fcollcode);
foreach($reval_arr_data as $ak=>$av)
{
//var_dump($av['TotalAmount']);
$FSUBCODE=$av["sub_code"];
$FAPPLASTDATE = "";
$insert="INSERT INTO res_stud
(
APPNO, FAPPDATE, FDEGREE, FEXAMNO,
FCOLLCODE, FREGNO, FSUBCODE, FCORRTYPE,
FAMOUNT, FTOTAL,
FLOGDATE,FPAYMENTYPE,FAPPLASTDATE
)values
('{$app_number}',current_date(),'{$fdegree}','{$FEXAMNO}',
'{$fcollcode}','{$reg_no}','{$FSUBCODE}','{$av["fcorrtype"]}',
'{$av["Amount"]}',{$av["TotalAmount"]},current_date(),'{$fpaymode}','{$FAPPLASTDATE}')";
$lobj_insert = $aobj_context->pobj_db->Execute($insert);
}
if($lobj_insert)
{
UpdateNextNumber($aobj_context,$fcollcode);
$query ="select * from masbank where ifnull(fsuspend,'') <> 'T'";
$resmasbank = $aobj_context->pobj_db->getAll($query);
$get_univcode="select funivcode from control ";
$lobj_get_univcode = $aobj_context->pobj_db->GetRow($get_univcode);
$univ_code=$lobj_get_univcode['funivcode'];
//$data['html'] = $html;
//$data['masbank'] = $resmasbank;
$data['fpaymode'] = $fpaymode;
$data['funivcode'] = $univ_code;
$data['fappno'] = $app_number;
$data['applied_date'] = date("Y/m/d");
if($fpaymode=="POSTOFFICE")
{
$data['note'] = "Note your application number for future reference. Print the Challan / Application. Make the payment at nearest Post Office.";
$link = "http://results.logisys.org/" . $folder_name . "//app.php?a=PrintRevaluationApplicationFormChallan&app_no=" . $app_number . "";
$data['link'] =$link;
}
else if($fpaymode=="Other Banks")
{
$data['note'] ="Note your application number for future reference.";
$data['masbank'] = $resmasbank;
if($isRazorPay)
{
$razorpayResp =pay_with_razorPay($aobj_context,$app_number,$univ_code);
$data['razorpayResp'] = $razorpayResp;
}
if($isPaytm)
{
$paytmResp =pay_with_paytm($aobj_context,$app_number,$univ_code);
$data['paytmResp'] = $paytmResp;
}
}
else if($fpaymode=="HDFC BANK (Challan)")
{
$data['note'] ="Note your application number for future reference.";
$data['link']="";
}
else
{
$data['note'] ="Note your application number for future reference.";
}
echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
return;
}
else
{
$arr='Updation Failed';
echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
return;
}
}
function uGetRevalutionApplications($aobj_context){
$reg_no=$aobj_context->mobj_data["regno"];
$exam_no=$aobj_context->mobj_data["examno"];
$folderName = $aobj_context->mobj_data["folderName"];
$query = "select fdegree, fregno, fname,fenroll,fcollcode from student
where (fregno = '{$reg_no}' or fenroll = '{$reg_no}')";
$results = $aobj_context->pobj_db->GetRow($query);
$reg_no = $results['fregno'];
$tableHeader = array();
$tableHeader = [
"Sl No",
"Application No",
"Amount",
"Applied Date",
"Status",
"Print",
];
$get_data="select distinct res_stud.APPNO,res_stud.FTOTAL,DATE_FORMAT(res_stud.FAPPDATE,'%d/%m/%Y') as FAPPDATE,res_stud.FCHALLANNO,
res_stud.FPAYMENTYPE,res_stud.FPAYMENTSTATUS,res_stud.FPAYMENTCONFIRM,res_stud.FAPPLASTDATE,
if(DATE_ADD(GREATEST(FRVLASTDATE,FRTLASTDATE,FXEROXLASTDATE,FCVLASTDATE),INTERVAL 2 DAY)>=current_date,'1','0') AS last_date,
if(fackdate is null,'1',if(funivrecdate is null,'2','3')) as app_status from res_stud,res_fee
where res_stud.FREGNO='{$reg_no}' and res_stud.FEXAMNO ='{$exam_no}' and res_fee.FREGNO = res_stud.FREGNO
and res_fee.FDEGREE = res_stud.FDEGREE and res_fee.FEXAMNO = res_stud.FEXAMNO";
$lobj_get_data = $aobj_context->pobj_db->GetAll($get_data);
if(count($lobj_get_data)==0)
{
$send_data="";
$send_data->error_code=-1;
$send_data->status="failure";
$send_data->errMsg="No data found!";
echo json_encode($send_data);
return;
}
$k=0;
$sl_no=1;
$tableData = array();
foreach($lobj_get_data as $ak=>$av)
{
$row_obj = "";
$APPNO=$av['APPNO'];
$FTOTAL=$av['FTOTAL'];
$FAPPDATE=$av['FAPPDATE'];
$FPAYMENTYPE=$av['FPAYMENTYPE'];
$FPAYMENTSTATUS=$av['FPAYMENTSTATUS'];
$FCHALLANNO=$av['FCHALLANNO'];
$app_status=$av['app_status'];
$FPAYMENTCONFIRM=$av['FPAYMENTCONFIRM'];
$lastdate = $av['last_date'];
$FAPPLASTDATE = $av['FAPPLASTDATE'];
if($k%2==0)
$class='tbl_row1';
else
$class='tbl_row_alter1';
$str_reval.="<tr>";
$str_reval.="<td class='{$class}' style='text-align:center; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;' >{$sl_no}</td>";
$row_obj->sl_no = $sl_no;
$str_reval.="<td class='{$class}' style='border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center; ' > {$APPNO}</td>";
$row_obj->APPNO = $APPNO;
$str_reval.="<td class='{$class}' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center; ' >{$FTOTAL} </td>";
$row_obj->FTOTAL = $FTOTAL;
$str_reval.="<td class='{$class}' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center; ' > {$FAPPDATE}</td>";
$row_obj->FAPPDATE = $FAPPDATE;
$qry="select count(*) as cnt from collexam where fdegree = '{$fdegree}'
and fcollcode = '{$fcollcode}'
and '{$FAPPLASTDATE}' < DATE_FORMAT(NOW(),'%Y-%m-%d')";
$exam_last_details = $aobj_context->pobj_db->GetRow($qry);
$cnt = $exam_last_details['cnt'];
if($FPAYMENTCONFIRM=='success')
{
$str_reval.="<td class='{$class}' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;color:green; ;text-align:center; ' >Received at University for processing</td>";
$row_obj->status = "Received at University for processing";
}
else
{
if($FPAYMENTYPE=="CASH")
{
$row_obj->status = "Payment not made at College";
}
else if($FPAYMENTYPE=="DEBIT/CREDIT/NET BANKING")
{
if($lastdate =='1')
{
$str_reval.="<td class='{$class}' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;color:red; ;text-align:center; '>Online Payment Pending</td>";
$row_obj->status = "Online Payment Pending";
}
else
{
$str_reval.="<td class='{$class}' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;color:red; ;text-align:center; '>Last date is over for Online Payment</td>";
$row_obj->status = "Last date is over for Online Payment";
}
}
else
{
$str_reval.="<td class='{$class}' style='text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;color:red; ;text-align:center; '>Payment Pending</td>";
$row_obj->status ="Payment Pending";
}
}
$div_data="";
if($FPAYMENTYPE=="DEBIT/CREDIT/NET BANKING" || $FPAYMENTYPE=="Other Banks")
{
if($FPAYMENTCONFIRM=="success")
{
$div_data.="<div class='raval_submit' style='margin-right:19px;width:125px; ' >
<span onclick=\"PrintRevaluationApplicationForm('{$APPNO}');\" style='float:left;margin-left:26px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Print App</span>
</div>";
$row_obj->print ="Print App";
$row_obj->link = "http://results.logisys.org/" .$folderName ."/app.php?a=PrintRevaluationApplicationForm&app_no=" .$APPNO;
}
else
{
/*if($lastdate =='1')
{
$div_data="<div class='raval_submit' style='margin-right:19px;width:129px; ;' >
<span onclick=\"MakeOnlinePayment('{$APPNO}');\" style='float:left;margin-left:8px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Make Payment</span>
</div>";
}*/
$query ="select masbank.*,control.funivcode from masbank, control where ifnull(fsuspend,'') <> 'T'";
$resmasbank = $aobj_context->pobj_db->getAll($query);
//var_dump()
//$resmasbank = json_encode($resmasbank,JSON_HEX_TAG);
$funivcode = $resmasbank[0]['funivcode'];
if($cnt > 0)
{
$div_data="<div class='raval_submit' style='margin-right:19px;width:129px; ;' >
<span style='float:left;margin-left:8px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Last Date is Over</span>
</div>";
$row_obj->print ="Last Date is Over";
}else
{
$div_data="<div class='raval_submit' style='margin-right:19px;width:129px; ;' >
<span onclick=\"MakeOnlinePayment('{$APPNO}','{$resmasbank}','{$funivcode}');\" style='float:left;margin-left:8px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Make Payment</span>
</div>";
$row_obj->print="Make Payment";
$row_obj->link ="Make Payment";
}
}
}
else if($FPAYMENTYPE=="POSTOFFICE")
{
$div_data="<div class='raval_submit' style='margin-right:19px;width:129px; ;' >
<span onclick=\"PrintRevaluationApplicationFormChallan('{$APPNO}');\" style='float:left;margin-left:26px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Print App</span>
</div>";
$row_obj->print="Print App";
$row_obj->link = "http://results.logisys.org/" .$folderName ."/app.php?a=PrintRevaluationApplicationForm&app_no=" .$APPNO;
}
else if($FPAYMENTYPE=="CASH")
{
$div_data="<div class='raval_submit' style='margin-right:19px;width:129px; ;' >
<span onclick=\"PrintRevaluationApplicationForm('{$APPNO}');\" style='float:left;margin-left:26px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Print App</span>
</div>";
$row_obj->print="Print App";
}
else
{
$div_data="<div class='raval_submit' style='margin-right:19px;width:129px; ;' >
<span onclick=\"PrintRevaluationApplicationFormChallan('{$APPNO}');\" style='float:left;margin-left:8px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Print Challan</span>
</div>";
$row_obj->print="Print Challan";
$row_obj->link ="http://results.logisys.org/" .$folderName ."/app.php?a=PrintRevaluationApplicationForm&app_no=" .$APPNO;
if(!empty($FCHALLANNO))
{
$div_data.="<div class='raval_submit' style='margin-right:19px;width:89px; ' >
<span onclick=\"PrintRevaluationApplicationForm('{$APPNO}');\" style='float:left;margin-left:8px;cursor: pointer; line-height: 19px;font-size:14px;font-weight:bold;'>Print App</span>
</div>";
$row_obj->print="Print App";
$row_obj->link ="http://results.logisys.org/" .$folderName ."/app.php?a=PrintRevaluationApplicationForm&app_no=" .$APPNO;
}
}
$str_reval.="</tr>";
$sl_no++;
$k++;
array_push($tableData,$row_obj);
}
$send_data ="";
$send_data->tableHeader = $tableHeader;
$send_data->tableData = $tableData;
$send_data->error_code = 0;
$send_data->status="success";
echo json_encode($send_data);
}
function GetNextNumber($aobj_context,$fcollcode)
{
$get_prefix_running_number = "select last_number from res_reval_code_generator
where college_code = '{$fcollcode}' and type='Student' ";
$lobj_get_prefix_running_number = $aobj_context->pobj_db->GetRow($get_prefix_running_number);
$query= " Select FRVPREFIX from control";
$result = $aobj_context->pobj_db->GetRow($query);
if(!empty($lobj_get_prefix_running_number['last_number']))
{
$next_number = $lobj_get_prefix_running_number['last_number'];
$last_number = str_pad($next_number,4, "0", STR_PAD_LEFT);
}
else
{
$next_number=0001;
$insert_into="insert into res_reval_code_generator(college_code,last_number,type)
values('{$fcollcode}',{$next_number},'Student')";
$lobj_insert_into = $aobj_context->pobj_db->Execute($insert_into);
$last_number = str_pad($next_number,4, "0", STR_PAD_LEFT);
}
return $result['FRVPREFIX'].str_pad($fcollcode,4, "0", STR_PAD_LEFT).$last_number;
}
function UpdateNextNumber($aobj_context,$fcollcode)
{
$update_code_generator = "update res_reval_code_generator set last_number = last_number+1
where college_code = '{$fcollcode}' and type='Student' ";
$lobj_update_code_generator = $aobj_context->pobj_db->Execute($update_code_generator);
}
function uGenerateOrderId($aobj_context)
{
$req = $aobj_context->req_body;
$isPaytm = $req['isPaytm'];
$isRazorPay = $req['isRazorPay'];
$app_number = $req['app_number'];
$univ_code=$aobj_context->mobj_data["univcode"];
if($isPaytm)
{
$resp = pay_with_paytm($aobj_context,$app_number,$univ_code);
$respObj ="";
$respObj->error_code = 0;
$respObj->data = $resp;
echo json_encode($respObj);
}
if($isRazorPay)
{
$resp = pay_with_razorPay($aobj_context,$app_number,$univ_code);
$respObj ="";
$respObj->error_code = 0;
$respObj->data = $resp;
echo json_encode($respObj);
}
}
include('razorpay/razorpay-php/Razorpay.php');
require_once('razorPayConfig.php');
use Razorpay\Api\Api;
function pay_with_razorPay($aobj_context,$app_number,$univ_code)
{
$api = new Api('rzp_test_FZazLkXZLydpKS', 'fy1e9wzLm5cEuc14gL7GLdNf');
$get_data = "select cs.fregno as fregno, IFNULL(cs.FTOTAL,0) as ftotalfee,
control.funivname,pdf_logo_path, '999999999' as fmobileno
,'99999' as fname,'999999@gmail.com' as femail
from control, res_stud cs
inner join college c on cs.fcollcode = c.fcollcode
where appno = '{$app_number}'";
$result = $aobj_context->pobj_db->GetRow($get_data);
$fregno = $result['fregno'];
$ftotalfee = $result['ftotalfee'];
$fname = $result['fname'];
$fmobileno = $result['fmobileno'];
$femail = $result['femail'];
$funivname = $result['funivname'];
$logo = $result['pdf_logo_path'];
$number = rand(10000001,99999999);
$orderData = [
'receipt' => $number,
'amount' => $ftotalfee * 100, // 2000 rupees in paise
'currency' => 'INR',
'payment_capture' => 1 // auto capture
];
$razorpayOrder = $api->order->create($orderData);
$razorpayOrderId = $razorpayOrder['id'];
$displayAmount = $amount = $orderData['amount'];
$displayAmount = $displayAmount / 100;
$query = "update res_stud set forderid = '{$razorpayOrderId}', fpaymenttype = 'razorpay'
where appno = '{$app_number}'";
$result1 = $aobj_context->pobj_db->Execute($query);
$razorpayResp = "";
$razorpayResp->key = 'rzp_test_FZazLkXZLydpKS';
$razorpayResp->order_id = $razorpayOrderId;
$razorpayResp->amount = $displayAmount;
return $razorpayResp;
}
//require_once("paytm/lib/config_paytm.php");
//require_once("paytm/lib/encdec_paytm.php");
function pay_with_paytm($aobj_context,$app_number,$univ_code)
{
$get_data = "select cs.fregno as fregno, IFNULL(cs.FTOTAL,0) as ftotalfee,
control.funivname,pdf_logo_path, '999999999' as fmobileno
,'99999' as fname,'999999@gmail.com' as femail
from control, res_stud cs
inner join college c on cs.fcollcode = c.fcollcode
where appno = '{$app_number}'";
$result = $aobj_context->pobj_db->GetRow($get_data);
$fregno = $result['fregno'];
$ftotalfee = $result['ftotalfee'];
$number = rand(10000000,99999999);
$query = "update res_stud set forderid = '{$number}', fpaymenttype = 'paytm' where appno = '{$app_number}'";
$result1 = $aobj_context->pobj_db->Execute($query);
$ORDER_ID = $number;
$CUST_ID = $fregno;
$INDUSTRY_TYPE_ID = "EducationGovernment";
$CHANNEL_ID = "WEB";
$TXN_AMOUNT = $ftotalfee;
$paramList = array();
$paramList['MID'] = PAYTM_MERCHANT_MID;
$paramList['ORDER_ID'] = $ORDER_ID;
$paramList['CUST_ID'] = $CUST_ID;
$paramList['MERC_UNQ_REF'] = $app_number;
$paramList['INDUSTRY_TYPE_ID'] = $INDUSTRY_TYPE_ID;
$paramList['CHANNEL_ID'] = $CHANNEL_ID;
$paramList['TXN_AMOUNT'] = $TXN_AMOUNT;
$paramList['WEBSITE'] = PAYTM_MERCHANT_WEBSITE;
$paramList['CALLBACK_URL'] = "http://results.logisys.org/bnu/pgResponse.php?ORDER_ID=" . $ORDER_ID;
$checkSum = getChecksumFromArray($paramList,PAYTM_MERCHANT_KEY);
$responseObj ="";
$responseObj->paytm_params = $paramList;
$responseObj->checksum = $checkSum;
return $responseObj;
}
require('razorpay/config.php');
require('razorpay/razorpay-php/Razorpay.php');
use Razorpay\Api\Errors\SignatureVerificationError;
function checkrazorpaystatus($aobj_context)
{
$payid = $aobj_context->req_body['razorpay_payment_id'];
$error = "Payment Failed";
$keyId = "rzp_test_FZazLkXZLydpKS";
$keySecret = "fy1e9wzLm5cEuc14gL7GLdNf";
$api = new Api($keyId, $keySecret);
$payment = $api->payment->fetch($payid);
if($payment->status == 'captured')
{
$servername = "97.74.228.93";
$username = "logisys3_logu";
$password = "Logisys@2106";
$dbname = "logisys3_comexam";
$conn = new mysqli($servername, $username, $password, $dbname);
$get_data = "select * from dbname where ifnull(fdeleted,'') <> 'T'";
$result1=$conn->query($get_data);
if (mysqli_num_rows($result1) > 0)
{
// output data of each row
$dbnames = array();
while($row = mysqli_fetch_assoc($result1))
{
$dbnames[$row['FUNIVCODE']] = $row['FDBNAME'];
}
}
mysqli_close($conn);
$servername = "97.74.228.93";
$username = "logisys3_logu";
$password = "Logisys@2106";
$dbname = $dbnames[$payment->notes->univcode];
$conn = new mysqli($servername, $username, $password, $dbname);
$status = "success";
$productinfo = $payment->notes->appno;
$txnid = $payment->id;
$amount = $payment['TXNAMOUNT'] = ((float)$payment->amount/100);
$firstname = 'razorpay';
//$Amount = $payment['TXNAMOUNT'];
$update="update res_stud set FPAYMENTREMARKS='{$txnid}',FPAYMENTSTATUS='{$status}',
FPAYMENTCONFIRM='{$status}', fackdate = current_date(), funivrecdate = current_date(),
fackuser = '{$firstname}', FCHALLANNO = '{$txnid}'
where APPNO='{$productinfo}'";
$result=$conn->query($update);
$arr['amount'] = $amount;
$arr['tranid'] = $txnid;
$arr['appno'] = $productinfo;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
else
{
$arr= "failure";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
$html = "<p>Your payment failed</p>
<p>{$error}</p>";
}
}
?>
|