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.144.91.130
<?php
function loadalldata($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$data = $aobj_context->mobj_data['data'];
if($data == "All"){
$deggrpcond = "WHERE d.fdeggrp <> ''";
}else{
$deggrpcond = "WHERE d.fdeggrp='{$data}'";
}
if($sem === "All"){
$semCond = "d.fexamno BETWEEN '0' AND 'Z'";
}else{
$semCond = "d.fexamno = '{$sem}'";
}
if($subj === "All"){
$subjCond = "s.fqpcode BETWEEN '0' AND 'Z'";
}else{
$subjCond = "s.fqpcode='{$subj}'";
}
$deggrpCond = "";
$degreeCond = "";
$programeeCond = "";
$semCond = "";
$subjCond = "";
//programme
$queryprog = "SELECT distinct d.fprogcode, d.fdegree FROM degree d $deggrpcond";
$resultprog = $aobj_context->pobj_db->GetAll($queryprog);
//degree
$query_degree = "SELECT IFNULL(d.fdegree,'') AS fdegree, IFNULL(d.fdescpn,'') AS fdescpn FROM degree d
$deggrpcond $deggrpCond
GROUP BY fdegree;";
$result_degree = $aobj_context->pobj_db->GetAll($query_degree);
//subject
$query_subject = " SELECT DISTINCT s.fsubcode, s.fsubname,s.fqpcode
FROM degree d
INNER JOIN subject s ON d.fdegree = s.fdegree AND d.fexamno = s.fexamno
$deggrpcond
and s.fqpcode in
((select distinct fqpcode from tdvs_tabsum union select fqpcode from tdvs_scriptreceive))
$degreeCond
$programeeCond
$semCond
AND s.fdoe != '0000-00-00';";
$result_subject = $aobj_context->pobj_db->GetAll($query_subject);
//date
$query_date = " SELECT DISTINCT DATE_FORMAT(s.fdoe,'%d/%m/%Y') AS fdoe
FROM degree d
INNER JOIN subject s ON d.fdegree = s.fdegree AND d.fexamno = s.fexamno
$deggrpcond
and s.fqpcode in
((select distinct fqpcode from tdvs_tabsum union select fqpcode from tdvs_scriptreceive))
$degreeCond
$programeeCond
$semCond
AND s.fdoe != '0000-00-00'
$subjCond;";
$result_date = $aobj_context->pobj_db->GetAll($query_date);
$combinedResult = array(
"program" => $resultprog,
"degree" => $result_degree,
"subject" => $result_subject,
"dates" => $result_date);
if($resultprog){
echo $aobj_context->mobj_output->TOJSONEnvelope($combinedResult,0,"success");
return;
}else{
$arr['msg'] = "Subject Not Found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
// // var_dump($deggrp,$programee,$degree,$sem);
// // die();
// if($degree === "All"){
// $degreeCond = "d.fdegree BETWEEN '0' AND 'Z'";
// }else{
// $degreeCond = "d.fdegree = '{$degree}'";
// }
// if($programee === "All"){
// $programeeCond = "d.fprogcode BETWEEN '0' AND 'Z'";
// }else{
// $programeeCond = "d.fprogcode = '{$programee}'";
// }
// if($sem === "All"){
// $semCond = "d.fexamno BETWEEN '0' AND 'Z'";
// }else{
// $semCond = "d.fexamno = '{$sem}'";
// }
function loadtdvsdegree($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['program'];
if($deggrp == 'All'){
$deggrpcond = "WHERE d.fdeggrp <> ''";
}else{
$deggrpcond = "WHERE d.fdeggrp='{$deggrp}'";
}
if($programee === "All"){
$programeeCond = "";
$programeeCond1="";
}else{
$programeeCond = "and fprogcode='{$programee}'";
$programeeCond1="and d.fprogcode = '{$programee}'";
}
$degreeCond = "";
$semCond = "";
// degree
$query_degree = "SELECT IFNULL(d.fdegree,'') AS fdegree, IFNULL(d.fdescpn,'') AS fdescpn FROM degree d
$deggrpcond $programeeCond
GROUP BY fdegree;";
$result_degree = $aobj_context->pobj_db->GetAll($query_degree);
//subject
$query_subject = " SELECT DISTINCT s.fsubcode, s.fsubname,s.fqpcode
FROM degree d
INNER JOIN subject s ON d.fdegree = s.fdegree AND d.fexamno = s.fexamno
$deggrpcond
and s.fqpcode in
((select distinct fqpcode from tdvs_tabsum union select fqpcode from tdvs_scriptreceive))
$degreeCond
$programeeCond1
$semCond
AND s.fdoe != '0000-00-00';";
$result_subject = $aobj_context->pobj_db->GetAll($query_subject);
//date
$query_date = " SELECT DISTINCT DATE_FORMAT(s.fdoe,'%d/%m/%Y') AS fdoe
FROM degree d
INNER JOIN subject s ON d.fdegree = s.fdegree AND d.fexamno = s.fexamno
$deggrpcond
and s.fqpcode in
((select distinct fqpcode from tdvs_tabsum union select fqpcode from tdvs_scriptreceive))
$degreeCond
$programeeCond1
$semCond
AND s.fdoe != '0000-00-00'
$subjCond;";
$result_date = $aobj_context->pobj_db->GetAll($query_date);
// var_dump($query_date);
$combinedResult = array(
"degree" => $result_degree,
"subject" => $result_subject,
"dates" => $result_date);
if($result_degree){
echo $aobj_context->mobj_output->TOJSONEnvelope($combinedResult,0,"success");
return;
}else{
$arr['msg'] = "Subject Not Found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
function loadtdvssubject($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$degree = $aobj_context->mobj_data['degree'];
$deggrp = $aobj_context->mobj_data['deggrp'];
$programee = $aobj_context->mobj_data['program'];
if($deggrp == 'All'){
$deggrpcond = "WHERE d.fdeggrp <> ''";
}else{
$deggrpcond = "WHERE d.fdeggrp='{$deggrp}'";
}
if($programee === "All"){
$programeeCond1="";
}else{
$programeeCond1="and d.fprogcode = '{$programee}'";
}
if($degree === "All"){
$degreeCond = "";
}else{
$degreeCond = "and d.fdegree = '{$degree}'";
}
$semCond = "";
//subject
$query_subject = " SELECT DISTINCT s.fsubcode, s.fsubname,s.fqpcode
FROM degree d
INNER JOIN subject s ON d.fdegree = s.fdegree AND d.fexamno = s.fexamno
$deggrpcond
and s.fqpcode in
((select distinct fqpcode from tdvs_tabsum union select fqpcode from tdvs_scriptreceive))
$degreeCond
$programeeCond1
$semCond
AND s.fdoe != '0000-00-00';";
// var_dump($query_subject);
// die();
$result_subject = $aobj_context->pobj_db->GetAll($query_subject);
//date
$query_date = " SELECT DISTINCT DATE_FORMAT(s.fdoe,'%d/%m/%Y') AS fdoe
FROM degree d
INNER JOIN subject s ON d.fdegree = s.fdegree AND d.fexamno = s.fexamno
$deggrpcond
and s.fqpcode in
((select distinct fqpcode from tdvs_tabsum union select fqpcode from tdvs_scriptreceive))
$degreeCond
$programeeCond1
$semCond
AND s.fdoe != '0000-00-00'
$subjCond;";
$result_date = $aobj_context->pobj_db->GetAll($query_date);
$combinedResult = array(
"subject" => $result_subject,
"dates" => $result_date);
if($query_subject){
echo $aobj_context->mobj_output->TOJSONEnvelope($combinedResult,0,"success");
return;
}else{
$arr['msg'] = "Subject Not Found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
function loadtdvssubj($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$sem = $aobj_context->mobj_data['sem'];
$deggrp = $aobj_context->mobj_data['deggrp'];
$programee = $aobj_context->mobj_data['program'];
$degree = $aobj_context->mobj_data['degree'];
if($deggrp == 'All'){
$deggrpcond = "WHERE d.fdeggrp <> ''";
}else{
$deggrpcond = "WHERE d.fdeggrp='{$deggrp}'";
}
if($programee === "All"){
$programeeCond1="";
}else{
$programeeCond1="and d.fprogcode = '{$programee}'";
}
if($degree === "All"){
$degreeCond = "";
}else{
$degreeCond = "and d.fdegree = '{$degree}'";
}
if($sem === "All"){
$semCond = "and d.fexamno BETWEEN '0' AND 'Z'";
}else{
$semCond = "and d.fexamno = '{$sem}'";
}
//subject
$query_subject = " SELECT DISTINCT s.fsubcode, s.fsubname,s.fqpcode
FROM degree d
INNER JOIN subject s ON d.fdegree = s.fdegree AND d.fexamno = s.fexamno
$deggrpcond
and s.fqpcode in
((select distinct fqpcode from tdvs_tabsum union select fqpcode from tdvs_scriptreceive))
$degreeCond
$programeeCond1
$semCond
AND s.fdoe != '0000-00-00';";
$result_subject = $aobj_context->pobj_db->GetAll($query_subject);
//date
$query_date = " SELECT DISTINCT DATE_FORMAT(s.fdoe,'%d/%m/%Y') AS fdoe
FROM degree d
INNER JOIN subject s ON d.fdegree = s.fdegree AND d.fexamno = s.fexamno
$deggrpcond
and s.fqpcode in
((select distinct fqpcode from tdvs_tabsum union select fqpcode from tdvs_scriptreceive))
$degreeCond
$programeeCond1
$semCond
AND s.fdoe != '0000-00-00'
$subjCond;";
$result_date = $aobj_context->pobj_db->GetAll($query_date);
$combinedResult = array(
"subject" => $result_subject,
"dates" => $result_date);
if($query_subject){
echo $aobj_context->mobj_output->TOJSONEnvelope($combinedResult,0,"success");
return;
}else{
$arr['msg'] = "Subject Not Found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
function loadtdvsdate($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$deggrp = $aobj_context->mobj_data['deggrp'];
$data = $aobj_context->mobj_data['data'];
$programee = $aobj_context->mobj_data['program'];
$degree = $aobj_context->mobj_data['degree'];
$sem = $aobj_context->mobj_data['sem'];
$subj = $aobj_context->mobj_data['subject'];
if($deggrp == 'All'){
$deggrpcond = "WHERE d.fdeggrp <> ''";
}else{
$deggrpcond = "WHERE d.fdeggrp='{$deggrp}'";
}
if($degree === "All"){
$degreeCond = "d.fdegree BETWEEN '0' AND 'Z'";
}else{
$degreeCond = "d.fdegree = '{$degree}'";
}
if($programee === "All"){
$programeeCond = "d.fprogcode BETWEEN '0' AND 'Z'";
}else{
$programeeCond = "d.fprogcode = '{$programee}'";
}
if($sem === "All"){
$semCond = "d.fexamno BETWEEN '0' AND 'Z'";
}else{
$semCond = "d.fexamno = '{$sem}'";
}
if($subj === "All"){
$subjCond = "s.fqpcode BETWEEN '0' AND 'Z'";
}else{
$subjCond = "s.fqpcode='{$subj}'";
}
$query = " SELECT DISTINCT DATE_FORMAT(s.fdoe,'%d/%m/%Y') AS fdoe
FROM degree d
INNER JOIN subject s ON d.fdegree = s.fdegree AND d.fexamno = s.fexamno
$deggrpcond
and s.fqpcode in
((select distinct fqpcode from tdvs_tabsum union select fqpcode from tdvs_scriptreceive))
AND $degreeCond
AND $programeeCond
AND $semCond
AND s.fdoe != '0000-00-00'
and $subjCond;";
$result = $aobj_context->pobj_db->GetAll($query);
// var_dump($query);
// die();
if($result){
echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
return;
}else{
$arr['msg'] = "Dates Not Found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
function loadtdvsstats($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'];
$subj = $aobj_context->mobj_data['subject'];
$date = $aobj_context->mobj_data['date'];
if($aobj_context->mobj_data['frmdate'] != "" && $aobj_context->mobj_data['todate'] != ""){
$frmdates = date_create($aobj_context->mobj_data['frmdate']);
$todates = date_create($aobj_context->mobj_data['todate']);
$frmdate = date_format($frmdates,"Y-m-d");
$todate = date_format($todates,"Y-m-d");
}else{
$frmdate = "";
$todate = "";
}
$qpfrm = $aobj_context->mobj_data['qpfrm'];
$qpto = $aobj_context->mobj_data['qpto'];
$qpptrn = $aobj_context->mobj_data['qpptrn'];
$qpstatus = $aobj_context->mobj_data['qpstatus'];
$ansstats = $aobj_context->mobj_data['ansstats'];
if($deggrp === "All"){
$deggrpcond = "q.fdeggrp <> ''";
$deg = "fdeggrp <> ''";
}else{
$deggrpcond = "q.fdeggrp='{$deggrp}'";
$deg = "fdeggrp ='{$deggrp}'";
}
if($degree === "All"){
$degreeCond = "fdegree BETWEEN '0' AND 'Z'";
}else{
$degreeCond = "fdegree='{$degree}'";
}
if($programee === "All"){
$programeeCond = "d.fprogcode BETWEEN '0' AND 'Z'";
}else{
$programeeCond = "d.fprogcode = '{$programee}'";
}
if($sem === "All"){
$semCond = "fexamno BETWEEN '0' AND 'Z'";
}else{
$semCond = "fexamno='{$sem}'";
}
if($subj === "All"){
$subjCond = "fqpcode BETWEEN '{$qpfrm}' AND '{$qpto}'";
}else{
$subjCond = "fqpcode='{$subj}'";
}
if($date === "All"){
$dateCond = " and m.fqpcode BETWEEN '{$qpfrm}' AND '{$qpto}'";
if($frmdate == "" && $todate == ""){
$dateCond1 = " and fdoe BETWEEN '0' AND 'Z'";
}else{
$dateCond1 = " and fdoe BETWEEN '{$frmdate}' AND '{$todate}'";
}
}else{
$dateCond = "";
$dateCond1 = "and fdoe ='{$date}'";
}
if($univcode === "051"){
$univCond = "if(ifnull(q.fqpcode,'') = '','Not Uploaded',concat('Uploaded')) as qprstatus,";
}else{
$univCond = "if(ifnull(r.fqpcode,'') = '','Not Received',concat('Received (',count(r.fcount),')')) as qprstatus,";
}
if($qpptrn == "Uploaded"){
$qpptrncond = "and ifnull(q.ftempcode,'') <> ''";
}elseif($qpptrn == "Pending"){
$qpptrncond = "and ifnull(q.ftempcode,'') = ''";
}else{
$qpptrncond = "";
}
if($qpstatus == "Uploaded"){
$qpstatuscond = "and ifnull(q.fqppath,'') <> ''";
}elseif($qpstatus == "Pending"){
$qpstatuscond = "and ifnull(q.fqppath,'') = ''";
}else{
$qpstatuscond = "";
}
if($ansstats == "Uploaded"){
$ansstatscond = "and ifnull(q.fschempath,'') <> ''";
}elseif($ansstats == "Pending"){
$ansstatscond = "and ifnull(q.fschempath,'') = ''";
}else{
$ansstatscond = "";
}
$query = " select m.fqpcode,s.fdoe, q.ftempcode,s.FSUBNAME, $univCond
if(count(m.fregcode) = 0,'Not Uploaded', count(m.fregcode)) as updstatus,
sum(if(m.fvalno = '1',1,0)) as fvalcnt,
sum(if(m.fvalno = '1' and ifnull(m.fstatus,'') = 'final',1,0)) as fvalc,
(SUM(IF(m.fvalno = '1', 1, 0)) - SUM(IF(m.fvalno = '1' AND IFNULL(m.fstatus,'') = 'final', 1, 0))) AS fpend,
sum(if(m.fvalno = '2',1,0)) as svalcnt,
sum(if(m.fvalno = '2' and ifnull(m.fstatus,'') = 'final',1,0)) as svalc,
(SUM(IF(m.fvalno = '2', 1, 0)) - SUM(IF(m.fvalno = '2' AND IFNULL(m.fstatus,'') = 'final', 1, 0))) AS spend,
sum(if(m.fvalno = 'D',1,0)) as dvalcnt,
sum(if(m.fvalno = 'D' and ifnull(m.fstatus,'') = 'final',1,0)) as dvalc,
if(sum(if( ifnull(t.fregno,'') = '',0,1)) <=0,'Not Statrted',sum(if( ifnull(t.fregno,'') = '',0,1))) as decodestatus,
if(ifnull(q.fqppath,'')= '','Not Uploaded','Uploaded') as qpupd,
if(ifnull(q.fschempath,'')= '','Not Uploaded','Uploaded') as ansupd
from tdvs_tabsum m inner join tdvs_masqp q on m.fqpcode = q.fqpcode
inner join (select distinct fqpcode,date_format(fdoe,'%d/%m/%Y') as fdoe,fsubname
from subject where ifnull(fqpcode,'') <>''
group by fqpcode) s on s.fqpcode = q.fqpcode
left join (select fqpcode,fyear,fexamtype,sum(fcount) as fcount from tdvs_scriptreceive where fdeggrp = '{$deggrp}'
group by fqpcode,fyear,fexamtype) r on m.fqpcode = r.fqpcode
and m.fexamtype = r.fexamtype and m.fyear = r.fyear
left join tdvs_tabulate t on m.fregcode = t.fregcode
and m.fqpcode = t.fqpcode and m.fyear = t.fyear and m.fexamtype = t.fexamtype
where $deggrpcond $dateCond
$qpptrncond $qpstatuscond $ansstatscond
group by m.fqpcode";
// var_dump($query);die();
// and $degreeCond and $semCond and $subjCond
// $dateCond1
$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 loadqpdetails($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$data = $aobj_context->mobj_data['fqpcode'];
$query = " select t.fqpcode,s.fsubname,t.fvalno,count(t.fregcode) as cnt,
sum(if(t.fstatus='FINAL',1,0)) as fsstatus,
(count(t.fregcode) - sum(if(t.fstatus='FINAL',1,0))) as fpstatus
from tdvs_tabsum t inner join tdvs_masqp s on t.fqpcode = s.fqpcode
where t.fqpcode = '{$data}'
group by fvalno";
$result = $aobj_context->pobj_db->GetAll($query);
$query1 = " select t.fvalno,
group_concat(distinct t.fteachcode,' - ',m.fteachname,' - ',r.FMAXSCR,' - ', ts.tstatus separator '*') as teachstatus
from tdvs_tabsum t
left join tdvs_masrev r on t.fqpcode = r.fqpcode and r.fvalno = t.fvalno
and t.fteachcode = r.fteachcode
left join tdvs_masteach m on t.fteachcode = m.fteachcode
left join (
select fteachcode,fvalno,fqpcode,sum(if(fstatus='FINAL',1,0)) as tstatus from tdvs_tabsum
where ifnull(fstatus,'') = 'final'
and fqpcode = '{$data}'
group by fteachcode,fvalno,fqpcode) as ts on t.fteachcode = ts.fteachcode
and t.fqpcode = ts.fqpcode and t.fvalno = ts.fvalno
where t.fqpcode = '{$data}'
group by fvalno;";
$result1 = $aobj_context->pobj_db->GetAll($query1);
foreach ($result1 as $item) {
if (!empty($item['teachstatus'])) {
$teachStatusArray = explode('*', $item['teachstatus']);
foreach ($teachStatusArray as $status) {
$statusParts = explode('-', $status);
$teacherCode = trim($statusParts[0]);
$teacherName = trim($statusParts[1]);
$fcnt = trim($statusParts[2]);
$fvalued = trim($statusParts[3]);
// var_dump($teacherCode,$teacherName,$fcnt,$fvalued);
// die;
}
}
}
$combinedResult = array(
"result" => $result,
"result1" => $result1,
// "teacherCode" => $teacherCode,
// "teacherName" => $teacherName,
// "fcnt" => $fcnt,
// "fvalued" => $fvalued,
);
if($result){
echo $aobj_context->mobj_output->TOJSONEnvelope($combinedResult,0,"success");
return;
}else{
$arr['msg'] = "Data Not Found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
?>
|