Added capital works blank section. Synced calling screen.
[capital-apms-progress.git] / process / copy-invoices.p
blobf33ea67451e002f74f587dbd45b5a4645f6c62df
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
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 ?.
14 RUN parse-parameters.
16 DEF VAR user-name AS CHAR NO-UNDO.
17 {inc/username.i "user-name"}
19 {inc/ofc-this.i}
21 /* _UIB-CODE-BLOCK-END */
22 &ANALYZE-RESUME
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 */
35 &ANALYZE-RESUME
39 /* *********************** Procedure Settings ************************ */
41 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
42 /* Settings for THIS-PROCEDURE
43 Type: Procedure
44 Allow:
45 Frames: 0
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
56 HEIGHT = .25
57 WIDTH = 32.57.
58 /* END WINDOW DEFINITION */
60 &ANALYZE-RESUME
62 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
63 /* ************************* Included-Libraries *********************** */
65 {inc/method/m-txtrep.i}
67 /* _UIB-CODE-BLOCK-END */
68 &ANALYZE-RESUME
74 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
77 /* *************************** Main Block *************************** */
79 RUN copy-invoices.
81 /* _UIB-CODE-BLOCK-END */
82 &ANALYZE-RESUME
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:
101 CREATE NewInvoice.
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.
110 END.
111 END.
113 END PROCEDURE.
115 /* _UIB-CODE-BLOCK-END */
116 &ANALYZE-RESUME
118 &ENDIF
120 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
122 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
123 PROCEDURE parse-parameters :
124 /*------------------------------------------------------------------------------
125 Purpose:
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" ).
134 DO i = 1 TO 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)).
146 END CASE.
148 END.
150 END PROCEDURE.
152 /* _UIB-CODE-BLOCK-END */
153 &ANALYZE-RESUME
155 &ENDIF