1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI
6 &Scoped-define WINDOW-NAME CURRENT-WINDOW
7 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS V-table-Win
8 /*------------------------------------------------------------------------
9 ------------------------------------------------------------------------*/
11 /* *************************** Definitions
************************** */
13 DEF VAR mode
AS CHAR NO-UNDO.
14 {inc
/topic
/tpbnkact.i
}
17 {inc
/ofc-set.i
"BankAccount-Format" "bank-format"}
18 IF NOT AVAILABLE(OfficeSetting
) THEN DO:
19 CASE Office.OfficeCode
:
20 WHEN "AKLD" THEN bank-format
= "99-9999-9999999-99X".
21 WHEN "SDNY" THEN bank-format
= "999-999-9999999XXX".
22 OTHERWISE bank-format
= "99-9999-9999999-99X".
26 /* _UIB-CODE-BLOCK-END
*/
30 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
32 /* ******************** Preprocessor Definitions
******************** */
34 &Scoped-define PROCEDURE-TYPE SmartViewer
36 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
38 /* Name of first Frame and
/or Browse and
/or first Query
*/
39 &Scoped-define FRAME-NAME F-Main
42 &Scoped-define EXTERNAL-TABLES BankAccount
43 &Scoped-define FIRST-EXTERNAL-TABLE BankAccount
46 /* Need to scope the external tables to this procedure
*/
47 DEFINE QUERY external_tables
FOR BankAccount.
48 /* Standard List Definitions
*/
49 &Scoped-Define ENABLED-FIELDS BankAccount.BankAccountCode ~
50 BankAccount.Active BankAccount.CompanyCode BankAccount.AccountCode ~
51 BankAccount.BankName BankAccount.BankBranchName BankAccount.AccountName ~
52 BankAccount.BankAccount BankAccount.ChequeAccount
53 &Scoped-define FIELD-PAIRS~
54 ~
{&FP1}BankAccountCode ~{&FP2}BankAccountCode ~{&FP3}~
55 ~
{&FP1}CompanyCode ~{&FP2}CompanyCode ~{&FP3}~
56 ~
{&FP1}AccountCode ~{&FP2}AccountCode ~{&FP3}~
57 ~
{&FP1}BankName ~{&FP2}BankName ~{&FP3}~
58 ~
{&FP1}BankBranchName ~{&FP2}BankBranchName ~{&FP3}~
59 ~
{&FP1}BankAccount ~{&FP2}BankAccount ~{&FP3}
60 &Scoped-define ENABLED-TABLES BankAccount
61 &Scoped-define FIRST-ENABLED-TABLE BankAccount
62 &Scoped-Define ENABLED-OBJECTS RECT-2
63 &Scoped-Define DISPLAYED-FIELDS BankAccount.BankAccountCode ~
64 BankAccount.Active BankAccount.CompanyCode BankAccount.AccountCode ~
65 BankAccount.BankName BankAccount.BankBranchName BankAccount.AccountName ~
66 BankAccount.BankAccount BankAccount.ChequeAccount
67 &Scoped-Define DISPLAYED-OBJECTS fil_Company fil_Account
69 /* Custom List Definitions
*/
70 /* ADM-CREATE-FIELDS
,ADM-ASSIGN-FIELDS
,List-3
,List-4
,List-5
,List-6
*/
72 /* _UIB-PREPROCESSOR-BLOCK-END
*/
77 /* *********************** Control Definitions
********************** */
80 /* Definitions of the field level widgets
*/
81 DEFINE VARIABLE fil_Account
AS CHARACTER FORMAT "X(50)":U
86 DEFINE VARIABLE fil_Company
AS CHARACTER FORMAT "X(50)":U
91 DEFINE RECTANGLE RECT-2
92 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
96 /* ************************ Frame Definitions
*********************** */
99 BankAccount.BankAccountCode
AT ROW 1 COL 10.86 COLON-ALIGNED
104 BankAccount.Active
AT ROW 1 COL 63.72
107 BankAccount.CompanyCode
AT ROW 2.5 COL 10.86 COLON-ALIGNED
111 fil_Company
AT ROW 2.5 COL 22.29 COLON-ALIGNED NO-LABEL
112 BankAccount.AccountCode
AT ROW 3.5 COL 10.86 COLON-ALIGNED
116 fil_Account
AT ROW 3.5 COL 22.29 COLON-ALIGNED NO-LABEL
117 BankAccount.BankName
AT ROW 5 COL 10.86 COLON-ALIGNED
121 BankAccount.BankBranchName
AT ROW 6 COL 10.86 COLON-ALIGNED
125 BankAccount.AccountName
AT ROW 7.5 COL 12.86 NO-LABEL
126 VIEW-AS EDITOR NO-WORD-WRAP
129 BankAccount.BankAccount
AT ROW 10 COL 10.86 COLON-ALIGNED
130 LABEL "Account No" FORMAT "99-9999-9999999-999"
133 BankAccount.ChequeAccount
AT ROW 10.05 COL 51.72
136 RECT-2
AT ROW 1 COL 1
137 "Account Name:" VIEW-AS TEXT
138 SIZE 10.86 BY 1 AT ROW 7.5 COL 1.86
140 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
141 SIDE-LABELS NO-UNDERLINE THREE-D
142 AT COL 1 ROW 1 SCROLLABLE
146 /* *********************** Procedure Settings
************************ */
148 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
149 /* Settings for
THIS-PROCEDURE
151 External Tables
: TTPL.BankAccount
152 Allow
: Basic
,DB-Fields
154 Add Fields to
: EXTERNAL-TABLES
155 Other Settings
: PERSISTENT-ONLY
COMPILE
158 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
159 /* then cleanup and return.
*/
160 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
161 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
162 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
166 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
168 /* ************************* Create Window
************************** */
170 &ANALYZE-SUSPEND _CREATE-WINDOW
171 /* DESIGN Window definition
(used by the UIB
)
172 CREATE WINDOW V-table-Win
ASSIGN
175 /* END WINDOW DEFINITION
*/
180 /* *************** Runtime Attributes and UIB Settings
************** */
182 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
183 /* SETTINGS
FOR WINDOW V-table-Win
184 VISIBLE,,RUN-PERSISTENT
*/
185 /* SETTINGS
FOR FRAME F-Main
186 NOT-VISIBLE Size-to-Fit
*/
188 FRAME F-Main
:SCROLLABLE = FALSE
189 FRAME F-Main
:HIDDEN = TRUE.
191 /* SETTINGS
FOR EDITOR BankAccount.AccountName
IN FRAME F-Main
193 /* SETTINGS
FOR FILL-IN BankAccount.BankAccount
IN FRAME F-Main
194 EXP-LABEL EXP-FORMAT
*/
195 /* SETTINGS
FOR FILL-IN BankAccount.BankAccountCode
IN FRAME F-Main
197 /* SETTINGS
FOR FILL-IN fil_Account
IN FRAME F-Main
199 /* SETTINGS
FOR FILL-IN fil_Company
IN FRAME F-Main
200 NO-ENABLE DEF-LABEL
*/
201 /* _RUN-TIME-ATTRIBUTES-END
*/
205 /* Setting information for Queries and Browse Widgets fields
*/
207 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
208 /* Query rebuild information for
FRAME F-Main
211 */ /* FRAME F-Main
*/
217 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
218 /* ************************* Included-Libraries
*********************** */
220 {src
/adm
/method
/viewer.i
}
221 {inc
/method
/m-mntvwr.i
}
223 /* _UIB-CODE-BLOCK-END
*/
229 /* ************************ Control Triggers
************************ */
231 &Scoped-define SELF-NAME BankAccount.AccountCode
232 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL BankAccount.AccountCode V-table-Win
233 ON LEAVE OF BankAccount.AccountCode
IN FRAME F-Main
/* GL Account
*/
235 {inc
/selcde
/cdcoa.i
"fil_Account"}
238 /* _UIB-CODE-BLOCK-END
*/
242 &Scoped-define SELF-NAME BankAccount.CompanyCode
243 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL BankAccount.CompanyCode V-table-Win
244 ON LEAVE OF BankAccount.CompanyCode
IN FRAME F-Main
/* Company
*/
246 {inc
/selcde
/cdcmp.i
"fil_Company"}
249 /* _UIB-CODE-BLOCK-END
*/
253 &Scoped-define SELF-NAME fil_Account
254 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Account V-table-Win
255 ON U1
OF fil_Account
IN FRAME F-Main
257 {inc
/selfil
/sfcoa1.i
"BankAccount" "AccountCode"}
260 /* _UIB-CODE-BLOCK-END
*/
264 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Account V-table-Win
265 ON U2
OF fil_Account
IN FRAME F-Main
267 {inc
/selfil
/sfcoa2.i
"BankAccount" "AccountCode"}
270 /* _UIB-CODE-BLOCK-END
*/
274 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Account V-table-Win
275 ON U3
OF fil_Account
IN FRAME F-Main
277 {inc
/selfil
/sfcoa3.i
"BankAccount" "AccountCode"}
280 /* _UIB-CODE-BLOCK-END
*/
284 &Scoped-define SELF-NAME fil_Company
285 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Company V-table-Win
286 ON U1
OF fil_Company
IN FRAME F-Main
288 {inc
/selfil
/sfcmp1.i
"BankAccount" "CompanyCode"}
291 /* _UIB-CODE-BLOCK-END
*/
295 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Company V-table-Win
296 ON U2
OF fil_Company
IN FRAME F-Main
298 {inc
/selfil
/sfcmp2.i
"BankAccount" "CompanyCode"}
301 /* _UIB-CODE-BLOCK-END
*/
305 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Company V-table-Win
306 ON U3
OF fil_Company
IN FRAME F-Main
308 {inc
/selfil
/sfcmp3.i
"BankAccount" "CompanyCode"}
311 /* _UIB-CODE-BLOCK-END
*/
317 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
320 /* *************************** Main Block
*************************** */
323 BankAccount.BankAccount
:FORMAT = bank-format.
325 /* _UIB-CODE-BLOCK-END
*/
329 /* ********************** Internal Procedures
*********************** */
331 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win _ADM-ROW-AVAILABLE
332 PROCEDURE adm-row-available
:
333 /*------------------------------------------------------------------------------
334 Purpose
: Dispatched to this procedure when the Record-
335 Source has a new row available. This procedure
336 tries to get the new row
(or foriegn keys
) from
337 the Record-Source and process it.
339 ------------------------------------------------------------------------------*/
341 /* Define variables needed by this internal procedure.
*/
342 {src
/adm
/template
/row-head.i
}
344 /* Create a list of all the tables that we need to get.
*/
345 {src
/adm
/template
/row-list.i
"BankAccount"}
347 /* Get the record
ROWID's from the RECORD-SOURCE.
*/
348 {src
/adm
/template
/row-get.i
}
350 /* FIND each record specified by the RECORD-SOURCE.
*/
351 {src
/adm
/template
/row-find.i
"BankAccount"}
353 /* Process the newly available records
(i.e. display fields
,
354 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
355 {src
/adm
/template
/row-end.i
}
359 /* _UIB-CODE-BLOCK-END
*/
363 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE cancel-changes V-table-Win
364 PROCEDURE cancel-changes
:
365 /*------------------------------------------------------------------------------
369 ------------------------------------------------------------------------------*/
371 RUN notify
( 'hide
, CONTAINER-SOURCE'
:U
).
372 IF mode
= "Add" THEN RUN delete-bank-account.
373 RUN check-modified
( "CLEAR" ).
374 RUN dispatch
( 'exit'
:U
).
378 /* _UIB-CODE-BLOCK-END
*/
382 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE confirm-changes V-table-Win
383 PROCEDURE confirm-changes
:
384 /*------------------------------------------------------------------------------
388 ------------------------------------------------------------------------------*/
390 RUN notify
( 'hide
, CONTAINER-SOURCE'
:U
).
391 IF mode
= "Add" THEN RUN notify
( 'open-query
,record-source'
:U
).
392 RUN dispatch
( 'update-record'
:U
).
393 RUN dispatch
( 'exit'
:U
).
397 /* _UIB-CODE-BLOCK-END
*/
401 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE delete-bank-account V-table-Win
402 PROCEDURE delete-bank-account
:
403 /*------------------------------------------------------------------------------
407 ------------------------------------------------------------------------------*/
409 FIND CURRENT BankAccount
EXCLUSIVE-LOCK.
414 /* _UIB-CODE-BLOCK-END
*/
418 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
419 PROCEDURE disable_UI
:
420 /*------------------------------------------------------------------------------
421 Purpose
: DISABLE the User Interface
423 Notes
: Here we clean-up the user-interface by deleting
424 dynamic widgets we have created and
/or hide
425 frames. This procedure is usually called when
426 we are ready to
"clean-up" after running.
427 ------------------------------------------------------------------------------*/
428 /* Hide all frames.
*/
430 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
433 /* _UIB-CODE-BLOCK-END
*/
437 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
438 PROCEDURE inst-initialize
:
439 /*------------------------------------------------------------------------------
443 ------------------------------------------------------------------------------*/
445 RUN get-attribute
( 'mode'
:U
).
451 RUN dispatch
( 'add-record'
:U
).
453 ELSE RUN dispatch
( 'enable-fields'
:U
).
457 /* _UIB-CODE-BLOCK-END
*/
461 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE override-add-record V-table-Win
462 PROCEDURE override-add-record
:
463 /*------------------------------------------------------------------------------
467 ------------------------------------------------------------------------------*/
470 ASSIGN BankAccount.BankAccount
= FILL( "0", 16 ).
471 RUN dispatch
( 'display-fields'
:U
).
472 RUN dispatch
( 'enable-fields'
:U
).
473 RUN dispatch
( 'update-record'
:U
).
475 CURRENT-WINDOW:TITLE = "Adding a new Bank Account".
479 /* _UIB-CODE-BLOCK-END
*/
483 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
484 PROCEDURE pre-destroy
:
485 /*------------------------------------------------------------------------------
487 ------------------------------------------------------------------------------*/
489 IF LAST-EVENT:FUNCTION = 'WINDOW-CLOSE'
:U
THEN RUN cancel-changes.
493 /* _UIB-CODE-BLOCK-END
*/
497 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win _ADM-SEND-RECORDS
498 PROCEDURE send-records
:
499 /*------------------------------------------------------------------------------
500 Purpose
: Send record
ROWID's for all tables used by
502 Parameters
: see template
/snd-head.i
503 ------------------------------------------------------------------------------*/
505 /* Define variables needed by this internal procedure.
*/
506 {src
/adm
/template
/snd-head.i
}
508 /* For each requested table
, put it's
ROWID in the output list.
*/
509 {src
/adm
/template
/snd-list.i
"BankAccount"}
511 /* Deal with any unexpected table requests before closing.
*/
512 {src
/adm
/template
/snd-end.i
}
516 /* _UIB-CODE-BLOCK-END
*/
520 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
521 PROCEDURE state-changed
:
522 /* -----------------------------------------------------------
526 -------------------------------------------------------------*/
527 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
528 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
531 /* Object instance CASEs can go here to replace standard behavior
533 {src
/adm
/template
/vstates.i
}
537 /* _UIB-CODE-BLOCK-END
*/
541 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-mode V-table-Win
543 /*------------------------------------------------------------------------------
545 ------------------------------------------------------------------------------*/
546 DEF INPUT PARAMETER new-mode
AS CHAR NO-UNDO.
550 /* _UIB-CODE-BLOCK-END
*/