1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
15 ------------------------------------------------------------------------*/
16 /* This .W file was created with the Progress UIB.
*/
17 /*----------------------------------------------------------------------*/
19 /* *************************** Definitions
************************** */
21 &SCOPED-DEFINE lines-per-page 112
24 DEF VAR ln
AS DEC INIT 0.00 NO-UNDO.
26 /* Line definitions
*/
28 DEF VAR trn-line
AS CHAR NO-UNDO.
29 DEF VAR trn-no
AS INT NO-UNDO.
31 DEF VAR reset-page
AS CHAR NO-UNDO.
32 DEF VAR half-line
AS CHAR NO-UNDO. half-line
= CHR(27) + "=".
33 DEF VAR title-font
AS CHAR NO-UNDO.
34 DEF VAR time-font
AS CHAR NO-UNDO.
35 DEF VAR type-font
AS CHAR NO-UNDO.
36 DEF VAR property-font
AS CHAR NO-UNDO.
37 DEF VAR line-printer
AS CHAR NO-UNDO.
38 DEF VAR area-fmt
AS CHAR INIT ">>>,>>9.99" NO-UNDO.
39 DEF VAR prk-fmt
AS CHAR INIT ">>>>>>>9" NO-UNDO.
40 DEF VAR tnt-fmt
AS CHAR INIT ">>>,>>9" NO-UNDO.
41 DEF VAR tot-fmt
AS CHAR INIT ">,>>>,>>9.99" NO-UNDO.
43 DEF VAR i
AS INT NO-UNDO.
45 DEF VAR region-name
AS CHAR NO-UNDO.
46 DEF VAR curr-region
AS CHAR NO-UNDO.
47 DEF VAR curr-type
AS CHAR NO-UNDO.
49 DEF VAR prp-tot
AS DEC EXTENT 8 NO-UNDO.
50 DEF VAR typ-tot
AS DEC EXTENT 8 NO-UNDO.
51 DEF VAR reg-tot
AS DEC EXTENT 8 NO-UNDO.
52 DEF VAR grd-tot
AS DEC EXTENT 8 NO-UNDO.
54 DEF VAR tenant-list
AS CHAR NO-UNDO.
56 /* _UIB-CODE-BLOCK-END
*/
60 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
62 /* ******************** Preprocessor Definitions
******************** */
64 &Scoped-define PROCEDURE-TYPE Procedure
68 /* _UIB-PREPROCESSOR-BLOCK-END
*/
73 /* *********************** Procedure Settings
************************ */
75 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
76 /* Settings for
THIS-PROCEDURE
80 Add Fields to
: Neither
81 Other Settings
: CODE-ONLY
COMPILE
83 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
85 /* ************************* Create Window
************************** */
87 &ANALYZE-SUSPEND _CREATE-WINDOW
88 /* DESIGN Window definition
(used by the UIB
)
89 CREATE WINDOW Procedure
ASSIGN
92 /* END WINDOW DEFINITION
*/
98 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
99 /* ************************* Included-Libraries
*********************** */
101 {inc
/method
/m-txtrep.i
}
104 /* _UIB-CODE-BLOCK-END
*/
109 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
112 /* *************************** Main Block
*************************** */
114 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
116 RUN rental-area-breakdown.
119 RUN view-output-file
( no
).
121 /* _UIB-CODE-BLOCK-END
*/
125 /* ********************** Internal Procedures
*********************** */
127 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE carriage-return Procedure
128 PROCEDURE carriage-return
:
129 /*------------------------------------------------------------------------------
133 ------------------------------------------------------------------------------*/
139 /* _UIB-CODE-BLOCK-END
*/
143 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE check-line Procedure
144 PROCEDURE check-line
:
145 /*------------------------------------------------------------------------------
149 ------------------------------------------------------------------------------*/
151 IF ln
>= {&lines-per-page} THEN
159 /* _UIB-CODE-BLOCK-END
*/
163 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE check-next-group Procedure
164 PROCEDURE check-next-group
:
165 /*------------------------------------------------------------------------------
169 ------------------------------------------------------------------------------*/
171 CASE Property.Region
:
172 WHEN "akld" THEN region-name
= "Auckland".
173 WHEN "wgtn" THEN region-name
= "Wellington".
174 WHEN "rot" THEN region-name
= "Rotorua".
175 WHEN "chch" THEN region-name
= "Christchurch".
176 WHEN "ham" THEN region-name
= "Hamilton".
177 WHEN "ZZZZ" THEN region-name
= "Sundry".
179 region-name
= CAPS( Property.Region
) + " Buildings".
183 IF region-name
<> curr-region
OR
184 Property.BuildingType
<> curr-type
THEN
186 IF curr-type
<> "" THEN
189 IF region-name
<> curr-region
AND
190 curr-region
<> "" THEN
195 curr-region
= region-name.
196 curr-type
= Property.BuildingType.
202 /* _UIB-CODE-BLOCK-END
*/
206 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE column-header Procedure
207 PROCEDURE column-header
:
208 /*------------------------------------------------------------------------------
212 ------------------------------------------------------------------------------*/
216 STRING( "BUILDING", "X(23)" ) SPACE(2)
217 STRING( " RETAIL", "X(10)" ) SPACE(2)
218 STRING( " WAREHOUSE", "X(10)" ) SPACE(2)
219 STRING( " FACTORY", "X(10)" ) SPACE(2)
220 STRING( " OTHER", "X(10)" ) SPACE(2)
221 STRING( " OFFICE", "X(10)" ) SPACE(2)
222 STRING( "CARPARKS", "X(8)" ) SPACE(2)
223 STRING( "TENANTS", "X(7)" ) SPACE(2)
224 STRING( " TOTAL", "X(12)" ).
229 /* _UIB-CODE-BLOCK-END
*/
233 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-property Procedure
234 PROCEDURE each-property
:
235 /*------------------------------------------------------------------------------
239 ------------------------------------------------------------------------------*/
241 IF NOT CAN-FIND ( FIRST BuildingType
WHERE
242 BuildingType.BuildingType
= Property.BuildingType
) THEN RETURN.
243 RUN check-next-group.
245 FOR EACH RentalSpace
OF Property
NO-LOCK.
246 RUN update-prp-totals.
253 /* _UIB-CODE-BLOCK-END
*/
257 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-control-strings Procedure
258 PROCEDURE get-control-strings
:
259 /*------------------------------------------------------------------------------
260 Purpose
: Get all control strings for this report
263 ------------------------------------------------------------------------------*/
265 DEF VAR rows
AS DEC NO-UNDO.
266 DEF VAR cols
AS DEC NO-UNDO.
268 RUN make-control-string
( "PCL", "reset,portrait,a4,tm,0,lm,1",
269 OUTPUT reset-page
, OUTPUT rows
, OUTPUT cols
).
271 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,12",
272 OUTPUT title-font
, OUTPUT rows
, OUTPUT cols
).
274 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,6",
275 OUTPUT time-font
, OUTPUT rows
, OUTPUT cols
).
277 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,10",
278 OUTPUT type-font
, OUTPUT rows
, OUTPUT cols
).
280 RUN make-control-string
( "PCL", "LinePrinter,lpi,9.54",
281 OUTPUT line-printer
, OUTPUT rows
, OUTPUT cols
).
285 /* _UIB-CODE-BLOCK-END
*/
289 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE grand-total Procedure
290 PROCEDURE grand-total
:
291 /*------------------------------------------------------------------------------
295 ------------------------------------------------------------------------------*/
297 DEF VAR i
AS INT NO-UNDO.
301 STRING( "GRAND TOTAL", "X(25)" ).
305 IF i
= 6 THEN prk-fmt
ELSE
306 IF i
= 7 THEN tnt-fmt
ELSE
307 IF i
= 8 THEN tot-fmt
ELSE area-fmt
)
313 /* _UIB-CODE-BLOCK-END
*/
317 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-feed Procedure
318 PROCEDURE page-feed
:
319 /*------------------------------------------------------------------------------
323 ------------------------------------------------------------------------------*/
329 /* _UIB-CODE-BLOCK-END
*/
333 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-header Procedure
334 PROCEDURE page-header
:
335 /*------------------------------------------------------------------------------
339 ------------------------------------------------------------------------------*/
347 /* _UIB-CODE-BLOCK-END
*/
351 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-title Procedure
352 PROCEDURE print-title
:
353 /*------------------------------------------------------------------------------
357 ------------------------------------------------------------------------------*/
358 DEF VAR user-name
AS CHAR NO-UNDO.
359 {inc
/username.i
"user-name"}
361 PUT CONTROL line-printer.
363 PUT CONTROL time-font.
366 "Printed: " + STRING( TODAY, "99/99/9999" ) + " " +
367 STRING( TIME, "HH:MM:SS" ) + " for " +
371 PUT CONTROL title-font.
372 PUT UNFORMATTED SPACE(45) STRING( "Rental Area Breakdown", "X(50)" ).
374 PUT CONTROL line-printer.
378 /* _UIB-CODE-BLOCK-END
*/
382 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE property-line Procedure
383 PROCEDURE property-line
:
384 /*------------------------------------------------------------------------------
388 ------------------------------------------------------------------------------*/
390 DEF VAR i
AS INT NO-UNDO.
391 DEF VAR line-zero
AS LOGI
INIT Yes
NO-UNDO.
393 DO i
= 1 TO 8: line-zero
= line-zero
AND prp-tot
[i
] = 0.00.
END.
394 IF line-zero
THEN RETURN.
397 STRING( Property.Name
, "X(23)" ) SPACE(2).
401 IF i
= 6 THEN prk-fmt
ELSE
402 IF i
= 7 THEN tnt-fmt
ELSE
403 IF i
= 8 THEN tot-fmt
ELSE area-fmt
)
408 RUN update-typ-totals.
409 RUN reset-prp-totals.
413 /* _UIB-CODE-BLOCK-END
*/
417 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE region-footer Procedure
418 PROCEDURE region-footer
:
419 /*------------------------------------------------------------------------------
423 ------------------------------------------------------------------------------*/
425 DEF VAR i
AS INT NO-UNDO.
429 STRING( curr-region
+ " Total", "X(25)" ).
433 IF i
= 6 THEN prk-fmt
ELSE
434 IF i
= 7 THEN tnt-fmt
ELSE
435 IF i
= 8 THEN tot-fmt
ELSE area-fmt
)
440 RUN update-grd-totals.
441 RUN reset-reg-totals.
445 /* _UIB-CODE-BLOCK-END
*/
449 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE rental-area-breakdown Procedure
450 PROCEDURE rental-area-breakdown
:
451 /*------------------------------------------------------------------------------
455 ------------------------------------------------------------------------------*/
457 RUN get-control-strings.
460 FOR EACH Property
NO-LOCK WHERE Property.Active
462 BY Property.BuildingType
474 /* _UIB-CODE-BLOCK-END
*/
478 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-page Procedure
479 PROCEDURE reset-page
:
480 /*------------------------------------------------------------------------------
484 ------------------------------------------------------------------------------*/
486 PUT CONTROL reset-page.
492 /* _UIB-CODE-BLOCK-END
*/
496 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-prp-totals Procedure
497 PROCEDURE reset-prp-totals
:
498 /*------------------------------------------------------------------------------
502 ------------------------------------------------------------------------------*/
504 DEF VAR i
AS INT NO-UNDO.
506 DO i
= 1 TO 8: prp-tot
[i
] = 0.00.
END.
510 /* _UIB-CODE-BLOCK-END
*/
514 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-reg-totals Procedure
515 PROCEDURE reset-reg-totals
:
516 /*------------------------------------------------------------------------------
520 ------------------------------------------------------------------------------*/
522 DEF VAR i
AS INT NO-UNDO.
523 DO i
= 1 TO 8: reg-tot
[i
] = 0.00.
END.
527 /* _UIB-CODE-BLOCK-END
*/
531 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-typ-totals Procedure
532 PROCEDURE reset-typ-totals
:
533 /*------------------------------------------------------------------------------
537 ------------------------------------------------------------------------------*/
539 DEF VAR i
AS INT NO-UNDO.
540 DO i
= 1 TO 8: typ-tot
[i
] = 0.00.
END.
544 /* _UIB-CODE-BLOCK-END
*/
548 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE separator-line Procedure
549 PROCEDURE separator-line
:
550 /*------------------------------------------------------------------------------
554 ------------------------------------------------------------------------------*/
556 PUT UNFORMATTED SPACE(25)
557 FILL( "-", 10 ) SPACE(2)
558 FILL( "-", 10 ) SPACE(2)
559 FILL( "-", 10 ) SPACE(2)
560 FILL( "-", 10 ) SPACE(2)
561 FILL( "-", 10 ) SPACE(2)
562 FILL( "-", 8 ) SPACE(2)
563 FILL( "-", 7 ) SPACE(2)
569 /* _UIB-CODE-BLOCK-END
*/
573 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-line Procedure
574 PROCEDURE skip-line
:
575 /*------------------------------------------------------------------------------
579 ------------------------------------------------------------------------------*/
581 DEF INPUT PARAMETER n
AS DEC NO-UNDO.
583 IF ln
+ n
>= {&lines-per-page} THEN
589 DEF VAR int-part
AS INT NO-UNDO.
590 DEF VAR dec-part
AS DEC NO-UNDO.
592 int-part
= TRUNCATE( n
, 0 ).
593 IF int-part
< 0 THEN RETURN.
594 dec-part
= n
- int-part.
595 IF int-part
= 0 AND dec-part
= 0 THEN RETURN.
597 /* Need to have this like the following
- do not touch
*/
598 IF int-part
<> 0 THEN PUT CONTROL FILL( CHR(10), int-part
).
599 IF dec-part
<> 0 THEN PUT CONTROL half-line.
607 /* _UIB-CODE-BLOCK-END
*/
611 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-to-line Procedure
612 PROCEDURE skip-to-line
:
613 /*------------------------------------------------------------------------------
617 ------------------------------------------------------------------------------*/
619 DEF INPUT PARAMETER line-no
AS DEC NO-UNDO.
621 DEF VAR int-part
AS INT NO-UNDO.
622 DEF VAR dec-part
AS DEC NO-UNDO.
624 int-part
= TRUNCATE( line-no
- ln
, 0 ).
625 IF int-part
< 0 THEN RETURN.
626 dec-part
= ( line-no
- ln
) - int-part.
627 IF int-part
= 0 AND dec-part
= 0 THEN RETURN.
629 IF int-part
<> 0 THEN PUT CONTROL FILL( CHR(10), int-part
).
630 IF dec-part
<> 0 THEN PUT CONTROL half-line.
638 /* _UIB-CODE-BLOCK-END
*/
642 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE type-footer Procedure
643 PROCEDURE type-footer
:
644 /*------------------------------------------------------------------------------
648 ------------------------------------------------------------------------------*/
650 DEF VAR i
AS INT NO-UNDO.
653 PUT UNFORMATTED SPACE(25).
657 IF i
= 6 THEN prk-fmt
ELSE
658 IF i
= 7 THEN tnt-fmt
ELSE
659 IF i
= 8 THEN tot-fmt
ELSE area-fmt
)
664 RUN update-reg-totals.
665 RUN reset-typ-totals.
669 /* _UIB-CODE-BLOCK-END
*/
673 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE type-header Procedure
674 PROCEDURE type-header
:
675 /*------------------------------------------------------------------------------
679 ------------------------------------------------------------------------------*/
681 FIND BuildingType
WHERE BuildingType.BuildingType
= Property.BuildingType
NO-LOCK NO-ERROR.
683 PUT CONTROL type-font.
684 PUT UNFORMATTED region-name
+ " " + BuildingType.Description.
685 PUT CONTROL line-printer.
690 /* _UIB-CODE-BLOCK-END
*/
694 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-grd-totals Procedure
695 PROCEDURE update-grd-totals
:
696 /*------------------------------------------------------------------------------
700 ------------------------------------------------------------------------------*/
702 DEF VAR i
AS INT NO-UNDO.
703 DO i
= 1 TO 8: grd-tot
[i
] = grd-tot
[i
] + reg-tot
[i
].
END.
707 /* _UIB-CODE-BLOCK-END
*/
711 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-prp-totals Procedure
712 PROCEDURE update-prp-totals
:
713 /*------------------------------------------------------------------------------
717 ------------------------------------------------------------------------------*/
719 DEF VAR i
AS INT NO-UNDO.
720 CASE RentalSpace.AreaType
:
721 WHEN 'R'
THEN prp-tot
[1] = prp-tot
[1] + RentalSpace.AreaSize .
722 WHEN 'W'
THEN prp-tot
[2] = prp-tot
[2] + RentalSpace.AreaSize .
723 WHEN 'F'
THEN prp-tot
[3] = prp-tot
[3] + RentalSpace.AreaSize .
724 WHEN 'S'
THEN prp-tot
[4] = prp-tot
[4] + RentalSpace.AreaSize .
725 WHEN 'A'
THEN prp-tot
[4] = prp-tot
[4] + RentalSpace.AreaSize .
726 WHEN 'O'
THEN prp-tot
[5] = prp-tot
[5] + RentalSpace.AreaSize .
727 WHEN 'C'
THEN prp-tot
[6] = prp-tot
[6] + RentalSpace.AreaSize .
729 IF RentalSpace.AreaSize
> 1.5 THEN DO:
730 /* Assume that it's other if there's more than
1.5 of it
! */
731 prp-tot
[4] = prp-tot
[4] + RentalSpace.AreaSize .
736 IF RentalSpace.AreaStatus
<> "V" THEN
738 FIND TenancyLease
OF RentalSpace
NO-LOCK NO-ERROR.
739 IF AVAILABLE TenancyLease
AND TenancyLease.LeaseStatus
<> "PAST" AND
740 CAN-FIND( FIRST Tenant
WHERE
741 Tenant.Active
AND Tenant.TenantCode
= TenancyLease.TenantCode
) AND
742 LOOKUP( STRING( TenancyLease.TenantCode
), tenant-list
) = 0
745 tenant-list
= tenant-list
+ IF tenant-list
= "" THEN "" ELSE ",".
746 tenant-list
= tenant-list
+ STRING( TenancyLease.TenantCode
).
747 prp-tot
[7] = prp-tot
[7] + 1.
752 IF LOOKUP( RentalSpace.AreaType
, "R,W,F,S,O" ) <> 0 THEN
753 prp-tot
[8] = prp-tot
[8] + RentalSpace.AreaSize .
757 /* _UIB-CODE-BLOCK-END
*/
761 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-reg-totals Procedure
762 PROCEDURE update-reg-totals
:
763 /*------------------------------------------------------------------------------
767 ------------------------------------------------------------------------------*/
769 DEF VAR i
AS INT NO-UNDO.
770 DO i
= 1 TO 8: reg-tot
[i
] = reg-tot
[i
] + typ-tot
[i
].
END.
774 /* _UIB-CODE-BLOCK-END
*/
778 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-typ-totals Procedure
779 PROCEDURE update-typ-totals
:
780 /*------------------------------------------------------------------------------
784 ------------------------------------------------------------------------------*/
786 DEF VAR i
AS INT NO-UNDO.
787 DO i
= 1 TO 8: typ-tot
[i
] = typ-tot
[i
] + prp-tot
[i
].
END.
791 /* _UIB-CODE-BLOCK-END
*/