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.81.172
<?php
function getprogramedet($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$deggrp = $aobj_context->mobj_data['deggrp'];
$query = "SELECT distinct fprogcode, fdegree FROM degree WHERE fdeggrp='{$deggrp}'";
// var_dump($query);
$result = $aobj_context->pobj_db->GetAll($query);
if($result){
echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
return;
}else{
$arr['msg'] = "Data not found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
function loaddegreeheads($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$deggrp = $aobj_context->mobj_data['deggrp'];
$Programee = $aobj_context->mobj_data['Programee'];
$Programee_arr = explode(",", $Programee);
foreach($Programee_arr as $key => $value){
$Programeer .= "'".$value."',";
}
$Programee_array = substr_replace($Programeer ,"",-1);
if($Programee_array === "'All'"){
$deggrpCond = "and IFNULL(fprogcode, '') <> ''";
}else{
$deggrpCond = "and fprogcode in ({$Programee_array})";
}
$query = "SELECT IFNULL(fdegree,'') AS fdegree, IFNULL(fdescpn,'') AS fdescpn FROM degree
WHERE fdeggrp='{$deggrp}' {$deggrpCond}
GROUP BY fdegree;";
// var_dump($query);
$result = $aobj_context->pobj_db->GetAll($query);
if($result){
echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
return;
}else{
$arr['msg'] = "Data not found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
function getDatesEntryForm($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$deggrp = $aobj_context->mobj_data['deggrp'];
$Programee = $aobj_context->mobj_data['Programee'];
$degree = $aobj_context->mobj_data['degree'];
$sem = $aobj_context->mobj_data['sem'];
// $programee_arr = explode(",", $Programee);
// foreach($programee_arr as $key => $value){
// $Programeer .= "'".$value."',";
// }
// $programee_array = substr_replace($Programeer ,"",-1);
// if($programee_array === "'All'"){
// $programeeCond = "";
// }else{
// $programeeCond = "and fprogcode in ({$programee_array})";
// }
// $degree_arr = explode(",",$degree);
// foreach($degree_arr as $key => $value){
// $degr .= "'".$value."',";
// }
// $degree_array = substr_replace($degr ,"",-1);
// if($degree === "All"){
// $degreeCond = " and fdegree BETWEEN '0' AND 'Z'";
// }else{
// $degreeCond = "and fdegree in ($degree_array)";
// }
// $sem_arr = explode(",",$sem);
// foreach($sem_arr as $key => $value){
// $semstr .= "'".$value."',";
// }
// $semstr_array = substr_replace($semstr ,"",-1);
// if($sem === "All"){
// $semCond = "and fexamno BETWEEN '0' AND 'Z'";
// }else{
// $semCond = "and fexamno in ($semstr_array)";
// }
$query = "SELECT fid,fheadname,fdeleted FROM notifhead WHERE fdeleted<>'T'";
// var_dump($query);die();
$result = $aobj_context->pobj_db->GetAll($query);
// $query1="SELECT fnotifdate,fnotifname FROM notifsum WHERE fdeggrp='BED' {$programeeCond}
// {$degreeCond} {$semCond}";
// $result1 = $aobj_context->pobj_db->GetRow($query1);
if($result){
echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
return;
}else{
$arr['msg'] = "Data not found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
function update_dates($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$user= $aobj_context->mobj_data['user'];
$usertype= $aobj_context->mobj_data['usertype'];
$deggrp= $aobj_context->mobj_data['deggrp'];
$Programee= $aobj_context->mobj_data['Programee'];
$degree= $aobj_context->mobj_data['degree'];
$sem= $aobj_context->mobj_data['sem'];
$notifname= $aobj_context->mobj_data['notifname'];
$notifdate= $aobj_context->mobj_data['notifdate'];
$table = json_decode($aobj_context->mobj_data['tabledata'], true);
$fnotifid= $aobj_context->mobj_data['fnotifid'];
$degreestr = str_replace(",", "*", $degree);
$Programeestr = str_replace(",", "*", $Programee);
$semstr = str_replace(",", "*", $sem);
$degree_arr = explode(",", $degree);
foreach($degree_arr as $key => $value){
$degr .= "'".$value."',";
}
$degree_array = substr_replace($degr ,"",-1);
$sem_arr = explode(",", $sem);
foreach($sem_arr as $key => $value){
$semr .= "'".$value."',";
}
$sem_array = substr_replace($semr ,"",-1);
$programee_arr = explode(",", $Programee);
foreach($programee_arr as $key => $value){
$Programeer .= "'".$value."',";
}
$programee_array = substr_replace($Programeer ,"",-1);
if($sem_array === "'All'"){
$semCond = "";
}else{
$semCond = "and fexamno in ({$sem_array})";
}
if($programee_array === "'All'"){
$programeeCond = "";
}else{
$programeeCond = "and fprogcode in ({$programee_array})";
}
if($degree_array === "'All'"){
$degCond = "";
}else{
$degCond = "and fdegree in ({$degree_array})";
}
$yearexam = "select fyear, fexamtype from notif_deggrp where fdeggrp='{$deggrp}'";
$resExam = $aobj_context->pobj_db->GetRow($yearexam);
$year = $resExam['fyear'];
$examtype = $resExam['fexamtype'];
if($fnotifid==='undefined'||$fnotifid===''){
$query="insert into notifsum
(fdeggrp, fdegree, fexamno, fnotifname, fnotifdate, fcreateddate,
fcreateduser, fdeleted, fprogcode,fyear,fexamtype)
values('{$deggrp}','{$degreestr}','{$semstr}','{$notifname}','{$notifdate}',
now(),'{$user}', '', '{$Programeestr}','{$year}','{$examtype}')";
$result = $aobj_context->pobj_db->Execute($query);
}else {
$query="UPDATE notifsum
SET
fdeggrp = '{$deggrp}',
fdegree = '{$degreestr}',
fexamno = '{$semstr}',
fnotifname = '{$notifname}',
fnotifdate = '{$notifdate}',
fcreateddate = NOW(),
fcreateduser = '{$user}',
fdeleted = '',
fprogcode = '{$Programeestr}',
fexamtype = '{$examtype}',
fyear = '{$year}'
WHERE
fnotifid = '{$fnotifid}'";
$result = $aobj_context->pobj_db->Execute($query);
}
$last_inserted_id = $aobj_context->pobj_db->Insert_ID();
$query="select fdegree, fexamno, fprogcode from degree
where fdeggrp='{$deggrp}' {$semCond} {$degCond} {$programeeCond}";
$result1 = $aobj_context->pobj_db->GetAll($query);
$deltequery="delete from notifdet where fnotifid='{$fnotifid}'";
$resultdelt = $aobj_context->pobj_db->Execute($deltequery);
foreach($result1 as $val){
$degree1 = $val['fdegree'];
$examno = $val['fexamno'];
$progcode = $val['fprogcode'];
foreach($table as $value) {
if($value['checkbox']){
$bool = 'T';
}else{
$bool = 'F';
}
if($fnotifid==='undefined'||$fnotifid===''){
$last_insert_id=$last_inserted_id;
}else {
$last_insert_id=$fnotifid;
}
$queryIns1 = "insert into notifdet(fnotifid, fdeggrp, fdegree, fexamno,
fprogcode, fyear, fexamtype, fheadid, fstartdate,
fenddate, fremarks, fcreateddate, fcreateduser, fdeleted)
values('{$last_insert_id}', '{$deggrp}', '{$degree1}', '{$examno}',
'{$progcode}', '{$year}', '{$examtype}', '{$value['fid']}',
date_format(str_to_date('{$value['frmdate']}', '%d/%m/%Y'),'%Y-%m-%d'),
date_format(str_to_date('{$value['todate']}','%d/%m/%Y'),'%Y-%m-%d'),
'{$value['remarks']}', now(), '{$user}', '{$bool}')";
$resultIns = $aobj_context->pobj_db->Execute($queryIns1);
}
}
if($result){
echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
return;
}else{
$arr['msg'] = "Data not found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
function loadeditingDet($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$query = "SELECT *, DATE_FORMAT(fnotifdate,'%d/%m/%Y') AS niceDate
FROM notifsum";
$result = $aobj_context->pobj_db->GetAll($query);
if($result){
echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
return;
}else{
$arr['msg'] = "Data not found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
function loadeditdet($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$fnotifid = $aobj_context->mobj_data['fnotifid'];
$query = "select fnotifname, fnotifdate, fdeggrp, fdegree, fprogcode,
fexamno from notifsum where fnotifid = '{$fnotifid}'";
$result = $aobj_context->pobj_db->GetRow($query);
$query = "select h.fheadname,h.fid, s.fnotifname, if(s.fnotifdate = '0000-00-00','',s.fnotifdate) as fnotifdate,
s.fdeggrp, s.fdegree, s.fprogcode,
s.fexamno,d.fremarks as remarks, date_format(if(d.fstartdate= '0000-00-00','',d.fstartdate), '%d/%m/%Y')as frmdate,
date_format(if(d.fenddate = '0000-00-00','',d.fenddate), '%d/%m/%Y')as todate, d.fdeleted from notifdet d inner join notifsum s on
s.fnotifid = d.fnotifid inner join notifhead h on h.fid = d.fheadid where
s.fnotifid='{$fnotifid}' group by h.fheadname order by fid";
// var_dump($query,"ddddd");
// die();
$result1 = $aobj_context->pobj_db->GetAll($query);
if($result){
$arr['sum'] = $result;
$arr['det'] = $result1;
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,0,"success");
return;
}else{
$arr['msg'] = "Data not found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
function viewNotifdet($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$deggrp = $aobj_context->mobj_data['deggrp'];
if($deggrp === "All"){
$deggrpCond = " ";
}else{
$deggrpCond = "and fdeggrp='{$deggrp}'";
}
$query = "select *, DATE_FORMAT(fnotifdate,'%d/%m/%Y') AS niceDate from notifsum
where fstatus='t' $deggrpCond order by fverifdate desc";
$result = $aobj_context->pobj_db->GetAll($query);
if($result){
echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
return;
}else{
$arr['msg'] = "Data not found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
?>
|