alter function dbo.fGetMandeHesab(@fcId int, @orgId int, @tafId bigint, @toDate int) returns decimal(19,4) as  
begin  
 declare @mande decimal(19,4);  
 set @mande=(  
  select sum(isnull(bes,0.0))-sum(isnull(bed,0.0)) from dbo.fAllCodeBedBes(@fcId,@orgId,0 , @toDate) where ID =@tafId  
 )  
 return isnull(@mande,0.0);  
end