Add a new UserGroupRight to control access to open/close months.
[capital-apms-progress.git] / trigger / a-ndcbch.p
blobf4d848426824bc2834d49519856320f344c8bceb
1 TRIGGER PROCEDURE FOR ASSIGN OF NewDocument.BatchCode.
3 IF NewDocument.DocumentCode > 0 THEN . ELSE
4 DO:
6 DEF BUFFER LastDoc FOR NewDocument.
7 DEF VAR doc-code AS INT NO-UNDO.
9 FIND LAST LastDoc WHERE LastDoc.BatchCode = NewDocument.BatchCode
10 NO-LOCK NO-ERROR.
12 doc-code = IF AVAILABLE LastDoc THEN
13 LastDoc.DocumentCode + 1 ELSE 1.
15 ASSIGN NewDocument.DocumentCode = doc-code.
17 END.