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


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/category.php

<?php

function savecategoryMaster($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$add_edit=trim($aobj_context->mobj_data["add_edit"]);
	$catcode=trim($aobj_context->mobj_data["catcode"]);
	$catdesc=trim($aobj_context->mobj_data["catdesc"]);
	
	if($add_edit == 'Add')
	{
		$checkRecord = "select * from mascat where FCATCODE = '{$catcode}'";
		$lobj_checkRecord = $aobj_context->mobj_db->getAll($checkRecord);
		
		if(count($lobj_checkRecord) > 0 )
		{
			$error_msg = 'Category code '.$catcode.' already exist';
			echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"failure"); 
			return;		
		}
		else
		{
			$save_category = "insert into mascat(FCATCODE,FCATDESC) values('{$catcode}','{$catdesc}')";
			$lobj_save_category = $aobj_context->mobj_db->Execute($save_category);
		
			if($lobj_save_category)
			{
				$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_category = "Update mascat set fcatcode = '{$catcode}',fcatdesc='{$catdesc}' where fcatcode = '{$catcode}'";
		$lobj_update_category = $aobj_context->mobj_db->Execute($update_category);
		
		if($lobj_update_category)
		{
			$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 ViewcategoryMasterDetails($aobj_context)
	{
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
		session_start();
		$srchfield1 = trim($aobj_context->mobj_data["srchfield1"]);
		$srchfield2 = trim($aobj_context->mobj_data["srchfield2"]);
		if($srchfield1 != '')
			$srchcond1 ="FCATCODE like '{$srchfield1}%' and";
		else
			$srchcond1 ='';
		
		if($srchfield2 != '')
			$srchcond2 =" FCATDESC like '{$srchfield2}%' and";
		else
			$srchcond2 =''; 
		
		$qry="select FCATCODE, FCATDESC from mascat 
		where {$srchcond1} {$srchcond2} ifnull(FDELETED,'') <> 'T'";
		$lobjcat = $aobj_context->mobj_db->GetAll($qry);				 

		if($lobjcat)	
		{
			echo $aobj_context->mobj_output->ToJSONEnvelope($lobjcat,0,"success"); 
		}
		else
		{
			$err_data="No records found"; 	 	
			echo $aobj_context->mobj_output->ToJSONEnvelope($err_data,-1,"Failure");
		}
	}

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

	$get_category_details = "select * from mascat where fcatcode = '{$catcode}'";	 
 
	$lobj_get_category_details = $aobj_context->mobj_db->getRow($get_category_details);
	
	
	if(lobj_get_category_details )
	{
		echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_category_details,0,"success"); 
		return;
	}
	else 
	{
		$error_msg = 'no details found ';
		echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"Disabled"); 
		return;		
	}
}

function disableCategoryRecord($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);
	for($k=0;$k<count($delete_arr_data);$k++)
	{	   
		$disable_category_record = 	"	UPDATE mascat SET FDELETED='T' 
		WHERE  fcatcode='{$delete_arr_data[$k]->catcode}' ";	

		$lobj_rs = $aobj_context->mobj_db->Execute($disable_category_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;
	}
}
?>