Add blank column, rename column.
[capital-apms-progress.git] / process / calcoutg.p
blobfb4901f94b7b135aec2a4f4111f93542b0633192
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r2 GUI
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 File : calcoutg.p
6 Purpose : Calculate the outgoings budget for a tenant
8 Syntax : calcoutg.r( TenantCode, OUTPUT OutgoingsBudgetPA )
10 Description :
12 Author(s) :
13 Created :
14 Notes :
15 ------------------------------------------------------------------------*/
17 DEF INPUT PARAMETER tenant-code LIKE Tenant.TenantCode NO-UNDO.
18 DEF OUTPUT PARAMETER TotalOutGoings AS DEC NO-UNDO.
20 /* _UIB-CODE-BLOCK-END */
21 &ANALYZE-RESUME
25 /* *********************** Procedure Settings ************************ */
27 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
28 /* Settings for THIS-PROCEDURE
29 Type: Procedure
30 Allow:
31 Frames: 0
32 Add Fields to: Neither
33 Other Settings: CODE-ONLY COMPILE
35 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
37 /* ************************* Create Window ************************** */
39 &ANALYZE-SUSPEND _CREATE-WINDOW
40 /* DESIGN Window definition (used by the UIB)
41 CREATE WINDOW Procedure ASSIGN
42 HEIGHT = .15
43 WIDTH = 40.
45 &ANALYZE-RESUME
50 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
53 /* *************************** Main Block *************************** */
54 DEF VAR total AS DEC INIT 0 NO-UNDO.
56 FOR EACH TenancyLease WHERE TenancyLease.TenantCode = tenant-code
57 AND TenancyLease.LeaseStatus <> "PAST"
58 NO-LOCK:
60 total = total + TenancyLease.OutgoingsBudget.
63 FOR EACH TenancyOutgoing OF TenancyLease NO-LOCK:
65 FIND FIRST PropertyOutGoing WHERE
66 PropertyOutgoing.PropertyCode = TenancyLease.PropertyCode AND
67 PropertyOutGoing.AccountCode = TenancyOutGoing.AccountCode NO-LOCK NO-ERROR.
69 total = total + IF FixedAmount <> 0 THEN FixedAmount ELSE
70 IF AVAILABLE PropertyOutGoing THEN
71 ROUND( PropertyOutGoing.BudgetAmount * ( TenancyOutGoing.Percentage / 100 ), 2 ) ELSE 0.
73 END.
76 END.
77 TotalOutgoings = total.
79 /* _UIB-CODE-BLOCK-END */
80 &ANALYZE-RESUME