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


Current Path : /var/www/oasis/src/
Upload File :
Current File : /var/www/oasis/src/absentEntryYearModewise.php

<?php
    function getSubjectDetTimetable($aobj_context){
        $qpcode = $aobj_context->mobj_data['qp_code'];
        $year = $aobj_context->mobj_data['year'];
        $examtype = $aobj_context->mobj_data['examtype'];

        $query = "select concat(s.FSUBNAME,' ',s.FSSUBNAME) as FSSUBNAME, date_format(t.fdate,'%d/%m/%Y') as FDOE, CASE WHEN LEFT(t.fsessiont,1)='M' THEN 'AM' ELSE 'PM' END AS FSESSION from 
                  timetable t inner join subject s on s.fqpcode = t.fqpcode  
                  where t.fqpcode='{$qpcode}' and fyear='{$year}' and fexamtype='{$examtype}' 
                  and ifnull(fdate, '0000-00-00') <> '0000-00-00' ";
        $res =  $aobj_context->mobj_db->GetRow($query);

        if($res){
            echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success"); 
        }else{
            $arr['msg'] = 'no data found';
            echo $aobj_context->mobj_output->ToJSONEnvelope($res, -1, "failure"); 
            return;
        }
    }

    function viewAbsentEntryDetails($aobj_context){
        $qpcode = $aobj_context->mobj_data['qp_code'];
        $year = $aobj_context->mobj_data['year'];
        $examtype = $aobj_context->mobj_data['examtype'];
        $category = $aobj_context->mobj_data['category'];
        $examDate = $aobj_context->mobj_data['examDate'];
        $session = $aobj_context->mobj_data['session'];
        $collcode = $_SESSION['collcode'];

        $query = "select  distinct stu.FREGNO, stu.FNAME
				  from absent a inner join  student stu on stu.FREGNO=a.FREGNO 
				  where 1=1  and a.FQPCODE='{$qpcode}' 
                  and a.FCOLLCODE='{$collcode}'
                  and a.FDOE=date_format(str_to_date('{$examDate}', '%d/%m/%Y'), '%Y-%m-%d')
                  and a.FSESSION='{$session}' and a.fyear='{$year}' and a.fexamtype='{$examtype}'
                  and FABSTYPE='{$category}' order by a.FREGNO";
                  
        $res =  $aobj_context->mobj_db->GetAll($query);
       
        if($res){
            echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success"); 
        }else{
            $data = array([
                "FREGNO" => "",
                "FNAME" => ""
            ]);
            $arr['msg'] = 'no data found';
            echo $aobj_context->mobj_output->ToJSONEnvelope($data, -1, "failure"); 
            return;
        }
    }

    function saveAbsentMalEntryDetails($aobj_context){
        $qpcode = $aobj_context->mobj_data['qpcode'];
        $year = $aobj_context->mobj_data['year'];
        $examtype = $aobj_context->mobj_data['examtype'];
        $category = $aobj_context->mobj_data['category'];
        $examDate = $aobj_context->mobj_data['examDate'];
        $session = $aobj_context->mobj_data['session'];
        $data = json_decode($aobj_context->mobj_data['data'], true);
        $collcode = $_SESSION['collcode'];
        $usercode = $_SESSION['usr'];

        $query = "delete from absent where fqpcode='{$qpcode}' and fexamtype='{$examtype}'
                      and fyear='{$year}' and fabstype='{$category}'";
        $res =  $aobj_context->mobj_db->Execute($query);

        foreach($data as $val){
            
            if($val['FREGNO'] != '')
            {
                $query1 = "insert into absent (FCOLLCODE, FQPCODE, FDOE, FYEAR, FEXAMTYPE,
                       FREGNO, FABSTYPE, FLOGNAME, FLOGDATE, FDELETED, FSESSION) values 
                       ('{$collcode}', '{$qpcode}', date_format(str_to_date('{$examDate}', '%d/%m/%Y'), '%Y-%m-%d'), 
                       '{$year}', '{$examtype}', 
                       '{$val['FREGNO']}', '{$category}', '{$usercode}', now(), 'F', '{$session}')";

                $res1 =  $aobj_context->mobj_db->Execute($query1);
            }
        }

        if($res1){
            $arr['msg'] = 'Updated successfully';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success"); 
        }else{
            $arr['msg'] = 'Failed to update';
            echo $aobj_context->mobj_output->ToJSONEnvelope($res, -1, "failure"); 
            return;
        }
    }

    
?>