1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
15 ------------------------------------------------------------------------*/
16 /* This .W file was created with the Progress UIB.
*/
17 /*----------------------------------------------------------------------*/
19 /* *************************** Definitions
************************** */
21 /* _UIB-CODE-BLOCK-END
*/
25 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
27 /* ******************** Preprocessor Definitions
******************** */
29 &Scoped-define PROCEDURE-TYPE Procedure
33 /* _UIB-PREPROCESSOR-BLOCK-END
*/
38 /* *********************** Procedure Settings
************************ */
40 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
41 /* Settings for
THIS-PROCEDURE
45 Add Fields to
: Neither
46 Other Settings
: CODE-ONLY
COMPILE
48 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
50 /* ************************* Create Window
************************** */
52 &ANALYZE-SUSPEND _CREATE-WINDOW
53 /* DESIGN Window definition
(used by the UIB
)
54 CREATE WINDOW Procedure
ASSIGN
57 /* END WINDOW DEFINITION
*/
64 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
67 /* *************************** Main Block
*************************** */
68 DEF VAR i
AS INT NO-UNDO.
69 DEF VAR j
AS INT NO-UNDO.
72 FIND OfficeSetting
OF Office
NO-LOCK WHERE OfficeSetting.SetName
= "UNIQLINE.P" NO-ERROR.
74 IF NOT AVAILABLE(OfficeSetting
) THEN DO:
76 OfficeSetting.OfficeCode
= Office.OfficeCode.
77 OfficeSetting.SetName
= "UNIQLINE.P".
78 OfficeSetting.SetValue
= "Voucher,0".
81 FIND OfficeSetting
OF Office
NO-LOCK WHERE OfficeSetting.SetName
= "UNIQLINE.P" NO-ERROR.
83 IF ENTRY(1, OfficeSetting.SetValue
) = "Voucher" THEN DO:
84 j
= INT(ENTRY(2,OfficeSetting.SetValue
)).
85 DEF VAR this-id
AS CHAR NO-UNDO.
86 DEF VAR recids
AS CHAR NO-UNDO.
89 DEF BUFFER NextLine
FOR VoucherLine.
90 ON WRITE OF VoucherLine
OVERRIDE DO: END.
93 FOR EACH Voucher
NO-LOCK:
94 FIND FIRST VoucherLine
OF Voucher
NO-LOCK NO-ERROR.
95 IF NOT AVAILABLE(VoucherLine
) THEN NEXT Voucher-loop.
96 IF CAN-FIND( FIRST NextLine
OF Voucher
WHERE RECID(NextLine
) <> RECID(VoucherLine
) ) THEN DO:
100 FOR EACH VoucherLine
OF Voucher
EXCLUSIVE-LOCK:
101 this-id
= STRING( RECID(VoucherLine
)).
102 IF LOOKUP( this-id
, recids
) <> 0 THEN NEXT Inv-line-loop.
103 recids
= recids
+ this-id
+ ",".
104 IF VoucherLine.LineSeq
<> i
THEN VoucherLine.LineSeq
= i.
105 IF j
MOD 100 = 0 THEN
106 MESSAGE Voucher.VoucherSeq VoucherLine.LineSeq .
114 IF ENTRY(1, OfficeSetting.SetValue
) = "Voucher" THEN DO:
116 FIND CURRENT OfficeSetting
EXCLUSIVE-LOCK.
117 OfficeSetting.SetValue
= "Invoice,0".
118 FIND CURRENT OfficeSetting
NO-LOCK.
123 IF ENTRY(1, OfficeSetting.SetValue
) = "Invoice" THEN DO:
124 j
= INT(ENTRY(2,OfficeSetting.SetValue
)).
125 ON WRITE OF InvoiceLine
OVERRIDE DO: END.
126 FOR EACH Invoice
NO-LOCK WHERE Invoice.InvoiceNo
> j
:
127 IF CAN-FIND( FIRST InvoiceLine
OF Invoice
) THEN DO TRANSACTION:
129 FOR EACH InvoiceLine
OF Invoice
:
130 IF InvoiceLine.LineSeq
> i
THEN
131 i
= InvoiceLine.LineSeq.
132 ELSE IF InvoiceLine.LineSeq
< i
THEN
133 InvoiceLine.LineSeq
= i.
138 IF (Invoice.InvoiceNo
MOD 10) = 0 THEN DO TRANSACTION:
139 FIND CURRENT OfficeSetting
EXCLUSIVE-LOCK.
140 OfficeSetting.SetValue
= "Invoice," + STRING( Invoice.InvoiceNo
).
141 FIND CURRENT OfficeSetting
NO-LOCK.
144 ON WRITE OF InvoiceLine
REVERT.
148 FIND CURRENT OfficeSetting
EXCLUSIVE-LOCK.
149 OfficeSetting.SetValue
= "Completed".
150 FIND CURRENT OfficeSetting
NO-LOCK.
153 /* _UIB-CODE-BLOCK-END
*/