Add blank column, rename column.
[capital-apms-progress.git] / process / report / sub-rec.p
blob1d8417abebc3aa106c33ee9e19c82ce620f2bba5
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 ------------------------------------------------------------------------*/
7 DEF INPUT PARAMETER report-options AS CHAR NO-UNDO.
9 DEF VAR preview AS LOGI NO-UNDO INIT No.
10 DEF VAR reconcile-types AS CHAR NO-UNDO.
11 DEF VAR m-1 AS INT NO-UNDO.
12 DEF VAR m-n AS INT NO-UNDO.
13 DEF VAR ec-1 AS INT NO-UNDO.
14 DEF VAR ec-n AS INT NO-UNDO.
15 DEF VAR ac-1 AS DEC NO-UNDO.
16 DEF VAR ac-n AS DEC NO-UNDO.
17 DEF VAR hdr-run-description AS CHAR NO-UNDO.
18 RUN parse-parameters.
19 IF RETURN-VALUE = "FAIL" THEN RETURN.
21 DEF VAR reconcile-procedure AS CHAR NO-UNDO.
22 DEF VAR proc-n AS INT NO-UNDO.
23 DEF VAR money-fmt AS CHAR NO-UNDO INITIAL ">>>,>>>,>>9.99CR".
24 DEF VAR items-processed AS INT NO-UNDO.
25 DEF VAR not-in-balance AS INT NO-UNDO.
27 {inc/ofc-this.i}
28 {inc/ofc-acct.i "DEBTORS" "sundry-debtors"}
29 {inc/ofc-acct.i "CREDITORS" "sundry-creditors"}
30 DEF VAR creditors-ledger AS INT NO-UNDO.
31 creditors-ledger = OfficeControlAccount.EntityCode .
33 DEF VAR user-name AS CHAR NO-UNDO.
34 {inc/username.i "user-name"}
35 DEF VAR timeStamp AS CHAR FORMAT "X(44)" NO-UNDO.
36 timeStamp = STRING( TODAY, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
38 DEF TEMP-TABLE CtrlAcct NO-UNDO
39 FIELD et AS CHAR
40 FIELD ec AS INT
41 FIELD ac AS DEC
42 FIELD mth AS INT
43 FIELD act-bal AS DEC INITIAL 0
44 FIELD act-bud AS DEC INITIAL 0
45 FIELD act-rbd AS DEC INITIAL 0
46 FIELD sum-bal AS DEC INITIAL 0
47 FIELD sum-bud AS DEC INITIAL 0
48 FIELD sum-rbd AS DEC INITIAL 0
49 INDEX XPKCtrlAcct IS UNIQUE PRIMARY et ec ac mth
50 INDEX XAKCtrlAcct mth ec ac .
52 DEF WORK-TABLE CtrlTotal NO-UNDO
53 FIELD et AS CHAR
54 FIELD ec AS INT
55 FIELD mth AS INT
56 FIELD act-bal AS DEC INITIAL 0
57 FIELD act-bud AS DEC INITIAL 0
58 FIELD act-rbd AS DEC INITIAL 0
59 FIELD sum-bal AS DEC INITIAL 0
60 FIELD sum-bud AS DEC INITIAL 0
61 FIELD sum-rbd AS DEC INITIAL 0.
63 /* _UIB-CODE-BLOCK-END */
64 &ANALYZE-RESUME
67 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
69 /* ******************** Preprocessor Definitions ******************** */
71 &Scoped-define PROCEDURE-TYPE Procedure
75 /* _UIB-PREPROCESSOR-BLOCK-END */
76 &ANALYZE-RESUME
79 /* ************************ Function Prototypes ********************** */
81 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD verify-account Procedure
82 FUNCTION verify-account RETURNS DECIMAL
83 ( INPUT et-p AS CHAR, INPUT ec-p AS INT, INPUT et-s AS CHAR, INPUT ac AS DEC, INPUT mnth AS INT ) FORWARD.
85 /* _UIB-CODE-BLOCK-END */
86 &ANALYZE-RESUME
89 /* *********************** Procedure Settings ************************ */
91 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
92 /* Settings for THIS-PROCEDURE
93 Type: Procedure
94 Allow:
95 Frames: 0
96 Add Fields to: Neither
97 Other Settings: CODE-ONLY COMPILE
99 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
101 /* ************************* Create Window ************************** */
103 &ANALYZE-SUSPEND _CREATE-WINDOW
104 /* DESIGN Window definition (used by the UIB)
105 CREATE WINDOW Procedure ASSIGN
106 HEIGHT = .33
107 WIDTH = 40.29.
108 /* END WINDOW DEFINITION */
110 &ANALYZE-RESUME
114 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
115 /* ************************* Included-Libraries *********************** */
117 {inc/method/m-txtrep.i}
119 /* _UIB-CODE-BLOCK-END */
120 &ANALYZE-RESUME
124 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
127 /* *************************** Main Block *************************** */
128 OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES PAGE-SIZE 0.
130 RUN pclrep-start( preview, "reset,landscape,tm,2,a4,lm,6,courier,cpi,18,lpi,9").
132 DO proc-n = 1 TO NUM-ENTRIES(reconcile-types):
133 reconcile-procedure = "reconcile-" + ENTRY( proc-n, reconcile-types).
134 not-in-balance = 0.
135 items-processed = 0.
136 IF LOOKUP( reconcile-procedure, THIS-PROCEDURE:INTERNAL-ENTRIES ) > 0 THEN DO:
137 RUN pclrep-line( "", "" ).
138 RUN VALUE( reconcile-procedure ).
139 END.
140 ELSE
141 MESSAGE "Reconciliation of " + SUBSTRING( reconcile-procedure, 11) + " not available."
142 VIEW-AS ALERT-BOX ERROR
143 TITLE "Huh!?!".
144 END.
146 OUTPUT CLOSE.
148 RUN pclrep-finish.
150 /* _UIB-CODE-BLOCK-END */
151 &ANALYZE-RESUME
154 /* ********************** Internal Procedures *********************** */
156 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE account-line Procedure
157 PROCEDURE account-line :
158 /*------------------------------------------------------------------------------
159 Purpose:
160 ------------------------------------------------------------------------------*/
161 DEF INPUT PARAMETER descr AS CHAR NO-UNDO.
163 DEF VAR line AS CHAR NO-UNDO.
165 FIND Month WHERE Month.MonthCode = CtrlAcct.mth NO-LOCK.
166 line = STRING( CtrlAcct.et, "X(2)")
167 + STRING( CtrlAcct.ec, "99999" ) + " "
168 + STRING( CtrlAcct.ac, "9999.99") + " "
169 + STRING( descr, "X(50)") + " "
170 + STRING( SUBSTRING( STRING(Month.StartDate,"99/99/9999"), 4), "X(7)") + " "
171 + STRING( CtrlAcct.act-bal, money-fmt) + " "
172 + STRING( CtrlAcct.sum-bal, money-fmt) + " "
173 + STRING( CtrlAcct.act-bal - CtrlAcct.sum-bal, money-fmt) + " "
174 + STRING( CtrlAcct.act-bud, money-fmt) + " "
175 + STRING( CtrlAcct.sum-bud, money-fmt) + " "
176 + STRING( CtrlAcct.act-bud - CtrlAcct.sum-bud, money-fmt) .
178 RUN pclrep-line( "Courier,cpi,19,lpi,8,Fixed,Normal", line ).
180 not-in-balance = not-in-balance + 1.
182 END PROCEDURE.
184 /* _UIB-CODE-BLOCK-END */
185 &ANALYZE-RESUME
188 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE add-balance Procedure
189 PROCEDURE add-balance :
190 /*------------------------------------------------------------------------------
191 Purpose:
192 ------------------------------------------------------------------------------*/
193 DEF VAR et AS CHAR NO-UNDO.
194 DEF VAR ec AS INT NO-UNDO.
195 DEF VAR ac AS DEC NO-UNDO.
196 DEF VAR tot-ec AS INT NO-UNDO.
198 DEF BUFFER CtrlBalance FOR AccountBalance.
200 RUN get-account-codes( OUTPUT et, OUTPUT ec, OUTPUT ac, OUTPUT tot-ec).
202 FIND FIRST CtrlTotal WHERE CtrlTotal.et = et
203 AND CtrlTotal.ec = tot-ec
204 AND CtrlTotal.mth = AccountBalance.MonthCode NO-ERROR.
205 IF NOT AVAILABLE(CtrlTotal) THEN DO:
206 CREATE CtrlTotal.
207 ASSIGN CtrlTotal.et = et
208 CtrlTotal.ec = tot-ec
209 CtrlTotal.mth = AccountBalance.MonthCode.
210 END.
213 FIND CtrlAcct WHERE CtrlAcct.et = et AND CtrlAcct.ec = ec AND CtrlAcct.ac = ac
214 AND CtrlAcct.mth = AccountBalance.MonthCode NO-ERROR.
215 IF NOT AVAILABLE( CtrlAcct ) THEN DO:
216 CREATE CtrlAcct.
217 ASSIGN CtrlAcct.et = et
218 CtrlAcct.ec = ec
219 CtrlAcct.ac = ac
220 CtrlAcct.mth = AccountBalance.MonthCode.
222 items-processed = items-processed + 1.
224 FIND CtrlBalance WHERE CtrlBalance.EntityType = et
225 AND CtrlBalance.EntityCode = ec
226 AND CtrlBalance.AccountCode = ac
227 AND CtrlBalance.MonthCode = AccountBalance.MonthCode NO-LOCK NO-ERROR.
228 IF AVAILABLE(CtrlBalance) THEN ASSIGN
229 CtrlAcct.act-bal = CtrlBalance.Balance
230 CtrlAcct.act-bud = CtrlBalance.Budget
231 CtrlAcct.act-rbd = CtrlBalance.RevisedBudget
232 CtrlTotal.act-bal = CtrlTotal.act-bal + CtrlBalance.Balance
233 CtrlTotal.act-bud = CtrlTotal.act-bud + CtrlBalance.Budget
234 CtrlTotal.act-rbd = CtrlTotal.act-rbd + CtrlBalance.RevisedBudget .
235 END.
236 CtrlAcct.sum-bal = CtrlAcct.sum-bal + AccountBalance.Balance.
237 CtrlAcct.sum-bud = CtrlAcct.sum-bud + AccountBalance.Budget.
238 CtrlAcct.sum-rbd = CtrlAcct.sum-rbd + AccountBalance.RevisedBudget.
239 CtrlTotal.sum-bal = CtrlTotal.sum-bal + AccountBalance.Balance.
240 CtrlTotal.sum-bud = CtrlTotal.sum-bud + AccountBalance.Budget.
241 CtrlTotal.sum-rbd = CtrlTotal.sum-rbd + AccountBalance.RevisedBudget.
243 END PROCEDURE.
245 /* _UIB-CODE-BLOCK-END */
246 &ANALYZE-RESUME
249 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-account-codes Procedure
250 PROCEDURE get-account-codes :
251 /*------------------------------------------------------------------------------
252 Purpose:
253 ------------------------------------------------------------------------------*/
254 DEF OUTPUT PARAMETER et AS CHAR NO-UNDO INITIAL ?.
255 DEF OUTPUT PARAMETER ec AS INT NO-UNDO INITIAL ?.
256 DEF OUTPUT PARAMETER ac AS DEC NO-UNDO INITIAL ?.
257 DEF OUTPUT PARAMETER tot-ec AS INT NO-UNDO INITIAL ?.
259 IF NOT AVAILABLE(AccountBalance) THEN RETURN "FAIL".
261 CASE AccountBalance.EntityType:
262 WHEN "T" THEN DO:
263 et = "L".
264 tot-ec = 0.
265 ac = sundry-debtors.
266 FIND Tenant WHERE Tenant.TenantCode = AccountBalance.EntityCode NO-LOCK.
267 IF Tenant.EntityType = "P" THEN DO:
268 FIND Property WHERE Property.PropertyCode = Tenant.EntityCode NO-LOCK.
269 ec = Property.CompanyCode .
270 END.
271 ELSE IF Tenant.EntityType = "L" THEN
272 ec = Tenant.EntityCode .
273 ELSE
274 MESSAGE "Tenant " + STRING(Tenant.TenantCode) + " updates to other than property or GL! Reconciliation not supported!".
275 END.
277 WHEN "C" THEN DO:
278 et = "L".
279 tot-ec = 0.
280 ec = creditors-ledger.
281 ac = sundry-creditors.
282 END.
284 WHEN "P" THEN DO:
285 et = "L".
286 ac = AccountBalance.AccountCode .
287 FIND Property WHERE Property.PropertyCode = AccountBalance.EntityCode NO-LOCK.
288 ec = Property.CompanyCode .
289 tot-ec = ec.
290 END.
292 END CASE.
293 END PROCEDURE.
295 /* _UIB-CODE-BLOCK-END */
296 &ANALYZE-RESUME
299 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-footer Procedure
300 PROCEDURE inst-page-footer :
301 /*------------------------------------------------------------------------------
302 Purpose: Print any page footer
303 ------------------------------------------------------------------------------*/
305 END PROCEDURE.
307 /* _UIB-CODE-BLOCK-END */
308 &ANALYZE-RESUME
311 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-header Procedure
312 PROCEDURE inst-page-header :
313 /*------------------------------------------------------------------------------
314 Purpose: Print any page header
315 ------------------------------------------------------------------------------*/
316 DEF VAR money-column-format AS CHAR NO-UNDO.
317 DEF VAR line AS CHAR NO-UNDO.
319 RUN pclrep-line( "univers,Point,7,bold,Proportional", TimeStamp).
320 RUN pclrep-line( "", "" ).
321 RUN pclrep-line( "univers,Point,12,bold,Proportional",
322 FILL(" ",40) + "Sub-Ledgers / Control Accounts - Reconciliation Report" ).
323 RUN pclrep-line( "univers,Point,7,normal,Proportional", "").
324 RUN pclrep-line( "univers,Point,9,normal,Proportional", hdr-run-description ).
325 RUN pclrep-line( "", "" ).
327 money-column-format = "X(" + STRING(LENGTH( STRING(0,money-fmt))) + ")".
328 line = "Entity/Account "
329 + STRING( "Description", "X(50)") + " "
330 + STRING( " Month ", "X(7)") + " "
331 + STRING( " Balance", money-column-format) + " "
332 + STRING( " Subs Balance", money-column-format) + " "
333 + STRING( " Bal. Variance", money-column-format) + " "
334 + STRING( " Budget", money-column-format) + " "
335 + STRING( " Subs Budget", money-column-format) + " "
336 + STRING( " Bud. Variance", money-column-format) .
338 RUN pclrep-line( "Courier,cpi,19,lpi,8,Fixed,bold", line ).
340 END PROCEDURE.
342 /* _UIB-CODE-BLOCK-END */
343 &ANALYZE-RESUME
346 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
347 PROCEDURE parse-parameters :
348 /*------------------------------------------------------------------------------
349 Purpose:
350 Parameters: <none>
351 Notes:
352 ------------------------------------------------------------------------------*/
353 DEF VAR token AS CHAR NO-UNDO.
354 DEF VAR i AS INT NO-UNDO.
356 DO i = 1 TO NUM-ENTRIES( report-options, "~n" ):
357 token = ENTRY( i, report-options, "~n" ).
359 CASE ENTRY( 1, token ):
360 WHEN "Preview" THEN preview = Yes.
362 WHEN "Reconcile" THEN reconcile-types = SUBSTRING( token, INDEX(token,",") + 1).
364 WHEN "MonthRange" THEN ASSIGN
365 m-1 = INT( ENTRY( 2, token))
366 m-n = INT( ENTRY( 3, token)) .
368 WHEN "EntityRange" THEN ASSIGN
369 ec-1 = INT( ENTRY( 2, token))
370 ec-n = INT( ENTRY( 3, token)) .
372 WHEN "AccountRange" THEN ASSIGN
373 ac-1 = DEC( ENTRY( 2, token))
374 ac-n = DEC( ENTRY( 3, token)) .
376 END CASE.
377 END.
379 /* MESSAGE report-options SKIP(1)
380 "Months" m-1 m-n SKIP
381 "Types" reconcile-types. */
383 FIND Month WHERE Month.MonthCode = m-1 NO-LOCK.
384 hdr-run-description = "Reconciling: " + reconcile-types
385 + ", Period from: " + STRING( Month.StartDate, "99/99/9999").
386 FIND Month WHERE Month.MonthCode = m-n NO-LOCK.
387 hdr-run-description = hdr-run-description + " to " + STRING( Month.EndDate, "99/99/9999").
389 END PROCEDURE.
391 /* _UIB-CODE-BLOCK-END */
392 &ANALYZE-RESUME
395 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reconcile-creditors Procedure
396 PROCEDURE reconcile-creditors :
397 /*------------------------------------------------------------------------------
398 Purpose:
399 ------------------------------------------------------------------------------*/
400 DEF VAR diff AS DEC NO-UNDO.
402 FOR EACH AccountBalance WHERE AccountBalance.EntityType = "C"
403 AND AccountBalance.MonthCode >= m-1
404 AND AccountBalance.MonthCode <= m-n NO-LOCK:
405 RUN add-balance.
406 END.
408 FOR EACH CtrlAcct BY CtrlAcct.mth BY CtrlAcct.ec BY CtrlAcct.ac:
409 IF CtrlAcct.act-bal <> CtrlAcct.sum-bal
410 /* OR CtrlAcct.act-bud <> CtrlAcct.sum-bud
411 OR CtrlAcct.act-rbd <> CtrlAcct.sum-rbd */
412 THEN RUN account-line( "Creditors control" ).
413 DELETE CtrlAcct.
414 END.
416 IF CAN-FIND( FIRST CtrlTotal WHERE CtrlTotal.act-bal <> CtrlTotal.sum-bal
417 /* OR CtrlTotal.act-bud <> CtrlTotal.sum-bud
418 OR CtrlTotal.act-rbd <> CtrlTotal.sum-rbd */ )
419 THEN DO:
420 RUN underline-line.
421 FOR EACH CtrlTotal BY CtrlTotal.mth BY CtrlTotal.ec:
422 IF CtrlTotal.act-bal <> CtrlTotal.sum-bal
423 /* OR CtrlTotal.act-bud <> CtrlTotal.sum-bud
424 OR CtrlTotal.act-rbd <> CtrlTotal.sum-rbd */
425 THEN RUN total-line( "Creditors control" ).
426 DELETE CtrlTotal.
427 END.
428 END.
430 IF not-in-balance > 0 THEN RUN pclrep-line( "", "" ).
431 RUN summary-line( "Creditors" ).
433 END PROCEDURE.
435 /* _UIB-CODE-BLOCK-END */
436 &ANALYZE-RESUME
439 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reconcile-debtors Procedure
440 PROCEDURE reconcile-debtors :
441 /*------------------------------------------------------------------------------
442 Purpose:
443 ------------------------------------------------------------------------------*/
444 DEF VAR diff AS DEC NO-UNDO.
446 FOR EACH AccountBalance WHERE AccountBalance.EntityType = "T"
447 AND AccountBalance.MonthCode >= m-1
448 AND AccountBalance.MonthCode <= m-n NO-LOCK:
449 RUN add-balance.
450 END.
452 FOR EACH CtrlAcct BY CtrlAcct.mth BY CtrlAcct.ec BY CtrlAcct.ac:
453 IF CtrlAcct.act-bal <> CtrlAcct.sum-bal
454 /* OR CtrlAcct.act-bud <> CtrlAcct.sum-bud */
455 THEN RUN account-line( "Sundry debtors" ).
456 DELETE CtrlAcct.
457 END.
459 IF CAN-FIND( FIRST CtrlTotal WHERE CtrlTotal.act-bal <> CtrlTotal.sum-bal
460 /* OR CtrlTotal.act-bud <> CtrlTotal.sum-bud */ )
461 THEN DO:
462 RUN underline-line.
463 FOR EACH CtrlTotal BY CtrlTotal.mth BY CtrlTotal.ec:
464 IF CtrlTotal.act-bal <> CtrlTotal.sum-bal
465 /* OR CtrlTotal.act-bud <> CtrlTotal.sum-bud */
466 THEN RUN total-line( "Debtors control" ).
467 DELETE CtrlTotal.
468 END.
469 END.
471 IF not-in-balance > 0 THEN RUN pclrep-line( "", "" ).
472 RUN summary-line( "Tenants" ).
474 END PROCEDURE.
476 /* _UIB-CODE-BLOCK-END */
477 &ANALYZE-RESUME
480 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reconcile-property Procedure
481 PROCEDURE reconcile-property :
482 /*------------------------------------------------------------------------------
483 Purpose:
484 ------------------------------------------------------------------------------*/
485 DEF VAR diff AS DEC NO-UNDO.
487 next-sub-account-balance:
488 FOR EACH AccountBalance WHERE AccountBalance.EntityType = "P"
489 AND AccountBalance.MonthCode >= m-1
490 AND AccountBalance.MonthCode <= m-n NO-LOCK:
491 IF AccountBalance.Balance = 0 THEN DO:
492 FIND ChartOfAccount WHERE ChartOfAccount.AccountCode = AccountBalance.AccountCode NO-LOCK NO-ERROR.
493 IF AVAILABLE(ChartOfAccount) THEN DO:
494 IF INDEX( ChartOfAccount.UpdateTo, "P") = 0 THEN NEXT.
495 END.
496 END.
497 RUN add-balance.
498 END.
500 FOR EACH CtrlAcct BY CtrlAcct.mth BY CtrlAcct.ec BY CtrlAcct.ac:
501 IF CtrlAcct.act-bal <> CtrlAcct.sum-bal
502 /* OR CtrlAcct.act-bud <> CtrlAcct.sum-bud
503 OR CtrlAcct.act-rbd <> CtrlAcct.sum-rbd */
504 THEN DO:
505 FIND ChartOfAccount WHERE ChartOfAccount.AccountCode = CtrlAcct.ac NO-LOCK NO-ERROR.
506 RUN account-line( ChartOfAccount.Name ).
507 END.
508 DELETE CtrlAcct.
509 END.
511 IF CAN-FIND( FIRST CtrlTotal WHERE CtrlTotal.act-bal <> CtrlTotal.sum-bal
512 /* OR CtrlTotal.act-bud <> CtrlTotal.sum-bud
513 OR CtrlTotal.act-rbd <> CtrlTotal.sum-rbd */ )
514 THEN DO:
515 RUN underline-line.
516 FOR EACH CtrlTotal BY CtrlTotal.mth BY CtrlTotal.ec:
517 IF CtrlTotal.act-bal <> CtrlTotal.sum-bal
518 /* OR CtrlTotal.act-bud <> CtrlTotal.sum-bud
519 OR CtrlTotal.act-rbd <> CtrlTotal.sum-rbd */
520 THEN DO:
521 FIND Company WHERE Company.CompanyCode = CtrlTotal.ec NO-LOCK.
522 RUN total-line( Company.LegalName ).
523 END.
524 DELETE CtrlTotal.
525 END.
526 END.
528 IF not-in-balance > 0 THEN RUN pclrep-line( "", "" ).
529 RUN summary-line( "Property Accounts" ).
531 END PROCEDURE.
533 /* _UIB-CODE-BLOCK-END */
534 &ANALYZE-RESUME
537 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE summary-line Procedure
538 PROCEDURE summary-line :
539 /*------------------------------------------------------------------------------
540 Purpose:
541 ------------------------------------------------------------------------------*/
542 DEF INPUT PARAMETER descr AS CHAR NO-UNDO.
544 DEF VAR line AS CHAR NO-UNDO.
546 line = "Summary - " + descr + ": "
547 + STRING( not-in-balance ) + " unbalanced items of "
548 + STRING( items-processed ) + " items processed.".
549 RUN pclrep-line( "univers,Point,9,bold,Proportional", line ).
551 END PROCEDURE.
553 /* _UIB-CODE-BLOCK-END */
554 &ANALYZE-RESUME
557 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE total-line Procedure
558 PROCEDURE total-line :
559 /*------------------------------------------------------------------------------
560 Purpose:
561 ------------------------------------------------------------------------------*/
562 DEF INPUT PARAMETER descr AS CHAR NO-UNDO.
564 DEF VAR line AS CHAR NO-UNDO.
566 FIND Month WHERE Month.MonthCode = CtrlTotal.mth NO-LOCK.
567 line = STRING( CtrlTotal.et, "X(2)")
568 + (IF CtrlTotal.ec > 0 THEN STRING( CtrlTotal.ec, "99999" ) ELSE " ") + " "
569 + "Total - "
570 + STRING( descr, "X(50)") + " "
571 + STRING( SUBSTRING( STRING(Month.StartDate,"99/99/9999"), 4), "X(7)") + " "
572 + STRING( CtrlTotal.act-bal, money-fmt) + " "
573 + STRING( CtrlTotal.sum-bal, money-fmt) + " "
574 + STRING( CtrlTotal.act-bal - CtrlTotal.sum-bal, money-fmt) + " "
575 + STRING( CtrlTotal.act-bud, money-fmt) + " "
576 + STRING( CtrlTotal.sum-bud, money-fmt) + " "
577 + STRING( CtrlTotal.act-bud - CtrlTotal.sum-bud, money-fmt) .
579 RUN pclrep-line( "Courier,cpi,19,lpi,8,Fixed,Normal", line ).
581 END PROCEDURE.
583 /* _UIB-CODE-BLOCK-END */
584 &ANALYZE-RESUME
587 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE underline-line Procedure
588 PROCEDURE underline-line :
589 /*------------------------------------------------------------------------------
590 Purpose: Print underlines for the totals
591 ------------------------------------------------------------------------------*/
592 DEF VAR money-length AS INT NO-UNDO.
593 DEF VAR line AS CHAR NO-UNDO.
595 money-length = LENGTH( STRING(0,money-fmt)).
597 line = FILL( " ", 74 ) + FILL( " " + FILL( "-", money-length), 6).
598 RUN pclrep-line( "Courier,cpi,19,lpi,8,Fixed,Normal", line ).
600 END PROCEDURE.
602 /* _UIB-CODE-BLOCK-END */
603 &ANALYZE-RESUME
606 /* ************************ Function Implementations ***************** */
608 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION verify-account Procedure
609 FUNCTION verify-account RETURNS DECIMAL
610 ( INPUT et-p AS CHAR, INPUT ec-p AS INT, INPUT et-s AS CHAR, INPUT ac AS DEC, INPUT mnth AS INT ) :
611 /*------------------------------------------------------------------------------
612 Purpose:
613 Notes:
614 ------------------------------------------------------------------------------*/
615 DEF BUFFER PrimAcct FOR AccountBalance.
616 DEF BUFFER SubAcct FOR AccountBalance.
618 DEF VAR primary AS DEC NO-UNDO.
619 DEF VAR secondary AS DEC NO-UNDO.
621 FIND PrimAcct NO-LOCK WHERE PrimAcct.EntityType = et-p
622 AND PrimAcct.EntityCode = ec-p
623 AND PrimAcct.AccountCode = ac
624 AND PrimAcct.MonthCode = mnth NO-ERROR.
625 IF AVAILABLE(PrimAcct) THEN
626 primary = PrimAcct.Balance.
627 ELSE
628 primary = 0.
630 secondary = 0.
631 FOR EACH SubAcct NO-LOCK WHERE SubAcct.EntityType = et-s
632 AND SubAcct.AccountCode = ac
633 AND SubAcct.MonthCode = mnth:
634 secondary = secondary + SubAcct.Balance.
635 END.
637 RETURN primary - secondary.
639 END FUNCTION.
641 /* _UIB-CODE-BLOCK-END */
642 &ANALYZE-RESUME