DROP FUNCTION IF EXISTS dbo.fn_GetChulpanReestrCost;
CREATE FUNCTION dbo.fn_GetChulpanReestrCost(ReestrID UUID)
	RETURNS Decimal(10, 2) AS
 $$
 Begin
	return 
	(
		select sum(ri.TARIF)
		from akuz.T_CHULPAN_REESTR_ITEM ri
		where ri.ChulpanReestr = $1
	);
END $$
language plpgsql stable;