1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r2 GUI
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
6 Purpose
: Calculate the outgoings budget for a tenant
8 Syntax
: calcoutg.r
( TenantCode
, OUTPUT OutgoingsBudgetPA
)
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
*/
25 /* *********************** Procedure Settings
************************ */
27 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
28 /* Settings for
THIS-PROCEDURE
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
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"
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.
77 TotalOutgoings
= total.
79 /* _UIB-CODE-BLOCK-END
*/