1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
10 ------------------------------------------------------------------------*/
11 DEF INPUT PARAMETER report-options
AS CHAR NO-UNDO.
12 DEF INPUT PARAMETER preview
AS LOGICAL NO-UNDO.
15 DEF VAR prt-ctrl
AS CHAR NO-UNDO.
16 DEF VAR cols
AS INT NO-UNDO.
17 DEF VAR rows
AS INT NO-UNDO.
21 /* report control variables
*/
22 DEF VAR bank-code
AS CHAR NO-UNDO.
23 bank-code
= ENTRY( 1, report-options
).
24 DEF VAR batch-code
AS INT NO-UNDO.
25 batch-code
= INTEGER( ENTRY( 2, report-options
) ).
27 DEF VAR user-name
AS CHAR NO-UNDO.
28 {inc
/username.i
"user-name"}
30 DEF VAR cheque-total
AS DECIMAL FORMAT ">>>,>>>,>>9.99" DECIMALS 2 INITIAL 0 NO-UNDO.
31 DEF VAR cash-total
AS DECIMAL FORMAT ">>>,>>>,>>9.99" DECIMALS 2 INITIAL 0 NO-UNDO.
32 DEF VAR no-cheques
AS INTEGER FORMAT ">>9" INITIAL 0 NO-UNDO.
33 DEF VAR line
AS CHAR NO-UNDO.
35 DEF VAR bold-font
AS CHAR NO-UNDO INITIAL "fixed,courier,cpi,12,lpi,7,bold".
36 DEF VAR base-font
AS CHAR NO-UNDO INITIAL "fixed,courier,cpi,17,lpi,8.5,normal".
38 DEFINE WORK-TABLE OutLine
LIKE NewAcctTrans.
41 /* _UIB-CODE-BLOCK-END
*/
45 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
47 /* ******************** Preprocessor Definitions
******************** */
49 &Scoped-define PROCEDURE-TYPE Procedure
53 /* _UIB-PREPROCESSOR-BLOCK-END
*/
58 /* *********************** Procedure Settings
************************ */
60 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
61 /* Settings for
THIS-PROCEDURE
65 Add Fields to
: Neither
66 Other Settings
: CODE-ONLY
COMPILE
68 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
70 /* ************************* Create Window
************************** */
72 &ANALYZE-SUSPEND _CREATE-WINDOW
73 /* DESIGN Window definition
(used by the UIB
)
74 CREATE WINDOW Procedure
ASSIGN
77 /* END WINDOW DEFINITION
*/
83 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
84 /* ************************* Included-Libraries
*********************** */
86 {inc
/method
/m-txtrep.i
}
88 /* _UIB-CODE-BLOCK-END
*/
93 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
96 /* *************************** Main Block
*************************** */
98 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
99 RUN pclrep-start
( preview
, "reset,portrait,tm,2,a4,lm,6," + base-font
).
101 RUN first-pass-calculations.
102 RUN bank-header-details.
103 RUN second-pass-printing.
109 /* _UIB-CODE-BLOCK-END
*/
113 /* ********************** Internal Procedures
*********************** */
115 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE bank-header-details Procedure
116 PROCEDURE bank-header-details
:
117 /*------------------------------------------------------------------------------
118 Purpose
: Display details of bank info.
119 ------------------------------------------------------------------------------*/
120 line
= "Date: " + STRING( TODAY, "99/99/9999").
121 RUN pclrep-line
( bold-font
, line
).
122 RUN pclrep-down-by
( 1.7 ).
124 FIND BankAccount
WHERE BankAccount.BankAccountCode
= bank-code
NO-LOCK.
125 FIND Company
WHERE Company.CompanyCode
= BankAccount.CompanyCode
NO-LOCK.
127 line
= STRING( "For the credit of " + Company.LegalName
, "X(60)") + " Cash: " + STRING( cash-total
, ">>>,>>>,>>9.99").
128 RUN pclrep-line
( bold-font
, line
).
129 RUN pclrep-down-by
( 1.7 ).
130 line
= "With the " + BankAccount.BankName.
131 RUN pclrep-line
( bold-font
, line
).
132 line
= STRING( " " + BankAccount.BankBranchName
+ " # "
133 + SUBSTRING( BankAccount.BankAccount
, 1, 6), "X(60)")
134 + " Cheques: " + STRING( cheque-total
, ">>>,>>>,>>9.99").
135 RUN pclrep-line
( bold-font
, line
).
136 line
= STRING( " Account # " + SUBSTRING( BankAccount.BankAccount
, 7), "X(60)")
138 RUN pclrep-line
( bold-font
, line
).
139 line
= FILL( " ", 60) + " TOTAL: " + STRING( cash-total
+ cheque-total
, ">>>,>>>,>>9.99").
140 RUN pclrep-line
( bold-font
, line
).
142 RUN pclrep-down-by
( 3 ).
143 line
= "Paid in by . . . . . . . . . . . . . . . . . . . . . . . . . . ".
144 RUN pclrep-line
( bold-font
, line
).
146 RUN pclrep-down-by
( 3 ).
148 line
= STRING( "Cheque#", "X(8)")
149 + STRING( "Received from", "X(45)")
150 + STRING( "Bank", "X(7)")
151 + STRING( "Branch", "X(7)")
152 + STRING( " Cash", "X(12)")
155 RUN pclrep-line
( base-font
+ ",bold", line
).
157 RUN pclrep-down-by
( 1.7 ).
161 /* _UIB-CODE-BLOCK-END
*/
165 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-transaction Procedure
166 PROCEDURE each-transaction
:
167 /*------------------------------------------------------------------------------
168 Purpose
: Display each transaction.
169 ------------------------------------------------------------------------------*/
170 DEF VAR bank
AS CHAR NO-UNDO.
171 DEF VAR bsb
AS CHAR NO-UNDO.
172 DEF VAR description
AS CHAR NO-UNDO.
174 description
= OutLine.Description.
175 bank
= ENTRY( 1, OutLine.Description
, ' '
).
176 IF LENGTH(bank
) < 4 THEN DO:
177 description
= SUBSTRING( description
, INDEX(description
, " ") + 1).
178 bank
= bank
+ "/" + ENTRY( 1, description
, ' '
).
180 IF OutLine.Reference
= "CASH"
182 line
= STRING( OutLine.Reference
, "X(8)")
183 + STRING( OutLine.Description
, "X(59)")
184 + STRING( STRING( OutLine.Amount
, ">>,>>9.99") , "X(12)") .
187 IF NUM-ENTRIES(bank
,"/") = 2 THEN ASSIGN
188 bsb
= ENTRY( 2, bank
, "/" )
189 bank
= ENTRY( 1, bank
, "/" )
190 description
= SUBSTRING( description
, INDEX(description
, " ") + 1).
192 bsb
= SUBSTRING( bank
, 4, 3 )
193 bank
= SUBSTRING( bank
, 1, 3 ).
195 IF OutLine.Reference
BEGINS "R" THEN OutLine.Reference
= SUBSTRING( OutLine.Reference
, 2).
196 description
= ENTRY( 1, description
, "-" ).
197 line
= STRING( OutLine.Reference
, "X(8)")
198 + STRING( description
, "X(45)")
199 + STRING( bank
, "X(7)")
200 + STRING( bsb
, "X(7)")
201 + STRING( "", "X(12)")
202 + STRING( OutLine.Amount
, ">>>,>>>,>>9.99") .
205 RUN pclrep-line
( base-font
, line
).
209 /* _UIB-CODE-BLOCK-END
*/
213 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE first-pass-calculations Procedure
214 PROCEDURE first-pass-calculations
:
215 /*------------------------------------------------------------------------------
216 Purpose
: Calculate totals and no's of cheques
217 ------------------------------------------------------------------------------*/
218 DEF VAR last-cheque
AS CHAR NO-UNDO.
220 FOR EACH NewAcctTrans
WHERE NewAcctTrans.BatchCode
= batch-code
221 AND NewAcctTrans.DocumentCode
= 1
223 IF ENTRY( 1, NewAcctTrans.Description
, ' '
) = "CASH"
224 OR NewAcctTrans.Reference
= "CASH" THEN
225 cash-total
= cash-total
+ NewAcctTrans.Amount.
227 cheque-total
= cheque-total
+ NewAcctTrans.Amount.
228 IF NewAcctTrans.Reference
<> last-cheque
THEN DO:
229 no-cheques
= no-cheques
+ 1.
230 last-cheque
= NewAcctTrans.Reference.
238 /* _UIB-CODE-BLOCK-END
*/
242 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-footer Procedure
243 PROCEDURE inst-page-footer
:
244 /*------------------------------------------------------------------------------
248 ------------------------------------------------------------------------------*/
252 /* _UIB-CODE-BLOCK-END
*/
256 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-header Procedure
257 PROCEDURE inst-page-header
:
258 /*------------------------------------------------------------------------------
262 ------------------------------------------------------------------------------*/
266 /* _UIB-CODE-BLOCK-END
*/
270 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-footer Procedure
271 PROCEDURE report-footer
:
272 /*------------------------------------------------------------------------------
274 ------------------------------------------------------------------------------*/
276 line
= FILL( " ", 67) + FILL( "_", 29).
277 RUN pclrep-line
( base-font
, line
).
279 line
= FILL( " ", 67)
280 + STRING( STRING( cash-total
, ">>,>>9.99"), "X(12)")
281 + STRING( cheque-total
, ">>>,>>>,>>9.99")
283 RUN pclrep-line
( base-font
, line
).
285 line
= FILL( " ", 67) + FILL( "=", 29).
286 RUN pclrep-line
( base-font
, line
).
289 RUN pclrep-line
( base-font
, line
).
290 RUN pclrep-line
( base-font
, line
).
292 line
= STRING( "Number of cheques = " + STRING( no-cheques
), "X(65)")
293 + "Total deposit " + STRING( cash-total
+ cheque-total
, ">>>,>>>,>>9.99")
295 RUN pclrep-line
( base-font
, line
).
299 /* _UIB-CODE-BLOCK-END
*/
303 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE second-pass-printing Procedure
304 PROCEDURE second-pass-printing
:
305 /*------------------------------------------------------------------------------
306 Purpose
: Calculate totals and no's of cheques
307 ------------------------------------------------------------------------------*/
308 DEF VAR did-something
AS INT NO-UNDO INITIAL 0.
310 OutLine.Reference
= "nothing as yet".
311 FOR EACH NewAcctTrans
WHERE NewAcctTrans.BatchCode
= batch-code
312 AND NewAcctTrans.DocumentCode
= 1 NO-LOCK:
313 did-something
= did-something
+ 1.
314 IF NewAcctTrans.Reference
= "CASH" THEN DO:
315 RUN each-transaction.
316 BUFFER-COPY NewAcctTrans
TO OutLine.
319 IF OutLine.Reference
= "CASH" OR OutLine.Reference
<> NewAcctTrans.Reference
THEN DO:
320 IF OutLine.Reference
<> "nothing as yet" THEN RUN each-transaction.
321 BUFFER-COPY NewAcctTrans
TO OutLine.
324 OutLine.Amount
= OutLine.Amount
+ NewAcctTrans.Amount.
328 IF did-something
> 0 THEN RUN each-transaction.
332 /* _UIB-CODE-BLOCK-END
*/