Add blank column, rename column.
[capital-apms-progress.git] / process / report / amtrust-tenant-forecast.p
blob8a84bab578b2a37d33769387aee26027bbb2c49b
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 Report: Amtrust Tenant Forecast report
6 Author: Andrew McMillan
7 Date: 16/9/2002
8 WRMS: See #2531 for specificationa and other details
9 ------------------------------------------------------------------------*/
11 DEF INPUT PARAMETER report-options AS CHAR NO-UNDO.
13 DEF VAR preview AS LOGI NO-UNDO INIT No.
14 DEF VAR show-rebates AS LOGI NO-UNDO INIT No.
15 DEF VAR prop-1 AS INT NO-UNDO.
16 DEF VAR prop-n AS INT NO-UNDO.
17 DEF VAR year-1 AS INT NO-UNDO.
18 DEF VAR year-n AS INT NO-UNDO.
19 DEF VAR selection-style AS CHAR NO-UNDO.
20 DEF VAR allowed-areatypes AS CHAR NO-UNDO INITIAL 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z'.
21 /* But we actually only want to deal with non-carparks */
22 /* allowed-areatypes = 'A,B,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z'. */
23 DEF VAR DEBUG_msg AS LOGICAL INITIAL No NO-UNDO.
25 RUN parse-parameters.
27 DEF VAR user-name AS CHAR NO-UNDO.
28 {inc/username.i "user-name"}
29 DEF VAR timeStamp AS CHAR FORMAT "X(44)" NO-UNDO.
30 timeStamp = STRING( TODAY, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
32 DEF VAR pr-line AS CHAR INIT "" NO-UNDO. /* used everywhere to hold print line */
34 DEF VAR title-font AS CHAR NO-UNDO INITIAL "font-family: sans-serif; font-weight: 700; font-size: 14pt".
35 DEF VAR time-font AS CHAR NO-UNDO INITIAL "font-family: tahoma,sans-serif; font-size: 8pt;".
36 DEF VAR break1-font AS CHAR NO-UNDO INITIAL "font-family: serif; font-size: 14pt; font-weight: 700;".
37 DEF VAR break2-font AS CHAR NO-UNDO INITIAL "font-family: serif; font-size: 11pt; font-weight: 700;".
38 DEF VAR base-font AS CHAR NO-UNDO INITIAL "font-family: serif; font-size: 10pt;".
40 DEF VAR month-1 AS INT NO-UNDO.
41 DEF VAR month-n AS INT NO-UNDO.
42 FIND FIRST Month WHERE Month.FinancialYearCode = year-1 NO-LOCK.
43 month-1 = Month.MonthCode.
45 FIND LAST Month WHERE Month.FinancialYearCode = year-n NO-LOCK.
46 month-n = Month.MonthCode.
49 {inc/ofc-this.i}
51 /* General global variables */
52 DEF VAR page-header AS CHAR NO-UNDO. /* A header for the top of each page */
53 DEF VAR columns-header AS CHAR NO-UNDO. /* A header for the columns of figures */
54 DEF VAR property-header AS CHAR NO-UNDO. /* A header identifying the property */
55 DEF VAR non-rec AS CHAR NO-UNDO. /* A footer with the non-recoverable details */
56 DEF VAR non-rec1 AS CHAR NO-UNDO. /* A footer with the non-recoverable details */
57 DEF VAR non-rec2 AS CHAR NO-UNDO. /* A footer with the non-recoverable details */
58 DEF VAR mostcolspan AS CHAR NO-UNDO. /* A colspan= clause to span all the years */
59 DEF VAR yearcolcount AS INT NO-UNDO. /* The number of year columns */
60 DEF VAR yearcolspan AS CHAR NO-UNDO. /* A colspan= clause to span all the years */
61 DEF VAR allcolspan AS CHAR NO-UNDO. /* A colspan= clause to span all columns */
62 DEF VAR first-tenant AS LOGI NO-UNDO INITIAL Yes. /* Indicate the first tenant */
63 DEF VAR vacant-area-code AS INT NO-UNDO INITIAL 999990. /* Code used for vacant area */
64 DEF VAR common-area-code AS INT NO-UNDO INITIAL 999999. /* Code used for common area */
66 DEF VAR lease-carparks AS INT NO-UNDO.
67 DEF VAR floor-growth-line AS CHAR NO-UNDO.
68 DEF VAR parks-growth-line AS CHAR NO-UNDO.
69 DEF VAR vacancy-assumption-line AS CHAR NO-UNDO.
72 /* Temp Table for the forecast non-recoverables */
73 DEFINE TEMP-TABLE fctmp NO-UNDO
74 FIELD PropertyCode AS INT
75 FIELD AccountCode AS DEC
76 FIELD YearCode AS INT
77 FIELD AccountName AS CHAR
78 FIELD Expenses AS DEC
79 FIELD Recoveries AS DEC
80 INDEX fc-temp-index IS PRIMARY
81 PropertyCode ASC AccountCode ASC YearCode ASC .
83 /* Temp Table for the forecast rentals */
84 DEFINE TEMP-TABLE fcrent NO-UNDO
85 FIELD PropertyCode AS INT
86 FIELD TenantCode AS INT
87 FIELD YearCode AS INT
88 FIELD BaseRent AS DEC
89 FIELD NewLeases AS DEC
90 FIELD BaseGrowth AS DEC
91 FIELD NewGrowth AS DEC
92 FIELD AgentsFees AS DEC
93 FIELD Refurbs AS DEC
94 FIELD VacantMonths AS INT
95 FIELD NetOfficeRate AS DEC
96 FIELD NetParksRate AS DEC
97 INDEX fc-rent-index IS PRIMARY
98 PropertyCode ASC TenantCode ASC YearCode ASC .
100 /* Temp Table for the forecast rentalspace details */
101 DEFINE TEMP-TABLE fcrsp NO-UNDO
102 FIELD PropertyCode AS INT
103 FIELD TenantCode AS INT
104 FIELD RentalspaceCode AS INT
105 FIELD AreaType AS CHAR
106 FIELD AreaSize AS DEC
107 FIELD SpaceDetails AS CHAR
108 INDEX fc-rsp-index IS PRIMARY PropertyCode ASC RentalspaceCode ASC .
110 /* _UIB-CODE-BLOCK-END */
111 &ANALYZE-RESUME
114 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
116 /* ******************** Preprocessor Definitions ******************** */
118 &Scoped-define PROCEDURE-TYPE Procedure
119 &Scoped-define DB-AWARE no
123 /* _UIB-PREPROCESSOR-BLOCK-END */
124 &ANALYZE-RESUME
127 /* ************************ Function Prototypes ********************** */
129 &IF DEFINED(EXCLUDE-get-best-parameter) = 0 &THEN
131 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-best-parameter Procedure
132 FUNCTION get-best-parameter RETURNS CHARACTER
133 ( INPUT param-name AS CHAR, INPUT year-no AS INT ) FORWARD.
135 /* _UIB-CODE-BLOCK-END */
136 &ANALYZE-RESUME
138 &ENDIF
140 &IF DEFINED(EXCLUDE-is-floor-space) = 0 &THEN
142 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD is-floor-space Procedure
143 FUNCTION is-floor-space RETURNS CHAR
144 ( INPUT type AS CHAR, INPUT area AS DECIMAL ) FORWARD.
146 /* _UIB-CODE-BLOCK-END */
147 &ANALYZE-RESUME
149 &ENDIF
152 /* *********************** Procedure Settings ************************ */
154 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
155 /* Settings for THIS-PROCEDURE
156 Type: Procedure
157 Allow:
158 Frames: 0
159 Add Fields to: Neither
160 Other Settings: CODE-ONLY COMPILE
162 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
164 /* ************************* Create Window ************************** */
166 &ANALYZE-SUSPEND _CREATE-WINDOW
167 /* DESIGN Window definition (used by the UIB)
168 CREATE WINDOW Procedure ASSIGN
169 HEIGHT = 28.25
170 WIDTH = 36.29.
171 /* END WINDOW DEFINITION */
173 &ANALYZE-RESUME
175 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
176 /* ************************* Included-Libraries *********************** */
178 {inc/method/m-txtrep.i}
179 {inc/null.i}
180 {inc/entity.i}
182 /* _UIB-CODE-BLOCK-END */
183 &ANALYZE-RESUME
189 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
192 /* *************************** Main Block *************************** */
194 /* Re-initialise with a more appropriate suffix for HTML files */
195 txtrep-file-suffix = ".html".
196 RUN txtrep-initialise.
198 OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES PAGE-SIZE 0.
200 RUN htmlrep-start('Tenant Forecast Report').
202 RUN report-headers.
204 FOR EACH Property WHERE Property.PropertyCode >= prop-1
205 AND Property.PropertyCode <= prop-n
206 NO-LOCK:
207 RUN each-property.
208 END.
210 IF first-tenant THEN DO:
211 /* We did nothing - say something so people don't think it's broken! */
212 PUT UNFORMATTED page-header.
213 PUT UNFORMATTED "<h1>No Tenant Forecast Data Found!</h1>".
214 END.
216 RUN report-footers.
218 OUTPUT CLOSE.
220 RUN htmlrep-finish.
222 /* _UIB-CODE-BLOCK-END */
223 &ANALYZE-RESUME
226 /* ********************** Internal Procedures *********************** */
228 &IF DEFINED(EXCLUDE-build-assumptions) = 0 &THEN
230 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE build-assumptions Procedure
231 PROCEDURE build-assumptions :
232 /*------------------------------------------------------------------------------
233 Purpose: Build static strings containing the assumptions for display
234 ------------------------------------------------------------------------------*/
235 DEF VAR growth-rate AS DEC NO-UNDO.
236 DEF VAR carpark-growth AS DEC NO-UNDO.
237 DEF VAR floor-rate AS DEC NO-UNDO.
238 DEF VAR parks-rate AS DEC NO-UNDO.
239 DEF VAR vacancy-months AS CHAR NO-UNDO.
241 growth-rate = DECIMAL( get-best-parameter( "Rental-Growth", year-1 ) ).
242 carpark-growth = DECIMAL( get-best-parameter( "Carpark-Growth", year-1 ) ).
243 floor-rate = Property.MarketRental.
244 parks-rate = Property.MarketCarpark.
247 floor-growth-line = "<tr>~n<td class=nonrec>Growth Rate " + STRING( growth-rate, "->,>>9.99" ) + "%</td>~n".
248 parks-growth-line = "<tr>~n<td class=nonrec>Growth Rate " + STRING( carpark-growth, "->,>>9.99" ) + "%</td>~n".
249 vacancy-assumption-line = "<tr>~n<td class=nonrec>Vacancy assumption</td>~n".
251 FOR EACH FinancialYear WHERE FinancialYear.FinancialYearCode >= year-1 AND FinancialYear.FinancialYearCode <= year-n NO-LOCK:
252 floor-growth-line = floor-growth-line + "<td align=right class=nonrec> " + STRING( floor-rate, "->>>,>>9.99" ) + "&nbsp;</td>~n".
253 floor-rate = floor-rate * ( 1 + DECIMAL( get-best-parameter( "Rental-Growth", FinancialYear.FinancialYearCode ) ) / 100).
255 parks-growth-line = parks-growth-line + "<td align=right class=nonrec> " + STRING( parks-rate, "->>>,>>9.99" ) + "&nbsp;</td>~n".
256 parks-rate = parks-rate * ( 1 + DECIMAL( get-best-parameter( "Carpark-Growth", FinancialYear.FinancialYearCode ) ) / 100).
258 vacancy-months = get-best-parameter( "Vacant-Months", FinancialYear.FinancialYearCode ).
259 vacancy-assumption-line = vacancy-assumption-line + "<td align=right class=nonrec> " + vacancy-months + "&nbsp;</td>~n".
260 END.
262 floor-growth-line = floor-growth-line + "</tr>~n".
263 parks-growth-line = parks-growth-line + "</tr>~n".
264 vacancy-assumption-line = vacancy-assumption-line + "</tr>~n".
266 END PROCEDURE.
268 /* _UIB-CODE-BLOCK-END */
269 &ANALYZE-RESUME
271 &ENDIF
273 &IF DEFINED(EXCLUDE-build-non-recoverables) = 0 &THEN
275 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE build-non-recoverables Procedure
276 PROCEDURE build-non-recoverables :
277 /*------------------------------------------------------------------------------
278 Purpose: Build the non-recoverables information for this property
279 ------------------------------------------------------------------------------*/
280 DEF VAR fexp AS DEC NO-UNDO.
281 DEF VAR frec AS DEC NO-UNDO.
282 DEF VAR facc AS DEC NO-UNDO.
283 DEF VAR account-name AS CHAR NO-UNDO.
284 DEF VAR row0 AS LOGI NO-UNDO INITIAL Yes.
285 DEF VAR cellclass AS CHAR NO-UNDO INITIAL "".
287 /* Add this propety into our temp table of non-recoverable stuff */
288 /* PUT UNFORMATTED "<p>Calculating non-recoverable expenses</p>". */
289 FOR EACH PropForecast OF Property NO-LOCK:
290 fexp = 0.
291 frec = 0.
292 facc = INT(PropForecast.AccountCode).
293 CASE PropForecastType:
294 WHEN "EXP" THEN fexp = PropForecast.Amount.
296 WHEN "RCBS" THEN frec = PropForecast.Amount.
297 WHEN "RCNW" THEN frec = PropForecast.Amount.
299 WHEN "BASE" THEN NEXT.
300 WHEN "NEW" THEN NEXT.
301 WHEN "GNEW" THEN NEXT.
302 WHEN "GBAS" THEN NEXT.
303 WHEN "AGNT" THEN NEXT.
305 OTHERWISE DO:
306 PUT UNFORMATTED "<p class=warn>Ignoring forecast type of " + PropForecastType + "</p>~n" .
307 END.
308 END CASE.
309 FIND Month WHERE Month.MonthCode = PropForecast.MonthCode NO-LOCK.
310 IF Month.FinancialYearCode < year-1 OR Month.FinancialYearCode > year-n THEN NEXT.
312 FIND FIRST fctmp WHERE fctmp.PropertyCode = Property.PropertyCode
313 AND fctmp.AccountCode = facc
314 AND fctmp.YearCode = Month.FinancialYearCode NO-ERROR.
315 IF AVAILABLE(fctmp) THEN DO:
316 fctmp.Expenses = fctmp.Expenses + fexp.
317 fctmp.Recoveries = fctmp.Recoveries + frec.
318 END.
319 ELSE DO:
320 FIND ChartOfAccount WHERE ChartOfAccount.AccountCode = facc NO-LOCK NO-ERROR.
321 account-name = STRING( facc, "9999.99") + " "
322 + SUBSTR( (IF AVAILABLE(ChartOfAccount) THEN ChartOfAccount.Name ELSE "Account not on file"), 1, 30 ).
323 FOR EACH FinancialYear WHERE FinancialYear.FinancialYearCode >= year-1 AND FinancialYear.FinancialYearCode <= year-n NO-LOCK:
324 CREATE fctmp.
325 fctmp.PropertyCode = Property.PropertyCode.
326 fctmp.AccountCode = facc .
327 fctmp.YearCode = FinancialYear.FinancialYearCode.
328 fctmp.AccountName = account-name.
329 IF FinancialYear.FinancialYearCode = Month.FinancialYearCode THEN DO:
330 fctmp.Expenses = fexp.
331 fctmp.Recoveries = frec.
332 END.
333 ELSE DO:
334 fctmp.Expenses = 0.
335 fctmp.Recoveries = 0.
336 END.
337 END.
338 END.
339 END.
341 /* Build HTML string of non-recoverable expenses */
342 /* PUT UNFORMATTED "<p>Building non-recoverable expenses HTML</p>". */
343 /* * * * WARNING * * * * - DIRTY ROTTEN HACK APPROACHING * * * * */
344 /* Progress (at least as of 9.1A cannot handle long strings, and */
345 /* this one is a doozy. For the moment we split it into two strings */
346 /* if it exceeds 20000 bytes... */
347 non-rec = "".
348 non-rec1 = "".
349 non-rec2 = "".
350 FOR EACH fctmp OF Property GROUP BY fctmp.AccountCode:
351 IF LENGTH(non-rec) > 20000 THEN DO:
352 non-rec1 = non-rec.
353 non-rec = "".
354 END.
355 IF FIRST-OF( fctmp.AccountCode ) THEN DO:
356 cellclass = " class=row" + (IF row0 THEN "0" ELSE "1").
357 non-rec = non-rec + "<tr" + cellclass
358 + ">~n <td" + cellclass + ">" + fctmp.AccountName + "</td>~n" .
359 END.
360 IF DEBUG_msg THEN DO:
361 PUT UNFORMATTED "*** Debug *** non-rec: " fctmp.AccountCode " " fctmp.AccountName "<br>".
362 END.
365 non-rec = non-rec + " <td align=right" + cellclass + ">" + STRING(fctmp.Expenses + fctmp.Recoveries, "->>>,>>>,>>9") + "&nbsp;</td>~n".
366 IF LAST-OF( fctmp.AccountCode ) THEN DO:
367 non-rec = non-rec + "</tr>~n".
368 row0 = NOT( row0 ).
369 END.
370 END.
373 END PROCEDURE.
375 /* _UIB-CODE-BLOCK-END */
376 &ANALYZE-RESUME
378 &ENDIF
380 &IF DEFINED(EXCLUDE-build-rentals) = 0 &THEN
382 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE build-rentals Procedure
383 PROCEDURE build-rentals :
384 /*------------------------------------------------------------------------------
385 Purpose: Build the rentals information for this property
386 ------------------------------------------------------------------------------*/
387 DEF VAR tenant-code AS INT NO-UNDO.
389 /* Add this propety into our temp table of rental stuff */
390 FOR EACH PropForecast OF Property WHERE NOT CAN-DO("EXP,RCBS,RCNW", PropForecastType ) NO-LOCK:
392 FIND Month WHERE Month.MonthCode = PropForecast.MonthCode NO-LOCK.
393 IF Month.FinancialYearCode < year-1 OR Month.FinancialYearCode > year-n THEN NEXT.
395 IF PropForecast.EntityType = "R" THEN DO:
396 FIND FIRST RentalSpace WHERE RentalSpace.PropertyCode = PropForecast.PropertyCode
397 AND RentalSpace.RentalSpaceCode = PropForecast.EntityCode
398 NO-LOCK NO-ERROR.
399 IF NOT AVAILABLE RentalSpace THEN DO:
400 PUT UNFORMATTED ".".
401 END.
402 ELSE DO:
403 IF RentalSpace.AreaStatus = "V" THEN tenant-code = vacant-area-code.
404 ELSE IF RentalSpace.AreaStatus = "C" THEN tenant-code = common-area-code.
405 ELSE DO:
406 FIND TenancyLease OF RentalSpace NO-LOCK.
407 tenant-code = TenancyLease.TenantCode .
408 END.
409 END.
410 END.
411 ELSE IF PropForecast.EntityType = "T" THEN DO:
412 tenant-code = PropForecast.EntityCode .
413 END.
414 ELSE DO:
415 tenant-code = 0.
416 PUT UNFORMATTED "<p class=warn>Cannot find tenant code for forecast entitytype "
417 PropForecast.EntityType
418 " for forecast type of "
419 PropForecastType .
420 END.
422 FIND FIRST fcrent WHERE fcrent.PropertyCode = Property.PropertyCode
423 AND fcrent.TenantCode = tenant-code
424 AND fcrent.YearCode = Month.FinancialYearCode NO-ERROR.
425 IF NOT AVAILABLE(fcrent) THEN DO:
427 FOR EACH FinancialYear WHERE FinancialYear.FinancialYearCode >= year-1 AND FinancialYear.FinancialYearCode <= year-n NO-LOCK:
428 CREATE fcrent.
429 fcrent.PropertyCode = Property.PropertyCode.
430 fcrent.tenantCode = tenant-code.
431 fcrent.YearCode = FinancialYear.FinancialYearCode.
432 END.
433 FIND FIRST fcrent WHERE fcrent.PropertyCode = Property.PropertyCode
434 AND fcrent.TenantCode = tenant-code
435 AND fcrent.YearCode = Month.FinancialYearCode NO-ERROR.
436 IF NOT AVAILABLE(fcrent) THEN DO:
437 PUT UNFORMATTED "<p class=warn>Financial year not set up for " Month.FinancialYearCode.
438 END.
439 END.
441 CASE PropForecastType:
442 WHEN "BASE" THEN fcrent.BaseRent = fcrent.BaseRent + PropForecast.Amount .
443 WHEN "NEW" THEN fcrent.NewLeases = fcrent.NewLeases + PropForecast.Amount .
444 WHEN "GNEW" THEN fcrent.NewGrowth = fcrent.NewGrowth + PropForecast.Amount .
445 WHEN "GBAS" THEN fcrent.BaseGrowth = fcrent.BaseGrowth + PropForecast.Amount .
446 WHEN "AGNT" THEN fcrent.AgentsFees = fcrent.AgentsFees + PropForecast.Amount .
448 OTHERWISE DO:
449 PUT UNFORMATTED "<p class=warn>Ignoring forecast type of " + PropForecastType + "</p>~n" .
450 END.
451 END CASE.
452 END.
455 END PROCEDURE.
457 /* _UIB-CODE-BLOCK-END */
458 &ANALYZE-RESUME
460 &ENDIF
462 &IF DEFINED(EXCLUDE-carpark-tenants) = 0 &THEN
464 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE carpark-tenants Procedure
465 PROCEDURE carpark-tenants :
466 /*------------------------------------------------------------------------------
467 Purpose:
468 ------------------------------------------------------------------------------*/
469 DEF VAR line-break AS CHAR NO-UNDO. line-break ="<tr class=nonrec><td class=nonrec" + allcolspan + ">&nbsp;</td>~n".
471 /* Now do our run for each tenant of the property that has just parks */
472 FOR EACH Tenant WHERE Tenant.EntityType = 'P' AND Tenant.EntityCode = Property.PropertyCode
473 AND CAN-FIND( FIRST fcrent WHERE fcrent.TenantCode = Tenant.TenantCode AND fcrent.PropertyCode = Property.PropertyCode )
474 AND NOT CAN-FIND( FIRST fcrsp WHERE fcrsp.TenantCode = Tenant.TenantCode AND fcrsp.PropertyCode = Property.PropertyCode AND fcrsp.AreaType <> "C" ) :
476 DEF VAR base-rent AS CHAR NO-UNDO INITIAL "".
477 DEF VAR base-growth AS CHAR NO-UNDO INITIAL "".
478 DEF VAR new-leases AS CHAR NO-UNDO INITIAL "".
479 DEF VAR new-growth AS CHAR NO-UNDO INITIAL "".
480 DEF VAR total-rent AS CHAR NO-UNDO INITIAL "".
481 DEF VAR agents-fee AS CHAR NO-UNDO INITIAL "".
483 IF first-tenant THEN
484 first-tenant = No.
485 ELSE
486 PUT UNFORMATTED "<hr>~n". /* Which should cause a page break when printing */
487 PUT UNFORMATTED property-header.
488 PUT UNFORMATTED "<h2>Carpark " + Tenant.Name + " (" + TRIM(STRING(Tenant.TenantCode,">>>>>9")) + ")</h2>~n".
490 FOR EACH TenancyLease OF Tenant WHERE TenancyLease.LeaseStatus <> "PAST" NO-LOCK:
491 PUT UNFORMATTED "<p>Lease for " TenancyLease.AreaDescription
492 (IF TenancyLease.LeaseEndDate = ? OR TenancyLease.LeaseEndDate < TODAY
493 THEN " is monthly"
494 ELSE " expires on " + STRING( TenancyLease.LeaseEndDate, "99/99/9999") )
495 "<br>~n".
497 PUT UNFORMATTED "Lease is "
498 (IF TenancyLease.GrossLease THEN "Gross" ELSE "Net")
499 " recoveries are by " TenancyLease.RecoveryType
500 "</p>~n" .
502 END.
503 PUT UNFORMATTED columns-header.
505 /* Build HTML strings of rental amounts */
506 FOR EACH fcrent OF Property WHERE fcrent.TenantCode = Tenant.TenantCode:
507 base-rent = base-rent + " <td align=right class=nonrec>" + STRING(fcrent.BaseRent, "->>>,>>>,>>9") + "&nbsp;</td>~n".
508 base-growth = base-growth + " <td align=right class=nonrec>" + STRING(fcrent.BaseGrowth, "->>>,>>>,>>9") + "&nbsp;</td>~n".
509 new-leases = new-leases + " <td align=right class=nonrec>" + STRING(fcrent.NewLeases, "->>>,>>>,>>9") + "&nbsp;</td>~n".
510 new-growth = new-growth + " <td align=right class=nonrec>" + STRING(fcrent.NewGrowth, "->>>,>>>,>>9") + "&nbsp;</td>~n".
511 total-rent = total-rent + " <td align=right class=nonrec>" + STRING(fcrent.BaseRent + fcrent.BaseGrowth + fcrent.NewLeases + fcrent.NewGrowth, "->>>,>>>,>>9") + "&nbsp;</td>~n".
512 agents-fee = agents-fee + " <td align=right class=nonrec>" + STRING(fcrent.AgentsFees, "->>>,>>>,>>9") + "&nbsp;</td>~n".
513 END.
516 PUT UNFORMATTED "<tr class=nonrec>~n <td class=nonrec>Base Rent</td>~n" + base-rent + "</tr>~n".
517 PUT UNFORMATTED "<tr class=nonrec>~n <td class=nonrec>Growth on Base Rent</td>~n" + base-growth + "</tr>~n".
518 PUT UNFORMATTED "<tr class=nonrec>~n <td class=nonrec>New Leases</td>~n" + new-leases + "</tr>~n".
519 PUT UNFORMATTED "<tr class=nonrec>~n <td class=nonrec>Growth on New Leases</td>~n" + new-growth + "</tr>~n".
520 PUT UNFORMATTED line-break.
521 PUT UNFORMATTED "<tr class=nonrec>~n <td class=nonrec>Total</td>~n" + total-rent + "</tr>~n".
522 PUT UNFORMATTED line-break.
523 PUT UNFORMATTED "<tr class=nonrec>~n <td class=nonrec>Agents Fees</td>~n" + agents-fee + "</tr>~n".
524 PUT UNFORMATTED line-break.
526 PUT UNFORMATTED "<tr class=nonrec>~n"
527 " <td class=nonrec>Average carpark rate</td>~n"
528 " <td align=right class=nonrec>" STRING( Property.MarketCarpark, "->>>,>>9.99" ) " &nbsp;</td>~n"
529 " <td" mostcolspan ">&nbsp;</td>~n"
530 "</tr>~n"
531 "<tr class=nonrec valign=top>~n"
532 " <td class=nonrec>by Tenant Space mult.</td>~n"
533 " <td class=nonrec" yearcolspan ">~n"
534 "<table>~n"
535 "<tr class=nonrec>~n"
536 "<th align=right class=nonrec>Net effective</td>~n"
537 "<th class=nonrec>&nbsp;Mult.&nbsp;</td>~n"
538 "<th class=nonrec>&nbsp;Level&nbsp;</td>~n"
539 "<th class=nonrec>Description</td>~n"
540 "<th align=right class=nonrec>&nbsp;Area&nbsp;</td>~n"
541 "</tr>~n".
543 FOR EACH fcrsp OF Property WHERE fcrsp.TenantCode = Tenant.TenantCode:
544 PUT UNFORMATTED fcrsp.SpaceDetail .
545 END.
546 PUT UNFORMATTED "</table>~n</td>~n</tr>~n".
547 PUT UNFORMATTED line-break.
548 END.
551 END PROCEDURE.
553 /* _UIB-CODE-BLOCK-END */
554 &ANALYZE-RESUME
556 &ENDIF
558 &IF DEFINED(EXCLUDE-each-property) = 0 &THEN
560 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-property Procedure
561 PROCEDURE each-property :
562 /*------------------------------------------------------------------------------
563 Purpose: Called for each property to be output
564 ------------------------------------------------------------------------------*/
566 /* First, calculate the things that we need for the property */
567 property-header = page-header
568 + "<h3>Property: " + STRING( Property.PropertyCode, ">>>>9" ) + " - "
569 + Property.Name
570 + "</h3>~n".
571 IF DEBUG_msg THEN DO:
572 PUT UNFORMATTED "<p> *** Debug *** Property: " Property.PropertyCode "********</p>".
573 END.
576 RUN build-non-recoverables.
577 IF DEBUG_msg THEN DO:
578 PUT UNFORMATTED "<p> *** Debug *** Built non-recoverables for: " Property.PropertyCode "********</p>".
579 END.
582 RUN build-rentals.
583 IF DEBUG_msg THEN DO:
584 PUT UNFORMATTED "<p> *** Debug *** Built rentals for: " Property.PropertyCode "********</p>".
585 END.
587 RUN build-assumptions.
589 /* Debug */
590 IF DEBUG_msg THEN DO:
591 PUT UNFORMATTED "<p> *** Debug *** Built assumptions for " Property.PropertyCode "********</p>".
592 END.
595 FOR EACH RentalSpace of Property
596 WHERE CAN-DO( allowed-areatypes, RentalSpace.AreaType )
597 NO-LOCK BY RentalSpace.Level BY RentalSpace.LevelSeq:
599 /* Debug */
600 IF DEBUG_msg THEN DO:
601 PUT UNFORMATTED "<p> *** Debug *** RentalSpace: "RentalSpace.RentalSpaceCode "********</p>".
602 END.
604 RUN each-rentalspace.
605 END.
607 /* Debug */
608 IF DEBUG_msg THEN DO:
609 FOR EACH fcrent:
610 PUT UNFORMATTED "<p> *** fcrent *** : " fcrent.TenantCode fcrent.PropertyCode "********</p>".
611 END.
612 END.
615 /* Debug */
616 IF DEBUG_msg THEN DO:
617 FOR EACH fcrsp:
618 PUT UNFORMATTED "<p> *** fcrsp *** : " fcrsp.TenantCode fcrsp.PropertyCode fcrsp.AreaType "********</p>".
619 END.
620 END.
623 /* Now do our run for each tenant of the property that has more than just parks */
624 FOR EACH Tenant WHERE Tenant.EntityType = 'P' AND Tenant.EntityCode = Property.PropertyCode
625 AND CAN-FIND( FIRST fcrent WHERE fcrent.TenantCode = Tenant.TenantCode AND fcrent.PropertyCode = Property.PropertyCode )
626 AND CAN-FIND( FIRST fcrsp WHERE fcrsp.TenantCode = Tenant.TenantCode AND fcrsp.PropertyCode = Property.PropertyCode AND fcrsp.AreaType <> "C" ) :
628 /* Debug */
629 IF DEBUG_msg THEN DO:
630 PUT UNFORMATTED "<p> *** Debug *** Tenant: " tenant.TenantCode "********</p>".
631 END.
633 RUN each-tenant.
634 END.
636 RUN carpark-tenants.
638 END PROCEDURE.
640 /* _UIB-CODE-BLOCK-END */
641 &ANALYZE-RESUME
643 &ENDIF
645 &IF DEFINED(EXCLUDE-each-rentalspace) = 0 &THEN
647 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-rentalspace Procedure
648 PROCEDURE each-rentalspace :
649 /*------------------------------------------------------------------------------
650 Purpose:
651 ------------------------------------------------------------------------------*/
652 DEF VAR tenant-code AS INT NO-UNDO INITIAL 0.
654 IF RentalSpace.AreaStatus = "L" THEN DO:
655 FIND FIRST TenancyLease OF RentalSpace NO-LOCK NO-ERROR.
656 IF AVAILABLE(TenancyLease) THEN DO:
657 FIND FIRST Tenant OF TenancyLease NO-LOCK NO-ERROR.
658 tenant-code = Tenant.TenantCode .
659 END.
660 END.
661 ELSE DO:
662 IF RentalSpace.AreaStatus = "V" THEN tenant-code = vacant-area-code.
663 IF RentalSpace.AreaStatus = "C" THEN tenant-code = common-area-code.
664 END.
666 CREATE fcrsp.
667 fcrsp.PropertyCode = RentalSpace.PropertyCode.
668 fcrsp.TenantCode = tenant-code.
669 fcrsp.RentalSpaceCode = RentalSpace.RentalSpaceCode.
670 fcrsp.AreaType = RentalSpace.AreaType .
671 fcrsp.AreaSize = RentalSpace.AreaSize .
673 fcrsp.SpaceDetails = "<tr class=nonrec>~n"
674 + "<td align=right class=nonrec>" + STRING(RentalSpace.Level) + "/" + STRING(RentalSpace.LevelSeq) + "&nbsp;</td>~n"
675 + "<td class=nonrec>" + RentalSpace.Description + " &nbsp; &nbsp; </td>~n"
676 + "<td align=right class=nonrec>" + TRIM( STRING(RentalSpace.AreaSize, "->>>,>>9.9")) + " &nbsp;</td>~n"
677 + "<td align=right class=nonrec>" + TRIM( STRING(RentalSpace.MarketRental, "->>>,>>>,>>9.99")) + "% &nbsp;</td>~n"
678 + "<td align=right class=nonrec>" + TRIM( STRING( (IF RentalSpace.AreaType = 'C' THEN Property.MarketCarpark ELSE Property.MarketRental ) * RentalSpace.MarketRental / 100.0, "->>>,>>>,>>9.99")) + " &nbsp;</td>~n"
679 + "</tr>~n".
681 END PROCEDURE.
683 /* _UIB-CODE-BLOCK-END */
684 &ANALYZE-RESUME
686 &ENDIF
688 &IF DEFINED(EXCLUDE-each-tenant) = 0 &THEN
690 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-tenant Procedure
691 PROCEDURE each-tenant :
692 /*------------------------------------------------------------------------------
693 Purpose: Run for each tenant
694 ------------------------------------------------------------------------------*/
695 DEF VAR base-rent AS CHAR NO-UNDO INITIAL "".
696 DEF VAR base-growth AS CHAR NO-UNDO INITIAL "".
697 DEF VAR new-leases AS CHAR NO-UNDO INITIAL "".
698 DEF VAR new-growth AS CHAR NO-UNDO INITIAL "".
699 DEF VAR total-rent AS CHAR NO-UNDO INITIAL "".
700 DEF VAR agents-fee AS CHAR NO-UNDO INITIAL "".
701 DEF VAR line-break AS CHAR NO-UNDO. line-break ="<tr class=nonrec><td class=nonrec" + allcolspan + ">&nbsp;</td>~n".
702 DEF VAR refurb-cost-line AS CHAR NO-UNDO INITIAL "".
704 IF first-tenant THEN
705 first-tenant = No.
706 ELSE
707 PUT UNFORMATTED "<hr>~n". /* Which should cause a page break when printing */
708 PUT UNFORMATTED property-header.
709 PUT UNFORMATTED "<h2>" + Tenant.Name + " (" + TRIM(STRING(Tenant.TenantCode,">>>>>9")) + ")</h2>~n".
711 FOR EACH TenancyLease OF Tenant WHERE TenancyLease.LeaseStatus <> "PAST" NO-LOCK:
712 PUT UNFORMATTED "<p>Lease for " TenancyLease.AreaDescription
713 (IF TenancyLease.LeaseEndDate = ? OR TenancyLease.LeaseEndDate < TODAY
714 THEN " is monthly"
715 ELSE " expires on " + STRING( TenancyLease.LeaseEndDate, "99/99/9999") )
716 "<br>~n".
718 PUT UNFORMATTED "Lease is "
719 (IF TenancyLease.GrossLease THEN "Gross" ELSE "Net")
720 /* " recoveries are by " TenancyLease.RecoveryType */
721 "<br>~n" .
723 PUT UNFORMATTED "Changes to [ Net / Gross ] on ___ / ___ / ___ "
724 "</p>~n" .
726 PUT UNFORMATTED "Lettable area changes [ Yes / No ] on ___ / ___ / ___ "
727 "</p>~n" .
729 IF TenancyLease.LeaseEndDate >= TODAY THEN DO:
730 refurb-cost-line = "<tr class=nonrec>~n"
731 + " <td class=nonrec>Refurb cost _________________ in " + STRING( YEAR(TenancyLease.LeaseEndDate), "9999") + " &nbsp;</td>~n"
732 + " <td" + yearcolspan + ">&nbsp;</td>~n"
733 + "</tr>~n" + line-break.
734 END.
736 END.
737 PUT UNFORMATTED columns-header.
739 /* Build HTML strings of rental amounts */
740 FOR EACH fcrent OF Property WHERE fcrent.TenantCode = Tenant.TenantCode:
741 base-rent = base-rent + " <td align=right class=nonrec>" + STRING(fcrent.BaseRent, "->>>,>>>,>>9") + "&nbsp;</td>~n".
742 base-growth = base-growth + " <td align=right class=nonrec>" + STRING(fcrent.BaseGrowth, "->>>,>>>,>>9") + "&nbsp;</td>~n".
743 new-leases = new-leases + " <td align=right class=nonrec>" + STRING(fcrent.NewLeases, "->>>,>>>,>>9") + "&nbsp;</td>~n".
744 new-growth = new-growth + " <td align=right class=nonrec>" + STRING(fcrent.NewGrowth, "->>>,>>>,>>9") + "&nbsp;</td>~n".
745 total-rent = total-rent + " <td align=right class=nonrec>" + STRING(fcrent.BaseRent + fcrent.BaseGrowth + fcrent.NewLeases + fcrent.NewGrowth, "->>>,>>>,>>9") + "&nbsp;</td>~n".
746 agents-fee = agents-fee + " <td align=right class=nonrec>" + STRING(fcrent.AgentsFees, "->>>,>>>,>>9") + "&nbsp;</td>~n".
747 END.
750 PUT UNFORMATTED "<tr class=nonrec>~n <td class=nonrec>Base Rent</td>~n" + base-rent + "</tr>~n".
751 PUT UNFORMATTED "<tr class=nonrec>~n <td class=nonrec>Growth on Base Rent</td>~n" + base-growth + "</tr>~n".
752 PUT UNFORMATTED "<tr class=nonrec>~n <td class=nonrec>New Leases</td>~n" + new-leases + "</tr>~n".
753 PUT UNFORMATTED "<tr class=nonrec>~n <td class=nonrec>Growth on New Leases</td>~n" + new-growth + "</tr>~n".
754 PUT UNFORMATTED line-break.
755 PUT UNFORMATTED "<tr class=nonrec>~n <td class=nonrec>Total</td>~n" + total-rent + "</tr>~n".
756 PUT UNFORMATTED line-break.
757 PUT UNFORMATTED "<tr class=nonrec>~n <td class=nonrec>Agents Fees</td>~n" + agents-fee + "</tr>~n".
758 PUT UNFORMATTED line-break.
760 PUT UNFORMATTED "<tr class=nonrec>~n"
761 " <td class=nonrec>Net effective market rental</td>~n"
762 " <td align=right class=nonrec>" STRING( Property.MarketRental, "->>>,>>9.99" ) " &nbsp;</td>~n"
763 " <td" mostcolspan ">&nbsp;</td>~n"
764 "</tr>~n".
766 PUT UNFORMATTED floor-growth-line.
768 PUT UNFORMATTED "<tr class=nonrec valign=top>~n"
769 /* " <td class=nonrec>by Tenant Space mult.</td>~n" */
770 " <td class=nonrec" allcolspan ">~n"
771 "<table>~n".
773 PUT UNFORMATTED "<tr class=nonrec>~n"
774 "<th align=right class=nonrec>Net effective</td>~n"
775 "<th class=nonrec>&nbsp;Mult.&nbsp;</td>~n"
776 "<th class=nonrec>&nbsp;Level&nbsp;</td>~n"
777 "<th class=nonrec>Description</td>~n"
778 "<th align=right class=nonrec>&nbsp;Area&nbsp;</td>~n"
779 "</tr>~n".
782 DEF VAR lease-carparks AS DEC NO-UNDO INITIAL 0.
783 DEF VAR lease-areatotal AS DEC NO-UNDO INITIAL 0.
784 FOR EACH fcrsp OF Property WHERE fcrsp.TenantCode = Tenant.TenantCode:
785 CASE is-floor-space( fcrsp.Areatype, fcrsp.AreaSize ):
786 WHEN 'Yes' THEN lease-areatotal = lease-areatotal + fcrsp.AreaSize .
787 WHEN 'Parks' THEN DO:
788 /* Just count carparks */
789 lease-carparks = lease-carparks + fcrsp.AreaSize .
790 NEXT.
791 END.
792 END CASE.
794 PUT UNFORMATTED fcrsp.SpaceDetail .
795 END.
796 PUT UNFORMATTED "<tr><td colspan=2 class=nonrec>&nbsp;</td><td align=right class=total>&nbsp; "
797 + STRING( lease-areatotal, "->,>>>,>>9.9")
798 + " &nbsp;</td><td colspan=2 class=nonrec>&nbsp;</td></tr>~n".
799 PUT UNFORMATTED "</table>~n</td>~n</tr>~n".
800 PUT UNFORMATTED line-break.
802 PUT UNFORMATTED "<tr class=nonrec>~n"
803 " <td class=nonrec>Net effective carpark rental</td>~n"
804 " <td align=right class=nonrec>" STRING( Property.MarketCarpark, "->,>>9.99" ) " &nbsp;</td>~n"
805 " <td" mostcolspan ">&nbsp;</td>~n"
806 "</tr>~n".
808 PUT UNFORMATTED parks-growth-line.
809 PUT UNFORMATTED "<tr class=nonrec>~n"
810 " <td class=nonrec>No of parks</td>~n"
811 " <td align=right class=nonrec>" STRING( lease-carparks, "->>>,>>9" ) " &nbsp;</td>~n"
812 " <td" mostcolspan ">&nbsp;</td>~n"
813 "</tr>~n".
814 PUT UNFORMATTED line-break.
816 PUT UNFORMATTED vacancy-assumption-line.
817 PUT UNFORMATTED line-break.
818 PUT UNFORMATTED refurb-cost-line.
820 PUT UNFORMATTED "<tr><th align=left" + allcolspan + ">Property Non-Recoverable Expenses</th></tr>~n".
821 PUT UNFORMATTED non-rec1.
822 PUT UNFORMATTED non-rec.
823 PUT UNFORMATTED "</table>~n".
826 END PROCEDURE.
828 /* _UIB-CODE-BLOCK-END */
829 &ANALYZE-RESUME
831 &ENDIF
833 &IF DEFINED(EXCLUDE-lease-block) = 0 &THEN
835 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE lease-block Procedure
836 PROCEDURE lease-block :
837 /*------------------------------------------------------------------------------
838 Purpose: Display the lease-related information for the tenant
839 ------------------------------------------------------------------------------*/
840 PUT UNFORMATTED "<table>~n".
842 PUT UNFORMATTED "<tr>~n".
843 PUT UNFORMATTED "<th>#</th>~n".
844 PUT UNFORMATTED "<th>Type</th>~n".
845 PUT UNFORMATTED "<th>Status</th>~n".
846 PUT UNFORMATTED "<th>Property</th>~n".
847 PUT UNFORMATTED "<th>Level</th>~n".
848 PUT UNFORMATTED "<th>Tenant</th>~n".
849 PUT UNFORMATTED "<th>Problem</th>~n".
850 PUT UNFORMATTED "<th>Received</th>~n".
851 PUT UNFORMATTED "<th>Creditor</th>~n".
852 PUT UNFORMATTED "<th>Action</th>~n".
853 PUT UNFORMATTED "<th>Completed</th>~n".
854 PUT CONTROL "</tr>~n".
856 PUT UNFORMATTED "</table>~n".
858 END PROCEDURE.
860 /* _UIB-CODE-BLOCK-END */
861 &ANALYZE-RESUME
863 &ENDIF
865 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
867 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
868 PROCEDURE parse-parameters :
869 /*------------------------------------------------------------------------------
870 Purpose:
871 ------------------------------------------------------------------------------*/
872 DEF VAR token AS CHAR NO-UNDO.
873 DEF VAR i AS INT NO-UNDO.
875 {inc/showopts.i "report-options"}
877 DO i = 1 TO NUM-ENTRIES( report-options, "~n" ):
878 token = ENTRY( i, report-options, "~n" ).
880 CASE ENTRY( 1, token ):
881 WHEN "Preview" THEN preview = Yes.
882 WHEN "Selection" THEN selection-style = ENTRY(2,token).
883 WHEN "Properties" THEN ASSIGN
884 prop-1 = INT( ENTRY(2,token) )
885 prop-n = INT( ENTRY(3,token) ).
886 WHEN "Years" THEN ASSIGN
887 year-1 = INT( ENTRY(2,token) )
888 year-n = INT( ENTRY(3,token) ).
889 END CASE.
891 END.
893 IF selection-style = "OneProperty" THEN prop-n = prop-1 .
894 ELSE IF selection-style = "All" THEN ASSIGN prop-1 = 0 prop-n = 99999.
896 END PROCEDURE.
898 /* _UIB-CODE-BLOCK-END */
899 &ANALYZE-RESUME
901 &ENDIF
903 &IF DEFINED(EXCLUDE-report-footers) = 0 &THEN
905 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-footers Procedure
906 PROCEDURE report-footers :
907 /*------------------------------------------------------------------------------
908 Purpose:
909 ------------------------------------------------------------------------------*/
910 END PROCEDURE.
912 /* _UIB-CODE-BLOCK-END */
913 &ANALYZE-RESUME
915 &ENDIF
917 &IF DEFINED(EXCLUDE-report-headers) = 0 &THEN
919 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-headers Procedure
920 PROCEDURE report-headers :
921 /*------------------------------------------------------------------------------
922 Purpose:
923 ------------------------------------------------------------------------------*/
925 /* Do a style sheet */
926 PUT UNFORMATTED "<style><!-- ~n".
927 PUT UNFORMATTED htmlrep-style( "body", "background: #ffffff; color: #000000;" ).
928 PUT UNFORMATTED htmlrep-style( "p, td", "font: 12px tahoma, sans-serif;" ).
929 PUT UNFORMATTED htmlrep-style( "th", "font: bold 12px tahoma, sans-serif; color: #000000;" ).
930 PUT UNFORMATTED htmlrep-style( ".row0", "padding: 0; margin: 0; background: #ffffff; color: #333333;" ).
931 PUT UNFORMATTED htmlrep-style( ".row1", "padding: 0; margin: 0; background: #f0ece8; color: #333333;" ).
932 PUT UNFORMATTED htmlrep-style( ".nonrec", "padding: 0; margin: 0; line-height: 12px;" ).
933 PUT UNFORMATTED htmlrep-style( ".total", "padding: 2px 0 0 0; border-top: thin double black ; margin: 0; line-height: 13px; font: bold 12px tahoma, sans-serif; " ).
934 PUT UNFORMATTED htmlrep-style( ".newpage", "page-break-before: always;" ).
935 PUT UNFORMATTED htmlrep-style( "h1, .h1", "padding: 0; margin: 0; font: normal 13px tahoma, sans-serif; color: #000044;" ).
936 PUT UNFORMATTED htmlrep-style( "h2, .h2", "font: bold 16px/17px verdana, arial, sans-serif; color: #000044;" ).
937 PUT UNFORMATTED htmlrep-style( "h3, .h3", "padding: 0; margin: 0; font: normal 12px tahoma, sans-serif; color: #000044;" ).
938 PUT UNFORMATTED htmlrep-style( "hr", "page-break-after: always;").
939 PUT UNFORMATTED htmlrep-style( "@media print", htmlrep-style( "hr", "page-break-after: always;") ).
940 PUT UNFORMATTED "--></style> ~n".
942 /* Finish head & start body */
943 RUN htmlrep-body.
945 page-header = "<h1 align=center>Tenant Forecast Report "
946 + (IF selection-style = 'All' THEN "for all properties" ELSE "")
947 + "</h1>~n".
949 DEF VAR yearcols AS INT NO-UNDO INITIAL 0.
950 columns-header = "<table>~n<tr>~n <th>Rentals</th>~n".
951 FOR EACH FinancialYear WHERE FinancialYearCode >= year-1 AND FinancialYearCode <= year-n NO-LOCK:
952 columns-header = columns-header + " <th>" + STRING(FinancialYear.FinancialYearCode) + "</th>~n".
953 yearcols = yearcols + 1.
954 END.
955 columns-header = columns-header + "</tr>~n".
957 yearcolspan = " colspan=" + TRIM( STRING(yearcols, ">>9")).
958 allcolspan = " colspan=" + TRIM( STRING(yearcols + 1, ">>9")).
959 mostcolspan = " colspan=" + TRIM( STRING(yearcols - 1, ">>9")).
961 END PROCEDURE.
963 /* _UIB-CODE-BLOCK-END */
964 &ANALYZE-RESUME
966 &ENDIF
968 /* ************************ Function Implementations ***************** */
970 &IF DEFINED(EXCLUDE-get-best-parameter) = 0 &THEN
972 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-best-parameter Procedure
973 FUNCTION get-best-parameter RETURNS CHARACTER
974 ( INPUT param-name AS CHAR, INPUT year-no AS INT ) :
975 /*------------------------------------------------------------------------------
976 Purpose: Return the most appropriate value for the named parameter
977 Notes:
978 ------------------------------------------------------------------------------*/
979 DEF VAR param-value AS CHAR NO-UNDO.
981 FIND FIRST Month WHERE FinancialYearCode = year-no NO-LOCK.
982 FIND FIRST PropForecastParam OF Property WHERE PropForecastParam.MonthCode >= Month.MonthCode
983 AND ParameterID = param-name NO-LOCK NO-ERROR.
984 IF NOT AVAILABLE(PropForecastParam) THEN DO:
985 FIND LAST PropForecastParam OF Property WHERE PropForecastParam.MonthCode < Month.MonthCode
986 AND ParameterID = param-name NO-LOCK NO-ERROR.
987 END.
988 IF NOT AVAILABLE(PropForecastParam) THEN DO:
989 RETURN "".
990 END.
992 param-value = ParameterValue.
993 IF ( param-value MATCHES '*%*' ) THEN DO:
994 param-value = ENTRY( 1, param-value, '%' ).
995 END.
997 RETURN param-value.
999 END FUNCTION.
1001 /* _UIB-CODE-BLOCK-END */
1002 &ANALYZE-RESUME
1004 &ENDIF
1006 &IF DEFINED(EXCLUDE-is-floor-space) = 0 &THEN
1008 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION is-floor-space Procedure
1009 FUNCTION is-floor-space RETURNS CHAR
1010 ( INPUT type AS CHAR, INPUT area AS DECIMAL ) :
1012 * Decide if we have a floor area, a carpark or something else...
1014 DEF BUFFER LocAreaType FOR AreaType.
1016 IF area = ? THEN RETURN "No".
1017 FIND LocAreaType WHERE LocAreaType.AreaType = type NO-LOCK NO-ERROR.
1018 IF AVAILABLE(LocAreaType) THEN DO:
1019 IF LocAreaType.IsCarPark THEN RETURN "Park".
1020 IF LocAreaType.IsFloorArea THEN RETURN "Yes".
1021 RETURN "No".
1022 END.
1024 CASE type:
1025 WHEN "C" THEN RETURN "Park".
1026 WHEN "O" THEN RETURN "Yes".
1027 WHEN "R" THEN RETURN "Yes".
1028 WHEN "W" THEN RETURN "Yes".
1029 WHEN "N" THEN RETURN "No".
1030 OTHERWISE
1031 IF area > 20 OR (area <> INTEGER(area)) THEN RETURN "Yes".
1032 END CASE.
1034 RETURN "No".
1036 END FUNCTION.
1038 /* _UIB-CODE-BLOCK-END */
1039 &ANALYZE-RESUME
1041 &ENDIF