1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 AmTrust Rental Forecasting Run
6 ------------------------------------------------------------------------*/
7 &SCOPED-DEFINE REPORT-ID "Amtrust Rental Run"
9 DEF INPUT PARAMETER report-options
AS CHAR NO-UNDO.
11 DEF VAR all-ratchets
AS LOGI
NO-UNDO INIT No.
12 DEF VAR clear-all
AS LOGI
NO-UNDO INIT No.
13 DEF VAR preview
AS LOGI
NO-UNDO INIT No.
14 DEF VAR audit-report
AS LOGI
NO-UNDO INIT No.
15 DEF VAR rent-report
AS LOGI
NO-UNDO INIT No.
16 DEF VAR skip-agents-fees
AS LOGI
NO-UNDO INIT No.
17 DEF VAR regenerate
AS LOGI
NO-UNDO INIT Yes.
18 DEF VAR regenerate-rents
AS LOGI
NO-UNDO INIT No.
19 DEF VAR regenerate-expenses
AS LOGI
NO-UNDO INIT No.
20 DEF VAR regenerate-recoveries
AS LOGI
NO-UNDO INIT No.
21 DEF VAR property-1
AS INT NO-UNDO INIT ?.
22 DEF VAR property-n
AS INT NO-UNDO INIT ?.
23 DEF VAR month-1
AS INT NO-UNDO INIT ?.
24 DEF VAR month-n
AS INT NO-UNDO INIT ?.
25 DEF VAR forecast-start
AS DATE NO-UNDO.
26 DEF VAR forecast-end
AS DATE NO-UNDO.
28 IF ERROR-STATUS:ERROR THEN RETURN.
30 DEF VAR time-pos
AS INT NO-UNDO INITIAL 1.
31 DEF VAR timings
AS INT NO-UNDO EXTENT 10 INITIAL 0 .
32 ETIME(Yes
).
/* start the timer
*/
34 DEF VAR in-rent-report
AS LOGI
INITIAL No
NO-UNDO.
35 DEF VAR round-up-after
AS INT NO-UNDO INIT 1.
36 DEF VAR one-twelfth
AS DEC NO-UNDO.
37 one-twelfth
= 1.0 / 12.0 .
39 DEF VAR rr-sequences
AS CHAR NO-UNDO INITIAL "BASE,GBAS,NEW,GNEW,VACT,GVAC,ONE,AGNT".
41 DEF VAR mfmt
AS CHAR NO-UNDO INITIAL "->>>,>>>,>>9.99".
42 DEF VAR pfmt
AS CHAR NO-UNDO INITIAL "->>9.99999".
43 DEF VAR i
AS INT NO-UNDO.
45 DEF VAR user-name
AS CHAR NO-UNDO.
46 {inc
/username.i
"user-name"}
47 DEF VAR timeStamp
AS CHAR FORMAT "X(44)" NO-UNDO.
48 timeStamp
= STRING( TODAY, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
50 DEF VAR base-font
AS CHAR NO-UNDO INITIAL "fixed,courier,cpi,24,lpi,10,normal".
51 DEF VAR header-font
AS CHAR NO-UNDO INITIAL "proportional,helvetica,point,10,lpi,7,bold".
54 {inc
/ofc-set.i
"Default-Forecast-Accounts" "forecast-accounts" "ERROR"}
55 DEF VAR floor-ac
AS DEC NO-UNDO.
56 DEF VAR other-ac
AS DEC NO-UNDO.
57 DEF VAR parks-ac
AS DEC NO-UNDO.
58 floor-ac
= DEC(ENTRY(1,forecast-accounts
)).
59 parks-ac
= DEC(ENTRY(1,forecast-accounts
)).
60 other-ac
= DEC(ENTRY(1,forecast-accounts
)).
62 {inc
/ofc-set.i
"Default-Forecast-Property" "default-forecast-property"}
63 DEF VAR default-property
AS INT NO-UNDO.
64 ASSIGN default-property
= INT( default-forecast-property
) NO-ERROR.
65 {inc
/ofc-set.i
"Default-Forecast-Fixed-OG-Account" "default-fixed-og"}
66 DEF VAR fixed-og-account
AS DEC NO-UNDO.
67 ASSIGN fixed-og-account
= DEC( default-fixed-og
) NO-ERROR.
69 {inc
/ofc-set.i
"Default-Forecast-Recovery-Offset" "default-forecast-rec-offset"}
70 DEF VAR recovery-offset
AS DEC NO-UNDO.
71 ASSIGN recovery-offset
= DEC( default-forecast-rec-offset
) NO-ERROR.
73 {inc
/ofc-set.i
"Default-Forecast-Agents-Fees-Account" "default-agents-fees"}
74 DEF VAR agents-fees-account
AS DEC NO-UNDO.
75 ASSIGN agents-fees-account
= DEC( default-agents-fees
) NO-ERROR.
77 {inc
/ofc-set.i
"Default-Forecast-Agents-Fees-Rate" "default-agents-rate"}
78 DEF VAR agents-fees-rate
AS DEC NO-UNDO.
79 ASSIGN agents-fees-rate
= DEC( default-agents-rate
) NO-ERROR.
80 IF agents-fees-rate
> 1 THEN agents-fees-rate
= agents-fees-rate
/ 100 .
82 DEFINE TEMP-TABLE Action
NO-UNDO
83 FIELD ActionDate
AS DATE
84 FIELD MonthCode
AS INT
85 FIELD TenancyLeaseCode
AS INT
86 FIELD RentalSpaceCode
AS INT
87 FIELD ActionType
AS CHAR
88 FIELD ActionDescription
AS CHAR
89 FIELD ActionFloor
AS DEC
90 FIELD ActionParks
AS DEC
91 FIELD ActionOther
AS DEC
92 FIELD ActionFCFloor
AS DEC
93 FIELD ActionFCParks
AS DEC
94 FIELD ActionFCOther
AS DEC
95 INDEX XPKAction
IS PRIMARY MonthCode ActionType
96 INDEX XAK1Action ActionType MonthCode
97 INDEX XAK2Action TenancyLeaseCode RentalSpaceCode ActionType MonthCode
98 INDEX XAK3Action RentalSpaceCode TenancyLeaseCode ActionType MonthCode .
100 DEF WORK-TABLE Lease
NO-UNDO LIKE TenancyLease.
102 DEF WORK-TABLE Area
NO-UNDO LIKE RentalSpace.
105 DEF TEMP-TABLE growth-month
NO-UNDO LIKE Month
110 DEF TEMP-TABLE rr-line
NO-UNDO
116 FIELD years
AS DEC EXTENT 5
117 INDEX XPKrr-lines
IS UNIQUE PRIMARY pcode et ec lseq
118 INDEX XAK1rr-lines
IS UNIQUE pcode et ec ltype.
120 DEF WORK-TABLE rates
NO-UNDO
121 FIELD b-floor
AS DEC FIELD b-parks
AS DEC FIELD b-other
AS DEC
122 FIELD g-floor
AS DEC FIELD g-parks
AS DEC FIELD g-other
AS DEC
123 FIELD m-floor
AS DEC FIELD m-parks
AS DEC FIELD m-other
AS DEC
124 FIELD lg-floor
AS DEC FIELD lg-parks
AS DEC FIELD lg-other
AS DEC
125 FIELD pro-rate
AS DEC
126 FIELD last-action
AS CHAR
127 FIELD et
AS CHAR FIELD ec
AS INT.
130 /* _UIB-CODE-BLOCK-END
*/
134 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
136 /* ******************** Preprocessor Definitions
******************** */
138 &Scoped-define PROCEDURE-TYPE Procedure
139 &Scoped-define DB-AWARE no
143 /* _UIB-PREPROCESSOR-BLOCK-END
*/
147 /* ************************ Function Prototypes
********************** */
149 &IF DEFINED(EXCLUDE-from-annual) = 0 &THEN
151 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD from-annual Procedure
152 FUNCTION from-annual
RETURNS DECIMAL
153 ( INPUT freq-code
AS CHAR, INPUT annual-amount
AS DEC ) FORWARD.
155 /* _UIB-CODE-BLOCK-END
*/
160 &IF DEFINED(EXCLUDE-get-area-rental) = 0 &THEN
162 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-area-rental Procedure
163 FUNCTION get-area-rental
RETURNS DECIMAL
164 ( /* no parameters
*/ ) FORWARD.
166 /* _UIB-CODE-BLOCK-END
*/
171 &IF DEFINED(EXCLUDE-get-int-parameter) = 0 &THEN
173 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-int-parameter Procedure
174 FUNCTION get-int-parameter
RETURNS INTEGER
175 ( INPUT param-id
AS CHAR, INPUT in-date
AS DATE, INPUT default-no
AS INT ) FORWARD.
177 /* _UIB-CODE-BLOCK-END
*/
182 &IF DEFINED(EXCLUDE-get-lease-recovery) = 0 &THEN
184 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-lease-recovery Procedure
185 FUNCTION get-lease-recovery
RETURNS DECIMAL
186 ( INPUT ac
AS DEC, INPUT lease-ended
AS LOGICAL ) FORWARD.
188 /* _UIB-CODE-BLOCK-END
*/
193 &IF DEFINED(EXCLUDE-get-parameter) = 0 &THEN
195 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-parameter Procedure
196 FUNCTION get-parameter
RETURNS CHARACTER
197 ( INPUT param-id
AS CHAR, INPUT in-date
AS DATE ) FORWARD.
199 /* _UIB-CODE-BLOCK-END
*/
204 &IF DEFINED(EXCLUDE-part-of-period) = 0 &THEN
206 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD part-of-period Procedure
207 FUNCTION part-of-period
RETURNS DECIMAL
208 ( INPUT part-1
AS DATE, INPUT part-n
AS DATE ) FORWARD.
210 /* _UIB-CODE-BLOCK-END
*/
215 &IF DEFINED(EXCLUDE-process-action-end-after) = 0 &THEN
217 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD process-action-end-after Procedure
218 FUNCTION process-action-end-after
RETURNS CHARACTER
219 ( /* no parameters
*/ ) FORWARD.
221 /* _UIB-CODE-BLOCK-END
*/
226 &IF DEFINED(EXCLUDE-process-action-end-before) = 0 &THEN
228 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD process-action-end-before Procedure
229 FUNCTION process-action-end-before
RETURNS CHARACTER
230 ( /* no parameters
*/ ) FORWARD.
232 /* _UIB-CODE-BLOCK-END
*/
237 &IF DEFINED(EXCLUDE-process-action-new) = 0 &THEN
239 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD process-action-new Procedure
240 FUNCTION process-action-new
RETURNS CHARACTER
241 ( /* no parameters
*/ ) FORWARD.
243 /* _UIB-CODE-BLOCK-END
*/
248 &IF DEFINED(EXCLUDE-process-action-old) = 0 &THEN
250 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD process-action-old Procedure
251 FUNCTION process-action-old
RETURNS CHARACTER
252 ( /* no parameters
*/ ) FORWARD.
254 /* _UIB-CODE-BLOCK-END
*/
259 &IF DEFINED(EXCLUDE-process-action-one) = 0 &THEN
261 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD process-action-one Procedure
262 FUNCTION process-action-one
RETURNS CHARACTER
263 ( /* no parameters
*/ ) FORWARD.
265 /* _UIB-CODE-BLOCK-END
*/
270 &IF DEFINED(EXCLUDE-process-action-rvw) = 0 &THEN
272 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD process-action-rvw Procedure
273 FUNCTION process-action-rvw
RETURNS CHARACTER
274 ( /* no parameters
*/ ) FORWARD.
276 /* _UIB-CODE-BLOCK-END
*/
281 &IF DEFINED(EXCLUDE-to-annual) = 0 &THEN
283 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD to-annual Procedure
284 FUNCTION to-annual
RETURNS DECIMAL
285 ( INPUT freq-code
AS CHAR, INPUT period-amount
AS DEC ) FORWARD.
287 /* _UIB-CODE-BLOCK-END
*/
292 &IF DEFINED(EXCLUDE-to-month-rate) = 0 &THEN
294 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD to-month-rate Procedure
295 FUNCTION to-month-rate
RETURNS DECIMAL
296 ( INPUT raw-percent
AS CHAR ) FORWARD.
298 /* _UIB-CODE-BLOCK-END
*/
304 /* *********************** Procedure Settings
************************ */
306 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
307 /* Settings for
THIS-PROCEDURE
311 Add Fields to
: Neither
312 Other Settings
: CODE-ONLY
COMPILE
314 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
316 /* ************************* Create Window
************************** */
318 &ANALYZE-SUSPEND _CREATE-WINDOW
319 /* DESIGN Window definition
(used by the UIB
)
320 CREATE WINDOW Procedure
ASSIGN
323 /* END WINDOW DEFINITION
*/
327 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
328 /* ************************* Included-Libraries
*********************** */
332 {inc
/method
/m-txtrep.i
}
334 /* _UIB-CODE-BLOCK-END
*/
341 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
344 /* *************************** Main Block
*************************** */
346 RUN pclrep-start
( preview
, "reset,landscape,tm,3,a4,lm,2," + base-font
).
347 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
349 RUN reset-growth-rates.
350 IF regenerate
THEN DO:
351 RUN clear-forecast-data.
353 RUN build-forecast-data.
357 IF rent-report
THEN DO:
362 IF audit-report
THEN DO:
363 DO i
= 1 TO (time-pos
- 1):
364 RUN pclrep-line
( base-font
, "Timing point #" + STRING(i
) + " - " + STRING( DEC(timings
[i
]) / 1000.0, ">>,>>9.999") + "mS").
372 /* _UIB-CODE-BLOCK-END
*/
376 /* ********************** Internal Procedures
*********************** */
378 &IF DEFINED(EXCLUDE-audit-down-by) = 0 &THEN
380 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE audit-down-by Procedure
381 PROCEDURE audit-down-by
:
382 /*------------------------------------------------------------------------------
384 ------------------------------------------------------------------------------*/
385 DEF INPUT PARAMETER lines
AS DEC NO-UNDO.
386 IF audit-report
THEN RUN pclrep-down-by
( lines
).
389 /* _UIB-CODE-BLOCK-END
*/
394 &IF DEFINED(EXCLUDE-audit-line) = 0 &THEN
396 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE audit-line Procedure
397 PROCEDURE audit-line
:
398 /*------------------------------------------------------------------------------
400 ------------------------------------------------------------------------------*/
401 DEF INPUT PARAMETER in-font
AS CHAR NO-UNDO.
402 DEF INPUT PARAMETER line
AS CHAR NO-UNDO.
405 RUN pclrep-line
( in-font
, line
).
409 /* _UIB-CODE-BLOCK-END
*/
414 &IF DEFINED(EXCLUDE-build-forecast-data) = 0 &THEN
416 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE build-forecast-data Procedure
417 PROCEDURE build-forecast-data
:
418 /*------------------------------------------------------------------------------
420 ------------------------------------------------------------------------------*/
421 FOR EACH Property
WHERE Active
AND Property.PropertyCode
>= property-1
422 AND Property.PropertyCode
<= property-n
NO-LOCK:
423 RUN audit-line
( header-font
, "Property " + STRING(Property.PropertyCode
) ).
424 RUN reset-growth-rates.
425 IF regenerate-rents
THEN DO:
426 IF Property.ExternallyManaged
THEN DO:
427 /* Deal with it as if it was vacant
*/
428 FOR EACH RentalSpace
OF Property
NO-LOCK:
429 RUN each-vacant-space.
430 RUN audit-down-by
( 0.2 ).
434 FOR EACH Tenant
WHERE Tenant.EntityType
= "P" AND Tenant.EntityCode
= Property.PropertyCode
435 AND Tenant.Active
NO-LOCK:
436 RUN audit-down-by
( 0.3 ).
439 FOR EACH RentalSpace
OF Property
WHERE RentalSpace.AreaStatus
= "V" NO-LOCK:
440 RUN each-vacant-space.
441 RUN audit-down-by
( 0.2 ).
445 IF regenerate-expenses
THEN DO:
446 FOR EACH CashFlow
WHERE CashFlow.ScenarioCode
= 1
447 AND CashFlow.EntityType
= "P"
448 AND CashFlow.EntityCode
= Property.PropertyCode
NO-LOCK:
450 RUN audit-down-by
( 0.2 ).
453 IF regenerate-recoveries
THEN DO:
454 FOR EACH Tenant
WHERE Tenant.EntityType
= "P" AND Tenant.EntityCode
= Property.PropertyCode
455 AND Tenant.Active
NO-LOCK:
456 RUN audit-down-by
( 0.3 ).
457 RUN each-tenant-recoveries.
459 FOR EACH RentalSpace
OF Property
WHERE RentalSpace.AreaStatus
= "V" NO-LOCK:
460 RUN each-vacant-space-recoveries.
461 RUN audit-down-by
( 0.2 ).
464 RUN audit-down-by
( 0.7 ).
469 /* _UIB-CODE-BLOCK-END
*/
474 &IF DEFINED(EXCLUDE-build-lease-actions) = 0 &THEN
476 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE build-lease-actions Procedure
477 PROCEDURE build-lease-actions
:
478 /*------------------------------------------------------------------------------
480 ------------------------------------------------------------------------------*/
481 DEF VAR vacant-months
AS INT NO-UNDO.
482 DEF VAR review-months
AS INT NO-UNDO.
483 DEF VAR action-date
AS DATE NO-UNDO.
485 FOR EACH Action
: DELETE Action.
END.
487 IF NOT AVAILABLE(TenancyLease
) THEN RETURN.
489 IF NOT( Property.ExternallyManaged
) THEN DO:
490 /* Only do manual overrides for externally managed properties
*/
491 FOR EACH RentReview
OF TenancyLease
WHERE RentReview.DateDue
>= forecast-start
492 AND RentReview.DateDue
< forecast-end
NO-LOCK:
493 RUN make-action
( RentReview.DateDue
, "Rvw", "RentReview").
496 IF Lease.LeaseEndDate
<> ?
AND Lease.LeaseEndDate
< forecast-end
THEN DO:
497 action-date
= Lease.LeaseEndDate.
498 IF action-date
< forecast-start
THEN action-date
= forecast-start
- 1.
499 RUN make-action
( action-date
, "End", "Lease end").
503 FOR EACH PropForecastParam
OF Property
WHERE PropForecastParam.MonthCode
>= month-1
504 AND PropForecastParam.MonthCode
<= month-n
505 AND PropForecastParam.ParameterID
= "Override" NO-LOCK:
506 IF NUM-ENTRIES(PropForecastParam.ParameterValue
) < 9 THEN DO:
507 MESSAGE PropForecastParam.ParameterValue
" - insufficient parameters for override action (RecordType,Code,Date,Old-Type,New-Type,Floor,Parks,Other,Description) are all needed.".
510 IF ENTRY(1,PropForecastParam.ParameterValue
) = "T"
511 AND INT( ENTRY(2,PropForecastParam.ParameterValue
) ) = TenancyLease.TenantCode
THEN
512 RUN override-action
( PropForecastParam.ParameterValue
).
517 /* _UIB-CODE-BLOCK-END
*/
522 &IF DEFINED(EXCLUDE-build-vacant-actions) = 0 &THEN
524 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE build-vacant-actions Procedure
525 PROCEDURE build-vacant-actions
:
526 /*------------------------------------------------------------------------------
528 ------------------------------------------------------------------------------*/
529 DEF VAR vacant-months
AS INT NO-UNDO.
530 DEF VAR review-months
AS INT NO-UNDO.
531 DEF VAR action-date
AS DATE NO-UNDO.
533 FOR EACH Action
: DELETE Action.
END.
535 FIND AreaType
OF RentalSpace
NO-LOCK.
536 /* IF AreaType.IsCarPark
THEN RETURN.
*/
537 IF NOT( Property.ExternallyManaged
) AND NOT( AreaType.IsCarPark
) THEN DO:
538 action-date
= forecast-start.
539 vacant-months
= get-int-parameter
("Vacant-Months", action-date
, 1).
540 action-date
= add-months
( action-date
, vacant-months
).
541 RUN make-action
( action-date
, "New", "Re leasing").
542 review-months
= get-int-parameter
("Review-Months", action-date
, 12).
543 DO WHILE action-date
< forecast-end
:
544 action-date
= add-months
( action-date
, review-months
).
545 IF action-date
< forecast-end
THEN
546 RUN make-action
( action-date
, "Rvw", "Review on new lease").
550 FOR EACH PropForecastParam
OF Property
WHERE PropForecastParam.MonthCode
>= month-1
551 AND PropForecastParam.MonthCode
<= month-n
552 AND PropForecastParam.ParameterID
= "Override" NO-LOCK:
553 IF NUM-ENTRIES(PropForecastParam.ParameterValue
) < 9 THEN DO:
554 MESSAGE PropForecastParam.ParameterValue
" - insufficient parameters for override action (RecordType,Code,Date,Old-Action,New-Action,Floor,Parks,Other,Description) are all needed.".
557 IF ENTRY(1,PropForecastParam.ParameterValue
) = "R"
558 AND INT( ENTRY(2,PropForecastParam.ParameterValue
) ) = RentalSpace.RentalSpaceCode
THEN
559 RUN override-action
( PropForecastParam.ParameterValue
).
564 /* _UIB-CODE-BLOCK-END
*/
569 &IF DEFINED(EXCLUDE-clear-forecast-data) = 0 &THEN
571 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE clear-forecast-data Procedure
572 PROCEDURE clear-forecast-data
:
573 /*------------------------------------------------------------------------------
575 ------------------------------------------------------------------------------*/
576 IF clear-all
THEN DO:
577 FOR EACH PropForecast
EXCLUSIVE-LOCK:
582 DEF VAR regenerate-types
AS CHAR NO-UNDO INITIAL "".
583 IF regenerate-rents
THEN
584 regenerate-types
= "BASE,GBAS,NEW,GNEW,ONE,VACT,GVAC,AGNT".
585 ELSE IF regenerate-expenses
THEN
586 regenerate-types
= "EXP,NREC".
587 ELSE IF regenerate-recoveries
THEN
588 regenerate-types
= "RCBS,RCNW".
590 FOR EACH PropForecast
WHERE PropForecast.PropertyCode
>= property-1
591 AND PropForecast.PropertyCode
<= property-n
EXCLUSIVE-LOCK:
592 IF (regenerate-rents
AND regenerate-expenses
AND regenerate-recoveries
)
593 OR LOOKUP( PropForecast.PropForecastType
, regenerate-types
) > 0 THEN
600 /* _UIB-CODE-BLOCK-END
*/
605 &IF DEFINED(EXCLUDE-dump-action) = 0 &THEN
607 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE dump-action Procedure
608 PROCEDURE dump-action
:
609 /*------------------------------------------------------------------------------
611 ------------------------------------------------------------------------------*/
612 DEF VAR line
AS CHAR NO-UNDO.
614 IF NOT audit-report
THEN RETURN.
615 line
= "Action: " + STRING(Action.ActionDate
) + " "
616 + STRING( Action.MonthCode
, ">>>9")
617 + (IF Action.TenancyLeaseCode
= ?
THEN "" ELSE " Lse" + STRING(Action.TenancyLeaseCode
,"99999") + " ")
618 + (IF Action.RentalSpaceCode
= ?
THEN "" ELSE " Rsp" + STRING(Action.RentalSpaceCode
,"99999") + " ")
619 + STRING( Action.ActionType
, "X(6)")
620 + STRING( Action.ActionDescription
, "X(15)")
621 + STRING( Action.ActionFloor
+ Action.ActionParks
+ Action.ActionOther
, mfmt
)
622 + STRING( Action.ActionFCFloor
+ Action.ActionFCParks
+ Action.ActionFCOther
, mfmt
).
624 RUN audit-line
( base-font
, line
).
628 /* _UIB-CODE-BLOCK-END
*/
633 &IF DEFINED(EXCLUDE-dump-prop-forecast) = 0 &THEN
635 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE dump-prop-forecast Procedure
636 PROCEDURE dump-prop-forecast
:
637 /*------------------------------------------------------------------------------
639 ------------------------------------------------------------------------------*/
640 DEF VAR line
AS CHAR NO-UNDO.
642 IF NOT audit-report
THEN RETURN.
643 line
= STRING( PropForecast.PropertyCode
, "99999") + " "
644 + PropForecast.EntityType
645 + STRING( PropForecast.EntityCode
, "99999") + "/"
646 + STRING( PropForecast.AccountCode
, "9999.99") + " "
647 + STRING( PropForecast.MonthCode
, ">>>>9") + " "
648 + STRING( PropForecast.PropForecastType
, "X(5)")
649 + STRING( PropForecast.Amount
, mfmt
).
650 RUN audit-line
( base-font
, line
).
653 /* _UIB-CODE-BLOCK-END
*/
658 &IF DEFINED(EXCLUDE-dump-rates) = 0 &THEN
660 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE dump-rates Procedure
661 PROCEDURE dump-rates
:
662 /*------------------------------------------------------------------------------
664 ------------------------------------------------------------------------------*/
665 DEF INPUT PARAMETER p-type
AS CHAR NO-UNDO.
667 DEF VAR line
AS CHAR NO-UNDO.
669 IF NOT audit-report
THEN RETURN.
670 line
= " " + STRING(p-type
, "X(5)" )
671 + STRING(growth-month.StartDate
)
672 + STRING(growth-month.MonthCode
, ">>>9")
673 + " " + STRING( growth-month.floor
, pfmt
)
674 + " " + STRING( growth-month.parks
, pfmt
)
675 + " " + STRING( growth-month.other
, pfmt
)
677 + STRING( rates.ec
, "99999") + " - "
678 + STRING( rates.b-floor
+ rates.b-parks
+ rates.b-other
, mfmt
)
679 + STRING( rates.g-floor
+ rates.g-parks
+ rates.g-other
, mfmt
)
680 + STRING( rates.m-floor
+ rates.m-parks
+ rates.m-other
, mfmt
)
681 + STRING( rates.pro-rate
, pfmt
)
682 + " " + rates.last-action .
683 RUN audit-line
( base-font
, line
).
686 /* _UIB-CODE-BLOCK-END
*/
691 &IF DEFINED(EXCLUDE-each-cash-flow) = 0 &THEN
693 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-cash-flow Procedure
694 PROCEDURE each-cash-flow
:
695 /*------------------------------------------------------------------------------
697 ------------------------------------------------------------------------------*/
698 DEF VAR part
AS DEC NO-UNDO.
699 DEF VAR amount
AS DEC NO-UNDO.
700 DEF VAR line
AS CHAR NO-UNDO.
702 RUN audit-line
( header-font
, "CashFlow " + CashFlow.EntityType
+ STRING(CashFlow.EntityCode
,"99999") + "/" + STRING(CashFlow.AccountCode
,"9999.99") + " " + STRING(CashFlow.StartDate
,"99/99/9999") + " " + CashFlow.Description
).
704 FOR EACH growth-month
WHERE growth-month.StartDate
>= CashFlow.StartDate
705 AND (growth-month.EndDate
<= CashFlow.EndDate
706 OR CashFlow.EndDate
= ?
):
707 part
= part-of-period
( CashFlow.StartDate
, CashFlow.EndDate
).
708 amount
= from-annual
( CashFlow.FrequencyCode
, CashFlow.Amount
) * part.
710 IF audit-report
AND ((CashFlow.StartDate
>= growth-month.StartDate
711 AND CashFlow.StartDate
<= growth-month.EndDate
)
712 OR (CashFlow.EndDate
>= growth-month.StartDate
713 AND CashFlow.EndDate
<= growth-month.EndDate
))
715 line
= "Cashflow from: " + null-str
(STRING(CashFlow.StartDate
, "99/99/9999"), "--/--/----")
716 + " to " + null-str
(STRING(CashFlow.EndDate
,"99/99/9999"), "++/++/++++") + " "
717 + null-str
( STRING( growth-month.StartDate
, "99/99/9999"), "??/??/????") + " "
718 + null-str
( STRING( part
, ">9.9999"), "?") + " "
719 + null-str
( STRING( amount
, mfmt
), "?").
721 RUN audit-line
( base-font
, line
).
724 RUN update-forecast
( CashFlow.EntityType
, CashFlow.EntityCode
, CashFlow.AccountCode
, CashFlow.CashFlowType
, amount
).
729 /* _UIB-CODE-BLOCK-END
*/
734 &IF DEFINED(EXCLUDE-each-tenant) = 0 &THEN
736 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-tenant Procedure
737 PROCEDURE each-tenant
:
738 /*------------------------------------------------------------------------------
740 ------------------------------------------------------------------------------*/
741 RUN audit-line
( header-font
, "Tenant " + STRING(Tenant.TenantCode
) + " " + Tenant.Name
).
742 FOR EACH TenancyLease
OF Tenant
WHERE TenancyLease.LeaseStatus
<> "PAST" NO-LOCK:
743 BUFFER-COPY TenancyLease
TO Lease.
744 RUN audit-line
( base-font
, "Lease " + STRING( TenancyLease.TenancyLeaseCode
) + " of " + TenancyLease.AreaDescription
).
745 /* normal tenants
(lease ends after forecast start
) */
746 RUN reset-lease-rates.
747 RUN build-lease-actions.
748 IF Lease.LeaseEndDate
< forecast-start
THEN DO:
749 rates.b-floor
= 0. rates.b-parks
= 0. rates.b-other
= 0.
750 rates.last-action
= "".
751 RUN process-actions
( "VACT" ).
754 RUN process-actions
( "BASE" ).
759 /* _UIB-CODE-BLOCK-END
*/
764 &IF DEFINED(EXCLUDE-each-tenant-recoveries) = 0 &THEN
766 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-tenant-recoveries Procedure
767 PROCEDURE each-tenant-recoveries
:
768 /*------------------------------------------------------------------------------
770 ------------------------------------------------------------------------------*/
771 RUN audit-line
( header-font
, "Tenant " + STRING(Tenant.TenantCode
) + " " + Tenant.Name
).
772 FOR EACH TenancyLease
OF Tenant
WHERE TenancyLease.LeaseStatus
<> "PAST" NO-LOCK:
773 BUFFER-COPY TenancyLease
TO Lease.
774 RUN audit-line
( base-font
, "Lease " + STRING( TenancyLease.TenancyLeaseCode
) + " of " + TenancyLease.AreaDescription
).
775 /* normal tenants
(lease ends after forecast start
) */
776 RUN reset-lease-rates.
777 RUN build-lease-actions.
778 IF Lease.LeaseEndDate
< forecast-start
THEN DO:
779 rates.b-floor
= 0. rates.b-parks
= 0. rates.b-other
= 0.
780 rates.last-action
= "".
781 RUN process-recoveries-actions
( "VACT" ).
784 RUN process-recoveries-actions
( "RCBS" ).
789 /* _UIB-CODE-BLOCK-END
*/
794 &IF DEFINED(EXCLUDE-each-vacant-space) = 0 &THEN
796 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-vacant-space Procedure
797 PROCEDURE each-vacant-space
:
798 /*------------------------------------------------------------------------------
799 Purpose
: Handle spaces that are currently vacant
, or due to be prior to the
801 ------------------------------------------------------------------------------*/
802 RUN audit-line
( header-font
, "Vacant area: " + STRING(RentalSpace.Level
) + "/" + STRING(RentalSpace.LevelSequence
) + RentalSpace.Description
).
803 RUN reset-area-rates.
804 RUN build-vacant-actions.
805 RUN process-actions
( "VACT" ).
809 /* _UIB-CODE-BLOCK-END
*/
814 &IF DEFINED(EXCLUDE-each-vacant-space-recoveries) = 0 &THEN
816 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-vacant-space-recoveries Procedure
817 PROCEDURE each-vacant-space-recoveries
:
818 /*------------------------------------------------------------------------------
819 Purpose
: Handle spaces that are currently vacant
, or due to be prior to the
821 ------------------------------------------------------------------------------*/
822 RUN audit-line
( header-font
, "Vacant area: " + STRING(RentalSpace.Level
) + "/" + STRING(RentalSpace.LevelSequence
) + RentalSpace.Description
).
823 RUN reset-area-rates.
824 RUN build-vacant-actions.
825 RUN process-recoveries-actions
( "VACT" ).
829 /* _UIB-CODE-BLOCK-END
*/
834 &IF DEFINED(EXCLUDE-inst-page-footer) = 0 &THEN
836 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-footer Procedure
837 PROCEDURE inst-page-footer
:
838 /*------------------------------------------------------------------------------
839 Purpose
: Print any page footer
840 ------------------------------------------------------------------------------*/
844 /* _UIB-CODE-BLOCK-END
*/
849 &IF DEFINED(EXCLUDE-inst-page-header) = 0 &THEN
851 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-header Procedure
852 PROCEDURE inst-page-header
:
853 /*------------------------------------------------------------------------------
854 Purpose
: Print any page header
855 ------------------------------------------------------------------------------*/
856 IF in-rent-report
THEN DO:
861 RUN pclrep-line
( "univers,Point,7,bold,Proportional", TimeStamp
).
862 RUN pclrep-line
( "univers,Point,11,bold,Proportional", SPC
(70) + "AmTrust Forecasting Run" ).
863 RUN pclrep-line
( "", "" ).
865 RUN pclrep-line
( base-font
+ ",bold", " Type From Mth Floor Parks Other Against Base Growth Market Pro-rata Last action").
867 RUN pclrep-line
( "", "" ).
871 /* _UIB-CODE-BLOCK-END
*/
876 &IF DEFINED(EXCLUDE-make-action) = 0 &THEN
878 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE make-action Procedure
879 PROCEDURE make-action
:
880 /*------------------------------------------------------------------------------
882 ------------------------------------------------------------------------------*/
883 DEF INPUT PARAMETER act-date
AS DATE NO-UNDO.
884 DEF INPUT PARAMETER act-type
AS CHAR NO-UNDO.
885 DEF INPUT PARAMETER act-desc
AS CHAR NO-UNDO.
887 FIND Month
WHERE Month.StartDate
<= act-date
AND Month.EndDate
>= act-date
NO-ERROR.
888 IF NOT AVAILABLE(Month
) THEN RETURN.
/* must be outside of system periods
! */
891 Action.TenancyLeaseCode
= (IF AVAILABLE(TenancyLease
) THEN TenancyLease.TenancyLeaseCode
ELSE ?
).
892 Action.RentalSpaceCode
= (IF AVAILABLE(RentalSpace
) THEN RentalSpace.RentalSpaceCode
ELSE ?
).
893 Action.ActionDate
= act-date.
894 Action.MonthCode
= Month.MonthCode.
895 Action.ActionType
= act-type.
896 Action.ActionDescription
= act-desc.
897 Action.ActionFloor
= 0.0 .
898 Action.ActionParks
= 0.0 .
899 Action.ActionOther
= 0.0 .
900 Action.ActionFCFloor
= 0.0 .
901 Action.ActionFCParks
= 0.0 .
902 Action.ActionFCOther
= 0.0 .
906 IF act-type
= "End" THEN DO:
907 DEF VAR vacant-months
AS INT NO-UNDO.
908 IF act-date
< forecast-start
THEN
909 /* apply vacant-months from the start of the forecast
*/
910 vacant-months
= get-int-parameter
("Vacant-Months", forecast-start
, 1 ).
912 vacant-months
= get-int-parameter
("Vacant-Months", act-date
, 1 ).
914 act-date
= add-months
( act-date
+ 1, vacant-months
).
915 IF act-date
< forecast-end
THEN DO:
916 IF act-date
< forecast-start
THEN act-date
= forecast-start.
917 RUN make-action
( act-date
, "New", "Re leasing").
920 ELSE IF act-type
= "New" THEN DO:
921 DEF VAR review-months
AS INT NO-UNDO.
922 /* add rent reviews
*/
923 review-months
= get-int-parameter
("Review-Months", act-date
, 12).
924 DO WHILE act-date
< forecast-end
:
925 act-date
= add-months
( act-date
, review-months
).
926 IF act-date
< forecast-end
THEN
927 RUN make-action
( act-date
, "Rvw", "Review on new lease").
933 /* _UIB-CODE-BLOCK-END
*/
938 &IF DEFINED(EXCLUDE-override-action) = 0 &THEN
940 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE override-action Procedure
941 PROCEDURE override-action
:
942 /*------------------------------------------------------------------------------
944 ------------------------------------------------------------------------------*/
945 DEF INPUT PARAMETER override-action
AS CHAR NO-UNDO.
947 DEF VAR act-date
AS DATE NO-UNDO.
948 DEF VAR old-type
AS CHAR NO-UNDO.
949 DEF VAR new-type
AS CHAR NO-UNDO.
950 DEF VAR floor-amt
AS DEC NO-UNDO.
951 DEF VAR parks-amt
AS DEC NO-UNDO.
952 DEF VAR other-amt
AS DEC NO-UNDO.
953 DEF VAR act-desc
AS CHAR NO-UNDO.
955 ASSIGN act-date
= DATE( ENTRY( 3, override-action
) )
956 old-type
= ENTRY(4, override-action
)
957 new-type
= ENTRY(5, override-action
)
958 floor-amt
= DEC( ENTRY(6, override-action
) )
959 parks-amt
= DEC( ENTRY(7, override-action
) )
960 other-amt
= DEC( ENTRY(8, override-action
) )
961 act-desc
= ENTRY(9, override-action
) NO-ERROR.
963 IF act-desc
= ?
THEN act-desc
= "".
964 IF act-date
= ?
THEN DO:
965 /* use the start date of the month applying
*/
966 FIND Month
WHERE Month.MonthCode
= PropForecastParam.MonthCode
NO-LOCK.
967 act-date
= Month.StartDate.
970 FIND FIRST growth-month
WHERE growth-month.StartDate
> (act-date
- round-up-after
) NO-LOCK NO-ERROR.
971 IF NOT AVAILABLE(growth-month
) THEN RETURN.
/* must be outside of forecast
*/
973 IF old-type
<> "" THEN DO:
974 FIND Action
WHERE Action.MonthCode
= growth-month.MonthCode
AND
975 Action.ActionType
= old-type
NO-ERROR.
979 Action.MonthCode
= growth-month.MonthCode.
980 Action.ActionType
= new-type.
982 Action.ActionDate
= act-date.
983 Action.ActionType
= new-type.
984 Action.ActionDescription
= act-desc.
985 Action.ActionFloor
= floor-amt.
986 Action.ActionParks
= parks-amt.
987 Action.ActionOther
= other-amt.
988 Action.ActionFCFloor
= floor-amt.
989 Action.ActionFCParks
= parks-amt.
990 Action.ActionFCOther
= other-amt.
994 IF new-type
= "End" THEN DO:
995 FOR EACH Action
WHERE Action.ActionDate
> act-date
:
998 DEF VAR vacant-months
AS INT NO-UNDO.
999 IF act-date
< forecast-start
THEN
1000 /* apply vacant-months from the start of the forecast
*/
1001 vacant-months
= get-int-parameter
("Vacant-Months", forecast-start
, 1 ).
1003 vacant-months
= get-int-parameter
("Vacant-Months", act-date
, 1 ).
1005 act-date
= add-months
( act-date
+ 1, vacant-months
).
1006 IF act-date
< forecast-end
THEN DO:
1007 IF act-date
< forecast-start
THEN act-date
= forecast-start.
1008 RUN make-action
( act-date
, "New", "Re leasing").
1011 ELSE IF new-type
= "New" THEN DO:
1012 FOR EACH Action
WHERE Action.ActionDate
> act-date
:
1015 DEF VAR review-months
AS INT NO-UNDO.
1016 /* add rent reviews
*/
1017 review-months
= get-int-parameter
("Review-Months", act-date
, 12).
1018 DO WHILE act-date
< forecast-end
:
1019 act-date
= add-months
( act-date
, review-months
).
1020 IF act-date
< forecast-end
THEN
1021 RUN make-action
( act-date
, "Rvw", "Review on new lease").
1027 /* _UIB-CODE-BLOCK-END
*/
1032 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
1034 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
1035 PROCEDURE parse-parameters
:
1036 /*------------------------------------------------------------------------------
1038 ------------------------------------------------------------------------------*/
1039 DEF VAR token
AS CHAR NO-UNDO.
1040 DEF VAR i
AS INT NO-UNDO.
1042 {inc
/showopts.i
"report-options"}
1044 DO i
= 1 TO NUM-ENTRIES( report-options
, "~n" ):
1045 token
= ENTRY( i
, report-options
, "~n" ).
1047 /* Preview and Property options are set for each run
*/
1048 CASE ENTRY( 1, token
):
1049 WHEN "Preview" THEN preview
= Yes.
1051 WHEN "ClearAll" THEN clear-all
= Yes.
1052 WHEN "AuditReport" THEN audit-report
= Yes.
1053 WHEN "RentReport" THEN rent-report
= Yes.
1054 WHEN "SkipAgentsFees" THEN skip-agents-fees
= Yes.
1055 WHEN "ReportOnly" THEN regenerate
= No.
1057 WHEN "Regenerate" THEN DO:
1059 CASE ENTRY(2,token
):
1060 WHEN "Rents" THEN regenerate-rents
= Yes.
1061 WHEN "Expenses" THEN regenerate-expenses
= Yes.
1062 WHEN "Recoveries" THEN regenerate-recoveries
= Yes.
1064 regenerate-rents
= Yes
1065 regenerate-expenses
= Yes
1066 regenerate-recoveries
= Yes.
1070 WHEN "All" THEN ASSIGN
1072 property-n
= 999999.
1074 WHEN "Properties" THEN ASSIGN
1075 property-1
= INT(ENTRY(2,token
))
1076 property-n
= INT(ENTRY(2,token
)).
1080 FIND RP
WHERE RP.UserName
= "Amtrust-Forecast"
1081 AND RP.ReportID
= {&REPORT-ID} NO-LOCK NO-ERROR.
1083 IF AVAILABLE RP
THEN report-options
= RP.Char6.
1085 /* inc
/showopts doesn't work twice
*/
1086 IF AVAILABLE(UsrGroupMember
) THEN MESSAGE report-options.
1088 DO i
= 1 TO NUM-ENTRIES( report-options
, "~n" ):
1089 token
= ENTRY( i
, report-options
, "~n" ).
1091 /* months
& ratchet options apply until forecast is cleared */
1092 CASE ENTRY( 1, token
):
1093 WHEN "AllRatchets" THEN all-ratchets
= Yes.
1094 WHEN "Months" THEN ASSIGN
1095 month-1
= INT(ENTRY(2,token
))
1096 month-n
= INT(ENTRY(3,token
)).
1101 FIND Month
WHERE Month.MonthCode
= month-1
NO-LOCK NO-ERROR.
1102 IF NOT AVAILABLE(Month
) THEN DO:
1103 MESSAGE "Invalid starting month for forecast"
1104 VIEW-AS ALERT-BOX ERROR.
1107 forecast-start
= Month.StartDate.
1108 FIND Month
WHERE Month.MonthCode
= month-n
NO-LOCK NO-ERROR.
1109 IF NOT AVAILABLE(Month
) THEN DO:
1110 MESSAGE "Invalid ending month for forecast"
1111 VIEW-AS ALERT-BOX ERROR.
1114 forecast-end
= Month.EndDate.
1116 IF clear-all
THEN ASSIGN
1118 regenerate-rents
= Yes
1119 regenerate-expenses
= Yes
1120 regenerate-recoveries
= Yes .
1123 /* _UIB-CODE-BLOCK-END
*/
1128 &IF DEFINED(EXCLUDE-process-actions) = 0 &THEN
1130 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE process-actions Procedure
1131 PROCEDURE process-actions
:
1132 /*------------------------------------------------------------------------------
1134 ------------------------------------------------------------------------------*/
1135 DEF INPUT PARAMETER pfc-type
AS CHAR NO-UNDO.
1137 DEF VAR lease-ended
AS LOGI
NO-UNDO.
1139 IF audit-report
THEN RUN audit-line
( base-font
, "Processing Lease Actions" ).
1141 FOR EACH growth-month
:
1142 rates.pro-rate
= 1.0 .
1143 lease-ended
= (pfc-type
= "VACT").
1144 rates.lg-floor
= rates.g-floor.
1145 rates.lg-parks
= rates.g-parks.
1146 rates.lg-other
= rates.g-other.
1148 FOR EACH Action
OF growth-month
BY Action.ActionDate
:
1149 CASE Action.ActionType
:
1151 IF NOT lease-ended
THEN process-action-end-before
( ).
1154 pfc-type
= process-action-old
( ).
1158 IF lease-ended
THEN pfc-type
= process-action-new
( ).
1162 IF NOT lease-ended
THEN process-action-rvw
().
1164 WHEN "One" THEN process-action-one
( ).
1167 rates.last-action
= Action.ActionType.
1170 IF rates.lg-floor
+ rates.lg-other
+ rates.b-floor
+ rates.b-other
= 0 THEN DO:
1171 /* Increase carparks
*/
1172 /* rates.b-parks
= rates.m-parks.
*/
1173 rates.g-parks
= (rates.b-parks
* growth-month.parks
) - rates.b-parks.
1174 RUN update-pfc-entity
( parks-ac
, "G" + pfc-type
, rates.lg-parks
+ ((rates.g-parks
- rates.lg-parks
) * rates.pro-rate
) ).
1177 RUN update-pfc-entity
( floor-ac
, "G" + pfc-type
, rates.lg-floor
+ ((rates.g-floor
- rates.lg-floor
) * rates.pro-rate
) ).
1178 RUN update-pfc-entity
( parks-ac
, "G" + pfc-type
, rates.lg-parks
+ ((rates.g-parks
- rates.lg-parks
) * rates.pro-rate
) ).
1179 RUN update-pfc-entity
( other-ac
, "G" + pfc-type
, rates.lg-other
+ ((rates.g-other
- rates.lg-other
) * rates.pro-rate
) ).
1182 IF rates.last-action
= "Rvw" THEN rates.pro-rate
= 1.0 .
1183 RUN update-pfc-entity
( floor-ac
, pfc-type
, rates.b-floor
* rates.pro-rate
).
1184 RUN update-pfc-entity
( parks-ac
, pfc-type
, rates.b-parks
* rates.pro-rate
).
1185 RUN update-pfc-entity
( other-ac
, pfc-type
, rates.b-other
* rates.pro-rate
).
1186 RUN dump-rates
( pfc-type
).
1188 IF rates.last-action
= "End" THEN DO:
1189 FIND LAST Action
OF growth-month
WHERE Action.ActionType
= "End".
1190 pfc-type
= process-action-end-after
().
1191 rates.last-action
= "".
1195 FOR EACH PropForecast
OF Property
WHERE PropForecast.EntityType
= rates.et
1196 AND PropForecast.EntityCode
= rates.ec
1197 AND PropForecast.MonthCode
= growth-month.MonthCode
NO-LOCK:
1198 RUN dump-prop-forecast.
1205 /* _UIB-CODE-BLOCK-END
*/
1210 &IF DEFINED(EXCLUDE-process-recoveries-actions) = 0 &THEN
1212 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE process-recoveries-actions Procedure
1213 PROCEDURE process-recoveries-actions
:
1214 /*------------------------------------------------------------------------------
1216 ------------------------------------------------------------------------------*/
1217 DEF INPUT PARAMETER pfc-type
AS CHAR NO-UNDO.
1219 DEF VAR lease-ended
AS LOGI
NO-UNDO.
1220 DEF VAR new-lease
AS LOGI
NO-UNDO INITIAL No.
1221 DEF VAR part
AS DEC NO-UNDO.
1222 DEF VAR percentage
AS DEC NO-UNDO.
1224 DEF VAR et
AS CHAR NO-UNDO.
1225 DEF VAR ec
AS INT NO-UNDO.
1226 DEF VAR line
AS CHAR NO-UNDO.
1229 ec
= Property.PropertyCode.
1231 DEF BUFFER ExpPFC
FOR PropForecast.
1233 FOR EACH growth-month
:
1234 lease-ended
= (pfc-type
= "VACT").
1235 new-lease
= new-lease
OR lease-ended.
1236 part
= (IF lease-ended
THEN 0.0 ELSE -1.0 ).
1238 FOR EACH Action
OF growth-month
BY Action.ActionDate
:
1239 CASE Action.ActionType
:
1241 part
= - part-of-period
( growth-month.StartDate
, Action.ActionDate
).
1246 part
= - part-of-period
( Action.ActionDate
, growth-month.EndDate
).
1253 part
= - part-of-period
( Action.ActionDate
, growth-month.EndDate
).
1261 line
= pfc-type
+ " " + STRING(growth-month.StartDate
, "99/99/9999")
1262 + STRING(growth-month.MonthCode
, ">>>9") + " "
1263 + STRING( - part
, ">9.9999") + " ".
1264 RUN audit-line
( base-font
, line
).
1266 IF NOT(new-lease
) AND AVAILABLE(TenancyLease
) AND TenancyLease.RecoveryType
= "F" THEN DO:
1267 RUN update-forecast
( et
, ec
, fixed-og-account
,
1268 pfc-type
, (TenancyLease.OutgoingsBudget
/ 12) * part
).
1271 FOR EACH ExpPFC
WHERE ExpPFC.PropertyCode
= Property.PropertyCode
1272 AND ExpPFC.EntityType
= "P"
1273 AND ExpPFC.EntityCode
= Property.PropertyCode
1274 AND ExpPFC.MonthCode
= growth-month.MonthCode
1275 AND ExpPFC.PropForecastType
= "EXP" NO-LOCK:
1276 IF NOT(new-lease
) AND AVAILABLE(TenancyLease
) THEN
1277 percentage
= get-lease-recovery
( ExpPFC.AccountCode
, lease-ended
).
1279 IF new-lease
AND AVAILABLE(TenancyLease
) THEN DO:
1281 IF TenancyLease.OutgoingsRate
> 0.0 THEN DO:
1282 FIND ChartOfAccount
WHERE ChartOfAccount.AccountCode
= ExpPFC.AccountCode
NO-LOCK NO-ERROR.
1283 IF AVAILABLE(ChartOfAccount
) AND ChartOfAccount.ExpenseRecoveryType
= "P" THEN
1284 percentage
= TenancyLease.OutgoingsRate.
1286 /* MESSAGE ExpPFC.MonthCode ExpPFC.AccountCode percentage .
*/
1287 /* MESSAGE ExpPFC.MonthCode ExpPFC.AccountCode percentage
VIEW-AS ALERT-BOX .
*/
1290 percentage
= RentalSpace.OutgoingsPercentage.
1294 line
= FILL(" ",20) + STRING(ExpPFC.AccountCode
, "9999.99")
1295 + STRING( percentage
/ 100.0, ">9.9999")
1296 + STRING( ExpPFC.Amount
, ">>,>>>,>>9.99")
1297 + STRING( ExpPFC.Amount
* (percentage
/ 100.0) * part
, "->>,>>>,>>9.99") .
1298 RUN audit-line
( base-font
, line
).
1299 RUN update-forecast
( et
, ec
, ExpPFC.AccountCode
+ recovery-offset
,
1300 pfc-type
, ExpPFC.Amount
* (percentage
/ 100.0) * part
).
1302 IF /* NOT(new-lease
) AND */ AVAILABLE(TenancyLease
) THEN DO:
1303 FOR EACH ChartOfAccount
WHERE ChartOfAccount.ExpenseRecoveryType
= "O" NO-LOCK,
1304 FIRST TenancyOutgoing
OF TenancyLease
WHERE TenancyOutgoing.AccountCode
= ChartOfAccount.AccountCode
NO-LOCK:
1305 RUN update-forecast
( et
, ec
, ChartOfAccount.AccountCode
+ recovery-offset
,
1306 pfc-type
, (TenancyOutgoing.FixedAmount
/ 12) * part
).
1310 IF lease-ended
THEN pfc-type
= "VACT".
1315 /* _UIB-CODE-BLOCK-END
*/
1320 &IF DEFINED(EXCLUDE-reset-area-rates) = 0 &THEN
1322 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-area-rates Procedure
1323 PROCEDURE reset-area-rates
:
1324 /*------------------------------------------------------------------------------
1325 Purpose
: Set up the 'rates' record for the current lease
1326 ------------------------------------------------------------------------------*/
1327 DEF VAR mkt-pc
AS DEC NO-UNDO.
1329 rates.b-floor
= 0. rates.b-parks
= 0. rates.b-other
= 0.
1330 rates.g-floor
= 0. rates.g-parks
= 0. rates.g-other
= 0.
1331 rates.m-floor
= 0. rates.m-parks
= 0. rates.m-other
= 0.
1333 /* Don't do any rates if it's externally managed
- its all manual then
*/
1334 IF Property.ExternallyManaged
THEN RETURN.
1336 FIND FIRST AreaType
OF RentalSpace
NO-LOCK.
1337 mkt-pc
= (IF RentalSpace.MarketRental
> 0 THEN RentalSpace.MarketRental
/ 100.0 ELSE 1.0).
1338 IF AreaType.IsFloorArea
THEN
1339 rates.m-floor
= (RentalSpace.AreaSize
* Property.MarketRental
* mkt-pc
) / 12.
1340 ELSE IF AreaType.IsCarPark
THEN
1341 rates.m-parks
= (RentalSpace.AreaSize
* Property.MarketCarpark
* mkt-pc
* 52) / 12.
1344 rates.ec
= RentalSpace.RentalSpaceCode.
1348 /* _UIB-CODE-BLOCK-END
*/
1353 &IF DEFINED(EXCLUDE-reset-growth-rates) = 0 &THEN
1355 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-growth-rates Procedure
1356 PROCEDURE reset-growth-rates
:
1357 /*------------------------------------------------------------------------------
1358 Purpose
: Calculate all of the compounding rgwoth rates in effect for this property
1359 ------------------------------------------------------------------------------*/
1360 DEF VAR floor-growth
AS DEC NO-UNDO INITIAL 1.0 .
1361 DEF VAR parks-growth
AS DEC NO-UNDO INITIAL 1.0 .
1362 DEF VAR other-growth
AS DEC NO-UNDO INITIAL 1.0 .
1364 FIND FIRST growth-month
NO-ERROR.
1365 IF NOT AVAILABLE(growth-month
) THEN DO:
1366 /* create the table for all months of the forecast
*/
1367 FOR EACH Month
WHERE Month.MonthCode
>= month-1
AND Month.MonthCode
<= month-n
NO-LOCK:
1368 CREATE growth-month.
1369 BUFFER-COPY Month
TO growth-month.
1373 /* update the interest rates from the start of the forecast
*/
1374 FOR EACH growth-month
:
1375 growth-month.floor
= floor-growth.
1376 growth-month.parks
= parks-growth.
1377 growth-month.other
= floor-growth.
/* not 'other' growth because we don't do that
*/
1378 floor-growth
= floor-growth
* to-month-rate
( get-parameter
( "Rental-Growth", growth-month.StartDate
)).
1379 parks-growth
= parks-growth
* to-month-rate
( get-parameter
( "Carpark-Growth", growth-month.StartDate
)).
1384 /* _UIB-CODE-BLOCK-END
*/
1389 &IF DEFINED(EXCLUDE-reset-lease-rates) = 0 &THEN
1391 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-lease-rates Procedure
1392 PROCEDURE reset-lease-rates
:
1393 /*------------------------------------------------------------------------------
1394 Purpose
: Set up the 'rates' record for the current lease
1395 ------------------------------------------------------------------------------*/
1396 DEF VAR mkt-pc
AS DEC NO-UNDO.
1397 DEF VAR other-size
AS DEC NO-UNDO INITIAL 0.0 .
1398 DEF VAR other-mult
AS DEC NO-UNDO INITIAL 0.0 .
1400 rates.b-floor
= 0. rates.b-parks
= 0. rates.b-other
= 0.
1401 rates.g-floor
= 0. rates.g-parks
= 0. rates.g-other
= 0.
1402 rates.m-floor
= 0. rates.m-parks
= 0. rates.m-other
= 0.
1404 /* Don't do any rates if it's externally managed
- its all manual then
*/
1405 IF Property.ExternallyManaged
THEN RETURN.
1407 /* do market rentals
*/
1408 FOR EACH RentalSpace
WHERE RentalSpace.TenancyLeaseCode
= Lease.TenancyLeaseCode
NO-LOCK,
1409 FIRST AreaType
OF RentalSpace
:
1410 mkt-pc
= (IF RentalSpace.MarketRental
> 0 THEN RentalSpace.MarketRental
/ 100.0 ELSE 1.0).
1411 IF AreaType.IsFloorArea
THEN DO:
1412 rates.m-floor
= rates.m-floor
+ (mkt-pc
* RentalSpace.AreaSize
* Property.MarketRental
/ 12).
1414 ELSE IF AreaType.IsCarPark
THEN ASSIGN
1415 rates.m-parks
= rates.m-parks
+ (mkt-pc
* RentalSpace.AreaSize
* Property.MarketCarpark
* 52 / 12).
1417 /* for market we use actual
, which is set below
, but we need to be able to handle a
%age
*/
1418 other-size
= other-size
+ RentalSpace.AreaSize
1419 other-mult
= other-mult
+ (RentalSpace.AreaSize
* mkt-pc
).
1422 /* do actual rentals
*/
1423 FOR EACH RentCharge
OF TenancyLease
NO-LOCK,
1424 FIRST AreaType
WHERE AreaType.AreaType
= RentCharge.RentChargeType
:
1425 FOR EACH RentChargeLine
OF RentCharge
WHERE RentChargeLine.RentChargeLineStatus
= "C"
1426 AND RentChargeLine.StartDate
<= forecast-start
1427 AND (RentChargeLine.EndDate
>= forecast-start
1428 OR RentChargeLine.EndDate
= ?
) NO-LOCK:
1429 IF AreaType.IsFloorArea
THEN
1430 rates.b-floor
= rates.b-floor
+ to-annual
( RentChargeLine.FrequencyCode
, RentChargeLine.Amount
).
1431 ELSE IF AreaType.IsCarPark
THEN ASSIGN
1432 rates.b-parks
= rates.b-parks
+ to-annual
( RentChargeLine.FrequencyCode
, RentChargeLine.Amount
).
1434 rates.b-other
= rates.b-other
+ to-annual
( RentChargeLine.FrequencyCode
, RentChargeLine.Amount
).
1438 rates.b-floor
= rates.b-floor
/ 12.
1439 rates.b-parks
= rates.b-parks
/ 12.
1440 rates.b-other
= rates.b-other
/ 12.
1441 rates.m-other
= rates.b-other
* (IF other-size
> 0 THEN other-mult
/ other-size
ELSE 1.0).
1444 rates.ec
= Tenant.TenantCode.
1448 /* _UIB-CODE-BLOCK-END
*/
1453 &IF DEFINED(EXCLUDE-rr-build-table) = 0 &THEN
1455 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE rr-build-table Procedure
1456 PROCEDURE rr-build-table
:
1457 /*------------------------------------------------------------------------------
1459 ------------------------------------------------------------------------------*/
1460 DEF VAR i
AS INT NO-UNDO.
1461 DEF VAR first-year
AS INT NO-UNDO.
1462 FIND FIRST growth-month.
1463 first-year
= growth-month.FinancialYearCode.
1465 RUN audit-line
( header-font
, "Building temp table for Rent Report").
1466 FOR EACH Property
WHERE Active
AND Property.PropertyCode
>= property-1
1467 AND Property.PropertyCode
<= property-n
NO-LOCK:
1468 RUN audit-line
( base-font
, "Temp table for Property " + STRING(Property.PropertyCode
)).
1469 FOR EACH PropForecast
OF Property
NO-LOCK:
1470 FIND growth-month
WHERE growth-month.MonthCode
= PropForecast.MonthCode.
1471 i
= (growth-month.FinancialYear
- first-year
) + 1.
1472 FIND rr-line
WHERE rr-line.pcode
= PropForecast.PropertyCode
1473 AND rr-line.et
= PropForecast.EntityType
1474 AND rr-line.ec
= PropForecast.EntityCode
1475 AND rr-line.ltype
= PropForecast.PropForecastType
NO-ERROR.
1477 IF NOT AVAILABLE(rr-line
) THEN DO:
1479 rr-line.pcode
= PropForecast.PropertyCode.
1480 rr-line.et
= PropForecast.EntityType.
1481 rr-line.ec
= PropForecast.EntityCode.
1482 rr-line.ltype
= PropForecast.PropForecastType.
1483 IF skip-agents-fees
AND rr-line.ltype
= "AGNT" THEN NEXT.
1484 rr-line.lseq
= LOOKUP( PropForecast.PropForecastType
, rr-sequences
).
1485 IF rr-line.lseq
= 0 THEN DO:
1486 rr-sequences
= rr-sequences
+ "," + PropForecast.PropForecastType.
1487 rr-line.lseq
= LOOKUP( PropForecast.PropForecastType
, rr-sequences
).
1488 RUN audit-line
( base-font
, "Couldn't locate '" + PropForecast.PropForecastType
+ "' in line type list, using default").
1491 IF PropForecast.PropForecastType
= "AGNT" THEN
1492 rr-line.years
[i
] = rr-line.years
[i
] - PropForecast.Amount.
1494 rr-line.years
[i
] = rr-line.years
[i
] + PropForecast.Amount.
1500 /* _UIB-CODE-BLOCK-END
*/
1505 &IF DEFINED(EXCLUDE-rr-line) = 0 &THEN
1507 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE rr-line Procedure
1509 /*------------------------------------------------------------------------------
1511 ------------------------------------------------------------------------------*/
1512 DEF BUFFER rr-total
FOR rr-line.
1514 DEF VAR t1
AS CHAR NO-UNDO.
1515 DEF VAR t2
AS CHAR NO-UNDO.
1516 DEF VAR is-total-line
AS LOGI
NO-UNDO.
1517 DEF VAR i
AS INT NO-UNDO.
1519 IF rr-line.pcode
> 99999 THEN
1520 t1
= "Grand totals".
1521 ELSE IF rr-line.et
= "Z" THEN
1522 t1
= "Property " + STRING(Property.PropertyCode
) + " totals".
1524 t1
= rr-line.et
+ STRING( rr-line.ec
, ">99999").
1526 IF rr-line.ltype
= "TOTAL" THEN DO: /* entity total line
*/
1527 RUN pclrep-line
( base-font
, FILL(" ",20) + FILL( " " + FILL( "-", LENGTH(mfmt
) - 1), 5)).
1530 /* find and add to total of this group
*/
1531 FIND rr-total
WHERE rr-total.pcode
= rr-line.pcode
1532 AND rr-total.et
= rr-line.et
1533 AND rr-total.ec
= rr-line.ec
1534 AND rr-total.ltype
= "TOTAL" NO-ERROR.
1535 IF NOT AVAILABLE(rr-total
) THEN DO:
1537 rr-total.pcode
= rr-line.pcode.
1538 rr-total.et
= rr-line.et.
1539 rr-total.ec
= rr-line.ec.
1540 rr-total.ltype
= "TOTAL".
1544 rr-total.years
[i
] = rr-total.years
[i
] + rr-line.years
[i
].
1547 IF rr-line.pcode
<= 99999 THEN DO:
1548 /* find and add to total at level above
*/
1549 FIND rr-total
WHERE rr-total.pcode
= (IF rr-line.et
= "Z" THEN 999999 ELSE rr-line.pcode
)
1550 AND rr-total.et
= "Z"
1551 AND rr-total.ec
= 999999
1552 AND rr-total.ltype
= rr-line.ltype
NO-ERROR.
1553 IF NOT AVAILABLE(rr-total
) THEN DO:
1555 rr-total.pcode
= (IF rr-line.et
= "Z" THEN 999999 ELSE rr-line.pcode
).
1557 rr-total.ec
= 999999.
1558 rr-total.ltype
= rr-line.ltype.
1559 rr-total.lseq
= rr-line.lseq.
1562 rr-total.years
[i
] = rr-total.years
[i
] + rr-line.years
[i
].
1567 ASSIGN t2
= ENTRY( rr-line.lseq
, "Base rental,Growth on Base Rental,New leases,Growth on new leases,Vacant costs,Growth on vacant costs,One-off income/costs,Agents Fees,Total,,,,,,") NO-ERROR.
1568 /* IF t2
= ?
THEN MESSAGE rr-line.lseq
VIEW-AS ALERT-BOX.
*/
1569 IF t2
= "" OR t2
= ?
THEN t2
= rr-line.ltype .
1570 RUN pclrep-line
( base-font
, STRING( t1
, "X(20)")
1571 + STRING( rr-line.years
[1], mfmt
)
1572 + STRING( rr-line.years
[2], mfmt
)
1573 + STRING( rr-line.years
[3], mfmt
)
1574 + STRING( rr-line.years
[4], mfmt
)
1575 + STRING( rr-line.years
[5], mfmt
)
1580 /* _UIB-CODE-BLOCK-END
*/
1585 &IF DEFINED(EXCLUDE-rr-page-header) = 0 &THEN
1587 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE rr-page-header Procedure
1588 PROCEDURE rr-page-header
:
1589 /*------------------------------------------------------------------------------
1590 Purpose
: Print page header for the rent report
1591 ------------------------------------------------------------------------------*/
1592 DEF VAR tfmt
AS CHAR NO-UNDO.
1593 DEF VAR first-year
AS INT NO-UNDO.
1594 DEF BUFFER gmth
FOR growth-month.
1596 first-year
= gmth.FinancialYearCode.
1598 RUN pclrep-line
( "univers,Point,7,bold,Proportional", TimeStamp
).
1599 RUN pclrep-line
( "univers,Point,11,bold,Proportional", SPC
(70) + "AmTrust Forecasting Run - Rental Report" ).
1600 RUN pclrep-line
( "", "" ).
1602 tfmt
= STRING( " 9999 ", "X(" + STRING(LENGTH(mfmt
)) + ")").
1603 RUN pclrep-line
( base-font
+ ",bold", FILL(" ",25) + STRING(first-year
, tfmt
)
1604 + STRING(first-year
+ 1, tfmt
) + STRING(first-year
+ 2, tfmt
)
1605 + STRING(first-year
+ 3, tfmt
) + STRING(first-year
+ 4, tfmt
) ).
1607 RUN pclrep-line
( "", "" ).
1611 /* _UIB-CODE-BLOCK-END
*/
1616 &IF DEFINED(EXCLUDE-rr-rent-report) = 0 &THEN
1618 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE rr-rent-report Procedure
1619 PROCEDURE rr-rent-report
:
1620 /*------------------------------------------------------------------------------
1622 ------------------------------------------------------------------------------*/
1623 DEF VAR years
AS DEC NO-UNDO EXTENT 5 INITIAL 0.
1624 DEF VAR etot
AS DEC NO-UNDO EXTENT 5 INITIAL 0.
1625 DEF VAR ptot
AS DEC NO-UNDO EXTENT 5 INITIAL 0.
1627 DEF VAR last-type
AS CHAR NO-UNDO INITIAL "".
1628 DEF VAR last-entity
AS CHAR NO-UNDO INITIAL "".
1629 DEF VAR this-entity
AS CHAR NO-UNDO.
1630 DEF VAR i
AS INT NO-UNDO.
1631 DEF VAR first-year
AS INT NO-UNDO.
1632 FIND FIRST growth-month.
1633 first-year
= growth-month.FinancialYearCode.
1637 in-rent-report
= Yes.
1638 IF audit-report
THEN RUN pclrep-page-break.
1639 FOR EACH Property
WHERE Active
AND Property.PropertyCode
>= property-1
1640 AND Property.PropertyCode
<= property-n
NO-LOCK:
1641 RUN pclrep-line
( header-font
, "Property " + STRING(Property.PropertyCode
) + " " + Property.Name
).
1644 FOR EACH Tenant
NO-LOCK WHERE Tenant.EntityType
= "P"
1645 AND Tenant.EntityCode
= Property.PropertyCode
1646 AND CAN-FIND( FIRST rr-line
WHERE rr-line.pcode
= Property.PropertyCode
1647 AND rr-line.et
= "T" AND rr-line.ec
= Tenant.TenantCode
):
1648 RUN pclrep-line
( header-font
, "Tenant " + STRING(Tenant.TenantCode
) + " " + Tenant.Name
).
1649 FOR EACH rr-line
WHERE rr-line.pcode
= Property.PropertyCode
1650 AND rr-line.et
= "T"
1651 AND rr-line.ec
= Tenant.TenantCode
:
1654 RUN pclrep-line
(base-font
,"").
1658 FOR EACH RentalSpace
NO-LOCK OF Property
1659 WHERE CAN-FIND( FIRST rr-line
WHERE rr-line.pcode
= Property.PropertyCode
1660 AND rr-line.et
= "R" AND rr-line.ec
= RentalSpace.RentalSpaceCode
):
1661 RUN pclrep-line
( header-font
, "Vacant space " + STRING(RentalSpace.Level
) + "/" + STRING(RentalSpace.LevelSequence
) + " " + RentalSpace.Description
).
1662 FOR EACH rr-line
WHERE rr-line.pcode
= Property.PropertyCode
1663 AND rr-line.et
= "R"
1664 AND rr-line.ec
= RentalSpace.RentalSpaceCode
:
1667 RUN pclrep-line
(base-font
,"").
1670 FOR EACH rr-line
WHERE rr-line.pcode
= Property.PropertyCode
1671 AND rr-line.et
= "Z":
1674 RUN pclrep-down-by
(2).
1678 IF property-1
<> property-n
THEN FOR EACH rr-line
WHERE rr-line.pcode
= 999999:
1684 /* _UIB-CODE-BLOCK-END
*/
1689 &IF DEFINED(EXCLUDE-stamp-time) = 0 &THEN
1691 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE stamp-time Procedure
1692 PROCEDURE stamp-time
:
1693 /*------------------------------------------------------------------------------
1695 ------------------------------------------------------------------------------*/
1696 timings
[time-pos
] = ETIME.
1697 time-pos
= time-pos
+ 1.
1700 /* _UIB-CODE-BLOCK-END
*/
1705 &IF DEFINED(EXCLUDE-update-forecast) = 0 &THEN
1707 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-forecast Procedure
1708 PROCEDURE update-forecast
:
1709 /*------------------------------------------------------------------------------
1711 ------------------------------------------------------------------------------*/
1712 DEF INPUT PARAMETER et
AS CHAR NO-UNDO.
1713 DEF INPUT PARAMETER ec
AS INT NO-UNDO.
1714 DEF INPUT PARAMETER ac
AS DEC NO-UNDO.
1715 DEF INPUT PARAMETER pf-linetype
AS CHAR NO-UNDO.
1716 DEF INPUT PARAMETER amount
AS DEC NO-UNDO.
1718 IF amount
= 0 OR amount
= ?
THEN RETURN.
1721 FIND PropForecast
WHERE PropForecast.PropertyCode
= Property.PropertyCode
1722 AND PropForecast.EntityType
= et
1723 AND PropForecast.EntityCode
= ec
1724 AND PropForecast.AccountCode
= ac
1725 AND PropForecast.MonthCode
= growth-month.MonthCode
1726 AND PropForecast.PropForecastType
= SUBSTRING(pf-linetype
, 1, 4)
1727 EXCLUSIVE-LOCK NO-ERROR.
1728 IF AVAILABLE(PropForecast
) THEN
1729 PropForecast.Amount
= PropForecast.Amount
+ amount.
1731 CREATE PropForecast.
1732 PropForecast.PropertyCode
= Property.PropertyCode.
1733 PropForecast.EntityType
= et.
1734 PropForecast.EntityCode
= ec.
1735 PropForecast.AccountCode
= ac.
1736 PropForecast.MonthCode
= growth-month.MonthCode.
1737 PropForecast.PropForecastType
= SUBSTRING(pf-linetype
, 1, 4).
1738 PropForecast.Amount
= amount.
1741 FIND PropForecast
OF Property
WHERE PropForecast.EntityType
= et
1742 AND PropForecast.EntityCode
= ec
1743 AND PropForecast.AccountCode
= ac
1744 AND PropForecast.MonthCode
= growth-month.MonthCode
1745 AND PropForecast.PropForecastType
= SUBSTRING(pf-linetype
, 1, 4)
1748 /* RUN dump-prop-forecast.
*/
1752 /* _UIB-CODE-BLOCK-END
*/
1757 &IF DEFINED(EXCLUDE-update-pfc-entity) = 0 &THEN
1759 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-pfc-entity Procedure
1760 PROCEDURE update-pfc-entity
:
1761 /*------------------------------------------------------------------------------
1763 ------------------------------------------------------------------------------*/
1764 DEF INPUT PARAMETER ac
AS DEC NO-UNDO.
1765 DEF INPUT PARAMETER pf-linetype
AS CHAR NO-UNDO.
1766 DEF INPUT PARAMETER amount
AS DEC NO-UNDO.
1768 IF amount
= 0 OR amount
= ?
THEN RETURN.
1770 RUN update-forecast
( rates.et
, rates.ec
, ac
, pf-linetype
, amount
).
1774 /* _UIB-CODE-BLOCK-END
*/
1779 /* ************************ Function Implementations
***************** */
1781 &IF DEFINED(EXCLUDE-from-annual) = 0 &THEN
1783 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION from-annual Procedure
1784 FUNCTION from-annual
RETURNS DECIMAL
1785 ( INPUT freq-code
AS CHAR, INPUT annual-amount
AS DEC ) :
1786 /*------------------------------------------------------------------------------
1787 Purpose
: Convert annual amount to annual figure
1789 ------------------------------------------------------------------------------*/
1790 /* short circuit for most cases
*/
1791 IF freq-code
= "MNTH" THEN RETURN (annual-amount
/ 12.0).
1793 FIND FrequencyType
WHERE FrequencyType.FrequencyCode
= freq-code
NO-LOCK NO-ERROR.
1794 IF NOT AVAILABLE(FrequencyType
) THEN RETURN (annual-amount
/ 12.0).
/* assume monthly
! */
1796 IF FrequencyType.RepeatUnits
BEGINS "M" THEN
1797 RETURN ((annual-amount
* DEC(FrequencyType.UnitCount
)) / 12.0 ).
1799 RETURN ((annual-amount
* DEC(FrequencyType.UnitCount
)) / 365.0 ).
1803 /* _UIB-CODE-BLOCK-END
*/
1808 &IF DEFINED(EXCLUDE-get-area-rental) = 0 &THEN
1810 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-area-rental Procedure
1811 FUNCTION get-area-rental
RETURNS DECIMAL
1812 ( /* no parameters
*/ ) :
1813 /*------------------------------------------------------------------------------
1814 Purpose
: Return the base rental for the current area
, at the forecast start date
1815 Notes
: Rental is returned as a monthly amount
1816 ------------------------------------------------------------------------------*/
1817 DEF VAR base-rental
AS DEC NO-UNDO.
1819 IF NOT AVAILABLE(RentalSpace
) THEN DO:
1820 MESSAGE "Trying to obtain rental for unknown area!".
1824 IF NOT AVAILABLE(Property
) THEN FIND Property
OF RentalSpace
NO-LOCK.
1826 FIND AreaType
OF RentalSpace
NO-LOCK.
1827 IF AreaType.IsCarPark
THEN
1828 base-rental
= RentalSpace.AreaSize
* Property.MarketCarpark
* 52 .
1829 ELSE IF AreaType.IsFloorArea
THEN
1830 base-rental
= RentalSpace.AreaSize
* Property.MarketRental .
1834 base-rental
= base-rental
/ 12.
1840 /* _UIB-CODE-BLOCK-END
*/
1845 &IF DEFINED(EXCLUDE-get-int-parameter) = 0 &THEN
1847 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-int-parameter Procedure
1848 FUNCTION get-int-parameter
RETURNS INTEGER
1849 ( INPUT param-id
AS CHAR, INPUT in-date
AS DATE, INPUT default-no
AS INT ) :
1850 /*------------------------------------------------------------------------------
1853 ------------------------------------------------------------------------------*/
1854 DEF VAR r-str
AS CHAR NO-UNDO.
1855 DEF VAR result
AS INT NO-UNDO.
1857 r-str
= get-parameter
( param-id
, in-date
).
1859 result
= default-no.
1861 ASSIGN result
= INT( r-str
) NO-ERROR.
1867 /* _UIB-CODE-BLOCK-END
*/
1872 &IF DEFINED(EXCLUDE-get-lease-recovery) = 0 &THEN
1874 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-lease-recovery Procedure
1875 FUNCTION get-lease-recovery
RETURNS DECIMAL
1876 ( INPUT ac
AS DEC, INPUT lease-ended
AS LOGICAL ) :
1877 /*------------------------------------------------------------------------------
1878 Purpose
: Get the recovery percentage for the current lease for this account
1880 ------------------------------------------------------------------------------*/
1882 IF ( NOT(lease-ended
) ) THEN DO:
1883 FIND TenancyOutgoing
OF TenancyLease
WHERE TenancyOutgoing.AccountCode
= ac
NO-LOCK NO-ERROR.
1884 IF AVAILABLE(TenancyOutgoing
) THEN RETURN TenancyOutgoing.Percentage.
1887 IF TenancyLease.OutgoingsRate
> 0.0 THEN DO:
1888 FIND ChartOfAccount
WHERE ChartOfAccount.AccountCode
= ac
NO-LOCK NO-ERROR.
1889 IF AVAILABLE(ChartOfAccount
) AND ChartOfAccount.ExpenseRecoveryType
= "P" THEN
1890 RETURN TenancyLease.OutgoingsRate.
1897 /* _UIB-CODE-BLOCK-END
*/
1902 &IF DEFINED(EXCLUDE-get-parameter) = 0 &THEN
1904 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-parameter Procedure
1905 FUNCTION get-parameter
RETURNS CHARACTER
1906 ( INPUT param-id
AS CHAR, INPUT in-date
AS DATE ) :
1907 /*------------------------------------------------------------------------------
1908 Purpose
: Get the parameter in effect on the date given
1910 ------------------------------------------------------------------------------*/
1911 IF NOT AVAILABLE(Property
) THEN RETURN "".
1912 IF in-date
> forecast-end
THEN RETURN "".
1913 FIND growth-month
WHERE growth-month.StartDate
<= in-date
AND growth-month.EndDate
>= in-date
NO-ERROR.
1914 IF NOT AVAILABLE(growth-month
) THEN DO:
1915 IF in-date
< forecast-end
THEN
1916 RUN audit-line
( base-font
, "Can't find month for " + (IF in-date
= ?
THEN "?" ELSE STRING(in-date
,"99/99/9999")) + " parameter " + param-id
).
1920 FIND LAST PropForecastParam
WHERE PropForecastParam.PropertyCode
= Property.PropertyCode
1921 AND PropForecastParam.ParameterID
BEGINS param-id
1922 AND PropForecastParam.MonthCode
<= growth-month.MonthCode
NO-LOCK NO-ERROR.
1923 IF NOT AVAILABLE(PropForecastParam
) THEN DO:
1924 RUN audit-line
( base-font
, "Can't find property parameter " + param-id
+ " for month " + STRING(growth-month.StartDate
) + ", property " + STRING(Property.PropertyCode
) + " month=" + STRING(growth-month.MonthCode
) ).
1925 FIND LAST PropForecastParam
WHERE PropForecastParam.PropertyCode
= default-property
1926 AND PropForecastParam.ParameterID
BEGINS param-id
1927 AND PropForecastParam.MonthCode
<= growth-month.MonthCode
NO-LOCK NO-ERROR.
1929 IF AVAILABLE(PropForecastParam
) THEN DO:
1930 /* RUN audit-line
( base-font
, "Using '" + PropForecastParam.ParameterValue
+ "' for " + param-id
+ " from date " + STRING( in-date
) ).
*/
1931 RETURN PropForecastParam.ParameterValue.
1934 RUN audit-line
( base-font
, "Parameter " + param-id
+ " not set for date " + STRING( in-date
) ).
1939 /* _UIB-CODE-BLOCK-END
*/
1944 &IF DEFINED(EXCLUDE-part-of-period) = 0 &THEN
1946 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION part-of-period Procedure
1947 FUNCTION part-of-period
RETURNS DECIMAL
1948 ( INPUT part-1
AS DATE, INPUT part-n
AS DATE ) :
1949 /*------------------------------------------------------------------------------
1952 ------------------------------------------------------------------------------*/
1953 DEF VAR period-days
AS DEC NO-UNDO.
1954 DEF VAR part-days
AS DEC NO-UNDO.
1956 period-days
= (growth-month.EndDate
- growth-month.StartDate
) + 1.
1958 IF part-n
= ?
OR part-n
> growth-month.EndDate
THEN
1959 part-n
= growth-month.EndDate.
1961 IF part-1
= ?
OR part-1
< growth-month.StartDate
THEN
1962 part-1
= growth-month.StartDate.
1964 part-days
= (part-n
- part-1
) + 1.
1966 RETURN (part-days
/ period-days
).
1970 /* _UIB-CODE-BLOCK-END
*/
1975 &IF DEFINED(EXCLUDE-process-action-end-after) = 0 &THEN
1977 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION process-action-end-after Procedure
1978 FUNCTION process-action-end-after
RETURNS CHARACTER
1979 ( /* no parameters
*/ ) :
1980 /*------------------------------------------------------------------------------
1982 ------------------------------------------------------------------------------*/
1983 rates.b-floor
= Action.ActionFloor.
1984 rates.b-parks
= Action.ActionParks.
1985 rates.b-other
= Action.ActionOther.
1987 Action.ActionFCFloor
= rates.b-floor
* growth-month.floor .
1988 Action.ActionFCParks
= rates.b-parks
* growth-month.parks .
1989 Action.ActionFCOther
= rates.b-other
* growth-month.other .
1991 rates.g-floor
= Action.ActionFCFloor
- Action.ActionFloor.
1992 rates.g-parks
= Action.ActionFCParks
- Action.ActionParks.
1993 rates.g-other
= Action.ActionFCOther
- Action.ActionOther.
1999 /* _UIB-CODE-BLOCK-END
*/
2004 &IF DEFINED(EXCLUDE-process-action-end-before) = 0 &THEN
2006 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION process-action-end-before Procedure
2007 FUNCTION process-action-end-before
RETURNS CHARACTER
2008 ( /* no parameters
*/ ) :
2009 /*------------------------------------------------------------------------------
2011 ------------------------------------------------------------------------------*/
2012 rates.pro-rate
= part-of-period
( growth-month.StartDate
, Action.ActionDate
).
2018 /* _UIB-CODE-BLOCK-END
*/
2023 &IF DEFINED(EXCLUDE-process-action-new) = 0 &THEN
2025 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION process-action-new Procedure
2026 FUNCTION process-action-new
RETURNS CHARACTER
2027 ( /* no parameters
*/ ) :
2028 /*------------------------------------------------------------------------------
2030 ------------------------------------------------------------------------------*/
2031 IF Action.ActionFCFloor
= 0 AND Action.ActionFCParks
= 0
2032 AND Action.ActionFCOther
= 0
2033 /* AND Action.ActionFloor
= 0
2034 AND Action.ActionParks
= 0 AND Action.ActionOther
= 0 */
2036 Action.ActionFCFloor
= rates.m-floor
* growth-month.floor .
2037 Action.ActionFCParks
= rates.m-parks
* growth-month.parks .
2038 Action.ActionFCOther
= rates.m-other
* growth-month.other .
2039 Action.ActionFloor
= Action.ActionFCFloor.
2040 Action.ActionParks
= Action.ActionFCParks.
2041 Action.ActionOther
= Action.ActionFCOther.
2044 rates.b-floor
= rates.m-floor.
2045 rates.b-parks
= rates.m-parks.
2046 rates.b-other
= rates.m-other.
2049 rates.g-floor
= Action.ActionFCFloor
- rates.b-floor.
2050 rates.g-parks
= Action.ActionFCParks
- rates.b-parks.
2051 rates.g-other
= Action.ActionFCOther
- rates.b-other.
2053 rates.pro-rate
= part-of-period
( Action.ActionDate
, growth-month.EndDate
).
2055 DEF VAR annual-rental
AS DEC NO-UNDO .
2056 DEF VAR agents-fees
AS DEC NO-UNDO .
2057 DEF VAR agents-fees-param
AS CHAR NO-UNDO .
2058 DEF VAR these-agents-fees
AS DEC NO-UNDO .
2059 annual-rental
= (Action.ActionFCFloor
+ Action.ActionFCParks
+ Action.ActionFCOther
) * 12 .
2060 agents-fees-param
= get-parameter
( 'Agents-Fees'
, Action.ActionDate
).
2061 IF agents-fees-param
= "" THEN
2062 these-agents-fees
= agents-fees-rate.
2064 these-agents-fees
= DEC( agents-fees-param
) NO-ERROR.
2065 IF these-agents-fees
= ?
THEN these-agents-fees
= agents-fees-rate .
2066 agents-fees
= annual-rental
* these-agents-fees .
2067 IF agents-fees
> 0 THEN DO:
2068 RUN update-pfc-entity
( agents-fees-account
, "AGNT", agents-fees
).
2069 RUN audit-line
( base-font
, "Agents fees of " + STRING(agents-fees
) + " applied to A/c " + STRING(agents-fees-account
,"9999.99") ).
2072 RUN audit-line
( base-font
, "Agents fees of 0 ("
2073 + TRIM(STRING(these-agents-fees
* 100, "->>>9.9%"))
2074 + " of " + TRIM(STRING( annual-rental
, "->>>,>>>,>>9.99"))
2075 + " - not applied" ).
2082 /* _UIB-CODE-BLOCK-END
*/
2087 &IF DEFINED(EXCLUDE-process-action-old) = 0 &THEN
2089 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION process-action-old Procedure
2090 FUNCTION process-action-old
RETURNS CHARACTER
2091 ( /* no parameters
*/ ) :
2092 /*------------------------------------------------------------------------------
2094 ------------------------------------------------------------------------------*/
2095 IF Action.ActionFCFloor
= 0 AND Action.ActionFCParks
= 0
2096 AND Action.ActionFCOther
= 0 AND Action.ActionFCFloor
= 0
2097 AND Action.ActionFCParks
= 0 AND Action.ActionFCOther
= 0
2099 Action.ActionFCFloor
= rates.m-floor
* growth-month.floor .
2100 Action.ActionFCParks
= rates.m-parks
* growth-month.parks .
2101 Action.ActionFCOther
= rates.m-other
* growth-month.other .
2102 Action.ActionFloor
= Action.ActionFCFloor.
2103 Action.ActionParks
= Action.ActionFCParks.
2104 Action.ActionOther
= Action.ActionFCOther.
2107 rates.b-floor
= Action.ActionFloor.
2108 rates.b-parks
= Action.ActionParks.
2109 rates.b-other
= Action.ActionOther.
2111 rates.g-floor
= Action.ActionFCFloor
- rates.b-floor.
2112 rates.g-parks
= Action.ActionFCParks
- rates.b-parks.
2113 rates.g-other
= Action.ActionFCOther
- rates.b-other.
2115 rates.pro-rate
= part-of-period
( Action.ActionDate
, growth-month.EndDate
).
2121 /* _UIB-CODE-BLOCK-END
*/
2126 &IF DEFINED(EXCLUDE-process-action-one) = 0 &THEN
2128 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION process-action-one Procedure
2129 FUNCTION process-action-one
RETURNS CHARACTER
2130 ( /* no parameters
*/ ) :
2131 /*------------------------------------------------------------------------------
2133 ------------------------------------------------------------------------------*/
2134 rates.b-floor
= Action.ActionFCFloor.
2135 rates.b-parks
= Action.ActionFCParks.
2136 rates.b-other
= Action.ActionFCOther.
2138 rates.g-floor
= Action.ActionFCFloor
- Action.ActionFloor.
2139 rates.g-parks
= Action.ActionFCParks
- Action.ActionParks.
2140 rates.g-other
= Action.ActionFCOther
- Action.ActionOther.
2146 /* _UIB-CODE-BLOCK-END
*/
2151 &IF DEFINED(EXCLUDE-process-action-rvw) = 0 &THEN
2153 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION process-action-rvw Procedure
2154 FUNCTION process-action-rvw
RETURNS CHARACTER
2155 ( /* no parameters
*/ ) :
2156 /*------------------------------------------------------------------------------
2158 ------------------------------------------------------------------------------*/
2159 DEF VAR total-rental
AS DEC NO-UNDO.
2160 DEF VAR total-fc
AS DEC NO-UNDO.
2162 DEF VAR apply-increase
AS LOGI
NO-UNDO INITIAL Yes.
2163 Action.ActionFCFloor
= rates.m-floor
* growth-month.floor .
2164 Action.ActionFCParks
= rates.m-parks
* growth-month.parks .
2165 Action.ActionFCOther
= rates.m-other
* growth-month.other .
2167 IF all-ratchets
OR NOT AVAILABLE(TenancyLease
) OR TenancyLease.HasRatchet
THEN DO:
2168 total-rental
= rates.b-floor
+ rates.b-parks
+ rates.b-other .
2169 total-fc
= Action.ActionFCFloor
+ Action.ActionFCParks
+ Action.ActionFCOther .
2171 IF total-fc
<= total-rental
THEN DO:
2172 RUN audit-line
( base-font
, "Forecast of " + STRING(total-fc
) + " is not greater than current rental of " + STRING( total-rental
) + " so increase not applied." ).
2173 apply-increase
= No.
2178 IF apply-increase
THEN DO:
2180 Action.ActionFloor
= Action.ActionFCFloor
2181 Action.ActionParks
= Action.ActionFCParks
2182 Action.ActionOther
= Action.ActionFCOther
2183 rates.g-floor
= Action.ActionFloor
- rates.b-floor
2184 rates.g-parks
= Action.ActionParks
- rates.b-parks
2185 rates.g-other
= Action.ActionOther
- rates.b-other.
2187 rates.pro-rate
= part-of-period
( Action.ActionDate
, growth-month.EndDate
).
2195 /* _UIB-CODE-BLOCK-END
*/
2200 &IF DEFINED(EXCLUDE-to-annual) = 0 &THEN
2202 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION to-annual Procedure
2203 FUNCTION to-annual
RETURNS DECIMAL
2204 ( INPUT freq-code
AS CHAR, INPUT period-amount
AS DEC ) :
2205 /*------------------------------------------------------------------------------
2206 Purpose
: Convert period amount to annual figure
2208 ------------------------------------------------------------------------------*/
2209 /* short circuit for most cases
*/
2210 IF freq-code
= "MNTH" THEN RETURN (period-amount
* 12.0).
2212 FIND FrequencyType
WHERE FrequencyType.FrequencyCode
= freq-code
NO-LOCK NO-ERROR.
2213 IF NOT AVAILABLE(FrequencyType
) THEN RETURN (period-amount
* 12.0).
/* assume monthly
! */
2215 IF FrequencyType.RepeatUnits
BEGINS "M" THEN
2216 RETURN ((period-amount
/ DEC(FrequencyType.UnitCount
)) * 12.0 ).
2218 RETURN ((period-amount
/ DEC(FrequencyType.UnitCount
)) * 365.0 ).
2222 /* _UIB-CODE-BLOCK-END
*/
2227 &IF DEFINED(EXCLUDE-to-month-rate) = 0 &THEN
2229 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION to-month-rate Procedure
2230 FUNCTION to-month-rate
RETURNS DECIMAL
2231 ( INPUT raw-percent
AS CHAR ) :
2232 /*------------------------------------------------------------------------------
2235 ------------------------------------------------------------------------------*/
2236 DEF VAR pc
AS DEC NO-UNDO.
2237 DEF VAR line
AS CHAR NO-UNDO.
2239 IF ( raw-percent
MATCHES '
*%*'
) THEN DO:
2240 raw-percent
= ENTRY( 1, raw-percent
, '
%'
).
2242 pc
= 1.0 + ( DEC(raw-percent
) / 100.0 ).
2244 /* line
= "Raw percent of: " + raw-percent
+ " converts to " + STRING( pc
).
*/
2245 pc
= EXP( pc
, one-twelfth
).
2247 /* line
= line
+ " which is: " + STRING( pc
) + " each month".
2248 RUN audit-line
( base-font
, line
).
*/
2254 /* _UIB-CODE-BLOCK-END
*/