<?php


function displaydepartment($postdata,$xcrud){
	
include('https://www.ebusinescloudservers.com/evergreenerp/includes/session.inc');

//include('includes/header.inc');
	
	$clientid= $postdata->get('patrol_location');
   
$db40 = Xcrud_db::get_instance();
	    $query = "SELECT 
		             department
		               
					  
		          FROM guardforceclient
				    
				   WHERE clientid = '" . $clientid . "'";
        
        $db40->query($query);
        $out40 = $db40->result();
        foreach($out40 as $output40){
			
			$id=$output40['department'];
			
			$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);
	
	$enddate= $postdata->get('end_date');
	
	$endtime= date('H:i:s',(strtotime($enddate)));
	
	if ($endtime > '08:00:00'){
		
		$xcrud->set_exception('end_date','Cant extend hours after 8a.m.Restricted!','success'); 
	}
	
	$postdata->set('lastupdate', now());
	
	$postdata->set('last_modified_by', $userid);
	
	
	
}

function customername($postdata,$xcrud){
	
	$debtorno= $postdata->get('debtorno');
   
$db40 = Xcrud_db::get_instance();
	    $query = "SELECT 
		             name
		               
					  
		          FROM debtorsmaster
				    
				   WHERE debtorno = '" . $debtorno . "'";
        
        $db40->query($query);
        $out40 = $db40->result();
        foreach($out40 as $output40){
			
			$name=$output40['name'];
			
				
            
        } 

$postdata->set('customername', $name);
	
}

function employeename($postdata,$xcrud){
	
	$employeeid= $postdata->get('employeeid');
   
$db40 = Xcrud_db::get_instance();
	    $query = "SELECT 
		             full_name
		               
					  
		          FROM debtorsmaster
				    
				   WHERE debtorno = '" . $employeeid . "'";
        
        $db40->query($query);
        $out40 = $db40->result();
        foreach($out40 as $output40){
			
			$fullname=$output40['full_name'];
			
				
            
        } 

$postdata->set('employees', $fullname);
	
}