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.22.41.80
<?php
function getStudCountForInvigilatorDairy($aobj_context){
$collcode=$aobj_context->mobj_data['collcode'];
$funivcode=$aobj_context->mobj_data['univcode'];
$dates=$aobj_context->mobj_data['date'];
$deggrp=$aobj_context->mobj_data['deggrp'];
$session=$aobj_context->mobj_data['session'];
// $query="SELECT ifnull(SUM(reg_cnt),'') AS totalStud
// FROM (SELECT COUNT(DISTINCT cd.FREGNO) AS reg_cnt FROM canddet cd
// INNER JOIN subject s ON s.fdegree = cd.fdegree AND s.fexamno = cd.fexamno AND s.FSUBCODE = cd.FSUBCODE
// INNER JOIN degree d ON cd.fdegree = d.fdegree AND cd.fexamno = d.fexamno
// INNER JOIN candsum cs ON cd.fcollcode = cs.fcollcode AND cs.FREGNO = cd.FREGNO
// LEFT JOIN reason r ON s.FSESSION = r.FREASONCD
// LEFT OUTER JOIN attshort a ON a.fdegree = cd.fdegree AND cd.fexamno = a.fexamno
// AND a.fregno = cd.fregno AND a.fsubcode = s.fcsubcode
// AND a.fyear = cd.fyear AND a.fexamtype = cd.fexamtype
// LEFT JOIN absent ab ON ab.fregno = cd.fregno AND ab.fqpcode = s.fqpcode
// WHERE s.fdoe = '{$dates}' AND IFNULL(cd.fpassmth, '') = '' AND cd.FPRESENT = 'P'
// AND s.fsession LIKE '{$session}' AND IFNULL(cs.FRECPTDATE, '0000-00-00') <> '0000-00-00'
// AND cs.fcntrcode = '{$collcode}' AND IFNULL(a.fregno, '') = '' AND IFNULL(ab.fabstype, '') <> 'QpM'
// AND INSTR(cs.fhtenable, cd.fexamno) > 0 AND d.fdeggrp = '{$deggrp}'
// GROUP BY s.fsubcode) AS subquery";
// $res = $aobj_context->mobj_db->GetRow($query);
// $query1 = "SELECT ifnull(SUM(reg_cnt),'') AS allotStud
// FROM (SELECT COUNT(DISTINCT cd.FREGNO) AS reg_cnt FROM canddet cd
// INNER JOIN subject s ON s.fdegree = cd.fdegree AND s.fexamno = cd.fexamno AND s.FSUBCODE = cd.FSUBCODE
// INNER JOIN degree d ON cd.fdegree = d.fdegree AND cd.fexamno = d.fexamno
// INNER JOIN candsum cs ON cd.fcollcode = cs.fcollcode AND cs.FREGNO = cd.FREGNO
// LEFT JOIN reason r ON s.FSESSION = r.FREASONCD
// LEFT OUTER JOIN attshort a ON a.fdegree = cd.fdegree AND cd.fexamno = a.fexamno AND a.fregno = cd.fregno
// AND a.fsubcode = s.fcsubcode
// AND a.fyear = cd.fyear AND a.fexamtype = cd.fexamtype LEFT JOIN absent ab ON ab.fregno = cd.fregno
// AND ab.fqpcode = s.fqpcode
// WHERE s.fdoe = '{$dates}' AND IFNULL(cd.fpassmth, '') = '' AND cd.FPRESENT = 'P'
// AND s.fsession LIKE '{$session}' AND IFNULL(cs.FRECPTDATE, '0000-00-00') <> '0000-00-00'
// AND cs.fcntrcode = '{$collcode}' AND IFNULL(a.fregno, '') = '' AND IFNULL(ab.fabstype, '') <> 'QpM'
// AND INSTR(cs.fhtenable, cd.fexamno) > 0 AND d.fdeggrp = '{$deggrp}' AND cd.fhallno<>'' AND fqpcode1<>''
// GROUP BY s.fsubcode) AS subquery";
// $res1 = $aobj_context->mobj_db->GetRow($query1);
// if($res1){
// $rst['totalStud'] = $res;
// $rst['allotStud'] = $res1;
// echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
// // var_dump($rst,"bjxhbcvh");die();
// }else{
// $rst['nodata']="No data found";
// echo $aobj_context->mobj_output->ToJSONEnvelope($rst,-1,"failed");
// }
// $query="SELECT
// SUM(reg_cnt) AS totalStud,
// SUM(CASE WHEN fhallno <> '' THEN 1 ELSE 0 END) AS allotStud FROM (
// SELECT
// COUNT(DISTINCT cd.FREGNO) AS reg_cnt,
// cd.fhallno
// FROM
// canddet cd
// INNER JOIN
// subject s ON s.fdegree = cd.fdegree
// AND s.fexamno = cd.fexamno
// AND s.FSUBCODE = cd.FSUBCODE
// INNER JOIN
// degree d ON cd.fdegree = d.fdegree
// AND cd.fexamno = d.fexamno
// INNER JOIN
// candsum cs ON cd.fcollcode = cs.fcollcode
// AND cs.FREGNO = cd.FREGNO
// LEFT JOIN
// reason r ON s.FSESSION = r.FREASONCD
// LEFT OUTER JOIN
// attshort a ON a.fdegree = cd.fdegree
// AND cd.fexamno = a.fexamno
// AND a.fregno = cd.fregno
// AND a.fsubcode = s.fcsubcode
// AND a.fyear = cd.fyear
// AND a.fexamtype = cd.fexamtype
// LEFT JOIN
// absent ab ON ab.fregno = cd.fregno
// AND ab.fqpcode = s.fqpcode
// WHERE
// s.fdoe = '{$dates}'
// AND IFNULL(cd.fpassmth, '') = ''
// AND cd.FPRESENT = 'P'
// AND s.fsession = '{$session}'
// AND IFNULL(cs.FRECPTDATE, '0000-00-00') <> '0000-00-00'
// AND cs.fcntrcode = '{$collcode}'
// AND IFNULL(a.fregno, '') = ''
// AND IFNULL(ab.fabstype, '') <> 'QpM'
// AND INSTR(cs.fhtenable, cd.fexamno) > 0
// AND d.fdeggrp = '{$deggrp}'
// GROUP BY
// s.fsubcode, cd.fhallno
// ) AS subquery";
$query="SELECT SUM(reg_cnt) AS totalStud,
SUM(fhallno) AS allotStud FROM (
SELECT COUNT(DISTINCT cd.FREGNO) AS reg_cnt, COUNT(cd.fhallno) AS fhallno
FROM canddet cd
INNER JOIN subject s ON s.fdegree = cd.fdegree AND s.fexamno = cd.fexamno AND s.FSUBCODE = cd.FSUBCODE
INNER JOIN degree d ON cd.fdegree = d.fdegree AND cd.fexamno = d.fexamno
INNER JOIN candsum cs ON cd.fcollcode = cs.fcollcode AND cs.FREGNO = cd.FREGNO
LEFT JOIN reason r ON s.FSESSION = r.FREASONCD
LEFT OUTER JOIN attshort a ON a.fdegree = cd.fdegree AND cd.fexamno = a.fexamno AND a.fregno = cd.fregno
AND a.fsubcode = s.fcsubcode
AND a.fyear = cd.fyear
AND a.fexamtype = cd.fexamtype
LEFT JOIN absent ab ON ab.fregno = cd.fregno AND ab.fqpcode = s.fqpcode
WHERE
s.fdoe = '{$dates}'
AND IFNULL(cd.fpassmth, '') = ''
AND cd.FPRESENT = 'P'
AND s.fsession = '{$session}'
AND IFNULL(cs.FRECPTDATE, '0000-00-00') <> '0000-00-00'
AND cs.fcntrcode = '{$collcode}'
AND IFNULL(a.fregno, '') = ''
AND IFNULL(ab.fabstype, '') <> 'QpM'
AND INSTR(cs.fhtenable, cd.fexamno) > 0
AND d.fdeggrp = '{$deggrp}'
GROUP BY
s.fsubcode, cd.fhallno
) AS subquery";
$res = $aobj_context->mobj_db->GetRow($query);
if($res){
$arr['data']=$res;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}else{
$arr['data']="Something Went Wrong";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
}
function getDegreeSessionOnDateAndYearModeForReports($aobj_context){
$collcode=$aobj_context->mobj_data['collcode'];
$funivcode=$aobj_context->mobj_data['univcode'];
$dates=$aobj_context->mobj_data['date'];
$yearmode=$aobj_context->mobj_data['yearmode'];
$yearmodeSplit=explode('*',$yearmode);
// $yearAndMode=explode('*',$yearmodeSplit[0]);
// var_dump($yearmodeSplit);die();
$query = "SELECT CONCAT(dg.fdeggrp, ' - ',dg.fdescpn)AS fdeggrp,t.fsession,r.FDESCPN,COUNT(DISTINCT cd.FREGNO) AS reg_cnt,
SUM(IF(IFNULL(cd.fhallno,'') = '',0,1)) AS fhallno,d.fdegree,
(COUNT(DISTINCT cd.FREGNO)-SUM(IF(IFNULL(cd.fhallno,'') = '',0,1)))AS pending
FROM canddet cd
INNER JOIN subject s ON s.fdegree = cd.fdegree AND s.fexamno = cd.fexamno
AND s.FSUBCODE = cd.FSUBCODE
INNER JOIN degree d ON cd.fdegree = d.fdegree AND cd.fexamno = d.fexamno
INNER JOIN deggrp dg ON dg.fdeggrp = d.fdeggrp
INNER JOIN candsum cs ON cd.fcollcode = cs.fcollcode AND cs.FREGNO = cd.FREGNO
INNER JOIN timetable t ON s.fqpcode = t.fqpcode AND t.fyear = cd.fyear
AND cd.fexamtype = t.fexamtype AND t.fdeggrp = d.fdeggrp
INNER JOIN reason r ON t.FSESSION = r.FREASONCD
WHERE cs.fcntrcode='{$collcode}' AND cd.fyear='{$yearmodeSplit[0]}'
AND cd.fexamtype='{$yearmodeSplit[1]}'
#AND cd.fhallno<>''
AND cd.FPRESENT = 'P'
AND IFNULL(cd.fpassmth,'') = ''
AND t.fdate=date_format(STR_TO_DATE('{$dates}', '%d/%m/%Y'),'%Y-%m-%d')
GROUP BY dg.fdeggrp,t.fsession";
// var_dump($query);die();
$res = $aobj_context->mobj_db->GetAll($query);
if($res){
$rst['degses']=$res;
echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
}else{
$rst['msg']="Data Not Found";
echo $aobj_context->mobj_output->ToJSONEnvelope($rst,-1,"Failed");
}
}
?>
|