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


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

<?php
  function getDateForRemuneration($aobj_context){
    session_start();
    $collcode = $_SESSION['collcode'];
    // $examdate = $aobj_context->mobj_data["rdate"];
    
    // $date = DateTime::createFromFormat('d-m-Y', $examdate);
    // $formatted_date = $date->format('Y-m-d');

    $query="SELECT DISTINCT s.fdoe FROM subject s INNER JOIN reason r ON s.fsession=r.freasoncd ";
  
    $res = $aobj_context->mobj_db->GetAll($query);
 
            if($res){
              echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success");
            }
            else{
              $arr['msg']="Failed to Load";
              echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
            }
  }  

  function getSessiontoDate($aobj_context){
    $examdate = $aobj_context->mobj_data["rdate"];
    
      $qry="SELECT DISTINCT s.fsession, r.fdescpn FROM subject s INNER JOIN reason r ON s.fsession=r.freasoncd 
      WHERE s.fdoe='{$examdate}' AND (s.fsession LIKE '%M%' OR s.fsession LIKE '%N%')";

$res = $aobj_context->mobj_db->GetAll($qry);
// var_dump(strpos($res['fsession'], 'M') !== false); die();


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

  }

  function selectinvigilatorsroomwise($aobj_context){
    $collcode = $_SESSION['collcode'];
    $examdate = $aobj_context->mobj_data["rdate"];
    $examsession = $aobj_context->mobj_data["session"];

 $qry=" SELECT DISTINCT m.froomno, m.froomname 
        FROM candsum cs INNER JOIN canddet cd ON cs.fregno = cd.fregno
        AND cs.fcollcode = cd.fcollcode
        INNER JOIN subject su ON cd.fdegree = su.fdegree
        AND cd.fexamno = su.fexamno AND cd.fsubcode = su.fsubcode
        INNER JOIN masroom m ON m.fcollcode = cs.fcntrcode
        INNER JOIN reason r ON su.fsession = r.freasoncd 
        #left join 
        WHERE su.fdoe='{$examdate}' AND su.fsession='{$examsession}'  AND cd.fpresent='P'
        AND cs.fcntrcode = '{$collcode}'";
  
    $res = $aobj_context->mobj_db->GetAll($qry);
    
    $query="SELECT DISTINCT fteachcode,fteachname FROM masteach WHERE fcollcode='{$collcode}'";
           
    $result = $aobj_context->mobj_db->GetAll($query);

    // $query1=" SELECT ifnull(m.fheadtype,'')as fheadtype,ifnull(mas.fteachname,'')as fteachname, r.froomno,ma.froomname, ifnull(r.fremamt,'')as fremamt,
    //           ifnull(r.ftechcode,'')as ftechcode, ifnull(r.fid,'')as fid FROM remuneration r left JOIN masrem m ON r.fid=m.fid 
    //          left JOIN masteach mas ON r.fcollcode=mas.fcollcode AND r.ftechcode=mas.fteachcode LEFT JOIN masroom ma ON r.froomno=ma.froomno
    //           WHERE fdate='{$examdate}' AND fsesstion='{$examsession}' AND ma.fallot <> ''";

    $query1 ="SELECT DISTINCT m.froomno, m.froomname,re.ftechcode,re.fdate,re.fid
              FROM candsum cs INNER JOIN canddet cd ON cs.fregno = cd.fregno
              AND cs.fcollcode = cd.fcollcode
              INNER JOIN subject su ON cd.fdegree = su.fdegree
              AND cd.fexamno = su.fexamno AND cd.fsubcode = su.fsubcode AND cs.fdegree=su.fdegree
              INNER JOIN masroom m ON m.fcollcode = cs.fcntrcode
              INNER JOIN reason r ON su.fsession = r.freasoncd 
              INNER JOIN masteach t ON t.fcollcode = cs.fcollcode 
              LEFT JOIN remuneration re ON re.ftechcode = t.fteachcode AND re.froomno = m.froomno AND re.fcollcode=m.fcollcode
              AND su.fdoe=re.fdate AND su.fsession=re.fsesstion AND r.freasoncd=re.fsesstion AND re.fcollcode =cd.fcollcode
              LEFT JOIN masrem mm ON mm.fid=re.fid
              WHERE su.fdoe='{$examdate}' AND su.fsession='{$examsession}' AND cd.fpresent='P'
              AND cs.fcntrcode = '{$collcode}' ";          

    $result1 = $aobj_context->mobj_db->GetAll($query1);
   
    if($res){
    
      $arr['room']=$res;
      $arr['roomname']=$result;
      $arr['tabledata']=$result1;
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
    }
    else{
      $arr['msg']="Failed to Load";
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
    }

  }

  function saveInvigilators($aobj_context){
    $collcode = $_SESSION['collcode'];
    $user = $_SESSION['usr'];

    $examdate = $aobj_context->mobj_data["rdate"];
    $examsession = $aobj_context->mobj_data["session"];
    $data = json_decode($aobj_context->mobj_data["data"], true);

    foreach ($data as $key => $value) {
       if ($value['selectedTeacher'] !=""){
        $query="select *from remuneration where froomno='{$value['froomno']}' and fid='{$value['fid']}'";

        $res1 = $aobj_context->mobj_db->GetRow($query);
       if($res1){
          // $qry="UPDATE remuneration re
          //       INNER JOIN candsum cs ON re.fcollcode = cs.fcollcode
          //       INNER JOIN canddet cd ON cs.fregno = cd.fregno AND cs.fcollcode = cd.fcollcode
          //       INNER JOIN subject su ON cd.fdegree = su.fdegree AND cd.fexamno = su.fexamno AND cd.fsubcode = su.fsubcode
          //       INNER JOIN masroom m ON m.fcollcode = cs.fcntrcode
          //       INNER JOIN reason r ON su.fsession = r.freasoncd
          //       INNER JOIN masteach t ON t.fcollcode = cs.fcollcode AND t.fteachcode = re.ftechcode
          //       SET re.froomno = m.froomno, fupduser='{$user}',fupddate=now() WHERE su.fdoe = '{$examdate}' AND su.fsession = '{$examsession}' AND cd.fpresent = 'P'
          //       AND cs.fcntrcode = '{$collcode}' AND m.froomno = '{$value['froomno']}' AND t.fteachcode = '{$value['selectedTeacher']}'";

          $qry="  UPDATE remuneration re
                INNER JOIN candsum cs ON re.fcollcode = cs.fcollcode
                INNER JOIN canddet cd ON cs.fregno = cd.fregno AND cs.fcollcode = cd.fcollcode
                INNER JOIN subject su ON cd.fdegree = su.fdegree AND cd.fexamno = su.fexamno AND cd.fsubcode = su.fsubcode
                INNER JOIN masroom m ON m.fcollcode = cs.fcntrcode
                INNER JOIN reason r ON su.fsession = r.freasoncd
                INNER JOIN masteach t ON t.fcollcode = cs.fcollcode AND t.fteachcode = re.ftechcode
                SET re.froomno = m.froomno, fupduser='{$user}', fupddate=NOW(), re.ftechcode='{$value['selectedTeacher']}'
                WHERE su.fdoe = '{$examdate}' AND su.fsession = '{$examsession}' AND cd.fpresent = 'P'
                AND cs.fcntrcode = '{$collcode}' AND m.froomno = '{$value['froomno']}' AND fid='{$value['fid']}' ";
       }else{
          // $qry="INSERT INTO remuneration (fid,fdate,fsesstion, ftechcode, froomno, fcollcode,fcreatedate,fcreateuser)
          //       SELECT DISTINCT '{$value['fid']}', su.fdoe,su.fsession, t.fteachcode,m.froomno,cs.fcollcode,NOW(),'{$user}'
          //       FROM candsum cs
          //       INNER JOIN canddet cd ON cs.fregno = cd.fregno AND cs.fcollcode = cd.fcollcode
          //       INNER JOIN subject su ON cd.fdegree = su.fdegree AND cd.fexamno = su.fexamno AND cd.fsubcode = su.fsubcode
          //       INNER JOIN masroom m ON m.fcollcode = cs.fcntrcode
          //       INNER JOIN reason r ON su.fsession = r.freasoncd 
          //       INNER JOIN masteach t ON t.fcollcode = cs.fcollcode 
          //       LEFT JOIN remuneration re ON re.ftechcode = t.fteachcode AND re.froomno = m.froomno AND re.fcollcode = cs.fcollcode 
          //       WHERE su.fdoe = '{$examdate}'  AND su.fsession = '{$examsession}' AND cd.fpresent = 'P' AND cs.fcntrcode = '{$collcode}' 
          //       AND m.froomno = '{$value['froomno']}' AND t.fteachcode = '{$value['selectedTeacher']}' 
          //       AND NOT EXISTS (SELECT 1 FROM remuneration re2 WHERE re2.ftechcode = t.fteachcode AND re2.froomno = m.froomno
          //       AND re2.fcollcode = cs.fcollcode)";

          $id="select fid from masrem where fheadtype='Invigilators'";
          $idres = $aobj_context->mobj_db->GetRow($id);

          $qry="INSERT INTO remuneration (fid, fdate, fsesstion, ftechcode, froomno, fcollcode, fcreatedate, fcreateuser)
                SELECT DISTINCT '{$idres['fid']}', su.fdoe, su.fsession, t.fteachcode, m.froomno, cs.fcollcode, NOW(), 'super'
                FROM candsum cs INNER JOIN canddet cd ON cs.fregno = cd.fregno AND cs.fcollcode = cd.fcollcode 
                INNER JOIN subject su ON cd.fdegree = su.fdegree AND cd.fexamno = su.fexamno AND cd.fsubcode = su.fsubcode 
                    INNER JOIN masroom m ON m.fcollcode = cs.fcntrcode 
                    INNER JOIN reason r ON su.fsession = r.freasoncd 
                    INNER JOIN masteach t ON t.fcollcode = cs.fcollcode 
                    LEFT JOIN remuneration re ON re.ftechcode = t.fteachcode AND re.froomno = m.froomno AND re.fcollcode = cs.fcollcode 
                WHERE 
                    su.fdoe = '{$examdate}' 
                    AND su.fsession = '{$examsession}' 
                    AND cd.fpresent = 'P' 
                    AND cs.fcntrcode = '{$collcode}' 
                    AND m.froomno = '{$value['froomno']}' 
                    AND t.fteachcode = '{$value['selectedTeacher']}'";
       }
      
     }
    }
    $res = $aobj_context->mobj_db->Execute($qry);
    if ($res) {
      $arr['msg'] = "Success";
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
  } else {
      $arr['msg'] = "Failed to Load";
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
  }
}

function invigilatorview($aobj_context){
  $query="SELECT DISTINCT fdate,fsesstion FROM remuneration ";
  $res = $aobj_context->mobj_db->GetAll($query);
  if ($res) {
    echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success");
} else {
    $arr['msg'] = "Failed to Load";
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
}
 
}
?>