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 from-property
LIKE Property.PropertyCode
NO-UNDO.
15 DEF VAR to-property
LIKE Property.PropertyCode
NO-UNDO.
16 DEF VAR month-ending
LIKE Month.MonthCode
NO-UNDO.
19 DEF VAR property-range
AS LOGI
NO-UNDO.
20 DEF VAR manager-range
AS LOGI
NO-UNDO.
21 DEF VAR administrator-range
AS LOGI
NO-UNDO.
22 DEF VAR region-range
AS LOGI
NO-UNDO.
23 DEF VAR list-range
AS LOGI
NO-UNDO.
24 DEF VAR entity-list
AS LOGI
NO-UNDO.
25 DEF VAR selection-id
AS CHAR NO-UNDO.
26 DEF VAR group-columns
AS LOGI
NO-UNDO INITIAL No.
29 DEF VAR detailed-property
AS LOGI
NO-UNDO.
30 DEF VAR consolidated-account
AS LOGI
NO-UNDO.
31 DEF VAR consolidated-property
AS LOGI
NO-UNDO.
33 DEF VAR to-file
AS LOGICAL NO-UNDO INITIAL No.
34 DEF VAR out-file-name
AS CHAR NO-UNDO INITIAL "".
35 DEF VAR report-preview
AS LOGI
NO-UNDO.
37 /* Month range variables
*/
38 DEF VAR range-type
AS CHAR NO-UNDO.
39 DEF VAR month-from
LIKE Month.MonthCode
NO-UNDO.
40 DEF VAR month-to
LIKE Month.MonthCode
NO-UNDO.
41 DEF VAR month-desc
AS CHAR NO-UNDO.
46 DEF VAR ln
AS DEC INIT 0.00 NO-UNDO.
47 DEF VAR page-lines
AS DEC NO-UNDO.
48 DEF VAR page-no
AS INT INIT 1 NO-UNDO.
49 DEF VAR last-multiplier
AS DEC NO-UNDO INIT 1.
51 /* Printer control strings
*/
53 DEF VAR reset-page
AS CHAR NO-UNDO.
54 DEF VAR half-line
AS CHAR NO-UNDO. half-line
= CHR(27) + "=" .
55 DEF VAR line-printer
AS CHAR NO-UNDO.
56 DEF VAR courier-font
AS CHAR NO-UNDO.
57 DEF VAR title-font
AS CHAR NO-UNDO.
58 DEF VAR manager-font
AS CHAR NO-UNDO.
62 DEF VAR acct-fmt
AS CHAR INIT "X(25)" NO-UNDO.
63 DEF VAR amt-fmt
AS CHAR INIT "(>>,>>>,>>9.99)" NO-UNDO.
64 DEF VAR var-fmt
AS CHAR INIT "(>,>>>,>>9.99)" NO-UNDO.
65 DEF VAR disp-mult
AS DEC INIT 1 NO-UNDO.
67 DEF VAR now
AS CHAR NO-UNDO.
68 now
= STRING( TODAY, "99/99/9999" ) + ' '
+ STRING( TIME, "HH:MM:SS" ).
69 DEF VAR user-name
AS CHAR NO-UNDO.
71 DEF BUFFER ThisMonth
FOR Month.
73 DEF VAR total
AS DEC EXTENT 28 NO-UNDO.
/* 7 totals
* 4 groups
*/
74 DEF VAR group-amnts
AS DEC NO-UNDO EXTENT 7 .
75 DEF VAR group-totals
AS DEC NO-UNDO EXTENT 7 INIT 0.0 .
78 {inc
/ofc-set.i
"AcctGroup-Recoveries" "recoveries-groups"}
79 IF NOT AVAILABLE(OfficeSetting
) THEN recoveries-groups
= "OPINC,OPEX".
81 /* _UIB-CODE-BLOCK-END
*/
85 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
87 /* ******************** Preprocessor Definitions
******************** */
89 &Scoped-define PROCEDURE-TYPE Procedure
90 &Scoped-define DB-AWARE no
94 /* _UIB-PREPROCESSOR-BLOCK-END
*/
99 /* *********************** Procedure Settings
************************ */
101 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
102 /* Settings for
THIS-PROCEDURE
106 Add Fields to
: Neither
107 Other Settings
: CODE-ONLY
COMPILE
109 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
111 /* ************************* Create Window
************************** */
113 &ANALYZE-SUSPEND _CREATE-WINDOW
114 /* DESIGN Window definition
(used by the UIB
)
115 CREATE WINDOW Procedure
ASSIGN
118 /* END WINDOW DEFINITION
*/
122 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
123 /* ************************* Included-Libraries
*********************** */
125 {inc
/method
/m-txtrep.i
}
127 /* _UIB-CODE-BLOCK-END
*/
134 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
137 /* *************************** Main Block
*************************** */
138 {inc
/username.i
"user-name"}
140 OUTPUT TO VALUE(out-file-name
) KEEP-MESSAGES PAGE-SIZE 0.
142 RUN get-control-strings.
143 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
146 RUN building-income-statement.
151 MESSAGE 'File
"' + out-file-name + '" generated successfully.'
152 VIEW-AS ALERT-BOX INFORMATION TITLE "Trial Balance by Group".
154 RUN view-output-file
( report-preview
).
156 /* _UIB-CODE-BLOCK-END
*/
160 /* ********************** Internal Procedures
*********************** */
162 &IF DEFINED(EXCLUDE-account-iteration) = 0 &THEN
164 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE account-iteration Procedure
165 PROCEDURE account-iteration
:
166 /*------------------------------------------------------------------------------
170 ------------------------------------------------------------------------------*/
171 IF consolidated-account
THEN DO:
172 RUN reset-totals
( 1 ).
173 RUN iterate-property.
174 RUN print-totals
( 1, ChartOfAccount.Name
).
177 RUN each-property-account.
181 /* _UIB-CODE-BLOCK-END
*/
186 &IF DEFINED(EXCLUDE-building-income-statement) = 0 &THEN
188 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE building-income-statement Procedure
189 PROCEDURE building-income-statement
:
190 /*------------------------------------------------------------------------------
192 ------------------------------------------------------------------------------*/
194 IF NOT detailed-property
THEN RUN page-header.
196 IF consolidated-account
THEN
197 RUN iterate-accounts.
199 RUN iterate-property.
201 IF NOT (detailed-property
OR to-file
) THEN RUN page-feed.
205 /* _UIB-CODE-BLOCK-END
*/
210 &IF DEFINED(EXCLUDE-carriage-return) = 0 &THEN
212 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE carriage-return Procedure
213 PROCEDURE carriage-return
:
214 /*------------------------------------------------------------------------------
218 ------------------------------------------------------------------------------*/
224 /* _UIB-CODE-BLOCK-END
*/
229 &IF DEFINED(EXCLUDE-column-header) = 0 &THEN
231 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE column-header Procedure
232 PROCEDURE column-header
:
233 /*------------------------------------------------------------------------------
235 ------------------------------------------------------------------------------*/
236 IF group-columns
THEN DO:
237 RUN column-header-groups.
241 PUT UNFORMATTED '
"Name","Month Actual","Month Budget","Month Variance"'
242 + '
,"Year Actual","Year Budget","Year Variance"'
243 + (IF range-type
= "NORMAL" THEN '
,"F/Y Budget"'
ELSE "")
248 PUT UNFORMATTED SPACE(26)
250 "------------------- MONTH ----------------- ---------------" +
251 ( IF range-type
= "NORMAL" THEN " YEAR TO DATE " ELSE " FOR RANGE " ) +
258 "Name" + FILL( ' '
, 27 ) +
259 "Actual" + FILL( ' '
, 8 ) + "Budget" + FILL( ' '
, 8 ) + "Variance" + FILL( ' '
, 8 ) +
260 "Actual" + FILL( ' '
, 9 ) + "Budget" + FILL( ' '
, 8 ) + "Variance" + FILL( ' '
, 6 ) +
261 IF range-type
= "NORMAL" THEN "F/Y Budget" ELSE "", "X(130)" ).
266 /* _UIB-CODE-BLOCK-END
*/
271 &IF DEFINED(EXCLUDE-column-header-groups) = 0 &THEN
273 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE column-header-groups Procedure
274 PROCEDURE column-header-groups
:
275 /*------------------------------------------------------------------------------
277 ------------------------------------------------------------------------------*/
279 PUT UNFORMATTED '
"Name","Rental Income","Recoveries","Total Income"'
280 + '
,"Recoverable Expenses","Non-Recoverables","Total Expenses"'
286 PUT UNFORMATTED SPACE(26)
287 " Rental Recoveries Total Income Rec. Expenses N/R Expenses Total Exps. Net Income".
292 /* _UIB-CODE-BLOCK-END
*/
297 &IF DEFINED(EXCLUDE-each-balance) = 0 &THEN
299 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-balance Procedure
300 PROCEDURE each-balance
:
301 /*------------------------------------------------------------------------------
305 ------------------------------------------------------------------------------*/
307 DEF VAR level
AS INT NO-UNDO.
308 DEF VAR base
AS INT NO-UNDO.
312 base
= ( level
- 1 ) * 7.
314 IF AccountBalance.MonthCode
= month-ending
THEN DO:
315 total
[ base
+ 1 ] = total
[ base
+ 1 ] + AccountBalance.Balance.
316 total
[ base
+ 2 ] = total
[ base
+ 2 ] + AccountBalance.Budget.
319 IF AccountBalance.MonthCode
<= month-ending
THEN DO:
320 total
[ base
+ 4 ] = total
[ base
+ 4 ] + AccountBalance.Balance.
321 total
[ base
+ 5 ] = total
[ base
+ 5 ] + AccountBalance.Budget.
324 total
[ base
+ 7 ] = total
[ base
+ 7 ] + AccountBalance.Budget.
330 /* _UIB-CODE-BLOCK-END
*/
335 &IF DEFINED(EXCLUDE-each-property-account) = 0 &THEN
337 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-property-account Procedure
338 PROCEDURE each-property-account
:
339 /*------------------------------------------------------------------------------
343 ------------------------------------------------------------------------------*/
344 DEF VAR level
AS INT NO-UNDO.
345 DEF VAR base
AS INT NO-UNDO.
347 IF detailed-property
THEN RUN reset-totals
( 1 ).
349 FOR EACH AccountBalance
NO-LOCK WHERE
350 AccountBalance.EntityType
= 'P'
AND
351 AccountBalance.EntityCode
= Property.PropertyCode
AND
352 AccountBalance.AccountCode
= ChartOfAccount.AccountCode
AND
353 AccountBalance.MonthCode
>= month-from
AND
354 AccountBalance.MonthCode
<= month-to
:
359 base
= ( level
- 1 ) * 7.
360 total
[ base
+ 3 ] = total
[ base
+ 1 ] - total
[ base
+ 2 ].
361 total
[ base
+ 6 ] = total
[ base
+ 4 ] - total
[ base
+ 5 ].
364 IF detailed-property
THEN RUN print-totals
( 1, ChartOfAccount.Name
).
368 /* _UIB-CODE-BLOCK-END
*/
373 &IF DEFINED(EXCLUDE-get-control-strings) = 0 &THEN
375 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-control-strings Procedure
376 PROCEDURE get-control-strings
:
377 /*------------------------------------------------------------------------------
379 ------------------------------------------------------------------------------*/
380 DEF VAR rows
AS DEC NO-UNDO.
381 DEF VAR cols
AS DEC NO-UNDO.
392 RUN make-control-string
( "PCL", "reset,portrait,a4,tm,2,lm,4",
393 OUTPUT reset-page
, OUTPUT rows
, OUTPUT cols
).
395 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,12",
396 OUTPUT title-font
, OUTPUT rows
, OUTPUT cols
).
398 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,10",
399 OUTPUT manager-font
, OUTPUT rows
, OUTPUT cols
).
401 RUN make-control-string
( "PCL", "LinePrinter,lpi,9.54",
402 OUTPUT line-printer
, OUTPUT rows
, OUTPUT cols
).
404 /* Note that this one sets the page length
*/
405 RUN make-control-string
( "PCL", "courier,cpi,18,lpi,9",
406 OUTPUT courier-font
, OUTPUT page-lines
, OUTPUT cols
).
407 page-lines
= page-lines
- 7.
/* For top margin of two
*/
409 IF report-preview
THEN RUN output-control-file
( reset-page
+ courier-font
).
413 /* _UIB-CODE-BLOCK-END
*/
418 &IF DEFINED(EXCLUDE-get-manager-name) = 0 &THEN
420 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-manager-name Procedure
421 PROCEDURE get-manager-name
:
422 /*------------------------------------------------------------------------------
426 ------------------------------------------------------------------------------*/
428 DEF OUTPUT PARAMETER manager-name
AS CHAR NO-UNDO.
430 IF NOT AVAILABLE Property
THEN RETURN.
431 FIND Person
WHERE Person.PersonCode
= Property.Manager
434 IF NOT AVAILABLE Person
THEN RETURN.
435 manager-name
= Person.JobTitle.
439 /* _UIB-CODE-BLOCK-END
*/
444 &IF DEFINED(EXCLUDE-get-month-range) = 0 &THEN
446 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-month-range Procedure
447 PROCEDURE get-month-range
:
448 /*------------------------------------------------------------------------------
450 ------------------------------------------------------------------------------*/
452 DEF INPUT PARAMETER range-type
AS CHAR NO-UNDO.
453 DEF INPUT PARAMETER range-desc
AS CHAR NO-UNDO.
455 IF range-type
= "RANGE" THEN DO:
456 month-from
= INT( ENTRY( 1, range-desc
) ).
457 month-to
= INT( ENTRY( 2, range-desc
) ).
458 month-ending
= month-to.
460 FIND Month
WHERE Month.MonthCode
= month-from
NO-LOCK.
461 month-desc
= "from " + STRING( Month.StartDate
, "99/99/9999" ).
462 FIND Month
WHERE Month.MonthCode
= month-to
NO-LOCK.
463 month-desc
= month-desc
+ " to " + STRING( Month.EndDate
, "99/99/9999" ).
467 DEF VAR financial-year
LIKE FinancialYear.FinancialYearCode
NO-UNDO.
469 month-ending
= INT( ENTRY( 1, range-desc
) ).
470 FIND FIRST ThisMonth
WHERE ThisMonth.MonthCode
= month-ending
NO-LOCK.
471 financial-year
= ThisMonth.FinancialYearCode.
472 month-desc
= "as at " + CAPS( ThisMonth.MonthName
) + ", " + STRING( ThisMonth.FinancialYearCode
, "9999" ).
474 FIND FIRST Month
WHERE Month.FinancialYearCode
= financial-year
NO-LOCK.
475 month-from
= Month.MonthCode.
477 FIND LAST Month
WHERE Month.FinancialYearCode
= financial-year
NO-LOCK.
478 month-to
= Month.MonthCode.
484 /* _UIB-CODE-BLOCK-END
*/
489 &IF DEFINED(EXCLUDE-iterate-accounts) = 0 &THEN
491 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE iterate-accounts Procedure
492 PROCEDURE iterate-accounts
:
493 /*------------------------------------------------------------------------------
495 ------------------------------------------------------------------------------*/
497 DEF VAR print-acct-totals
AS LOGI
NO-UNDO.
498 print-acct-totals
= consolidated-account
OR detailed-property.
502 RUN reset-totals
( 3 ).
504 RUN reset-totals
( 2 ).
505 FOR EACH ChartOfAccount
NO-LOCK WHERE
506 ChartOfAccount.AccountGroupCode
= "RENT":
507 RUN account-iteration.
509 IF print-acct-totals
THEN RUN print-totals
( 2, "Rental Income" ).
510 ELSE IF group-columns
THEN group-amnts
[1] = total
[8].
512 RUN reset-totals
( 2 ).
513 FOR EACH ChartOfAccount
NO-LOCK WHERE
514 LOOKUP( ChartOfAccount.AccountGroupCode
, recoveries-groups
) > 0:
515 RUN account-iteration.
517 IF print-acct-totals
THEN RUN print-totals
( 2, "Total Recoveries" ).
518 ELSE IF group-columns
THEN group-amnts
[2] = total
[8].
520 IF print-acct-totals
THEN RUN print-totals
( 3, "Total Income" ).
521 ELSE IF group-columns
THEN group-amnts
[3] = group-amnts
[1] + group-amnts
[2].
525 RUN reset-totals
( 3 ).
527 RUN reset-totals
( 2 ).
528 FOR EACH ChartOfAccount
NO-LOCK WHERE
529 ( ChartOfAccount.AccountGroupCode
= 'PROPEX'
) OR
530 ( ChartOfAccount.AccountGroupCode
= 'LEASNG'
AND
531 TRUNCATE( ChartOfAccount.AccountCode
, 0 ) = ChartOfAccount.AccountCode
):
532 RUN account-iteration.
534 IF print-acct-totals
THEN RUN print-totals
( 2, "Expense Recoverable" ).
535 ELSE IF group-columns
THEN group-amnts
[4] = total
[8].
537 IF CAN-FIND( AccountGroup
WHERE AccountGroup.AccountGroupCode
= "TENEX") THEN DO:
538 RUN reset-totals
( 2 ).
539 FOR EACH ChartOfAccount
NO-LOCK WHERE ChartOfAccount.AccountGroupCode
= 'TENEX'
:
540 RUN account-iteration.
542 IF print-acct-totals
THEN RUN print-totals
( 2, "Tenants Expenses Recoverable" ).
543 ELSE IF group-columns
THEN group-amnts
[4] = group-amnts
[4] + total
[8].
546 RUN reset-totals
( 2 ).
547 FOR EACH ChartOfAccount
NO-LOCK WHERE
548 (( ChartOfAccount.AccountGroupCode
= 'PROPEX'
OR
549 ChartOfAccount.AccountGroupCode
= 'LEASNG'
) AND
550 ChartOfAccount.AccountCode
- TRUNCATE( ChartOfAccount.AccountCode
, 0 ) = 0.10
551 ) OR ChartOfAccount.AccountGroupCode
= 'OWNEX'
:
552 RUN account-iteration.
554 IF print-acct-totals
THEN RUN print-totals
( 2, "Expenses Non-Recoverable" ).
555 ELSE IF group-columns
THEN group-amnts
[5] = total
[8].
557 IF print-acct-totals
THEN RUN print-totals
( 3, "Total Expenses" ).
558 ELSE IF group-columns
THEN group-amnts
[6] = group-amnts
[4] + group-amnts
[5].
560 IF print-acct-totals
THEN RUN print-totals
( 4, "NET INCOME" ).
561 ELSE IF group-columns
THEN DO:
562 group-amnts
[7] = group-amnts
[3] + group-amnts
[6].
563 RUN print-group-totals
( Property.Name
).
567 /* _UIB-CODE-BLOCK-END
*/
572 &IF DEFINED(EXCLUDE-iterate-property) = 0 &THEN
574 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE iterate-property Procedure
575 PROCEDURE iterate-property
:
576 /*------------------------------------------------------------------------------
580 ------------------------------------------------------------------------------*/
581 DEF VAR i
AS INT NO-UNDO.
582 DEF VAR n
AS INT NO-UNDO.
583 DEF VAR coy-code
AS INT NO-UNDO.
585 IF property-range
THEN
586 FOR EACH Property
NO-LOCK WHERE Property.PropertyCode
>= from-property
587 AND Property.PropertyCode
<= to-property
:
588 RUN property-iteration.
590 ELSE IF manager-range
THEN
591 FOR EACH Property
NO-LOCK WHERE Property.Manager
= INT( selection-id
):
592 RUN property-iteration.
594 ELSE IF administrator-range
THEN
595 FOR EACH Property
NO-LOCK WHERE Property.Administrator
= INT( selection-id
):
596 RUN property-iteration.
598 ELSE IF region-range
THEN
599 FOR EACH Property
NO-LOCK WHERE Property.Region
= selection-id
:
600 RUN property-iteration.
602 ELSE IF entity-list
THEN
603 FOR EACH EntityListMember
NO-LOCK WHERE EntityListMember.ListCode
= selection-id
604 AND EntityListMember.EntityType
= "P",
605 FIRST Property
NO-LOCK
606 WHERE Property.PropertyCode
= EntityListMember.EntityCode
607 BY EntityListMember.SortSequence
:
608 RUN property-iteration.
610 ELSE IF list-range
THEN DO:
611 FIND ConsolidationList
WHERE ConsolidationList.Name
= selection-id
NO-LOCK.
612 n
= NUM-ENTRIES( ConsolidationList.CompanyList
).
614 coy-code
= INT( ENTRY( i
, ConsolidationList.CompanyList
)).
615 FOR EACH Property
NO-LOCK WHERE Property.CompanyCode
= coy-code
:
616 RUN property-iteration.
621 IF group-columns
THEN DO:
622 IF NOT(to-file
) THEN DO:
624 PUT UNFORMATTED FILL(" ",26).
628 PUT UNFORMATTED '
,'
+ STRING( group-totals
[i
] ).
630 PUT UNFORMATTED STRING( group-totals
[i
] * (IF i
< 4 OR i
= 7 THEN -1 ELSE 1),
634 ELSE IF consolidated-property
THEN RUN print-totals
( 4, "NET INCOME" ).
638 /* _UIB-CODE-BLOCK-END
*/
643 &IF DEFINED(EXCLUDE-page-feed) = 0 &THEN
645 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-feed Procedure
646 PROCEDURE page-feed
:
647 /*------------------------------------------------------------------------------
651 ------------------------------------------------------------------------------*/
653 IF to-file
THEN RETURN.
656 page-no
= page-no
+ 1.
660 /* _UIB-CODE-BLOCK-END
*/
665 &IF DEFINED(EXCLUDE-page-header) = 0 &THEN
667 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-header Procedure
668 PROCEDURE page-header
:
669 /*------------------------------------------------------------------------------
673 ------------------------------------------------------------------------------*/
677 DEF VAR title-string
AS CHAR NO-UNDO.
678 DEF VAR range-desc
AS CHAR NO-UNDO.
680 PUT UNFORMATTED STRING( "Printed: " + now
+ " for " + user-name
, "X(40)" ).
681 IF NOT( to-file
) THEN
682 PUT UNFORMATTED SPACE(80) "Page: " + STRING( page-no
).
685 title-string
= "Building Income Statement " + month-desc
+
686 IF consolidated-account
THEN ", Consolidated by Account" ELSE
687 IF consolidated-property
THEN ", Consolidated by Property" ELSE "".
689 PUT UNFORMATTED '
"' + title-string + '"'.
691 PUT UNFORMATTED SPACE( ( 132 - LENGTH( title-string
) ) / 2 ) title-string.
694 IF property-range
AND NOT detailed-property
THEN
695 range-desc
= "Property " + STRING( from-property
, "99999" ) + " to " + STRING( to-property
, "99999" ).
696 ELSE IF manager-range
THEN
698 FIND Person
WHERE Person.PersonCode
= INT( selection-id
) NO-ERROR.
699 range-desc
= "Portoflio: " + IF AVAILABLE Person
THEN Person.JobTitle
702 ELSE IF administrator-range
THEN
704 FIND Person
WHERE Person.PersonCode
= INT( selection-id
) NO-ERROR.
705 range-desc
= "Managed by: " + IF AVAILABLE Person
THEN ( Person.FirstName
+ ' '
+ Person.LastName
)
708 ELSE IF region-range
THEN DO:
709 FIND Region
WHERE Region.Region
= selection-id
NO-LOCK.
710 range-desc
= "Region: " + Region.Name.
712 ELSE IF entity-list
THEN DO:
713 FIND EntityList
WHERE EntityList.ListCode
= selection-id
NO-LOCK.
714 range-desc
= "Entity List: " + EntityList.Description.
717 IF detailed-property
THEN range-desc
= Property.Name
+ " (" + STRING( Property.PropertyCode
, "99999" ) + ")" +
718 IF range-desc
= "" THEN "" ELSE ( ", " + range-desc
).
720 PUT UNFORMATTED '
"' + range-desc + '"'
SKIP.
722 PUT UNFORMATTED SPACE( ( 132 - LENGTH( range-desc
) ) / 2 ) range-desc.
730 /* _UIB-CODE-BLOCK-END
*/
735 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
737 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
738 PROCEDURE parse-parameters
:
739 /*------------------------------------------------------------------------------
741 ------------------------------------------------------------------------------*/
742 DEF VAR i
AS INT NO-UNDO.
743 DEF VAR token
AS CHAR NO-UNDO.
745 {inc
/showopts.i
"report-options"}
747 DO i
= 1 TO NUM-ENTRIES( report-options
, "~n" ):
748 token
= ENTRY( i
, report-options
, "~n" ).
750 CASE ENTRY( 1, token
):
754 selection-id
= ENTRY( 3, token
).
755 CASE ENTRY( 2, token
):
756 WHEN "RANGE" THEN ASSIGN
758 from-property
= INT( TRIM( ENTRY( 1, selection-id
, "-") ) )
759 to-property
= INT( TRIM( ENTRY( 2, selection-id
, "-") ) ).
760 WHEN "PORTFOLIO" THEN manager-range
= Yes.
761 WHEN "MANAGER" THEN administrator-range
= Yes.
762 WHEN "REGION" THEN region-range
= Yes.
763 WHEN "LIST" THEN list-range
= Yes.
764 WHEN "ELIST" THEN entity-list
= Yes.
769 CASE ENTRY( 2, token
):
770 WHEN "Detailed" THEN detailed-property
= Yes.
771 WHEN "Account" THEN consolidated-account
= Yes.
772 WHEN "Property" THEN consolidated-property
= Yes.
773 WHEN "Groups" THEN ASSIGN
775 consolidated-property
= Yes.
778 WHEN "Preview" THEN report-preview
= Yes.
782 out-file-name
= TRIM( ENTRY(2, token
) ).
785 WHEN "Month" THEN DO:
786 range-type
= ENTRY( 2, token
).
787 RUN get-month-range
( range-type
, ENTRY( 3, token
) + "," + ENTRY( 4, token
) ).
795 /* _UIB-CODE-BLOCK-END
*/
800 &IF DEFINED(EXCLUDE-print-group-totals) = 0 &THEN
802 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-group-totals Procedure
803 PROCEDURE print-group-totals
:
804 /*------------------------------------------------------------------------------
806 ------------------------------------------------------------------------------*/
807 DEF INPUT PARAMETER total-description
AS CHAR NO-UNDO.
809 DEF VAR i
AS INT NO-UNDO.
810 DEF VAR all-zero
AS LOGI
NO-UNDO INIT Yes.
813 all-zero
= all-zero
AND group-amnts
[i
] = 0.00.
815 IF all-zero
THEN RETURN.
818 PUT UNFORMATTED '
"' + total-description + '"'.
820 PUT UNFORMATTED STRING( total-description
, "X(25)" ) SPACE(1).
824 PUT UNFORMATTED '
,'
+ STRING( group-amnts
[i
] ).
826 PUT UNFORMATTED STRING( group-amnts
[i
] * (IF i
< 4 OR i
= 7 THEN -1 ELSE 1),
828 group-totals
[i
] = group-totals
[i
] + group-amnts
[i
].
835 /* _UIB-CODE-BLOCK-END
*/
840 &IF DEFINED(EXCLUDE-print-totals) = 0 &THEN
842 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-totals Procedure
843 PROCEDURE print-totals
:
844 /*------------------------------------------------------------------------------
846 ------------------------------------------------------------------------------*/
848 DEF INPUT PARAMETER level
AS INT NO-UNDO.
849 DEF INPUT PARAMETER total-description
AS CHAR NO-UNDO.
851 DEF VAR i
AS INT NO-UNDO.
852 DEF VAR all-zero
AS LOGI
NO-UNDO INIT Yes.
853 DEF VAR multiplier
AS DEC NO-UNDO.
854 DEF VAR n-tots
AS INT NO-UNDO.
855 n-tots
= IF range-type
= "NORMAL" THEN 7 ELSE 6.
858 all-zero
= all-zero
AND total
[ ( level
- 1 ) * 7 + i
] = 0.00.
860 IF all-zero
THEN RETURN.
862 IF level
> 1 THEN RUN separator-line.
864 PUT UNFORMATTED '
"' + total-description + '"'.
866 PUT UNFORMATTED STRING( total-description
, "X(25)" ) SPACE(1).
868 IF level
= 4 THEN multiplier
= -1.
869 ELSE IF detailed-property
OR consolidated-account
THEN
871 FIND AccountGroup
OF ChartOfAccount
NO-LOCK NO-ERROR.
872 multiplier
= IF AVAILABLE AccountGroup
THEN
873 ( IF AccountGroup.CreditGroup
THEN -1 ELSE 1 ) ELSE last-multiplier.
875 ELSE multiplier
= -1.
879 PUT UNFORMATTED '
,'
+ STRING( total
[ ( level
- 1 ) * 7 + i
] * multiplier
).
881 PUT UNFORMATTED STRING( total
[ ( level
- 1 ) * 7 + i
] * (IF i
= 3 OR i
= 6 THEN -1 ELSE multiplier
),
882 (IF i
= 3 OR i
= 6 THEN var-fmt
ELSE amt-fmt
) ).
885 RUN skip-line
( IF level
= 1 OR level
= 4 THEN 1 ELSE 2 ).
887 last-multiplier
= multiplier.
891 /* _UIB-CODE-BLOCK-END
*/
896 &IF DEFINED(EXCLUDE-property-iteration) = 0 &THEN
898 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE property-iteration Procedure
899 PROCEDURE property-iteration
:
900 /*------------------------------------------------------------------------------
902 ------------------------------------------------------------------------------*/
904 IF detailed-property
OR consolidated-property
THEN
905 IF NOT CAN-FIND( FIRST AccountBalance
WHERE
906 AccountBalance.EntityType
= 'P'
AND
907 AccountBalance.EntityCode
= Property.PropertyCode
AND
908 AccountBalance.MonthCode
>= month-from
AND
909 AccountBalance.MonthCode
<= month-to
) THEN RETURN.
911 IF consolidated-account
THEN
912 RUN each-property-account.
913 ELSE IF detailed-property
THEN DO:
914 RUN reset-totals
( 4 ).
917 RUN iterate-accounts.
920 ELSE IF group-columns
THEN DO:
921 RUN iterate-accounts.
923 ELSE IF consolidated-property
THEN DO:
924 RUN reset-totals
( 1 ).
925 RUN iterate-accounts.
926 RUN print-totals
( 1, Property.Name
).
931 /* _UIB-CODE-BLOCK-END
*/
936 &IF DEFINED(EXCLUDE-reset-page) = 0 &THEN
938 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-page Procedure
939 PROCEDURE reset-page
:
940 /*------------------------------------------------------------------------------
944 ------------------------------------------------------------------------------*/
946 IF NOT report-preview
THEN
948 PUT CONTROL reset-page.
949 PUT CONTROL courier-font.
955 /* _UIB-CODE-BLOCK-END
*/
960 &IF DEFINED(EXCLUDE-reset-totals) = 0 &THEN
962 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-totals Procedure
963 PROCEDURE reset-totals
:
964 /*------------------------------------------------------------------------------
968 ------------------------------------------------------------------------------*/
970 DEF INPUT PARAMETER level
AS INT NO-UNDO.
972 DEF VAR i
AS INT NO-UNDO.
975 total
[ ( level
- 1 ) * 7 + i
] = 0.00.
980 /* _UIB-CODE-BLOCK-END
*/
985 &IF DEFINED(EXCLUDE-separator-line) = 0 &THEN
987 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE separator-line Procedure
988 PROCEDURE separator-line
:
989 /*------------------------------------------------------------------------------
993 ------------------------------------------------------------------------------*/
996 PUT UNFORMATTED '
""'
+ FILL( '
,"' + FILL( '-', 14) + '"'
,
997 (IF range-type
= "NORMAL" THEN 7 ELSE 6) ).
999 PUT UNFORMATTED SPACE(26)
1000 FILL( '
-'
, 14 ) + ' '
+ FILL( '
-'
, 14 ) + ' '
+ FILL( '
-'
, 14 ) + ' '
+
1001 FILL( '
-'
, 14 ) + ' '
+ FILL( '
-'
, 14 ) + ' '
+ FILL( '
-'
, 14 ) + ' '
+
1002 ( IF range-type
= "NORMAL" THEN FILL( '
-'
, 14 ) ELSE "" ).
1008 /* _UIB-CODE-BLOCK-END
*/
1013 &IF DEFINED(EXCLUDE-skip-line) = 0 &THEN
1015 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-line Procedure
1016 PROCEDURE skip-line
:
1017 /*------------------------------------------------------------------------------
1021 ------------------------------------------------------------------------------*/
1022 DEF INPUT PARAMETER n
AS DEC NO-UNDO.
1024 DEF VAR int-part
AS INT NO-UNDO.
1025 DEF VAR dec-part
AS DEC NO-UNDO.
1027 int-part
= TRUNCATE( n
, 0 ).
1028 IF int-part
< 0 THEN RETURN.
1029 dec-part
= n
- int-part.
1030 IF int-part
= 0 AND dec-part
= 0 THEN RETURN.
1032 IF page-lines
> 0 AND (ln
+ n
) >= page-lines
THEN DO:
1037 IF dec-part
<> 0 THEN PUT CONTROL half-line.
1039 IF int-part
> 1 THEN PUT SKIP(int-part
).
1040 ELSE IF int-part
= 1 THEN PUT " " SKIP.
1046 /* _UIB-CODE-BLOCK-END
*/