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


Current Path : /var/www/oasis/src_old/
Upload File :
Current File : /var/www/oasis/src_old/examAppChallan.php

<?php

function getExmAppData($aobj_context){
  $deg = $aobj_context->mobj_data["degree"];
  $exam = $aobj_context->mobj_data["exmno"];   
  $college_code = $_SESSION['collcode'];

  if($college_code == '')
  {
    $result="Please Login and try again";
    echo $aobj_context->mobj_output->ToJSONEnvelope($result, 1, "Failure");
    return;
  }


  $qry=" select * from collexam where fdegree = '{$deg}' and fcollcode = '{$college_code}' 
  and fexamno = '{$exam}'
  and DATE_FORMAT(NOW(),'%Y-%m-%d') 
  BETWEEN DATE_FORMAT(fadmfrom,'%Y-%m-%d') 
  AND DATE_FORMAT(fadmto,'%Y-%m-%d')";
  $student_exam_details = $aobj_context->mobj_db->GetRow($qry); 

  if(count($student_exam_details) <= 0)
  {
      $result="Admission Not Enabled";
      echo $aobj_context->mobj_output->ToJSONEnvelope($result, 1, "Failure");
      return;
      die();
  }

  $query= "select distinct c.fregno,s.fname, ifnull(d.fadmfee,0) as amount,if(ifnull(ac.fregno,'') = '','F','T') as applied,
  ac.fchallanno  
  from regcanddet c inner join student s on
  c.fcollcode = s.fcollcode and c.fdegree = s.fdegree and c.fregno = s.fregno 
  inner join degree d on c.fdegree = d.fdegree and c.fexamno = d.fexamno
  left join appchallandet ac on c.fregno = ac.fregno and c.fcollcode = ac.fcollcode 
  and c.fdegree = ac.fdegree
  where ifnull(c.fpassmth,'') = '' and c.fdegree = '{$deg}' and c.fexamno = '{$exam}' 
  and c.fcollcode = '{$college_code}'
  and c.fregno in (select distinct fregno from regcandsum where fdegree = '{$deg}' 
  and FFRESHEXAM = '{$exam}' and fcollcode = '{$college_code}' and ifnull(fadmallow,'F')= 'T')
  group by c.fregno";
  //var_dump($query);17ns0182
  $result=$aobj_context->mobj_db->GetAll($query);
  // var_dump($result);
  if($result){
    echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "Success");
    return;
  }else{
    $result="No data found";
    echo $aobj_context->mobj_output->ToJSONEnvelope($result, 1, "Failure");
    return;
  }
}

