1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
10 ------------------------------------------------------------------------*/
11 /* *************************** Definitions
************************** */
12 DEF INPUT PARAMETER report-options
AS CHAR NO-UNDO.
14 DEF VAR preview
AS LOGICAL NO-UNDO.
15 DEF VAR in-file
AS CHAR NO-UNDO.
16 DEF VAR create-receipts
AS LOGICAL NO-UNDO.
17 preview
= (ENTRY( 1, report-options
) = "Yes").
18 in-file
= ENTRY( 2, report-options
).
19 create-receipts
= (ENTRY( 3, report-options
) = "Yes").
21 /* MESSAGE preview in-file create-receipts.
*/
24 DEF VAR prt-ctrl
AS CHAR NO-UNDO.
25 DEF VAR cols
AS INT NO-UNDO.
26 DEF VAR rows
AS INT NO-UNDO.
27 DEF VAR user-name
AS CHAR FORMAT "X(20)" NO-UNDO.
28 {inc
/username.i
"user-name"}
31 &SCOPED-DEFINE page-width 180
32 &SCOPED-DEFINE with-clause NO-BOX USE-TEXT NO-LABELS WIDTH {&page-width}
34 DEF VAR timeStamp
AS CHAR FORMAT "X(54)" NO-UNDO.
35 timeStamp
= STRING( TODAY, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
36 DEF VAR hline2
AS CHAR FORMAT "X({&page-width})" NO-UNDO.
37 DEF VAR hline3
AS CHAR FORMAT "X({&page-width})" NO-UNDO.
38 hline2
= "Statement Processing for ANZ Online".
39 hline2
= SUBSTRING( STRING("","X({&page-width})"), 1, INTEGER(({&page-width} - LENGTH(hline2) ) / 2)) + hline2.
40 hline3
= "Presented Cheques" + (IF create-receipts
THEN " and Receipts Batch Creation" ELSE "").
41 hline3
= SUBSTRING( STRING("","X({&page-width})"), 1, INTEGER(({&page-width} - LENGTH(hline3) ) / 2)) + hline3.
43 DEFINE FRAME heading-frame
WITH 1 DOWN {&with-clause} PAGE-TOP.
45 timeStamp
"Page " + STRING( PAGE-NUMBER ) TO {&page-width} SKIP (1)
46 hline2
FORMAT "X({&page-width})"
47 hline3
FORMAT "X({&page-width})"
48 SKIP (2) " Date Bank Account Number Type Reference Amount || Import Program Action taken"
49 WITH FRAME heading-frame.
51 /* _UIB-CODE-BLOCK-END
*/
55 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
57 /* ******************** Preprocessor Definitions
******************** */
59 &Scoped-define PROCEDURE-TYPE Procedure
63 /* _UIB-PREPROCESSOR-BLOCK-END
*/
68 /* *********************** Procedure Settings
************************ */
70 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
71 /* Settings for
THIS-PROCEDURE
75 Add Fields to
: Neither
76 Other Settings
: CODE-ONLY
COMPILE
78 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
80 /* ************************* Create Window
************************** */
82 &ANALYZE-SUSPEND _CREATE-WINDOW
83 /* DESIGN Window definition
(used by the UIB
)
84 CREATE WINDOW Procedure
ASSIGN
87 /* END WINDOW DEFINITION
*/
93 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
94 /* ************************* Included-Libraries
*********************** */
96 {inc
/method
/m-txtrep.i
}
98 /* _UIB-CODE-BLOCK-END
*/
103 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
106 /* *************************** Main Block
*************************** */
108 RUN make-control-string
( "PCL", "reset,landscape,tm,2,a4,lm,6,courier,cpi,18,lpi,9",
109 OUTPUT prt-ctrl
, OUTPUT rows
, OUTPUT cols
).
111 RUN output-control-file
( prt-ctrl
).
112 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE VALUE(rows
).
114 VIEW FRAME heading-frame.
119 RUN view-output-file
( preview
).
121 /* _UIB-CODE-BLOCK-END
*/
125 /* ********************** Internal Procedures
*********************** */
127 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE convert-verbose-date Procedure
128 PROCEDURE convert-verbose-date
:
129 /*------------------------------------------------------------------------------
131 ------------------------------------------------------------------------------*/
132 DEF INPUT PARAMETER v-date
AS CHAR NO-UNDO.
133 DEF OUTPUT PARAMETER i-date
AS DATE NO-UNDO.
135 DEF VAR dd
AS INT NO-UNDO.
136 DEF VAR mm
AS INT INITIAL 1 NO-UNDO.
137 DEF VAR yy
AS INT NO-UNDO.
138 DEF VAR mth
AS CHAR NO-UNDO.
139 DEF VAR mth-list
AS CHAR INITIAL "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec" NO-UNDO.
141 dd
= INTEGER( SUBSTRING( v-date
, 1, INDEX( v-date
, "-") - 1)).
142 yy
= INTEGER( SUBSTRING( v-date
, R-INDEX( v-date
, "-") + 1)).
143 mth
= SUBSTRING( v-date
, INDEX( v-date
, "-") + 1, 3).
144 DO WHILE mm
< 12 AND ENTRY( mm
, mth-list
) <> mth
:
148 i-date
= DATE( mm
, dd
, yy
).
152 /* _UIB-CODE-BLOCK-END
*/
156 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE create-payment-transaction Procedure
157 PROCEDURE create-payment-transaction
:
158 /*------------------------------------------------------------------------------
160 ------------------------------------------------------------------------------*/
161 MESSAGE "Payment transaction creation not yet written!"
162 VIEW-AS ALERT-BOX ERROR.
166 /* _UIB-CODE-BLOCK-END
*/
170 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE mark-as-presented Procedure
171 PROCEDURE mark-as-presented
:
172 /*------------------------------------------------------------------------------
174 ------------------------------------------------------------------------------*/
175 DEF INPUT PARAMETER bkacct
AS CHAR NO-UNDO.
176 DEF INPUT PARAMETER chqnum
AS CHAR NO-UNDO.
177 DEF INPUT PARAMETER indate
AS CHAR NO-UNDO.
178 DEF INPUT PARAMETER amount
AS DEC NO-UNDO.
180 DEF VAR cheque-no
AS INT NO-UNDO.
181 DEF VAR prdate
AS DATE NO-UNDO.
183 RUN convert-verbose-date
( indate
, OUTPUT prdate
).
185 FIND BankAccount
WHERE BankAccount.BankAccount
= bkacct
NO-LOCK NO-ERROR.
186 IF NOT AVAILABLE(BankAccount
) THEN DO:
187 PUT UNFORMATTED "No bank account available with account code " bkacct
"!".
191 cheque-no
= INTEGER( chqnum
).
192 FIND Cheque
WHERE Cheque.BankAccountCode
= BankAccount.BankAccountCode
193 AND Cheque.ChequeNo
= cheque-no
EXCLUSIVE-LOCK NO-ERROR.
194 IF NOT AVAILABLE(Cheque
) THEN DO:
195 PUT UNFORMATTED "Cheque " cheque-no
" presented for " TRIM(STRING( amount
, ">>>,>>>,>>9.99")) " but no record of issue - ignored!".
199 IF amount
<> Cheque.Amount
THEN DO:
200 PUT UNFORMATTED "Cheque " cheque-no
" issued for " TRIM(STRING( Cheque.Amount
, ">>>,>>>,>>9.99")) "but presented for" TRIM(STRING( amount
, ">>>,>>>,>>9.99")).
201 MESSAGE "Cheque" STRING( cheque-no
, "999999") "issued for" STRING( Cheque.Amount
, ">>>,>>>,>>9.99")
202 " but presented for" STRING( amount
, ">>>,>>>,>>9.99") SKIP(1)
203 "Cheque not marked as presented!"
204 VIEW-AS ALERT-BOX WARNING TITLE "Error in presented amount!".
208 PUT UNFORMATTED "Cheque record updated".
210 ASSIGN Cheque.DatePresented
= prdate
211 Cheque.PresentedAmount
= amount.
215 /* _UIB-CODE-BLOCK-END
*/
219 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE present-cheques Procedure
220 PROCEDURE present-cheques
:
221 /*------------------------------------------------------------------------------
222 Purpose
: Mark cheques in ANZ on-line report as presented.
223 ------------------------------------------------------------------------------*/
224 DEF VAR tr-date
AS CHAR NO-UNDO.
/* date presented
*/
225 DEF VAR bk-acct
AS CHAR NO-UNDO.
226 DEF VAR tr-type
AS CHAR NO-UNDO.
227 DEF VAR tr-ref1
AS CHAR NO-UNDO.
/* cheque no
*/
228 DEF VAR tr-amnt
AS DEC NO-UNDO.
/* amount
*/
230 DEF VAR in-line
AS CHAR NO-UNDO.
232 INPUT FROM VALUE( in-file
+ "T.CSV").
234 IMPORT UNFORMATTED in-line .
235 tr-date
= ENTRY( 2, ENTRY( 1, in-line
), '
"').
236 bk-acct = ENTRY( 2, ENTRY( 2, in-line), '"'
).
237 tr-type
= ENTRY( 2, ENTRY( 8, in-line
), '
"').
238 tr-ref1 = ENTRY( 2, ENTRY( 9, in-line), '"'
).
239 tr-amnt
= DECIMAL( ENTRY( 2, ENTRY( 10, in-line
), '
"')).
241 PUT UNFORMATTED STRING( tr-date, "X(12)") " "
242 STRING( bk-acct, "X(20)") " "
243 STRING( tr-type, "X(10)") " "
244 STRING( tr-ref1, "X(18)") " "
245 STRING( tr-amnt, ">>>,>>>,>>9.99CR
") " ||
".
247 IF tr-type = "CHEQUE
" THEN DO:
248 RUN mark-as-presented( bk-acct, tr-ref1, tr-date, - tr-amnt ).
250 ELSE IF tr-type = "TRANSFER
" AND create-receipts THEN DO:
251 RUN create-payment-transaction.
253 PUT UNFORMATTED " " SKIP.
259 /* _UIB-CODE-BLOCK-END */