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


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

<?php

    function getDetails($aobj_context){
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $fteachcode=$aobj_context->mobj_data["teachcode"];
        $collcode=$_SESSION["collcode"];

        // var_dump($fteachcode);
        // die();

        $query = "select fteachcode from teachtransfer where fteachcode = '$fteachcode'";
        $get_data_teachcode = $aobj_context->mobj_db->GetRow($query);

// var_dump($get_data_teachcode);
// die();

        if(count($get_data_teachcode) == 0){
            $qry = "SELECT 
            IFNULL(fteachname,'')AS fteachname,
            DATE_FORMAT (IFNULL(fdob, ''),'%Y/%m/%d')AS fdob FROM masteach 
            WHERE  fteachcode='$fteachcode' and fcollcode='$collcode'";
        
            $get_data = $aobj_context->mobj_db->GetRow($qry);
            
            if($get_data)
            {	
                // $arr['msg']="saved";
                echo $aobj_context->mobj_output->ToJSONEnvelope($get_data,0,"success"); 
                return;
            }
            else
            {
                $arr['msg'] = "Not Found..!";
                $data="not found";
                echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                return;
            }   
        }else{
            $arr['msg'] = "Already existed..!";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                return;
        }
    }
    function loadcoltrans($aobj_context){
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $collcode=$_SESSION["collcode"];

        $query1="SELECT IFNULL(mt.fteachcode,'') AS fteachcode,
        IFNULL(mt.fteachname,'')AS fteachname,
        IFNULL(mt.fcollcode,'')AS fcollcode, 
        IFNULL(ct.fcollname,'')AS fcollname FROM masteach mt
        INNER JOIN college ct ON mt.fcollcode=ct.fcollcode where  mt.fcollcode='{$collcode}'
        and IFNULL(mt.fteachcode,'') <> '$collcode'";
        $lobj_get_data1 = $aobj_context->mobj_db->GetAll($query1);
       
        $query2="select concat(fcollcode,' - ', fcollname,', ',ftown) as fcollname, ifnull(fcollcode,'')as fcollcode from college where ifnull(fdeleted,'') <> 'T'
        order by fcollcode";
        $lobj_get_data2 = $aobj_context->mobj_db->GetAll($query2);

        if($lobj_get_data1)
        {	
            $arr['teach']=$lobj_get_data1;
            $arr['college']=$lobj_get_data2;
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
            return;
        }
        else
        {
            $data = "No data found..!";
            echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
            return;
        }
    }

    function savetranscoll($aobj_context)
    {
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $fteachname=$aobj_context->mobj_data["teachname"];
        $fid=$aobj_context->mobj_data["fid"];
        $fteachcode=$aobj_context->mobj_data["teachcode"];
        $collcode=$_SESSION["collcode"];
        $ftocolcode=$aobj_context->mobj_data["ftocolcode"];
        $fremarks=$aobj_context->mobj_data["remarks"];
        $fdob=$aobj_context->mobj_data["dob"];
        
        // var_dump($fdob);
        // die();
        $query2="select fteachcode from teachtransfer where fteachcode='$fteachcode'";
        $lobj = $aobj_context->mobj_db->GetRow($query2);


        if($lobj['fteachcode'] == '')
        {
            $query1="insert into teachtransfer
            (fteachname, fteachcode, ffromcolcode, ftocolcode, fremarks, fdob,fcreateddate)
            values('$fteachname','$fteachcode','$collcode','$ftocolcode', '$fremarks', DATE_FORMAT(STR_TO_DATE('$fdob','%Y/%m/%d'),'%Y-%m-%d'), now())";
            // var_dump($query1);
            // die();
            $result = $aobj_context->mobj_db->Execute($query1);

            if($result){
                $arr['msg']="Saved";
                echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
                return;
            }
            else
            {  
                $arr['msg']="failed";
                echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                return;
            }

        }else{
            $query3="UPDATE teachtransfer SET ftocolcode='$ftocolcode' ,
            fremarks='$fremarks' WHERE fteachcode='$fteachcode'";
            $lobj_get_data = $aobj_context->mobj_db->Execute($query3);

            if($lobj_get_data){
                $arr['msg']="Updated";
                echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
                return;
            }
            else
            {  
                $arr['msg']="failed";
                echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                return;
            }

        }

        
    }

    function loadtable($aobj_context){
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

        $collcode=$_SESSION["collcode"];
        $query="SELECT IFNULL(fid,'')AS fid, 
                IFNULL(fteachname,'')AS fteachname,
                IFNULL(fteachcode,'')AS fteachcode,
                IFNULL(ftocolcode,'')AS ftocolcode,
                IFNULL(fstatus,'')AS fstatus,
                IFNULL(fremarks,'')AS fremarks FROM teachtransfer where ffromcolcode = '$collcode'";

        $lobj_get_data = $aobj_context->mobj_db->GetAll($query);
        if($lobj_get_data)
        {	
            // $arr['msg']="saved";
            echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_data,0,"success"); 
            return;
        }
        else
        {
            $arr['msg'] = "not found..!";
            $data="not found";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
            return;
        }
        
    }

function edittable($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $fid=$aobj_context->mobj_data["fid"];
    $query="SELECT IFNULL(fid,'')AS fid, IFNULL(fteachname,'')AS fteachname,
                IFNULL(fteachcode,'')AS fteachcode,
                IFNULL(ftocolcode,'')AS ftocolcode,
                IFNULL(fteachcode,'')AS fteachcode,
                DATE_FORMAT (IFNULL(fdob, ''),'%Y/%m/%d')AS fdob,
                IFNULL(fremarks,'')AS fremarks FROM teachtransfer where fid='$fid' ";
    $lobj_get_data = $aobj_context->mobj_db->GetRow($query);
    
    if($lobj_get_data)
    {	
        // $arr['msg']="saved";
        echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_data,0,"success"); 
        return;
    }
    else
    {
        // $arr['msg'] = "failed..!";
        $data="not found";
        echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
        return;
    }
}
?>