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 : 52.15.173.197


Current Path : /var/www/oasis/src/
Upload File :
Current File : /var/www/oasis/src/affliation_fee.php

<?php

function loaddeggrpaff($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $id    = stripslashes($aobj_context->mobj_data["id"]);

    $query = "SELECT DISTINCT fdeggrp, fafffine  
		FROM affliation_fee ,control";
    $lobj_get_data = $aobj_context->mobj_db->GetAll($query);

  if($lobj_get_data)
	{	
		echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_data,0,"success"); 
		return;
	}
	else
	{
		$data = "No data found..!";
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
		return;
	}
}


function loadaffoptions($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $fdeggrp    = stripslashes($aobj_context->mobj_data["fdeggrp"]);

    $select_qry = "SELECT DISTINCT faffid,faffihead FROM affliation_fee WHERE fdeggrp ='{$fdeggrp}'"; 
   // var_dump($select_qry);
	$cntrresults = $aobj_context->mobj_db->GetAll($select_qry);

	

  if($cntrresults)
	{
		echo $aobj_context->mobj_output->ToJSONEnvelope($cntrresults,0,"success"); 
		return;
	}
	else
	{
		$data = "No affliation found..!";
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
		return;
	}
}


function loadtabaffi($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $faffid    = stripslashes($aobj_context->mobj_data["faffid"]);

    $select_qry = "SELECT * FROM affliation_fee WHERE faffid = '{$faffid}'"; 
   // var_dump($select_qry);
	$cntrresults = $aobj_context->mobj_db->GetAll($select_qry);

	

    if($cntrresults)
	{
		echo $aobj_context->mobj_output->ToJSONEnvelope($cntrresults,0,"success"); 
		return;
	}
	else
	{
		$data = "No affliation found..!";
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
		return;
	}
}

function saveafflifee($aobj_context){
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$sel_tab    = stripslashes($aobj_context->mobj_data["sel_tab"]);
	$principal_name    = strtoupper(stripslashes($aobj_context->mobj_data["principal_name"]));
	$mobileno    = stripslashes($aobj_context->mobj_data["mobileno"]);
	$aisue_code    = stripslashes($aobj_context->mobj_data["aisue_code"]);
	$aisue_user_id    = stripslashes($aobj_context->mobj_data["aisue_user_id"]);
	$sel_tab = json_decode($sel_tab, true);
	// var_dump($principal_name,$mobileno);
	



	$sum = 0;

	foreach($sel_tab as $k => $v){
		$sum += $v['ftotal'];
	}

	$query = "SELECT  fafffine  FROM control";
	$res = $aobj_context->mobj_db->GetRow($query);
	$fafffine = $res['fafffine'];
	$total = $sum+$fafffine;

	$select_qry = "INSERT INTO affliation_sum (fprincipalname,fcollcode,fmobileno,faisuecode,faisueid,ffine,ftotalsum,fcreatedate,fapplastdate)
	VALUES('{$principal_name}','{$_SESSION['collcode']}','{$mobileno}','{$aisue_code}','{$aisue_user_id}','{$fafffine}','{$total}',now(),now())"; 
	// var_dump($select_qry);
	 $result = $aobj_context->mobj_db->Execute($select_qry);
	 $last_id = $aobj_context->mobj_db->Insert_ID();

	if($result)
	{
		$values = '';
		foreach ($sel_tab as $k => $v) {
			
				$values .= "('" . $last_id . "', '" . $v['faffid'] . "', '" . $v['ffeeid'] . "', '" . $v['ffeehead'] . "',
				'" . $v['ffees'] . "','" . $v['fgst'] . "','" . $v['ftotal'] . "',now()),";       
		}

		//$values .= "('" . $last_id . "', '" . $v['faffid'] . "', '" . $v['ffeeid'] . "', '01 Fine',
			//	'" . $fafffine . "','" . $v['fgst'] . "','" . $v['ftotal'] . "',now())";  

		$values = rtrim($values, ',');
	  
	  $query = "INSERT INTO affliation_det (fsaffid,faffid,ffeeid,ffeehead,ffees,fgst,ftotal,fcreatedate)
	  VALUES " . $values . " ";
		$result = $aobj_context->mobj_db->Execute($query);
		//var_dump($query);
		if ($result) {
			$arr['msg'] = 'Successfully Updated';
			$arr['appno'] = $last_id;
			echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
			return;
		} else {
			$arr['msg'] = 'Insertion / Updation Failed';
			echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
			return;
		}

	}else
	{
			$arr['msg'] = 'Insertion / Updation Failed';
			echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
			return;
	}
	
}


function viewafflifee($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    // $faffid    = stripslashes($aobj_context->mobj_data["faffid"]);

    $select_qry = "SELECT fsaffid, fprincipalname, fcollcode, fmobileno, faisuecode, faisueid, ftotalsum, 
	DATE_FORMAT(fcreatedate,'%d/%m/%Y') AS fcreatedate, IFNULL(fpaymentstatus,'') AS fpaymentstatus,
	ifnull(fapplastdate,0) >=date_format(now(),'%Y-%m-%d') as last_date 
	FROM affliation_sum where fcollcode ='{$_SESSION['collcode']}'"; 
   // var_dump($select_qry);
	$cntrresults = $aobj_context->mobj_db->GetAll($select_qry);

  if($cntrresults)
	{
		echo $aobj_context->mobj_output->ToJSONEnvelope($cntrresults,0,"success"); 
		return;
	}
	else
	{
		$data = "No affliation found..!";
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
		return;
	}
}





?>