Various files changed in the process of adding support
[capital-apms-progress.git] / forecast / amtrust-rent-report.p
blob0a2ab8dee903e8906c79bd794bcef507742dfaf1
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 AmTrust Rental Forecasting Run
6 ------------------------------------------------------------------------*/
7 &SCOPED-DEFINE REPORT-ID "Amtrust Rental Run"
9 DEF INPUT PARAMETER report-options AS CHAR NO-UNDO.
11 DEF VAR preview AS LOGI NO-UNDO INIT No.
12 DEF VAR summary-level AS CHAR NO-UNDO INIT "Detail".
13 DEF VAR property-1 AS INT NO-UNDO INIT ?.
14 DEF VAR property-n AS INT NO-UNDO INIT ?.
15 DEF VAR month-1 AS INT NO-UNDO INIT ?.
16 DEF VAR month-n AS INT NO-UNDO INIT ?.
17 DEF VAR monthly AS LOGI NO-UNDO INIT No.
18 DEF VAR show-agents-fees AS LOGI NO-UNDO INIT No.
19 DEF VAR show-expenses AS LOGI NO-UNDO INIT No.
20 DEF VAR consolidated AS LOGI NO-UNDO INIT No.
21 DEF VAR forecast-start AS DATE NO-UNDO.
22 DEF VAR forecast-end AS DATE NO-UNDO.
23 DEF VAR first-year AS INT NO-UNDO.
24 DEF VAR first-month-start AS DATE NO-UNDO.
25 DEF VAR report-on AS CHAR NO-UNDO.
26 DEF VAR report-types AS CHAR NO-UNDO.
27 DEF VAR report-descs AS CHAR NO-UNDO.
28 RUN parse-parameters.
29 IF ERROR-STATUS:ERROR THEN RETURN.
31 DEF VAR mfmt AS CHAR NO-UNDO INITIAL "->>>,>>>,>>9".
32 DEF VAR pfmt AS CHAR NO-UNDO INITIAL "->>9.99999".
33 DEF VAR i AS INT NO-UNDO.
35 DEF VAR user-name AS CHAR NO-UNDO.
36 DEF VAR timeStamp AS CHAR FORMAT "X(44)" NO-UNDO.
38 DEF VAR base-font AS CHAR NO-UNDO INITIAL "fixed,courier,cpi,18,lpi,9,normal".
39 DEF VAR header-font AS CHAR NO-UNDO INITIAL "proportional,helvetica,point,10,lpi,7,bold".
41 {inc/ofc-this.i}
42 {inc/ofc-set.i "Default-Forecast-Property" "default-forecast-pcode"}
43 DEF VAR default-pcode AS INT NO-UNDO.
44 ASSIGN default-pcode = INT(default-forecast-pcode) NO-ERROR.
45 IF default-pcode < 1 THEN default-pcode = 99999.
47 DEF TEMP-TABLE rr-line NO-UNDO
48 FIELD pcode AS INT
49 FIELD et AS CHAR
50 FIELD ec AS INT
51 FIELD ac AS DEC
52 FIELD lseq AS INT
53 FIELD ltype AS CHAR
54 FIELD years AS DEC EXTENT 15
55 FIELD months AS DEC EXTENT 12
56 INDEX XAK2rr-lines pcode ac ltype
57 INDEX XPKrr-lines IS UNIQUE PRIMARY pcode et ec ac lseq
58 INDEX XAK1rr-lines IS UNIQUE pcode et ec ac ltype .
60 /* _UIB-CODE-BLOCK-END */
61 &ANALYZE-RESUME
64 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
66 /* ******************** Preprocessor Definitions ******************** */
68 &Scoped-define PROCEDURE-TYPE Procedure
69 &Scoped-define DB-AWARE no
73 /* _UIB-PREPROCESSOR-BLOCK-END */
74 &ANALYZE-RESUME
77 /* ************************ Function Prototypes ********************** */
79 &IF DEFINED(EXCLUDE-exclude-ltype) = 0 &THEN
81 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD exclude-ltype Procedure
82 FUNCTION exclude-ltype RETURNS LOGICAL
83 ( INPUT ltype AS CHAR ) FORWARD.
85 /* _UIB-CODE-BLOCK-END */
86 &ANALYZE-RESUME
88 &ENDIF
91 /* *********************** Procedure Settings ************************ */
93 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
94 /* Settings for THIS-PROCEDURE
95 Type: Procedure
96 Allow:
97 Frames: 0
98 Add Fields to: Neither
99 Other Settings: CODE-ONLY COMPILE
101 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
103 /* ************************* Create Window ************************** */
105 &ANALYZE-SUSPEND _CREATE-WINDOW
106 /* DESIGN Window definition (used by the UIB)
107 CREATE WINDOW Procedure ASSIGN
108 HEIGHT = 17.6
109 WIDTH = 40.43.
110 /* END WINDOW DEFINITION */
112 &ANALYZE-RESUME
114 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
115 /* ************************* Included-Libraries *********************** */
117 {inc/date.i}
118 {inc/method/m-txtrep.i}
120 /* _UIB-CODE-BLOCK-END */
121 &ANALYZE-RESUME
127 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
130 /* *************************** Main Block *************************** */
131 {inc/username.i "user-name"}
132 timeStamp = STRING( TODAY, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
134 IF monthly THEN
135 RUN pclrep-start( preview, "reset,landscape,tm,2,a4,lm,6," + base-font).
136 ELSE
137 RUN pclrep-start( preview, "reset,portrait,tm,2,a4,lm,6," + base-font).
138 OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES PAGE-SIZE 0.
140 RUN rent-report.
142 OUTPUT CLOSE.
144 RUN pclrep-finish.
146 /* _UIB-CODE-BLOCK-END */
147 &ANALYZE-RESUME
150 /* ********************** Internal Procedures *********************** */
152 &IF DEFINED(EXCLUDE-inst-page-footer) = 0 &THEN
154 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-footer Procedure
155 PROCEDURE inst-page-footer :
156 /*------------------------------------------------------------------------------
157 Purpose: Print any page footer
158 ------------------------------------------------------------------------------*/
160 END PROCEDURE.
162 /* _UIB-CODE-BLOCK-END */
163 &ANALYZE-RESUME
165 &ENDIF
167 &IF DEFINED(EXCLUDE-inst-page-header) = 0 &THEN
169 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-header Procedure
170 PROCEDURE inst-page-header :
171 /*------------------------------------------------------------------------------
172 Purpose: Print page header for the rent report
173 ------------------------------------------------------------------------------*/
174 DEF VAR tfmt AS CHAR NO-UNDO.
175 DEF VAR line AS CHAR NO-UNDO.
176 DEF VAR i AS INT NO-UNDO.
178 RUN pclrep-line( "univers,Point,7,bold,Proportional", TimeStamp).
179 RUN pclrep-line( "univers,Point,11,bold,Proportional", SPC(20) + "AmTrust Forecasting Report - " + report-on).
180 RUN pclrep-line( "", "" ).
182 IF monthly THEN DO:
183 tfmt = FILL(" ",LENGTH(mfmt) - 7).
184 FIND Month WHERE Month.MonthCode = month-1 NO-LOCK.
185 line = FILL(" ",5) + SUBSTRING( STRING( Month.StartDate, "99/99/9999"), 4) + tfmt.
186 DO i = 2 TO 12:
187 FIND NEXT Month NO-LOCK.
188 line = line + SUBSTRING( STRING( Month.StartDate, "99/99/9999"), 4) + tfmt.
189 END.
190 line = line + " Total" + tfmt.
191 RUN pclrep-line( base-font + ",bold", line).
192 END.
193 ELSE DO:
194 tfmt = STRING( " 9999 ", "X(" + STRING(LENGTH(mfmt)) + ")").
195 RUN pclrep-line( base-font + ",bold", FILL(" ",4) + STRING(first-year, tfmt)
196 + STRING(first-year + 1, tfmt) + STRING(first-year + 2, tfmt)
197 + STRING(first-year + 3, tfmt) + STRING(first-year + 4, tfmt) ).
198 END.
200 RUN pclrep-line( "", "" ).
202 END PROCEDURE.
204 /* _UIB-CODE-BLOCK-END */
205 &ANALYZE-RESUME
207 &ENDIF
209 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
211 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
212 PROCEDURE parse-parameters :
213 /*------------------------------------------------------------------------------
214 Purpose:
215 ------------------------------------------------------------------------------*/
216 DEF VAR token AS CHAR NO-UNDO.
217 DEF VAR i AS INT NO-UNDO.
219 /* ensure this is run as early as possible (its included from txtrep) */
220 RUN get-bq-routine IN THIS-PROCEDURE.
222 {inc/showopts.i "report-options"}
224 DO i = 1 TO NUM-ENTRIES( report-options, "~n" ):
225 token = ENTRY( i, report-options, "~n" ).
227 /* Preview and Property options are set for each run */
228 CASE ENTRY( 1, token ):
229 WHEN "Preview" THEN preview = Yes.
230 WHEN "Monthly" THEN monthly = Yes.
231 WHEN "Consolidated" THEN consolidated = Yes.
232 WHEN "ShowAgentsFees" THEN show-agents-fees = Yes.
233 WHEN "SummariseTo" THEN summary-level = ENTRY(2,token).
235 WHEN "All" THEN ASSIGN
236 property-1 = 0
237 property-n = 999999.
239 WHEN "Properties" THEN ASSIGN
240 property-1 = INT(ENTRY(2,token))
241 property-n = INT(ENTRY(3,token)).
243 WHEN "ReportOn" THEN report-on = ENTRY(2,token).
245 WHEN "Months" THEN ASSIGN
246 month-1 = INT(ENTRY(2,token))
247 month-n = INT(ENTRY(3,token)).
249 END CASE.
250 END.
252 FIND Month WHERE Month.MonthCode = month-1 NO-LOCK NO-ERROR.
253 IF NOT AVAILABLE(Month) THEN DO:
254 MESSAGE "Invalid starting month for forecast"
255 VIEW-AS ALERT-BOX ERROR.
256 RETURN ERROR.
257 END.
258 forecast-start = Month.StartDate.
259 first-year = Month.FinancialYearCode.
260 first-month-start = Month.StartDate.
262 FIND Month WHERE Month.MonthCode = month-n NO-LOCK NO-ERROR.
263 IF NOT AVAILABLE(Month) THEN DO:
264 MESSAGE "Invalid ending month for forecast"
265 VIEW-AS ALERT-BOX ERROR.
266 RETURN ERROR.
267 END.
268 forecast-end = Month.EndDate.
270 CASE report-on:
271 WHEN "Rents" THEN ASSIGN
272 report-types = "BASE,GBAS,NEW,GNEW,VACT,GVAC,ONE"
273 report-descs = "Base rental,Growth on Base Rental,New leases,Growth on new leases,Vacant costs,Growth on vacant costs,One-off income/costs".
274 WHEN "Expenses" THEN ASSIGN
275 report-types = "EXP,NREC,AEXP"
276 report-descs = "Recoverable Expenses,Non-recoverable Expenses,Administration Expenses"
277 show-expenses = Yes.
278 WHEN "Recoveries" THEN ASSIGN
279 report-types = "RCBS,RCNW"
280 report-descs = "Base Recoveries,Recoveries on new leases".
281 WHEN "NetExpenses" THEN ASSIGN
282 report-types = "EXP,NREC,RCBS,RCNW,AEXP"
283 report-descs = "Recoverable Expenses,Non-recoverable Expenses,Base Recoveries,Recoveries on new leases,Administration Expenses"
284 show-expenses = Yes.
285 OTHERWISE DO:
286 MESSAGE "Unknown report option '" + report-on + "'"
287 VIEW-AS ALERT-BOX ERROR
288 TITLE "The Programmer Blew It! (tm)".
289 RETURN "FAIL".
290 END.
291 END CASE.
292 IF show-agents-fees THEN DO:
293 report-types = report-types + ",AGNT".
294 report-descs = report-descs + ",Agents Fees".
295 END.
297 END PROCEDURE.
299 /* _UIB-CODE-BLOCK-END */
300 &ANALYZE-RESUME
302 &ENDIF
304 &IF DEFINED(EXCLUDE-rent-report) = 0 &THEN
306 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE rent-report Procedure
307 PROCEDURE rent-report :
308 /*------------------------------------------------------------------------------
309 Purpose:
310 ------------------------------------------------------------------------------*/
311 DEF VAR years AS DEC NO-UNDO EXTENT 5 INITIAL 0.
312 DEF VAR etot AS DEC NO-UNDO EXTENT 5 INITIAL 0.
313 DEF VAR ptot AS DEC NO-UNDO EXTENT 5 INITIAL 0.
314 DEF VAR pcode AS INT NO-UNDO INITIAL 0.
316 DEF VAR last-type AS CHAR NO-UNDO INITIAL "".
317 DEF VAR last-entity AS CHAR NO-UNDO INITIAL "".
318 DEF VAR this-entity AS CHAR NO-UNDO.
319 DEF VAR last-account AS DEC NO-UNDO INITIAL ?.
321 DEF VAR first-year AS INT NO-UNDO.
322 FIND Month WHERE Month.MonthCode = month-1 NO-LOCK.
323 first-year = Month.FinancialYearCode.
326 RUN rr-build-table.
327 FOR EACH Property WHERE Active AND Property.PropertyCode >= property-1
328 AND Property.PropertyCode <= property-n NO-LOCK:
329 pcode = Property.PropertyCode.
330 IF consolidated THEN DO:
331 pcode = default-pcode.
333 END.
334 ELSE DO:
335 IF LOOKUP( summary-level, "Detail,LinePerLease,FourPerProperty") > 0 THEN
336 RUN pclrep-line( header-font, "Property " + STRING(pcode) + " " + Property.Name ).
338 /* tenants */
339 FOR EACH Tenant NO-LOCK WHERE Tenant.EntityType = "P"
340 AND Tenant.EntityCode = pcode
341 AND CAN-FIND( FIRST rr-line WHERE rr-line.pcode = pcode
342 AND rr-line.et = "T" AND rr-line.ec = Tenant.TenantCode):
343 IF summary-level = "Detail" THEN
344 RUN pclrep-line( header-font, "Tenant " + STRING(Tenant.TenantCode) + " " + Tenant.Name ).
345 FOR EACH rr-line WHERE rr-line.pcode = pcode
346 AND rr-line.et = "T"
347 AND rr-line.ec = Tenant.TenantCode:
348 IF rr-line.ltype = 'AGNT' AND show-expenses THEN NEXT.
349 RUN rr-line.
350 END.
351 IF summary-level = "Detail" THEN RUN pclrep-line(base-font,"").
352 END.
354 /* vacant spaces */
355 FOR EACH RentalSpace NO-LOCK OF Property
356 WHERE CAN-FIND( FIRST rr-line WHERE rr-line.pcode = pcode
357 AND rr-line.et = "R" AND rr-line.ec = RentalSpace.RentalSpaceCode):
358 IF summary-level = "Detail" THEN RUN pclrep-line( header-font, "Vacant space " + STRING(RentalSpace.Level) + "/" + STRING(RentalSpace.LevelSequence) + " " + RentalSpace.Description ).
359 FOR EACH rr-line WHERE rr-line.pcode = pcode
360 AND rr-line.et = "R"
361 AND rr-line.ec = RentalSpace.RentalSpaceCode:
362 IF rr-line.ltype = 'AGNT' AND show-expenses THEN NEXT.
363 RUN rr-line.
364 END.
365 IF summary-level = "Detail" THEN RUN pclrep-line(base-font,"").
366 END.
367 END.
369 /* property accounts (expenses) */
370 last-account = ?.
371 FOR EACH rr-line WHERE rr-line.pcode = pcode
372 AND (rr-line.et = "P"
373 OR (rr-line.ltype = 'AGNT' AND show-agents-fees AND show-expenses))
374 BY rr-line.pcode BY rr-line.ac:
376 FIND ChartOfAccount WHERE ChartOfAccount.AccountCode = rr-line.ac NO-LOCK NO-ERROR.
377 IF summary-level = "Detail" AND last-account <> rr-line.ac THEN DO:
378 IF last-account <> ? THEN RUN pclrep-line(base-font,"").
379 RUN pclrep-line( header-font, "Account " + STRING(rr-line.ac,"9999.99") + " "
380 + (IF AVAILABLE(ChartOfAccount) THEN ChartOfAccount.Name ELSE "* * * Account not on file! * * *")).
381 last-account = rr-line.ac.
382 END.
383 RUN rr-line.
384 END.
385 IF summary-level = "Detail" AND last-account <> ? THEN
386 RUN pclrep-line(base-font,"").
388 FOR EACH rr-line WHERE rr-line.pcode = pcode
389 AND rr-line.et = "Z":
390 RUN rr-line.
391 END.
392 IF LOOKUP( summary-level, "Detail,LinePerLease") > 0 THEN
393 RUN pclrep-down-by(2).
394 ELSE IF summary-level = "FourPerProperty" THEN
395 RUN pclrep-line(base-font,"").
397 IF consolidated THEN LEAVE.
398 END.
400 IF property-1 <> property-n THEN FOR EACH rr-line WHERE rr-line.pcode = 999999:
401 RUN rr-line.
402 END.
404 END PROCEDURE.
406 /* _UIB-CODE-BLOCK-END */
407 &ANALYZE-RESUME
409 &ENDIF
411 &IF DEFINED(EXCLUDE-rr-build-table) = 0 &THEN
413 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE rr-build-table Procedure
414 PROCEDURE rr-build-table :
415 /*------------------------------------------------------------------------------
416 Purpose:
417 ------------------------------------------------------------------------------*/
418 DEF VAR i AS INT NO-UNDO.
419 DEF VAR j AS INT NO-UNDO.
421 DEF VAR pcode AS INT NO-UNDO.
422 DEF VAR ecode AS INT NO-UNDO.
423 DEF VAR entity-type AS CHAR NO-UNDO.
424 DEF VAR my-amount AS DEC NO-UNDO.
426 FOR EACH Property WHERE Active AND Property.PropertyCode >= property-1
427 AND Property.PropertyCode <= property-n NO-LOCK:
428 FOR EACH PropForecast OF Property NO-LOCK:
429 IF exclude-ltype(PropForecast.PropForecastType) THEN NEXT.
431 FIND Month WHERE Month.MonthCode = PropForecast.MonthCode.
432 i = (Month.FinancialYear - first-year) + 1.
433 j = diff-months( first-month-start, Month.StartDate) + 1.
434 IF NOT( i > 0 ) THEN NEXT.
435 pcode = PropForecast.PropertyCode .
436 IF consolidated THEN pcode = default-pcode.
438 my-amount = PropForecast.Amount .
439 IF PropForecast.PropForecastType = "AGNT" AND show-expenses AND show-agents-fees THEN DO:
440 entity-type = "P".
441 ecode = pcode.
442 END.
443 ELSE IF consolidated AND PropForecast.EntityType = "P" THEN DO:
444 entity-type = "P".
445 ecode = pcode.
446 END.
447 ELSE DO:
448 entity-type = PropForecast.EntityType .
449 ecode = PropForecast.EntityCode.
450 END.
452 IF PropForecast.PropForecastType = "AGNT" AND show-agents-fees AND report-on = "Rents" THEN DO:
453 my-amount = - my-amount.
454 END.
456 FIND rr-line WHERE rr-line.pcode = pcode
457 AND rr-line.et = entity-type
458 AND rr-line.ec = ecode
459 AND rr-line.ltype = PropForecast.PropForecastType
460 AND rr-line.ac = INT(PropForecast.AccountCode) NO-ERROR.
462 IF NOT AVAILABLE(rr-line) THEN DO:
463 CREATE rr-line.
464 rr-line.pcode = pcode.
465 rr-line.et = entity-type.
466 rr-line.ec = ecode.
467 rr-line.ltype = PropForecast.PropForecastType.
468 rr-line.ac = INT(PropForecast.AccountCode).
469 rr-line.lseq = LOOKUP( PropForecast.PropForecastType, report-types).
470 IF rr-line.lseq = 0 THEN DO:
471 RUN pclrep-line( base-font, "Couldn't locate '" + PropForecast.PropForecastType + "' in line type list.").
472 END.
473 END.
474 rr-line.years[i] = rr-line.years[i] + my-amount .
475 IF j > 0 AND j <= 12 THEN
476 rr-line.months[j] = rr-line.months[j] + my-amount .
477 END.
478 END.
480 END PROCEDURE.
482 /* _UIB-CODE-BLOCK-END */
483 &ANALYZE-RESUME
485 &ENDIF
487 &IF DEFINED(EXCLUDE-rr-line) = 0 &THEN
489 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE rr-line Procedure
490 PROCEDURE rr-line :
491 /*------------------------------------------------------------------------------
492 Purpose:
493 ------------------------------------------------------------------------------*/
494 DEF BUFFER rr-total FOR rr-line.
496 DEF VAR t2 AS CHAR NO-UNDO.
497 DEF VAR is-total-line AS LOGI NO-UNDO INITIAL No.
498 DEF VAR i AS INT NO-UNDO.
499 DEF VAR thisline-total AS DEC NO-UNDO INITIAL 0.0 .
501 IF rr-line.ltype = "TOTAL" THEN DO: /* entity total line */
502 is-total-line = Yes.
503 IF summary-level = "LinePerProperty" THEN
504 is-total-line = (rr-line.pcode > 99999).
505 ELSE IF summary-level = "FourPerProperty" THEN
506 is-total-line = (rr-line.et = "Z").
507 ELSE IF summary-level = "LinePerLease" THEN
508 is-total-line = (rr-line.et = "Z").
509 ELSE
510 is-total-line = Yes.
512 IF is-total-line AND monthly THEN
513 RUN pclrep-line( base-font, FILL( " " + FILL( "-", LENGTH(mfmt) - 1), 12)).
514 ELSE IF is-total-line THEN
515 RUN pclrep-line( base-font, FILL( " " + FILL( "-", LENGTH(mfmt) - 1), 5)).
517 IF monthly THEN DO i = 1 TO 12:
518 thisline-total = thisline-total + rr-line.months[i].
519 END.
520 END.
521 ELSE DO:
522 /* find and add to total of this group */
523 FIND rr-total WHERE rr-total.pcode = rr-line.pcode
524 AND rr-total.et = rr-line.et
525 AND rr-total.ec = rr-line.ec
526 AND rr-total.ltype = "TOTAL"
527 AND (rr-total.ac = rr-line.ac OR report-on = "Rents") NO-ERROR.
528 IF NOT AVAILABLE(rr-total) THEN DO:
529 CREATE rr-total.
530 rr-total.pcode = rr-line.pcode.
531 rr-total.et = rr-line.et.
532 rr-total.ec = rr-line.ec.
533 rr-total.ac = rr-line.ac.
534 rr-total.ltype = "TOTAL".
535 rr-total.lseq = 9.
536 END.
537 DO i = 1 TO 5:
538 rr-total.years[i] = rr-total.years[i] + rr-line.years[i].
539 END.
540 IF monthly THEN DO i = 1 TO 12:
541 rr-total.months[i] = rr-total.months[i] + rr-line.months[i].
542 END.
544 IF rr-line.pcode <= 99999 THEN DO:
545 /* find and add to total at level above */
546 FIND rr-total WHERE rr-total.pcode = (IF rr-line.et = "Z" THEN 999999 ELSE rr-line.pcode)
547 AND rr-total.et = "Z"
548 AND rr-total.ec = 999999
549 AND rr-total.ltype = rr-line.ltype NO-ERROR.
550 IF NOT AVAILABLE(rr-total) THEN DO:
551 CREATE rr-total.
552 rr-total.pcode = (IF rr-line.et = "Z" THEN 999999 ELSE rr-line.pcode).
553 rr-total.et = "Z".
554 rr-total.ec = 999999.
555 rr-total.ltype = rr-line.ltype.
556 rr-total.lseq = rr-line.lseq.
557 END.
558 DO i = 1 TO 5:
559 rr-total.years[i] = rr-total.years[i] + rr-line.years[i].
560 END.
561 IF monthly THEN DO i = 1 TO 12:
562 rr-total.months[i] = rr-total.months[i] + rr-line.months[i].
563 END.
564 END.
565 END.
567 IF LOOKUP(summary-level,"LinePerLease,LinePerProperty") > 0 AND rr-line.ltype <> "TOTAL" THEN RETURN.
568 IF LOOKUP(summary-level,"FourPerProperty,LinePerProperty") > 0 AND rr-line.et <> "Z" THEN RETURN.
570 IF rr-line.lseq = 9 THEN
571 t2 = "Total".
572 ELSE
573 t2 = ENTRY( rr-line.lseq, report-descs).
575 IF rr-line.et = "P" AND AVAILABLE(ChartOfAccount) THEN
576 t2 = STRING(rr-line.ltype, "X(4)") + " "
577 + STRING(ChartOfAccount.AccountCode, "9999.99") + " "
578 + ChartOfAccount.Name.
580 IF summary-level = "LinePerLease" THEN DO:
581 IF rr-line.et = "T" THEN
582 t2 = "T" + STRING(Tenant.TenantCode,"99999") + " " + Tenant.Name.
583 ELSE IF rr-line.et = "R" THEN
584 t2 = "Vacant: " + RentalSpace.Description.
585 END.
586 ELSE IF summary-level = "LinePerProperty" THEN DO:
587 IF rr-line.pcode > 99999 THEN
588 t2 = "Grand totals".
589 ELSE IF rr-line.et = "Z" AND rr-line.pcode = default-pcode THEN
590 t2 = "Consolidated Total".
591 ELSE IF rr-line.et = "Z" THEN
592 t2 = "P" + STRING(Property.PropertyCode,"99999") + " " + Property.Name.
593 END.
595 IF monthly THEN DO:
596 RUN pclrep-line( base-font, STRING( rr-line.months[1], mfmt)
597 + STRING( rr-line.months[2], mfmt)
598 + STRING( rr-line.months[3], mfmt)
599 + STRING( rr-line.months[4], mfmt)
600 + STRING( rr-line.months[5], mfmt)
601 + STRING( rr-line.months[6], mfmt)
602 + STRING( rr-line.months[7], mfmt)
603 + STRING( rr-line.months[8], mfmt)
604 + STRING( rr-line.months[9], mfmt)
605 + STRING( rr-line.months[10], mfmt)
606 + STRING( rr-line.months[11], mfmt)
607 + STRING( rr-line.months[12], mfmt)
608 + STRING( thisline-total, mfmt)
609 + " " + t2 ).
610 /* STRING(t2,"X(40)")
611 + " " + STRING(rr-line.pcode)
612 + " " + rr-line.et
613 + " " + rr-line.ltype ). */
614 END.
615 ELSE DO:
616 RUN pclrep-line( base-font, STRING( rr-line.years[1], mfmt)
617 + STRING( rr-line.years[2], mfmt)
618 + STRING( rr-line.years[3], mfmt)
619 + STRING( rr-line.years[4], mfmt)
620 + STRING( rr-line.years[5], mfmt)
621 + " " + t2 ).
622 /* STRING(t2,"X(40)")
623 + " " + STRING(rr-line.pcode)
624 + " " + rr-line.et
625 + " " + rr-line.ltype ). */
626 END.
628 END PROCEDURE.
630 /* _UIB-CODE-BLOCK-END */
631 &ANALYZE-RESUME
633 &ENDIF
635 /* ************************ Function Implementations ***************** */
637 &IF DEFINED(EXCLUDE-exclude-ltype) = 0 &THEN
639 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION exclude-ltype Procedure
640 FUNCTION exclude-ltype RETURNS LOGICAL
641 ( INPUT ltype AS CHAR ) :
642 /*------------------------------------------------------------------------------
643 Purpose: Decide whether we're including this line in the report
644 ------------------------------------------------------------------------------*/
646 RETURN (LOOKUP( ltype, report-types) = 0).
648 END FUNCTION.
650 /* _UIB-CODE-BLOCK-END */
651 &ANALYZE-RESUME
653 &ENDIF