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 /*------------------------------------------------------------------------
10 Description
: Kick of transaction update
11 ------------------------------------------------------------------------*/
13 /* *************************** Definitions
************************** */
15 DEFINE TEMP-TABLE Update-Month
NO-UNDO
16 FIELD TrnCount
AS INTEGER FORMAT ">>,>>9" COLUMN-LABEL "# Lines"
17 FIELD Closed
AS CHAR FORMAT "X(6)" COLUMN-LABEL "Status"
18 FIELD MonthName
AS CHAR FORMAT "X(3)" COLUMN-LABEL "Mth"
19 FIELD Year
AS INT FORMAT "9999" COLUMN-LABEL "Year"
20 FIELD MonthCode
LIKE Month.MonthCode
21 FIELD ActualMonth
AS CHAR FORMAT "X(8)" COLUMN-LABEL "Post to"
22 FIELD MonthValue
AS DEC FORMAT "->>,>>>,>>9.99" COLUMN-LABEL "Month Total"
23 INDEX XPKUpdate-Month
IS UNIQUE PRIMARY MonthCode Closed .
26 {inc
/ofc-set-l.i
"Fail-Unbalanced-Update" "fail-unbalanced-update"}
28 DEF VAR force-month
AS INT NO-UNDO.
31 /* _UIB-CODE-BLOCK-END
*/
35 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
37 /* ******************** Preprocessor Definitions
******************** */
39 &Scoped-define PROCEDURE-TYPE SmartViewer
41 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
43 /* Name of first Frame and
/or Browse and
/or first Query
*/
44 &Scoped-define FRAME-NAME F-Main
45 &Scoped-define BROWSE-NAME br-UpdateMonths
48 &Scoped-define EXTERNAL-TABLES NewBatch
49 &Scoped-define FIRST-EXTERNAL-TABLE NewBatch
52 /* Need to scope the external tables to this procedure
*/
53 DEFINE QUERY external_tables
FOR NewBatch.
54 /* Internal Tables
(found by Frame
, Query
& Browse Queries) */
55 &Scoped-define INTERNAL-TABLES Update-Month
57 /* Definitions for
BROWSE br-UpdateMonths
*/
58 &Scoped-define FIELDS-IN-QUERY-br-UpdateMonths MonthName Year Closed TrnCount ActualMonth MonthValue
59 &Scoped-define ENABLED-FIELDS-IN-QUERY-br-UpdateMonths
60 &Scoped-define FIELD-PAIRS-IN-QUERY-br-UpdateMonths
61 &Scoped-define SELF-NAME br-UpdateMonths
62 &Scoped-define OPEN-QUERY-br-UpdateMonths OPEN QUERY {&SELF-NAME} FOR EACH Update-Month BY Update-Month.MonthCode .
63 &Scoped-define TABLES-IN-QUERY-br-UpdateMonths Update-Month
64 &Scoped-define FIRST-TABLE-IN-QUERY-br-UpdateMonths Update-Month
67 /* Definitions for
FRAME F-Main
*/
68 &Scoped-define OPEN-BROWSERS-IN-QUERY-F-Main ~
69 ~
{&OPEN-QUERY-br-UpdateMonths}
71 /* Standard List Definitions
*/
72 &Scoped-Define ENABLED-OBJECTS RECT-13 br-UpdateMonths ~
73 tgl_ReverseNextPeriod btn_update cmb_ForceMonth tgl_ForceMonth
74 &Scoped-Define DISPLAYED-FIELDS NewBatch.Description NewBatch.BatchType ~
75 NewBatch.DocumentCount NewBatch.Total
76 &Scoped-Define DISPLAYED-OBJECTS fil_Operator tgl_ReverseNextPeriod ~
77 cmb_ForceMonth tgl_ForceMonth
79 /* Custom List Definitions
*/
80 /* ADM-CREATE-FIELDS
,ADM-ASSIGN-FIELDS
,List-3
,List-4
,List-5
,List-6
*/
82 /* _UIB-PREPROCESSOR-BLOCK-END
*/
87 /* *********************** Control Definitions
********************** */
90 /* Definitions of the field level widgets
*/
91 DEFINE BUTTON btn_update
DEFAULT
96 DEFINE VARIABLE cmb_ForceMonth
AS CHARACTER FORMAT "X(256)":U
98 VIEW-AS COMBO-BOX INNER-LINES 10
100 SIZE 17.43 BY 1.05 NO-UNDO.
102 DEFINE VARIABLE fil_Operator
AS CHARACTER FORMAT "X(256)":U
108 DEFINE RECTANGLE RECT-13
109 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
112 DEFINE VARIABLE tgl_ForceMonth
AS LOGICAL INITIAL no
115 SIZE 2.29 BY .8 NO-UNDO.
117 DEFINE VARIABLE tgl_ReverseNextPeriod
AS LOGICAL INITIAL no
118 LABEL "Reversing Journal"
120 SIZE 16.57 BY 1.3 NO-UNDO.
122 /* Query definitions
*/
124 DEFINE QUERY br-UpdateMonths
FOR
125 Update-Month
SCROLLING.
128 /* Browse definitions
*/
129 DEFINE BROWSE br-UpdateMonths
130 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _DISPLAY-FIELDS br-UpdateMonths V-table-Win _FREEFORM
131 QUERY br-UpdateMonths
DISPLAY
138 /* _UIB-CODE-BLOCK-END
*/
140 WITH NO-ROW-MARKERS SEPARATORS SIZE 49.43 BY 6.9
144 /* ************************ Frame Definitions
*********************** */
147 NewBatch.Description
AT ROW 1.4 COL 12.72 COLON-ALIGNED
152 fil_Operator
AT ROW 3 COL 12.72 COLON-ALIGNED
153 NewBatch.BatchType
AT ROW 4.2 COL 12.72 COLON-ALIGNED
157 NewBatch.DocumentCount
AT ROW 4.2 COL 29.86 COLON-ALIGNED
162 NewBatch.Total
AT ROW 4.2 COL 48.72 COLON-ALIGNED FORMAT "-ZZZ,ZZZ,ZZ9.99"
166 br-UpdateMonths
AT ROW 5.6 COL 14.72
167 tgl_ReverseNextPeriod
AT ROW 12.5 COL 15
168 btn_update
AT ROW 13.7 COL 48.14
169 cmb_ForceMonth
AT ROW 13.9 COL 17.43
170 tgl_ForceMonth
AT ROW 14 COL 15
171 RECT-13
AT ROW 1 COL 1
172 "Force posting to:" VIEW-AS TEXT
173 SIZE 11.72 BY 1 AT ROW 13.9 COL 3
174 "Update Months:" VIEW-AS TEXT
175 SIZE 11.43 BY 1 AT ROW 5.6 COL 3.29
177 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
178 SIDE-LABELS NO-UNDERLINE THREE-D
179 AT COL 1 ROW 1 SCROLLABLE
181 DEFAULT-BUTTON btn_update.
184 /* *********************** Procedure Settings
************************ */
186 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
187 /* Settings for
THIS-PROCEDURE
189 External Tables
: ttpl.NewBatch
190 Allow
: Basic
,DB-Fields
192 Add Fields to
: EXTERNAL-TABLES
193 Other Settings
: PERSISTENT-ONLY
COMPILE
196 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
197 /* then cleanup and return.
*/
198 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
199 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
200 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
204 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
206 /* ************************* Create Window
************************** */
208 &ANALYZE-SUSPEND _CREATE-WINDOW
209 /* DESIGN Window definition
(used by the UIB
)
210 CREATE WINDOW V-table-Win
ASSIGN
213 /* END WINDOW DEFINITION
*/
218 /* *************** Runtime Attributes and UIB Settings
************** */
220 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
221 /* SETTINGS
FOR WINDOW V-table-Win
222 VISIBLE,,RUN-PERSISTENT
*/
223 /* SETTINGS
FOR FRAME F-Main
224 NOT-VISIBLE Size-to-Fit
*/
225 /* BROWSE-TAB br-UpdateMonths Total F-Main
*/
227 FRAME F-Main
:SCROLLABLE = FALSE
228 FRAME F-Main
:HIDDEN = TRUE.
230 /* SETTINGS
FOR FILL-IN NewBatch.BatchType
IN FRAME F-Main
232 /* SETTINGS
FOR COMBO-BOX cmb_ForceMonth
IN FRAME F-Main
234 /* SETTINGS
FOR FILL-IN NewBatch.Description
IN FRAME F-Main
235 NO-ENABLE EXP-LABEL
*/
236 /* SETTINGS
FOR FILL-IN NewBatch.DocumentCount
IN FRAME F-Main
237 NO-ENABLE EXP-LABEL
*/
238 /* SETTINGS
FOR FILL-IN fil_Operator
IN FRAME F-Main
240 /* SETTINGS
FOR FILL-IN NewBatch.Total
IN FRAME F-Main
241 NO-ENABLE EXP-FORMAT
*/
242 /* _RUN-TIME-ATTRIBUTES-END
*/
246 /* Setting information for Queries and Browse Widgets fields
*/
248 &ANALYZE-SUSPEND _QUERY-BLOCK BROWSE br-UpdateMonths
249 /* Query rebuild information for
BROWSE br-UpdateMonths
251 OPEN QUERY {&SELF-NAME} FOR EACH Update-Month
252 BY Update-Month.MonthCode .
255 */ /* BROWSE br-UpdateMonths
*/
258 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
259 /* Query rebuild information for
FRAME F-Main
262 */ /* FRAME F-Main
*/
268 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
269 /* ************************* Included-Libraries
*********************** */
271 {src
/adm
/method
/viewer.i
}
272 {inc
/method
/m-drlvwr.i
}
274 /* _UIB-CODE-BLOCK-END
*/
280 /* ************************ Control Triggers
************************ */
282 &Scoped-define SELF-NAME btn_update
283 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_update V-table-Win
284 ON CHOOSE OF btn_update
IN FRAME F-Main
/* Update
*/
286 {&SELF-NAME}:SENSITIVE = No.
288 {&SELF-NAME}:SENSITIVE = Yes.
289 RUN dispatch
( 'exit'
:U
).
292 /* _UIB-CODE-BLOCK-END
*/
296 &Scoped-define SELF-NAME cmb_ForceMonth
297 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_ForceMonth V-table-Win
298 ON U1
OF cmb_ForceMonth
IN FRAME F-Main
/* month
*/
300 {inc
/selcmb
/scmthe1.i
"?" "force-month"}
303 /* _UIB-CODE-BLOCK-END
*/
307 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_ForceMonth V-table-Win
308 ON U2
OF cmb_ForceMonth
IN FRAME F-Main
/* month
*/
310 {inc
/selcmb
/scmthe2.i
"?" "force-month"}
313 /* _UIB-CODE-BLOCK-END
*/
317 &Scoped-define SELF-NAME tgl_ForceMonth
318 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL tgl_ForceMonth V-table-Win
319 ON VALUE-CHANGED
OF tgl_ForceMonth
IN FRAME F-Main
321 RUN enable-appropriate-fields.
324 /* _UIB-CODE-BLOCK-END
*/
328 &Scoped-define BROWSE-NAME br-UpdateMonths
331 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
334 /* *************************** Main Block
*************************** */
336 /* _UIB-CODE-BLOCK-END
*/
340 /* ********************** Internal Procedures
*********************** */
342 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win _ADM-ROW-AVAILABLE
343 PROCEDURE adm-row-available
:
344 /*------------------------------------------------------------------------------
345 Purpose
: Dispatched to this procedure when the Record-
346 Source has a new row available. This procedure
347 tries to get the new row
(or foriegn keys
) from
348 the Record-Source and process it.
350 ------------------------------------------------------------------------------*/
352 /* Define variables needed by this internal procedure.
*/
353 {src
/adm
/template
/row-head.i
}
355 /* Create a list of all the tables that we need to get.
*/
356 {src
/adm
/template
/row-list.i
"NewBatch"}
358 /* Get the record
ROWID's from the RECORD-SOURCE.
*/
359 {src
/adm
/template
/row-get.i
}
361 /* FIND each record specified by the RECORD-SOURCE.
*/
362 {src
/adm
/template
/row-find.i
"NewBatch"}
364 /* Process the newly available records
(i.e. display fields
,
365 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
366 {src
/adm
/template
/row-end.i
}
370 /* _UIB-CODE-BLOCK-END
*/
374 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
375 PROCEDURE disable_UI
:
376 /*------------------------------------------------------------------------------
377 Purpose
: DISABLE the User Interface
379 Notes
: Here we clean-up the user-interface by deleting
380 dynamic widgets we have created and
/or hide
381 frames. This procedure is usually called when
382 we are ready to
"clean-up" after running.
383 ------------------------------------------------------------------------------*/
384 /* Hide all frames.
*/
386 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
389 /* _UIB-CODE-BLOCK-END
*/
393 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable-appropriate-fields V-table-Win
394 PROCEDURE enable-appropriate-fields
:
395 /*------------------------------------------------------------------------------
397 ------------------------------------------------------------------------------*/
398 DO WITH FRAME {&FRAME-NAME}:
399 IF INPUT tgl_ForceMonth
THEN
400 ENABLE cmb_ForceMonth.
402 DISABLE cmb_ForceMonth.
406 /* _UIB-CODE-BLOCK-END
*/
410 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE post-row-available V-table-Win
411 PROCEDURE post-row-available
:
412 /*------------------------------------------------------------------------------
413 Purpose
: Set the local batch code to the current row available
414 ------------------------------------------------------------------------------*/
415 DEF VAR month-status
AS CHAR NO-UNDO.
417 DEF BUFFER xx-Month
FOR Month.
419 IF NOT AVAILABLE(NewBatch
) THEN RETURN.
421 DO WITH FRAME {&FRAME-NAME}:
422 APPLY 'U1'
:U
TO cmb_ForceMonth.
423 RUN enable-appropriate-fields.
427 FIND Person
WHERE Person.PersonCode
= NewBatch.PersonCode
NO-LOCK NO-ERROR.
428 IF AVAILABLE(Person
) AND Person.PersonCode
> 0 THEN DO:
429 fil_Operator
= Person.FirstName
+ " " + Person.LastName.
431 WITH FRAME {&FRAME-NAME} IN WINDOW {&WINDOW-NAME}.
434 FOR EACH NewAcctTrans
OF NewBatch
NO-LOCK:
435 IF NewAcctTrans.Date
= ?
OR NewAcctTrans.Date
< DATE(1,1,1990) THEN DO:
436 MESSAGE "Transactions in Batch have bad Date field!"
437 VIEW-AS ALERT-BOX ERROR TITLE "Bad Dates in Batch".
438 RUN notify
( 'exit'
:U
).
441 FIND Month
WHERE Month.MonthCode
= NewAccttrans.MonthCode
NO-LOCK NO-ERROR.
442 IF NOT AVAILABLE(Month
) THEN
443 FIND LAST Month
WHERE Month.StartDate
<= NewAccttrans.Date
NO-LOCK NO-ERROR.
444 IF NOT AVAILABLE(Month
) THEN
445 FIND FIRST Month
WHERE Month.EndDate
>= NewAccttrans.Date
NO-LOCK NO-ERROR.
446 month-status
= (IF Month.MonthStatus
= "CLOS" THEN (IF Month.MonthCode
= NewAcctTrans.MonthCode
THEN "Forced" ELSE "Closed") ELSE "").
448 FIND FIRST Update-Month
WHERE Update-Month.MonthCode
= Month.MonthCode
449 AND Update-Month.Closed
= month-status
NO-LOCK NO-ERROR.
450 IF NOT AVAILABLE(Update-Month
) THEN DO:
453 Update-Month.MonthCode
= Month.MonthCode
454 Update-Month.MonthName
= Month.MonthName
455 Update-Month.Year
= YEAR(Month.EndDate
)
456 Update-Month.Closed
= month-status
457 Update-Month.TrnCount
= 0 .
459 IF month-status
= "Closed" THEN DO:
460 FIND FIRST xx-Month
WHERE xx-Month.MonthCode
> Month.MonthCode
461 AND xx-Month.MonthStatus
= "OPEN" NO-LOCK NO-ERROR.
462 IF NOT AVAILABLE(xx-Month
) THEN
463 FIND LAST xx-Month
WHERE xx-Month.MonthCode
< Month.MonthCode
464 AND xx-Month.MonthStatus
= "OPEN" NO-LOCK NO-ERROR.
465 IF NOT AVAILABLE(xx-Month
) THEN
466 Update-Month.ActualMonth
= "Not Open".
468 Update-Month.ActualMonth
= STRING(MONTH(xx-Month.StartDate
), "99") + "/"
469 + STRING(YEAR(xx-Month.StartDate
), "9999").
472 Update-Month.TrnCount
= Update-Month.TrnCount
+ 1.
473 Update-Month.MonthValue
= Update-Month.MonthValue
+ NewAcctTrans.Amount.
475 OPEN QUERY br-UpdateMonths
FOR EACH Update-Month
BY Update-Month.MonthCode .
479 /* _UIB-CODE-BLOCK-END
*/
483 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-initialize V-table-Win
484 PROCEDURE pre-initialize
:
485 /*------------------------------------------------------------------------------
487 ------------------------------------------------------------------------------*/
489 FIND LAST Month
WHERE Month.StartDate
<= TODAY NO-LOCK NO-ERROR.
490 IF AVAILABLE(Month
) THEN force-month
= Month.MonthCode.
494 /* _UIB-CODE-BLOCK-END
*/
498 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win _ADM-SEND-RECORDS
499 PROCEDURE send-records
:
500 /*------------------------------------------------------------------------------
501 Purpose
: Send record
ROWID's for all tables used by
503 Parameters
: see template
/snd-head.i
504 ------------------------------------------------------------------------------*/
506 /* Define variables needed by this internal procedure.
*/
507 {src
/adm
/template
/snd-head.i
}
509 /* For each requested table
, put it's
ROWID in the output list.
*/
510 {src
/adm
/template
/snd-list.i
"NewBatch"}
511 {src
/adm
/template
/snd-list.i
"Update-Month"}
513 /* Deal with any unexpected table requests before closing.
*/
514 {src
/adm
/template
/snd-end.i
}
518 /* _UIB-CODE-BLOCK-END
*/
522 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
523 PROCEDURE state-changed
:
524 /* -----------------------------------------------------------
528 -------------------------------------------------------------*/
529 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
530 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
533 /* Object instance CASEs can go here to replace standard behavior
535 {src
/adm
/template
/vstates.i
}
539 /* _UIB-CODE-BLOCK-END
*/
543 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-batch V-table-Win
544 PROCEDURE update-batch
:
545 /*------------------------------------------------------------------------------
546 Purpose
: Run the batch update program
547 ------------------------------------------------------------------------------*/
548 DEF VAR update-options
AS CHAR NO-UNDO.
551 IF RETURN-VALUE = "FAIL" THEN RETURN.
553 DO WITH FRAME {&FRAME-NAME}:
554 IF INPUT tgl_ForceMonth
THEN
555 APPLY 'U2'
:U
TO cmb_ForceMonth.
/* Assign the values
*/
557 IF NewBatch.BatchType
BEGINS "PART" THEN
558 /* don't muck around with partly posted ones
- just let them be posted again
! */.
560 FIND CURRENT NewBatch
EXCLUSIVE-LOCK.
561 NewBatch.BatchType
= "UPDT".
562 FIND CURRENT NewBatch
NO-LOCK.
565 update-options
= "DeleteAfterPosting"
566 + "~nBatchCode," + STRING(NewBatch.BatchCode
)
567 + (IF INPUT tgl_ReverseNextPeriod
THEN
568 "~nReverseNextPeriod" ELSE "")
569 + (IF INPUT tgl_ForceMonth
THEN
570 ("~nForceMonth," + STRING(force-month
))
572 + "~nPrintAfterPosting".
574 RUN make-bq-entry
IN sys-mgr
( "process/tru.p", update-options
, ?
, ?
).
577 FIND CURRENT NewBatch
EXCLUSIVE-LOCK NO-ERROR.
578 IF AVAILABLE(NewBatch
) AND NewBatch.BatchType
= "UPDT" THEN
579 NewBatch.BatchType
= "NORM".
580 FIND CURRENT NewBatch
NO-LOCK NO-ERROR.
583 RUN notify
( 'open-query
,record-source'
:U
).
587 /* _UIB-CODE-BLOCK-END
*/
591 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-update V-table-Win
592 PROCEDURE verify-update
:
593 /*------------------------------------------------------------------------------
595 ------------------------------------------------------------------------------*/
596 DEF VAR mth-valid
AS LOGICAL INITIAL Yes
NO-UNDO.
597 DEF VAR warn-result
AS LOGICAL INITIAL no
NO-UNDO.
599 IF NOT AVAILABLE(NewBatch
) THEN DO:
600 MESSAGE "There is no batch selected for update!" SKIP
601 "Please choose a valid batch"
602 VIEW-AS ALERT-BOX ERROR TITLE "Error Running Update".
606 IF NewBatch.BatchType
= "ACCR" THEN DO:
607 MESSAGE "Use the Batch Tool to create a 'NORM' batch and update that"
608 VIEW-AS ALERT-BOX ERROR TITLE "Accruals batches cannot update directly".
612 IF CAN-FIND( FIRST Update-Month
WHERE Update-Month.Closed
= "Closed" ) THEN DO:
613 MESSAGE "Some transactions in this batch relate to closed" SKIP
614 "months. You may want to cancel this batch update" SKIP
615 "and open those months for posting!" SKIP(2)
616 "Or do you want to update the batch anyway, with those" SKIP
617 "transactions posting to the nearest open months?"
618 VIEW-AS ALERT-BOX WARNING BUTTONS OK-CANCEL
619 TITLE "Warning: Transactions relate to closed months"
621 IF NOT warn-result
THEN RETURN "FAIL".
624 IF NewBatch.Total
<> 0 THEN DO:
625 DEF VAR btot
AS DECIMAL NO-UNDO.
627 FOR EACH NewDocument
OF NewBatch
NO-LOCK,
628 EACH NewAcctTrans
OF NewDocument
NO-LOCK:
629 btot
= btot
+ ((IF NewDocument.DocumentType
= "RCPT" THEN -1 ELSE 1) * NewAcctTrans.Amount
).
630 IF NOT CAN-FIND( Month
WHERE Month.StartDate
>= NewAcctTrans.Date
631 AND Month.EndDate
<= NewAcctTrans.Date
632 AND Month.MonthStatus
= "OPEN")
636 IF btot
<> 0 AND fail-unbalanced-update
AND NOT(NewBatch.BatchType
BEGINS "PART") THEN DO:
637 MESSAGE "Batch total does not equal zero!"
638 VIEW-AS ALERT-BOX ERROR
639 TITLE "Error: Non-zero batch total!".
642 ELSE IF btot
<> 0 THEN DO:
644 MESSAGE "Batch total does not equal zero!" SKIP
645 "Are you sure you want to update it?"
646 VIEW-AS ALERT-BOX WARNING BUTTONS OK-CANCEL
647 TITLE "Warning: Non-zero batch total!"
649 IF NOT warn-result
THEN RETURN "FAIL".
656 /* _UIB-CODE-BLOCK-END
*/