Changes for PDF support.
[capital-apms-progress.git] / process / report / schdppg.p
blob9643a3efb199316550e41a7a01c85f48d4fc7910
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 File :
6 Purpose :
7 Author(s) :
8 Created :
9 Notes :
10 ------------------------------------------------------------------------*/
12 DEF INPUT PARAMETER report-options AS CHAR NO-UNDO.
14 DEF VAR preview AS LOGICAL NO-UNDO.
15 DEF VAR exporting AS LOGICAL NO-UNDO INITIAL No.
16 DEF VAR debug-mode AS LOGICAL NO-UNDO INITIAL No.
17 DEF VAR for-agents AS LOGICAL NO-UNDO INITIAL No.
18 DEF VAR file-name AS CHAR NO-UNDO INITIAL ?.
19 DEF VAR selection-style AS CHAR NO-UNDO INITIAL "RP".
20 DEF VAR show-warnings AS LOGI NO-UNDO INITIAL No.
21 DEF VAR show-future-charges AS LOGI NO-UNDO INITIAL No.
22 DEF VAR level-summaries AS LOGI NO-UNDO INITIAL No.
23 DEF VAR property-1 AS INTEGER NO-UNDO.
24 DEF VAR property-n AS INTEGER NO-UNDO.
25 DEF VAR run-date AS DATE NO-UNDO.
26 DEF VAR sortby AS CHAR NO-UNDO.
27 RUN parse-parameters.
29 DEF VAR no-on-level AS INT NO-UNDO.
30 DEF VAR printing-tenancies AS LOGI NO-UNDO INITIAL No.
32 DEF VAR building-rental AS DEC NO-UNDO.
33 DEF VAR building-floor AS DEC NO-UNDO.
34 DEF VAR building-parks AS DEC NO-UNDO.
36 DEF VAR base-font AS CHAR NO-UNDO INITIAL "courier,lpi,12,cpi,23,normal,fixed".
37 DEF VAR tenancies-font AS CHAR NO-UNDO INITIAL "courier,lpi,9.6,cpi,17,normal,fixed".
38 DEF VAR overview-font AS CHAR NO-UNDO INITIAL "courier,lpi,7,cpi,14,normal,fixed".
39 DEF VAR page-reset AS CHAR NO-UNDO INITIAL "reset,landscape,lm,3,tm,4".
40 DEF VAR disclaimer-font AS CHAR NO-UNDO INITIAL "Times,point,6,proportional,normal".
41 DEF VAR page-header-font AS CHAR NO-UNDO INITIAL "Helvetica,point,12,proportional,bold".
42 DEF VAR error-font1 AS CHAR NO-UNDO INITIAL "courier,lpi,10,cpi,18,normal,bold,fixed".
43 DEF VAR error-font2 AS CHAR NO-UNDO INITIAL "courier,lpi,9,cpi,18,normal,italic,fixed".
45 DEFINE TEMP-TABLE Tenancies NO-UNDO
46 FIELD Level AS INT
47 FIELD LevelSeq AS INT
48 FIELD AreaStatus AS CHAR
49 FIELD AreaDescription AS CHAR
50 FIELD TenantName AS CHAR
51 FIELD TenantCode AS INT
52 FIELD LeaseCode AS INT
53 FIELD Quality AS INT
54 FIELD FloorArea AS DEC
55 FIELD NoCarparks AS DEC
56 FIELD MiscArea AS DEC
57 FIELD FloorAreaLeased AS DEC
58 FIELD NoCarparksLeased AS DEC
59 FIELD FloorRent AS DEC
60 FIELD ParkRent AS DEC
61 FIELD MiscRent AS DEC
62 FIELD Expiry AS DATE
63 FIELD YearsToRun AS DEC
64 FIELD NextReview AS DATE
65 FIELD Renewal AS CHAR
66 FIELD NetLease AS LOGI
67 FIELD MarketPSF AS DEC
68 FIELD MarketPPK AS DEC
69 INDEX XPKTenancies IS UNIQUE PRIMARY Level LevelSeq TenantCode LeaseCode.
71 DEF VAR month-1 AS INT NO-UNDO.
72 DEF VAR month-n AS INT NO-UNDO.
73 FIND LAST Month WHERE Month.EndDate < TODAY NO-LOCK.
74 FIND FinancialYear OF Month NO-LOCK.
75 FIND FIRST Month OF FinancialYear NO-LOCK.
76 month-1 = Month.MonthCode.
77 FIND LAST Month OF FinancialYear NO-LOCK.
78 month-n = Month.MonthCode.
80 {inc/ofc-this.i}
81 {inc/ofc-set.i "Area-Units" "area-units"}
82 DEF VAR area-units-short AS CHAR NO-UNDO.
83 IF NOT AVAILABLE(OfficeSetting) THEN ASSIGN
84 area-units = "Sq.M".
85 area-units-short = LOWER( "P" + REPLACE( REPLACE( area-units, "Q", ""), ".", "")).
87 /* _UIB-CODE-BLOCK-END */
88 &ANALYZE-RESUME
91 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
93 /* ******************** Preprocessor Definitions ******************** */
95 &Scoped-define PROCEDURE-TYPE Procedure
96 &Scoped-define DB-AWARE no
100 /* _UIB-PREPROCESSOR-BLOCK-END */
101 &ANALYZE-RESUME
104 /* ************************ Function Prototypes ********************** */
106 &IF DEFINED(EXCLUDE-amount-and-psf) = 0 &THEN
108 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD amount-and-psf Procedure
109 FUNCTION amount-and-psf RETURNS CHARACTER
110 ( INPUT amount AS DEC ) FORWARD.
112 /* _UIB-CODE-BLOCK-END */
113 &ANALYZE-RESUME
115 &ENDIF
117 &IF DEFINED(EXCLUDE-get-account-budget) = 0 &THEN
119 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-account-budget Procedure
120 FUNCTION get-account-budget RETURNS DECIMAL
121 ( INPUT et AS CHAR, INPUT ec AS INT, INPUT ac AS DEC, INPUT m-1 AS INT, INPUT m-n AS INT ) FORWARD.
123 /* _UIB-CODE-BLOCK-END */
124 &ANALYZE-RESUME
126 &ENDIF
128 &IF DEFINED(EXCLUDE-get-annual-amount) = 0 &THEN
130 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-annual-amount Procedure
131 FUNCTION get-annual-amount RETURNS DECIMAL
132 ( INPUT period-amount AS DEC, INPUT freq-type AS CHAR ) FORWARD.
134 /* _UIB-CODE-BLOCK-END */
135 &ANALYZE-RESUME
137 &ENDIF
139 &IF DEFINED(EXCLUDE-get-level-code) = 0 &THEN
141 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-level-code Procedure
142 FUNCTION get-level-code RETURNS CHARACTER
143 ( INPUT l-no AS INT, INPUT l-seq AS INT ) FORWARD.
145 /* _UIB-CODE-BLOCK-END */
146 &ANALYZE-RESUME
148 &ENDIF
150 &IF DEFINED(EXCLUDE-sum-group) = 0 &THEN
152 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD sum-group Procedure
153 FUNCTION sum-group RETURNS DECIMAL
154 ( INPUT group-list AS CHAR, INPUT pattern AS CHAR, INPUT amt-type AS CHAR ) FORWARD.
156 /* _UIB-CODE-BLOCK-END */
157 &ANALYZE-RESUME
159 &ENDIF
162 /* *********************** Procedure Settings ************************ */
164 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
165 /* Settings for THIS-PROCEDURE
166 Type: Procedure
167 Allow:
168 Frames: 0
169 Add Fields to: Neither
170 Other Settings: CODE-ONLY COMPILE
172 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
174 /* ************************* Create Window ************************** */
176 &ANALYZE-SUSPEND _CREATE-WINDOW
177 /* DESIGN Window definition (used by the UIB)
178 CREATE WINDOW Procedure ASSIGN
179 HEIGHT = 4.05
180 WIDTH = 33.86.
181 /* END WINDOW DEFINITION */
183 &ANALYZE-RESUME
185 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
186 /* ************************* Included-Libraries *********************** */
188 {inc/method/m-hpgl.i}
189 {inc/date.i}
190 {inc/null.i}
191 {inc/method/m-txtrep.i}
193 /* _UIB-CODE-BLOCK-END */
194 &ANALYZE-RESUME
200 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
203 /* *************************** Main Block *************************** */
205 RUN pclrep-start( preview, page-reset + "," + base-font ).
206 OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES APPEND.
208 FOR EACH Property WHERE Property.Active AND Property.PropertyCode >= property-1
209 AND Property.PropertyCode <= property-n NO-LOCK:
210 RUN property-schedule.
211 END.
213 OUTPUT CLOSE.
215 RUN pclrep-finish.
217 /* _UIB-CODE-BLOCK-END */
218 &ANALYZE-RESUME
221 /* ********************** Internal Procedures *********************** */
223 &IF DEFINED(EXCLUDE-building-financial) = 0 &THEN
225 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE building-financial Procedure
226 PROCEDURE building-financial :
227 /*------------------------------------------------------------------------------
228 Purpose:
229 ------------------------------------------------------------------------------*/
230 RUN pclrep-down-by( 1.2 ).
231 RUN pclrep-line( page-header-font, "Financial Information $ $" + area-units-short ).
232 RUN pclrep-down-by( 0.3 ).
234 DEF VAR income AS DEC NO-UNDO.
235 DEF VAR expenses AS DEC NO-UNDO.
236 DEF VAR recoveries AS DEC NO-UNDO.
237 DEF VAR net-income AS DEC NO-UNDO.
238 DEF VAR prop-value AS DEC NO-UNDO.
239 DEF VAR yield AS DEC NO-UNDO.
241 income = building-rental.
243 IF CAN-FIND( FIRST TenancyLease OF Property WHERE TenancyLease.LeaseStatus <> "PAST"
244 AND TenancyLease.RecoveryType = "A")
245 THEN
246 RUN calculate-expenses-actual( OUTPUT expenses, OUTPUT recoveries).
247 ELSE
249 RUN calculate-expenses-budget( OUTPUT expenses, OUTPUT recoveries).
251 net-income = income - expenses + recoveries.
252 /*prop-value = sum-group( "PROP", "*", "Balance").*/
253 /* Get Valuation from valuation file */
254 FIND FIRST valuation NO-LOCK
255 WHERE valuation.propertycode = property.propertycode
256 AND valuation.valuationtype = 'CVAL'
257 USE-INDEX xpkvaluation NO-ERROR.
258 IF AVAILABLE valuation THEN prop-value = valuation.amount. ELSE prop-value = 0.
260 yield = (net-income / prop-value) * 100.
261 IF yield = ? THEN yield = 0.
263 RUN pclrep-line( overview-font, "Income: " + STRING( income, "->>>,>>>,>>9" ) ).
264 RUN pclrep-line( overview-font, "Property expenses: " + amount-and-psf( expenses ) ).
265 RUN pclrep-line( overview-font + ",lpi,14", "Property recoveries: " + amount-and-psf( recoveries ) ).
266 RUN pclrep-line( overview-font + ",lpi,14", " " + FILL( "-", 12 ) ).
267 RUN pclrep-line( overview-font + ",lpi,14", "Net Income: " + STRING( net-income, "->>>,>>>,>>9" ) ).
268 RUN pclrep-line( overview-font, " " + FILL( "=", 12 ) ).
269 RUN pclrep-line( overview-font, "Property value: " + amount-and-psf( prop-value ) ).
270 RUN pclrep-line( overview-font, "Yield: " + STRING( yield, "->,>>>,>>9.9" ) + " %").
272 END PROCEDURE.
274 /* _UIB-CODE-BLOCK-END */
275 &ANALYZE-RESUME
277 &ENDIF
279 &IF DEFINED(EXCLUDE-building-overview) = 0 &THEN
281 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE building-overview Procedure
282 PROCEDURE building-overview :
283 /*------------------------------------------------------------------------------
284 Purpose:
285 ------------------------------------------------------------------------------*/
286 DEF VAR description-codes AS CHAR NO-UNDO.
287 DEF VAR wall AS DEC NO-UNDO.
288 DEF VAR wqal AS DEC NO-UNDO.
289 DEF VAR avg-floor AS DEC NO-UNDO.
290 DEF VAR base-market AS DEC NO-UNDO.
291 DEF VAR base-carpark AS DEC NO-UNDO.
292 DEF VAR occupancy AS DEC NO-UNDO.
294 RUN pclrep-line( base-font, "" ).
295 FIND ConstructionDetails OF Property NO-LOCK NO-ERROR.
296 IF NOT AVAILABLE(ConstructionDetails) THEN DO TRANSACTION:
297 CREATE ConstructionDetails.
298 ConstructionDetails.PropertyCode = Property.PropertyCode.
299 FIND CURRENT ConstructionDetails NO-LOCK.
300 END.
301 RUN hpgl-clear.
302 IF TRIM(ConstructionDetails.DescriptionText) <> "" THEN DO:
303 RUN hpgl-moveto(122,184).
304 RUN hpgl-text( page-header-font, "Building Description" ).
305 RUN hpgl-move-relative( 0, -7).
306 RUN hpgl-wrap-lines( page-header-font + ",normal",
307 REPLACE( ConstructionDetails.DescriptionText, "~n", " "),
308 80, -4.5 ).
309 END.
310 IF for-agents THEN DO:
311 RUN hpgl-moveto(13.5,8).
312 RUN hpgl-wrap-lines( disclaimer-font,
313 "The information supplied by Prime Property Group Limited in this summary is provided "
314 + "in good faith and to the best of its knowledge is true and accurate. However "
315 + "Prime Property Group Limited nor any of its related companies, officers or "
316 + "employees, or appointed agents makes any representation or warranty, express "
317 + "or implied, as to the completeness or accuracy of such information or accepts "
318 + "any liability to any person that may result from this summary.",
319 280, -1.9 ).
320 END.
321 RUN hpgl-moveto(13.5,184).
322 RUN hpgl-get-codes( No, Yes, OUTPUT description-codes ).
324 PUT CONTROL description-codes.
326 RUN pclrep-line( page-header-font, "Overview" ).
327 RUN pclrep-down-by( 0.5 ).
328 /* RUN pclrep-line( overview-font, "Ranking by Property Value: " + STRING( Property.Ranking, "->>9" ) ). */
329 RUN pclrep-line( overview-font, "Age: " + STRING( YEAR(ConstructionDetails.ConstructionDate), "9999" ) ).
331 RUN get-statistics( OUTPUT wall, OUTPUT wqal, OUTPUT avg-floor, OUTPUT base-market, OUTPUT base-carpark, OUTPUT occupancy).
332 RUN pclrep-line( overview-font, "Weighted average rental duration: " + STRING( wall, "->>9.9" ) ).
333 IF NOT for-agents THEN RUN pclrep-line( overview-font, "Weighted quality: " + STRING( wqal, "->>9.9" ) ).
334 RUN pclrep-line( overview-font, "Average floor rent ($" + area-units-short + "): " + STRING( avg-floor, "->>>,>>9.99" ) ).
335 IF NOT for-agents THEN RUN pclrep-line( overview-font, "Base market floor rent ($" + area-units-short + "): " + STRING( base-market, "->>>,>>9.99" ) ).
336 IF NOT for-agents THEN RUN pclrep-line( overview-font, "Base market carpark rent ($PW): " + STRING( base-carpark, "->>>,>>9.99" ) ).
337 RUN pclrep-line( overview-font, "Occupancy factor: " + STRING( occupancy, "->>>9" ) + " %" ).
339 END PROCEDURE.
341 /* _UIB-CODE-BLOCK-END */
342 &ANALYZE-RESUME
344 &ENDIF
346 &IF DEFINED(EXCLUDE-building-tenancies) = 0 &THEN
348 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE building-tenancies Procedure
349 PROCEDURE building-tenancies :
350 /*------------------------------------------------------------------------------
351 Purpose:
352 ------------------------------------------------------------------------------*/
353 printing-tenancies = Yes.
355 RUN pclrep-down-by( 1.2 ).
356 RUN pclrep-skip-to( 55 ).
357 RUN pclrep-line( page-header-font, "Tenancies" ).
358 RUN pclrep-down-by( -0.2 ).
360 RUN tenancies-column-headers.
362 /* Level < 90 */
363 CASE sortby:
364 WHEN "TenantNo" THEN DO:
365 FOR EACH Tenancies WHERE Tenancies.Level < 90
366 BY Tenancies.TenantCode BY Tenancies.Level BY Tenancies.LevelSeq:
367 RUN print-tenancies-line.
368 END.
369 END.
370 WHEN "Floor" THEN DO:
371 FOR EACH Tenancies WHERE Tenancies.Level < 90
372 BY Tenancies.Level BY Tenancies.LevelSeq BY Tenancies.TenantCode:
373 RUN print-tenancies-line.
374 END.
375 END.
376 END CASE.
379 IF CAN-FIND( FIRST Tenancies WHERE Tenancies.Level >= 90 AND Tenancies.Level < 99999 ) THEN
380 RUN pclrep-down-by( 1 ).
382 /* Level >= 90 */
383 CASE sortby:
384 WHEN "TenantNo" THEN DO:
385 FOR EACH Tenancies WHERE Tenancies.Level >= 90
386 BY Tenancies.TenantCode BY Tenancies.Level BY Tenancies.LevelSeq:
387 RUN print-tenancies-line.
388 END.
389 END.
390 WHEN "Floor" THEN DO:
391 FOR EACH Tenancies WHERE Tenancies.Level >= 90
392 BY Tenancies.Level BY Tenancies.LevelSeq BY Tenancies.TenantCode:
393 RUN print-tenancies-line.
394 END.
395 END.
396 END CASE.
398 /*********************
399 FOR EACH Tenancies WHERE Tenancies.Level >= 90
400 /* BY Tenancies.TenantCode BY Tenancies.Level BY Tenancies.LevelSeq*/
401 BY Tenancies.Level BY Tenancies.LevelSeq BY Tenancies.TenantCode:
402 RUN print-tenancies-line.
403 END.
404 *********************/
406 IF show-warnings AND (Property.TotalArea <> building-floor
407 OR Property.TotalParks <> building-parks)
408 THEN DO:
409 RUN pclrep-down-by( 1 ).
410 RUN pclrep-line( tenancies-font + ",bold", FILL(" ",20)
411 + "* * * WARNING * * *" + FILL(" ",5)
412 + "Sum of areas = " + TRIM(STRING(building-floor, "->>,>>>,>>9.99"))
413 + ", from property file = " + TRIM(STRING(Property.TotalArea, "->>,>>>,>>9.99"))
414 + FILL(" ",15)
415 + "Sum of parks = " + TRIM(STRING(building-parks, "->>,>>>,>>9"))
416 + ", from property file = " + TRIM(STRING(Property.TotalParks, "->>,>>>,>>9")) ).
417 END.
419 END PROCEDURE.
421 /* _UIB-CODE-BLOCK-END */
422 &ANALYZE-RESUME
424 &ENDIF
426 &IF DEFINED(EXCLUDE-calculate-expenses-actual) = 0 &THEN
428 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE calculate-expenses-actual Procedure
429 PROCEDURE calculate-expenses-actual :
430 /*------------------------------------------------------------------------------
431 Purpose:
432 ------------------------------------------------------------------------------*/
433 DEF OUTPUT PARAMETER expense AS DEC NO-UNDO INITIAL 0.
434 DEF OUTPUT PARAMETER recover AS DEC NO-UNDO INITIAL 0.
436 DEF VAR acct-budget AS DEC NO-UNDO.
437 DEF VAR lease-percent AS DEC NO-UNDO.
439 FOR EACH ChartOfAccount WHERE ChartOfAccount.ExpenseRecoveryType = "P" NO-LOCK:
440 acct-budget = get-account-budget( "P", Property.PropertyCode, ChartOfAccount.AccountCode, month-1, month-n).
441 IF acct-budget = 0 THEN NEXT.
443 expense = expense + acct-budget .
444 FOR EACH TenancyLease OF Property WHERE TenancyLease.LeaseStatus <> "PAST"
445 AND TenancyLease.RecoveryType = "A" NO-LOCK:
446 FIND TenancyOutgoing OF TenancyLease WHERE TenancyOutgoing.AccountCode = ChartOfAccount.AccountCode NO-LOCK NO-ERROR.
447 IF AVAILABLE(TenancyOutgoing) THEN DO:
448 lease-percent = TenancyOutgoing.Percentage.
449 IF TenancyOutgoing.FixedAmount > 0 THEN DO:
450 lease-percent = 0.
451 recover = recover + TenancyOutgoing.FixedAmount .
452 END.
453 END.
454 ELSE
455 lease-percent = TenancyLease.OutgoingsRate.
457 recover = recover + (acct-budget * lease-percent / 100).
458 END.
459 END.
461 FOR EACH TenancyLease OF Property WHERE TenancyLease.LeaseStatus <> "PAST"
462 AND TenancyLease.RecoveryType = "F" NO-LOCK:
463 recover = recover + TenancyLease.OutgoingsBudget .
464 END.
466 END PROCEDURE.
468 /* _UIB-CODE-BLOCK-END */
469 &ANALYZE-RESUME
471 &ENDIF
473 &IF DEFINED(EXCLUDE-calculate-expenses-budget) = 0 &THEN
475 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE calculate-expenses-budget Procedure
476 PROCEDURE calculate-expenses-budget :
477 /*------------------------------------------------------------------------------
478 Purpose:
479 ------------------------------------------------------------------------------*/
480 DEF OUTPUT PARAMETER expense AS DEC NO-UNDO INITIAL 0.
481 DEF OUTPUT PARAMETER recover AS DEC NO-UNDO INITIAL 0.
483 DEF VAR lease-percent AS DEC NO-UNDO.
484 FOR EACH PropertyOutgoing OF Property NO-LOCK,
485 FIRST ChartOfAccount OF PropertyOutgoing NO-LOCK:
486 IF PropertyOutgoing.BudgetAmount = 0 THEN NEXT.
487 IF ChartOfAccount.ExpenseRecoveryType = "O" THEN NEXT.
488 expense = expense + PropertyOutgoing.BudgetAmount .
489 FOR EACH TenancyLease OF Property WHERE TenancyLease.LeaseStatus <> "PAST"
490 AND TenancyLease.RecoveryType = "B" NO-LOCK:
491 FIND TenancyOutgoing OF TenancyLease WHERE TenancyOutgoing.AccountCode = PropertyOutgoing.AccountCode NO-LOCK NO-ERROR.
492 IF AVAILABLE(TenancyOutgoing) THEN DO:
493 lease-percent = TenancyOutgoing.Percentage.
494 IF TenancyOutgoing.FixedAmount > 0 THEN DO:
495 lease-percent = 0.
496 recover = recover + TenancyOutgoing.FixedAmount .
497 END.
498 END.
499 ELSE
500 lease-percent = TenancyLease.OutgoingsRate.
502 recover = recover + (PropertyOutgoing.BudgetAmount * lease-percent / 100).
503 END.
504 END.
506 FOR EACH ChartOfAccount WHERE ChartOfAccount.ExpenseRecoveryType = "O" NO-LOCK:
507 FOR EACH TenancyLease OF Property WHERE TenancyLease.LeaseStatus <> "PAST"
508 AND TenancyLease.RecoveryType = "B" NO-LOCK:
509 FIND TenancyOutgoing OF TenancyLease WHERE TenancyOutgoing.AccountCode = ChartOfAccount.AccountCode NO-LOCK NO-ERROR.
510 IF AVAILABLE(TenancyOutgoing) THEN
511 recover = recover + TenancyOutgoing.FixedAmount .
512 END.
513 END.
515 FOR EACH TenancyLease OF Property WHERE TenancyLease.LeaseStatus <> "PAST"
516 AND TenancyLease.RecoveryType = "F" NO-LOCK:
517 recover = recover + TenancyLease.OutgoingsBudget .
518 END.
520 END PROCEDURE.
522 /* _UIB-CODE-BLOCK-END */
523 &ANALYZE-RESUME
525 &ENDIF
527 &IF DEFINED(EXCLUDE-get-statistics) = 0 &THEN
529 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-statistics Procedure
530 PROCEDURE get-statistics :
531 /*------------------------------------------------------------------------------
532 Purpose:
533 ------------------------------------------------------------------------------*/
534 DEF OUTPUT PARAMETER wall AS DEC NO-UNDO.
535 DEF OUTPUT PARAMETER wqal AS DEC NO-UNDO.
536 DEF OUTPUT PARAMETER avg-floor AS DEC NO-UNDO.
537 DEF OUTPUT PARAMETER base-market AS DEC NO-UNDO.
538 DEF OUTPUT PARAMETER base-carpark AS DEC NO-UNDO.
539 DEF OUTPUT PARAMETER occupancy AS DEC NO-UNDO.
541 DEF VAR floor-rent AS DEC NO-UNDO INITIAL 0.
542 DEF VAR all-rent AS DEC NO-UNDO INITIAL 0.
543 DEF VAR total-quality AS DEC NO-UNDO INITIAL 0.
544 DEF VAR income-left AS DEC NO-UNDO INITIAL 0.
545 DEF VAR quality-left AS DEC NO-UNDO INITIAL 0.
547 building-rental = 0.
548 building-floor = 0.
549 building-parks = 0.
551 RUN make-tenancies.
553 FOR EACH Tenancies WHERE Tenancies.AreaStatus <> "T":
554 building-parks = building-parks + Tenancies.NoCarParks.
555 building-floor = building-floor + Tenancies.FloorArea.
556 IF Tenancies.AreaStatus = "L" THEN DO:
557 all-rent = Tenancies.FloorRent + Tenancies.ParkRent + Tenancies.MiscRent .
558 floor-rent = floor-rent + Tenancies.FloorRent.
559 building-rental = building-rental + all-rent.
561 occupancy = occupancy + Tenancies.FloorArea.
562 IF Tenancies.FloorRent > 0 THEN DO:
563 income-left = income-left + (Tenancies.FloorRent * Tenancies.YearsToRun).
564 quality-left = quality-left + (Tenancies.Quality * Tenancies.FloorRent * Tenancies.YearsToRun).
565 total-quality = total-quality + Tenancies.Quality.
566 END.
567 END.
568 END.
570 wall = income-left / floor-rent.
571 wqal = quality-left / (floor-rent * wall) .
573 avg-floor = floor-rent / occupancy.
574 base-market = Property.MarketRental.
575 base-carpark = Property.MarketCarpark.
576 occupancy = (occupancy / building-floor) * 100.
578 IF wall = ? THEN wall = 0.
579 IF wqal = ? THEN wqal = 0.
580 IF avg-floor = ? THEN avg-floor = 0.
581 IF base-market = ? THEN base-market = 0.
582 IF base-carpark = ? THEN base-carpark = 0.
583 IF occupancy = ? THEN occupancy = 0.
585 END PROCEDURE.
587 /* _UIB-CODE-BLOCK-END */
588 &ANALYZE-RESUME
590 &ENDIF
592 &IF DEFINED(EXCLUDE-inst-page-header) = 0 &THEN
594 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-header Procedure
595 PROCEDURE inst-page-header :
596 /*------------------------------------------------------------------------------
597 Purpose:
598 ------------------------------------------------------------------------------*/
599 DEF VAR p-line AS CHAR NO-UNDO.
601 IF NOT AVAILABLE(Property) THEN RETURN.
603 p-line = Property.Name + ", " + Property.StreetAddress + " (P" + STRING( Property.PropertyCode, "99999") + ")".
604 p-line = p-line + FILL( " ", 130 - INT(DEC(LENGTH(p-line)) * 1.3) ) + STRING(run-date,"99/99/9999").
606 RUN pclrep-line( page-header-font, p-line).
607 RUN pclrep-line( page-header-font, "").
609 IF printing-tenancies THEN RUN tenancies-column-headers.
611 END PROCEDURE.
613 /* _UIB-CODE-BLOCK-END */
614 &ANALYZE-RESUME
616 &ENDIF
618 &IF DEFINED(EXCLUDE-make-tenancies) = 0 &THEN
620 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE make-tenancies Procedure
621 PROCEDURE make-tenancies :
622 /*------------------------------------------------------------------------------
623 Purpose:
624 ------------------------------------------------------------------------------*/
625 DEF VAR pcnt AS DEC NO-UNDO.
627 FOR EACH Tenancies: DELETE Tenancies. END.
629 FOR EACH TenancyLease OF Property WHERE TenancyLease.LeaseStatus <> "PAST" NO-LOCK:
630 FIND Tenant OF TenancyLease NO-LOCK.
631 CREATE Tenancies.
632 Tenancies.AreaStatus = "L".
633 Tenancies.AreaDescription = TenancyLease.AreaDescription.
634 Tenancies.TenantCode = TenancyLease.TenantCode.
635 Tenancies.LeaseCode = TenancyLease.TenancyLeaseCode.
636 Tenancies.TenantName = Tenant.Name.
637 Tenancies.Level = ?.
638 Tenancies.Quality = Tenant.Quality.
639 Tenancies.Expiry = TenancyLease.LeaseEndDate.
640 Tenancies.YearsToRun = (TenancyLease.LeaseEndDate - run-date) / 365.
641 IF Tenancies.YearsToRun > 0.08 THEN /* correct */.
642 ELSE Tenancies.YearsToRun = (1 / 12).
643 FIND FIRST RentReview OF TenancyLease WHERE ReviewStatus <> "DONE" NO-LOCK NO-ERROR.
644 IF AVAILABLE(RentReview) THEN Tenancies.NextReview = RentReview.DateDue.
645 Tenancies.Renewal = TenancyLease.RightsOfRenewal.
646 Tenancies.NetLease = NOT TenancyLease.GrossLease.
648 rental-space-loop:
649 FOR EACH RentalSpace OF TenancyLease NO-LOCK:
650 FIND AreaType OF RentalSpace NO-LOCK NO-ERROR.
651 IF NOT AVAILABLE(AreaType) THEN DO:
652 IF show-warnings THEN
653 MESSAGE "Can't find an area type '" + RentalSpace.AreaType + "' for Property" Property.PropertyCode ", Lease" TenancyLease.TenancyLeaseCode ", Tenant" TenancyLease.TenantCode ", RentalSpace" RentalSpace.RentalSpaceCode.
654 NEXT rental-space-loop.
655 END.
656 IF Tenancies.Level = ? OR RentalSpace.RentalSpaceCode = TenancyLease.PrimarySpace THEN DO:
657 Tenancies.Level = RentalSpace.Level.
658 Tenancies.LevelSeq = RentalSpace.LevelSeq.
659 END.
660 pcnt = 1.0 .
661 IF RentalSpace.MarketRental <> ? THEN pcnt = RentalSpace.MarketRental / 100.0 .
663 IF AreaType.IsFloorArea THEN ASSIGN
664 Tenancies.FloorArea = Tenancies.FloorArea + RentalSpace.AreaSize
665 Tenancies.MarketPSF = Tenancies.MarketPSF
666 + (Property.MarketRental * RentalSpace.AreaSize * pcnt).
667 ELSE IF AreaType.IsCarPark THEN ASSIGN
668 Tenancies.NoCarParks = Tenancies.NoCarParks + RentalSpace.AreaSize
669 Tenancies.MarketPPK = Tenancies.MarketPPK
670 + (Property.MarketCarpark * RentalSpace.AreaSize * pcnt * 52.0).
671 ELSE
672 Tenancies.MiscArea = Tenancies.MiscArea + RentalSpace.AreaSize.
674 END.
676 rent-charge-loop:
677 FOR EACH RentCharge OF TenancyLease NO-LOCK:
678 FIND AreaType WHERE AreaType.AreaType = RentCharge.RentChargeType NO-LOCK NO-ERROR.
679 IF AVAILABLE(AreaType) THEN DO:
680 IF show-future-charges THEN DO:
681 FIND LAST RentChargeLine OF RentCharge WHERE RentChargeLine.RentChargeLineStatus = "C"
682 NO-LOCK NO-ERROR.
683 IF RentChargeLine.EndDate = RentChargeLine.LastChargedDate
684 AND RentChargeLine.LastChargedDate <> ? THEN NEXT rent-charge-loop.
685 END.
686 ELSE
687 FIND LAST RentChargeLine OF RentCharge WHERE RentChargeLine.RentChargeLineStatus = "C"
688 AND (RentChargeLine.StartDate <= run-date OR RentChargeLine.StartDate = ?)
689 NO-LOCK NO-ERROR.
690 IF NOT AVAILABLE(RentChargeLine) THEN DO:
691 FIND FIRST RentChargeLine OF RentCharge WHERE RentChargeLine.RentChargeLineStatus = "C"
692 AND RentChargeLine.StartDate > run-date NO-LOCK NO-ERROR.
693 IF NOT AVAILABLE(RentChargeLine) THEN DO:
694 IF show-warnings THEN
695 MESSAGE "Can't find an appropriate rent charge line for Tenant" TenancyLease.TenantCode ", Charge" RentCharge.RentChargeType ", Property" Property.PropertyCode ", Lease" TenancyLease.TenancyLeaseCode.
696 NEXT rent-charge-loop.
697 END.
699 IF NOT show-future-charges THEN NEXT rent-charge-loop.
700 END.
701 IF AreaType.IsFloorArea THEN
702 Tenancies.FloorRent = Tenancies.FloorRent + get-annual-amount( RentChargeLine.Amount, RentChargeLine.FrequencyCode ) .
703 ELSE IF AreaType.IsCarPark THEN
704 Tenancies.ParkRent = Tenancies.ParkRent + get-annual-amount( RentChargeLine.Amount, RentChargeLine.FrequencyCode ) .
705 ELSE
706 Tenancies.MiscRent = Tenancies.MiscRent + get-annual-amount( RentChargeLine.Amount, RentChargeLine.FrequencyCode ) .
707 END.
708 END.
709 END.
711 /* Create vacant and common areas */
712 FOR EACH RentalSpace OF Property WHERE RentalSpace.AreaStatus <> "L" NO-LOCK:
713 IF RentalSpace.AreaStatus = "V" THEN DO:
714 CREATE Tenancies.
715 Tenancies.TenantName = "* * * Vacant * * *".
716 END.
717 ELSE IF RentalSpace.AreaStatus = "C" THEN DO:
718 CREATE Tenancies.
719 Tenancies.TenantName = "* * * Common Area * * *".
720 END.
721 ELSE
722 NEXT. /* ignore other status other than Leased/Vacant/Common */
724 Tenancies.AreaStatus = RentalSpace.AreaStatus.
725 Tenancies.Level = RentalSpace.Level.
726 Tenancies.LevelSeq = RentalSpace.LevelSeq.
727 Tenancies.AreaDescription = RentalSpace.Description.
728 Tenancies.TenantCode = ?.
729 pcnt = 1.0 .
730 IF RentalSpace.MarketRental > 0 THEN pcnt = RentalSpace.MarketRental / 100.0 .
732 FIND AreaType OF RentalSpace NO-LOCK NO-ERROR.
733 IF NOT AVAILABLE(AreaType) THEN ASSIGN
734 Tenancies.MiscArea = RentalSpace.AreaSize.
735 ELSE IF AreaType.IsFloorArea THEN ASSIGN
736 Tenancies.FloorArea = RentalSpace.AreaSize
737 Tenancies.MarketPSF = Property.MarketRental * RentalSpace.AreaSize * pcnt.
738 ELSE IF AreaType.IsCarPark THEN ASSIGN
739 Tenancies.NoCarParks = RentalSpace.AreaSize
740 Tenancies.MarketPPK = Property.MarketCarpark * RentalSpace.AreaSize * pcnt * 52.0.
741 ELSE
742 Tenancies.MiscArea = RentalSpace.AreaSize.
743 END.
745 /* create a final one for holding totals */
746 DEF BUFFER TotTenancies FOR Tenancies.
747 CREATE TotTenancies.
748 TotTenancies.AreaStatus = "T".
749 TotTenancies.Level = 99999.
750 TotTenancies.LevelSeq = 0.
751 TotTenancies.AreaDescription = "Totals".
752 TotTenancies.TenantName = "".
753 TotTenancies.TenantCode = ?.
754 TotTenancies.YearsToRun = ?.
756 FOR EACH Tenancies WHERE Tenancies.AreaStatus <> "T":
757 TotTenancies.FloorArea = TotTenancies.FloorArea + Tenancies.FloorArea.
758 TotTenancies.NoCarParks = TotTenancies.NoCarParks + Tenancies.NoCarParks.
759 TotTenancies.MiscArea = TotTenancies.MiscArea + Tenancies.MiscArea.
760 TotTenancies.FloorRent = TotTenancies.FloorRent + Tenancies.FloorRent.
761 TotTenancies.ParkRent = TotTenancies.ParkRent + Tenancies.ParkRent.
762 TotTenancies.MiscRent = TotTenancies.MiscRent + Tenancies.MiscRent.
763 TotTenancies.MarketPSF = TotTenancies.MarketPSF + Tenancies.MarketPSF.
764 TotTenancies.MarketPPK = TotTenancies.MarketPPK + Tenancies.MarketPPK.
766 IF Tenancies.AreaStatus <> "V" THEN ASSIGN
767 Tenancies.FloorAreaLeased = Tenancies.FloorArea
768 Tenancies.NoCarParksLeased = Tenancies.NoCarParks
769 TotTenancies.FloorAreaLeased = TotTenancies.FloorAreaLeased + Tenancies.FloorArea
770 TotTenancies.NoCarParksLeased = TotTenancies.NoCarParksLeased + Tenancies.NoCarParks.
771 END.
773 END PROCEDURE.
775 /* _UIB-CODE-BLOCK-END */
776 &ANALYZE-RESUME
778 &ENDIF
780 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
782 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
783 PROCEDURE parse-parameters :
784 /*------------------------------------------------------------------------------
785 Purpose:
786 ------------------------------------------------------------------------------*/
787 DEF VAR i AS INT NO-UNDO.
788 DEF VAR token AS CHAR NO-UNDO.
790 {inc/showopts.i "report-options"}
792 run-date = TODAY.
794 DO i = 1 TO NUM-ENTRIES( report-options, "~n" ):
795 token = ENTRY( i, report-options, "~n" ).
796 CASE( ENTRY( 1, token ) ):
797 WHEN "Properties" THEN ASSIGN
798 property-1 = INT( ENTRY(2,token) )
799 property-n = INT( ENTRY(3,token) ).
801 WHEN "Selection" THEN selection-style = ENTRY(2,token).
802 WHEN "File name" THEN file-name = ENTRY(2,token).
803 WHEN "Agents Version" THEN for-agents = ENTRY(2,token) BEGINS "Y".
804 WHEN "Show Future Charges" THEN show-future-charges = ENTRY(2,token) BEGINS "Y".
805 WHEN "Preview" THEN preview = ENTRY(2,token) BEGINS "Y".
806 WHEN "Warnings" THEN show-warnings = ENTRY(2,token) BEGINS "Y".
807 WHEN "Export" THEN exporting = ENTRY(2,token) BEGINS "Y".
808 WHEN "Debug" THEN debug-mode = ENTRY(2,token) BEGINS "Y".
809 WHEN "Sortby" THEN sortby = ENTRY(2,token) .
810 END CASE.
811 END.
813 IF property-n < property-1 THEN property-n = property-1.
814 IF selection-style = "AP" THEN ASSIGN
815 property-1 = 0
816 property-n = 999999.
817 ELSE IF selection-style = "1P" THEN ASSIGN
818 property-n = property-1.
820 END PROCEDURE.
822 /* _UIB-CODE-BLOCK-END */
823 &ANALYZE-RESUME
825 &ENDIF
827 &IF DEFINED(EXCLUDE-print-tenancies-line) = 0 &THEN
829 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-tenancies-line Procedure
830 PROCEDURE print-tenancies-line :
831 /*------------------------------------------------------------------------------
832 Purpose:
833 ------------------------------------------------------------------------------*/
834 DEF VAR line AS CHAR NO-UNDO.
835 DEF VAR p-s-f AS CHAR NO-UNDO INITIAL "".
836 DEF VAR p-w AS CHAR NO-UNDO INITIAL "".
837 DEF VAR dashes AS CHAR NO-UNDO INITIAL "---------".
839 IF Tenancies.AreaStatus = "T" THEN DO:
840 line = FILL(" ", 65) + dashes + " --- " + dashes + " -----"
841 + FILL(" ", 30) + FILL( " " + dashes, 4).
842 RUN pclrep-line( tenancies-font + ",lpi,16", line ).
843 END.
845 IF Tenancies.FloorAreaLeased > 0 AND Tenancies.FloorRent > 0 THEN
846 p-s-f = STRING( Tenancies.FloorRent / Tenancies.FloorAreaLeased, ">,>>9.99" ).
847 IF Tenancies.NoCarParksLeased > 0 AND Tenancies.ParkRent > 0 THEN
848 p-w = STRING( Tenancies.ParkRent / Tenancies.NoCarParksLeased / 52, ">,>>9.99" ).
850 line = get-level-code( Tenancies.Level, Tenancies.LevelSeq ).
851 line = TRIM( STRING(line, "X(6)") + Tenancies.AreaDescription ).
852 line = STRING( line, "X(25)") + " "
853 + STRING( Tenancies.TenantName, "X(30)" ) + " "
854 + (IF Tenancies.TenantCode = ? THEN FILL(" ",5) ELSE STRING( Tenancies.TenantCode, "99999")) + " "
855 /*+ STRING( (IF Tenancies.Quality > 0 THEN STRING(Tenancies.Quality,"->9") ELSE ""), "X(3)")*/
856 + STRING( Tenancies.FloorArea, ">>>>,>>9.99" )
857 + STRING( Tenancies.NoCarParks, ">,>>9" )
858 /* + STRING( Tenancies.MiscArea, ">>>>,>>9.99" )*/
861 IF Tenancies.AreaStatus = "L" OR Tenancies.AreaStatus = "T" THEN
862 line = line + STRING( p-s-f, "X(9)" )
863 + STRING( p-w, "X(9)" )
864 + (IF Tenancies.Expiry <> ? THEN STRING( Tenancies.Expiry, "99/99/9999") ELSE FILL(" ",10)) + " "
865 + (IF Tenancies.YearsToRun <> ? THEN STRING( Tenancies.YearsToRun, ">>9.99") ELSE FILL(" ",6)) + " "
866 + (IF Tenancies.NextReview <> ? THEN STRING( Tenancies.NextReview, "99/99/9999") ELSE FILL(" ", 10)) + " "
867 + STRING( Tenancies.FloorRent, "->>,>>>,>>9" )
868 + STRING( Tenancies.ParkRent, "->>,>>>,>>9" )
869 + STRING( Tenancies.MiscRent, "->>,>>>,>>9" )
870 + STRING( Tenancies.FloorRent + Tenancies.ParkRent + Tenancies.MiscRent, "->>,>>>,>>9" ) + " ".
872 line = line + (IF Tenancies.AreaStatus = "L" THEN
873 STRING( (IF Tenancies.Renewal = ? THEN "" ELSE Tenancies.Renewal), "X(7)" ) + STRING( Tenancies.NetLease, "Y/N" )
874 ELSE FILL(" ",8)).
876 IF NOT for-agents THEN DO:
877 p-s-f = "".
878 p-w = "".
879 IF Tenancies.FloorArea > 0 AND Tenancies.MarketPSF > 0 THEN
880 p-s-f = STRING( Tenancies.MarketPSF / Tenancies.FloorArea, ">>9.99" ).
881 IF Tenancies.NoCarParks > 0 AND Tenancies.MarketPPK > 0 THEN
882 p-w = STRING( Tenancies.MarketPPK / Tenancies.NoCarParks / 52, ">>>9.99" ).
884 /*line = line + STRING( p-s-f, "X(7)" ) + p-w.*/
886 END.
888 RUN pclrep-line( tenancies-font + (IF Tenancies.AreaStatus = "T" THEN ",lpi,16" ELSE ""), line ).
889 END PROCEDURE.
891 /* _UIB-CODE-BLOCK-END */
892 &ANALYZE-RESUME
894 &ENDIF
896 &IF DEFINED(EXCLUDE-property-schedule) = 0 &THEN
898 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE property-schedule Procedure
899 PROCEDURE property-schedule :
900 /*------------------------------------------------------------------------------
901 Purpose:
902 ------------------------------------------------------------------------------*/
903 printing-tenancies = No.
905 RUN building-overview.
906 IF NOT for-agents THEN RUN building-financial.
907 RUN building-tenancies.
909 RUN pclrep-page-break.
910 END PROCEDURE.
912 /* _UIB-CODE-BLOCK-END */
913 &ANALYZE-RESUME
915 &ENDIF
917 &IF DEFINED(EXCLUDE-tenancies-column-headers) = 0 &THEN
919 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE tenancies-column-headers Procedure
920 PROCEDURE tenancies-column-headers :
921 /*------------------------------------------------------------------------------
922 Purpose:
923 ------------------------------------------------------------------------------*/
924 DEF VAR hdr-line-1 AS CHAR NO-UNDO.
925 DEF VAR hdr-line-2 AS CHAR NO-UNDO.
927 hdr-line-1 = " Rate Parks Lease Years Next Sitting Rent Net ".
928 hdr-line-2 = " Floor Tenant Ref Area Parks " + area-units-short + " P.W. Expires to run Review Floor Carpark Other Total Rnwl Lse ".
931 IF NOT for-agents THEN DO:
932 hdr-line-1 = hdr-line-1 + " Market".
933 hdr-line-2 = hdr-line-2 + "Floor Park".
934 END.
937 RUN pclrep-line( tenancies-font, hdr-line-1 ).
938 RUN pclrep-line( tenancies-font, hdr-line-2 ).
940 END PROCEDURE.
942 /* _UIB-CODE-BLOCK-END */
943 &ANALYZE-RESUME
945 &ENDIF
947 /* ************************ Function Implementations ***************** */
949 &IF DEFINED(EXCLUDE-amount-and-psf) = 0 &THEN
951 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION amount-and-psf Procedure
952 FUNCTION amount-and-psf RETURNS CHARACTER
953 ( INPUT amount AS DEC ) :
954 /*------------------------------------------------------------------------------
955 Purpose:
956 Notes:
957 ------------------------------------------------------------------------------*/
959 RETURN STRING( amount, "->>>,>>>,>>9" ) + " "
960 + (IF amount <> ? AND building-floor > 0 THEN
961 STRING( amount / building-floor, "->>>,>>9.99" )
962 ELSE "").
964 END FUNCTION.
966 /* _UIB-CODE-BLOCK-END */
967 &ANALYZE-RESUME
969 &ENDIF
971 &IF DEFINED(EXCLUDE-get-account-budget) = 0 &THEN
973 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-account-budget Procedure
974 FUNCTION get-account-budget RETURNS DECIMAL
975 ( INPUT et AS CHAR, INPUT ec AS INT, INPUT ac AS DEC, INPUT m-1 AS INT, INPUT m-n AS INT ) :
976 /*------------------------------------------------------------------------------
977 Purpose:
978 Notes:
979 ------------------------------------------------------------------------------*/
980 DEF VAR bud AS DEC NO-UNDO INITIAL 0.0 .
982 FOR EACH AccountBalance WHERE AccountBalance.EntityType = et
983 AND AccountBalance.EntityCode = ec AND AccountBalance.AccountCode = ac
984 AND AccountBalance.MonthCode >= m-1 AND AccountBalance.MonthCode <= m-n NO-LOCK:
985 bud = bud + AccountBalance.Budget.
986 END.
988 RETURN bud.
990 END FUNCTION.
992 /* _UIB-CODE-BLOCK-END */
993 &ANALYZE-RESUME
995 &ENDIF
997 &IF DEFINED(EXCLUDE-get-annual-amount) = 0 &THEN
999 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-annual-amount Procedure
1000 FUNCTION get-annual-amount RETURNS DECIMAL
1001 ( INPUT period-amount AS DEC, INPUT freq-type AS CHAR ) :
1002 /*------------------------------------------------------------------------------
1003 Purpose:
1004 Notes:
1005 ------------------------------------------------------------------------------*/
1006 DEF VAR annual-amount AS DEC NO-UNDO.
1008 FIND FrequencyType WHERE FrequencyType.FrequencyCode = freq-type NO-LOCK.
1010 annual-amount = ((period-amount / FrequencyType.UnitCount) * (IF FrequencyType.RepeatUnits = "D" THEN 365 ELSE 12)).
1012 RETURN annual-amount.
1014 END FUNCTION.
1016 /* _UIB-CODE-BLOCK-END */
1017 &ANALYZE-RESUME
1019 &ENDIF
1021 &IF DEFINED(EXCLUDE-get-level-code) = 0 &THEN
1023 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-level-code Procedure
1024 FUNCTION get-level-code RETURNS CHARACTER
1025 ( INPUT l-no AS INT, INPUT l-seq AS INT ) :
1026 /*------------------------------------------------------------------------------
1027 Purpose:
1028 Notes:
1029 ------------------------------------------------------------------------------*/
1030 DEF VAR answer AS CHAR NO-UNDO.
1032 IF l-no >= 99999 THEN RETURN "".
1034 IF l-no = 0 THEN answer = "G".
1035 ELSE IF l-no = 90 THEN answer = "PK".
1036 ELSE IF l-no = 80 THEN answer = "B".
1037 ELSE IF l-no > 80 AND l-no < 90 THEN answer = "B" + STRING(l-no - 80).
1038 ELSE IF l-no < 0 THEN answer = "B" + STRING(ABS(l-no)).
1039 ELSE answer = STRING(l-no).
1041 answer = answer + (IF l-seq = 0 THEN "" ELSE "-" + TRIM(STRING(l-seq))).
1043 RETURN answer.
1045 END FUNCTION.
1047 /* _UIB-CODE-BLOCK-END */
1048 &ANALYZE-RESUME
1050 &ENDIF
1052 &IF DEFINED(EXCLUDE-sum-group) = 0 &THEN
1054 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION sum-group Procedure
1055 FUNCTION sum-group RETURNS DECIMAL
1056 ( INPUT group-list AS CHAR, INPUT pattern AS CHAR, INPUT amt-type AS CHAR ) :
1057 /*------------------------------------------------------------------------------
1058 Purpose:
1059 Notes:
1060 ------------------------------------------------------------------------------*/
1061 DEF VAR result AS DEC NO-UNDO INITIAL 0.0 .
1062 DEF VAR account-group AS CHAR NO-UNDO.
1063 DEF VAR i AS INT NO-UNDO.
1064 DEF VAR n AS INT NO-UNDO.
1066 n = NUM-ENTRIES( group-list).
1067 DO i = 1 TO n:
1068 account-group = ENTRY(i,group-list).
1069 FOR EACH ChartOfAccount WHERE ChartOfAccount.AccountGroupCode = account-group NO-LOCK:
1070 IF STRING(ChartOfAccount.AccountCode, "9999.99") MATCHES pattern THEN DO:
1071 FOR EACH AccountSummary WHERE AccountSummary.EntityType = "P"
1072 AND AccountSummary.EntityCode = Property.PropertyCode
1073 AND AccountSummary.AccountCode = ChartOfAccount.AccountCode
1074 NO-LOCK:
1075 result = result + (IF amt-type = "Budget" THEN AccountSummary.Budget ELSE AccountSummary.Balance ) .
1076 END.
1077 END.
1078 END.
1079 END.
1081 RETURN result.
1083 END FUNCTION.
1085 /* _UIB-CODE-BLOCK-END */
1086 &ANALYZE-RESUME
1088 &ENDIF