<?php


function displaydepartment($postdata,$xcrud){
	
	$accnum = $postdata->get('account_number');
   
$db40 = Xcrud_db::get_instance();
	    $query = "SELECT 
		             departmentid
		               
					  
		          FROM debtoraccount
				    
				   WHERE account_number = '" . $accnum . "'";
        
        $db40->query($query);
        $out40 = $db40->result();
        foreach($out40 as $output40){
			
			$id=$output40['departmentid'];
			
			$db41 = Xcrud_db::get_instance();
	    $query = "SELECT 
		             departmentname
		               
					  
		          FROM department
				    
				   WHERE departmentid = '" . $id . "'";
        
        $db41->query($query);
        $out41 = $db41->result();
        foreach($out41 as $output41){
			$department=$output41['departmentname'];
			
			
			
            
        } 
			
            
        } 

$postdata->set('department', $department);
	
}
