1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r11
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
13 Created
: Deep in the mists of time
15 ------------------------------------------------------------------------*/
17 /* *************************** Definitions
************************** */
19 &SCOPED-DEFINE lines-per-page 112
21 DEF INPUT PARAMETER report-options
AS CHAR NO-UNDO.
23 DEF VAR date-to
AS DATE NO-UNDO.
24 DEF VAR exclude-monthly
AS LOGI
NO-UNDO INITIAL No.
25 DEF VAR preview
AS LOGI
NO-UNDO INITIAL No.
31 DEF VAR ln
AS DEC INIT 0.00 NO-UNDO.
33 /* Line definitions
*/
35 DEF VAR page-no
AS INT INIT 1 NO-UNDO.
36 DEF VAR reset-page
AS CHAR NO-UNDO.
37 DEF VAR half-line
AS CHAR NO-UNDO. half-line
= CHR(27) + "=".
38 DEF VAR title-font
AS CHAR NO-UNDO.
39 DEF VAR time-font
AS CHAR NO-UNDO.
40 DEF VAR property-font
AS CHAR NO-UNDO.
41 DEF VAR lease-font
AS CHAR NO-UNDO.
42 DEF VAR header-font
AS CHAR NO-UNDO.
43 DEF VAR line-printer
AS CHAR NO-UNDO.
44 DEF VAR i
AS INT NO-UNDO.
46 DEF VAR user-name
AS CHAR NO-UNDO.
47 {inc
/username.i
"user-name"}
49 /* _UIB-CODE-BLOCK-END
*/
53 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
55 /* ******************** Preprocessor Definitions
******************** */
57 &Scoped-define PROCEDURE-TYPE Procedure
58 &Scoped-define DB-AWARE no
62 /* _UIB-PREPROCESSOR-BLOCK-END
*/
67 /* *********************** Procedure Settings
************************ */
69 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
70 /* Settings for
THIS-PROCEDURE
74 Add Fields to
: Neither
75 Other Settings
: CODE-ONLY
COMPILE
77 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
79 /* ************************* Create Window
************************** */
81 &ANALYZE-SUSPEND _CREATE-WINDOW
82 /* DESIGN Window definition
(used by the UIB
)
83 CREATE WINDOW Procedure
ASSIGN
86 /* END WINDOW DEFINITION
*/
90 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
91 /* ************************* Included-Libraries
*********************** */
93 {inc
/method
/m-txtrep.i
}
96 /* _UIB-CODE-BLOCK-END
*/
103 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
106 /* *************************** Main Block
*************************** */
108 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
113 RUN view-output-file
( no
).
115 /* _UIB-CODE-BLOCK-END
*/
119 /* ********************** Internal Procedures
*********************** */
121 &IF DEFINED(EXCLUDE-carriage-return) = 0 &THEN
123 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE carriage-return Procedure
124 PROCEDURE carriage-return
:
125 /*------------------------------------------------------------------------------
129 ------------------------------------------------------------------------------*/
135 /* _UIB-CODE-BLOCK-END
*/
140 &IF DEFINED(EXCLUDE-column-header) = 0 &THEN
142 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE column-header Procedure
143 PROCEDURE column-header
:
144 /*------------------------------------------------------------------------------
148 ------------------------------------------------------------------------------*/
150 PUT CONTROL line-printer.
152 PUT CONTROL header-font.
155 STRING( "Space Description", "X(60)" ) SPACE(6)
156 STRING( "Area SQ.M", "X(10)" ) SPACE(8)
157 STRING( "Estimated Rental Value", "X(22)" ) SPACE(18)
158 STRING( "Current Rental", "X(20)" ).
159 PUT CONTROL line-printer.
161 PUT CONTROL header-font.
164 STRING( "$", "X" ) SPACE(10)
165 STRING( "$/Sq M", "X(6)" ) SPACE(18)
166 STRING( "$", "X" ) SPACE(10)
167 STRING( "$/Sq M", "X(6)" ).
168 PUT CONTROL line-printer.
173 /* _UIB-CODE-BLOCK-END
*/
178 &IF DEFINED(EXCLUDE-each-property) = 0 &THEN
180 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-property Procedure
181 PROCEDURE each-property
:
182 /*------------------------------------------------------------------------------
186 ------------------------------------------------------------------------------*/
188 DEF VAR i
AS INT NO-UNDO.
191 IF NOT( exclude-monthly
) THEN DO:
192 FOR EACH TenancyLease
OF Property
NO-LOCK WHERE
193 TenancyLease.LeaseStatus
= 'NORM'
194 AND ( TenancyLease.LeaseEndDate
= ?
OR
195 TenancyLease.LeaseEndDate
<= TODAY ) AND
196 CAN-FIND( Tenant
WHERE
197 Tenant.Active
AND Tenant.TenantCode
= TenancyLease.TenantCode
)
198 BY TenancyLease.LeaseEndDate
:
201 IF i
= 1 THEN RUN property-header.
202 RUN each-tenancy-lease.
206 FOR EACH TenancyLease
OF Property
NO-LOCK WHERE
207 TenancyLease.LeaseStatus
= 'NORM'
AND
208 NOT ( TenancyLease.LeaseEndDate
= ?
OR
209 TenancyLease.LeaseEndDate
<= TODAY ) AND
210 TenancyLease.LeaseEndDate
<= date-to
AND
211 CAN-FIND( Tenant
WHERE
212 Tenant.Active
AND Tenant.TenantCode
= TenancyLease.TenantCode
)
213 BY TenancyLease.LeaseEndDate
:
216 IF i
= 1 THEN RUN property-header.
217 RUN each-tenancy-lease.
220 IF i
> 0 THEN RUN skip-line
(2).
224 /* _UIB-CODE-BLOCK-END
*/
229 &IF DEFINED(EXCLUDE-each-rental-space) = 0 &THEN
231 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-rental-space Procedure
232 PROCEDURE each-rental-space
:
233 /*------------------------------------------------------------------------------
237 ------------------------------------------------------------------------------*/
239 DEF VAR mrkt
AS DEC NO-UNDO.
240 DEF VAR chrg
AS DEC NO-UNDO.
241 DEF VAR mrkt-rate
AS DEC NO-UNDO.
242 DEF VAR chrg-rate
AS DEC NO-UNDO.
243 DEF VAR c-mrkt-rate
AS CHAR NO-UNDO.
244 DEF VAR c-chrg-rate
AS CHAR NO-UNDO.
245 DEF VAR suffix
AS CHAR NO-UNDO.
247 mrkt
= IF RentalSpace.MarketRental
= ?
THEN 0.00 ELSE RentalSpace.MarketRental.
248 chrg
= IF RentalSpace.ChargedRental
= ?
THEN 0.00 ELSE RentalSpace.ChargedRental.
250 IF RentalSpace.AreaType
= "C" THEN
252 mrkt-rate
= ( mrkt
/ RentalSpace.AreaSize
) / 52
253 chrg-rate
= ( chrg
/ RentalSpace.AreaSize
) / 52
257 mrkt-rate
= mrkt
/ RentalSpace.AreaSize
258 chrg-rate
= chrg
/ RentalSpace.AreaSize.
260 IF mrkt-rate
= ?
THEN mrkt-rate
= 0.00.
IF chrg-rate
= ?
THEN chrg-rate
= 0.00.
262 c-mrkt-rate
= STRING( mrkt-rate
, ">>>>9.99" ) + suffix
263 c-chrg-rate
= STRING( chrg-rate
, ">>>>9.99" ) + suffix.
265 PUT UNFORMATTED SPACE(10)
266 STRING( RentalSpace.RentalSpaceCode
, "9999" ) SPACE(2)
267 STRING( RentalSpace.Description
, "X(40)" ) SPACE(2)
268 STRING( RentalSpace.AreaSize
, ">>>,>>9.99" ) SPACE(2)
269 STRING( mrkt
, ">>>,>>>,>>9.99" ) SPACE(2)
270 STRING( c-mrkt-rate
, "X(9)" ) SPACE(2)
271 STRING( chrg
, ">>>,>>>,>>9.99" ) SPACE(2)
272 STRING( c-chrg-rate
, "X(9)" ).
277 /* _UIB-CODE-BLOCK-END
*/
282 &IF DEFINED(EXCLUDE-each-tenancy-lease) = 0 &THEN
284 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-tenancy-lease Procedure
285 PROCEDURE each-tenancy-lease
:
286 /*------------------------------------------------------------------------------
290 ------------------------------------------------------------------------------*/
294 FOR EACH RentalSpace
OF Tenancylease
NO-LOCK
295 WHERE RentalSpace.AreaStatus
<> "V":
296 RUN each-rental-space.
303 /* _UIB-CODE-BLOCK-END
*/
308 &IF DEFINED(EXCLUDE-get-control-strings) = 0 &THEN
310 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-control-strings Procedure
311 PROCEDURE get-control-strings
:
312 /*------------------------------------------------------------------------------
313 Purpose
: Get all control strings for this report
316 ------------------------------------------------------------------------------*/
318 DEF VAR rows
AS DEC NO-UNDO.
319 DEF VAR cols
AS DEC NO-UNDO.
321 RUN make-control-string
( "PCL", "reset,portrait,a4,tm,0,lm,4",
322 OUTPUT reset-page
, OUTPUT rows
, OUTPUT cols
).
324 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,12",
325 OUTPUT title-font
, OUTPUT rows
, OUTPUT cols
).
327 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,6",
328 OUTPUT time-font
, OUTPUT rows
, OUTPUT cols
).
330 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,8",
331 OUTPUT header-font
, OUTPUT rows
, OUTPUT cols
).
333 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,10",
334 OUTPUT property-font
, OUTPUT rows
, OUTPUT cols
).
336 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,8",
337 OUTPUT lease-font
, OUTPUT rows
, OUTPUT cols
).
339 RUN make-control-string
( "PCL", "LinePrinter,lpi,9.54",
340 OUTPUT line-printer
, OUTPUT rows
, OUTPUT cols
).
344 /* _UIB-CODE-BLOCK-END
*/
349 &IF DEFINED(EXCLUDE-lease-header) = 0 &THEN
351 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE lease-header Procedure
352 PROCEDURE lease-header
:
353 /*------------------------------------------------------------------------------
357 ------------------------------------------------------------------------------*/
359 PUT CONTROL line-printer.
360 PUT UNFORMATTED SPACE(6).
361 PUT CONTROL lease-font.
363 FIND FIRST Tenant
WHERE Tenant.TenantCode
= TenancyLease.TenantCode
NO-LOCK NO-ERROR.
366 IF TenancyLease.LeaseEndDate
<= TODAY OR
367 TenancyLease.LeaseEndDate
= ?
THEN "Monthly" ELSE
368 STRING( TenancyLease.LeaseEndDate
, "99/99/9999" )
370 PUT CONTROL line-printer.
376 /* _UIB-CODE-BLOCK-END
*/
381 &IF DEFINED(EXCLUDE-leases-expiring) = 0 &THEN
383 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE leases-expiring Procedure
384 PROCEDURE leases-expiring
:
385 /*------------------------------------------------------------------------------
389 ------------------------------------------------------------------------------*/
391 RUN get-control-strings.
394 FOR EACH Property
NO-LOCK WHERE Property.Active
403 /* _UIB-CODE-BLOCK-END
*/
408 &IF DEFINED(EXCLUDE-page-feed) = 0 &THEN
410 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-feed Procedure
411 PROCEDURE page-feed
:
412 /*------------------------------------------------------------------------------
416 ------------------------------------------------------------------------------*/
418 page-no
= page-no
+ 1.
423 /* _UIB-CODE-BLOCK-END
*/
428 &IF DEFINED(EXCLUDE-page-header) = 0 &THEN
430 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-header Procedure
431 PROCEDURE page-header
:
432 /*------------------------------------------------------------------------------
436 ------------------------------------------------------------------------------*/
444 /* _UIB-CODE-BLOCK-END
*/
449 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
451 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
452 PROCEDURE parse-parameters
:
453 /*------------------------------------------------------------------------------
455 ------------------------------------------------------------------------------*/
456 DEF VAR token
AS CHAR NO-UNDO.
457 DEF VAR i
AS INT NO-UNDO.
459 {inc
/showopts.i
"report-options"}
461 DO i
= 1 TO NUM-ENTRIES( report-options
, "~n" ):
462 token
= ENTRY( i
, report-options
, "~n" ).
464 CASE ENTRY( 1, token
):
465 WHEN "Preview" THEN preview
= Yes.
466 WHEN "ExcludeMonthly" THEN exclude-monthly
= Yes.
467 WHEN "UpTo" THEN ASSIGN
468 date-to
= DATE( ENTRY( 2, token
) ).
476 /* _UIB-CODE-BLOCK-END
*/
481 &IF DEFINED(EXCLUDE-print-title) = 0 &THEN
483 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-title Procedure
484 PROCEDURE print-title
:
485 /*------------------------------------------------------------------------------
489 ------------------------------------------------------------------------------*/
491 PUT CONTROL line-printer.
493 PUT CONTROL time-font.
496 "Printed: " + STRING( TODAY, "99/99/9999" ) + " " +
497 STRING( TIME, "HH:MM:SS" ) + " for " + user-name
,
498 "X(100)" ) SPACE(120)
499 STRING( "Page: " + STRING( page-no
), "X(20)" ).
501 PUT CONTROL title-font.
502 PUT UNFORMATTED SPACE(45) STRING( "Leases Expiring Report", "X(50)" ).
504 PUT CONTROL line-printer.
508 /* _UIB-CODE-BLOCK-END
*/
513 &IF DEFINED(EXCLUDE-property-header) = 0 &THEN
515 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE property-header Procedure
516 PROCEDURE property-header
:
517 /*------------------------------------------------------------------------------
521 ------------------------------------------------------------------------------*/
523 PUT CONTROL property-font.
524 PUT UNFORMATTED STRING(
525 "(" + Property.Region
+ ") " +
526 STRING( Property.PropertyCode
, "9999" ) + '
- '
+ Property.Name
,
528 PUT CONTROL line-printer.
533 /* _UIB-CODE-BLOCK-END
*/
538 &IF DEFINED(EXCLUDE-reset-page) = 0 &THEN
540 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-page Procedure
541 PROCEDURE reset-page
:
542 /*------------------------------------------------------------------------------
546 ------------------------------------------------------------------------------*/
548 PUT CONTROL reset-page.
553 /* _UIB-CODE-BLOCK-END
*/
558 &IF DEFINED(EXCLUDE-skip-line) = 0 &THEN
560 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-line Procedure
561 PROCEDURE skip-line
:
562 /*------------------------------------------------------------------------------
566 ------------------------------------------------------------------------------*/
568 DEF INPUT PARAMETER n
AS DEC NO-UNDO.
570 IF ln
+ n
>= {&lines-per-page} THEN
577 DEF VAR int-part
AS INT NO-UNDO.
578 DEF VAR dec-part
AS DEC NO-UNDO.
580 int-part
= TRUNCATE( n
, 0 ).
581 IF int-part
< 0 THEN RETURN.
582 dec-part
= n
- int-part.
583 IF int-part
= 0 AND dec-part
= 0 THEN RETURN.
585 /* Need to have this like the following
- do not touch
*/
586 IF int-part
<> 0 THEN PUT CONTROL FILL( CHR(10), int-part
).
587 IF dec-part
<> 0 THEN PUT CONTROL half-line.
595 /* _UIB-CODE-BLOCK-END
*/
600 &IF DEFINED(EXCLUDE-skip-to-line) = 0 &THEN
602 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-to-line Procedure
603 PROCEDURE skip-to-line
:
604 /*------------------------------------------------------------------------------
608 ------------------------------------------------------------------------------*/
610 DEF INPUT PARAMETER line-no
AS DEC NO-UNDO.
612 DEF VAR int-part
AS INT NO-UNDO.
613 DEF VAR dec-part
AS DEC NO-UNDO.
615 int-part
= TRUNCATE( line-no
- ln
, 0 ).
616 IF int-part
< 0 THEN RETURN.
617 dec-part
= ( line-no
- ln
) - int-part.
618 IF int-part
= 0 AND dec-part
= 0 THEN RETURN.
620 IF int-part
<> 0 THEN PUT CONTROL FILL( CHR(10), int-part
).
621 IF dec-part
<> 0 THEN PUT CONTROL half-line.
629 /* _UIB-CODE-BLOCK-END
*/