Add blank column, rename column.
[capital-apms-progress.git] / process / report / actual-recoveries.p
blobed43369959ffc12abde89879534107cdd10a0dd5
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 one-property AS LOGI NO-UNDO INIT No.
11 DEF VAR property-code AS INT NO-UNDO INIT ?.
12 DEF VAR generate-transactions AS LOGI NO-UNDO INIT No.
13 DEF VAR exporting AS LOGI NO-UNDO INITIAL No.
14 DEF VAR month-ending AS INT NO-UNDO INITIAL ?.
15 DEF VAR year-end AS LOGI NO-UNDO INITIAL No.
16 DEF VAR summary AS LOGI NO-UNDO INITIAL No.
17 RUN parse-parameters.
19 DEF BUFFER ToMonth FOR Month.
20 FIND ToMonth WHERE ToMonth.MonthCode = month-ending NO-LOCK.
21 DEF BUFFER FromMonth FOR Month.
23 DEF VAR period-text AS CHAR NO-UNDO INITIAL "Month".
24 IF year-end THEN period-text = "Year".
26 DEF VAR batch-no AS INT NO-UNDO INITIAL ?.
27 DEF VAR document-no AS INT NO-UNDO.
28 DEF VAR transaction-no AS INT NO-UNDO.
29 DEF VAR need-property-header AS LOGI NO-UNDO.
30 DEF VAR need-account-header AS LOGI NO-UNDO.
31 DEF VAR property-total AS DEC NO-UNDO.
32 DEF VAR last-property AS INT NO-UNDO INITIAL ?.
34 DEF VAR user-name AS CHAR NO-UNDO.
35 {inc/username.i "user-name"}
36 DEF VAR timeStamp AS CHAR FORMAT "X(44)" NO-UNDO.
37 timeStamp = STRING( ToMonth.EndDate, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
39 DEF VAR line AS CHAR NO-UNDO.
41 DEF VAR time-font AS CHAR NO-UNDO INITIAL "helvetica,proportional,point,6,normal".
42 DEF VAR fixed-font AS CHAR NO-UNDO INITIAL "courier,fixed,cpi,16,lpi,9,normal".
43 DEF VAR header-font AS CHAR NO-UNDO INITIAL "Times,Point,11,lpi,6,Proportional,Normal".
45 DEF TEMP-TABLE TOG NO-UNDO
46 FIELD PropertyCode AS INT
47 FIELD TenantCode AS INT
48 FIELD AccountCode AS DEC
49 FIELD AccountName AS CHAR
50 FIELD Percent AS DEC
51 FIELD Fixed AS DEC
52 FIELD Budget AS DEC
53 FIELD Actual AS DEC
54 FIELD Recovered AS DEC
55 INDEX XPKTOG IS UNIQUE PRIMARY PropertyCode TenantCode AccountCode
56 INDEX XAK1TOG PropertyCode AccountCode .
59 {inc/ofc-this.i}
60 {inc/ofc-set.i "AcctGroup-Opex" "opex-groups"}
61 {inc/ofc-acct.i "OUTGOINGS" "outgoings-account"}
62 {inc/ofc-acct.i "DEBTORS" "sundry-debtors"}
63 DEF VAR gst-entity LIKE AcctTran.EntityCode NO-UNDO.
64 IF Office.GST <> ? THEN DO:
65 {inc/ofc-acct.i "GST-OUT" "gst-account"}
66 gst-entity = OfficeControlAccount.EntityCode.
67 END.
69 /* _UIB-CODE-BLOCK-END */
70 &ANALYZE-RESUME
73 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
75 /* ******************** Preprocessor Definitions ******************** */
77 &Scoped-define PROCEDURE-TYPE Procedure
81 /* _UIB-PREPROCESSOR-BLOCK-END */
82 &ANALYZE-RESUME
85 /* ************************ Function Prototypes ********************** */
87 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD each-account Procedure
88 FUNCTION each-account RETURNS DECIMAL
89 ( /* no parameters */ ) FORWARD.
91 /* _UIB-CODE-BLOCK-END */
92 &ANALYZE-RESUME
94 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD each-property Procedure
95 FUNCTION each-property RETURNS DECIMAL
96 ( /* parameter-definitions */ ) FORWARD.
98 /* _UIB-CODE-BLOCK-END */
99 &ANALYZE-RESUME
101 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD each-transaction Procedure
102 FUNCTION each-transaction RETURNS DECIMAL
103 ( INPUT percent AS DEC ) FORWARD.
105 /* _UIB-CODE-BLOCK-END */
106 &ANALYZE-RESUME
108 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-balance Procedure
109 FUNCTION get-balance RETURNS DECIMAL
110 ( INPUT et AS CHAR, INPUT ec AS INT, INPUT ac AS DEC ) FORWARD.
112 /* _UIB-CODE-BLOCK-END */
113 &ANALYZE-RESUME
115 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD make-transaction Procedure
116 FUNCTION make-transaction RETURNS LOGICAL
117 ( INPUT et AS CHAR, INPUT ec AS INT, INPUT ac AS DEC, INPUT ref AS CHAR, INPUT txt AS CHAR, INPUT amnt AS DEC, INPUT tr-date AS DATE ) FORWARD.
119 /* _UIB-CODE-BLOCK-END */
120 &ANALYZE-RESUME
122 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD transaction-line Procedure
123 FUNCTION transaction-line RETURNS CHARACTER
124 ( INPUT percent AS DEC ) FORWARD.
126 /* _UIB-CODE-BLOCK-END */
127 &ANALYZE-RESUME
130 /* *********************** Procedure Settings ************************ */
132 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
133 /* Settings for THIS-PROCEDURE
134 Type: Procedure
135 Allow:
136 Frames: 0
137 Add Fields to: Neither
138 Other Settings: CODE-ONLY COMPILE
140 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
142 /* ************************* Create Window ************************** */
144 &ANALYZE-SUSPEND _CREATE-WINDOW
145 /* DESIGN Window definition (used by the UIB)
146 CREATE WINDOW Procedure ASSIGN
147 HEIGHT = .35
148 WIDTH = 51.14.
149 /* END WINDOW DEFINITION */
151 &ANALYZE-RESUME
155 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
156 /* ************************* Included-Libraries *********************** */
158 {inc/method/m-txtrep.i}
159 {inc/date.i}
160 {inc/null.i}
161 {inc/convert.i}
163 /* _UIB-CODE-BLOCK-END */
164 &ANALYZE-RESUME
168 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
171 /* *************************** Main Block *************************** */
173 OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES PAGE-SIZE 0.
175 RUN pclrep-start( preview, "reset,portrait,tm,2,a4,lm,6,courier,cpi,18,lpi,9").
177 RUN actual-recoveries.
179 OUTPUT CLOSE.
181 RUN pclrep-finish.
183 /* _UIB-CODE-BLOCK-END */
184 &ANALYZE-RESUME
187 /* ********************** Internal Procedures *********************** */
189 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE actual-recoveries Procedure
190 PROCEDURE actual-recoveries :
191 /*------------------------------------------------------------------------------
192 Purpose:
193 ------------------------------------------------------------------------------*/
194 DEF VAR g-total AS DEC NO-UNDO INITIAL 0.0 .
195 IF one-property THEN DO:
196 FIND Property WHERE Property.PropertyCode = property-code NO-LOCK.
197 each-property().
198 END.
199 ELSE DO:
200 FOR EACH Property WHERE Property.Active AND NOT Property.ExternallyManaged NO-LOCK:
201 g-total = g-total + each-property().
202 END.
203 END.
205 END PROCEDURE.
207 /* _UIB-CODE-BLOCK-END */
208 &ANALYZE-RESUME
211 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-footer Procedure
212 PROCEDURE inst-page-footer :
213 /*------------------------------------------------------------------------------
214 Purpose: Print any page footer
215 ------------------------------------------------------------------------------*/
217 END PROCEDURE.
219 /* _UIB-CODE-BLOCK-END */
220 &ANALYZE-RESUME
223 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-header Procedure
224 PROCEDURE inst-page-header :
225 /*------------------------------------------------------------------------------
226 Purpose:
227 ------------------------------------------------------------------------------*/
229 line = timeStamp.
230 IF NOT exporting THEN DO:
231 line = line + CHR(13) + SPC(275) + "Page: " + STRING( pclrep-page-number ).
232 END.
233 RUN pclrep-line( time-font, line).
235 RUN pclrep-down-by(2).
236 RUN pclrep-line( header-font, SPC(35) + "Recoveries to " + STRING( ToMonth.EndDate, "99/99/9999")).
237 RUN pclrep-down-by(1).
239 END PROCEDURE.
241 /* _UIB-CODE-BLOCK-END */
242 &ANALYZE-RESUME
245 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
246 PROCEDURE parse-parameters :
247 /*------------------------------------------------------------------------------
248 Purpose:
249 ------------------------------------------------------------------------------*/
251 DEF VAR token AS CHAR NO-UNDO.
252 DEF VAR i AS INT NO-UNDO.
254 DO i = 1 TO NUM-ENTRIES( report-options, "~n" ):
255 token = ENTRY( i, report-options, "~n" ).
257 CASE ENTRY( 1, token ):
258 WHEN "Preview" THEN preview = Yes.
259 WHEN "Summary" THEN summary = Yes.
260 WHEN "Property" THEN property-code = INT( ENTRY(2,token ) ).
261 WHEN "OneProperty" THEN one-property = Yes.
262 WHEN "MakeTransactions" THEN generate-transactions = Yes.
263 WHEN "MonthEnding" THEN month-ending = INT( ENTRY(2,token) ).
264 END CASE.
266 END.
268 END PROCEDURE.
270 /* _UIB-CODE-BLOCK-END */
271 &ANALYZE-RESUME
274 /* ************************ Function Implementations ***************** */
276 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION each-account Procedure
277 FUNCTION each-account RETURNS DECIMAL
278 ( /* no parameters */ ) :
279 /*------------------------------------------------------------------------------
280 Purpose:
281 Notes:
282 ------------------------------------------------------------------------------*/
283 DEF VAR pcnt AS DEC NO-UNDO.
284 DEF VAR total-recovered AS DEC NO-UNDO.
285 DEF VAR total-expense AS DEC NO-UNDO.
286 DEF VAR txt AS CHAR NO-UNDO.
287 DEF VAR ref AS CHAR NO-UNDO.
289 FIND AccountBalance WHERE AccountBalance.EntityType = "P"
290 AND AccountBalance.EntityCode = Property.PropertyCode
291 AND AccountBalance.AccountCode = ChartOfAccount.AccountCode
292 AND AccountBalance.MonthCode = ToMonth.MonthCode
293 NO-LOCK NO-ERROR.
294 IF NOT AVAILABLE(AccountBalance) THEN RETURN 0.0 .
296 need-account-header = Yes.
297 FOR EACH TenancyLease OF Property WHERE TenancyLease.LeaseStatus <> "PAST"
298 AND TenancyLease.RecoveryType = "A" NO-LOCK:
299 IF TenancyLease.FirstLeaseStart > ToMonth.EndDate THEN NEXT.
300 FIND TenancyOutgoing OF TenancyLease WHERE TenancyOutgoing.AccountCode = ChartOfAccount.AccountCode NO-LOCK NO-ERROR.
301 pcnt = IF AVAILABLE(TenancyOutgoing) THEN TenancyOutgoing.Percent ELSE TenancyLease.OutgoingsRate.
302 IF pcnt = 0 THEN NEXT.
304 FOR EACH AcctTran WHERE AcctTran.EntityType = "P" AND AcctTran.EntityCode = Property.PropertyCode
305 AND AcctTran.AccountCode = ChartOfAccount.AccountCode
306 AND AcctTran.MonthCode = ToMonth.MonthCode
307 AND NOT(AcctTran.Reference BEGINS "XFR recovere")
308 NO-LOCK:
309 total-recovered = total-recovered + each-transaction( pcnt ).
310 total-expense = total-expense + AcctTran.Amount.
311 END.
312 END.
314 IF NOT summary AND NOT need-account-header THEN DO:
315 line = FILL( " ", 28) + FILL( '-', 12 ) + " " + FILL( '-', 12).
316 RUN pclrep-line( fixed-font, line ).
318 line = FILL( " ", 28)
319 + STRING( total-expense, ">,>>>,>>9.99CR") + " "
320 + STRING( total-recovered, ">,>>>,>>9.99CR").
321 RUN pclrep-line( fixed-font, line ).
322 RUN pclrep-down-by(0.8).
323 END.
325 IF generate-transactions AND total-expense <> 0 THEN DO:
326 document-no = document-no + 1.
327 txt = "Xfr recovered account balance to .3".
328 make-transaction( "P", Property.PropertyCode,
329 ChartOfAccount.AccountCode, "XFR recovered", txt, - total-expense, TODAY ).
330 make-transaction( "P", Property.PropertyCode,
331 ChartOfAccount.AccountCode + 0.3, "XFR recovered", txt, total-expense, TODAY ).
332 END.
334 RETURN total-recovered.
336 END FUNCTION.
338 /* _UIB-CODE-BLOCK-END */
339 &ANALYZE-RESUME
342 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION each-property Procedure
343 FUNCTION each-property RETURNS DECIMAL
344 ( /* parameter-definitions */ ) :
345 /*------------------------------------------------------------------------------
346 Purpose:
347 Notes:
348 ------------------------------------------------------------------------------*/
349 DEF VAR p-total AS DEC NO-UNDO INITIAL 0.0 .
351 FIND FIRST TenancyLease OF Property WHERE TenancyLease.LeaseStatus <> "PAST"
352 AND TenancyLease.RecoveryType = "A"
353 NO-LOCK NO-ERROR.
354 IF NOT AVAILABLE(TenancyLease) THEN DO:
355 IF one-property THEN
356 RUN pclrep-line( header-font, "Property " + STRING(Property.PropertyCode, "99999") + " has no leases on Actuals - skipped.").
357 RETURN 0.0 .
358 END.
360 FIND FIRST TenancyLease OF Property WHERE TenancyLease.LeaseStatus <> "PAST"
361 AND TenancyLease.RecoveryType = "B"
362 NO-LOCK NO-ERROR.
363 IF AVAILABLE(TenancyLease) THEN DO:
364 RUN pclrep-line( header-font, "Property " + STRING(Property.PropertyCode, "99999") + " has tenants on Budget outgoings - skipping") .
365 RETURN 0.0.
366 END.
368 need-property-header = Yes.
369 FOR EACH ChartOfAccount WHERE ChartOfAccount.ExpenseRecoveryType = "P"
370 OR ChartOfAccount.ExpenseRecoveryType = "O"
371 NO-LOCK:
373 FOR EACH ChartOfAccount WHERE ChartOfAccount.AccountCode = INT(ChartOfAccount.AccountCode)
374 AND LOOKUP( ChartOfAccount.AccountGroupCode, opex-groups) > 0 NO-LOCK:
376 p-total = p-total + each-account().
377 END.
379 IF p-total <> 0 THEN DO:
380 IF summary THEN DO:
381 RUN pclrep-line( fixed-font, "P" + STRING(Property.PropertyCode, "99999")
382 + " - " + STRING( null-str(Property.Name,"?"), "X(60)" )
383 + " for " + STRING( MONTH(ToMonth.StartDate), "99")
384 + "/" + STRING( YEAR(ToMonth.StartDate), "9999")
385 + " "
386 + STRING( p-total, ">,>>>,>>9.99CR") ).
387 END.
388 ELSE DO:
389 line = FILL( " ", 51) + FILL( '-', 12 ).
390 RUN pclrep-line( fixed-font, line ).
392 line = FILL( " ", 51)
393 + STRING( p-total, ">,>>>,>>9.99CR").
394 RUN pclrep-line( fixed-font, line ).
395 RUN pclrep-down-by(1.3).
396 END.
397 END.
398 ELSE IF one-property THEN DO:
399 RUN pclrep-line( header-font, "Property " + STRING(Property.PropertyCode, "99999") + " has nothing to recover - skipped.").
400 END.
402 RETURN p-total.
404 END FUNCTION.
406 /* _UIB-CODE-BLOCK-END */
407 &ANALYZE-RESUME
410 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION each-transaction Procedure
411 FUNCTION each-transaction RETURNS DECIMAL
412 ( INPUT percent AS DEC ) :
413 /*------------------------------------------------------------------------------
414 Purpose:
415 Notes:
416 ------------------------------------------------------------------------------*/
417 DEF VAR amount AS DEC NO-UNDO.
418 DEF VAR txt AS CHAR NO-UNDO.
419 DEF VAR ref AS CHAR NO-UNDO.
421 amount = ROUND( AcctTran.Amount * percent / 100, 2).
423 line = transaction-line( percent ).
424 IF NOT summary THEN DO:
425 RUN pclrep-line( fixed-font, line ).
426 IF generate-transactions THEN DO:
427 document-no = document-no + 1.
428 ref = AcctTran.Reference.
429 txt = AcctTran.Description.
430 IF ref = "" OR txt = "" THEN DO:
431 FIND Document OF AcctTran NO-LOCK.
432 IF txt = "" THEN txt = Document.Description .
433 IF ref = "" THEN ref = Document.Reference.
434 END.
436 txt = STRING( percent ) + "%, " + txt.
437 make-transaction( "T", TenancyLease.TenantCode, sundry-debtors,
438 ref, txt, amount, TODAY ).
439 make-transaction( "P", Property.PropertyCode, ChartOfAccount.AccountCode + 0.1,
440 ref, txt, - amount, TODAY ).
441 IF Office.GST <> ? THEN DO:
442 txt = "GST, " + txt.
443 make-transaction( "T", TenancyLease.TenantCode, sundry-debtors,
444 ref, txt, (amount * Office.GST / 100), TODAY).
445 make-transaction( "P", Property.PropertyCode, gst-account,
446 ref, txt, - (amount * Office.GST / 100), TODAY).
447 END.
448 END.
449 END.
451 RETURN amount.
453 END FUNCTION.
455 /* _UIB-CODE-BLOCK-END */
456 &ANALYZE-RESUME
459 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-balance Procedure
460 FUNCTION get-balance RETURNS DECIMAL
461 ( INPUT et AS CHAR, INPUT ec AS INT, INPUT ac AS DEC ) :
462 /*------------------------------------------------------------------------------
463 Purpose:
464 Notes:
465 ------------------------------------------------------------------------------*/
466 DEF VAR balance AS DEC NO-UNDO INITIAL 0.0 .
468 FOR EACH AccountBalance WHERE AccountBalance.EntityType = et
469 AND AccountBalance.EntityCode = ec
470 AND AccountBalance.AccountCode = ac
471 AND AccountBalance.MonthCode <= month-ending
472 AND AccountBalance.Balance <> 0.0 NO-LOCK:
473 balance = balance + AccountBalance.Balance.
474 END.
475 RETURN balance.
477 END FUNCTION.
479 /* _UIB-CODE-BLOCK-END */
480 &ANALYZE-RESUME
483 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION make-transaction Procedure
484 FUNCTION make-transaction RETURNS LOGICAL
485 ( INPUT et AS CHAR, INPUT ec AS INT, INPUT ac AS DEC, INPUT ref AS CHAR, INPUT txt AS CHAR, INPUT amnt AS DEC, INPUT tr-date AS DATE ) :
486 /*------------------------------------------------------------------------------
487 Purpose:
488 Notes:
489 ------------------------------------------------------------------------------*/
491 IF amnt = 0 OR amnt = ? THEN RETURN No.
493 IF batch-no = ? THEN DO:
494 CREATE NewBatch.
495 NewBatch.BatchType = "AUTO".
496 NewBatch.Description = "Actual recoveries to " + STRING( ToMonth.EndDate, "99/99/9999").
497 batch-no = NewBatch.BatchCode.
498 END.
500 FIND NewDocument WHERE NewDocument.BatchCode = batch-no
501 AND NewDocument.DocumentCode = document-no NO-LOCK NO-ERROR.
502 IF NOT AVAILABLE(NewDocument) THEN DO:
503 CREATE NewDocument.
504 NewDocument.BatchCode = batch-no.
505 NewDocument.DocumentCode = document-no.
506 NewDocument.DocumentType = "RCVR".
507 NewDocument.Reference = ref.
508 NewDocument.Description = txt.
509 transaction-no = 0.
510 END.
512 transaction-no = transaction-no + 1.
514 CREATE NewAcctTrans.
515 NewAcctTrans.BatchCode = batch-no.
516 NewAcctTrans.DocumentCode = document-no.
517 NewAcctTrans.EntityType = et.
518 NewAcctTrans.EntityCode = ec.
519 NewAcctTrans.AccountCode = ac.
520 NewAcctTrans.Amount = ROUND( amnt, 2).
521 NewAcctTrans.Date = tr-date.
522 NewAcctTrans.Description = txt.
523 NewAcctTrans.Reference = ref.
525 RETURN Yes.
527 END FUNCTION.
529 /* _UIB-CODE-BLOCK-END */
530 &ANALYZE-RESUME
533 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION transaction-line Procedure
534 FUNCTION transaction-line RETURNS CHARACTER
535 ( INPUT percent AS DEC ) :
536 /*------------------------------------------------------------------------------
537 Purpose:
538 Notes:
539 ------------------------------------------------------------------------------*/
540 DEF VAR s1 AS CHAR NO-UNDO.
541 DEF VAR ref AS CHAR NO-UNDO.
542 DEF VAR txt AS CHAR NO-UNDO.
544 IF need-property-header THEN DO:
545 IF NOT summary THEN DO:
546 RUN pclrep-down-by(0.4).
547 RUN pclrep-line( header-font, "P" + STRING(Property.PropertyCode, "99999")
548 + " - " + Property.Name
549 + " for " + STRING( MONTH(ToMonth.StartDate), "99")
550 + "/" + STRING( YEAR(ToMonth.StartDate), "9999") ).
551 RUN pclrep-down-by(0.3).
552 END.
553 need-property-header = No.
554 END.
556 IF need-account-header THEN DO:
557 IF NOT summary THEN DO:
558 RUN pclrep-line( header-font,
559 STRING( ChartOfAccount.AccountCode, "9999.99") + " " + ChartOfAccount.Name).
560 RUN pclrep-down-by(0.3).
561 END.
562 need-account-header = No.
563 END.
565 IF summary THEN RETURN "".
567 ref = AcctTran.Reference.
568 txt = AcctTran.Description.
569 IF ref = "" OR txt = "" THEN DO:
570 FIND Document OF AcctTran NO-LOCK.
571 IF ref = "" THEN ref = Document.Reference.
572 IF txt = "" THEN txt = Document.Description.
573 END.
574 FIND Tenant OF TenancyLease NO-LOCK.
575 s1 = "T" + STRING( Tenant.TenantCode, "99999") + " "
576 + STRING( Tenant.Name, "X(20)" ) + " "
577 + STRING( AcctTran.Amount, ">,>>>,>>9.99CR" ) + " "
578 + STRING( percent, ">>9.99" ) + "% "
579 + STRING( percent * AcctTran.Amount / 100, ">,>>>,>>9.99CR" ) + " "
580 + STRING( ref, "X(12)") + " " + txt .
582 RETURN s1.
584 END FUNCTION.
586 /* _UIB-CODE-BLOCK-END */
587 &ANALYZE-RESUME