Add blank column, rename column.
[capital-apms-progress.git] / process / report / property-outgoings.p
bloba48097ef4ca70bf65acd8a65523b40f6824ab68e
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 Report: Current Income and Budgetted Expenditure
6 Author: Andrew McMillan
7 Date: 2/2/1999
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.
16 RUN parse-parameters.
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".
32 {inc/ofc-this.i}
34 /* _UIB-CODE-BLOCK-END */
35 &ANALYZE-RESUME
38 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
40 /* ******************** Preprocessor Definitions ******************** */
42 &Scoped-define PROCEDURE-TYPE Procedure
46 /* _UIB-PREPROCESSOR-BLOCK-END */
47 &ANALYZE-RESUME
51 /* *********************** Procedure Settings ************************ */
53 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
54 /* Settings for THIS-PROCEDURE
55 Type: Procedure
56 Allow:
57 Frames: 0
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
68 HEIGHT = .1
69 WIDTH = 32.57.
70 /* END WINDOW DEFINITION */
72 &ANALYZE-RESUME
76 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
77 /* ************************* Included-Libraries *********************** */
79 {inc/method/m-txtrep.i}
81 /* _UIB-CODE-BLOCK-END */
82 &ANALYZE-RESUME
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.
99 OUTPUT CLOSE.
101 RUN pclrep-finish.
103 /* _UIB-CODE-BLOCK-END */
104 &ANALYZE-RESUME
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, "" ).
124 need-header = No.
125 END.
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")).
132 END.
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.
138 END.
140 END PROCEDURE.
142 /* _UIB-CODE-BLOCK-END */
143 &ANALYZE-RESUME
146 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE for-each-property Procedure
147 PROCEDURE for-each-property :
148 /*------------------------------------------------------------------------------
149 Purpose:
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 ).
158 END.
160 END PROCEDURE.
162 /* _UIB-CODE-BLOCK-END */
163 &ANALYZE-RESUME
166 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE for-one-property Procedure
167 PROCEDURE for-one-property :
168 /*------------------------------------------------------------------------------
169 Purpose:
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!").
175 RETURN.
176 END.
178 property-code = Property.PropertyCode.
179 property-name = Property.Name.
180 RUN each-property( property-code ).
182 END PROCEDURE.
184 /* _UIB-CODE-BLOCK-END */
185 &ANALYZE-RESUME
188 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-footer Procedure
189 PROCEDURE inst-page-footer :
190 /*------------------------------------------------------------------------------
191 Purpose: Print any page footer
192 ------------------------------------------------------------------------------*/
194 END PROCEDURE.
196 /* _UIB-CODE-BLOCK-END */
197 &ANALYZE-RESUME
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))
211 + " - "
212 + property-name ).
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).
220 END PROCEDURE.
222 /* _UIB-CODE-BLOCK-END */
223 &ANALYZE-RESUME
226 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
227 PROCEDURE parse-parameters :
228 /*------------------------------------------------------------------------------
229 Purpose:
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) ).
246 END CASE.
248 END.
250 END PROCEDURE.
252 /* _UIB-CODE-BLOCK-END */
253 &ANALYZE-RESUME