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


Current Path : /proc/thread-self/root/var/www/html/reva/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/reva/src/qppattern.php

<?php
function loadQpPattern($aobj_context){
  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
  $query = "select ifnull(ftempcode, '') as ftempcode, ifnull(ftempname, '') as ftempname,
  ifnull(ftempdesc, '')as ftempdesc from tdvs_qptemphead";
  $lobj_get_data = $aobj_context->mobj_db->GetAll($query);  

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

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

  $tempcode = $aobj_context->mobj_data["tempcode"];
  $query = "select distinct ifnull(fpartcode, '') as fpartcode 
            from tdvs_qptemphead where ftempcode ='$tempcode'";

            // var_dump($query);
            // die();
  $lobj_get_data = $aobj_context->mobj_db->GetAll($query);

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

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

  $tempcode = $aobj_context->mobj_data["tempcode"];
  $partcode = $aobj_context->mobj_data["partcode"];

  $partcodedet = "select distinct ifnull(fpartcode, '') as fpartcode, ifnull(ftempcode, '') as ftempcode 
               from tdvs_qptemphead where fpartcode ='{$partcode}' and ftempcode = '{$tempcode}'";
              
  $partcodedata = $aobj_context->mobj_db->GetRow($partcodedet); 
  //  var_dump($partcode);
  //              die();
  
  $query = "select ifnull(fqncode, '') as fqncode ,ifnull(fqnno, '') as fqnno,
            ifnull(fpartcode, '') as fpartcode, ifnull(ftempcode, '') as ftempcode,
            ifnull(fqnlevel, '') as fqnlevel, ifnull(fqnparent, '') as fqnparent,
            ifnull(fmaxmarks, '') as fmaxmarks, ifnull(fsubqp, '') as fsubqp, 
            ifnull(fsubmaxqn, '') as fsubmaxqn, ifnull(fsubmandqn, '') as fsubmandqn,
            ifnull(fqnord, '') as fqnord from tdvs_qptempdetl 
            where fpartcode = '$partcode' and ftempcode ='$tempcode'";
            // var_dump($query);
            // die();
  $lobj_get_data = $aobj_context->mobj_db->GetAll($query);

  $result['partcode']=   $partcodedata;
  $result['table']= $lobj_get_data;

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

function editqppatterndet($aobj_context){
  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
  $tempcode = $aobj_context->mobj_data["tempcode"];

  $query = "select ifnull(ftempcode, '') as ftempcode ,ifnull(ftempname, '') as ftempname, 
  ifnull(ftempdesc, '') as ftempdesc, ifnull(fmaxmarks, '') as fmaxmarks,
  ifnull(ftotmandqn, '') as ftotmandqn,ifnull(fpartcode, '') as fpartcode,ifnull(fpartdesc, '') as fpartdesc,ifnull(fmaxqn, '') as fmaxqn,ifnull(fmandqn, '') as fmandqn,ifnull(fminqn, '') as fminqn from tdvs_qptemphead 
  where ftempcode ='{$tempcode}'";


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

  $query1 = "select distinct ifnull(ftempcode, '') as ftempcode ,ifnull(ftempname, '') as ftempname, 
  ifnull(ftempdesc, '') as ftempdesc, ifnull(fmaxmarks, '') as fmaxmarks,
  ifnull(ftotmandqn, '') as ftotmandqn from tdvs_qptemphead 
  where ftempcode ='{$tempcode}'
  group by ftempcode";


  $lobj_get_data1 = $aobj_context->mobj_db->GetRow($query1);

  $result['tempcode'] = $lobj_get_data1;
  $result['table'] = $lobj_get_data;


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

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

  $tdata = json_decode($aobj_context->mobj_data["tdata"],true);

  $tempcode = $aobj_context->mobj_data["tempcode"];
  $partcode = $aobj_context->mobj_data["partcode"];


  // var_dump($fetch);
  // die();
 
  foreach($tdata as $key => $value){

    $query1 = "select ifnull(fqncode, '') as fqncode from tdvs_qptempdetl
    where fpartcode = '$partcode'  
    and ftempcode = '$tempcode' and fqncode = '{$value['fqncode']}'";

    $fetch = $aobj_context->mobj_db->GetRow($query1);
    
    if($fetch['fqncode'] == "" || $fetch['fqncode'] == NULL){
      $query2 = "insert into tdvs_qptempdetl (ftempcode, fpartcode, fqncode, fqnno, fqnlevel, 
                fqnparent, fmaxmarks, fsubqp, fsubmaxqn, fsubmandqn, fqnord) 
                values ('{$tempcode}', '{$partcode}', '{$value['fqncode']}', '{$value['fqnno']}', '{$value['fqnlevel']}',
                '{$value['fqnparent']}', '{$value['fmaxmarks']}', '{$value['fsubqp']}', '{$value['fsubmaxqn']}',
                 '{$value['fsubmandqn']}', '{$value['fqnord']}')";
      //var_dump($query2);          
      $result = $aobj_context->mobj_db->Execute($query2);
    }else{
      $query3 = "update tdvs_qptempdetl set fqnno='{$value['fqnno']}',
                 fqnlevel='{$value['fqnlevel']}', fqnparent='{$value['fqnparent']}', fmaxmarks='{$value['fmaxmarks']}', 
                 fsubqp='{$value['fsubqp']}', fsubmaxqn='{$value['fsubmaxqn']}', fsubmandqn='{$value['fsubmandqn']}', 
                 fqnord='{$value['fqnord']}' where fpartcode = '{$partcode}' and ftempcode = '{$tempcode}' and fqncode = '{$value['fqncode']}'";
               
       $result = $aobj_context->mobj_db->Execute($query3);
    } 
  }
  if($result){
    $arr['msg'] = "success";
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
    
    }else{
      $arr['msg'] = "success";
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
    }
}

