1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI
3 &Scoped-define WINDOW-NAME CURRENT-WINDOW
4 &Scoped-define FRAME-NAME Dialog-Frame
5 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Dialog-Frame
6 /*------------------------------------------------------------------------
10 Description
: Dialog to assign project
/order for matching vouchers to orders.
18 Author
: Andrew McMillan
21 ------------------------------------------------------------------------*/
23 DEF INPUT PARAMETER vchrseq
AS INT NO-UNDO.
25 RUN initialize-values.
26 IF RETURN-VALUE= "FAIL" THEN RETURN.
28 /* _UIB-CODE-BLOCK-END
*/
32 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
34 /* ******************** Preprocessor Definitions
******************** */
36 &Scoped-define PROCEDURE-TYPE DIALOG-BOX
37 &Scoped-define DB-AWARE no
39 /* Name of first Frame and
/or Browse and
/or first Query
*/
40 &Scoped-define FRAME-NAME Dialog-Frame
42 /* Standard List Definitions
*/
43 &Scoped-Define ENABLED-OBJECTS fil_EntityType fil_EntityCode fil_OrderCode ~
44 fil_OrderDescription Btn_OK Btn_Cancel RECT-30
45 &Scoped-Define DISPLAYED-OBJECTS fil_EntityType fil_TypeName fil_EntityCode ~
46 fil_EntityName fil_OrderCode fil_OrderDescription
48 /* Custom List Definitions
*/
49 /* List-1
,List-2
,List-3
,List-4
,List-5
,List-6
*/
51 /* _UIB-PREPROCESSOR-BLOCK-END
*/
56 /* *********************** Control Definitions
********************** */
58 /* Define a dialog box
*/
60 /* Definitions of the field level widgets
*/
61 DEFINE BUTTON Btn_Cancel
AUTO-END-KEY
66 DEFINE BUTTON Btn_OK
AUTO-GO
71 DEFINE VARIABLE fil_OrderDescription
AS CHARACTER
72 VIEW-AS EDITOR NO-WORD-WRAP
74 BGCOLOR 16 FGCOLOR 0 NO-UNDO.
76 DEFINE VARIABLE fil_EntityCode
AS INTEGER FORMAT ">>>>9" INITIAL 0
81 DEFINE VARIABLE fil_EntityName
AS CHARACTER FORMAT "X(256)":U
83 SIZE 49.72 BY 1 NO-UNDO.
85 DEFINE VARIABLE fil_EntityType
AS CHARACTER FORMAT "X(256)":U
88 SIZE 3 BY 1.05 NO-UNDO.
90 DEFINE VARIABLE fil_OrderCode
AS INTEGER FORMAT ">>9" INITIAL 0
95 DEFINE VARIABLE fil_TypeName
AS CHARACTER FORMAT "X(256)":U
97 SIZE 30 BY 1.05 NO-UNDO.
99 DEFINE RECTANGLE RECT-30
100 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
104 /* ************************ Frame Definitions
*********************** */
106 DEFINE FRAME Dialog-Frame
107 fil_EntityType
AT ROW 1.25 COL 7 COLON-ALIGNED
108 fil_TypeName
AT ROW 1.25 COL 13 COLON-ALIGNED NO-LABEL
109 fil_EntityCode
AT ROW 2.5 COL 7 COLON-ALIGNED
110 fil_EntityName
AT ROW 2.5 COL 12.72 COLON-ALIGNED NO-LABEL
111 fil_OrderCode
AT ROW 3.8 COL 7 COLON-ALIGNED
112 fil_OrderDescription
AT ROW 3.8 COL 14.72 NO-LABEL
113 Btn_OK
AT ROW 8.25 COL 1
114 Btn_Cancel
AT ROW 8.25 COL 10.72
115 RECT-30
AT ROW 1.1 COL 1.29
116 SPACE(2.70) SKIP(1.99)
117 WITH VIEW-AS DIALOG-BOX KEEP-TAB-ORDER
118 SIDE-LABELS NO-UNDERLINE THREE-D SCROLLABLE
120 TITLE "Select Project / Order for matching"
121 DEFAULT-BUTTON Btn_OK
CANCEL-BUTTON Btn_Cancel.
124 /* *********************** Procedure Settings
************************ */
126 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
127 /* Settings for
THIS-PROCEDURE
129 Allow
: Basic
,Browse
,DB-Fields
,Query
130 Other Settings
: COMPILE
132 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
134 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Dialog-Frame
135 /* ************************* Included-Libraries
*********************** */
139 /* _UIB-CODE-BLOCK-END
*/
145 /* *********** Runtime Attributes and AppBuilder Settings
*********** */
147 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
148 /* SETTINGS
FOR DIALOG-BOX Dialog-Frame
151 FRAME Dialog-Frame
:SCROLLABLE = FALSE
152 FRAME Dialog-Frame
:HIDDEN = TRUE.
154 /* SETTINGS
FOR FILL-IN fil_EntityName
IN FRAME Dialog-Frame
157 fil_OrderDescription
:READ-ONLY IN FRAME Dialog-Frame
= TRUE.
159 /* SETTINGS
FOR FILL-IN fil_TypeName
IN FRAME Dialog-Frame
161 /* _RUN-TIME-ATTRIBUTES-END
*/
168 /* ************************ Control Triggers
************************ */
170 &Scoped-define SELF-NAME Dialog-Frame
171 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Dialog-Frame Dialog-Frame
172 ON WINDOW-CLOSE
OF FRAME Dialog-Frame
/* Select Project
/ Order for matching
*/
174 APPLY "END-ERROR":U
TO SELF.
177 /* _UIB-CODE-BLOCK-END
*/
181 &Scoped-define SELF-NAME Btn_OK
182 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL Btn_OK Dialog-Frame
183 ON CHOOSE OF Btn_OK
IN FRAME Dialog-Frame
/* OK */
185 RUN save-current-values.
188 /* _UIB-CODE-BLOCK-END
*/
192 &Scoped-define SELF-NAME fil_EntityCode
193 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_EntityCode Dialog-Frame
194 ON LEAVE OF fil_EntityCode
IN FRAME Dialog-Frame
/* Entity
*/
199 /* _UIB-CODE-BLOCK-END
*/
203 &Scoped-define SELF-NAME fil_EntityType
204 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_EntityType Dialog-Frame
205 ON LEAVE OF fil_EntityType
IN FRAME Dialog-Frame
/* Type
*/
210 /* _UIB-CODE-BLOCK-END
*/
214 &Scoped-define SELF-NAME fil_OrderCode
215 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_OrderCode Dialog-Frame
216 ON LEAVE OF fil_OrderCode
IN FRAME Dialog-Frame
/* Order
*/
221 /* _UIB-CODE-BLOCK-END
*/
227 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Dialog-Frame
230 /* *************************** Main Block
*************************** */
232 /* Parent the dialog-box to the
ACTIVE-WINDOW, if there is no parent.
*/
233 IF VALID-HANDLE(ACTIVE-WINDOW) AND FRAME {&FRAME-NAME}:PARENT eq ?
234 THEN FRAME {&FRAME-NAME}:PARENT = ACTIVE-WINDOW.
237 /* Now enable the interface and wait for the exit condition.
*/
238 /* (NOTE
: handle
ERROR and
END-KEY so cleanup code will always fire.
*/
240 DO ON ERROR UNDO MAIN-BLOCK
, LEAVE MAIN-BLOCK
241 ON END-KEY UNDO MAIN-BLOCK
, LEAVE MAIN-BLOCK
:
243 WAIT-FOR GO
OF FRAME {&FRAME-NAME}.
247 /* _UIB-CODE-BLOCK-END
*/
251 /* ********************** Internal Procedures
*********************** */
253 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI Dialog-Frame _DEFAULT-DISABLE
254 PROCEDURE disable_UI
:
255 /*------------------------------------------------------------------------------
256 Purpose
: DISABLE the User Interface
258 Notes
: Here we clean-up the user-interface by deleting
259 dynamic widgets we have created and
/or hide
260 frames. This procedure is usually called when
261 we are ready to
"clean-up" after running.
262 ------------------------------------------------------------------------------*/
263 /* Hide all frames.
*/
264 HIDE FRAME Dialog-Frame.
267 /* _UIB-CODE-BLOCK-END
*/
270 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI Dialog-Frame _DEFAULT-ENABLE
271 PROCEDURE enable_UI
:
272 /*------------------------------------------------------------------------------
273 Purpose
: ENABLE the User Interface
275 Notes
: Here we display
/view
/enable the widgets in the
276 user-interface. In addition
, OPEN all queries
277 associated with each
FRAME and
BROWSE.
278 These statements here are based on the
"Other
279 Settings" section of the widget Property Sheets.
280 ------------------------------------------------------------------------------*/
281 DISPLAY fil_EntityType fil_TypeName fil_EntityCode fil_EntityName
282 fil_OrderCode fil_OrderDescription
283 WITH FRAME Dialog-Frame.
284 ENABLE fil_EntityType fil_EntityCode fil_OrderCode fil_OrderDescription
285 Btn_OK Btn_Cancel RECT-30
286 WITH FRAME Dialog-Frame.
287 VIEW FRAME Dialog-Frame.
288 {&OPEN-BROWSERS-IN-QUERY-Dialog-Frame}
291 /* _UIB-CODE-BLOCK-END
*/
294 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE entity-changed Dialog-Frame
295 PROCEDURE entity-changed
:
296 /*------------------------------------------------------------------------------
298 ------------------------------------------------------------------------------*/
299 DO WITH FRAME {&FRAME-NAME}:
300 fil_EntityName
= get-entity-name
( INPUT fil_EntityType
, INPUT fil_EntityCode
).
301 fil_EntityName
:SCREEN-VALUE = fil_EntityName .
306 /* _UIB-CODE-BLOCK-END
*/
309 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE initialize-values Dialog-Frame
310 PROCEDURE initialize-values
:
311 /*------------------------------------------------------------------------------
313 ------------------------------------------------------------------------------*/
314 FIND Voucher
NO-LOCK WHERE VoucherSeq
= vchrseq
NO-ERROR.
315 IF NOT AVAILABLE(Voucher
) THEN RETURN "FAIL".
317 DO WITH FRAME {&FRAME-NAME}:
318 fil_EntityType
= Voucher.EntityType.
319 fil_EntityCode
= Voucher.EntityCode.
320 fil_OrderCode
= Voucher.OrderCode.
321 DISPLAY fil_OrderCode fil_EntityCode fil_EntityType.
326 /* _UIB-CODE-BLOCK-END
*/
329 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE order-changed Dialog-Frame
330 PROCEDURE order-changed
:
331 /*------------------------------------------------------------------------------
333 ------------------------------------------------------------------------------*/
334 DO WITH FRAME {&FRAME-NAME}:
335 FIND FIRST Order
WHERE Order.EntityType
= INPUT fil_EntityType
336 AND Order.EntityCode
= INPUT fil_EntityCode
337 AND Order.OrderCode
= INPUT fil_OrderCode
339 IF AVAILABLE(Order
) THEN
340 fil_OrderDescription
= Order.Description .
342 fil_OrderDescription
= "".
343 fil_OrderDescription
:SCREEN-VALUE = fil_OrderDescription .
344 fil_OrderDescription
:FGCOLOR = ?.
345 fil_OrderDescription
:BGCOLOR = ?.
349 /* _UIB-CODE-BLOCK-END
*/
352 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE save-current-values Dialog-Frame
353 PROCEDURE save-current-values
:
354 /*------------------------------------------------------------------------------
356 ------------------------------------------------------------------------------*/
357 DO WITH FRAME {&FRAME-NAME}:
358 FIND Voucher
NO-LOCK WHERE VoucherSeq
= vchrseq
NO-ERROR.
359 FIND FIRST Order
WHERE Order.EntityType
= INPUT fil_EntityType
360 AND Order.EntityCode
= INPUT fil_EntityCode
361 AND Order.OrderCode
= INPUT fil_OrderCode
363 IF AVAILABLE(Order
) AND AVAILABLE(Voucher
) THEN DO:
364 FIND CURRENT Voucher
EXCLUSIVE-LOCK NO-ERROR.
365 IF INPUT fil_EntityType
= "J" THEN Voucher.ProjectCode
= INPUT fil_EntityCode.
366 Voucher.EntityType
= INPUT fil_EntityType.
367 Voucher.EntityCode
= INPUT fil_EntityCode.
368 Voucher.OrderCode
= INPUT fil_OrderCode.
371 MESSAGE "Not assigned - no such order" INPUT fil_EntityType
372 + STRING(INPUT fil_EntityCode
) + "/" + (INPUT fil_OrderCode
)
373 VIEW-AS ALERT-BOX WARNING.
378 /* _UIB-CODE-BLOCK-END
*/
381 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE type-changed Dialog-Frame
382 PROCEDURE type-changed
:
383 /*------------------------------------------------------------------------------
385 ------------------------------------------------------------------------------*/
386 DO WITH FRAME {&FRAME-NAME}:
387 fil_TypeName
= get-entity-type-name
( INPUT fil_EntityType
) .
388 fil_TypeName
:SCREEN-VALUE = fil_TypeName .
393 /* _UIB-CODE-BLOCK-END
*/