Add %age area column to vacancies section.
[capital-apms-progress.git] / rplctn / b-replog.w
blob25575fad08dc831da6700394461583bab4fff4b6
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 B-table-Win
8 /*------------------------------------------------------------------------
10 File:
12 Description: from BROWSER.W - Basic SmartBrowser Object Template
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 this-office LIKE Office.Officecode NO-UNDO.
39 DEF VAR repl-date AS CHAR FORMAT "X(12)" LABEL "Date" NO-UNDO.
40 DEF VAR repl-time AS CHAR FORMAT "X(12)" LABEL "Time" NO-UNDO.
41 DEF VAR all-trans AS LOGI NO-UNDO.
43 /* _UIB-CODE-BLOCK-END */
44 &ANALYZE-RESUME
47 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
49 /* ******************** Preprocessor Definitions ******************** */
51 &Scoped-define PROCEDURE-TYPE SmartBrowser
53 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
55 /* Name of first Frame and/or Browse and/or first Query */
56 &Scoped-define FRAME-NAME F-Main
57 &Scoped-define BROWSE-NAME br_table
59 /* Internal Tables (found by Frame, Query & Browse Queries) */
60 &Scoped-define INTERNAL-TABLES ReplLog
62 /* Define KEY-PHRASE in case it is used by any query. */
63 &Scoped-define KEY-PHRASE TRUE
65 /* Definitions for BROWSE br_table */
66 &Scoped-define FIELDS-IN-QUERY-br_table ~
67 STRING( ReplLog.ReplDate, '99/99/9999' ) @ repl-date ReplLog.TableToRepl ~
68 STRING( ReplLog.ReplTime, 'HH:MM:SS' ) @ repl-time ReplLog.DumpFile ~
69 ReplLog.ReplEvent ReplLog.TransActID ReplLog.ReplId
70 &Scoped-define ENABLED-FIELDS-IN-QUERY-br_table
71 &Scoped-define FIELD-PAIRS-IN-QUERY-br_table
72 &Scoped-define OPEN-QUERY-br_table OPEN QUERY br_table FOR EACH ReplLog WHERE ~{&KEY-PHRASE} ~
73 AND ReplLog.OfficeCode = this-office AND ~
74 ( all-trans OR ReplLog.ReplDate = TODAY ) NO-LOCK ~
75 ~{&SORTBY-PHRASE}.
76 &Scoped-define TABLES-IN-QUERY-br_table ReplLog
77 &Scoped-define FIRST-TABLE-IN-QUERY-br_table ReplLog
80 /* Definitions for FRAME F-Main */
82 /* Standard List Definitions */
83 &Scoped-Define ENABLED-OBJECTS br_table
85 /* Custom List Definitions */
86 /* List-1,List-2,List-3,List-4,List-5,List-6 */
88 /* _UIB-PREPROCESSOR-BLOCK-END */
89 &ANALYZE-RESUME
92 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" B-table-Win _INLINE
93 /* Actions: ? adm/support/keyedit.w ? ? ? */
94 /* STRUCTURED-DATA
95 <KEY-OBJECT>
96 &BROWSE-NAME
97 </KEY-OBJECT>
98 <FOREIGN-KEYS>
99 OfficeCode|y|y|ttpl.ReplLog.OfficeCode
100 TableToRepl||y|ttpl.ReplLog.TableToRepl
101 </FOREIGN-KEYS>
102 <EXECUTING-CODE>
103 **************************
104 * Set attributes related to FOREIGN KEYS
106 RUN set-attribute-list (
107 'Keys-Accepted = "OfficeCode",
108 Keys-Supplied = "OfficeCode,TableToRepl"':U).
110 /* Tell the ADM to use the OPEN-QUERY-CASES. */
111 &Scoped-define OPEN-QUERY-CASES RUN dispatch ('open-query-cases':U).
112 /**************************
113 </EXECUTING-CODE> */
114 /* _UIB-CODE-BLOCK-END */
115 &ANALYZE-RESUME
117 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Advanced Query Options" B-table-Win _INLINE
118 /* Actions: ? adm/support/advqedit.w ? ? ? */
119 /* STRUCTURED-DATA
120 <KEY-OBJECT>
121 &BROWSE-NAME
122 </KEY-OBJECT>
123 <SORTBY-OPTIONS>
124 </SORTBY-OPTIONS>
125 <SORTBY-RUN-CODE>
126 ************************
127 * Set attributes related to SORTBY-OPTIONS */
128 RUN set-attribute-list (
129 'SortBy-Options = ""':U).
130 /************************
131 </SORTBY-RUN-CODE>
132 <FILTER-ATTRIBUTES>
133 </FILTER-ATTRIBUTES> */
135 /* _UIB-CODE-BLOCK-END */
136 &ANALYZE-RESUME
139 /* *********************** Control Definitions ********************** */
142 /* Definitions of the field level widgets */
143 /* Query definitions */
144 &ANALYZE-SUSPEND
145 DEFINE QUERY br_table FOR
146 ReplLog SCROLLING.
147 &ANALYZE-RESUME
149 /* Browse definitions */
150 DEFINE BROWSE br_table
151 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _DISPLAY-FIELDS br_table B-table-Win _STRUCTURED
152 QUERY br_table NO-LOCK DISPLAY
153 STRING( ReplLog.ReplDate, '99/99/9999' ) @ repl-date
154 ReplLog.TableToRepl FORMAT "X(15)"
155 STRING( ReplLog.ReplTime, 'HH:MM:SS' ) @ repl-time
156 ReplLog.DumpFile COLUMN-LABEL "File" FORMAT "X(50)"
157 ReplLog.ReplEvent
158 ReplLog.TransActID
159 ReplLog.ReplId
160 /* _UIB-CODE-BLOCK-END */
161 &ANALYZE-RESUME
162 WITH NO-ASSIGN SEPARATORS SIZE 77.72 BY 14
163 BGCOLOR 15 FONT 10.
166 /* ************************ Frame Definitions *********************** */
168 DEFINE FRAME F-Main
169 br_table AT ROW 1 COL 1
170 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
171 SIDE-LABELS NO-UNDERLINE THREE-D
172 AT COL 1 ROW 1 SCROLLABLE
173 FONT 10.
176 /* *********************** Procedure Settings ************************ */
178 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
179 /* Settings for THIS-PROCEDURE
180 Type: SmartBrowser
181 Allow: Basic,Browse
182 Frames: 1
183 Add Fields to: EXTERNAL-TABLES
184 Other Settings: PERSISTENT-ONLY COMPILE
187 /* This procedure should always be RUN PERSISTENT. Report the error, */
188 /* then cleanup and return. */
189 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
190 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
191 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
192 RETURN.
193 END.
195 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
197 /* ************************* Create Window ************************** */
199 &ANALYZE-SUSPEND _CREATE-WINDOW
200 /* DESIGN Window definition (used by the UIB)
201 CREATE WINDOW B-table-Win ASSIGN
202 HEIGHT = 15.2
203 WIDTH = 80.72.
204 /* END WINDOW DEFINITION */
206 &ANALYZE-RESUME
209 /* *************** Runtime Attributes and UIB Settings ************** */
211 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
212 /* SETTINGS FOR WINDOW B-table-Win
213 NOT-VISIBLE,,RUN-PERSISTENT */
214 /* SETTINGS FOR FRAME F-Main
215 NOT-VISIBLE Size-to-Fit */
216 /* BROWSE-TAB br_table 1 F-Main */
217 ASSIGN
218 FRAME F-Main:SCROLLABLE = FALSE
219 FRAME F-Main:HIDDEN = TRUE.
221 /* _RUN-TIME-ATTRIBUTES-END */
222 &ANALYZE-RESUME
225 /* Setting information for Queries and Browse Widgets fields */
227 &ANALYZE-SUSPEND _QUERY-BLOCK BROWSE br_table
228 /* Query rebuild information for BROWSE br_table
229 _TblList = "ttpl.ReplLog"
230 _Options = "NO-LOCK KEY-PHRASE SORTBY-PHRASE"
231 _Where[1] = "ReplLog.OfficeCode = this-office AND
232 ( all-trans OR ReplLog.ReplDate = TODAY )"
233 _FldNameList[1] > "_<CALC>"
234 "STRING( ReplLog.ReplDate, '99/99/9999' ) @ repl-date" ? ? ? ? ? ? ? ? ? no ?
235 _FldNameList[2] > ttpl.ReplLog.TableToRepl
236 "ReplLog.TableToRepl" ? "X(15)" "character" ? ? ? ? ? ? no ?
237 _FldNameList[3] > "_<CALC>"
238 "STRING( ReplLog.ReplTime, 'HH:MM:SS' ) @ repl-time" ? ? ? ? ? ? ? ? ? no ?
239 _FldNameList[4] > ttpl.ReplLog.DumpFile
240 "ReplLog.DumpFile" "File" "X(50)" "character" ? ? ? ? ? ? no ?
241 _FldNameList[5] = ttpl.ReplLog.ReplEvent
242 _FldNameList[6] = ttpl.ReplLog.TransActID
243 _FldNameList[7] = ttpl.ReplLog.ReplId
244 _Query is NOT OPENED
245 */ /* BROWSE br_table */
246 &ANALYZE-RESUME
248 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
249 /* Query rebuild information for FRAME F-Main
250 _Options = "NO-LOCK"
251 _Query is NOT OPENED
252 */ /* FRAME F-Main */
253 &ANALYZE-RESUME
258 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB B-table-Win
259 /* ************************* Included-Libraries *********************** */
261 {src/adm/method/browser.i}
262 {inc/method/m-drlvwr.i}
264 /* _UIB-CODE-BLOCK-END */
265 &ANALYZE-RESUME
270 /* ************************ Control Triggers ************************ */
272 &Scoped-define BROWSE-NAME br_table
273 &Scoped-define SELF-NAME br_table
274 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
275 ON ROW-DISPLAY OF br_table IN FRAME F-Main
277 DEF VAR fgcolor AS INT NO-UNDO.
279 IF NOT AVAILABLE ReplLog THEN RETURN.
280 CASE ReplLog.ReplEvent:
281 WHEN "C" THEN fgcolor = 2.
282 WHEN "M" THEN fgcolor = 1.
283 WHEN "D" THEN fgcolor = 12.
284 OTHERWISE fgcolor = ?.
285 END CASE.
287 ASSIGN repl-date:FGCOLOR IN BROWSE {&BROWSE-NAME} = fgcolor
288 repl-time:FGCOLOR = fgcolor
289 ReplLog.TableToRepl:FGCOLOR = fgcolor
290 ReplLog.DumpFile:FGCOLOR = fgcolor
291 ReplLog.ReplEvent:FGCOLOR = fgcolor.
293 END.
295 /* _UIB-CODE-BLOCK-END */
296 &ANALYZE-RESUME
299 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
300 ON ROW-ENTRY OF br_table IN FRAME F-Main
302 /* This code displays initial values for newly added or copied rows. */
303 {src/adm/template/brsentry.i}
304 END.
306 /* _UIB-CODE-BLOCK-END */
307 &ANALYZE-RESUME
310 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
311 ON ROW-LEAVE OF br_table IN FRAME F-Main
313 /* Do not disable this code or no updates will take place except
314 by pressing the Save button on an Update SmartPanel. */
315 {src/adm/template/brsleave.i}
316 END.
318 /* _UIB-CODE-BLOCK-END */
319 &ANALYZE-RESUME
322 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
323 ON VALUE-CHANGED OF br_table IN FRAME F-Main
325 /* This ADM trigger code must be preserved in order to notify other
326 objects when the browser's current row changes. */
327 {src/adm/template/brschnge.i}
329 END.
331 /* _UIB-CODE-BLOCK-END */
332 &ANALYZE-RESUME
335 &UNDEFINE SELF-NAME
337 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK B-table-Win
340 /* *************************** Main Block *************************** */
342 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
343 RUN dispatch IN THIS-PROCEDURE ('initialize':U).
344 &ENDIF
346 {inc/ofc-this.i}
347 this-office = Office.OfficeCode.
349 /* Set up the filter attributes */
351 RUN set-attribute-list( 'FilterBy-Options = Today|All, FilterBy-Case = All' ).
353 /* _UIB-CODE-BLOCK-END */
354 &ANALYZE-RESUME
357 /* ********************** Internal Procedures *********************** */
359 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-open-query-cases B-table-Win adm/support/_adm-opn.p
360 PROCEDURE adm-open-query-cases :
361 /*------------------------------------------------------------------------------
362 Purpose: Opens different cases of the query based on attributes
363 such as the 'Key-Name', or 'SortBy-Case'
364 Parameters: <none>
365 ------------------------------------------------------------------------------*/
366 DEF VAR key-value AS CHAR NO-UNDO.
368 /* Look up the current key-value. */
369 RUN get-attribute ('Key-Value':U).
370 key-value = RETURN-VALUE.
372 /* Find the current record using the current Key-Name. */
373 RUN get-attribute ('Key-Name':U).
374 CASE RETURN-VALUE:
375 WHEN 'OfficeCode':U THEN DO:
376 &Scope KEY-PHRASE ReplLog.OfficeCode eq key-value
377 {&OPEN-QUERY-{&BROWSE-NAME}}
378 END. /* OfficeCode */
379 OTHERWISE DO:
380 &Scope KEY-PHRASE TRUE
381 {&OPEN-QUERY-{&BROWSE-NAME}}
382 END. /* OTHERWISE...*/
383 END CASE.
385 END PROCEDURE.
387 /* _UIB-CODE-BLOCK-END */
388 &ANALYZE-RESUME
391 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available B-table-Win _ADM-ROW-AVAILABLE
392 PROCEDURE adm-row-available :
393 /*------------------------------------------------------------------------------
394 Purpose: Dispatched to this procedure when the Record-
395 Source has a new row available. This procedure
396 tries to get the new row (or foriegn keys) from
397 the Record-Source and process it.
398 Parameters: <none>
399 ------------------------------------------------------------------------------*/
401 /* Define variables needed by this internal procedure. */
402 {src/adm/template/row-head.i}
404 /* Process the newly available records (i.e. display fields,
405 open queries, and/or pass records on to any RECORD-TARGETS). */
406 {src/adm/template/row-end.i}
408 END PROCEDURE.
410 /* _UIB-CODE-BLOCK-END */
411 &ANALYZE-RESUME
414 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE can-dump-changes B-table-Win
415 PROCEDURE can-dump-changes :
416 /*------------------------------------------------------------------------------
417 Purpose:
418 Parameters: <none>
419 Notes:
420 ------------------------------------------------------------------------------*/
422 RUN set-link-attributes IN sys-mgr( THIS-PROCEDURE, "dump-changes",
423 "SENSITIVE = " + IF CAN-FIND( FIRST ReplLog WHERE ReplLog.OfficeCode = this-office
424 AND ReplLog.Dumpfile = "" ) THEN "Yes" ELSE "No" ).
426 END PROCEDURE.
428 /* _UIB-CODE-BLOCK-END */
429 &ANALYZE-RESUME
432 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI B-table-Win _DEFAULT-DISABLE
433 PROCEDURE disable_UI :
434 /*------------------------------------------------------------------------------
435 Purpose: DISABLE the User Interface
436 Parameters: <none>
437 Notes: Here we clean-up the user-interface by deleting
438 dynamic widgets we have created and/or hide
439 frames. This procedure is usually called when
440 we are ready to "clean-up" after running.
441 ------------------------------------------------------------------------------*/
442 /* Hide all frames. */
443 HIDE FRAME F-Main.
444 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
445 END PROCEDURE.
447 /* _UIB-CODE-BLOCK-END */
448 &ANALYZE-RESUME
451 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE dump-changes B-table-Win
452 PROCEDURE dump-changes :
453 /*------------------------------------------------------------------------------
454 Purpose:
455 Parameters: <none>
456 Notes:
457 ------------------------------------------------------------------------------*/
459 DEF VAR dumped-to AS CHAR NO-UNDO.
461 RUN rplctn\repldump.p.
462 dumped-to = RETURN-VALUE.
463 RUN dispatch( 'open-query':U ).
465 MESSAGE
466 "The current outstanding replication" SKIP
467 "changes have been dumped successfully" SKIP
468 "to file:" dumped-to
469 VIEW-AS ALERT-BOX INFORMATION TITLE "Done !".
471 RUN can-dump-changes.
473 END PROCEDURE.
475 /* _UIB-CODE-BLOCK-END */
476 &ANALYZE-RESUME
479 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-value-changed B-table-Win
480 PROCEDURE inst-value-changed :
481 /*------------------------------------------------------------------------------
482 Purpose:
483 Parameters: <none>
484 Notes:
485 ------------------------------------------------------------------------------*/
487 RUN can-dump-changes.
489 END PROCEDURE.
491 /* _UIB-CODE-BLOCK-END */
492 &ANALYZE-RESUME
495 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE purge-log B-table-Win
496 PROCEDURE purge-log :
497 /*------------------------------------------------------------------------------
498 Purpose:
499 ------------------------------------------------------------------------------*/
500 DEF VAR do-it AS LOGICAL NO-UNDO INITIAL No.
502 MESSAGE "This will delete all changes which have been logged" SKIP
503 "for replication to other sites." SKIP(1)
504 "Are you sure you want to do this?"
505 VIEW-AS ALERT-BOX WARNING BUTTONS OK-CANCEL
506 TITLE "Are you sure?"
507 UPDATE do-it .
509 IF do-it THEN DO:
510 FOR EACH ReplLog EXCLUSIVE-LOCK: DELETE ReplLog. END.
511 RUN dispatch( 'open-query':U ).
512 END.
514 END PROCEDURE.
516 /* _UIB-CODE-BLOCK-END */
517 &ANALYZE-RESUME
520 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE replicate-out B-table-Win
521 PROCEDURE replicate-out :
522 /*------------------------------------------------------------------------------
523 Purpose:
524 ------------------------------------------------------------------------------*/
525 RUN notify( 'set-busy,container-source':U ).
526 RUN rplctn/repldump.p .
527 RUN notify( 'set-idle,container-source':U ).
528 MESSAGE "Data for outward replication dumped to file".
529 END PROCEDURE.
531 /* _UIB-CODE-BLOCK-END */
532 &ANALYZE-RESUME
535 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-key B-table-Win adm/support/_key-snd.p
536 PROCEDURE send-key :
537 /*------------------------------------------------------------------------------
538 Purpose: Sends a requested KEY value back to the calling
539 SmartObject.
540 Parameters: <see adm/template/sndkytop.i>
541 ------------------------------------------------------------------------------*/
543 /* Define variables needed by this internal procedure. */
544 {src/adm/template/sndkytop.i}
546 /* Return the key value associated with each key case. */
547 {src/adm/template/sndkycas.i "OfficeCode" "ReplLog" "OfficeCode"}
548 {src/adm/template/sndkycas.i "TableToRepl" "ReplLog" "TableToRepl"}
550 /* Close the CASE statement and end the procedure. */
551 {src/adm/template/sndkyend.i}
553 END PROCEDURE.
555 /* _UIB-CODE-BLOCK-END */
556 &ANALYZE-RESUME
559 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records B-table-Win _ADM-SEND-RECORDS
560 PROCEDURE send-records :
561 /*------------------------------------------------------------------------------
562 Purpose: Send record ROWID's for all tables used by
563 this file.
564 Parameters: see template/snd-head.i
565 ------------------------------------------------------------------------------*/
567 /* Define variables needed by this internal procedure. */
568 {src/adm/template/snd-head.i}
570 /* For each requested table, put it's ROWID in the output list. */
571 {src/adm/template/snd-list.i "ReplLog"}
573 /* Deal with any unexpected table requests before closing. */
574 {src/adm/template/snd-end.i}
576 END PROCEDURE.
578 /* _UIB-CODE-BLOCK-END */
579 &ANALYZE-RESUME
582 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed B-table-Win
583 PROCEDURE state-changed :
584 /* -----------------------------------------------------------
585 Purpose:
586 Parameters: <none>
587 Notes:
588 -------------------------------------------------------------*/
589 DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
590 DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
592 CASE p-state:
593 /* Object instance CASEs can go here to replace standard behavior
594 or add new cases. */
595 {src/adm/template/bstates.i}
596 END CASE.
597 END PROCEDURE.
599 /* _UIB-CODE-BLOCK-END */
600 &ANALYZE-RESUME
603 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-FilterBy-Case B-table-Win
604 PROCEDURE use-FilterBy-Case :
605 /*------------------------------------------------------------------------------
606 Purpose:
607 Parameters: <none>
608 Notes:
609 ------------------------------------------------------------------------------*/
611 DEF INPUT PARAMETER new-case AS CHAR NO-UNDO.
612 all-trans = new-case = "All".
614 END PROCEDURE.
616 /* _UIB-CODE-BLOCK-END */
617 &ANALYZE-RESUME