<?php


function addsupptrans($postdata,$xcrud){

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

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

function addsupptrans1($postdata,$xcrud){

		
	$amount = $postdata->get('ovamount');
	
//$type = $postdata->get('type');
	
   
$db41 = Xcrud_db::get_instance();
	    $query = "SELECT 
		            typeno
					  
		          FROM systypes
				    
				   WHERE typeid = '22'";
        
        $db41->query($query);
        $out41 = $db41->result();
        foreach($out41 as $output41){
			
			$current=$output41['typeno'];
			
        } 

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