Changes for Catalyst APMS. Added PDF checkboxes to screens the generate remittance...
[capital-apms-progress.git] / vwr / mnt / v-portfolio-expiry.w
blob72835ac98de642d3bbd4163f54bb94330df03ff0
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 DEF VAR user-name AS CHAR INITIAL "Andrew" NO-UNDO.
16 {inc/username.i "user-name"}
17 &GLOB REPORT-ID "portfolio-expiry"
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.Int1 RP.Int2 RP.Char2
43 &Scoped-define FIELD-PAIRS~
44 ~{&FP1}Int1 ~{&FP2}Int1 ~{&FP3}~
45 ~{&FP1}Int2 ~{&FP2}Int2 ~{&FP3}~
46 ~{&FP1}Char2 ~{&FP2}Char2 ~{&FP3}
47 &Scoped-define ENABLED-TABLES RP
48 &Scoped-define FIRST-ENABLED-TABLE RP
49 &Scoped-Define ENABLED-OBJECTS RECT-1 btn_Browse Btn_OK
50 &Scoped-Define DISPLAYED-FIELDS RP.Int1 RP.Int2 RP.Char2
52 /* Custom List Definitions */
53 /* ADM-CREATE-FIELDS,ADM-ASSIGN-FIELDS,List-3,List-4,List-5,List-6 */
55 /* _UIB-PREPROCESSOR-BLOCK-END */
56 &ANALYZE-RESUME
60 /* *********************** Control Definitions ********************** */
63 /* Definitions of the field level widgets */
64 DEFINE BUTTON btn_Browse
65 LABEL "Browse"
66 SIZE 9.72 BY 1.
68 DEFINE BUTTON Btn_OK AUTO-GO DEFAULT
69 LABEL "OK"
70 SIZE 12 BY 1.2
71 BGCOLOR 8 .
73 DEFINE RECTANGLE RECT-1
74 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
75 SIZE 61.72 BY 8.2.
78 /* ************************ Frame Definitions *********************** */
80 DEFINE FRAME F-Main
81 RP.Int1 AT ROW 1.8 COL 16.14 COLON-ALIGNED
82 LABEL "No of Periods"
83 VIEW-AS FILL-IN
84 SIZE 5.72 BY 1.05
85 RP.Int2 AT ROW 2.8 COL 16.14 COLON-ALIGNED
86 LABEL "Months Per Period"
87 VIEW-AS FILL-IN
88 SIZE 5.72 BY 1.05
89 RP.Char2 AT ROW 5.4 COL 5.86 COLON-ALIGNED
90 LABEL "Export"
91 VIEW-AS FILL-IN
92 SIZE 44.57 BY 1
93 btn_Browse AT ROW 5.4 COL 52.43
94 Btn_OK AT ROW 7.8 COL 50.14
95 RECT-1 AT ROW 1 COL 1
96 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
97 SIDE-LABELS NO-UNDERLINE THREE-D
98 AT COL 1 ROW 1 SCROLLABLE
99 FONT 10
100 DEFAULT-BUTTON Btn_OK.
103 /* *********************** Procedure Settings ************************ */
105 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
106 /* Settings for THIS-PROCEDURE
107 Type: SmartViewer
108 External Tables: ttpl.RP
109 Allow: Basic,DB-Fields
110 Frames: 1
111 Add Fields to: EXTERNAL-TABLES
112 Other Settings: PERSISTENT-ONLY COMPILE
115 /* This procedure should always be RUN PERSISTENT. Report the error, */
116 /* then cleanup and return. */
117 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
118 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
119 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
120 RETURN.
121 END.
123 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
125 /* ************************* Create Window ************************** */
127 &ANALYZE-SUSPEND _CREATE-WINDOW
128 /* DESIGN Window definition (used by the UIB)
129 CREATE WINDOW V-table-Win ASSIGN
130 HEIGHT = 12.15
131 WIDTH = 69.57.
132 /* END WINDOW DEFINITION */
134 &ANALYZE-RESUME
137 /* *************** Runtime Attributes and UIB Settings ************** */
139 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
140 /* SETTINGS FOR WINDOW V-table-Win
141 VISIBLE,,RUN-PERSISTENT */
142 /* SETTINGS FOR FRAME F-Main
143 NOT-VISIBLE Size-to-Fit */
144 ASSIGN
145 FRAME F-Main:SCROLLABLE = FALSE
146 FRAME F-Main:HIDDEN = TRUE.
148 /* SETTINGS FOR FILL-IN RP.Char2 IN FRAME F-Main
149 EXP-LABEL */
150 /* SETTINGS FOR FILL-IN RP.Int1 IN FRAME F-Main
151 EXP-LABEL */
152 /* SETTINGS FOR FILL-IN RP.Int2 IN FRAME F-Main
153 EXP-LABEL */
154 /* _RUN-TIME-ATTRIBUTES-END */
155 &ANALYZE-RESUME
158 /* Setting information for Queries and Browse Widgets fields */
160 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
161 /* Query rebuild information for FRAME F-Main
162 _Options = "NO-LOCK"
163 _Query is NOT OPENED
164 */ /* FRAME F-Main */
165 &ANALYZE-RESUME
170 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
171 /* ************************* Included-Libraries *********************** */
173 {src/adm/method/viewer.i}
174 {inc/method/m-mntvwr.i}
176 /* _UIB-CODE-BLOCK-END */
177 &ANALYZE-RESUME
182 /* ************************ Control Triggers ************************ */
184 &Scoped-define SELF-NAME btn_Browse
185 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_Browse V-table-Win
186 ON CHOOSE OF btn_Browse IN FRAME F-Main /* Browse */
188 RUN select-file-dialog.
189 END.
191 /* _UIB-CODE-BLOCK-END */
192 &ANALYZE-RESUME
195 &Scoped-define SELF-NAME Btn_OK
196 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_OK V-table-Win
197 ON CHOOSE OF Btn_OK IN FRAME F-Main /* OK */
199 DISABLE {&SELF-NAME}.
200 RUN run-report.
201 ENABLE {&SELF-NAME}.
202 END.
204 /* _UIB-CODE-BLOCK-END */
205 &ANALYZE-RESUME
208 &UNDEFINE SELF-NAME
210 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
213 /* *************************** Main Block *************************** */
215 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
216 RUN dispatch IN THIS-PROCEDURE ('initialize':U).
217 &ENDIF
219 /************************ INTERNAL PROCEDURES ********************/
221 /* _UIB-CODE-BLOCK-END */
222 &ANALYZE-RESUME
225 /* ********************** Internal Procedures *********************** */
227 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win _ADM-ROW-AVAILABLE
228 PROCEDURE adm-row-available :
229 /*------------------------------------------------------------------------------
230 Purpose: Dispatched to this procedure when the Record-
231 Source has a new row available. This procedure
232 tries to get the new row (or foriegn keys) from
233 the Record-Source and process it.
234 Parameters: <none>
235 ------------------------------------------------------------------------------*/
237 /* Define variables needed by this internal procedure. */
238 {src/adm/template/row-head.i}
240 /* Create a list of all the tables that we need to get. */
241 {src/adm/template/row-list.i "RP"}
243 /* Get the record ROWID's from the RECORD-SOURCE. */
244 {src/adm/template/row-get.i}
246 /* FIND each record specified by the RECORD-SOURCE. */
247 {src/adm/template/row-find.i "RP"}
249 /* Process the newly available records (i.e. display fields,
250 open queries, and/or pass records on to any RECORD-TARGETS). */
251 {src/adm/template/row-end.i}
253 END PROCEDURE.
255 /* _UIB-CODE-BLOCK-END */
256 &ANALYZE-RESUME
259 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
260 PROCEDURE disable_UI :
261 /*------------------------------------------------------------------------------
262 Purpose: DISABLE the User Interface
263 Parameters: <none>
264 Notes: Here we clean-up the user-interface by deleting
265 dynamic widgets we have created and/or hide
266 frames. This procedure is usually called when
267 we are ready to "clean-up" after running.
268 ------------------------------------------------------------------------------*/
269 /* Hide all frames. */
270 HIDE FRAME F-Main.
271 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
272 END PROCEDURE.
274 /* _UIB-CODE-BLOCK-END */
275 &ANALYZE-RESUME
278 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable-appropriate-fields V-table-Win
279 PROCEDURE enable-appropriate-fields :
280 /*------------------------------------------------------------------------------
281 Purpose: As its name!
282 ------------------------------------------------------------------------------*/
284 DO WITH FRAME {&FRAME-NAME}:
285 /* not required */
286 END.
288 END PROCEDURE.
290 /* _UIB-CODE-BLOCK-END */
291 &ANALYZE-RESUME
294 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
295 PROCEDURE inst-initialize :
296 /*------------------------------------------------------------------------------
297 Purpose: Initialise the necessary bits and pieces
298 ------------------------------------------------------------------------------*/
300 FIND RP WHERE RP.ReportID = {&REPORT-ID}
301 AND RP.UserName = user-name
302 NO-ERROR.
304 IF NOT AVAILABLE( RP ) THEN DO:
305 CREATE RP.
306 ASSIGN
307 RP.ReportID = {&REPORT-ID}
308 RP.UserName = user-name
310 END.
312 RUN dispatch ( 'display-fields':U ).
313 RUN dispatch ( 'enable-fields':U ).
314 RUN enable-appropriate-fields.
316 END PROCEDURE.
318 /* _UIB-CODE-BLOCK-END */
319 &ANALYZE-RESUME
322 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
323 PROCEDURE pre-destroy :
324 /*------------------------------------------------------------------------------
325 Purpose:
326 ------------------------------------------------------------------------------*/
327 RUN check-modified( 'clear':U ).
328 END PROCEDURE.
330 /* _UIB-CODE-BLOCK-END */
331 &ANALYZE-RESUME
334 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE run-report V-table-Win
335 PROCEDURE run-report :
336 /*------------------------------------------------------------------------------
337 Purpose: Actually run the report program.
338 ------------------------------------------------------------------------------*/
339 DEF VAR report-options AS CHAR NO-UNDO.
341 RUN dispatch IN THIS-PROCEDURE ('update-record':U).
343 report-options = "File," + RP.Char2
344 + "~nPeriods," + STRING(RP.Int1)
345 + "~nPeriodMonths," + STRING(RP.Int2).
347 RUN notify( 'set-busy,container-source':U ).
348 RUN process/export/portfolio-expiry.p ( report-options ).
349 RUN notify( 'set-idle,container-source':U ).
351 END PROCEDURE.
353 /* _UIB-CODE-BLOCK-END */
354 &ANALYZE-RESUME
357 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE select-file-dialog V-table-Win
358 PROCEDURE select-file-dialog :
359 /*------------------------------------------------------------------------------
360 Purpose:
361 ------------------------------------------------------------------------------*/
362 DEF VAR select-ok AS LOGICAL INITIAL Yes NO-UNDO.
363 DEF VAR file-name AS CHAR NO-UNDO.
364 DEF VAR start-dir AS CHAR NO-UNDO.
366 file-name = INPUT FRAME {&FRAME-NAME} RP.Char2 .
367 start-dir = SUBSTRING( file-name, 1, R-INDEX(file-name, "\" ) ).
369 SYSTEM-DIALOG GET-FILE file-name FILTERS "Comma-separated values" "*.CSV"
370 SAVE-AS ASK-OVERWRITE CREATE-TEST-FILE DEFAULT-EXTENSION ".CSV"
371 INITIAL-DIR start-dir RETURN-TO-START-DIR
372 TITLE "" USE-FILENAME UPDATE select-ok.
374 IF select-ok THEN DO:
375 IF SUBSTRING( file-name, R-INDEX( file-name, ".") ) <> ".CSV" THEN DO:
376 IF (LENGTH( file-name ) - R-INDEX( file-name, "." )) < 4 THEN
377 file-name = SUBSTRING( file-name, 1, R-INDEX( file-name, ".")) + "CSV" .
378 END.
379 RP.Char2:SCREEN-VALUE IN FRAME {&FRAME-NAME} = file-name.
380 END.
382 END PROCEDURE.
384 /* _UIB-CODE-BLOCK-END */
385 &ANALYZE-RESUME
388 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win _ADM-SEND-RECORDS
389 PROCEDURE send-records :
390 /*------------------------------------------------------------------------------
391 Purpose: Send record ROWID's for all tables used by
392 this file.
393 Parameters: see template/snd-head.i
394 ------------------------------------------------------------------------------*/
396 /* Define variables needed by this internal procedure. */
397 {src/adm/template/snd-head.i}
399 /* For each requested table, put it's ROWID in the output list. */
400 {src/adm/template/snd-list.i "RP"}
402 /* Deal with any unexpected table requests before closing. */
403 {src/adm/template/snd-end.i}
405 END PROCEDURE.
407 /* _UIB-CODE-BLOCK-END */
408 &ANALYZE-RESUME
411 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
412 PROCEDURE state-changed :
413 /* -----------------------------------------------------------
414 Purpose:
415 Parameters: <none>
416 Notes:
417 -------------------------------------------------------------*/
418 DEFINE INPUT PARAMETER p-issuer-hdl AS HANDLE NO-UNDO.
419 DEFINE INPUT PARAMETER p-state AS CHARACTER NO-UNDO.
421 CASE p-state:
422 /* Object instance CASEs can go here to replace standard behavior
423 or add new cases. */
424 {src/adm/template/vstates.i}
425 END CASE.
426 END PROCEDURE.
428 /* _UIB-CODE-BLOCK-END */
429 &ANALYZE-RESUME