1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
15 ------------------------------------------------------------------------*/
17 DEF INPUT PARAMETER batch-no
LIKE Batch.BatchCode
NO-UNDO.
19 &SCOPED-DEFINE lines-per-page 112
22 DEF VAR ln
AS DEC INIT 0.00 NO-UNDO.
24 /* Line definitions
*/
26 DEF VAR page-no
AS INT INIT 1 NO-UNDO.
27 DEF VAR reset-page
AS CHAR NO-UNDO.
28 DEF VAR half-line
AS CHAR NO-UNDO. half-line
= CHR(27) + "=".
30 DEF VAR title-font
AS CHAR NO-UNDO.
31 DEF VAR column-font
AS CHAR NO-UNDO.
32 DEF VAR line-printer
AS CHAR NO-UNDO.
33 DEF VAR trn-font-1
AS CHAR NO-UNDO.
34 DEF VAR trn-font-2
AS CHAR NO-UNDO.
35 DEF VAR footer-font
AS CHAR NO-UNDO.
36 DEF VAR warning-font
AS CHAR NO-UNDO.
37 DEF VAR normal
AS CHAR NO-UNDO.
39 DEF VAR i
AS INT NO-UNDO.
41 DEF VAR ledger-total
AS DEC NO-UNDO.
44 {inc
/ofc-set-l.i
"Tenant-Accounts" "tenant-accounts"}
45 {inc
/ofc-set-l.i
"Period-Closed-Warnings" "Period-Closed-Warnings"}
47 /* _UIB-CODE-BLOCK-END
*/
51 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
53 /* ******************** Preprocessor Definitions
******************** */
55 &Scoped-define PROCEDURE-TYPE Procedure
59 /* _UIB-PREPROCESSOR-BLOCK-END
*/
64 /* *********************** Procedure Settings
************************ */
66 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
67 /* Settings for
THIS-PROCEDURE
71 Add Fields to
: Neither
72 Other Settings
: CODE-ONLY
COMPILE
74 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
76 /* ************************* Create Window
************************** */
78 &ANALYZE-SUSPEND _CREATE-WINDOW
79 /* DESIGN Window definition
(used by the UIB
)
80 CREATE WINDOW Procedure
ASSIGN
83 /* END WINDOW DEFINITION
*/
89 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
90 /* ************************* Included-Libraries
*********************** */
92 {inc
/method
/m-txtrep.i
}
95 /* _UIB-CODE-BLOCK-END
*/
100 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
103 /* *************************** Main Block
*************************** */
105 DEF VAR user-name
AS CHAR NO-UNDO.
106 {inc
/username.i
"user-name"}
108 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
113 RUN view-output-file
( no
).
115 /* _UIB-CODE-BLOCK-END
*/
119 /* ********************** Internal Procedures
*********************** */
121 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE carriage-return Procedure
122 PROCEDURE carriage-return
:
123 /*------------------------------------------------------------------------------
127 ------------------------------------------------------------------------------*/
133 /* _UIB-CODE-BLOCK-END
*/
137 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE column-header Procedure
138 PROCEDURE column-header
:
139 /*------------------------------------------------------------------------------
143 ------------------------------------------------------------------------------*/
145 PUT CONTROL column-font.
146 PUT UNFORMATTED SPACE(9)
147 STRING( "Co/Ppty/Proj", "X(13)" ) SPACE(5)
148 STRING( "Acct", "X(4)" ) SPACE(5)
149 STRING( "Tn/Cr", "X(5)" ) SPACE(8)
150 STRING( "Date", "X(4)" ) SPACE(4)
151 STRING( "Trans Ref", "X(9)" ) SPACE(20)
152 STRING( "Amount", "X(6)" ).
153 PUT CONTROL line-printer.
158 /* _UIB-CODE-BLOCK-END
*/
162 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-document Procedure
163 PROCEDURE each-document
:
164 /*------------------------------------------------------------------------------
168 ------------------------------------------------------------------------------*/
170 PUT CONTROL trn-font-1.
172 STRING( Document.DocumentType
, "X(4)" ) SPACE(2)
173 STRING( Document.Reference
, "X(12)" ) SPACE(2)
174 STRING( Document.Description
, "X(50)" ).
177 FOR EACH AcctTran
OF Document
NO-LOCK.
178 RUN each-transaction.
185 /* _UIB-CODE-BLOCK-END
*/
189 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-transaction Procedure
190 PROCEDURE each-transaction
:
191 /*------------------------------------------------------------------------------
195 ------------------------------------------------------------------------------*/
197 DEF VAR entity-code
AS CHAR NO-UNDO.
198 entity-code
= FILL( ' '
, IF AcctTran.EntityType
= "P" THEN 3 ELSE
199 IF AcctTran.EntityType
= "J" THEN 8 ELSE 0 ).
200 entity-code
= entity-code
+ STRING( AcctTran.EntityCode
,
201 IF AcctTran.Entitytype
= "L" THEN "999" ELSE "99999" ).
202 IF LOOKUP( AcctTran.EntityType
, "C,T") <> 0 THEN entity-code
= "".
204 PUT CONTROL trn-font-2.
206 PUT UNFORMATTED SPACE(5)
207 STRING( entity-code
, "X(13)" ) SPACE(1)
208 STRING( IF AcctTran.EntityType
<> "C" AND (tenant-accounts
OR AcctTran.EntityType
<> "T") THEN
209 STRING( AcctTran.AccountCode
, "9999.99" ) ELSE "", "X(7)" ) SPACE(1)
210 STRING( IF LOOKUP( AcctTran.EntityType
, "T,C" ) <> 0 THEN AcctTran.EntityType
+
211 STRING( AcctTran.EntityCode
, "99999" ) ELSE "", "X(6)" ) SPACE(1)
212 STRING( AcctTran.Date
, "99/99/9999" ) SPACE(1)
213 STRING( IF AcctTran.Reference
<> "" THEN AcctTran.Reference
214 ELSE Document.Reference
, "X(12)" ) SPACE(1)
215 STRING( AcctTran.Amount
, ">>>,>>>,>>9.99CR" ) SPACE(1)
216 STRING( IF AcctTran.Description
<> "" THEN AcctTran.Description
ELSE Document.Description
, "X(50)" ).
219 FIND Month
WHERE Month.MonthCode
= AcctTran.MonthCode
NO-LOCK.
221 IF Period-Closed-Warnings
<> No
AND (AcctTran.Date
< Month.StartDate
OR AcctTran.Date
> Month.EndDate
) THEN DO:
222 PUT CONTROL warning-font.
223 PUT UNFORMATTED SPACE(5) STRING(
224 "( Warning! Period closed - updated to " +
225 STRING( Month.StartDate
, "99/99/9999" ) + " to " + STRING( Month.EndDate
, "99/99/9999" ) +
226 " period instead. )" ).
231 ledger-total
= ledger-total
+
232 IF AcctTran.EntityType
= "L" THEN AcctTran.Amount
ELSE 0.
236 /* _UIB-CODE-BLOCK-END
*/
240 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-control-strings Procedure
241 PROCEDURE get-control-strings
:
242 /*------------------------------------------------------------------------------
243 Purpose
: Get all control strings for this report
246 ------------------------------------------------------------------------------*/
248 DEF VAR rows
AS DEC NO-UNDO.
249 DEF VAR cols
AS DEC NO-UNDO.
251 RUN make-control-string
( "PCL", "reset,portrait,a4,tm,0,lm,4",
252 OUTPUT reset-page
, OUTPUT rows
, OUTPUT cols
).
254 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,10",
255 OUTPUT title-font
, OUTPUT rows
, OUTPUT cols
).
257 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,8",
258 OUTPUT column-font
, OUTPUT rows
, OUTPUT cols
).
260 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,10",
261 OUTPUT footer-font
, OUTPUT rows
, OUTPUT cols
).
263 RUN make-control-string
( "PCL", "LinePrinter,lpi,9.54",
264 OUTPUT line-printer
, OUTPUT rows
, OUTPUT cols
).
266 RUN make-control-string
( "PCL", "LinePrinter,lpi,9.54",
267 OUTPUT trn-font-1
, OUTPUT rows
, OUTPUT cols
).
269 RUN make-control-string
( "PCL", "Courier,Pitch,24",
270 OUTPUT trn-font-2
, OUTPUT rows
, OUTPUT cols
).
272 RUN make-control-string
( "PCL", "Courier,Bold,Pitch,24",
273 OUTPUT warning-font
, OUTPUT rows
, OUTPUT cols
).
275 RUN make-control-string
( "PCL", "Normal",
276 OUTPUT normal
, OUTPUT rows
, OUTPUT cols
).
280 /* _UIB-CODE-BLOCK-END
*/
284 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-feed Procedure
285 PROCEDURE page-feed
:
286 /*------------------------------------------------------------------------------
288 ------------------------------------------------------------------------------*/
290 page-no
= page-no
+ 1.
295 /* _UIB-CODE-BLOCK-END
*/
299 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-header Procedure
300 PROCEDURE page-header
:
301 /*------------------------------------------------------------------------------
303 ------------------------------------------------------------------------------*/
311 /* _UIB-CODE-BLOCK-END
*/
315 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-ledger-total Procedure
316 PROCEDURE print-ledger-total
:
317 /*------------------------------------------------------------------------------
321 ------------------------------------------------------------------------------*/
323 PUT CONTROL footer-font.
324 PUT UNFORMATTED SPACE(10)
325 STRING( "Control Total of Ledger Transactions for Batch = " +
326 TRIM( STRING( ledger-total
, ">>,>>>,>>>,>>9.99CR" ) ), "X(80)" ).
330 /* _UIB-CODE-BLOCK-END
*/
334 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-title Procedure
335 PROCEDURE print-title
:
336 /*------------------------------------------------------------------------------
340 ------------------------------------------------------------------------------*/
342 PUT CONTROL line-printer.
344 PUT CONTROL column-font.
345 PUT UNFORMATTED STRING( TODAY, "99/99/9999" )
346 STRING( ",", "X" ) SPACE
347 STRING( TIME, "HH:MM:SS" ) + " for " + user-name
348 CHR(13) SPACE(180) "Page " page-no.
349 PUT CONTROL line-printer.
351 PUT CONTROL title-font.
352 PUT UNFORMATTED STRING(
353 "Posted Transactions for batch " + STRING( Batch.BatchCode
, "99999" ) + " - " +
356 PUT CONTROL line-printer.
361 /* _UIB-CODE-BLOCK-END
*/
365 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-page Procedure
366 PROCEDURE reset-page
:
367 /*------------------------------------------------------------------------------
371 ------------------------------------------------------------------------------*/
373 PUT CONTROL reset-page.
378 /* _UIB-CODE-BLOCK-END
*/
382 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-line Procedure
383 PROCEDURE skip-line
:
384 /*------------------------------------------------------------------------------
388 ------------------------------------------------------------------------------*/
390 DEF INPUT PARAMETER n
AS DEC NO-UNDO.
392 IF ln
+ n
>= {&lines-per-page} THEN
399 DEF VAR int-part
AS INT NO-UNDO.
400 DEF VAR dec-part
AS DEC NO-UNDO.
402 int-part
= TRUNCATE( n
, 0 ).
403 IF int-part
< 0 THEN RETURN.
404 dec-part
= n
- int-part.
405 IF int-part
= 0 AND dec-part
= 0 THEN RETURN.
407 /* Need to have this like the following
- do not touch
*/
408 IF int-part
<> 0 THEN PUT CONTROL FILL( CHR(10), int-part
).
409 IF dec-part
<> 0 THEN PUT CONTROL half-line.
417 /* _UIB-CODE-BLOCK-END
*/
421 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-to-line Procedure
422 PROCEDURE skip-to-line
:
423 /*------------------------------------------------------------------------------
427 ------------------------------------------------------------------------------*/
429 DEF INPUT PARAMETER line-no
AS DEC NO-UNDO.
431 DEF VAR int-part
AS INT NO-UNDO.
432 DEF VAR dec-part
AS DEC NO-UNDO.
434 int-part
= TRUNCATE( line-no
- ln
, 0 ).
435 IF int-part
< 0 THEN RETURN.
436 dec-part
= ( line-no
- ln
) - int-part.
437 IF int-part
= 0 AND dec-part
= 0 THEN RETURN.
439 IF int-part
<> 0 THEN PUT CONTROL FILL( CHR(10), int-part
).
440 IF dec-part
<> 0 THEN PUT CONTROL half-line.
448 /* _UIB-CODE-BLOCK-END
*/
452 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-report Procedure
453 PROCEDURE update-report
:
454 /*------------------------------------------------------------------------------
458 ------------------------------------------------------------------------------*/
460 FIND Batch
WHERE Batch.BatchCode
= batch-no
NO-LOCK NO-ERROR.
461 IF NOT AVAILABLE Batch
THEN RETURN.
463 RUN get-control-strings.
466 FOR EACH Document
OF Batch
NO-LOCK:
471 RUN print-ledger-total.
476 /* _UIB-CODE-BLOCK-END
*/