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


Current Path : /var/www/html/pgadm/admin-src/
Upload File :
Current File : /var/www/html/pgadm/admin-src/viewpresealallot2.php

<?php
function viewpresealallot2($aobj_context)
{

    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

    $fdeptt = $aobj_context->mobj_data["fdepttt"];
    $collcode = $aobj_context->mobj_data["collcode"];
  

    // $query = "select * from entseatallot where fdegree = '{$fdeptt}' and fcollcode = '{$collcode}'";
    // $res =  $aobj_context->mobj_db->GetAll($query);

    // if($res){
    
    //   $arr['msg']="Students started paying. you cant change";
    //   echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failed");
    //   return;
    // }
   


    $query1 = "select round(ifnull(s.fentmarks,0)/2,2) as fent50, 
    round(ifnull(s.feffper,0)/2,2) as fdeg50, round((ifnull(s.feffper,0) + ifnull(s.fentmarks,0))/2,2) as ffinalper,
    s.ftotmax, s.fappno,s.fregno,s.fname,s.fhk,s.fcategory,s.fspcat,s.fentmarks,
    s.ftotsec,s.frank,s1.fallotquota,s1.fallotcoll,s1.fallotcatcode
    from entcandlist_coll s inner join entoptions o on s.fappno = o.fappno and s.fdegree = o.fdegree
    inner join entstudint b on s.fmobileno = b.fmobile
    left outer join entseatallot c on s.fappno = c.fappno 
    and s.fdegree = c.fdegree and s.fcollcode = c.fcollcode
    left join entcandlist_new s1 on 
    s.fappno = s1.fappno 
    and s.fdegree = s1.fdegree
    and s.fregno = s1.fregno 
    and s1.fround = '2'
    and s1.fallotcoll = o.fcollcode
    where s.fdegree = '{$fdeptt}'
    and o.fcollcode = '{$collcode}'
    and ifnull(c.fdegree,'') = ''
    and b.finterested = 'F'
    and ifnull(s.freject,'') <> 'T'
    order by s.forder, s.fcollcode, LPAD(s.frank,4,'0000'), s.ffinalper desc";
    //var_dump($query1);
    //die();

    // select a., b. from entcandlist_coll a 
    //  left outer join entseatallot c on a.fappno = c.fappno and a.fdegree = c.fdegree 
    //  and a.fcollcode = c.fcollcode where a.fdegree = 'MAKN' and c.fdegree is null 
    //  and b.finterested = 'F' order by a.forder, a.fcollcode, a.frank, a.ffinalper desc

     $result1 =  $aobj_context->mobj_db->GetAll($query1);

     $html = '<table border = "1" style = "text-align:center;border: 1px solid black;
     border-collapse: collapse;border-spacing: 2px;">
        <thead >
        <tr>
          <th style = "width:5%;text-align:center;"> Sl. No. </th>
          <th style = "width:5%;text-align:center;"> App. No. </th>
          <th style = "width:5%;text-align:center;"> Reg. No. </th>
          <th style = "width:10%;text-align:center;"> Name</th>
          <th style = "width:5%;text-align:center;"> HK </th>
          <th style = "width:5%;text-align:center;"> Applied Cat. </th>
          <th style = "width:5%;text-align:center;"> Special Quota </th>
          <th style = "width:5%;text-align:center;"> Uni. Marks </th>
          <th style = "width:5%;text-align:center;"> Ent. marks </th>
          <th style = "width:5%;text-align:center;"> Deg.(50%)  </th>
          <th style = "width:5%;text-align:center;"> Ent.(50%)  </th>
          <th style = "width:5%;text-align:center;"> Tot. % </th>
          <th style = "width:5%;text-align:center;"> Rank </th>
          <th style = "width:15%;text-align:center;"> Cat. </th>
          <th style = "width:15%;text-align:center;"> Quota </th>
          <th style = "width:5%;text-align:center;"> Action </th>
        </tr>
        </thead>
        <tbody>
              ';
    $i  =1;

    $cat = '<option value = "">--Select--</option>
    <option>GM</option>
    <option>CAT-I</option>
    <option>IIA</option>
    <option>IIB</option>
    <option>IIIA</option>
    <option>IIIB</option>
    <option>SC</option>
    <option>ST</option>
    <option>PH</option>
    <option value = "NSS">NSS/NCC/SPORTS</option>
    <option value = "EX" >EX-SERVICEMAN</option>
    ';

    $opt = '<option value = "">--Select--</option>
    <option>General Quota *</option>
    <option>371(J)</option>';

    foreach($result1 as $value){

      $regno = $value['fregno'];
      $fappno = $value['fappno'];

     
      $html .= "<tr>
      <td>$i</td>
      <td id='appno_$regno' style = 'padding:2px;'>".$value['fappno']."</td>
      <td style = 'padding:2px;'>".$value['fregno']."</td>
      <td style = 'text-align:left;padding:2px;'>".$value['fname']."</td>
      <td>".$value['fhk']."</td>
      <td>".$value['fcategory']."</td>
      <td>".$value['fspcat']."</td>
      <td>".$value['ftotsec']."/".$value['ftotmax']."</td>
      <td>".$value['fentmarks']."</td>
      <td>".$value['fdeg50']."</td>
      <td>".$value['fent50']."</td>      
      <td>".$value['ffinalper']."</td>
      <td>".$value['frank']."</td>
      <td><select id='catcode_$regno' class='form-control'>".$cat."</select></td>
      <td><select id='quta_$regno' class='form-control'>".$opt."</select></td>
      <td><button
      type='button'
      class='btn btn-primary waves-effect'
      onclick=\"savepresealallot2('{$regno}')\"
    >
      Save
    </button></td>
      </tr>";
      $i++;
    }

    $html .= '</tbody></table>';
 
  if($result1){
    
    $data['studdata'] = $result1;
    $data['html'] = $html;

    echo $aobj_context->mobj_output->TOJSONEnvelope($data,0,"success");
  }
  else{
    $arr['msg']="Failed to load";
    echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failed");
  }

}