function saveAnsPrtChallan($aobj_context){

  $degree = $aobj_context->mobj_data["degree"];
  $exam = $aobj_context->mobj_data["exmno"]; 
  $studlen = $aobj_context->mobj_data["studlen"]; 
  $amount = $aobj_context->mobj_data["amount"]; 

  $studfeedet = $aobj_context->mobj_data["studfeedet"];   
  $studfeedet = json_decode($studfeedet,true);
  
  $college_code = $_SESSION['collcode'];

  if($college_code == '')
  {
    $result="Please Login and try again";
    echo $aobj_context->mobj_output->ToJSONEnvelope($result, 1, "Failure");
    return;
    die();
  }

  $qry=" select * from collexam where fdegree = '{$degree}' and fcollcode = '{$college_code}' 
  and fexamno = '{$exam}'
  and DATE_FORMAT(NOW(),'%Y-%m-%d') 
  BETWEEN DATE_FORMAT(fadmfrom,'%Y-%m-%d') 
  AND DATE_FORMAT(fadmto,'%Y-%m-%d')";
  $student_exam_details = $aobj_context->mobj_db->GetRow($qry); 

  if(count($student_exam_details) <= 0)
  {
      $result="Please Login and try again";
      echo $aobj_context->mobj_output->ToJSONEnvelope($result, 1, "Failure");
      return;
      die();
  }
  

  $query = "insert into appchallan(fcollcode,fdegree,fexamno,fappcnt,famount,fcreatedate) 
  values ('{$college_code}','{$degree}','{$exam}','{$studlen}','{$amount}',now())";
  
  $result=$aobj_context->mobj_db->Execute($query);
  $id =$aobj_context->mobj_db->Insert_ID();

  if($id)
  {
    $query = "select last_number from res_reval_code_generator where college_code = '{$college_code}' 
    and type='Candidate'";
    $result = $aobj_context->mobj_db->GetRow($query);
   
    if(!empty($result['last_number']))
		{			
			$next_number = $result['last_number'];
			$last_number = str_pad($next_number,4, "0", STR_PAD_LEFT);
		}
		else
		{	
			$next_number=0001;			
			$insert_into="insert into res_reval_code_generator(college_code,last_number,type)
			values
			(
			'{$college_code}',
			{$next_number},'Candidate'
			)";
			$lobj_insert_into = $aobj_context->mobj_db->Execute($insert_into);
			$last_number = str_pad($next_number,4, "0", STR_PAD_LEFT);		
    }
    
    $values = "";
    foreach($studfeedet as $value)
    {
      $last_number = str_pad($last_number,4, "0", STR_PAD_LEFT);
        $appno = '103'.$college_code.$last_number;	

        $values .= "('{$appno}', '{$college_code}','{$degree}','{$exam}','{$value[fregno]}','{$value[amount]}','{$id}'),";
        $last_number++;	
    }

    $values = rtrim($values, ',');

    $query = "insert into appchallandet values $values";
			
    $result = $aobj_context->mobj_db->Execute($query);

    $query1 = "update res_reval_code_generator set last_number = '{$last_number}'
    where college_code = '{$college_code}' and type='Candidate'";
  
    $result1 = $aobj_context->mobj_db->Execute($query1);

    if($result)
    {
      $query = "INSERT INTO  appcandsum 
      (APPNO, FDATE,FPAYMENTYPE,fchallanno,
      FDEGREE,FEXAMNO, FCOLLCODE, FREGNO, 
      FCATEGORY, FAPPEARA, FEXAMFEEA, 
      FRECPTNOA, 	FRECPTDATEA, FAPPEARB, 
      FEXAMFEEB, 	FRECPTNOB, 	FRECPTDATEB, 
      FAPPEARC, 	FEXAMFEEC, FRECPTNOC, 
      FRECPTDATEC, FAPPEARD, 	FEXAMFEED, 
      FRECPTNOD, 	FRECPTDATED,FAPPEARE, 
      FEXAMFEEE, 	FRECPTNOE, 	FRECPTDATEE, FAPPEARF, 
      FEXAMFEEF, 	FRECPTNOF, 	FRECPTDATEF, 	FAPPEARG, 
      FEXAMFEEG, 	FRECPTNOG, 	FRECPTDATEG, 	FAPPEARH, 
      FEXAMFEEH, 	FRECPTNOH, 	FRECPTDATEH, FAPPEARI, 
      FEXAMFEEI, 	FRECPTNOI,	FRECPTDATEI, 
      FAPPEARJ, FEXAMFEEJ, 	FRECPTNOJ, 
      FRECPTDATEJ, FRECPTNO, FRECPTDATE, 	FTOTALFEE, 
      FREMARKS, 	FYEAR, 	FEXAMTYPE,  FCNTRCODE, 	FGENDER,FFRESHEXAM)
      SELECT a.fappno,current_date(),'SBM','{$id}',
			c.FDEGREE,c.FEXAMNO, a.FCOLLCODE, a.FREGNO, 
			FCATEGORY,  FAPPEARA, FEXAMFEEA, 
			FRECPTNOA, 	FRECPTDATEA, FAPPEARB, 
			FEXAMFEEB, 	FRECPTNOB, 	FRECPTDATEB, 
			FAPPEARC, 	FEXAMFEEC, FRECPTNOC, 
			FRECPTDATEC, FAPPEARD, 	FEXAMFEED, 
			FRECPTNOD, 	FRECPTDATED,FAPPEARE, 
			FEXAMFEEE, 	FRECPTNOE, 	FRECPTDATEE, FAPPEARF, 
			FEXAMFEEF, 	FRECPTNOF, 	FRECPTDATEF, 	FAPPEARG, 
			FEXAMFEEG, 	FRECPTNOG, 	FRECPTDATEG, 	FAPPEARH, 
			FEXAMFEEH, 	FRECPTNOH, 	FRECPTDATEH, FAPPEARI, 
			FEXAMFEEI, 	FRECPTNOI,	FRECPTDATEI, 
			FAPPEARJ, FEXAMFEEJ, 	FRECPTNOJ, 
			FRECPTDATEJ, FRECPTNO, FRECPTDATE, 	a.famount, 
			FREMARKS, 	FYEAR, 	FEXAMTYPE, FCNTRCODE, 	FGENDER,FFRESHEXAM
			FROM regcandsum c inner join appchallandet a on 
			a.fdegree = c.fdegree and a.fcollcode = c.fcollcode
			and  a.fregno = c.fregno
			where  c.FDEGREE='{$degree}'
			AND c.FCOLLCODE='{$college_code}'			
      AND  a.fchallanno = '{$id}'";

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

      $query1 = "insert into appcanddet 
      (appno,fdegree,fexamno,fcollcode,fregno,fsubcode,finserted,fpresent, fyear, fexamtype)
      select a.fappno, c.fdegree,c.fexamno,c.fcollcode,c.fregno,c.fsubcode,c.finserted,'P', c.fyear, c.fexamtype 
      from regcanddet c inner join appchallandet a
      on c.fcollcode = a.fcollcode and c.fdegree = a.fdegree 
      and c.fregno = a.fregno
      where c.fdegree = '{$degree}' 
      and c.fcollcode = '{$college_code}'  
      and c.fexamno = '{$exam}'
      and ifnull(c.fpassmth,'') = ''
      and a.fchallanno = '{$id}'";
     
      $result1 = $aobj_context->mobj_db->Execute($query1);

      $query2 = "insert into appstudfee(appno,fdegree,fexamno,fcollcode,fregno,ffeecode,famount,flogname,flogdate)
      select fappno,fdegree,fexamno,fcollcode,fregno,'01 Exam Fee',famount,null,now() from appchallandet 
      where fchallanno = '{$id}' and fcollcode = '{$college_code}'";
      $result2 = $aobj_context->mobj_db->Execute($query2);

      if($result && $result1 && $result2 )
      {
        $data = $id;
        echo $aobj_context->mobj_output->ToJSONEnvelope($data, 0, "Success");
        return;
      }else
      {
        $result="Updation Failure";
        echo $aobj_context->mobj_output->ToJSONEnvelope($result, 1, "Failure");
        return;
      }

    }

  }

}

?>