Added capital works blank section. Synced calling screen.
[capital-apms-progress.git] / process / report / debtors.p
blob2e9ddc81683f349dd819bdf5513313ce6c20c5d8
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 File : debtors.p
6 Purpose : Debtors report
7 Author(s) : Andrew McMillan
8 ------------------------------------------------------------------------*/
9 /* *************************** Definitions ************************** */
10 DEF INPUT PARAMETER report-options AS CHAR NO-UNDO.
12 /* report control parameters */
13 DEF VAR show-inactives AS LOGICAL NO-UNDO INITIAL Yes.
14 DEF VAR summarise-part AS LOGICAL NO-UNDO INITIAL No.
15 DEF VAR sort-by AS CHAR NO-UNDO.
16 DEF VAR report-all-records AS LOGICAL NO-UNDO INITIAL No.
17 DEF VAR record-1 AS CHAR NO-UNDO.
18 DEF VAR record-n AS CHAR NO-UNDO.
19 DEF VAR exporting AS LOGI NO-UNDO INITIAL No.
20 DEF VAR exclude-rent AS LOGI NO-UNDO INITIAL No.
21 DEF VAR file-name AS CHAR NO-UNDO.
22 DEF VAR list-name AS CHAR NO-UNDO.
23 DEF VAR min-abs-balance LIKE AccountSummary.Balance NO-UNDO INITIAL ?.
24 DEF VAR min-debit-balance LIKE AccountSummary.Balance NO-UNDO INITIAL ?.
25 DEF VAR overdue-balance LIKE AccountSummary.Balance NO-UNDO INITIAL ?.
26 DEF VAR overdue-periods AS INT NO-UNDO INITIAL ?.
27 DEF VAR asat-date LIKE AcctTran.Date NO-UNDO.
28 DEF VAR asat-month LIKE AcctTran.MonthCode NO-UNDO.
29 DEF VAR asat-month1 LIKE AcctTran.MonthCode NO-UNDO.
30 DEF VAR asat-month2 LIKE AcctTran.MonthCode NO-UNDO.
31 DEF VAR preview AS LOGICAL NO-UNDO INITIAL No.
32 RUN parse-parameters.
34 DEF VAR base-entity-type AS CHAR INITIAL "T" NO-UNDO.
35 DEF VAR header-not-displayed AS LOGICAL NO-UNDO INITIAL Yes.
36 DEF VAR need-break-header AS LOGICAL INITIAL Yes NO-UNDO.
37 DEF VAR need-entity-header AS LOGICAL INITIAL Yes NO-UNDO.
38 DEF VAR need-tenant-header AS LOGICAL INITIAL Yes NO-UNDO.
40 DEF VAR prt-ctrl AS CHAR NO-UNDO.
41 DEF VAR rows AS INT NO-UNDO.
42 DEF VAR cols AS INT NO-UNDO.
44 DEF VAR grand-total LIKE AcctTran.Amount INITIAL 0 NO-UNDO.
45 DEF VAR break-total LIKE AcctTran.Amount INITIAL 0 NO-UNDO.
46 DEF VAR entity-total LIKE AcctTran.Amount INITIAL 0 NO-UNDO.
47 DEF VAR tenant-total LIKE AcctTran.Amount INITIAL 0 NO-UNDO.
49 DEF VAR t-other-debits LIKE AcctTran.Amount INITIAL 0 NO-UNDO.
50 DEF VAR t-credits LIKE AcctTran.Amount INITIAL 0 NO-UNDO.
51 DEF VAR t-0 LIKE AcctTran.Amount INITIAL 0 NO-UNDO.
52 DEF VAR t-1 LIKE AcctTran.Amount INITIAL 0 NO-UNDO.
53 DEF VAR t-2 LIKE AcctTran.Amount INITIAL 0 NO-UNDO.
54 DEF VAR t-3 LIKE AcctTran.Amount INITIAL 0 NO-UNDO.
55 DEF VAR amt-fmt AS CHAR INIT "(>>,>>>,>>9.99)" NO-UNDO.
57 DEF VAR this-break AS CHAR NO-UNDO.
58 DEF VAR this-entity AS CHAR NO-UNDO.
59 DEF VAR money-format AS CHAR INITIAL ">,>>>,>>9.99CR" NO-UNDO.
61 DEF VAR user-name AS CHAR NO-UNDO.
62 DEF VAR timeStamp AS CHAR FORMAT "X(54)" NO-UNDO.
63 DEF VAR dispIntro AS CHAR FORMAT "X(35)" NO-UNDO.
64 DEF VAR dispDate AS CHAR FORMAT "X(8)" NO-UNDO.
65 DEF VAR dispReference AS CHAR FORMAT "X(12)" NO-UNDO.
66 DEF VAR dispDescription AS CHAR FORMAT "X(50)" NO-UNDO.
67 DEF VAR dispAmount AS CHAR FORMAT "X(14)" NO-UNDO.
68 DEF VAR dispNotes AS CHAR FORMAT "X(45)" NO-UNDO.
69 DEF VAR tenant-name AS CHAR NO-UNDO.
70 DEF VAR tenant-notes AS CHAR NO-UNDO.
72 {inc/ofc-this.i}
73 {inc/ofc-acct.i "DEBTORS" "sundry-debtors"}
76 &SCOPED-DEFINE page-width 185
77 DEF VAR hline2 AS CHAR FORMAT "X({&page-width})" NO-UNDO.
78 DEF VAR hline3 AS CHAR FORMAT "X({&page-width})" NO-UNDO.
79 hline2 = "Tenant Debtors Report to " + STRING(asat-date,"99/99/9999").
80 hline2 = SUBSTRING( STRING("","X({&page-width})"), 1, INTEGER(({&page-width} - LENGTH(hline2) ) / 2)) + hline2.
83 /* define all the frames for the report */
84 &SCOPED-DEFINE with-clause NO-BOX USE-TEXT NO-LABELS WIDTH {&page-width}
86 DEFINE FRAME default-frame WITH DOWN {&with-clause}.
88 DEFINE FRAME heading-frame WITH 1 DOWN {&with-clause} PAGE-TOP.
89 FORM HEADER
90 timeStamp "Page " + STRING( PAGE-NUMBER ) TO {&page-width} SKIP (1)
91 hline2 FORMAT "X({&page-width})" SKIP
92 hline3 FORMAT "X({&page-width})" SKIP
93 WITH FRAME heading-frame.
95 DEFINE FRAME report-line WITH DOWN {&with-clause}.
96 FORM dispIntro FORMAT "X(45)"
97 dispDate FORMAT "X(8)"
98 dispReference FORMAT "X(12)"
99 dispDescription FORMAT "X(50)"
100 dispAmount FORMAT "X(14)"
101 dispNotes
102 WITH FRAME report-line.
104 DEFINE WORK-TABLE Manager NO-UNDO
105 FIELD Manager LIKE Property.Manager
106 FIELD LastName AS CHAR
107 FIELD FullName AS CHAR.
109 /* _UIB-CODE-BLOCK-END */
110 &ANALYZE-RESUME
113 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
115 /* ******************** Preprocessor Definitions ******************** */
117 &Scoped-define PROCEDURE-TYPE Procedure
118 &Scoped-define DB-AWARE no
122 /* _UIB-PREPROCESSOR-BLOCK-END */
123 &ANALYZE-RESUME
127 /* *********************** Procedure Settings ************************ */
129 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
130 /* Settings for THIS-PROCEDURE
131 Type: Procedure
132 Allow:
133 Frames: 0
134 Add Fields to: Neither
135 Other Settings: CODE-ONLY COMPILE
137 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
139 /* ************************* Create Window ************************** */
141 &ANALYZE-SUSPEND _CREATE-WINDOW
142 /* DESIGN Window definition (used by the UIB)
143 CREATE WINDOW Procedure ASSIGN
144 HEIGHT = 20.6
145 WIDTH = 40.
146 /* END WINDOW DEFINITION */
148 &ANALYZE-RESUME
150 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
151 /* ************************* Included-Libraries *********************** */
153 {inc/method/m-txtrep.i}
154 {inc/convert.i}
156 /* _UIB-CODE-BLOCK-END */
157 &ANALYZE-RESUME
163 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
166 /* *************************** Main Block *************************** */
167 {inc/username.i "user-name"}
168 timeStamp = "Printed at " + STRING( TODAY, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
170 RUN make-control-string ( "PCL", "reset,landscape,tm,2,a4,lm,6,courier,cpi,18,lpi,9",
171 OUTPUT prt-ctrl, OUTPUT rows, OUTPUT cols ).
173 RUN output-control-file ( prt-ctrl ).
174 OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES PAGE-SIZE VALUE(rows).
176 RUN debtors-report.
178 OUTPUT CLOSE.
180 IF exporting THEN
181 MESSAGE "Export Complete" VIEW-AS ALERT-BOX INFORMATION TITLE "Finished".
182 ELSE
183 RUN view-output-file ( preview ).
185 /* _UIB-CODE-BLOCK-END */
186 &ANALYZE-RESUME
189 /* ********************** Internal Procedures *********************** */
191 &IF DEFINED(EXCLUDE-break-footing) = 0 &THEN
193 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE break-footing Procedure
194 PROCEDURE break-footing :
195 /*------------------------------------------------------------------------------
196 Purpose:
197 ------------------------------------------------------------------------------*/
198 DEF INPUT PARAMETER brk-name AS CHAR NO-UNDO.
200 RUN disp-totals( break-total, "Total for " + brk-name ).
201 grand-total = grand-total + break-total.
203 END PROCEDURE.
205 /* _UIB-CODE-BLOCK-END */
206 &ANALYZE-RESUME
208 &ENDIF
210 &IF DEFINED(EXCLUDE-break-heading) = 0 &THEN
212 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE break-heading Procedure
213 PROCEDURE break-heading :
214 /*------------------------------------------------------------------------------
215 Purpose:
216 ------------------------------------------------------------------------------*/
217 DEF INPUT PARAMETER brk-name AS CHAR NO-UNDO.
219 IF NOT need-break-header THEN RETURN.
220 need-break-header = No.
222 hline3 = sort-by + " - " + brk-name.
223 hline3 = SUBSTRING( STRING("","X({&page-width})"), 1, INTEGER(({&page-width} - LENGTH(hline3) ) / 2)) + hline3.
224 IF header-not-displayed THEN DO:
225 VIEW FRAME heading-frame.
226 header-not-displayed = No.
227 END.
228 ELSE
229 PAGE.
231 break-total = 0.
233 END PROCEDURE.
235 /* _UIB-CODE-BLOCK-END */
236 &ANALYZE-RESUME
238 &ENDIF
240 &IF DEFINED(EXCLUDE-build-manager-table) = 0 &THEN
242 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE build-manager-table Procedure
243 PROCEDURE build-manager-table :
244 /*------------------------------------------------------------------------------
245 Purpose:
246 ------------------------------------------------------------------------------*/
247 FOR EACH Property NO-LOCK:
248 FIND FIRST Manager WHERE Property.Manager = Manager.Manager NO-ERROR.
249 IF NOT AVAILABLE(Manager) THEN DO:
250 CREATE Manager.
251 Manager.Manager = Property.Manager.
252 FIND Person WHERE Person.PersonCode = Manager.Manager NO-LOCK NO-ERROR.
253 IF AVAILABLE(Person) THEN ASSIGN
254 Manager.LastName = Person.LastName
255 Manager.FullName = Person.FirstName + " " + Person.LastName .
256 ELSE ASSIGN
257 Manager.LastName = "ZZZZZZZZZZZZZZZZZZZZZ"
258 Manager.FullName = "Manager Record not on file" .
259 END.
260 END.
262 END PROCEDURE.
264 /* _UIB-CODE-BLOCK-END */
265 &ANALYZE-RESUME
267 &ENDIF
269 &IF DEFINED(EXCLUDE-debtors-report) = 0 &THEN
271 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE debtors-report Procedure
272 PROCEDURE debtors-report :
273 /*------------------------------------------------------------------------------
274 Purpose:
275 ------------------------------------------------------------------------------*/
277 IF sort-by = "Manager" THEN
278 RUN report-by-manager.
279 ELSE IF sort-by = "Region" THEN
280 RUN report-by-region.
281 ELSE IF sort-by = "Property" THEN
282 RUN report-by-property.
283 ELSE IF sort-by = "Company" THEN
284 RUN report-by-company.
286 IF report-all-records AND sort-by <> "Company" THEN RUN non-property-debtors.
288 IF min-abs-balance > 0.01 OR min-abs-balance = ? OR grand-total <> 0 THEN
289 DO WITH FRAME report-line:
290 RUN disp-totals( grand-total, "Total for entire report" ).
292 IF min-abs-balance >= 0.01 OR min-abs-balance = ? THEN DO:
293 DISPLAY "Other debtors not shown" @ dispDescription
294 STRING( t-other-debits, money-format) @ dispAmount.
295 DOWN.
296 RUN disp-totals( grand-total + t-other-debits, "This report + other debit balances").
298 DISPLAY " " @ dispIntro " " @ dispDate " " @ dispReference " " @ dispDescription "============ " @ dispAmount " " @ dispNotes. DOWN.
299 DISPLAY " " @ dispAmount. DOWN.
301 DISPLAY "Credit balances not shown" @ dispDescription
302 STRING( t-credits, money-format) @ dispAmount.
303 DOWN.
304 RUN disp-totals( grand-total + t-other-debits + t-credits, "Grand Total Debtors").
306 DISPLAY " " @ dispIntro " " @ dispDate " " @ dispReference " " @ dispDescription "============ " @ dispAmount " " @ dispNotes. DOWN.
307 DISPLAY " " @ dispAmount. DOWN.
309 DISPLAY "Total 3 Months and over" @ dispDescription STRING( t-3, money-format) @ dispAmount. DOWN.
310 DISPLAY "Total 2 Months " @ dispDescription STRING( t-2, money-format) @ dispAmount. DOWN.
311 DISPLAY "Total 1 Month" @ dispDescription STRING( t-1, money-format) @ dispAmount. DOWN.
312 DISPLAY "Total Current Period" @ dispDescription STRING( t-0, money-format) @ dispAmount. DOWN.
313 END.
314 END.
316 END PROCEDURE.
318 /* _UIB-CODE-BLOCK-END */
319 &ANALYZE-RESUME
321 &ENDIF
323 &IF DEFINED(EXCLUDE-disp-totals) = 0 &THEN
325 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disp-totals Procedure
326 PROCEDURE disp-totals :
327 /*------------------------------------------------------------------------------
328 Purpose: Display a totals line
329 ------------------------------------------------------------------------------*/
330 DEF INPUT PARAMETER this-total LIKE AcctTran.Amount NO-UNDO.
331 DEF INPUT PARAMETER this-text LIKE dispDescription NO-UNDO.
333 DISPLAY
334 " " @ dispIntro
335 " " @ dispDate
336 " " @ dispReference
337 " " @ dispDescription
338 "------------ " @ dispAmount
339 " " @ dispNotes
340 WITH FRAME report-line.
341 DOWN WITH FRAME report-line.
342 DISPLAY this-text @ dispDescription
343 STRING( this-total, money-format) @ dispAmount
344 WITH FRAME report-line.
345 DOWN WITH FRAME report-line.
346 PUT UNFORMATTED SKIP.
348 END PROCEDURE.
350 /* _UIB-CODE-BLOCK-END */
351 &ANALYZE-RESUME
353 &ENDIF
355 &IF DEFINED(EXCLUDE-each-account) = 0 &THEN
357 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-account Procedure
358 PROCEDURE each-account :
359 /*------------------------------------------------------------------------------
360 Purpose: Find each suitable transaction for the tenant
361 ------------------------------------------------------------------------------*/
362 DEF VAR l-no AS INTEGER INITIAL 0 NO-UNDO.
363 DEF VAR no-notes AS INTEGER NO-UNDO.
364 DEF VAR no-names AS INTEGER NO-UNDO.
366 DEF VAR bal-t AS DEC NO-UNDO.
367 DEF VAR bal-0 AS DEC NO-UNDO.
368 DEF VAR bal-1 AS DEC NO-UNDO.
369 DEF VAR bal-2 AS DEC NO-UNDO.
370 DEF VAR bal-3 AS DEC NO-UNDO.
371 DEF VAR bal-overdue AS DEC NO-UNDO.
373 tenant-total = 0.
374 need-tenant-header = Yes.
375 dispNotes = "".
377 IF min-abs-balance >= 0.01 OR min-debit-balance >= 0.01 THEN DO:
378 /* using some new options */
379 RUN get-balances( Tenant.TenantCode,
380 OUTPUT bal-t, OUTPUT bal-0, OUTPUT bal-1, OUTPUT bal-2, OUTPUT bal-3,
381 OUTPUT bal-overdue ).
383 IF (overdue-balance <> ? AND bal-overdue >= overdue-balance) THEN DO:
384 IF bal-t < 0 THEN DO:
385 t-credits = t-credits + bal-t.
386 RETURN.
387 END.
388 /* else fall through to show debtor on report */
389 END.
390 ELSE IF (min-debit-balance <> ? AND bal-t < min-debit-balance) THEN DO:
391 IF bal-t < 0 THEN t-credits = t-credits + bal-t.
392 ELSE ASSIGN t-other-debits = t-other-debits + bal-t
393 t-0 = t-0 + bal-0
394 t-1 = t-1 + bal-1
395 t-2 = t-2 + bal-2
396 t-3 = t-3 + bal-3 .
397 RETURN.
398 END.
399 ELSE IF (min-abs-balance <> ? AND ABS(bal-t) < ABS(min-abs-balance)) THEN DO:
400 IF bal-t < 0 THEN t-credits = t-credits + bal-t.
401 ELSE ASSIGN t-other-debits = t-other-debits + bal-t
402 t-0 = t-0 + bal-0
403 t-1 = t-1 + bal-1
404 t-2 = t-2 + bal-2
405 t-3 = t-3 + bal-3 .
406 RETURN.
407 END.
408 END.
410 t-0 = t-0 + bal-0.
411 t-1 = t-1 + bal-1.
412 t-2 = t-2 + bal-2.
413 t-3 = t-3 + bal-3.
415 FIND Note WHERE Note.NoteCode = Tenant.NoteCode NO-LOCK NO-ERROR.
416 RUN word-wrap( (IF AVAILABLE(Note) THEN Note.Detail ELSE ""), 45, OUTPUT tenant-notes).
417 RUN word-wrap( STRING(Tenant.TenantCode,"99999") + " " + Tenant.Name, 29, OUTPUT tenant-name).
418 no-notes = NUM-ENTRIES( tenant-notes, CHR(10) ).
419 no-names = NUM-ENTRIES( tenant-name, CHR(10) ).
421 FOR EACH AcctTran NO-LOCK
422 WHERE AcctTran.EntityType = base-entity-type
423 AND AcctTran.EntityCode = Tenant.TenantCode
424 AND AcctTran.AccountCode = sundry-debtors
425 AND AcctTran.MonthCode <= asat-month
426 AND (AcctTran.ClosingGroup = ? OR AcctTran.ClosingGroup = 0 OR (IF summarise-part THEN No ELSE AcctTran.ClosedState = "P") ),
427 FIRST Document OF AcctTran NO-LOCK
428 BY AcctTran.EntityType BY AcctTran.EntityCode BY AcctTran.AccountCode
429 BY AcctTran.MonthCode BY AcctTran.Date
430 BY AcctTran.BatchCode BY AcctTran.DocumentCode BY AcctTran.TransactionCode:
431 l-no = l-no + 1.
432 IF l-no <= no-notes THEN dispNotes = ENTRY( l-no, tenant-notes, CHR(10)).
433 IF l-no <= no-names THEN dispIntro = FILL(' ', 6) + ENTRY( l-no, tenant-name, CHR(10)).
435 RUN for-each-transaction.
436 ASSIGN dispIntro = "" dispNotes = "" .
437 END.
439 /* catch transactions which have closed, but where part of the group is after
440 * the end of the report
442 DEF VAR group-list AS CHAR NO-UNDO INITIAL "".
443 DEF VAR group-code AS CHAR NO-UNDO.
444 DEF BUFFER ClosedTran FOR AcctTran.
446 next-closed-tran:
447 FOR EACH ClosedTran NO-LOCK
448 WHERE ClosedTran.EntityType = base-entity-type
449 AND ClosedTran.EntityCode = Tenant.TenantCode
450 AND ClosedTran.AccountCode = sundry-debtors
451 AND ClosedTran.MonthCode > asat-month
452 AND ClosedTran.ClosingGroup > 0
453 AND ClosedTran.ClosedState = "F"
454 BY ClosedTran.EntityType BY ClosedTran.EntityCode
455 BY ClosedTran.AccountCode BY ClosedTran.ClosingGroup:
457 group-code = STRING(ClosedTran.ClosingGroup).
458 IF LOOKUP( group-code, group-list ) > 0 THEN NEXT next-closed-tran.
459 group-list = group-list + group-code + ",".
461 FOR EACH AcctTran WHERE AcctTran.EntityType = base-entity-type
462 AND AcctTran.EntityCode = Tenant.TenantCode
463 AND AcctTran.AccountCode = sundry-debtors
464 AND AcctTran.ClosingGroup = ClosedTran.ClosingGroup
465 AND AcctTran.MonthCode <= asat-month NO-LOCK,
466 FIRST Document OF AcctTran NO-LOCK
467 BY AcctTran.EntityType BY AcctTran.EntityCode BY AcctTran.AccountCode
468 BY AcctTran.MonthCode BY AcctTran.Date
469 BY AcctTran.BatchCode BY AcctTran.DocumentCode BY AcctTran.TransactionCode:
471 l-no = l-no + 1.
472 IF l-no <= no-notes THEN dispNotes = ENTRY( l-no, tenant-notes, CHR(10)).
473 IF l-no <= no-names THEN dispIntro = FILL(' ', 6) + ENTRY( l-no, tenant-name, CHR(10)).
475 RUN for-each-transaction.
476 ASSIGN dispIntro = "" dispNotes = "" .
477 END.
478 END.
480 IF summarise-part THEN DO:
481 FOR EACH ClosingGroup NO-LOCK
482 WHERE ClosingGroup.EntityType = base-entity-type
483 AND ClosingGroup.EntityCode = Tenant.TenantCode
484 AND ClosingGroup.AccountCode = sundry-debtors
485 AND ClosingGroup.ClosedStatus = "P"
486 BY ClosingGroup.EntityType BY ClosingGroup.EntityCode
487 BY ClosingGroup.AccountCode BY ClosingGroup.Date:
488 l-no = l-no + 1.
489 IF l-no <= no-notes THEN dispNotes = ENTRY( l-no, tenant-notes, CHR(10)).
490 IF l-no <= no-names THEN dispIntro = FILL(' ', 6) + ENTRY( l-no, tenant-name, CHR(10)).
491 RUN for-each-closing-group.
492 ASSIGN dispIntro = "" dispNotes = "" .
493 END.
494 END.
496 IF l-no < 1 THEN RETURN.
498 DO WHILE ( l-no < no-notes ):
499 IF need-tenant-header THEN RUN tenant-heading.
501 l-no = l-no + 1.
502 dispNotes = (IF l-no <= no-notes THEN ENTRY( l-no, tenant-notes, CHR(10)) ELSE "").
503 dispIntro = (IF l-no <= no-names THEN
504 FILL(' ', 6) +
505 STRING( Tenant.TenantCode, "99999") + " " +
506 ENTRY( l-no, tenant-name, CHR(10)) ELSE "").
508 DISPLAY
509 dispIntro
510 "" @ dispDate
511 "" @ dispReference
512 "" @ dispDescription
513 "" @ dispAmount
514 dispNotes
515 WITH FRAME report-line.
516 DOWN WITH FRAME report-line.
518 END.
520 RUN disp-totals( tenant-total, "" ).
521 entity-total = entity-total + tenant-total.
523 END PROCEDURE.
525 /* _UIB-CODE-BLOCK-END */
526 &ANALYZE-RESUME
528 &ENDIF
530 &IF DEFINED(EXCLUDE-each-company) = 0 &THEN
532 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-company Procedure
533 PROCEDURE each-company :
534 /*------------------------------------------------------------------------------
535 Purpose:
536 ------------------------------------------------------------------------------*/
537 need-break-header = Yes.
538 this-break = STRING(Company.CompanyCode, "99999") + " " + Company.LegalName.
539 FOR EACH Property OF Company NO-LOCK BY Property.PropertyCode:
540 need-entity-header = Yes.
541 this-entity = STRING(Property.PropertyCode, "99999") + " " + Property.Name.
542 FOR EACH Tenant NO-LOCK WHERE (Tenant.Active OR show-inactives)
543 AND Tenant.EntityType = "P"
544 AND Tenant.EntityCode = Property.PropertyCode
545 BY Tenant.TenantCode:
546 RUN each-tenant.
547 END.
548 IF NOT(need-entity-header) THEN RUN entity-footing( this-entity ).
549 END.
550 need-entity-header = Yes.
551 this-entity = "L" + STRING(Company.CompanyCode) + " - Non-Property Debtors".
552 FOR EACH Tenant NO-LOCK WHERE (Tenant.Active OR show-inactives)
553 AND Tenant.EntityType = "L"
554 AND Tenant.EntityCode = Company.CompanyCode
555 BY Tenant.TenantCode:
556 RUN each-tenant.
557 END.
558 IF NOT(need-entity-header) THEN RUN entity-footing( this-entity ).
560 IF NOT(need-break-header) THEN RUN break-footing( this-break ).
562 END PROCEDURE.
564 /* _UIB-CODE-BLOCK-END */
565 &ANALYZE-RESUME
567 &ENDIF
569 &IF DEFINED(EXCLUDE-each-tenant) = 0 &THEN
571 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-tenant Procedure
572 PROCEDURE each-tenant :
573 /*------------------------------------------------------------------------------
574 Purpose:
575 ------------------------------------------------------------------------------*/
576 DEF BUFFER AltTran FOR AcctTran.
578 /* This IF statement is so horridible I decided to put it in it's own routine */
579 FIND FIRST AcctTran WHERE AcctTran.EntityType = base-entity-type
580 AND AcctTran.EntityCode = Tenant.TenantCode
581 AND AcctTran.AccountCode = sundry-debtors
582 AND AcctTran.MonthCode <= asat-month
583 AND (AcctTran.ClosingGroup = ?
584 OR AcctTran.ClosedState = "P"
585 OR CAN-FIND(FIRST AltTran WHERE AltTran.EntityType = base-entity-type
586 AND AltTran.EntityCode = Tenant.TenantCode
587 AND AltTran.AccountCode = sundry-debtors
588 AND AltTran.MonthCode > asat-month
589 AND AltTran.ClosedState = "F")
590 ) NO-LOCK NO-ERROR.
592 IF AVAILABLE(AcctTran) THEN RUN each-account.
594 END PROCEDURE.
596 /* _UIB-CODE-BLOCK-END */
597 &ANALYZE-RESUME
599 &ENDIF
601 &IF DEFINED(EXCLUDE-entity-footing) = 0 &THEN
603 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE entity-footing Procedure
604 PROCEDURE entity-footing :
605 /*------------------------------------------------------------------------------
606 Purpose:
607 ------------------------------------------------------------------------------*/
608 DEF INPUT PARAMETER e-name AS CHAR NO-UNDO.
610 RUN disp-totals( entity-total, "Total for " + e-name ).
611 break-total = break-total + entity-total.
613 END PROCEDURE.
615 /* _UIB-CODE-BLOCK-END */
616 &ANALYZE-RESUME
618 &ENDIF
620 &IF DEFINED(EXCLUDE-entity-heading) = 0 &THEN
622 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE entity-heading Procedure
623 PROCEDURE entity-heading :
624 /*------------------------------------------------------------------------------
625 Purpose:
626 ------------------------------------------------------------------------------*/
627 DEF INPUT PARAMETER e-name AS CHAR NO-UNDO.
629 IF NOT need-entity-header THEN RETURN.
630 need-entity-header = No.
631 IF need-break-header THEN RUN break-heading( this-break ).
633 DISPLAY
634 FILL( ' ', 3) + e-name @ dispIntro
635 ' ' @ dispDate
636 ' ' @ dispReference
637 ' ' @ dispDescription
638 ' ' @ dispAmount
639 ' ' @ dispNotes
640 WITH FRAME report-line.
641 DOWN WITH FRAME report-line.
642 DISPLAY
643 FILL( ' ', 3) + FILL('-', LENGTH(e-name)) @ dispIntro
644 ' ' @ dispDate
645 ' ' @ dispReference
646 ' ' @ dispDescription
647 ' ' @ dispAmount
648 ' ' @ dispNotes
649 WITH FRAME report-line.
650 DOWN WITH FRAME report-line.
652 entity-total = 0.
653 END PROCEDURE.
655 /* _UIB-CODE-BLOCK-END */
656 &ANALYZE-RESUME
658 &ENDIF
660 &IF DEFINED(EXCLUDE-for-each-closing-group) = 0 &THEN
662 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE for-each-closing-group Procedure
663 PROCEDURE for-each-closing-group :
664 /*------------------------------------------------------------------------------
665 Purpose:
666 ------------------------------------------------------------------------------*/
667 DEF VAR grp-amount AS DEC NO-UNDO INITIAL 0.
669 FIND LAST AcctTran NO-LOCK OF ClosingGroup WHERE AcctTran.MonthCode <= asat-month NO-ERROR.
670 IF NOT AVAILABLE(AcctTran) THEN RETURN.
672 ASSIGN dispDate = STRING( ClosingGroup.Date, "99/99/99" )
673 dispReference = "CG " + STRING( ClosingGroup.ClosingGroup)
674 dispDescription = (IF ClosingGroup.Description <> "" THEN ClosingGroup.Description ELSE AcctTran.Description) .
676 IF dispDescription = "" /* OR dispReference = "" */ THEN DO:
677 FIND Document NO-LOCK OF AcctTran.
678 IF dispDescription = "" THEN dispDescription = Document.Description.
679 /* IF dispReference = "" THEN dispReference = Document.Reference. */
680 END.
682 DEF BUFFER AltTran FOR AcctTran.
683 FOR EACH AltTran NO-LOCK OF ClosingGroup WHERE AltTran.MonthCode <= asat-month:
684 grp-amount = grp-amount + AltTran.Amount.
685 END.
687 dispAmount = STRING( grp-amount, money-format ).
688 tenant-total = tenant-total + grp-amount.
690 IF need-tenant-header THEN RUN tenant-heading.
691 DISPLAY
692 dispIntro
693 dispDate
694 dispReference
695 dispDescription
696 dispAmount
697 dispNotes
698 WITH FRAME report-line.
700 DOWN WITH FRAME report-line.
702 END PROCEDURE.
704 /* _UIB-CODE-BLOCK-END */
705 &ANALYZE-RESUME
707 &ENDIF
709 &IF DEFINED(EXCLUDE-for-each-transaction) = 0 &THEN
711 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE for-each-transaction Procedure
712 PROCEDURE for-each-transaction :
713 /*------------------------------------------------------------------------------
714 Purpose:
715 ------------------------------------------------------------------------------*/
716 IF need-tenant-header THEN RUN tenant-heading.
717 ASSIGN
718 dispDate = STRING( AcctTran.Date, "99/99/99" )
719 dispReference = IF (AcctTran.Reference = "") THEN (Document.Reference) ELSE (AcctTran.Reference)
720 dispDescription = IF (AcctTran.Description = "") THEN (Document.Description) ELSE (AcctTran.Description)
721 dispAmount = STRING( AcctTran.Amount, money-format )
722 tenant-total = tenant-total + AcctTran.Amount .
724 DISPLAY
725 dispIntro
726 dispDate
727 dispReference
728 dispDescription
729 dispAmount
730 dispNotes
731 WITH FRAME report-line.
733 DOWN WITH FRAME report-line.
735 END PROCEDURE.
737 /* _UIB-CODE-BLOCK-END */
738 &ANALYZE-RESUME
740 &ENDIF
742 &IF DEFINED(EXCLUDE-get-balances) = 0 &THEN
744 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-balances Procedure
745 PROCEDURE get-balances :
746 /*------------------------------------------------------------------------------
747 Purpose:
748 ------------------------------------------------------------------------------*/
749 DEF INPUT PARAMETER ec AS INT NO-UNDO.
750 DEF OUTPUT PARAMETER bt AS DEC NO-UNDO INITIAL 0.0 .
751 DEF OUTPUT PARAMETER b0 AS DEC NO-UNDO INITIAL 0.0 .
752 DEF OUTPUT PARAMETER b1 AS DEC NO-UNDO INITIAL 0.0 .
753 DEF OUTPUT PARAMETER b2 AS DEC NO-UNDO INITIAL 0.0 .
754 DEF OUTPUT PARAMETER b3 AS DEC NO-UNDO INITIAL 0.0 .
755 DEF OUTPUT PARAMETER overdue AS DEC NO-UNDO INITIAL 0.0 .
757 FOR EACH AcctTran NO-LOCK WHERE AcctTran.EntityType = 'T'
758 AND AcctTran.EntityCode = ec
759 AND AcctTran.AccountCode = sundry-debtors
760 AND AcctTran.MonthCode <= asat-month
761 AND (AcctTran.ClosingGroup = 0 OR AcctTran.ClosingGroup = ?
762 OR (IF summarise-part THEN No ELSE AcctTran.ClosedState = "P") ),
763 FIRST Document OF AcctTran NO-LOCK:
764 IF exclude-rent AND Document.DocumentType = "RENT" THEN NEXT.
766 IF AcctTran.MonthCode >= asat-month THEN
767 b0 = b0 + AcctTran.Amount.
768 ELSE IF AcctTran.MonthCode = asat-month1 THEN
769 b1 = b1 + AcctTran.Amount.
770 ELSE IF AcctTran.MonthCode = asat-month2 THEN
771 b2 = b2 + AcctTran.Amount.
772 ELSE
773 b3 = b3 + AcctTran.Amount.
774 END.
776 /* catch transactions which have closed, but where part of the group is after
777 * the end of the report
779 DEF VAR group-list AS CHAR NO-UNDO INITIAL "".
780 DEF VAR group-code AS CHAR NO-UNDO.
781 DEF BUFFER ClosedTran FOR AcctTran.
782 DEF VAR d-min AS INT NO-UNDO.
783 DEF VAR d-max AS INT NO-UNDO.
784 DEF VAR group-total AS DEC NO-UNDO.
786 IF summarise-part THEN DO:
787 part-closed-loop:
788 FOR EACH ClosedTran NO-LOCK
789 WHERE ClosedTran.EntityType = base-entity-type
790 AND ClosedTran.EntityCode = ec
791 AND ClosedTran.AccountCode = sundry-debtors
792 AND ClosedTran.MonthCode <= asat-month
793 AND ClosedTran.ClosingGroup > 0
794 AND ClosedTran.ClosedState = "P":
796 group-code = STRING(ClosedTran.ClosingGroup).
797 IF LOOKUP( group-code, group-list ) > 0 THEN NEXT part-closed-loop.
798 group-list = group-list + group-code + ",".
800 d-min = ClosedTran.MonthCode.
801 d-max = ClosedTran.MonthCode.
802 group-total = 0.
803 FOR EACH AcctTran WHERE AcctTran.EntityType = 'T'
804 AND AcctTran.EntityCode = Tenant.TenantCode
805 AND AcctTran.AccountCode = sundry-debtors
806 AND AcctTran.MonthCode <= asat-month
807 AND AcctTran.ClosingGroup = ClosedTran.ClosingGroup NO-LOCK,
808 FIRST Document OF AcctTran NO-LOCK:
809 d-min = MIN(d-min, AcctTran.MonthCode).
810 d-max = MAX(d-max, AcctTran.MonthCode).
811 IF exclude-rent AND Document.DocumentType = "RENT" THEN NEXT.
812 group-total = group-total + AcctTran.Amount.
813 END.
814 IF group-total > 0 THEN d-min = d-max.
816 IF d-min >= asat-month THEN
817 b0 = b0 + group-total.
818 ELSE IF d-min = asat-month1 THEN
819 b1 = b1 + group-total.
820 ELSE IF d-min = asat-month2 THEN
821 b2 = b2 + group-total.
822 ELSE
823 b3 = b3 + group-total.
825 END.
826 END.
828 group-list = "".
829 next-closed-tran:
830 FOR EACH ClosedTran NO-LOCK
831 WHERE ClosedTran.EntityType = base-entity-type
832 AND ClosedTran.EntityCode = ec
833 AND ClosedTran.AccountCode = sundry-debtors
834 AND ClosedTran.MonthCode > asat-month
835 AND ClosedTran.ClosingGroup > 0
836 AND ClosedTran.ClosedState = "F":
838 group-code = STRING(ClosedTran.ClosingGroup).
839 IF LOOKUP( group-code, group-list ) > 0 THEN NEXT next-closed-tran.
840 group-list = group-list + group-code + ",".
842 FOR EACH AcctTran WHERE AcctTran.EntityType = base-entity-type
843 AND AcctTran.EntityCode = ec
844 AND AcctTran.AccountCode = sundry-debtors
845 AND AcctTran.ClosingGroup = ClosedTran.ClosingGroup
846 AND AcctTran.MonthCode <= asat-month NO-LOCK,
847 FIRST Document OF AcctTran NO-LOCK:
848 IF exclude-rent AND Document.DocumentType = "RENT" THEN NEXT.
850 IF AcctTran.MonthCode >= asat-month THEN
851 b0 = b0 + AcctTran.Amount.
852 ELSE IF AcctTran.MonthCode = asat-month1 THEN
853 b1 = b1 + AcctTran.Amount.
854 ELSE IF AcctTran.MonthCode = asat-month2 THEN
855 b2 = b2 + AcctTran.Amount.
856 ELSE
857 b3 = b3 + AcctTran.Amount.
859 END.
860 END.
862 overdue = b3.
863 IF overdue-periods < 3 THEN overdue = overdue + b2.
864 IF overdue-periods < 2 THEN overdue = overdue + b1.
866 bt = b0 + b1 + b2 + b3.
868 END PROCEDURE.
870 /* _UIB-CODE-BLOCK-END */
871 &ANALYZE-RESUME
873 &ENDIF
875 &IF DEFINED(EXCLUDE-non-property-debtors) = 0 &THEN
877 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE non-property-debtors Procedure
878 PROCEDURE non-property-debtors :
879 /*------------------------------------------------------------------------------
880 Purpose:
881 Parameters: <none>
882 Notes:
883 ------------------------------------------------------------------------------*/
886 this-break = "Non-property debtors".
887 FOR EACH Company NO-LOCK:
888 need-entity-header = Yes.
889 this-entity = STRING(Company.CompanyCode, "999") + " " + Company.LegalName.
890 FOR EACH Tenant NO-LOCK WHERE Tenant.EntityType = "L"
891 AND Tenant.EntityCode = Company.CompanyCode
892 BY Company.CompanyCode BY Tenant.Name:
893 RUN each-tenant.
894 END.
895 IF NOT need-entity-header THEN RUN entity-footing( this-entity ).
896 END.
898 need-entity-header = Yes.
899 this-entity = "Tenants that are completely screwed up".
901 FOR EACH Tenant NO-LOCK:
902 /* Skip to next record if we have already processed it */
903 IF Tenant.EntityType = "P" AND CAN-FIND( Property WHERE Property.PropertyCode = Tenant.EntityCode) THEN NEXT.
904 IF Tenant.EntityType = "L" AND CAN-FIND( Company WHERE Company.CompanyCode = Tenant.EntityCode) THEN NEXT.
906 RUN each-tenant.
907 END.
908 IF NOT need-entity-header THEN RUN entity-footing( this-entity ).
910 IF NOT need-break-header THEN RUN break-footing( this-break ).
912 END.
914 END PROCEDURE.
916 /* _UIB-CODE-BLOCK-END */
917 &ANALYZE-RESUME
919 &ENDIF
921 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
923 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
924 PROCEDURE parse-parameters :
925 /*------------------------------------------------------------------------------
926 Purpose:
927 ------------------------------------------------------------------------------*/
928 DEF VAR i AS INT NO-UNDO.
929 DEF VAR token AS CHAR NO-UNDO.
931 {inc/showopts.i "report-options"}
933 DO i = 1 TO NUM-ENTRIES( report-options, "~n" ):
934 token = ENTRY( i, report-options, "~n" ).
935 CASE( ENTRY( 1, token ) ):
936 WHEN "AsAtDate" THEN asat-date = DATE( ENTRY(2,token) ).
937 WHEN "SummarisePart" THEN summarise-part = Yes.
938 WHEN "HideInactives" THEN show-inactives = No.
939 WHEN "Preview" THEN preview = Yes.
940 WHEN "ExcludeRent" THEN exclude-rent = Yes.
941 WHEN "SortBy" THEN sort-by = ENTRY(2, token).
942 WHEN "ConsolidationList" THEN list-name = ENTRY(2, token).
943 WHEN "MinAbsBalance" THEN min-abs-balance = DEC( ENTRY(2, token) ).
944 WHEN "MinDebitBalance" THEN min-debit-balance = DEC( ENTRY(2, token) ).
945 WHEN "OverdueBalance" THEN overdue-balance = DEC( ENTRY(2, token) ).
946 WHEN "OverduePeriods" THEN overdue-periods = INT( ENTRY(2, token) ).
948 WHEN "AllRecords" THEN report-all-records = Yes.
950 WHEN "RecordRange" THEN ASSIGN
951 record-1 = ENTRY(2, token)
952 record-n = ENTRY(3, token) .
954 WHEN "Export" THEN ASSIGN
955 exporting = Yes
956 file-name = SUBSTRING( token, INDEX( token, ",") + 1 ).
958 END CASE.
959 END.
961 IF report-all-records THEN ASSIGN
962 record-1 = (IF sort-by = "Region" THEN "0000" ELSE "0")
963 record-n = (IF sort-by = "Region" THEN "ZZZZ" ELSE "99999").
965 FIND LAST Month WHERE Month.StartDate <= asat-date NO-LOCK.
966 asat-month = Month.MonthCode.
967 FIND PREV Month NO-LOCK.
968 asat-month1 = Month.MonthCode.
969 FIND PREV Month NO-LOCK.
970 asat-month2 = Month.MonthCode.
972 END PROCEDURE.
974 /* _UIB-CODE-BLOCK-END */
975 &ANALYZE-RESUME
977 &ENDIF
979 &IF DEFINED(EXCLUDE-report-by-company) = 0 &THEN
981 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-by-company Procedure
982 PROCEDURE report-by-company :
983 /*------------------------------------------------------------------------------
984 Purpose:
985 ------------------------------------------------------------------------------*/
986 DEF VAR i AS INT NO-UNDO.
988 IF LENGTH(list-name) > 0 THEN
989 FIND ConsolidationList WHERE ConsolidationList.Name = list-name NO-LOCK NO-ERROR.
991 IF AVAILABLE(ConsolidationList) THEN DO:
992 this-break = "Consolidation List " + ConsolidationList.Name
993 + " - " + ConsolidationList.Description.
994 DO i = 1 TO NUM-ENTRIES(ConsolidationList.CompanyList):
995 FIND Company WHERE Company.CompanyCode = INT( ENTRY(i, ConsolidationList.CompanyList)) NO-LOCK.
996 RUN each-company.
997 END.
998 END.
999 ELSE DO:
1000 this-break = "Company " + record-1 + " to " + record-n.
1001 FOR EACH Company NO-LOCK WHERE Company.CompanyCode >= INT(record-1) AND Company.CompanyCode <= INT(record-n):
1002 RUN each-company.
1003 END.
1004 END.
1006 END PROCEDURE.
1008 /* _UIB-CODE-BLOCK-END */
1009 &ANALYZE-RESUME
1011 &ENDIF
1013 &IF DEFINED(EXCLUDE-report-by-manager) = 0 &THEN
1015 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-by-manager Procedure
1016 PROCEDURE report-by-manager :
1017 /*------------------------------------------------------------------------------
1018 Purpose:
1019 ------------------------------------------------------------------------------*/
1020 RUN build-manager-table.
1022 FOR EACH Manager WHERE (Manager.Manager >= INT(record-1) AND Manager.Manager <= INT(record-n))
1023 BY Manager.Manager:
1024 need-break-header = Yes.
1025 this-break = "Managed by " + Manager.FullName.
1027 FOR EACH Property WHERE Property.Manager = Manager.Manager NO-LOCK BY Property.PropertyCode:
1028 need-entity-header = Yes.
1029 this-entity = STRING(Property.PropertyCode, "99999") + " " + Property.Name.
1030 FOR EACH Tenant NO-LOCK WHERE (Tenant.Active OR show-inactives)
1031 AND Tenant.EntityType = "P"
1032 AND Tenant.EntityCode = Property.PropertyCode
1033 BY Tenant.Name:
1034 RUN each-tenant.
1035 END.
1036 IF need-entity-header = No THEN RUN entity-footing( this-entity ).
1037 END.
1038 IF need-break-header = No THEN RUN break-footing( this-break ).
1039 END.
1041 END PROCEDURE.
1043 /* _UIB-CODE-BLOCK-END */
1044 &ANALYZE-RESUME
1046 &ENDIF
1048 &IF DEFINED(EXCLUDE-report-by-property) = 0 &THEN
1050 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-by-property Procedure
1051 PROCEDURE report-by-property :
1052 /*------------------------------------------------------------------------------
1053 Purpose:
1054 ------------------------------------------------------------------------------*/
1055 this-break = "Property " + record-1 + " to " + record-n.
1056 need-break-header = Yes.
1058 FOR EACH Property NO-LOCK WHERE Property.PropertyCode >= INT(record-1) AND Property.PropertyCode <= INT(record-n)
1059 BY Property.Manager BY Property.PropertyCode:
1060 need-entity-header = Yes.
1061 this-entity = STRING(Property.PropertyCode, "99999") + " " + Property.Name.
1062 FOR EACH Tenant NO-LOCK WHERE (Tenant.Active OR show-inactives)
1063 AND Tenant.EntityType = "P"
1064 AND Tenant.EntityCode = Property.PropertyCode
1065 BY Tenant.Name:
1066 RUN each-tenant.
1067 END.
1068 IF need-entity-header = No THEN RUN entity-footing( this-entity ).
1069 END.
1070 IF need-break-header = No THEN RUN break-footing( this-break ).
1072 END PROCEDURE.
1074 /* _UIB-CODE-BLOCK-END */
1075 &ANALYZE-RESUME
1077 &ENDIF
1079 &IF DEFINED(EXCLUDE-report-by-region) = 0 &THEN
1081 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-by-region Procedure
1082 PROCEDURE report-by-region :
1083 /*------------------------------------------------------------------------------
1084 Purpose:
1085 ------------------------------------------------------------------------------*/
1087 FOR EACH Region WHERE Region.Region >= record-1 AND Region.Region <= record-n NO-LOCK:
1088 need-break-header = Yes.
1089 this-break = Region.Name .
1090 FOR EACH Property NO-LOCK WHERE Property.Region = Region.Region BY Property.Name:
1091 need-entity-header = Yes.
1092 this-entity = STRING(Property.PropertyCode, "99999") + " " + Property.Name.
1093 FOR EACH Tenant NO-LOCK WHERE (Tenant.Active OR show-inactives)
1094 AND Tenant.EntityType = "P"
1095 AND Tenant.EntityCode = Property.PropertyCode
1096 BY Tenant.Name:
1097 RUN each-tenant.
1098 END.
1099 IF NOT need-entity-header THEN RUN entity-footing( this-entity ).
1100 END.
1101 IF NOT need-break-header THEN RUN break-footing( this-break ).
1102 END.
1104 END PROCEDURE.
1106 /* _UIB-CODE-BLOCK-END */
1107 &ANALYZE-RESUME
1109 &ENDIF
1111 &IF DEFINED(EXCLUDE-report-by-tenant) = 0 &THEN
1113 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-by-tenant Procedure
1114 PROCEDURE report-by-tenant :
1115 /*------------------------------------------------------------------------------
1116 Purpose:
1117 ------------------------------------------------------------------------------*/
1118 this-break = "Tenant " + record-1 + " to " + record-n.
1119 need-break-header = Yes.
1121 need-entity-header = No.
1122 this-entity = "".
1124 FOR EACH Tenant NO-LOCK WHERE (Tenant.Active OR show-inactives)
1125 BY Tenant.TenantCode:
1126 RUN each-tenant.
1127 END.
1128 IF NOT need-break-header THEN RUN break-footing( this-break ).
1130 END PROCEDURE.
1132 /* _UIB-CODE-BLOCK-END */
1133 &ANALYZE-RESUME
1135 &ENDIF
1137 &IF DEFINED(EXCLUDE-tenant-heading) = 0 &THEN
1139 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE tenant-heading Procedure
1140 PROCEDURE tenant-heading :
1141 /*------------------------------------------------------------------------------
1142 Purpose:
1143 ------------------------------------------------------------------------------*/
1145 IF NOT header-not-displayed THEN PUT SKIP(1).
1146 IF need-entity-header THEN RUN entity-heading( this-entity ).
1147 need-tenant-header = No.
1149 END PROCEDURE.
1151 /* _UIB-CODE-BLOCK-END */
1152 &ANALYZE-RESUME
1154 &ENDIF