1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI
5 &Scoped-define WINDOW-NAME CURRENT-WINDOW
6 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS B-table-Win
7 /*------------------------------------------------------------------------
13 ------------------------------------------------------------------------*/
17 /* *************************** Definitions
************************** */
19 DEF VAR key-name
AS CHAR NO-UNDO.
20 DEF VAR key-value
AS CHAR NO-UNDO.
22 DEF WORK-TABLE SavePFP
NO-UNDO LIKE PropForecastParam.
24 FIND Month
WHERE Month.StartDate
<= TODAY AND Month.EndDate
>= TODAY NO-LOCK NO-ERROR.
25 IF AVAILABLE(Month
) THEN DO:
26 SavePFP.MonthCode
= Month.MonthCode.
27 FIND FIRST FinancialYear
WHERE FinancialYear.FinancialYearCode
> Month.FinancialYearCode
NO-LOCK NO-ERROR.
28 IF AVAILABLE(FinancialYear
) THEN
29 FIND FIRST Month
OF FinancialYear
NO-LOCK NO-ERROR.
30 IF AVAILABLE(Month
) THEN SavePFP.MonthCode
= Month.MonthCode.
33 DEF VAR line-modified
AS LOGI
NO-UNDO INITIAL No.
34 DEF VAR last-line
AS LOGI
NO-UNDO INITIAL No.
35 DEF VAR new-record
AS LOGI
NO-UNDO INITIAL No.
36 DEF VAR entry-date
AS DATE NO-UNDO.
37 DEF BUFFER tmp_Month2
FOR Month.
39 DEFINE TEMP-TABLE tmp_Month
NO-UNDO LIKE Month
40 FIELD EnteredDate
AS DATE FORMAT "99/99/9999" INITIAL TODAY.
42 ON FIND OF PropForecastParam
DO:
43 FIND tmp_Month2
WHERE tmp_Month2.MonthCode
= PropForecastParam.MonthCode
NO-LOCK NO-ERROR.
44 IF AVAILABLE(tmp_Month2
) THEN
45 entry-date
= tmp_Month2.StartDate.
47 entry-date
= DATE( MONTH(entry-date
), 1, YEAR(entry-date
)).
49 FIND tmp_Month
WHERE tmp_Month.MonthCode
= PropForecastParam.MonthCode
NO-ERROR.
50 IF NOT AVAILABLE(tmp_Month
) THEN FIND FIRST tmp_Month.
51 tmp_Month.EnteredDate
= entry-date.
55 /* _UIB-CODE-BLOCK-END
*/
59 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
61 /* ******************** Preprocessor Definitions
******************** */
63 &Scoped-define PROCEDURE-TYPE SmartBrowser
65 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
67 /* Name of first Frame and
/or Browse and
/or first Query
*/
68 &Scoped-define FRAME-NAME f_browser
69 &Scoped-define BROWSE-NAME br_table
71 /* Internal Tables
(found by Frame
, Query
& Browse Queries) */
72 &Scoped-define INTERNAL-TABLES PropForecastParam
74 /* Define KEY-PHRASE in case it is used by any query.
*/
75 &Scoped-define KEY-PHRASE TRUE
77 /* Definitions for
BROWSE br_table
*/
78 &Scoped-define FIELDS-IN-QUERY-br_table PropForecastParam.PropertyCode tmp_Month.EnteredDate PropForecastParam.ParameterID PropForecastParam.ParameterValue
79 &Scoped-define ENABLED-FIELDS-IN-QUERY-br_table PropForecastParam.PropertyCode ~
80 tmp_Month.EnteredDate ~
81 PropForecastParam.ParameterID ~
82 PropForecastParam.ParameterValue
83 &Scoped-define FIELD-PAIRS-IN-QUERY-br_table~
84 ~
{&FP1}PropertyCode ~{&FP2}PropertyCode ~{&FP3}~
85 ~
{&FP1}EnteredDate ~{&FP2}EnteredDate ~{&FP3}~
86 ~
{&FP1}ParameterID ~{&FP2}ParameterID ~{&FP3}~
87 ~
{&FP1}ParameterValue ~{&FP2}ParameterValue ~{&FP3}
88 &Scoped-define ENABLED-TABLES-IN-QUERY-br_table PropForecastParam tmp_Month
89 &Scoped-define FIRST-ENABLED-TABLE-IN-QUERY-br_table PropForecastParam
90 &Scoped-define SECOND-ENABLED-TABLE-IN-QUERY-br_table tmp_Month
91 &Scoped-define SELF-NAME br_table
92 &Scoped-define OPEN-QUERY-br_table OPEN QUERY {&SELF-NAME} FOR EACH PropForecastParam WHERE ~{&KEY-PHRASE} NO-LOCK ~{&SORTBY-PHRASE}.
93 &Scoped-define TABLES-IN-QUERY-br_table PropForecastParam
94 &Scoped-define FIRST-TABLE-IN-QUERY-br_table PropForecastParam
97 /* Definitions for
FRAME f_browser
*/
99 /* Standard List Definitions
*/
100 &Scoped-Define ENABLED-OBJECTS br_table btn_add-line
102 /* Custom List Definitions
*/
103 /* List-1
,List-2
,List-3
,List-4
,List-5
,List-6
*/
105 /* _UIB-PREPROCESSOR-BLOCK-END
*/
109 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" B-table-Win _INLINE
110 /* Actions
: ? adm
/support
/keyedit.w ? ? ?
*/
116 MonthCode|y|y|TTPL.PropForecastParam.MonthCode
117 PropertyCode|y|y|TTPL.PropForecastParam.PropertyCode
120 **************************
121 * Set attributes related to FOREIGN
KEYS
123 RUN set-attribute-list
(
124 'Keys-Accepted
= "MonthCode,PropertyCode",
125 Keys-Supplied
= "MonthCode,PropertyCode"'
:U
).
127 /* Tell the ADM to use the OPEN-QUERY-CASES.
*/
128 &Scoped-define OPEN-QUERY-CASES RUN dispatch ('open-query-cases':U).
129 /**************************
131 /* _UIB-CODE-BLOCK-END
*/
134 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Advanced Query Options" B-table-Win _INLINE
135 /* Actions
: ? adm
/support
/advqedit.w ? ? ?
*/
143 ************************
144 * Set attributes related to SORTBY-OPTIONS
*/
145 RUN set-attribute-list
(
146 'SortBy-Options
= ""'
:U
).
147 /************************
150 </FILTER-ATTRIBUTES
> */
152 /* _UIB-CODE-BLOCK-END
*/
156 /* *********************** Control Definitions
********************** */
159 /* Definitions of the field level widgets
*/
160 DEFINE BUTTON btn_add-line
164 /* Query definitions
*/
166 DEFINE QUERY br_table
FOR
167 PropForecastParam
SCROLLING.
170 /* Browse definitions
*/
171 DEFINE BROWSE br_table
172 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _DISPLAY-FIELDS br_table B-table-Win _FREEFORM
173 QUERY br_table
NO-LOCK DISPLAY
174 PropForecastParam.PropertyCode
COLUMN-LABEL "Property" FORMAT "99999":C
175 tmp_Month.EnteredDate
COLUMN-LABEL "Starting On" WIDTH 9
176 PropForecastParam.ParameterID
FORMAT "X(50)" WIDTH 14
177 PropForecastParam.ParameterValue
FORMAT "X(1024)" WIDTH 45
179 PropForecastParam.PropertyCode
180 tmp_Month.EnteredDate
HELP "The first day of the parameters effects"
181 PropForecastParam.ParameterID
182 PropForecastParam.ParameterValue
183 /* _UIB-CODE-BLOCK-END
*/
185 WITH NO-ASSIGN SEPARATORS SIZE 82.29 BY 14.2
189 /* ************************ Frame Definitions
*********************** */
191 DEFINE FRAME f_browser
192 br_table
AT ROW 1 COL 1
193 btn_add-line
AT ROW 2.4 COL 35.29
194 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
195 SIDE-LABELS NO-UNDERLINE THREE-D
196 AT COL 1 ROW 1 SCROLLABLE
197 BGCOLOR 16 FGCOLOR 0 FONT 10.
200 /* *********************** Procedure Settings
************************ */
202 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
203 /* Settings for
THIS-PROCEDURE
207 Add Fields to
: EXTERNAL-TABLES
208 Other Settings
: PERSISTENT-ONLY
COMPILE
211 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
212 /* then cleanup and return.
*/
213 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
214 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
215 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
219 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
221 /* ************************* Create Window
************************** */
223 &ANALYZE-SUSPEND _CREATE-WINDOW
224 /* DESIGN Window definition
(used by the UIB
)
225 CREATE WINDOW B-table-Win
ASSIGN
228 /* END WINDOW DEFINITION
*/
233 /* *************** Runtime Attributes and UIB Settings
************** */
235 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
236 /* SETTINGS
FOR WINDOW B-table-Win
237 NOT-VISIBLE
,,RUN-PERSISTENT
*/
238 /* SETTINGS
FOR FRAME f_browser
239 NOT-VISIBLE Size-to-Fit
*/
240 /* BROWSE-TAB br_table
1 f_browser
*/
242 FRAME f_browser
:SCROLLABLE = FALSE
243 FRAME f_browser
:HIDDEN = TRUE.
245 /* _RUN-TIME-ATTRIBUTES-END
*/
249 /* Setting information for Queries and Browse Widgets fields
*/
251 &ANALYZE-SUSPEND _QUERY-BLOCK BROWSE br_table
252 /* Query rebuild information for
BROWSE br_table
254 OPEN QUERY {&SELF-NAME} FOR EACH PropForecastParam WHERE ~{&KEY-PHRASE} NO-LOCK
257 _Options
= "NO-LOCK KEY-PHRASE SORTBY-PHRASE"
258 _TblOptList
= ", OUTER,"
260 */ /* BROWSE br_table
*/
263 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME f_browser
264 /* Query rebuild information for
FRAME f_browser
267 */ /* FRAME f_browser
*/
273 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB B-table-Win
274 /* ************************* Included-Libraries
*********************** */
276 {src
/adm
/method
/browser.i
}
277 {inc
/method
/m-drlvwr.i
}
279 /* _UIB-CODE-BLOCK-END
*/
285 /* ************************ Control Triggers
************************ */
287 &Scoped-define SELF-NAME f_browser
288 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL f_browser B-table-Win
289 ON RETURN OF FRAME f_browser
291 IF LOOKUP( FOCUS:TYPE, '
FILL-IN,COMBO-BOX,EDITOR'
) <> 0 OR
292 (FOCUS:TYPE = '
BUTTON'
:U
AND FOCUS:DYNAMIC) THEN
294 APPLY 'TAB'
:U
TO FOCUS.
299 /* _UIB-CODE-BLOCK-END
*/
303 &Scoped-define BROWSE-NAME br_table
304 &Scoped-define SELF-NAME br_table
305 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
306 ON ENTRY OF br_table
IN FRAME f_browser
309 DEF VAR n-results
AS INT NO-UNDO.
310 DEF VAR s-focused
AS LOGI
NO-UNDO INIT ?.
311 DEF VAR n-row
AS LOGI
NO-UNDO INIT ?.
312 IF LOOKUP( LAST-EVENT:LABEL, 'ENTER
,TAB
,MOUSE-SELECT-UP'
:U
) = 0 THEN RETURN.
314 n-row
= {&BROWSE-NAME}:NEW-ROW IN FRAME {&FRAME-NAME}.
316 n-results
= NUM-RESULTS("{&BROWSE-NAME}":U
).
317 IF NOT ( n-results
= ?
OR n-results
= 0 ) THEN
318 s-focused
= {&BROWSE-NAME}:SELECT-FOCUSED-ROW().
322 /* Set the default screen-values
*/
323 RUN set-default-values.
326 ELSE IF NOT AVAILABLE PropForecastParam
THEN RETURN.
328 IF TRIM(PropForecastParam.ParameterID
:SCREEN-VALUE IN BROWSE {&BROWSE-NAME}) = "" THEN
329 APPLY '
ENTRY'
:U
TO PropForecastParam.ParameterID
IN BROWSE {&BROWSE-NAME}.
331 APPLY '
ENTRY'
:U
TO PropForecastParam.PropertyCode
IN BROWSE {&BROWSE-NAME}.
337 /* _UIB-CODE-BLOCK-END
*/
341 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
342 ON ROW-ENTRY
OF br_table
IN FRAME f_browser
344 IF {&BROWSE-NAME}:NEW-ROW IN FRAME {&FRAME-NAME} THEN DO:
345 RUN set-default-values.
352 /* _UIB-CODE-BLOCK-END
*/
356 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
357 ON ROW-LEAVE
OF br_table
IN FRAME f_browser
358 OR 'CURSOR-DOWN'
:U
OF {&SELF-NAME}
359 OR 'CURSOR-UP'
:U
OF {&SELF-NAME}
360 OR 'ENTER'
:U
OF PropForecastParam.ParameterValue
IN BROWSE {&SELF-NAME}
363 IF line-modified
THEN DO:
364 RUN verify-line.
/* and update it
*/
365 IF RETURN-VALUE = "FAIL" THEN RETURN NO-APPLY.
368 RUN save-these-values.
372 /* _UIB-CODE-BLOCK-END
*/
376 &Scoped-define SELF-NAME btn_add-line
377 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_add-line B-table-Win
378 ON CHOOSE OF btn_add-line
IN FRAME f_browser
/* Button
1 */
383 /* _UIB-CODE-BLOCK-END
*/
389 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK B-table-Win
392 /* *************************** Main Block
*************************** */
394 /* create the tmp_Month table from the Month table
*/
395 FOR EACH Month
NO-LOCK:
397 BUFFER-COPY Month
TO tmp_Month
398 ASSIGN tmp_Month.EnteredDate
= Month.StartDate.
402 HIDE btn_add-line
IN FRAME {&FRAME-NAME}.
404 &Scoped-define SELF-NAME PropForecastParam.PropertyCode
405 ON LEAVE OF {&SELF-NAME} IN BROWSE {&BROWSE-NAME}
407 IF line-modified
THEN RETURN.
408 IF INPUT BROWSE {&BROWSE-NAME} {&SELF-NAME} <> {&SELF-NAME} THEN
413 &SCOP SELF-NAME tmp_Month.EnteredDate
414 ON LEAVE OF {&SELF-NAME} IN BROWSE {&BROWSE-NAME} DO:
415 IF line-modified
THEN RETURN.
416 IF (INPUT BROWSE {&BROWSE-NAME} {&SELF-NAME}) <> {&SELF-NAME} THEN
420 &SCOP SELF-NAME PropForecastParam.ParameterID
421 ON LEAVE OF {&SELF-NAME} IN BROWSE {&BROWSE-NAME} DO:
422 IF line-modified
THEN RETURN.
423 IF (INPUT BROWSE {&BROWSE-NAME} {&SELF-NAME}) <> {&SELF-NAME} THEN
427 &SCOP SELF-NAME PropForecastParam.ParameterValue
428 ON LEAVE OF {&SELF-NAME} IN BROWSE {&BROWSE-NAME} DO:
429 IF line-modified
THEN RETURN.
430 IF (INPUT BROWSE {&BROWSE-NAME} {&SELF-NAME}) <> {&SELF-NAME} THEN
436 /* _UIB-CODE-BLOCK-END
*/
440 /* ********************** Internal Procedures
*********************** */
442 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE add-new-line B-table-Win
443 PROCEDURE add-new-line
:
444 /*------------------------------------------------------------------------------
445 Purpose
: Inserts a new line at the end of the browse
446 ------------------------------------------------------------------------------*/
447 DO WITH FRAME {&FRAME-NAME}:
448 IF NUM-RESULTS("{&BROWSE-NAME}":U
) = ?
OR
449 NUM-RESULTS("{&BROWSE-NAME}":U
) = 0 THEN
452 FIND FIRST PropForecastParam
WHERE NOT(PropForecastParam.PropertyCode
> 0)
453 OR NOT(PropForecastParam.MonthCode
> 0)
454 EXCLUSIVE-LOCK NO-ERROR.
455 IF NOT AVAILABLE(PropForecastParam
) THEN CREATE PropForecastParam.
456 RUN assign-default-values.
458 RUN local-open-query-cases.
461 IF {&BROWSE-NAME}:INSERT-ROW("AFTER") THEN .
466 /* _UIB-CODE-BLOCK-END
*/
470 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-open-query-cases B-table-Win adm/support/_adm-opn.p
471 PROCEDURE adm-open-query-cases
:
472 /*------------------------------------------------------------------------------
473 Purpose
: Opens different cases of the query based on attributes
474 such as the 'Key-Name'
, or 'SortBy-Case'
476 ------------------------------------------------------------------------------*/
477 DEF VAR key-value
AS CHAR NO-UNDO.
479 /* Look up the current key-value.
*/
480 RUN get-attribute
('Key-Value'
:U
).
481 key-value
= RETURN-VALUE.
483 /* Find the current record using the current Key-Name.
*/
484 RUN get-attribute
('Key-Name'
:U
).
486 WHEN 'MonthCode'
:U
THEN DO:
487 &Scope KEY-PHRASE PropForecastParam.MonthCode eq INTEGER(key-value)
488 {&OPEN-QUERY-{&BROWSE-NAME}}
490 WHEN 'PropertyCode'
:U
THEN DO:
491 &Scope KEY-PHRASE PropForecastParam.PropertyCode eq INTEGER(key-value)
492 {&OPEN-QUERY-{&BROWSE-NAME}}
493 END.
/* PropertyCode
*/
495 &Scope KEY-PHRASE TRUE
496 {&OPEN-QUERY-{&BROWSE-NAME}}
497 END.
/* OTHERWISE...
*/
502 /* _UIB-CODE-BLOCK-END
*/
506 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available B-table-Win _ADM-ROW-AVAILABLE
507 PROCEDURE adm-row-available
:
508 /*------------------------------------------------------------------------------
509 Purpose
: Dispatched to this procedure when the Record-
510 Source has a new row available. This procedure
511 tries to get the new row
(or foriegn keys
) from
512 the Record-Source and process it.
514 ------------------------------------------------------------------------------*/
516 /* Define variables needed by this internal procedure.
*/
517 {src
/adm
/template
/row-head.i
}
519 /* Process the newly available records
(i.e. display fields
,
520 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
521 {src
/adm
/template
/row-end.i
}
525 /* _UIB-CODE-BLOCK-END
*/
529 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE assign-default-values B-table-Win
530 PROCEDURE assign-default-values
:
531 /*------------------------------------------------------------------------------
533 ------------------------------------------------------------------------------*/
534 DEF BUFFER tmp_Prop
FOR Property.
535 DEF BUFFER tmp_month2
FOR Month.
536 IF NOT AVAILABLE(PropForecastParam
) THEN RETURN.
537 DO WITH FRAME {&FRAME-NAME}:
538 PropForecastParam.ParameterID
= SavePFP.ParameterID.
539 PropForecastParam.ParameterValue
= SavePFP.ParameterValue.
541 WHEN 'PropertyCode'
THEN DO:
542 PropForecastParam.PropertyCode
= INT(key-value
).
543 FIND FIRST tmp_month2
WHERE tmp_Month2.MonthCode
> SavePFP.MonthCode
NO-LOCK NO-ERROR.
544 PropForecastParam.MonthCode
= tmp_Month2.MonthCode.
546 WHEN 'MonthCode'
THEN DO:
547 FIND tmp_month2
WHERE tmp_Month2.MonthCode
= INT(key-value
) NO-LOCK NO-ERROR.
548 PropForecastParam.MonthCode
= tmp_Month2.MonthCode.
549 FIND FIRST tmp_Prop
WHERE tmp_Prop.Active
AND tmp_Prop.PropertyCode
> SavePFP.PropertyCode
NO-LOCK NO-ERROR.
550 PropForecastParam.PropertyCode
= (IF AVAILABLE(tmp_Prop
) THEN tmp_Prop.PropertyCode
ELSE 0).
552 WHEN 'FinancialYearCode'
THEN DO:
553 FIND FIRST tmp_month2
WHERE tmp_Month2.MonthCode
> SavePFP.MonthCode
NO-LOCK NO-ERROR.
554 PropForecastParam.MonthCode
= tmp_Month2.MonthCode.
555 FIND FIRST tmp_Prop
WHERE tmp_Prop.Active
AND tmp_Prop.PropertyCode
> SavePFP.PropertyCode
NO-LOCK NO-ERROR.
556 PropForecastParam.PropertyCode
= (IF AVAILABLE(tmp_Prop
) THEN tmp_Prop.PropertyCode
ELSE 0).
559 FIND tmp_Month
OF PropForecastParam
NO-ERROR.
563 /* _UIB-CODE-BLOCK-END
*/
567 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE assign-line B-table-Win
568 PROCEDURE assign-line
:
569 /*------------------------------------------------------------------------------
571 ------------------------------------------------------------------------------*/
572 DEF BUFFER tmp_tmp
FOR tmp_Month.
573 DEF BUFFER tmp_Month2
FOR Month.
574 DEF VAR in-date
AS DATE NO-UNDO.
576 /* Code placed here will execute PRIOR to standard behavior.
*/
577 IF NOT AVAILABLE PropForecastParam
THEN RETURN.
578 in-date
= INPUT BROWSE {&BROWSE-NAME} tmp_Month.EnteredDate .
580 DO TRANSACTION WITH FRAME {&FRAME-NAME}:
582 IF NOT NEW PropForecastParam
THEN FIND CURRENT PropForecastParam
EXCLUSIVE-LOCK.
584 ASSIGN BROWSE {&BROWSE-NAME}
585 PropForecastParam.PropertyCode
586 PropForecastParam.ParameterID
587 PropForecastParam.ParameterValue.
589 FIND tmp_Month2
WHERE tmp_Month2.StartDate
<= in-date
590 AND tmp_Month2.EndDate
>= in-date
NO-LOCK NO-ERROR.
591 IF NOT AVAILABLE(tmp_Month2
) THEN DO:
592 MESSAGE "No financial period (Month) found for the date" in-date
593 VIEW-AS ALERT-BOX ERROR.
596 PropForecastParam.MonthCode
= tmp_Month2.MonthCode.
597 tmp_Month.EnteredDate
= tmp_Month2.StartDate.
598 FIND CURRENT PropForecastParam
NO-LOCK.
605 /* _UIB-CODE-BLOCK-END
*/
609 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI B-table-Win _DEFAULT-DISABLE
610 PROCEDURE disable_UI
:
611 /*------------------------------------------------------------------------------
612 Purpose
: DISABLE the User Interface
614 Notes
: Here we clean-up the user-interface by deleting
615 dynamic widgets we have created and
/or hide
616 frames. This procedure is usually called when
617 we are ready to
"clean-up" after running.
618 ------------------------------------------------------------------------------*/
619 /* Hide all frames.
*/
620 HIDE FRAME f_browser.
621 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
624 /* _UIB-CODE-BLOCK-END
*/
628 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE display-line B-table-Win
629 PROCEDURE display-line
:
630 /*------------------------------------------------------------------------------
632 ------------------------------------------------------------------------------*/
633 IF NOT AVAILABLE PropForecastParam
THEN RETURN.
635 IF NUM-RESULTS("{&BROWSE-NAME}":U
) > 1 THEN
636 DISPLAY {&ENABLED-FIELDS-IN-QUERY-{&BROWSE-NAME}} WITH BROWSE {&BROWSE-NAME}.
638 RUN local-open-query-cases.
642 /* _UIB-CODE-BLOCK-END
*/
646 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-cancel-record B-table-Win
647 PROCEDURE local-cancel-record
:
648 /*------------------------------------------------------------------------------
649 Purpose
: Override standard ADM method
651 ------------------------------------------------------------------------------*/
653 /* Code placed here will execute PRIOR to standard behavior.
*/
654 IF new-record
THEN DO TRANSACTION WITH FRAME {&FRAME-NAME}:
655 FIND CURRENT PropForecastParam
EXCLUSIVE-LOCK NO-ERROR.
656 IF AVAILABLE(PropForecastParam
) THEN DELETE PropForecastParam.
658 IF {&BROWSE-NAME}:DELETE-CURRENT-ROW() THEN .
661 ELSE DO TRANSACTION WITH FRAME {&FRAME-NAME}:
662 FIND CURRENT PropForecastParam
EXCLUSIVE-LOCK NO-ERROR.
663 IF AVAILABLE(PropForecastParam
) THEN
664 BUFFER-COPY SavePFP
TO PropForecastParam.
669 /* _UIB-CODE-BLOCK-END
*/
673 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-display-record B-table-Win
674 PROCEDURE local-display-record
:
675 /*------------------------------------------------------------------------------
676 Purpose
: Override standard ADM method
678 ------------------------------------------------------------------------------*/
684 /* _UIB-CODE-BLOCK-END
*/
688 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-open-query-cases B-table-Win
689 PROCEDURE local-open-query-cases
:
690 /*------------------------------------------------------------------------------
691 Purpose
: Override standard ADM method
693 ------------------------------------------------------------------------------*/
694 DEF VAR m-1
AS INT NO-UNDO.
695 DEF VAR m-2
AS INT NO-UNDO.
697 IF key-name
= 'MonthCode'
:U
THEN DO:
698 /* Show everything from that month on
*/
699 &Scope KEY-PHRASE PropForecastParam.MonthCode >= INTEGER(key-value)
700 {&OPEN-QUERY-{&BROWSE-NAME}}
703 ELSE IF key-name
= 'FinancialYearCode'
:U
THEN DO:
704 /* Show everything during that financial year
*/
705 FIND FIRST Month
WHERE Month.FinancialYearCode
= INT(key-value
) NO-LOCK.
706 FIND LAST Month
WHERE Month.FinancialYearCode
= INT(key-value
) NO-LOCK.
707 &Scope KEY-PHRASE PropForecastParam.MonthCode >= m-1 AND PropForecastParam.MonthCode <= m-2
708 {&OPEN-QUERY-{&BROWSE-NAME}}
712 /* Dispatch standard ADM method.
*/
713 RUN dispatch
IN THIS-PROCEDURE ( INPUT 'open-query-cases'
:U
) .
715 /* Code placed here will execute AFTER standard behavior.
*/
719 /* _UIB-CODE-BLOCK-END
*/
723 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE save-these-values B-table-Win
724 PROCEDURE save-these-values
:
725 /*------------------------------------------------------------------------------
727 ------------------------------------------------------------------------------*/
728 IF AVAILABLE(PropForecastParam
) THEN DO:
729 BUFFER-COPY PropForecastParam
TO SavePFP.
736 /* _UIB-CODE-BLOCK-END
*/
740 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-key B-table-Win adm/support/_key-snd.p
742 /*------------------------------------------------------------------------------
743 Purpose
: Sends a requested
KEY value back to the calling
745 Parameters
: <see adm
/template
/sndkytop.i
>
746 ------------------------------------------------------------------------------*/
748 /* Define variables needed by this internal procedure.
*/
749 {src
/adm
/template
/sndkytop.i
}
751 /* Return the key value associated with each key case.
*/
752 {src
/adm
/template
/sndkycas.i
"MonthCode" "PropForecastParam" "MonthCode"}
753 {src
/adm
/template
/sndkycas.i
"PropertyCode" "PropForecastParam" "PropertyCode"}
755 /* Close the
CASE statement and end the procedure.
*/
756 {src
/adm
/template
/sndkyend.i
}
760 /* _UIB-CODE-BLOCK-END
*/
764 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records B-table-Win _ADM-SEND-RECORDS
765 PROCEDURE send-records
:
766 /*------------------------------------------------------------------------------
767 Purpose
: Send record
ROWID's for all tables used by
769 Parameters
: see template
/snd-head.i
770 ------------------------------------------------------------------------------*/
772 /* Define variables needed by this internal procedure.
*/
773 {src
/adm
/template
/snd-head.i
}
775 /* For each requested table
, put it's
ROWID in the output list.
*/
776 {src
/adm
/template
/snd-list.i
"PropForecastParam"}
778 /* Deal with any unexpected table requests before closing.
*/
779 {src
/adm
/template
/snd-end.i
}
783 /* _UIB-CODE-BLOCK-END
*/
787 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE set-default-values B-table-Win
788 PROCEDURE set-default-values
:
789 /*------------------------------------------------------------------------------
791 ------------------------------------------------------------------------------*/
792 DEF BUFFER tmp_Prop
FOR Property.
793 DEF BUFFER tmp_month2
FOR Month.
794 DO WITH FRAME {&FRAME-NAME}:
795 PropForecastParam.ParameterID
:SCREEN-VALUE IN BROWSE {&BROWSE-NAME} = SavePFP.ParameterID.
796 PropForecastParam.ParameterValue
:SCREEN-VALUE IN BROWSE {&BROWSE-NAME} = SavePFP.ParameterValue.
798 WHEN 'PropertyCode'
THEN DO:
799 PropForecastParam.PropertyCode
:SCREEN-VALUE IN BROWSE {&BROWSE-NAME} = key-value.
800 FIND FIRST tmp_month2
WHERE tmp_Month2.MonthCode
> SavePFP.MonthCode
NO-LOCK NO-ERROR.
801 tmp_Month.EnteredDate
:SCREEN-VALUE IN BROWSE {&BROWSE-NAME} = STRING( tmp_Month2.StartDate, tmp_Month.EnteredDate:FORMAT IN BROWSE {&BROWSE-NAME}).
803 WHEN 'MonthCode'
THEN DO:
804 FIND tmp_month2
WHERE tmp_Month2.MonthCode
= INT(key-value
) NO-LOCK NO-ERROR.
805 tmp_Month.EnteredDate
:SCREEN-VALUE IN BROWSE {&BROWSE-NAME} = STRING( tmp_Month2.StartDate, tmp_Month.EnteredDate:FORMAT IN BROWSE {&BROWSE-NAME}).
806 FIND FIRST tmp_Prop
WHERE tmp_Prop.Active
AND tmp_Prop.PropertyCode
> SavePFP.PropertyCode
NO-LOCK NO-ERROR.
807 PropForecastParam.PropertyCode
:SCREEN-VALUE IN BROWSE {&BROWSE-NAME} = STRING( (IF AVAILABLE(tmp_Prop) THEN tmp_Prop.PropertyCode ELSE ?), PropForecastParam.PropertyCode:FORMAT IN BROWSE {&BROWSE-NAME}).
809 WHEN 'FinancialYearCode'
THEN DO:
810 FIND FIRST tmp_month2
WHERE tmp_Month2.MonthCode
> SavePFP.MonthCode
NO-LOCK NO-ERROR.
811 tmp_Month.EnteredDate
:SCREEN-VALUE IN BROWSE {&BROWSE-NAME} = STRING( tmp_Month2.StartDate, tmp_Month.EnteredDate:FORMAT IN BROWSE {&BROWSE-NAME}).
812 FIND FIRST tmp_Prop
WHERE tmp_Prop.Active
AND tmp_Prop.PropertyCode
> SavePFP.PropertyCode
NO-LOCK NO-ERROR.
813 PropForecastParam.PropertyCode
:SCREEN-VALUE IN BROWSE {&BROWSE-NAME} = STRING( (IF AVAILABLE(tmp_Prop) THEN tmp_Prop.PropertyCode ELSE ?), PropForecastParam.PropertyCode:FORMAT IN BROWSE {&BROWSE-NAME}).
819 /* _UIB-CODE-BLOCK-END
*/
823 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed B-table-Win
824 PROCEDURE state-changed
:
825 /* -----------------------------------------------------------
829 -------------------------------------------------------------*/
830 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
831 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
834 /* Object instance CASEs can go here to replace standard behavior
836 {src
/adm
/template
/bstates.i
}
840 /* _UIB-CODE-BLOCK-END
*/
844 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-line B-table-Win
845 PROCEDURE update-line
:
846 /*------------------------------------------------------------------------------
847 Purpose
: Update the current invoice line.
848 ------------------------------------------------------------------------------*/
850 /* Create a new line if needed and update the details
*/
851 IF {&BROWSE-NAME}:NEW-ROW IN FRAME {&FRAME-NAME} THEN DO:
852 FIND FIRST PropForecastParam
WHERE NOT(PropForecastParam.PropertyCode
> 0)
853 OR NOT(PropForecastParam.MonthCode
> 0)
854 EXCLUSIVE-LOCK NO-ERROR.
855 IF NOT AVAILABLE(PropForecastParam
) THEN CREATE PropForecastParam.
856 IF {&BROWSE-NAME}:CREATE-RESULT-LIST-ENTRY() THEN.
866 /* _UIB-CODE-BLOCK-END
*/
870 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-Key-Name B-table-Win
871 PROCEDURE use-Key-Name
:
872 /*------------------------------------------------------------------------------
874 ------------------------------------------------------------------------------*/
875 DEF INPUT PARAMETER new-key-name
AS CHAR NO-UNDO.
876 key-name
= new-key-name.
879 /* _UIB-CODE-BLOCK-END
*/
883 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-Key-Value B-table-Win
884 PROCEDURE use-Key-Value
:
885 /*------------------------------------------------------------------------------
887 ------------------------------------------------------------------------------*/
888 DEF INPUT PARAMETER new-key-value
AS CHAR NO-UNDO.
889 key-value
= new-key-value.
891 IF key-name
= "PropertyCode" THEN
892 SavePFP.PropertyCode
= INT(key-value
).
893 ELSE IF key-name
= "MonthCode" THEN
894 SavePFP.MonthCode
= INT(key-value
).
898 /* _UIB-CODE-BLOCK-END
*/
902 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-line B-table-Win
903 PROCEDURE verify-line
:
904 /*------------------------------------------------------------------------------
906 ------------------------------------------------------------------------------*/
907 DEF VAR err-field
AS HANDLE NO-UNDO.
909 err-field
= WIDGET-HANDLE( RETURN-VALUE ).
915 /* _UIB-CODE-BLOCK-END
*/