Added estimate for accounts listing browser, same as the chart of accounts. Requested
[capital-apms-progress.git] / trigger / crtenant.p
blob34db65306f86fa91d3af864c74672c019ef28c79
1 TRIGGER PROCEDURE FOR CREATE OF Tenant.
3 DEF VAR tenant-code LIKE Tenant.TenantCode NO-UNDO.
4 DEF BUFFER LastTenant FOR Tenant.
6 FIND LAST LastTenant NO-LOCK NO-ERROR.
7 IF AVAILABLE(LastTenant) AND LastTenant.TenantCode >= 99999 THEN DO:
8 FIND LAST LastTenant WHERE LastTenant.TenantCode < 9990 NO-LOCK NO-ERROR.
9 IF AVAILABLE(LastTenant) AND LastTenant.TenantCode = 9989 THEN DO:
10 FIND LAST LastTenant WHERE LastTenant.TenantCode < 90000 NO-LOCK NO-ERROR.
11 /* sort this one out when we need to */
12 END.
13 END.
14 tenant-code = IF AVAILABLE LastTenant THEN LastTenant.TenantCode + 1 ELSE 1.
16 ASSIGN Tenant.TenantCode = tenant-code.