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.196.141


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

<?php
function attendenceshort($aobj_context){
    $collcode=$_SESSION['collcode'];
    $degree = $aobj_context->mobj_data["deg"];

    $query="SELECT DISTINCT d.FDEGREE, d.FDESCPN FROM degree d 
    INNER JOIN candsum c ON c.fdegree = d.fdegree  
    WHERE c.fcollcode='{$collcode}' group by d.fdegree";
   $results=$aobj_context->mobj_db->GetAll($query);

   
if($results){ 
    $data['data'] =$results;
    echo $aobj_context->mobj_output->ToJSONEnvelope($data, 0,"success"); 
}else{
    $data['data'] = "Failed to update";
    echo $aobj_context->mobj_output->ToJSONEnvelope($data, -1,"fail"); 
    return;
}}

function getShortPer($aobj_context){
    $collcode=$_SESSION['collcode'];
    $degree = $aobj_context->mobj_data["deg"];
    $sem = $aobj_context->mobj_data["sem"];
    $examstr1 = '';
    if(strtolower($sem) != 'all')
    {	
        $examstr1 = "and fexamno = '{$exam}'";
    }

    $query="SELECT DISTINCT fshortiaper,fshortattper FROM degree 
    WHERE fdegree='{$degree}' 
    {$examstr1}
    group by fdegree";
   $results=$aobj_context->mobj_db->GetRow($query);

   
if($results){ 
    $data['data'] =$results;
    echo $aobj_context->mobj_output->ToJSONEnvelope($results, 0,"success"); 
}else{
    $data['data'] = "Failed to update";
    echo $aobj_context->mobj_output->ToJSONEnvelope($data, -1,"fail"); 
    return;
}}



