1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 Report
: Current Income and Budgetted Expenditure
6 Author
: Andrew McMillan
8 ------------------------------------------------------------------------*/
10 DEF INPUT PARAMETER report-options
AS CHAR NO-UNDO.
12 DEF VAR preview
AS LOGI
NO-UNDO INIT No.
13 DEF VAR property-1
AS INT NO-UNDO INIT 0.
14 DEF VAR property-n
AS INT NO-UNDO INIT 99999.
15 DEF VAR selection-style
AS CHAR NO-UNDO.
18 DEF VAR property-code
AS INT NO-UNDO.
19 DEF VAR property-name
AS CHAR NO-UNDO.
21 DEF VAR user-name
AS CHAR NO-UNDO.
22 DEF VAR timeStamp
AS CHAR FORMAT "X(44)" NO-UNDO.
24 DEF VAR pr-line
AS CHAR INIT "" NO-UNDO.
/* used everywhere to hold print line
*/
26 DEF VAR title-font
AS CHAR NO-UNDO INITIAL "proportional,helv,point,12,bold".
27 DEF VAR time-font
AS CHAR NO-UNDO INITIAL "proportional,helv,point,6,normal".
28 DEF VAR break1-font
AS CHAR NO-UNDO INITIAL "proportional,helv,point,12,lpi,7,bold".
29 DEF VAR break2-font
AS CHAR NO-UNDO INITIAL "proportional,helv,point,8,bold".
30 DEF VAR base-font
AS CHAR NO-UNDO INITIAL "fixed,courier,cpi,17,lpi,8.5,bold".
34 /* _UIB-CODE-BLOCK-END
*/
38 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
40 /* ******************** Preprocessor Definitions
******************** */
42 &Scoped-define PROCEDURE-TYPE Procedure
46 /* _UIB-PREPROCESSOR-BLOCK-END
*/
51 /* *********************** Procedure Settings
************************ */
53 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
54 /* Settings for
THIS-PROCEDURE
58 Add Fields to
: Neither
59 Other Settings
: CODE-ONLY
COMPILE
61 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
63 /* ************************* Create Window
************************** */
65 &ANALYZE-SUSPEND _CREATE-WINDOW
66 /* DESIGN Window definition
(used by the UIB
)
67 CREATE WINDOW Procedure
ASSIGN
70 /* END WINDOW DEFINITION
*/
76 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
77 /* ************************* Included-Libraries
*********************** */
79 {inc
/method
/m-txtrep.i
}
81 /* _UIB-CODE-BLOCK-END
*/
86 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
89 /* *************************** Main Block
*************************** */
90 {inc
/username.i
"user-name"}
91 timeStamp
= STRING( TODAY, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
93 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
95 RUN pclrep-start
( preview
, "reset,portrait,tm,2,a4,lm,6,courier,cpi,18,lpi,9").
97 IF selection-style
= "OneProperty" THEN RUN for-one-property.
103 /* _UIB-CODE-BLOCK-END
*/
107 /* ********************** Internal Procedures
*********************** */
109 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-property Procedure
110 PROCEDURE each-property
:
111 /*------------------------------------------------------------------------------
112 Purpose
: Print the outgoings budgets for the property
113 ------------------------------------------------------------------------------*/
114 DEF INPUT PARAMETER property-code
AS INT NO-UNDO.
116 DEF VAR need-header
AS LOGI
INITIAL No
NO-UNDO.
117 DEF VAR pog-total
AS DECIMAL INITIAL 0 NO-UNDO.
118 DEF VAR account-name
AS CHAR NO-UNDO.
120 FOR EACH PropertyOutgoing
OF Property
NO-LOCK:
121 IF need-header
THEN DO:
122 RUN pclrep-line
( break1-font
, STRING( property-code
, "99999") + " - " + property-name
).
123 RUN pclrep-line
( break1-font
, "" ).
126 pog-total
= pog-total
+ PropertyOutgoing.BudgetAmount.
127 FIND ChartOfAccount
OF PropertyOutgoing
NO-LOCK NO-ERROR.
128 account-name
= (IF AVAILABLE(ChartOfAccount
) THEN ChartOfAccount.Name
ELSE "* * * Unknown * * *").
129 RUN pclrep-line
( base-font
, STRING(PropertyOutgoing.AccountCode
, ">>>9999.99") + " "
130 + STRING( account-name
, "X(50)") + " "
131 + STRING( PropertyOutgoing.BudgetAmount
, ">>,>>>,>>9.99CR")).
134 IF NOT(need-header
) THEN DO:
135 RUN pclrep-line
( base-font
, FILL(" ", 64) + FILL("-", 13)).
136 RUN pclrep-line
( base-font
, FILL(" ", 64) + STRING(pog-total
, ">>,>>>,>>9.99CR")).
137 RUN pclrep-page-break.
142 /* _UIB-CODE-BLOCK-END
*/
146 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE for-each-property Procedure
147 PROCEDURE for-each-property
:
148 /*------------------------------------------------------------------------------
150 ------------------------------------------------------------------------------*/
152 FOR EACH Property
WHERE Property.PropertyCode
>= property-1
153 AND Property.PropertyCode
<= property-n
154 AND Property.Active
NO-LOCK:
155 property-code
= Property.PropertyCode.
156 property-name
= Property.Name.
157 RUN each-property
( property-code
).
162 /* _UIB-CODE-BLOCK-END
*/
166 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE for-one-property Procedure
167 PROCEDURE for-one-property
:
168 /*------------------------------------------------------------------------------
170 ------------------------------------------------------------------------------*/
172 FIND Property
WHERE Property.PropertyCode
= property-1
NO-LOCK NO-ERROR.
173 IF NOT AVAILABLE Property
THEN DO:
174 RUN pclrep-line
( base-font
+ ",bold", "Property " + STRING(property-1
) + " not on file!").
178 property-code
= Property.PropertyCode.
179 property-name
= Property.Name.
180 RUN each-property
( property-code
).
184 /* _UIB-CODE-BLOCK-END
*/
188 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-footer Procedure
189 PROCEDURE inst-page-footer
:
190 /*------------------------------------------------------------------------------
191 Purpose
: Print any page footer
192 ------------------------------------------------------------------------------*/
196 /* _UIB-CODE-BLOCK-END
*/
200 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-header Procedure
201 PROCEDURE inst-page-header
:
202 /*------------------------------------------------------------------------------
203 Purpose
: Print any page header
204 ------------------------------------------------------------------------------*/
206 RUN pclrep-line
( "univers,Point,6,bold,Proportional", TimeStamp
).
207 RUN pclrep-line
( "", "" ).
208 RUN pclrep-line
( "univers,Point,12,bold,Proportional",
209 "Property Outgoings Budgets for P"
210 + TRIM(STRING(property-code
))
213 RUN pclrep-line
( "", "" ).
215 /* Put any column headers here
*/
216 pr-line
= " Account Description Annual Budget" .
217 RUN pclrep-line
( base-font
, pr-line
).
218 RUN pclrep-down-by
(1).
222 /* _UIB-CODE-BLOCK-END
*/
226 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
227 PROCEDURE parse-parameters
:
228 /*------------------------------------------------------------------------------
230 ------------------------------------------------------------------------------*/
231 DEF VAR token
AS CHAR NO-UNDO.
232 DEF VAR i
AS INT NO-UNDO.
233 DEF VAR fin-year
AS INT NO-UNDO.
235 {inc
/showopts.i
"report-options"}
237 DO i
= 1 TO NUM-ENTRIES( report-options
, "~n" ):
238 token
= ENTRY( i
, report-options
, "~n" ).
240 CASE ENTRY( 1, token
):
241 WHEN "Preview" THEN preview
= Yes.
242 WHEN "Selection" THEN selection-style
= ENTRY(2,token
).
243 WHEN "Properties" THEN ASSIGN
244 property-1
= INT( ENTRY(2,token
) )
245 property-n
= INT( ENTRY(3,token
) ).
252 /* _UIB-CODE-BLOCK-END
*/