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 : 18.119.112.208


Current Path : /proc/thread-self/root/var/www/oasis/src/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/src/remunerationEntry.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 viewremuneration($aobj_context){
    $collcode = $_SESSION['collcode'];
    $examdate = $aobj_context->mobj_data["rdate"];
    $examsession = $aobj_context->mobj_data["session"];

    $qry="SELECT *FROM masrem";
    $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, 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
              WHERE fdate='{$examdate}' AND fsesstion='{$examsession}'";

             

    // $query1="SELECT *FROM remuneration where fdate='{$examdate}' and fsesstion='{$examsession}'";
    $result1 = $aobj_context->mobj_db->GetAll($query1);
   
    if($res){
    
      $arr['rem']=$res;
      $arr['teach']=$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 saveRemunerationData($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) { 

  //     $words = explode("-", $value['selectedTeacher']);
  //     $teachcode=$words[0];
  //     $teachname=$words[1];

  //     $qry1="select *from remuneration";
  //     $res1 = $aobj_context->mobj_db->GetAll($qry1);

  //     if($res1){
  //       foreach($res1 as $val){
          
  //         if($val['fid'] == $value['fid']){
          
  //           $query="update remuneration set fremteachname='{$teachname}',
  //           flogdate='NOW()',fuser='{$user},fremteachcode='{$teachcode}',
  //           fremdate='{$examdate}',fremsession='{$examsession}' where fid='{$val['fid']}'";
        
  //         }else{
  //           $query = "INSERT INTO remuneration (fremtype, fremamt, fremteachname, flogdate, fuser,fremteachcode,fremdate,fremsession,fid)
  //           VALUES ('{$value['fheadtype']}', '{$value['famount']}', '{$teachname}', NOW(), '{$user}','{$teachcode}','{$examdate}','{$examsession}','{$value['fid']}')";
       
  //         }
         
  //       }

  //     }else{

  //       $query = "INSERT INTO remuneration (fremtype, fremamt, fremteachname, flogdate, fuser,fremteachcode,fremdate,fremsession,fid)
  //       VALUES ('{$value['fheadtype']}', '{$value['famount']}', '{$teachname}', NOW(), '{$user}','{$teachcode}','{$examdate}','{$examsession}','{$value['fid']}')";
  //     }

    
  
  //   $res = $aobj_context->mobj_db->Execute($query);

  //     if($res){
  //     $arr['msg']="Inserted Successfully";
  //     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 saveRemunerationData($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) {
        $words = explode("-", $value['selectedTeacher']);
        $teachcode = $words[0];
        $teachname = $words[1];

        $qry1 = "SELECT * FROM remuneration WHERE fid = '{$value['fid']}' and fdate='{$examdate}' and fsesstion='{$examsession}'";
        $res1 = $aobj_context->mobj_db->GetAll($qry1);
      
        if ($res1) {
         
            $query = "UPDATE remuneration SET
                        fupddate=NOW(), 
                        fupduser='{$user}', 
                        ftechcode='{$teachcode}'
                      WHERE fid='{$value['fid']}' and fdate='{$examdate}' and fsesstion='{$examsession}' and fcollcode='{$collcode}'";
        } else {
       
            // $query = "INSERT INTO remuneration (fremtype, fremamt, fremteachname, flogdate, fuser, fremteachcode, fremdate, fremsession, fid)
            //           VALUES ('{$value['fheadtype']}', '{$value['famount']}', '{$teachname}', NOW(), '{$user}', '{$teachcode}', '{$examdate}', '{$examsession}', '{$value['fid']}')";

                       $query = "INSERT INTO remuneration (fid, fcollcode, fdate, fsesstion, ftechcode, fremamt, fcreatedate, fcreateuser, fupduser,fupddate)
                      VALUES ('{$value['fid']}','{$collcode}','{$examdate}','{$examsession}','{$teachcode}','{$value['famount']}',NOW(),'{$user}','','')";
        }
   
        $res = $aobj_context->mobj_db->Execute($query);
    }
    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 remunerationview($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");
}
 
}
?>