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.15.193.71
<?php
function getTeahcerData($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$query = "select distinct m.fteachcode, mas.fteachname, CONCAT(m.fteachcode, '-', mas.fteachname) AS teachername from
moderator m inner join masteach mas on mas.fteachcode = m.fteachcode union
select distinct q.fteachcode, mas.fteachname, CONCAT(q.fteachcode, '-', mas.fteachname) AS teachername from
qpseterdet q inner join masteach mas on mas.fteachcode = q.fteachcode";
$result = $aobj_context->mobj_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");
}
}
function getTeachValDet($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$deggrp = $aobj_context->mobj_data["fdeggrp"];
$degree = $aobj_context->mobj_data["fdegree"];
$fsem = $aobj_context->mobj_data["fsem"];
$freportopt = $aobj_context->mobj_data["freportopt"];
$fteacher = $aobj_context->mobj_data["fteacher"];
$ffrmDate = $aobj_context->mobj_data["ffrmDate"];
$ftoDate = $aobj_context->mobj_data["ftoDate"];
$fdisptype = $aobj_context->mobj_data["fdisptyp"];
if($freportopt == 'Teacher'){
$cond = "q.fqpduser";
$cond1 = "q.fqpfilepath";
$cond2 = "fqpdtme";
}else if($freportopt == 'Moderator'){
$cond = "q.fmodteach";
$cond1 = "q.fmodqpupd";
$cond2 = "fmodqpdate";
}
$degree_arr = explode(",", $degree);
foreach($degree_arr as $key => $value){
if($value != 'All')
$degree_array .= "'".$value."',";
}
$degree_array = substr_replace($degree_array ,"",-1);
if($degree_array != ""){
$degreeCond = "and s.fdegree in ({$degree_array})";
}
if($fsem != "All"){
$fsemCond = "and d.fexamno ='{$fsem}'";
}
$fteacher_arr = explode(",", $fteacher);
foreach($fteacher_arr as $key => $value){
if($value != 'All')
$fteacher_array .= "'".$value."',";
}
$fteacher_array = substr_replace($fteacher_array ,"",-1);
if($fteacher_array != ""){
$fteacherCond = "and $cond in ({$fteacher_array})";
}
if($fdisptype == "All"){
$dispcond = "";
}else if($fdisptype == "Generated"){
$dispcond = "and ifnull(q.fdocno,'') <> ''";
}else if($fdisptype == "Pending"){
$dispcond = "and ifnull(q.fdocno,'') = ''";
}
$query = "select m.fteachcode,m.fteachname,count($cond) ftotscrp,
q.fset,q.fqpcode,if(ifnull(fdocno,'')='','F','F') as fcheck
from qpseterdet q
inner join masteach m on $cond = m.fteachcode
inner join (select fqpcode from subject s inner join degree d on s.fdegree = d.fdegree
and s.fexamno = d.fexamno
where d.fdeggrp = '{$deggrp}' $fsemCond
group by fqpcode) x on q.fqpcode = x.fqpcode
where date_format(q.$cond2,'%Y-%m-%d') between '{$ffrmDate}'
and '{$ftoDate}'
$dispcond
$degreeCond
$fteacherCond
group by $cond
having ftotscrp >0";
// var_dump($query);die();
$result = $aobj_context->mobj_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");
}
}
function saveValBillDet($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$findata = json_decode($aobj_context->mobj_data["finData"]);
$fdeggrp = $aobj_context->mobj_data["fdeggrp"];
$fdegree = $aobj_context->mobj_data["fdegree"];
$fsem = $aobj_context->mobj_data["fsem"];
$freportopt = $aobj_context->mobj_data["freportopt"];
$fteacher = $aobj_context->mobj_data["fteacher"];
$ffrmDate = $aobj_context->mobj_data["ffrmDate"];
$ftoDate = $aobj_context->mobj_data["ftoDate"];
$fuser = $aobj_context->mobj_data["fuser"];
$fdisptype = $aobj_context->mobj_data["fdisptyp"];
if($freportopt == 'Teacher'){
$cond = "q.fqpduser";
$cond1 = "q.fqpfilepath";
$cond2 = "fqpdtme";
}else if($freportopt == 'Moderator'){
$cond = "q.fmodteach";
$cond1 = "q.fmodqpupd";
$cond2 = "fmodqpdate";
}
$degree_arr = explode(",", $fdegree);
foreach($degree_arr as $key => $value){
if($value != 'All')
$degree_array .= "'".$value."',";
}
$degree_array = substr_replace($degree_array ,"",-1);
if($degree_array != ""){
$degreeCond = "and d.fdegree in ({$degree_array})";
}
if($fsem != "All"){
$fsemCond = "and d.fexamno ='{$fsem}'";
}
$fteacher_arr = explode(",", $fteacher);
foreach($fteacher_arr as $key => $value){
if($value != 'All')
$fteacher_array .= "'".$value."',";
}
$fteacher_array = substr_replace($fteacher_array ,"",-1);
if($fteacher_array != ""){
$fteacherCond = "and $cond in ({$fteacher_array})";
}
$query = "INSERT INTO tdvs_docno (FDEGGRP,FDEGREE,FEXAMNO,FREPORTYPE,
FTEACHCODE,FFROMDATE,FTODATE,FUPDUSER,FUPDTIME,FDELETED)
VALUES('{$fdeggrp}','{$fdegree}','{$fsem}','{$freportopt}',
'{$fteacher}','{$ffrmDate}','{$ftoDate}','{$fuser}',now(),'F')";
$result = $aobj_context->mobj_db->Execute($query);
$docNo = $aobj_context->mobj_db->Insert_id();
foreach($findata as $val)
{
if($val->fcheck == 'T'){
if($freportopt == 'Teacher'){
if($univcode == '030')
{
$insertPayhead = "INSERT INTO tdvs_payhead (FDOCNO,FDEGGRP,FBILLDATE,FBILLTYPE,FYEAR,
FEXAMTYPE,FTEACHCODE,FDAYS,FTOTAL,fteachname,fmobileno,
femail,fbankname,faccno,
fifsccode,faadharno,fpanno,fqtotal,FCREATDATE,fsubname)
select '$docNo','$fdeggrp',now(),'QPMS','2222','2',m.fteachcode,'',
(sum(f100) + sum(f40) + sum(f20)) as fstot,
m.fteachname,m.fmobile,m.femail,
m.FBANKNAME,m.faccno,m.FIFSCCODE,
m.faccno,m.fpanno,sum(qpcnt) as totcnt,now(),
group_concat(concat(q.fsubname,' - ',q.fsubshort,' Max. Maks: ',fmaxmarks,' ( ',qpcnt,' ) ') order by q.fsubshort SEPARATOR ', ')as fsubname
from(select q.fteachcode,s.fsubname,s.fsubshort,q.fqpcode,fyear,fexamtype,
s.fmaxmarks,
if(ifnull(q.fqpcode, '')<> '',1,0) as qpcnt,
if(s.fmaxmarks >= '50',if(left(fdeggrp,2) = 'UG',1200,1200),0)as f100,
if(s.fmaxmarks >=20 and s.fmaxmarks <=40,1200,1200) as f40,
if(s.fmaxmarks <20,1200,1200) as f20
from qpseterdet q
inner join subject s on q.fqpcode = s.fqpcode
inner join degree d on d.fdegree = s.fdegree
and d.fexamno = s.fexamno
where fyear='2222' and fexamtype='2'
and ifnull(fqpfilepath,'') <> ''
and date_format(q.fqpdtme,'%Y-%m-%d') between '{$ffrmDate}'
and '{$ftoDate}' and d.fdeggrp = '{$fdeggrp}'
$degreeCond
$fsemCond
$fteacherCond
group by q.fteachcode,q.fqpcode,q.fset) q
inner join masteach m on q.fteachcode = m.fteachcode
where q.fyear='2222' and q.fexamtype='2'
and q.fteachcode = '{$val->fteachcode}'
group by q.fteachcode";
}else
{
$insertPayhead = "INSERT INTO tdvs_payhead (FDOCNO,FDEGGRP,FBILLDATE,FBILLTYPE,FYEAR,
FEXAMTYPE,FTEACHCODE,FDAYS,FTOTAL,fteachname,fmobileno,
femail,fbankname,faccno,
fifsccode,faadharno,fpanno,fqtotal,FCREATDATE,fsubname)
select '$docNo','$fdeggrp',now(),'QPMS','2222','2',m.fteachcode,'',
(sum(f100) + sum(f40) + sum(f20)) as fstot,
m.fteachname,m.fmobile,m.femail,
m.FBANKNAME,m.faccno,m.FIFSCCODE,
m.faccno,m.fpanno,sum(qpcnt) as totcnt,now(),
group_concat(concat(q.fsubname,' - ',q.fsubshort,' Max. Maks: ',fmaxmarks,' ( ',qpcnt,' ) ') order by q.fsubshort SEPARATOR ', ')as fsubname
from(select q.fteachcode,s.fsubname,s.fsubshort,q.fqpcode,fyear,fexamtype,
s.fmaxmarks,
if(ifnull(q.fqpcode, '')<> '',1,0) as qpcnt,
if(s.fmaxmarks >= '50',if(left(fdeggrp,2) = 'UG',600,900),0)as f100,
if(s.fmaxmarks >=20 and s.fmaxmarks <=40,250,0) as f40,
if(s.fmaxmarks <20,100,0) as f20
from qpseterdet q
inner join subject s on q.fqpcode = s.fqpcode
inner join degree d on d.fdegree = s.fdegree
and d.fexamno = s.fexamno
where fyear='2222' and fexamtype='2'
and ifnull(fqpfilepath,'') <> ''
and date_format(q.fqpdtme,'%Y-%m-%d') between '{$ffrmDate}'
and '{$ftoDate}' and d.fdeggrp = '{$fdeggrp}'
$degreeCond
$fsemCond
$fteacherCond
group by q.fteachcode,q.fqpcode,q.fset) q
inner join masteach m on q.fteachcode = m.fteachcode
where q.fyear='2222' and q.fexamtype='2'
and q.fteachcode = '{$val->fteachcode}'
group by q.fteachcode";
}
}else if($freportopt == 'Moderator'){
if($univcode == '030')
{
$insertPayhead = "INSERT INTO tdvs_payhead (FDOCNO,FDEGGRP,FBILLDATE,FBILLTYPE,FYEAR,FEXAMTYPE,
FTEACHCODE,FDAYS,FTOTAL,fteachname,fmobileno,femail,fbankname,faccno,
fifsccode,faadharno,fpanno,fqtotal,FCREATDATE,fsubname)
select '$docNo','$fdeggrp',now(),'QPMS','2222','2',m.fteachcode,'',
sum(s.total) as total,m.fteachname,m.fmobile,m.femail,
m.FBANKNAME,m.faccno,m.FIFSCCODE,m.faccno,m.fpanno,sum(s.count)as totcnt,now(),
group_concat(concat(s.fsubname,' - ',s.fsubshort,' Max. Maks: ',s.fmaxmarks,' ( ',count,' ) ') order by s.fsubshort SEPARATOR ', ')as fsubname
from(select mo.fteachcode,s.fsubname, s.fsubshort,s.fmaxmarks, mo.fqpcode,
mo.fyear, mo.fexamtype, s.fexamno, s.fdegree,
if(mo.fqpcode <> '', 1, 0)as count,
if(mo.fqpcode <> '', 1200,0)as total
from moderator mo
inner join subject s on s.fqpcode = mo.fqpcode
inner join degree d on d.fdegree = s.fdegree and d.fexamno = s.fexamno
inner join qpseterdet q on mo.fqpcode = q.fqpcode
and ifnull(q.fmodqpupd,'') <> ''
where mo.fyear='2222' and mo.fexamtype='2'
and date_format(q.fqpdtme,'%Y-%m-%d') between '{$ffrmDate}'
and '{$ftoDate}' and d.fdeggrp = '{$fdeggrp}'
$degreeCond
$fsemCond
$fteacherCond
group by mo.fteachcode, mo.fqpcode) s
inner join masteach m on m.fteachcode = s.fteachcode
where s.fyear='2222' and s.fexamtype='2'
and s.fteachcode = '{$val->fteachcode}'
group by s.fteachcode";
}else
{
$insertPayhead = "INSERT INTO tdvs_payhead (FDOCNO,FDEGGRP,FBILLDATE,FBILLTYPE,FYEAR,FEXAMTYPE,
FTEACHCODE,FDAYS,FTOTAL,fteachname,fmobileno,femail,fbankname,faccno,
fifsccode,faadharno,fpanno,fqtotal,FCREATDATE,fsubname)
select '$docNo','$fdeggrp',now(),'QPMS','2222','2',m.fteachcode,'',
sum(s.total) as total,m.fteachname,m.fmobile,m.femail,
m.FBANKNAME,m.faccno,m.FIFSCCODE,m.faccno,m.fpanno,sum(s.count)as totcnt,now(),
group_concat(concat(s.fsubname,' - ',s.fsubshort,' Max. Maks: ',s.fmaxmarks,' ( ',count,' ) ') order by s.fsubshort SEPARATOR ', ')as fsubname
from(select mo.fteachcode,s.fsubname, s.fsubshort,s.fmaxmarks, mo.fqpcode,
mo.fyear, mo.fexamtype, s.fexamno, s.fdegree,
if(mo.fqpcode <> '', 1, 0)as count,
if(mo.fqpcode <> '', 700,0)as total
from moderator mo
inner join subject s on s.fqpcode = mo.fqpcode
inner join degree d on d.fdegree = s.fdegree and d.fexamno = s.fexamno
inner join qpseterdet q on mo.fqpcode = q.fqpcode
and ifnull(q.fmodqpupd,'') <> ''
where mo.fyear='2222' and mo.fexamtype='2'
and date_format(q.fqpdtme,'%Y-%m-%d') between '{$ffrmDate}'
and '{$ftoDate}' and d.fdeggrp = '{$fdeggrp}'
$degreeCond
$fsemCond
$fteacherCond
group by mo.fteachcode, mo.fqpcode) s
inner join masteach m on m.fteachcode = s.fteachcode
where s.fyear='2222' and s.fexamtype='2'
and s.fteachcode = '{$val->fteachcode}'
group by s.fteachcode";
}
}
// var_dump($insertPayhead);die();
$res = $aobj_context->mobj_db->Execute($insertPayhead);
$insetpaydet = "insert into tdvs_paydetl (FBILLNO,FDOCNO,FBILLTYPE,
FTEACHCODE,FHEADCODE,FAMOUNT,FREMARKS,FCREATEDATE)
select FBILLNO,FDOCNO,'QPMS',FTEACHCODE,'QP',FTOTAL,fsubname,now()
from tdvs_payhead
where fteachcode = '{$val->fteachcode}' and fyear='2222' and fexamtype='2'";
$res2 = $aobj_context->mobj_db->Execute($insetpaydet);
if($freportopt == 'Teacher'){
$cond3 = "fqpduser";
$cond4 = "fdocno";
}else if($freportopt == 'Moderator'){
$cond3 = "fmodteach";
$cond4 = "fmoddocno";
}
$update = "update qpseterdet set $cond4 = '$docNo'
where $cond3 = '{$val->fteachcode}'
and fqpcode = '{$val->fqpcode}'
and fset = '{$val->fset}'
and fyear = '2222'
and fexamtype = '2'";
$qpres = $aobj_context->mobj_db->Execute($update);
}
}
if($qpres){
$arr['msg'] = 'Successfully Updated';
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}else{
$arr['msg'] = 'Something went wrong please try later';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function getGenerateBillReport($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$ftype = $aobj_context->mobj_data["ftype"];
$cond = "";
if($ftype != "All")
$cond = "where FREPORTYPE = '{$ftype}'";
$query = "select * from tdvs_docno $cond";
$result = $aobj_context->mobj_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");
}
}
?>
|