Added capital works blank section. Synced calling screen.
[capital-apms-progress.git] / process / report / prplistg.p
blobba42c745f4a531c928108d07360181063027ca31
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 ------------------------------------------------------------------------*/
7 &IF DEFINED(UIB_IS_RUNNING) &THEN
8 DEF VAR report-options AS CHAR NO-UNDO INITIAL "".
9 &ELSE
10 DEF INPUT PARAMETER report-options AS CHAR NO-UNDO.
11 &ENDIF
13 DEF VAR active-flag AS LOGI NO-UNDO INIT Yes.
14 DEF VAR by-propertycode AS LOGI NO-UNDO.
15 DEF VAR by-region AS LOGI NO-UNDO.
16 DEF VAR by-manager AS LOGI NO-UNDO.
17 DEF VAR by-portfolio AS LOGI NO-UNDO.
18 DEF VAR by-shortname AS LOGI NO-UNDO.
20 DEF VAR sort-desc AS CHAR NO-UNDO.
21 DEF VAR filt-desc AS CHAR NO-UNDO.
23 DEF VAR preview AS LOGI NO-UNDO INIT Yes.
24 DEF VAR user-name AS CHAR NO-UNDO.
25 {inc/username.i "user-name"}
26 DEF VAR timeStamp AS CHAR FORMAT "X(44)" NO-UNDO.
27 timeStamp = STRING( TODAY, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
30 /* $History: prplistg.p $
32 * ***************** Version 4 *****************
33 * User: Andrew Date: 22/12/97 Time: 14:49
34 * Updated in $/PROCESS/REPORT
35 * Should only check in a couple of items - let's see!
37 * ***************** Version 3 *****************
38 * User: Andrew Date: 22/12/97 Time: 9:44
39 * Updated in $/PROCESS/REPORT
40 * Testing new SS version
42 * ***************** Version 2 *****************
43 * User: Andrew Date: 19/12/97 Time: 10:46
44 * Updated in $/PROCESS/REPORT
45 * Sending an update to OZ and to Auckland
47 * ***************** Version 1 *****************
48 * User: Andrew Date: 21/07/97 Time: 0:08
49 * Created in $/PROCESS/REPORT
51 * ***************** Version 3 *****************
52 * User: Tyrone Date: 7/15/97 Time: 10:52a
53 * Updated in $/PROCESS/REPORT
55 * ***************** Version 2 *****************
56 * User: Tyrone Date: 7/11/97 Time: 2:23p
57 * Updated in $/PROCESS/REPORT
59 * ***************** Version 1 *****************
60 * User: Tyrone Date: 7/10/97 Time: 9:35a
61 * Created in $/PROCESS/REPORT
63 * ***************** Version 5 *****************
64 * User: Andrew Date: 16/06/97 Time: 11:15
65 * Updated in $/PROCESS/REPORT
66 * Back from Auckland
68 * ***************** Version 10 *****************
69 * User: Andrew Date: 11/06/97 Time: 10:24
70 * Updated in $/PROCESS/REPORT
71 * In Auckland
73 * ***************** Version 9 *****************
74 * User: Andrew Date: 28/03/97 Time: 17:27
75 * Updated in $/PROCESS/REPORT
78 /* _UIB-CODE-BLOCK-END */
79 &ANALYZE-RESUME
82 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
84 /* ******************** Preprocessor Definitions ******************** */
86 &Scoped-define PROCEDURE-TYPE Procedure
90 /* _UIB-PREPROCESSOR-BLOCK-END */
91 &ANALYZE-RESUME
95 /* *********************** Procedure Settings ************************ */
97 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
98 /* Settings for THIS-PROCEDURE
99 Type: Procedure
100 Allow:
101 Frames: 0
102 Add Fields to: Neither
103 Other Settings: CODE-ONLY COMPILE
105 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
107 /* ************************* Create Window ************************** */
109 &ANALYZE-SUSPEND _CREATE-WINDOW
110 /* DESIGN Window definition (used by the UIB)
111 CREATE WINDOW Procedure ASSIGN
112 HEIGHT = .29
113 WIDTH = 30.14.
114 /* END WINDOW DEFINITION */
116 &ANALYZE-RESUME
120 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
121 /* ************************* Included-Libraries *********************** */
123 {inc/method/m-txtrep.i}
125 /* _UIB-CODE-BLOCK-END */
126 &ANALYZE-RESUME
130 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
133 /* *************************** Main Block *************************** */
135 RUN parse-parameters.
137 OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES PAGE-SIZE 0.
139 RUN pclrep-start( preview, "reset,portrait,tm,2,a4,lm,4,courier,cpi,18,lpi,9").
141 RUN property-listing.
143 OUTPUT CLOSE.
145 RUN pclrep-finish.
147 /* _UIB-CODE-BLOCK-END */
148 &ANALYZE-RESUME
151 /* ********************** Internal Procedures *********************** */
153 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-property Procedure
154 PROCEDURE each-property :
155 /*------------------------------------------------------------------------------
156 Purpose:
157 Parameters: <none>
158 Notes:
159 ------------------------------------------------------------------------------*/
161 RUN pclrep-line( "courier,Fixed,cpi,18,lpi,9,Normal",
162 STRING( Property.PropertyCode, "99999" ) + SPC(4) +
163 STRING( Property.Active, "Yes/No" ) + SPC( 4 ) +
164 STRING( Property.ShortName, "X(10)" ) + SPC( 4 ) +
165 STRING( Property.Name, "X(30)" ) + SPC( 4 ) +
166 STRING( Property.StreetAddress, "X(50)" ) + SPC( 4 ) +
167 STRING( Property.City, "X(15)" )
170 END PROCEDURE.
172 /* _UIB-CODE-BLOCK-END */
173 &ANALYZE-RESUME
176 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE group-header Procedure
177 PROCEDURE group-header :
178 /*------------------------------------------------------------------------------
179 Purpose:
180 Parameters: <none>
181 Notes:
182 ------------------------------------------------------------------------------*/
184 DEF INPUT PARAMETER header-text AS CHAR NO-UNDO.
186 RUN pclrep-line( "Helvetica,Point,8,Bold,Proportional", header-text ).
187 RUN pclrep-line( "", "" ).
189 END PROCEDURE.
191 /* _UIB-CODE-BLOCK-END */
192 &ANALYZE-RESUME
195 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-footer Procedure
196 PROCEDURE inst-page-footer :
197 /*------------------------------------------------------------------------------
198 Purpose: Print any page footer
199 ------------------------------------------------------------------------------*/
201 END PROCEDURE.
203 /* _UIB-CODE-BLOCK-END */
204 &ANALYZE-RESUME
207 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-header Procedure
208 PROCEDURE inst-page-header :
209 /*------------------------------------------------------------------------------
210 Purpose: Print any page header
211 ------------------------------------------------------------------------------*/
213 RUN pclrep-line( "univers,Point,7,bold,proportional", TimeStamp).
214 RUN pclrep-line( "univers,Point,12,bold,proportional",
215 FILL( " ", 45) + "Property Listing by " + sort-desc
218 RUN pclrep-line( "", "").
219 RUN pclrep-line( "courier,Fixed,cpi,18,lpi,9,Bold",
220 STRING( "Code", "X(5)" ) + SPC(4) +
221 STRING( "Active", "X(5)" ) + SPC( 2 ) +
222 STRING( "Short Name", "X(10)" ) + SPC( 4 ) +
223 STRING( "Name", "X(30)" ) + SPC( 4 ) +
224 STRING( "Street Address", "X(50)" ) + SPC( 4 ) +
225 STRING( "City", "X(15)" )
227 RUN pclrep-line( "", "").
229 END PROCEDURE.
231 /* _UIB-CODE-BLOCK-END */
232 &ANALYZE-RESUME
235 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
236 PROCEDURE parse-parameters :
237 /*------------------------------------------------------------------------------
238 Purpose:
239 Parameters: <none>
240 Notes:
241 ------------------------------------------------------------------------------*/
243 DEF VAR i AS INT NO-UNDO.
244 DEF VAR token AS CHAR NO-UNDO.
246 DO i = 1 TO NUM-ENTRIES( report-options, "~n" ):
247 token = ENTRY( i, report-options, "~n" ).
249 CASE ENTRY( 1, token ):
251 WHEN "Sort" THEN
253 CASE ENTRY( 2,token ):
254 WHEN "Code" THEN ASSIGN by-propertycode = Yes sort-desc = "Property Code".
255 WHEN "Region" THEN ASSIGN by-region = Yes sort-desc = "Region".
256 WHEN "ShortName" THEN ASSIGN by-shortname = Yes sort-desc = "Short Name".
257 WHEN "Manager" THEN ASSIGN by-manager = Yes sort-desc = "Property Manager".
258 END CASE.
259 END.
261 WHEN "Active" THEN
262 CASE ENTRY( 2, token ):
263 WHEN "Yes" THEN ASSIGN active-flag = Yes filt-desc = "Active Only".
264 WHEN "No" THEN ASSIGN active-flag = No filt-desc = "Inactive Only".
265 OTHERWISE ASSIGN active-flag = ? filt-desc = "".
266 END CASE.
268 WHEN "Preview" THEN preview = ENTRY( 2, token ) = "Yes".
270 END CASE.
272 END.
274 END PROCEDURE.
276 /* _UIB-CODE-BLOCK-END */
277 &ANALYZE-RESUME
280 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE property-listing Procedure
281 PROCEDURE property-listing :
282 /*------------------------------------------------------------------------------
283 Purpose:
284 Parameters: <none>
285 Notes:
286 ------------------------------------------------------------------------------*/
288 &SCOP WHERE-PHRASE WHERE ( IF active-flag = ? THEN True ELSE Property.Active = active-flag )
290 IF by-propertycode THEN
291 FOR EACH Property NO-LOCK {&WHERE-PHRASE}:
292 RUN each-property.
293 END.
295 ELSE IF by-region THEN
296 FOR EACH Property NO-LOCK {&WHERE-PHRASE}
297 BREAK BY Property.Region:
299 IF FIRST-OF( Property.Region ) THEN
301 FIND Region WHERE Region.Region = Property.Region NO-LOCK NO-ERROR.
302 RUN group-header( IF AVAILABLE Region THEN Region.Name ELSE "Region - Unknown" ).
303 END.
305 RUN each-property.
307 IF LAST-OF( Property.Region ) THEN RUN pclrep-line( ?, ? ).
309 END.
311 ELSE IF by-shortname THEN
312 FOR EACH Property NO-LOCK {&WHERE-PHRASE} BY Property.ShortName:
313 RUN each-property.
314 END.
316 ELSE IF by-manager THEN
317 FOR EACH Property NO-LOCK {&WHERE-PHRASE}
318 BREAK BY Property.Manager:
320 IF FIRST-OF( Property.Manager ) THEN
322 FIND Person WHERE Person.PersonCode = Property.Manager NO-LOCK NO-ERROR.
323 RUN group-header( IF AVAILABLE Person
324 THEN ( "Managed by - " + TRIM( Person.FirstName + " " + Person.LastName ) )
325 ELSE "Not managed" ).
326 END.
328 RUN each-property.
330 IF LAST-OF( Property.Manager ) THEN RUN pclrep-line( ?, ? ).
332 END.
334 END PROCEDURE.
336 /* _UIB-CODE-BLOCK-END */
337 &ANALYZE-RESUME