Add %age area column to vacancies section.
[capital-apms-progress.git] / forecast / v-amtrust-market-rents.w
blobff22b9be17fcd6338e8da4db630068ec271382d2
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI
2 &ANALYZE-RESUME
3 /* Connected Databases
4 ttpl PROGRESS
5 */
6 &Scoped-define WINDOW-NAME CURRENT-WINDOW
7 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS V-table-Win
8 /*------------------------------------------------------------------------
9 File:
10 Description:
11 ------------------------------------------------------------------------*/
12 CREATE WIDGET-POOL.
13 /* *************************** Definitions ************************** */
15 &SCOPED-DEFINE REPORT-ID "Amtrust Market Rentals"
17 {inc/ofc-this.i}
19 /* _UIB-CODE-BLOCK-END */
20 &ANALYZE-RESUME
23 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
25 /* ******************** Preprocessor Definitions ******************** */
27 &Scoped-define PROCEDURE-TYPE SmartViewer
29 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
31 /* Name of first Frame and/or Browse and/or first Query */
32 &Scoped-define FRAME-NAME F-Main
34 /* External Tables */
35 &Scoped-define EXTERNAL-TABLES RP
36 &Scoped-define FIRST-EXTERNAL-TABLE RP
39 /* Need to scope the external tables to this procedure */
40 DEFINE QUERY external_tables FOR RP.
41 /* Standard List Definitions */
42 &Scoped-Define ENABLED-FIELDS RP.Char1 RP.Int1 RP.Int2 RP.Log1
43 &Scoped-define FIELD-PAIRS~
44 ~{&FP1}Int1 ~{&FP2}Int1 ~{&FP3}~
45 ~{&FP1}Int2 ~{&FP2}Int2 ~{&FP3}
46 &Scoped-define ENABLED-TABLES RP
47 &Scoped-define FIRST-ENABLED-TABLE RP
48 &Scoped-Define ENABLED-OBJECTS RECT-23 btn_print
49 &Scoped-Define DISPLAYED-FIELDS RP.Char1 RP.Int1 RP.Int2 RP.Log1
50 &Scoped-Define DISPLAYED-OBJECTS fil_Property fil_Property2
52 /* Custom List Definitions */
53 /* ADM-CREATE-FIELDS,ADM-ASSIGN-FIELDS,List-3,List-4,List-5,List-6 */
55 /* _UIB-PREPROCESSOR-BLOCK-END */
56 &ANALYZE-RESUME
60 /* *********************** Control Definitions ********************** */
63 /* Definitions of the field level widgets */
64 DEFINE BUTTON btn_print
65 LABEL "&OK"
66 SIZE 10.29 BY 1
67 FONT 9.
69 DEFINE VARIABLE fil_Property AS CHARACTER FORMAT "X(256)":U
70 VIEW-AS FILL-IN
71 SIZE 40 BY 1
72 FONT 10 NO-UNDO.
74 DEFINE VARIABLE fil_Property2 AS CHARACTER FORMAT "X(256)":U
75 VIEW-AS FILL-IN
76 SIZE 40 BY 1
77 FONT 10 NO-UNDO.
79 DEFINE RECTANGLE RECT-23
80 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
81 SIZE 68 BY 10.
84 /* ************************ Frame Definitions *********************** */
86 DEFINE FRAME F-Main
87 RP.Char1 AT ROW 1.2 COL 2 NO-LABEL
88 VIEW-AS RADIO-SET VERTICAL
89 RADIO-BUTTONS
90 "All properties", "All":U,
91 "Single Property", "OneProperty":U,
92 "Range of Properties", "PropertyRange":U
93 SIZE 17.29 BY 2.7
94 FONT 10
95 RP.Int1 AT ROW 2 COL 17.29 COLON-ALIGNED NO-LABEL FORMAT "99999"
96 VIEW-AS FILL-IN
97 SIZE 6.57 BY 1
98 FONT 10
99 fil_Property AT ROW 2 COL 26.43 COLON-ALIGNED NO-LABEL
100 RP.Int2 AT ROW 3 COL 17.29 COLON-ALIGNED NO-LABEL FORMAT "99999"
101 VIEW-AS FILL-IN
102 SIZE 6.57 BY 1
103 FONT 10
104 fil_Property2 AT ROW 3 COL 26.43 COLON-ALIGNED NO-LABEL
105 RP.Log1 AT ROW 9.8 COL 6.14
106 LABEL "Preview"
107 VIEW-AS TOGGLE-BOX
108 SIZE 14.29 BY .8
109 FONT 10
110 btn_print AT ROW 9.8 COL 58.14
111 RECT-23 AT ROW 1 COL 1
112 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
113 SIDE-LABELS NO-UNDERLINE THREE-D
114 AT COL 1 ROW 1 SCROLLABLE
115 FONT 10
116 DEFAULT-BUTTON btn_print.
119 /* *********************** Procedure Settings ************************ */
121 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
122 /* Settings for THIS-PROCEDURE
123 Type: SmartViewer
124 External Tables: ttpl.RP
125 Allow: Basic,DB-Fields
126 Frames: 1
127 Add Fields to: EXTERNAL-TABLES
128 Other Settings: PERSISTENT-ONLY COMPILE
131 /* This procedure should always be RUN PERSISTENT. Report the error, */
132 /* then cleanup and return. */
133 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
134 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
135 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
136 RETURN.
137 END.
139 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
141 /* ************************* Create Window ************************** */
143 &ANALYZE-SUSPEND _CREATE-WINDOW
144 /* DESIGN Window definition (used by the UIB)
145 CREATE WINDOW V-table-Win ASSIGN
146 HEIGHT = 11.9
147 WIDTH = 75.43.
148 /* END WINDOW DEFINITION */
150 &ANALYZE-RESUME
153 /* *************** Runtime Attributes and UIB Settings ************** */
155 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
156 /* SETTINGS FOR WINDOW V-table-Win
157 VISIBLE,,RUN-PERSISTENT */
158 /* SETTINGS FOR FRAME F-Main
159 NOT-VISIBLE Size-to-Fit */
160 ASSIGN
161 FRAME F-Main:SCROLLABLE = FALSE
162 FRAME F-Main:HIDDEN = TRUE.
164 /* SETTINGS FOR FILL-IN fil_Property IN FRAME F-Main
165 NO-ENABLE */
166 /* SETTINGS FOR FILL-IN fil_Property2 IN FRAME F-Main
167 NO-ENABLE */
168 /* SETTINGS FOR FILL-IN RP.Int1 IN FRAME F-Main
169 EXP-LABEL EXP-FORMAT */
170 /* SETTINGS FOR FILL-IN RP.Int2 IN FRAME F-Main
171 EXP-LABEL EXP-FORMAT */
172 /* SETTINGS FOR TOGGLE-BOX RP.Log1 IN FRAME F-Main
173 EXP-LABEL */
174 /* _RUN-TIME-ATTRIBUTES-END */
175 &ANALYZE-RESUME
178 /* Setting information for Queries and Browse Widgets fields */
180 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
181 /* Query rebuild information for FRAME F-Main
182 _Options = "NO-LOCK"
183 _Query is NOT OPENED
184 */ /* FRAME F-Main */
185 &ANALYZE-RESUME
190 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
191 /* ************************* Included-Libraries *********************** */
193 {src/adm/method/viewer.i}
194 {inc/method/m-mntvwr.i}
196 /* _UIB-CODE-BLOCK-END */
197 &ANALYZE-RESUME
202 /* ************************ Control Triggers ************************ */
204 &Scoped-define SELF-NAME btn_print
205 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_print V-table-Win
206 ON CHOOSE OF btn_print IN FRAME F-Main /* OK */
208 SELF:SENSITIVE = No.
209 RUN run-report.
210 SELF:SENSITIVE = Yes.
211 END.
213 /* _UIB-CODE-BLOCK-END */
214 &ANALYZE-RESUME
217 &Scoped-define SELF-NAME RP.Char1
218 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Char1 V-table-Win
219 ON VALUE-CHANGED OF RP.Char1 IN FRAME F-Main /* Char1 */
221 RUN select-options-changed.
222 END.
224 /* _UIB-CODE-BLOCK-END */
225 &ANALYZE-RESUME
228 &Scoped-define SELF-NAME fil_Property
229 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
230 ON U1 OF fil_Property IN FRAME F-Main
232 {inc/selfil/sfpro1.i "RP" "Int1"}
233 END.
235 /* _UIB-CODE-BLOCK-END */
236 &ANALYZE-RESUME
239 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
240 ON U2 OF fil_Property IN FRAME F-Main
242 {inc/selfil/sfpro2.i "RP" "Int1"}
243 END.
245 /* _UIB-CODE-BLOCK-END */
246 &ANALYZE-RESUME
249 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
250 ON U3 OF fil_Property IN FRAME F-Main
252 {inc/selfil/sfpro3.i "RP" "Int1"}
253 END.
255 /* _UIB-CODE-BLOCK-END */
256 &ANALYZE-RESUME
259 &Scoped-define SELF-NAME fil_Property2
260 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property2 V-table-Win
261 ON U1 OF fil_Property2 IN FRAME F-Main
263 {inc/selfil/sfpro1.i "RP" "Int2"}
264 END.
266 /* _UIB-CODE-BLOCK-END */
267 &ANALYZE-RESUME
270 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property2 V-table-Win
271 ON U2 OF fil_Property2 IN FRAME F-Main
273 {inc/selfil/sfpro2.i "RP" "Int2"}
274 END.
276 /* _UIB-CODE-BLOCK-END */
277 &ANALYZE-RESUME
280 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property2 V-table-Win
281 ON U3 OF fil_Property2 IN FRAME F-Main
283 {inc/selfil/sfpro3.i "RP" "Int2"}
284 END.
286 /* _UIB-CODE-BLOCK-END */
287 &ANALYZE-RESUME
290 &Scoped-define SELF-NAME RP.Int1
291 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int1 V-table-Win
292 ON LEAVE OF RP.Int1 IN FRAME F-Main /* Int1 */
294 {inc/selcde/cdpro.i "fil_Property"}
295 END.
297 /* _UIB-CODE-BLOCK-END */
298 &ANALYZE-RESUME
301 &Scoped-define SELF-NAME RP.Int2
302 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int2 V-table-Win
303 ON LEAVE OF RP.Int2 IN FRAME F-Main /* Int2 */
305 {inc/selcde/cdpro.i "fil_Property2"}
306 END.
308 /* _UIB-CODE-BLOCK-END */
309 &ANALYZE-RESUME
312 &UNDEFINE SELF-NAME
314 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
317 /* *************************** Main Block *************************** */
319 /* _UIB-CODE-BLOCK-END */
320 &ANALYZE-RESUME
323 /* ********************** Internal Procedures *********************** */
325 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win
326 PROCEDURE adm-row-available :
327 /*------------------------------------------------------------------------------
328 Purpose: Override (thoroughly!) the Progress adm-row-available
329 ------------------------------------------------------------------------------*/
331 /* Define variables needed by this internal procedure. */
332 {src/adm/template/row-head.i}
334 /* Create a list of all the tables that we need to get. */
335 {src/adm/template/row-list.i "Creditor"}
337 /* Get the record ROWID's from the RECORD-SOURCE. */
338 {src/adm/template/row-get.i}
340 /* FIND each record specified by the RECORD-SOURCE. */
341 {src/adm/template/row-find.i "Creditor"}
343 /* Process the newly available records (i.e. display fields,
344 open queries, and/or pass records on to any RECORD-TARGETS). */
345 {src/adm/template/row-end.i}
347 END PROCEDURE.
349 /* _UIB-CODE-BLOCK-END */
350 &ANALYZE-RESUME
353 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
354 PROCEDURE disable_UI :
355 /*------------------------------------------------------------------------------
356 Purpose: DISABLE the User Interface
357 Parameters: <none>
358 Notes: Here we clean-up the user-interface by deleting
359 dynamic widgets we have created and/or hide
360 frames. This procedure is usually called when
361 we are ready to "clean-up" after running.
362 ------------------------------------------------------------------------------*/
363 /* Hide all frames. */
364 HIDE FRAME F-Main.
365 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
366 END PROCEDURE.
368 /* _UIB-CODE-BLOCK-END */
369 &ANALYZE-RESUME
372 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable-appropriate-fields V-table-Win
373 PROCEDURE enable-appropriate-fields :
374 /*------------------------------------------------------------------------------
375 Purpose:
376 ------------------------------------------------------------------------------*/
377 DO WITH FRAME {&FRAME-NAME}:
379 RUN select-options-changed.
381 END.
382 END PROCEDURE.
384 /* _UIB-CODE-BLOCK-END */
385 &ANALYZE-RESUME
388 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-enable-fields V-table-Win
389 PROCEDURE inst-enable-fields :
390 /*------------------------------------------------------------------------------
391 Purpose:
392 ------------------------------------------------------------------------------*/
394 RUN enable-appropriate-fields.
396 END PROCEDURE.
398 /* _UIB-CODE-BLOCK-END */
399 &ANALYZE-RESUME
402 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
403 PROCEDURE inst-initialize :
404 /*------------------------------------------------------------------------------
405 Purpose:
406 ------------------------------------------------------------------------------*/
407 DEF VAR user-name AS CHAR NO-UNDO.
409 {inc/username.i "user-name"}
411 FIND RP WHERE RP.UserName = user-name
412 AND RP.ReportID = {&REPORT-ID} NO-ERROR.
414 IF NOT AVAILABLE RP THEN DO WITH FRAME {&FRAME-NAME}:
415 CREATE RP.
416 ASSIGN RP.ReportID = {&REPORT-ID}
417 RP.UserName = user-name
418 RP.Char1 = "All"
419 RP.Log1 = Yes
420 RP.Log2 = Yes.
421 END.
423 RUN dispatch( 'display-fields':U ).
424 RUN dispatch( 'enable-fields':U ).
426 END PROCEDURE.
428 /* _UIB-CODE-BLOCK-END */
429 &ANALYZE-RESUME
432 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
433 PROCEDURE pre-destroy :
434 /*------------------------------------------------------------------------------
435 Purpose:
436 Parameters: <none>
437 Notes:
438 ------------------------------------------------------------------------------*/
440 RUN check-modified( "CLEAR" ).
442 END PROCEDURE.
444 /* _UIB-CODE-BLOCK-END */
445 &ANALYZE-RESUME
448 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE run-report V-table-Win
449 PROCEDURE run-report :
450 /*------------------------------------------------------------------------------
451 Purpose: Actually run the report through RB engine.
452 ------------------------------------------------------------------------------*/
453 DEF VAR report-options AS CHAR NO-UNDO.
455 RUN verify-report.
456 IF RETURN-VALUE = "FAIL" THEN RETURN.
458 RUN dispatch( 'update-record':U ).
460 report-options = RP.Char1
461 + (IF RP.Char1 = "OneProperty" THEN
462 "~nProperties," + STRING(RP.Int1) + "," + STRING(RP.Int1)
463 ELSE (IF RP.Char1 = "PropertyRange" THEN
464 "~nProperties," + STRING(RP.Int1) + "," + STRING(RP.Int2)
465 ELSE ""))
466 + (IF RP.Log1 THEN "~nPreview" ELSE "") .
468 RUN notify( 'set-busy, CONTAINER-SOURCE':U ).
469 RUN forecast/amtrust-market-rents.p ( report-options ).
470 RUN notify( 'set-idle, CONTAINER-SOURCE':U ).
472 END PROCEDURE.
474 /* _UIB-CODE-BLOCK-END */
475 &ANALYZE-RESUME
478 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE select-options-changed V-table-Win
479 PROCEDURE select-options-changed :
480 /*------------------------------------------------------------------------------
481 Purpose:
482 ------------------------------------------------------------------------------*/
483 DEF VAR options AS CHAR NO-UNDO.
485 options = INPUT FRAME {&FRAME-NAME} RP.Char1.
487 CASE options:
488 WHEN "All" THEN
489 DO WITH FRAME {&FRAME-NAME}:
490 HIDE RP.Int1 fil_Property RP.Int2 fil_Property2.
491 RUN set-link-attributes IN sys-mgr( THIS-PROCEDURE, STRING( fil_Property:HANDLE ), "HIDDEN = Yes":U ).
492 RUN set-link-attributes IN sys-mgr( THIS-PROCEDURE, STRING( fil_Property2:HANDLE ), "HIDDEN = Yes":U ).
493 END.
495 WHEN "OneProperty" THEN
496 DO WITH FRAME {&FRAME-NAME}:
497 HIDE RP.Int2 fil_Property2.
498 VIEW RP.Int1 fil_Property.
499 RUN set-link-attributes IN sys-mgr( THIS-PROCEDURE, STRING( fil_Property:HANDLE ), "HIDDEN = No":U ).
500 RUN set-link-attributes IN sys-mgr( THIS-PROCEDURE, STRING( fil_Property2:HANDLE ), "HIDDEN = Yes":U ).
501 END.
503 WHEN "PropertyRange" THEN
504 DO WITH FRAME {&FRAME-NAME}:
505 VIEW RP.Int1 fil_Property RP.Int2 fil_Property2.
506 RUN set-link-attributes IN sys-mgr( THIS-PROCEDURE, STRING( fil_Property:HANDLE ), "HIDDEN = No":U ).
507 RUN set-link-attributes IN sys-mgr( THIS-PROCEDURE, STRING( fil_Property2:HANDLE ), "HIDDEN = No":U ).
508 END.
509 END.
511 END PROCEDURE.
513 /* _UIB-CODE-BLOCK-END */
514 &ANALYZE-RESUME
517 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win
518 PROCEDURE send-records :
519 /*------------------------------------------------------------------------------
520 Purpose:
521 ------------------------------------------------------------------------------*/
523 /* Define variables needed by this internal procedure. */
524 {src/adm/template/snd-head.i}
526 /* For each requested table, put it's ROWID in the output list. */
527 {src/adm/template/snd-list.i "Creditor"}
529 /* Deal with any unexpected table requests before closing. */
530 {src/adm/template/snd-end.i}
532 END PROCEDURE.
534 /* _UIB-CODE-BLOCK-END */
535 &ANALYZE-RESUME
538 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
539 PROCEDURE state-changed :
540 /* -----------------------------------------------------------
541 Purpose:
542 Parameters: <none>
543 Notes:
544 -------------------------------------------------------------*/
545 DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
546 DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
548 CASE p-state:
549 /* Object instance CASEs can go here to replace standard behavior
550 or add new cases. */
551 {src/adm/template/vstates.i}
552 END CASE.
553 END PROCEDURE.
555 /* _UIB-CODE-BLOCK-END */
556 &ANALYZE-RESUME
559 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-report V-table-Win
560 PROCEDURE verify-report :
561 /*------------------------------------------------------------------------------
562 Purpose:
563 ------------------------------------------------------------------------------*/
565 CASE INPUT FRAME {&FRAME-NAME} RP.Char1:
567 WHEN 'OneProperty' THEN
568 IF NOT CAN-FIND( FIRST Property WHERE Property.PropertyCode =
569 INPUT FRAME {&FRAME-NAME} RP.Int1 ) THEN
571 MESSAGE "You must select a property" VIEW-AS ALERT-BOX ERROR.
572 APPLY 'ENTRY':U TO RP.Int1 IN FRAME {&FRAME-NAME}.
573 RETURN "FAIL".
574 END.
575 END.
577 END PROCEDURE.
579 /* _UIB-CODE-BLOCK-END */
580 &ANALYZE-RESUME