1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 ------------------------------------------------------------------------*/
7 DEF INPUT PARAMETER report-options
AS CHAR NO-UNDO.
9 DEF VAR report-id
AS CHAR NO-UNDO INITIAL "VCNT".
11 DEF VAR debug-mode
AS LOGICAL NO-UNDO INITIAL No.
12 DEF VAR min-rental
AS DECIMAL NO-UNDO INITIAL 0.
13 DEF VAR gen-report
AS LOGICAL NO-UNDO INITIAL No.
14 DEF VAR report-sequence
AS CHAR NO-UNDO.
16 DEF VAR single-manager
AS INT NO-UNDO INITIAL 0.
17 DEF VAR one-manager-name
AS CHAR NO-UNDO INITIAL "".
18 DEF VAR merge-parks
AS LOGICAL NO-UNDO INITIAL No.
19 DEF VAR report-exclude-entity
AS LOGICAL NO-UNDO INITIAL No.
20 DEF VAR entity-list
AS CHAR NO-UNDO.
21 DEF VAR print-summary-only
AS LOGICAL NO-UNDO INITIAL No.
26 DEF VAR current-process
AS CHAR NO-UNDO.
28 /* _UIB-CODE-BLOCK-END
*/
32 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
34 /* ******************** Preprocessor Definitions
******************** */
36 &Scoped-define PROCEDURE-TYPE Procedure
37 &Scoped-define DB-AWARE no
41 /* _UIB-PREPROCESSOR-BLOCK-END
*/
46 /* *********************** Procedure Settings
************************ */
48 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
49 /* Settings for
THIS-PROCEDURE
53 Add Fields to
: Neither
54 Other Settings
: CODE-ONLY
COMPILE
56 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
58 /* ************************* Create Window
************************** */
60 &ANALYZE-SUSPEND _CREATE-WINDOW
61 /* DESIGN Window definition
(used by the UIB
)
62 CREATE WINDOW Procedure
ASSIGN
65 /* END WINDOW DEFINITION
*/
69 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
70 /* ************************* Included-Libraries
*********************** */
72 {inc
/method
/m-period.i
}
74 /* _UIB-CODE-BLOCK-END
*/
81 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
84 /* *************************** Main Block
*************************** */
86 IF file-name
= "Printer" THEN
87 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
89 OUTPUT TO VALUE( file-name
).
91 IF gen-report
THEN DO:
92 RUN delete-todays-report.
93 RUN generate-vacant-spaces.
96 RUN output-vacant-summary.
97 IF NOT(print-summary-only
) THEN
98 RUN output-vacant-spaces.
101 IF file-name
= "Printer" THEN RUN view-output-file
( report-preview
).
103 /* _UIB-CODE-BLOCK-END
*/
107 /* ********************** Internal Procedures
*********************** */
109 &IF DEFINED(EXCLUDE-generate-vacant-spaces) = 0 &THEN
111 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE generate-vacant-spaces Procedure
112 PROCEDURE generate-vacant-spaces
:
113 /*------------------------------------------------------------------------------
114 Purpose
: Generate the information for the report
115 ------------------------------------------------------------------------------*/
117 RUN create-detail
( "HR", "", report-options
).
118 RUN create-detail
( "VC", "", '
"Description"'
+ delim
+ '
"Area"'
+ delim
+ '
"Parks"'
+ delim
+ '
"EAR-Annual"'
+ delim
+ '
"EAR-PSM"'
+ delim
+ '
"Cost-Annual"'
119 + delim
+ '
"Cost-PSM"'
+ delim
+ '
"VacantFromDate"'
).
121 FOR EACH Property
WHERE Property.Active
NO-LOCK:
122 FOR EACH RentalSpace
OF Property
NO-LOCK:
123 RUN add-rsp-portfolio.
125 IF RentalSpace.AreaStatus
= "V" THEN DO:
127 RUN create-rentalspace-detail.
133 RUN create-detail
( "PC", "", '
"Portfolio"'
+ delim
+ '
"Area"'
+ delim
+ '
"EAR-Annual"'
+ delim
+ '
"Base-Annual"'
+ delim
+ '
"Total-Annual"'
).
135 RUN create-detail
( "PF", STRING(Portfolio.Portfolio
),
136 STRING( Portfolio.AreaSize
) + delim
137 + STRING( Portfolio.Rental
[1] ) + delim
138 + STRING( Portfolio.Rental
[2] ) + delim
139 + STRING( Portfolio.Rental
[3] ) ).
141 RUN create-detail
( "PF", "Total", STRING( total-area
) + delim
142 + STRING( total-rntl
[1] ) + delim
143 + STRING( total-rntl
[2] ) + delim
144 + STRING( total-rntl
[3] ) ).
150 /* _UIB-CODE-BLOCK-END
*/
155 &IF DEFINED(EXCLUDE-output-vacant-spaces) = 0 &THEN
157 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE output-vacant-spaces Procedure
158 PROCEDURE output-vacant-spaces
:
159 /*------------------------------------------------------------------------------
161 ------------------------------------------------------------------------------*/
162 current-process
= "VACANCIES".
163 FIND LAST PeriodicDetail
WHERE PeriodicDetail.ReportID
= report-id
164 AND PeriodicDetail.Date
<= report-asat-date
165 AND PeriodicDetail.DetailType
= "D"
168 report-title
= "Vacant Space by " + report-sequence
169 + "~n as at " + STRING( PeriodicDetail.Date
, "99/99/9999")
170 + (IF report-sequence
= "Single":U
THEN " for " + one-manager-name
ELSE "").
172 now
= STRING( TODAY, "99/99/9999" ) + ", " + STRING( TIME, "HH:MM:SS" ).
174 xlate-list
= "1,3,4,7,8,15,C".
175 RUN set-rentalspace-fields.
177 CASE report-sequence
:
178 WHEN "Region" THEN ASSIGN
186 RUN basic-report
( report-asat-date
).
190 /* _UIB-CODE-BLOCK-END
*/
195 &IF DEFINED(EXCLUDE-output-vacant-summary) = 0 &THEN
197 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE output-vacant-summary Procedure
198 PROCEDURE output-vacant-summary
:
199 /*------------------------------------------------------------------------------
201 ------------------------------------------------------------------------------*/
202 current-process
= "SUMMARY".
203 FIND LAST PeriodicDetail
WHERE PeriodicDetail.ReportID
= report-id
204 AND PeriodicDetail.Date
<= report-asat-date
205 AND PeriodicDetail.DetailType
= "D"
208 report-title
= "Summary of Vacant Space ~nas at " + STRING( PeriodicDetail.Date
, "99/99/9999")
209 + (IF report-sequence
= "Single":U
THEN " for " + one-manager-name
ELSE "").
210 now
= STRING( TODAY, "99/99/9999" ) + ", " + STRING( TIME, "HH:MM:SS" ).
212 xlate-list
= "1,3,16,4,7,17".
213 RUN set-rentalspace-fields.
215 /* ENTRY( 7, total-formats
, delim
) = ">>,>>9.99".
*/
220 RUN basic-report
( report-asat-date
).
224 /* _UIB-CODE-BLOCK-END
*/
229 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
231 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
232 PROCEDURE parse-parameters
:
233 /*------------------------------------------------------------------------------
234 Purpose
: Decode the command-line parameters
235 ------------------------------------------------------------------------------*/
236 DEF VAR i
AS INT NO-UNDO.
237 DEF VAR token
AS CHAR NO-UNDO.
239 {inc
/showopts.i
"report-options"}
241 DO i
= 1 TO NUM-ENTRIES( report-options
, "~n" ):
242 token
= ENTRY( i
, report-options
, "~n" ).
243 CASE( ENTRY( 1, token
) ):
244 WHEN "Debug" THEN debug-mode
= Yes.
245 WHEN "Regenerate" THEN gen-report
= Yes.
246 WHEN "FileName" THEN file-name
= TRIM( SUBSTRING(token
, LENGTH(ENTRY(1,token
)) + 2) ).
247 WHEN "AsAtDate" THEN report-asat-date
= DATE( ENTRY(2,token
) ).
249 WHEN "MinRental" THEN min-rental
= DEC( ENTRY(2,token
) ).
250 WHEN "Sequence" THEN report-sequence
= ENTRY(2,token
).
251 WHEN "OneManager" THEN single-manager
= INT( ENTRY(2,token
) ).
252 WHEN "MergeParks" THEN merge-parks
= yes.
253 WHEN "SummaryOnly" THEN print-summary-only
= yes.
257 IF gen-report
THEN report-asat-date
= TODAY.
258 IF file-name
= "Preview" THEN ASSIGN
259 file-name
= "Printer"
260 report-preview
= Yes.
262 IF report-sequence
= "Single":U
THEN DO:
263 FIND Person
WHERE Person.PersonCode
= single-manager
NO-LOCK NO-ERROR.
264 IF AVAILABLE(Person
) THEN
265 one-manager-name
= Person.FirstName
+ " " + Person.LastName .
267 report-sequence
= "Manager":U .
272 /* _UIB-CODE-BLOCK-END
*/
277 &IF DEFINED(EXCLUDE-pre-break-begin) = 0 &THEN
279 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-break-begin Procedure
280 PROCEDURE pre-break-begin
:
281 /*------------------------------------------------------------------------------
282 Purpose
: override the break begin procedure
283 ------------------------------------------------------------------------------*/
284 DEF INPUT PARAMETER break-level
AS INT NO-UNDO.
286 IF current-process
= "VACANCIES" THEN DO:
287 IF report-sequence
= "Single":U
AND break-level
= 1 THEN RETURN "No".
291 RUN skip-line
(0).
/* force headers
*/
292 IF current-process
= "SUMMARY" THEN RETURN "NO".
296 /* _UIB-CODE-BLOCK-END
*/
301 &IF DEFINED(EXCLUDE-pre-break-end) = 0 &THEN
303 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-break-end Procedure
304 PROCEDURE pre-break-end
:
305 /*------------------------------------------------------------------------------
306 Purpose
: Override the default break-end process
307 ------------------------------------------------------------------------------*/
308 DEF INPUT PARAMETER break-level
AS INT NO-UNDO.
310 IF current-process
<> "SUMMARY" THEN RETURN.
311 IF break-level
= 1 THEN RETURN "NO".
312 IF break-level
<> 2 AND break-level
<> 0 THEN RETURN.
314 DEF VAR total-line
AS CHAR NO-UNDO.
315 DEF VAR break-value
AS CHAR NO-UNDO.
316 DEF VAR area
AS DECIMAL NO-UNDO.
317 DEF VAR i
AS INT NO-UNDO.
318 DEF VAR totals
AS CHAR NO-UNDO.
319 DEF VAR portfolio-area
AS DECIMAL NO-UNDO.
320 DEF VAR portfolio-rent
AS DECIMAL NO-UNDO.
322 totals
= (IF break-level
= 0 THEN grd-tot
ELSE brk-tot
[break-level
]).
323 break-value
= IF break-level
= 0 THEN "Grand Total" ELSE brk-val
[break-level
].
324 ASSIGN area
= DECIMAL( ENTRY( 2, totals
, delim
) ) NO-ERROR.
325 IF area
= ?
THEN area
= 0.
330 total-line
= total-line
+ break-value
+ delim.
331 /* ELSE IF i
= 7 AND area
<> 0 THEN
332 total-line
= total-line
+ STRING( (DECIMAL( ENTRY( 5, totals
, delim
)) / area
),
333 ENTRY( i
, total-formats
, delim
) )
335 ELSE IF i
= 7 OR ENTRY( i
, total-list
, delim
) <> "Y" THEN
336 total-line
= total-line
+ delim.
*/
337 ELSE /* i
= 2, 3, or
4 */
338 total-line
= total-line
+ STRING( DECIMAL( ENTRY( i
, totals
, delim
)),
339 ENTRY( i
, total-formats
, delim
) )
343 IF break-level
= 0 THEN DO:
346 /* overwrite the total figures for
% area and
% rent with zero since the totals
348 FOR EACH PropInfo
NO-LOCK:
350 portfolio-area
= portfolio-area
+ PropInfo.TotalArea
351 portfolio-rent
= portfolio-rent
+ PropInfo.TotalRent.
353 ENTRY(3, total-line
, delim
) = " ".
354 ENTRY(6, total-line
, delim
) = " ".
356 IF file-name
= "Printer" THEN RUN line-to-printer
( No
, total-line
+ delim
+ "" ).
357 ELSE RUN line-to-file
( total-line
+ delim
+ "" ).
359 /* print
% for total portfolio line
*/
360 ENTRY(1, total-line
, delim
) = "Whole Portfolio".
361 ENTRY(3, total-line
, delim
) = STRING(DECIMAL(ENTRY(2, total-line
, delim
)) / portfolio-area
* 100,">>9.99").
362 ENTRY(6, total-line
, delim
) = STRING(DECIMAL(ENTRY(5, total-line
, delim
)) / portfolio-rent
* 100,">>9.99").
363 ENTRY(2, total-line
, delim
) = " ".
364 ENTRY(4, total-line
, delim
) = " ".
365 ENTRY(5, total-line
, delim
) = " ".
369 IF file-name
= "Printer" THEN RUN line-to-printer
( No
, total-line
+ delim
+ "" ).
370 ELSE RUN line-to-file
( total-line
+ delim
+ "" ).
377 /* _UIB-CODE-BLOCK-END
*/
382 &IF DEFINED(EXCLUDE-pre-detail-line) = 0 &THEN
384 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-detail-line Procedure
385 PROCEDURE pre-detail-line
:
386 /*------------------------------------------------------------------------------
387 Purpose
: Override the default detail-line processing
388 ------------------------------------------------------------------------------*/
389 DEF INPUT-OUTPUT PARAMETER break-value
AS CHAR NO-UNDO.
391 DEF VAR property-code
AS INT NO-UNDO.
393 /* MESSAGE PeriodicDetail.ReportId PeriodicDetail.Date PeriodicDetail.DetailType PeriodicDetail.BreakValue3.
*/
394 IF report-sequence
= "Single":U
THEN DO:
395 property-code
= INT( TRIM( ENTRY( 1, ENTRY( 2, PeriodicDetail.BreakValue1
, "|"), " ") ) ).
396 FIND Property
WHERE Property.PropertyCode
= property-code
NO-LOCK NO-ERROR.
397 IF Property.Manager
<> single-manager
THEN RETURN "No".
398 /* MESSAGE ">>" + manager-name
+ "<< >>" + one-manager-name
+ "<<".
*/
401 IF ABSOLUTE( DECIMAL( ENTRY( 7, PeriodicDetail.Data
, delim
) ) ) < min-rental
THEN
406 /* _UIB-CODE-BLOCK-END
*/
411 &IF DEFINED(EXCLUDE-pre-output-line) = 0 &THEN
413 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-output-line Procedure
414 PROCEDURE pre-output-line
:
415 /*------------------------------------------------------------------------------
416 Purpose
: Selectively override the printing of the detail line
417 ------------------------------------------------------------------------------*/
418 DEF INPUT PARAMETER break-value
AS CHAR NO-UNDO.
420 IF current-process
= "VACANCIES" THEN RETURN.
421 IF current-process
= "SUMMARY" THEN RETURN "NO".
425 /* _UIB-CODE-BLOCK-END
*/
430 &IF DEFINED(EXCLUDE-second-pass) = 0 &THEN
432 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE second-pass Procedure
433 PROCEDURE second-pass
:
434 /*------------------------------------------------------------------------------
435 Purpose
: Second pass to set up vacant space totals in breakvalue
2
436 ------------------------------------------------------------------------------*/
437 DEF VAR last-pcode
AS INT NO-UNDO INITIAL -1.
438 DEF VAR this-pcode
AS INT NO-UNDO INITIAL -1.
439 DEF VAR ptotal
AS DEC NO-UNDO.
440 DEF VAR val
AS DEC NO-UNDO.
441 DEF BUFFER PD
FOR PeriodicDetail.
443 FOR EACH PeriodicDetail
WHERE PeriodicDetail.ReportID
= report-id
444 AND PeriodicDetail.DetailType
= "D"
445 AND PeriodicDetail.Date
= TODAY
447 BY PeriodicDetail.BreakValue2
DESCENDING:
448 this-pcode
= INTEGER( SUBSTRING( ENTRY( 2, PeriodicDetail.BreakValue2
, delim
), 1, 5)).
449 IF this-pcode
<> last-pcode
THEN DO:
451 FOR EACH PD
NO-LOCK WHERE PD.BreakValue2
= PeriodicDetail.BreakValue2
452 AND PD.ReportID
= report-id
453 AND PD.DetailType
= "D"
454 AND PD.Date
= TODAY :
455 ASSIGN val
= DECIMAL( ENTRY( 7, PD.Data
, delim
) ) NO-ERROR.
456 ptotal
= ptotal
- (IF val
= ?
THEN 0 ELSE val
).
458 last-pcode
= this-pcode.
460 ENTRY( 1, PeriodicDetail.BreakValue2
, delim
) = ENTRY( 1, PeriodicDetail.BreakValue2
, delim
) +
461 " " + STRING( ptotal
, "9999999999.99").
466 /* _UIB-CODE-BLOCK-END
*/