function savepresealallot2($aobj_context)
{
  $appno = $aobj_context->mobj_data["appno"];
  $quta = $aobj_context->mobj_data["quta"];
  $catcode = $aobj_context->mobj_data["catcode"];
  $coll = $aobj_context->mobj_data["coll"];
  $regno = $aobj_context->mobj_data["regno"];
  $fdeptt = $aobj_context->mobj_data["fdepttt"];
  
  if($_SESSION['USERNAME'] == NULL || $_SESSION['USERNAME'] == '')
	{
		$arr = "Please login";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error"); 
		return;
	}

	$user = $_SESSION['USERNAME'];


$query = "select * from entcandlist_new where fappno = '{$appno}'
and  fregno = '{$regno}'
and fdegree = '{$fdeptt}'
and fallotcoll = '{$coll}'
and fround = '2'";
$rs1 = $aobj_context->mobj_db->GetRow($query);

if($catcode =='' && $quta == ''){
  $qyery1 = "delete from entcandlist_new
  where  fappno = '{$appno}'
  and  fregno = '{$regno}'
  and fdegree = '{$fdeptt}'
  and fallotcoll = '{$coll}'
  and fround = '2'";
  $rst2 = $aobj_context->mobj_db->Execute($qyery1);
  //var_dump($qyery1);
}
else if($rs1)
{
  $qyery1 = "update entcandlist_new set fallotquota = '{$quta}', fallotcoll = '{$coll}', 
  fallotcatcode = '{$catcode}',
  fmoduser = '{$user}', 
  fmoddate = now(),
  fround = '2'
  where  fappno = '{$appno}'
  and  fregno = '{$regno}'
  and fdegree = '{$fdeptt}'
  and fallotcoll = '{$coll}'
  and fround = '2'";
  $rst2 = $aobj_context->mobj_db->Execute($qyery1);
}
else
{

  $insert = "insert into entcandlist_new(fdegree, fappno, fregno, fname, fcategory, fspcat, funiv, fhk, funivstud1, fqdegree, fqregno1, famo, fbmo, fcmo, fdmo, femo, ffmo, famm, fbmm, fcmm, fdmm, femm, ffmm, fdegree1, fappno1, fqregno, funivstud, fregno1, fnoatta, fnoattb, fnoattc, fnoattd, fnoatte, fnoattf, fentmarks, fmaxmarksa, fmarksa, fmaxmarksb, fmarksb, fmaxmarksc, fmarksc, fmaxmarksd, fmarksd, fmaxmarkse, fmarkse, fmaxmarksf, fmarksf, ftotsec, ftotmax, fototsec, fototmax, fnoatt, fper, foper, feffper, fper3, fper2, fper1, frank, fallotquota, fallotcoll, fallotcatcode, fmoduser, fmoddate, freject,fround)
  select  fdegree, fappno, fregno, fname, fcategory, fspcat, funiv, fhk, funivstud1, fqdegree, fqregno1, famo, fbmo, fcmo, fdmo, femo, ffmo, famm, fbmm, fcmm, fdmm, femm, ffmm, fdegree1, fappno1, fqregno, funivstud, fregno1, fnoatta, fnoattb, fnoattc, fnoattd, fnoatte, fnoattf, fentmarks, fmaxmarksa, fmarksa, fmaxmarksb, fmarksb, fmaxmarksc, fmarksc, fmaxmarksd, fmarksd, fmaxmarkse, fmarkse, fmaxmarksf, fmarksf, ftotsec, ftotmax, fototsec, fototmax, fnoatt, fper, foper, feffper, fper3, fper2, 
  fper1, frank, '{$quta}', '{$coll}', '{$catcode}', '{$user}', now(), freject,'2' 
  from entcandlist_coll
  where fappno = '{$appno}'
  and  fregno = '{$regno}'
  and fcollcode = '{$coll}' 
  and fdegree = '{$fdeptt}'";

  //var_dump($insert);
  $rst2 = $aobj_context->mobj_db->Execute($insert);
}

 if($rst2)
 {	
   $success_msg= "Updated Successfully";
   echo $aobj_context->mobj_output->ToJSONEnvelope($success_msg,0,"success"); 
 }	
 else
 {	
   $error_msg = "Some Failure as occured";
   echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"error"); 
 }


}
?>