
CREATE FUNCTION [dbo].apiHrMinimalSalary
(
	@Data datetime
	
	
)
RETURNS  decimal(16,2)
BEGIN
   DECLARE @res decimal(16,2);
 set @res = ISNULL((
select cast(StrValue as decimal(16,2)) from dbo.CfgAttributes where Node in (
select  top 1 Id from dbo.CfgNodes 
where 
Parent =432
and TRY_CONVERT (datetime, Name,111)<=@Data
ORDER BY  TRY_CONVERT (datetime, Name,111) DESC

  ))
	
	--,*
	 ,0);
	 return @res;
END
