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


Current Path : /proc/thread-self/root/var/www/misc/public_html/live100/src/
Upload File :
Current File : //proc/thread-self/root/var/www/misc/public_html/live100/src/revaluation.php

<?php
function GetNextNumber($aobj_context)
{
session_start();
$college_code = $_SESSION['collcode'];
		
			$get_prefix_running_number = "select last_number from reval_code_generator
							where college_code = '{$college_code}'  ";		
			$lobj_get_prefix_running_number = $aobj_context->mobj_db->GetRow($get_prefix_running_number); 
 	
 			if(!empty($lobj_get_prefix_running_number[last_number]))
			{			
			$next_number = $lobj_get_prefix_running_number[last_number]+1;
			$last_number = str_pad($next_number,4, "0", STR_PAD_LEFT);
				 
				$update_code_generator = "update reval_code_generator set last_number = '{$next_number}'
											    where college_code = '{$college_code}' ";
				$lobj_update_code_generator = $aobj_context->mobj_db->Execute($update_code_generator);
				 
			}
			else
			{	
				$next_number=0001;			
				$insert_into="insert into 
							reval_code_generator(college_code,last_number)
							values
							(
							'{$college_code}',
							{$next_number}
							)";
				$lobj_insert_into = $aobj_context->mobj_db->Execute($insert_into);
			$last_number = str_pad($next_number,4, "0", STR_PAD_LEFT);		
			}
			return $college_code.$last_number;	
}	
		
function DisplayRevalutionDetails($aobj_context)
{ 
session_start();
$college_code = $_SESSION['collcode'];
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$revalution_degree_code=($aobj_context->mobj_data["revalution_degree_code"]);
$revalution_regno=($aobj_context->mobj_data["revalution_regno"]);
$get_reg_no_exists="select count(*) as reg_cnt from mresult where
			FDEGREE='{$revalution_degree_code}' and  FREGNO='{$revalution_regno}'";
  $lobj_get_reg_no_exists = $aobj_context->mobj_db->GetRow($get_reg_no_exists);	
 
	if($lobj_get_reg_no_exists[reg_cnt]>0)
	{
 
		$get_data="select  date_format(current_date(),'%d/%m/%Y') as curr_date, s.FDEGREE,FCSUBCODE ,s.FSUBNAME as FSUBNAME,
					mr.FFEE,mr.FPASS,st.FNAME,
					mr.is_selected as is_selected,mr.internal_code from
			  mresult mr  left join  subject s on mr.FSUBCODE=s.FCSUBCODE
			  left join student st on st.FREGNO=mr.FREGNO
				where mr.FDEGREE='{$revalution_degree_code}' and mr.FREGNO='{$revalution_regno}' 
			 and mr.FCOLLCODE={$college_code}   and  s.FDEGREE=mr.FDEGREE and s.FEXAMNO=mr.FEXAMNO 
			 and current_date()<= ifnull(FLASTDATE,'0000-00-00')
				group by FCSUBCODE";
  $lobj_get_data = $aobj_context->mobj_db->GetAll($get_data);
  
	$str_reval="";
	$str_reval.="<table style='padding:3px 4px 3px 3px;' class='tr_ventor_row' id='reval_table_data' width='100%' border='0' cellspacing='0' cellpadding='0'>";
	$str_reval.="<th align='left' colspan='6' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:24px;'>Revaluation</th>";
	$str_reval.="<tr class='ui-state-default ui-jqgrid-hdiv'>";
	$str_reval.="<td align='center' style=' font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sub.Code</td>";
	$str_reval.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Subject Name</td>";
	$str_reval.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Result?</td>";
	$str_reval.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Fee</td>";
	$str_reval.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'> Is Selected</td>";
	$str_reval.="</tr>";
    $sl_no=0;
	$total_val=0;
	//echo $get_data; 
	$name=$lobj_get_data[0][FNAME];
	$curr_date=$lobj_get_data[0][curr_date];
	foreach($lobj_get_data as $k=>$val)	 
	{
       //print_r($lobj_get_data); die();	

		$is_selected_checked='';
		$FCSUBCODE =$val[FCSUBCODE];	
		$FPASS =$val[FPASS];	
		$FFEE =$val[FFEE];	
		$internal_code =$val[internal_code];
		$FSUBNAME =$val[FSUBNAME];
		$is_selected =$val[is_selected];	   
		if($val[is_selected]==1)
		{
		$is_selected_checked='checked'; 
		$total_val+=$FFEE;
	    }
		$str_reval.="<tr class='ui-widget-content jqgrow'>";		
		$str_reval.="<td class='tbl_row_new' style='text-align:center; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;  ' id=fccode_{$FCSUBCODE}>{$FCSUBCODE}</td>";
		$str_reval.="<td class='tbl_row_new' style='border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;   ' id=fsname_{$FCSUBCODE}>{$FSUBNAME}</td>";
		$str_reval.="<td class='tbl_row_new' style='border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;  ' id=fsname_{$FCSUBCODE}>{$FPASS}</td>";
		$str_reval.="<td class='tbl_row_new' style='border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;   ' id=fee_{$FCSUBCODE}>{$FFEE}</td>";
		$str_reval.="<td class='tbl_row_new' style='text-align:center; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;   ' id=is_sele_{$FCSUBCODE}>";
		$str_reval.="<input id='column_view_{$FCSUBCODE}'  onclick='CalculateRevaluationTotFee();' value ='' {$is_selected_checked} type='checkbox' style='width: 20px;'></td>";
		$str_reval.="</tr>";
		$sl_no++;
	 }
		$str_reval.="</table>";
		$arr['reval_html']=$str_reval;
		$arr['total_val']=$total_val;
		$arr['name']=$name;
		$arr['curr_date']=$curr_date;
		//$arr['reval_data']=$lobj_get_data;
		if(!empty($lobj_get_data))
		{
		$arr['reval_html']=$str_reval;
		$arr['total_val']=$total_val;
		$arr['name']=$name;
		$arr['curr_date']=$curr_date;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 		
		}
		else
		{
		$data="You Cannot Enter the Revaluation Details";
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"success"); 
		}
	}
	else
	{
	$data="Invalid Reg No";
	echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"success"); 
	}	
}

