<?php


function addjournal($postdata,$xcrud){

		
	$clientaccount = $postdata->get('account_number');
	$ref = $postdata->get('reference');
	$amount = $postdata->get('ovamount');
	

	
   
$db41 = Xcrud_db::get_instance();
	    $query = "SELECT 
		            typeno
					  
		          FROM systypes
				    
				   WHERE typeid = '15'";
        
        $db41->query($query);
        $out41 = $db41->result();
        foreach($out41 as $output41){
			
			$current=$output41['typeno'];
			
        } 

	$newno = $current + 1;
	
	$date = date('Y-m-d H:i:s');
$postdata->set('transno', $newno);
	$postdata->set('inputdate', $date);
	$postdata->set('entered_date', $date);
	
	//now systypes
	
	
	$db43 = Xcrud_db::get_instance();
	    $query = "UPDATE systypes
		               
					  
		         set  typeno = '" . $newno . "'
				 
				 WHERE typeid = '15'";
        
        $db43->query($query);
	
	
	
    
	
	
	
}

