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.115.40
<?php
function tdvs_dashboard($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$query="select count(*) as Total,
sum(case when ifnull(ts.fstatus,'')='final' then 1 else 0 end) as Completed,
sum(case when ifnull(ts.fstatus,'')='rejected' then 1 else 0 end) as Rejected,
(count(*) -
sum(case when ifnull(ts.fstatus,'')='final' then 1 else 0 end)) as Remaining
from tdvs_deggrp dg
inner join tdvs_masqp qp on dg.fdeggrp = qp.fdeggrp
inner join tdvs_tabsum ts on ts.fqpcode = qp.fqpcode
inner join tdvs_masboard mb on dg.fdeggrp = mb.fdeggrp and mb.fdeggrp = qp.fdeggrp
and qp.fboard = mb.fboard";
$result = $aobj_context->pobj_db->GetRow($query);
$query1 = "select count(*) as ftotal,
sum(case when ifnull(fvalno,'')='1' then 1 else 0 end) as fvalno1,
sum(case when ifnull(fvalno,'')='2' then 1 else 0 end) as fvalno2,
sum(case when ifnull(fvalno,'')='D' then 1 else 0 end) as fvalnoD
from tdvs_tabsum where fstatus = 'final';";
$result1 = $aobj_context->pobj_db->GetRow($query1);
$query2="select
sum(case when ifnull(fvalno,'')='1' then 1 else 0 end) as fvalno1,
sum(case when ifnull(fvalno,'')='2' then 1 else 0 end) as fvalno2,
sum(case when ifnull(fvalno,'')='D' then 1 else 0 end) as fvalnoD
from tdvs_tabsum where ifnull(fstatus, '') = ''; ";
$result2 = $aobj_context->pobj_db->GetRow($query2);
$query3="select distinct t.fteachcode, m.fteachname, t.fvalno,
t.fqpcode, t.fstatus from tdvs_tabsum t
inner join tdvs_masteach m on m.fteachcode = t.fteachcode
where fsysdate >= CURDATE()
order by fvalno;";
$result3 = $aobj_context->pobj_db->GetAll($query3);
$query4="select count(distinct fregcode)as count,
sum(case when ifnull(t.fstatus, '')='' then 1 else 0 end)as fstatus,
t.fqpcode, mt.fteachcode, t.fvalno, mt.fteachname
from tdvs_tabsum t inner join
tdvs_masrev m on m.fqpcode = t.fqpcode
inner join tdvs_masteach mt on mt.fteachcode = m.fteachcode
group by fqpcode, fvalno having count = fstatus ;";
$result4 = $aobj_context->pobj_db->GetAll($query4);
$query5="select distinct t.fqpcode, t.fvalno, count(t.fregcode)as count,
concat(q.fsubname,' - ', s.fsubshort)as fsubname
from tdvs_tabsum t inner join tdvs_masqp q on q.fqpcode = t.fqpcode
inner join subject s on s.fqpcode = q.fqpcode and s.fexamno = q.fexamno
where
concat(t.fqpcode, t.fvalno) not in(select concat(fqpcode, fvalno)
from tdvs_masrev) group by fqpcode, fvalno;";
$result5 = $aobj_context->pobj_db->GetAll($query5);
if($result){
$arr['scr'] = $result;
$arr['val'] = $result1;
$arr['rem'] = $result2;
$arr['currdate'] = $result3;
$arr['assign'] = $result4;
$arr['notass'] = $result5;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}else{
$arr['msg'] = "Something went wrong";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
?>
|