function deleteDetailedReport($aobj_context){
  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
  $qnno = $aobj_context->mobj_data["qnno"];
  $tempcode = $aobj_context->mobj_data["tempcode"];
  $partcode = $aobj_context->mobj_data["part"];

  $query = "delete from tdvs_qptempdetl 
            where ftempcode='{$tempcode}' and 
            fpartcode='{$partcode}' and 
            fqncode='{$qnno}'";
  $result = $aobj_context->mobj_db->Execute($query);
  if($result){
    $arr['msg'] = "Deleted";
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
    }else{
      $arr['msg'] = "failed to delete";
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
      return;
    }            
}

function saveSummaryPattern($aobj_context){
  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
 
  $tdata = json_decode($aobj_context->mobj_data["tdata"],true);
  // $savepattern= $_POST["savepattern"];
  // var_dump($savepattern);
  // die();
  $tempcode = $aobj_context->mobj_data["temp_code"];
  $tempname = $aobj_context->mobj_data["temp_name"];
  $tempdesc = $aobj_context->mobj_data["temp_desc"];
  $mans_qns = $aobj_context->mobj_data["mans_qns"];
  $max_marks = $aobj_context->mobj_data["max_marks"];
  $part_code = $aobj_context->mobj_data["part_code"];
  $part_disc = $aobj_context->mobj_data["part_disc"];
  $max_qns = $aobj_context->mobj_data["max_qns"];
  $mand_qns = $aobj_context->mobj_data["mand_qns"];
  $max_mks = $aobj_context->mobj_data["max_mks"];
  $min_qns = $aobj_context->mobj_data["min_qns"];
  // $data=$aobj_context->mobj_data["data"];
  // var_dump($data);
  // die();

  
  foreach($tdata as $key => $value){
    
    $query = "select ifnull(fpartcode, '')as fpartcode from 
              tdvs_qptemphead where ftempcode='{$tempcode}' and fpartcode = '{$value['fpartcode']}'";
              // var_dump($query);
              
    $fetch = $aobj_context->mobj_db->GetRow($query);
    if($fetch["fpartcode"]==""){
     
      $query1 = "insert into tdvs_qptemphead(ftempcode, ftempname, ftempdesc, 
                ftotmandqn, fpartcode, fpartdesc, fmandqn, fmaxqn, fmaxmarks, fminqn)
                values('{$tempcode}', '{$tempname}', '{$tempdesc}',
                '{$mans_qns}', '{$value['fpartcode']}', '{$value['fpartdesc']}', '{$value['fmandqn']}',
                '{$value['fmaxqn']}', '{$value['fmaxmarks']}', '{$value['fminqn']}')";
                // var_dump($query1);
                // die();
      $result = $aobj_context->mobj_db->Execute($query1);
    }
  
   
  
}
  if($result){
    $arr['msg'] = "success";
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
    }else{
      $arr['msg'] = "failed to save";
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
      return;
    }   
}

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

  $tempcode = $aobj_context->mobj_data["temp"];
  $partcode = $aobj_context->mobj_data["part"];

  $query = "delete from tdvs_qptemphead where ftempcode = '{$tempcode}' and fpartcode = '{$partcode}'";
  // var_dump($query);
  // die();
  $result = $aobj_context->mobj_db->Execute($query);

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

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

  $qncode = $aobj_context->mobj_data["qncode"];
  $tempcode = $aobj_context->mobj_data["tempcode"];
  $partcode = $aobj_context->mobj_data["partcode"];
  
  $query = "select ifnull(fqncode,'')as fqncode from tdvs_qptempdetl 
            where fqncode = '{$qncode}' and fpartcode = '{$partcode}' and ftempcode = '{$tempcode}'";
// var_dump($query);
//   die();
  $result= $aobj_context->mobj_db->GetRow($query);

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

}

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

  $tempcode = $aobj_context->mobj_data["temp_code"];
  $tempname = $aobj_context->mobj_data["temp_name"];
  $tempdesc = $aobj_context->mobj_data["temp_desc"];
  $mans_qns = $aobj_context->mobj_data["mans_qns"];
  $max_marks = $aobj_context->mobj_data["max_marks"];
  $part_code = $aobj_context->mobj_data["part_code"];
  $part_disc = $aobj_context->mobj_data["part_disc"];
  $max_qns = $aobj_context->mobj_data["max_qns"];
  $mand_qns = $aobj_context->mobj_data["mand_qns"];
  $max_mks = $aobj_context->mobj_data["max_mks"];
  $min_qns = $aobj_context->mobj_data["min_qns"];
  $tdata = json_decode($aobj_context->mobj_data["tdata"],true);

  // var_dump($tempcode);
  // die();
  foreach($tdata as $key=> $value){
    $query2 = "insert into tdvs_qptemphead(ftempcode, ftempname, ftempdesc, fmaxmarks, ftotmandqn, 
              fpartcode, fpartdesc, fmaxqn, fmandqn, fminqn) 
              values('{$tempcode}','{$tempname}','{$tempdesc}','{$max_marks}','{$mans_qns}',
              '{$value['fpartcode']}','{$value['fpartdesc']}','{$value['fmaxqn']}','{$value['fmandqn']}','{$value['fminqn']}')";
    $result = $aobj_context->mobj_db->Execute($query2);
  }
  if($result){
    $arr['msg'] = "Saved Successfully";
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
    return;
  }else{
    $data="Failed";
    echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
    return;
  }

}
?>