1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Method-Library
4 /*--------------------------------------------------------------------------
15 ------------------------------------------------------------------------*/
18 {inc
/ofc-acct.i
"DEBTORS" "sundry-debtors"}
20 /* _UIB-CODE-BLOCK-END
*/
24 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
26 /* ******************** Preprocessor Definitions
******************** */
30 /* _UIB-PREPROCESSOR-BLOCK-END
*/
35 /* *********************** Procedure Settings
************************ */
37 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
38 /* Settings for
THIS-PROCEDURE
42 Add Fields to
: Neither
43 Other Settings
: INCLUDE-ONLY
45 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
47 /* ************************* Create Window
************************** */
49 &ANALYZE-SUSPEND _CREATE-WINDOW
50 /* DESIGN Window definition
(used by the UIB
)
51 CREATE WINDOW Method-Library
ASSIGN
54 /* END WINDOW DEFINITION
*/
60 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Method-Library
61 /* ************************* Included-Libraries
*********************** */
63 /* _UIB-CODE-BLOCK-END
*/
68 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Method-Library
71 /* *************************** Main Block
*************************** */
73 /* _UIB-CODE-BLOCK-END
*/
77 /* ********************** Internal Procedures
*********************** */
79 &IF DEFINED(EXCLUDE-get-aged-balances) = 0 &THEN
81 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-aged-balances Method-Library
82 PROCEDURE get-aged-balances
:
83 /*------------------------------------------------------------------------------
84 Purpose
: Calculate the aged balances for the current tenant
85 ------------------------------------------------------------------------------*/
86 DEF INPUT PARAMETER tenant-code
AS INT NO-UNDO.
87 DEF INPUT PARAMETER current-month-code
AS INT NO-UNDO.
88 DEF OUTPUT PARAMETER b0
AS DEC NO-UNDO INITIAL 0.
89 DEF OUTPUT PARAMETER b1
AS DEC NO-UNDO INITIAL 0.
90 DEF OUTPUT PARAMETER b2
AS DEC NO-UNDO INITIAL 0.
91 DEF OUTPUT PARAMETER b3
AS DEC NO-UNDO INITIAL 0.
93 DEF VAR i
AS INT NO-UNDO.
94 DEF BUFFER Trn
FOR AcctTran.
95 DEF BUFFER m0
FOR Month.
96 DEF BUFFER m1
FOR Month.
97 DEF BUFFER m2
FOR Month.
98 DEF BUFFER m3
FOR Month.
100 FIND m0
WHERE m0.MonthCode
= current-month-code
NO-LOCK.
101 FIND LAST m1
WHERE m1.MonthCode
< m0.MonthCode
NO-LOCK.
102 FIND LAST m2
WHERE m2.MonthCode
< m1.MonthCode
NO-LOCK.
103 FIND LAST m3
WHERE m3.MonthCode
< m2.MonthCode
NO-LOCK.
105 FOR EACH Trn
NO-LOCK WHERE Trn.EntityType
= 'T'
106 AND Trn.EntityCode
= tenant-code
107 AND Trn.AccountCode
= sundry-debtors
108 /* AND Trn.MonthCode
<= current-month-code
*/
109 AND Trn.ClosedState
<> "F":
110 IF Trn.MonthCode
<= m3.MonthCode
THEN
111 b3
= b3
+ Trn.Amount.
112 ELSE IF Trn.MonthCode
= m2.MonthCode
THEN
113 b2
= b2
+ Trn.Amount.
114 ELSE IF Trn.MonthCode
= m1.MonthCode
THEN
115 b1
= b1
+ Trn.Amount.
117 b0
= b0
+ Trn.Amount.
122 /* _UIB-CODE-BLOCK-END
*/