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


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

<?php

	function getfeeInformation($aobj_context)
	{
		$query1="select FCATEGORY as internal_code,FCATEGORY as value from category order by FCATEGORY";
		$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, date_format(am.fadmfeesdate,'%d/%m/%Y') as fromdate,
		date_format(am.fadmfeeedate,'%d/%m/%Y') as todate 
		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";
		//var_dump($query1);
		
		$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:150px'  disabled  value = '{$av['fdescpn']}'/></td>
				<td ><input type = 'text' id='fee{$j}'  style = 'width:45px;text-align:right' value = '{$av['ffee']}' /></td> 
				<td width = '10px'> <input type = 'text' id='feepr{$j}' style = 'width:45px;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:45px;text-align:right' value = '{$av['fmaxfee']}'/> </td> 
				<td width = '10px'> <input type = 'text' id='feere{$j}' style = 'width:45px;text-align:right' value = '{$av['frepfee']}' /></td> 
				<td width = '10px'> <input type = 'text' id='feerepr{$j}' style = 'width:45px;text-align:right' value = '{$av['frepprfee']}'/> </td>
				<td width = '150px'> <input type = 'text' id='fromdate{$j}' onkeydown = 'dmydateformat(event,this.id)'   maxlength = 10 style = 'width:80px;text-align:left;float:left;' placeholder = 'dd/mm/yyy' value = '{$av['fromdate']}'/></td> 
				<td width = '10px'> <input type = 'text' id='todate{$j}' onkeydown = 'dmydateformat(event,this.id)'   style = 'width:100px;text-align:left' placeholder = 'dd/mm/yyy'  value = '{$av['todate']}'/> 
			</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);
		
		$fromdate = trim($aobj_context->mobj_data["fromdate"]);
		$fromdate = explode(',', $fromdate);
		
		$todate = trim($aobj_context->mobj_data["todate"]);
		$todate = explode(',', $todate);
		
		$query = "select FHEADCODE as fhead from admfeestr am where am.fdegree = '{$degree}' 
		and am.fexamno = '{$examno}' and am.fcatcode ='{$category}' and am.fconstype = '{$feetype}'";			
		//var_dump($query);
		$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].'*');
			//var_dump($strfee);
			//var_dump($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, fadmfeesdate, fadmfeeedate) 
								values('2016','{$degree}','{$examno}','{$fmodule}','{$category}','{$feetype}','{$fheadcode[$i]}','{$ffee[$i]}','{$ffeepr[$i]}','{$ffeemax[$i]}','{$ffeere[$i]}','{$ffeerepr[$i]}',
								date_format(str_to_date('{$fromdate[$i]}','%d/%m/%Y'),'%Y-%m-%d'), date_format(str_to_date('{$todate[$i]}','%d/%m/%Y'),'%Y-%m-%d'))";
								var_dump($insert);
					$results = $aobj_context->mobj_db->Execute($insert);
					var_dump($results);
				}
			}
			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]}', fadmfeesdate = date_format(str_to_date('{$fromdate[$i]}','%d/%m/%Y'),'%Y-%m-%d'), fadmfeeedate = date_format(str_to_date('{$todate[$i]}','%d/%m/%Y'),'%Y-%m-%d')
								where fdegree = '{$degree}' and fexamno='{$examno}' 
								and  fconstype ='{$feetype}' and fcatcode='{$category}' and  FHEADCODE = '{$fheadcode[$i]}'";
								//var_dump($update);
					$lobj_update = $aobj_context->mobj_db->Execute($update);
				}
	
			}

		}
		
		if($lobj_update || $results)
		{
			$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;			
		}

	}
?>