1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 ------------------------------------------------------------------------*/
6 DEF INPUT PARAMETER report-options
AS CHAR NO-UNDO.
8 DEF VAR invoice-1
AS INT NO-UNDO INIT ?.
9 DEF VAR invoice-n
AS INT NO-UNDO INIT ?.
11 DEF VAR invoice-date
AS DATE NO-UNDO INIT ?.
12 DEF VAR due-date
AS DATE NO-UNDO INIT ?.
16 DEF VAR user-name
AS CHAR NO-UNDO.
17 {inc
/username.i
"user-name"}
21 /* _UIB-CODE-BLOCK-END
*/
25 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
27 /* ******************** Preprocessor Definitions
******************** */
29 &Scoped-define PROCEDURE-TYPE Procedure
30 &Scoped-define DB-AWARE no
34 /* _UIB-PREPROCESSOR-BLOCK-END
*/
39 /* *********************** Procedure Settings
************************ */
41 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
42 /* Settings for
THIS-PROCEDURE
46 Add Fields to
: Neither
47 Other Settings
: CODE-ONLY
COMPILE
49 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
51 /* ************************* Create Window
************************** */
53 &ANALYZE-SUSPEND _CREATE-WINDOW
54 /* DESIGN Window definition
(used by the UIB
)
55 CREATE WINDOW Procedure
ASSIGN
58 /* END WINDOW DEFINITION
*/
62 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
63 /* ************************* Included-Libraries
*********************** */
65 {inc
/method
/m-txtrep.i
}
67 /* _UIB-CODE-BLOCK-END
*/
74 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
77 /* *************************** Main Block
*************************** */
81 /* _UIB-CODE-BLOCK-END
*/
85 /* ********************** Internal Procedures
*********************** */
87 &IF DEFINED(EXCLUDE-copy-invoices) = 0 &THEN
89 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE copy-invoices Procedure
90 PROCEDURE copy-invoices
:
91 /*------------------------------------------------------------------------------
92 Purpose
: Actually copy the invoices
93 ------------------------------------------------------------------------------*/
94 DEFINE BUFFER NewInvoice
FOR Invoice.
95 DEFINE BUFFER NewInvoiceLine
FOR InvoiceLine.
97 /* Override the Invoice Line YourShare
ASSIGN trigger which calculates the invoice total
*/
98 ON ASSIGN OF InvoiceLine.YourShare
OVERRIDE DO: END.
100 FOR EACH Invoice
WHERE Invoice.InvoiceNo
>= invoice-1
AND Invoice.InvoiceNo
<= invoice-n
NO-LOCK:
102 BUFFER-COPY Invoice
EXCEPT InvoiceNo
TO NewInvoice
103 ASSIGN NewInvoice.InvoiceStatus
= "U"
104 NewInvoice.InvoiceDate
= invoice-date
105 NewInvoice.DueDate
= due-date.
106 FOR EACH InvoiceLine
OF Invoice
NO-LOCK:
107 CREATE NewInvoiceLine.
108 BUFFER-COPY InvoiceLine
EXCEPT InvoiceNo
TO NewInvoiceLine
109 ASSIGN NewInvoiceLine.InvoiceNo
= NewInvoice.InvoiceNo.
115 /* _UIB-CODE-BLOCK-END
*/
120 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
122 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
123 PROCEDURE parse-parameters
:
124 /*------------------------------------------------------------------------------
126 ------------------------------------------------------------------------------*/
127 DEF VAR token
AS CHAR NO-UNDO.
128 DEF VAR i
AS INT NO-UNDO.
129 DEF VAR n
AS INT NO-UNDO.
131 {inc
/showopts.i
"report-options"}
133 n
= NUM-ENTRIES( report-options
, "~n" ).
135 token
= ENTRY( i
, report-options
, "~n" ).
137 CASE ENTRY( 1, token
):
138 WHEN "InvoiceDate" THEN invoice-date
= DATE(ENTRY(2,TOKEN
)).
140 WHEN "DueDate" THEN due-date
= DATE(ENTRY(2,TOKEN
)).
142 WHEN "InvoiceRange" THEN ASSIGN
143 invoice-1
= INT(ENTRY(2,token
))
144 invoice-n
= INT(ENTRY(3,token
)).
152 /* _UIB-CODE-BLOCK-END
*/