Add blank column, rename column.
[capital-apms-progress.git] / process / report / schdsdny.p
blobdd1c6ff0fb0ff109429528d8e07fd7a8b2968b3c
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 File :
6 Purpose : Property Schedule for AGP
7 Author(s) : Andrew McMillan
8 Created :
9 Notes :
10 ------------------------------------------------------------------------*/
12 DEF INPUT PARAMETER report-options AS CHAR NO-UNDO.
14 /* for accumulating outgoing details over a property */
15 DEF WORK-TABLE bldg-og NO-UNDO LIKE OutgoingDescription.
16 DEF WORK-TABLE bldg-sublease NO-UNDO LIKE SubLease.
18 /* report option variables */
19 DEF VAR preview AS LOGICAL NO-UNDO.
20 DEF VAR total-all-levels AS LOGICAL NO-UNDO.
21 DEF VAR property-1 AS INTEGER NO-UNDO.
22 DEF VAR property-2 AS INTEGER NO-UNDO.
24 DEF VAR max-level-sequence AS INT INITIAL 999 NO-UNDO.
25 DEF VAR show-x-spaces AS LOGICAL INITIAL No NO-UNDO.
26 WHEN "Max Sequence" THEN max-level-sequence = INT(ENTRY(2,token)).
27 WHEN "Include 'X' spaces" THEN show-x-spaces = (ENTRY(2,token) = "Yes").
29 DEF VAR agent-version AS LOGICAL NO-UNDO.
30 RUN parse-parameters.
32 DEF VAR first-building AS LOGICAL INITIAL yes NO-UNDO.
33 DEF VAR user-name AS CHAR NO-UNDO.
34 {inc/username.i "user-name"}
36 &GLOB PAGE-WIDTH 245
37 DEF VAR timeStamp AS CHAR FORMAT "X(44)" NO-UNDO.
38 timeStamp = STRING( TODAY, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
39 DEF VAR hline2 AS CHAR NO-UNDO.
40 DEF VAR hline3 AS CHAR NO-UNDO.
41 DEF VAR hline4 AS CHAR NO-UNDO.
42 DEF VAR col-head1-base AS CHAR NO-UNDO.
43 DEF VAR col-head2-base AS CHAR NO-UNDO.
44 DEF VAR col-head1 AS CHAR NO-UNDO.
45 DEF VAR col-head2 AS CHAR NO-UNDO.
46 DEF VAR u-line AS CHAR NO-UNDO.
47 u-line = FILL("-",{&page-width} ).
48 DEF VAR e-line AS CHAR NO-UNDO.
49 e-line = FILL("=",{&page-width}).
50 &GLOB VERT-POS 73
51 col-head1-base = " <----------------------------------- Income Details ----------------------------------------> <---------- Lease Details ----------> <------------- Outgoings ------------>".
52 col-head2-base = "Level Lessee Area SqM Rental PSM Sundry PSM Gross PSM Parking No -----P.C.M.----- %age Description Base Amount".
55 &GLOB FIELD-COUNT 12
56 DEF VAR f AS CHAR EXTENT {&FIELD-COUNT} NO-UNDO. /* an array of the fields we will print */
57 DEF VAR f-fmt AS CHAR EXTENT {&FIELD-COUNT} NO-UNDO.
58 DEF VAR notes-fmt AS CHAR NO-UNDO.
59 DEF VAR notes-queue AS CHAR NO-UNDO.
60 ASSIGN
61 /************************************************************/
62 notes-fmt = "X(62)" /* equiv to f[1] + f[2] + f[3] */
63 /************************************************************/
64 f-fmt[1] = "X(6)" f-fmt[2] = "X(45)" /* level, name */
65 f-fmt[3] = "X(11)" f-fmt[4] = "X(41)" /* area, 1st rentals */
66 f-fmt[5] = "X(36)" f-fmt[6] = "X(22)" /* 2nd rentals, rent pcm*/
67 f-fmt[7] = "X(20)" f-fmt[8] = "X(33)" /* 1st lease, 2nd lease */
68 f-fmt[9] = "X(30)" f-fmt[10] = "X(8)" /* outgoings */
69 f-fmt[11] = "X(10)" f-fmt[12] = "X(4)" /* */
72 DEF VAR page-reset AS CHAR NO-UNDO INITIAL "reset,landscape,tm,1,a4,lm,4".
73 DEF VAR time-font AS CHAR NO-UNDO INITIAL "Helvetica,point,5,proportional,bold".
74 DEF VAR base-font AS CHAR NO-UNDO INITIAL "fixed,courier,cpi,23,lpi,12,normal".
75 DEF VAR property-header-font AS CHAR NO-UNDO INITIAL "Helvetica,point,16,proportional,bold".
76 DEF VAR page-header-font AS CHAR NO-UNDO INITIAL "Helvetica,point,12,proportional,bold".
77 DEF VAR error-font1 AS CHAR NO-UNDO INITIAL "courier,lpi,10,cpi,18,normal,bold,fixed".
78 DEF VAR error-font2 AS CHAR NO-UNDO INITIAL "courier,lpi,9,cpi,18,normal,italic,fixed".
80 /* Accumulators */
81 DEF VAR l-common AS DEC NO-UNDO INITIAL 0.
82 DEF VAR l-occupied AS DEC NO-UNDO INITIAL 0.
83 DEF VAR l-vacant AS DEC NO-UNDO INITIAL 0.
84 DEF VAR l-rental AS DEC NO-UNDO INITIAL 0.
85 DEF VAR l-area AS DEC NO-UNDO INITIAL 0.
86 DEF VAR l-og AS DEC NO-UNDO INITIAL 0.
87 DEF VAR l-sundry AS DEC NO-UNDO INITIAL 0.
88 DEF VAR l-pkrent AS DEC NO-UNDO INITIAL 0.
89 DEF VAR l-pkcount AS INT NO-UNDO INITIAL 0.
90 DEF VAR l-rent-yr AS DEC NO-UNDO INITIAL 0.
91 DEF VAR l-area-yr AS DEC NO-UNDO INITIAL 0.
92 DEF VAR l-percent AS DEC NO-UNDO INITIAL 0.
93 DEF VAR level-lines AS INT NO-UNDO INITIAL 0.
95 DEF VAR lease-years AS DEC NO-UNDO INITIAL 0.
96 DEF VAR lease-notes AS CHAR NO-UNDO.
97 DEF VAR lease-outgoings AS DEC NO-UNDO INITIAL 0.
99 DEF VAR b-common AS DEC NO-UNDO INITIAL 0.
100 DEF VAR b-occupied AS DEC NO-UNDO INITIAL 0.
101 DEF VAR b-vacant AS DEC NO-UNDO INITIAL 0.
102 DEF VAR b-rental AS DEC NO-UNDO INITIAL 0.
103 DEF VAR b-area AS DEC NO-UNDO INITIAL 0.
104 DEF VAR b-og AS DEC NO-UNDO INITIAL 0.
105 DEF VAR b-sundry AS DEC NO-UNDO INITIAL 0.
106 DEF VAR b-pkrent AS DEC NO-UNDO INITIAL 0.
107 DEF VAR b-pkcount AS INT NO-UNDO INITIAL 0.
108 DEF VAR b-rent-yr AS DEC NO-UNDO INITIAL 0.
109 DEF VAR b-area-yr AS DEC NO-UNDO INITIAL 0.
110 DEF VAR b-percent AS DEC NO-UNDO INITIAL 0.
112 DEF VAR last-level AS INT INITIAL -99999 NO-UNDO.
113 DEF VAR out-line AS CHAR NO-UNDO.
114 DEF VAR total-break AS INTEGER NO-UNDO INITIAL 90.
116 DEF VAR areas-processed AS CHAR NO-UNDO.
117 DEF VAR primary-space AS LOGICAL NO-UNDO.
119 DEF TEMP-TABLE SundryCharge NO-UNDO
120 FIELD LeaseCode AS INT INITIAL 999
121 FIELD Amount AS DEC INITIAL 0
122 FIELD Description AS CHAR INITIAL "Sundry"
123 INDEX XPKSundryCharges IS PRIMARY LeaseCode.
125 DEF TEMP-TABLE XRentReview NO-UNDO
126 FIELD LeaseCode AS INT INITIAL ?
127 FIELD ReviewDate AS DATE INITIAL ?
128 FIELD ReviewType AS CHAR INITIAL ""
129 INDEX XPKRentReviews IS PRIMARY LeaseCode ReviewDate.
131 DEF TEMP-TABLE LeaseDone NO-UNDO
132 FIELD LeaseCode AS INT
133 FIELD LevelNo AS INT
134 FIELD LevelSeq AS INT
135 FIELD OGBudget AS DEC INITIAL 0
136 FIELD OGPercent AS DEC INITIAL 0
137 FIELD LeasedArea AS DEC INITIAL 0
138 FIELD LeaseNotes AS CHAR
139 INDEX XPKLeasesDone IS UNIQUE PRIMARY LeaseCode
140 INDEX XAK1LevelSeq /* IS UNIQUE */ LevelNo LevelSeq.
142 DEF TEMP-TABLE HeadLease NO-UNDO
143 FIELD TenancyLeaseCode AS INT
144 FIELD HeadLeaseCode AS INT
145 FIELD AreaSize AS DEC INITIAL 0.0
146 FIELD AnnualRent AS DEC INITIAL 0.0
147 INDEX XPKLCode IS UNIQUE PRIMARY TenancyLeaseCode
148 INDEX XAKLCode HeadLeaseCode TenancyLeaseCode.
150 {inc/ofc-this.i}
151 {inc/ofc-set.i "Statutory-Expense-Accounts" "stat-accounts"}
152 {inc/ofc-set-l.i "Use-Rent-Charges" "use-rent-charges"}
153 {inc/ofc-set.i "Schedule-AGP-Agent-Excludes" "agent-exclude-types"}
155 {inc/ofc-set.i "RentCharge-Outgoings" "og-method"}
156 IF NOT AVAILABLE(OfficeSetting) THEN og-method = "".
157 {inc/ofc-set-l.i "RentCharge-OG-By-Lease" "charge-og-lease"}
158 IF NOT AVAILABLE(OfficeSetting) THEN charge-og-lease = Yes.
159 /* IF NOT charge-og-lease THEN og-method = "". */
161 /* _UIB-CODE-BLOCK-END */
162 &ANALYZE-RESUME
165 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
167 /* ******************** Preprocessor Definitions ******************** */
169 &Scoped-define PROCEDURE-TYPE Procedure
170 &Scoped-define DB-AWARE no
174 /* _UIB-PREPROCESSOR-BLOCK-END */
175 &ANALYZE-RESUME
178 /* ************************ Function Prototypes ********************** */
180 &IF DEFINED(EXCLUDE-head-lease) = 0 &THEN
182 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD head-lease Procedure
183 FUNCTION head-lease RETURNS INTEGER
184 ( INPUT lease-code AS INT ) FORWARD.
186 /* _UIB-CODE-BLOCK-END */
187 &ANALYZE-RESUME
189 &ENDIF
191 &IF DEFINED(EXCLUDE-to-annual) = 0 &THEN
193 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD to-annual Procedure
194 FUNCTION to-annual RETURNS DECIMAL
195 ( INPUT freq-type AS CHAR, INPUT period-amount AS DEC ) FORWARD.
197 /* _UIB-CODE-BLOCK-END */
198 &ANALYZE-RESUME
200 &ENDIF
203 /* *********************** Procedure Settings ************************ */
205 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
206 /* Settings for THIS-PROCEDURE
207 Type: Procedure
208 Allow:
209 Frames: 0
210 Add Fields to: Neither
211 Other Settings: CODE-ONLY COMPILE
213 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
215 /* ************************* Create Window ************************** */
217 &ANALYZE-SUSPEND _CREATE-WINDOW
218 /* DESIGN Window definition (used by the UIB)
219 CREATE WINDOW Procedure ASSIGN
220 HEIGHT = 24.55
221 WIDTH = 36.14.
222 /* END WINDOW DEFINITION */
224 &ANALYZE-RESUME
226 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
227 /* ************************* Included-Libraries *********************** */
229 {inc/null.i}
230 {inc/convert.i}
231 {inc/method/m-txtrep.i}
232 {inc/method/m-lease-rentals.i}
233 {inc/method/m-charged-rent.i}
235 /* _UIB-CODE-BLOCK-END */
236 &ANALYZE-RESUME
242 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
245 /* *************************** Main Block *************************** */
247 RUN pclrep-start( preview, page-reset + "," + base-font ).
248 OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES APPEND.
250 FOR EACH Property WHERE Property.Active AND Property.PropertyCode >= property-1
251 AND Property.PropertyCode <= property-2
252 AND Property.Active NO-LOCK:
253 RUN property-schedule.
254 END.
256 OUTPUT CLOSE.
258 RUN pclrep-finish.
260 ERROR-STATUS:ERROR = False.
261 RETURN "".
263 /* _UIB-CODE-BLOCK-END */
264 &ANALYZE-RESUME
267 /* ********************** Internal Procedures *********************** */
269 &IF DEFINED(EXCLUDE-build-head-leases) = 0 &THEN
271 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE build-head-leases Procedure
272 PROCEDURE build-head-leases :
273 /*------------------------------------------------------------------------------
274 Purpose:
275 ------------------------------------------------------------------------------*/
276 DEF BUFFER OtherSpace FOR RentalSpace.
277 DEF BUFFER OtherLease FOR HeadLease.
279 DEF VAR hlease AS INT NO-UNDO.
280 FOR EACH RentalSpace OF Property WHERE RentalSpace.AreaStatus = "L" NO-LOCK:
281 FIND TenancyLease OF RentalSpace NO-LOCK NO-ERROR.
283 IF NOT( AVAILABLE(TenancyLease) ) THEN DO:
284 RUN pclrep-line( error-font1, "Error: Rental space at level " + STRING(RentalSpace.Level) + "/" + STRING(RentalSpace.LevelSeq) + " "
285 + " - " + RentalSpace.Description + " - marked as 'leased', but no lease record is associated!").
286 NEXT.
287 END.
289 hlease = head-lease( RentalSpace.TenancyLeaseCode ).
290 IF hlease <> ? THEN NEXT.
291 other-space-loop:
292 FOR EACH OtherSpace OF Property WHERE OtherSpace.Level = RentalSpace.Level
293 AND OtherSpace.LevelSeq = RentalSpace.LevelSeq
294 AND OtherSpace.AreaStatus = "L" NO-LOCK:
295 hlease = head-lease( OtherSpace.TenancyLeaseCode ).
296 IF hlease <> ? THEN LEAVE other-space-loop.
297 END.
299 IF hlease = ? THEN hlease = RentalSpace.TenancyLeaseCode.
300 CREATE HeadLease.
301 HeadLease.TenancyLeaseCode = RentalSpace.TenancyLeaseCode.
302 HeadLease.HeadLeaseCode = hlease.
303 END.
305 FOR EACH HeadLease BY HeadLease.HeadLeaseCode:
306 FIND LeaseDone WHERE LeaseDone.LeaseCode = HeadLease.HeadLeaseCode NO-ERROR.
307 IF NOT AVAILABLE(LeaseDone) THEN DO:
308 CREATE LeaseDone.
309 LeaseDone.LeaseCode = HeadLease.HeadLeaseCode.
310 LeaseDone.LevelNo = ?.
311 LeaseDone.LevelSeq = ?.
312 END.
313 FIND TenancyLease OF HeadLease NO-LOCK.
314 IF CAN-FIND( FIRST RentalSpace OF TenancyLease WHERE CAN-FIND(FIRST AreaType OF RentalSpace WHERE AreaType.IsFloorArea) ) THEN ASSIGN
315 LeaseDone.OGPercent = LeaseDone.OGPercent + null-dec( TenancyLease.OutgoingsRate, 0.0).
317 FIND Note OF TenancyLease NO-LOCK NO-ERROR.
318 IF AVAILABLE(Note) THEN
319 LeaseDone.LeaseNotes = LeaseDone.LeaseNotes + TRIM(Note.Detail) + "~n".
321 FOR EACH RentCharge OF TenancyLease NO-LOCK:
322 IF agent-version AND LOOKUP( RentCharge.RentChargeType, agent-exclude-types) > 0 THEN
323 NEXT.
324 ELSE IF NOT charge-og-lease AND RentCharge.RentChargeType = og-method THEN DO:
325 IF show-future-rentals THEN DO:
326 FIND LAST RentChargeLine OF RentCharge WHERE RentChargeLine.RentChargeLineStatus = "C"
327 NO-LOCK NO-ERROR.
328 IF NOT AVAILABLE(RentChargeLine) OR (RentChargeLine.EndDate = RentChargeLine.LastChargedDate
329 AND RentChargeLine.LastChargedDate <> ? ) THEN
330 NEXT.
331 LeaseDone.OGBudget = LeaseDone.OGBudget + to-annual( RentChargeLine.FrequencyCode, RentChargeLine.Amount ).
332 END.
333 ELSE
334 LeaseDone.OGBudget = LeaseDone.OGBudget + RentCharge.CurrentAnnualRent .
335 END.
336 END.
337 END.
339 END PROCEDURE.
341 /* _UIB-CODE-BLOCK-END */
342 &ANALYZE-RESUME
344 &ENDIF
346 &IF DEFINED(EXCLUDE-clear-property) = 0 &THEN
348 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE clear-property Procedure
349 PROCEDURE clear-property :
350 /*------------------------------------------------------------------------------
351 Purpose: Clear the work-tables we are using for each property
352 ------------------------------------------------------------------------------*/
353 FOR EACH bldg-og: DELETE bldg-og. END.
354 FOR EACH bldg-sublease: DELETE bldg-sublease. END.
355 FOR EACH SundryCharge: DELETE SundryCharge. END.
356 FOR EACH XRentReview: DELETE XRentReview. END.
357 FOR EACH LeaseDone: DELETE LeaseDone. END.
358 FOR EACH HeadLease: DELETE HeadLease. END.
359 FOR EACH LeaseRental: DELETE LeaseRental. END.
360 FOR EACH AreaRental: DELETE AreaRental. END.
362 ASSIGN
363 b-common = 0 b-occupied = 0
364 b-vacant = 0 b-rental = 0
365 b-area = 0 b-sundry = 0
366 b-pkrent = 0 b-pkcount = 0
367 b-rent-yr = 0 b-area-yr = 0
368 b-percent = 0
371 notes-queue = "".
373 END PROCEDURE.
375 /* _UIB-CODE-BLOCK-END */
376 &ANALYZE-RESUME
378 &ENDIF
380 &IF DEFINED(EXCLUDE-each-rental-space) = 0 &THEN
382 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-rental-space Procedure
383 PROCEDURE each-rental-space :
384 /*------------------------------------------------------------------------------
385 Purpose:
386 ------------------------------------------------------------------------------*/
387 DEF VAR i AS INT NO-UNDO.
389 DO i = 1 TO {&FIELD-COUNT}: f[i] = "". END.
390 ASSIGN
391 lease-notes = ""
392 lease-years = 0
393 lease-outgoings = 0.
395 RUN set-lease-details.
396 RUN set-area-details.
398 END PROCEDURE.
400 /* _UIB-CODE-BLOCK-END */
401 &ANALYZE-RESUME
403 &ENDIF
405 &IF DEFINED(EXCLUDE-get-last-notes) = 0 &THEN
407 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-last-notes Procedure
408 PROCEDURE get-last-notes :
409 /*------------------------------------------------------------------------------
410 Purpose: Collect together various pieces of inforrmation as notes
411 ------------------------------------------------------------------------------*/
412 DEF VAR a-line AS CHAR NO-UNDO.
413 DEF VAR various-notes AS CHAR NO-UNDO INITIAL "".
416 /* outgoings for the building */
417 IF CAN-FIND( FIRST bldg-og ) THEN DO:
418 various-notes = various-notes + CHR(10) + "Outgoings" + CHR(10) + "---------" + CHR(10).
419 FOR EACH bldg-og BY bldg-og.Description:
420 various-notes = various-notes + STRING( bldg-og.Percentage, ">>>>>>9.99 ") + bldg-og.Description + CHR(10).
421 END.
422 END.
424 /* sub leases for the building */
425 IF CAN-FIND( FIRST bldg-sublease ) THEN DO:
426 various-notes = various-notes + CHR(10) + "Sub Leases" + CHR(10) + "----------" + CHR(10).
427 FOR EACH bldg-sublease:
428 FIND TenancyLease OF bldg-sublease NO-LOCK.
429 FIND Tenant OF Tenancylease NO-LOCK NO-ERROR.
430 various-notes = various-notes + (IF AVAILABLE(Tenant) THEN Tenant.Name ELSE "Tenant not on file") + CHR(10).
431 various-notes = various-notes + " To: " + bldg-sublease.Name + CHR(10).
432 a-line = (IF bldg-sublease.AnnualRental > 0 THEN (" Rent:" + STRING( bldg-sublease.AnnualRental, ">>>>>>>>>.99")) ELSE "")
433 + (IF bldg-sublease.LeaseStartDate > DATE(1,1,1) THEN (" Start:" + STRING( bldg-sublease.LeaseStartDate, "99/99/9999")) ELSE "")
434 + (IF bldg-sublease.LeaseEndDate > DATE(1,1,1) THEN (" End:" + STRING( bldg-sublease.LeaseEndDate, "99/99/9999")) ELSE "").
435 IF TRIM(a-line) <> "" THEN various-notes = various-notes + a-line + CHR(10).
436 IF TRIM(bldg-sublease.Detail) <> "" THEN various-notes = various-notes + bldg-sublease.Detail + CHR(10).
437 various-notes = various-notes + CHR(10).
438 END.
439 various-notes = various-notes + CHR(10).
440 END.
442 /* frontages for the building */
443 IF CAN-FIND( FIRST StreetFrontage WHERE StreetFrontage.PropertyCode = Property.PropertyCode ) THEN DO:
444 various-notes = various-notes + CHR(10) + "Frontages" + CHR(10) + "---------" + CHR(10).
445 FOR EACH StreetFrontage WHERE StreetFrontage.PropertyCode = Property.PropertyCode NO-LOCK:
446 various-notes = various-notes + STRING( StreetFrontage.Length, ">>>>>>9.99m ") + StreetFrontage.Description + CHR(10).
447 END.
448 END.
450 END PROCEDURE.
452 /* _UIB-CODE-BLOCK-END */
453 &ANALYZE-RESUME
455 &ENDIF
457 &IF DEFINED(EXCLUDE-get-notes) = 0 &THEN
459 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-notes Procedure
460 PROCEDURE get-notes :
461 /*------------------------------------------------------------------------------
462 Purpose:
463 ------------------------------------------------------------------------------*/
464 DEF INPUT PARAMETER note-code AS INTEGER NO-UNDO.
465 DEF OUTPUT PARAMETER note-detail AS CHAR NO-UNDO.
467 DEF VAR i AS INT NO-UNDO.
468 DEF VAR no-notes AS INT NO-UNDO.
470 /* search the list of notes already display for this property
471 *** no longer used ***
472 no-notes = NUM-ENTRIES( notes-list).
473 DO i = 1 TO no-notes:
474 IF note-code = INTEGER(ENTRY(i,notes-list)) THEN DO:
475 note-detail = "see note [" + TRIM( STRING( i, ">>9")) + "] above.".
476 note-code = 0.
477 RETURN.
478 END.
479 END.
482 IF note-code <> ? THEN DO:
483 /* IF notes-list <> "" THEN notes-list = notes-list + ",".
484 notes-list = notes-list + TRIM(STRING( note-code, ">>>>>>>9")).
486 FIND Note WHERE Note.NoteCode = note-code NO-LOCK NO-ERROR.
487 note-detail = (IF AVAILABLE(Note)
488 THEN /* "[" + TRIM( STRING(no-notes + 1, ">>9")) + "] "
489 + */ TRIM( REPLACE( Note.Detail, "~r", "") )
490 ELSE "" ).
491 END.
492 ELSE
493 note-detail = "".
495 END PROCEDURE.
497 /* _UIB-CODE-BLOCK-END */
498 &ANALYZE-RESUME
500 &ENDIF
502 &IF DEFINED(EXCLUDE-inst-page-header) = 0 &THEN
504 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-header Procedure
505 PROCEDURE inst-page-header :
506 /*------------------------------------------------------------------------------
507 Purpose:
508 ------------------------------------------------------------------------------*/
510 RUN pclrep-line( time-font, timeStamp ).
511 RUN pclrep-line( base-font, hline2 ).
512 RUN pclrep-line( base-font, hline3 ).
513 RUN pclrep-line( base-font, hline4 ).
514 RUN pclrep-down-by( 1 ).
515 RUN pclrep-line( base-font, col-head1 ).
516 RUN pclrep-line( base-font, col-head2 ).
517 RUN pclrep-down-by( 0.6 ).
519 END PROCEDURE.
521 /* _UIB-CODE-BLOCK-END */
522 &ANALYZE-RESUME
524 &ENDIF
526 &IF DEFINED(EXCLUDE-new-level) = 0 &THEN
528 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE new-level Procedure
529 PROCEDURE new-level :
530 /*------------------------------------------------------------------------------
531 Purpose:
532 ------------------------------------------------------------------------------*/
533 DEF INPUT PARAMETER last-level AS INT NO-UNDO.
534 DEF INPUT PARAMETER next-level AS INT NO-UNDO.
536 DEF VAR out-line AS CHAR NO-UNDO.
537 DEF VAR level-units AS CHAR NO-UNDO.
538 DEF VAR level-code AS CHAR NO-UNDO.
540 IF last-level <> -99999 AND (level-lines > 1 OR total-all-levels) THEN DO:
541 RUN print-line( u-line ).
542 IF l-area = 0 THEN l-area = 2000000001.
543 out-line = "Level Common:" + STRING( l-common, "->>,>>9.999")
544 + " Occupied:" + STRING( l-occupied, "->>,>>9.999")
545 + FILL( " ", 10)
546 + STRING( l-rental, "->>>>>>>9.99")
547 + STRING( (l-rental / l-area), "->>>>9.99")
548 + STRING( l-sundry, "->>>>>>9.99")
549 + STRING( (l-sundry / l-area), "->>>>9.99")
550 + STRING( (l-rental + l-og), "->>>>>>>9.99")
551 + STRING( null-dec((l-rental + l-og) / l-occupied, 0.0), "->>>>9.99")
552 + STRING( l-pkrent, "->>>>>9.99")
553 + STRING( l-pkcount, "->>>>9") + FILL(" ",5)
554 + STRING( ((l-rental + l-sundry + l-pkrent) / 12), "->,>>>,>>9.99") + FILL(" ",47)
555 + STRING( l-percent, ">>9.99" )
557 RUN print-line( out-line ).
558 level-code = IF last-level = 0 THEN " G" ELSE
559 ( IF last-level = 90 THEN " PK" ELSE
560 ( IF last-level = 80 THEN " B" ELSE
561 ( IF last-level > 80 AND last-level < 90 THEN " B" + STRING(last-level - 80) ELSE
562 STRING( last-level, "->9")))).
563 out-line = level-code
564 + " Total:" + STRING( l-occupied + l-vacant + l-common, "->>,>>9.999")
565 + " Vacant:" + STRING( l-vacant, "->>,>>9.999") + FILL(" ",93)
566 + STRING( (l-rental + l-sundry + l-pkrent), "->,>>>,>>9.99") + " P.A."
568 RUN print-line( out-line ).
569 END.
570 IF (level-lines > 1 OR total-all-levels) THEN RUN print-line( u-line ).
571 RUN pclrep-down-by(1).
573 ASSIGN
574 b-common = b-common + l-common
575 b-occupied = b-occupied + l-occupied
576 b-vacant = b-vacant + l-vacant
577 b-rental = b-rental + l-rental
578 b-og = b-og + l-og
579 b-area = b-area + (IF l-area > 2000000000 THEN 0 ELSE l-area)
580 b-sundry = b-sundry + l-sundry
581 b-pkrent = b-pkrent + l-pkrent
582 b-pkcount = b-pkcount + l-pkcount
583 b-rent-yr = b-rent-yr + l-rent-yr
584 b-area-yr = b-area-yr + l-area-yr
585 b-percent = b-percent + l-percent
587 l-common = 0
588 l-occupied = 0
589 l-vacant = 0
590 l-og = 0
591 l-rental = 0
592 l-area = 0
593 l-sundry = 0
594 l-pkrent = 0
595 l-pkcount = 0
596 l-rent-yr = 0
597 l-area-yr = 0
598 l-percent = 0
601 level-lines = 0.
603 END PROCEDURE.
605 /* _UIB-CODE-BLOCK-END */
606 &ANALYZE-RESUME
608 &ENDIF
610 &IF DEFINED(EXCLUDE-new-sundrycharge) = 0 &THEN
612 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE new-sundrycharge Procedure
613 PROCEDURE new-sundrycharge :
614 /*------------------------------------------------------------------------------
615 Purpose:
616 ------------------------------------------------------------------------------*/
617 DEF INPUT PARAMETER contract-rental AS DEC NO-UNDO.
618 DEF INPUT PARAMETER area-type AS CHAR NO-UNDO.
619 DEF INPUT PARAMETER default-description AS CHAR NO-UNDO.
620 DEF INPUT PARAMETER lease-code AS INT NO-UNDO.
622 CREATE SundryCharge.
623 SundryCharge.LeaseCode = lease-code.
624 SundryCharge.Amount = contract-rental.
626 IF default-description = "" THEN DO:
627 FIND RentChargeType WHERE RentChargeType = area-type NO-LOCK NO-ERROR.
628 IF AVAILABLE(RentChargeType) THEN
629 default-description = RentChargeType.Description.
630 END.
632 FIND AreaType WHERE AreaType.AreaType = area-type NO-LOCK NO-ERROR.
633 IF area-type = "S" AND default-description <> "" THEN
634 SundryCharge.Description = default-description.
635 ELSE IF AVAILABLE(AreaType) THEN
636 SundryCharge.Description = AreaType.Description.
637 ELSE
638 SundryCharge.Description = default-description.
640 END PROCEDURE.
642 /* _UIB-CODE-BLOCK-END */
643 &ANALYZE-RESUME
645 &ENDIF
647 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
649 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
650 PROCEDURE parse-parameters :
651 /*------------------------------------------------------------------------------
652 Purpose:
653 ------------------------------------------------------------------------------*/
654 DEF VAR token AS CHAR NO-UNDO.
655 DEF VAR i AS INT NO-UNDO.
657 {inc/showopts.i "report-options"}
659 DO i = 1 TO NUM-ENTRIES( report-options, "~n" ):
660 token = ENTRY( i, report-options, "~n" ).
662 CASE ENTRY( 1, token ):
663 WHEN "Preview" THEN preview = (ENTRY(2,token) = "Yes").
664 WHEN "Total Every Level" THEN total-all-levels = (ENTRY(2,token) = "Yes").
665 WHEN "Show Future Rentals" THEN show-future-rentals = (ENTRY(2,token) = "Yes").
666 WHEN "Properties" THEN ASSIGN
667 property-1 = INT(ENTRY(2,token))
668 property-2 = INT(ENTRY(3,token)) .
669 END CASE.
671 END.
672 all-future-rentals = show-future-rentals.
674 END PROCEDURE.
676 /* _UIB-CODE-BLOCK-END */
677 &ANALYZE-RESUME
679 &ENDIF
681 &IF DEFINED(EXCLUDE-print-areas) = 0 &THEN
683 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-areas Procedure
684 PROCEDURE print-areas :
685 /*------------------------------------------------------------------------------
686 Purpose:
687 ------------------------------------------------------------------------------*/
688 DEF VAR fval AS CHAR NO-UNDO.
689 DEF VAR i AS INT NO-UNDO.
690 DEF VAR notes-lines AS INT NO-UNDO.
691 DEF VAR lines-done AS LOGICAL INITIAL No NO-UNDO.
692 DEF VAR l-no AS INT NO-UNDO.
693 DEF VAR notes-start AS INT NO-UNDO.
695 areas-processed = "".
697 RUN build-head-leases.
699 rental-space-loop:
700 FOR EACH RentalSpace OF Property NO-LOCK WHERE (RentalSpace.AreaStatus <> "X")
701 BY RentalSpace.PropertyCode BY RentalSpace.Level BY RentalSpace.LevelSequence:
702 IF LOOKUP( STRING( RentalSpace.RentalSpaceCode), areas-processed ) > 0 THEN NEXT.
703 IF RentalSpace.Level <> last-level THEN DO:
704 RUN new-level ( last-level, RentalSpace.Level ).
705 last-level = RentalSpace.Level.
706 END.
707 ELSE
708 RUN pclrep-down-by( 1 ).
710 /* MESSAGE RentalSpace.Level RentalSpace.LevelSequence
711 RentalSpace.AreaType RentalSpace.Description . */
712 RUN each-rental-space.
714 IF RentalSpace.AreaStatus = "C" THEN DO:
715 level-lines = level-lines + 1.
716 NEXT. /* skip printout of common areas */
717 END.
718 RUN word-wrap( f[2], 50, OUTPUT f[2]).
720 lines-done = No.
721 l-no = 1.
722 notes-start = NUM-ENTRIES( f[2], "~n") + 2.
723 notes-lines = NUM-ENTRIES( lease-notes, "~n" ).
724 IF TRIM(lease-notes) = "" THEN notes-start = ?.
725 IF notes-lines > 4 THEN DO:
726 notes-queue = notes-queue + STRING(RentalSpace.TenancyLeaseCode) + ",".
727 lease-notes = "See detailed notes at end of report".
728 END.
729 DO WHILE NOT lines-done:
730 out-line = "".
731 DO i = 1 TO {&FIELD-COUNT}:
732 ASSIGN fval = ""
733 fval = ENTRY( l-no, f[i], "~n") NO-ERROR.
734 IF fval = ? THEN fval = "".
735 IF i < 3 AND notes-start <> ? AND l-no >= notes-start THEN DO:
736 i = 3.
737 fval = ENTRY( 1 + l-no - notes-start, lease-notes, "~n") NO-ERROR.
738 IF fval = ? THEN fval = "".
739 out-line = out-line + STRING( fval, notes-fmt ).
740 END.
741 ELSE
742 out-line = out-line + STRING( fval, f-fmt[i] ).
743 END.
744 /* MESSAGE out-line. */
746 IF TRIM(out-line) = "" AND (notes-start = ? OR l-no > notes-start) THEN DO:
747 lines-done = Yes.
748 END.
749 ELSE
750 RUN print-line( out-line ).
752 l-no = l-no + 1.
753 END.
754 level-lines = level-lines + 1.
755 END.
756 RUN new-level( last-level, 99999 ).
757 RUN pclrep-down-by(2).
759 /* Print building totals */
760 RUN print-line( e-line ).
761 IF l-area = 0 THEN l-area = 2000000001.
762 out-line = "Grand Common:" + STRING( b-common, "->>,>>9.999")
763 + " Occupied:" + STRING( b-occupied, "->>,>>9.999")
764 + FILL( " ", 10)
765 + STRING( b-rental, "->>>>>>>9.99")
766 + STRING( (b-rental / b-area), "->>>>9.99")
767 + STRING( b-sundry, "->>>>>>9.99")
768 + STRING( (b-sundry / b-area), "->>>>9.99")
769 + STRING( (b-rental + b-og), "->>>>>>>9.99")
770 + STRING( ((b-rental + b-og) / b-occupied), "->>>>9.99")
771 + STRING( b-pkrent, "->>>>>9.99")
772 + STRING( b-pkcount, "->>>>9") + FILL(" ",5)
773 + STRING( ((b-rental + b-sundry + b-pkrent) / 12), "->,>>>,>>9.99") + FILL(" ",47)
774 + STRING( b-percent, ">>9.99" )
776 RUN print-line( out-line ).
777 out-line = "Total Total:" + STRING( b-occupied + b-vacant + b-common, "->>,>>9.999")
778 + " Vacant:" + STRING( b-vacant, "->>,>>9.999") + FILL(" ",93)
779 + STRING( (b-rental + b-sundry + b-pkrent), "->,>>>,>>9.99") + " P.A."
781 RUN print-line( out-line ).
782 RUN print-line( e-line ).
784 END PROCEDURE.
786 /* _UIB-CODE-BLOCK-END */
787 &ANALYZE-RESUME
789 &ENDIF
791 &IF DEFINED(EXCLUDE-print-bldg-notes) = 0 &THEN
793 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-bldg-notes Procedure
794 PROCEDURE print-bldg-notes :
795 /*------------------------------------------------------------------------------
796 Purpose: Print the building notes page
797 ------------------------------------------------------------------------------*/
798 DEF VAR no-of AS INT NO-UNDO.
799 DEF VAR no-queue AS INT NO-UNDO.
800 DEF VAR i AS INT NO-UNDO.
801 DEF VAR j AS INT NO-UNDO.
803 DEF VAR notes AS CHAR NO-UNDO.
805 no-queue = NUM-ENTRIES(notes-queue) - 1. /* has a trailing comma */
806 DO j = 1 TO no-queue:
807 FIND TenancyLease WHERE TenancyLease.TenancyLeaseCode = INT(ENTRY( j, notes-queue )) NO-LOCK NO-ERROR.
808 IF AVAILABLE(TenancyLease) THEN DO:
809 FIND Note WHERE Note.NoteCode = TenancyLease.NoteCode NO-LOCK NO-ERROR.
810 IF AVAILABLE(Note) THEN DO:
811 RUN pclrep-down-by(2).
812 out-line = "Detailed Lease notes for T"
813 + TRIM(STRING(TenancyLease.TenantCode))
814 + " - "
815 + TenancyLease.AreaDescription .
816 RUN print-line( out-line ).
817 out-line = FILL( "-", LENGTH(out-line) ).
818 RUN print-line( out-line ).
819 RUN pclrep-down-by(0.45).
820 RUN word-wrap( Note.Detail, 150, OUTPUT notes).
821 no-of = NUM-ENTRIES( notes, "~n").
822 DO i = 1 TO no-of:
823 out-line = FILL( " ", 20) + ENTRY( i, notes, "~n").
824 RUN print-line( out-line ).
825 END.
826 END.
827 END.
828 END.
830 FIND Note WHERE Note.NoteCode = Property.NoteCode NO-LOCK NO-ERROR.
831 IF AVAILABLE(Note) THEN DO:
832 RUN pclrep-down-by(2).
833 out-line = "Building notes for P"
834 + TRIM(STRING(Property.PropertyCode))
835 + " - "
836 + Property.Name .
837 RUN print-line( out-line ).
838 out-line = FILL( "-", LENGTH(out-line) ).
839 RUN print-line( out-line ).
840 RUN pclrep-down-by(0.8).
841 RUN word-wrap( Note.Detail, 150, OUTPUT notes).
842 no-of = NUM-ENTRIES( notes, "~n").
843 DO i = 1 TO no-of:
844 out-line = FILL( " ", 20) + ENTRY( i, notes, "~n").
845 RUN print-line( out-line ).
846 END.
847 END.
849 END PROCEDURE.
851 /* _UIB-CODE-BLOCK-END */
852 &ANALYZE-RESUME
854 &ENDIF
856 &IF DEFINED(EXCLUDE-print-line) = 0 &THEN
858 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-line Procedure
859 PROCEDURE print-line :
860 /*------------------------------------------------------------------------------
861 Purpose: Print a line of output
862 ------------------------------------------------------------------------------*/
863 DEF INPUT PARAMETER the-line AS CHAR NO-UNDO.
865 RUN pclrep-line( base-font, RIGHT-TRIM(the-line)).
867 END PROCEDURE.
869 /* _UIB-CODE-BLOCK-END */
870 &ANALYZE-RESUME
872 &ENDIF
874 &IF DEFINED(EXCLUDE-print-notes) = 0 &THEN
876 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-notes Procedure
877 PROCEDURE print-notes :
878 /*------------------------------------------------------------------------------
879 Purpose: Print the notes
880 ------------------------------------------------------------------------------*/
881 DEF INPUT PARAMETER left-notes AS CHAR NO-UNDO.
882 DEF INPUT PARAMETER right-notes AS CHAR NO-UNDO.
884 DEF VAR out-line AS CHAR NO-UNDO.
885 DEF VAR one-note AS CHAR NO-UNDO.
887 DEF VAR no-lines AS INT NO-UNDO.
888 no-lines = NUM-ENTRIES( left-notes, CHR(10)).
889 IF no-lines < NUM-ENTRIES( right-notes, CHR(10)) THEN no-lines = NUM-ENTRIES( right-notes, CHR(10)).
891 DEF VAR l-no AS INTEGER INITIAL 1 NO-UNDO.
892 DO l-no = 1 TO no-lines:
893 ASSIGN one-note = ""
894 one-note = ENTRY( l-no, left-notes, CHR(10)) NO-ERROR.
895 IF one-note = ? THEN one-note = "".
896 out-line = ' ' + STRING( one-note, "X(70)") + ' '.
898 ASSIGN one-note = ""
899 one-note = ENTRY( l-no, right-notes, CHR(10)) NO-ERROR.
900 IF one-note = ? THEN one-note = "".
901 out-line = out-line + ' ' + STRING( one-note, "X(100)").
903 RUN print-line( out-line ).
904 END.
906 END PROCEDURE.
908 /* _UIB-CODE-BLOCK-END */
909 &ANALYZE-RESUME
911 &ENDIF
913 &IF DEFINED(EXCLUDE-property-schedule) = 0 &THEN
915 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE property-schedule Procedure
916 PROCEDURE property-schedule :
917 /*------------------------------------------------------------------------------
918 Purpose: Schedule for a single building
919 ------------------------------------------------------------------------------*/
921 RUN clear-property.
922 RUN set-headings.
923 RUN build-lease-rentals.
925 RUN print-areas.
926 RUN print-bldg-notes.
927 RUN pclrep-page-break.
929 END PROCEDURE.
931 /* _UIB-CODE-BLOCK-END */
932 &ANALYZE-RESUME
934 &ENDIF
936 &IF DEFINED(EXCLUDE-put-blank-line) = 0 &THEN
938 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE put-blank-line Procedure
939 PROCEDURE put-blank-line :
940 /*------------------------------------------------------------------------------
941 Purpose: Put a blank line - with a vertical in it?
942 ------------------------------------------------------------------------------*/
943 DEF VAR out-line AS CHAR NO-UNDO.
944 out-line = FILL(' ',{&VERT-POS}).
945 RUN print-line( out-line, ?).
946 END PROCEDURE.
948 /* _UIB-CODE-BLOCK-END */
949 &ANALYZE-RESUME
951 &ENDIF
953 &IF DEFINED(EXCLUDE-set-area-details) = 0 &THEN
955 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE set-area-details Procedure
956 PROCEDURE set-area-details :
957 /*------------------------------------------------------------------------------
958 Purpose:
959 ------------------------------------------------------------------------------*/
960 DEF BUFFER AltSpace FOR RentalSpace.
962 DEF VAR area-rental AS DECIMAL NO-UNDO INITIAL 0.
963 DEF VAR area-area AS DECIMAL NO-UNDO INITIAL 0.
964 DEF VAR area-og AS DECIMAL NO-UNDO INITIAL 0.
965 DEF VAR level-area AS DECIMAL NO-UNDO INITIAL 0.
966 DEF VAR level-og AS DECIMAL NO-UNDO INITIAL 0.
967 DEF VAR level-rental AS DECIMAL NO-UNDO INITIAL 0.
968 DEF VAR level-sundry AS DECIMAL NO-UNDO INITIAL 0.
969 DEF VAR level-parks AS INTEGER NO-UNDO INITIAL 0.
970 DEF VAR level-pk-rent AS DECIMAL NO-UNDO INITIAL 0.
971 DEF VAR sundry-desc AS CHAR NO-UNDO INITIAL "".
972 DEF VAR sundry-amnt AS CHAR NO-UNDO INITIAL "".
973 DEF VAR parking-desc AS CHAR NO-UNDO INITIAL "".
975 DEF VAR lease-rental AS DECIMAL NO-UNDO INITIAL 0.
976 DEF VAR lease-og AS DECIMAL NO-UNDO INITIAL 0.
977 DEF VAR lease-sundry AS DECIMAL NO-UNDO INITIAL 0.
978 DEF VAR lease-cleaning AS DECIMAL NO-UNDO INITIAL 0.
979 DEF VAR lease-area AS DECIMAL NO-UNDO INITIAL 0.
980 DEF VAR space-type AS CHAR NO-UNDO.
981 DEF VAR future-values AS LOGI NO-UNDO INITIAL NO.
983 f[1] = TRIM( IF RentalSpace.Level = 0 THEN "G" ELSE
984 ( IF RentalSpace.Level = 90 THEN "PK" ELSE
985 ( IF RentalSpace.Level = 80 THEN "B" ELSE
986 ( IF RentalSpace.Level > 80 AND RentalSpace.Level < 90 THEN "B" + STRING(RentalSpace.Level - 80) ELSE
987 STRING(RentalSpace.Level) ))))
988 + "-" + TRIM(STRING(RentalSpace.LevelSequence)).
989 RUN test-floor-space( RentalSpace.AreaType, RentalSpace.AreaSize ).
990 area-rental = get-area-rental( RentalSpace.PropertyCode, RentalSpace.RentalSpaceCode ).
991 IF RETURN-VALUE = "Park" THEN DO:
992 parking-desc = parking-desc + "~nCar parking fees"
993 + STRING( area-rental, "->>>>>>>>9.99")
994 + STRING( RentalSpace.AreaSize, ">>>>>9").
995 level-parks = level-parks + RentalSpace.AreaSize.
996 level-pk-rent = level-pk-rent + area-rental.
997 END.
998 ELSE IF RETURN-VALUE = "Yes" THEN DO:
999 level-area = level-area + RentalSpace.AreaSize.
1000 level-rental = level-rental + area-rental.
1001 area-area = RentalSpace.AreaSize.
1002 END.
1003 ELSE
1004 RUN set-sundry-space( RentalSpace.AreaType, RentalSpace.Description, area-rental, INPUT-OUTPUT sundry-desc, INPUT-OUTPUT sundry-amnt, INPUT-OUTPUT level-sundry ).
1006 IF primary-space THEN DO:
1007 FOR EACH LeaseRental WHERE LeaseRental.LeaseCode = TenancyLease.TenancyLeaseCode
1008 AND LeaseRental.AreaCount = 0:
1009 IF LeaseRental.AreaType BEGINS "X" THEN NEXT.
1010 FIND AreaType WHERE AreaType.AreaType = LeaseRental.AreaType NO-LOCK NO-ERROR.
1011 IF AVAILABLE(AreaType) THEN
1012 space-type = AreaType.Description.
1013 ELSE DO:
1014 FIND RentChargeType WHERE RentChargeType.RentChargeType = LeaseRental.AreaType NO-LOCK NO-ERROR.
1015 IF AVAILABLE(RentChargeType) THEN
1016 space-type = RentChargeType.Description.
1017 ELSE
1018 space-type = LeaseRental.AreaType.
1019 END.
1020 /* MESSAGE LeaseRental.AreaType og-method LeaseRental.AnnualRent . */
1021 IF LeaseRental.AreaType = og-method THEN ASSIGN
1022 level-og = level-og + LeaseRental.AnnualRent
1023 lease-og = lease-og + LeaseRental.AnnualRent.
1024 RUN set-sundry-space( "S", space-type, LeaseRental.AnnualRent, INPUT-OUTPUT sundry-desc, INPUT-OUTPUT sundry-amnt, INPUT-OUTPUT level-sundry ).
1025 END.
1026 future-values = CAN-FIND( FIRST LeaseRental WHERE LeaseRental.LeaseCode = TenancyLease.TenancyLeaseCode AND LeaseRental.Future ).
1027 END.
1029 IF RentalSpace.AreaStatus <> "C" AND RentalSpace.AreaStatus <> "V" THEN DO:
1030 areas-processed = (IF areas-processed = "" THEN "" ELSE (areas-processed + ",")) + STRING(RentalSpace.RentalSpaceCode).
1031 FOR EACH AltSpace WHERE RentalSpace.PropertyCode = AltSpace.PropertyCode
1032 AND RentalSpace.Level = AltSpace.Level
1033 AND (AltSpace.AreaStatus <> "X")
1034 AND RentalSpace.TenancyLeaseCode = AltSpace.TenancyLeaseCode
1035 AND AltSpace.TenancyLeaseCode > 0
1036 AND RentalSpace.RentalSpaceCode <> AltSpace.RentalSpaceCode
1037 NO-LOCK:
1038 IF LOOKUP( STRING( AltSpace.RentalSpaceCode), areas-processed ) > 0 THEN NEXT.
1040 RUN test-floor-space( AltSpace.AreaType, AltSpace.AreaSize).
1041 space-type = RETURN-VALUE.
1042 IF level-area <> 0 AND space-type = "Yes" THEN NEXT.
1044 areas-processed = areas-processed + "," + STRING(AltSpace.RentalSpaceCode).
1045 area-rental = get-area-rental( AltSpace.PropertyCode, AltSpace.RentalSpaceCode ).
1046 IF space-type = "Park" THEN DO:
1047 parking-desc = parking-desc + "~nCar parking fees"
1048 + STRING( area-rental, "->>>>>>>>9.99")
1049 + STRING( AltSpace.AreaSize, ">>>>>9").
1050 level-parks = level-parks + AltSpace.AreaSize.
1051 level-pk-rent = level-pk-rent + area-rental.
1052 END.
1053 ELSE IF space-type = "Yes" THEN DO:
1054 level-area = level-area + AltSpace.AreaSize.
1055 level-rental = level-rental + area-rental.
1056 END.
1057 ELSE DO:
1058 RUN set-sundry-space( AltSpace.AreaType, AltSpace.Description, area-rental, INPUT-OUTPUT sundry-desc, INPUT-OUTPUT sundry-amnt, INPUT-OUTPUT level-sundry ).
1059 END.
1060 END.
1061 END.
1063 /* Work out totals for whole of lease in this building */
1064 ASSIGN lease-area = 0 lease-rental = 0 lease-sundry = 0 lease-cleaning = 0 .
1065 FOR EACH AltSpace WHERE RentalSpace.PropertyCode = AltSpace.PropertyCode
1066 AND RentalSpace.TenancyLeaseCode = AltSpace.TenancyLeaseCode
1067 NO-LOCK:
1068 RUN test-floor-space( AltSpace.AreaType, AltSpace.AreaSize).
1069 space-type = RETURN-VALUE.
1070 area-rental = get-area-rental( AltSpace.PropertyCode, AltSpace.RentalSpaceCode ).
1071 IF space-type = "Yes" THEN ASSIGN
1072 lease-area = lease-area + AltSpace.AreaSize
1073 lease-rental = lease-rental + area-rental.
1074 ELSE IF space-type = "No" THEN DO:
1075 lease-sundry = lease-sundry + area-rental.
1076 IF AltSpace.AreaType = 'L' THEN lease-cleaning = lease-cleaning + area-rental.
1077 END.
1078 END.
1079 /* Charges which are not associatable with an area must be sundry (e.g. O/G) */
1080 FOR EACH LeaseRental WHERE LeaseRental.LeaseCode = RentalSpace.TenancyLeaseCode
1081 AND LeaseRental.AreaCount = 0:
1082 IF LeaseRental.AreaType BEGINS "X" THEN NEXT.
1083 lease-sundry = lease-sundry + LeaseRental.AnnualRent.
1084 IF LeaseRental.AreaType = 'L' THEN lease-cleaning = lease-cleaning + LeaseRental.AnnualRent.
1085 END.
1087 IF level-area <> 0 THEN f[3] = STRING( level-area, ">>,>>9.999").
1088 f[4] = STRING( level-rental, "->>>>>9.99")
1089 + STRING( (IF level-area <> 0 THEN (level-rental / level-area) ELSE 0), "->>>>9.99")
1090 + (IF level-sundry = 0
1091 THEN ""
1092 ELSE ( STRING( level-sundry, "->>>>>>9.99")
1093 /* + STRING( (IF lease-area <> 0 THEN (level-sundry / lease-area) ELSE 0 ), "->>>>9.99") */ )
1096 IF level-sundry <> 0 THEN DO:
1097 DEF VAR i AS INT NO-UNDO.
1098 DEF VAR tmp-amount AS DECIMAL NO-UNDO.
1100 sundry-amnt = SUBSTRING( sundry-amnt, 2).
1101 sundry-desc = SUBSTRING( sundry-desc, 2).
1102 DO i = 1 TO NUM-ENTRIES(sundry-amnt):
1103 tmp-amount = DECIMAL( ENTRY( i, sundry-amnt) ).
1104 f[4] = f[4] + "~n" + STRING( ENTRY( i, sundry-desc, "~n"), "X(20)")
1105 + STRING( tmp-amount, "->>>>>9.99")
1106 + STRING( (IF lease-area <> 0 THEN (tmp-amount / (IF ENTRY( i, sundry-desc, "~n") = "Cleaning Charges" THEN level-area ELSE lease-area)) ELSE 0 ), "->>>>9.99").
1107 END.
1109 IF primary-space THEN
1110 f[5] = STRING( lease-rental + lease-og, "->>>>>9.99")
1111 + STRING( (IF lease-area <> 0 THEN ((lease-rental + lease-og) / lease-area) ELSE 0 ), "->>>>9.99").
1112 END.
1113 ELSE
1114 f[5] = FILL( " ", 19).
1116 IF level-parks <> 0 THEN
1117 f[5] = f[5] + STRING( level-pk-rent, ">>>>>>9.99")
1118 + STRING( level-parks , ">>>>>9").
1120 f[5] = f[5] + parking-desc.
1122 f[6] = (IF level-rental <> 0 THEN
1123 ("~nRental:" + STRING( level-rental / 12, "->>>>>9.99")) ELSE "")
1124 + (IF level-sundry <> 0 THEN
1125 ("~nSundry:" + STRING( level-sundry / 12, "->>>>>9.99")) ELSE "")
1126 + (IF (level-rental <> 0) AND (level-sundry <> 0) THEN
1127 ("~n Total:" + STRING( (level-rental + level-sundry) / 12, "->>>>>9.99")) ELSE "")
1128 + (IF level-pk-rent <> 0 THEN
1129 ("~n Park:" + STRING( level-pk-rent / 12, "->>>>>9.99")) ELSE "")
1130 + (IF level-parks <> 0 THEN
1131 ("~n P.Av:" + STRING( (level-pk-rent / level-parks) / 12, "->>>>>9.99")) ELSE "").
1132 f[6] = SUBSTRING( f[6], 2).
1133 IF future-values THEN
1134 f[6] = f[6] + "~n(future rental)".
1136 l-area = l-area + level-area.
1137 l-pkcount = l-pkcount + level-parks.
1139 IF RentalSpace.AreaStatus = "V" THEN ASSIGN
1140 l-vacant = l-vacant + level-area
1141 f[4] = "" f[6] = "" f[5] = ""
1142 f[8] = FILL( " ", 22) + (IF RentalSpace.OutgoingsPercentage <> 0 THEN STRING( RentalSpace.OutgoingsPercentage, ">>9.99") ELSE "")
1143 l-percent = l-percent + RentalSpace.OutgoingsPercentage.
1144 ELSE IF RentalSpace.AreaStatus = "C" THEN ASSIGN
1145 l-common = l-common + level-area
1146 f[4] = "" f[6] = "" .
1147 ELSE ASSIGN
1148 l-rental = l-rental + level-rental
1149 l-og = l-og + level-og
1150 l-sundry = l-sundry + level-sundry
1151 l-pkrent = l-pkrent + level-pk-rent
1152 l-occupied = l-occupied + level-area.
1155 MESSAGE f[1] REPLACE(f[2],"~n"," ") level-rental level-sundry level-rental level-area level-pk-rent level-parks level-og.
1158 END PROCEDURE.
1160 /* _UIB-CODE-BLOCK-END */
1161 &ANALYZE-RESUME
1163 &ENDIF
1165 &IF DEFINED(EXCLUDE-set-headings) = 0 &THEN
1167 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE set-headings Procedure
1168 PROCEDURE set-headings :
1169 /*------------------------------------------------------------------------------
1170 Purpose: Set the headings for the building schedule report.
1171 ------------------------------------------------------------------------------*/
1172 DEF VAR pos AS INT NO-UNDO.
1173 DEF VAR pw AS INT NO-UNDO.
1174 DEF VAR pwformat AS CHAR NO-UNDO.
1176 pw = {&page-width}.
1177 pwformat = "X(" + STRING( pw ) + ")".
1179 FIND Company WHERE Company.CompanyCode = Property.CompanyCode NO-LOCK NO-ERROR.
1180 ASSIGN
1181 hline2 = (IF AVAILABLE(Company) THEN Company.LegalName ELSE "No Company Assigned")
1182 hline3 = Property.Name + " (P" + TRIM( STRING( Property.PropertyCode, ">>>>9")) + ")"
1183 hline4 = Property.StreetAddress
1184 col-head1 = col-head1-base
1185 col-head2 = col-head2-base
1188 Replace-EOL-With-Commas:
1189 DO WHILE TRUE:
1190 pos = INDEX( hline4, CHR(10)).
1191 IF pos > 0 THEN
1192 hline4 = SUBSTRING( hline4, 1, pos - 1) + ", " + SUBSTRING( hline4, pos + 1).
1193 ELSE
1194 LEAVE Replace-EOL-With-Commas.
1195 END.
1196 hline2 = SUBSTRING( STRING("", pwformat), 1, INTEGER((pw - LENGTH(hline2) ) / 2)) + hline2.
1197 hline3 = SUBSTRING( STRING("", pwformat), 1, INTEGER((pw - LENGTH(hline3) ) / 2)) + hline3.
1198 hline4 = SUBSTRING( STRING("", pwformat), 1, INTEGER((pw - LENGTH(hline4) ) / 2)) + hline4.
1200 IF first-building THEN DO:
1201 VIEW FRAME heading-frame.
1202 first-building = no.
1203 END.
1204 ELSE DO:
1205 PAGE.
1206 END.
1208 END PROCEDURE.
1210 /* _UIB-CODE-BLOCK-END */
1211 &ANALYZE-RESUME
1213 &ENDIF
1215 &IF DEFINED(EXCLUDE-set-lease-details) = 0 &THEN
1217 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE set-lease-details Procedure
1218 PROCEDURE set-lease-details :
1219 /*------------------------------------------------------------------------------
1220 Purpose:
1221 ------------------------------------------------------------------------------*/
1222 DEF VAR i AS INT NO-UNDO.
1223 DEF VAR n AS INT NO-UNDO.
1224 DEF VAR options AS CHAR NO-UNDO.
1225 DEF VAR opt-ex AS DATE NO-UNDO.
1227 IF RentalSpace.AreaStatus = "V" THEN DO:
1228 f[2] = "* * * Vacant * * *~n" + RentalSpace.Description.
1229 RETURN.
1230 END.
1231 IF RentalSpace.AreaStatus = "C" THEN DO:
1232 f[2] = "* * * Common * * *~n" + RentalSpace.Description.
1233 RETURN.
1234 END.
1236 FIND TenancyLease OF RentalSpace WHERE TenancyLease.LeaseStatus <> "PAST" NO-LOCK NO-ERROR.
1238 IF NOT AVAILABLE(TenancyLease) THEN DO:
1239 f[2] = "Lease not on file!~n" + RentalSpace.Description.
1240 RETURN.
1241 END.
1242 RUN set-tenant-details.
1243 FIND LeaseDone WHERE LeaseDone.LeaseCode = TenancyLease.TenancyLeaseCode NO-ERROR.
1244 IF NOT AVAILABLE(LeaseDone) THEN DO:
1245 CREATE LeaseDone.
1246 LeaseDone.LeaseCode = TenancyLease.TenancyLeaseCode.
1247 END.
1249 lease-years = TenancyLease.LeaseEndDate - TODAY.
1250 IF lease-years < 0 THEN lease-years = 1 / 12.
1252 primary-space = (TenancyLease.PrimarySpace = RentalSpace.RentalSpaceCode).
1253 IF NOT primary-space THEN DO:
1254 DEF BUFFER OtherSpace FOR RentalSpace.
1255 FIND FIRST OtherSpace OF TenancyLease
1256 WHERE OtherSpace.RentalSpaceCode = TenancyLease.PrimarySpace
1257 OR (OtherSpace.LevelSequence <= RentalSpace.LevelSequence
1258 AND OtherSpace.RentalSpaceCode < RentalSpace.RentalSpaceCode
1259 AND OtherSpace.Level <= RentalSpace.Level)
1260 NO-LOCK NO-ERROR .
1261 primary-space = NOT AVAILABLE(OtherSpace).
1262 END.
1263 IF NOT primary-space THEN RETURN.
1265 RUN get-notes( TenancyLease.NoteCode, OUTPUT lease-notes ).
1266 RUN word-wrap( lease-notes, 62, OUTPUT lease-notes ).
1268 f[7] = "Commence:" + STRING( TenancyLease.LeaseStartDate, "99/99/9999")
1269 + "~n Expires:" + (IF TenancyLease.LeaseEndDate = ? OR TenancyLease.LeaseEndDate < TODAY THEN " monthly"
1270 ELSE STRING( TenancyLease.LeaseEndDate, "99/99/9999")).
1271 FIND FIRST RentReview OF TenancyLease WHERE RentReview.ReviewStatus <> "DONE"
1272 AND RentReview.DateDue <> ? NO-LOCK NO-ERROR.
1273 IF AVAILABLE(RentReview) THEN DO:
1274 f[7] = f[7] + "~n Review:" + STRING( RentReview.DateDue, "99/99/9999").
1275 IF RentReview.Earliest <> ? THEN
1276 f[7] = f[7] + "~nEarliest:" + STRING( RentReview.Earliest, "99/99/9999").
1277 IF RentReview.Latest <> ? THEN
1278 f[7] = f[7] + "~n Latest:" + STRING( RentReview.Latest, "99/99/9999").
1279 END.
1281 FIND FIRST LeaseType WHERE LeaseType.LeaseType = TenancyLease.LeaseType NO-LOCK NO-ERROR.
1282 RUN set-outgoing-list. /* sets f[8] to min outgoings */
1284 options = TenancyLease.RightsOfRenewal.
1285 IF options = "none" OR TenancyLease.RORNoticePeriod = ? OR options = "" THEN DO:
1286 options = "none".
1287 opt-ex = ?.
1288 END.
1289 ELSE DO:
1290 DEF VAR yy AS INT NO-UNDO.
1291 DEF VAR mm AS INT NO-UNDO.
1292 DEF VAR dd AS INT NO-UNDO.
1293 yy = YEAR(TenancyLease.LeaseEndDate).
1294 mm = MONTH(TenancyLease.LeaseEndDate) - TenancyLease.RORNoticePeriod .
1295 dd = DAY(TenancyLease.LeaseEndDate).
1296 IF mm < 1 THEN ASSIGN mm = mm + 12 yy = yy - 1 .
1297 ASSIGN opt-ex = DATE( mm, dd, yy) NO-ERROR.
1298 IF opt-ex = ? OR
1299 MONTH(TenancyLease.LeaseEndDate) <> MONTH(TenancyLease.LeaseEndDate + 1) THEN DO:
1300 ASSIGN mm = mm + 1
1301 dd = 1.
1302 IF mm > 12 THEN ASSIGN mm = 1 yy = yy + 1.
1303 opt-ex = DATE( mm, dd, yy ) - 1.
1304 END.
1305 END.
1307 n = TRUNCATE( (TenancyLease.LeaseEndDate - TenancyLease.LeaseStartDate) / 365.25, 0 ).
1308 i = INTEGER((((TenancyLease.LeaseEndDate - TenancyLease.LeaseStartDate) / 365.25) - n ) * 12).
1309 IF n = ? THEN n = 0.
1310 IF i = ? THEN i = 1.
1311 IF i = 12 THEN ASSIGN n = n + 1 i = 0 .
1312 f[8] = " Life:" + STRING( TRIM( STRING( n, ">>>9")) + "-" + TRIM( STRING( i, ">9")), "X(15)")
1313 + f[8]
1314 + "~nOption:" + TenancyLease.RightsOfRenewal
1315 + (IF options = "none" THEN "" ELSE ("~n OptEx:" + STRING( opt-ex, "99/99/9999")))
1316 + "~n Basis:" + (IF AVAILABLE(RentReview) THEN RentReview.EstimateBasis ELSE "")
1317 + "~n Type:" + (IF AVAILABLE(LeaseType) THEN LeaseType.Description ELSE "").
1319 i = NUM-ENTRIES(f[7], "~n").
1320 n = NUM-ENTRIES(f[8], "~n").
1322 IF ( i < n ) THEN
1323 f[7] = f[7] + FILL("~n", n - i) .
1324 ELSE IF n < i THEN
1325 f[8] = f[8] + FILL("~n", i - n) .
1327 i = LENGTH( STRING("", f-fmt[7]) ).
1328 FOR EACH Guarantor NO-LOCK OF TenancyLease, FIRST Person NO-LOCK OF Guarantor :
1329 options = "Guarantee:" + Guarantor.Type + " "
1330 + TRIM(STRING( Guarantor.Limit, ">>,>>>,>>9")) + " ".
1331 options = options + (IF Guarantor.Type = "I" THEN Person.FirstName + " " + Person.LastName ELSE Person.Company).
1332 f[7] = f[7] + "~n" + SUBSTRING(options, 1, i).
1333 f[8] = f[8] + "~n" + SUBSTRING(options, i + 1).
1334 END.
1336 END PROCEDURE.
1338 /* _UIB-CODE-BLOCK-END */
1339 &ANALYZE-RESUME
1341 &ENDIF
1343 &IF DEFINED(EXCLUDE-set-outgoing-list) = 0 &THEN
1345 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE set-outgoing-list Procedure
1346 PROCEDURE set-outgoing-list :
1347 /*------------------------------------------------------------------------------
1348 Purpose:
1349 ------------------------------------------------------------------------------*/
1350 DEF VAR base-names AS CHAR NO-UNDO INITIAL " Council, Water,Land Tax, General".
1351 DEF VAR base-dates AS DATE EXTENT 4 INITIAL ? NO-UNDO.
1352 DEF VAR base-amnts AS DEC EXTENT 4 INITIAL 0 NO-UNDO.
1353 DEF VAR min-percent AS DEC INITIAL 0 NO-UNDO.
1354 DEF VAR offset AS INT NO-UNDO.
1355 DEF VAR og-total AS DEC INITIAL 0 NO-UNDO.
1357 FOR EACH TenancyOutgoing OF TenancyLease NO-LOCK:
1359 IF TenancyOutgoing.Percentage <> ? THEN DO:
1360 IF TenancyOutgoing.Percentage <> 0 AND
1361 (TenancyOutgoing.Percentage < min-percent OR min-percent = 0)
1362 THEN
1363 min-percent = TenancyOutgoing.Percentage.
1364 END.
1366 CASE TenancyOutgoing.AccountCode:
1367 WHEN 201.00 THEN /* Council */ offset = 1.
1368 WHEN 202.00 THEN /* Water */ offset = 2.
1369 WHEN 203.00 THEN /* Land Tax */ offset = 3.
1370 OTHERWISE /* General */ offset = 4.
1371 END CASE.
1373 IF TenancyOutgoing.BaseYear <> ?
1374 AND (base-dates[offset] = ?
1375 OR base-dates[offset] > TenancyOutgoing.BaseYear)
1376 THEN
1377 base-dates[offset] = TenancyOutgoing.BaseYear.
1379 base-amnts[offset] = base-amnts[offset] + TenancyOutgoing.BaseYearAmount.
1380 END.
1382 DO offset = 1 TO 4:
1383 f[9] = f[9] + "~n" + ENTRY( offset, base-names) + ":"
1384 + (IF base-dates[offset] <> ? THEN STRING( base-dates[offset], "99/99/9999") ELSE FILL(" ",10) )
1385 + (IF base-amnts[offset] <> 0 THEN STRING( base-amnts[offset], ">>>>>>>>9") ELSE "" ).
1386 og-total = og-total + base-amnts[offset].
1387 END.
1388 f[9] = SUBSTRING( f[9], 2).
1389 IF og-total <> 0 THEN DO:
1390 f[9] = f[9] + "~n ---------"
1391 + "~n Total: " + STRING( og-total, ">>>>>>>>9").
1392 END.
1394 IF TenancyLease.OutgoingsRate <> ? AND TenancyLease.OutgoingsRate <> 0 THEN
1395 min-percent = TenancyLease.OutgoingsRate.
1396 f[8] = (IF min-percent <> 0 THEN STRING( min-percent, ">>9.99") ELSE "").
1397 l-percent = l-percent + min-percent.
1399 END PROCEDURE.
1401 /* _UIB-CODE-BLOCK-END */
1402 &ANALYZE-RESUME
1404 &ENDIF
1406 &IF DEFINED(EXCLUDE-set-sundry-space) = 0 &THEN
1408 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE set-sundry-space Procedure
1409 PROCEDURE set-sundry-space :
1410 /*------------------------------------------------------------------------------
1411 Purpose:
1412 ------------------------------------------------------------------------------*/
1413 DEF INPUT PARAMETER itype AS CHAR NO-UNDO.
1414 DEF INPUT PARAMETER idesc AS CHAR NO-UNDO.
1415 DEF INPUT PARAMETER irent AS DECIMAL NO-UNDO.
1416 DEF INPUT-OUTPUT PARAMETER s-desc AS CHAR NO-UNDO.
1417 DEF INPUT-OUTPUT PARAMETER s-amnt AS CHAR NO-UNDO.
1418 DEF INPUT-OUTPUT PARAMETER s-rent AS DECIMAL NO-UNDO.
1420 DEF VAR area-desc AS CHAR NO-UNDO.
1421 CASE itype:
1422 WHEN "S" THEN area-desc = idesc.
1423 WHEN "L" THEN area-desc = "Cleaning Charges".
1424 OTHERWISE DO:
1425 FIND AreaType WHERE AreaType.AreaType = itype NO-LOCK NO-ERROR.
1426 area-desc = (IF AVAILABLE(AreaType) THEN AreaType.Description ELSE idesc).
1427 END.
1428 END CASE.
1430 s-desc = s-desc + "~n" + area-desc.
1431 s-amnt = s-amnt + "," + STRING( irent, "->>>>>9.99").
1432 s-rent = s-rent + irent.
1434 END PROCEDURE.
1436 /* _UIB-CODE-BLOCK-END */
1437 &ANALYZE-RESUME
1439 &ENDIF
1441 &IF DEFINED(EXCLUDE-set-tenant-details) = 0 &THEN
1443 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE set-tenant-details Procedure
1444 PROCEDURE set-tenant-details :
1445 /*------------------------------------------------------------------------------
1446 Purpose: Get the tenant of the lease.
1447 ------------------------------------------------------------------------------*/
1448 FIND Tenant OF TenancyLease NO-LOCK NO-ERROR.
1449 IF AVAILABLE(Tenant) THEN DO:
1450 f[2] = Tenant.Name + " (T" + STRING( Tenant.TenantCode ) + ")~n"
1451 + RentalSpace.Description.
1452 END.
1453 ELSE
1454 f[2] = "Tenant not on file!~n" + RentalSpace.Description.
1456 END PROCEDURE.
1458 /* _UIB-CODE-BLOCK-END */
1459 &ANALYZE-RESUME
1461 &ENDIF
1463 &IF DEFINED(EXCLUDE-test-floor-space) = 0 &THEN
1465 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE test-floor-space Procedure
1466 PROCEDURE test-floor-space :
1467 /*------------------------------------------------------------------------------
1468 Purpose: Decide if this is actual floor space
1469 ------------------------------------------------------------------------------*/
1470 DEF INPUT PARAMETER type AS CHAR NO-UNDO.
1471 DEF INPUT PARAMETER area AS DECIMAL NO-UNDO.
1473 DEF BUFFER LocAreaType FOR AreaType.
1475 IF area = ? THEN RETURN "No".
1476 FIND LocAreaType WHERE LocAreaType.AreaType = type NO-LOCK NO-ERROR.
1477 IF AVAILABLE(LocAreaType) THEN DO:
1478 IF LocAreaType.IsCarPark THEN RETURN "Park".
1479 IF LocAreaType.IsFloorArea THEN RETURN "Yes".
1480 RETURN "No".
1481 END.
1483 CASE type:
1484 WHEN "C" THEN RETURN "Park".
1485 WHEN "O" THEN RETURN "Yes".
1486 WHEN "R" THEN RETURN "Yes".
1487 WHEN "W" THEN RETURN "Yes".
1488 WHEN "N" THEN RETURN "No".
1489 /* OTHERWISE
1490 IF area > 10 OR (area <> INTEGER(area)) THEN RETURN "Yes". */
1491 END CASE.
1493 RETURN "No".
1495 END PROCEDURE.
1497 /* _UIB-CODE-BLOCK-END */
1498 &ANALYZE-RESUME
1500 &ENDIF
1502 /* ************************ Function Implementations ***************** */
1504 &IF DEFINED(EXCLUDE-head-lease) = 0 &THEN
1506 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION head-lease Procedure
1507 FUNCTION head-lease RETURNS INTEGER
1508 ( INPUT lease-code AS INT ) :
1509 /*------------------------------------------------------------------------------
1510 Purpose: Convert a lease code into the appropriate head lease
1511 ------------------------------------------------------------------------------*/
1512 FIND HeadLease WHERE HeadLease.TenancyLeaseCode = lease-code NO-ERROR.
1513 IF AVAILABLE(HeadLease) THEN
1514 RETURN HeadLease.HeadLeaseCode.
1515 ELSE
1516 RETURN ?.
1518 END FUNCTION.
1520 /* _UIB-CODE-BLOCK-END */
1521 &ANALYZE-RESUME
1523 &ENDIF
1525 &IF DEFINED(EXCLUDE-to-annual) = 0 &THEN
1527 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION to-annual Procedure
1528 FUNCTION to-annual RETURNS DECIMAL
1529 ( INPUT freq-type AS CHAR, INPUT period-amount AS DEC ) :
1530 /*------------------------------------------------------------------------------
1531 Purpose: Return an annualised conversion of the amount.
1532 Notes:
1533 ------------------------------------------------------------------------------*/
1534 DEF VAR annual-amount AS DEC NO-UNDO.
1536 FIND FrequencyType WHERE FrequencyType.FrequencyCode = freq-type NO-LOCK.
1538 annual-amount = ((period-amount / FrequencyType.UnitCount) * (IF FrequencyType.RepeatUnits = "D" THEN 365 ELSE 12)).
1540 RETURN annual-amount.
1542 END FUNCTION.
1544 /* _UIB-CODE-BLOCK-END */
1545 &ANALYZE-RESUME
1547 &ENDIF