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


Current Path : /var/www/html/kswu/orms/src/
Upload File :
Current File : /var/www/html/kswu/orms/src/research_det2.php

<?php

function replaceChars($name)
{
	$spl_char = array("*","/","~","!","@","#","$","%","^","&",":",";","?","/","\\","_","-","'"," ","");
	$link_name = strtolower(str_replace($spl_char,"_",$name));
	return str_ireplace("__","_",$link_name);
}

function saveresearchcat($aobj_context)
{
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
	include_once("/JSON.php");
	

	$json = new Services_JSON();
	$appno = stripslashes($aobj_context->mobj_data["appno"]);
	$fieldarrvalue = stripslashes($aobj_context->mobj_data["fieldarrvalue"]);
	$persnaldet = $json->decode($fieldarrvalue);
	$persarr = get_object_vars($persnaldet);
	

	$query = "delete from tleact
	where fuserid = {$userid} and fappno =  '{$appno}'";
	$result = $aobj_context->mobj_db->Execute($query);
	 
	$query1 = "insert into tleact(fuserid,fappno,factivity, fmaxscore, fspent,fselfscore,fenttype)
	values('{$userid}','{$appno}','a', '{$persarr['T501']}', '{$persarr['T502']}', '{$persarr['T503']}','cat1'),
	('{$userid}','{$appno}','b', '{$persarr['T504']}', '{$persarr['T505']}', '{$persarr['T506']}','cat1'),
	('{$userid}','{$appno}','c', '{$persarr['T507']}', '{$persarr['T508']}', '{$persarr['T509']}','cat1'),
	('{$userid}','{$appno}','a', '{$persarr['T513']}', '{$persarr['T514']}', '{$persarr['T515']}','cat2'),
	('{$userid}','{$appno}','b', '{$persarr['T516']}', '{$persarr['T517']}', '{$persarr['T518']}','cat2'),
	('{$userid}','{$appno}','c', '{$persarr['T519']}', '{$persarr['T520']}', '{$persarr['T521']}','cat2')";
	//var_dump($query1);
	$results = $aobj_context->mobj_db->Execute($query1);
	
	
	if($results)
	{	
		$arr = "Updated Successfully";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
	}	
	else
	{	
		$arr = "Some Failure as occured";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error"); 
	}
}


