DROP FUNCTION IF EXISTS fn_GetRegisterTotalCost;
CREATE FUNCTION fn_GetRegisterTotalCost("RegisterID" UUID)
RETURNS decimal(31, 10) AS
 $$
Begin
	return
	(
		select sum(STO) from AKUZ.T_REGISTER_ITEM where RegisterMain = "RegisterID" and RegisterItemInMain is null
	);
END $$
language plpgsql stable;