Added capital works blank section. Synced calling screen.
[capital-apms-progress.git] / vwr / mnt / d-voucher-match.w
blob07c4fd1ea47dedbe49bf9edc46ea6b7582601651
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI
2 &ANALYZE-RESUME
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 /*------------------------------------------------------------------------
8 File:
10 Description: Dialog to assign project/order for matching vouchers to orders.
12 Input Parameters:
13 <none>
15 Output Parameters:
16 <none>
18 Author: Andrew McMillan
20 Created: 3 Feb 2000
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 */
29 &ANALYZE-RESUME
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 */
52 &ANALYZE-RESUME
56 /* *********************** Control Definitions ********************** */
58 /* Define a dialog box */
60 /* Definitions of the field level widgets */
61 DEFINE BUTTON Btn_Cancel AUTO-END-KEY
62 LABEL "Cancel"
63 SIZE 9.43 BY 1.15
64 BGCOLOR 8 .
66 DEFINE BUTTON Btn_OK AUTO-GO
67 LABEL "OK"
68 SIZE 9.14 BY 1.15
69 BGCOLOR 8 .
71 DEFINE VARIABLE fil_OrderDescription AS CHARACTER
72 VIEW-AS EDITOR NO-WORD-WRAP
73 SIZE 49.72 BY 3.9
74 BGCOLOR 16 FGCOLOR 0 NO-UNDO.
76 DEFINE VARIABLE fil_EntityCode AS INTEGER FORMAT ">>>>9" INITIAL 0
77 LABEL "Entity"
78 VIEW-AS FILL-IN
79 SIZE 5.72 BY 1.
81 DEFINE VARIABLE fil_EntityName AS CHARACTER FORMAT "X(256)":U
82 VIEW-AS FILL-IN
83 SIZE 49.72 BY 1 NO-UNDO.
85 DEFINE VARIABLE fil_EntityType AS CHARACTER FORMAT "X(256)":U
86 LABEL "Type"
87 VIEW-AS FILL-IN
88 SIZE 3 BY 1.05 NO-UNDO.
90 DEFINE VARIABLE fil_OrderCode AS INTEGER FORMAT ">>9" INITIAL 0
91 LABEL "Order"
92 VIEW-AS FILL-IN
93 SIZE 5.72 BY 1.
95 DEFINE VARIABLE fil_TypeName AS CHARACTER FORMAT "X(256)":U
96 VIEW-AS FILL-IN
97 SIZE 30 BY 1.05 NO-UNDO.
99 DEFINE RECTANGLE RECT-30
100 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
101 SIZE 63.43 BY 6.9.
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
119 FONT 9
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
128 Type: DIALOG-BOX
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 *********************** */
137 {inc/entity.i}
139 /* _UIB-CODE-BLOCK-END */
140 &ANALYZE-RESUME
145 /* *********** Runtime Attributes and AppBuilder Settings *********** */
147 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
148 /* SETTINGS FOR DIALOG-BOX Dialog-Frame
150 ASSIGN
151 FRAME Dialog-Frame:SCROLLABLE = FALSE
152 FRAME Dialog-Frame:HIDDEN = TRUE.
154 /* SETTINGS FOR FILL-IN fil_EntityName IN FRAME Dialog-Frame
155 NO-ENABLE */
156 ASSIGN
157 fil_OrderDescription:READ-ONLY IN FRAME Dialog-Frame = TRUE.
159 /* SETTINGS FOR FILL-IN fil_TypeName IN FRAME Dialog-Frame
160 NO-ENABLE */
161 /* _RUN-TIME-ATTRIBUTES-END */
162 &ANALYZE-RESUME
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.
175 END.
177 /* _UIB-CODE-BLOCK-END */
178 &ANALYZE-RESUME
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.
186 END.
188 /* _UIB-CODE-BLOCK-END */
189 &ANALYZE-RESUME
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 */
196 RUN entity-changed.
197 END.
199 /* _UIB-CODE-BLOCK-END */
200 &ANALYZE-RESUME
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 */
207 RUN type-changed.
208 END.
210 /* _UIB-CODE-BLOCK-END */
211 &ANALYZE-RESUME
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 */
218 RUN order-changed.
219 END.
221 /* _UIB-CODE-BLOCK-END */
222 &ANALYZE-RESUME
225 &UNDEFINE SELF-NAME
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. */
239 MAIN-BLOCK:
240 DO ON ERROR UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
241 ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:
242 RUN enable_UI.
243 WAIT-FOR GO OF FRAME {&FRAME-NAME}.
244 END.
245 RUN disable_UI.
247 /* _UIB-CODE-BLOCK-END */
248 &ANALYZE-RESUME
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
257 Parameters: <none>
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.
265 END PROCEDURE.
267 /* _UIB-CODE-BLOCK-END */
268 &ANALYZE-RESUME
270 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI Dialog-Frame _DEFAULT-ENABLE
271 PROCEDURE enable_UI :
272 /*------------------------------------------------------------------------------
273 Purpose: ENABLE the User Interface
274 Parameters: <none>
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}
289 END PROCEDURE.
291 /* _UIB-CODE-BLOCK-END */
292 &ANALYZE-RESUME
294 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE entity-changed Dialog-Frame
295 PROCEDURE entity-changed :
296 /*------------------------------------------------------------------------------
297 Purpose:
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 .
302 END.
303 RUN order-changed.
304 END PROCEDURE.
306 /* _UIB-CODE-BLOCK-END */
307 &ANALYZE-RESUME
309 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE initialize-values Dialog-Frame
310 PROCEDURE initialize-values :
311 /*------------------------------------------------------------------------------
312 Purpose:
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.
322 RUN type-changed.
323 END.
324 END PROCEDURE.
326 /* _UIB-CODE-BLOCK-END */
327 &ANALYZE-RESUME
329 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE order-changed Dialog-Frame
330 PROCEDURE order-changed :
331 /*------------------------------------------------------------------------------
332 Purpose:
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
338 NO-LOCK NO-ERROR.
339 IF AVAILABLE(Order) THEN
340 fil_OrderDescription = Order.Description .
341 ELSE
342 fil_OrderDescription = "".
343 fil_OrderDescription:SCREEN-VALUE = fil_OrderDescription .
344 fil_OrderDescription:FGCOLOR = ?.
345 fil_OrderDescription:BGCOLOR = ?.
346 END.
347 END PROCEDURE.
349 /* _UIB-CODE-BLOCK-END */
350 &ANALYZE-RESUME
352 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE save-current-values Dialog-Frame
353 PROCEDURE save-current-values :
354 /*------------------------------------------------------------------------------
355 Purpose:
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
362 NO-LOCK NO-ERROR.
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.
369 END.
370 ELSE DO:
371 MESSAGE "Not assigned - no such order" INPUT fil_EntityType
372 + STRING(INPUT fil_EntityCode) + "/" + (INPUT fil_OrderCode)
373 VIEW-AS ALERT-BOX WARNING.
374 END.
375 END.
376 END PROCEDURE.
378 /* _UIB-CODE-BLOCK-END */
379 &ANALYZE-RESUME
381 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE type-changed Dialog-Frame
382 PROCEDURE type-changed :
383 /*------------------------------------------------------------------------------
384 Purpose:
385 ------------------------------------------------------------------------------*/
386 DO WITH FRAME {&FRAME-NAME}:
387 fil_TypeName = get-entity-type-name( INPUT fil_EntityType ) .
388 fil_TypeName:SCREEN-VALUE = fil_TypeName .
389 END.
390 RUN entity-changed.
391 END PROCEDURE.
393 /* _UIB-CODE-BLOCK-END */
394 &ANALYZE-RESUME