Slightly increase field sizes to cope with e-mail address.
[capital-apms-progress.git] / forecast / v-amtrust-to-budget.w
blob811a5689782bd51a64acaf8a6d563a947148d742
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 to Budgets"
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.Log1
43 &Scoped-define FIELD-PAIRS
44 &Scoped-define ENABLED-TABLES RP
45 &Scoped-define FIRST-ENABLED-TABLE RP
46 &Scoped-Define ENABLED-OBJECTS RECT-23 cmb_MonthFrom btn_print
47 &Scoped-Define DISPLAYED-FIELDS RP.Log1
48 &Scoped-Define DISPLAYED-OBJECTS cmb_MonthFrom
50 /* Custom List Definitions */
51 /* ADM-CREATE-FIELDS,ADM-ASSIGN-FIELDS,List-3,List-4,List-5,List-6 */
53 /* _UIB-PREPROCESSOR-BLOCK-END */
54 &ANALYZE-RESUME
58 /* *********************** Control Definitions ********************** */
61 /* Definitions of the field level widgets */
62 DEFINE BUTTON btn_print
63 LABEL "&OK"
64 SIZE 10.29 BY 1
65 FONT 9.
67 DEFINE VARIABLE cmb_MonthFrom AS CHARACTER FORMAT "X(256)":U
68 LABEL "From month"
69 VIEW-AS COMBO-BOX INNER-LINES 24
70 LIST-ITEMS "Item 1"
71 SIZE 16 BY 1 NO-UNDO.
73 DEFINE RECTANGLE RECT-23
74 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
75 SIZE 58.86 BY 6.
78 /* ************************ Frame Definitions *********************** */
80 DEFINE FRAME F-Main
81 cmb_MonthFrom AT ROW 2 COL 11 COLON-ALIGNED
82 RP.Log1 AT ROW 5.8 COL 13
83 LABEL "Preview"
84 VIEW-AS TOGGLE-BOX
85 SIZE 14.29 BY .8
86 FONT 10
87 btn_print AT ROW 5.8 COL 49
88 RECT-23 AT ROW 1 COL 1
89 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
90 SIDE-LABELS NO-UNDERLINE THREE-D
91 AT COL 1 ROW 1 SCROLLABLE
92 FONT 10
93 DEFAULT-BUTTON btn_print.
96 /* *********************** Procedure Settings ************************ */
98 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
99 /* Settings for THIS-PROCEDURE
100 Type: SmartViewer
101 External Tables: ttpl.RP
102 Allow: Basic,DB-Fields
103 Frames: 1
104 Add Fields to: EXTERNAL-TABLES
105 Other Settings: PERSISTENT-ONLY COMPILE
108 /* This procedure should always be RUN PERSISTENT. Report the error, */
109 /* then cleanup and return. */
110 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
111 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
112 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
113 RETURN.
114 END.
116 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
118 /* ************************* Create Window ************************** */
120 &ANALYZE-SUSPEND _CREATE-WINDOW
121 /* DESIGN Window definition (used by the UIB)
122 CREATE WINDOW V-table-Win ASSIGN
123 HEIGHT = 11.9
124 WIDTH = 75.43.
125 /* END WINDOW DEFINITION */
127 &ANALYZE-RESUME
130 /* *************** Runtime Attributes and UIB Settings ************** */
132 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
133 /* SETTINGS FOR WINDOW V-table-Win
134 VISIBLE,,RUN-PERSISTENT */
135 /* SETTINGS FOR FRAME F-Main
136 NOT-VISIBLE Size-to-Fit */
137 ASSIGN
138 FRAME F-Main:SCROLLABLE = FALSE
139 FRAME F-Main:HIDDEN = TRUE.
141 /* SETTINGS FOR TOGGLE-BOX RP.Log1 IN FRAME F-Main
142 EXP-LABEL */
143 /* _RUN-TIME-ATTRIBUTES-END */
144 &ANALYZE-RESUME
147 /* Setting information for Queries and Browse Widgets fields */
149 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
150 /* Query rebuild information for FRAME F-Main
151 _Options = "NO-LOCK"
152 _Query is NOT OPENED
153 */ /* FRAME F-Main */
154 &ANALYZE-RESUME
159 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
160 /* ************************* Included-Libraries *********************** */
162 {src/adm/method/viewer.i}
163 {inc/method/m-mntvwr.i}
165 /* _UIB-CODE-BLOCK-END */
166 &ANALYZE-RESUME
171 /* ************************ Control Triggers ************************ */
173 &Scoped-define SELF-NAME btn_print
174 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_print V-table-Win
175 ON CHOOSE OF btn_print IN FRAME F-Main /* OK */
177 SELF:SENSITIVE = No.
178 RUN run-report.
179 SELF:SENSITIVE = Yes.
180 END.
182 /* _UIB-CODE-BLOCK-END */
183 &ANALYZE-RESUME
186 &Scoped-define SELF-NAME cmb_MonthFrom
187 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthFrom V-table-Win
188 ON U1 OF cmb_MonthFrom IN FRAME F-Main /* From month */
190 {inc/selcmb/scmths1.i "RP" "Int3"}
191 END.
193 /* _UIB-CODE-BLOCK-END */
194 &ANALYZE-RESUME
197 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthFrom V-table-Win
198 ON U2 OF cmb_MonthFrom IN FRAME F-Main /* From month */
200 {inc/selcmb/scmths2.i "RP" "Int3"}
201 END.
203 /* _UIB-CODE-BLOCK-END */
204 &ANALYZE-RESUME
207 &UNDEFINE SELF-NAME
209 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
212 /* *************************** Main Block *************************** */
214 /* _UIB-CODE-BLOCK-END */
215 &ANALYZE-RESUME
218 /* ********************** Internal Procedures *********************** */
220 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win
221 PROCEDURE adm-row-available :
222 /*------------------------------------------------------------------------------
223 Purpose: Override (thoroughly!) the Progress adm-row-available
224 ------------------------------------------------------------------------------*/
226 /* Define variables needed by this internal procedure. */
227 {src/adm/template/row-head.i}
229 /* Create a list of all the tables that we need to get. */
230 {src/adm/template/row-list.i "Creditor"}
232 /* Get the record ROWID's from the RECORD-SOURCE. */
233 {src/adm/template/row-get.i}
235 /* FIND each record specified by the RECORD-SOURCE. */
236 {src/adm/template/row-find.i "Creditor"}
238 /* Process the newly available records (i.e. display fields,
239 open queries, and/or pass records on to any RECORD-TARGETS). */
240 {src/adm/template/row-end.i}
242 END PROCEDURE.
244 /* _UIB-CODE-BLOCK-END */
245 &ANALYZE-RESUME
248 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
249 PROCEDURE disable_UI :
250 /*------------------------------------------------------------------------------
251 Purpose: DISABLE the User Interface
252 Parameters: <none>
253 Notes: Here we clean-up the user-interface by deleting
254 dynamic widgets we have created and/or hide
255 frames. This procedure is usually called when
256 we are ready to "clean-up" after running.
257 ------------------------------------------------------------------------------*/
258 /* Hide all frames. */
259 HIDE FRAME F-Main.
260 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
261 END PROCEDURE.
263 /* _UIB-CODE-BLOCK-END */
264 &ANALYZE-RESUME
267 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable-appropriate-fields V-table-Win
268 PROCEDURE enable-appropriate-fields :
269 /*------------------------------------------------------------------------------
270 Purpose:
271 ------------------------------------------------------------------------------*/
272 DO WITH FRAME {&FRAME-NAME}:
275 END.
276 END PROCEDURE.
278 /* _UIB-CODE-BLOCK-END */
279 &ANALYZE-RESUME
282 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-enable-fields V-table-Win
283 PROCEDURE inst-enable-fields :
284 /*------------------------------------------------------------------------------
285 Purpose:
286 ------------------------------------------------------------------------------*/
288 RUN enable-appropriate-fields.
290 END PROCEDURE.
292 /* _UIB-CODE-BLOCK-END */
293 &ANALYZE-RESUME
296 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
297 PROCEDURE inst-initialize :
298 /*------------------------------------------------------------------------------
299 Purpose:
300 ------------------------------------------------------------------------------*/
301 DEF VAR user-name AS CHAR NO-UNDO.
303 {inc/username.i "user-name"}
305 FIND RP WHERE RP.UserName = user-name
306 AND RP.ReportID = {&REPORT-ID} NO-ERROR.
308 IF NOT AVAILABLE RP THEN DO WITH FRAME {&FRAME-NAME}:
309 CREATE RP.
310 ASSIGN RP.ReportID = {&REPORT-ID}
311 RP.UserName = user-name
312 RP.Char1 = "All"
313 RP.Log1 = Yes
314 RP.Log2 = Yes.
315 END.
317 RUN dispatch( 'display-fields':U ).
318 RUN dispatch( 'enable-fields':U ).
320 END PROCEDURE.
322 /* _UIB-CODE-BLOCK-END */
323 &ANALYZE-RESUME
326 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
327 PROCEDURE pre-destroy :
328 /*------------------------------------------------------------------------------
329 Purpose:
330 Parameters: <none>
331 Notes:
332 ------------------------------------------------------------------------------*/
334 RUN check-modified( "CLEAR" ).
336 END PROCEDURE.
338 /* _UIB-CODE-BLOCK-END */
339 &ANALYZE-RESUME
342 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE run-report V-table-Win
343 PROCEDURE run-report :
344 /*------------------------------------------------------------------------------
345 Purpose: Actually run the report through RB engine.
346 ------------------------------------------------------------------------------*/
347 DEF VAR report-options AS CHAR NO-UNDO.
349 RUN verify-report.
350 IF RETURN-VALUE = "FAIL" THEN RETURN.
352 RUN dispatch( 'update-record':U ).
354 report-options = "FromMonth," + STRING( RP.Int3 )
355 + (IF RP.Log1 THEN "~nPreview" ELSE "").
357 RUN notify( 'set-busy, CONTAINER-SOURCE':U ).
358 RUN forecast/amtrust-to-budgets.p ( report-options ).
359 RUN notify( 'set-idle, CONTAINER-SOURCE':U ).
361 END PROCEDURE.
363 /* _UIB-CODE-BLOCK-END */
364 &ANALYZE-RESUME
367 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win
368 PROCEDURE send-records :
369 /*------------------------------------------------------------------------------
370 Purpose:
371 ------------------------------------------------------------------------------*/
373 /* Define variables needed by this internal procedure. */
374 {src/adm/template/snd-head.i}
376 /* For each requested table, put it's ROWID in the output list. */
377 {src/adm/template/snd-list.i "Creditor"}
379 /* Deal with any unexpected table requests before closing. */
380 {src/adm/template/snd-end.i}
382 END PROCEDURE.
384 /* _UIB-CODE-BLOCK-END */
385 &ANALYZE-RESUME
388 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
389 PROCEDURE state-changed :
390 /* -----------------------------------------------------------
391 Purpose:
392 Parameters: <none>
393 Notes:
394 -------------------------------------------------------------*/
395 DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
396 DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
398 CASE p-state:
399 /* Object instance CASEs can go here to replace standard behavior
400 or add new cases. */
401 {src/adm/template/vstates.i}
402 END CASE.
403 END PROCEDURE.
405 /* _UIB-CODE-BLOCK-END */
406 &ANALYZE-RESUME
409 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-report V-table-Win
410 PROCEDURE verify-report :
411 /*------------------------------------------------------------------------------
412 Purpose:
413 ------------------------------------------------------------------------------*/
416 END PROCEDURE.
418 /* _UIB-CODE-BLOCK-END */
419 &ANALYZE-RESUME