function attendenceshortagedata($aobj_context){

    $college_code = $_SESSION['collcode'];
    $degree_code = $aobj_context->mobj_data["deg"];
    $exam = $aobj_context->mobj_data["sem"];
 
    if(strtolower($exam) != 'all')
    {	
        $examstr1 = "and fexamno = '{$exam}'";
        $examstr2 = "and m.fexamno = '{$exam}'";
        $examstr3 = "and a.fexamno = '{$exam}'";
    }


    $query = "select distinct fyear, fexamtype from canddet where fdegree = '{$degree_code}' {$examstr1}";
			$res1 = $aobj_context->mobj_db->GetRow($query);
			$fyear = $res1['fyear'];
			$fexamtype = $res1['fexamtype'];
           

			$query = "select distinct fdeggrp from degree 
			where fdegree = '{$degree_code}' {$examstr1}";
			$res4 = $aobj_context->mobj_db->GetRow($query);
			$fdeggrp = $res4['fdeggrp'];

			$delqur = "delete from attshort_r where 
			fdegree = '{$degree_code}' 
			and fyear = '{$fyear}' and fexamtype = '{$fexamtype}'
			{$examstr1}";
			$res2 = $aobj_context->mobj_db->Execute($delqur);

			
			if($fdeggrp == 'UGMD')
			{
				$qyery = "insert ignore into attshort_r(fcollcode,fdegree,fexamno,fsubcode,fregno,fremarks,ftotval,fsecval,fperval,FUPDDATE,fyear,fexamtype,fshortiaper)
				select m.fcollcode,m.fdegree,m.fexamno,m.fsubcode,m.fregno,'IA Shortage', sum(m.fmarks) as secmarks,sum(s.fvalmax) as maxmarks,
				((sum(m.fmarks)/sum(s.fvalmax))*100) as perval,now(),m.fyear,m.fexamtype,dg.fshortiaper 
				from marks m inner join candsum cs on m.fregno = cs.fregno and m.fexamno = cs.ffreshexam
				and m.fyear = cs.fyear and m.fexamtype = cs.fexamtype
				inner join subject s on m.fdegree = s.fdegree and m.fexamno = s.fexamno and m.fsubcode = s.fcsubcode
				inner join degree dg on m.fdegree = dg.fdegree and m.fexamno = dg.fexamno
				where m.fdegree ='{$degree_code}' 
				and m.fcollcode = '{$college_code}'
				and ifnull(dg.fshortiaper,'') <> ''	
				{$examstr2}
				group by m.fcollcode,m.fdegree,m.fexamno,s.fsubcode,m.fregno
				having (perval< CAST(dg.fshortiaper as unsigned))";
				
				$res4 = $aobj_context->mobj_db->Execute($qyery);

			}else
			{	

				$qyery = "insert ignore into attshort_r(fcollcode,fdegree,fexamno,fsubcode,fregno,fremarks,ftotval,fsecval,fperval,FUPDDATE,fyear,fexamtype,fshortiaper)
				select m.fcollcode,m.fdegree,m.fexamno,m.fsubcode,m.fregno,'IA Shortage',
				sum(fsmaxmarks) as totval,sum(if(ifnull(fmarks,'-1') = '-1',0,fmarks)) as secval,
				(sum(if(ifnull(fmarks,'-1') = '-1',0,fmarks))/sum(fvalmax)*100) as perval,now(),m.fyear,m.fexamtype,dg.fshortiaper
				from marks m 
				inner join candsum cs on m.fregno = cs.fregno and m.fexamno = cs.ffreshexam
				and m.fyear = cs.fyear and m.fexamtype = cs.fexamtype
				inner join subject s on m.fdegree = s.fdegree and m.fexamno = s.fexamno and m.fsubcode = s.fcsubcode
				inner join degree dg on m.fdegree = dg.fdegree and m.fexamno = dg.fexamno
				where s.fintass = 'T' and m.fdegree like '{$degree_code}' 
				and ifnull(dg.fshortiaper,'') <> ''
				{$examstr2} 
				and m.fcollcode = '{$college_code}'
				and s.fretain = 'T' 
				group by m.fcollcode,m.fdegree,m.fexamno,m.fsubcode,m.fregno
				having (perval< CAST(dg.fshortiaper as unsigned))";
				
				//<ifnull(dg.fshortiaper,'0')
				// echo $qyery;
				// die();
				$res4 = $aobj_context->mobj_db->Execute($qyery);
			}

			$qyery = "insert ignore into attshort_r(fcollcode,fdegree,fexamno,fsubcode,fregno,fremarks,fperval,FUPDDATE,fyear,fexamtype)
			select distinct a.fcollcode,a.fdegree,a.fexamno,s.fcsubcode,a.fregno,'Attendance Shortage',ifnull(a.fper,0) as perval,now(),a.fyear,a.fexamtype
			from attend a inner join candsum cs on a.fregno = cs.fregno and a.fexamno = cs.ffreshexam
			and a.fyear = cs.fyear and a.fexamtype = cs.fexamtype
			inner join degree dg on a.fdegree = dg.fdegree and a.fexamno = dg.fexamno
			inner join subject s on a.fdegree = s.fdegree and a.fexamno = s.fexamno
			and left(a.fsubcode,4) = s.fsubcode
			where ifnull(fper,0) < ifnull(dg.fshortattper,0) 
			and a.fdegree = '{$degree_code}'
			and ifnull(dg.fshortattper,'') <> ''
			and s.fretain <> 'T'
			{$examstr3} 
			and a.fcollcode like '{$college_code}' 
            and ifnull(a.fentdate,'')<>''";
			$res5 = $aobj_context->mobj_db->Execute($qyery);

    
    $query="SELECT  att.fregno as regno, st.fname as fname,  
    concat(su.fsubname,' - ',su.fsubshort) as subjectcode,
    att.FPERVAL as attper, concat(FSECVAL,'/',FTOTVAL,', Per.: ',att.FPERVAL) as iaper,
    FREMARKS 
    FROM attshort_r att 
    INNER JOIN student st on att.fregno = st.fregno 
    AND att.fdegree = st.fdegree
    INNER JOIN subject su on att.fdegree = su.fdegree  
    AND  att.FEXAMNO = su.FEXAMNO
    AND att.fsubcode = su.fcsubcode
    WHERE att.fdegree='{$degree_code}'
    and att.fyear = '{$fyear}'
    and att.fexamtype = '{$fexamtype}' 
    order by att.fregno,att.fsubcode";



   $results = $aobj_context->mobj_db->GetAll($query);

   if($results){
       $data['data'] = $results;
       echo $aobj_context->mobj_output->ToJSONEnvelope($data, 0,"success"); 
   }else{
       $data['data'] = "Failed to show";
       echo $aobj_context->mobj_output->ToJSONEnvelope($data, -1,"fail"); 
       return;
   }
      
}  


function attshorttable($aobj_context){
    $iaattarray = json_decode($aobj_context->mobj_data["data"],true);
    

    foreach ($iaattarray as $data) {
        if($data['fstatus']){
           
                $query = "INSERT INTO attshort (fdegree, fcollcode, fexamno, fsubcode, fregno,fyear,fexamtype,faname)
                          values('{$data['degree']}', '{$data['collegecode']}', '{$data['examno']}', '{$data['subjectcode']}', 
                          '{$data['regno']}', '{$data['years']}','{$data['examtype']}', 
                          '{$data['fname']}')";
          
            $result = $aobj_context->mobj_db->Execute($query);
         
        }
        
        if ($result) {
            $data['data'] = $result;
            echo $aobj_context->mobj_output->ToJSONEnvelope($data, 0,"success"); 
         
        } else {
            $data['data'] = "Failed to update";
            echo $aobj_context->mobj_output->ToJSONEnvelope($data, -1,"fail");
       
        }
        
        }  
}
    

?>