-- Slice 8b-4d · GL Close perm
INSERT INTO user_groups_perms (user_group_id, controller_allowed, action_allowed, created_by, created_on)
SELECT g.c0d, 'ServiceRequisitions', 'closeAj', 0, NOW()
FROM user_groups g
WHERE g.user_group_name IN ('Accountant','Finance Manager','Administrator')
  AND NOT EXISTS (SELECT 1 FROM user_groups_perms p WHERE p.user_group_id = g.c0d AND p.controller_allowed = 'ServiceRequisitions' AND p.action_allowed = 'closeAj');
