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 /*------------------------------------------------------------------------
12 Description
: from VIEWER.W
- Template for SmartViewer Objects
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.
*/
32 /* *************************** Definitions
************************** */
34 /* Parameters Definitions
--- */
36 /* Local Variable Definitions
--- */
38 DEF VAR mode
AS CHAR NO-UNDO.
40 /* _UIB-CODE-BLOCK-END
*/
44 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
46 /* ******************** Preprocessor Definitions
******************** */
48 &Scoped-define PROCEDURE-TYPE SmartViewer
49 &Scoped-define DB-AWARE no
51 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
53 /* Name of first Frame and
/or Browse and
/or first Query
*/
54 &Scoped-define FRAME-NAME F-Main
57 &Scoped-define EXTERNAL-TABLES ProjectBudget
58 &Scoped-define FIRST-EXTERNAL-TABLE ProjectBudget
61 /* Need to scope the external tables to this procedure
*/
62 DEFINE QUERY external_tables
FOR ProjectBudget.
63 /* Standard List Definitions
*/
64 &Scoped-Define ENABLED-FIELDS ProjectBudget.AccountCode ~
65 ProjectBudget.Description ProjectBudget.OriginalBudget ~
66 ProjectBudget.EntityType ProjectBudget.EntityCode ~
67 ProjectBudget.EntityAccount ProjectBudget.AllowPosting ~
68 ProjectBudget.HighVolume
69 &Scoped-define ENABLED-TABLES ProjectBudget
70 &Scoped-define FIRST-ENABLED-TABLE ProjectBudget
71 &Scoped-define DISPLAYED-TABLES ProjectBudget
72 &Scoped-define FIRST-DISPLAYED-TABLE ProjectBudget
73 &Scoped-Define ENABLED-OBJECTS cmb_Category RECT-2
74 &Scoped-Define DISPLAYED-FIELDS ProjectBudget.AccountCode ~
75 ProjectBudget.Description ProjectBudget.OriginalBudget ~
76 ProjectBudget.AgreedVariation ProjectBudget.Adjustment ~
77 ProjectBudget.EntityType ProjectBudget.EntityCode ~
78 ProjectBudget.EntityAccount ProjectBudget.UncommittedBudget ~
79 ProjectBudget.CommittedBudget ProjectBudget.AllowPosting ~
80 ProjectBudget.HighVolume
81 &Scoped-Define DISPLAYED-OBJECTS cmb_Category fil_Entity fil_EAccount
83 /* Custom List Definitions
*/
84 /* ADM-CREATE-FIELDS
,ADM-ASSIGN-FIELDS
,List-3
,List-4
,List-5
,List-6
*/
86 /* _UIB-PREPROCESSOR-BLOCK-END
*/
90 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" V-table-Win _INLINE
91 /* Actions
: ? adm
/support
/keyedit.w ? ? ?
*/
99 **************************
100 * Set attributes related to FOREIGN
KEYS
102 RUN set-attribute-list
(
104 Keys-Supplied
= ""'
:U
).
105 /**************************
108 /* _UIB-CODE-BLOCK-END
*/
112 /* *********************** Control Definitions
********************** */
115 /* Definitions of the field level widgets
*/
116 DEFINE VARIABLE cmb_Category
AS CHARACTER FORMAT "X(256)":U
117 LABEL "Expense Category"
118 VIEW-AS COMBO-BOX INNER-LINES 15
121 SIZE 48.43 BY 1.05 NO-UNDO.
123 DEFINE VARIABLE fil_EAccount
AS CHARACTER FORMAT "X(256)":U
125 SIZE 48.57 BY 1 NO-UNDO.
127 DEFINE VARIABLE fil_Entity
AS CHARACTER FORMAT "X(256)":U
129 SIZE 48.57 BY 1 NO-UNDO.
131 DEFINE RECTANGLE RECT-2
132 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
136 /* ************************ Frame Definitions
*********************** */
139 ProjectBudget.AccountCode
AT ROW 1.5 COL 12.14 COLON-ALIGNED
142 ProjectBudget.Description
AT ROW 1.5 COL 24 COLON-ALIGNED NO-LABEL
145 cmb_Category
AT ROW 2.6 COL 24.14 COLON-ALIGNED
146 ProjectBudget.OriginalBudget
AT ROW 6.5 COL 24.14 COLON-ALIGNED
147 LABEL "Original Budget" FORMAT "->>>,>>>,>>9.99"
150 ProjectBudget.AgreedVariation
AT ROW 7.5 COL 24.14 COLON-ALIGNED
151 LABEL "Agreed Variation" FORMAT "->>>,>>>,>>9.99"
155 ProjectBudget.Adjustment
AT ROW 7.5 COL 55.14 COLON-ALIGNED
159 ProjectBudget.EntityType
AT ROW 4 COL 12.14 COLON-ALIGNED
163 ProjectBudget.EntityCode
AT ROW 4 COL 14.43 COLON-ALIGNED NO-LABEL
166 fil_Entity
AT ROW 4 COL 24.14 COLON-ALIGNED NO-LABEL
167 ProjectBudget.EntityAccount
AT ROW 5 COL 12.14 COLON-ALIGNED NO-LABEL
170 fil_EAccount
AT ROW 5 COL 24.14 COLON-ALIGNED NO-LABEL
171 ProjectBudget.UncommittedBudget
AT ROW 10 COL 24.14 COLON-ALIGNED
172 LABEL "Uncommitted Budget"
176 ProjectBudget.CommittedBudget
AT ROW 9 COL 24.14 COLON-ALIGNED
177 LABEL "Committed Budget" FORMAT "->>>,>>>,>>9.99"
181 ProjectBudget.AllowPosting
AT ROW 9 COL 51.14
182 LABEL "Allow direct posting"
185 ProjectBudget.HighVolume
AT ROW 10 COL 51.14
188 RECT-2
AT ROW 1 COL 1
189 "Entity Account:" VIEW-AS TEXT
190 SIZE 10.86 BY 1 AT ROW 4 COL 3
192 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
193 SIDE-LABELS NO-UNDERLINE THREE-D
194 AT COL 1 ROW 1 SCROLLABLE
198 /* *********************** Procedure Settings
************************ */
200 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
201 /* Settings for
THIS-PROCEDURE
203 External Tables
: TTPL.ProjectBudget
204 Allow
: Basic
,DB-Fields
206 Add Fields to
: EXTERNAL-TABLES
207 Other Settings
: PERSISTENT-ONLY
COMPILE
210 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
211 /* then cleanup and return.
*/
212 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
213 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT.":U
214 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
218 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
220 /* ************************* Create Window
************************** */
222 &ANALYZE-SUSPEND _CREATE-WINDOW
223 /* DESIGN Window definition
(used by the UIB
)
224 CREATE WINDOW V-table-Win
ASSIGN
227 /* END WINDOW DEFINITION
*/
231 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
232 /* ************************* Included-Libraries
*********************** */
234 {src
/adm
/method
/viewer.i
}
235 {inc
/method
/m-mntvwr.i
}
237 /* _UIB-CODE-BLOCK-END
*/
243 /* *********** Runtime Attributes and AppBuilder Settings
*********** */
245 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
246 /* SETTINGS
FOR WINDOW V-table-Win
247 VISIBLE,,RUN-PERSISTENT
*/
248 /* SETTINGS
FOR FRAME F-Main
249 NOT-VISIBLE Size-to-Fit Custom
*/
251 FRAME F-Main
:SCROLLABLE = FALSE
252 FRAME F-Main
:HIDDEN = TRUE.
254 /* SETTINGS
FOR FILL-IN ProjectBudget.Adjustment
IN FRAME F-Main
256 /* SETTINGS
FOR FILL-IN ProjectBudget.AgreedVariation
IN FRAME F-Main
257 NO-ENABLE EXP-LABEL EXP-FORMAT
*/
258 /* SETTINGS
FOR TOGGLE-BOX ProjectBudget.AllowPosting
IN FRAME F-Main
260 /* SETTINGS
FOR FILL-IN ProjectBudget.CommittedBudget
IN FRAME F-Main
261 NO-ENABLE EXP-LABEL EXP-FORMAT
*/
262 /* SETTINGS
FOR FILL-IN ProjectBudget.Description
IN FRAME F-Main
264 /* SETTINGS
FOR FILL-IN ProjectBudget.EntityAccount
IN FRAME F-Main
266 /* SETTINGS
FOR FILL-IN ProjectBudget.EntityCode
IN FRAME F-Main
268 /* SETTINGS
FOR FILL-IN ProjectBudget.EntityType
IN FRAME F-Main
270 /* SETTINGS
FOR FILL-IN fil_EAccount
IN FRAME F-Main
272 /* SETTINGS
FOR FILL-IN fil_Entity
IN FRAME F-Main
274 /* SETTINGS
FOR FILL-IN ProjectBudget.OriginalBudget
IN FRAME F-Main
275 EXP-LABEL EXP-FORMAT
*/
276 /* SETTINGS
FOR FILL-IN ProjectBudget.UncommittedBudget
IN FRAME F-Main
277 NO-ENABLE EXP-LABEL
*/
278 /* _RUN-TIME-ATTRIBUTES-END
*/
282 /* Setting information for Queries and Browse Widgets fields
*/
284 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
285 /* Query rebuild information for
FRAME F-Main
288 */ /* FRAME F-Main
*/
295 /* ************************ Control Triggers
************************ */
297 &Scoped-define SELF-NAME ProjectBudget.AccountCode
298 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL ProjectBudget.AccountCode V-table-Win
299 ON LEAVE OF ProjectBudget.AccountCode
IN FRAME F-Main
/* Account
*/
301 /* If the given account does not exist then allow the user
302 to specify a description
*/
304 IF NOT SELF:MODIFIED THEN RETURN.
306 IF CAN-FIND( ChartOfAccount
WHERE
307 ChartOfAccount.AccountCode
= INPUT {&SELF-NAME} ) THEN
309 {inc
/selcde
/cdcoa.i
"ProjectBudget.Description"}
314 ProjectBudget.Description
:SCREEN-VALUE = "".
316 IF LAST-EVENT:LABEL = "TAB" THEN
318 APPLY '
ENTRY'
:U
TO ProjectBudget.Description.
325 /* _UIB-CODE-BLOCK-END
*/
329 &Scoped-define SELF-NAME cmb_Category
330 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_Category V-table-Win
331 ON U1
OF cmb_Category
IN FRAME F-Main
/* Expense Category
*/
333 {inc
/selcmb
/scpxct1.i
"ProjectBudget" "ProjectExpenseCategory"}
336 /* _UIB-CODE-BLOCK-END
*/
340 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_Category V-table-Win
341 ON U2
OF cmb_Category
IN FRAME F-Main
/* Expense Category
*/
343 {inc
/selcmb
/scpxct2.i
"ProjectBudget" "ProjectExpenseCategory"}
346 /* _UIB-CODE-BLOCK-END
*/
350 &Scoped-define SELF-NAME ProjectBudget.Description
351 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL ProjectBudget.Description V-table-Win
352 ON U1
OF ProjectBudget.Description
IN FRAME F-Main
/* Description
*/
354 {inc
/selfil
/sfcoa1.i
"ProjectBudget" "AccountCode"}
357 /* _UIB-CODE-BLOCK-END
*/
361 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL ProjectBudget.Description V-table-Win
362 ON U2
OF ProjectBudget.Description
IN FRAME F-Main
/* Description
*/
364 {inc
/selfil
/sfcoa2.i
"ProjectBudget" "AccountCode"}
367 /* _UIB-CODE-BLOCK-END
*/
371 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL ProjectBudget.Description V-table-Win
372 ON U3
OF ProjectBudget.Description
IN FRAME F-Main
/* Description
*/
374 {inc
/selfil
/sfcoa3.i
"ProjectBudget" "AccountCode"}
377 /* _UIB-CODE-BLOCK-END
*/
381 &Scoped-define SELF-NAME ProjectBudget.EntityAccount
382 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL ProjectBudget.EntityAccount V-table-Win
383 ON LEAVE OF ProjectBudget.EntityAccount
IN FRAME F-Main
/* Account
*/
385 IF {&SELF-NAME}:MODIFIED THEN DO:
387 DEF VAR old-val
AS CHAR NO-UNDO.
388 DEF VAR curr-val
AS CHAR NO-UNDO.
390 DEF BUFFER tmp_ChartOfAccount
FOR ChartOfAccount.
392 old-val
= ENTRY( 2, {&SELF-NAME}:PRIVATE-DATA ).
393 curr-val
= {&SELF-NAME}:SCREEN-VALUE.
395 IF old-val
<> curr-val
THEN DO WITH FRAME {&FRAME-NAME}:
397 DEF BUFFER tmp_ProjectBudget
FOR ProjectBudget.
398 IF (INPUT ProjectBudget.EntityType
) = "J" AND CAN-FIND(ProjectBudget
WHERE ProjectBudget.ProjectCode
= (INPUT ProjectBudget.EntityCode
)
399 AND ProjectBudget.AccountCode
= INPUT {&SELF-NAME} )
401 FIND FIRST tmp_ProjectBudget
NO-LOCK WHERE tmp_ProjectBudget.ProjectCode
= (INPUT ProjectBudget.EntityCode
)
402 AND tmp_ProjectBudget.AccountCode
= INPUT {&SELF-NAME} NO-ERROR.
403 IF AVAILABLE(tmp_ProjectBudget
) THEN DO:
404 fil_EAccount
= tmp_ProjectBudget.Description.
405 DISPLAY fil_EAccount.
409 FIND FIRST tmp_ChartOfAccount
WHERE tmp_ChartOfAccount.AccountCode
= INPUT {&SELF-NAME}
412 IF NOT AVAILABLE( tmp_ChartOfAccount
)
413 AND NOT AVAILABLE( tmp_ProjectBudget
)
415 DEF VAR old-id
AS ROWID NO-UNDO.
416 old-id
= TO-ROWID( ENTRY( 1, {&SELF-NAME}:PRIVATE-DATA ) ).
418 MESSAGE "There is no ChartOfAccount or ProjectBudget available with code " INPUT {&SELF-NAME}
419 VIEW-AS ALERT-BOX ERROR.
421 FIND FIRST tmp_ChartOfAccount
WHERE ROWID( tmp_ChartOfAccount
) = old-id
NO-LOCK NO-ERROR.
423 IF AVAILABLE tmp_ChartOfAccount
THEN
424 DISPLAY tmp_ChartOfAccount.AccountCode @
{&SELF-NAME}.
426 DISPLAY {&SELF-NAME}.
431 DEF VAR spd
AS CHAR NO-UNDO.
432 spd
= {&SELF-NAME}:PRIVATE-DATA.
433 ENTRY( 1, spd
) = STRING( ROWID( tmp_ChartOfAccount
) ).
434 ENTRY( 2, spd
) = {&SELF-NAME}:SCREEN-VALUE.
435 {&SELF-NAME}:PRIVATE-DATA = spd.
437 fil_EAccount
:PRIVATE-DATA = STRING( ROWID( tmp_ChartOfAccount
) ).
439 DEF VAR enabled
AS LOGI
NO-UNDO.
440 enabled
= fil_EAccount
:SENSITIVE.
442 fil_EAccount
:SENSITIVE = TRUE.
443 APPLY 'U2'
:U
TO fil_EAccount.
444 fil_EAccount
:SENSITIVE = enabled.
446 /* Tab past the select button for valid codes if tab was pressed
*/
447 IF LOOKUP( LAST-EVENT:LABEL, 'TAB
,ENTER'
:U
) <> 0 THEN DO:
448 DEF VAR next-tab
AS HANDLE NO-UNDO.
450 next-tab
= {&SELF-NAME}:NEXT-TAB-ITEM.
451 DO WHILE NOT next-tab
:SENSITIVE:
452 next-tab
= next-tab
:NEXT-TAB-ITEM.
455 IF VALID-HANDLE( next-tab
) AND next-tab
:TYPE = '
BUTTON'
:U
456 AND next-tab
:DYNAMIC THEN
458 APPLY 'TAB'
:U
TO next-tab.
465 END.
/* Of check if modified
*/
468 /* _UIB-CODE-BLOCK-END
*/
472 &Scoped-define SELF-NAME ProjectBudget.EntityCode
473 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL ProjectBudget.EntityCode V-table-Win
474 ON LEAVE OF ProjectBudget.EntityCode
IN FRAME F-Main
/* Code
*/
476 CASE ProjectBudget.EntityType
:SCREEN-VALUE:
477 WHEN 'P'
THEN DO: {inc
/selcde
/cdpro.i
"fil_Entity"} END.
478 WHEN 'L'
THEN DO: {inc
/selcde
/cdcmp.i
"fil_Entity"} END.
479 WHEN 'J'
THEN DO: {inc
/selcde
/cdprj.i
"fil_Entity"} END.
483 /* _UIB-CODE-BLOCK-END
*/
487 &Scoped-define SELF-NAME ProjectBudget.EntityType
488 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL ProjectBudget.EntityType V-table-Win
489 ON ANY-PRINTABLE
OF ProjectBudget.EntityType
IN FRAME F-Main
/* Entity
*/
491 APPLY CAPS( CHR( LASTKEY ) ) TO SELF.
495 /* _UIB-CODE-BLOCK-END
*/
499 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL ProjectBudget.EntityType V-table-Win
500 ON LEAVE OF ProjectBudget.EntityType
IN FRAME F-Main
/* Entity
*/
502 IF SELF:MODIFIED THEN
505 IF RETURN-VALUE = "FAIL" THEN RETURN NO-APPLY.
509 /* _UIB-CODE-BLOCK-END
*/
513 &Scoped-define SELF-NAME fil_EAccount
514 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_EAccount V-table-Win
515 ON U1
OF fil_EAccount
IN FRAME F-Main
517 DO WITH FRAME {&FRAME-NAME}:
518 IF INPUT ProjectBudget.EntityType
= "J" THEN DO:
519 {inc
/selfil
/sfpbj1.i
"ProjectBudget" "EntityAccount"}
522 {inc
/selfil
/sfcoa1.i
"ProjectBudget" "EntityAccount"}
527 /* _UIB-CODE-BLOCK-END
*/
531 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_EAccount V-table-Win
532 ON U2
OF fil_EAccount
IN FRAME F-Main
534 IF INPUT ProjectBudget.EntityType
= "J" THEN DO:
535 {inc
/selfil
/sfpbj2.i
"ProjectBudget" "EntityAccount"}
538 {inc
/selfil
/sfcoa2.i
"ProjectBudget" "EntityAccount"}
542 /* _UIB-CODE-BLOCK-END
*/
546 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_EAccount V-table-Win
547 ON U3
OF fil_EAccount
IN FRAME F-Main
549 IF INPUT ProjectBudget.EntityType
= "J" THEN DO:
550 {inc
/selfil
/sfpbj3.i
"ProjectBudget" "EntityAccount"}
553 {inc
/selfil
/sfcoa3.i
"ProjectBudget" "EntityAccount"}
557 /* _UIB-CODE-BLOCK-END
*/
561 &Scoped-define SELF-NAME fil_Entity
562 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Entity V-table-Win
563 ON U1
OF fil_Entity
IN FRAME F-Main
565 CASE ProjectBudget.EntityType
:SCREEN-VALUE:
566 WHEN 'P'
THEN DO: {inc
/selfil
/sfpro1.i
"ProjectBudget" "EntityCode"} END.
567 WHEN 'L'
THEN DO: {inc
/selfil
/sfcmp1.i
"ProjectBudget" "EntityCode"} END.
568 WHEN 'J'
THEN DO: {inc
/selfil
/sfprj1.i
"ProjectBudget" "EntityCode"} END.
572 /* _UIB-CODE-BLOCK-END
*/
576 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Entity V-table-Win
577 ON U2
OF fil_Entity
IN FRAME F-Main
579 CASE ProjectBudget.EntityType
:SCREEN-VALUE:
580 WHEN 'P'
THEN DO: {inc
/selfil
/sfpro2.i
"ProjectBudget" "EntityCode"} END.
581 WHEN 'L'
THEN DO: {inc
/selfil
/sfcmp2.i
"ProjectBudget" "EntityCode"} END.
582 WHEN 'J'
THEN DO: {inc
/selfil
/sfprj1.i
"ProjectBudget" "EntityCode"} END.
586 /* _UIB-CODE-BLOCK-END
*/
592 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
595 /* *************************** Main Block
*************************** */
597 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
598 RUN dispatch
IN THIS-PROCEDURE ('initialize'
:U
).
601 /************************ INTERNAL PROCEDURES
********************/
603 /* _UIB-CODE-BLOCK-END
*/
607 /* ********************** Internal Procedures
*********************** */
609 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win _ADM-ROW-AVAILABLE
610 PROCEDURE adm-row-available
:
611 /*------------------------------------------------------------------------------
612 Purpose
: Dispatched to this procedure when the Record-
613 Source has a new row available. This procedure
614 tries to get the new row
(or foriegn keys
) from
615 the Record-Source and process it.
617 ------------------------------------------------------------------------------*/
619 /* Define variables needed by this internal procedure.
*/
620 {src
/adm
/template
/row-head.i
}
622 /* Create a list of all the tables that we need to get.
*/
623 {src
/adm
/template
/row-list.i
"ProjectBudget"}
625 /* Get the record
ROWID's from the RECORD-SOURCE.
*/
626 {src
/adm
/template
/row-get.i
}
628 /* FIND each record specified by the RECORD-SOURCE.
*/
629 {src
/adm
/template
/row-find.i
"ProjectBudget"}
631 /* Process the newly available records
(i.e. display fields
,
632 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
633 {src
/adm
/template
/row-end.i
}
637 /* _UIB-CODE-BLOCK-END
*/
640 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE cancel-changes V-table-Win
641 PROCEDURE cancel-changes
:
642 /*------------------------------------------------------------------------------
646 ------------------------------------------------------------------------------*/
648 RUN notify
( 'hide
, CONTAINER-SOURCE'
:U
).
649 IF mode
= "Add" THEN RUN delete-budget.
ELSE RUN check-modified
( "CLEAR" ).
650 RUN dispatch
( 'exit'
:U
).
654 /* _UIB-CODE-BLOCK-END
*/
657 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE confirm-changes V-table-Win
658 PROCEDURE confirm-changes
:
659 /*------------------------------------------------------------------------------
663 ------------------------------------------------------------------------------*/
666 IF RETURN-VALUE = "FAIL" THEN RETURN.
668 RUN notify
( 'hide
, CONTAINER-SOURCE'
:U
).
669 RUN dispatch
( 'update-record'
:U
).
670 IF mode
= "Add" THEN RUN notify
( 'open-query
, RECORD-SORUCE'
:U
).
671 RUN dispatch
( 'exit'
:U
).
675 /* _UIB-CODE-BLOCK-END
*/
678 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE delete-budget V-table-Win
679 PROCEDURE delete-budget
:
680 /*------------------------------------------------------------------------------
684 ------------------------------------------------------------------------------*/
686 FIND CURRENT ProjectBudget
EXCLUSIVE-LOCK NO-ERROR.
687 IF AVAILABLE ProjectBudget
THEN DELETE ProjectBudget.
691 /* _UIB-CODE-BLOCK-END
*/
694 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
695 PROCEDURE disable_UI
:
696 /*------------------------------------------------------------------------------
697 Purpose
: DISABLE the User Interface
699 Notes
: Here we clean-up the user-interface by deleting
700 dynamic widgets we have created and
/or hide
701 frames. This procedure is usually called when
702 we are ready to
"clean-up" after running.
703 ------------------------------------------------------------------------------*/
704 /* Hide all frames.
*/
706 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
709 /* _UIB-CODE-BLOCK-END
*/
712 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-project V-table-Win
713 PROCEDURE get-project
:
714 /*------------------------------------------------------------------------------
718 ------------------------------------------------------------------------------*/
720 DEF VAR c-recsrc
AS CHAR NO-UNDO.
721 DEF VAR rowid-list
AS CHAR NO-UNDO.
723 RUN get-link-handle
IN adm-broker-hdl
( THIS-PROCEDURE, 'RECORD-SOURCE'
:U
, OUTPUT c-recsrc
).
724 RUN send-records
IN WIDGET-HANDLE( c-recsrc
) ( "Project", OUTPUT rowid-list
).
725 FIND Project
WHERE ROWID( Project
) = TO-ROWID( rowid-list
) NO-LOCK NO-ERROR.
729 /* _UIB-CODE-BLOCK-END
*/
732 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-display-fields V-table-Win
733 PROCEDURE inst-display-fields
:
734 /*------------------------------------------------------------------------------
738 ------------------------------------------------------------------------------*/
740 RUN update-entity-button.
741 RUN update-account-button.
745 /* _UIB-CODE-BLOCK-END
*/
748 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-enable-fields V-table-Win
749 PROCEDURE inst-enable-fields
:
750 /*------------------------------------------------------------------------------
754 ------------------------------------------------------------------------------*/
756 DO WITH FRAME {&FRAME-NAME}:
758 DEF VAR default-budget
AS LOGI
NO-UNDO.
760 /* Check to see if this is the default budget
*/
761 FIND Project
WHERE Project.ProjectCode
= ProjectBudget.ProjectCode
763 default-budget
= Project.EntityAccount
= ProjectBudget.AccountCode.
765 /* ProjectBudget.AccountCode
:SENSITIVE = mode
= "Add".
766 ProjectBudget.EntityType
:SENSITIVE = mode
= "Add".
767 ProjectBudget.EntityCode
:SENSITIVE = mode
= "Add".
768 ProjectBudget.EntityAccount
:SENSITIVE = mode
= "Add".
*/
770 /* RUN set-link-attributes
IN sys-mgr
(
772 STRING( ProjectBudget.Description
:HANDLE ),
773 "HIDDEN = " + IF mode
= "Add" THEN "No" ELSE "Yes" ).
*/
775 /* RUN set-link-attributes
IN sys-mgr
(
777 STRING( fil_Entity
:HANDLE ),
778 "HIDDEN = " + IF mode
= "Add" THEN "No" ELSE "Yes" ).
*/
780 /* RUN set-link-attributes
IN sys-mgr
(
782 STRING( fil_EAccount
:HANDLE ),
783 "HIDDEN = " + IF mode
= "Add" THEN "No" ELSE "Yes" ).
*/
785 ProjectBudget.Adjustment
:SENSITIVE = NOT default-budget.
791 /* _UIB-CODE-BLOCK-END
*/
794 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
795 PROCEDURE inst-initialize
:
796 /*------------------------------------------------------------------------------
800 ------------------------------------------------------------------------------*/
802 DEF VAR can-edit
AS LOGI
NO-UNDO.
804 can-edit
= AVAILABLE Project
AND NOT Project.BudgetsFrozen.
811 RUN dispatch
( 'add-record'
:U
).
816 "All budget changes have been frozen for this project!" SKIP
817 "The add has been cancelled."
818 VIEW-AS ALERT-BOX ERROR TITLE "Add Error".
819 RUN set-attribute-list
( 'mode
= Maintain'
).
820 RUN dispatch
( 'disable-fields'
:U
).
823 ELSE RUN dispatch
( IF can-edit
THEN 'enable-fields'
ELSE 'disable-fields'
:U
).
827 /* _UIB-CODE-BLOCK-END
*/
830 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE override-add-record V-table-Win
831 PROCEDURE override-add-record
:
832 /*------------------------------------------------------------------------------
834 ------------------------------------------------------------------------------*/
835 DEF VAR account-default
AS DEC NO-UNDO INITIAL 1.
837 IF NOT AVAILABLE Project
THEN
839 RUN dispatch
( 'disable-fields'
:U
).
843 FIND LAST ProjectBudget
OF Project
WHERE ProjectBudget.AccountCode
< 100 NO-LOCK NO-ERROR.
844 IF AVAILABLE(ProjectBudget
) THEN account-default
= INT(ProjectBudget.AccountCode
) + 1.
847 CREATE ProjectBudget.
849 ProjectBudget.ProjectCode
= Project.ProjectCode
850 ProjectBudget.AccountCode
= account-default
851 ProjectBudget.EntityType
= Project.EntityType
852 ProjectBudget.EntityCode
= Project.EntityCode
853 ProjectBudget.EntityAccount
= Project.EntityAccount.
855 RUN dispatch
( 'enable-fields'
:U
).
856 RUN dispatch
( 'display-fields'
:U
).
858 CURRENT-WINDOW:TITLE = "Adding a new Budget to Project " + STRING( Project.ProjectCode
).
862 /* _UIB-CODE-BLOCK-END
*/
865 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
866 PROCEDURE pre-destroy
:
867 /*------------------------------------------------------------------------------
871 ------------------------------------------------------------------------------*/
873 IF LAST-EVENT:FUNCTION = "WINDOW-CLOSE":U
THEN RUN cancel-changes.
877 /* _UIB-CODE-BLOCK-END
*/
880 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-initialize V-table-Win
881 PROCEDURE pre-initialize
:
882 /*------------------------------------------------------------------------------
886 ------------------------------------------------------------------------------*/
892 /* _UIB-CODE-BLOCK-END
*/
895 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win _ADM-SEND-RECORDS
896 PROCEDURE send-records
:
897 /*------------------------------------------------------------------------------
898 Purpose
: Send record
ROWID's for all tables used by
900 Parameters
: see template
/snd-head.i
901 ------------------------------------------------------------------------------*/
903 /* Define variables needed by this internal procedure.
*/
904 {src
/adm
/template
/snd-head.i
}
906 /* For each requested table
, put it's
ROWID in the output list.
*/
907 {src
/adm
/template
/snd-list.i
"ProjectBudget"}
909 /* Deal with any unexpected table requests before closing.
*/
910 {src
/adm
/template
/snd-end.i
}
914 /* _UIB-CODE-BLOCK-END
*/
917 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
918 PROCEDURE state-changed
:
919 /* -----------------------------------------------------------
923 -------------------------------------------------------------*/
924 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
925 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
928 /* Object instance CASEs can go here to replace standard behavior
930 {src
/adm
/template
/vstates.i
}
934 /* _UIB-CODE-BLOCK-END
*/
937 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE type-changed V-table-Win
938 PROCEDURE type-changed
:
939 /*------------------------------------------------------------------------------
943 ------------------------------------------------------------------------------*/
945 DO WITH FRAME {&FRAME-NAME}:
947 /* Reset the entity
*/
948 ProjectBudget.EntityCode
:PRIVATE-DATA = ",".
949 ProjectBudget.EntityCode
:SCREEN-VALUE = STRING( 0 ).
950 ProjectBudget.EntityCode
:MODIFIED = No.
951 fil_Entity
:PRIVATE-DATA = "".
952 fil_Entity
:SCREEN-VALUE = "".
954 /* Reset the entity account
*/
955 ProjectBudget.EntityAccount
:PRIVATE-DATA = ",".
956 ProjectBudget.EntityAccount
:SCREEN-VALUE = STRING( 0.00 ).
957 ProjectBudget.EntityAccount
:MODIFIED = No.
958 fil_EAccount
:PRIVATE-DATA = "".
959 fil_EAccount
:SCREEN-VALUE = "".
961 RUN update-entity-button.
962 RUN update-account-button.
968 /* _UIB-CODE-BLOCK-END
*/
971 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-account-button V-table-Win
972 PROCEDURE update-account-button
:
973 /*------------------------------------------------------------------------------
977 ------------------------------------------------------------------------------*/
979 DO WITH FRAME {&FRAME-NAME}:
981 DEF VAR account-group
AS CHAR NO-UNDO.
983 CASE INPUT ProjectBudget.EntityType
:
984 WHEN 'P'
THEN account-group
= 'PROPEX'.
985 WHEN 'L'
THEN account-group
= 'ADMIN '.
986 WHEN 'J'
THEN account-group
= 'ADMIN '.
989 IF account-group
<> "" THEN
991 FIND AccountGroup
WHERE AccountGroup.AccountGroupCode
= account-group
993 IF NOT AVAILABLE AccountGroup
THEN RETURN.
995 RUN set-link-attributes
IN sys-mgr
(
997 STRING( fil_EAccount
:HANDLE ),
999 "FilterBy-Case = " + account-group
+ " - " + AccountGroup.Name
).
1006 /* _UIB-CODE-BLOCK-END
*/
1009 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-entity-button V-table-Win
1010 PROCEDURE update-entity-button
:
1011 /*------------------------------------------------------------------------------
1015 ------------------------------------------------------------------------------*/
1017 DO WITH FRAME {&FRAME-NAME}:
1019 DEF VAR node-name
AS CHAR NO-UNDO.
1020 DEF VAR vwr-name
AS CHAR NO-UNDO.
1021 DEF VAR filter-panel
AS CHAR NO-UNDO.
1022 DEF VAR sort-panel
AS CHAR NO-UNDO.
1024 FIND EntityType
WHERE EntityType.EntityType
= INPUT ProjectBudget.EntityType
1026 ProjectBudget.EntityType
:LABEL = IF AVAILABLE EntityType
THEN
1027 EntityType.Description
ELSE "Entity".
1029 CASE INPUT ProjectBudget.EntityType
:
1030 WHEN 'P'
THEN ASSIGN
1031 node-name
= 'w-selpro' vwr-name
= 'b-selpro'
1032 filter-panel
= "Yes" sort-panel
= "Yes".
1033 WHEN 'L'
THEN ASSIGN
1034 node-name
= 'w-selcmp' vwr-name
= 'b-selcmp'
1035 filter-panel
= "No" sort-panel
= "Yes".
1036 WHEN 'J'
THEN ASSIGN
1037 node-name
= 'w-selprj' vwr-name
= 'b-selprj'
1038 filter-panel
= "No" sort-panel
= "Yes".
1041 RUN set-link-attributes
IN sys-mgr
(
1043 STRING( fil_Entity
:HANDLE ),
1044 "TARGET = " + node-name
+ "," +
1045 "VIEWER = " + vwr-name
+ "," +
1046 "FILTER-PANEL = " + filter-panel
+ "," +
1047 "SORT-PANEL = " + sort-panel
).
1053 /* _UIB-CODE-BLOCK-END
*/
1056 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-mode V-table-Win
1057 PROCEDURE use-mode
:
1058 /*------------------------------------------------------------------------------
1062 ------------------------------------------------------------------------------*/
1063 DEF INPUT PARAMETER new-mode
AS CHAR NO-UNDO.
1068 /* _UIB-CODE-BLOCK-END
*/
1071 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-budget V-table-Win
1072 PROCEDURE verify-budget
:
1073 /*------------------------------------------------------------------------------
1077 ------------------------------------------------------------------------------*/
1079 DO WITH FRAME {&FRAME-NAME}:
1081 DEF BUFFER OtherBudget
FOR ProjectBudget.
1083 IF NOT ((INPUT ProjectBudget.EntityType
= "J") AND CAN-FIND( OtherBudget
WHERE OtherBudget.ProjectCode
= INPUT ProjectBudget.EntityCode
1084 AND OtherBudget.AccountCode
= INPUT ProjectBudget.EntityAccount
))
1085 AND NOT ((INPUT ProjectBudget.EntityType
<> "J") AND CAN-FIND(ChartOfAccount
WHERE ChartOfAccount.AccountCode
= INPUT ProjectBudget.EntityAccount
))
1087 MESSAGE "You must enter an account for this project"
1088 VIEW-AS ALERT-BOX ERROR TITLE "No Account Selected".
1089 APPLY '
ENTRY'
:U
TO ProjectBudget.EntityAccount.
1093 IF CAN-FIND( OtherBudget
WHERE
1094 OtherBudget.ProjectCode
= Project.ProjectCode
AND
1095 OtherBudget.AccountCode
= INPUT ProjectBudget.AccountCode
AND
1096 ROWID( OtherBudget
) <> ROWID( ProjectBudget
) ) THEN
1099 "Another budget already exists for project " + STRING( Project.ProjectCode
) SKIP
1100 "and account" ProjectBudget.AccountCode
:SCREEN-VALUE + "." SKIP(1)
1101 "Please change the account code."
1102 VIEW-AS ALERT-BOX ERROR TITLE "Duplicate budget".
1103 APPLY '
ENTRY'
:U
TO ProjectBudget.AccountCode.
1107 IF fil_Entity
:SCREEN-VALUE = "" THEN
1110 "You must select a" ProjectBudget.EntityType
:LABEL "for this" SKIP
1112 VIEW-AS ALERT-BOX ERROR TITLE "No " + ProjectBudget.EntityType
:LABEL + " selected".
1113 APPLY '
ENTRY'
TO ProjectBudget.EntityType.
1121 /* _UIB-CODE-BLOCK-END
*/
1124 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-type V-table-Win
1125 PROCEDURE verify-type
:
1126 /*------------------------------------------------------------------------------
1130 ------------------------------------------------------------------------------*/
1132 DO WITH FRAME {&FRAME-NAME}:
1134 IF LOOKUP( INPUT ProjectBudget.EntityType
, "P,L,J" ) = 0 THEN
1137 ProjectBudget.EntityType
:MODIFIED = No.
1143 /* _UIB-CODE-BLOCK-END
*/