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


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

<?php
function saveOrganisationMaster($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$add_edit=trim($aobj_context->mobj_data["add_edit"]);
	$orgcode=trim($aobj_context->mobj_data["orgcode"]);
	$orgname=trim($aobj_context->mobj_data["orgname"]);
	$contact=trim($aobj_context->mobj_data["contact"]);
	$add1=trim($aobj_context->mobj_data["add1"]);
	$add2=trim($aobj_context->mobj_data["add2"]);
	$add3=trim($aobj_context->mobj_data["add3"]);
	$add4=trim($aobj_context->mobj_data["add4"]);
	$email=trim($aobj_context->mobj_data["email"]);
	
	if($add_edit == 'Add')
	{
	$checkRecord = "select * from masorg where FORGCODE = '{$orgcode}'";
	$lobj_checkRecord = $aobj_context->mobj_db->getAll($checkRecord);
	
	if(count($lobj_checkRecord) > 0 )
	{
		$error_msg = 'Organisation code '.$orgcode.' already exist';
		echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"failure"); 
		return;		
	}
	else
	{
		$save_Organisation = "insert into masorg(FORGCODE,FORGNAME,FADD1,FADD2,FADD3,FADD4,FCONTACT,FEMAIL)
		values('{$orgcode}','{$orgname}','{$add1}','{$add2}','{$add3}','{$add4}','{$contact}','{$email}')";
		$lobj_save_Organisation = $aobj_context->mobj_db->Execute($save_Organisation);
		
		if($lobj_save_Organisation)
		{
			$success_msg = 'Updated successfully.';
			echo $aobj_context->mobj_output->ToJSONEnvelope($success_msg,0,"success"); 
			return;
		}
		else 
		{
			$error_msg = 'Updation failed';
			echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"failure"); 
			return;		
		}
	}	
	}
	else if($add_edit == 'Edit')
	{
		$update_Organisation = "update masorg set FORGNAME = '{$orgname}',FCONTACT='{$contact}',FADD1='{$add1}',FADD2='{$add2}',
		FADD3='{$add3}',FADD4='{$add4}', FEMAIL='{$email}'
		where FORGCODE = '{$orgcode}'";
		$lobj_update_Organisation = $aobj_context->mobj_db->Execute($update_Organisation);
		
		if($lobj_update_Organisation)
		{
			
			$success_msg = 'Updated successfully';
			echo $aobj_context->mobj_output->ToJSONEnvelope($success_msg,0,"success"); 
			return;
		}
		else 
		{
			$error_msg = 'Updation failed';
			echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"failure"); 
			return;		
		}
	}
}
function getOrganisationCodeDetails($aobj_context)
{

	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 	
	session_start();   //and FDELETED = 'F'
	$orgcode =$aobj_context->mobj_data["orgcode"];  

	$get_Organisation_details = "select * from masorg 
	where FORGCODE = '{$orgcode}'";	 
	$lobj_get_Organisation_details = $aobj_context->mobj_db->getRow($get_Organisation_details);
	if(count($lobj_get_Organisation_details)  > 0)
	{
		echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_Organisation_details,0,"success"); 
		return;
	}
	else 
	{
		$error_msg = 'no details found ';
		echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"Disabled"); 
		return;		
	}
}
function disableOrganisationRecord($aobj_context)
{

	include_once("/JSON.php"); 
	$json = new Services_JSON();
	
	$lstr_param = stripslashes($aobj_context->mobj_data["delete_arr"]);
	$mobj_jsondata = $json->decode($lstr_param);
	$delete_arr_data = get_object_vars($mobj_jsondata);
	$supcodes = '';
	for($k=0;$k<count($delete_arr_data);$k++)
	{	   
		$orgcodes .= $delete_arr_data[$k]->OrganisationCode.
		$disable_Organisation_record = "UPDATE masorg SET FDELETED='T' 
		WHERE FORGCODE='{$delete_arr_data[$k]->OrganisationCode}' ";	
		$lobj_rs = $aobj_context->mobj_db->Execute($disable_Organisation_record);
	}
	if($lobj_rs) 
	{			
		echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_rs,0,"success"); 
		return;
	}	
	else
	{			
		echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_rs,-1,"Failure");
		return;
	}
}	
?>