1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI ADM1
6 &Scoped-define WINDOW-NAME CURRENT-WINDOW
7 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS V-table-Win
8 /*------------------------------------------------------------------------
11 ------------------------------------------------------------------------*/
13 /* *************************** Definitions
************************** */
15 &SCOPED-DEFINE REPORT-ID "Portfolio Yield"
19 /* _UIB-CODE-BLOCK-END
*/
23 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
25 /* ******************** Preprocessor Definitions
******************** */
27 &Scoped-define PROCEDURE-TYPE SmartViewer
28 &Scoped-define DB-AWARE no
30 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
32 /* Name of first Frame and
/or Browse and
/or first Query
*/
33 &Scoped-define FRAME-NAME F-Main
36 &Scoped-define EXTERNAL-TABLES RP
37 &Scoped-define FIRST-EXTERNAL-TABLE RP
40 /* Need to scope the external tables to this procedure
*/
41 DEFINE QUERY external_tables
FOR RP.
42 /* Standard List Definitions
*/
43 &Scoped-Define ENABLED-FIELDS RP.Char1 RP.Int1 RP.Int2 RP.Log2 RP.Log3 ~
45 &Scoped-define ENABLED-TABLES RP
46 &Scoped-define FIRST-ENABLED-TABLE RP
47 &Scoped-define DISPLAYED-TABLES RP
48 &Scoped-define FIRST-DISPLAYED-TABLE RP
49 &Scoped-Define ENABLED-OBJECTS cmb_MonthTo btn_print RECT-23
50 &Scoped-Define DISPLAYED-FIELDS RP.Char1 RP.Int1 RP.Int2 RP.Log2 RP.Log3 ~
52 &Scoped-Define DISPLAYED-OBJECTS fil_Property fil_Property2 cmb_MonthTo
54 /* Custom List Definitions
*/
55 /* ADM-CREATE-FIELDS
,ADM-ASSIGN-FIELDS
,List-3
,List-4
,List-5
,List-6
*/
57 /* _UIB-PREPROCESSOR-BLOCK-END
*/
62 /* *********************** Control Definitions
********************** */
65 /* Definitions of the field level widgets
*/
66 DEFINE BUTTON btn_print
71 DEFINE VARIABLE cmb_MonthTo
AS CHARACTER FORMAT "X(256)":U
73 VIEW-AS COMBO-BOX INNER-LINES 15
76 SIZE 15.43 BY 1 NO-UNDO.
78 DEFINE VARIABLE fil_Property
AS CHARACTER FORMAT "X(256)":U
83 DEFINE VARIABLE fil_Property2
AS CHARACTER FORMAT "X(256)":U
88 DEFINE RECTANGLE RECT-23
89 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
93 /* ************************ Frame Definitions
*********************** */
96 RP.Char1
AT ROW 1.2 COL 2 NO-LABEL
97 VIEW-AS RADIO-SET VERTICAL
99 "All properties", "All":U
,
100 "Single Property", "OneProperty":U
,
101 "Range of Properties", "PropertyRange":U
104 RP.Int1
AT ROW 2 COL 17.29 COLON-ALIGNED NO-LABEL FORMAT "99999"
108 fil_Property
AT ROW 2 COL 26.43 COLON-ALIGNED NO-LABEL
109 RP.Int2
AT ROW 3 COL 17.29 COLON-ALIGNED NO-LABEL FORMAT "99999"
113 fil_Property2
AT ROW 3 COL 26.43 COLON-ALIGNED NO-LABEL
114 cmb_MonthTo
AT ROW 4.2 COL 40 COLON-ALIGNED
115 RP.Log2
AT ROW 4.3 COL 10.14
116 LABEL "Calculate Based on Actuals"
119 RP.Log3
AT ROW 5.2 COL 10.14
120 LABEL "Monthly Areas Columns"
123 RP.Log4
AT ROW 6.2 COL 10.14
124 LABEL "Sort by Manager"
127 RP.Log1
AT ROW 7.2 COL 10.14
132 btn_print
AT ROW 7.2 COL 58.14
133 RECT-23
AT ROW 1 COL 1
134 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
135 SIDE-LABELS NO-UNDERLINE THREE-D
136 AT COL 1 ROW 1 SCROLLABLE
138 DEFAULT-BUTTON btn_print.
141 /* *********************** Procedure Settings
************************ */
143 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
144 /* Settings for
THIS-PROCEDURE
146 External Tables
: ttpl.RP
147 Allow
: Basic
,DB-Fields
149 Add Fields to
: EXTERNAL-TABLES
150 Other Settings
: PERSISTENT-ONLY
COMPILE
153 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
154 /* then cleanup and return.
*/
155 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
156 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT.":U
157 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
161 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
163 /* ************************* Create Window
************************** */
165 &ANALYZE-SUSPEND _CREATE-WINDOW
166 /* DESIGN Window definition
(used by the UIB
)
167 CREATE WINDOW V-table-Win
ASSIGN
170 /* END WINDOW DEFINITION
*/
174 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
175 /* ************************* Included-Libraries
*********************** */
177 {src
/adm
/method
/viewer.i
}
178 {inc
/method
/m-mntvwr.i
}
180 /* _UIB-CODE-BLOCK-END
*/
186 /* *********** Runtime Attributes and AppBuilder Settings
*********** */
188 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
189 /* SETTINGS
FOR WINDOW V-table-Win
190 VISIBLE,,RUN-PERSISTENT
*/
191 /* SETTINGS
FOR FRAME F-Main
192 NOT-VISIBLE Size-to-Fit
*/
194 FRAME F-Main
:SCROLLABLE = FALSE
195 FRAME F-Main
:HIDDEN = TRUE.
197 /* SETTINGS
FOR FILL-IN fil_Property
IN FRAME F-Main
199 /* SETTINGS
FOR FILL-IN fil_Property2
IN FRAME F-Main
201 /* SETTINGS
FOR FILL-IN RP.Int1
IN FRAME F-Main
202 EXP-LABEL EXP-FORMAT
*/
203 /* SETTINGS
FOR FILL-IN RP.Int2
IN FRAME F-Main
204 EXP-LABEL EXP-FORMAT
*/
205 /* SETTINGS
FOR TOGGLE-BOX RP.Log1
IN FRAME F-Main
207 /* SETTINGS
FOR TOGGLE-BOX RP.Log2
IN FRAME F-Main
209 /* SETTINGS
FOR TOGGLE-BOX RP.Log3
IN FRAME F-Main
211 /* SETTINGS
FOR TOGGLE-BOX RP.Log4
IN FRAME F-Main
213 /* _RUN-TIME-ATTRIBUTES-END
*/
217 /* Setting information for Queries and Browse Widgets fields
*/
219 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
220 /* Query rebuild information for
FRAME F-Main
223 */ /* FRAME F-Main
*/
230 /* ************************ Control Triggers
************************ */
232 &Scoped-define SELF-NAME btn_print
233 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_print V-table-Win
234 ON CHOOSE OF btn_print
IN FRAME F-Main
/* OK */
238 SELF:SENSITIVE = Yes.
241 /* _UIB-CODE-BLOCK-END
*/
245 &Scoped-define SELF-NAME RP.Char1
246 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Char1 V-table-Win
247 ON VALUE-CHANGED
OF RP.Char1
IN FRAME F-Main
/* Char1
*/
249 RUN select-options-changed.
252 /* _UIB-CODE-BLOCK-END
*/
256 &Scoped-define SELF-NAME cmb_MonthTo
257 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthTo V-table-Win
258 ON U1
OF cmb_MonthTo
IN FRAME F-Main
/* To Month
*/
260 {inc
/selcmb
/scmthe1.i
"RP" "Int3"}
263 /* _UIB-CODE-BLOCK-END
*/
267 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthTo V-table-Win
268 ON U2
OF cmb_MonthTo
IN FRAME F-Main
/* To Month
*/
270 {inc
/selcmb
/scmthe2.i
"RP" "Int3"}
273 /* _UIB-CODE-BLOCK-END
*/
277 &Scoped-define SELF-NAME fil_Property
278 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
279 ON U1
OF fil_Property
IN FRAME F-Main
281 {inc
/selfil
/sfpro1.i
"RP" "Int1"}
284 /* _UIB-CODE-BLOCK-END
*/
288 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
289 ON U2
OF fil_Property
IN FRAME F-Main
291 {inc
/selfil
/sfpro2.i
"RP" "Int1"}
294 /* _UIB-CODE-BLOCK-END
*/
298 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
299 ON U3
OF fil_Property
IN FRAME F-Main
301 {inc
/selfil
/sfpro3.i
"RP" "Int1"}
304 /* _UIB-CODE-BLOCK-END
*/
308 &Scoped-define SELF-NAME fil_Property2
309 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property2 V-table-Win
310 ON U1
OF fil_Property2
IN FRAME F-Main
312 {inc
/selfil
/sfpro1.i
"RP" "Int2"}
315 /* _UIB-CODE-BLOCK-END
*/
319 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property2 V-table-Win
320 ON U2
OF fil_Property2
IN FRAME F-Main
322 {inc
/selfil
/sfpro2.i
"RP" "Int2"}
325 /* _UIB-CODE-BLOCK-END
*/
329 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property2 V-table-Win
330 ON U3
OF fil_Property2
IN FRAME F-Main
332 {inc
/selfil
/sfpro3.i
"RP" "Int2"}
335 /* _UIB-CODE-BLOCK-END
*/
339 &Scoped-define SELF-NAME RP.Int1
340 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int1 V-table-Win
341 ON LEAVE OF RP.Int1
IN FRAME F-Main
/* Int1
*/
343 {inc
/selcde
/cdpro.i
"fil_Property"}
346 /* _UIB-CODE-BLOCK-END
*/
350 &Scoped-define SELF-NAME RP.Int2
351 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int2 V-table-Win
352 ON LEAVE OF RP.Int2
IN FRAME F-Main
/* Int2
*/
354 {inc
/selcde
/cdpro.i
"fil_Property2"}
357 /* _UIB-CODE-BLOCK-END
*/
361 &Scoped-define SELF-NAME RP.Log2
362 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Log2 V-table-Win
363 ON VALUE-CHANGED
OF RP.Log2
IN FRAME F-Main
/* Calculate Based on Actuals
*/
365 RUN calculation-basis-changed.
368 /* _UIB-CODE-BLOCK-END
*/
374 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
377 /* *************************** Main Block
*************************** */
379 /* _UIB-CODE-BLOCK-END
*/
383 /* ********************** Internal Procedures
*********************** */
385 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win
386 PROCEDURE adm-row-available
:
387 /*------------------------------------------------------------------------------
388 Purpose
: Override
(thoroughly
!) the Progress adm-row-available
389 ------------------------------------------------------------------------------*/
391 /* Define variables needed by this internal procedure.
*/
392 {src
/adm
/template
/row-head.i
}
394 /* Create a list of all the tables that we need to get.
*/
395 {src
/adm
/template
/row-list.i
"Creditor"}
397 /* Get the record
ROWID's from the RECORD-SOURCE.
*/
398 {src
/adm
/template
/row-get.i
}
400 /* FIND each record specified by the RECORD-SOURCE.
*/
401 {src
/adm
/template
/row-find.i
"Creditor"}
403 /* Process the newly available records
(i.e. display fields
,
404 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
405 {src
/adm
/template
/row-end.i
}
409 /* _UIB-CODE-BLOCK-END
*/
412 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE calculation-basis-changed V-table-Win
413 PROCEDURE calculation-basis-changed
:
414 /*------------------------------------------------------------------------------
416 ------------------------------------------------------------------------------*/
417 DO WITH FRAME {&FRAME-NAME}:
418 IF INPUT RP.Log2
THEN
425 /* _UIB-CODE-BLOCK-END
*/
428 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
429 PROCEDURE disable_UI
:
430 /*------------------------------------------------------------------------------
431 Purpose
: DISABLE the User Interface
433 Notes
: Here we clean-up the user-interface by deleting
434 dynamic widgets we have created and
/or hide
435 frames. This procedure is usually called when
436 we are ready to
"clean-up" after running.
437 ------------------------------------------------------------------------------*/
438 /* Hide all frames.
*/
440 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
443 /* _UIB-CODE-BLOCK-END
*/
446 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable-appropriate-fields V-table-Win
447 PROCEDURE enable-appropriate-fields
:
448 /*------------------------------------------------------------------------------
450 ------------------------------------------------------------------------------*/
451 DO WITH FRAME {&FRAME-NAME}:
452 RUN select-options-changed.
453 RUN calculation-basis-changed.
457 /* _UIB-CODE-BLOCK-END
*/
460 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-enable-fields V-table-Win
461 PROCEDURE inst-enable-fields
:
462 /*------------------------------------------------------------------------------
464 ------------------------------------------------------------------------------*/
466 RUN enable-appropriate-fields.
470 /* _UIB-CODE-BLOCK-END
*/
473 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
474 PROCEDURE inst-initialize
:
475 /*------------------------------------------------------------------------------
477 ------------------------------------------------------------------------------*/
478 DEF VAR user-name
AS CHAR NO-UNDO.
480 {inc
/username.i
"user-name"}
482 FIND RP
WHERE RP.UserName
= user-name
483 AND RP.ReportID
= {&REPORT-ID} NO-ERROR.
485 IF NOT AVAILABLE RP
THEN DO WITH FRAME {&FRAME-NAME}:
487 ASSIGN RP.ReportID
= {&REPORT-ID}
488 RP.UserName
= user-name
494 RUN dispatch
( 'display-fields'
:U
).
495 RUN dispatch
( 'enable-fields'
:U
).
499 /* _UIB-CODE-BLOCK-END
*/
502 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
503 PROCEDURE pre-destroy
:
504 /*------------------------------------------------------------------------------
508 ------------------------------------------------------------------------------*/
510 RUN check-modified
( "CLEAR" ).
514 /* _UIB-CODE-BLOCK-END
*/
517 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE run-report V-table-Win
518 PROCEDURE run-report
:
519 /*------------------------------------------------------------------------------
520 Purpose
: Actually run the report through RB engine.
521 ------------------------------------------------------------------------------*/
522 DEF VAR report-options
AS CHAR NO-UNDO.
525 IF RETURN-VALUE = "FAIL" THEN RETURN.
527 RUN dispatch
( 'update-record'
:U
).
529 report-options
= RP.Char1
530 + (IF RP.Char1
= "OneProperty" THEN
531 "~nProperties," + STRING(RP.Int1
) + "," + STRING(RP.Int1
)
532 ELSE (IF RP.Char1
= "PropertyRange" THEN
533 "~nProperties," + STRING(RP.Int1
) + "," + STRING(RP.Int2
)
535 + (IF RP.Log1
THEN "~nPreview" ELSE "")
536 + (IF RP.Log2
THEN "~nActuals" + "~nToMonth," + STRING(RP.Int3
)
538 + (IF RP.Log3
THEN "~nMarsColumns" ELSE "")
539 + (IF RP.Log4
THEN "~nByManager" ELSE "") .
541 {inc
/bq-do.i
"process/report/portfolio-yield.p" "report-options" "NOT RP.Log1"}
545 /* _UIB-CODE-BLOCK-END
*/
548 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE select-options-changed V-table-Win
549 PROCEDURE select-options-changed
:
550 /*------------------------------------------------------------------------------
552 ------------------------------------------------------------------------------*/
553 DEF VAR options
AS CHAR NO-UNDO.
555 options
= INPUT FRAME {&FRAME-NAME} RP.Char1.
559 DO WITH FRAME {&FRAME-NAME}:
560 HIDE RP.Int1 fil_Property RP.Int2 fil_Property2.
561 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property
:HANDLE ), "HIDDEN = Yes":U
).
562 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property2
:HANDLE ), "HIDDEN = Yes":U
).
565 WHEN "OneProperty" THEN
566 DO WITH FRAME {&FRAME-NAME}:
567 HIDE RP.Int2 fil_Property2.
568 VIEW RP.Int1 fil_Property.
569 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property
:HANDLE ), "HIDDEN = No":U
).
570 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property2
:HANDLE ), "HIDDEN = Yes":U
).
573 WHEN "PropertyRange" THEN
574 DO WITH FRAME {&FRAME-NAME}:
575 VIEW RP.Int1 fil_Property RP.Int2 fil_Property2.
576 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property
:HANDLE ), "HIDDEN = No":U
).
577 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property2
:HANDLE ), "HIDDEN = No":U
).
583 /* _UIB-CODE-BLOCK-END
*/
586 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win
587 PROCEDURE send-records
:
588 /*------------------------------------------------------------------------------
590 ------------------------------------------------------------------------------*/
592 /* Define variables needed by this internal procedure.
*/
593 {src
/adm
/template
/snd-head.i
}
595 /* For each requested table
, put it's
ROWID in the output list.
*/
596 {src
/adm
/template
/snd-list.i
"Creditor"}
598 /* Deal with any unexpected table requests before closing.
*/
599 {src
/adm
/template
/snd-end.i
}
603 /* _UIB-CODE-BLOCK-END
*/
606 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
607 PROCEDURE state-changed
:
608 /* -----------------------------------------------------------
612 -------------------------------------------------------------*/
613 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
614 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
617 /* Object instance CASEs can go here to replace standard behavior
619 {src
/adm
/template
/vstates.i
}
623 /* _UIB-CODE-BLOCK-END
*/
626 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-report V-table-Win
627 PROCEDURE verify-report
:
628 /*------------------------------------------------------------------------------
630 ------------------------------------------------------------------------------*/
632 CASE INPUT FRAME {&FRAME-NAME} RP.Char1:
634 WHEN 'OneProperty'
THEN
635 IF NOT CAN-FIND( FIRST Property
WHERE Property.PropertyCode
=
636 INPUT FRAME {&FRAME-NAME} RP.Int1 ) THEN
638 MESSAGE "You must select a property" VIEW-AS ALERT-BOX ERROR.
639 APPLY '
ENTRY'
:U
TO RP.Int1
IN FRAME {&FRAME-NAME}.
646 /* _UIB-CODE-BLOCK-END
*/