Added capital works blank section. Synced calling screen.
[capital-apms-progress.git] / process / report / vcntspce.p
blob608f54b23ea9ee3a5570962b6bacaa76645778ed
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r11
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 File :
6 Purpose :
8 Syntax :
10 Description :
12 Author(s) :
13 Created :
14 Notes :
15 ------------------------------------------------------------------------*/
16 /* This .W file was created with the Progress UIB. */
17 /*----------------------------------------------------------------------*/
19 /* *************************** Definitions ************************** */
21 &SCOPED-DEFINE lines-per-page 112
23 /* Report counters */
24 DEF VAR ln AS DEC INIT 0.00 NO-UNDO.
26 /* Line definitions */
28 DEF VAR page-no AS INT INIT 1 NO-UNDO.
29 DEF VAR reset-page AS CHAR NO-UNDO.
30 DEF VAR half-line AS CHAR NO-UNDO. half-line = CHR(27) + "=".
31 DEF VAR title-font AS CHAR NO-UNDO.
32 DEF VAR time-font AS CHAR NO-UNDO.
33 DEF VAR property-font AS CHAR NO-UNDO.
34 DEF VAR header-font AS CHAR NO-UNDO.
35 DEF VAR line-printer AS CHAR NO-UNDO.
36 DEF VAR i AS INT NO-UNDO.
38 DEF VAR rsp-tot AS DEC EXTENT 2 NO-UNDO.
39 DEF VAR prp-tot AS DEC EXTENT 2 NO-UNDO.
40 DEF VAR grd-tot AS DEC EXTENT 2 NO-UNDO.
42 DEF VAR market-total AS DEC NO-UNDO.
44 DEF VAR user-name AS CHAR NO-UNDO.
45 {inc/username.i "user-name"}
47 /* _UIB-CODE-BLOCK-END */
48 &ANALYZE-RESUME
51 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
53 /* ******************** Preprocessor Definitions ******************** */
55 &Scoped-define PROCEDURE-TYPE Procedure
59 /* _UIB-PREPROCESSOR-BLOCK-END */
60 &ANALYZE-RESUME
64 /* *********************** Procedure Settings ************************ */
66 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
67 /* Settings for THIS-PROCEDURE
68 Type: Procedure
69 Allow:
70 Frames: 0
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
81 HEIGHT = .1
82 WIDTH = 40.
84 &ANALYZE-RESUME
88 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
89 /* ************************* Included-Libraries *********************** */
91 {inc/method/m-txtrep.i}
92 {inc/convert.i}
94 /* _UIB-CODE-BLOCK-END */
95 &ANALYZE-RESUME
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.
106 RUN vacant-spaces.
108 OUTPUT CLOSE.
109 RUN view-output-file ( no ).
111 /* _UIB-CODE-BLOCK-END */
112 &ANALYZE-RESUME
115 /* ********************** Internal Procedures *********************** */
117 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE carriage-return Procedure
118 PROCEDURE carriage-return :
119 /*------------------------------------------------------------------------------
120 Purpose:
121 Parameters: <none>
122 Notes:
123 ------------------------------------------------------------------------------*/
125 PUT CONTROL CHR(13).
127 END PROCEDURE.
129 /* _UIB-CODE-BLOCK-END */
130 &ANALYZE-RESUME
133 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE column-header Procedure
134 PROCEDURE column-header :
135 /*------------------------------------------------------------------------------
136 Purpose:
137 Parameters: <none>
138 Notes:
139 ------------------------------------------------------------------------------*/
141 PUT CONTROL line-printer.
142 RUN skip-line(2).
143 PUT CONTROL header-font.
144 PUT UNFORMATTED SPACE(12)
145 STRING( "Code" ) SPACE(10)
146 STRING( "Space Description", "X(86)" ) SPACE(4)
147 STRING( "Area", "X(8)" ) SPACE(4)
148 STRING( "Expected Market Value" ).
149 PUT CONTROL line-printer.
150 RUN skip-line(1).
152 PUT CONTROL header-font.
153 PUT UNFORMATTED SPACE(150)
154 STRING( "$ P.A.", "X(6)" ) SPACE(12)
155 STRING( "$/Sq M" ).
157 PUT CONTROL line-printer.
158 RUN skip-line(3).
160 END PROCEDURE.
162 /* _UIB-CODE-BLOCK-END */
163 &ANALYZE-RESUME
166 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-property Procedure
167 PROCEDURE each-property :
168 /*------------------------------------------------------------------------------
169 Purpose:
170 Parameters: <none>
171 Notes:
172 ------------------------------------------------------------------------------*/
174 DEF VAR i AS INT NO-UNDO.
175 DEF VAR area-rental AS DEC NO-UNDO.
177 RUN reset-prp-totals.
178 i = 0.
179 FOR EACH RentalSpace OF Property NO-LOCK:
180 IF RentalSpace.AreaStatus = "V" THEN
182 i = i + 1.
183 IF i = 1 THEN RUN property-header.
184 RUN each-vacant-space.
185 area-rental = (IF RentalSpace.MarketRental <> ? THEN RentalSpace.MarketRental ELSE 0.00).
186 END.
187 ELSE
188 area-rental = (IF RentalSpace.ContractedRental <> ? THEN RentalSpace.ContractedRental ELSE 0.00).
190 market-total = market-total + area-rental.
191 END.
193 IF i > 1 THEN RUN property-footer.
194 IF i > 0 THEN RUN skip-line(0.5).
196 END PROCEDURE.
198 /* _UIB-CODE-BLOCK-END */
199 &ANALYZE-RESUME
202 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-vacant-space Procedure
203 PROCEDURE each-vacant-space :
204 /*------------------------------------------------------------------------------
205 Purpose:
206 Parameters: <none>
207 Notes:
208 ------------------------------------------------------------------------------*/
210 DEF VAR rsp-rate AS DEC NO-UNDO.
211 DEF VAR c-rate AS CHAR NO-UNDO.
213 rsp-tot[1] = IF RentalSpace.AreaSize <> ? THEN RentalSpace.AreaSize ELSE 0.00.
214 rsp-tot[2] = IF RentalSpace.MarketRental <> ? THEN RentalSpace.MarketRental ELSE 0.00.
215 IF RentalSpace.AreaType = "C" THEN DO:
216 ASSIGN
217 rsp-rate = rsp-tot[2] / rsp-tot[1]
218 rsp-rate = rsp-rate / 52.
220 IF rsp-rate = ? THEN rsp-rate = rsp-tot[2].
221 c-rate = STRING( rsp-rate, ">>>9.99" ) + "pw".
222 END.
223 ELSE DO:
224 rsp-rate = rsp-tot[2] / rsp-tot[1].
225 IF rsp-rate = ? THEN rsp-rate = rsp-tot[2].
226 c-rate = STRING( rsp-rate, ">>>9.99" ).
227 END.
229 PUT UNFORMATTED SPACE(8)
230 STRING( RentalSpace.RentalSpaceCode, "9999" ) SPACE(6)
231 STRING( RentalSpace.Description, "X(50)" ) SPACE(4)
232 STRING( rsp-tot[1], ">>>,>>9.99" ) SPACE(4)
233 STRING( rsp-tot[2], ">>>,>>>,>>9.99" ) SPACE(4)
234 STRING( c-rate, "X(12)" ).
235 RUN skip-line(1).
236 RUN update-prp-totals.
238 END PROCEDURE.
240 /* _UIB-CODE-BLOCK-END */
241 &ANALYZE-RESUME
244 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-control-strings Procedure
245 PROCEDURE get-control-strings :
246 /*------------------------------------------------------------------------------
247 Purpose: Get all control strings for this report
248 Parameters: <none>
249 Notes:
250 ------------------------------------------------------------------------------*/
252 DEF VAR rows AS DEC NO-UNDO.
253 DEF VAR cols AS DEC NO-UNDO.
255 RUN make-control-string ( "PCL", "reset,portrait,a4,tm,0,lm,4",
256 OUTPUT reset-page, OUTPUT rows, OUTPUT cols ).
258 RUN make-control-string ( "PCL", "Proportional,Helvetica,Bold,Point,12",
259 OUTPUT title-font, OUTPUT rows, OUTPUT cols ).
261 RUN make-control-string ( "PCL", "Proportional,Helvetica,Bold,Point,6",
262 OUTPUT time-font, OUTPUT rows, OUTPUT cols ).
264 RUN make-control-string ( "PCL", "Proportional,Helvetica,Bold,Point,8",
265 OUTPUT header-font, OUTPUT rows, OUTPUT cols ).
267 RUN make-control-string ( "PCL", "Proportional,Helvetica,Bold,Point,10",
268 OUTPUT property-font, OUTPUT rows, OUTPUT cols ).
270 RUN make-control-string ( "PCL", "LinePrinter,lpi,9.54",
271 OUTPUT line-printer, OUTPUT rows, OUTPUT cols ).
273 END PROCEDURE.
275 /* _UIB-CODE-BLOCK-END */
276 &ANALYZE-RESUME
279 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-feed Procedure
280 PROCEDURE page-feed :
281 /*------------------------------------------------------------------------------
282 Purpose:
283 Parameters: <none>
284 Notes:
285 ------------------------------------------------------------------------------*/
287 page-no = page-no + 1.
288 PUT CONTROL CHR(12).
290 END PROCEDURE.
292 /* _UIB-CODE-BLOCK-END */
293 &ANALYZE-RESUME
296 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-header Procedure
297 PROCEDURE page-header :
298 /*------------------------------------------------------------------------------
299 Purpose:
300 Parameters: <none>
301 Notes:
302 ------------------------------------------------------------------------------*/
304 RUN reset-page.
305 RUN print-title.
306 RUN column-header.
308 END PROCEDURE.
310 /* _UIB-CODE-BLOCK-END */
311 &ANALYZE-RESUME
314 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-grd-totals Procedure
315 PROCEDURE print-grd-totals :
316 /*------------------------------------------------------------------------------
317 Purpose:
318 Parameters: <none>
319 Notes:
320 ------------------------------------------------------------------------------*/
322 RUN skip-line(2).
323 PUT UNFORMATTED SPACE(72)
324 STRING( FILL( '-', 10 ) + FILL( ' ', 4 ) + FILL( '-', 14 ), "X(50)" ).
325 RUN skip-line(1).
327 DEF VAR percentage AS DEC NO-UNDO.
328 percentage = grd-tot[2] / market-total.
330 PUT UNFORMATTED
331 STRING( "GRAND TOTAL", "X(11)" ) SPACE(61)
332 STRING( grd-tot[1], ">>>,>>9.99" ) SPACE(4)
333 STRING( grd-tot[2], ">>>,>>>,>>9.99" ).
334 RUN skip-line(2).
336 PUT UNFORMATTED
337 SPACE( 72 )
338 STRING( percentage, ">>9.99" ) STRING( "%", "X" ) SPACE(1)
339 STRING( "of Rental Gross Income as at " + STRING(TODAY, "99/99/9999"), "X(60)" ).
340 RUN skip-line(1).
342 END PROCEDURE.
344 /* _UIB-CODE-BLOCK-END */
345 &ANALYZE-RESUME
348 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-title Procedure
349 PROCEDURE print-title :
350 /*------------------------------------------------------------------------------
351 Purpose:
352 Parameters: <none>
353 Notes:
354 ------------------------------------------------------------------------------*/
356 PUT CONTROL line-printer.
357 RUN skip-line(2).
358 PUT CONTROL time-font.
359 PUT UNFORMATTED
360 STRING(
361 "Printed: " + STRING( TODAY, "99/99/9999" ) + " " +
362 STRING( TIME, "HH:MM:SS" ) + " for " + user-name,
363 "X(100)" ) SPACE(120)
364 STRING( "Page: " + STRING( page-no ), "X(20)" ).
365 RUN skip-line(2).
366 PUT CONTROL title-font.
367 PUT UNFORMATTED SPACE(45) STRING( "Vacant Space Report", "X(50)" ).
368 RUN skip-line(1).
369 PUT CONTROL line-printer.
371 END PROCEDURE.
373 /* _UIB-CODE-BLOCK-END */
374 &ANALYZE-RESUME
377 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE property-footer Procedure
378 PROCEDURE property-footer :
379 /*------------------------------------------------------------------------------
380 Purpose:
381 Parameters: <none>
382 Notes:
383 ------------------------------------------------------------------------------*/
385 PUT UNFORMATTED SPACE(72)
386 STRING( FILL( '-', 10 ) + FILL( ' ', 4 ) + FILL( '-', 14 ), "X(50)" ).
387 RUN skip-line(1).
389 PUT UNFORMATTED SPACE(72)
390 STRING( prp-tot[1], ">>>,>>9.99" ) SPACE(4)
391 STRING( prp-tot[2], ">>>,>>>,>>9.99" ).
392 RUN skip-line(1).
394 RUN update-grd-totals.
395 RUN skip-line(1).
397 END PROCEDURE.
399 /* _UIB-CODE-BLOCK-END */
400 &ANALYZE-RESUME
403 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE property-header Procedure
404 PROCEDURE property-header :
405 /*------------------------------------------------------------------------------
406 Purpose:
407 Parameters: <none>
408 Notes:
409 ------------------------------------------------------------------------------*/
411 PUT CONTROL property-font.
412 PUT UNFORMATTED STRING(
413 "(" + Property.Region + ") " +
414 STRING( Property.PropertyCode, "9999" ) + ' - ' + Property.Name,
415 "X(100)" ).
416 PUT CONTROL line-printer.
417 RUN skip-line(2).
419 END PROCEDURE.
421 /* _UIB-CODE-BLOCK-END */
422 &ANALYZE-RESUME
425 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-page Procedure
426 PROCEDURE reset-page :
427 /*------------------------------------------------------------------------------
428 Purpose:
429 Parameters: <none>
430 Notes:
431 ------------------------------------------------------------------------------*/
433 PUT CONTROL reset-page.
434 ln = 0.
436 END PROCEDURE.
438 /* _UIB-CODE-BLOCK-END */
439 &ANALYZE-RESUME
442 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-prp-totals Procedure
443 PROCEDURE reset-prp-totals :
444 /*------------------------------------------------------------------------------
445 Purpose:
446 Parameters: <none>
447 Notes:
448 ------------------------------------------------------------------------------*/
450 DO i = 1 TO 2: prp-tot[i] = 0.00. END.
452 END PROCEDURE.
454 /* _UIB-CODE-BLOCK-END */
455 &ANALYZE-RESUME
458 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-line Procedure
459 PROCEDURE skip-line :
460 /*------------------------------------------------------------------------------
461 Purpose:
462 Parameters: <none>
463 Notes:
464 ------------------------------------------------------------------------------*/
466 DEF INPUT PARAMETER n AS DEC NO-UNDO.
468 IF ln + n >= {&lines-per-page} THEN
470 RUN page-feed.
471 RUN page-header.
472 RETURN.
473 END.
475 DEF VAR int-part AS INT NO-UNDO.
476 DEF VAR dec-part AS DEC NO-UNDO.
478 int-part = TRUNCATE( n, 0 ).
479 IF int-part < 0 THEN RETURN.
480 dec-part = n - int-part.
481 IF int-part = 0 AND dec-part = 0 THEN RETURN.
483 /* Need to have this like the following - do not touch */
484 IF int-part <> 0 THEN PUT CONTROL FILL( CHR(10), int-part ).
485 IF dec-part <> 0 THEN PUT CONTROL half-line.
487 ln = ln + n.
489 RUN carriage-return.
491 END PROCEDURE.
493 /* _UIB-CODE-BLOCK-END */
494 &ANALYZE-RESUME
497 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-to-line Procedure
498 PROCEDURE skip-to-line :
499 /*------------------------------------------------------------------------------
500 Purpose:
501 Parameters: <none>
502 Notes:
503 ------------------------------------------------------------------------------*/
505 DEF INPUT PARAMETER line-no AS DEC NO-UNDO.
507 DEF VAR int-part AS INT NO-UNDO.
508 DEF VAR dec-part AS DEC NO-UNDO.
510 int-part = TRUNCATE( line-no - ln, 0 ).
511 IF int-part < 0 THEN RETURN.
512 dec-part = ( line-no - ln ) - int-part.
513 IF int-part = 0 AND dec-part = 0 THEN RETURN.
515 IF int-part <> 0 THEN PUT CONTROL FILL( CHR(10), int-part ).
516 IF dec-part <> 0 THEN PUT CONTROL half-line.
518 ln = line-no.
520 RUN carriage-return.
522 END PROCEDURE.
524 /* _UIB-CODE-BLOCK-END */
525 &ANALYZE-RESUME
528 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-grd-totals Procedure
529 PROCEDURE update-grd-totals :
530 /*------------------------------------------------------------------------------
531 Purpose:
532 Parameters: <none>
533 Notes:
534 ------------------------------------------------------------------------------*/
536 DO i = 1 TO 2: grd-tot[i] = grd-tot[i] + prp-tot[i]. END.
538 END PROCEDURE.
540 /* _UIB-CODE-BLOCK-END */
541 &ANALYZE-RESUME
544 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-prp-totals Procedure
545 PROCEDURE update-prp-totals :
546 /*------------------------------------------------------------------------------
547 Purpose:
548 Parameters: <none>
549 Notes:
550 ------------------------------------------------------------------------------*/
552 prp-tot[1] = prp-tot[1] + IF RentalSpace.AreaType = "C" THEN 0.00 ELSE rsp-tot[1].
553 prp-tot[2] = prp-tot[2] + rsp-tot[2].
555 END PROCEDURE.
557 /* _UIB-CODE-BLOCK-END */
558 &ANALYZE-RESUME
561 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE vacant-spaces Procedure
562 PROCEDURE vacant-spaces :
563 /*------------------------------------------------------------------------------
564 Purpose:
565 Parameters: <none>
566 Notes:
567 ------------------------------------------------------------------------------*/
569 RUN get-control-strings.
570 RUN page-header.
572 FOR EACH Property NO-LOCK WHERE Property.Active BY Region:
573 RUN each-property.
574 END.
576 RUN print-grd-totals.
577 RUN page-feed.
579 END PROCEDURE.
581 /* _UIB-CODE-BLOCK-END */
582 &ANALYZE-RESUME