1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
8 ------------------------------------------------------------------------*/
10 DEF INPUT PARAMETER report-options
AS CHAR NO-UNDO.
12 DEF VAR preview
AS LOGI
NO-UNDO INIT Yes.
13 DEF VAR property-1
AS INT NO-UNDO INIT 0.
14 DEF VAR property-n
AS INT NO-UNDO INIT 99999.
15 DEF VAR selection-style
AS CHAR NO-UNDO.
16 DEF VAR test-client-code
AS CHAR NO-UNDO INITIAL ?.
17 DEF VAR company-list
AS CHAR NO-UNDO INITIAL ?.
18 DEF VAR property-code
AS INT NO-UNDO.
19 DEF VAR property-name
AS CHAR NO-UNDO.
23 DEF VAR user-name
AS CHAR NO-UNDO.
24 {inc
/username.i
"user-name"}
25 DEF VAR timeStamp
AS CHAR FORMAT "X(44)" NO-UNDO.
26 timeStamp
= STRING( TODAY, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
28 DEF VAR line
AS CHAR NO-UNDO INITIAL "".
30 /* _UIB-CODE-BLOCK-END
*/
34 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
36 /* ******************** Preprocessor Definitions
******************** */
38 &Scoped-define PROCEDURE-TYPE Procedure
42 /* _UIB-PREPROCESSOR-BLOCK-END
*/
47 /* *********************** Procedure Settings
************************ */
49 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
50 /* Settings for
THIS-PROCEDURE
54 Add Fields to
: Neither
55 Other Settings
: CODE-ONLY
COMPILE
57 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
59 /* ************************* Create Window
************************** */
61 &ANALYZE-SUSPEND _CREATE-WINDOW
62 /* DESIGN Window definition
(used by the UIB
)
63 CREATE WINDOW Procedure
ASSIGN
66 /* END WINDOW DEFINITION
*/
72 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
73 /* ************************* Included-Libraries
*********************** */
75 {inc
/method
/m-txtrep.i
}
77 /* _UIB-CODE-BLOCK-END
*/
82 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
85 /* *************************** Main Block
*************************** */
87 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
89 RUN pclrep-start
( preview
, "reset,portrait,tm,2,a4,lm,6,courier,cpi,18,lpi,9").
91 IF selection-style
= "OneClient" THEN RUN for-one-client.
92 ELSE IF selection-style
= "CompanyList" THEN RUN for-company-list.
94 RUN for-each-property.
100 /* _UIB-CODE-BLOCK-END
*/
104 /* ********************** Internal Procedures
*********************** */
106 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-property Procedure
107 PROCEDURE each-property
:
108 /*------------------------------------------------------------------------------
109 Purpose
: Print the building area reconciliation
110 ------------------------------------------------------------------------------*/
111 DEF VAR delim
AS CHAR INITIAL "|" NO-UNDO.
112 DEF VAR level-totals
AS CHAR NO-UNDO INITIAL ?.
113 DEF VAR last-level
AS INT NO-UNDO INITIAL 9876543.
114 DEF VAR level-name
AS CHAR NO-UNDO INITIAL "".
116 DEF VAR level-leased
AS DECIMAL NO-UNDO INITIAL 0.
117 DEF VAR level-vacant
AS DECIMAL NO-UNDO INITIAL 0.
118 DEF VAR level-common
AS DECIMAL NO-UNDO INITIAL 0.
120 DEF VAR total-leased
AS DECIMAL NO-UNDO INITIAL 0.
121 DEF VAR total-vacant
AS DECIMAL NO-UNDO INITIAL 0.
122 DEF VAR total-common
AS DECIMAL NO-UNDO INITIAL 0.
123 DEF VAR total-parks
AS DECIMAL NO-UNDO INITIAL 0.
125 property-code
= Property.PropertyCode.
126 property-name
= Property.Name.
128 FOR EACH RentalSpace
OF Property
NO-LOCK
129 WHERE RentalSpace.AreaStatus
<> "X"
130 BY RentalSpace.PropertyCode
BY RentalSpace.Level
BY RentalSpace.LevelSequence
:
132 IF RentalSpace.AreaType
= "C" THEN
133 total-parks
= total-parks
+ RentalSpace.AreaSize.
135 RUN test-floor-space
( RentalSpace.AreaType
, RentalSpace.AreaSize
).
136 IF RETURN-VALUE = "Yes" THEN DO:
137 IF RentalSpace.Level
<> last-level
THEN DO:
138 IF level-totals
= ?
THEN
140 ELSE IF level-leased
= 0 AND level-vacant
= 0 THEN
143 level-totals
= level-totals
+ (IF level-totals
<> "" THEN delim
ELSE "")
144 + (IF last-level
= 0 THEN " GRD" ELSE STRING( last-level
, "->>9"))
145 + STRING( level-leased
, ">,>>>,>>9.99")
146 + STRING( level-vacant
, ">,>>>,>>9.99")
147 + STRING( level-common
, ">,>>>,>>9.99")
148 + STRING( level-leased
+ level-vacant
, ">,>>>,>>9.99").
151 last-level
= RentalSpace.level
152 total-vacant
= total-vacant
+ level-vacant
153 total-leased
= total-leased
+ level-leased
154 total-common
= total-common
+ level-common
159 CASE RentalSpace.AreaStatus
:
160 WHEN "V" THEN level-vacant
= level-vacant
+ RentalSpace.AreaSize.
161 WHEN "C" THEN level-common
= level-common
+ RentalSpace.AreaSize.
162 OTHERWISE level-leased
= level-leased
+ RentalSpace.AreaSize.
167 IF level-totals
= ?
THEN
169 ELSE IF level-leased
= 0 AND level-vacant
= 0 THEN
172 level-totals
= level-totals
+ (IF level-totals
<> "" THEN delim
ELSE "")
173 + (IF last-level
= 0 THEN " GRD" ELSE STRING( last-level
, "->>9"))
174 + STRING( level-leased
, ">,>>>,>>9.99")
175 + STRING( level-vacant
, ">,>>>,>>9.99")
176 + STRING( level-common
, ">,>>>,>>9.99")
177 + STRING( level-leased
+ level-vacant
, ">,>>>,>>9.99").
180 total-vacant
= total-vacant
+ level-vacant
181 total-leased
= total-leased
+ level-leased
182 total-common
= total-common
+ level-common.
184 DEF VAR i
AS INT NO-UNDO.
185 DEF VAR no-of
AS INT NO-UNDO.
187 no-of
= NUM-ENTRIES( level-totals
, delim
).
188 level-totals
= level-totals
+ delim
+ delim.
/* so we don't get errors unstringing
*/
190 line
= ENTRY( i
, level-totals
, delim
).
191 RUN print-line
( line
).
194 line
= FILL( " ", 4) + FILL( " " + FILL( "-", 11), 4).
195 RUN print-line
( line
).
197 + STRING( total-leased
, ">,>>>,>>9.99")
198 + STRING( total-vacant
, ">,>>>,>>9.99")
199 + STRING( total-common
, ">,>>>,>>9.99")
200 + STRING( total-leased
+ total-vacant
, ">,>>>,>>9.99")
201 + " Total car parking: " + STRING( total-parks
, "->,>>9" ).
202 RUN print-line
( line
).
204 IF total-parks
<> Property.TotalParks
OR (total-leased
+ total-vacant
) <> Property.TotalArea
THEN DO:
205 RUN pclrep-down-by
(1).
206 line
= "From property file:" + FILL(" ",20)
207 + STRING( Property.TotalArea
, "->,>>>,>>9.99")
208 + " car parking: " + STRING( Property.TotalParks
, "->,>>9" ).
209 RUN print-line
( line
).
210 line
= FILL( " ", 4) + FILL( " " + FILL( "-", 11), 4).
211 RUN print-line
( line
).
213 total-parks
= total-parks
- Property.TotalParks.
214 total-leased
= total-leased
+ total-vacant
- Property.TotalArea.
215 line
= "*** Discrepancy ***" + FILL(" ",20)
216 + STRING( total-leased
, "->,>>>,>>9.99")
217 + " car parking: " + STRING( total-parks
, "->,>>9" ).
218 RUN print-line
( line
).
220 line
= FILL( " ", 4) + FILL( " " + FILL( "=", 11), 4).
221 RUN print-line
( line
).
225 /* _UIB-CODE-BLOCK-END
*/
229 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE for-company-list Procedure
230 PROCEDURE for-company-list
:
231 /*------------------------------------------------------------------------------
233 ------------------------------------------------------------------------------*/
234 DEF VAR i
AS INT NO-UNDO.
235 DEF VAR n
AS INT NO-UNDO.
236 DEF VAR company-code
AS INT NO-UNDO.
238 FIND ConsolidationList
WHERE ConsolidationList.Name
= company-list
NO-LOCK.
239 n
= NUM-ENTRIES( ConsolidationList.CompanyList
).
241 company-code
= INT( ENTRY( i
, ConsolidationList.CompanyList
) ).
242 FOR EACH Property
WHERE Property.CompanyCode
= company-code
243 AND Property.Active
NO-LOCK:
250 /* _UIB-CODE-BLOCK-END
*/
254 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE for-each-property Procedure
255 PROCEDURE for-each-property
:
256 /*------------------------------------------------------------------------------
258 ------------------------------------------------------------------------------*/
260 FOR EACH Property
WHERE Property.PropertyCode
>= property-1
261 AND Property.PropertyCode
<= property-n
NO-LOCK:
267 /* _UIB-CODE-BLOCK-END
*/
271 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE for-one-client Procedure
272 PROCEDURE for-one-client
:
273 /*------------------------------------------------------------------------------
275 ------------------------------------------------------------------------------*/
277 FOR EACH Company
WHERE Company.ClientCode
= test-client-code
NO-LOCK:
278 FOR EACH Property
OF Company
WHERE Property.Active
NO-LOCK:
286 /* _UIB-CODE-BLOCK-END
*/
290 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-footer Procedure
291 PROCEDURE inst-page-footer
:
292 /*------------------------------------------------------------------------------
293 Purpose
: Print any page footer
294 ------------------------------------------------------------------------------*/
298 /* _UIB-CODE-BLOCK-END
*/
302 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-header Procedure
303 PROCEDURE inst-page-header
:
304 /*------------------------------------------------------------------------------
305 Purpose
: Print any page header
306 ------------------------------------------------------------------------------*/
308 RUN pclrep-line
( "univers,Point,7,bold,Proportional", TimeStamp
).
309 RUN pclrep-line
( "univers,Point,12,bold,Proportional",
310 "Building area reconciliation for P"
311 + TRIM(STRING(Property.PropertyCode
))
315 RUN pclrep-down-by
(2).
317 line
= "Level Occupied Vacant Common Total Level Occupied Vacant Common Total Level Occupied Vacant Common Total" .
318 RUN print-line
( line
).
319 line
= "---------------------------------------------------- ---------------------------------------------------- ----------------------------------------------------" .
320 RUN print-line
( line
).
322 RUN pclrep-down-by
(1).
326 /* _UIB-CODE-BLOCK-END
*/
330 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
331 PROCEDURE parse-parameters
:
332 /*------------------------------------------------------------------------------
334 ------------------------------------------------------------------------------*/
335 DEF VAR token
AS CHAR NO-UNDO.
336 DEF VAR i
AS INT NO-UNDO.
338 DO i
= 1 TO NUM-ENTRIES( report-options
, "~n" ):
339 token
= ENTRY( i
, report-options
, "~n" ).
341 CASE ENTRY( 1, token
):
342 WHEN "Preview" THEN preview
= Yes.
349 /* _UIB-CODE-BLOCK-END
*/
353 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-line Procedure
354 PROCEDURE print-line
:
355 /*------------------------------------------------------------------------------
359 ------------------------------------------------------------------------------*/
360 DEFINE INPUT PARAMETER line
AS CHARACTER NO-UNDO.
362 RUN pclrep-line
("univers,Point,12,bold,Proportional",
367 /* _UIB-CODE-BLOCK-END
*/
371 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE test-floor-space Procedure
372 PROCEDURE test-floor-space
:
373 /*------------------------------------------------------------------------------
374 Purpose
: Decide if this is actual floor space
375 ------------------------------------------------------------------------------*/
376 DEF INPUT PARAMETER type
AS CHAR NO-UNDO.
377 DEF INPUT PARAMETER area
AS DECIMAL NO-UNDO.
379 DEF BUFFER LocAreaType
FOR AreaType.
381 IF area
= ?
THEN RETURN "No".
382 FIND LocAreaType
WHERE LocAreaType.AreaType
= type
NO-LOCK NO-ERROR.
383 IF AVAILABLE(LocAreaType
) THEN DO:
384 IF LocAreaType.IsCarPark
THEN RETURN "Park".
385 IF LocAreaType.IsFloorArea
THEN RETURN "Yes".
390 WHEN "C" THEN RETURN "Park".
391 WHEN "O" THEN RETURN "Yes".
392 WHEN "R" THEN RETURN "Yes".
393 WHEN "W" THEN RETURN "Yes".
394 WHEN "N" THEN RETURN "No".
401 /* _UIB-CODE-BLOCK-END
*/