0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.137.159.163


Current Path : /var/www/html/kus/src/
Upload File :
Current File : /var/www/html/kus/src/getfeeinformation.php

<?php

	function getfeeInformation($aobj_context)
	{
		$query1="select FCATEGORY as internal_code,FCATEGORY as value from category ";
		$query = "select distinct FEXAMNO as internal_code, FEXAMNO as value from degree";
		$query2="SELECT DISTINCT FCONSTYPE as internal_code,FCONSTYPE as value FROM admfeestr ORDER BY 1 DESC ";
		$query3 = "select distinct FDEGREE as internal_code,  CONCAT(FDESCPN,' - ',FDEGREE)  as value from degree order by fdescpn, fdegree";
		
		$results = $aobj_context->mobj_db->GetAll($query);
		$results1 = $aobj_context->mobj_db->GetAll($query1);
		$results2 = $aobj_context->mobj_db->GetAll($query2);
		$results3 = $aobj_context->mobj_db->GetAll($query3);
		
		$arr['FEXAMNO']=$results;
		$arr['category']=$results1;
		$arr['FCONSTYPE']=$results2;
		$arr['FDEGREE']=$results3;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 

	}
	
	function displayfeeDetails($aobj_context)
	{
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
		$degree = $aobj_context->mobj_data["degree"];
		$examno = $aobj_context->mobj_data["examno"];
		$feetype = $aobj_context->mobj_data["feetype"];
		$category = $aobj_context->mobj_data["category"];
		
		$query1 = "select distinct mf.ffeecode, mf.fdescpn, ifnull(am.ffee,0) as ffee, 
		ifnull(am.fprfee,0) as fprfee, ifnull(am.fmaxfee,0) as fmaxfee, ifnull(am.frepfee,0) as frepfee, 
		ifnull(am.frepprfee,0) as frepprfee, ifnull(am.fused,'') as fused 
		from masfee mf
		left outer join  admfeestr am on mf.ffeecode = am.fheadcode 
		and am.fdegree = '{$degree}' and am.fexamno = '{$examno}' 
		and am.fcatcode = '{$category}' and am.fconstype = '{$feetype}'
		where length(mf.ffeecode) > 2 order by mf.fsequence";
		
		$results1 = $aobj_context->mobj_db->GetAll($query1);
		$i = 1;
		$j= 0;
		
		
		foreach($results1 as $ak=>$av)
		{
			$details.="<tr>
			<td><input type = 'text' id='head{$j}'  disabled	name = 'rowid' name = 'rowid' value = '{$av['ffeecode']}'/></td>
			<td><input type = 'text' id='headname{$j}' style = 'width:250px'  disabled  value = '{$av['fdescpn']}'/></td>
			<td ><input type = 'text' id='fee{$j}'  style = 'width:50px;text-align:right' value = '{$av['ffee']}' /></td> 
			<td width = '10px'> <input type = 'text' id='feepr{$j}' style = 'width:50px;text-align:right' value = '{$av['fprfee']}'/> <input type = 'hidden' id='feeprh{$j}' style = 'width:50px' value = 'T'/></td>
			<td width = '10px'> <input type = 'text' id='feemax{$j}'style = 'width:50px;text-align:right' value = '{$av['fmaxfee']}'/> </td> 
			<td width = '10px'> <input type = 'text' id='feere{$j}' style = 'width:50px;text-align:right' value = '{$av['frepfee']}' /></td> 
			<td width = '10px'> <input type = 'text' id='feerepr{$j}' style = 'width:50px;text-align:right' value = '{$av['frepprfee']}'/> </td>
			<td width = '10px'> <input type = 'text' id='feeused{$j}' style = 'width:50px;text-align:center'  value = '{$av['fused']}'/> </td> 
			</tr>";
			$j++;
		}
		$arr['details']=$details;
		$arr['totallength']=$j;
		
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
	
	}
	
	function savefeeInformation($aobj_context)
	{
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
		
		$feetype = trim($aobj_context->mobj_data["feetype"]);
		$examno = trim($aobj_context->mobj_data["examno"]);
		$degree = trim($aobj_context->mobj_data["degree"]);
		$category = trim($aobj_context->mobj_data["category"]);
		$fmodule = trim($aobj_context->mobj_data["fmodule"]);
		
		$fheadcode = trim($aobj_context->mobj_data["fheadcode"]);
		$fheadcode = explode(',', $fheadcode);
		
		$ffee=trim($aobj_context->mobj_data["ffee"]);

		$ffee=explode(',', $ffee);

		
		$ffeepr=trim($aobj_context->mobj_data["ffeepr"]);
		$ffeepr=explode(',', $ffeepr);
		
		$ffeemax=trim($aobj_context->mobj_data["ffeemax"]);
		$ffeemax=explode(',', $ffeemax);
		
		$ffeere=trim($aobj_context->mobj_data["ffeere"]);
		$ffeere=explode(',', $ffeere);
		
		$ffeerepr=trim($aobj_context->mobj_data["ffeerepr"]);
		$ffeerepr=explode(',', $ffeerepr);
		
		$fused=trim($aobj_context->mobj_data["fused"]);
		$fused =explode(',', $fused);
		
		$query = "select FHEADCODE as fhead from admfeestr am where am.fdegree = '{$degree}' 
		and am.fexamno = '{$examno}' and am.fcatcode ='{$category}' and am.fconstype = '{$feetype}'";			
		
		$results = $aobj_context->mobj_db->getAll($query);
		
		foreach($results as $key=>$value)
		{
			$strfee.= $value['fhead'].'*';
		}
	
		for($i=0;$i<count($fheadcode);$i++)
		{	
			$a = strrpos($strfee,$fheadcode[$i].'*');
			if($a === false)
			{
				if($ffee[$i] != '0' || $ffeepr[$i] != '0' || $ffeemax[$i] !='0' || $ffeere[$i] != '0' || $ffeerepr[$i] != '0' || $fused[$i] != '')
				{
					$insert = "insert into admfeestr(fyear,fdegree,fexamno,fcombcode,fcatcode,fconstype,fheadcode,ffee,fprfee,fmaxfee,frepfee,frepprfee,fused) 
					  values('2016','{$degree}','{$examno}','{$fmodule}','{$category}','{$feetype}','{$fheadcode[$i]}','{$ffee[$i]}','{$ffeepr[$i]}','{$ffeemax[$i]}','{$ffeere[$i]}','{$ffeerepr[$i]}','{$fused[$i]}')";
					$results = $aobj_context->mobj_db->Execute($insert);
				}
			}
			else
			{
				if($ffee[$i] == '0' && $ffeepr[$i] == '0' && $ffeemax[$i] =='0' && $ffeere[$i] == '0' && $ffeerepr[$i] == '0' && $fused[$i] == '')
				{
					$delete = "delete FROM admfeestr
					where fdegree = '{$degree}' and fexamno='{$examno}' 
					and fconstype='{$feetype}' and fcatcode='{$category}' and  FHEADCODE = '{$fheadcode[$i]}'"; 
					$lobj_update = $aobj_context->mobj_db->Execute($delete);
				}
				else
				{
					$update = " update admfeestr set
					ffee = '{$ffee[$i]}', fprfee = '{$ffeepr[$i]}', fmaxfee = '{$ffeemax[$i]}', frepfee = '{$ffeere[$i]}',
					frepprfee = '{$ffeerepr[$i]}', fused = '{$fused[$i]}'
					where fdegree = '{$degree}' and fexamno='{$examno}' 
					and  fconstype ='{$feetype}' and fcatcode='{$category}' and  FHEADCODE = '{$fheadcode[$i]}'";
					$lobj_update = $aobj_context->mobj_db->Execute($update);
				}
	
			}

		}
		
		if($lobj_update)
		{
			$rdata = "Updated Successfully.";
			print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
			return $rdata;
		}
		else
		{
			$rdata = "No Updation";
			print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));  
			return $rdata;			
		}
		
		
	}
?>