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.145.83.96
<?php
function viewTdvsBoard($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$boards = $aobj_context->mobj_data['board'];
$qpcodefrm = $aobj_context->mobj_data['qpcodefrm'];
$qpcodeto = $aobj_context->mobj_data['qpcodeto'];
$status = $aobj_context->mobj_data['status'];
$report = $aobj_context->mobj_data['report'];
if($report == "QP"){
if($boards == 'All'){
$board = "";
}else{
$board = "AND qp.fboard = '{$boards}'";
}
if($status == 'All'){
$con1 = "";
$conn = "";
}
elseif($status == 'C'){
$con1 = "having per = 0";
$conn = "";
}
elseif($status == 'R'){
$conn = "AND IFNULL(hed.freject, '') = 'T'";
$con1="";
}else{
$con1 ="HAVING per <> 0";
$conn = "";
}
$query = "SELECT qp.fboard, hed.fqpcode,qp.fsubname,COUNT(hed.fregcode) AS count,
SUM(IF(IFNULL(lat.fregcode,'') = '',0,1)) AS dcnt,
COUNT(hed.fregcode) - SUM(IF(IFNULL(lat.fregcode,'') = '',0,1)) AS per
FROM tdvs_masqp qp INNER JOIN tdvs_tabhead hed ON qp.fqpcode = hed.fqpcode
LEFT JOIN tdvs_tabulate lat ON hed.fqpcode =lat.fqpcode AND hed.fregcode = lat.fregcode
WHERE hed.fqpcode BETWEEN '{$qpcodefrm}' AND '{$qpcodeto}'
{$board}{$conn}
GROUP BY qp.fboard,hed.fqpcode
{$con1}";
}else{
if($boards == 'All'){
$board = "";
}else{
$board = "AND qp.fboard = '{$boards}'";
}
if($status == 'All'){
$con1 = "";
$conn = "";
}
elseif($status == 'C'){
$con1 = "having per = 0";
$conn = "";
}
elseif($status == 'R'){
$conn = "AND IFNULL(hed.freject, '') = 'T'";
$con1="";
}else{
$con1 ="HAVING per <> 0";
$conn = "";
}
$query="SELECT qp.fboard,mb.fboardname,COUNT(hed.fregcode) AS count,
SUM(IF(IFNULL(lat.fregcode,'') = '',0,1)) AS dcnt,
COUNT(hed.fregcode) - SUM(IF(IFNULL(lat.fregcode,'') = '',0,1)) AS per
FROM tdvs_masboard mb INNER JOIN tdvs_masqp qp ON mb.fboard = qp.fboard AND mb.fdeggrp = qp.fdeggrp
INNER JOIN tdvs_tabhead hed ON qp.fqpcode = hed.fqpcode
LEFT JOIN tdvs_tabulate lat ON hed.fqpcode =lat.fqpcode AND hed.fregcode = lat.fregcode
WHERE hed.fqpcode between '{$qpcodefrm}' AND '{$qpcodeto}'
{$board}{$conn}
GROUP BY qp.fboard
{$con1}";
}
// var_dump($query);
// die();
$result = $aobj_context->pobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$arr['msg'] = 'No Data found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
?>
|