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 /*------------------------------------------------------------------------
9 ------------------------------------------------------------------------*/
13 /* *************************** Definitions
************************** */
15 DEF VAR debug-mode
AS LOGI
NO-UNDO INITIAL No.
16 DEF VAR mode
AS CHAR NO-UNDO.
17 DEF VAR committing-charge
AS LOGI
NO-UNDO.
19 DEF VAR maintain-enabled
AS LOGI
INITIAL No
NO-UNDO.
21 /* _UIB-CODE-BLOCK-END
*/
25 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
27 /* ******************** Preprocessor Definitions
******************** */
29 &Scoped-define PROCEDURE-TYPE SmartViewer
31 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
33 /* Name of first Frame and
/or Browse and
/or first Query
*/
34 &Scoped-define FRAME-NAME F-Main
37 &Scoped-define EXTERNAL-TABLES Valuation
38 &Scoped-define FIRST-EXTERNAL-TABLE Valuation
41 /* Need to scope the external tables to this procedure
*/
42 DEFINE QUERY external_tables
FOR Valuation.
43 /* Standard List Definitions
*/
44 &Scoped-Define ENABLED-FIELDS Valuation.Amount Valuation.DateDone ~
46 &Scoped-define FIELD-PAIRS~
47 ~
{&FP1}Amount ~{&FP2}Amount ~{&FP3}~
48 ~
{&FP1}DateDone ~{&FP2}DateDone ~{&FP3}~
49 ~
{&FP1}Valuer ~{&FP2}Valuer ~{&FP3}
50 &Scoped-define ENABLED-TABLES Valuation
51 &Scoped-define FIRST-ENABLED-TABLE Valuation
52 &Scoped-Define ENABLED-OBJECTS RECT-34 cmb_ValuationType
53 &Scoped-Define DISPLAYED-FIELDS Valuation.PropertyCode ~
54 Valuation.ValuationCode Valuation.Amount Valuation.DateDone ~
56 &Scoped-Define DISPLAYED-OBJECTS fil_Property cmb_ValuationType
58 /* Custom List Definitions
*/
59 /* ADM-CREATE-FIELDS
,ADM-ASSIGN-FIELDS
,List-3
,List-4
,List-5
,List-6
*/
61 /* _UIB-PREPROCESSOR-BLOCK-END
*/
65 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" V-table-Win _INLINE
66 /* Actions
: ? adm
/support
/keyedit.w ? ? ?
*/
74 **************************
75 * Set attributes related to FOREIGN
KEYS
77 RUN set-attribute-list
(
79 Keys-Supplied
= ""'
:U
).
80 /**************************
83 /* _UIB-CODE-BLOCK-END
*/
87 /* *********************** Control Definitions
********************** */
90 /* Definitions of the field level widgets
*/
91 DEFINE VARIABLE cmb_ValuationType
AS CHARACTER FORMAT "X(256)":U
93 VIEW-AS COMBO-BOX INNER-LINES 15
95 SIZE 37.72 BY 1 NO-UNDO.
97 DEFINE VARIABLE fil_Property
AS CHARACTER FORMAT "X(256)":U
101 DEFINE RECTANGLE RECT-34
102 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
106 /* ************************ Frame Definitions
*********************** */
109 Valuation.PropertyCode
AT ROW 1.2 COL 7.57 COLON-ALIGNED
113 fil_Property
AT ROW 1.2 COL 13.29 COLON-ALIGNED NO-LABEL
114 Valuation.ValuationCode
AT ROW 2.2 COL 7.57 COLON-ALIGNED
118 cmb_ValuationType
AT ROW 4.4 COL 7.57 COLON-ALIGNED
119 Valuation.Amount
AT ROW 5.6 COL 7.57 COLON-ALIGNED
120 LABEL "Valuation" FORMAT "->>>,>>>,>>9.99"
123 Valuation.DateDone
AT ROW 6.8 COL 7.57 COLON-ALIGNED
127 Valuation.Valuer
AT ROW 8 COL 7.57 COLON-ALIGNED
130 RECT-34
AT ROW 1 COL 1
131 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
132 SIDE-LABELS NO-UNDERLINE THREE-D
133 AT COL 1 ROW 1 SCROLLABLE
137 /* *********************** Procedure Settings
************************ */
139 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
140 /* Settings for
THIS-PROCEDURE
142 External Tables
: TTPL.Valuation
143 Allow
: Basic
,DB-Fields
145 Add Fields to
: EXTERNAL-TABLES
146 Other Settings
: PERSISTENT-ONLY
COMPILE
149 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
150 /* then cleanup and return.
*/
151 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
152 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
153 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
157 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
159 /* ************************* Create Window
************************** */
161 &ANALYZE-SUSPEND _CREATE-WINDOW
162 /* DESIGN Window definition
(used by the UIB
)
163 CREATE WINDOW V-table-Win
ASSIGN
166 /* END WINDOW DEFINITION
*/
171 /* *************** Runtime Attributes and UIB Settings
************** */
173 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
174 /* SETTINGS
FOR WINDOW V-table-Win
175 VISIBLE,,RUN-PERSISTENT
*/
176 /* SETTINGS
FOR FRAME F-Main
177 NOT-VISIBLE Size-to-Fit
*/
179 FRAME F-Main
:SCROLLABLE = FALSE
180 FRAME F-Main
:HIDDEN = TRUE.
182 /* SETTINGS
FOR FILL-IN Valuation.Amount
IN FRAME F-Main
183 EXP-LABEL EXP-FORMAT
*/
184 /* SETTINGS
FOR FILL-IN Valuation.DateDone
IN FRAME F-Main
186 /* SETTINGS
FOR FILL-IN fil_Property
IN FRAME F-Main
188 /* SETTINGS
FOR FILL-IN Valuation.PropertyCode
IN FRAME F-Main
189 NO-ENABLE EXP-LABEL
*/
190 /* SETTINGS
FOR FILL-IN Valuation.ValuationCode
IN FRAME F-Main
191 NO-ENABLE EXP-LABEL
*/
192 /* _RUN-TIME-ATTRIBUTES-END
*/
196 /* Setting information for Queries and Browse Widgets fields
*/
198 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
199 /* Query rebuild information for
FRAME F-Main
202 */ /* FRAME F-Main
*/
208 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
209 /* ************************* Included-Libraries
*********************** */
211 {src
/adm
/method
/viewer.i
}
212 {inc
/method
/m-mntvwr.i
}
214 /* _UIB-CODE-BLOCK-END
*/
220 /* ************************ Control Triggers
************************ */
222 &Scoped-define SELF-NAME cmb_ValuationType
223 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_ValuationType V-table-Win
224 ON U1
OF cmb_ValuationType
IN FRAME F-Main
/* Type
*/
226 {inc
/selcmb
/scvaltyp1.i
"Valuation" "ValuationType"}
229 /* _UIB-CODE-BLOCK-END
*/
233 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_ValuationType V-table-Win
234 ON U2
OF cmb_ValuationType
IN FRAME F-Main
/* Type
*/
236 {inc
/selcmb
/scvaltyp2.i
"Valuation" "ValuationType"}
239 /* _UIB-CODE-BLOCK-END
*/
245 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
248 /* *************************** Main Block
*************************** */
250 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
251 RUN dispatch
IN THIS-PROCEDURE ('initialize'
:U
).
254 /************************ INTERNAL PROCEDURES
********************/
256 /* _UIB-CODE-BLOCK-END
*/
260 /* ********************** Internal Procedures
*********************** */
262 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win _ADM-ROW-AVAILABLE
263 PROCEDURE adm-row-available
:
264 /*------------------------------------------------------------------------------
265 Purpose
: Dispatched to this procedure when the Record-
266 Source has a new row available. This procedure
267 tries to get the new row
(or foriegn keys
) from
268 the Record-Source and process it.
270 ------------------------------------------------------------------------------*/
272 /* Define variables needed by this internal procedure.
*/
273 {src
/adm
/template
/row-head.i
}
275 /* Create a list of all the tables that we need to get.
*/
276 {src
/adm
/template
/row-list.i
"Valuation"}
278 /* Get the record
ROWID's from the RECORD-SOURCE.
*/
279 {src
/adm
/template
/row-get.i
}
281 /* FIND each record specified by the RECORD-SOURCE.
*/
282 {src
/adm
/template
/row-find.i
"Valuation"}
284 /* Process the newly available records
(i.e. display fields
,
285 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
286 {src
/adm
/template
/row-end.i
}
290 /* _UIB-CODE-BLOCK-END
*/
294 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE cancel-changes V-table-Win
295 PROCEDURE cancel-changes
:
296 /*------------------------------------------------------------------------------
298 ------------------------------------------------------------------------------*/
300 IF mode
= "Add" THEN RUN delete-valuation.
301 RUN check-modified
( "CLEAR" ).
302 RUN dispatch
( 'exit'
:U
).
306 /* _UIB-CODE-BLOCK-END
*/
310 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE confirm-changes V-table-Win
311 PROCEDURE confirm-changes
:
312 /*------------------------------------------------------------------------------
314 ------------------------------------------------------------------------------*/
316 RUN verify-valuation.
317 IF RETURN-VALUE = "FAIL" THEN RETURN.
319 RUN dispatch
( 'update-record'
:U
).
321 IF mode
= "Add" THEN RUN notify
( 'open-query
, RECORD-SOURCE'
:U
).
322 RUN dispatch
( 'exit'
:U
).
326 /* _UIB-CODE-BLOCK-END
*/
330 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE delete-valuation V-table-Win
331 PROCEDURE delete-valuation
:
332 /*------------------------------------------------------------------------------
336 ------------------------------------------------------------------------------*/
338 FIND CURRENT Valuation
EXCLUSIVE-LOCK NO-ERROR.
339 IF AVAILABLE Valuation
THEN DELETE Valuation
NO-ERROR.
343 /* _UIB-CODE-BLOCK-END
*/
347 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
348 PROCEDURE disable_UI
:
349 /*------------------------------------------------------------------------------
350 Purpose
: DISABLE the User Interface
352 Notes
: Here we clean-up the user-interface by deleting
353 dynamic widgets we have created and
/or hide
354 frames. This procedure is usually called when
355 we are ready to
"clean-up" after running.
356 ------------------------------------------------------------------------------*/
357 /* Hide all frames.
*/
359 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
362 /* _UIB-CODE-BLOCK-END
*/
366 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
367 PROCEDURE inst-initialize
:
368 /*------------------------------------------------------------------------------
372 ------------------------------------------------------------------------------*/
374 IF mode
= "Add" THEN DO:
376 RUN dispatch
( 'add-record'
).
379 RUN dispatch
( 'enable-fields'
:U
).
384 /* _UIB-CODE-BLOCK-END
*/
388 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-row-available V-table-Win
389 PROCEDURE inst-row-available
:
390 /*------------------------------------------------------------------------------
392 ------------------------------------------------------------------------------*/
393 DO WITH FRAME {&FRAME-NAME}:
394 FIND Property
WHERE Property.PropertyCode
= Valuation.PropertyCode
NO-LOCK NO-ERROR.
395 fil_Property
= (IF AVAILABLE(Property
) THEN Property.Name
ELSE "").
396 DISPLAY fil_Property
WITH FRAME {&FRAME-NAME} .
397 /* fil_Property
:SCREEN-VALUE = (IF AVAILABLE(Property
) THEN Property.Name
ELSE "").
*/
401 /* _UIB-CODE-BLOCK-END
*/
405 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE override-add-record V-table-Win
406 PROCEDURE override-add-record
:
407 /*------------------------------------------------------------------------------
411 ------------------------------------------------------------------------------*/
412 DEF VAR property-code
AS INT NO-UNDO.
413 DEF VAR valuation-code
LIKE Valuation.ValuationCode
NO-UNDO.
415 DO WITH FRAME {&FRAME-NAME}:
417 CURRENT-WINDOW:TITLE = "Adding a Valuation".
418 property-code
= INT( find-parent-key
( 'PropertyCode'
) ).
419 FIND LAST Valuation
WHERE Valuation.PropertyCode
= property-code
NO-LOCK NO-ERROR.
420 valuation-code
= (IF AVAILABLE(Valuation
) THEN Valuation.ValuationCode
ELSE 0) + 1.
423 Valuation.PropertyCode
= property-code.
424 Valuation.ValuationCode
= valuation-code.
427 RUN dispatch
( 'display-fields'
:U
).
428 RUN dispatch
( 'enable-fields'
:U
).
430 Valuation.DateDone
:SCREEN-VALUE = STRING( TODAY ).
436 /* _UIB-CODE-BLOCK-END
*/
440 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
441 PROCEDURE pre-destroy
:
442 /*------------------------------------------------------------------------------
446 ------------------------------------------------------------------------------*/
448 IF LAST-EVENT:FUNCTION = "WINDOW-CLOSE" THEN RUN cancel-changes.
452 /* _UIB-CODE-BLOCK-END
*/
456 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win _ADM-SEND-RECORDS
457 PROCEDURE send-records
:
458 /*------------------------------------------------------------------------------
459 Purpose
: Send record
ROWID's for all tables used by
461 Parameters
: see template
/snd-head.i
462 ------------------------------------------------------------------------------*/
464 /* Define variables needed by this internal procedure.
*/
465 {src
/adm
/template
/snd-head.i
}
467 /* For each requested table
, put it's
ROWID in the output list.
*/
468 {src
/adm
/template
/snd-list.i
"Valuation"}
470 /* Deal with any unexpected table requests before closing.
*/
471 {src
/adm
/template
/snd-end.i
}
475 /* _UIB-CODE-BLOCK-END
*/
479 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
480 PROCEDURE state-changed
:
481 /* -----------------------------------------------------------
485 -------------------------------------------------------------*/
486 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
487 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
490 /* Object instance CASEs can go here to replace standard behavior
492 {src
/adm
/template
/vstates.i
}
496 /* _UIB-CODE-BLOCK-END
*/
500 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-mode V-table-Win
502 /*------------------------------------------------------------------------------
506 ------------------------------------------------------------------------------*/
508 DEF INPUT PARAMETER new-mode
AS CHAR NO-UNDO.
513 /* _UIB-CODE-BLOCK-END
*/
517 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-valuation V-table-Win
518 PROCEDURE verify-valuation
:
519 /*------------------------------------------------------------------------------
523 ------------------------------------------------------------------------------*/
525 DO WITH FRAME {&FRAME-NAME}:
526 /* no valuation yet
*/
531 /* _UIB-CODE-BLOCK-END
*/