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


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

<?php
function getExtMarkQP($aobj_context){
  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
  $collcode = $_SESSION['collcode'];
  $usr = $_SESSION['usr'];
  

  $qry1 = "select ifnull(fteachcode,'') as fteachcode from s_sysdb
  where college_code = '{$collcode}' and sysusr = '{$usr}'";

  $lobj1 = $aobj_context->mobj_db->GetRow($qry1);  

  if($lobj1['fteachcode'] == ""){
      $cnd = "";
  }else{
      $cnd = "where fteachcode = '{$lobj1['fteachcode']}'";
  }

  $query = "select ifnull(t.fsubcode,'') as fsubcode, concat(ifnull(FSUBNAME, ''),' - ',fssubname) as fsubname 
  from
  tdvs_copomarks t
  inner join 
  subject s on  t.fsubcode = s.fqpcode
  $cnd
  group by t.fsubcode";


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

  if($result){
        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 getPackNo($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $qpcode = $aobj_context->mobj_data["qpcode"];
  
    $user_type = $_SESSION['user_type'];

    $user = $_SESSION['usr'];
    $user_type = 40;
    $cnd = "and t.fteachcode = right('{$user}',4)";
    if($user_type == '14' || $user_type == '40')
      $cnd = "";



    $qry = "select ifnull(t.fcollcode,'') as fcollcode from tdvs_copomarks t
    where t.fsubcode = '{$qpcode}'  {$cnd}
    group by t.fcollcode";
  
    $result = $aobj_context->mobj_db->GetAll($qry);
  
    if($result){
          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 getValNo($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $qpcode = $aobj_context->mobj_data["qpcode"];
    $packet = $aobj_context->mobj_data["packet"];

  
    $qry = "select ifnull(fvalno,'') as fvalno from tdvs_copomarks
    where fsubcode = '{$qpcode}' and fcollcode = '{$packet}'
    group by fvalno";
    
    $result = $aobj_context->mobj_db->GetAll($qry);
  
    if($result){
          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 entryMarksData($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

    $valno = $aobj_context->mobj_data["valno"];
    $packet = $aobj_context->mobj_data["packet"];
    $qpcode = $aobj_context->mobj_data["qpcode"];
    $collcode=$_SESSION['collcode'];

    $query = "select fqpcode from subject where fdegree = '{$degree}' and fexamno = '{$examno}' and fcsubcode = '{$qpcode}'";
    $res1 = $aobj_context->mobj_db->Getrow($query); 
    $fqpcode1 = $res1['fqpcode'];

    $qry3 = "select fdegree,fexamno from tdvs_qpcopo where fqpcode = '{$qpcode}'";
    $res3 = $aobj_context->mobj_db->Getrow($qry3); 
    $degree = $res3['fdegree'];
    $examno = $res3['fexamno'];

    $query = "select p.fqncode,pd.fqnno,p.fmaxmarks
    from   tdvs_qpcopo p 
    inner join tdvs_qptempdetl_copo pd on p.ftempcode = pd.ftempcode
    and p.fpartcode = pd.fpartcode and p.fqncode = pd.fqncode
    where  p.fdegree = '{$degree}' and p.fexamno = '{$examno}'
    and ifnull(p.fmaxmarks,0) >0
    and p.fqpcode = '{$qpcode}'
    order by pd.fqncode";

    $res=$aobj_context->mobj_db->GetAll($query);
	$id = 4+count($res);

    $e_data.="<table  width='80%' id = 'showteachsub' cellspacing='0' class='tr_ventor_row' cellpadding='0' border='0' >";
    $e_data.="<th align='left' colspan='{$id}' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:24px;'>Marks Entry</th>";			
    $e_data.="<tr class='ui-state-default ui-jqgrid-hdiv'>";	
    $e_data.="<td  style='padding:2px; width:20px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Sl.<br>No.</center></td>";
    $e_data.="<td  style='padding:2px; width:50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Script No.</center></td>";
    $e_data.="<td  style='padding:2px; width:20px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Tot.<br>Marks</center></td>";
    
    $fileds = "";
    $x =0;
    $arry = [];
    $qno = [];
    
    foreach($res as $value)
    {
        $e_data.="<td  style='padding:2px; width:30px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>{$value['fqnno']}<br>({$value['fmaxmarks']})
        <input type = 'hidden' value ='".$value['fmaxmarks']."' id = '$x".'qnmax'."'/>
        </center></td>";
        $fileds .= "ifnull(".'fq'.strtolower(str_replace(".","",$value['fqnno'])).",'-1') as ".'fq'.strtolower(str_replace(".","",$value['fqnno'])).", ";
        $arry[$x] = 'fq'.strtolower(str_replace(".","",$value['fqnno']));
        array_push($qno, $value['fqnno']);
        
         $x++;
    }
    
    $e_data.="</tr>";

    $query = "select $fileds fregno,ftotmarks from tdvs_copomarks 
    where fcollcode = '{$packet}' and fvalno = '{$valno}'
    and fsubcode = '{$qpcode}'";
    // var_dump($query);
    // die();
    $res2= $aobj_context->mobj_db->GetAll($query);
    $i = 1;

    foreach($res2 as $val)
    {
        $e_data.="<tr>";
        $e_data.="<td  style='padding:2px; width:30px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>$i</center></td>";
        $e_data.="<td  style='padding:2px; width:30px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>{$val['fregno']}  
        <input type = 'hidden' value ='".$val['fregno']."' id = '$i".'hregno'."'/>
        <input type = 'hidden' value ='N' id = '$i".'hcregno'."'/>
        <input type = 'hidden' value ='".count($arry)."' id = '$i".'totqp'."'/>
        </center></td>";
        $e_data.="<td  style='padding:2px; width:30px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;text-align: center;' id = '$i".'totmarks'."'>{$val['ftotmarks']}</td>";
        for($z =0;$z<count($arry);$z++)
        {
            $e_data.="<td  style='padding:2px; width:25px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;text-align:center'><input type = 'text' value ='".$val[$arry[$z]]."'  style='width:30px;text-align: center;' onchange = 'getregupd(this),valmaxmarksExt(this)' id = '$i".'_qp_'."$z'/>
            <input type = 'hidden' value ='".$arry[$z]."' id = '$i".'_hqp_'."$z'/>
            </td>";    
        }
        $e_data.="</tr>";
        $i++;
    }

    $e_data.="</table>";
    $lob = true;
    if($lob){

        $arry['tabledata'] = $e_data;
        $arry['qpcnt'] = $z;
        $arry['tablecnt'] = count($res2);
        $arry['qno'] = $qno;
          echo $aobj_context->mobj_output->ToJSONEnvelope($arry,0,"success"); 
      }else{
          $arr['msg'] = 'Failed to load';
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
      }
  }


function saveExtMarks($aobj_context)
{
    $valno = $aobj_context->mobj_data["valno"];
    $packet = $aobj_context->mobj_data["packet"];
    $qpcode = $aobj_context->mobj_data["qpcode"];
    $submarks = $aobj_context->mobj_data["submarks"];
    $collcode=$_SESSION['collcode'];
    $fsubarry = json_decode($submarks);
	
    $fviewopt = $_SESSION['fviewopt'];
	var_dump($fsubarry,$fviewopt,$submarks);die();
    if($fviewopt == 'T')
    {
        $rdata='Only View Option Enabled';
        echo $aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure");
        return;	
    }
    
    $qry3 = "select fdegree,fexamno from tdvs_qpcopo where fqpcode = '{$qpcode}'";
    $res3 = $aobj_context->mobj_db->Getrow($qry3); 
    $degree = $res3['fdegree'];
    $examno = $res3['fexamno'];

    $query = "select fcsubcode from subject where fdegree = '{$degree}' and fexamno = '{$examno}' and fqpcode = '{$qpcode}'";
    $res1 = $aobj_context->mobj_db->Getrow($query); 
    $fsubcode = $res1['fcsubcode'];

    foreach($fsubarry as $val)
    {
        $res = $val;
       foreach($res as $value)
       {
            $regno =  $value->regno;
            $totmarks =  $value->totmarks;
            $maxmarks =  $value->maxmarks;
            $qp =  $value->qp;

            $upd = "update tdvs_copomarks set $qp = '{$maxmarks}',
            ftotmarks = '{$totmarks}'
            where fregno = '{$regno}'  and fvalno = '{$valno}'
            and fsubcode = '{$qpcode}'
            and fcollcode = '{$packet}'";
            
            $resupd = $aobj_context->mobj_db->Execute($upd);
       }
    }

    if($resupd)
    {
        $rdata = "Updated Successfully.";
        echo($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
        return;
    }
    else
    {
        $rdata = "No Updation / Add..!";
        echo($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));  
        return;			
    }
   

}

?>