Really, this should be it, for the passing income.
[capital-apms-progress.git] / vwr / mnt / v-frqtyp.w
bloba8f22e0d567c3bea3cb49926b6fe6874c33410d3
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 /*------------------------------------------------------------------------
10 File:
12 Description: from VIEWER.W - Template for SmartViewer Objects
14 Input Parameters:
15 <none>
17 Output Parameters:
18 <none>
20 ------------------------------------------------------------------------*/
21 /* This .W file was created with the Progress UIB. */
22 /*----------------------------------------------------------------------*/
24 /* Create an unnamed pool to store all the widgets created
25 by this procedure. This is a good default which assures
26 that this procedure's triggers and internal procedures
27 will execute in this procedure's storage, and that proper
28 cleanup will occur on deletion of the procedure. */
30 CREATE WIDGET-POOL.
32 /* *************************** Definitions ************************** */
34 /* Parameters Definitions --- */
36 /* Local Variable Definitions --- */
38 DEF VAR mode AS CHAR NO-UNDO.
40 /* _UIB-CODE-BLOCK-END */
41 &ANALYZE-RESUME
44 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
46 /* ******************** Preprocessor Definitions ******************** */
48 &Scoped-define PROCEDURE-TYPE SmartViewer
50 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
52 /* Name of first Frame and/or Browse and/or first Query */
53 &Scoped-define FRAME-NAME F-Main
55 /* External Tables */
56 &Scoped-define EXTERNAL-TABLES FrequencyType
57 &Scoped-define FIRST-EXTERNAL-TABLE FrequencyType
60 /* Need to scope the external tables to this procedure */
61 DEFINE QUERY external_tables FOR FrequencyType.
62 /* Standard List Definitions */
63 &Scoped-Define ENABLED-FIELDS FrequencyType.FrequencyCode ~
64 FrequencyType.Description FrequencyType.UnitCount FrequencyType.RepeatUnits
65 &Scoped-define FIELD-PAIRS~
66 ~{&FP1}FrequencyCode ~{&FP2}FrequencyCode ~{&FP3}~
67 ~{&FP1}Description ~{&FP2}Description ~{&FP3}~
68 ~{&FP1}UnitCount ~{&FP2}UnitCount ~{&FP3}
69 &Scoped-define ENABLED-TABLES FrequencyType
70 &Scoped-define FIRST-ENABLED-TABLE FrequencyType
71 &Scoped-Define ENABLED-OBJECTS RECT-11
72 &Scoped-Define DISPLAYED-FIELDS FrequencyType.FrequencyCode ~
73 FrequencyType.Description FrequencyType.UnitCount FrequencyType.RepeatUnits
75 /* Custom List Definitions */
76 /* ADM-CREATE-FIELDS,ADM-ASSIGN-FIELDS,List-3,List-4,List-5,List-6 */
78 /* _UIB-PREPROCESSOR-BLOCK-END */
79 &ANALYZE-RESUME
83 /* *********************** Control Definitions ********************** */
86 /* Definitions of the field level widgets */
87 DEFINE RECTANGLE RECT-11
88 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
89 SIZE 48 BY 3.6.
92 /* ************************ Frame Definitions *********************** */
94 DEFINE FRAME F-Main
95 FrequencyType.FrequencyCode AT ROW 1.2 COL 8.14 COLON-ALIGNED
96 LABEL "Code"
97 VIEW-AS FILL-IN
98 SIZE 5.43 BY 1
99 FrequencyType.Description AT ROW 2.4 COL 8.14 COLON-ALIGNED
100 VIEW-AS FILL-IN
101 SIZE 38.29 BY 1
102 FrequencyType.UnitCount AT ROW 3.4 COL 8.14 COLON-ALIGNED
103 VIEW-AS FILL-IN
104 SIZE 7.43 BY 1
105 FrequencyType.RepeatUnits AT ROW 3.4 COL 31.29 HELP
106 "Units for the repeat frequency (Day, Month, Year...)" NO-LABEL
107 VIEW-AS RADIO-SET HORIZONTAL
108 RADIO-BUTTONS
109 "Days", "DAYS":U,
110 "Months", "MONTHS":U
111 SIZE 17.14 BY 1
112 RECT-11 AT ROW 1 COL 1
113 "Units are:" VIEW-AS TEXT
114 SIZE 6.86 BY 1 AT ROW 3.4 COL 23.29
115 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
116 SIDE-LABELS NO-UNDERLINE THREE-D
117 AT COL 1 ROW 1 SCROLLABLE
118 FONT 10.
121 /* *********************** Procedure Settings ************************ */
123 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
124 /* Settings for THIS-PROCEDURE
125 Type: SmartViewer
126 External Tables: TTPL.FrequencyType
127 Allow: Basic,DB-Fields
128 Frames: 1
129 Add Fields to: EXTERNAL-TABLES
130 Other Settings: PERSISTENT-ONLY COMPILE
133 /* This procedure should always be RUN PERSISTENT. Report the error, */
134 /* then cleanup and return. */
135 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
136 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
137 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
138 RETURN.
139 END.
141 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
143 /* ************************* Create Window ************************** */
145 &ANALYZE-SUSPEND _CREATE-WINDOW
146 /* DESIGN Window definition (used by the UIB)
147 CREATE WINDOW V-table-Win ASSIGN
148 HEIGHT = 6.4
149 WIDTH = 53.72.
150 /* END WINDOW DEFINITION */
152 &ANALYZE-RESUME
155 /* *************** Runtime Attributes and UIB Settings ************** */
157 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
158 /* SETTINGS FOR WINDOW V-table-Win
159 VISIBLE,,RUN-PERSISTENT */
160 /* SETTINGS FOR FRAME F-Main
161 NOT-VISIBLE Size-to-Fit */
162 ASSIGN
163 FRAME F-Main:SCROLLABLE = FALSE
164 FRAME F-Main:HIDDEN = TRUE.
166 /* SETTINGS FOR FILL-IN FrequencyType.FrequencyCode IN FRAME F-Main
167 EXP-LABEL */
168 /* SETTINGS FOR RADIO-SET FrequencyType.RepeatUnits IN FRAME F-Main
169 EXP-HELP */
170 /* _RUN-TIME-ATTRIBUTES-END */
171 &ANALYZE-RESUME
174 /* Setting information for Queries and Browse Widgets fields */
176 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
177 /* Query rebuild information for FRAME F-Main
178 _Options = "NO-LOCK"
179 _Query is NOT OPENED
180 */ /* FRAME F-Main */
181 &ANALYZE-RESUME
186 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
187 /* ************************* Included-Libraries *********************** */
189 {src/adm/method/viewer.i}
190 {inc/method/m-mntvwr.i}
192 /* _UIB-CODE-BLOCK-END */
193 &ANALYZE-RESUME
197 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
200 /* *************************** Main Block *************************** */
202 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
203 RUN dispatch IN THIS-PROCEDURE ('initialize':U).
204 &ENDIF
206 /************************ INTERNAL PROCEDURES ********************/
208 /* _UIB-CODE-BLOCK-END */
209 &ANALYZE-RESUME
212 /* ********************** Internal Procedures *********************** */
214 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win _ADM-ROW-AVAILABLE
215 PROCEDURE adm-row-available :
216 /*------------------------------------------------------------------------------
217 Purpose: Dispatched to this procedure when the Record-
218 Source has a new row available. This procedure
219 tries to get the new row (or foriegn keys) from
220 the Record-Source and process it.
221 Parameters: <none>
222 ------------------------------------------------------------------------------*/
224 /* Define variables needed by this internal procedure. */
225 {src/adm/template/row-head.i}
227 /* Create a list of all the tables that we need to get. */
228 {src/adm/template/row-list.i "FrequencyType"}
230 /* Get the record ROWID's from the RECORD-SOURCE. */
231 {src/adm/template/row-get.i}
233 /* FIND each record specified by the RECORD-SOURCE. */
234 {src/adm/template/row-find.i "FrequencyType"}
236 /* Process the newly available records (i.e. display fields,
237 open queries, and/or pass records on to any RECORD-TARGETS). */
238 {src/adm/template/row-end.i}
240 END PROCEDURE.
242 /* _UIB-CODE-BLOCK-END */
243 &ANALYZE-RESUME
246 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE cancel-changes V-table-Win
247 PROCEDURE cancel-changes :
248 /*------------------------------------------------------------------------------
249 Purpose:
250 Parameters: <none>
251 Notes:
252 ------------------------------------------------------------------------------*/
254 RUN notify( 'hide, CONTAINER-SOURCE':U ).
255 IF mode = "Add" THEN RUN delete-frequency. ELSE RUN check-modified( "CLEAR" ).
256 RUN dispatch( 'exit':U ).
258 END PROCEDURE.
260 /* _UIB-CODE-BLOCK-END */
261 &ANALYZE-RESUME
264 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE confirm-changes V-table-Win
265 PROCEDURE confirm-changes :
266 /*------------------------------------------------------------------------------
267 Purpose:
268 Parameters: <none>
269 Notes:
270 ------------------------------------------------------------------------------*/
272 RUN verify-frequency.
273 IF RETURN-VALUE = "FAIL" THEN RETURN.
275 RUN dispatch( 'update-record':U ).
276 RUN notify( 'open-query,record-source':U).
277 RUN dispatch( 'exit':U ).
279 END PROCEDURE.
281 /* _UIB-CODE-BLOCK-END */
282 &ANALYZE-RESUME
285 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE delete-frequency V-table-Win
286 PROCEDURE delete-frequency :
287 /*------------------------------------------------------------------------------
288 Purpose:
289 Parameters: <none>
290 Notes:
291 ------------------------------------------------------------------------------*/
293 FIND CURRENT FrequencyType EXCLUSIVE-LOCK NO-ERROR.
294 IF AVAILABLE FrequencyType THEN DELETE FrequencyType.
296 END PROCEDURE.
298 /* _UIB-CODE-BLOCK-END */
299 &ANALYZE-RESUME
302 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
303 PROCEDURE disable_UI :
304 /*------------------------------------------------------------------------------
305 Purpose: DISABLE the User Interface
306 Parameters: <none>
307 Notes: Here we clean-up the user-interface by deleting
308 dynamic widgets we have created and/or hide
309 frames. This procedure is usually called when
310 we are ready to "clean-up" after running.
311 ------------------------------------------------------------------------------*/
312 /* Hide all frames. */
313 HIDE FRAME F-Main.
314 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
315 END PROCEDURE.
317 /* _UIB-CODE-BLOCK-END */
318 &ANALYZE-RESUME
321 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
322 PROCEDURE inst-initialize :
323 /*------------------------------------------------------------------------------
324 Purpose:
325 Parameters: <none>
326 Notes:
327 ------------------------------------------------------------------------------*/
329 RUN get-attribute( 'mode' ).
330 mode = RETURN-VALUE.
332 IF mode = "Add" THEN
334 have-records = Yes.
335 RUN dispatch( 'add-record':U ).
336 END.
337 ELSE RUN dispatch( 'enable-fields' ).
339 END PROCEDURE.
341 /* _UIB-CODE-BLOCK-END */
342 &ANALYZE-RESUME
345 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE override-add-record V-table-Win
346 PROCEDURE override-add-record :
347 /*------------------------------------------------------------------------------
348 Purpose:
349 Parameters: <none>
350 Notes:
351 ------------------------------------------------------------------------------*/
353 CREATE FrequencyType.
354 ASSIGN FrequencyType.RepeatUnits = "DAYS".
356 RUN dispatch( 'display-fields':U ).
357 RUN dispatch( 'enable-fields':U ).
359 CURRENT-WINDOW:TITLE = "Adding a new Frequency Type".
361 END PROCEDURE.
363 /* _UIB-CODE-BLOCK-END */
364 &ANALYZE-RESUME
367 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
368 PROCEDURE pre-destroy :
369 /*------------------------------------------------------------------------------
370 Purpose:
371 Parameters: <none>
372 Notes:
373 ------------------------------------------------------------------------------*/
375 IF LAST-EVENT:FUNCTION = "WINDOW-CLOSE" THEN RUN cancel-changes.
377 END PROCEDURE.
379 /* _UIB-CODE-BLOCK-END */
380 &ANALYZE-RESUME
383 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win _ADM-SEND-RECORDS
384 PROCEDURE send-records :
385 /*------------------------------------------------------------------------------
386 Purpose: Send record ROWID's for all tables used by
387 this file.
388 Parameters: see template/snd-head.i
389 ------------------------------------------------------------------------------*/
391 /* Define variables needed by this internal procedure. */
392 {src/adm/template/snd-head.i}
394 /* For each requested table, put it's ROWID in the output list. */
395 {src/adm/template/snd-list.i "FrequencyType"}
397 /* Deal with any unexpected table requests before closing. */
398 {src/adm/template/snd-end.i}
400 END PROCEDURE.
402 /* _UIB-CODE-BLOCK-END */
403 &ANALYZE-RESUME
406 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
407 PROCEDURE state-changed :
408 /* -----------------------------------------------------------
409 Purpose:
410 Parameters: <none>
411 Notes:
412 -------------------------------------------------------------*/
413 DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
414 DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
416 CASE p-state:
417 /* Object instance CASEs can go here to replace standard behavior
418 or add new cases. */
419 {src/adm/template/vstates.i}
420 END CASE.
421 END PROCEDURE.
423 /* _UIB-CODE-BLOCK-END */
424 &ANALYZE-RESUME
427 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-frequency V-table-Win
428 PROCEDURE verify-frequency :
429 /*------------------------------------------------------------------------------
430 Purpose:
431 Parameters: <none>
432 Notes:
433 ------------------------------------------------------------------------------*/
435 DO WITH FRAME {&FRAME-NAME}:
437 IF TRIM( INPUT FrequencyType.FrequencyCode) = ""
438 OR TRIM( INPUT FrequencyType.Description) = "" THEN DO:
439 MESSAGE "You must enter a code and a description" SKIP
440 "for this frequency type."
441 VIEW-AS ALERT-BOX ERROR TITLE "No code or description entered".
443 IF INPUT FrequencyType.Description = "" THEN
444 APPLY 'ENTRY' TO FrequencyType.Description.
445 ELSE
446 APPLY 'ENTRY' TO FrequencyType.FrequencyCode.
448 RETURN "FAIL".
449 END.
451 IF INPUT FrequencyType.FrequencyCode <> FrequencyType.FrequencyCode
452 AND CAN-FIND( FrequencyType WHERE FrequencyType.FrequencyCode
453 = INPUT FrequencyType.FrequencyCode ) THEN DO:
454 MESSAGE "A frequency already exists with code" INPUT FrequencyType.FrequencyCode + "."
455 VIEW-AS ALERT-BOX ERROR TITLE "Duplicate Frequency".
456 APPLY 'ENTRY' TO FrequencyType.FrequencyCode.
457 RETURN "FAIL".
458 END.
460 IF NOT INPUT FrequencyType.UnitCount > 0 THEN DO:
461 MESSAGE "The repeat units must be greater than zero!" VIEW-AS ALERT-BOX ERROR
462 TITLE "Invalid repeat units".
463 APPLY 'ENTRY' TO FrequencyType.UnitCount.
464 RETURN "FAIL".
465 END.
467 END.
469 END PROCEDURE.
471 /* _UIB-CODE-BLOCK-END */
472 &ANALYZE-RESUME