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.119.132.80
<?php
function getDegreeDet($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$fdegree = $aobj_context->mobj_data['fdegree'];
$query = "select fdegree,fdescpn,fexamno,fexamname,ifnull(ffaculty,'') as ffaculty,
ifnull(fadyear,'') as fadyear, ifnull(fadexamtyp,'') as fadexamtyp,fmeyear,fmeexamtyp,
fdeggrp,fexamdate,ifnull(freshold,'') as freshold,
ifnull(fadmdeg,'F') as fadmdeg,ifnull(feligrem01,'') as feligrem01,
ifnull(feligrem02,'') as feligrem02, ifnull(frvappfee,'') as frvappfee,
ifnull(fxrappfee,'') as fxrappfee,ifnull(frvappfine,'') as frvappfine from degree
where fdegree='{$fdegree}' and ifnull(fdeleted,'') <> 'T' limit 1";
$result = $aobj_context->pobj_db->GetRow($query);
$qry = "select fexamno,fexamname,ifnull(ftotsub,'') as ftotsub,
ifnull(fresexamdate,'') as fresexamdate, ifnull(fresyear,'') as fresyear,
ifnull(fresexamtype,'') as fresexamtype,
ifnull(frvfee,'') as frvfee,ifnull(frtfee,'') as frtfee,
ifnull(fxeroxfee,'') as fxeroxfee,ifnull(fcvfee,'') as fcvfee,ifnull(frifee,'') as frifee,
ifnull(frvdays,'') as frvdays,ifnull(frtdays,'') as frtdays,ifnull(fxrdays,'') as fxrdays,
ifnull(fcvdays,'') as fcvdays,ifnull(fridays,'') as fridays
from degree where fdegree='{$fdegree}'
order by fexamno";
$result1 = $aobj_context->pobj_db->GetAll($qry);
// var_dump($qry,$result1);
// die();
if($result && count($result)>0)
{
$res['DegDet'] = $result;
$res['SemDet'] = $result1;
echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success");
}
else
{
$arr['msg'] = 'No details found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function saveDegree($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$data = $aobj_context->req_body['data'];
$DegDet = $data['DegDet'];
$semDet = $data['SemDet'];
$chkDeg = "select fdegree from degree where fdegree='{$DegDet['fdegree']}'";
$resdeg = $aobj_context->pobj_db->getAll($qry);
if(count($resdeg)>0){
//=====If degree is found, update deg details and its semester details===== //
$query = "update degree set
fdescpn='{$DegDet['fdescpn']}',
fexamname='{$DegDet['fexamname']}',ffaculty='{$DegDet['ffaculty']}',
fadyear='{$DegDet['fadyear']}', fadexamtyp='{$DegDet['fadexamtyp']}',
fmeyear='{$DegDet['fmeyear']}',fmeexamtyp='{$DegDet['fmeexamtyp']}',
fdeggrp='{$DegDet['fdeggrp']}',fexamdate='{$DegDet['fexamdate']}',
freshold='{$DegDet['freshold']}', fadmdeg='{$DegDet['fadmdeg']}',
feligrem01='{$DegDet['feligrem01']}',feligrem02='{$DegDet['feligrem02']}',
frvappfee = '{$DegDet['frvappfee']}', fxrappfee = '{$DegDet['fxrappfee']}',
frvappfine = '{$DegDet['frvappfine']}'
where fdegree='{$DegDet['fdegree']}'";
$result = $aobj_context->pobj_db->Execute($query);
if($result && count($result)>0)
{
foreach ($semDet as $key => $value) {
$qry = "update degree set fexamno='{$value['fexamno']}',fexamname='{$value['fexamname']}',ftotsub='{$value['ftotsub']}',
frvfee='{$value['frvfee']}',frtfee='{$value['frtfee']}',fxeroxfee='{$value['fxeroxfee']}',fcvfee='{$value['fcvfee']}',
frifee='{$value['frifee']}',
frvdays='{$value['frvdays']}',frtdays='{$value['frtdays']}',fxrdays='{$value['fxrdays']}',
fcvdays='{$value['fcvdays']}',fridays='{$value['fridays']}'
where fdegree='{$DegDet['fdegree']}' and fexamno='{$value['fexamno']}'";
$result1 = $aobj_context->pobj_db->Execute($qry);
}
if(!$result1){
$arr['msg'] = 'Semesters details was not updated, please try after sometime.';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}else{
$arr['msg'] = "Updated successfully.";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
}
else
{
$arr['msg'] = 'Degree details was not updated, please try after sometime.';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}else{
// ====== If new deg is inserted, add to degree table ====== //
$values = '';
foreach ($semDet as $key => $value) {
$values .= "('{$DegDet['fdegree']}','{$DegDet['fdescpn']}','{$value['fexamno']}','{$value['fexamname']}',
'{$DegDet['ffaculty']}','{$DegDet['fadyear']}','{$DegDet['fadexamtyp']}','{$DegDet['fmeyear']}','{$DegDet['fmeexamtyp']}',
'{$DegDet['fdeggrp']}','{$DegDet['fexamdate']}','{$DegDet['freshold']}','{$DegDet['fadmdeg']}',
'{$DegDet['feligrem01']}','{$DegDet['feligrem02']}','{$value['ftotsub']}','{$value['frvfee']}',
'{$value['frtfee']}','{$value['fxeroxfee']}','{$value['fcvfee']}','{$value['frifee']}',
'{$value['frvdays']}','{$value['frtdays']}','{$value['fxrdays']}','{$value['fcvdays']}','{$value['fridays']}','F'),";
}
$values = rtrim($values, ',');
$query = " insert ignore into degree(fdegree,fdescpn,fexamno,fexamname,ffaculty,fadyear,
fadexamtyp,fmeyear,fmeexamtyp,fdeggrp,fexamdate,freshold,
fadmdeg,feligrem01,feligrem02,ftotsub,frvfee,frtfee,fxeroxfee,fcvfee,frifee,frvdays,frtdays,fxrdays,
fcvdays,fridays,fdeleted) values {$values}";
// var_dump($query);
$result = $aobj_context->pobj_db->Execute($query);
if($result && count($result)>0)
{
$arr['msg'] = "New Degree created successfully.";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
else
{
$arr['msg'] = 'Degree details was not updated, please try after sometime.';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
}
?>
|