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


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

<?php
function loadmarksdeg($aobj_context){
  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
  $collcode = $_SESSION['collcode'];
  $element = $aobj_context->mobj_data["element"];
  $user_type = $_SESSION['user_type'];
  $user = $_SESSION['usr'];
  $cnd = "and t.fteachcode = right('{$user}',4)";
  if($user_type == '14' || $user_type == '40')
    $cnd = "";
  
   if($element == "theory"){
    $qry1 = " select distinct ifnull(d.FDEGREE , '') as fdegree,ifnull(d.FDESCPN , '') as fdescpn 
            from degree d inner join tdvs_copomarks t on d.fdegree = t.fdegree
            and d.fexamno = t.fexamno inner join subject s on s.fqpcode = t.fsubcode
            and t.fdegree = s.fdegree and t.fexamno = s.fexamno
            where ifnull(d.FDEGREE , '') <> ''
            and t.fcollcode = '{$collcode}' and s.fretain='F'
            {$cnd}";
  }else{
  $qry1 = " select distinct ifnull(d.FDEGREE , '') as fdegree,ifnull(d.FDESCPN , '') as fdescpn 
            from degree d inner join tdvs_copomarks t on d.fdegree = t.fdegree
            and d.fexamno = t.fexamno inner join subject s on s.fcsubcode = t.fsubcode
            and t.fdegree = s.fdegree and t.fexamno = s.fexamno
            where ifnull(d.FDEGREE , '') <> ''
            and t.fcollcode = '{$collcode}' and s.fretain='T'";
  }

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

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

function loadmarksexamno($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $collcode = $_SESSION['collcode'];
    $user_type = $_SESSION['user_type'];
  $user = $_SESSION['usr'];
  $cnd = "";
 

    $degree = $aobj_context->mobj_data["degree"];
    $qry1 = "select distinct ifnull(d.FEXAMNO , '') as fexamno,ifnull(d.FEXAMNAME , '') as fexamname 
    from degree d inner join tdvs_copomarks t on d.fdegree = t.fdegree
    and d.fexamno = t.fexamno inner join colldeg c on d.fdegree = c.fdegree
    where t.FDEGREE = '{$degree}'
    and c.fcollcode = '{$collcode}'
    {$cnd}";

    // var_dump($qry1);
    // die();
  
    $lob = $aobj_context->mobj_db->GetAll($qry1); 

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

  function loadmarksqpcode($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $collcode = $_SESSION['collcode'];
    $degree = $aobj_context->mobj_data["degree"];
    $examno = $aobj_context->mobj_data["examno"];
    $element = $aobj_context->mobj_data["element"];

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

    if ($element == "theory") {
        $qry1 = "select distinct ifnull(s.fqpcode , '') as fqpcode, ifnull(s.FSUBNAME, '') as fsubname 
        from tdvs_copomarks t inner join subject s on s.fdegree = t.fdegree 
        and s.fexamno = t.fexamno and s.fqpcode = t.fsubcode 
        where t.FDEGREE = '{$degree}' and t.FEXAMNO = '{$examno}' 
        and ifnull(s.fqpcode,'') <> '' and t.fcollcode = '{$collcode}'
        {$cnd}";
    }else{
        $qry1 = "select distinct ifnull(s.fcsubcode , '') as fqpcode, concat(ifnull(FSUBNAME, ''),' - ',fssubname) as fsubname 
        from tdvs_copomarks t inner join subject s on s.fdegree = t.fdegree 
        and s.fexamno = t.fexamno 
        and s.fcsubcode = t.fsubcode
        where t.FDEGREE = '{$degree}' and t.FEXAMNO = '{$examno}' 
        and s.fretain = 'T'
        and t.fcollcode = '{$collcode}'
        {$cnd}";
    } 
  
    // var_dump($qry1);
    // die();
    $lob = $aobj_context->mobj_db->GetAll($qry1); 
  
    if($lob){
          echo $aobj_context->mobj_output->ToJSONEnvelope($lob,0,"success"); 
      }else{
          $arr['msg'] = 'Failed to load';
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
      }
  }

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

    $degree = $aobj_context->mobj_data["degree"];
    $examno = $aobj_context->mobj_data["examno"];
    $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'];

    $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>Reg. 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 fdegree = '{$degree}' and fexamno = '{$examno}'
    and fcollcode = '{$collcode}'
    and fsubcode = '{$qpcode}'";
  

    $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),valmaxmarks(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 SaveCopoMarkEntry($aobj_context)
{
    $degree = $aobj_context->mobj_data["deg"];
    $examno = $aobj_context->mobj_data["examno"];
    $qpcode = $aobj_context->mobj_data["qpcode"];
    $submarks = $aobj_context->mobj_data["submarks"];
    $collcode=$_SESSION['collcode'];
    $fsubarry = json_decode($submarks);

    $fviewopt = $_SESSION['fviewopt'];
    if($fviewopt == 'T')
    {
        $rdata='Only View Option Enabled';
        echo $aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure");
        return;	
    }

    $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 fdegree = '{$degree}'
            and fexamno = '{$examno}' and fsubcode = '{$qpcode}'
            and fcollcode = '{$collcode}'";
            
            $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;			
    }
   

}

?>