function SaveRevalution($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	include_once("/JSON.php"); 
	$json = new Services_JSON();
	
	$reg_no=($aobj_context->mobj_data["reg_no"]);
	$revalution_corr_type=($aobj_context->mobj_data["revalution_corr_type"]);
	$revalution_fee_total=($aobj_context->mobj_data["revalution_fee_total"]);
	$revalution_date=($aobj_context->mobj_data["revalution_date"]);
	$revalution_dd_date=($aobj_context->mobj_data["revalution_dd_date"]);
	$revalution_dd_no=($aobj_context->mobj_data["revalution_dd_no"]);
	$revalution_receipt_no=($aobj_context->mobj_data["revalution_receipt_no"]);
	$revalution_bank=($aobj_context->mobj_data["revalution_bank"]);
	$revalution_place=($aobj_context->mobj_data["revalution_place"]);	
	 
	$lstr_param_reval = stripslashes($aobj_context->mobj_data["myJSONText"]);
	$mobj_json_reval_data = $json->decode($lstr_param_reval);
	$reval_arr_data = get_object_vars($mobj_json_reval_data);
	$int_codes_arr=array();

		for($k=0;$k<count($reval_arr_data);$k++)
		{	
		array_push($int_codes_arr,"'".$reval_arr_data[$k]->FSUBCODE."'");
			$insert_reval="update mresult set
							 FTOTFEE='{$revalution_fee_total}',
							 FAPPDATE='{$revalution_date}',
							 FDDDATE='{$revalution_dd_date}',
							 FDDNO='{$revalution_dd_no}',
							 FRECNO='{$revalution_receipt_no}',
							 FBANK='{$revalution_bank}',
							 FPLACE='{$revalution_place}',		
							is_selected='{$reval_arr_data[$k]->checked}' 	
							 
							 where  FREGNO='{$reg_no}'		
							 and 	  FSUBCODE='{$reval_arr_data[$k]->FSUBCODE}'	
							";
			$lobj_insert_reval = $aobj_context->mobj_db->Execute($insert_reval);
		  
			
		}
		$int_codes=implode(",",$int_codes_arr);
		$select_app_nos="select GROUP_CONCAT(ifnull(APPNO,'')  SEPARATOR '')  as app_no from mresult
						where FSUBCODE in ({$int_codes}) and  FREGNO='{$reg_no}'";
		$lobj_select_app_nos = $aobj_context->mobj_db->GetRow($select_app_nos);
		//echo $select_app_nos;
		$app_nos=trim($lobj_select_app_nos[app_no]);	
		if(empty($app_nos))
		{
		$app_number=GetNextNumber($aobj_context);
		$update=" update mresult set APPNO='{$app_number}' 
				where  FSUBCODE in ({$int_codes}) and  FREGNO='{$reg_no}'";
		$lobj_update = $aobj_context->mobj_db->Execute($update);
		 $arr="Done! Application No: {$app_number}";
		
		} 
		else
		$arr='Updated Successfully';
			if($lobj_insert_reval) 
					{
							
				             echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
							 return;
					}	
			        else
					{
							$arr='Updation Failed';
							echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
						   return;
					}
		
	

}

?>