1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r11
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
15 ------------------------------------------------------------------------*/
17 DEF INPUT PARAMETER date-to
AS DATE NO-UNDO.
19 &SCOPED-DEFINE lines-per-page 112
22 DEF VAR ln
AS DEC INIT 0.00 NO-UNDO.
24 /* Line definitions
*/
26 DEF VAR page-no
AS INT INIT 1 NO-UNDO.
27 DEF VAR reset-page
AS CHAR NO-UNDO.
28 DEF VAR half-line
AS CHAR NO-UNDO. half-line
= CHR(27) + "=".
29 DEF VAR title-font
AS CHAR NO-UNDO.
30 DEF VAR time-font
AS CHAR NO-UNDO.
31 DEF VAR rent-review-font
AS CHAR NO-UNDO.
32 DEF VAR header-font
AS CHAR NO-UNDO.
33 DEF VAR line-printer
AS CHAR NO-UNDO.
34 DEF VAR i
AS INT NO-UNDO.
36 DEF VAR area-tot
AS DEC INITIAL 0.00 NO-UNDO.
37 DEF VAR chrg-tot
AS DEC INITIAL 0.00 NO-UNDO.
38 DEF VAR erv-tot
AS DEC INITIAL 0.00 NO-UNDO.
40 DEF VAR g-area-tot
AS DEC INITIAL 0.00 NO-UNDO.
41 DEF VAR g-chrg-tot
AS DEC INITIAL 0.00 NO-UNDO.
42 DEF VAR g-erv-tot
AS DEC INITIAL 0.00 NO-UNDO.
44 DEF VAR user-name
AS CHAR NO-UNDO.
45 {inc
/username.i
"user-name"}
47 /* _UIB-CODE-BLOCK-END
*/
51 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
53 /* ******************** Preprocessor Definitions
******************** */
55 &Scoped-define PROCEDURE-TYPE Procedure
59 /* _UIB-PREPROCESSOR-BLOCK-END
*/
64 /* *********************** Procedure Settings
************************ */
66 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
67 /* Settings for
THIS-PROCEDURE
71 Add Fields to
: Neither
72 Other Settings
: CODE-ONLY
COMPILE
74 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
76 /* ************************* Create Window
************************** */
78 &ANALYZE-SUSPEND _CREATE-WINDOW
79 /* DESIGN Window definition
(used by the UIB
)
80 CREATE WINDOW Procedure
ASSIGN
88 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
89 /* ************************* Included-Libraries
*********************** */
91 {inc
/method
/m-txtrep.i
}
94 /* _UIB-CODE-BLOCK-END
*/
99 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
102 /* *************************** Main Block
*************************** */
104 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
109 RUN view-output-file
( no
).
111 /* _UIB-CODE-BLOCK-END
*/
115 /* ********************** Internal Procedures
*********************** */
117 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE carriage-return Procedure
118 PROCEDURE carriage-return
:
119 /*------------------------------------------------------------------------------
123 ------------------------------------------------------------------------------*/
129 /* _UIB-CODE-BLOCK-END
*/
133 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE column-header Procedure
134 PROCEDURE column-header
:
135 /*------------------------------------------------------------------------------
139 ------------------------------------------------------------------------------*/
141 PUT CONTROL line-printer.
143 PUT CONTROL header-font.
145 STRING( "Date Due", "X(10)" ) SPACE(4)
146 STRING( "Space Description", "X(60)" ) SPACE(6)
147 STRING( "Area SQ.M", "X(10)" ) SPACE(8)
148 STRING( "Estimated Rental Value", "X(22)" ) SPACE(18)
149 STRING( "Current Rental", "X(20)" ).
150 PUT CONTROL line-printer.
152 PUT CONTROL header-font.
155 STRING( "$", "X" ) SPACE(10)
156 STRING( "$/Sq M", "X(6)" ) SPACE(18)
157 STRING( "$", "X" ) SPACE(10)
158 STRING( "$/Sq M", "X(6)" ).
159 PUT CONTROL line-printer.
164 /* _UIB-CODE-BLOCK-END
*/
168 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-rent-review Procedure
169 PROCEDURE each-rent-review
:
170 /*------------------------------------------------------------------------------
174 ------------------------------------------------------------------------------*/
176 DEF VAR i
AS INT NO-UNDO.
177 RUN rent-review-header.
181 FOR EACH RentalSpace
OF TenancyLease
NO-LOCK:
183 RUN each-rental-space.
186 IF i
> 1 THEN RUN rent-review-footer.
191 /* _UIB-CODE-BLOCK-END
*/
195 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-rental-space Procedure
196 PROCEDURE each-rental-space
:
197 /*------------------------------------------------------------------------------
201 ------------------------------------------------------------------------------*/
203 DEF VAR mrkt
AS DEC NO-UNDO.
204 DEF VAR chrg
AS DEC NO-UNDO.
205 DEF VAR mrkt-rate
AS DEC NO-UNDO.
206 DEF VAR chrg-rate
AS DEC NO-UNDO.
207 DEF VAR c-mrkt-rate
AS CHAR NO-UNDO.
208 DEF VAR c-chrg-rate
AS CHAR NO-UNDO.
209 DEF VAR c-area
AS CHAR NO-UNDO.
210 DEF VAR suffix
AS CHAR NO-UNDO.
212 mrkt
= IF RentalSpace.MarketRental
= ?
THEN 0.00 ELSE RentalSpace.MarketRental.
213 chrg
= IF RentalSpace.ChargedRental
= ?
THEN 0.00 ELSE RentalSpace.ChargedRental.
215 IF RentalSpace.AreaType
= "C" THEN
217 mrkt-rate
= ( mrkt
/ RentalSpace.AreaSize
) / 52
218 chrg-rate
= ( chrg
/ RentalSpace.AreaSize
) / 52
222 mrkt-rate
= mrkt
/ RentalSpace.AreaSize
223 chrg-rate
= chrg
/ RentalSpace.AreaSize.
225 IF mrkt-rate
= ?
THEN mrkt-rate
= 0.00.
IF chrg-rate
= ?
THEN chrg-rate
= 0.00.
227 c-mrkt-rate
= STRING( mrkt-rate
, ">>>9.99" ) + suffix
228 c-chrg-rate
= STRING( chrg-rate
, ">>>9.99" ) + suffix.
230 c-area
= IF RentalSpace.AreaType
= "C"
231 THEN STRING( RentalSpace.AreaSize
, " >>>,>>9" ) + "cp"
232 ELSE STRING( RentalSpace.AreaSize
, ">>>,>>9.99" ).
237 STRING( RentalSpace.RentalSpaceCode
, "9999" ) SPACE(2)
238 STRING( RentalSpace.Description
, "X(45)" ) SPACE(2)
239 STRING( c-area
, "X(12)" ) SPACE(0)
240 STRING( mrkt
, ">>>,>>>,>>9.99" ) SPACE(2)
241 STRING( c-mrkt-rate
, "X(9)" ) SPACE(2)
242 STRING( chrg
, ">>>,>>>,>>9.99" ) SPACE(2)
243 STRING( c-chrg-rate
, "X(9)" ).
246 area-tot
= area-tot
+ IF LOOKUP( RentalSpace.AreaType
, "C,N" ) <> 0 THEN 0 ELSE RentalSpace.AreaSize .
247 chrg-tot
= chrg-tot
+ chrg.
248 erv-tot
= erv-tot
+ mrkt.
252 /* _UIB-CODE-BLOCK-END
*/
256 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-control-strings Procedure
257 PROCEDURE get-control-strings
:
258 /*------------------------------------------------------------------------------
259 Purpose
: Get all control strings for this report
262 ------------------------------------------------------------------------------*/
264 DEF VAR rows
AS DEC NO-UNDO.
265 DEF VAR cols
AS DEC NO-UNDO.
267 RUN make-control-string
( "PCL", "reset,portrait,a4,tm,0,lm,4",
268 OUTPUT reset-page
, OUTPUT rows
, OUTPUT cols
).
270 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,12",
271 OUTPUT title-font
, OUTPUT rows
, OUTPUT cols
).
273 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,6",
274 OUTPUT time-font
, OUTPUT rows
, OUTPUT cols
).
276 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,8",
277 OUTPUT header-font
, OUTPUT rows
, OUTPUT cols
).
279 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,8",
280 OUTPUT rent-review-font
, OUTPUT rows
, OUTPUT cols
).
282 RUN make-control-string
( "PCL", "LinePrinter,lpi,9.54",
283 OUTPUT line-printer
, OUTPUT rows
, OUTPUT cols
).
287 /* _UIB-CODE-BLOCK-END
*/
291 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-feed Procedure
292 PROCEDURE page-feed
:
293 /*------------------------------------------------------------------------------
297 ------------------------------------------------------------------------------*/
299 page-no
= page-no
+ 1.
304 /* _UIB-CODE-BLOCK-END
*/
308 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-header Procedure
309 PROCEDURE page-header
:
310 /*------------------------------------------------------------------------------
314 ------------------------------------------------------------------------------*/
322 /* _UIB-CODE-BLOCK-END
*/
326 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-title Procedure
327 PROCEDURE print-title
:
328 /*------------------------------------------------------------------------------
332 ------------------------------------------------------------------------------*/
334 PUT CONTROL line-printer.
336 PUT CONTROL time-font.
339 "Printed: " + STRING( TODAY, "99/99/9999" ) + " " +
340 STRING( TIME, "HH:MM:SS" ) + " for " + user-name
,
341 "X(100)" ) SPACE(120)
342 STRING( "Page: " + STRING( page-no
), "X(20)" ).
344 PUT CONTROL title-font.
345 PUT UNFORMATTED SPACE(42) STRING( "Schedule of Rent Reviews", "X(50)" ).
347 PUT CONTROL line-printer.
351 /* _UIB-CODE-BLOCK-END
*/
355 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE rent-review-footer Procedure
356 PROCEDURE rent-review-footer
:
357 /*------------------------------------------------------------------------------
361 ------------------------------------------------------------------------------*/
362 PUT UNFORMATTED SPACE(57) FILL( '
-'
, 10 ) + " " + FILL( '
-'
, 14 )
363 + FILL( ' '
, 13 ) + FILL( '
-'
, 14 ).
365 PUT UNFORMATTED SPACE(57)
366 STRING( area-tot
, ">>>,>>9.99" ) SPACE(2)
367 STRING( erv-tot
, ">>>,>>>,>>9.99" ) SPACE(13)
368 STRING( chrg-tot
, ">>>,>>>,>>9.99" ).
373 /* _UIB-CODE-BLOCK-END
*/
377 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE rent-review-header Procedure
378 PROCEDURE rent-review-header
:
379 /*------------------------------------------------------------------------------
383 ------------------------------------------------------------------------------*/
385 FIND TenancyLease
OF RentReview
NO-LOCK NO-ERROR.
386 FIND Tenant
WHERE Tenant.TenantCode
= TenancyLease.TenantCode
NO-LOCK NO-ERROR.
387 FIND Property
OF TenancyLease
NO-LOCK NO-ERROR.
389 PUT CONTROL rent-review-font.
391 STRING( RentReview.DateDue
, "99/99/9999" ) SPACE(4)
392 STRING( Property.PropertyCode
, "9999" ) STRING( " - ", "X(3)" )
393 STRING( Property.Name
, "X(50)" ) SPACE(4).
394 PUT CONTROL line-printer.
396 PUT CONTROL rent-review-font.
399 STRING( Tenant.Name
, "X(50)" ).
400 PUT CONTROL line-printer.
405 /* _UIB-CODE-BLOCK-END
*/
409 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE rent-reviews Procedure
410 PROCEDURE rent-reviews
:
411 /*------------------------------------------------------------------------------
415 ------------------------------------------------------------------------------*/
417 RUN get-control-strings.
420 FOR EACH RentReview
NO-LOCK WHERE RentReview.DateDue
<= date-to
421 AND RentReview.ReviewStatus
<> "DONE"
422 BY RentReview.DateDue
:
423 RUN each-rent-review.
432 /* _UIB-CODE-BLOCK-END
*/
436 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-footer Procedure
437 PROCEDURE report-footer
:
438 /*------------------------------------------------------------------------------
440 ------------------------------------------------------------------------------*/
442 PUT UNFORMATTED SPACE(57) FILL( '
='
, 10 ) + " " + FILL( '
='
, 14 )
443 + FILL( ' '
, 13 ) + FILL( '
='
, 14 ).
445 PUT UNFORMATTED SPACE(57)
446 STRING( g-area-tot
, ">>>,>>9.99" ) SPACE(2)
447 STRING( g-erv-tot
, ">>>,>>>,>>9.99" ) SPACE(13)
448 STRING( g-chrg-tot
, ">>>,>>>,>>9.99" ).
453 /* _UIB-CODE-BLOCK-END
*/
457 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-page Procedure
458 PROCEDURE reset-page
:
459 /*------------------------------------------------------------------------------
463 ------------------------------------------------------------------------------*/
465 PUT CONTROL reset-page.
470 /* _UIB-CODE-BLOCK-END
*/
474 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-totals Procedure
475 PROCEDURE reset-totals
:
476 /*------------------------------------------------------------------------------
480 ------------------------------------------------------------------------------*/
481 g-area-tot
= g-area-tot
+ area-tot .
482 g-chrg-tot
= g-chrg-tot
+ chrg-tot .
483 g-erv-tot
= g-erv-tot
+ erv-tot .
491 /* _UIB-CODE-BLOCK-END
*/
495 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-line Procedure
496 PROCEDURE skip-line
:
497 /*------------------------------------------------------------------------------
501 ------------------------------------------------------------------------------*/
503 DEF INPUT PARAMETER n
AS DEC NO-UNDO.
505 IF ln
+ n
>= {&lines-per-page} THEN
512 DEF VAR int-part
AS INT NO-UNDO.
513 DEF VAR dec-part
AS DEC NO-UNDO.
515 int-part
= TRUNCATE( n
, 0 ).
516 IF int-part
< 0 THEN RETURN.
517 dec-part
= n
- int-part.
518 IF int-part
= 0 AND dec-part
= 0 THEN RETURN.
520 /* Need to have this like the following
- do not touch
*/
521 IF int-part
<> 0 THEN PUT CONTROL FILL( CHR(10), int-part
).
522 IF dec-part
<> 0 THEN PUT CONTROL half-line.
530 /* _UIB-CODE-BLOCK-END
*/
534 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-to-line Procedure
535 PROCEDURE skip-to-line
:
536 /*------------------------------------------------------------------------------
540 ------------------------------------------------------------------------------*/
542 DEF INPUT PARAMETER line-no
AS DEC NO-UNDO.
544 DEF VAR int-part
AS INT NO-UNDO.
545 DEF VAR dec-part
AS DEC NO-UNDO.
547 int-part
= TRUNCATE( line-no
- ln
, 0 ).
548 IF int-part
< 0 THEN RETURN.
549 dec-part
= ( line-no
- ln
) - int-part.
550 IF int-part
= 0 AND dec-part
= 0 THEN RETURN.
552 IF int-part
<> 0 THEN PUT CONTROL FILL( CHR(10), int-part
).
553 IF dec-part
<> 0 THEN PUT CONTROL half-line.
561 /* _UIB-CODE-BLOCK-END
*/