1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI
6 &Scoped-define WINDOW-NAME CURRENT-WINDOW
7 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS V-table-Win
8 /*------------------------------------------------------------------------
11 ------------------------------------------------------------------------*/
13 /* *************************** Definitions
************************** */
15 &SCOPED-DEFINE REPORT-ID "Amtrust Market Rentals"
19 /* _UIB-CODE-BLOCK-END
*/
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
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
*/
60 /* *********************** Control Definitions
********************** */
63 /* Definitions of the field level widgets
*/
64 DEFINE BUTTON btn_print
69 DEFINE VARIABLE fil_Property
AS CHARACTER FORMAT "X(256)":U
74 DEFINE VARIABLE fil_Property2
AS CHARACTER FORMAT "X(256)":U
79 DEFINE RECTANGLE RECT-23
80 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
84 /* ************************ Frame Definitions
*********************** */
87 RP.Char1
AT ROW 1.2 COL 2 NO-LABEL
88 VIEW-AS RADIO-SET VERTICAL
90 "All properties", "All":U
,
91 "Single Property", "OneProperty":U
,
92 "Range of Properties", "PropertyRange":U
95 RP.Int1
AT ROW 2 COL 17.29 COLON-ALIGNED NO-LABEL FORMAT "99999"
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"
104 fil_Property2
AT ROW 3 COL 26.43 COLON-ALIGNED NO-LABEL
105 RP.Log1
AT ROW 9.8 COL 6.14
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
116 DEFAULT-BUTTON btn_print.
119 /* *********************** Procedure Settings
************************ */
121 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
122 /* Settings for
THIS-PROCEDURE
124 External Tables
: ttpl.RP
125 Allow
: Basic
,DB-Fields
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.
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
148 /* END WINDOW DEFINITION
*/
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
*/
161 FRAME F-Main
:SCROLLABLE = FALSE
162 FRAME F-Main
:HIDDEN = TRUE.
164 /* SETTINGS
FOR FILL-IN fil_Property
IN FRAME F-Main
166 /* SETTINGS
FOR FILL-IN fil_Property2
IN FRAME F-Main
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
174 /* _RUN-TIME-ATTRIBUTES-END
*/
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
184 */ /* FRAME F-Main
*/
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
*/
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 */
210 SELF:SENSITIVE = Yes.
213 /* _UIB-CODE-BLOCK-END
*/
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.
224 /* _UIB-CODE-BLOCK-END
*/
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"}
235 /* _UIB-CODE-BLOCK-END
*/
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"}
245 /* _UIB-CODE-BLOCK-END
*/
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"}
255 /* _UIB-CODE-BLOCK-END
*/
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"}
266 /* _UIB-CODE-BLOCK-END
*/
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"}
276 /* _UIB-CODE-BLOCK-END
*/
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"}
286 /* _UIB-CODE-BLOCK-END
*/
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"}
297 /* _UIB-CODE-BLOCK-END
*/
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"}
308 /* _UIB-CODE-BLOCK-END
*/
314 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
317 /* *************************** Main Block
*************************** */
319 /* _UIB-CODE-BLOCK-END
*/
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
}
349 /* _UIB-CODE-BLOCK-END
*/
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
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.
*/
365 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
368 /* _UIB-CODE-BLOCK-END
*/
372 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable-appropriate-fields V-table-Win
373 PROCEDURE enable-appropriate-fields
:
374 /*------------------------------------------------------------------------------
376 ------------------------------------------------------------------------------*/
377 DO WITH FRAME {&FRAME-NAME}:
379 RUN select-options-changed.
384 /* _UIB-CODE-BLOCK-END
*/
388 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-enable-fields V-table-Win
389 PROCEDURE inst-enable-fields
:
390 /*------------------------------------------------------------------------------
392 ------------------------------------------------------------------------------*/
394 RUN enable-appropriate-fields.
398 /* _UIB-CODE-BLOCK-END
*/
402 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
403 PROCEDURE inst-initialize
:
404 /*------------------------------------------------------------------------------
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}:
416 ASSIGN RP.ReportID
= {&REPORT-ID}
417 RP.UserName
= user-name
423 RUN dispatch
( 'display-fields'
:U
).
424 RUN dispatch
( 'enable-fields'
:U
).
428 /* _UIB-CODE-BLOCK-END
*/
432 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
433 PROCEDURE pre-destroy
:
434 /*------------------------------------------------------------------------------
438 ------------------------------------------------------------------------------*/
440 RUN check-modified
( "CLEAR" ).
444 /* _UIB-CODE-BLOCK-END
*/
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.
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
)
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
).
474 /* _UIB-CODE-BLOCK-END
*/
478 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE select-options-changed V-table-Win
479 PROCEDURE select-options-changed
:
480 /*------------------------------------------------------------------------------
482 ------------------------------------------------------------------------------*/
483 DEF VAR options
AS CHAR NO-UNDO.
485 options
= INPUT FRAME {&FRAME-NAME} RP.Char1.
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
).
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
).
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
).
513 /* _UIB-CODE-BLOCK-END
*/
517 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win
518 PROCEDURE send-records
:
519 /*------------------------------------------------------------------------------
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
}
534 /* _UIB-CODE-BLOCK-END
*/
538 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
539 PROCEDURE state-changed
:
540 /* -----------------------------------------------------------
544 -------------------------------------------------------------*/
545 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
546 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
549 /* Object instance CASEs can go here to replace standard behavior
551 {src
/adm
/template
/vstates.i
}
555 /* _UIB-CODE-BLOCK-END
*/
559 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-report V-table-Win
560 PROCEDURE verify-report
:
561 /*------------------------------------------------------------------------------
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}.
579 /* _UIB-CODE-BLOCK-END
*/