1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
11 ------------------------------------------------------------------------*/
12 DEF INPUT PARAMETER report-options
AS CHAR NO-UNDO.
14 DEF VAR bankaccount-code
LIKE BankAccount.BankAccountCode
NO-UNDO INITIAL ?.
15 DEF VAR date-1
AS DATE NO-UNDO.
16 DEF VAR date-n
AS DATE NO-UNDO.
17 DEF VAR preview
AS LOGI
NO-UNDO INITIAL No.
18 DEF VAR sent
AS LOGI
NO-UNDO INITIAL No.
19 DEF VAR cheque-1
LIKE Cheque.ChequeNo
NO-UNDO.
20 DEF VAR cheque-n
LIKE Cheque.ChequeNo
NO-UNDO.
24 DEF VAR ln
AS DEC INIT 0.00 NO-UNDO.
25 DEF VAR reset-page
AS CHAR NO-UNDO.
26 DEF VAR half-line
AS CHAR NO-UNDO. half-line
= CHR(27) + "=".
27 DEF VAR title-font
AS CHAR NO-UNDO.
28 DEF VAR option-font
AS CHAR NO-UNDO.
29 DEF VAR bankaccount-font
AS CHAR NO-UNDO.
30 DEF VAR line-printer
AS CHAR NO-UNDO.
32 DEF VAR bank-account-total
AS DEC NO-UNDO.
33 DEF VAR bank-account-not-sent-total
AS DEC NO-UNDO.
34 DEF VAR total-pre-space
AS CHAR NO-UNDO.
35 DEF VAR day-sent
AS INTEGER NO-UNDO.
36 DEF VAR day-sent-total
AS DEC EXTENT 7.
37 DEF VAR option-string
AS CHAR NO-UNDO.
39 DEF VAR prt-ctrl
AS CHAR NO-UNDO.
40 DEF VAR cols
AS INT NO-UNDO.
41 DEF VAR rows
AS INT NO-UNDO.
43 &SCOPED-DEFINE EARLY-DATE DATE(1,1,1)
44 &SCOPED-DEFINE LATE-DATE DATE(12,31,2999)
45 &SCOPED-DEFINE lines-per-page 82
47 /* _UIB-CODE-BLOCK-END
*/
51 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
53 /* ******************** Preprocessor Definitions
******************** */
55 &Scoped-define PROCEDURE-TYPE Procedure
56 &Scoped-define DB-AWARE no
60 /* _UIB-PREPROCESSOR-BLOCK-END
*/
65 /* *********************** Procedure Settings
************************ */
67 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
68 /* Settings for
THIS-PROCEDURE
72 Add Fields to
: Neither
73 Other Settings
: CODE-ONLY
COMPILE
75 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
77 /* ************************* Create Window
************************** */
79 &ANALYZE-SUSPEND _CREATE-WINDOW
80 /* DESIGN Window definition
(used by the UIB
)
81 CREATE WINDOW Procedure
ASSIGN
84 /* END WINDOW DEFINITION
*/
88 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
89 /* ************************* Included-Libraries
*********************** */
91 {inc
/method
/m-sysmgr.i
}
92 {inc
/method
/m-txtrep.i
}
94 /* _UIB-CODE-BLOCK-END
*/
101 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
104 /* *************************** Main Block
*************************** */
107 RUN make-control-string
( "PCL", "reset", OUTPUT prt-ctrl
, OUTPUT rows
, OUTPUT cols
).
108 RUN output-control-file
( prt-ctrl
).
110 RUN get-control-strings.
111 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
113 RUN unpresented-cheques.
116 RUN view-output-file
( preview
).
118 /* _UIB-CODE-BLOCK-END
*/
122 /* ********************** Internal Procedures
*********************** */
124 &IF DEFINED(EXCLUDE-bank-account-footer) = 0 &THEN
126 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE bank-account-footer Procedure
127 PROCEDURE bank-account-footer
:
128 /*------------------------------------------------------------------------------
132 ------------------------------------------------------------------------------*/
137 STRING( "Total for Bank Account","X(30)" )
138 STRING( bank-account-total
, "->>>,>>>,>>9.99" ).
142 DEF VAR balance
LIKE AccountSummary.Balance
NO-UNDO.
144 FIND AccountSummary
WHERE AccountSummary.EntityType
= "L"
145 AND AccountSummary.EntityCode
= BankAccount.CompanyCode
146 AND AccountSummary.AccountCode
= BankAccount.AccountCode
148 IF AVAILABLE(AccountSummary
) THEN DO:
149 balance
= AccountSummary.Balance.
156 STRING( "Balance from GL","X(30)" )
157 STRING( balance
, "->>>,>>>,>>9.99" ).
159 IF bank-account-total
= 0 AND bank-account-not-sent-total
= 0 THEN DO:
168 STRING( "Estimated Balance at Bank","X(30)" )
169 STRING( balance
+ bank-account-total
, "->>>,>>>,>>9.99" ).
175 STRING( "If sent cheques are presented","X(30)" )
176 STRING( balance
+ bank-account-total
- bank-account-not-sent-total
, "->>>,>>>,>>9.99" ).
183 /* _UIB-CODE-BLOCK-END
*/
188 &IF DEFINED(EXCLUDE-bank-account-header) = 0 &THEN
190 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE bank-account-header Procedure
191 PROCEDURE bank-account-header
:
192 /*------------------------------------------------------------------------------
196 ------------------------------------------------------------------------------*/
198 PUT CONTROL bankaccount-font.
200 "(L" + STRING( BankAccount.CompanyCode
, "9999" ) + " - " +
201 STRING( BankAccount.AccountCode
, "9999.99" ) + ") " +
202 BankAccount.BankName
+ ", " +
203 BankAccount.BankBranchName
+ ", " +
204 BankAccount.AccountName
+ " " +
205 "(" + STRING( BankAccount.BankAccount
) + ")".
206 PUT CONTROL line-printer.
211 /* _UIB-CODE-BLOCK-END
*/
216 &IF DEFINED(EXCLUDE-carriage-return) = 0 &THEN
218 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE carriage-return Procedure
219 PROCEDURE carriage-return
:
220 /*------------------------------------------------------------------------------
224 ------------------------------------------------------------------------------*/
230 /* _UIB-CODE-BLOCK-END
*/
235 &IF DEFINED(EXCLUDE-column-header) = 0 &THEN
237 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE column-header Procedure
238 PROCEDURE column-header
:
239 /*------------------------------------------------------------------------------
243 ------------------------------------------------------------------------------*/
245 PUT UNFORMATTED SPACE(3)
246 STRING( "Payee Name", "X(50)" ) SPACE(2)
247 STRING( "Chq No.", "X(7)" ) SPACE(2)
248 STRING( "Date", "X(10)" ) SPACE(2).
252 STRING( "Sent", "X(10)" ) SPACE(2).
255 STRING( " Amount", "X(15)" ).
261 /* _UIB-CODE-BLOCK-END
*/
266 &IF DEFINED(EXCLUDE-each-bank-account) = 0 &THEN
268 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-bank-account Procedure
269 PROCEDURE each-bank-account
:
270 /*------------------------------------------------------------------------------
274 ------------------------------------------------------------------------------*/
276 bank-account-total
= 0.
277 bank-account-not-sent-total
= 0.
278 DO day-sent
= 1 TO 7:
279 day-sent-total
[ day-sent
] = 0.
282 RUN bank-account-header.
284 IF cheque-1
= ?
OR cheque-n
= ?
THEN DO:
285 FOR EACH Cheque
NO-LOCK WHERE Cheque.BankAccountCode
= BankAccount.BankAccountCode
286 AND Cheque.Date
>= date-1
AND Cheque.Date
<= date-n
287 AND (Cheque.DatePresented
> date-n
OR Cheque.DatePresented
= ?
)
288 AND NOT(Cheque.Cancelled
):
293 FOR EACH Cheque
NO-LOCK WHERE Cheque.BankAccountCode
= BankAccount.BankAccountCode
294 AND Cheque.ChequeNo
>= cheque-1
AND Cheque.ChequeNo
<= cheque-n
295 AND Cheque.Date
>= date-1
AND Cheque.Date
<= date-n
296 AND ( Cheque.DatePresented
> date-n
OR Cheque.DatePresented
= ?
)
297 AND NOT(Cheque.Cancelled
):
302 RUN bank-account-footer.
304 IF sent
THEN RUN sent-summary.
308 /* _UIB-CODE-BLOCK-END
*/
313 &IF DEFINED(EXCLUDE-each-cheque) = 0 &THEN
315 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-cheque Procedure
316 PROCEDURE each-cheque
:
317 /*------------------------------------------------------------------------------
321 ------------------------------------------------------------------------------*/
323 IF Cheque.Cancelled
THEN RETURN.
324 FIND Creditor
OF Cheque
NO-LOCK.
326 PUT UNFORMATTED SPACE(3)
327 STRING( Cheque.PayeeName
, "X(50)" ) SPACE(2)
328 STRING( Cheque.ChequeNo
, "9999999" ) SPACE(2)
329 STRING( Cheque.Date
, "99/99/9999" ) SPACE(2).
333 STRING( IF Cheque.DateSent
= ?
THEN "" ELSE
334 STRING( Cheque.DateSent
, "99/99/9999" ), "X(10)" ) SPACE(2).
337 STRING( Cheque.Amount
, "->>>,>>>,>>9.99" ).
339 bank-account-total
= bank-account-total
+ Cheque.Amount.
340 IF Cheque.DateSent
= ?
THEN
341 bank-account-not-sent-total
= bank-account-not-sent-total
+ Cheque.Amount.
343 day-sent
= TODAY - Cheque.DateSent.
344 IF day-sent
>=0 AND day-sent
<= 6 THEN
345 day-sent-total
[ day-sent
+ 1 ] = day-sent-total
[ day-sent
+ 1] + Cheque.Amount.
351 /* _UIB-CODE-BLOCK-END
*/
356 &IF DEFINED(EXCLUDE-get-control-strings) = 0 &THEN
358 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-control-strings Procedure
359 PROCEDURE get-control-strings
:
360 /*------------------------------------------------------------------------------
362 ------------------------------------------------------------------------------*/
363 DEF VAR rows
AS DEC NO-UNDO.
364 DEF VAR cols
AS DEC NO-UNDO.
366 RUN make-control-string
( "PCL", "reset,portrait,a4,tm,0,lm,5",
367 OUTPUT reset-page
, OUTPUT rows
, OUTPUT cols
).
369 IF preview
THEN RETURN.
371 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,12",
372 OUTPUT title-font
, OUTPUT rows
, OUTPUT cols
).
374 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,7",
375 OUTPUT option-font
, OUTPUT rows
, OUTPUT cols
).
377 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,8",
378 OUTPUT bankaccount-font
, OUTPUT rows
, OUTPUT cols
).
380 RUN make-control-string
( "PCL", "LinePrinter,lpi,8",
381 OUTPUT line-printer
, OUTPUT rows
, OUTPUT cols
).
385 /* _UIB-CODE-BLOCK-END
*/
390 &IF DEFINED(EXCLUDE-get-option-string) = 0 &THEN
392 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-option-string Procedure
393 PROCEDURE get-option-string
:
394 /*------------------------------------------------------------------------------
396 ------------------------------------------------------------------------------*/
397 DEF VAR bank-account-string
AS CHAR NO-UNDO.
398 DEF VAR date-string
AS CHAR NO-UNDO.
399 DEF VAR cheque-string
AS CHAR NO-UNDO.
403 bank-account-string
= IF bankaccount-code
= ?
THEN "All Bank Accounts, " ELSE "".
404 date-string
= IF date-1
= {&EARLY-DATE} AND date-n = {&LATE-DATE} THEN
407 (IF date-1
= {&EARLY-DATE} THEN "" ELSE ", from " + STRING( date-1, "99/99/9999" ) ) +
408 (IF date-n
= {&LATE-DATE} THEN "" ELSE ", to " + STRING( date-n, "99/99/9999" ) ).
409 cheque-string
= IF cheque-1
= ?
OR cheque-n
= ?
THEN
412 "Cheque Numbers " + STRING( cheque-1
, ">999999" ) + " to" + STRING( cheque-n
, ">999999" ).
414 option-string
= bank-account-string
+ date-string
+ ", " + cheque-string.
418 /* _UIB-CODE-BLOCK-END
*/
423 &IF DEFINED(EXCLUDE-page-feed) = 0 &THEN
425 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-feed Procedure
426 PROCEDURE page-feed
:
427 /*------------------------------------------------------------------------------
431 ------------------------------------------------------------------------------*/
437 /* _UIB-CODE-BLOCK-END
*/
442 &IF DEFINED(EXCLUDE-page-header) = 0 &THEN
444 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-header Procedure
445 PROCEDURE page-header
:
446 /*------------------------------------------------------------------------------
450 ------------------------------------------------------------------------------*/
451 DEF VAR report-title
AS CHAR NO-UNDO INITIAL "Unpresented Cheques".
454 PUT CONTROL line-printer.
456 DEF VAR user-name
AS CHAR NO-UNDO.
457 {inc
/username.i
"user-name"}
460 PUT UNFORMATTED STRING( TODAY, "99/99/9999" ) ' '
STRING( TIME, "HH:MM:SS" ) + " for " + user-name.
463 PUT CONTROL title-font.
464 IF date-n
<> {&LATE-DATE} THEN report-title = report-title + " as at " + STRING( date-n, "99/99/9999").
465 IF date-1
<> {&EARLY-DATE} THEN report-title = report-title + " produced from " + STRING( date-1, "99/99/9999") + " onwards".
466 PUT UNFORMATTED STRING( report-title
, "X(100)" ).
468 PUT CONTROL line-printer.
471 PUT CONTROL option-font.
472 PUT UNFORMATTED STRING( option-string
, "X(100)" ).
474 PUT CONTROL line-printer.
480 /* _UIB-CODE-BLOCK-END
*/
485 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
487 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
488 PROCEDURE parse-parameters
:
489 /*------------------------------------------------------------------------------
491 ------------------------------------------------------------------------------*/
492 DEF VAR token
AS CHAR NO-UNDO.
493 DEF VAR i
AS INT NO-UNDO.
495 {inc
/showopts.i
"report-options"}
497 DO i
= 1 TO NUM-ENTRIES( report-options
, "~n" ):
498 token
= ENTRY( i
, report-options
, "~n" ).
500 CASE ENTRY( 1, token
):
501 WHEN "Preview" THEN preview
= Yes.
502 WHEN "BankAccount" THEN bankaccount-code
= ENTRY( 2, token
).
504 WHEN "Period" THEN ASSIGN
505 date-1
= DATE( ENTRY( 2, token
) )
506 date-n
= DATE( ENTRY( 3, token
) ) NO-ERROR.
508 WHEN "Cheques" THEN ASSIGN
509 cheque-1
= INT(ENTRY(2,token
))
510 cheque-n
= INT(ENTRY(3,token
)) NO-ERROR.
512 WHEN "Sent" THEN sent
= Yes.
516 IF date-1
= ?
OR date-1
< DATE(1,1,1980) THEN date-1
= {&EARLY-DATE} .
517 IF date-n
= ?
OR date-n
> (TODAY + 365) THEN date-n
= {&LATE-DATE} .
519 total-pre-space
= FILL( " ", IF sent
THEN 58 ELSE 46 ).
523 /* _UIB-CODE-BLOCK-END
*/
528 &IF DEFINED(EXCLUDE-reset-page) = 0 &THEN
530 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-page Procedure
531 PROCEDURE reset-page
:
532 /*------------------------------------------------------------------------------
536 ------------------------------------------------------------------------------*/
538 PUT CONTROL reset-page.
543 /* _UIB-CODE-BLOCK-END
*/
548 &IF DEFINED(EXCLUDE-sent-summary) = 0 &THEN
550 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE sent-summary Procedure
551 PROCEDURE sent-summary
:
552 /*------------------------------------------------------------------------------
554 ------------------------------------------------------------------------------*/
558 "Sent Cheque Summary".
562 STRING( "Date", "X(10)" ) SPACE(2)
563 STRING( " Total", "X(15)" ).
566 DEF VAR total-sent-in-last-week
AS DEC.
568 DO day-sent
= 1 TO 5:
571 STRING( TODAY - day-sent
+ 1, "99/99/9999" ) SPACE(2)
572 STRING( day-sent-total
[day-sent
], "->>>,>>>,>>9.99" ).
574 total-sent-in-last-week
= total-sent-in-last-week
+ day-sent-total
[day-sent
].
579 STRING( "Prior", "X(10)" ) SPACE(2)
580 STRING( bank-account-total
- (bank-account-not-sent-total
+ total-sent-in-last-week
), "->>>,>>>,>>9.99" ).
585 STRING( "Not sent", "X(10)" ) SPACE(2)
586 STRING( bank-account-not-sent-total
, "->>>,>>>,>>9.99" ).
596 STRING( bank-account-total
, "->>>,>>>,>>9.99" ).
601 /* _UIB-CODE-BLOCK-END
*/
606 &IF DEFINED(EXCLUDE-separator-line) = 0 &THEN
608 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE separator-line Procedure
609 PROCEDURE separator-line
:
610 /*------------------------------------------------------------------------------
614 ------------------------------------------------------------------------------*/
618 SPACE(30) FILL( "-", 15 ).
623 /* _UIB-CODE-BLOCK-END
*/
628 &IF DEFINED(EXCLUDE-skip-line) = 0 &THEN
630 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-line Procedure
631 PROCEDURE skip-line
:
632 /*------------------------------------------------------------------------------
634 ------------------------------------------------------------------------------*/
635 DEF INPUT PARAMETER n
AS DEC NO-UNDO.
637 DEF VAR int-part
AS INT NO-UNDO.
638 DEF VAR dec-part
AS DEC NO-UNDO.
640 int-part
= TRUNCATE( n
, 0 ).
641 IF int-part
< 0 THEN RETURN.
642 dec-part
= n
- int-part.
643 IF int-part
= 0 AND dec-part
= 0 THEN RETURN.
645 IF (ln
+ n
) > {&lines-per-page} THEN DO:
650 IF dec-part
<> 0 THEN PUT CONTROL half-line.
662 /* _UIB-CODE-BLOCK-END
*/
667 &IF DEFINED(EXCLUDE-unpresented-cheques) = 0 &THEN
669 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE unpresented-cheques Procedure
670 PROCEDURE unpresented-cheques
:
671 /*------------------------------------------------------------------------------
675 ------------------------------------------------------------------------------*/
677 RUN get-option-string.
678 RUN get-control-strings.
681 IF bankaccount-code
= ?
THEN
682 FOR EACH BankAccount
NO-LOCK:
683 RUN each-bank-account.
687 FIND FIRST BankAccount
WHERE BankAccount.BankAccountCode
= bankaccount-code
689 IF AVAILABLE BankAccount
THEN RUN each-bank-account.
696 /* _UIB-CODE-BLOCK-END
*/