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


Current Path : /proc/thread-self/root/var/www/html/acu/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/acu/src/transaction-series.php

<?php
function getTransactionSeriesModule($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
	  	
	 $get_module_name="select distinct ref_s_user_schema_code as internal_code,sus.module_name as type from s_user_schema_elements us
		 inner join s_ref_type r on r.internal_code=data_type
		inner join s_user_schema sus on sus.internal_code=ref_s_user_schema_code
		where r.value='Auto Increment'";
	    $get_module_name_obj=$aobj_context->mobj_db->GetAll($get_module_name); 		
		$arr[0]=$get_module_name_obj;
		
	    include_once("getmoduledetails.php");
	    $arr['links_data']= getLinks($aobj_context,"Transaction Series Setup");	
		
		 if( count($get_module_name_obj) != 0)
		 echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
		 else 
		  echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
} 
function getTransactionSeriesModuleElements($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
	$module_id = $aobj_context->mobj_data["module_id"]; 	
	 $get_module_ele_name="select  us.internal_code as internal_code,us.name as type from s_user_schema_elements us
		 inner join s_ref_type r on r.internal_code=data_type
		 where r.value='Auto Increment' and ref_s_user_schema_code={$module_id }";
			 $get_module_ele_name_obj=$aobj_context->mobj_db->GetAll($get_module_ele_name);
 	 
			 if( $get_module_ele_name_obj)
			 echo $aobj_context->mobj_output->ToJSONEnvelope($get_module_ele_name_obj,0,"success");
			 else 
			  echo $aobj_context->mobj_output->ToJSONEnvelope($get_module_ele_name_obj,-1,"success");
} 

function saveTransactionSeries($aobj_context)
{
 
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
	$internal_code=trim($aobj_context->mobj_data["internal_code"]);
	$ref_module_code=trim($aobj_context->mobj_data["ref_module_code"]);
	$ref_module_element_code=trim($aobj_context->mobj_data["ref_module_element_code"]);
	$series_name=trim($aobj_context->mobj_data["series_name"]);
	$prefix=trim($aobj_context->mobj_data["prefix"]);
	$starting_no=trim($aobj_context->mobj_data["starting_no"]);
	$ending_no=trim($aobj_context->mobj_data["ending_no"]);
	$last_no=trim($aobj_context->mobj_data["last_no"]);
	$starting_date=trim($aobj_context->mobj_data["starting_date"]);
	$ending_date=trim($aobj_context->mobj_data["ending_date"]);
	 
	if($internal_code==0)
	{
	$get_dup="select count(*)  as s_count from transaction_series_prefix 
				where
				ref_module_code={$ref_module_code}
				and ref_module_element_code={$ref_module_element_code}
				and  prefix='{$prefix}'
				and 
				( '{$starting_date}' between starting_date and ending_date
				or '{$ending_date}' between starting_date and ending_date ) ";
		$lobj_get_dup = $aobj_context->mobj_db->GetRow($get_dup); 	
		if($lobj_get_dup['s_count']>0)
		{
			$rdata = " Prefix {$prefix} allready exstis for the combination";
				        print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"failure"));
				        return $rdata;
		}
	}
	
	if($internal_code>0)
	{	
		$delete_data="delete from transaction_series_prefix where internal_code={$internal_code}";
		$lobj_delete_datad = $aobj_context->mobj_db->Execute($delete_data); 
	}	
					$insert_qry="insert into transaction_series_prefix(
						ref_module_code,
						ref_module_element_code,
						series_name,
						prefix,
						starting_no,
						ending_no,
						last_no,
						starting_date,
						ending_date) values
				 		(
						{$ref_module_code},
						{$ref_module_element_code},
						'{$series_name}',
						'{$prefix}',
						'{$starting_no}',
						'{$ending_no}',
						'{$last_no}',
						'{$starting_date}',
						'{$ending_date}')";
						$lobj_insert_qry = $aobj_context->mobj_db->Execute($insert_qry);
						
					// echo $insert_qry;	
				    if($lobj_insert_qry)
				    {
				        $rdata = "Module Series Details Inserted Successfully.";
				        print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
				        return $rdata;
				     }
				    else
				    {
				        $rdata = "insertion Failed.";
				        print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));  
						return $rdata;			
				    }    
		          
}
function getTransactionSeries($aobj_context)
{
 
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
	$internal_code=trim($aobj_context->mobj_data["internal_code"]);
	$get_details="select tsp.internal_code ,
		 ref_module_code,ref_module_element_code,
		 series_name,
		 prefix,
		 starting_no,
		 ending_no,
		last_no,
		DATE_FORMAT(starting_date,'%d/%m/%Y') as starting_date,
		DATE_FORMAT( ending_date,'%d/%m/%Y')  as ending_date
		from transaction_series_prefix tsp 
		where internal_code={$internal_code} and starting_date<= current_date() and ending_date>=current_date()";
			$lobj_details = $aobj_context->mobj_db->getRow($get_details); 
		 if( $lobj_details)
		  echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_details,0,"success");
}
?>