function saveresearchassociate($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
	session_start();
	$userid = $_SESSION['userid'];
	$fpublication = trim($aobj_context->mobj_data["fpublication"]);
	$ftitle = trim($aobj_context->mobj_data["ftitle"]);
	$fjournalname = trim($aobj_context->mobj_data["fjournalname"]);
	$fjournalno = trim($aobj_context->mobj_data["fjournalno"]);
	$fyear = trim($aobj_context->mobj_data["fyear"]);
	$fvolno = trim($aobj_context->mobj_data["fvolno"]);
	$fpageno = trim($aobj_context->mobj_data["fpageno"]);
	$fissnno = trim($aobj_context->mobj_data["fissnno"]);
	$fimpfact = trim($aobj_context->mobj_data["impfact"]);
	$fauthor = trim($aobj_context->mobj_data["fauthor"]);
	$fpoints = trim($aobj_context->mobj_data["fpoints"]); 
	$fenclosureno = trim($aobj_context->mobj_data["fenclosureno"]); 
	$associate = trim($aobj_context->mobj_data["associate"]); 
	$appno = trim($aobj_context->mobj_data["appno"]);

	if($associate == 'I')
	{
		$query = "insert into researchexp(fuserid,fappno,fpublication,ftitle,fjournalname,fyear,fvolno,fpageno,fissnno,fjournalno,fimpfact,fauthor,fpoints,fenclosureno,fenttype) 
				   values('{$userid}','{$appno}','{$fpublication}','{$ftitle}','{$fjournalname}','{$fyear}','{$fvolno}','{$fpageno}'
				   ,'{$fissnno}','{$fjournalno}','{$fimpfact}','{$fauthor}','{$fpoints}','{$fenclosureno}','rcphd')";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	else
	{
		$query = "update researchexp set fpublication = '{$fpublication}',ftitle = '{$ftitle}',fjournalno = '{$fjournalno}',
			fjournalname = '{$fjournalname}',fyear = '{$fyear}',fvolno ='{$fvolno}',
			fpageno='{$fpageno}',fissnno = '{$fissnno}',fimpfact = '{$fimpfact}',
			fauthor = '{$fauthor}',fpoints = '{$fpoints}',fenclosureno = '{$fenclosureno}'
			where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$associate}'";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	
	if($results)
	{
		$query = "select fslno,fpublication,r1.freasonname as fpublicationname, ftitle,fjournalname,fyear,fjournalno,
				 fvolno,fpageno,fissnno,frefereed,r2.freasonname as ffauthorname, fauthor,fpoints,fimpfact,fenclosureno
				from researchexp 
				left join reason r1 on researchexp.fpublication = r1.freasoncode
				left join reason r2 on researchexp.fauthor = r2.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcphd'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='research21_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[fpublication]}' id = '{$i}HRC1'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fpublicationname]}' id = '{$i}RC1'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC2' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC3' value = '{$value[fjournalname]}' />";
			$table.="</td>"; 
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC4' value = '{$value[fyear]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC5' value = '{$value[fvolno]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC6' value = '{$value[fpageno]}'  /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC7'  value = '{$value[fissnno]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC81'  value = '{$value[fjournalno]}' /></td>"; 
			$table.="<td><input type = 'hidden' id = '{$i}HRC8' value = '{$value[fauthor]}' ><input type='text'   style='width:90%;' disabled id = '{$i}RC8' value = '{$value[ffauthorname]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC9' value = '{$value[fimpfact]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC10' value = '{$value[fpoints]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC70' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}

		
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
		
	}	
}

function saveresearchassociate2($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
	session_start();
	$userid = $_SESSION['userid'];
	$fpublication = trim($aobj_context->mobj_data["fpublication"]);
	$ftitle = trim($aobj_context->mobj_data["ftitle"]);
	$fjournalname = trim($aobj_context->mobj_data["fjournalname"]);
	$fyear = trim($aobj_context->mobj_data["fyear"]);
	$fvolno = trim($aobj_context->mobj_data["fvolno"]);
	$fpageno = trim($aobj_context->mobj_data["fpageno"]);
	$fissnno = trim($aobj_context->mobj_data["fissnno"]);
	 
	$fimpfact = trim($aobj_context->mobj_data["impfact"]);
	$fauthor = trim($aobj_context->mobj_data["fauthor"]);
	$fenclosureno = trim($aobj_context->mobj_data["fenclosureno"]); 
	$associate = trim($aobj_context->mobj_data["associate"]); 
	$appno = trim($aobj_context->mobj_data["appno"]);

	if($associate == 'I')
	{
		$query = "insert into researchexp(fuserid,fappno,fpublication,ftitle,fjournalname,fyear,fvolno,fpageno,fissnno,fimpfact,fauthor,fenclosureno,fenttype) 
				   values('{$userid}','{$appno}','{$fpublication}','{$ftitle}','{$fjournalname}','{$fyear}','{$fvolno}','{$fpageno}'
				   ,'{$fissnno}','{$fimpfact}','{$fauthor}','{$fenclosureno}','rcoth')";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	else
	{
		$query = "update researchexp set fpublication = '{$fpublication}',ftitle = '{$ftitle}',
			fjournalname = '{$fjournalname}',fyear = '{$fyear}',fvolno ='{$fvolno}',
			fpageno='{$fpageno}',fissnno = '{$fissnno}',fimpfact = '{$fimpfact}',
			fauthor = '{$fauthor}',fenclosureno = '{$fenclosureno}'
			where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$associate}'";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	
	if($results)
	{
		$query = "select fslno,fpublication,r1.freasonname as fpublicationname, ftitle,fjournalname,fyear,fjournalno,
				 fvolno,fpageno,fissnno,frefereed,r2.freasonname as ffauthorname, fauthor,fpoints,fimpfact,fenclosureno
				from researchexp 
				left join reason r1 on researchexp.fpublication = r1.freasoncode
				left join reason r2 on researchexp.fauthor = r2.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcoth'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='research22_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[fpublication]}' id = '{$i}HRC11'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fpublicationname]}' id = '{$i}RC11'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC12' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC13' value = '{$value[fjournalname]}' />";
			$table.="</td>"; 
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC14' value = '{$value[fyear]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC15' value = '{$value[fvolno]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC16' value = '{$value[fpageno]}'  /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC17'  value = '{$value[fissnno]}' /></td>";
			$table.="<td><input type = 'hidden' id = '{$i}HRC18' value = '{$value[fauthor]}' ><input type='text'   style='width:90%;' disabled id = '{$i}RC18' value = '{$value[ffauthorname]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC19' value = '{$value[fimpfact]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC71' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate2(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate2(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
	}
		
}

function saveresearchassociate3($aobj_context)
{
	
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$fpublication = trim($aobj_context->mobj_data["fpublication"]);
	$ftitle = trim($aobj_context->mobj_data["ftitle"]);
	$fjournalname = trim($aobj_context->mobj_data["fjournalname"]);
	$fyear = trim($aobj_context->mobj_data["fyear"]);
	$fenclosureno = trim($aobj_context->mobj_data["fenclosureno"]);
	$fpageno = trim($aobj_context->mobj_data["fpageno"]);
	$fissnno = trim($aobj_context->mobj_data["fissnno"]);
	//$frefereed = trim($aobj_context->mobj_data["frefereed"]); 
	$fautaddrs = trim($aobj_context->mobj_data["fautaddrs"]);
	$fauthor = trim($aobj_context->mobj_data["fauthor"]);
	$fpoints = trim($aobj_context->mobj_data["fpoints"]); 
	$RA1 = trim($aobj_context->mobj_data["RA1"]); 
	$appno = trim($aobj_context->mobj_data["appno"]);

	if($RA1 == 'I')
	{
		$query = "insert into researchexp(fuserid,fappno,fpublication,ftitle,fjournalname,fyear,flevel,fpageno,fissnno,frefereed,fautaddrs,fauthor,fpoints,fenclosureno,fenttype) 
				   values('{$userid}','{$appno}','{$fpublication}','{$ftitle}','{$fjournalname}','{$fyear}','{$flevel}','{$fpageno}'
				   ,'{$fissnno}','{$frefereed}','{$fautaddrs}','{$fauthor}','{$fpoints}','{$fenclosureno}','rcotj')";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	else
	{
		$query = "update researchexp set fpublication = '{$fpublication}',ftitle = '{$ftitle}',
			fjournalname = '{$fjournalname}',fyear = '{$fyear}',flevel ='{$flevel}',
			fpageno='{$fpageno}',fissnno = '{$fissnno}',fautaddrs = '{$fautaddrs}',
			fauthor = '{$fauthor}',fpoints = '{$fpoints}',frefereed = '{$frefereed}',fenclosureno = '{$fenclosureno}'
			where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$RA1}'";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	
	if($results)
	{
		$query = "select fslno,fpublication,r1.freasonname as fpublicationname, ftitle,fjournalname,fyear,flevel,r3.freasonname as flevelname,
				 fvolno,fpageno,fissnno,frefereed,r2.freasonname as ffauthorname, fauthor,fpoints,fimpfact,fautaddrs,fenclosureno
				from researchexp 
				left join reason r1 on researchexp.fpublication = r1.freasoncode
				left join reason r2 on researchexp.fauthor = r2.freasoncode
				left join reason r3 on researchexp.flevel = r3.freasoncode 
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcotj'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid23_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[fpublication]}' id = '{$i}HRC20'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fpublicationname]}' id = '{$i}RC20'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC21' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC22' value = '{$value[fjournalname]}' />";
			$table.="</td>"; 
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC23' value = '{$value[fyear]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC24' value = '{$value[fpageno]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC25' value = '{$value[fissnno]}'  /></td>";
			//$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RA26'  value = '{$value[frefereed]}' /></td>";
			//$table.="<td><input type = 'hidden' id = '{$i}HRA27' value = '{$value[flevel]}' ><input type='text'   style='width:90%;' disabled id = '{$i}RA27'  value = '{$value[flevelname]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC28'  value = '{$value[fautaddrs]}' /></td>";
			$table.="<td><input type = 'hidden' id = '{$i}HRC29' value = '{$value[fauthor]}' ><input type='text'   style='width:90%;' disabled id = '{$i}RC29' value = '{$value[ffauthorname]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC30' value = '{$value[fpoints]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC72' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate3(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate3(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}

		
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}else
	{
		$query = "select fslno,fpublication,r1.freasonname as fpublicationname, ftitle,fjournalname,fyear,flevel,r3.freasonname as flevelname,
				 fvolno,fpageno,fissnno,frefereed,r2.freasonname as ffauthorname, fauthor,fpoints,fimpfact,fautaddrs,fenclosureno
				from researchexp 
				left join reason r1 on researchexp.fpublication = r1.freasoncode
				left join reason r2 on researchexp.fauthor = r2.freasoncode
				left join reason r3 on researchexp.flevel = r3.freasoncode 
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcotj'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid23_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[fpublication]}' id = '{$i}HRC20'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fpublicationname]}' id = '{$i}RC20'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC21' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC22' value = '{$value[fjournalname]}' />";
			$table.="</td>"; 
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC23' value = '{$value[fyear]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC24' value = '{$value[fpageno]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC25' value = '{$value[fissnno]}'  /></td>";
			//$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RA26'  value = '{$value[frefereed]}' /></td>";
			//$table.="<td><input type = 'hidden' id = '{$i}HRA27' value = '{$value[flevel]}' ><input type='text'   style='width:90%;' disabled id = '{$i}RA27'  value = '{$value[flevelname]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC28'  value = '{$value[fautaddrs]}' /></td>";
			$table.="<td><input type = 'hidden' id = '{$i}HRC29' value = '{$value[fauthor]}' ><input type='text'   style='width:90%;' disabled id = '{$i}RC29' value = '{$value[ffauthorname]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC30' value = '{$value[fpoints]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC72' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate3(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate3(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}

		
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
	}
		
}


function loadresearchassoprodetails($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
	session_start();
	$userid = $_SESSION['userid'];
	$appno = stripslashes($aobj_context->mobj_data["appno"]);
	$query1 = "SELECT * FROM tleact 
		where fuserid = '{$userid}' and fappno = '{$appno}' order by fenttype,factivity";
	$result = $aobj_context->mobj_db->GetAll($query1);
	//var_dump($query1);
	
	$query13 = "SELECT sum(fselfscore) as fselfscore FROM tleact 
		where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'cat1' order by fenttype,factivity";
	
	$result13 = $aobj_context->mobj_db->GetRow($query13);
	
	$query14 = "SELECT sum(fselfscore) as fselfscore FROM tleact 
		where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'cat2' order by fenttype,factivity";
	$result14 = $aobj_context->mobj_db->GetRow($query14);
	
	
		$query = "select fslno,fpublication,r1.freasonname as fpublicationname, ftitle,fjournalname,fyear,fjournalno,
				 fvolno,fpageno,fissnno,frefereed,r2.freasonname as ffauthorname, fauthor,fpoints,fimpfact,fenclosureno
				from researchexp 
				left join reason r1 on researchexp.fpublication = r1.freasoncode
				left join reason r2 on researchexp.fauthor = r2.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcphd'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='research21_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[fpublication]}' id = '{$i}HRC1'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fpublicationname]}' id = '{$i}RC1'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC2' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC3' value = '{$value[fjournalname]}' />";
			$table.="</td>"; 
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC4' value = '{$value[fyear]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC5' value = '{$value[fvolno]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC6' value = '{$value[fpageno]}'  /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC7'  value = '{$value[fissnno]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC81'  value = '{$value[fjournalno]}' /></td>"; 
			$table.="<td><input type = 'hidden' id = '{$i}HRC8' value = '{$value[fauthor]}' ><input type='text'   style='width:90%;' disabled id = '{$i}RC8' value = '{$value[ffauthorname]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC9' value = '{$value[fimpfact]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC10' value = '{$value[fpoints]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC70' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}

		$query = "select fslno,fpublication,r1.freasonname as fpublicationname, ftitle,fjournalname,fyear,
				 fvolno,fpageno,fissnno,frefereed,r2.freasonname as ffauthorname, fauthor,fpoints,fimpfact,fenclosureno
				from researchexp 
				left join reason r1 on researchexp.fpublication = r1.freasoncode
				left join reason r2 on researchexp.fauthor = r2.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcoth'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table2 ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table2.="<tr style = 'width:90%'>";  
			$table2.="<td>";
			$table2.="<input type = 'hidden'  value = '{$value[fslno]}' id='research22_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[fpublication]}' id = '{$i}HRC11'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fpublicationname]}' id = '{$i}RC11'  name='fulltimeexp'>";
			$table2.="</td>"; 
			$table2.="<td>";
			$table2.="<input type='text' style='width:90%;' disabled id = '{$i}RC12' value = '{$value[ftitle]}'/>";
			$table2.="</td>"; 
			$table2.="<td>";
			$table2.="<input type='text'   style='width:90%;' disabled id = '{$i}RC13' value = '{$value[fjournalname]}' />";
			$table2.="</td>"; 
			$table2.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC14' value = '{$value[fyear]}'></td>";
			$table2.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC15' value = '{$value[fvolno]}' /></td>";
			$table2.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC16' value = '{$value[fpageno]}'  /></td>";
			$table2.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC17'  value = '{$value[fissnno]}' /></td>";
			$table2.="<td><input type = 'hidden' id = '{$i}HRC18' value = '{$value[fauthor]}' ><input type='text'   style='width:90%;' disabled id = '{$i}RC18' value = '{$value[ffauthorname]}' /></td>";
			$table2.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC19' value = '{$value[fimpfact]}' /></td>";
			$table2.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC71' value = '{$value[fenclosureno]}' /></td>";
			$table2.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate2(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate2(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table2.="</tr>";
			$i++;
		}
		
		
		$query = "select fslno,fpublication,r1.freasonname as fpublicationname, ftitle,fjournalname,fyear,flevel,r3.freasonname as flevelname,
				 fvolno,fpageno,fissnno,frefereed,r2.freasonname as ffauthorname, fauthor,fpoints,fimpfact,fautaddrs,fenclosureno
				from researchexp 
				left join reason r1 on researchexp.fpublication = r1.freasoncode
				left join reason r2 on researchexp.fauthor = r2.freasoncode
				left join reason r3 on researchexp.flevel = r3.freasoncode 
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcotj'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table3 ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table3.="<tr style = 'width:90%'>";  
			$table3.="<td>";
			$table3.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid23_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[fpublication]}' id = '{$i}HRC20'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fpublicationname]}' id = '{$i}RC20'  name='fulltimeexp'>";
			$table3.="</td>"; 
			$table3.="<td>";
			$table3.="<input type='text' style='width:90%;' disabled id = '{$i}RC21' value = '{$value[ftitle]}'/>";
			$table3.="</td>"; 
			$table3.="<td>";
			$table3.="<input type='text'   style='width:90%;' disabled id = '{$i}RC22' value = '{$value[fjournalname]}' />";
			$table3.="</td>"; 
			$table3.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC23' value = '{$value[fyear]}'></td>";
			$table3.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC24' value = '{$value[fpageno]}' /></td>";
			$table3.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC25' value = '{$value[fissnno]}'  /></td>";
			//$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RA26'  value = '{$value[frefereed]}' /></td>";
			//$table.="<td><input type = 'hidden' id = '{$i}HRA27' value = '{$value[flevel]}' ><input type='text'   style='width:90%;' disabled id = '{$i}RA27'  value = '{$value[flevelname]}' /></td>";
			$table3.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC28'  value = '{$value[fautaddrs]}' /></td>";
			$table3.="<td><input type = 'hidden' id = '{$i}HRC29' value = '{$value[fauthor]}' ><input type='text'   style='width:90%;' disabled id = '{$i}RC29' value = '{$value[ffauthorname]}' /></td>";
			$table3.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC30' value = '{$value[fpoints]}' /></td>";
			$table3.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC72' value = '{$value[fenclosureno]}' /></td>";
			$table3.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate3(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate3(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table3.="</tr>";
			$i++;
		}
		
		$query = "select fslno,ffaculty,r1.freasonname as ffacultyname, ftitle,fagency,fperiod,famount,fpoints,fenclosureno,fenttype
				from rcprojct 
				left join reason r1 on rcprojct.ffaculty = r1.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcspon'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table4 ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table4.="<tr style = 'width:90%'>";  
			$table4.="<td>";
			$table4.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid24_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[ffaculty]}' id = '{$i}HRC31'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[ffacultyname]}' id = '{$i}RC31'  name='fulltimeexp'>";
			$table4.="</td>"; 
			$table4.="<td>";
			$table4.="<input type='text' style='width:90%;' disabled id = '{$i}RC32' value = '{$value[ftitle]}'/>";
			$table4.="</td>"; 
			$table4.="<td>";
			$table4.="<input type='text'   style='width:90%;' disabled id = '{$i}RC33' value = '{$value[fagency]}' />";
			$table4.="</td>"; 
			$table4.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC34' value = '{$value[fperiod]}'></td>";
			$table4.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC35' value = '{$value[famount]}' /></td>";
			$table4.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC36' value = '{$value[fpoints]}'  /></td>";
			$table4.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC73' value = '{$value[fenclosureno]}' /></td>";
			$table4.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate4(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate4(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table4.="</tr>";
			$i++;
		}
		$query = "select fslno,ffaculty,r1.freasonname as ffacultyname, ftitle,fagency,fperiod,famount,fpoints,fenclosureno,fenttype
				from rcprojct 
				left join reason r1 on rcprojct.ffaculty = r1.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rccons'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table5 ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table5.="<tr style = 'width:90%'>";  
			$table5.="<td>";
			$table5.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid25_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[ffaculty]}' id = '{$i}HRC37'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[ffacultyname]}' id = '{$i}RC37'  name='fulltimeexp'>";
			$table5.="</td>"; 
			$table5.="<td>";
			$table5.="<input type='text' style='width:90%;' disabled id = '{$i}RC38' value = '{$value[ftitle]}'/>";
			$table5.="</td>"; 
			$table5.="<td>";
			$table5.="<input type='text'   style='width:90%;' disabled id = '{$i}RC39' value = '{$value[fagency]}' />";
			$table5.="</td>"; 
			$table5.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC40' value = '{$value[fperiod]}'></td>";
			$table5.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC41' value = '{$value[famount]}' /></td>";
			$table5.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC42' value = '{$value[fpoints]}'  /></td>";
			$table5.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC74' value = '{$value[fenclosureno]}' /></td>";
			$table5.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate5(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate5(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table5.="</tr>";
			$i++;
		}
		$query = "select fslno,ffaculty,r1.freasonname as flevelname, flevel,ftitle,fagency,fperiod,famount,fpoints,fenclosureno,fenttype
				from rcprojct 
				left join reason r1 on rcprojct.flevel = r1.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcpout'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table6 ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table6.="<tr style = 'width:90%'>";  
			$table6.="<td>";
			$table6.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid26_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[ffaculty]}' id = '{$i}RC43'  name='fulltimeexp'>";
			$table6.="</td>"; 
			$table6.="<td>";
			$table6.="<input type='text' style='width:90%;' disabled id = '{$i}RC44' value = '{$value[ftitle]}'/>";
			$table6.="</td>"; 
			$table6.="<td>";
			$table6.="<input type='text'   style='width:90%;' disabled id = '{$i}RC45' value = '{$value[fagency]}' />";
			$table6.="</td>"; 
			$table6.="<td><input type='hidden' style='width:90%;' disabled value = '{$value[flevel]}' id = '{$i}HRC46'  name='fulltimeexp'><input type='text' style='width:90%;' disabled id = '{$i}RC46' value = '{$value[flevel]}'></td>";
			$table6.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC47' value = '{$value[fpoints]}' /></td>";
			$table6.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC75' value = '{$value[fenclosureno]}' /></td>";
			$table6.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate6(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate6(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table6.="</tr>";
			$i++;
		}
		
		$query = "select fslno,fuserid,fappno,fnostud,fpoints,fenclosureno,fenttype
				from rechguid 
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcgm'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table7 ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table7.="<tr style = 'width:90%'>";  
			$table7.="<td>";
			$table7.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid27_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[fnostud]}' id = '{$i}RC48'  name='fulltimeexp'>";
			$table7.="</td>"; 
			$table7.="<td>";
			$table7.="<input type='text' style='width:90%;' disabled id = '{$i}RC49' value = '{$value[fpoints]}'/>";
			$table7.="</td>"; 
			$table7.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC76' value = '{$value[fenclosureno]}' /></td>";
			$table7.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate7(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate7(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table7.="</tr>";
			$i++;
		}
		
		$query = "select fslno,fuserid,fappno,fnostud,fpoints,fenclosureno,fenttype,fawareded,r1.freasonname as fawarededname
				from rechguid
				left join reason r1 on rechguid.fawareded = r1.freasoncode	
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcgp'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table8 ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table8.="<tr style = 'width:90%'>";  
			$table8.="<td>";
			$table8.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid28_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[fawareded]}' id = '{$i}RC50'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fawarededname]}' id = '{$i}RC50'  name='fulltimeexp'>";
			$table8.="</td>"; 
			$table8.="<td>";
			$table8.="<input type='text' style='width:90%;' disabled id = '{$i}RC51' value = '{$value[fnostud]}'/>";
			$table8.="</td>"; 
			$table8.="<td>";
			$table8.="<input type='text' style='width:90%;' disabled id = '{$i}RC52' value = '{$value[fpoints]}'/>";
			$table8.="</td>"; 
			$table8.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC77' value = '{$value[fenclosureno]}' /></td>";
			$table8.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate8(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate8(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table8.="</tr>";
			$i++;
		}
		
				$query = "select fslno,fuserid,fappno,fname,facademic,flevel,fawareded,fpoints,fenclosureno,fenttype,
		r1.freasonname as fawarededname,r2.freasonname as flevelname
		from rechguid
		left join reason r1 on rechguid.fawareded = r1.freasoncode	
		left join reason r2 on rechguid.flevel = r2.freasoncode
		where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcfs'";

		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table9 ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table9.="<tr style = 'width:90%'>";  
			$table9.="<td>";
			$table9.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid29_{$i}'/><input type='text' style='width:90%;' disabled id = '{$i}RC53' value = '{$value[fname]}'/>";
			$table9.="</td>"; 
			$table9.="<td>";
			$table9.="<input type='text' style='width:90%;' disabled id = '{$i}RC54' value = '{$value[facademic]}'/>";
			$table9.="</td>"; 
			$table9.="<td>";
			$table9.="<input type='hidden' style='width:90%;' disabled value = '{$value[fawareded]}' id = '{$i}HRC55'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fawarededname]}' id = '{$i}RC55'  name='fulltimeexp'>";
			$table9.="</td>"; 
			$table9.="<td>";
			$table9.="<input type='hidden' style='width:90%;' disabled value = '{$value[flevel]}' id = '{$i}HRC56'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[flevelname]}' id = '{$i}RC56'  name='fulltimeexp'>";
			$table9.="</td>"; 
			$table9.="<td>";
			$table9.="<input type='text' style='width:90%;' disabled id = '{$i}RC57' value = '{$value[fpoints]}'/>";
			$table9.="</td>";
			$table9.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC78' value = '{$value[fenclosureno]}' /></td>";
			$table9.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate9(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate9(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table9.="</tr>";
			$i++;
		}
		
		$query = "select fslno,fuserid,fappno,ftitle,fsubmitted,forganized,flevel,date_format(fdate,'%d/%m/%Y') as fdate,ftype,fpoints,fenclosureno,
				r1.freasonname as ftypename,r2.freasonname as flevelname
				from rclecture
				left join reason r1 on rclecture.ftype = r1.freasoncode
				left join reason r2 on rclecture.flevel = r2.freasoncode		
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcil'";

		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table10 ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table10.="<tr style = 'width:90%'>";  
			$table10.="<td>";
			$table10.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid30_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[ftitle]}' id = '{$i}RC58'  name='fulltimeexp'>";
			$table10.="</td>"; 
			$table10.="<td>";
			$table10.="<input type='text' style='width:90%;' disabled id = '{$i}RC59' value = '{$value[fsubmitted]}'/>";
			$table10.="</td>"; 
			$table10.="<td>";
			$table10.="<input type='text' style='width:90%;' disabled id = '{$i}RC60' value = '{$value[forganized]}'/>";
			$table10.="</td>"; 
			$table10.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC61' value = '{$value[fdate]}' /></td>";
			$table10.="<td><input type='hidden' style='width:90%;' disabled value = '{$value[ftype]}' id = '{$i}HRC62'  name='fulltimeexp'><input type='text'   style='width:90%;' disabled id = '{$i}RC62' value = '{$value[ftypename]}' /></td>";
			$table10.="<td><input type='hidden' style='width:90%;' disabled value = '{$value[flevel]}' id = '{$i}HRC63'  name='fulltimeexp'><input type='text'   style='width:90%;' disabled id = '{$i}RC63' value = '{$value[flevelname]}' /></td>";
			$table10.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC64' value = '{$value[fpoints]}' /></td>";
			$table10.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC79' value = '{$value[fenclosureno]}' /></td>";
			$table10.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate10(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate10(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table10.="</tr>";
			$i++;
		}
		
		$query = "select fslno,fuserid,fappno,ftitle,fsubmitted,fnom,fpoints,fenclosureno,fenttype
		from rclecture
		where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcde'";

		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table11 ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table11.="<tr style = 'width:90%'>";  
			$table11.="<td>";
			$table11.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid31_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[ftitle]}' id = '{$i}RC65'  name='fulltimeexp'>";
			$table11.="</td>"; 
			$table11.="<td>";
			$table11.="<input type='text' style='width:90%;' disabled id = '{$i}RC66' value = '{$value[fsubmitted]}'/>";
			$table11.="</td>"; 
			$table11.="<td>";
			$table11.="<input type='text' style='width:90%;' disabled id = '{$i}RC67' value = '{$value[fnom]}'/>";
			$table11.="</td>";
			$table11.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC68' value = '{$value[fpoints]}'/></td>";
			$table11.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC80' value = '{$value[fenclosureno]}' /></td>";
			$table11.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate11(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate11(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table11.="</tr>";
			$i++;
		}
		//
		$arr['table11'] = $table11;
		$arr['table13'] = $result13;
		$arr['table14'] = $result14;
		$arr['table10'] = $table10;
		$arr['table9'] = $table9;
		$arr['table8'] = $table8;
		$arr['table7'] = $table7;
		$arr['table6'] = $table6;
		$arr['table5'] = $table5;
		$arr['table4'] = $table4;
		$arr['table3'] = $table3;
		$arr['table2'] = $table2;
		$arr['table'] = $table;
		$arr['tleact'] = $result;
	
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		
}


function deleteassociate($aobj_context)
{
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	
	$appno = trim($aobj_context->mobj_data["appno"]);
	$slno = trim($aobj_context->mobj_data["slno"]);
	
	$query = "delete from researchexp where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$slno}' and fenttype = 'rcphd'";
	$results  = $aobj_context->mobj_db->Execute($query);	
	if($results)
	{
		$query = "select fslno,fpublication,r1.freasonname as fpublicationname, ftitle,fjournalname,fyear,fjournalno,
				 fvolno,fpageno,fissnno,frefereed,r2.freasonname as ffauthorname, fauthor,fpoints,fimpfact,fenclosureno
				from researchexp 
				left join reason r1 on researchexp.fpublication = r1.freasoncode
				left join reason r2 on researchexp.fauthor = r2.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcphd'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='research21_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[fpublication]}' id = '{$i}HRC1'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fpublicationname]}' id = '{$i}RC1'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC2' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC3' value = '{$value[fjournalname]}' />";
			$table.="</td>"; 
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC4' value = '{$value[fyear]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC5' value = '{$value[fvolno]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC6' value = '{$value[fpageno]}'  /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC7'  value = '{$value[fissnno]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC81'  value = '{$value[fjournalno]}' /></td>"; 
			$table.="<td><input type = 'hidden' id = '{$i}HRC8' value = '{$value[fauthor]}' ><input type='text'   style='width:90%;' disabled id = '{$i}RC8' value = '{$value[ffauthorname]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC9' value = '{$value[fimpfact]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC10' value = '{$value[fpoints]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC70' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}

		
		
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
	}
}

function deleteassociate2($aobj_context)
{
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	
	$appno = trim($aobj_context->mobj_data["appno"]);
	$slno = trim($aobj_context->mobj_data["slno"]);
	
	$query = "delete from researchexp where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$slno}' and fenttype = 'rcoth'";
	$results  = $aobj_context->mobj_db->Execute($query);	
	if($results)
	{
		$query = "select fslno,fpublication,r1.freasonname as fpublicationname, ftitle,fjournalname,fyear,fjournalno,
				 fvolno,fpageno,fissnno,frefereed,r2.freasonname as ffauthorname, fauthor,fpoints,fimpfact,fenclosureno
				from researchexp 
				left join reason r1 on researchexp.fpublication = r1.freasoncode
				left join reason r2 on researchexp.fauthor = r2.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcoth'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='research22_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[fpublication]}' id = '{$i}HRC11'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fpublicationname]}' id = '{$i}RC11'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC12' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC13' value = '{$value[fjournalname]}' />";
			$table.="</td>"; 
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC14' value = '{$value[fyear]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC15' value = '{$value[fvolno]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC16' value = '{$value[fpageno]}'  /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC17'  value = '{$value[fissnno]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC81'  value = '{$value[fjournalno]}' /></td>";
			$table.="<td><input type = 'hidden' id = '{$i}HRC18' value = '{$value[fauthor]}' ><input type='text'   style='width:90%;' disabled id = '{$i}RC18' value = '{$value[ffauthorname]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC19' value = '{$value[fimpfact]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC71' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate2(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate2(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
	}
}


function deleteassociate3($aobj_context)
{
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	
	$appno = trim($aobj_context->mobj_data["appno"]);
	$slno = trim($aobj_context->mobj_data["slno"]);
	
	$query = "delete from researchexp where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$slno}' and fenttype = 'rcotj'";
	
	$results  = $aobj_context->mobj_db->Execute($query);	
	if($results)
	{
		$query = "select fslno,fpublication,r1.freasonname as fpublicationname, ftitle,fjournalname,fyear,flevel,r3.freasonname as flevelname,
				 fvolno,fpageno,fissnno,frefereed,r2.freasonname as ffauthorname, fauthor,fpoints,fimpfact,fautaddrs,fenclosureno
				from researchexp 
				left join reason r1 on researchexp.fpublication = r1.freasoncode
				left join reason r2 on researchexp.fauthor = r2.freasoncode
				left join reason r3 on researchexp.flevel = r3.freasoncode 
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcotj'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid23_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[fpublication]}' id = '{$i}HRC20'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fpublicationname]}' id = '{$i}RC20'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC21' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC22' value = '{$value[fjournalname]}' />";
			$table.="</td>"; 
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC23' value = '{$value[fyear]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC24' value = '{$value[fpageno]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC25' value = '{$value[fissnno]}'  /></td>";
			//$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RA26'  value = '{$value[frefereed]}' /></td>";
			//$table.="<td><input type = 'hidden' id = '{$i}HRA27' value = '{$value[flevel]}' ><input type='text'   style='width:90%;' disabled id = '{$i}RA27'  value = '{$value[flevelname]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC28'  value = '{$value[fautaddrs]}' /></td>";
			$table.="<td><input type = 'hidden' id = '{$i}HRC29' value = '{$value[fauthor]}' ><input type='text'   style='width:90%;' disabled id = '{$i}RC29' value = '{$value[ffauthorname]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC30' value = '{$value[fpoints]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC72' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate3(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate3(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}

		
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
	}
}

function saveresearchassociate4($aobj_context)
{
	
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$faculty = trim($aobj_context->mobj_data["faculty"]);
	$ftitle = trim($aobj_context->mobj_data["ftitle"]);
	$fagency = trim($aobj_context->mobj_data["fagency"]);
	$fperiod = trim($aobj_context->mobj_data["fperiod"]);
	$famount = trim($aobj_context->mobj_data["famount"]);
	$fpoints = trim($aobj_context->mobj_data["fpoints"]);
	$fenclosureno = trim($aobj_context->mobj_data["fenclosureno"]);
	$RA1 = trim($aobj_context->mobj_data["RA1"]); 
	$appno = trim($aobj_context->mobj_data["appno"]);

	if($RA1 == 'I')
	{
		$query = "insert into rcprojct(fuserid,fappno,ffaculty,ftitle,fagency,fperiod,famount,fpoints,fenclosureno,fenttype) 
				   values('{$userid}','{$appno}','{$faculty}','{$ftitle}','{$fagency}','{$fperiod}','{$famount}','{$fpoints}','{$fenclosureno}','rcspon')";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	else
	{
		$query = "update rcprojct set ffaculty = '{$faculty}',ftitle = '{$ftitle}',
			fagency = '{$fagency}',fperiod = '{$fperiod}',famount ='{$famount}',
			fpoints = '{$fpoints}',fenclosureno = '{$fenclosureno}'
			where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$RA1}'";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	//var_dump($query);
	if($results)
	{
		$query = "select fslno,ffaculty,r1.freasonname as ffacultyname, ftitle,fagency,fperiod,famount,fpoints,fenclosureno,fenttype
				from rcprojct 
				left join reason r1 on rcprojct.ffaculty = r1.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcspon'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid24_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[ffaculty]}' id = '{$i}HRC31'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[ffacultyname]}' id = '{$i}RC31'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC32' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC33' value = '{$value[fagency]}' />";
			$table.="</td>"; 
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC34' value = '{$value[fperiod]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC35' value = '{$value[famount]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC36' value = '{$value[fpoints]}'  /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC73' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate4(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate4(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}

		
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}else
	{
		$query = "select fslno,ffaculty,r1.freasonname as ffacultyname, ftitle,fagency,fperiod,famount,fpoints,fenclosureno,fenttype
				from rcprojct 
				left join reason r1 on rcprojct.ffaculty = r1.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcspon'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid24_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[ffaculty]}' id = '{$i}HRC31'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[ffacultyname]}' id = '{$i}RC31'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC32' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC33' value = '{$value[fagency]}' />";
			$table.="</td>"; 
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC34' value = '{$value[fperiod]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC35' value = '{$value[famount]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC36' value = '{$value[fpoints]}'  /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC73' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate4(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate4(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}

		
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
	}
		
}

function deleteassociate4($aobj_context)
{
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	
	$appno = trim($aobj_context->mobj_data["appno"]);
	$slno = trim($aobj_context->mobj_data["slno"]);
	
	$query = "delete from rcprojct where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$slno}' and fenttype = 'rcspon'";
	
	$results  = $aobj_context->mobj_db->Execute($query);	
	if($results)
	{
		$query = "select fslno,ffaculty,r1.freasonname as ffacultyname, ftitle,fagency,fperiod,famount,fpoints,fenclosureno,fenttype
				from rcprojct 
				left join reason r1 on rcprojct.ffaculty = r1.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcspon'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid24_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[ffaculty]}' id = '{$i}HRC31'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[ffacultyname]}' id = '{$i}RC31'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC32' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC33' value = '{$value[fagency]}' />";
			$table.="</td>"; 
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC34' value = '{$value[fperiod]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC35' value = '{$value[famount]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC36' value = '{$value[fpoints]}'  /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC73' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate4(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate4(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}

		
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
	}
}

function saveresearchassociate5($aobj_context)
{
	
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$faculty = trim($aobj_context->mobj_data["faculty"]);
	$ftitle = trim($aobj_context->mobj_data["ftitle"]);
	$fagency = trim($aobj_context->mobj_data["fagency"]);
	$fperiod = trim($aobj_context->mobj_data["fperiod"]);
	$famount = trim($aobj_context->mobj_data["famount"]);
	$fpoints = trim($aobj_context->mobj_data["fpoints"]);
	$fenclosureno = trim($aobj_context->mobj_data["fenclosureno"]);
	$RA1 = trim($aobj_context->mobj_data["RA1"]); 
	$appno = trim($aobj_context->mobj_data["appno"]);

	if($RA1 == 'I')
	{
		$query = "insert into rcprojct(fuserid,fappno,ffaculty,ftitle,fagency,fperiod,famount,fpoints,fenclosureno,fenttype) 
				   values('{$userid}','{$appno}','{$faculty}','{$ftitle}','{$fagency}','{$fperiod}','{$famount}','{$fpoints}','{$fenclosureno}','rccons')";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	else
	{
		$query = "update rcprojct set ffaculty = '{$faculty}',ftitle = '{$ftitle}',
			fagency = '{$fagency}',fperiod = '{$fperiod}',famount ='{$famount}',
			fpoints = '{$fpoints}',fenclosureno = '{$fenclosureno}'
			where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$RA1}'";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	//var_dump($query);
	if($results)
	{
		$query = "select fslno,ffaculty,r1.freasonname as ffacultyname, ftitle,fagency,fperiod,famount,fpoints,fenclosureno,fenttype
				from rcprojct 
				left join reason r1 on rcprojct.ffaculty = r1.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rccons'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid25_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[ffaculty]}' id = '{$i}HRC37'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[ffacultyname]}' id = '{$i}RC37'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC38' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC39' value = '{$value[fagency]}' />";
			$table.="</td>"; 
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC40' value = '{$value[fperiod]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC41' value = '{$value[famount]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC42' value = '{$value[fpoints]}'  /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC74' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate5(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate5(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}else
	{
		$query = "select fslno,ffaculty,r1.freasonname as ffacultyname, ftitle,fagency,fperiod,famount,fpoints,fenclosureno,fenttype
				from rcprojct 
				left join reason r1 on rcprojct.ffaculty = r1.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rccons'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid25_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[ffaculty]}' id = '{$i}HRC37'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[ffacultyname]}' id = '{$i}RC37'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC38' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC39' value = '{$value[fagency]}' />";
			$table.="</td>"; 
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC40' value = '{$value[fperiod]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC41' value = '{$value[famount]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC42' value = '{$value[fpoints]}'  /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC74' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate5(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate5(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
	}
		
}

function deleteassociate5($aobj_context)
{
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	
	$appno = trim($aobj_context->mobj_data["appno"]);
	$slno = trim($aobj_context->mobj_data["slno"]);
	
	$query = "delete from rcprojct where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$slno}' and fenttype = 'rccons'";
	
	$results  = $aobj_context->mobj_db->Execute($query);	
	if($results)
	{
		$query = "select fslno,ffaculty,r1.freasonname as ffacultyname, ftitle,fagency,fperiod,famount,fpoints,fenclosureno,fenttype
				from rcprojct 
				left join reason r1 on rcprojct.ffaculty = r1.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rccons'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid25_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[ffaculty]}' id = '{$i}HRC37'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[ffacultyname]}' id = '{$i}RC37'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC38' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC39' value = '{$value[fagency]}' />";
			$table.="</td>"; 
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC40' value = '{$value[fperiod]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC41' value = '{$value[famount]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC42' value = '{$value[fpoints]}'  /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC74' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate5(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate5(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}

		
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
	}
}


function saveresearchassociate6($aobj_context)
{
	
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$faculty = trim($aobj_context->mobj_data["faculty"]);
	$ftitle = trim($aobj_context->mobj_data["ftitle"]);
	$fagency = trim($aobj_context->mobj_data["fagency"]);
	$flevel = trim($aobj_context->mobj_data["flevel"]);
	$fpoints = trim($aobj_context->mobj_data["fpoints"]);
	$fenclosureno = trim($aobj_context->mobj_data["fenclosureno"]);
	$RA1 = trim($aobj_context->mobj_data["RA1"]); 
	$appno = trim($aobj_context->mobj_data["appno"]);

	if($RA1 == 'I')
	{
		$query = "insert into rcprojct(fuserid,fappno,ffaculty,ftitle,fagency,flevel,fpoints,fenclosureno,fenttype) 
				   values('{$userid}','{$appno}','{$faculty}','{$ftitle}','{$fagency}','{$flevel}','{$fpoints}','{$fenclosureno}','rcpout')";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	else
	{
		$query = "update rcprojct set ffaculty = '{$faculty}',ftitle = '{$ftitle}',
			fagency = '{$fagency}',flevel = '{$flevel}',
			fpoints = '{$fpoints}',fenclosureno = '{$fenclosureno}'
			where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$RA1}'";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	//var_dump($query);
	if($results)
	{
		$query = "select fslno,ffaculty,r1.freasonname as flevelname, flevel,ftitle,fagency,fperiod,famount,fpoints,fenclosureno,fenttype
				from rcprojct 
				left join reason r1 on rcprojct.flevel = r1.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcpout'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid26_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[ffaculty]}' id = '{$i}RC43'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC44' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC45' value = '{$value[fagency]}' />";
			$table.="</td>"; 
			$table.="<td><input type='hidden' style='width:90%;' disabled value = '{$value[flevel]}' id = '{$i}HRC46'  name='fulltimeexp'><input type='text' style='width:90%;' disabled id = '{$i}RC46' value = '{$value[flevel]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC47' value = '{$value[fpoints]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC75' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate6(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate6(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}else
	{
		$query = "select fslno,ffaculty,r1.freasonname as flevelname, flevel,ftitle,fagency,fperiod,famount,fpoints,fenclosureno,fenttype
				from rcprojct 
				left join reason r1 on rcprojct.flevel = r1.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcpout'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid26_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[ffaculty]}' id = '{$i}RC43'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC44' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC45' value = '{$value[fagency]}' />";
			$table.="</td>"; 
			$table.="<td><input type='hidden' style='width:90%;' disabled value = '{$value[flevel]}' id = '{$i}HRC46'  name='fulltimeexp'><input type='text' style='width:90%;' disabled id = '{$i}RC46' value = '{$value[flevel]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC47' value = '{$value[fpoints]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC75' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate6(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate6(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
	}
		
}

function deleteassociate6($aobj_context)
{
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	
	$appno = trim($aobj_context->mobj_data["appno"]);
	$slno = trim($aobj_context->mobj_data["slno"]);
	
	$query = "delete from rcprojct where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$slno}' and fenttype = 'rcpout'";
	
	$results  = $aobj_context->mobj_db->Execute($query);	
	if($results)
	{
		$query = "select fslno,ffaculty,r1.freasonname as flevelname, flevel,ftitle,fagency,fperiod,famount,fpoints,fenclosureno,fenttype
				from rcprojct 
				left join reason r1 on rcprojct.flevel = r1.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcpout'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid26_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[ffaculty]}' id = '{$i}RC43'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC44' value = '{$value[ftitle]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text'   style='width:90%;' disabled id = '{$i}RC45' value = '{$value[fagency]}' />";
			$table.="</td>"; 
			$table.="<td><input type='hidden' style='width:90%;' disabled value = '{$value[flevel]}' id = '{$i}HRC46'  name='fulltimeexp'><input type='text' style='width:90%;' disabled id = '{$i}RC46' value = '{$value[flevel]}'></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC47' value = '{$value[fpoints]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC75' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate6(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate6(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
	}
}


function saveresearchassociate7($aobj_context)
{
	
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$fnostud = trim($aobj_context->mobj_data["fnostud"]);
	$fpoints = trim($aobj_context->mobj_data["fpoints"]);
	$fenclosureno = trim($aobj_context->mobj_data["fenclosureno"]);
	$RA1 = trim($aobj_context->mobj_data["RA1"]); 
	$appno = trim($aobj_context->mobj_data["appno"]);

	if($RA1 == 'I')
	{
		$query = "insert into rechguid(fuserid,fappno,fnostud,fpoints,fenclosureno,fenttype) 
				   values('{$userid}','{$appno}','{$fnostud}','{$fpoints}','{$fenclosureno}','rcgm')";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	else
	{
		$query = "update rechguid set fnostud = '{$fnostud}',
			fpoints = '{$fpoints}',fenclosureno = '{$fenclosureno}'
			where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$RA1}'";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	//var_dump($query);
	if($results)
	{
		$query = "select fslno,fuserid,fappno,fnostud,fpoints,fenclosureno,fenttype
				from rechguid 
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcgm'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid27_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[fnostud]}' id = '{$i}RC48'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC49' value = '{$value[fpoints]}'/>";
			$table.="</td>"; 
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC76' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate7(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate7(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}else
	{
		$query = "select fslno,fuserid,fappno,fnostud,fpoints,fenclosureno,fenttype
				from rechguid 
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcgm'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid27_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[fnostud]}' id = '{$i}RC48'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC49' value = '{$value[fpoints]}'/>";
			$table.="</td>"; 
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC76' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate7(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate7(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
	}
		
}

function deleteassociate7($aobj_context)
{
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	
	$appno = trim($aobj_context->mobj_data["appno"]);
	$slno = trim($aobj_context->mobj_data["slno"]);
	
	$query = "delete from rechguid where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$slno}' and fenttype = 'rcgm'";
	
	$results  = $aobj_context->mobj_db->Execute($query);	
	if($results)
	{
		$query = "select fslno,fuserid,fappno,fnostud,fpoints,fenclosureno,fenttype
				from rechguid 
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcgm'";
		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid27_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[fnostud]}' id = '{$i}RC48'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC49' value = '{$value[fpoints]}'/>";
			$table.="</td>"; 
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC76' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate7(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate7(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
	}
}

function saveresearchassociate8($aobj_context)
{
	
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$fawareded = trim($aobj_context->mobj_data["fawareded"]);
	$fnostud = trim($aobj_context->mobj_data["fnostud"]);
	$fpoints = trim($aobj_context->mobj_data["fpoints"]);
	$fenclosureno = trim($aobj_context->mobj_data["fenclosureno"]);
	$RA1 = trim($aobj_context->mobj_data["RA1"]); 
	$appno = trim($aobj_context->mobj_data["appno"]);

	if($RA1 == 'I')
	{
		$query = "insert into rechguid(fuserid,fappno,fawareded,fnostud,fpoints,fenclosureno,fenttype) 
				   values('{$userid}','{$appno}','{$fawareded}','{$fnostud}','{$fpoints}','{$fenclosureno}','rcgp')";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	else
	{
		$query = "update rechguid set fnostud = '{$fnostud}',fawareded = '{$fawareded}',
			fpoints = '{$fpoints}',fenclosureno = '{$fenclosureno}'
			where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$RA1}'";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	//var_dump($query);
	if($results)
	{
				$query = "select fslno,fuserid,fappno,fnostud,fpoints,fenclosureno,fenttype,fawareded,r1.freasonname as fawarededname
		from rechguid
		left join reason r1 on rechguid.fawareded = r1.freasoncode	
		where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcgp'";

		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid28_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[fawareded]}' id = '{$i}RC50'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fawarededname]}' id = '{$i}RC50'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC51' value = '{$value[fnostud]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC52' value = '{$value[fpoints]}'/>";
			$table.="</td>"; 
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC77' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate8(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate8(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}else
	{
				$query = "select fslno,fuserid,fappno,fnostud,fpoints,fenclosureno,fenttype,fawareded,r1.freasonname as fawarededname
		from rechguid
		left join reason r1 on rechguid.fawareded = r1.freasoncode	
		where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcgp'";

		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid28_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[fawareded]}' id = '{$i}RC50'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fawarededname]}' id = '{$i}RC50'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC51' value = '{$value[fnostud]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC52' value = '{$value[fpoints]}'/>";
			$table.="</td>"; 
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC77' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate8(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate8(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}
		
}

function deleteassociate8($aobj_context)
{
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	
	$appno = trim($aobj_context->mobj_data["appno"]);
	$slno = trim($aobj_context->mobj_data["slno"]);
	
	$query = "delete from rechguid where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$slno}' and fenttype = 'rcgp'";
	
	$results  = $aobj_context->mobj_db->Execute($query);	
	if($results)
	{
			$query = "select fslno,fuserid,fappno,fnostud,fpoints,fenclosureno,fenttype,fawareded,r1.freasonname as fawarededname
		from rechguid
		left join reason r1 on rechguid.fawareded = r1.freasoncode	
		where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcgp'";

		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid28_{$i}'/><input type='hidden' style='width:90%;' disabled value = '{$value[fawareded]}' id = '{$i}RC50'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fawarededname]}' id = '{$i}RC50'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC51' value = '{$value[fnostud]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC52' value = '{$value[fpoints]}'/>";
			$table.="</td>"; 
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC77' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate8(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate8(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}
}

function saveresearchassociate9($aobj_context)
{
	
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$fawareded = trim($aobj_context->mobj_data["fawareded"]);
	$fname = trim($aobj_context->mobj_data["fname"]);
	$facademic = trim($aobj_context->mobj_data["facademic"]);
	$flevel = trim($aobj_context->mobj_data["flevel"]); 
	$fpoints = trim($aobj_context->mobj_data["fpoints"]);
	$fenclosureno = trim($aobj_context->mobj_data["fenclosureno"]);
	$RA1 = trim($aobj_context->mobj_data["RA1"]); 
	$appno = trim($aobj_context->mobj_data["appno"]);

	if($RA1 == 'I')
	{
		$query = "insert into rechguid(fuserid,fappno,fname,facademic,flevel,fawareded,fpoints,fenclosureno,fenttype) 
				   values('{$userid}','{$appno}','{$fname}','{$facademic}','{$flevel}','{$fawareded}','{$fpoints}','{$fenclosureno}','rcfs')";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	else
	{
		$query = "update rechguid set fname = '{$fname}',fawareded = '{$fawareded}',
			fpoints = '{$fpoints}',fenclosureno = '{$fenclosureno}',facademic = '{$facademic}',flevel = '{$flevel}'
			where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$RA1}'";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	//var_dump($query);
	if($results)
	{
				$query = "select fslno,fuserid,fappno,fname,facademic,flevel,fawareded,fpoints,fenclosureno,fenttype,
				r1.freasonname as fawarededname,r2.freasonname as flevelname
				from rechguid
				left join reason r1 on rechguid.fawareded = r1.freasoncode	
				left join reason r2 on rechguid.flevel = r2.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcfs'";

		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid29_{$i}'/><input type='text' style='width:90%;' disabled id = '{$i}RC53' value = '{$value[fname]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC54' value = '{$value[facademic]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='hidden' style='width:90%;' disabled value = '{$value[fawareded]}' id = '{$i}HRC55'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fawarededname]}' id = '{$i}RC55'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='hidden' style='width:90%;' disabled value = '{$value[flevel]}' id = '{$i}HRC56'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[flevelname]}' id = '{$i}RC56'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC57' value = '{$value[fpoints]}'/>";
			$table.="</td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC78' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate9(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate9(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}else
	{
				$query = "select fslno,fuserid,fappno,fname,facademic,flevel,fawareded,fpoints,fenclosureno,fenttype,
				r1.freasonname as fawarededname,r2.freasonname as flevelname
				from rechguid
				left join reason r1 on rechguid.fawareded = r1.freasoncode	
				left join reason r2 on rechguid.flevel = r2.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcfs'";

		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid29_{$i}'/><input type='text' style='width:90%;' disabled id = '{$i}RC53' value = '{$value[fname]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC54' value = '{$value[facademic]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='hidden' style='width:90%;' disabled value = '{$value[fawareded]}' id = '{$i}HRC55'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fawarededname]}' id = '{$i}RC55'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='hidden' style='width:90%;' disabled value = '{$value[flevel]}' id = '{$i}HRC56'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[flevelname]}' id = '{$i}RC56'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC57' value = '{$value[fpoints]}'/>";
			$table.="</td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC78' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate9(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate9(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}
		
}

function deleteassociate9($aobj_context)
{
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	
	$appno = trim($aobj_context->mobj_data["appno"]);
	$slno = trim($aobj_context->mobj_data["slno"]);
	
	$query = "delete from rechguid where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$slno}' and fenttype = 'rcfs'";
	
	$results  = $aobj_context->mobj_db->Execute($query);	
	if($results)
	{
			$query = "select fslno,fuserid,fappno,fname,facademic,flevel,fawareded,fpoints,fenclosureno,fenttype,
				r1.freasonname as fawarededname,r2.freasonname as flevelname
				from rechguid
				left join reason r1 on rechguid.fawareded = r1.freasoncode	
				left join reason r2 on rechguid.flevel = r2.freasoncode
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcfs'";

		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid29_{$i}'/><input type='text' style='width:90%;' disabled id = '{$i}RC53' value = '{$value[fname]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC54' value = '{$value[facademic]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='hidden' style='width:90%;' disabled value = '{$value[fawareded]}' id = '{$i}HRC55'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[fawarededname]}' id = '{$i}RC55'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='hidden' style='width:90%;' disabled value = '{$value[flevel]}' id = '{$i}HRC56'  name='fulltimeexp'><input type='text' style='width:90%;' disabled value = '{$value[flevelname]}' id = '{$i}RC56'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC57' value = '{$value[fpoints]}'/>";
			$table.="</td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC78' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate9(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate9(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}
}

function saveresearchassociate10($aobj_context)
{
	
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$ftitle = trim($aobj_context->mobj_data["ftitle"]);
	$fsubmitted = trim($aobj_context->mobj_data["fsubmitted"]);
	$forganized = trim($aobj_context->mobj_data["forganized"]);
	$flevel = trim($aobj_context->mobj_data["flevel"]);
	$fdate = trim($aobj_context->mobj_data["fdate"]);
	$ftype = trim($aobj_context->mobj_data["ftype"]);
	$fpoints = trim($aobj_context->mobj_data["fpoints"]);
	$fenclosureno = trim($aobj_context->mobj_data["fenclosureno"]);
	$RA1 = trim($aobj_context->mobj_data["RA1"]); 
	$appno = trim($aobj_context->mobj_data["appno"]);

	if($RA1 == 'I')
	{
		$query = "insert into rclecture(fuserid,fappno,ftitle,fsubmitted,forganized,flevel,fdate,ftype,fpoints,fenclosureno,fenttype) 
				   values('{$userid}','{$appno}','{$ftitle}','{$fsubmitted}','{$forganized}','{$flevel}',DATE_FORMAT(str_to_date('{$fdate}','%d/%m/%Y'),'%Y-%m-%d'),'{$ftype}','{$fpoints}','{$fenclosureno}','rcil')";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	else
	{
		$query = "update rclecture set ftitle = '{$ftitle}',fsubmitted = '{$fsubmitted}',
			fpoints = '{$fpoints}',fenclosureno = '{$fenclosureno}',forganized = '{$forganized}',flevel = '{$flevel}',
			fdate = DATE_FORMAT(str_to_date('{$fdate}','%d/%m/%Y'),'%Y-%m-%d'),ftype = '{$ftype}'
			where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$RA1}'";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	//var_dump($query);
	if($results)
	{
				$query = "select fslno,fuserid,fappno,ftitle,fsubmitted,forganized,flevel,date_format(fdate,'%d/%m/%Y') as fdate,ftype,fpoints,fenclosureno,
				r1.freasonname as ftypename,r2.freasonname as flevelname
				from rclecture
				left join reason r1 on rclecture.ftype = r1.freasoncode
				left join reason r2 on rclecture.flevel = r2.freasoncode		
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcil'";

		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid30_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[ftitle]}' id = '{$i}RC58'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC59' value = '{$value[fsubmitted]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC60' value = '{$value[forganized]}'/>";
			$table.="</td>"; 
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC61' value = '{$value[fdate]}' /></td>";
			$table.="<td><input type='hidden' style='width:90%;' disabled value = '{$value[ftype]}' id = '{$i}HRC62'  name='fulltimeexp'><input type='text'   style='width:90%;' disabled id = '{$i}RC62' value = '{$value[ftypename]}' /></td>";
			$table.="<td><input type='hidden' style='width:90%;' disabled value = '{$value[flevel]}' id = '{$i}HRC63'  name='fulltimeexp'><input type='text'   style='width:90%;' disabled id = '{$i}RC63' value = '{$value[flevelname]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC64' value = '{$value[fpoints]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC79' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate10(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate10(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		//
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}else
	{
				$query = "select fslno,fuserid,fappno,ftitle,fsubmitted,forganized,flevel,date_format(fdate,'%d/%m/%Y') as fdate,ftype,fpoints,fenclosureno,
				r1.freasonname as ftypename,r2.freasonname as flevelname
				from rclecture
				left join reason r1 on rclecture.ftype = r1.freasoncode
				left join reason r2 on rclecture.flevel = r2.freasoncode		
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcil'";

		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid30_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[ftitle]}' id = '{$i}RC58'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC59' value = '{$value[fsubmitted]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC60' value = '{$value[forganized]}'/>";
			$table.="</td>"; 
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC61' value = '{$value[fdate]}' /></td>";
			$table.="<td><input type='hidden' style='width:90%;' disabled value = '{$value[ftype]}' id = '{$i}HRC62'  name='fulltimeexp'><input type='text'   style='width:90%;' disabled id = '{$i}RC62' value = '{$value[ftypename]}' /></td>";
			$table.="<td><input type='hidden' style='width:90%;' disabled value = '{$value[flevel]}' id = '{$i}HRC63'  name='fulltimeexp'><input type='text'   style='width:90%;' disabled id = '{$i}RC63' value = '{$value[flevelname]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC64' value = '{$value[fpoints]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC79' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate10(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate10(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		//
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}
		
}

function deleteassociate10($aobj_context)
{
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	
	$appno = trim($aobj_context->mobj_data["appno"]);
	$slno = trim($aobj_context->mobj_data["slno"]);
	
	$query = "delete from rclecture where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$slno}' and fenttype = 'rcil'";
	
	$results  = $aobj_context->mobj_db->Execute($query);	
	if($results)
	{
			$query = "select fslno,fuserid,fappno,ftitle,fsubmitted,forganized,flevel,date_format(fdate,'%d/%m/%Y') as fdate,ftype,fpoints,fenclosureno,
				r1.freasonname as ftypename,r2.freasonname as flevelname
				from rclecture
				left join reason r1 on rclecture.ftype = r1.freasoncode
				left join reason r2 on rclecture.flevel = r2.freasoncode		
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcil'";

		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid30_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[ftitle]}' id = '{$i}RC58'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC59' value = '{$value[fsubmitted]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC60' value = '{$value[forganized]}'/>";
			$table.="</td>"; 
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC61' value = '{$value[fdate]}' /></td>";
			$table.="<td><input type='hidden' style='width:90%;' disabled value = '{$value[ftype]}' id = '{$i}HRC62'  name='fulltimeexp'><input type='text'   style='width:90%;' disabled id = '{$i}RC62' value = '{$value[ftypename]}' /></td>";
			$table.="<td><input type='hidden' style='width:90%;' disabled value = '{$value[flevel]}' id = '{$i}HRC63'  name='fulltimeexp'><input type='text'   style='width:90%;' disabled id = '{$i}RC63' value = '{$value[flevelname]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC64' value = '{$value[fpoints]}' /></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC79' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate10(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate10(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		//
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}
}

function saveresearchassociate11($aobj_context)
{
	
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$ftitle = trim($aobj_context->mobj_data["ftitle"]);
	$fsubmitted = trim($aobj_context->mobj_data["fsubmitted"]);
	$fnom = trim($aobj_context->mobj_data["fnom"]);
	$fpoints = trim($aobj_context->mobj_data["fpoints"]);
	$fenclosureno = trim($aobj_context->mobj_data["fenclosureno"]);
	$RA1 = trim($aobj_context->mobj_data["RA1"]); 
	$appno = trim($aobj_context->mobj_data["appno"]);

	if($RA1 == 'I')
	{
		$query = "insert into rclecture(fuserid,fappno,ftitle,fsubmitted,fnom,fpoints,fenclosureno,fenttype) 
				   values('{$userid}','{$appno}','{$ftitle}','{$fsubmitted}','{$fnom}','{$fpoints}','{$fenclosureno}','rcde')";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	else
	{
		$query = "update rclecture set ftitle = '{$ftitle}',fsubmitted = '{$fsubmitted}',
			fpoints = '{$fpoints}',fenclosureno = '{$fenclosureno}',fnom = '{$fnom}'
			where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$RA1}'";
		$results  = $aobj_context->mobj_db->Execute($query);	
	}
	//var_dump($query);
	if($results)
	{
				$query = "select fslno,fuserid,fappno,ftitle,fsubmitted,fnom,fpoints,fenclosureno,fenttype
				from rclecture
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcde'";

		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid31_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[ftitle]}' id = '{$i}RC65'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC66' value = '{$value[fsubmitted]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC67' value = '{$value[fnom]}'/>";
			$table.="</td>";
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC68' value = '{$value[fpoints]}'/></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC80' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate11(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate11(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		//
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}else
	{
				$query = "select fslno,fuserid,fappno,ftitle,fsubmitted,fnom,fpoints,fenclosureno,fenttype
				from rclecture
				where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcde'";

		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid31_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[ftitle]}' id = '{$i}RC65'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC66' value = '{$value[fsubmitted]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC67' value = '{$value[fnom]}'/>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC68' value = '{$value[fpoints]}'/>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC80' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate11(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate11(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		//
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}
		
}

function deleteassociate11($aobj_context)
{
	session_start();
	$userid = $_SESSION['userid'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	
	$appno = trim($aobj_context->mobj_data["appno"]);
	$slno = trim($aobj_context->mobj_data["slno"]);
	
	$query = "delete from rclecture where fuserid = '{$userid}' and fappno = '{$appno}' and fslno = '{$slno}' and fenttype = 'rcde'";
	
	$results  = $aobj_context->mobj_db->Execute($query);	
	if($results)
	{
		$query = "select fslno,fuserid,fappno,ftitle,fsubmitted,fnom,fpoints,fenclosureno,fenttype
		from rclecture
		where fuserid = '{$userid}' and fappno = '{$appno}' and fenttype = 'rcde'";

		$results  = $aobj_context->mobj_db->getAll($query);
		
		$i = 2;
		$table ='';
		foreach($results as $value)
		{
			$slno = $value[fslno];
			
			$table.="<tr style = 'width:90%'>";  
			$table.="<td>";
			$table.="<input type = 'hidden'  value = '{$value[fslno]}' id='rechid31_{$i}'/><input type='text' style='width:90%;' disabled value = '{$value[ftitle]}' id = '{$i}RC65'  name='fulltimeexp'>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC66' value = '{$value[fsubmitted]}'/>";
			$table.="</td>"; 
			$table.="<td>";
			$table.="<input type='text' style='width:90%;' disabled id = '{$i}RC67' value = '{$value[fnom]}'/></td>";
			$table.="<td><input type='text' style='width:90%;' disabled id = '{$i}RC68' value = '{$value[fpoints]}'/></td>";
			$table.="<td><input type='text'   style='width:90%;' disabled id = '{$i}RC80' value = '{$value[fenclosureno]}' /></td>";
			$table.="<td><input type='submit' class='btn btn_3 btn btn-info' value = 'Edit' onclick = 'editassociate11(\"$slno\",\"$i\")' id='{$i}BT9' style='width:90%;' ><br><br><input type='submit' value = 'delete' class='btn btn_3 btn btn-danger' onclick = 'deleteassociate11(\"$slno\",\"$i\")' id='{$i}BT10' style='width:90%;' ></td>";
			$table.="</tr>";
			$i++;
		}
		//
		$rst['table'] = $table;
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
			
	}
}


?>