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.145.72.240
<?php
function saveFinanceTeacherDetails($aobj_context){
include ('/var/www/html/sms/sendsmsapiv1.php');
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$data = json_decode($aobj_context->mobj_data["teacherData"], true);
if($data['status'] === false){
$qry = "select * from fms_masteach where fteachcode = '{$data['empcode']}'";
$res = $aobj_context->pobj_db->GetRow($qry);
if(count($res) > 0){
$arr['msg'] = "Teacher code already present";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error");
return;
}
}
$query = "select fteachcode from fms_masteach where fteachcode = '{$data['empcode']}'";
$result = $aobj_context->pobj_db->GetRow($query);
if(count($result)>0){
$query = "update fms_masteach set ftitle = '{$data['empTitle']}', fteachname = '{$data['empName']}',
fgender = '{$data['empGender']}', fdesigncode = '{$data['empDesignation']}',
fdept = '{$data['empDepartment']}', faddress = '{$data['empAdress']}',
fmobile = '{$data['empMobileNo']}', femail = '{$data['empEmailId']}',
ftype = '{$data['empType']}', faccno = '{$data['empAccNo']}', fifsc = '{$data['empIfsc']}',
fbank = '{$data['empBankName']}', fbranch = '{$data['empBranch']}', fpan = '{$data['empPanNo']}'
where fteachcode='{$data['empcode']}'";
}else{
$query = "insert into fms_masteach(fteachcode, ftitle, fteachname, fgender,
fdesigncode, fdept, faddress, fmobile, femail, ftype, faccno, fifsc,
fbank, fbranch, fpan)values('{$data['empcode']}', '{$data['empTitle']}', '{$data['empName']}',
'{$data['empGender']}',
'{$data['empDesignation']}', '{$data['empDepartment']}', '{$data['empAdress']}',
'{$data['empMobileNo']}', '{$data['empEmailId']}', '{$data['empType']}',
'{$data['empAccNo']}', '{$data['empIfsc']}', '{$data['empBankName']}', '{$data['empBranch']}',
'{$data['empPanNo']}')";
}
$result = $aobj_context->pobj_db->Execute($query);
$qry = "update fms_masuser set fmobileno='{$data['empMobileNo']}'
where fteachcode='{$data['empcode']}'";
$res = $aobj_context->pobj_db->Execute($qry);
if($result){
date_default_timezone_set('Asia/Kolkata');
$time = date("h:i A");
$otp = rand(100000, 999999);
$arr['msg'] = "Successfully saved";
$smsotp = "From Uniclare: Dear Teacher, OTP for Registration is $otp. sent at {$time} - Uniclare";
$upd = "update fms_masteach set fotp = '{$otp}'
where fteachcode='{$data['empcode']}'";
$res = $aobj_context->pobj_db->Execute($upd);
if($res){
$sms = new SMS('026', 'OTP');
$sms->sendIndvidualSms($data['empMobileNo'], $smsotp, '900', 'PGET');
$smsresp = 'Sent';
$row["sms"] = $smsresp;
}
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}else{
$arr['msg'] = "failed to update";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error");
return;
}
}
function viewFinanceTeacherDetails($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$query = "select fteachcode, ftitle, fteachname, fgender,
fdesigncode, fdept, faddress, fmobile, femail, ftype, faccno, fifsc,
fbank, fbranch, fpan from fms_masteach";
$result = $aobj_context->pobj_db->GetAll($query);
if($result){
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}else{
$arr['msg'] = "No data found";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error");
return;
}
}
function getFinanceTeachDet($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$teachcode = $aobj_context->mobj_data["teachcode"];
$query = "select fteachcode, ftitle, fteachname, fgender,
fdesigncode, fdept, faddress, fmobile, femail, ftype, faccno, fifsc,
fbank, fbranch, fpan from fms_masteach where fteachcode='{$teachcode}'";
$result = $aobj_context->pobj_db->GetRow($query);
if($result){
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}else{
$arr['msg'] = "No data found";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error");
return;
}
}
function financeTeacherOtp($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$teachcode = $aobj_context->mobj_data["teachcode"];
$mobile = $aobj_context->mobj_data["mobile"];
$otp = $aobj_context->mobj_data["otp"];
$qry = "select ifnull(fotp, '')as fotp from fms_masteach
where fteachcode='{$teachcode}' and fmobile='{$mobile}' and fotp='{$otp}'";
$res = $aobj_context->pobj_db->GetRow($qry);
if(count($res) > 0){
$query = "update fms_masteach set fstatus = 'T'
where fteachcode='{$teachcode}' and fmobile='{$mobile}'
and fotp='{$otp}'";
$result = $aobj_context->pobj_db->Execute($query);
if($result){
$arr['msg'] = "Successfully Updated";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
} else {
$arr['msg'] = "Failed to update";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error");
return;
}
} else {
$arr['msg'] = "Enter Valid OTP";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error");
return;
}
}
?>
|