File mfg/2013/base/src/soiv1002.p added (mode: 100644) (index 0000000..341e3eb) |
|
1 |
|
/* soiv1002.p - INVOICE HISTORY INVOICE REPRINT MAINLOOP */ |
|
2 |
|
/* soiv1001.p - INVOICE HISTORY INVOICE REPRINT MAINLOOP */ |
|
3 |
|
/* Copyright 1986 QAD Inc. All rights reserved. */ |
|
4 |
|
/* $Id$: */ |
|
5 |
|
/* REVISION: 8.5 CREATED: 10/20/97 BY: *H1F8* Nirav Parikh */ |
|
6 |
|
/* REVISION: 8.6E LAST MODIFIED: 02/23/98 BY: *L007* A. Rahane */ |
|
7 |
|
/* REVISION: 8.6E LAST MODIFIED: 04/28/98 BY: *L00L* Adam Harris */ |
|
8 |
|
/* REVISION: 8.6E LAST MODIFIED: 05/20/98 BY: *K1Q4* Alfred Tan */ |
|
9 |
|
/* REVISION: 8.6E LAST MODIFIED: 06/23/98 BY: *L024* Sami Kureishy */ |
|
10 |
|
/* REVISION: 8.6E LAST MODIFIED: 12/04/98 BY: *J360* Poonam Bahl */ |
|
11 |
|
/* REVISION: 8.6E LAST MODIFIED: 02/01/99 BY: *L0D5* Robin McCarthy */ |
|
12 |
|
/* REVISION: 8.6E LAST MODIFIED: 02/05/99 BY: *J38T* Poonam Bahl */ |
|
13 |
|
/* REVISION: 8.6E LAST MODIFIED: 05/07/99 BY: *J3DQ* Niranjan R. */ |
|
14 |
|
/* REVISION: 8.6E LAST MODIFIED: 10/05/99 BY: *L0JV* Anup Pereira */ |
|
15 |
|
/* REVISION: 9.1 LAST MODIFIED: 03/06/00 BY: *N05Q* Luke Pokic */ |
|
16 |
|
/* REVISION: 9.1 LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */ |
|
17 |
|
/* REVISION: 9.1 LAST MODIFIED: 02/16/00 BY: *N06R* Denis Tatarik */ |
|
18 |
|
/* REVISION: 9.1 LAST MODIFIED: 05/07/00 BY: *N09G* Luke Pokic */ |
|
19 |
|
/* REVISION: 9.1 LAST MODIFIED: 06/27/99 BY: *N0DQ* Katie Hilbert */ |
|
20 |
|
/* REVISION: 9.1 LAST MODIFIED: 07/03/00 BY: *N0DX* Mudit Mehta */ |
|
21 |
|
/* REVISION: 9.1 LAST MODIFIED: 08/23/00 BY: *N0ND* Mark Brown */ |
|
22 |
|
/* REVISION: 9.1 LAST MODIFIED: 11/07/00 BY: *L15K* Kaustubh K */ |
|
23 |
|
/* REVISION: 9.1 LAST MODIFIED: 10/13/00 BY: *N0W8* Mudit Mehta */ |
|
24 |
|
/* Revision: 1.30 BY: Katie Hilbert DATE: 04/01/01 ECO: *P002* */ |
|
25 |
|
/* Revision: 1.31 BY: Manisha Sawant DATE: 05/08/01 ECO: *N0YD* */ |
|
26 |
|
/* Revision: 1.32 BY: Ellen Borden DATE: 07/09/01 ECO: *P007* */ |
|
27 |
|
/* Revision: 1.33 BY: Hareesh V. DATE: 08/20/01 ECO: *N11L* */ |
|
28 |
|
/* Revision: 1.34 BY: Vinod Nair DATE: 08/24/01 ECO: *N11P* */ |
|
29 |
|
/* Revision: 1.35 BY: Tiziana Giustozzi DATE: 10/02/01 ECO: *N138* */ |
|
30 |
|
/* Revision: 1.37 BY: Mercy Chittilapilly DATE: 10/08/02 ECO: *N1W1* */ |
|
31 |
|
/* Revision: 1.38 BY: Amit Chaturvedi DATE: 01/20/03 ECO: *N20Y* */ |
|
32 |
|
/* Revision: 1.39 BY: Vandna Rohira DATE: 04/28/03 ECO: *N1YL* */ |
|
33 |
|
/* Revision: 1.40 BY: Narathip W. DATE: 05/21/03 ECO: *P0S8* */ |
|
34 |
|
/* Revision: 1.42 BY: Paul Donnelly (SB) DATE: 06/28/03 ECO: *Q00P* */ |
|
35 |
|
/* Revision: 1.43 BY: Vivek Gogte DATE: 08/02/03 ECO: *N2GZ* */ |
|
36 |
|
/* Revision: 1.44 BY: Ed van de Gevel DATE: 08/22/03 ECO: *Q02M* */ |
|
37 |
|
/* Revision: 1.45 BY: Manish Dani DATE: 09/01/03 ECO: *P0VZ* */ |
|
38 |
|
/* Revision: 1.46 BY: Ashish Maheshwari DATE: 11/15/03 ECO: *P15L* */ |
|
39 |
|
/* Revision: 1.47 BY: Shilpa Athalye DATE: 11/26/03 ECO: *P1BF* */ |
|
40 |
|
/* Revision: 1.48 BY: Vinay Soman DATE: 01/20/04 ECO: *N2NZ* */ |
|
41 |
|
/* Revision: 1.49 BY: Shivaraman V. DATE: 02/05/04 ECO: *P1MR* */ |
|
42 |
|
/* Revision: 1.51 BY: Swati Sharma DATE: 02/27/04 ECO: *P1R4* */ |
|
43 |
|
/* Revision: 1.52 BY: Bhagyashri Shinde DATE: 02/01/05 ECO: *P365* */ |
|
44 |
|
/* Revision: 1.57 BY: Ed van de Gevel DATE: 03/01/05 ECO: *R00G* */ |
|
45 |
|
/* Revision: 1.58 BY: Ed van de Gevel DATE: 03/16/05 ECO: *R00H* */ |
|
46 |
|
/* Revision: 1.59 BY: Ed van de Gevel DATE: 18/03/05 ECO: *R00F* */ |
|
47 |
|
/* Revision: 1.60 BY: Priya Idnani DATE: 03/30/05 ECO: *P380* */ |
|
48 |
|
/* Revision: 1.61 BY: Ed van de Gevel DATE: 07/01/05 ECO: *R01H* */ |
|
49 |
|
/* Revision: 1.62 BY: Alok Gupta DATE: 01/24/06 ECO: *P43Q* */ |
|
50 |
|
/* Revision: 1.63 BY: Nishit V DATE: 02/06/06 ECO: *P4GY* */ |
|
51 |
|
/* Revision: 1.65 BY: Tom Kennedy DATE: 06/08/06 ECO: *Q0LK* */ |
|
52 |
|
/* Revision: 1.66 BY: Samir Bavkar DATE: 08/31/06 ECO: *R08J* */ |
|
53 |
|
/* Revision: 1.70 BY: Katie Hilbert DATE: 06/22/07 ECO: *R0C6* */ |
|
54 |
|
/* Revision: 1.71 BY: Dinesh Dubey DATE: 07/07/08 ECO: *R0W3* */ |
|
55 |
|
/* Revision: 1.75 BY: Jean Miller DATE: 10/07/08 ECO: *R15M* */ |
|
56 |
|
/* Revision: 1.76 BY: Dilip Manawat DATE: 10/03/08 ECO: *R15K* */ |
|
57 |
|
/* Revision: 1.77 BY: Yizhou Mao DATE: 02/10/09 ECO: *R1BY* */ |
|
58 |
|
/* Revision: 1.78 BY: Hemant Dhavse DATE: 03/20/09 ECO: *Q2J3* */ |
|
59 |
|
/* Revision: 1.79 BY: Sundeep Kalla DATE: 05/27/09 ECO: *R1K4* */ |
|
60 |
|
/* Revision: 1.80 BY: Xiaolei Meng DATE: 07/31/09 ECO: *R1N2* */ |
|
61 |
|
/* Revision: 1.81 BY: Jean Miller DATE: 11/23/09 ECO: *R1TW* */ |
|
62 |
|
/* Revision: 1.82 BY: Manjusha Inglay DATE: 12/14/09 ECO: *R1VM* */ |
|
63 |
|
/* Revision: 1.83 BY: Sandeep Rohila DATE: 02/03/10 ECO: *R1XM* */ |
|
64 |
|
/* Revision: 1.84 BY: Trupti Khairnar DATE: 08/24/10 ECO: *Q4BT* */ |
|
65 |
|
/* BGL LAST MODIFIED: 2014-FEB-12 BY: gbg *d2561 */ |
|
66 |
|
/*-Revision end---------------------------------------------------------------*/ |
|
67 |
|
|
|
68 |
|
/******************************************************************************/ |
|
69 |
|
/* All patch markers and commented out code have been removed from the source */ |
|
70 |
|
/* code below. For all future modifications to this file, any code which is */ |
|
71 |
|
/* no longer required should be deleted and no in-line patch markers should */ |
|
72 |
|
/* be added. The ECO marker should only be included in the Revision History. */ |
|
73 |
|
/******************************************************************************/ |
|
74 |
|
|
|
75 |
|
/* THIS PROGRAM IS SIMILAR TO sorp1001.p. CHANGES DONE IN THIS PROGRAM */ |
|
76 |
|
/* MAY ALSO NEED TO BE DONE IN sorp1001.p. */ |
|
77 |
|
|
|
78 |
|
/*! N1YL HAS CHANGED THE WAY TAXABLE/NON-TAXABLE AMOUNT IS CALCULATED. |
|
79 |
|
THE ORDER DISCOUNT IS APPLIED FOR EACH LINE TOTAL AND THEN IT IS |
|
80 |
|
SUMMED UP TO CALCULATE THE TAXABLE/NON-TAXABLE AMOUNT BASED ON THE |
|
81 |
|
TAXABLE STATUS OF EACH LINE. PREVIOUSLY, TAXABLE/NON-TAXABLE AMOUNT |
|
82 |
|
WAS OBTAINED FROM THE GTM TABLES. THIS CAUSED PROBLEMS WHEN |
|
83 |
|
MULTIPLE TAXABLE BASES ARE USED TO CALCULATE TAX. |
|
84 |
|
|
|
85 |
|
TAXABLE/NON-TAXABLE AMOUNT WILL NOW BE DISPLAYED IN THE TRAILER |
|
86 |
|
FRAME BASED ON THE VALUE OF THE FLAG "DISPLAY TAXABLE/NON-TAXABLE |
|
87 |
|
AMOUNT ON TRAILER" IN THE GLOBAL TAX MANAGEMENT CTRL FILE |
|
88 |
|
*/ |
|
89 |
|
{us/bbi/mfdeclre.i} |
|
90 |
|
{us/bbi/gplabel.i} /* EXTERNAL LABEL INCLUDE */ |
|
91 |
|
{us/px/pxmaint.i} |
|
92 |
|
{us/px/pxphdef.i adcrxr} |
|
93 |
|
|
|
94 |
|
{us/gp/gprunpdf.i "sopl" "p"} |
|
95 |
|
{us/so/sotxidef.i} |
|
96 |
|
|
|
97 |
|
|
|
98 |
|
/*d2561* start added code >>> */ |
|
99 |
|
{xx2561.i new} |
|
100 |
|
{xxtaxfn.i} |
|
101 |
|
/*d2561* end added code <<< */ |
|
102 |
|
|
|
103 |
|
define new shared variable undo_txdetrp like mfc_logical. |
|
104 |
|
define new shared variable rmaso like mfc_logical. |
|
105 |
|
define new shared variable col-80 like mfc_logical initial true. |
|
106 |
|
define new shared variable disc_prnt_label as character format "x(8)". |
|
107 |
|
define new shared variable sacontract like mfc_logical. |
|
108 |
|
define new shared variable isDomOrder as logical no-undo. |
|
109 |
|
|
|
110 |
|
define shared variable prt_cor like mfc_logical initial no. |
|
111 |
|
define shared variable rndmthd like rnd_rnd_mthd. |
|
112 |
|
define shared variable oldcurr like ih_curr. |
|
113 |
|
define shared variable inv like idh_inv_nbr. |
|
114 |
|
define shared variable inv1 like idh_inv_nbr. |
|
115 |
|
define shared variable nbr like ih_nbr. |
|
116 |
|
define shared variable nbr1 like ih_nbr. |
|
117 |
|
define shared variable dnbr like ih_nbr no-undo. |
|
118 |
|
define shared variable dnbr1 like ih_nbr no-undo. |
|
119 |
|
define shared variable dom-proc as integer no-undo. |
|
120 |
|
define shared variable site like ih_site. |
|
121 |
|
define shared variable site1 like ih_site. |
|
122 |
|
define shared variable print_lotserials like mfc_logical. |
|
123 |
|
define shared variable first_line like mfc_logical. |
|
124 |
|
define shared variable pages as integer. |
|
125 |
|
define shared variable comp_addr like soc_company. |
|
126 |
|
define shared variable msg like msg_desc. |
|
127 |
|
define shared variable inv_date like ih_inv_date. |
|
128 |
|
define shared variable inv_date1 like ih_inv_date. |
|
129 |
|
define shared variable ih_recno as recid. |
|
130 |
|
define shared variable company as character |
|
131 |
|
format "x(38)" extent 6. |
|
132 |
|
define shared variable billto as character |
|
133 |
|
format "x(38)" extent 6. |
|
134 |
|
define shared variable soldto as character |
|
135 |
|
format "x(38)" extent 6. |
|
136 |
|
define shared variable termsdesc as character format "x(40)" label "Description" no-undo. |
|
137 |
|
define shared variable shipdate like ih_ship_date. |
|
138 |
|
define shared variable shipdate1 like shipdate. |
|
139 |
|
define shared variable addr as character |
|
140 |
|
format "x(38)" extent 6. |
|
141 |
|
define shared variable print_options like mfc_logical. |
|
142 |
|
define shared variable base_rpt as character. |
|
143 |
|
define shared variable override_print_hist like mfc_logical. |
|
144 |
|
define shared variable hdr_po as character format "x(38)". |
|
145 |
|
define shared variable cust like ih_cust. |
|
146 |
|
define shared variable cust1 like ih_cust. |
|
147 |
|
define shared variable bill like ih_bill. |
|
148 |
|
define shared variable bill1 like ih_bill. |
|
149 |
|
/* DEFINE VARIABLES FOR INVOICE TOTALS. */ |
|
150 |
|
define shared variable resale like cm_resale. |
|
151 |
|
define shared variable call-detail like mfc_logical. |
|
152 |
|
define shared variable incinv like mfc_logical. |
|
153 |
|
define shared variable incmemo like mfc_logical. |
|
154 |
|
define shared variable slspsn1 as character no-undo. |
|
155 |
|
define shared variable slspsn as character no-undo. |
|
156 |
|
define shared variable reprint like mfc_logical. |
|
157 |
|
define shared variable update_invoice like mfc_logical. |
|
158 |
|
define shared variable lang like so_lang. |
|
159 |
|
define shared variable lang1 like lang. |
|
160 |
|
define shared variable sls-psn like so_slspsn[1] no-undo. |
|
161 |
|
define shared variable sls-psn1 like so_slspsn[1] no-undo. |
|
162 |
|
define shared variable daybook as character no-undo. |
|
163 |
|
define shared variable daybook1 as character no-undo. |
|
164 |
|
define shared variable inv_batch like ih_batch no-undo. |
|
165 |
|
define shared variable inv_batch1 like ih_batch no-undo. |
|
166 |
|
|
|
167 |
|
/* For fiscal number */ |
|
168 |
|
define shared variable update_fnbr like mfc_logical no-undo. |
|
169 |
|
define shared variable fnbr_seq like nr_seqid no-undo. |
|
170 |
|
define variable l_error like mfc_logical no-undo. |
|
171 |
|
|
|
172 |
|
/* Shared variables for print settings */ |
|
173 |
|
{us/so/soprsets.i} |
|
174 |
|
|
|
175 |
|
{us/so/soivtot1.i} |
|
176 |
|
/* DEFINITION FOR TEMP TABLE t_tr_hist1 */ |
|
177 |
|
{us/so/sotrhstb.i} |
|
178 |
|
define new shared frame phead1. |
|
179 |
|
|
|
180 |
|
/* DEFINE VARIABLES FOR DISPLAY OF VAT REG NO & COUNTRY CODE */ |
|
181 |
|
{us/gp/gpvtegl.i} |
|
182 |
|
{us/gp/gpvtecdf.i &var="shared"} |
|
183 |
|
{us/gp/gpvtepdf.i &var="shared"} |
|
184 |
|
|
|
185 |
|
define variable first-invoice like mfc_logical no-undo. |
|
186 |
|
define variable currdisp like so_curr no-undo. |
|
187 |
|
define variable svremarks as character format "x(58)" |
|
188 |
|
no-undo. |
|
189 |
|
define variable h_format as handle no-undo. |
|
190 |
|
define variable prepaid-lbl as character format "x(12)" |
|
191 |
|
no-undo. |
|
192 |
|
define variable prepaid_fmt as character no-undo. |
|
193 |
|
define variable prepaid_old as character no-undo. |
|
194 |
|
define variable tot_prepaid_amt like so_prepaid. |
|
195 |
|
define variable hdl_sum_disc_lbl as handle no-undo. |
|
196 |
|
define variable tax_tr_type like tx2d_tr_type |
|
197 |
|
initial "16" no-undo. |
|
198 |
|
define variable print_invoice like mfc_logical no-undo. |
|
199 |
|
define variable hdr_call as character |
|
200 |
|
format "x(21)" no-undo. |
|
201 |
|
define variable call-lbl as character format "x(16)" |
|
202 |
|
no-undo. |
|
203 |
|
define variable tot_prepaid_nett like so_prepaid |
|
204 |
|
label "Total Prepaid" no-undo. |
|
205 |
|
define variable tot_ptax_amt like ih_prep_tax no-undo. |
|
206 |
|
define variable amt_due_af_prep like so_prepaid |
|
207 |
|
label "Amount Due" no-undo. |
|
208 |
|
define variable add-trl-length as integer no-undo. |
|
209 |
|
define variable price_fmt as character no-undo. |
|
210 |
|
define variable vlResult like mfc_logical no-undo. |
|
211 |
|
define variable vcCreditCardMsg as character format "x(80)" |
|
212 |
|
extent 3 no-undo. |
|
213 |
|
define variable translation as character no-undo. |
|
214 |
|
define variable c-cont as character format "x(35)" no-undo. |
|
215 |
|
define variable l_skip_rec like mfc_logical no-undo. |
|
216 |
|
define variable auth_price like sod_price |
|
217 |
|
format "->>>>,>>>,>>9.99" no-undo. |
|
218 |
|
define variable auth_found like mfc_logical no-undo. |
|
219 |
|
define variable l_nontax_amt like ih_trl2_amt initial 0. |
|
220 |
|
define variable l_tax_amt like ih_trl2_amt initial 0. |
|
221 |
|
define variable ent_ord_bill like ih_bill no-undo. |
|
222 |
|
define variable ent_ord_ship like ih_ship no-undo. |
|
223 |
|
define variable ent_ord_nbr like ih_nbr no-undo. |
|
224 |
|
define variable ent_ord_line like idh_line no-undo. |
|
225 |
|
define variable ent_ord_line_part like idh_part no-undo. |
|
226 |
|
define variable ent_ord_line_uom like idh_um no-undo. |
|
227 |
|
/* DOM variables needed for us/so/soivto10.i */ |
|
228 |
|
define variable so-trl1-cd like so_trl1_cd no-undo. |
|
229 |
|
define variable so-trl2-cd like so_trl2_cd no-undo. |
|
230 |
|
define variable so-trl3-cd like so_trl3_cd no-undo. |
|
231 |
|
define variable isConsolDom as logical no-undo. |
|
232 |
|
|
|
233 |
|
define variable l_conso like mfc_logical no-undo. |
|
234 |
|
define variable exch_rate like so_ex_rate no-undo. |
|
235 |
|
define variable exch_rate2 like so_ex_rate2 no-undo. |
|
236 |
|
define variable exch_ratetype like so_ex_ratetype no-undo. |
|
237 |
|
define variable exch_exru_seq like so_exru_seq no-undo. |
|
238 |
|
define variable l_tot_amt as decimal no-undo. |
|
239 |
|
define variable l_tax_total_message as character extent 2 |
|
240 |
|
format "x(13)" no-undo. |
|
241 |
|
define variable l_basetaxtot like glt_amt no-undo. |
|
242 |
|
define variable is_fallback as logical no-undo. |
|
243 |
|
|
|
244 |
|
|
|
245 |
|
/* InvoiceCerification 20110405 : Add a new variable that will hold the invoice-certificate text that needs to be printed on the invoice for the Portugese decree-363 */ |
|
246 |
|
define variable vcInvoiceCertificationText as character no-undo. |
|
247 |
|
define variable vcInvoiceYearVoucherNumber as character no-undo. |
|
248 |
|
|
|
249 |
|
|
|
250 |
|
define buffer abs_mst1 for abs_mstr. |
|
251 |
|
define buffer ih_buff for ih_hist. |
|
252 |
|
|
|
253 |
|
define new shared temp-table t_absr_det no-undo |
|
254 |
|
field t_absr_id like absr_id |
|
255 |
|
field t_absr_reference like absr_reference |
|
256 |
|
field t_absr_qty as decimal format "->>>>,>>>,>>9.99" |
|
257 |
|
field t_absr_ext as decimal format "->>>>,>>>,>>9.99" |
|
258 |
|
index t_absr_indx t_absr_id t_absr_reference. |
|
259 |
|
|
|
260 |
|
for first txc_ctrl |
|
261 |
|
where txc_domain = global_domain |
|
262 |
|
no-lock: |
|
263 |
|
end. |
|
264 |
|
{us/so/soeuinv.i} |
|
265 |
|
|
|
266 |
|
assign l_tax_total_message[1] = getTermLabel("TOTAL_TAX",9) |
|
267 |
|
+ " " |
|
268 |
|
+ getTermLabel("IN",2) |
|
269 |
|
l_tax_total_message[2] = getTermLabel("TOTAL_TAX",9). |
|
270 |
|
|
|
271 |
|
|
|
272 |
|
{us/so/sodiscwk.i &new="new"} |
|
273 |
|
|
|
274 |
|
assign |
|
275 |
|
prepaid-lbl = getTermLabel("AMOUNT_PAID",11) + ":" |
|
276 |
|
call-lbl = getTermLabel("CALL_NUMBER",14) + ": " |
|
277 |
|
c-cont = CAPS(dynamic-function ('getTermLabelFillCentered' in h-label, |
|
278 |
|
input "CONTINUED", |
|
279 |
|
input 35, |
|
280 |
|
input '*')). |
|
281 |
|
|
|
282 |
|
/* SHARED WORKFILE FOR SUMMARY DISCOUNTS */ |
|
283 |
|
{us/et/etvar.i} |
|
284 |
|
{us/et/etrpvar.i &new="new"} |
|
285 |
|
|
|
286 |
|
/*d2561* {us/mf/mfivtrla.i "NEW"} */ |
|
287 |
|
/*d2561*/ {xxmfivtrla.i "NEW"} |
|
288 |
|
{us/bbi/wbgp03.i &new="NEW SHARED"} |
|
289 |
|
|
|
290 |
|
{us/px/pxpgmmgr.i} |
|
291 |
|
{us/px/pxphdef.i pccalcxr} |
|
292 |
|
|
|
293 |
|
assign |
|
294 |
|
l_nontaxable_lbl = getTermLabelRtColon("NON-TAXABLE", 12) |
|
295 |
|
l_taxable_lbl = getTermLabelRtColon("TAXABLE", 12). |
|
296 |
|
|
|
297 |
|
hdl_sum_disc_lbl = prnt_sum_disc_amt:handle in frame disc_sum_print. |
|
298 |
|
|
|
299 |
|
/* ASSIGN ORIGINAL FORMAT TO _OLD VARIABLES */ |
|
300 |
|
assign |
|
301 |
|
nontax_old = nontaxable_amt:format |
|
302 |
|
taxable_old = taxable_amt:format |
|
303 |
|
line_tot_old = line_total:format |
|
304 |
|
disc_old = disc_amt:format |
|
305 |
|
trl_amt_old = ih_trl1_amt:format |
|
306 |
|
tax_amt_old = tax_amt:format |
|
307 |
|
container_old = container_charge_total:format |
|
308 |
|
line_charge_old = line_charge_total:format |
|
309 |
|
ord_amt_old = ord_amt:format. |
|
310 |
|
|
|
311 |
|
form |
|
312 |
|
tot_prepaid_amt colon 60 |
|
313 |
|
tot_ptax_amt colon 60 |
|
314 |
|
tot_prepaid_nett colon 60 |
|
315 |
|
skip(1) |
|
316 |
|
amt_due_af_prep colon 60 |
|
317 |
|
with frame ihprepd width 80 |
|
318 |
|
side-labels. |
|
319 |
|
|
|
320 |
|
/* SET EXTERNAL LABELS */ |
|
321 |
|
setFrameLabels(frame ihprepd:handle). |
|
322 |
|
|
|
323 |
|
prepaid_old = tot_prepaid_amt:format. |
|
324 |
|
{us/bbi/gprun.i ""gpctryfmt.p"" "persistent set h_format"} |
|
325 |
|
|
|
326 |
|
find first rmc_ctrl where rmc_domain = global_domain no-lock no-error. |
|
327 |
|
|
|
328 |
|
/* Get statutory currency */ |
|
329 |
|
{us/px/pxrun.i &PROC = 'getStatutoryCurrency' |
|
330 |
|
&PROGRAM='pccalcxr.p' |
|
331 |
|
&handle = ph_pccalcxr |
|
332 |
|
&PARAM = "(output g_mgmt_curr, |
|
333 |
|
output is_fallback)" |
|
334 |
|
&NOAPPERROR=true |
|
335 |
|
&CATCHERROR=true} |
|
336 |
|
|
|
337 |
|
mainloop: |
|
338 |
|
do: |
|
339 |
|
for each ih_buff |
|
340 |
|
where ih_buff.ih_domain = global_domain |
|
341 |
|
and (override_print_hist or ih_inv_mthd = "" |
|
342 |
|
or ih_inv_mthd begins " " |
|
343 |
|
or ih_inv_mthd begins "b" |
|
344 |
|
or ih_inv_mthd begins "p" |
|
345 |
|
or not ih_invoiced) |
|
346 |
|
and (ih_inv_nbr >= inv and ih_inv_nbr <= inv1) |
|
347 |
|
and ((ih_nbr >= dnbr and ih_nbr <= dnbr1) |
|
348 |
|
or (ih_nbr >= nbr and ih_nbr <= nbr1)) |
|
349 |
|
and (ih_ship_date >= shipdate and ih_ship_date <= shipdate1) |
|
350 |
|
and (ih_inv_date >= inv_date and ih_inv_date <= inv_date1) |
|
351 |
|
and (ih_cust >= cust and ih_cust <= cust1) |
|
352 |
|
and (ih_bill >= bill and ih_bill <= bill1) |
|
353 |
|
and (ih_site >= site and ih_site <= site1) |
|
354 |
|
and (ih_lang >= lang and ih_lang <= lang1) |
|
355 |
|
and (ih_slspsn[1] >= sls-psn and ih_slspsn[1] <= sls-psn1) |
|
356 |
|
and (ih_daybook >= daybook and ih_daybook <= daybook1) |
|
357 |
|
and (ih_batch >= inv_batch and ih_batch <= inv_batch1) |
|
358 |
|
no-lock break by ih_inv_nbr: |
|
359 |
|
|
|
360 |
|
if not reprint then |
|
361 |
|
if ih_invoiced then next. |
|
362 |
|
|
|
363 |
|
/* IS A DOM ORDER? */ |
|
364 |
|
isDomOrder = false. |
|
365 |
|
{us/bbi/gprun.i ""sodomxr.p"" |
|
366 |
|
"(input ih_nbr, |
|
367 |
|
input 0, |
|
368 |
|
input 'SO', |
|
369 |
|
output ent_ord_nbr, |
|
370 |
|
output ent_ord_line, |
|
371 |
|
output ent_ord_bill, |
|
372 |
|
output ent_ord_ship, |
|
373 |
|
output ent_ord_line_part, |
|
374 |
|
output ent_ord_line_uom)" } |
|
375 |
|
if ent_ord_nbr <> "" then |
|
376 |
|
isDomOrder = true. |
|
377 |
|
if dom-proc = 1 and /* DOM ORDER ENTERED AND NO DOMAIN ORDERS */ |
|
378 |
|
isDomOrder = false |
|
379 |
|
then next. |
|
380 |
|
/* Although it is intended to skip non-dom orders when only dom order */ |
|
381 |
|
/* range is entered, the report should print all domain orders in the */ |
|
382 |
|
/* range when domain order range is entered,regardless of their */ |
|
383 |
|
/* origin(DOM or MFG/PRO.) */ |
|
384 |
|
|
|
385 |
|
assign |
|
386 |
|
l_skip_rec = no |
|
387 |
|
l_nontax_amt = 0 |
|
388 |
|
l_tax_amt = 0 |
|
389 |
|
isConsolDom = false. |
|
390 |
|
|
|
391 |
|
/* MOVED THE CODE FOR GETTING THE ROUNDING METHOD FROM BELOW */ |
|
392 |
|
/* AS IT IS REQUIRED BY THE PROCEDURE p-get-ord-amt */ |
|
393 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-get-rnd-mthd" |
|
394 |
|
"(input ih_curr, |
|
395 |
|
output rndmthd, |
|
396 |
|
output mc-error-number)"} |
|
397 |
|
|
|
398 |
|
if mc-error-number <> 0 |
|
399 |
|
then do: |
|
400 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=3} |
|
401 |
|
next. |
|
402 |
|
end. /* IF mc-error-number <> 0 */ |
|
403 |
|
|
|
404 |
|
/* EXCLUDE CREDIT/DEBIT INVOICE */ |
|
405 |
|
if not incinv |
|
406 |
|
or not incmemo |
|
407 |
|
then do: |
|
408 |
|
|
|
409 |
|
/* OBTAIN TOTAL INVOICE VALUE */ |
|
410 |
|
if first-of(ih_buff.ih_inv_nbr) |
|
411 |
|
then |
|
412 |
|
run p-get-ord-amt(input ih_buff.ih_inv_nbr, |
|
413 |
|
output ord_amt). |
|
414 |
|
|
|
415 |
|
{us/mf/mfrpchk.i &warn=false} |
|
416 |
|
|
|
417 |
|
/* SKIP THE DEBIT/CREDIT INVOICE */ |
|
418 |
|
if (not incinv |
|
419 |
|
and ord_amt >= 0) |
|
420 |
|
or (not incmemo |
|
421 |
|
and ord_amt < 0) |
|
422 |
|
then |
|
423 |
|
l_skip_rec = yes. |
|
424 |
|
|
|
425 |
|
end. /* IF NOT incinv OR ... */ |
|
426 |
|
|
|
427 |
|
if l_skip_rec |
|
428 |
|
then |
|
429 |
|
next. |
|
430 |
|
|
|
431 |
|
isDomOrder = false. |
|
432 |
|
{us/bbi/gprun.i ""sodomxr.p"" |
|
433 |
|
"(input ih_nbr, |
|
434 |
|
input 0, |
|
435 |
|
input 'SO', |
|
436 |
|
output ent_ord_nbr, |
|
437 |
|
output ent_ord_line, |
|
438 |
|
output ent_ord_bill, |
|
439 |
|
output ent_ord_ship, |
|
440 |
|
output ent_ord_line_part, |
|
441 |
|
output ent_ord_line_uom)" } |
|
442 |
|
if ent_ord_nbr <> "" then |
|
443 |
|
isDomOrder = true. |
|
444 |
|
|
|
445 |
|
run removeEmptyStrings. |
|
446 |
|
|
|
447 |
|
/* InvoiceCerification 20110405 : Fill the new variable with the invoice-certificate text that needs to be printed on the invoice for the Portugese decree-363 ; this will be printed on the forms defined in soivhfrm.i */ |
|
448 |
|
/* This text needs to be printed in portugese regardless the language used for the other parts of the print and regardless the langauge of the user. It can thus be that the user is working in English, the print is requested in Dutch but even in this scenario this fixed text should be in Portugese */ |
|
449 |
|
if ih__qadc05 <> "":U and |
|
450 |
|
ih__qadc05 <> ? and |
|
451 |
|
num-entries(ih__qadc05,chr(4)) = 2 |
|
452 |
|
then assign vcInvoiceCertificationText = trim(entry(2,ih__qadc05,chr(4))) + "-Processado por Programa Certificado n. ":U + trim(entry(1,ih__qadc05,chr(4))) + "/DGCI":U |
|
453 |
|
vcInvoiceYearVoucherNumber = substring(ih_inv_nbr,1,4) + substring(ih_inv_nbr,6,length(ih_inv_nbr) - 14) + "/" + substring(ih_inv_nbr,length(ih_inv_nbr) - 8). |
|
454 |
|
else assign vcInvoiceCertificationText = "":U |
|
455 |
|
vcInvoiceYearVoucherNumber = ih_inv_nbr. |
|
456 |
|
|
|
457 |
|
|
|
458 |
|
/* form frame phead1 & phead1ent PAGE-TOP FRAME DEFINITION */ |
|
459 |
|
/*d2561* {us/so/soivhfrm.i} */ |
|
460 |
|
/*d2561*/ {xxivhfrm.i} |
|
461 |
|
|
|
462 |
|
run GetHeading. |
|
463 |
|
if isDomOrder then |
|
464 |
|
view frame phead1ent. |
|
465 |
|
else |
|
466 |
|
view frame phead1. |
|
467 |
|
first-invoice = if first-of(ih_inv_nbr) then yes else no. |
|
468 |
|
|
|
469 |
|
for first cil_mstr |
|
470 |
|
where cil_domain = global_domain |
|
471 |
|
and cil_cor_inv = ih_inv_nbr |
|
472 |
|
and cil_cor_so_nbr = ih_nbr |
|
473 |
|
no-lock: |
|
474 |
|
end. /* FOR FIRST cil_mstr */ |
|
475 |
|
|
|
476 |
|
if available cil_mstr and not prt_cor then next. |
|
477 |
|
if first-invoice then page. |
|
478 |
|
if ih_fsm_type = "FSM-RO" then tax_tr_type = '16'. |
|
479 |
|
pages = page-number - 1. |
|
480 |
|
|
|
481 |
|
if (oldcurr <> ih_curr) or (oldcurr = "") then do: |
|
482 |
|
|
|
483 |
|
/* DETERMINE CURRENCY DISPLAY AMERICAN OR EUROPEAN */ |
|
484 |
|
find rnd_mstr where rnd_rnd_mthd = rndmthd |
|
485 |
|
no-lock no-error. |
|
486 |
|
|
|
487 |
|
if not available rnd_mstr then do: |
|
488 |
|
/* ROUND METHOD RECORD NOT FOUND */ |
|
489 |
|
{us/bbi/pxmsg.i &MSGNUM=863 &ERRORLEVEL=3} |
|
490 |
|
next. |
|
491 |
|
end. /* IF AVAIL rnd_mstr */ |
|
492 |
|
|
|
493 |
|
{us/so/socurfmt.i} |
|
494 |
|
|
|
495 |
|
/* SET CURRENCY DEPENDENT FORMATS */ |
|
496 |
|
prepaid_fmt = prepaid_old. |
|
497 |
|
|
|
498 |
|
{us/bbi/gprun.i ""gpcurfmt.p"" "(input-output prepaid_fmt, |
|
499 |
|
input rndmthd)"} |
|
500 |
|
oldcurr = ih_curr. |
|
501 |
|
end. /* IF (OLDCURR <> IH_CURR) */ |
|
502 |
|
|
|
503 |
|
if first-invoice then |
|
504 |
|
do for ih_hist: |
|
505 |
|
assign |
|
506 |
|
tot_prepaid_amt = 0 |
|
507 |
|
tot_ptax_amt = 0. |
|
508 |
|
for each ih_hist |
|
509 |
|
where ih_hist.ih_domain = global_domain |
|
510 |
|
and ih_hist.ih_inv_nbr = ih_buff.ih_inv_nbr |
|
511 |
|
exclusive-lock break by ih_inv_nbr: |
|
512 |
|
first_line = yes. |
|
513 |
|
/* PRINT INVOICES, CREDITS, OR BOTH */ |
|
514 |
|
|
|
515 |
|
if first-of(ih_inv_nbr) then do: |
|
516 |
|
/* INITIALIZE VARIABLES FOR INVOICE TOTALS.*/ |
|
517 |
|
{us/so/soivtot2.i} |
|
518 |
|
end. /* IF FIRST-OF ih_inv_nbr */ |
|
519 |
|
|
|
520 |
|
assign |
|
521 |
|
ih_recno = recid(ih_hist) |
|
522 |
|
base_rpt = ih_curr. |
|
523 |
|
|
|
524 |
|
assign |
|
525 |
|
rmaso = no |
|
526 |
|
sacontract = no. |
|
527 |
|
|
|
528 |
|
/* RMASO INDICATES AN RMA INVOICE */ |
|
529 |
|
if ih_fsm_type = "RMA" then |
|
530 |
|
rmaso = yes. |
|
531 |
|
|
|
532 |
|
/* SACONTRACT INDICATES A SERVICE CONTRACT INVOICE */ |
|
533 |
|
if ih_fsm_type = "SC" then |
|
534 |
|
sacontract = yes. |
|
535 |
|
/* IF "PRINT NO CHARGE RECEIPTS" (rmc_prt_rtn) IS NO, */ |
|
536 |
|
/* AND THE RMA INVOICE HAS ONLY ZERO PRICED RECEIPT */ |
|
537 |
|
/* LINES, THEN WE DON'T PRINT THE INVOICE. */ |
|
538 |
|
|
|
539 |
|
if available rmc_ctrl and |
|
540 |
|
not rmc_prt_rtn and |
|
541 |
|
rmaso |
|
542 |
|
then do: |
|
543 |
|
print_invoice = no. |
|
544 |
|
for each idh_hist |
|
545 |
|
where idh_domain = global_domain |
|
546 |
|
and idh_inv_nbr = ih_inv_nbr |
|
547 |
|
and idh_qty_inv <> 0 |
|
548 |
|
no-lock: |
|
549 |
|
|
|
550 |
|
if idh_price <> 0 or |
|
551 |
|
idh_rma_type <> "I" |
|
552 |
|
then |
|
553 |
|
print_invoice = yes. |
|
554 |
|
end. /* FOR EACH idh_hist */ |
|
555 |
|
|
|
556 |
|
if print_invoice = no then |
|
557 |
|
next. |
|
558 |
|
end. /* IF AVAIL rmc_ctrl */ |
|
559 |
|
|
|
560 |
|
{us/px/pxrun.i &PROC='getTermsDescription' &PROGRAM='adcrxr.p' |
|
561 |
|
&HANDLE=ph_adcrxr |
|
562 |
|
&PARAM="(input ih_cr_terms, |
|
563 |
|
output termsdesc)"} |
|
564 |
|
|
|
565 |
|
find ad_mstr |
|
566 |
|
where ad_domain = global_domain |
|
567 |
|
and ad_addr = ih_bill |
|
568 |
|
no-lock no-wait no-error. |
|
569 |
|
update billto = "". |
|
570 |
|
|
|
571 |
|
if available ad_mstr then do: |
|
572 |
|
|
|
573 |
|
/* Assign values to addr and format */ |
|
574 |
|
{us/mf/mfadfmt.i} |
|
575 |
|
|
|
576 |
|
for first cm_mstr where cm_domain = global_domain |
|
577 |
|
and cm_addr = ih_bill |
|
578 |
|
no-lock: end. |
|
579 |
|
|
|
580 |
|
/* Use bill-to country's format */ |
|
581 |
|
run setFormatForCountryCode in h_format |
|
582 |
|
(input cm_lang, |
|
583 |
|
input ad_mstr.ad_ctry). |
|
584 |
|
|
|
585 |
|
assign |
|
586 |
|
billto[1] = addr[1] |
|
587 |
|
billto[2] = addr[2] |
|
588 |
|
billto[3] = addr[3] |
|
589 |
|
billto[4] = addr[4] |
|
590 |
|
billto[5] = addr[5] |
|
591 |
|
billto[6] = addr[6]. |
|
592 |
|
|
|
593 |
|
hdr_po = getTermLabel("PURCHASE_ORDER",14) + ": " + ih_po. |
|
594 |
|
|
|
595 |
|
if addr[6] <> "" |
|
596 |
|
and ih_po = "" |
|
597 |
|
then |
|
598 |
|
billto[6] = addr[6]. |
|
599 |
|
|
|
600 |
|
end. /* IF AVAIL ad_mstr */ |
|
601 |
|
else do: |
|
602 |
|
for first usr_mstr |
|
603 |
|
where usr_userid = global_userid |
|
604 |
|
no-lock: |
|
605 |
|
end. |
|
606 |
|
/* Default to user's locale */ |
|
607 |
|
run setFormatForCountryCode in h_format |
|
608 |
|
(input global_user_lang, |
|
609 |
|
input usr_ctry_code). |
|
610 |
|
end. |
|
611 |
|
|
|
612 |
|
/*d2561* start added code >>> */ |
|
613 |
|
find ad_mstr where ad_domain = global_domain |
|
614 |
|
and ad_addr = ih_ship |
|
615 |
|
no-lock no-wait no-error. |
|
616 |
|
/*d2561* end added code <<< */ |
|
617 |
|
/*d2561* start deleted code >>> |
|
618 |
|
find ad_mstr where ad_domain = global_domain |
|
619 |
|
and ad_addr = ih_cust |
|
620 |
|
no-lock no-wait no-error. |
|
621 |
|
*d2561* end deleted code <<<< */ |
|
622 |
|
|
|
623 |
|
update soldto = "". |
|
624 |
|
|
|
625 |
|
if available ad_mstr then do: |
|
626 |
|
|
|
627 |
|
/* Assign values to addr and format */ |
|
628 |
|
{us/mf/mfadfmt.i} |
|
629 |
|
|
|
630 |
|
assign |
|
631 |
|
soldto[1] = addr[1] |
|
632 |
|
soldto[2] = addr[2] |
|
633 |
|
soldto[3] = addr[3] |
|
634 |
|
soldto[4] = addr[4] |
|
635 |
|
soldto[5] = addr[5] |
|
636 |
|
soldto[6] = addr[6]. |
|
637 |
|
|
|
638 |
|
find cm_mstr where cm_domain = global_domain |
|
639 |
|
and cm_addr = ih_cust |
|
640 |
|
no-lock no-error. |
|
641 |
|
if available cm_mstr then |
|
642 |
|
resale = cm_resale. |
|
643 |
|
else |
|
644 |
|
resale = "". |
|
645 |
|
end. /* IF AVAIL ad_mstr */ |
|
646 |
|
|
|
647 |
|
/* GET VAT REG NO AND COUNTRY CODE FOR SHIP-TO */ |
|
648 |
|
find ad_mstr where ad_domain = global_domain |
|
649 |
|
and ad_addr = ih_ship |
|
650 |
|
no-lock no-wait no-error. |
|
651 |
|
|
|
652 |
|
if available ad_mstr |
|
653 |
|
then do: |
|
654 |
|
|
|
655 |
|
vatreg1 = "". |
|
656 |
|
for first cm_mstr |
|
657 |
|
where cm_domain = global_domain |
|
658 |
|
and cm_addr = ih_cust |
|
659 |
|
no-lock: |
|
660 |
|
end. |
|
661 |
|
if available cm_mstr |
|
662 |
|
then |
|
663 |
|
vatreg1 = if ih_cust <> ih_ship |
|
664 |
|
then substring(ad_pst_id,1,15) |
|
665 |
|
else substring(cm_pst_id,1,15). |
|
666 |
|
|
|
667 |
|
if ad_pst_id = "" then do: |
|
668 |
|
find ad_mstr |
|
669 |
|
where ad_domain = global_domain |
|
670 |
|
and ad_addr = ih_bill |
|
671 |
|
no-lock no-wait no-error. |
|
672 |
|
|
|
673 |
|
if available ad_mstr then do: |
|
674 |
|
{us/gp/gpvteprg.i} |
|
675 |
|
end. /* IF AVAIL ad_mstr */ |
|
676 |
|
|
|
677 |
|
end. /* IF ad_pst_id = "" */ |
|
678 |
|
|
|
679 |
|
else do: |
|
680 |
|
{us/gp/gpvteprg.i} |
|
681 |
|
end. /* ELSE ad_pst_id <> "" */ |
|
682 |
|
|
|
683 |
|
end. /* IF AVAIL ad_mstr */ |
|
684 |
|
|
|
685 |
|
/* FOR RMAs, CHECK FOR CALL NUMBER */ |
|
686 |
|
hdr_call = "". |
|
687 |
|
|
|
688 |
|
if rmaso then |
|
689 |
|
hdr_call = call-lbl + ih_ca_nbr. |
|
690 |
|
|
|
691 |
|
/* Create/Update fiscal number cross-reference. It should be the */ |
|
692 |
|
/* last action before the invoice being actually printed. */ |
|
693 |
|
if not available soc_ctrl then |
|
694 |
|
find first soc_ctrl where soc_ctrl.soc_domain = global_domain |
|
695 |
|
no-lock no-error. |
|
696 |
|
if available soc_ctrl and |
|
697 |
|
soc_use_fnbr and |
|
698 |
|
update_fnbr |
|
699 |
|
then do: |
|
700 |
|
{us/gp/gprunp.i "soldfnbr" "p" "createFiscalNbrXref" |
|
701 |
|
"(input ih_buff.ih_inv_nbr, |
|
702 |
|
input ih_buff.ih_nbr, |
|
703 |
|
input fnbr_seq, |
|
704 |
|
output l_error)"} |
|
705 |
|
if l_error then do: |
|
706 |
|
next. |
|
707 |
|
end. |
|
708 |
|
end. |
|
709 |
|
|
|
710 |
|
/*d2561* start added code >>> */ |
|
711 |
|
for first Debtor no-lock |
|
712 |
|
where Debtor.DebtorCode = ih_cust, |
|
713 |
|
first BusinessRelation of Debtor no-lock, |
|
714 |
|
each Address no-lock |
|
715 |
|
where Address.BusinessRelation_ID = |
|
716 |
|
BusinessRelation.BusinessRelation_ID, |
|
717 |
|
first AddressType no-lock |
|
718 |
|
where AddressType.AddressType_ID = Address.AddressType_ID |
|
719 |
|
and AddressType.AddressTypeCode = "REMINDER" |
|
720 |
|
and AddressType.AddressTypeIsActive, |
|
721 |
|
first Contact no-lock |
|
722 |
|
where Contact.Address_ID = Address.Address_ID |
|
723 |
|
and Contact.ContactIsPrimary: |
|
724 |
|
vemail = Contact.ContactEmail. |
|
725 |
|
end. |
|
726 |
|
|
|
727 |
|
if not isDomOrder then |
|
728 |
|
form |
|
729 |
|
header |
|
730 |
|
getTermLabelRtColon("SALES_ORDER",15) format "x(15)" to 15 |
|
731 |
|
ih_nbr |
|
732 |
|
getTermLabelRtColon("SHIP_DATE",20) format "x(20)" to 55 |
|
733 |
|
ih_ship_date |
|
734 |
|
getTermLabelRtColon("ORDER_DATE",15) format "x(15)" to 15 |
|
735 |
|
ih_ord_date |
|
736 |
|
hdr_po to 78 no-label |
|
737 |
|
getTermLabelRtColon("SALESPERSON(S)",15) format "x(15)" to 15 |
|
738 |
|
ih_slspsn[1] |
|
739 |
|
ih_slspsn[2] |
|
740 |
|
getTermLabelRtColon("SHIP_TO",20) format "x(20)" to 55 |
|
741 |
|
ih_ship |
|
742 |
|
ih_slspsn[3] at 17 |
|
743 |
|
ih_slspsn[4] |
|
744 |
|
getTermLabelRtColon("SHIP_VIA",20) format "x(20)" to 55 |
|
745 |
|
ih_shipvia |
|
746 |
|
getTermLabelRtColon("CREDIT_TERMS",15) format "x(15)" to 15 |
|
747 |
|
ih_cr_terms |
|
748 |
|
|
|
749 |
|
getTermLabelRtColon("BOL",10) format "x(10)" to 55 |
|
750 |
|
ih_bol |
|
751 |
|
" " to 15 |
|
752 |
|
termsdesc |
|
753 |
|
getTermLabelRtColon("FOB_POINT",15) format "x(15)" to 55 |
|
754 |
|
ih_fob |
|
755 |
|
getTermLabelRtColon("RESALE",15) format "x(15)" to 15 |
|
756 |
|
resale |
|
757 |
|
hdr_call to 64 no-label |
|
758 |
|
getTermLabelRtColon("REMARKS",15) format "x(15)" to 15 |
|
759 |
|
ih_rmks |
|
760 |
|
" Sold-To Email:" format "x(15)" to 15 |
|
761 |
|
vemail |
|
762 |
|
skip(1) |
|
763 |
|
with frame phead2 width 90. |
|
764 |
|
/*d2561* end added code <<< */ |
|
765 |
|
/*d2561* start deleted code >>> |
|
766 |
|
if not isDomOrder then |
|
767 |
|
form |
|
768 |
|
header |
|
769 |
|
getTermLabelRtColon("SALES_ORDER",15) format "x(15)" to 15 |
|
770 |
|
ih_nbr |
|
771 |
|
getTermLabelRtColon("SHIP_DATE",20) format "x(20)" to 55 |
|
772 |
|
ih_ship_date |
|
773 |
|
getTermLabelRtColon("ORDER_DATE",15) format "x(15)" to 15 |
|
774 |
|
ih_ord_date |
|
775 |
|
hdr_po to 78 no-label |
|
776 |
|
getTermLabelRtColon("SALESPERSON(S)",15) format "x(15)" to 15 |
|
777 |
|
ih_slspsn[1] |
|
778 |
|
ih_slspsn[2] |
|
779 |
|
getTermLabelRtColon("SHIP_TO",20) format "x(20)" to 55 |
|
780 |
|
ih_ship |
|
781 |
|
ih_slspsn[3] at 17 |
|
782 |
|
ih_slspsn[4] |
|
783 |
|
getTermLabelRtColon("SHIP_VIA",20) format "x(20)" to 55 |
|
784 |
|
ih_shipvia |
|
785 |
|
getTermLabelRtColon("CREDIT_TERMS",15) format "x(15)" to 15 |
|
786 |
|
ih_cr_terms |
|
787 |
|
|
|
788 |
|
getTermLabelRtColon("BOL",10) format "x(10)" to 55 |
|
789 |
|
ih_bol |
|
790 |
|
" " to 15 |
|
791 |
|
termsdesc |
|
792 |
|
getTermLabelRtColon("FOB_POINT",15) format "x(15)" to 55 |
|
793 |
|
ih_fob |
|
794 |
|
getTermLabelRtColon("RESALE",15) format "x(15)" to 15 |
|
795 |
|
resale |
|
796 |
|
hdr_call to 64 no-label |
|
797 |
|
getTermLabelRtColon("REMARKS",15) format "x(15)" to 15 |
|
798 |
|
ih_rmks skip (1) |
|
799 |
|
with frame phead2 width 90. |
|
800 |
|
*d2561* end deleted code <<< */ |
|
801 |
|
{&d2561-tag-1000} /* new form definition */ |
|
802 |
|
else |
|
803 |
|
form |
|
804 |
|
header |
|
805 |
|
getTermLabelRtColon("SALES_ORDER",15) format "x(15)" to 17 |
|
806 |
|
ih_nbr |
|
807 |
|
getTermLabelRtColon("SHIP_DATE",20) format "x(20)" to 57 |
|
808 |
|
ih_ship_date |
|
809 |
|
getTermLabelRtColon("ORDER_DATE",15) format "x(15)" to 17 |
|
810 |
|
ih_ord_date |
|
811 |
|
hdr_po to 80 no-label |
|
812 |
|
getTermLabelRtColon("ENTERPRISE_ORDER_NUMBER",17) format "x(17)" to 17 |
|
813 |
|
ent_ord_nbr |
|
814 |
|
getTermLabelRtColon("SALESPERSON(S)",15) format "x(15)" to 17 |
|
815 |
|
ih_slspsn[1] |
|
816 |
|
ih_slspsn[2] |
|
817 |
|
getTermLabelRtColon("SHIP-TO",20) format "x(20)" to 57 |
|
818 |
|
ih_ship |
|
819 |
|
ih_slspsn[3] at 19 |
|
820 |
|
ih_slspsn[4] |
|
821 |
|
getTermLabelRtColon("SHIP_VIA",20) format "x(20)" to 57 |
|
822 |
|
ih_shipvia |
|
823 |
|
getTermLabelRtColon("CREDIT_TERMS",15) format "x(15)" to 17 |
|
824 |
|
ih_cr_terms |
|
825 |
|
getTermLabelRtColon("BOL",10) format "x(10)" to 57 |
|
826 |
|
ih_bol |
|
827 |
|
" " to 17 |
|
828 |
|
termsdesc |
|
829 |
|
getTermLabelRtColon("FOB_POINT",15) format "x(15)" to 57 |
|
830 |
|
ih_fob |
|
831 |
|
getTermLabelRtColon("RESALE",15) format "x(15)" to 17 |
|
832 |
|
resale |
|
833 |
|
hdr_call to 64 no-label |
|
834 |
|
getTermLabelRtColon("REMARKS",15) format "x(15)" to 17 |
|
835 |
|
ih_rmks skip (1) |
|
836 |
|
with frame phead2ent width 90. |
|
837 |
|
|
|
838 |
|
form header |
|
839 |
|
fill ("-",77)format "x(77)" skip space (31) |
|
840 |
|
c-cont |
|
841 |
|
skip(8) |
|
842 |
|
with frame continue page-bottom width 80. |
|
843 |
|
|
|
844 |
|
form |
|
845 |
|
vcCreditCardMsg[1] skip |
|
846 |
|
vcCreditCardMsg[2] skip |
|
847 |
|
vcCreditCardMsg[3] |
|
848 |
|
with frame soccmsg no-labels width 132. |
|
849 |
|
|
|
850 |
|
/* **NOTE: THE CUSTOMER HAS PROMISED TO PAY USING A CREDIT CARD */ |
|
851 |
|
{us/bbi/pxmsg.i &MSGNUM=3867 &ERRORLEVEL=1 &MSGBUFFER=vcCreditCardMsg[1]} |
|
852 |
|
/* THE CARD USED AT ORDER TIME WILL BE PROCESSED FOR PAYMENT */ |
|
853 |
|
{us/bbi/pxmsg.i &MSGNUM=3868 &ERRORLEVEL=1 &MSGBUFFER=vcCreditCardMsg[2]} |
|
854 |
|
/* CUSTOMER IS RESPONSIBLE FOR PAYMENT IF CREDIT CARD IS DENIED */ |
|
855 |
|
{us/bbi/pxmsg.i &MSGNUM=3869 &ERRORLEVEL=1 &MSGBUFFER=vcCreditCardMsg[3]} |
|
856 |
|
|
|
857 |
|
/* PRINT LINE ITEMS */ |
|
858 |
|
|
|
859 |
|
if first-of(ih_inv_nbr) then do: |
|
860 |
|
/* INITIALIZE VARIABLES FOR INVOICE TOTALS.*/ |
|
861 |
|
{us/so/soivtot2.i} |
|
862 |
|
view frame continue. |
|
863 |
|
if not isDomOrder then |
|
864 |
|
view frame phead2. |
|
865 |
|
else |
|
866 |
|
view frame phead2ent. |
|
867 |
|
|
|
868 |
|
if ih_fsm_type = "SC" then do: |
|
869 |
|
|
|
870 |
|
svremarks = getTermLabel("FOR_PERIOD",25) + ": " |
|
871 |
|
+ string(ih_req_date,"99/99/99") + " " |
|
872 |
|
+ getTermLabel("TO",10) + ": " |
|
873 |
|
+ string(ih_due_date,"99/99/99"). |
|
874 |
|
put svremarks at 15. |
|
875 |
|
|
|
876 |
|
svremarks = getTermLabel("SERVICE_CONTRACT",30) + ": " |
|
877 |
|
+ ih_sa_nbr. |
|
878 |
|
put svremarks at 15. |
|
879 |
|
end. /* IF ih_fsm_type = "SC" */ |
|
880 |
|
|
|
881 |
|
run PrintHeaderComment(input ih_cmtindx, |
|
882 |
|
input vcPriHeadComment). |
|
883 |
|
put skip(1). |
|
884 |
|
/* IF THIS INVOICE IS FOR AN RMA WHICH REFERENCES */ |
|
885 |
|
/* A CALL, PRINT HEADER COMMENTS FROM THAT CALL */ |
|
886 |
|
|
|
887 |
|
if rmaso then do: |
|
888 |
|
/* NOTE: CA_CATEGORY = "0" FOR CALLS, AND */ |
|
889 |
|
/* "QUOTE" FOR CALL QUOTES. */ |
|
890 |
|
find first ca_mstr |
|
891 |
|
where ca_domain = global_domain |
|
892 |
|
and ca_nbr = ih_ca_nbr |
|
893 |
|
and ca_category = "0" |
|
894 |
|
no-lock no-error. |
|
895 |
|
|
|
896 |
|
if available ca_mstr then do: |
|
897 |
|
put skip(1). |
|
898 |
|
run PrintHeaderComment(input ca_cmtindx, |
|
899 |
|
input vcPriHeadComment). |
|
900 |
|
end. /* IF AVAIL ca_mstr */ |
|
901 |
|
else do: |
|
902 |
|
find first chm_mstr |
|
903 |
|
where chm_domain = global_domain |
|
904 |
|
and chm_nbr = ih_ca_nbr |
|
905 |
|
and chm_category = "0" |
|
906 |
|
no-lock no-error. |
|
907 |
|
|
|
908 |
|
if available chm_mstr then do: |
|
909 |
|
put skip(1). |
|
910 |
|
run PrintHeaderComment(input chm_cmtindx, |
|
911 |
|
input vcPriHeadComment). |
|
912 |
|
end. /* IF AVAIL chm_mstr */ |
|
913 |
|
end. /* ELSE NOT AVAIL ca_mstr */ |
|
914 |
|
end. /* IF rmaso */ |
|
915 |
|
|
|
916 |
|
if disc_det_key <> "1" then do: |
|
917 |
|
|
|
918 |
|
run getTranslation(input disc_det_key, |
|
919 |
|
output translation). |
|
920 |
|
|
|
921 |
|
disc_prnt_label = translation. |
|
922 |
|
end. /* IF disc_det_key <> "1" */ |
|
923 |
|
/* FOURTH AND FIFTH OUTPUT PARAMETERS ARE ADDED FOR |
|
924 |
|
CALCULATING TAXABLE AND NON TAXABLE LINE AND CONTAINER |
|
925 |
|
CHARGES */ |
|
926 |
|
/*d2561* {us/bbi/gprun.i ""soivrp1a.p"" */ |
|
927 |
|
/*d2561*/ {us/bbi/gprun.i ""xxivrp1a.p"" |
|
928 |
|
"(output invtot_container_amt, |
|
929 |
|
output invtot_linecharge_amt, |
|
930 |
|
input-output l_nontax_amt, |
|
931 |
|
input-output l_tax_amt)"} |
|
932 |
|
|
|
933 |
|
assign |
|
934 |
|
invtot_line_total = invtot_line_total + |
|
935 |
|
invtot_container_amt + |
|
936 |
|
invtot_linecharge_amt |
|
937 |
|
invtot_ord_amt = invtot_ord_amt + |
|
938 |
|
invtot_container_amt + |
|
939 |
|
invtot_linecharge_amt. |
|
940 |
|
if not isDomOrder then |
|
941 |
|
hide frame phead2. |
|
942 |
|
else |
|
943 |
|
hide frame phead2ent. |
|
944 |
|
|
|
945 |
|
hide frame continue. |
|
946 |
|
end. /* IF FIRST-OF ih_inv_nbr */ |
|
947 |
|
|
|
948 |
|
/*Check if this is a credit card order*/ |
|
949 |
|
{us/gp/gprunp.i "gpccpl" "p" "isCCOrder" |
|
950 |
|
"(input ih_nbr, output vlResult)"} |
|
951 |
|
/*If it is view credit card message frame*/ |
|
952 |
|
if vlResult then |
|
953 |
|
display vcCreditCardMsg with frame soccmsg. |
|
954 |
|
|
|
955 |
|
if disc_sum_key <> "1" and |
|
956 |
|
disc_sum_key <> disc_det_key |
|
957 |
|
then do: |
|
958 |
|
run getTranslation(input disc_sum_key, |
|
959 |
|
output translation). |
|
960 |
|
|
|
961 |
|
disc_prnt_label = translation. |
|
962 |
|
|
|
963 |
|
end. /* IF disc_sum_key <> "1" */ |
|
964 |
|
|
|
965 |
|
/* PRINT DISCOUNT SUMMARY, DELETE DISC WKFL RECORDS */ |
|
966 |
|
{us/so/sopiprn2.i} |
|
967 |
|
assign |
|
968 |
|
tot_prepaid_amt = tot_prepaid_amt + ih_hist.ih_prepaid |
|
969 |
|
tot_ptax_amt = tot_ptax_amt + ih_hist.ih_prep_tax. |
|
970 |
|
|
|
971 |
|
/* TRAILER */ |
|
972 |
|
/* (Only display trailer after all SOs for this invoice */ |
|
973 |
|
/* have been printed.) */ |
|
974 |
|
|
|
975 |
|
if not last-of(ih_inv_nbr) |
|
976 |
|
then do: |
|
977 |
|
l_conso = yes. |
|
978 |
|
{us/bbi/gprun.i ""soihtrl2.p"" "(input l_conso)"} |
|
979 |
|
|
|
980 |
|
/* ACCUMULATE TRAILER TOTALS USING SOIVTOT9.I */ |
|
981 |
|
run p-acc-totals (buffer ih_hist, |
|
982 |
|
input-output invtot_nontaxable_amt, |
|
983 |
|
input-output invtot_taxable_amt, |
|
984 |
|
input-output invtot_line_total, |
|
985 |
|
input-output invtot_disc_amt, |
|
986 |
|
input-output invtot_trl1_amt, |
|
987 |
|
input-output invtot_trl2_amt, |
|
988 |
|
input-output invtot_trl3_amt, |
|
989 |
|
input-output invtot_tax_amt, |
|
990 |
|
input-output invtot_ord_amt, |
|
991 |
|
input-output invtot_container_amt, |
|
992 |
|
input-output invtot_linecharge_amt) . |
|
993 |
|
|
|
994 |
|
end. /* IF NOT LAST-OF(IH_INV_NBR) */ |
|
995 |
|
|
|
996 |
|
if update_invoice |
|
997 |
|
and ih_hist.ih_invoiced = false |
|
998 |
|
then do: |
|
999 |
|
ih_hist.ih_invoiced = true. |
|
1000 |
|
end. |
|
1001 |
|
|
|
1002 |
|
if last-of(ih_inv_nbr) then do: |
|
1003 |
|
|
|
1004 |
|
undo_txdetrp = true. |
|
1005 |
|
|
|
1006 |
|
/* ADDED SIXTH INPUT PARAMETER '' AND SEVENTH INPUT */ |
|
1007 |
|
/* PARAMETER yes TO ACCOMMODATE THE LOGIC INTRODUCED IN */ |
|
1008 |
|
/* txdetrpa.i FOR DISPLAYING THE APPROPRIATE CURRENCY */ |
|
1009 |
|
/* AMOUNT. */ |
|
1010 |
|
|
|
1011 |
|
{us/bbi/gprun.i ""txdetrp.p"" "(input tax_tr_type, |
|
1012 |
|
input ih_inv_nbr, |
|
1013 |
|
input '*', |
|
1014 |
|
input col-80, |
|
1015 |
|
input 10, |
|
1016 |
|
input '', |
|
1017 |
|
input yes)" } |
|
1018 |
|
|
|
1019 |
|
/* OBTAINING TOTAL INCLUDED TAX FOR THE TRANSACTION */ |
|
1020 |
|
{us/bbi/gprun.i ""txtotal1.p"" "(input '16', |
|
1021 |
|
input ih_inv_nbr, |
|
1022 |
|
input '*', |
|
1023 |
|
input 0, |
|
1024 |
|
output l_tax_in)"} |
|
1025 |
|
|
|
1026 |
|
{us/bbi/gprun.i ""soihtrl2.p"" "(input l_conso)"} |
|
1027 |
|
/* OBTAINING TOTAL TAX AMOUNT FOR THE INVOICE */ |
|
1028 |
|
{us/bbi/gprun.i ""txtotal.p"" "(input '16', |
|
1029 |
|
input ih_inv_nbr, |
|
1030 |
|
input '*', |
|
1031 |
|
input 0, |
|
1032 |
|
output tax_amt)" } |
|
1033 |
|
|
|
1034 |
|
/* ADJUSTING TOTAL TAX AMOUNT BY INCLUDED TAX */ |
|
1035 |
|
assign |
|
1036 |
|
tax_amt = tax_amt + l_tax_in |
|
1037 |
|
ord_amt = ord_amt + tax_amt. |
|
1038 |
|
|
|
1039 |
|
/* ACCUMULATE TRAILER TOTALS USING SOIVTOT9.I */ |
|
1040 |
|
run p-acc-totals (buffer ih_hist, |
|
1041 |
|
input-output invtot_nontaxable_amt, |
|
1042 |
|
input-output invtot_taxable_amt, |
|
1043 |
|
input-output invtot_line_total, |
|
1044 |
|
input-output invtot_disc_amt, |
|
1045 |
|
input-output invtot_trl1_amt, |
|
1046 |
|
input-output invtot_trl2_amt, |
|
1047 |
|
input-output invtot_trl3_amt, |
|
1048 |
|
input-output invtot_tax_amt, |
|
1049 |
|
input-output invtot_ord_amt, |
|
1050 |
|
input-output invtot_container_amt, |
|
1051 |
|
input-output invtot_linecharge_amt) . |
|
1052 |
|
|
|
1053 |
|
if ih_curr <> base_curr and isEUtransaction(ih_site, ih_cust) then do: |
|
1054 |
|
assign l_basetaxtot = 0. |
|
1055 |
|
|
|
1056 |
|
for each tx2d_det where tx2d_domain = global_domain |
|
1057 |
|
and tx2d_ref = ih_inv_nbr |
|
1058 |
|
and tx2d_nbr = ih_nbr |
|
1059 |
|
and tx2d_tr_type = tax_tr_type |
|
1060 |
|
and tx2d_tax_code <> "00000000" |
|
1061 |
|
no-lock: |
|
1062 |
|
assign l_basetaxtot = l_basetaxtot + tx2d_tax_amt. |
|
1063 |
|
end. |
|
1064 |
|
|
|
1065 |
|
{us/so/soivto11.i |
|
1066 |
|
&totaltaxbase=l_basetaxtot |
|
1067 |
|
&totaltax=invtot_tax_amt |
|
1068 |
|
&socurr=ih_curr |
|
1069 |
|
&eusite=ih_site |
|
1070 |
|
&eubill=ih_bill |
|
1071 |
|
&base_only=no |
|
1072 |
|
&linepos=38 |
|
1073 |
|
&labelpos=23} |
|
1074 |
|
end. |
|
1075 |
|
|
|
1076 |
|
if l_tax_in <> 0 and l_conso |
|
1077 |
|
then do: |
|
1078 |
|
line_total = invtot_line_total. |
|
1079 |
|
|
|
1080 |
|
{us/gp/gprunp.i "sopl" "p" "adjustDiscountAmount" |
|
1081 |
|
"(input invtot_taxable_amt - l_tax_in, |
|
1082 |
|
input invtot_nontaxable_amt, |
|
1083 |
|
input invtot_trl1_amt, |
|
1084 |
|
input invtot_trl2_amt, |
|
1085 |
|
input invtot_trl3_amt, |
|
1086 |
|
input invtot_line_total, |
|
1087 |
|
input-output disc_amt)"} |
|
1088 |
|
end. /* IF l_tax_in <> 0 and ...*/ |
|
1089 |
|
|
|
1090 |
|
assign |
|
1091 |
|
l_conso = no |
|
1092 |
|
l_tax_in = 0. |
|
1093 |
|
|
|
1094 |
|
if can-find(mfc_ctrl where mfc_domain = global_domain |
|
1095 |
|
and mfc_module = "SO" |
|
1096 |
|
and mfc_seq = 170) |
|
1097 |
|
then do: |
|
1098 |
|
view frame continue. |
|
1099 |
|
{us/so/soivtotb.i} |
|
1100 |
|
hide frame continue. |
|
1101 |
|
end. /* FOUND mfc_ctrl RECORD */ |
|
1102 |
|
|
|
1103 |
|
add-trl-length = if tot_prepaid_amt <> 0 then |
|
1104 |
|
3 |
|
1105 |
|
else 0. |
|
1106 |
|
|
|
1107 |
|
if page-size - line-counter < 12 + add-trl-length |
|
1108 |
|
then do: |
|
1109 |
|
view frame continue. |
|
1110 |
|
page. |
|
1111 |
|
hide frame continue. |
|
1112 |
|
end. /* IF page-size - line-counter < 12 */ |
|
1113 |
|
|
|
1114 |
|
do while page-size - line-counter > 12 + add-trl-length: |
|
1115 |
|
put skip(1). |
|
1116 |
|
end. /* DO WHILE page-size - line-counter > 12 */ |
|
1117 |
|
|
|
1118 |
|
put msg skip. |
|
1119 |
|
|
|
1120 |
|
put fill("-",77) format "x(77)" skip. |
|
1121 |
|
currdisp = ih_curr. |
|
1122 |
|
|
|
1123 |
|
/* DETERMINE IF THIS INVOICE IS A CONSOLIDATED INVOICE WHICH */ |
|
1124 |
|
/* WAS CONSOLIDATED FROM A DOM GLOBAL ORDER */ |
|
1125 |
|
if isDomOrder = true |
|
1126 |
|
then do: |
|
1127 |
|
{us/bbi/gprun.i ""soivdom1.p"" |
|
1128 |
|
"(input 'ih_hist', |
|
1129 |
|
input ih_inv_nbr, |
|
1130 |
|
output so-trl1-cd, |
|
1131 |
|
output so-trl2-cd, |
|
1132 |
|
output so-trl3-cd, |
|
1133 |
|
output isConsolDom)"} |
|
1134 |
|
end. |
|
1135 |
|
|
|
1136 |
|
/* Calculate SC amount of total tax */ |
|
1137 |
|
tax_sc_amt = invtot_tax_amt. |
|
1138 |
|
if ih_curr <> g_mgmt_curr then do: |
|
1139 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-conv" |
|
1140 |
|
"(input ih_curr, |
|
1141 |
|
input g_mgmt_curr, |
|
1142 |
|
input ih_mgmt_ex_rate, |
|
1143 |
|
input ih_mgmt_ex_rate2, |
|
1144 |
|
input tax_sc_amt, |
|
1145 |
|
input true, /* ROUND */ |
|
1146 |
|
output tax_sc_amt, |
|
1147 |
|
output mc-error-number)"} |
|
1148 |
|
if mc-error-number <> 0 then do: |
|
1149 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
1150 |
|
end. |
|
1151 |
|
end. |
|
1152 |
|
|
|
1153 |
|
/* SET CURRENCY DEPENDENT FORMATS */ |
|
1154 |
|
assign |
|
1155 |
|
nontaxable_amt:format in frame ihtot = nontax_fmt |
|
1156 |
|
taxable_amt:format in frame ihtot = taxable_fmt |
|
1157 |
|
line_total:format in frame ihtot = line_tot_fmt |
|
1158 |
|
disc_amt:format in frame ihtot = disc_fmt |
|
1159 |
|
ih_trl1_amt:format in frame ihtot = trl_amt_fmt |
|
1160 |
|
ih_trl2_amt:format in frame ihtot = trl_amt_fmt |
|
1161 |
|
ih_trl3_amt:format in frame ihtot = trl_amt_fmt |
|
1162 |
|
tax_amt:format in frame ihtot = tax_amt_fmt |
|
1163 |
|
container_charge_total:format in frame ihtot = container_fmt |
|
1164 |
|
line_charge_total:format in frame ihtot = line_charge_fmt |
|
1165 |
|
ord_amt:format in frame ihtot = ord_amt_fmt. |
|
1166 |
|
|
|
1167 |
|
/*d2561* {us/so/soivto10.i} */ |
|
1168 |
|
/*d2561* start added code >>> */ |
|
1169 |
|
/* Calculate Trailer Tax */ |
|
1170 |
|
assign |
|
1171 |
|
tr1pct = gettrltaxpct(ih_inv_nbr, ih_trl1_cd) |
|
1172 |
|
tr1tax = gettrltaxamt(ih_inv_nbr, ih_trl1_cd) |
|
1173 |
|
tr2pct = gettrltaxpct(ih_inv_nbr, ih_trl2_cd) |
|
1174 |
|
tr2tax = gettrltaxamt(ih_inv_nbr, ih_trl2_cd) |
|
1175 |
|
tr3pct = gettrltaxpct(ih_inv_nbr, ih_trl3_cd) |
|
1176 |
|
tr3tax = gettrltaxamt(ih_inv_nbr, ih_trl3_cd) |
|
1177 |
|
. |
|
1178 |
|
{xxivto10.i} |
|
1179 |
|
/*d2561* end added code <<< */ |
|
1180 |
|
if tot_prepaid_amt <> 0 |
|
1181 |
|
then do: |
|
1182 |
|
price_fmt = "-zzzz,zzz,zz9.99". |
|
1183 |
|
{us/bbi/gprun.i ""gpcurfmt.p"" "(input-output price_fmt, |
|
1184 |
|
input rndmthd)"} |
|
1185 |
|
|
|
1186 |
|
assign |
|
1187 |
|
tot_prepaid_amt:format in frame ihprepd = price_fmt |
|
1188 |
|
tot_ptax_amt:format in frame ihprepd = price_fmt |
|
1189 |
|
tot_prepaid_nett:format in frame ihprepd = price_fmt |
|
1190 |
|
amt_due_af_prep:format in frame ihprepd = price_fmt |
|
1191 |
|
tot_prepaid_nett = tot_prepaid_amt + tot_ptax_amt |
|
1192 |
|
amt_due_af_prep = invtot_ord_amt - tot_prepaid_nett. |
|
1193 |
|
|
|
1194 |
|
display |
|
1195 |
|
tot_prepaid_amt |
|
1196 |
|
tot_ptax_amt |
|
1197 |
|
tot_prepaid_nett |
|
1198 |
|
amt_due_af_prep |
|
1199 |
|
with frame ihprepd. |
|
1200 |
|
|
|
1201 |
|
end. /* IF tot_prepaid_amt <> 0 */ |
|
1202 |
|
|
|
1203 |
|
end. /* IF LAST-OF ih_inv_nbr */ |
|
1204 |
|
|
|
1205 |
|
end. /* FOR EACH ih_hist */ |
|
1206 |
|
end. /* DO FOR ih_hist */ |
|
1207 |
|
end. /* FOR EACH ih_buff */ |
|
1208 |
|
|
|
1209 |
|
end. /* MAINLOOP */ |
|
1210 |
|
|
|
1211 |
|
run resetFormat in h_format. |
|
1212 |
|
delete procedure h_format no-error. |
|
1213 |
|
|
|
1214 |
|
|
|
1215 |
|
PROCEDURE p-get-ord-amt: |
|
1216 |
|
/* THIS PROCEDURE IS DERIVED FROM SOIHTRL2.P AND */ |
|
1217 |
|
/* OBTAINS THE TOTAL INVOICE VALUE */ |
|
1218 |
|
|
|
1219 |
|
define input parameter p_inv_nbr as character no-undo. |
|
1220 |
|
define output parameter l_ord_amt as decimal |
|
1221 |
|
format "-zzzz,zzz,z99.99" no-undo. |
|
1222 |
|
|
|
1223 |
|
/* LOCAL VARIABLES */ |
|
1224 |
|
define variable l_ext_actual like idh_price no-undo. |
|
1225 |
|
define variable l_tmp_amt as decimal no-undo. |
|
1226 |
|
define variable mc-error-number like msg_nbr no-undo. |
|
1227 |
|
|
|
1228 |
|
define buffer ih_hist for ih_hist. |
|
1229 |
|
|
|
1230 |
|
assign |
|
1231 |
|
line_total = 0 |
|
1232 |
|
taxable_amt = 0. |
|
1233 |
|
|
|
1234 |
|
for each ih_hist |
|
1235 |
|
where ih_domain = global_domain |
|
1236 |
|
and ih_inv_nbr = p_inv_nbr |
|
1237 |
|
no-lock |
|
1238 |
|
break by ih_inv_nbr: |
|
1239 |
|
|
|
1240 |
|
empty temp-table t_store_ext_actual no-error. |
|
1241 |
|
|
|
1242 |
|
assign |
|
1243 |
|
line_total = 0 |
|
1244 |
|
l_ord_contains_tax_in_lines = can-find (first idh_hist |
|
1245 |
|
where idh_domain = global_domain |
|
1246 |
|
and idh_inv_nbr = ih_inv_nbr |
|
1247 |
|
and idh_nbr = ih_nbr |
|
1248 |
|
and idh_taxable |
|
1249 |
|
and idh_tax_in) |
|
1250 |
|
taxable_amt = 0. |
|
1251 |
|
|
|
1252 |
|
/* sotrhstb.p CREATES TEMP-TABLE TO STORE tr_hist RECORDS AND RETRIEVE */ |
|
1253 |
|
/* THE SAME IN soauthbl.p TO IMPROVE THE PERFORMANCE WHILE PRINTING */ |
|
1254 |
|
/* AUTHORIZATION NUMBERS FOR SCHEDULE ORDERS. */ |
|
1255 |
|
|
|
1256 |
|
if ((ih_sched = yes |
|
1257 |
|
and can-find(first idh_hist |
|
1258 |
|
where idh_domain = global_domain |
|
1259 |
|
and idh_inv_nbr = ih_inv_nbr |
|
1260 |
|
and idh_nbr = ih_nbr |
|
1261 |
|
and idh__qadc06 = "yes")) |
|
1262 |
|
or print_lotserials) |
|
1263 |
|
and not can-find(first t_tr_hist1 |
|
1264 |
|
where t_tr_nbr = ih_nbr) |
|
1265 |
|
then do: |
|
1266 |
|
|
|
1267 |
|
{us/bbi/gprun.i ""sotrhstb.p"" |
|
1268 |
|
"(input ih_nbr, |
|
1269 |
|
input ih_inv_nbr, |
|
1270 |
|
input-output table t_tr_hist1)"} |
|
1271 |
|
|
|
1272 |
|
end. /* IF ih_sched ... */ |
|
1273 |
|
|
|
1274 |
|
for each idh_hist |
|
1275 |
|
fields( idh_domain idh_inv_nbr idh_nbr idh_price |
|
1276 |
|
idh_tax_in idh_sched idh_line |
|
1277 |
|
idh_qty_inv idh_rma_type idh_taxable |
|
1278 |
|
idh__qadc06 idh_part idh_site) |
|
1279 |
|
where idh_domain = global_domain |
|
1280 |
|
and idh_inv_nbr = ih_inv_nbr |
|
1281 |
|
and idh_nbr = ih_nbr |
|
1282 |
|
no-lock: |
|
1283 |
|
|
|
1284 |
|
l_ext_actual = idh_price * idh_qty_inv. |
|
1285 |
|
|
|
1286 |
|
/* ROUND PER DOCUMENT CURRENCY ROUND METHOD */ |
|
1287 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1288 |
|
"(input-output l_ext_actual, |
|
1289 |
|
input rndmthd, |
|
1290 |
|
output mc-error-number)" } |
|
1291 |
|
if mc-error-number <> 0 |
|
1292 |
|
then do: |
|
1293 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
1294 |
|
end. |
|
1295 |
|
|
|
1296 |
|
/* CHECK AUTHORIZATION RECORDS FOR DIFFERENT EXT PRICE */ |
|
1297 |
|
if idh_sched = yes |
|
1298 |
|
and idh__qadc06 = "yes" |
|
1299 |
|
then do: |
|
1300 |
|
|
|
1301 |
|
auth_found = no. |
|
1302 |
|
|
|
1303 |
|
{us/bbi/gprun.i ""soauthbl.p"" |
|
1304 |
|
"(input table t_tr_hist1, |
|
1305 |
|
input idh_inv_nbr, |
|
1306 |
|
input idh__qadc06, |
|
1307 |
|
input idh_nbr, |
|
1308 |
|
input idh_line, |
|
1309 |
|
input idh_price, |
|
1310 |
|
input idh_site, |
|
1311 |
|
input l_ext_actual, |
|
1312 |
|
output auth_price, |
|
1313 |
|
output auth_found)"} |
|
1314 |
|
|
|
1315 |
|
l_ext_actual = auth_price. |
|
1316 |
|
|
|
1317 |
|
end. /*IF idh_sched */ |
|
1318 |
|
|
|
1319 |
|
for first t_store_ext_actual |
|
1320 |
|
where t_line = idh_line |
|
1321 |
|
no-lock: |
|
1322 |
|
end. /* FOR FIRST t_store_ext_actual ... */ |
|
1323 |
|
|
|
1324 |
|
if not available t_store_ext_actual |
|
1325 |
|
then do: |
|
1326 |
|
create t_store_ext_actual. |
|
1327 |
|
assign |
|
1328 |
|
t_line = idh_line |
|
1329 |
|
t_ext_actual = l_ext_actual. |
|
1330 |
|
end. /* IF NOT AVAILABLE t_store_ext_actual ... */ |
|
1331 |
|
|
|
1332 |
|
if l_ord_contains_tax_in_lines = no |
|
1333 |
|
then |
|
1334 |
|
line_total = line_total + l_ext_actual. |
|
1335 |
|
|
|
1336 |
|
if idh_taxable |
|
1337 |
|
then |
|
1338 |
|
taxable_amt = taxable_amt + l_ext_actual. |
|
1339 |
|
|
|
1340 |
|
end. /* FOR EACH idh_hist */ |
|
1341 |
|
|
|
1342 |
|
empty temp-table t_tr_hist1. |
|
1343 |
|
|
|
1344 |
|
if l_ord_contains_tax_in_lines = no |
|
1345 |
|
then |
|
1346 |
|
disc_amt = (- line_total * (ih_disc_pct / 100)). |
|
1347 |
|
|
|
1348 |
|
/* ROUND PER DOCUMENT CURRENCY ROUND METHOD */ |
|
1349 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1350 |
|
"(input-output disc_amt, |
|
1351 |
|
input rndmthd, |
|
1352 |
|
output mc-error-number)" } |
|
1353 |
|
|
|
1354 |
|
if mc-error-number <> 0 |
|
1355 |
|
then do: |
|
1356 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
1357 |
|
end. |
|
1358 |
|
|
|
1359 |
|
l_tmp_amt = taxable_amt * ih_disc_pct / 100. |
|
1360 |
|
|
|
1361 |
|
/* ROUND PER DOCUMENT CURRENCY ROUND METHOD */ |
|
1362 |
|
|
|
1363 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1364 |
|
"(input-output l_tmp_amt, |
|
1365 |
|
input rndmthd, |
|
1366 |
|
output mc-error-number)" } |
|
1367 |
|
if mc-error-number <> 0 |
|
1368 |
|
then do: |
|
1369 |
|
/* ROUNDING METHOD DOES NOT EXIST */ |
|
1370 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
1371 |
|
end. /* IF mc-error-number <> 0 */ |
|
1372 |
|
|
|
1373 |
|
taxable_amt = taxable_amt - l_tmp_amt. |
|
1374 |
|
|
|
1375 |
|
/* ALL PROCEDURES USED FOR CALCULATING VARIOUS TOTALS */ |
|
1376 |
|
/* PERTAINING TO THE INVOICE ARE CLUBBED TOGETHER AND WOULD BE*/ |
|
1377 |
|
/* RUN ONLY ONCE WITHIN THE ih_hist loop, SO THAT THEY GET */ |
|
1378 |
|
/* ADDED CORRECTLY TO l_ord_amt */ |
|
1379 |
|
|
|
1380 |
|
if last-of(ih_inv_nbr) |
|
1381 |
|
then do: |
|
1382 |
|
|
|
1383 |
|
/* OBTAIN INVOICE TOTAL TAX */ |
|
1384 |
|
{us/bbi/gprun.i ""txtotal.p"" |
|
1385 |
|
"(input '16', |
|
1386 |
|
input ih_inv_nbr, |
|
1387 |
|
input '*', |
|
1388 |
|
input 0, /* ALL LINES */ |
|
1389 |
|
output tax_amt)"} |
|
1390 |
|
|
|
1391 |
|
/* OBTAINING TOTAL INCLUDED TAX FOR THE TRANSACTION */ |
|
1392 |
|
{us/bbi/gprun.i ""txtotal1.p"" |
|
1393 |
|
"(input '16', |
|
1394 |
|
input ih_inv_nbr, |
|
1395 |
|
input '*', |
|
1396 |
|
input 0, |
|
1397 |
|
output l_tax_in)"} |
|
1398 |
|
|
|
1399 |
|
/* WHEN TAX DETAIL RECORDS ARE NOT AVAILABLE AND SO IS */ |
|
1400 |
|
/* TAXABLE THEN USE THE PROCEDURE TO CALCULATE ORDER */ |
|
1401 |
|
/* TOTAL AND DISCOUNT */ |
|
1402 |
|
|
|
1403 |
|
/* WHEN TAX INCLUDED IS YES, ORDER DISCOUNT SHOULD BE */ |
|
1404 |
|
/* CALCULATED ON THE ORDER TOTAL AFTER REDUCING THE */ |
|
1405 |
|
/* ORDER TOTAL BY THE INCLUDED TAX */ |
|
1406 |
|
if l_tax_in <> 0 |
|
1407 |
|
or (l_ord_contains_tax_in_lines |
|
1408 |
|
and (not can-find (tx2d_det |
|
1409 |
|
where tx2d_domain = global_domain |
|
1410 |
|
and tx2d_ref = ih_inv_nbr |
|
1411 |
|
and tx2d_nbr = ih_nbr))) |
|
1412 |
|
then do: |
|
1413 |
|
{us/gp/gprunp.i "sopl" "p" "calDiscAmountAfterSubtractingTax" |
|
1414 |
|
"(input table t_store_ext_actual, |
|
1415 |
|
input rndmthd, |
|
1416 |
|
input ih_disc_pct, |
|
1417 |
|
input ih_inv_nbr, |
|
1418 |
|
input ih_nbr, |
|
1419 |
|
input tax_tr_type, |
|
1420 |
|
output line_total, |
|
1421 |
|
output disc_amt)"} |
|
1422 |
|
|
|
1423 |
|
/* DISCOUNT AMOUNT IS ADJUSTED TO AVOID ROUNDING ERROR */ |
|
1424 |
|
/* IN CALCULATION OF ORDER AMOUNT */ |
|
1425 |
|
{us/gp/gprunp.i "sopl" "p" "adjustDiscountAmount" |
|
1426 |
|
"(input taxable_amt - l_tax_in, |
|
1427 |
|
input nontaxable_amt, |
|
1428 |
|
input ih_trl1_amt, |
|
1429 |
|
input ih_trl2_amt, |
|
1430 |
|
input ih_trl3_amt, |
|
1431 |
|
input line_total, |
|
1432 |
|
input-output disc_amt)"} |
|
1433 |
|
|
|
1434 |
|
end. /* IF l_tax_in <> 0 */ |
|
1435 |
|
|
|
1436 |
|
end. /* IF LAST-OF(ih_inv_nbr) */ |
|
1437 |
|
|
|
1438 |
|
/* JUST MOVED CODE FROM ABOVE AS THIS CALCULATION SHOULD BE */ |
|
1439 |
|
/* SALES ORDER WISE(ih_nbr) AND THEREFORE SHOULD BE RUN FOR */ |
|
1440 |
|
/* ALL ih_hist RECORDS */ |
|
1441 |
|
{us/bbi/gprun.i ""txabsrb.p"" |
|
1442 |
|
"(input ih_inv_nbr, |
|
1443 |
|
input ih_nbr, |
|
1444 |
|
input '16', |
|
1445 |
|
input-output line_total, |
|
1446 |
|
input-output taxable_amt)"} |
|
1447 |
|
|
|
1448 |
|
/* ADJUSTING LINE TOTALS AND TAXABLE AMOUNT BY INCLUDED TAX */ |
|
1449 |
|
assign |
|
1450 |
|
line_total = line_total - l_tax_in |
|
1451 |
|
tax_amt = tax_amt + l_tax_in |
|
1452 |
|
l_tax_in = 0 |
|
1453 |
|
l_ord_amt = l_ord_amt + line_total + disc_amt + ih_trl1_amt |
|
1454 |
|
+ ih_trl2_amt + ih_trl3_amt + tax_amt. |
|
1455 |
|
|
|
1456 |
|
end. /* FOR EACH ih_hist */ |
|
1457 |
|
|
|
1458 |
|
END PROCEDURE. /* PROCEDURE p-get-ord-amt */ |
|
1459 |
|
|
|
1460 |
|
PROCEDURE p-acc-totals: |
|
1461 |
|
/* THIS PROCEDURE ACCUMULATES TRAILER TOTALS FOR GTM */ |
|
1462 |
|
|
|
1463 |
|
define parameter buffer ih_hist for ih_hist. |
|
1464 |
|
|
|
1465 |
|
define input-output parameter invtot_nontaxable_amt as decimal no-undo. |
|
1466 |
|
define input-output parameter invtot_taxable_amt as decimal no-undo. |
|
1467 |
|
define input-output parameter invtot_line_total as decimal no-undo. |
|
1468 |
|
define input-output parameter invtot_disc_amt as decimal no-undo. |
|
1469 |
|
define input-output parameter invtot_trl1_amt like ih_trl1_amt no-undo. |
|
1470 |
|
define input-output parameter invtot_trl2_amt like ih_trl2_amt no-undo. |
|
1471 |
|
define input-output parameter invtot_trl3_amt like ih_trl3_amt no-undo. |
|
1472 |
|
define input-output parameter invtot_tax_amt as decimal no-undo. |
|
1473 |
|
define input-output parameter invtot_ord_amt as decimal no-undo. |
|
1474 |
|
|
|
1475 |
|
define input-output parameter invtot_container_amt as decimal no-undo. |
|
1476 |
|
define input-output parameter invtot_linecharge_amt as decimal no-undo. |
|
1477 |
|
|
|
1478 |
|
define variable tmpamt as decimal no-undo. |
|
1479 |
|
define variable mc-error-number like msg_nbr no-undo. |
|
1480 |
|
|
|
1481 |
|
{us/so/soivtot9.i} |
|
1482 |
|
END PROCEDURE. /* PROCEDURE P-ACC-TOTALS */ |
|
1483 |
|
|
|
1484 |
|
PROCEDURE getTranslation: |
|
1485 |
|
/*--------------------------------------------------------------------------- |
|
1486 |
|
Purpose: Get translation from language detail |
|
1487 |
|
Parameters: pKey1 - lngd_key1 |
|
1488 |
|
pTranslation - output lngd_translation |
|
1489 |
|
|
|
1490 |
|
Notes: Added by ECO N06R to prevent action segment compile error. |
|
1491 |
|
---------------------------------------------------------------------------*/. |
|
1492 |
|
define input parameter pKey1 as character no-undo. |
|
1493 |
|
define output parameter pTranslation as character no-undo. |
|
1494 |
|
|
|
1495 |
|
for first lngd_det where lngd_dataset begins "soprint" and |
|
1496 |
|
lngd_field = "det_disc_prnt" and |
|
1497 |
|
lngd_lang = global_user_lang and |
|
1498 |
|
lngd_key1 = pKey1 |
|
1499 |
|
no-lock: |
|
1500 |
|
pTranslation = lngd_translation. |
|
1501 |
|
end. |
|
1502 |
|
|
|
1503 |
|
END PROCEDURE. /*GetTranslation*/ |
|
1504 |
|
|
|
1505 |
|
PROCEDURE removeEmptyStrings: |
|
1506 |
|
/*--------------------------------------------------------------------------- |
|
1507 |
|
Purpose: Workaround for an issue with the Progress 10.1B client running |
|
1508 |
|
with cpinternal to set utf-8. The problem is that any field |
|
1509 |
|
with an empty string in it "" will cause a form/frame defined as |
|
1510 |
|
a "header" to lose data. The following code sets empty strings |
|
1511 |
|
to single spaces in the fields that are in frames phead1 and |
|
1512 |
|
phead1ent in us/so/soivhfrm.i. |
|
1513 |
|
---------------------------------------------------------------------------*/. |
|
1514 |
|
define variable j as integer no-undo. |
|
1515 |
|
do j = 1 to 6: |
|
1516 |
|
if company[j] = "" then |
|
1517 |
|
company[j] = " ". |
|
1518 |
|
if billto[j] = "" then |
|
1519 |
|
billto[j] = " ". |
|
1520 |
|
end. |
|
1521 |
|
|
|
1522 |
|
if covatreglbl = "" then |
|
1523 |
|
covatreglbl = " ". |
|
1524 |
|
|
|
1525 |
|
if covatreg = "" then |
|
1526 |
|
covatreg = " ". |
|
1527 |
|
|
|
1528 |
|
if vatreglbl = "" then |
|
1529 |
|
vatreglbl = " ". |
|
1530 |
|
|
|
1531 |
|
if vatreg = "" then |
|
1532 |
|
vatreg = " ". |
|
1533 |
|
|
|
1534 |
|
END PROCEDURE. /*removeEmptyStrings*/ |
|
1535 |
|
|
|
1536 |
|
/* procedures of print settings */ |
|
1537 |
|
{us/so/soprprc1.i} |
File mfg/2013/base/src/sorp1002.p added (mode: 100644) (index 0000000..c407fa5) |
|
1 |
|
/* xxrp1002.p - SALES ORDER INVOICE PRINT FOR ENGLISH PRINT CODE "1" */ |
|
2 |
|
/* sorp1001.p - SALES ORDER INVOICE PRINT FOR ENGLISH PRINT CODE "1" */ |
|
3 |
|
/* sorp1001.p - SALES ORDER INVOICE PRINT FOR ENGLISH PRINT CODE "1" */ |
|
4 |
|
/* Copyright 1986 QAD Inc. All rights reserved. */ |
|
5 |
|
/* $Id$: */ |
|
6 |
|
/* REVISION: 5.0 LAST MODIFIED: 03/15/90 BY: MLB *B615* */ |
|
7 |
|
/* REVISION: 6.0 LAST MODIFIED: 04/20/90 BY: ftb * */ |
|
8 |
|
/* REVISION: 6.0 LAST MODIFIED: 07/05/90 BY: WUG *D043* */ |
|
9 |
|
/* REVISION: 5.0 LAST MODIFIED: 08/18/90 BY: MLB *B755* */ |
|
10 |
|
/* REVISION: 6.0 LAST MODIFIED: 08/20/90 BY: MLB *D055* */ |
|
11 |
|
/* REVISION: 6.0 LAST MODIFIED: 12/13/90 BY: dld *D257* */ |
|
12 |
|
/* REVISION: 6.0 LAST MODIFIED: 12/21/90 BY: MLB *D238* */ |
|
13 |
|
/* REVISION: 6.0 LAST MODIFIED: 01/04/90 BY: WUG *D288* */ |
|
14 |
|
/* REVISION: 6.0 LAST MODIFIED: 03/12/91 BY: afs *D425* */ |
|
15 |
|
/* REVISION: 6.0 LAST MODIFIED: 10/21/91 BY: afs *D903* */ |
|
16 |
|
/* REVISION: 6.0 LAST MODIFIED: 11/26/91 BY: WUG *D953* */ |
|
17 |
|
/* REVISION: 7.0 LAST MODIFIED: 11/29/91 BY: SAS *F017* */ |
|
18 |
|
/* REVISION: 7.0 LAST MODIFIED: 02/11/92 BY: tjs *F191* */ |
|
19 |
|
/* REVISION: 7.0 LAST MODIFIED: 03/28/92 BY: dld *F322* */ |
|
20 |
|
/* REVISION: 7.0 LAST MODIFIED: 03/31/92 BY: sas *F277* */ |
|
21 |
|
/* REVISION: 7.0 LAST MODIFIED: 04/02/92 BY: afs *F348* */ |
|
22 |
|
/* REVISION: 7.0 LAST MODIFIED: 04/09/92 BY: emb *F369* */ |
|
23 |
|
/* REVISION: 7.0 LAST MODIFIED: 04/16/92 BY: sas *F378* */ |
|
24 |
|
/* REVISION: 7.0 LAST MODIFIED: 06/08/92 BY: tjs *F504* */ |
|
25 |
|
/* REVISION: 7.3 LAST MODIFIED: 09/04/92 BY: afs *G047* */ |
|
26 |
|
/* REVISION: 7.3 LAST MODIFIED: 12/03/92 BY: afs *G341* */ |
|
27 |
|
/* REVISION: 7.3 LAST MODIFIED: 02/19/93 by: jms *G712* */ |
|
28 |
|
/* REVISION: 7.3 LAST MODIFIED: 04/05/93 BY: tjs *G858* */ |
|
29 |
|
/* REVISION: 7.4 LAST MODIFIED: 07/15/93 BY: jjs *H050* */ |
|
30 |
|
/* REVISION: 7.4 LAST MODIFIED: 08/19/93 BY: pcd *H009* */ |
|
31 |
|
/* REVISION: 7.4 LAST MODIFIED: 10/28/93 BY: cdt *H197* */ |
|
32 |
|
/* REVISION: 7.4 LAST MODIFIED: 05/03/94 BY: cdt *FN91* */ |
|
33 |
|
/* REVISION: 7.4 LAST MODIFIED: 06/03/94 BY: dpm *GK02* */ |
|
34 |
|
/* REVISION: 7.4 LAST MODIFIED: 10/05/94 BY: rxm *GM88* */ |
|
35 |
|
/* REVISION: 7.4 LAST MODIFIED: 11/18/94 BY: smp *FT80* */ |
|
36 |
|
/* REVISION: 7.4 LAST MODIFIED: 11/30/94 BY: smp *GO65* */ |
|
37 |
|
/* REVISION: 7.4 LAST MODIFIED: 03/14/95 BY: kjm *F0MY* */ |
|
38 |
|
/* REVISION: 7.4 LAST MODIFIED: 03/24/95 BY: kjm *F0NZ* */ |
|
39 |
|
/* REVISION: 8.5 LAST MODIFIED: 03/30/95 BY: nte *J042* */ |
|
40 |
|
/* REVISION: 7.4 LAST MODIFIED: 05/31/95 BY: jym *G0ND* */ |
|
41 |
|
/* REVISION: 7.4 LAST MODIFIED: 07/19/95 BY: bcm *F0RW* */ |
|
42 |
|
/* REVISION: 7.4 LAST MODIFIED: 10/13/95 BY: rxm *G0Z9* */ |
|
43 |
|
/* REVISION: 7.4 LAST MODIFIED: 10/20/95 BY: jym *G0XY* */ |
|
44 |
|
/* REVISION: 8.5 LAST MODIFIED: 07/25/95 BY: taf *J053* */ |
|
45 |
|
/* REVISION: 8.5 LAST MODIFIED: 01/05/96 BY: ais *G1J5* */ |
|
46 |
|
/* REVISION: 8.5 LAST MODIFIED: 02/05/96 BY: ais *G0NX* */ |
|
47 |
|
/* REVISION: 8.5 LAST MODIFIED: 04/11/96 BY: GWM *J0HW* */ |
|
48 |
|
/* REVISION: 8.5 LAST MODIFIED: 04/12/96 BY: ais *G1QW* */ |
|
49 |
|
/* REVISION: 8.5 LAST MODIFIED: 04/10/96 BY: *J04C* Sue Poland */ |
|
50 |
|
/* REVISION: 8.5 LAST MODIFIED: 06/14/96 BY: *J0T0* Dennis Hensen */ |
|
51 |
|
/* REVISION: 8.5 LAST MODIFIED: 06/26/96 BY: *J0WF* Sue Poland */ |
|
52 |
|
/* REVISION: 8.5 LAST MODIFIED: 07/22/96 BY: *J0ZZ* T. Farnsworth */ |
|
53 |
|
/* REVISION: 8.5 LAST MODIFIED: 08/07/96 BY: *G29K* Markus Barone */ |
|
54 |
|
/* REVISION: 8.5 LAST MODIFIED: 11/14/96 BY: *G2J1* Amy Esau */ |
|
55 |
|
/* REVISION: 8.5 LAST MODIFIED: 07/22/97 BY: *H1C9* Seema Varma */ |
|
56 |
|
/* REVISION: 8.5 LAST MODIFIED: 08/19/97 BY: *J1Z0* Ajit Deodhar */ |
|
57 |
|
/* REVISION: 8.5 LAST MODIFIED: 09/23/97 BY: *H1FM* Seema Varma */ |
|
58 |
|
/* REVISION: 8.5 LAST MODIFIED: 10/20/97 BY: *H1F8* Nirav Parikh */ |
|
59 |
|
/* REVISION: 8.5 LAST MODIFIED: 11/27/97 BY: *J273* Nirav Parikh */ |
|
60 |
|
/* REVISION: 8.5 LAST MODIFIED: 12/30/97 BY: *J281* Manish K. */ |
|
61 |
|
/* REVISION: 8.6E LAST MODIFIED: 02/23/98 BY: *L007* A. Rahane */ |
|
62 |
|
/* REVISION: 8.6E LAST MODIFIED: 04/23/98 BY: *L00L* Adam Harris */ |
|
63 |
|
/* REVISION: 8.6E LAST MODIFIED: 05/05/98 BY: *L00T* Ed v.d.Gevel */ |
|
64 |
|
/* REVISION: 8.6E LAST MODIFIED: 05/20/98 BY: *K1Q4* Alfred Tan */ |
|
65 |
|
/* REVISION: 8.6E LAST MODIFIED: 06/29/98 BY: *L024* Sami Kureishy */ |
|
66 |
|
/* REVISION: 8.6E LAST MODIFIED: 09/08/98 BY: *H1MZ* Poonam Bahl */ |
|
67 |
|
/* REVISION: 8.6E LAST MODIFIED: 10/15/98 BY: *J29B* Ajit Deodhar */ |
|
68 |
|
/* REVISION: 8.6E LAST MODIFIED: 02/01/99 BY: *L0D5* Robin McCarthy */ |
|
69 |
|
/* REVISION: 8.6E LAST MODIFIED: 04/13/99 BY: *J3CZ* Poonam Bahl */ |
|
70 |
|
/* REVISION: 9.1 LAST MODIFIED: 09/08/99 BY: *N02P* Robert Jensen */ |
|
71 |
|
/* REVISION: 9.1 LAST MODIFIED: 10/01/99 BY: *N014* Murali Ayyagari */ |
|
72 |
|
/* REVISION: 9.1 LAST MODIFIED: 10/18/99 BY: *K23R* Sachin Shinde */ |
|
73 |
|
/* REVISION: 9.1 LAST MODIFIED: 11/02/99 BY: *N04P* Robert Jensen */ |
|
74 |
|
/* REVISION: 9.1 LAST MODIFIED: 03/06/00 BY: *N05Q* Luke Pokic */ |
|
75 |
|
/* REVISION: 9.1 LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */ |
|
76 |
|
/* REVISION: 9.1 LAST MODIFIED: 02/16/00 BY: *N06R* Denis Tatarik */ |
|
77 |
|
/* REVISION: 9.1 LAST MODIFIED: 06/08/00 BY: *L0Z5* Ashwini G. */ |
|
78 |
|
/* REVISION: 9.1 LAST MODIFIED: 06/28/00 BY: *N0DM* Rajinder Kamra */ |
|
79 |
|
/* REVISION: 9.1 LAST MODIFIED: 08/12/00 BY: *N0KN* Mark Brown */ |
|
80 |
|
/* REVISION: 9.1 LAST MODIFIED: 11/07/00 BY: *L15K* Kaustubh K */ |
|
81 |
|
/* Revision: 1.29.1.15 BY: Manisha Sawant DATE: 12/07/00 ECO: *M0XL* */ |
|
82 |
|
/* Revision: 1.29.1.16 BY: BalbeerS Rajput DATE: 10/14/00 ECO: *N0WB* */ |
|
83 |
|
/* Old ECO marker removed, but no ECO header exists *F0PN* */ |
|
84 |
|
/* Revision: 1.29.1.17 BY: Katie Hilbert DATE: 04/01/01 ECO: *P002* */ |
|
85 |
|
/* Revision: 1.29.1.18 BY: Ellen Borden DATE: 07/09/01 ECO: *P007* */ |
|
86 |
|
/* Revision: 1.29.1.19 BY: Jean Miller DATE: 07/09/01 ECO: *P03Q* */ |
|
87 |
|
/* Revision: 1.29.1.20 BY: Patrick Rowan DATE: 03/15/02 ECO: *P00G* */ |
|
88 |
|
/* Revision: 1.29.1.21 BY: Dipesh Bector DATE: 01/14/03 ECO: *M21Q* */ |
|
89 |
|
/* Revision: 1.29.1.22 BY: Vandna Rohira DATE: 04/28/03 ECO: *N1YL* */ |
|
90 |
|
/* Revision: 1.29.1.23 BY: Narathip W. DATE: 05/21/03 ECO: *P0S8* */ |
|
91 |
|
/* Revision: 1.29.1.26 BY: Paul Donnelly (SB) DATE: 06/28/03 ECO: *Q00L* */ |
|
92 |
|
/* Revision: 1.29.1.26 BY: Manish Dani DATE: 09/01/03 ECO: *P0VZ* */ |
|
93 |
|
/* Revision: 1.29.1.27 BY: Shoma Salgaonkar DATE: 09/18/03 ECO: *N2L5* */ |
|
94 |
|
/* Revision: 1.29.1.28 BY: Somesh Jeswani DATE: 10/10/03 ECO: *P131* */ |
|
95 |
|
/* Revision: 1.29.1.29 BY: Shivaraman V. DATE: 02/05/04 ECO: *P1MR* */ |
|
96 |
|
/* Revision: 1.29.1.30 BY: Prashant Parab DATE: 04/06/04 ECO: *P1WT* */ |
|
97 |
|
/* Revision: 1.29.1.31 BY: Bharath Kumar DATE: 09/03/04 ECO: *P2J3* */ |
|
98 |
|
/* Revision: 1.29.1.32 BY: Ed van de Gevel DATE: 03/01/05 ECO: *R00G* */ |
|
99 |
|
/* Revision: 1.29.1.33 BY: Ed van de Gevel DATE: 03/16/05 ECO: *R00H* */ |
|
100 |
|
/* Revision: 1.29.1.34 BY: Ed van de Gevel DATE: 18/03/05 ECO: *R00F* */ |
|
101 |
|
/* Revision: 1.29.1.35 BY: Dayanand Jethwa DATE: 04/01/05 ECO: *P27M* */ |
|
102 |
|
/* Revision: 1.29.1.36 BY: Ed van de Gevel DATE: 07/01/05 ECO: *R01H* */ |
|
103 |
|
/* Revision: 1.29.1.37 BY: Dinesh Dubey DATE: 01/17/06 ECO: *P3HZ* */ |
|
104 |
|
/* Revision: 1.29.1.38 BY: Jean Miller DATE: 02/17/06 ECO: *Q0R5* */ |
|
105 |
|
/* Revision: 1.29.1.39 BY: Tom Kennedy DATE: 06/08/06 ECO: *Q0LK* */ |
|
106 |
|
/* Revision: 1.29.1.40 BY: Rafiq S. DATE: 11/23/06 ECO: *P4YY* */ |
|
107 |
|
/* Revision: 1.29.1.43 BY: Jean Miller DATE: 07/23/07 ECO: *R0C5* */ |
|
108 |
|
/* Revision: 1.29.1.46 BY: Edgar Roca DATE: 09/24/07 ECO: *R0C6* */ |
|
109 |
|
/* Revision: 1.29.1.47 BY: Jean Miller DATE: 02/20/08 ECO: *P5KF* */ |
|
110 |
|
/* Revision: 1.29.1.48 BY: Jean Miller DATE: 06/20/08 ECO: *R0VG* */ |
|
111 |
|
/* Revision: 1.29.1.49 BY: Dinesh Dubey DATE: 07/07/08 ECO: *R0W3* */ |
|
112 |
|
/* Revision: 1.29.1.50 BY: Deirdre O'Brien DATE: 10/31/08 ECO: *R16Q* */ |
|
113 |
|
/* Revision: 1.29.1.54 BY: Jean Miller DATE: 10/31/08 ECO: *R15M* */ |
|
114 |
|
/* Revision: 1.29.1.55 BY: Dilip Manawat DATE: 10/03/08 ECO: *R15K* */ |
|
115 |
|
/* Revision: 1.29.1.56 BY: Sundeep Kalla DATE: 05/27/09 ECO: *R1K4* */ |
|
116 |
|
/* Revision: 1.29.1.57 BY: Xiaolei Meng DATE: 07/31/09 ECO: *R1N2* */ |
|
117 |
|
/* Revision: 1.29.1.58 BY: Dipanshu Talwar DATE: 11/06/09 ECO: *R1TK* */ |
|
118 |
|
/* Revision: 1.29.1.60 BY: Jean Miller DATE: 11/22/09 ECO: *R1TV* */ |
|
119 |
|
/* Revision: 1.29.1.61 BY: Jean Miller DATE: 11/23/09 ECO: *R1TW* */ |
|
120 |
|
/* BGL LAST MODIFIED: 2014-FEB-12 BY: gbg *d2561 */ |
|
121 |
|
/*-Revision end---------------------------------------------------------------*/ |
|
122 |
|
/******************************************************************************/ |
|
123 |
|
/* All patch markers and commented out code have been removed from the source */ |
|
124 |
|
/* code below. For all future modifications to this file, any code which is */ |
|
125 |
|
/* no longer required should be deleted and no in-line patch markers should */ |
|
126 |
|
/* be added. The ECO marker should only be included in the Revision History. */ |
|
127 |
|
/******************************************************************************/ |
|
128 |
|
|
|
129 |
|
/* THIS PROGRAM IS SIMILAR TO soiv1001.p. CHANGES DONE IN THIS */ |
|
130 |
|
/* PROGRAM MAY ALSO NEED TO BE DONE IN soiv1001.p. */ |
|
131 |
|
|
|
132 |
|
/* IN ORDER TO AVOID LOCKING ISSUES DURING INVOICE PRINT OF */ |
|
133 |
|
/* SINGLE/MULTIPLE ORDERS, SKIP THE LOCKED ORDER AND PRINT THE */ |
|
134 |
|
/* INVOICES FOR THE REMAINING ORDERS. */ |
|
135 |
|
|
|
136 |
|
using com.qad.eefin.buser.EntitySecurityCheck. |
|
137 |
|
{us/bbi/mfdeclre.i} |
|
138 |
|
{us/bbi/gplabel.i} |
|
139 |
|
{us/px/pxmaint.i} |
|
140 |
|
{us/px/pxphdef.i adcrxr} |
|
141 |
|
|
|
142 |
|
{us/gp/gpldcons.i} /* CONSTANTS FOR LEGAL DOCUMENT */ |
|
143 |
|
|
|
144 |
|
/*d2561* start added code >>> */ |
|
145 |
|
{xx2561.i new} |
|
146 |
|
/*d2561* end added code <<< */ |
|
147 |
|
|
|
148 |
|
define variable daybookSetBySiteInstalled like mfc_logical no-undo. |
|
149 |
|
define variable hDaybooksetValidation as handle no-undo. |
|
150 |
|
define variable iErrorNumber as integer no-undo. |
|
151 |
|
define variable daybookDate as date no-undo. |
|
152 |
|
|
|
153 |
|
/* DAYBOOKSET VALIDATION LIBRARY PROTOTYPES */ |
|
154 |
|
{us/dy/dybvalpl.i hDaybooksetValidation} |
|
155 |
|
|
|
156 |
|
/* INITIALIZE PERSISTENT PROCEDURES */ |
|
157 |
|
run mfairunh.p |
|
158 |
|
(input "dybvalpl.p", |
|
159 |
|
input ?, |
|
160 |
|
output hDaybooksetValidation). |
|
161 |
|
|
|
162 |
|
define new shared temp-table t_absr_det no-undo |
|
163 |
|
field t_absr_id like absr_id |
|
164 |
|
field t_absr_reference like absr_reference |
|
165 |
|
field t_absr_qty as decimal format "->>>>,>>>,>>9.99" |
|
166 |
|
field t_absr_ext as decimal format "->>>>,>>>,>>9.99" |
|
167 |
|
index t_absr_indx t_absr_id t_absr_reference. |
|
168 |
|
|
|
169 |
|
define shared temp-table consolidated-so |
|
170 |
|
field cs-so-nbr like so_nbr |
|
171 |
|
field cs-trl1-cd like so_trl1_cd |
|
172 |
|
field cs-trl2-cd like so_trl2_cd |
|
173 |
|
field cs-trl3-cd like so_trl3_cd |
|
174 |
|
field cs-trl1-amt like so_trl1_amt |
|
175 |
|
field cs-trl2-amt like so_trl2_amt |
|
176 |
|
field cs-trl3-amt like so_trl3_amt |
|
177 |
|
field cs-added as logical |
|
178 |
|
index cs-primary is unique primary cs-so-nbr. |
|
179 |
|
|
|
180 |
|
define new shared variable convertmode as character no-undo initial "report". |
|
181 |
|
define new shared variable rndmthd like rnd_rnd_mthd. |
|
182 |
|
define new shared variable old_sod_nbr like sod_nbr. |
|
183 |
|
define new shared variable pages as integer. |
|
184 |
|
define new shared variable so_recno as recid. |
|
185 |
|
define new shared variable billto as character format "x(38)" extent 6. |
|
186 |
|
define new shared variable soldto as character format "x(38)" extent 6. |
|
187 |
|
define new shared variable print_invoice like mfc_logical. |
|
188 |
|
define new shared variable rmaso like mfc_logical. |
|
189 |
|
define new shared variable sacontract like mfc_logical. |
|
190 |
|
define new shared variable fsremarks as character format "x(60)". |
|
191 |
|
define new shared variable ext_actual like sod_price. |
|
192 |
|
define new shared variable ext_margin like sod_price. |
|
193 |
|
define new shared variable comb_inv_nbr like so_inv_nbr. |
|
194 |
|
define new shared variable consolidate like mfc_logical initial true. |
|
195 |
|
define new shared variable undo_trl2 like mfc_logical. |
|
196 |
|
define new shared variable undo_txdetrp like mfc_logical. |
|
197 |
|
define new shared variable new_order like mfc_logical. |
|
198 |
|
define new shared variable disc_prnt_label as character format "x(8)". |
|
199 |
|
define new shared variable addtax like mfc_logical. |
|
200 |
|
define new shared variable shipper_id like abs_id no-undo. |
|
201 |
|
define new shared variable shipper_date like abs_shp_date no-undo. |
|
202 |
|
define new shared variable abs_recno as recid. |
|
203 |
|
|
|
204 |
|
define shared variable dom-ord like so_nbr no-undo. |
|
205 |
|
define shared variable dom-ord1 like so_nbr no-undo. |
|
206 |
|
define shared variable daybookset like dybs_code. |
|
207 |
|
define shared variable daybookset1 like dybs_code. |
|
208 |
|
define shared variable sls-psn like so_slspsn[1] no-undo. |
|
209 |
|
define shared variable sls-psn1 like so_slspsn[1] no-undo. |
|
210 |
|
define shared variable dom-single like mfc_logical no-undo. |
|
211 |
|
define shared variable cust like ih_cust. |
|
212 |
|
define shared variable cust1 like ih_cust. |
|
213 |
|
define shared variable bill like ih_bill. |
|
214 |
|
define shared variable bill1 like ih_bill. |
|
215 |
|
define shared variable site like so_site. |
|
216 |
|
define shared variable site1 like so_site. |
|
217 |
|
define shared variable conso like mfc_logical. |
|
218 |
|
define shared variable nbr like so_nbr. |
|
219 |
|
define shared variable nbr1 like so_nbr. |
|
220 |
|
define shared variable inv_only as logical. |
|
221 |
|
define shared variable print_lotserials as logical. |
|
222 |
|
define shared variable msg like msg_desc. |
|
223 |
|
define shared variable inv_date like so_inv_date. |
|
224 |
|
define shared variable company as character format "x(38)" extent 6. |
|
225 |
|
define shared variable shipdate like so_ship_date. |
|
226 |
|
define shared variable shipdate1 like shipdate. |
|
227 |
|
define shared variable addr as character format "x(38)" extent 6. |
|
228 |
|
define shared variable print_options as logical. |
|
229 |
|
define shared variable lang like so_lang. |
|
230 |
|
define shared variable lang1 like lang. |
|
231 |
|
define shared variable ldnbr like lgd_nbr. |
|
232 |
|
define shared variable ldnbr1 like lgd_nbr. |
|
233 |
|
define shared variable ldshipfrom like lgd_shipfrom. |
|
234 |
|
define shared variable ldshipfrom1 like lgd_shipfrom. |
|
235 |
|
define shared variable call-detail like mfc_logical. |
|
236 |
|
define shared variable incinv like mfc_logical. |
|
237 |
|
define shared variable incmemo like mfc_logical. |
|
238 |
|
define shared variable order_nbrs as character extent 30. |
|
239 |
|
define shared variable order_nbr_list as character no-undo. |
|
240 |
|
define shared variable prt_cor like mfc_logical. |
|
241 |
|
define shared variable undo_all like mfc_logical no-undo. |
|
242 |
|
define shared variable update_post like mfc_logical. |
|
243 |
|
define shared variable inccor like mfc_logical. |
|
244 |
|
define shared variable eff_date like ar_effdate. |
|
245 |
|
|
|
246 |
|
/* Shared variables for print settings */ |
|
247 |
|
{us/so/soprsets.i} |
|
248 |
|
|
|
249 |
|
define variable ent_ord_bill like so_bill no-undo. |
|
250 |
|
define variable ent_ord_ship like so_ship no-undo. |
|
251 |
|
define variable ent_ord_nbr like so_nbr no-undo. |
|
252 |
|
define variable ent_ord_line like sod_line no-undo. |
|
253 |
|
define variable ent_ord_line_part like sod_part no-undo. |
|
254 |
|
define variable ent_ord_line_uom like sod_um no-undo. |
|
255 |
|
define variable so-trl1-cd like so_trl1_cd no-undo. |
|
256 |
|
define variable so-trl2-cd like so_trl2_cd no-undo. |
|
257 |
|
define variable so-trl3-cd like so_trl3_cd no-undo. |
|
258 |
|
define variable isConsolDom as logical no-undo. |
|
259 |
|
define variable pass-con as integer no-undo. |
|
260 |
|
|
|
261 |
|
define variable termsdesc as character format "x(40)" label "Description" no-undo. |
|
262 |
|
define variable prepaid-lbl as character format "x(12)" no-undo. |
|
263 |
|
define variable po-lbl as character format "x(8)" no-undo. |
|
264 |
|
define variable po-lbl2 as character format "x(16)" no-undo. |
|
265 |
|
define variable lot-lbl as character format "x(43)" no-undo. |
|
266 |
|
define variable cspart-lbl as character format "x(15)" no-undo. |
|
267 |
|
define variable resale like cm_resale format "x(20)". |
|
268 |
|
define variable trl_length as integer initial 11 no-undo. |
|
269 |
|
define variable hdr_po as character format "x(38)". |
|
270 |
|
define variable sales_entity like si_entity. |
|
271 |
|
define variable col-80 like mfc_logical initial true no-undo. |
|
272 |
|
define variable xab as character format "x(70)" . |
|
273 |
|
define variable prevxab like xab. |
|
274 |
|
define variable env_check as logical initial true no-undo. |
|
275 |
|
define variable line_env_check as logical initial true no-undo. |
|
276 |
|
define variable foundone as logical no-undo. |
|
277 |
|
define variable cErrorArgs as character no-undo. |
|
278 |
|
|
|
279 |
|
define workfile shipper field shipper_sonbr like sod_nbr. |
|
280 |
|
|
|
281 |
|
define buffer bsod_det for sod_det. |
|
282 |
|
define buffer bsoddet for sod_det. |
|
283 |
|
|
|
284 |
|
{us/px/pxmaint.i} |
|
285 |
|
|
|
286 |
|
{us/so/sodiscwk.i &new="new"} /* Shared workfile for summary discounts */ |
|
287 |
|
|
|
288 |
|
define variable l_inv_conso like mfc_logical initial no no-undo. |
|
289 |
|
define variable l_orig_invnbr like so_inv_nbr initial "" no-undo. |
|
290 |
|
define variable r-result as integer no-undo. |
|
291 |
|
|
|
292 |
|
define buffer soddet2 for sod_det. |
|
293 |
|
define buffer abs_mst1 for abs_mstr. |
|
294 |
|
define buffer somstr for so_mstr. |
|
295 |
|
define buffer somstr2 for so_mstr. |
|
296 |
|
define buffer bsomstr for so_mstr. |
|
297 |
|
define buffer bsomstr1 for so_mstr. |
|
298 |
|
define buffer bsomstr2 for so_mstr. |
|
299 |
|
|
|
300 |
|
define new shared frame sotot. |
|
301 |
|
|
|
302 |
|
{us/so/soivtot1.i "NEW"} /* Define variables for invoice totals. */ |
|
303 |
|
|
|
304 |
|
define variable hdr_call as character format "x(21)" no-undo. |
|
305 |
|
define variable call-lbl as character format "x(16)" no-undo. |
|
306 |
|
define variable prepaid_fmt as character no-undo. |
|
307 |
|
define variable prepaid_old as character no-undo. |
|
308 |
|
define variable h_format as handle no-undo. |
|
309 |
|
define variable oldcurr like so_curr no-undo. |
|
310 |
|
define variable tot_prepaid_amt like so_prepaid. |
|
311 |
|
define variable hdl_sum_disc_lbl as handle. |
|
312 |
|
define variable tax-tran-type as character no-undo. |
|
313 |
|
define variable l_consolidate as logical initial no no-undo. |
|
314 |
|
define variable l_msg_text as character no-undo. |
|
315 |
|
define variable l_ctrj as integer no-undo. |
|
316 |
|
define variable l_ctrk as integer no-undo. |
|
317 |
|
define variable l_so_nbr like so_nbr no-undo. |
|
318 |
|
define variable l_so_nbr2 like so_nbr no-undo. |
|
319 |
|
define variable l_nbr like tx2d_nbr no-undo. |
|
320 |
|
define variable tot_prepaid_nett like so_prepaid |
|
321 |
|
label "Total Prepaid" no-undo. |
|
322 |
|
define variable tot_ptax_amt like so_prepaid no-undo |
|
323 |
|
label "Prepaid Tax". |
|
324 |
|
define variable amt_due_af_prep like so_prepaid |
|
325 |
|
label "Amount Due" no-undo. |
|
326 |
|
|
|
327 |
|
define variable add-trl-length as integer no-undo. |
|
328 |
|
define variable price_fmt as character no-undo. |
|
329 |
|
define variable vlResult like mfc_logical no-undo. |
|
330 |
|
define variable vcCreditCardMsg as character format "x(80)" extent 3 no-undo. |
|
331 |
|
define variable tot_cont_charge as decimal no-undo. |
|
332 |
|
define variable tot_line_charge as decimal no-undo. |
|
333 |
|
define variable c-cont as character format "x(35)" no-undo. |
|
334 |
|
define variable exch_rate like so_ex_rate no-undo. |
|
335 |
|
define variable exch_rate2 like so_ex_rate2 no-undo. |
|
336 |
|
define variable exch_ratetype like so_ex_ratetype no-undo. |
|
337 |
|
define variable exch_exru_seq like so_exru_seq no-undo. |
|
338 |
|
define variable l_tot_amt as decimal no-undo. |
|
339 |
|
define variable l_tax_total_message as character extent 2 format "x(13)" no-undo. |
|
340 |
|
define variable l_basetaxtot like glt_amt. |
|
341 |
|
define variable hInvoiceTotal as handle no-undo. |
|
342 |
|
define variable blockedEntities as character no-undo initial "". |
|
343 |
|
define variable lEntityOk as logical no-undo. |
|
344 |
|
define variable l_consign_progs as character no-undo. |
|
345 |
|
|
|
346 |
|
/* QAD Financials Data Objects Definitions */ |
|
347 |
|
define variable hQADFinancialsLib as handle no-undo. |
|
348 |
|
define variable EntitySecurity as EntitySecurityCheck no-undo. |
|
349 |
|
|
|
350 |
|
l_consign_progs = "socnaimt.p,socnuac.p,socnuac3.p,socnuac5.p,socnuac7.p" + |
|
351 |
|
",socnundo.p". |
|
352 |
|
|
|
353 |
|
run mfairunh.p |
|
354 |
|
(input 'mfinvtot.p', |
|
355 |
|
input '?', |
|
356 |
|
output hInvoiceTotal) no-error. |
|
357 |
|
|
|
358 |
|
for first txc_ctrl where txc_domain = global_domain |
|
359 |
|
no-lock: end. |
|
360 |
|
|
|
361 |
|
{us/so/soeuinv.i} |
|
362 |
|
|
|
363 |
|
assign |
|
364 |
|
l_tax_total_message[1] = getTermLabel("TOTAL_TAX",9) |
|
365 |
|
+ " " |
|
366 |
|
+ getTermLabel("IN",2) |
|
367 |
|
l_tax_total_message[2] = getTermLabel("TOTAL_TAX",9). |
|
368 |
|
|
|
369 |
|
|
|
370 |
|
c-cont = CAPS(dynamic-function('getTermLabelFillCentered' in h-label, |
|
371 |
|
input "CONTINUED", |
|
372 |
|
input 35, |
|
373 |
|
input '*')). |
|
374 |
|
|
|
375 |
|
{us/gp/gprunpdf.i "txincopl" "p"} |
|
376 |
|
|
|
377 |
|
/* FORMS NEEDED FOR SOIVTRL2.P */ |
|
378 |
|
define new shared frame d. |
|
379 |
|
form /* NOT USED DURING INVOICE PRINT */ |
|
380 |
|
so_cr_init colon 15 |
|
381 |
|
so_to_inv colon 48 |
|
382 |
|
so_cr_card colon 15 |
|
383 |
|
so_print_so colon 48 |
|
384 |
|
so_stat colon 15 |
|
385 |
|
so_print_pl colon 48 |
|
386 |
|
so_rev colon 15 |
|
387 |
|
so_prepaid colon 48 |
|
388 |
|
so_fob colon 15 |
|
389 |
|
with frame d side-labels width 80. |
|
390 |
|
|
|
391 |
|
/* SET EXTERNAL LABELS */ |
|
392 |
|
setFrameLabels(frame d:handle). |
|
393 |
|
|
|
394 |
|
form |
|
395 |
|
tot_prepaid_amt colon 60 |
|
396 |
|
tot_ptax_amt colon 60 |
|
397 |
|
tot_prepaid_nett colon 60 |
|
398 |
|
skip(1) |
|
399 |
|
amt_due_af_prep colon 60 |
|
400 |
|
with frame prepd width 80 side-labels. |
|
401 |
|
|
|
402 |
|
/* SET EXTERNAL LABELS */ |
|
403 |
|
setFrameLabels(frame prepd:handle). |
|
404 |
|
|
|
405 |
|
form header |
|
406 |
|
fill("-",77) format "x(77)" skip |
|
407 |
|
space(31) |
|
408 |
|
c-cont |
|
409 |
|
skip(8) |
|
410 |
|
with frame continue page-bottom width 80. |
|
411 |
|
|
|
412 |
|
form |
|
413 |
|
so_nbr colon 15 |
|
414 |
|
so_ship_date colon 55 |
|
415 |
|
so_ord_date colon 15 |
|
416 |
|
hdr_po to 78 no-label |
|
417 |
|
so_slspsn[1] colon 15 label "Salesperson(s)" |
|
418 |
|
so_slspsn[2] no-label |
|
419 |
|
so_ship colon 55 |
|
420 |
|
so_slspsn[3] at 17 no-label |
|
421 |
|
so_slspsn[4] no-label |
|
422 |
|
so_shipvia colon 55 |
|
423 |
|
so_cr_terms colon 15 |
|
424 |
|
so_bol colon 55 |
|
425 |
|
termsdesc at 17 no-label |
|
426 |
|
so_fob colon 55 |
|
427 |
|
resale colon 15 |
|
428 |
|
hdr_call to 64 no-label |
|
429 |
|
so_rmks colon 15 |
|
430 |
|
/*d2561*/ vemail colon 15 label "Sold-To Email" |
|
431 |
|
skip(1) |
|
432 |
|
with frame phead2 side-labels width 90. |
|
433 |
|
|
|
434 |
|
/* SET EXTERNAL LABELS */ |
|
435 |
|
setFrameLabels(frame phead2:handle). |
|
436 |
|
|
|
437 |
|
{us/et/etvar.i} |
|
438 |
|
{us/et/etrpvar.i &new="new"} |
|
439 |
|
|
|
440 |
|
{us/et/etsotrla.i "NEW"} |
|
441 |
|
{us/so/so10a01.i} |
|
442 |
|
|
|
443 |
|
{us/fs/fsconst.i} /* FIELD SERVICE CONSTANTS */ |
|
444 |
|
|
|
445 |
|
empty temp-table t_absr_det no-error. |
|
446 |
|
|
|
447 |
|
assign |
|
448 |
|
l_nontaxable_lbl = getTermLabelRtColon("NON-TAXABLE", 12) |
|
449 |
|
l_taxable_lbl = getTermLabelRtColon("TAXABLE", 12). |
|
450 |
|
|
|
451 |
|
form |
|
452 |
|
vcCreditCardMsg[1] skip |
|
453 |
|
vcCreditCardMsg[2] skip |
|
454 |
|
vcCreditCardMsg[3] |
|
455 |
|
with frame soccmsg no-labels width 132. |
|
456 |
|
|
|
457 |
|
/* **NOTE: The customer has promised to pay using a credit card */ |
|
458 |
|
{us/bbi/pxmsg.i &MSGNUM=3867 &ERRORLEVEL=1 &MSGBUFFER=vcCreditCardMsg[1]} |
|
459 |
|
/* The card used at order time will be processed for payment */ |
|
460 |
|
{us/bbi/pxmsg.i &MSGNUM=3868 &ERRORLEVEL=1 &MSGBUFFER=vcCreditCardMsg[2]} |
|
461 |
|
/* Customer is responsible for payment if credit card is denied */ |
|
462 |
|
{us/bbi/pxmsg.i &MSGNUM=3869 &ERRORLEVEL=1 &MSGBUFFER=vcCreditCardMsg[3]} |
|
463 |
|
|
|
464 |
|
hdl_sum_disc_lbl = prnt_sum_disc_amt:handle in frame disc_sum_print. |
|
465 |
|
|
|
466 |
|
/* ASSIGN ORIGINAL FORMAT TO _OLD VARIABLES */ |
|
467 |
|
assign |
|
468 |
|
nontax_old = nontaxable_amt:format |
|
469 |
|
taxable_old = taxable_amt:format |
|
470 |
|
line_tot_old = line_total:format |
|
471 |
|
disc_old = disc_amt:format |
|
472 |
|
trl_amt_old = so_trl1_amt:format |
|
473 |
|
tax_amt_old = tax_amt:format |
|
474 |
|
ord_amt_old = ord_amt:format |
|
475 |
|
prepaid_old = so_prepaid:format |
|
476 |
|
container_old = container_charge_total:format |
|
477 |
|
line_charge_old = line_charge_total:format. |
|
478 |
|
|
|
479 |
|
find first sac_ctrl where sac_domain = global_domain no-lock no-error. |
|
480 |
|
find first rmc_ctrl where rmc_domain = global_domain no-lock no-error. |
|
481 |
|
find first svc_ctrl where svc_domain = global_domain no-lock no-error. |
|
482 |
|
find first shc_ctrl where shc_domain = global_domain no-lock no-error. |
|
483 |
|
|
|
484 |
|
/* DEFINE VARIABLES FOR DISPLAY OF VAT REG NO & COUNTRY CODE */ |
|
485 |
|
{us/gp/gpvtecdf.i &var="shared"} |
|
486 |
|
{us/gp/gpvtepdf.i &var=" "} |
|
487 |
|
|
|
488 |
|
assign |
|
489 |
|
maint = no |
|
490 |
|
pages = 0 |
|
491 |
|
old_sod_nbr = ?. |
|
492 |
|
|
|
493 |
|
{us/bbi/gprun.i ""gpctryfmt.p"" "persistent set h_format"} |
|
494 |
|
|
|
495 |
|
if msg <> "" then trl_length = trl_length + 1. |
|
496 |
|
|
|
497 |
|
if dom-single = yes |
|
498 |
|
then do: |
|
499 |
|
conso = yes. |
|
500 |
|
/* TELL DOM THE ORDER NUMBERS THAT ARE PROCESSED HERE */ |
|
501 |
|
{us/bbi/gprun.i ""sodomso.p"" } |
|
502 |
|
end. |
|
503 |
|
|
|
504 |
|
/* The check on rcauis01 will prevent execution when coming from */ |
|
505 |
|
/* rcauis.p as well as the two EDI inbound gateways that also call it */ |
|
506 |
|
if (execname <> "rcsois.p" and |
|
507 |
|
execname <> "whrfshtr.p" and |
|
508 |
|
index(program-name(4),'rcauis01') = 0 and |
|
509 |
|
execname <> "rcunis.p" and |
|
510 |
|
lookup(execname,l_consign_progs) = 0) |
|
511 |
|
and dom-single = no |
|
512 |
|
then do: |
|
513 |
|
for each so_mstr |
|
514 |
|
where so_domain = global_domain |
|
515 |
|
and (so_nbr >= nbr and so_nbr <= nbr1) |
|
516 |
|
and (so_to_inv = yes) |
|
517 |
|
and (so_ship_date >= shipdate and so_ship_date <= shipdate1) |
|
518 |
|
and (so_cust >= cust and so_cust <= cust1) |
|
519 |
|
and (so_bill >= bill and so_bill <= bill1) |
|
520 |
|
and (so_site >= site and so_site <= site1) |
|
521 |
|
and (so_lang >= lang and so_lang <= lang1) |
|
522 |
|
and (so_slspsn[1] >= sls-psn and so_slspsn[1] <= sls-psn1) |
|
523 |
|
and (so_daybookset >= daybookset and so_daybookset <= daybookset1) |
|
524 |
|
and so_compl_stat = "" |
|
525 |
|
no-lock: |
|
526 |
|
/* Consider legal doc number when 'Separate Invoices for Each Shipment' */ |
|
527 |
|
if available shc_ctrl and shc_check_ship_pending then do: |
|
528 |
|
|
|
529 |
|
if can-find(first lgdd_det where lgdd_domain = global_domain |
|
530 |
|
and lgdd_order = so_nbr |
|
531 |
|
and can-find(first lgd_mstr where lgd_domain = global_domain |
|
532 |
|
and lgd_type = yes |
|
533 |
|
and ((lgd_posted = no and lgd_status = {&LD_CONFIRMED}) |
|
534 |
|
or (lgd_posted = yes and lgd_status ={&LD_CANCELLED} and lgd_cancel_inv = "")) |
|
535 |
|
and lgd_mstr.oid_lgd_mstr = lgdd_det.oid_lgd_mstr |
|
536 |
|
and lgd_nbr >= ldnbr and lgd_nbr <= ldnbr1 |
|
537 |
|
and lgd_shipfrom >= ldshipfrom and lgd_shipfrom <= ldshipfrom1)) |
|
538 |
|
or |
|
539 |
|
not can-find(first lgdd_det where lgdd_domain = global_domain and lgdd_order = so_nbr) |
|
540 |
|
then do: |
|
541 |
|
so_recno = recid(so_mstr). |
|
542 |
|
run p_check_locked(input so_recno). |
|
543 |
|
leave. |
|
544 |
|
end. |
|
545 |
|
end. |
|
546 |
|
else do: |
|
547 |
|
so_recno = recid(so_mstr). |
|
548 |
|
run p_check_locked(input so_recno). |
|
549 |
|
leave. |
|
550 |
|
end. |
|
551 |
|
end. |
|
552 |
|
end. /* IF EXECNAME <>"RCSOIS.P" AND EXECNAME <> "RCUNIS.P" */ |
|
553 |
|
|
|
554 |
|
else do: |
|
555 |
|
l_ctrj = 1. |
|
556 |
|
/* OBTAINING FIRST SALES ORDER FROM ORDER_NBR ARRAY IF */ |
|
557 |
|
/* INVOICE PRINT IS BEING RUN FROM PRE-SHIPPER/SHIPPER CONFIRM */ |
|
558 |
|
/* OR SHIPPER UNCONFIRM */ |
|
559 |
|
l_so_nbr = order_nbrs[l_ctrj]. |
|
560 |
|
for first so_mstr where so_domain = global_domain |
|
561 |
|
and so_nbr = l_so_nbr |
|
562 |
|
and so_compl_stat = "" |
|
563 |
|
no-lock: end. |
|
564 |
|
end. |
|
565 |
|
|
|
566 |
|
repeat while available so_mstr: |
|
567 |
|
foundone = true. |
|
568 |
|
|
|
569 |
|
/* CALL PROCEDURE p_consolidate TO FIND IF THERE EXIST PENDING */ |
|
570 |
|
/* INVOICES REFERENCING SAME MANUALLY ENTERED INVOICE NUMBER */ |
|
571 |
|
/* NOTE: FOR QADFinancials, Manually entered invoice numbers */ |
|
572 |
|
/* are no longer supported. Need to determine if the internal */ |
|
573 |
|
/* procedure, p_consolidate, and the flag l_inv_conso should be deleted. */ |
|
574 |
|
/* EMPTY THE TEMP-TABLES FOR CONSOLIDATION OF INVOICE */ |
|
575 |
|
{us/gp/gprunp.i "txincopl" "p" "empty-table"} |
|
576 |
|
|
|
577 |
|
assign |
|
578 |
|
l_inv_conso = no |
|
579 |
|
l_orig_invnbr = "". |
|
580 |
|
|
|
581 |
|
/* THE BLOCKA HAS BEEN INTRODUCED AND THE NEXT STATEMENTS IN THE */ |
|
582 |
|
/* PROGRAM WHICH REFER TO THE OUTER REPEAT WHILE AVAILABLE so_mstr*/ |
|
583 |
|
/* HAVE BEEN REPLACED BY THE STATEMENT LEAVE BLOCKA. THIS IS */ |
|
584 |
|
/* NECCESSARY, SINCE THE FIND NEXT so_mstr IS BEING DONE AT THE */ |
|
585 |
|
/* END OF THE REPEAT LOOP AS A RESULT OF WHICH, THE INVOICE PRINT */ |
|
586 |
|
/* WENT INTO AN INFINITE LOOP FOR ALL CONDITIONS WHERE THE NEXT */ |
|
587 |
|
/* STATEMENT IS BEING USED */ |
|
588 |
|
blocka: |
|
589 |
|
do: |
|
590 |
|
|
|
591 |
|
daybookDate = today. |
|
592 |
|
|
|
593 |
|
if eff_date <> ? then |
|
594 |
|
daybookDate = eff_date. |
|
595 |
|
else if so_inv_date <> ? then |
|
596 |
|
daybookDate = so_inv_date. |
|
597 |
|
|
|
598 |
|
run validateDaybookSet in hDaybookSetValidation |
|
599 |
|
( input so_mstr.so_daybookset, |
|
600 |
|
input so_mstr.so_site, |
|
601 |
|
input daybookDate, |
|
602 |
|
output iErrorNumber, |
|
603 |
|
output cErrorArgs). |
|
604 |
|
|
|
605 |
|
if iErrorNumber > 0 |
|
606 |
|
then do: |
|
607 |
|
{us/bbi/pxmsg.i &MSGNUM=iErrorNumber &ERRORLEVEL=3 &MSGARG1=cErrorArgs} |
|
608 |
|
leave blocka. |
|
609 |
|
end. |
|
610 |
|
|
|
611 |
|
/* Find the entity for the current header site*/ |
|
612 |
|
for first si_mstr no-lock |
|
613 |
|
where si_mstr.si_domain = so_domain |
|
614 |
|
and si_mstr.si_site = so_site: |
|
615 |
|
|
|
616 |
|
/* If this entity is already in our blocked list then skip this so*/ |
|
617 |
|
if lookup(si_mstr.si_entity,blockedEntities,chr(2)) <> 0 |
|
618 |
|
then leave blocka. |
|
619 |
|
|
|
620 |
|
{us/gl/glenchk.i |
|
621 |
|
&entity=si_mstr.si_entity |
|
622 |
|
&entity1=si_mstr.si_entity |
|
623 |
|
&entity_ok=lEntityOk} |
|
624 |
|
|
|
625 |
|
/* Error handling */ |
|
626 |
|
if not lEntityOk |
|
627 |
|
then do: |
|
628 |
|
/* Store a list of blocked entities so we only get one error message */ |
|
629 |
|
if blockedEntities = "" |
|
630 |
|
then |
|
631 |
|
assign blockedEntities = si_mstr.si_entity. |
|
632 |
|
else |
|
633 |
|
assign blockedEntities = blockedEntities + chr(2) |
|
634 |
|
+ si_mstr.si_entity. |
|
635 |
|
leave blocka. |
|
636 |
|
end. |
|
637 |
|
end. |
|
638 |
|
|
|
639 |
|
/* THIS TEST IS INCLUDED TO PREVENT THE PROGRAM FROM RE-INVOICING */ |
|
640 |
|
/* SALES ORDERS INCLUDED IN PREVIOUS CONSOLIDATIONS (EARLIER IN */ |
|
641 |
|
/* THIS LOOP). IT SEEMS NECESSARY BECAUSE PROGRESS DOES NOT */ |
|
642 |
|
/* NECESSARILY UPDATE ALL INDEXES AT THE SAME TIME IT UPDATES */ |
|
643 |
|
/* DATA IN THE DATABASE. */ |
|
644 |
|
for each shipper exclusive-lock: |
|
645 |
|
delete shipper. |
|
646 |
|
end. |
|
647 |
|
create shipper. |
|
648 |
|
assign shipper.shipper_sonbr = so_mstr.so_nbr. |
|
649 |
|
if recid(shipper) = -1 then . |
|
650 |
|
|
|
651 |
|
if not so_to_inv then leave blocka. |
|
652 |
|
find first cil_mstr where |
|
653 |
|
cil_mstr.cil_domain = global_domain and |
|
654 |
|
cil_cor_so_nbr = so_mstr.so_nbr |
|
655 |
|
no-lock no-error. |
|
656 |
|
if available cil_mstr and not inccor then leave blocka. |
|
657 |
|
|
|
658 |
|
if (oldcurr <> so_curr) or (oldcurr = "") then do: |
|
659 |
|
|
|
660 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-get-rnd-mthd" |
|
661 |
|
"(input so_curr, |
|
662 |
|
output rndmthd, |
|
663 |
|
output mc-error-number)"} |
|
664 |
|
if mc-error-number <> 0 then do: |
|
665 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=4} |
|
666 |
|
leave blocka. |
|
667 |
|
end. |
|
668 |
|
|
|
669 |
|
/* DETERMINE CURRENCY DISPLAY AMERICAN OR EUROPEAN */ |
|
670 |
|
find rnd_mstr where rnd_rnd_mthd = rndmthd no-lock no-error. |
|
671 |
|
if not available rnd_mstr then do: |
|
672 |
|
/* ROUND METHOD RECORD NOT FOUND */ |
|
673 |
|
{us/bbi/pxmsg.i &MSGNUM=863 &ERRORLEVEL=4} |
|
674 |
|
leave blocka. |
|
675 |
|
end. |
|
676 |
|
|
|
677 |
|
{us/so/socurfmt.i} |
|
678 |
|
prepaid_fmt = prepaid_old. |
|
679 |
|
{us/bbi/gprun.i ""gpcurfmt.p"" "(input-output prepaid_fmt, |
|
680 |
|
input rndmthd)"} |
|
681 |
|
|
|
682 |
|
oldcurr = so_curr. |
|
683 |
|
end. /* IF (OLDCURR <> SO_CURR) */ |
|
684 |
|
|
|
685 |
|
if can-find(qad_wkfl where qad_domain = global_domain |
|
686 |
|
and qad_key1 = "sosois.p" + so_nbr |
|
687 |
|
and qad_key2 = "BATCH" ) |
|
688 |
|
then |
|
689 |
|
leave blocka. |
|
690 |
|
|
|
691 |
|
/* FOR CALL INVOICES, USE TRANSACTION TYPE 38 INSTEAD OF 13 */ |
|
692 |
|
if so_fsm_type = "FSM-RO" |
|
693 |
|
then |
|
694 |
|
tax-tran-type = "38". |
|
695 |
|
else |
|
696 |
|
tax-tran-type = "13". |
|
697 |
|
|
|
698 |
|
{us/so/soivtot2.i} /* Initialize variables for invoice totals. */ |
|
699 |
|
|
|
700 |
|
assign |
|
701 |
|
comb_inv_nbr = "" |
|
702 |
|
taxable_amt = 0 |
|
703 |
|
nontaxable_amt = 0 . |
|
704 |
|
|
|
705 |
|
/* PRINT INVOICES, CREDITS, OR BOTH */ |
|
706 |
|
/* THIS ENHANCEMENT REQUIRES AN IMMEDIATE CALL TO SOIVTRL TO GET */ |
|
707 |
|
/* THE INVOICE TOTAL TO DETERMINE IF IT SHOULD BE PRINTED. */ |
|
708 |
|
if not incinv or not incmemo then do: |
|
709 |
|
|
|
710 |
|
so_recno = recid(so_mstr). |
|
711 |
|
/* TOTAL INVOICE */ |
|
712 |
|
undo_trl2 = true. |
|
713 |
|
|
|
714 |
|
{us/bbi/gprun.i ""soivtrl2.p"" |
|
715 |
|
"(input so_nbr, |
|
716 |
|
input '', |
|
717 |
|
input col-80 /* REPORT WIDTH */, |
|
718 |
|
input '13', |
|
719 |
|
input tot_cont_charge, |
|
720 |
|
input tot_line_charge, |
|
721 |
|
input l_consolidate)"} |
|
722 |
|
|
|
723 |
|
if undo_trl2 then leave blocka. |
|
724 |
|
|
|
725 |
|
if not incinv and ord_amt >= 0 then leave blocka. |
|
726 |
|
|
|
727 |
|
/* CREDIT PRINT TEST */ |
|
728 |
|
if not incmemo and ord_amt < 0 then leave blocka. |
|
729 |
|
|
|
730 |
|
{us/so/soivtot2.i} /* Initialize variables for invoice totals. */ |
|
731 |
|
|
|
732 |
|
end. |
|
733 |
|
|
|
734 |
|
assign |
|
735 |
|
rmaso = no |
|
736 |
|
print_invoice = yes |
|
737 |
|
sacontract = no. |
|
738 |
|
|
|
739 |
|
/* RMASO INDICATES AN RMA INVOICE */ |
|
740 |
|
if so_fsm_type = rma_c then |
|
741 |
|
rmaso = yes. |
|
742 |
|
|
|
743 |
|
/* IF "PRINT NO CHARGE RECEIPTS" (rmc_prt_rtn) IS NO, */ |
|
744 |
|
/* AND THE RMA INVOICE HAS ONLY ZERO PRICED RECEIPT */ |
|
745 |
|
/* LINES, THEN WE DON'T PRINT THE INVOICE. */ |
|
746 |
|
if available rmc_ctrl and |
|
747 |
|
not rmc_prt_rtn and |
|
748 |
|
so_fsm_type = rma_c |
|
749 |
|
then do: |
|
750 |
|
|
|
751 |
|
print_invoice = no. |
|
752 |
|
|
|
753 |
|
for each sod_det where sod_domain = global_domain |
|
754 |
|
and sod_nbr = so_nbr |
|
755 |
|
and sod_qty_inv <> 0 |
|
756 |
|
and sod_compl_stat = "" |
|
757 |
|
no-lock: |
|
758 |
|
if sod_price <> 0 or |
|
759 |
|
sod_rma_type <> "I" |
|
760 |
|
then |
|
761 |
|
print_invoice = yes. |
|
762 |
|
end. |
|
763 |
|
|
|
764 |
|
if print_invoice = no then do: |
|
765 |
|
so_recno = recid(so_mstr). |
|
766 |
|
{us/bbi/gprun.i ""sosoina.p""} |
|
767 |
|
leave blocka. |
|
768 |
|
end. |
|
769 |
|
|
|
770 |
|
end. /* if available rmc_ctrl */ |
|
771 |
|
|
|
772 |
|
/* Identify if it's a service contract billing. */ |
|
773 |
|
/* SACONTRACT INDICATES A SERVICE CONTRACT INVOICE */ |
|
774 |
|
if so_fsm_type = "SC" then sacontract = yes. |
|
775 |
|
|
|
776 |
|
termsdesc = "". |
|
777 |
|
{us/px/pxrun.i &PROC='getTermsDescription' &PROGRAM='adcrxr.p' |
|
778 |
|
&HANDLE=ph_adcrxr |
|
779 |
|
&PARAM="(input so_cr_terms, |
|
780 |
|
output termsdesc)"} |
|
781 |
|
|
|
782 |
|
find ad_mstr where ad_domain = global_domain |
|
783 |
|
and ad_addr = so_bill |
|
784 |
|
no-lock no-wait no-error. |
|
785 |
|
|
|
786 |
|
update billto = "". |
|
787 |
|
|
|
788 |
|
if available ad_mstr then do: |
|
789 |
|
|
|
790 |
|
/* Assign values to addr and format */ |
|
791 |
|
{us/mf/mfadfmt.i} |
|
792 |
|
|
|
793 |
|
assign |
|
794 |
|
billto[1] = addr[1] |
|
795 |
|
billto[2] = addr[2] |
|
796 |
|
billto[3] = addr[3] |
|
797 |
|
billto[4] = addr[4] |
|
798 |
|
billto[5] = addr[5] |
|
799 |
|
billto[6] = addr[6]. |
|
800 |
|
|
|
801 |
|
for first cm_mstr where cm_domain = global_domain |
|
802 |
|
and cm_addr = so_bill |
|
803 |
|
no-lock: end. |
|
804 |
|
|
|
805 |
|
/* Format based on sold-to country */ |
|
806 |
|
run setFormatForCountryCode in h_format |
|
807 |
|
(input cm_lang, input ad_mstr.ad_ctry). |
|
808 |
|
|
|
809 |
|
/* Move the PO number up into the address window */ |
|
810 |
|
/* (if it fits) */ |
|
811 |
|
hdr_po = po-lbl2 + so_po. |
|
812 |
|
|
|
813 |
|
if addr[6] <> "" |
|
814 |
|
and so_po = "" |
|
815 |
|
then |
|
816 |
|
billto[6] = addr[6]. |
|
817 |
|
|
|
818 |
|
end. /* if available ad_mstr */ |
|
819 |
|
else do: |
|
820 |
|
for first usr_mstr |
|
821 |
|
where usr_userid = global_userid |
|
822 |
|
no-lock: |
|
823 |
|
end. |
|
824 |
|
/* Default to user's format if country not available */ |
|
825 |
|
run setFormatForCountryCode in h_format |
|
826 |
|
(input global_user_lang, input usr_ctry_code). |
|
827 |
|
end. |
|
828 |
|
|
|
829 |
|
/*d2561* start added code >>> */ |
|
830 |
|
find ad_mstr where ad_domain = global_domain |
|
831 |
|
and ad_addr = so_ship |
|
832 |
|
no-lock no-wait no-error. |
|
833 |
|
/*d2561* end added code <<< */ |
|
834 |
|
/*d2561* start deleted code >>>> |
|
835 |
|
find ad_mstr where ad_domain = global_domain |
|
836 |
|
and ad_addr = so_cust |
|
837 |
|
no-lock no-wait no-error. |
|
838 |
|
*d2561* end deleted code <<<< */ |
|
839 |
|
|
|
840 |
|
update soldto = "". |
|
841 |
|
|
|
842 |
|
if available ad_mstr then do: |
|
843 |
|
|
|
844 |
|
/* Assign values to addr and format */ |
|
845 |
|
{us/mf/mfadfmt.i} |
|
846 |
|
|
|
847 |
|
assign |
|
848 |
|
soldto[1] = addr[1] |
|
849 |
|
soldto[2] = addr[2] |
|
850 |
|
soldto[3] = addr[3] |
|
851 |
|
soldto[4] = addr[4] |
|
852 |
|
soldto[5] = addr[5] |
|
853 |
|
soldto[6] = addr[6]. |
|
854 |
|
end. /* if available ad_mstr */ |
|
855 |
|
|
|
856 |
|
if so_app_owner = 'DOM' then do: |
|
857 |
|
{us/bbi/gprun.i ""sodomxr.p"" |
|
858 |
|
"(input so_nbr, |
|
859 |
|
input 0, |
|
860 |
|
input 'SO', |
|
861 |
|
output ent_ord_nbr, |
|
862 |
|
output ent_ord_line, |
|
863 |
|
output ent_ord_bill, |
|
864 |
|
output ent_ord_ship, |
|
865 |
|
output ent_ord_line_part, |
|
866 |
|
output ent_ord_line_uom)" } |
|
867 |
|
end. /* if so_app_owner = 'DOM' */ |
|
868 |
|
|
|
869 |
|
/* FIND VAT NO FOR SHIP TO OR BILL TO IF SHIP TO VAT=" " */ |
|
870 |
|
find ad_mstr where ad_domain = global_domain |
|
871 |
|
and ad_addr = so_ship |
|
872 |
|
no-lock no-wait no-error. |
|
873 |
|
|
|
874 |
|
if available ad_mstr |
|
875 |
|
then do: |
|
876 |
|
vatreg1 = "". |
|
877 |
|
for first cm_mstr where cm_domain = global_domain |
|
878 |
|
and cm_addr = so_cust |
|
879 |
|
no-lock: end. |
|
880 |
|
if available cm_mstr then |
|
881 |
|
vatreg1 = if so_cust <> so_ship |
|
882 |
|
then substring(ad_pst_id,1,15) |
|
883 |
|
else substring(cm_pst_id,1,15). |
|
884 |
|
|
|
885 |
|
if ad_pst_id = " " then do: |
|
886 |
|
find ad_mstr where ad_domain = global_domain |
|
887 |
|
and ad_addr = so_bill |
|
888 |
|
no-lock no-wait no-error. |
|
889 |
|
if available ad_mstr then do: |
|
890 |
|
{us/gp/gpvteprg.i} |
|
891 |
|
end. |
|
892 |
|
end. |
|
893 |
|
else do: |
|
894 |
|
{us/gp/gpvteprg.i} |
|
895 |
|
end. |
|
896 |
|
end. /* if available ad_mstr */ |
|
897 |
|
|
|
898 |
|
find cm_mstr where cm_domain = global_domain |
|
899 |
|
and cm_addr = so_cust |
|
900 |
|
no-lock no-error. |
|
901 |
|
if available cm_mstr then |
|
902 |
|
resale = cm_resale. |
|
903 |
|
else |
|
904 |
|
resale = "". |
|
905 |
|
|
|
906 |
|
hdr_call = "". |
|
907 |
|
if rmaso then do. |
|
908 |
|
find first rma_mstr where rma_domain = global_domain |
|
909 |
|
and rma_nbr = so_nbr |
|
910 |
|
and rma_prefix = "C" |
|
911 |
|
no-lock no-error. |
|
912 |
|
if available rma_mstr then |
|
913 |
|
hdr_call = call-lbl + rma_ca_nbr. |
|
914 |
|
end. |
|
915 |
|
|
|
916 |
|
assign |
|
917 |
|
addtax = yes |
|
918 |
|
so_recno = recid(so_mstr). |
|
919 |
|
|
|
920 |
|
/* DAYBOOK SET INVOICE NUMBER GENERATION */ |
|
921 |
|
if execname <> "sosorp20.p" then |
|
922 |
|
do for bsomstr: |
|
923 |
|
for first bsomstr where recid(bsomstr) = so_recno |
|
924 |
|
exclusive-lock: end. |
|
925 |
|
if available(bsomstr) |
|
926 |
|
then do: |
|
927 |
|
if so_inv_nbr = "" |
|
928 |
|
then do: |
|
929 |
|
if comb_inv_nbr <> "" |
|
930 |
|
then |
|
931 |
|
bsomstr.so_inv_nbr = comb_inv_nbr. |
|
932 |
|
else |
|
933 |
|
bsomstr.so_inv_nbr = bsomstr.so_nbr. |
|
934 |
|
end. /* IF so_inv_nbr = "" */ |
|
935 |
|
bsomstr.so_inv_date = inv_date. |
|
936 |
|
end. /* IF AVAILABLE(bsomstr) */ |
|
937 |
|
end. /* DO FOR BSOMSTR */ |
|
938 |
|
else do: |
|
939 |
|
{us/bbi/gprun.i ""sosoina.p""} |
|
940 |
|
end. |
|
941 |
|
|
|
942 |
|
{us/bbi/gprun.i ""txdelete.p"" |
|
943 |
|
"(input '16', |
|
944 |
|
input so_inv_nbr, |
|
945 |
|
input (if conso |
|
946 |
|
or (not conso and l_inv_conso) |
|
947 |
|
then |
|
948 |
|
'*' |
|
949 |
|
else |
|
950 |
|
so_nbr))" } |
|
951 |
|
|
|
952 |
|
if tax-tran-type = "38" then |
|
953 |
|
l_nbr = so_quote. |
|
954 |
|
else |
|
955 |
|
l_nbr = "". |
|
956 |
|
|
|
957 |
|
if l_inv_conso then |
|
958 |
|
run p_consotot |
|
959 |
|
(input nbr, |
|
960 |
|
input nbr1, |
|
961 |
|
input so_mstr.so_nbr, |
|
962 |
|
input so_mstr.so_inv_nbr). |
|
963 |
|
|
|
964 |
|
so_recno = recid(so_mstr). |
|
965 |
|
|
|
966 |
|
if not conso |
|
967 |
|
and not l_inv_conso |
|
968 |
|
then do: |
|
969 |
|
/* COPY tx2d_dets FROM SALES ORDER OR CALL INVOICE TO INVOICE */ |
|
970 |
|
{us/bbi/gprun.i ""txdetcpy.p"" |
|
971 |
|
"(input so_nbr, |
|
972 |
|
input l_nbr, |
|
973 |
|
input tax-tran-type, |
|
974 |
|
input so_inv_nbr, |
|
975 |
|
input so_nbr, |
|
976 |
|
input '16')"} |
|
977 |
|
end. /* IF NOT conso */ |
|
978 |
|
|
|
979 |
|
|
|
980 |
|
|
|
981 |
|
/*d2561* start added code >>> */ |
|
982 |
|
for first Debtor no-lock |
|
983 |
|
where Debtor.DebtorCode = so_cust, |
|
984 |
|
first BusinessRelation of Debtor no-lock, |
|
985 |
|
each Address no-lock |
|
986 |
|
where Address.BusinessRelation_ID = |
|
987 |
|
BusinessRelation.BusinessRelation_ID, |
|
988 |
|
first AddressType no-lock |
|
989 |
|
where AddressType.AddressType_ID = Address.AddressType_ID |
|
990 |
|
and AddressType.AddressTypeCode = "REMINDER" |
|
991 |
|
and AddressType.AddressTypeIsActive, |
|
992 |
|
first Contact no-lock |
|
993 |
|
where Contact.Address_ID = Address.Address_ID |
|
994 |
|
and Contact.ContactIsPrimary: |
|
995 |
|
vemail = Contact.ContactEmail. |
|
996 |
|
end. |
|
997 |
|
/*d2561* end added code <<< */ |
|
998 |
|
if execname = "sosorp20.p" then do: |
|
999 |
|
{us/so/sorphfrm.i} /* Form definitions for phead1 */ |
|
1000 |
|
|
|
1001 |
|
run GetHeading. |
|
1002 |
|
view frame phead1. |
|
1003 |
|
|
|
1004 |
|
if old_sod_nbr <> ? then page. |
|
1005 |
|
pages = page-number - 1. |
|
1006 |
|
|
|
1007 |
|
display |
|
1008 |
|
so_nbr |
|
1009 |
|
so_ship_date |
|
1010 |
|
so_ord_date |
|
1011 |
|
hdr_po |
|
1012 |
|
so_slspsn[1] |
|
1013 |
|
so_slspsn[2] |
|
1014 |
|
so_ship |
|
1015 |
|
so_slspsn[3] |
|
1016 |
|
so_slspsn[4] |
|
1017 |
|
so_shipvia |
|
1018 |
|
so_cr_terms |
|
1019 |
|
so_bol termsdesc |
|
1020 |
|
so_fob |
|
1021 |
|
hdr_call |
|
1022 |
|
resale |
|
1023 |
|
so_rmks |
|
1024 |
|
/*d2561*/ vemail |
|
1025 |
|
with frame phead2. |
|
1026 |
|
|
|
1027 |
|
hide frame phead2. |
|
1028 |
|
|
|
1029 |
|
if sacontract then do: |
|
1030 |
|
|
|
1031 |
|
/* FOR SERVICE CONTRACT INVOICES, PRINT THE PERIOD */ |
|
1032 |
|
/* OF COVERAGE BEING BILLED FOR, AND THE CONTRACT # */ |
|
1033 |
|
fsremarks = getTermLabel("FOR_PERIOD",25) + ": " + |
|
1034 |
|
string(so_req_date,"99/99/99") + |
|
1035 |
|
" " + getTermLabel("TO",10) + ": " + |
|
1036 |
|
string(so_due_date,"99/99/99"). |
|
1037 |
|
put fsremarks at 15. |
|
1038 |
|
|
|
1039 |
|
fsremarks = getTermLabel("SERVICE_CONTRACT",35) + ": " + so_sa_nbr. |
|
1040 |
|
put fsremarks at 15. |
|
1041 |
|
|
|
1042 |
|
end. /* if sacontract */ |
|
1043 |
|
|
|
1044 |
|
run PrintHeaderComment(input so_cmtindx, |
|
1045 |
|
input vcPriHeadComment). |
|
1046 |
|
put skip(1). |
|
1047 |
|
|
|
1048 |
|
/* IF THIS INVOICE IS FOR AN RMA WHICH REFERENCES */ |
|
1049 |
|
/* A CALL, PRINT HEADER COMMENTS FROM THAT CALL */ |
|
1050 |
|
if rmaso then do: |
|
1051 |
|
if available rma_mstr then do: |
|
1052 |
|
/* NOTE: CA_CATEGORY = "0" FOR CALLS, AND */ |
|
1053 |
|
/* "QUOTE" FOR CALL QUOTES. */ |
|
1054 |
|
find first ca_mstr where ca_domain = global_domain |
|
1055 |
|
and ca_nbr = rma_ca_nbr |
|
1056 |
|
and ca_category = "0" |
|
1057 |
|
no-lock no-error. |
|
1058 |
|
if available ca_mstr then do: |
|
1059 |
|
put skip(1). |
|
1060 |
|
run PrintHeaderComment(input ca_cmtindx, |
|
1061 |
|
input vcPriHeadComment). |
|
1062 |
|
end. /* if available ca_mstr */ |
|
1063 |
|
end. /* if available rma_mstr */ |
|
1064 |
|
end. /* if rmaso */ |
|
1065 |
|
end. /* if execname = "sosorp20.p" */ |
|
1066 |
|
|
|
1067 |
|
old_sod_nbr = so_nbr. |
|
1068 |
|
|
|
1069 |
|
/*Establish the label for the display of discounts*/ |
|
1070 |
|
if disc_det_key <> "1" then do: |
|
1071 |
|
find first lngd_det |
|
1072 |
|
where lngd_dataset begins "soprint" |
|
1073 |
|
and lngd_field = "det_disc_prnt" |
|
1074 |
|
and lngd_lang = global_user_lang |
|
1075 |
|
and lngd_key1 = disc_det_key |
|
1076 |
|
no-lock no-error. |
|
1077 |
|
if available lngd_det then |
|
1078 |
|
disc_prnt_label = lngd_translation. |
|
1079 |
|
end. |
|
1080 |
|
|
|
1081 |
|
if execname = "sosorp20.p" then do: |
|
1082 |
|
/*d2561* {us/bbi/gprun.i ""sorp1a01.p"" "(output tot_cont_charge,*/ |
|
1083 |
|
/*d2561*/ {us/bbi/gprun.i ""xxrp1a01.p"" "(output tot_cont_charge, |
|
1084 |
|
output tot_line_charge)"} |
|
1085 |
|
end. |
|
1086 |
|
|
|
1087 |
|
find si_mstr where si_domain = global_domain |
|
1088 |
|
and si_site = so_site |
|
1089 |
|
no-lock no-error. |
|
1090 |
|
|
|
1091 |
|
assign |
|
1092 |
|
sales_entity = if available si_mstr then si_entity |
|
1093 |
|
else glentity |
|
1094 |
|
tot_prepaid_amt = 0 |
|
1095 |
|
tot_ptax_amt = 0 |
|
1096 |
|
l_consolidate = no. |
|
1097 |
|
|
|
1098 |
|
/*Check if this is a credit card order*/ |
|
1099 |
|
{us/gp/gprunp.i "gpccpl" "p" "isCCOrder" |
|
1100 |
|
"(input so_nbr, output vlResult)"} |
|
1101 |
|
/*If it is then view credit card message frame*/ |
|
1102 |
|
if vlResult then |
|
1103 |
|
display vcCreditCardMsg with frame soccmsg. |
|
1104 |
|
|
|
1105 |
|
/* MOVED THE CODE FROM BELOW SO THAT THE TOTALS OF THE */ |
|
1106 |
|
/* FIRST SALES ORDER ARE ACCUMULATED BEFORE CHECKING */ |
|
1107 |
|
/* FOR ITS POSSIBLE CONSOLIDATIONS WITH THE REMAINING */ |
|
1108 |
|
/* SALES ORDERS */ |
|
1109 |
|
/* TOTAL ORDER, BUT DON'T PRINT THE DETAIL REPORT YET*/ |
|
1110 |
|
if not conso |
|
1111 |
|
and not l_inv_conso |
|
1112 |
|
then do: |
|
1113 |
|
undo_trl2 = true. |
|
1114 |
|
{us/bbi/gprun.i ""soivtrl2.p"" "(input so_inv_nbr, |
|
1115 |
|
input so_nbr, |
|
1116 |
|
input col-80 /* REPORT WIDTH */, |
|
1117 |
|
input '16', |
|
1118 |
|
input tot_cont_charge, |
|
1119 |
|
input tot_line_charge, |
|
1120 |
|
input l_consolidate)"} |
|
1121 |
|
|
|
1122 |
|
if undo_trl2 then return. |
|
1123 |
|
{us/so/soivtod7.i} /* ACCUMULATE INVOICE TOTALS */ |
|
1124 |
|
|
|
1125 |
|
/* STORE THIS VALUE, WHICH CAN BE USED BY POST SUBROUTINE */ |
|
1126 |
|
if execname <> "sosorp20.p" then |
|
1127 |
|
run addOrderTotal in hInvoiceTotal |
|
1128 |
|
(input so_nbr, |
|
1129 |
|
input invtot_ord_amt). |
|
1130 |
|
end. /* IF NOT conso */ |
|
1131 |
|
|
|
1132 |
|
/* Check for consolable invoices */ |
|
1133 |
|
/* ADDED CONDITION TO ENTER LOOP IF CONSOLIDATE INVOICES IS NO */ |
|
1134 |
|
/* BUT MULTIPLE PENDING INVOICES REFERENCE SAME INVOICE NUMBER */ |
|
1135 |
|
if conso |
|
1136 |
|
or (not conso and l_inv_conso) |
|
1137 |
|
then do: |
|
1138 |
|
{us/gp/gprunp.i "txincopl" "p" "create-record" |
|
1139 |
|
"(input recid(so_mstr), |
|
1140 |
|
input tax-tran-type)" } |
|
1141 |
|
|
|
1142 |
|
if (execname <> "rcsois.p" and |
|
1143 |
|
execname <> "whrfshtr.p" and |
|
1144 |
|
index(program-name(4),'rcauis01') = 0 and |
|
1145 |
|
execname <> "rcunis.p" and |
|
1146 |
|
lookup(execname,l_consign_progs) = 0) |
|
1147 |
|
then do: |
|
1148 |
|
for each somstr2 |
|
1149 |
|
where somstr2.so_domain = global_domain |
|
1150 |
|
and (so_nbr > so_mstr.so_nbr and so_nbr <= nbr1) |
|
1151 |
|
and (so_to_inv = yes) |
|
1152 |
|
and (so_ship_date >= shipdate and so_ship_date <= shipdate1) |
|
1153 |
|
and (so_lang >= lang and so_lang <= lang1) |
|
1154 |
|
and (so_daybookset >= daybookset and so_daybookset <= daybookset1) |
|
1155 |
|
and (so_site >= site and so_site <= site1) |
|
1156 |
|
and so_compl_stat = "" |
|
1157 |
|
no-lock by so_to_inv by so_nbr: |
|
1158 |
|
|
|
1159 |
|
/* ASSIGN TRANSACTION TYPE AS 38 FOR CALL INVOICES */ |
|
1160 |
|
if somstr2.so_fsm_type = "FSM-RO" |
|
1161 |
|
then |
|
1162 |
|
tax-tran-type = "38". |
|
1163 |
|
else |
|
1164 |
|
tax-tran-type = "13". |
|
1165 |
|
|
|
1166 |
|
if (somstr2.so_inv_nbr <> "" |
|
1167 |
|
and somstr2.so_inv_nbr <> so_mstr.so_inv_nbr) |
|
1168 |
|
or somstr2.so_cust <> so_mstr.so_cust |
|
1169 |
|
then |
|
1170 |
|
next. |
|
1171 |
|
|
|
1172 |
|
/* PROCEDURE FOR CONSOLIDATION RULES */ |
|
1173 |
|
pass-con = 1. |
|
1174 |
|
if dom-single = yes |
|
1175 |
|
then pass-con = 3. |
|
1176 |
|
else if available shc_ctrl and shc_check_ship_pending |
|
1177 |
|
then pass-con = 4. |
|
1178 |
|
{us/bbi/gprun.i ""soconsod.p"" "(input pass-con, |
|
1179 |
|
input so_mstr.so_nbr, |
|
1180 |
|
input so_nbr, |
|
1181 |
|
output l_consolidate, |
|
1182 |
|
output l_msg_text)"} |
|
1183 |
|
if l_consolidate |
|
1184 |
|
then do: |
|
1185 |
|
{us/gp/gprunp.i "txincopl" "p" "create-record" |
|
1186 |
|
"(input recid(somstr2), |
|
1187 |
|
input tax-tran-type)" } |
|
1188 |
|
end. /* IF l_consolidate */ |
|
1189 |
|
end. /* FOR EACH somstr2 */ |
|
1190 |
|
r-result = 0 . |
|
1191 |
|
{us/gp/gprunp.i "txincopl" "p" "txcalc" |
|
1192 |
|
"(input 16 , |
|
1193 |
|
input so_mstr.so_inv_nbr , |
|
1194 |
|
input 'CONSOL' , |
|
1195 |
|
input 0 , |
|
1196 |
|
input tax-tran-type , |
|
1197 |
|
input no , |
|
1198 |
|
output r-result)" } |
|
1199 |
|
|
|
1200 |
|
undo_trl2 = true. |
|
1201 |
|
{us/bbi/gprun.i ""soivtrl2.p"" "(input so_mstr.so_inv_nbr, |
|
1202 |
|
input (if conso |
|
1203 |
|
or (not conso and l_inv_conso) |
|
1204 |
|
then |
|
1205 |
|
'*' |
|
1206 |
|
else |
|
1207 |
|
so_mstr.so_nbr), |
|
1208 |
|
input col-80 /* REPORT WIDTH */, |
|
1209 |
|
input '16', |
|
1210 |
|
input tot_cont_charge, |
|
1211 |
|
input tot_line_charge, |
|
1212 |
|
input (if conso |
|
1213 |
|
or (not conso and l_inv_conso) |
|
1214 |
|
then |
|
1215 |
|
yes |
|
1216 |
|
else |
|
1217 |
|
l_consolidate ))"} |
|
1218 |
|
if undo_trl2 then return. |
|
1219 |
|
|
|
1220 |
|
{us/so/soivtod7.i} /* ACCUMULATE INVOICE TOTALS */ |
|
1221 |
|
|
|
1222 |
|
if execname <> "sosorp20.p" then |
|
1223 |
|
run addOrderTotal in hInvoiceTotal (so_mstr.so_nbr, invtot_ord_amt). |
|
1224 |
|
|
|
1225 |
|
addtax = no. |
|
1226 |
|
|
|
1227 |
|
for each somstr2 |
|
1228 |
|
where somstr2.so_domain = global_domain |
|
1229 |
|
and (so_nbr > so_mstr.so_nbr and so_nbr <= nbr1) |
|
1230 |
|
and (so_to_inv = yes) |
|
1231 |
|
and (so_ship_date >= shipdate and so_ship_date <= shipdate1) |
|
1232 |
|
and (so_lang >= lang and so_lang <= lang1) |
|
1233 |
|
and (so_daybookset >= daybookset and so_daybookset <= daybookset1) |
|
1234 |
|
and (so_site >= site and so_site <= site1) |
|
1235 |
|
and so_compl_stat = "" |
|
1236 |
|
no-lock by so_inv_nbr by so_nbr: |
|
1237 |
|
|
|
1238 |
|
/* ASSIGN TRANSACTION TYPE AS 38 FOR CALL INVOICES */ |
|
1239 |
|
if somstr2.so_fsm_type = "FSM-RO" |
|
1240 |
|
then |
|
1241 |
|
tax-tran-type = "38". |
|
1242 |
|
else |
|
1243 |
|
tax-tran-type = "13". |
|
1244 |
|
|
|
1245 |
|
if not incinv or not incmemo |
|
1246 |
|
then do: |
|
1247 |
|
so_recno = recid(somstr2). |
|
1248 |
|
/* GET THE INVOICE TOTAL */ |
|
1249 |
|
undo_trl2 = true. |
|
1250 |
|
{us/bbi/gprun.i ""soivtrl2.p"" |
|
1251 |
|
"(input comb_inv_nbr, |
|
1252 |
|
input so_nbr, |
|
1253 |
|
input col-80 /* REPORT WIDTH */, |
|
1254 |
|
input '16', |
|
1255 |
|
input tot_cont_charge, |
|
1256 |
|
input tot_line_charge, |
|
1257 |
|
input l_consolidate)"} |
|
1258 |
|
|
|
1259 |
|
if not incinv and ord_amt >= 0 then |
|
1260 |
|
next. |
|
1261 |
|
|
|
1262 |
|
if not incmemo and ord_amt < 0 then |
|
1263 |
|
next. |
|
1264 |
|
|
|
1265 |
|
end. /* IF NOT INCINV OR NOT INCMEMO */ |
|
1266 |
|
|
|
1267 |
|
run process-conso |
|
1268 |
|
(input somstr2.so_nbr, |
|
1269 |
|
input so_mstr.so_nbr, |
|
1270 |
|
input so_mstr.so_inv_nbr, |
|
1271 |
|
input so_mstr.so_cust) . |
|
1272 |
|
|
|
1273 |
|
if undo_trl2 then |
|
1274 |
|
return. |
|
1275 |
|
|
|
1276 |
|
end. /* for each */ |
|
1277 |
|
end. /* IF execname <> "rcsois" ... */ |
|
1278 |
|
else do for somstr2: |
|
1279 |
|
|
|
1280 |
|
l_ctrk = l_ctrj + 1. |
|
1281 |
|
|
|
1282 |
|
/* FOR CONSOLIDATIONS, OBTAINING SALES ORDER FROM ORDER_NBR */ |
|
1283 |
|
/* ARRAY OR ORDER_NBR_LIST IF INVOICE PRINT IS BEING RUN FROM */ |
|
1284 |
|
/* PRE-SHIPPER/SHIPPER CONFIRM OR SHIPPER UNCONFIRM */ |
|
1285 |
|
l_so_nbr2 = if (l_ctrk <= 30) then |
|
1286 |
|
order_nbrs[l_ctrk] |
|
1287 |
|
else |
|
1288 |
|
entry(l_ctrk - 30 ,order_nbr_list). |
|
1289 |
|
|
|
1290 |
|
for first somstr2 where somstr2.so_domain = global_domain |
|
1291 |
|
and somstr2.so_nbr = l_so_nbr2 |
|
1292 |
|
and somstr2.so_compl_stat = "" |
|
1293 |
|
no-lock: |
|
1294 |
|
end. /* FOR FIRST somstr2 */ |
|
1295 |
|
|
|
1296 |
|
if addtax |
|
1297 |
|
then do: |
|
1298 |
|
repeat while available somstr2 and somstr2.so_to_inv: |
|
1299 |
|
/* PROCEDURE FOR CONSOLIDATION RULES */ |
|
1300 |
|
pass-con = 1. |
|
1301 |
|
if dom-single = yes |
|
1302 |
|
then pass-con = 3. |
|
1303 |
|
else if available shc_ctrl and shc_check_ship_pending |
|
1304 |
|
then pass-con = 4. |
|
1305 |
|
{us/bbi/gprun.i ""soconsod.p"" "(input pass-con, |
|
1306 |
|
input so_mstr.so_nbr, |
|
1307 |
|
input so_nbr, |
|
1308 |
|
output l_consolidate, |
|
1309 |
|
output l_msg_text)"} |
|
1310 |
|
if l_consolidate |
|
1311 |
|
then do: |
|
1312 |
|
{us/gp/gprunp.i "txincopl" "p" "create-record" |
|
1313 |
|
"(input recid(somstr2), |
|
1314 |
|
input tax-tran-type)" } |
|
1315 |
|
end. /* IF l_consolidate */ |
|
1316 |
|
|
|
1317 |
|
l_ctrk = l_ctrk + 1. |
|
1318 |
|
|
|
1319 |
|
/* OBTAIN NEXT SALES ORDER FROM ORDER_NBR ARRAY OR */ |
|
1320 |
|
/* THE ORDER_NBR_LIST */ |
|
1321 |
|
l_so_nbr2 = if (l_ctrk <= 30) then |
|
1322 |
|
order_nbrs[l_ctrk] |
|
1323 |
|
else |
|
1324 |
|
entry(l_ctrk - 30 ,order_nbr_list). |
|
1325 |
|
|
|
1326 |
|
for first somstr2 |
|
1327 |
|
where somstr2.so_domain = global_domain |
|
1328 |
|
and somstr2.so_nbr = l_so_nbr2 |
|
1329 |
|
and somstr2.so_compl_stat = "" |
|
1330 |
|
no-lock: |
|
1331 |
|
end. /* FOR FIRST somstr2 */ |
|
1332 |
|
|
|
1333 |
|
end. /* REPEAT WHILE AVAILABLE SOMSTR2 */ |
|
1334 |
|
|
|
1335 |
|
{us/gp/gprunp.i "txincopl" "p" "txcalc" |
|
1336 |
|
"(input 16 , |
|
1337 |
|
input so_mstr.so_inv_nbr , |
|
1338 |
|
input 'CONSOL' , |
|
1339 |
|
input 0 , |
|
1340 |
|
input tax-tran-type , |
|
1341 |
|
input no , |
|
1342 |
|
output r-result)" } |
|
1343 |
|
|
|
1344 |
|
undo_trl2 = true. |
|
1345 |
|
{us/bbi/gprun.i ""soivtrl2.p"" |
|
1346 |
|
"(input so_mstr.so_inv_nbr, |
|
1347 |
|
input (if conso |
|
1348 |
|
or (not conso and l_inv_conso) |
|
1349 |
|
then |
|
1350 |
|
'*' |
|
1351 |
|
else |
|
1352 |
|
so_mstr.so_nbr), |
|
1353 |
|
input col-80 /* REPORT WIDTH */, |
|
1354 |
|
input '16', |
|
1355 |
|
input tot_cont_charge, |
|
1356 |
|
input tot_line_charge, |
|
1357 |
|
input (if conso |
|
1358 |
|
or (not conso and l_inv_conso) |
|
1359 |
|
then |
|
1360 |
|
yes |
|
1361 |
|
else |
|
1362 |
|
l_consolidate ))"} |
|
1363 |
|
|
|
1364 |
|
if undo_trl2 then return. |
|
1365 |
|
assign |
|
1366 |
|
l_ctrk = l_ctrj |
|
1367 |
|
l_so_nbr2 = if (l_ctrk <= 30) then |
|
1368 |
|
order_nbrs[l_ctrk] |
|
1369 |
|
else |
|
1370 |
|
entry(l_ctrk - 30 ,order_nbr_list). |
|
1371 |
|
|
|
1372 |
|
for first somstr2 |
|
1373 |
|
where somstr2.so_domain = global_domain |
|
1374 |
|
and somstr2.so_nbr = l_so_nbr2 |
|
1375 |
|
and somstr2.so_compl_stat = "" |
|
1376 |
|
no-lock: |
|
1377 |
|
end. /* FOR FIRST somstr2 */ |
|
1378 |
|
|
|
1379 |
|
{us/so/soivtod7.i} /* ACCUMULATE INVOICE TOTALS */ |
|
1380 |
|
|
|
1381 |
|
addtax = no. |
|
1382 |
|
if execname <> "sosorp20.p" then |
|
1383 |
|
run addOrderTotal in hInvoiceTotal (so_mstr.so_nbr, invtot_ord_amt). |
|
1384 |
|
|
|
1385 |
|
end. /* IF addtax */ |
|
1386 |
|
l_ctrk = l_ctrj + 1. |
|
1387 |
|
|
|
1388 |
|
/* FOR CONSOLIDATIONS, OBTAINING SALES ORDER FROM ORDER_NBR */ |
|
1389 |
|
/* ARRAY OR ORDER_NBR_LIST IF INVOICE PRINT IS BEING RUN FROM */ |
|
1390 |
|
/* PRE-SHIPPER/SHIPPER CONFIRM OR SHIPPER UNCONFIRM */ |
|
1391 |
|
l_so_nbr2 = if (l_ctrk <= 30) then |
|
1392 |
|
order_nbrs[l_ctrk] |
|
1393 |
|
else |
|
1394 |
|
entry(l_ctrk - 30 ,order_nbr_list). |
|
1395 |
|
|
|
1396 |
|
for first somstr2 |
|
1397 |
|
where somstr2.so_domain = global_domain |
|
1398 |
|
and somstr2.so_nbr = l_so_nbr2 |
|
1399 |
|
and somstr2.so_compl_stat = "" |
|
1400 |
|
no-lock: |
|
1401 |
|
end. /* FOR FIRST somstr2 */ |
|
1402 |
|
|
|
1403 |
|
repeat while available somstr2 and somstr2.so_to_inv: |
|
1404 |
|
|
|
1405 |
|
run process-conso |
|
1406 |
|
(input somstr2.so_nbr, |
|
1407 |
|
input so_mstr.so_nbr, |
|
1408 |
|
input so_mstr.so_inv_nbr, |
|
1409 |
|
input so_mstr.so_cust). |
|
1410 |
|
|
|
1411 |
|
if undo_trl2 then |
|
1412 |
|
return. |
|
1413 |
|
|
|
1414 |
|
l_ctrk = l_ctrk + 1. |
|
1415 |
|
|
|
1416 |
|
/* OBTAIN NEXT SALES ORDER FROM ORDER_NBR ARRAY OR */ |
|
1417 |
|
/* THE ORDER_NBR_LIST */ |
|
1418 |
|
l_so_nbr2 = if (l_ctrk <= 30) then |
|
1419 |
|
order_nbrs[l_ctrk] |
|
1420 |
|
else |
|
1421 |
|
entry(l_ctrk - 30 ,order_nbr_list). |
|
1422 |
|
|
|
1423 |
|
for first somstr2 |
|
1424 |
|
where somstr2.so_domain = global_domain |
|
1425 |
|
and somstr2.so_nbr = l_so_nbr2 |
|
1426 |
|
and somstr2.so_compl_stat = "" |
|
1427 |
|
no-lock: |
|
1428 |
|
end. /* FOR FIRST somstr2 */ |
|
1429 |
|
|
|
1430 |
|
end. /* REPEAT WHILE AVAILABLE SOMSTR2 */ |
|
1431 |
|
|
|
1432 |
|
end. /* IF EXECNAME = "RCSOIS.P" OR EXECNAME = "RCUNIS.P" */ |
|
1433 |
|
|
|
1434 |
|
end. /* IF CONSO */ |
|
1435 |
|
|
|
1436 |
|
if execname = "sosorp20.p" then do: |
|
1437 |
|
if can-find(mfc_ctrl where mfc_domain = global_domain and |
|
1438 |
|
mfc_module = "SO" and |
|
1439 |
|
mfc_seq = 170) |
|
1440 |
|
then do: |
|
1441 |
|
so_recno = recid(so_mstr). |
|
1442 |
|
{us/bbi/gprun.i ""sorp10c.p""} |
|
1443 |
|
end. |
|
1444 |
|
|
|
1445 |
|
hide frame continue. |
|
1446 |
|
|
|
1447 |
|
/*Establish the label for the display of discounts*/ |
|
1448 |
|
if disc_sum_key <> "1" and |
|
1449 |
|
disc_sum_key <> disc_det_key |
|
1450 |
|
then do: |
|
1451 |
|
find first lngd_det where lngd_dataset begins "soprint" |
|
1452 |
|
and lngd_field = "det_disc_prnt" |
|
1453 |
|
and lngd_lang = global_user_lang |
|
1454 |
|
and lngd_key1 = disc_sum_key |
|
1455 |
|
no-lock no-error. |
|
1456 |
|
if available lngd_det then |
|
1457 |
|
disc_prnt_label = lngd_translation. |
|
1458 |
|
else |
|
1459 |
|
disc_prnt_label = "". |
|
1460 |
|
end. |
|
1461 |
|
|
|
1462 |
|
/* Print discount summary, delete disc wkfl records */ |
|
1463 |
|
{us/so/sopiprn2.i} |
|
1464 |
|
|
|
1465 |
|
end. |
|
1466 |
|
|
|
1467 |
|
find first soc_ctrl where soc_domain = global_domain |
|
1468 |
|
no-lock no-error. |
|
1469 |
|
if available soc_ctrl and soc_print_ship = yes then do: |
|
1470 |
|
assign prevxab = "" . |
|
1471 |
|
for each shipper, |
|
1472 |
|
each soddet2 |
|
1473 |
|
where soddet2.sod_domain = global_domain |
|
1474 |
|
and soddet2.sod_nbr = shipper_sonbr |
|
1475 |
|
and soddet2.sod_compl_stat = "" |
|
1476 |
|
no-lock, |
|
1477 |
|
each abs_mstr |
|
1478 |
|
where abs_mstr.abs_domain = global_domain |
|
1479 |
|
and abs_order = sod_nbr |
|
1480 |
|
and abs_line = string(sod_line) |
|
1481 |
|
and abs_shp_date <> ? |
|
1482 |
|
no-lock by abs_id: |
|
1483 |
|
if abs_inv_nbr <> "" then next. |
|
1484 |
|
else do: |
|
1485 |
|
assign abs_recno = recid(abs_mstr). |
|
1486 |
|
{us/bbi/gprun.i ""sososhr6.p""} |
|
1487 |
|
end. |
|
1488 |
|
end. |
|
1489 |
|
end. |
|
1490 |
|
|
|
1491 |
|
/*PRINT TRAILER*/ |
|
1492 |
|
so_recno = recid(so_mstr). |
|
1493 |
|
|
|
1494 |
|
/* DISPLAY TRAILER*/ |
|
1495 |
|
/* PRINT TAX DETAIL FOR ALL SALES ORDERS */ |
|
1496 |
|
/* FOR THIS INVOICE NUMBER USING 132 COLUMN */ |
|
1497 |
|
/* AND NO FORCED PAGE BREAK */ |
|
1498 |
|
undo_txdetrp = true. |
|
1499 |
|
|
|
1500 |
|
/* ADDED SIXTH INPUT PARAMETER '' AND SEVENTH INPUT */ |
|
1501 |
|
/* PARAMETER yes TO ACCOMMODATE THE LOGIC INTRODUCED IN */ |
|
1502 |
|
/* txdetrpa.i FOR DISPLAYING THE APPROPRIATE CURRENCY */ |
|
1503 |
|
/* AMOUNT. */ |
|
1504 |
|
|
|
1505 |
|
if so_curr <> base_curr and isEUtransaction(so_site, so_cust) |
|
1506 |
|
then do: |
|
1507 |
|
assign exch_rate = so_ex_rate |
|
1508 |
|
exch_rate2 = so_ex_rate2. |
|
1509 |
|
|
|
1510 |
|
if (not so_fix_rate) then do: |
|
1511 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-get-ex-rate" |
|
1512 |
|
"(input so_curr, |
|
1513 |
|
input base_curr, |
|
1514 |
|
input so_ex_ratetype, |
|
1515 |
|
input so_inv_date, |
|
1516 |
|
output exch_rate, |
|
1517 |
|
output exch_rate2, |
|
1518 |
|
output mc-error-number)" } |
|
1519 |
|
if mc-error-number <> 0 then do: |
|
1520 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
1521 |
|
end. |
|
1522 |
|
|
|
1523 |
|
assign so_ex_rate = exch_rate |
|
1524 |
|
so_ex_rate2 = exch_rate2. |
|
1525 |
|
|
|
1526 |
|
end. /* IF (NOT SO_FIX_RATE) AND .. */ |
|
1527 |
|
|
|
1528 |
|
for each tx2d_det where tx2d_domain = global_domain |
|
1529 |
|
and tx2d_ref = so_inv_nbr |
|
1530 |
|
and tx2d_nbr = so_nbr |
|
1531 |
|
and tx2d_tr_type = "16" |
|
1532 |
|
and tx2d_tax_code <> "00000000" |
|
1533 |
|
exclusive-lock: |
|
1534 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-conv" |
|
1535 |
|
"(input so_curr, |
|
1536 |
|
input base_curr, |
|
1537 |
|
input exch_rate, |
|
1538 |
|
input exch_rate2, |
|
1539 |
|
input tx2d_cur_tax_amt, |
|
1540 |
|
input true, /* ROUND */ |
|
1541 |
|
output tx2d_tax_amt, |
|
1542 |
|
output mc-error-number)" } |
|
1543 |
|
|
|
1544 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-conv" |
|
1545 |
|
"(input so_curr, |
|
1546 |
|
input base_curr, |
|
1547 |
|
input exch_rate, |
|
1548 |
|
input exch_rate2, |
|
1549 |
|
input tx2d_tottax, |
|
1550 |
|
input true, /* ROUND */ |
|
1551 |
|
output tx2d_taxable_amt, |
|
1552 |
|
output mc-error-number)" } |
|
1553 |
|
|
|
1554 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-conv" |
|
1555 |
|
"(input so_curr, |
|
1556 |
|
input base_curr, |
|
1557 |
|
input exch_rate, |
|
1558 |
|
input exch_rate2, |
|
1559 |
|
input tx2d_cur_nontax_amt, |
|
1560 |
|
input true, /* ROUND */ |
|
1561 |
|
output tx2d_nontax_amt, |
|
1562 |
|
output mc-error-number)" } |
|
1563 |
|
|
|
1564 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-conv" |
|
1565 |
|
"(input so_curr, |
|
1566 |
|
input base_curr, |
|
1567 |
|
input exch_rate, |
|
1568 |
|
input exch_rate2, |
|
1569 |
|
input tx2d_cur_recov_amt, |
|
1570 |
|
input true, /* ROUND */ |
|
1571 |
|
output tx2d_recov_amt, |
|
1572 |
|
output mc-error-number)" } |
|
1573 |
|
|
|
1574 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-conv" |
|
1575 |
|
"(input so_curr, |
|
1576 |
|
input base_curr, |
|
1577 |
|
input exch_rate, |
|
1578 |
|
input exch_rate2, |
|
1579 |
|
input tx2d_cur_abs_ret_amt, |
|
1580 |
|
input true, /* ROUND */ |
|
1581 |
|
output tx2d_abs_ret_amt, |
|
1582 |
|
output mc-error-number)" } |
|
1583 |
|
end. |
|
1584 |
|
end. |
|
1585 |
|
|
|
1586 |
|
if execname = "sosorp20.p" then do: |
|
1587 |
|
{us/bbi/gprun.i ""txdetrp.p"" "(input '16', |
|
1588 |
|
input so_nbr, |
|
1589 |
|
input '*', |
|
1590 |
|
input col-80, |
|
1591 |
|
input trl_length, /* PAGE-BREAK */ |
|
1592 |
|
input '', |
|
1593 |
|
input yes)"} |
|
1594 |
|
|
|
1595 |
|
if undo_txdetrp then |
|
1596 |
|
undo, leave. /* FOR EACH SO_MSTR */ |
|
1597 |
|
|
|
1598 |
|
/*jpm*/ /*Temporarily remove PRM */ |
|
1599 |
|
/* |
|
1600 |
|
/* LOAD PREPAYMENTS */ |
|
1601 |
|
if so_fsm_type = "PRM" |
|
1602 |
|
then do: |
|
1603 |
|
{gprunmo.i |
|
1604 |
|
&module="PRM" |
|
1605 |
|
&program="pjsoprep.p" |
|
1606 |
|
¶m="""(input so_nbr, |
|
1607 |
|
input so_inv_nbr)"""} |
|
1608 |
|
end. |
|
1609 |
|
*/ |
|
1610 |
|
assign |
|
1611 |
|
tot_ptax_amt = tot_ptax_amt + so_prep_tax |
|
1612 |
|
tot_prepaid_amt = tot_prepaid_amt + so_prepaid |
|
1613 |
|
add-trl-length = if tot_prepaid_amt <> 0 then 5 |
|
1614 |
|
else 0. |
|
1615 |
|
|
|
1616 |
|
if so_curr <> base_curr then do: |
|
1617 |
|
assign l_basetaxtot = 0. |
|
1618 |
|
|
|
1619 |
|
for each tx2d_det |
|
1620 |
|
where tx2d_domain = global_domain |
|
1621 |
|
and tx2d_ref = so_inv_nbr |
|
1622 |
|
and tx2d_nbr = so_nbr |
|
1623 |
|
and tx2d_tr_type = "16" |
|
1624 |
|
and tx2d_tax_code <> "00000000" |
|
1625 |
|
no-lock: |
|
1626 |
|
l_basetaxtot = l_basetaxtot + tx2d_tax_amt. |
|
1627 |
|
end. |
|
1628 |
|
|
|
1629 |
|
{us/so/soivto11.i &totaltaxbase=l_basetaxtot |
|
1630 |
|
&totaltax=invtot_tax_amt |
|
1631 |
|
&socurr=so_curr |
|
1632 |
|
&eusite=so_site |
|
1633 |
|
&eubill=so_cust |
|
1634 |
|
&base_only=no |
|
1635 |
|
&linepos=38 |
|
1636 |
|
&labelpos=23} |
|
1637 |
|
end. |
|
1638 |
|
|
|
1639 |
|
if page-size - line-counter < trl_length + add-trl-length then |
|
1640 |
|
page. |
|
1641 |
|
|
|
1642 |
|
do while page-size - line-counter > trl_length + add-trl-length: |
|
1643 |
|
put skip(1). |
|
1644 |
|
end. |
|
1645 |
|
|
|
1646 |
|
if msg <> "" then put msg skip. |
|
1647 |
|
put |
|
1648 |
|
"-----------------------------------------" + |
|
1649 |
|
"-----------------------------------------" format "x(80)". |
|
1650 |
|
|
|
1651 |
|
{us/so/soivtod8.i} |
|
1652 |
|
|
|
1653 |
|
price_fmt = "-zzzz,zzz,zz9.99". |
|
1654 |
|
|
|
1655 |
|
{us/bbi/gprun.i ""gpcurfmt.p"" "(input-output price_fmt, |
|
1656 |
|
input rndmthd)"} |
|
1657 |
|
|
|
1658 |
|
tot_prepaid_amt:format in frame prepd = price_fmt. |
|
1659 |
|
tot_ptax_amt:format in frame prepd = price_fmt. |
|
1660 |
|
tot_prepaid_nett:format in frame prepd = price_fmt. |
|
1661 |
|
amt_due_af_prep:format in frame prepd = price_fmt. |
|
1662 |
|
|
|
1663 |
|
if tot_prepaid_amt <> 0 then do: |
|
1664 |
|
|
|
1665 |
|
/* IF THERE HAS BEEN A ROUNDING ERROR, ADJUST */ |
|
1666 |
|
/* THE PREPAID TAX AMOUNT TO BALANCE IT OUT. */ |
|
1667 |
|
if absolute(tot_ptax_amt - tax_amt) = .01 then |
|
1668 |
|
tot_ptax_amt = tax_amt. |
|
1669 |
|
|
|
1670 |
|
assign |
|
1671 |
|
tot_prepaid_nett = tot_prepaid_amt + tot_ptax_amt |
|
1672 |
|
amt_due_af_prep = invtot_ord_amt - tot_prepaid_nett. |
|
1673 |
|
|
|
1674 |
|
display |
|
1675 |
|
tot_prepaid_amt |
|
1676 |
|
tot_ptax_amt |
|
1677 |
|
tot_prepaid_nett |
|
1678 |
|
amt_due_af_prep |
|
1679 |
|
with frame prepd. |
|
1680 |
|
|
|
1681 |
|
end. |
|
1682 |
|
|
|
1683 |
|
page. |
|
1684 |
|
end. |
|
1685 |
|
|
|
1686 |
|
assign update_post = true. |
|
1687 |
|
|
|
1688 |
|
end. /* BLOCKA */ |
|
1689 |
|
|
|
1690 |
|
if (execname <> "rcsois.p" and |
|
1691 |
|
execname <> "whrfshtr.p" and |
|
1692 |
|
index(program-name(4),'rcauis01') = 0 and |
|
1693 |
|
execname <> "rcunis.p" and |
|
1694 |
|
lookup(execname,l_consign_progs) = 0) and |
|
1695 |
|
dom-single = no |
|
1696 |
|
then do: |
|
1697 |
|
find next so_mstr where so_domain = global_domain |
|
1698 |
|
and (so_nbr >= nbr and so_nbr <= nbr1) |
|
1699 |
|
and (so_to_inv = yes) |
|
1700 |
|
and (so_ship_date >= shipdate and so_ship_date <= shipdate1) |
|
1701 |
|
and (so_cust >= cust and so_cust <= cust1) |
|
1702 |
|
and (so_bill >= bill and so_bill <= bill1) |
|
1703 |
|
and (so_site >= site and so_site <= site1) |
|
1704 |
|
and (so_slspsn[1] >= sls-psn and so_slspsn[1] <= sls-psn1) |
|
1705 |
|
and (so_lang >= lang and so_lang <= lang1) |
|
1706 |
|
and (so_daybookset >= daybookset and so_daybookset <= daybookset1) |
|
1707 |
|
and so_compl_stat = "" |
|
1708 |
|
no-lock no-error. |
|
1709 |
|
|
|
1710 |
|
if available so_mstr |
|
1711 |
|
then do: |
|
1712 |
|
so_recno = recid(so_mstr). |
|
1713 |
|
run p_check_locked(input so_recno). |
|
1714 |
|
end. /* IF AVAILABLE so_mstr */ |
|
1715 |
|
end. /* IF (EXECNAME <> "RCSOIS.P" AND EXECNAME <> "RCUNIS.P") */ |
|
1716 |
|
|
|
1717 |
|
else do: |
|
1718 |
|
l_ctrj = l_ctrj + 1. |
|
1719 |
|
/* OBTAIN NEXT SALES ORDER FROM ORDER_NBR ARRAY OR */ |
|
1720 |
|
/* THE ORDER_NBR_LIST */ |
|
1721 |
|
l_so_nbr = if (l_ctrj <= 30) then |
|
1722 |
|
order_nbrs[l_ctrj] |
|
1723 |
|
else |
|
1724 |
|
entry(l_ctrj - 30 ,order_nbr_list). |
|
1725 |
|
for first so_mstr where so_domain = global_domain |
|
1726 |
|
and so_nbr = l_so_nbr |
|
1727 |
|
and so_compl_stat = "" |
|
1728 |
|
no-lock: end. |
|
1729 |
|
end. /* ELSE DO */ |
|
1730 |
|
|
|
1731 |
|
end. |
|
1732 |
|
|
|
1733 |
|
if not foundone then do: |
|
1734 |
|
/* 0 records found matching selection criteria */ |
|
1735 |
|
{us/bbi/pxmsg.i &MSGNUM=1615 &ERRORLEVEL=1 &MSGARG1=string(0) |
|
1736 |
|
&PAUSEAFTER=true} |
|
1737 |
|
end. |
|
1738 |
|
|
|
1739 |
|
run resetFormat in h_format. |
|
1740 |
|
delete procedure h_format no-error. |
|
1741 |
|
|
|
1742 |
|
PROCEDURE process-conso: |
|
1743 |
|
/* THIS PROCEDURE PROCESSES CONSOLIDATIONS OF SALES ORDERS */ |
|
1744 |
|
|
|
1745 |
|
/* INPUT PARAMETERS */ |
|
1746 |
|
define input parameter l_so_nbr3 like so_nbr no-undo. |
|
1747 |
|
define input parameter l_so_nbr like so_nbr no-undo. |
|
1748 |
|
define input parameter l_so_inv_nbr like so_inv_nbr no-undo. |
|
1749 |
|
define input parameter l_so_cust like so_cust no-undo. |
|
1750 |
|
/* BUFFERS */ |
|
1751 |
|
define buffer somstr3 for so_mstr. |
|
1752 |
|
|
|
1753 |
|
for first somstr3 where somstr3.so_domain = global_domain |
|
1754 |
|
and somstr3.so_nbr = l_so_nbr3 |
|
1755 |
|
and somstr3.so_compl_stat = "" |
|
1756 |
|
no-lock: end. |
|
1757 |
|
|
|
1758 |
|
if (somstr3.so_inv_nbr <> "" |
|
1759 |
|
and somstr3.so_inv_nbr <> l_so_inv_nbr) |
|
1760 |
|
or somstr3.so_cust <> l_so_cust |
|
1761 |
|
then |
|
1762 |
|
return. |
|
1763 |
|
|
|
1764 |
|
/* PROCEDURE FOR CONSOLIDATION RULES */ |
|
1765 |
|
pass-con = 1. |
|
1766 |
|
if dom-single = yes |
|
1767 |
|
then pass-con = 3. |
|
1768 |
|
else if available shc_ctrl and shc_ctrl.shc_check_ship_pending |
|
1769 |
|
then pass-con = 4. |
|
1770 |
|
{us/bbi/gprun.i ""soconsod.p"" "(input pass-con, |
|
1771 |
|
input l_so_nbr, |
|
1772 |
|
input somstr3.so_nbr, |
|
1773 |
|
output l_consolidate, |
|
1774 |
|
output l_msg_text)"} |
|
1775 |
|
|
|
1776 |
|
if l_consolidate then do: |
|
1777 |
|
|
|
1778 |
|
/*jpm*/ /*Temporarily remove PRM */ |
|
1779 |
|
/* |
|
1780 |
|
/* LOAD PREPAYMENTS */ |
|
1781 |
|
if so_fsm_type = "PRM" |
|
1782 |
|
then do: |
|
1783 |
|
{gprunmo.i |
|
1784 |
|
&module="PRM" |
|
1785 |
|
&program="pjsoprep.p" |
|
1786 |
|
¶m="""(input so_nbr, |
|
1787 |
|
input l_so_inv_nbr)"""} |
|
1788 |
|
end. |
|
1789 |
|
*/ |
|
1790 |
|
assign |
|
1791 |
|
tot_prepaid_amt = tot_prepaid_amt + so_prepaid |
|
1792 |
|
tot_ptax_amt = tot_ptax_amt + so_prep_tax |
|
1793 |
|
comb_inv_nbr = l_so_inv_nbr. |
|
1794 |
|
|
|
1795 |
|
if tax-tran-type = "38" then |
|
1796 |
|
l_nbr = so_quote. |
|
1797 |
|
else |
|
1798 |
|
l_nbr = "". |
|
1799 |
|
|
|
1800 |
|
so_recno = recid(somstr3). |
|
1801 |
|
|
|
1802 |
|
find first shipper where shipper.shipper_sonbr = somstr3.so_nbr no-error. |
|
1803 |
|
if not available shipper then |
|
1804 |
|
create shipper. |
|
1805 |
|
shipper.shipper_sonbr = somstr3.so_nbr. |
|
1806 |
|
if recid(shipper) = -1 then . |
|
1807 |
|
|
|
1808 |
|
/* UPDATE SALES ORDER HEADER */ |
|
1809 |
|
{us/bbi/gprun.i ""sosoina.p""} |
|
1810 |
|
|
|
1811 |
|
/* PRINT SALES ORDER LINES */ |
|
1812 |
|
/*d2561* {us/bbi/gprun.i ""sorp1a01.p"" "(output tot_cont_charge,*/ |
|
1813 |
|
/*d2561*/ {us/bbi/gprun.i ""xxrp1a01.p"" "(output tot_cont_charge, |
|
1814 |
|
output tot_line_charge)"} |
|
1815 |
|
/* TOTAL SALES ORDER */ |
|
1816 |
|
/* TOTAL ORDER, BUT DON'T PRINT THE DETAIL REPORT YET */ |
|
1817 |
|
undo_trl2 = true. |
|
1818 |
|
{us/bbi/gprun.i ""soivtrl2.p"" "(input comb_inv_nbr, |
|
1819 |
|
input somstr3.so_nbr, |
|
1820 |
|
input col-80, |
|
1821 |
|
input '16', |
|
1822 |
|
input tot_cont_charge, |
|
1823 |
|
input tot_line_charge, |
|
1824 |
|
input l_consolidate)"} |
|
1825 |
|
if undo_trl2 then return. |
|
1826 |
|
|
|
1827 |
|
/* ACCUMULATE INVOICE TOTALS */ |
|
1828 |
|
{us/so/soivtod7.i} |
|
1829 |
|
|
|
1830 |
|
if execname <> "sosorp20.p" then |
|
1831 |
|
run addOrderTotal in hInvoiceTotal (l_so_nbr, invtot_ord_amt). |
|
1832 |
|
|
|
1833 |
|
end. /* IF L_CONSOLIDATE */ |
|
1834 |
|
|
|
1835 |
|
END PROCEDURE. |
|
1836 |
|
|
|
1837 |
|
/* THIS PROCEDURE CHECKS FOR MULTIPLE PENDING INVOICES REFERENCING */ |
|
1838 |
|
/* SAME INVOICE NUMBER SO AS TO PROCEED FOR CONSOLIDATION EVEN IF */ |
|
1839 |
|
/* USER ENTERS CONSOLIDATE INVOICES AS NO. */ |
|
1840 |
|
PROCEDURE p_consolidate: |
|
1841 |
|
|
|
1842 |
|
define input parameter l_nbr1 like so_nbr no-undo. |
|
1843 |
|
define input parameter l_nbr2 like so_nbr no-undo. |
|
1844 |
|
define input parameter l_so_nbr like so_nbr no-undo. |
|
1845 |
|
define input parameter l_so_inv_nbr like so_inv_nbr no-undo. |
|
1846 |
|
define output parameter l_multi_conso like mfc_logical no-undo. |
|
1847 |
|
|
|
1848 |
|
define buffer somstr4 for so_mstr. |
|
1849 |
|
|
|
1850 |
|
isConsolDom = no. |
|
1851 |
|
if dom-single = yes |
|
1852 |
|
then do: |
|
1853 |
|
if can-find (first somstr4 |
|
1854 |
|
where somstr4.so_domain = global_domain |
|
1855 |
|
and somstr4.so_nbr >= l_nbr1 |
|
1856 |
|
and somstr4.so_nbr <= l_nbr2 |
|
1857 |
|
and somstr4.so_nbr <> l_so_nbr |
|
1858 |
|
and somstr4.so_inv_nbr = l_so_inv_nbr |
|
1859 |
|
and somstr4.so_app_owner = "DOM" |
|
1860 |
|
and somstr4.so_compl_stat = "") |
|
1861 |
|
then do: |
|
1862 |
|
assign |
|
1863 |
|
l_multi_conso = yes |
|
1864 |
|
isConsolDom = yes. |
|
1865 |
|
return. |
|
1866 |
|
end. |
|
1867 |
|
end. |
|
1868 |
|
|
|
1869 |
|
if can-find (first somstr4 |
|
1870 |
|
where somstr4.so_domain = global_domain |
|
1871 |
|
and somstr4.so_nbr >= l_nbr1 |
|
1872 |
|
and somstr4.so_nbr <= l_nbr2 |
|
1873 |
|
and somstr4.so_nbr <> l_so_nbr |
|
1874 |
|
and somstr4.so_inv_nbr = l_so_inv_nbr |
|
1875 |
|
and somstr4.so_compl_stat = "") |
|
1876 |
|
then |
|
1877 |
|
l_multi_conso = yes. |
|
1878 |
|
|
|
1879 |
|
END PROCEDURE. /* p_consolidate */ |
|
1880 |
|
|
|
1881 |
|
PROCEDURE p_consotot: |
|
1882 |
|
|
|
1883 |
|
define input parameter l_nbr1 like so_nbr no-undo. |
|
1884 |
|
define input parameter l_nbr2 like so_nbr no-undo. |
|
1885 |
|
define input parameter l_so_nbr like so_nbr no-undo. |
|
1886 |
|
define input parameter l_so_inv_nbr like so_inv_nbr no-undo. |
|
1887 |
|
|
|
1888 |
|
define buffer somstr4 for so_mstr. |
|
1889 |
|
|
|
1890 |
|
for each somstr4 |
|
1891 |
|
where somstr4.so_domain = global_domain |
|
1892 |
|
and somstr4.so_nbr <> l_so_nbr |
|
1893 |
|
and somstr4.so_inv_nbr = l_so_inv_nbr |
|
1894 |
|
and somstr4.so_to_inv = false |
|
1895 |
|
and somstr4.so_compl_stat = "" |
|
1896 |
|
no-lock: |
|
1897 |
|
so_recno = recid(somstr4) . |
|
1898 |
|
|
|
1899 |
|
{us/gp/gprunp.i "txincopl" "p" "create-record" |
|
1900 |
|
"(input recid(somstr4), |
|
1901 |
|
input tax-tran-type)" } |
|
1902 |
|
|
|
1903 |
|
undo_trl2 = true. |
|
1904 |
|
{us/bbi/gprun.i ""soivtrl2.p"" "(input somstr4.so_inv_nbr, |
|
1905 |
|
input '*', |
|
1906 |
|
input col-80 /* REPORT WIDTH */, |
|
1907 |
|
input '16', |
|
1908 |
|
input tot_cont_charge, |
|
1909 |
|
input tot_line_charge, |
|
1910 |
|
input l_consolidate)"} |
|
1911 |
|
if undo_trl2 then return. |
|
1912 |
|
{us/so/soivtod7.i} /* ACCUMULATE INVOICE TOTALS */ |
|
1913 |
|
end. /* FOR EACH somstr4 */ |
|
1914 |
|
|
|
1915 |
|
END PROCEDURE. /* p_consotot */ |
|
1916 |
|
|
|
1917 |
|
/* PROCEDURE TO SKIP LOCKED ORDERS DURING INVOICE PRINT */ |
|
1918 |
|
PROCEDURE p_check_locked: |
|
1919 |
|
|
|
1920 |
|
define input parameter l_so_recno as recid no-undo. |
|
1921 |
|
|
|
1922 |
|
find first so_mstr |
|
1923 |
|
where recid(so_mstr) = l_so_recno |
|
1924 |
|
exclusive-lock no-error no-wait. |
|
1925 |
|
|
|
1926 |
|
if locked so_mstr |
|
1927 |
|
then do: |
|
1928 |
|
/* Consider legal doc number when 'Separate Invoices for Each Shipment' */ |
|
1929 |
|
if available shc_ctrl and shc_ctrl.shc_check_ship_pending then |
|
1930 |
|
find next so_mstr |
|
1931 |
|
where so_domain = global_domain |
|
1932 |
|
and (so_nbr >= nbr and so_nbr <= nbr1) |
|
1933 |
|
and (so_to_inv = yes) |
|
1934 |
|
and (so_ship_date >= shipdate and so_ship_date <= shipdate1) |
|
1935 |
|
and (so_cust >= cust and so_cust <= cust1) |
|
1936 |
|
and (so_bill >= bill and so_bill <= bill1) |
|
1937 |
|
and (so_site >= site and so_site <= site1) |
|
1938 |
|
and (so_lang >= lang and so_lang <= lang1) |
|
1939 |
|
and (so_slspsn[1] >= sls-psn and so_slspsn[1] <= sls-psn1) |
|
1940 |
|
and (so_daybookset >= daybookset and so_daybookset <= daybookset1) |
|
1941 |
|
and so_compl_stat = "" |
|
1942 |
|
and (can-find(first lgdd_det where lgdd_domain = global_domain |
|
1943 |
|
and lgdd_order = so_nbr |
|
1944 |
|
and can-find(first lgd_mstr where lgd_domain = global_domain |
|
1945 |
|
and lgd_type = yes |
|
1946 |
|
and ((lgd_posted = no and lgd_status = {&LD_CONFIRMED}) |
|
1947 |
|
or (lgd_posted = yes and lgd_status = {&LD_CANCELLED} and lgd_cancel_inv = "")) |
|
1948 |
|
and lgd_mstr.oid_lgd_mstr = lgdd_det.oid_lgd_mstr |
|
1949 |
|
and lgd_nbr >= ldnbr and lgd_nbr <= ldnbr1 |
|
1950 |
|
and lgd_shipfrom >= ldshipfrom and lgd_shipfrom <= ldshipfrom1)) |
|
1951 |
|
or |
|
1952 |
|
not can-find(first lgdd_det where lgdd_domain = global_domain and lgdd_order = so_nbr)) |
|
1953 |
|
no-lock no-error. |
|
1954 |
|
else |
|
1955 |
|
find next so_mstr |
|
1956 |
|
where so_domain = global_domain |
|
1957 |
|
and (so_nbr >= nbr and so_nbr <= nbr1) |
|
1958 |
|
and (so_to_inv = yes) |
|
1959 |
|
and (so_ship_date >=shipdate and so_ship_date <= shipdate1) |
|
1960 |
|
and (so_cust >= cust and so_cust <= cust1) |
|
1961 |
|
and (so_bill >= bill and so_bill <= bill1) |
|
1962 |
|
and (so_site >= site and so_site <= site1) |
|
1963 |
|
and (so_slspsn[1] >= sls-psn and so_slspsn[1] <= sls-psn1) |
|
1964 |
|
and (so_lang >= lang and so_lang <= lang1) |
|
1965 |
|
and (so_daybookset >= daybookset and so_daybookset <= daybookset1) |
|
1966 |
|
and so_compl_stat = "" |
|
1967 |
|
no-lock no-error. |
|
1968 |
|
|
|
1969 |
|
if available(so_mstr) |
|
1970 |
|
then do: |
|
1971 |
|
l_so_recno = recid(so_mstr). |
|
1972 |
|
run p_check_locked(l_so_recno). |
|
1973 |
|
end. /* IF AVAILABLE so_mstr */ |
|
1974 |
|
|
|
1975 |
|
end. /* IF LOCKED so_mstr */ |
|
1976 |
|
|
|
1977 |
|
END PROCEDURE. /* p_check_locked */ |
|
1978 |
|
|
|
1979 |
|
/* procedures of print settings */ |
|
1980 |
|
{us/so/soprprc1.i} |
File mfg/2013/base/src/xxihtrl2.p added (mode: 100644) (index 0000000..6ab192c) |
|
1 |
|
/* xxihtrl2.p - CLOSED INVOICE TRAILER */ |
|
2 |
|
/* soihtrl2.p - CLOSED INVOICE TRAILER */ |
|
3 |
|
/* Copyright 1986 QAD Inc. All rights reserved. */ |
|
4 |
|
/* $Id$: */ |
|
5 |
|
/* REVISION: 7.4 CREATED: 09/23/94 BY: bcm *H536* */ |
|
6 |
|
/* 7.4 12/01/94 BY: bcm *H601* */ |
|
7 |
|
/* 8.5 07/13/95 BY: taf *J053* */ |
|
8 |
|
/* 7.4 07/06/95 BY: jym *H0F7* */ |
|
9 |
|
/* 7.4 08/01/95 BY: jym *G0T3* */ |
|
10 |
|
/* REVISION 8.5 LAST MODIFIED: 10/03/97 BY: *H1FT* MANISH K. */ |
|
11 |
|
/* REVISION 8.5 LAST MODIFIED: 11/18/97 BY: *H1F8* Nirav Parikh */ |
|
12 |
|
/* REVISION: 8.6E LAST MODIFIED: 02/23/98 BY: *L007* A. Rahane */ |
|
13 |
|
/* REVISION: 8.6E LAST MODIFIED: 05/06/98 BY: *L00L* Ed v.d.Gevel */ |
|
14 |
|
/* Old ECO marker removed, but no ECO header exists *F0PN* */ |
|
15 |
|
/* REVISION: 8.6E LAST MODIFIED: 07/15/98 BY: *L024* Steve Goeke */ |
|
16 |
|
/* REVISION: 8.6E LAST MODIFIED: 12/04/98 BY: *J360* Poonam Bahl */ |
|
17 |
|
/* REVISION: 8.6E LAST MODIFIED: 01/22/99 BY: *J38T* Poonam Bahl */ |
|
18 |
|
/* REVISION: 8.6E LAST MODIFIED: 05/07/99 BY: *J3DQ* Niranjan R. */ |
|
19 |
|
/* REVISION: 8.6E LAST MODIFIED: 01/04/00 BY: *J3N6* Santosh Rao */ |
|
20 |
|
/* REVISION: 9.1 LAST MODIFIED: 09/05/00 BY: *N0RF* Mark Brown */ |
|
21 |
|
/* REVISION: 9.1 LAST MODIFIED: 09/06/00 BY: *N0D0* Santosh Rao */ |
|
22 |
|
/* Revision: 1.25 BY: Amit Chaturvedi DATE: 01/20/03 ECO: *N20Y* */ |
|
23 |
|
/* Revision: 1.26 BY: Vandna Rohira DATE: 04/28/03 ECO: *N1YL* */ |
|
24 |
|
/* Revision: 1.28 BY: Paul Donnelly (SB) DATE: 06/28/03 ECO: *Q00L* */ |
|
25 |
|
/* Revision: 1.29 BY: Vivek Gogte DATE: 08/02/03 ECO: *N2GZ* */ |
|
26 |
|
/* Revision: 1.30 BY: Ed van de Gevel DATE: 09/11/03 ECO: *Q037* */ |
|
27 |
|
/* Revision: 1.31 BY: Ashish Maheshwari DATE: 11/15/03 ECO: *P15L* */ |
|
28 |
|
/* Revision: 1.32 BY: Vinay Soman DATE: 01/20/04 ECO: *N2NZ* */ |
|
29 |
|
/* Revision: 1.33 BY: Ajay Nair DATE: 03/31/04 ECO: *P1W7* */ |
|
30 |
|
/* Revision: 1.34 BY: Sachin Deshmukh DATE: 07/07/04 ECO: *P268* */ |
|
31 |
|
/* Revision: 1.35 BY: Sushant Pradhan DATE: 09/06/04 ECO: *P2J5* */ |
|
32 |
|
/* Revision: 1.36 BY: Priyank Khandare DATE: 03/21/05 ECO: *P339* */ |
|
33 |
|
/* Revision: 1.37 BY: Alok Gupta DATE: 10/03/05 ECO: *P43Q* */ |
|
34 |
|
/* Revision: 1.38 BY: Nishit V DATE: 02/06/06 ECO: *P4GY* */ |
|
35 |
|
/* Revision: 1.39 BY: Ashim Mishra DATE: 03/30/07 ECO: *P5RY* */ |
|
36 |
|
/* Revision: 1.40 BY: Ashim Mishra DATE: 06/21/07 ECO: *P601* */ |
|
37 |
|
/* Revision: 1.41 BY: Jing Li DATE: 01/09/08 ECO: *R0JR* */ |
|
38 |
|
/* Revision: 1.46 BY: Dipanshu Talwar DATE: 10/01/09 ECO: *P552* */ |
|
39 |
|
/* Revision: 1.47 BY: Jean Miller DATE: 11/23/09 ECO: *R1TW* */ |
|
40 |
|
/* Revision: 1.48 BY: John Corda DATE: 12/22/09 ECO: *Q36D* */ |
|
41 |
|
/* $Revision$ BY: Trupti Khairnar DATE: 03/22/10 ECO: *Q3X5* */ |
|
42 |
|
/* BGL LAST MODIFIED: 2014-FEB-12 BY: gbg *d2561 */ |
|
43 |
|
/*-Revision end--------------------------------------------------------------*/ |
|
44 |
|
/******************************************************************************/ |
|
45 |
|
/* All patch markers and commented out code have been removed from the source */ |
|
46 |
|
/* code below. For all future modifications to this file, any code which is */ |
|
47 |
|
/* no longer required should be deleted and no in-line patch markers should */ |
|
48 |
|
/* be added. The ECO marker should only be included in the Revision History. */ |
|
49 |
|
/******************************************************************************/ |
|
50 |
|
|
|
51 |
|
/*! N1YL HAS CHANGED THE WAY TAXABLE/NON-TAXABLE AMOUNT IS CALCULATED. |
|
52 |
|
THE ORDER DISCOUNT IS APPLIED FOR EACH LINE TOTAL AND THEN IT IS |
|
53 |
|
SUMMED UP TO CALCULATE THE TAXABLE/NON-TAXABLE AMOUNT BASED ON THE |
|
54 |
|
TAXABLE STATUS OF EACH LINE. PREVIOUSLY, TAXABLE/NON-TAXABLE AMOUNT |
|
55 |
|
WAS OBTAINED FROM THE GTM TABLES. THIS CAUSED PROBLEMS WHEN |
|
56 |
|
MULTIPLE TAXABLE BASES ARE USED TO CALCULATE TAX. |
|
57 |
|
|
|
58 |
|
TAXABLE/NON-TAXABLE AMOUNT WILL NOW BE DISPLAYED IN THE TRAILER |
|
59 |
|
FRAME BASED ON THE VALUE OF THE FLAG "DISPLAY TAXABLE/NON-TAXABLE |
|
60 |
|
AMOUNT ON TRAILER" IN THE GLOBAL TAX MANAGEMENT CTRL FILE |
|
61 |
|
*/ |
|
62 |
|
|
|
63 |
|
{us/bbi/mfdeclre.i} |
|
64 |
|
{us/gp/gprunpdf.i "sopl" "p"} |
|
65 |
|
|
|
66 |
|
/* SHARED VARIABLES */ |
|
67 |
|
define shared variable ih_recno as recid. |
|
68 |
|
define shared variable taxable_amt as decimal |
|
69 |
|
format "->>>>,>>>,>>9.99" |
|
70 |
|
label "Taxable". |
|
71 |
|
define shared variable nontaxable_amt like taxable_amt |
|
72 |
|
label "Non-Taxable". |
|
73 |
|
define shared variable line_total as decimal |
|
74 |
|
format "-zzzz,zzz,zz9.99" |
|
75 |
|
label "Line Total". |
|
76 |
|
define shared variable disc_amt like line_total |
|
77 |
|
label "Discount" |
|
78 |
|
format "(zzzz,zzz,zz9.99)". |
|
79 |
|
define shared variable tax_amt like line_total |
|
80 |
|
label "Total Tax". |
|
81 |
|
define shared variable trl_amt like line_total. |
|
82 |
|
define shared variable ord_amt like line_total |
|
83 |
|
label "Total". |
|
84 |
|
define shared variable invcrdt as character format "x(15)". |
|
85 |
|
define shared variable user_desc like trl_desc extent 3. |
|
86 |
|
define shared variable tax_date like ih_tax_date. |
|
87 |
|
define shared variable col-80 like mfc_logical. |
|
88 |
|
define shared variable rndmthd like rnd_rnd_mthd. |
|
89 |
|
define shared variable l_tax_in like tax_amt no-undo. |
|
90 |
|
define shared variable l_nontaxable_lbl as character format "x(12)" no-undo. |
|
91 |
|
define shared variable l_taxable_lbl as character format "x(12)" no-undo. |
|
92 |
|
|
|
93 |
|
/* GENERAL VARIABLES */ |
|
94 |
|
define variable ext_price like idh_price no-undo. |
|
95 |
|
define variable ext_actual like idh_price no-undo. |
|
96 |
|
define variable tax_lines like tx2d_line initial 0 no-undo. |
|
97 |
|
define variable page_break as integer initial 10 no-undo. |
|
98 |
|
define variable tax_ref like tx2d_ref no-undo. |
|
99 |
|
define variable tax_nbr like tx2d_nbr no-undo. |
|
100 |
|
define variable tax_tr_type like tx2d_tr_type |
|
101 |
|
initial "16" no-undo. |
|
102 |
|
define variable l_tmp_amt as decimal no-undo. |
|
103 |
|
define variable auth_price like sod_price |
|
104 |
|
format "->>>>,>>>,>>9.99" no-undo. |
|
105 |
|
define variable auth_found like mfc_logical no-undo. |
|
106 |
|
define variable l_roundedDiscAmt like line_total |
|
107 |
|
format "(zzzz,zzz,zz9.99)" no-undo. |
|
108 |
|
/* l_linetot_tax_in IS THE EXTENDED AMOUNT EXCLUDING TAX WHEN THE LINE IS */ |
|
109 |
|
/* TAX INCLUDED */ |
|
110 |
|
define variable l_linetot_tax_in like idh_price no-undo. |
|
111 |
|
define variable l_ih_nbr like ih_nbr no-undo. |
|
112 |
|
|
|
113 |
|
define input parameter l_conso like mfc_logical no-undo. |
|
114 |
|
|
|
115 |
|
define shared temp-table t_absr_det no-undo |
|
116 |
|
field t_absr_id like absr_id |
|
117 |
|
field t_absr_reference like absr_reference |
|
118 |
|
field t_absr_qty as decimal format "->>>>,>>>,>>9.99" |
|
119 |
|
field t_absr_ext as decimal format "->>>>,>>>,>>9.99" |
|
120 |
|
index t_absr_indx t_absr_id t_absr_reference. |
|
121 |
|
|
|
122 |
|
{us/so/socurvar.i} |
|
123 |
|
{us/et/etvar.i} |
|
124 |
|
{us/et/etrpvar.i} |
|
125 |
|
|
|
126 |
|
/* DEFINITION FOR TEMP TABLE t_tr_hist1 */ |
|
127 |
|
{us/so/sotrhstb.i} |
|
128 |
|
|
|
129 |
|
do for ih_hist: /*scope this trans */ |
|
130 |
|
|
|
131 |
|
for first ih_hist where recid(ih_hist) = ih_recno |
|
132 |
|
no-lock: end. |
|
133 |
|
|
|
134 |
|
assign |
|
135 |
|
tax_ref = ih_inv_nbr |
|
136 |
|
tax_nbr = "*". |
|
137 |
|
|
|
138 |
|
taxloop: |
|
139 |
|
do on endkey undo, leave: |
|
140 |
|
|
|
141 |
|
/*** GET TOTALS FOR LINES ***/ |
|
142 |
|
assign |
|
143 |
|
line_total = 0 |
|
144 |
|
taxable_amt = 0 |
|
145 |
|
nontaxable_amt = 0. |
|
146 |
|
|
|
147 |
|
if ih_tax_date <> ? then |
|
148 |
|
tax_date = ih_tax_date. |
|
149 |
|
else |
|
150 |
|
if ih_ship_date <> ? then |
|
151 |
|
tax_date = ih_ship_date. |
|
152 |
|
else |
|
153 |
|
tax_date = ih_due_date. |
|
154 |
|
|
|
155 |
|
/* sotrhstb.p CREATES TEMP-TABLE TO STORE tr_hist RECORDS AND RETRIEVE */ |
|
156 |
|
/* THE SAME IN soauthbl.p TO IMPROVE THE PERFORMANCE WHILE PRINTING */ |
|
157 |
|
/* AUTHORIZATION NUMBERS FOR SCHEDULE ORDERS. */ |
|
158 |
|
if available ih_hist |
|
159 |
|
and ih_sched = yes |
|
160 |
|
and can-find(first idh_hist where idh_domain = global_domain |
|
161 |
|
and idh_inv_nbr = ih_inv_nbr |
|
162 |
|
and idh_nbr = ih_nbr |
|
163 |
|
and idh__qadc06 = "yes") |
|
164 |
|
and not can-find(first t_tr_hist1 |
|
165 |
|
where t_tr_nbr = ih_nbr) |
|
166 |
|
then do: |
|
167 |
|
|
|
168 |
|
{us/bbi/gprun.i ""sotrhstb.p"" |
|
169 |
|
"(input ih_nbr, |
|
170 |
|
input ih_inv_nbr, |
|
171 |
|
input-output table t_tr_hist1)"} |
|
172 |
|
|
|
173 |
|
end. /* IF AVAILABLE ih_hist ... */ |
|
174 |
|
|
|
175 |
|
/* CALCULATE EXTENDED AMOUNTS */ |
|
176 |
|
/* OBTAINING LINE TOTALS FOR THE SALES ORDER */ |
|
177 |
|
for each idh_hist where idh_hist.idh_domain = global_domain |
|
178 |
|
and idh_inv_nbr = ih_inv_nbr |
|
179 |
|
and idh_nbr = ih_nbr |
|
180 |
|
no-lock: |
|
181 |
|
|
|
182 |
|
if idh_hist.idh_fsm_type = "SC" |
|
183 |
|
or idh_hist.idh_fsm_type = "SC-ADD" |
|
184 |
|
then do: |
|
185 |
|
ext_actual = idh_price * idh_qty_item. |
|
186 |
|
|
|
187 |
|
if can-find (sac_ctrl where sac_domain = global_domain |
|
188 |
|
and sac_int_rnd) |
|
189 |
|
then do: |
|
190 |
|
/* ROUND PER DOCUMENT CURRENCY ROUND METHOD */ |
|
191 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
192 |
|
"(input-output ext_actual, |
|
193 |
|
input rndmthd, |
|
194 |
|
output mc-error-number)" } |
|
195 |
|
if mc-error-number <> 0 |
|
196 |
|
then do: |
|
197 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
198 |
|
end. /* IF mc-error-number <> 0 */ |
|
199 |
|
end. /* IF CAN-FIND.... */ |
|
200 |
|
|
|
201 |
|
ext_actual = ext_actual * idh_qty_per. |
|
202 |
|
|
|
203 |
|
end. /* IF idh_hist.idh_fsm_type = "SC" */ |
|
204 |
|
|
|
205 |
|
else |
|
206 |
|
ext_actual = idh_price * idh_qty_inv. |
|
207 |
|
|
|
208 |
|
/* ROUND PER DOCUMENT CURRENCY ROUND METHOD */ |
|
209 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
210 |
|
"(input-output ext_actual, |
|
211 |
|
input rndmthd, |
|
212 |
|
output mc-error-number)" } |
|
213 |
|
if mc-error-number <> 0 |
|
214 |
|
then do: |
|
215 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
216 |
|
end. /* IF mc-error-number <> 0 */ |
|
217 |
|
|
|
218 |
|
/* CHECK AUTHORIZATION RECORDS FOR DIFFERENT EXTENDED PRICE */ |
|
219 |
|
if idh_sched = yes |
|
220 |
|
and idh__qadc06 = "yes" |
|
221 |
|
then do: |
|
222 |
|
|
|
223 |
|
auth_found = no. |
|
224 |
|
|
|
225 |
|
{us/bbi/gprun.i ""soauthbl.p"" |
|
226 |
|
"(input table t_tr_hist1, |
|
227 |
|
input idh_inv_nbr, |
|
228 |
|
input idh__qadc06, |
|
229 |
|
input idh_nbr, |
|
230 |
|
input idh_line, |
|
231 |
|
input idh_price, |
|
232 |
|
input idh_site, |
|
233 |
|
input ext_actual, |
|
234 |
|
output auth_price, |
|
235 |
|
output auth_found)"} |
|
236 |
|
|
|
237 |
|
ext_actual = auth_price. |
|
238 |
|
|
|
239 |
|
end. /*IF idh_sched */ |
|
240 |
|
|
|
241 |
|
l_linetot_tax_in = ext_actual. |
|
242 |
|
/* CALL THE PROCEDURE TO GET LINE TOTAL ONLY WHEN TAX IS */ |
|
243 |
|
/* INCLUDED */ |
|
244 |
|
if idh_tax_in |
|
245 |
|
then do: |
|
246 |
|
{us/gp/gprunp.i "sopl" "p" "getExtendedAmount" |
|
247 |
|
"(input rndmthd, |
|
248 |
|
input idh_line, |
|
249 |
|
input ih_inv_nbr, |
|
250 |
|
input ih_nbr, |
|
251 |
|
input tax_tr_type, |
|
252 |
|
input-output l_linetot_tax_in)"} |
|
253 |
|
end. /* IF idh_tax_in */ |
|
254 |
|
|
|
255 |
|
line_total = line_total + l_linetot_tax_in. |
|
256 |
|
|
|
257 |
|
if idh_taxable then |
|
258 |
|
taxable_amt = taxable_amt + ext_actual. |
|
259 |
|
else |
|
260 |
|
nontaxable_amt = nontaxable_amt + ext_actual. |
|
261 |
|
end. /* FOR EACH idh_hist */ |
|
262 |
|
|
|
263 |
|
empty temp-table t_tr_hist1. |
|
264 |
|
|
|
265 |
|
assign |
|
266 |
|
disc_amt = (- line_total * (ih_disc_pct / 100)) |
|
267 |
|
l_roundedDiscAmt = disc_amt. |
|
268 |
|
|
|
269 |
|
/* ROUND PER DOCUMENT CURRENCY ROUND METHOD */ |
|
270 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
271 |
|
"(input-output l_roundedDiscAmt, |
|
272 |
|
input rndmthd, |
|
273 |
|
output mc-error-number)" } |
|
274 |
|
|
|
275 |
|
if mc-error-number <> 0 |
|
276 |
|
then do: |
|
277 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
278 |
|
end. /* IF mc-error-number <> 0 */ |
|
279 |
|
|
|
280 |
|
l_tmp_amt = taxable_amt * ih_disc_pct / 100. |
|
281 |
|
|
|
282 |
|
/* ROUND PER DOCUMENT CURRENCY ROUND METHOD */ |
|
283 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
284 |
|
"(input-output l_tmp_amt, |
|
285 |
|
input rndmthd, |
|
286 |
|
output mc-error-number)" } |
|
287 |
|
|
|
288 |
|
if mc-error-number <> 0 |
|
289 |
|
then do: |
|
290 |
|
/* ROUNDING METHOD DOES NOT EXIST */ |
|
291 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
292 |
|
end. /* IF mc-error-number <> 0 */ |
|
293 |
|
|
|
294 |
|
assign |
|
295 |
|
taxable_amt = taxable_amt - l_tmp_amt |
|
296 |
|
l_tmp_amt = nontaxable_amt * ih_disc_pct / 100. |
|
297 |
|
|
|
298 |
|
/* ROUND PER DOCUMENT CURRENCY ROUND METHOD */ |
|
299 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
300 |
|
"(input-output l_tmp_amt, |
|
301 |
|
input rndmthd, |
|
302 |
|
output mc-error-number)" } |
|
303 |
|
|
|
304 |
|
if mc-error-number <> 0 |
|
305 |
|
then do: |
|
306 |
|
/* ROUNDING METHOD DOES NOT EXIST */ |
|
307 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
308 |
|
end. /* IF mc-error-number <> 0 */ |
|
309 |
|
|
|
310 |
|
nontaxable_amt = nontaxable_amt - l_tmp_amt. |
|
311 |
|
|
|
312 |
|
/* ADD TRAILER AMOUNTS */ |
|
313 |
|
{us/tx/txtrltrl.i ih_trl1_cd ih_trl1_amt user_desc[1]} |
|
314 |
|
{us/tx/txtrltrl.i ih_trl2_cd ih_trl2_amt user_desc[2]} |
|
315 |
|
{us/tx/txtrltrl.i ih_trl3_cd ih_trl3_amt user_desc[3]} |
|
316 |
|
|
|
317 |
|
{us/bbi/gprun.i ""txabsrb.p"" "(input ih_inv_nbr, |
|
318 |
|
input ih_nbr, |
|
319 |
|
input tax_tr_type, |
|
320 |
|
input-output line_total, |
|
321 |
|
input-output taxable_amt)"} |
|
322 |
|
|
|
323 |
|
|
|
324 |
|
/* CALL TO txtotal.p IS MADE IN THE MAIN PROGRAM */ |
|
325 |
|
|
|
326 |
|
/* ADJUSTING LINE TOTAL AND TAXABLE AMOUNT BY INCLUDED TAX */ |
|
327 |
|
taxable_amt = taxable_amt - l_tax_in. |
|
328 |
|
|
|
329 |
|
l_ih_nbr = if tax_tr_type = "16" |
|
330 |
|
then |
|
331 |
|
ih_inv_nbr |
|
332 |
|
else |
|
333 |
|
ih_nbr. |
|
334 |
|
|
|
335 |
|
if l_tax_in <> 0 |
|
336 |
|
or (l_tax_in = 0 |
|
337 |
|
and can-find(first tx2d_det |
|
338 |
|
where tx2d_det.tx2d_domain = global_domain |
|
339 |
|
and tx2d_ref = l_ih_nbr |
|
340 |
|
and (tx2d_nbr = tax_nbr |
|
341 |
|
or tax_nbr = "*") |
|
342 |
|
and tx2d_tr_type = tax_tr_type |
|
343 |
|
and (tax_lines = 0 |
|
344 |
|
or tx2d_line = tax_lines) |
|
345 |
|
and tx2d_tax_in)) |
|
346 |
|
then |
|
347 |
|
line_total = (taxable_amt + nontaxable_amt |
|
348 |
|
- (ih_trl1_amt + ih_trl2_amt + ih_trl3_amt)) |
|
349 |
|
* (100 / (100 - ih_disc_pct)). |
|
350 |
|
|
|
351 |
|
ord_amt = line_total + l_roundedDiscAmt + ih_trl1_amt |
|
352 |
|
+ ih_trl2_amt + ih_trl3_amt. |
|
353 |
|
|
|
354 |
|
/* DISPLAY TRAILER ONLY IF INVOICES ARE NOT CONSOLIDATED */ |
|
355 |
|
/* DISPLAY TRAILER AFTER LINE DETAILS OF ALL CONSOLIDATED */ |
|
356 |
|
/* SALES ORDERS ARE DISPLAYED. THIS IS DONE IN soivto10.i */ |
|
357 |
|
|
|
358 |
|
end. /* TAXLOOP */ |
|
359 |
|
|
|
360 |
|
end. /* DO For ih_hist */ |
File mfg/2013/base/src/xxivrp1a.p added (mode: 100644) (index 0000000..b208b46) |
|
1 |
|
/* xxivrp1a.p - SALES ORDER INVOICE REPRINT - LINE ITEMS */ |
|
2 |
|
/* soivrp1a.p - SALES ORDER INVOICE REPRINT - LINE ITEMS */ |
|
3 |
|
/* Copyright 1986 QAD Inc. All rights reserved. */ |
|
4 |
|
/* $Id$: */ |
|
5 |
|
/* REVISION: 5.0 LAST MODIFIED: 01/08/90 BY: ftb *B511**/ |
|
6 |
|
/* REVISION: 6.0 LAST MODIFIED: 04/20/90 BY: ftb **/ |
|
7 |
|
/* REVISION: 6.0 LAST MODIFIED: 07/05/90 BY: WUG *D043**/ |
|
8 |
|
/* REVISION: 6.0 LAST MODIFIED: 03/12/91 BY: afs *D425**/ |
|
9 |
|
/* REVISION: 6.0 LAST MODIFIED: 10/21/91 BY: afs *D903**/ |
|
10 |
|
/* REVISION: 7.0 LAST MODIFIED: 02/10/92 BY: tjs *F191**/ |
|
11 |
|
/* REVISION: 7.0 LAST MODIFIED: 03/25/92 BY: tjs *F320**/ |
|
12 |
|
/* REVISION: 7.0 LAST MODIFIED: 04/02/92 BY: afs *F348**/ |
|
13 |
|
/* REVISION: 7.3 LAST MODIFIED: 09/04/92 BY: afs *G047**/ |
|
14 |
|
/* REVISION: 7.3 LAST MODIFIED: 11/19/92 BY: tjs *G191**/ |
|
15 |
|
/* REVISION: 7.3 LAST MODIFIED: 02/19/93 BY: jms *G712**/ |
|
16 |
|
/* REVISION: 7.3 LAST MODIFIED: 03/17/93 BY: afs *G820**/ |
|
17 |
|
/* REVISION: 7.3 LAST MODIFIED: 04/29/93 BY: bcm *GA56**/ |
|
18 |
|
/* REVISION: 7.3 LAST MODIFIED: 05/13/93 BY: kgs *GA93**/ |
|
19 |
|
/* REVISION: 7.3 LAST MODIFIED: 09/30/93 BY: WUG *GG08**/ |
|
20 |
|
/* REVISION: 7.4 LAST MODIFIED: 05/24/94 BY: dpm *FO25**/ |
|
21 |
|
/* REVISION: 7.4 LAST MODIFIED: 05/24/94 BY: dpm *GJ94**/ |
|
22 |
|
/* REVISION: 7.4 LAST MODIFIED: 05/27/94 BY: dpm *GJ96**/ |
|
23 |
|
/* REVISION: 7.3 LAST MODIFIED: 07/08/94 BY: WUG *GK60**/ |
|
24 |
|
/* REVISION: 7.4 LAST MODIFIED: 11/17/94 BY: rxm *FT54**/ |
|
25 |
|
/* REVISION: 7.4 LAST MODIFIED: 12/07/94 BY: jxz *GO76**/ |
|
26 |
|
/* REVISION: 7.4 LAST MODIFIED: 02/16/95 BY: dxb *G0GB**/ |
|
27 |
|
/* REVISION: 7.4 LAST MODIFIED: 04/27/95 BY: rxm *F0PD**/ |
|
28 |
|
/* REVISION: 8.5 LAST MODIFIED: 03/20/95 BY: nte *J042**/ |
|
29 |
|
/* REVISION: 8.5 LAST MODIFIED: 08/18/95 BY: afs *J06R**/ |
|
30 |
|
/* REVISION: 7.4 LAST MODIFIED: 09/05/95 BY: jym *G0W9**/ |
|
31 |
|
/* REVISION: 7.4 LAST MODIFIED: 09/21/95 BY: jym *G0XP**/ |
|
32 |
|
/* REVISION: 7.4 LAST MODIFIED: 10/02/95 BY: jym *G0Y6**/ |
|
33 |
|
/* REVISION: 8.5 LAST MODIFIED: 07/27/95 BY: taf *J053**/ |
|
34 |
|
/* REVISION: 8.5 LAST MODIFIED: 03/25/96 BY: kxn *J0GC**/ |
|
35 |
|
/* REVISION: 8.5 LAST MODIFIED: 04/12/96 BY: *J04C* Sue Poland */ |
|
36 |
|
/* REVISION: 8.5 LAST MODIFIED: 06/13/96 BY: *J0T0* Dennis Hensen */ |
|
37 |
|
/* REVISION: 8.5 LAST MODIFIED: 06/26/96 BY: *J0WF* Sue Poland */ |
|
38 |
|
/* REVISION: 8.5 LAST MODIFIED: 08/07/96 BY: *G29K* Markus Barone */ |
|
39 |
|
/* REVISION: 8.5 LAST MODIFIED: 10/03/96 BY: *J15C* Markus Barone */ |
|
40 |
|
/* REVISION: 8.5 LAST MODIFIED: 01/17/97 BY: *G2H2* Vinay Nayak-Sujir */ |
|
41 |
|
/* REVISION: 8.5 LAST MODIFIED: 02/25/97 BY: *G2KX* Suresh Nayak */ |
|
42 |
|
/* REVISION: 8.5 LAST MODIFIED: 04/14/97 BY: *J1N0* Ajit Deodhar */ |
|
43 |
|
/* REVISION: 8.5 LAST MODIFIED: 05/14/97 BY: *G2N0* Sue Poland */ |
|
44 |
|
/* REVISION: 8.6 LAST MODIFIED: 12/09/97 BY: *K1DL* Suresh Nayak */ |
|
45 |
|
/* REVISION: 8.6E LAST MODIFIED: 02/23/98 BY: *L007* A. Rahane */ |
|
46 |
|
/* REVISION: 8.6E LAST MODIFIED: 04/23/98 BY: *L00L* EvdGevel */ |
|
47 |
|
/* REVISION: 8.6E LAST MODIFIED: 05/20/98 BY: *K1Q4* Alfred Tan */ |
|
48 |
|
/* REVISION: 8.6E LAST MODIFIED: 06/06/98 BY: *L01M* Jean Miller */ |
|
49 |
|
/* REVISION: 8.6E LAST MODIFIED: 06/29/98 BY: *L024* Sami Kureishy */ |
|
50 |
|
/* REVISION: 8.6E LAST MODIFIED: 07/08/98 BY: *J2Q6* Samir Bavkar */ |
|
51 |
|
/* REVISION: 8.6E LAST MODIFIED: 08/19/98 BY: *L06H* Jean Miller */ |
|
52 |
|
/* REVISION: 9.0 LAST MODIFIED: 11/20/98 BY: *J33Y* Poonam Bahl */ |
|
53 |
|
/* REVISION: 9.0 LAST MODIFIED: 02/01/99 BY: *L0D5* Robin McCarthy */ |
|
54 |
|
/* REVISION: 9.0 LAST MODIFIED: 02/17/99 BY: *K1ZK* Reetu Kapoor */ |
|
55 |
|
/* REVISION: 9.0 LAST MODIFIED: 03/13/99 BY: *M0BD* Alfred Tan */ |
|
56 |
|
/* REVISION: 9.1 LAST MODIFIED: 10/29/99 BY: *N049* Robert Jensen */ |
|
57 |
|
/* REVISION: 9.1 LAST MODIFIED: 11/03/99 BY: *N004* Steve Nugent */ |
|
58 |
|
/* REVISION: 9.1 LAST MODIFIED: 03/06/00 BY: *N05Q* Luke Pokic */ |
|
59 |
|
/* REVISION: 9.1 LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */ |
|
60 |
|
/* REVISION: 9.1 LAST MODIFIED: 05/11/00 BY: *N0BF* Luke Pokic */ |
|
61 |
|
/* REVISION: 9.1 LAST MODIFIED: 05/17/00 BY: *N0BC* Arul Victoria */ |
|
62 |
|
/* REVISION: 9.1 LAST MODIFIED: 08/11/00 BY: *N0JM* Mudit Mehta */ |
|
63 |
|
/* Old ECO marker removed, but no ECO header exists *F0PN* */ |
|
64 |
|
/* Revision: 1.29.2.11 BY: Katie Hilbert DATE: 04/01/01 ECO: *P002* */ |
|
65 |
|
/* Revision: 1.29.2.12 BY: Steve Nugent DATE: 07/09/01 ECO: *P007* */ |
|
66 |
|
/* Revision: 1.29.2.13 BY: Steve Nugent DATE: 03/15/02 ECO: *P00G* */ |
|
67 |
|
/* Revision: 1.29.2.15 BY: Katie Hilbert DATE: 04/15/02 ECO: *P03J* */ |
|
68 |
|
/* Revision: 1.29.2.16 BY: Amit Chaturvedi DATE: 01/20/03 ECO: *N20Y* */ |
|
69 |
|
/* Revision: 1.29.2.17 BY: Narathip W. DATE: 05/14/03 ECO: *P0RT* */ |
|
70 |
|
/* Revision: 1.29.2.19 BY: Paul Donnelly (SB) DATE: 06/28/03 ECO: *Q00L* */ |
|
71 |
|
/* Revision: 1.29.2.20 BY: Rajinder Kamra DATE: 06/23/03 ECO: *Q003* */ |
|
72 |
|
/* Revision: 1.29.2.21 BY: Rajinder Kamra DATE: 07/17/03 ECO: *Q013* */ |
|
73 |
|
/* Revision: 1.29.2.22 BY: Gnanasekar DATE: 08/04/03 ECO: *P0V7* */ |
|
74 |
|
/* Revision: 1.29.2.23 BY: Ashish Maheshwari DATE: 11/15/03 ECO: *P15L* */ |
|
75 |
|
/* Revision: 1.29.2.24 BY: Subramanian Iyer DATE: 11/27/03 ECO: *P13Q* */ |
|
76 |
|
/* Revision: 1.29.2.25 BY: Vinay Soman DATE: 01/20/04 ECO: *N2NZ* */ |
|
77 |
|
/* Revision: 1.29.2.28 BY: Swati Sharma DATE: 02/27/04 ECO: *P1R4* */ |
|
78 |
|
/* Revision: 1.29.2.29 BY: Ajay Nair DATE: 03/31/04 ECO: *P1W7* */ |
|
79 |
|
/* Revision: 1.29.2.30 BY: Sachin Deshmukh DATE: 09/22/04 ECO: *P2LR* */ |
|
80 |
|
/* Revision: 1.29.2.31 BY: Dan Herman DATE: 10/21/04 ECO: *P2QS* */ |
|
81 |
|
/* Revision: 1.29.2.32 BY: Sushant Pradhan DATE: 02/17/05 ECO: *P37X* */ |
|
82 |
|
/* Revision: 1.29.2.33 BY: Bharath Kumar DATE: 02/25/05 ECO: *P39Z* */ |
|
83 |
|
/* Revision: 1.29.2.34 BY: Priyank Khandare DATE: 03/21/05 ECO: *P339* */ |
|
84 |
|
/* Revision: 1.29.2.36 BY: Surajit Roy DATE: 03/23/05 ECO: *P32N* */ |
|
85 |
|
/* Revision: 1.29.2.37 BY: Priyank Khandare DATE: 11/28/05 ECO: *P49L* */ |
|
86 |
|
/* Revision: 1.29.2.38 BY: Nishit V DATE: 02/02/06 ECO: *P4GY* */ |
|
87 |
|
/* Revision: 1.29.2.39 BY: Jean Miller DATE: 02/28/06 ECO: *Q0R5* */ |
|
88 |
|
/* Revision: 1.29.2.40 BY: Sanat Paul DATE: 04/25/06 ECO: *P4Q9* */ |
|
89 |
|
/* Revision: 1.29.2.41 BY: Katie Hilbert DATE: 06/08/06 ECO: *Q0LK* */ |
|
90 |
|
/* Revision: 1.29.2.44 BY: Jean Miller DATE: 06/22/07 ECO: *R0C5* */ |
|
91 |
|
/* Revision: 1.29.2.45 BY: Katie Hilbert DATE: 09/24/07 ECO: *R0C6* */ |
|
92 |
|
/* Revision: 1.29.2.49 BY: Jean Miller DATE: 11/06/07 ECO: *P5Z7* */ |
|
93 |
|
/* Revision: 1.29.2.50 BY: Hemant Dhavse DATE: 03/20/09 ECO: *Q2J3* */ |
|
94 |
|
/* Revision: 1.29.2.51 BY: Anju Dubey DATE: 03/30/09 ECO: *P6K5* */ |
|
95 |
|
/* Revision: 1.29.2.52 BY: Dipanshu Talwar DATE: 06/10/09 ECO: *Q2K3* */ |
|
96 |
|
/* Revision: 1.29.2.54 BY: Xiaolei Meng DATE: 07/31/09 ECO: *R1N2* */ |
|
97 |
|
/* Revision: 1.29.2.55 BY: Yizhou Mao DATE: 08/27/09 ECO: *R1Q6* */ |
|
98 |
|
/* Revision: 1.29.2.56 BY: Dipanshu Talwar DATE: 10/01/09 ECO: *P552* */ |
|
99 |
|
/* $Revision$ BY: Jean Miller DATE: 11/23/09 ECO: *R1TW* */ |
|
100 |
|
/* BGL LAST MODIFIED: 2014-FEB-12 BY: gbg *d2561 */ |
|
101 |
|
/*-Revision end---------------------------------------------------------------*/ |
|
102 |
|
/******************************************************************************/ |
|
103 |
|
/* All patch markers and commented out code have been removed from the source */ |
|
104 |
|
/* code below. For all future modifications to this file, any code which is */ |
|
105 |
|
/* no longer required should be deleted and no in-line patch markers should */ |
|
106 |
|
/* be added. The ECO marker should only be included in the Revision History. */ |
|
107 |
|
/******************************************************************************/ |
|
108 |
|
|
|
109 |
|
{us/bbi/mfdeclre.i} |
|
110 |
|
{us/px/pxmaint.i} |
|
111 |
|
{us/px/pxphdef.i gpumxr} |
|
112 |
|
{us/bbi/gplabel.i} /* EXTERNAL LABEL INCLUDE */ |
|
113 |
|
{us/gp/gprunpdf.i "mcpl" "p" } |
|
114 |
|
|
|
115 |
|
define output parameter container_charge_tot like abs_price no-undo. |
|
116 |
|
define output parameter line_charge_tot like absl_lc_amt no-undo. |
|
117 |
|
define input-output parameter l_nontax_amt like ih_trl2_amt no-undo. |
|
118 |
|
define input-output parameter l_tax_amt like ih_trl2_amt no-undo. |
|
119 |
|
|
|
120 |
|
define new shared variable ext_price_fmt as character. |
|
121 |
|
define new shared variable lotserial_total like tr_qty_chg. |
|
122 |
|
define new shared variable lotserials_toprint as integer. |
|
123 |
|
define new shared variable so_db like dc_name. |
|
124 |
|
define new shared variable sonbr like idh_nbr. |
|
125 |
|
define new shared variable soline like idh_line. |
|
126 |
|
define new shared variable soinv like idh_inv_nbr no-undo. |
|
127 |
|
define new shared variable sopart like idh_part. |
|
128 |
|
define new shared variable shipper_id like abs_id no-undo. |
|
129 |
|
define new shared variable shipper_date like abs_shp_date no-undo. |
|
130 |
|
define new shared variable abs_recno as recid. |
|
131 |
|
|
|
132 |
|
define shared variable ih_recno as recid. |
|
133 |
|
define shared variable rndmthd like rnd_rnd_mthd. |
|
134 |
|
define shared variable print_lotserials like mfc_logical initial no |
|
135 |
|
label "Print Lot/Serial Numbers Shipped". |
|
136 |
|
define shared variable first_line like mfc_logical. |
|
137 |
|
define shared variable pages as integer. |
|
138 |
|
define shared variable company as character format "x(38)" extent 6. |
|
139 |
|
define shared variable billto as character format "x(38)" extent 6. |
|
140 |
|
define shared variable soldto as character format "x(38)" extent 6. |
|
141 |
|
define shared variable inv_date like ih_inv_date. |
|
142 |
|
define shared variable call-detail like mfc_logical |
|
143 |
|
label "Print Call Invoice Detail". |
|
144 |
|
define shared variable disc_prnt_label as character. |
|
145 |
|
define shared variable rmaso like mfc_logical. |
|
146 |
|
define shared variable sacontract like mfc_logical. |
|
147 |
|
define shared variable print_options like mfc_logical initial no |
|
148 |
|
label "Print Features and Options". |
|
149 |
|
define shared variable isDomOrder as logical no-undo. |
|
150 |
|
|
|
151 |
|
/* Invoice Print Settings */ |
|
152 |
|
{us/so/soprsets.i} |
|
153 |
|
|
|
154 |
|
define variable ent_ord_bill like ih_bill no-undo. |
|
155 |
|
define variable ent_ord_ship like ih_ship no-undo. |
|
156 |
|
define variable ent_ord_nbr like ih_nbr no-undo. |
|
157 |
|
define variable ent_ord_line like idh_line no-undo. |
|
158 |
|
define variable ent_ord_line_part like idh_part no-undo. |
|
159 |
|
define variable ent_ord_line_uom like idh_um no-undo. |
|
160 |
|
define variable qty_bo like idh_qty_ord |
|
161 |
|
format "->>>>>>9.9<<<<" |
|
162 |
|
label "Backorder". |
|
163 |
|
define variable ext_price like idh_price |
|
164 |
|
format "->>>>,>>>,>>9.99" |
|
165 |
|
label "XXXXXXXXXXXXXXXX". |
|
166 |
|
define variable i as integer no-undo. |
|
167 |
|
define variable ibh_desc like pt_desc1. |
|
168 |
|
define variable ibh_desc2 like pt_desc2. |
|
169 |
|
define variable ibh_um like pt_um. |
|
170 |
|
define variable desc1 like pt_desc1 no-undo. |
|
171 |
|
define variable desc2 like pt_desc2 no-undo. |
|
172 |
|
define variable err_flag as integer. |
|
173 |
|
define variable sob-qty like ibh_qty_req. |
|
174 |
|
define variable svremarks as character format "x(60)". |
|
175 |
|
define variable billable-amt like sod_price no-undo. |
|
176 |
|
define variable display-price like mfc_logical. |
|
177 |
|
define variable work-code like itm_ca_int_type. |
|
178 |
|
define variable pm_code like pt_pm_code. |
|
179 |
|
define variable hdl_disc_lbl as handle. |
|
180 |
|
define variable total-billable like sfb_price no-undo. |
|
181 |
|
define variable total-covered like sfb_price no-undo. |
|
182 |
|
define variable total-price like sfb_price no-undo. |
|
183 |
|
define variable total-exchange like sfb_price no-undo. |
|
184 |
|
define variable sfb-line-count as integer no-undo. |
|
185 |
|
define variable tmp_amt as decimal. |
|
186 |
|
define variable restock_pct like sv_rstk_pct no-undo. |
|
187 |
|
define variable restock_amt like rmd_restock no-undo. |
|
188 |
|
define variable restock_prc like sod_price no-undo. |
|
189 |
|
|
|
190 |
|
define variable auth_price like sod_price |
|
191 |
|
format "->>>>,>>>,>>9.99" no-undo. |
|
192 |
|
define variable auth_found like mfc_logical no-undo. |
|
193 |
|
define variable conversion_factor as decimal no-undo. |
|
194 |
|
define variable l_inv_nbr like ih_inv_nbr no-undo. |
|
195 |
|
define variable xab as character format "x(45)" . |
|
196 |
|
|
|
197 |
|
define variable l_lot-lbl as character format "x(56)". |
|
198 |
|
define variable l_lotsrl_tot like tr_qty_chg. |
|
199 |
|
define variable l_effdate as date no-undo. |
|
200 |
|
|
|
201 |
|
define new shared temp-table t_absr_det no-undo |
|
202 |
|
field t_absr_id like absr_id |
|
203 |
|
field t_absr_reference like absr_reference |
|
204 |
|
field t_absr_qty as decimal format "->>>>,>>>,>>9.99" |
|
205 |
|
field t_absr_ext as decimal format "->>>>,>>>,>>9.99" |
|
206 |
|
index t_absr_indx t_absr_id t_absr_reference. |
|
207 |
|
|
|
208 |
|
define buffer ihhist for ih_hist. |
|
209 |
|
|
|
210 |
|
l_lot-lbl = getTermLabelRtColon("LOT/SERIAL_NUMBERS_SHIPPED",27) + " " + |
|
211 |
|
getTermLabelRt("QUANTITY",6) + " " + |
|
212 |
|
getTermLabelRt("EXPIRE",8) + " " + |
|
213 |
|
getTermLabelRt("REFERENCE",12). |
|
214 |
|
|
|
215 |
|
{us/et/etvar.i} |
|
216 |
|
{us/et/etrpvar.i} |
|
217 |
|
|
|
218 |
|
/* DEFINITION FOR TEMP TABLE t_tr_hist1 */ |
|
219 |
|
{us/so/sotrhstb.i} |
|
220 |
|
|
|
221 |
|
define new shared frame d. |
|
222 |
|
define new shared frame dent. |
|
223 |
|
|
|
224 |
|
/* DEFINE VARIABLE DEFINITIONS FOR us/bbi/gpfile.i */ |
|
225 |
|
{us/bbi/gpfilev.i} |
|
226 |
|
|
|
227 |
|
/* SSM CONSTANTS */ |
|
228 |
|
{us/fs/fsconst.i} |
|
229 |
|
|
|
230 |
|
/* FRAME e-hist DEFINITION FOR CALL DETAILS */ |
|
231 |
|
{us/fs/fs10b01.i} |
|
232 |
|
|
|
233 |
|
/* SHARED WORKFILE FOR SUMMARY DISCOUNTS */ |
|
234 |
|
{us/so/sodiscwk.i} |
|
235 |
|
|
|
236 |
|
/* SET THE LABEL FOR THE DISCOUNT DISPLAY */ |
|
237 |
|
hdl_disc_lbl = prnt_disc_amt:handle in frame disc_print. |
|
238 |
|
|
|
239 |
|
/* Form definitions for frame d, dent */ |
|
240 |
|
{us/so/soivhfm2.i} |
|
241 |
|
|
|
242 |
|
/* DETERMINE IF CONTAINER/LINE CHARGES IS ACTIVATED */ |
|
243 |
|
{us/cc/cclc.i} |
|
244 |
|
|
|
245 |
|
ext_price_fmt = ext_price:format. |
|
246 |
|
{us/bbi/gprun.i ""gpcurfmt.p"" "(input-output ext_price_fmt, |
|
247 |
|
input rndmthd)"} |
|
248 |
|
|
|
249 |
|
/* IF INCLUDING CALL DETAILS, HANDLE CDR FOR THOSE PRINT FIELDS */ |
|
250 |
|
if call-detail |
|
251 |
|
then |
|
252 |
|
assign |
|
253 |
|
billable-amt:format = ext_price_fmt |
|
254 |
|
sfh_price:format = ext_price_fmt. |
|
255 |
|
|
|
256 |
|
find first rmc_ctrl where rmc_domain = global_domain no-lock no-error. |
|
257 |
|
find first svc_ctrl where svc_domain = global_domain no-lock no-error. |
|
258 |
|
find first soc_ctrl where soc_domain = global_domain no-lock no-error. |
|
259 |
|
|
|
260 |
|
l_inv_nbr = "". |
|
261 |
|
|
|
262 |
|
find ih_hist where recid(ih_hist) = ih_recno no-lock. |
|
263 |
|
|
|
264 |
|
/* DEFINE VARIABLES FOR DISPLAY OF VAT REG. NO & COUNTRY CODE */ |
|
265 |
|
{us/gp/gpvtecdf.i &var="SHARED"} |
|
266 |
|
{us/gp/gpvtepdf.i &var="SHARED"} |
|
267 |
|
|
|
268 |
|
/* sotrhstb.p CREATES TEMP-TABLE TO STORE tr_hist RECORDS AND RETRIEVE IN */ |
|
269 |
|
/* soauthbl.p TO IMPROVE THE PERFORMANCE WHILE PRINTING AUTHORIZATION */ |
|
270 |
|
/* NUMBERS FOR SCHEDULE ORDERS AND IN soivpr1c.p AND soivpr1d.p TO PRINT */ |
|
271 |
|
/* LOTSERIAL NUMBER. */ |
|
272 |
|
|
|
273 |
|
if available ih_hist |
|
274 |
|
then |
|
275 |
|
l_inv_nbr = ih_inv_nbr. |
|
276 |
|
|
|
277 |
|
do for ihhist: |
|
278 |
|
for each ihhist |
|
279 |
|
fields(ih_domain ih_inv_nbr ih_sched ih_nbr) |
|
280 |
|
no-lock |
|
281 |
|
where ih_domain = global_domain |
|
282 |
|
and ih_inv_nbr = l_inv_nbr |
|
283 |
|
and ((ih_sched = yes |
|
284 |
|
and can-find(first idh_hist |
|
285 |
|
where idh_domain = global_domain |
|
286 |
|
and idh_inv_nbr = ih_inv_nbr |
|
287 |
|
and idh_nbr = ih_nbr |
|
288 |
|
and idh__qadc06 = "yes")) |
|
289 |
|
or print_lotserials) |
|
290 |
|
and not can-find(first t_tr_hist1 |
|
291 |
|
where t_tr_nbr = ih_nbr): |
|
292 |
|
|
|
293 |
|
{us/bbi/gprun.i ""sotrhstb.p"" |
|
294 |
|
"(input ih_nbr, |
|
295 |
|
input ih_inv_nbr, |
|
296 |
|
input-output table t_tr_hist1)"} |
|
297 |
|
|
|
298 |
|
end. /* FOR EACH ihhist */ |
|
299 |
|
end. /* DO FOR ihhist */ |
|
300 |
|
|
|
301 |
|
/* start invoice certification */ |
|
302 |
|
define variable isPositive as logical initial true no-undo. |
|
303 |
|
/* end. invoice certification */ |
|
304 |
|
|
|
305 |
|
for each idh_hist |
|
306 |
|
where idh_domain = global_domain |
|
307 |
|
and (idh_inv_nbr = ih_inv_nbr) |
|
308 |
|
and (idh_qty_inv <> 0 ) |
|
309 |
|
break by idh_nbr |
|
310 |
|
by idh_line: |
|
311 |
|
|
|
312 |
|
conversion_factor = 1. |
|
313 |
|
if isDomOrder then do: |
|
314 |
|
{us/bbi/gprun.i ""sodomxr.p"" |
|
315 |
|
"(input idh_nbr, |
|
316 |
|
input idh_line, |
|
317 |
|
input 'SO', |
|
318 |
|
output ent_ord_nbr, |
|
319 |
|
output ent_ord_line, |
|
320 |
|
output ent_ord_bill, |
|
321 |
|
output ent_ord_ship, |
|
322 |
|
output ent_ord_line_part, |
|
323 |
|
output ent_ord_line_uom)" } |
|
324 |
|
if idh_um <> ent_ord_line_uom then do: |
|
325 |
|
{us/px/pxrun.i &PROC = 'retrieveUMConversion' &PROGRAM = 'gpumxr.p' |
|
326 |
|
&HANDLE=ph_gpumxr |
|
327 |
|
&PARAM="(input ent_ord_line_part, |
|
328 |
|
input ent_ord_line_uom, |
|
329 |
|
input idh_um, |
|
330 |
|
output conversion_factor)" |
|
331 |
|
&NOAPPERROR=True |
|
332 |
|
&CATCHERROR=True} |
|
333 |
|
end. |
|
334 |
|
end. |
|
335 |
|
|
|
336 |
|
/* IF A ZERO PRICED RMA RECEIPT LINE, AND */ |
|
337 |
|
/* "PRINT NO CHARGE RECEIPTS" IS NO, SKIP IT. */ |
|
338 |
|
if idh_fsm_type = rmarct_c and available rmc_ctrl |
|
339 |
|
then |
|
340 |
|
if not rmc_prt_rtn and idh_price = 0 |
|
341 |
|
then |
|
342 |
|
next. |
|
343 |
|
|
|
344 |
|
/* IF A ZERO PRICED SERVICE CONTRACT LINE, AND */ |
|
345 |
|
/* "PRINT NO CHARGE LINES" IS NO, SKIP IT. */ |
|
346 |
|
if sacontract and available svc_ctrl |
|
347 |
|
then |
|
348 |
|
if not svc_prt_0itm and idh_price = 0 |
|
349 |
|
then |
|
350 |
|
next. |
|
351 |
|
|
|
352 |
|
restock_amt = 0. |
|
353 |
|
if idh_fsm_type = rmarct_c |
|
354 |
|
then do: |
|
355 |
|
|
|
356 |
|
restock_amt = idh_covered_amt. |
|
357 |
|
if restock_amt <> 0 |
|
358 |
|
then |
|
359 |
|
assign |
|
360 |
|
restock_pct = idh_disc_pct |
|
361 |
|
restock_prc = idh_price + restock_amt. |
|
362 |
|
end. /* if RMA receipt */ |
|
363 |
|
|
|
364 |
|
/* PRINT ORDER DETAIL */ |
|
365 |
|
|
|
366 |
|
if idh_qty_ord >= 0 |
|
367 |
|
then |
|
368 |
|
qty_bo = max(idh_qty_ord - idh_qty_ship, 0). |
|
369 |
|
else |
|
370 |
|
qty_bo = min(idh_qty_ord - idh_qty_ship, 0). |
|
371 |
|
|
|
372 |
|
/* ROUND OFF THE INVOICE PRICE BEFORE CALCULATING THE */ |
|
373 |
|
/* EXTENDED PRICE AND EXTENDED MARGIN. */ |
|
374 |
|
|
|
375 |
|
ext_price = idh_price. |
|
376 |
|
if (idh_fsm_type = "SC" |
|
377 |
|
or idh_fsm_type = "SC-ADD") |
|
378 |
|
and can-find (sac_ctrl where sac_domain = global_domain |
|
379 |
|
and sac_int_rnd) |
|
380 |
|
then do: |
|
381 |
|
run mcpl-mc-curr-rnd |
|
382 |
|
(input-output ext_price, |
|
383 |
|
input rndmthd, |
|
384 |
|
output mc-error-number). |
|
385 |
|
if mc-error-number <> 0 |
|
386 |
|
then do: |
|
387 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
388 |
|
end. /* IF mc-error-number <> 0 */ |
|
389 |
|
end. /* IF idh_fsm_type = "SC" */ |
|
390 |
|
|
|
391 |
|
/* CALCULATE EXTENDED PRICE AND EXTENDED MARGIN USING */ |
|
392 |
|
/* ROUNDED OFF VALUE OF THE INVOICE PRICE. */ |
|
393 |
|
|
|
394 |
|
ext_price = idh_qty_inv * ext_price. |
|
395 |
|
|
|
396 |
|
run mcpl-mc-curr-rnd |
|
397 |
|
(input-output ext_price, |
|
398 |
|
input rndmthd, |
|
399 |
|
output mc-error-number). |
|
400 |
|
|
|
401 |
|
/* CHECK AUTHORIZATION RECORDS FOR DIFFERENT EXT PRICE */ |
|
402 |
|
if idh_sched = yes |
|
403 |
|
and idh__qadc06 = "yes" |
|
404 |
|
then do: |
|
405 |
|
|
|
406 |
|
auth_found = no. |
|
407 |
|
|
|
408 |
|
{us/bbi/gprun.i ""soauthbl.p"" |
|
409 |
|
"(input table t_tr_hist1, |
|
410 |
|
input idh_inv_nbr, |
|
411 |
|
input idh__qadc06, |
|
412 |
|
input idh_nbr, |
|
413 |
|
input idh_line, |
|
414 |
|
input idh_price, |
|
415 |
|
input idh_site, |
|
416 |
|
input ext_price, |
|
417 |
|
output auth_price, |
|
418 |
|
output auth_found)"} |
|
419 |
|
|
|
420 |
|
ext_price = auth_price. |
|
421 |
|
|
|
422 |
|
end. /*IF idh_sched */ |
|
423 |
|
|
|
424 |
|
accumulate ext_price (total). |
|
425 |
|
|
|
426 |
|
assign |
|
427 |
|
desc1 = idh_desc |
|
428 |
|
desc2 = "". |
|
429 |
|
find pt_mstr |
|
430 |
|
where pt_domain = global_domain |
|
431 |
|
and pt_part = idh_part |
|
432 |
|
no-lock no-wait no-error. |
|
433 |
|
if desc1 = "" and available pt_mstr |
|
434 |
|
then |
|
435 |
|
desc1 = pt_desc1. |
|
436 |
|
if available pt_mstr |
|
437 |
|
then |
|
438 |
|
desc2 = pt_desc2. |
|
439 |
|
|
|
440 |
|
if print_lotserials |
|
441 |
|
then do: |
|
442 |
|
|
|
443 |
|
lotserials_toprint = 0. |
|
444 |
|
|
|
445 |
|
/* CHANGE DOMAINS IF USING MULTI-DOMAINS TO LOCATE tr_hist */ |
|
446 |
|
so_db = global_db. |
|
447 |
|
find si_mstr |
|
448 |
|
where si_domain = global_domain |
|
449 |
|
and si_site = idh_site no-lock. |
|
450 |
|
if si_db <> so_db |
|
451 |
|
then do: |
|
452 |
|
{us/bbi/gprun.i ""gpalias3.p"" "(si_db, output err_flag)" } |
|
453 |
|
end. |
|
454 |
|
assign |
|
455 |
|
sonbr = idh_nbr |
|
456 |
|
soline = idh_line |
|
457 |
|
soinv = idh_inv_nbr. |
|
458 |
|
|
|
459 |
|
{us/bbi/gprun.i ""soivrp1c.p"" |
|
460 |
|
"(input table t_tr_hist1)"} |
|
461 |
|
|
|
462 |
|
/* RESET THE DOMAIN TO THE SALES ORDER DOMAIN */ |
|
463 |
|
if si_db <> so_db |
|
464 |
|
then do: |
|
465 |
|
{us/bbi/gprun.i ""gpalias3.p"" "(so_db, output err_flag)" } |
|
466 |
|
end. |
|
467 |
|
|
|
468 |
|
end. /* if print_lotserials */ |
|
469 |
|
|
|
470 |
|
first_line = no. |
|
471 |
|
|
|
472 |
|
assign |
|
473 |
|
ext_price:format in frame d = ext_price_fmt. |
|
474 |
|
|
|
475 |
|
/* Display sub-header for additional SOs on the invoice */ |
|
476 |
|
if first-of(idh_nbr) and not first(idh_nbr) |
|
477 |
|
then do for ihhist: |
|
478 |
|
|
|
479 |
|
find ihhist |
|
480 |
|
where ihhist.ih_domain = global_domain |
|
481 |
|
and ihhist.ih_inv_nbr = idh_inv_nbr |
|
482 |
|
and ihhist.ih_nbr = idh_nbr |
|
483 |
|
no-lock no-error. |
|
484 |
|
if available ihhist |
|
485 |
|
then |
|
486 |
|
find ad_mstr |
|
487 |
|
where ad_domain = global_domain |
|
488 |
|
and ad_addr = ihhist.ih_ship |
|
489 |
|
no-lock no-error. |
|
490 |
|
do with frame subheada: |
|
491 |
|
/* SET EXTERNAL LABELS */ |
|
492 |
|
setFrameLabels(frame subheada:handle). |
|
493 |
|
display |
|
494 |
|
skip(1) |
|
495 |
|
idh_nbr label "Order" |
|
496 |
|
ad_name label "Ship-To" when (available ad_mstr) |
|
497 |
|
ihhist.ih_po label "PO" when (available ihhist) |
|
498 |
|
skip(1) |
|
499 |
|
with frame subheada side-labels no-box. |
|
500 |
|
end. /* do with */ |
|
501 |
|
|
|
502 |
|
if available ihhist and ihhist.ih_cmtindx <> 0 |
|
503 |
|
then do: |
|
504 |
|
put skip(1). |
|
505 |
|
run PrintHeaderComment(input ihhist.ih_cmtindx, |
|
506 |
|
input vcPriHeadComment). |
|
507 |
|
put skip(1). |
|
508 |
|
end. /* if available ihhist */ |
|
509 |
|
|
|
510 |
|
end. /* if first-of(idh_nbr) */ |
|
511 |
|
|
|
512 |
|
if idh_fsm_type = "FSM-RO" |
|
513 |
|
then do: |
|
514 |
|
|
|
515 |
|
/* ITM_DET SHOULD STILL EXIST, UNLESS THE CLOSED */ |
|
516 |
|
/* CALL HAS BEEN MOVED TO HISTORY (FSCACLS.P) */ |
|
517 |
|
find itm_det |
|
518 |
|
where itm_domain = global_domain |
|
519 |
|
and itm_nbr = idh_nbr |
|
520 |
|
and itm_prefix = caprefix_c |
|
521 |
|
and itm_type = mfblank |
|
522 |
|
and itm_line = idh_line |
|
523 |
|
no-lock no-error. |
|
524 |
|
if not available itm_det |
|
525 |
|
then |
|
526 |
|
find itmh_hist |
|
527 |
|
where itmh_domain = global_domain |
|
528 |
|
and itmh_nbr = idh_nbr |
|
529 |
|
and itmh_prefix = caprefix_c |
|
530 |
|
and itmh_type = mfblank |
|
531 |
|
and itmh_line = idh_line |
|
532 |
|
no-lock no-error. |
|
533 |
|
|
|
534 |
|
idh_qty_inv:label = getTermLabelRt("REPAIRED",8). |
|
535 |
|
|
|
536 |
|
end. /* if idh_fsm_type = "FSM-RO" */ |
|
537 |
|
else |
|
538 |
|
|
|
539 |
|
idh_qty_inv:label = getTermLabelRt("SHIPPED",8). |
|
540 |
|
|
|
541 |
|
/* WHERE AN EXCHANGE IS INCLUDED, THE NET PRICE COULD BE NEGATIVE*/ |
|
542 |
|
/* FOR CALL INVOICES, WE DON'T ALWAYS PRINT THE PRICE BECAUSE, */ |
|
543 |
|
/* WHEN IT'S NOT A 'FIXED PRICE REPAIR' (MEANING WHENEVER PART */ |
|
544 |
|
/* NUMBER X GETS FIXED, IT COSTS $100, FOR EXAMPLE), SOD_PRICE IS */ |
|
545 |
|
/* THE TOTAL OF ALL LABOR/EXPENSES/PARTS USED IN THE REPAIR LESS */ |
|
546 |
|
/* EXCHANGE CREDITS, LESS CONTRACT COVERAGE. AND, THAT PRICE IS */ |
|
547 |
|
/* FOR THE FULL QUANTITY OF PARTS REPAIRED - IT'S NOT A UNIT PRICE */ |
|
548 |
|
/* SO, IT DOESN'T MAKE SENSE TO PRINT IT THAT WAY. HOWEVER, WHEN */ |
|
549 |
|
/* FIXED PRICE REPAIRS ARE BEING INVOICED, THE GROSS FIXED PRICE */ |
|
550 |
|
/* DOES PRINT IN THE 'PRICE' COLUMN. THE NET PRICE DISPLAYED IS */ |
|
551 |
|
/* NET OF ANY EXCHANGE CREDIT GIVEN. */ |
|
552 |
|
|
|
553 |
|
/* ALSO, FOR CALL INVOICES, AS WE DON'T REALLY 'SHIP' ANYTHING, */ |
|
554 |
|
/* THE QUANTITY OF INTEREST IS THE QUANTITY REPAIRED ON THE CALL */ |
|
555 |
|
/* LINE. THEREFORE, PRINT THAT INSTEAD OF QTY TO INVOICE AND */ |
|
556 |
|
/* PRINT NO BACKORDER QUANTITY (BECAUSE THERE ISN'T ANY). */ |
|
557 |
|
|
|
558 |
|
if idh_fsm_type <> "FSM-RO" |
|
559 |
|
then |
|
560 |
|
assign |
|
561 |
|
ext_price:label in frame d = getTermLabelRt("EXTENDED_PRICE",16) |
|
562 |
|
ext_price:label in frame dent = getTermLabelRt("EXTENDED_PRICE",16). |
|
563 |
|
else |
|
564 |
|
assign |
|
565 |
|
ext_price:label in frame d = getTermLabelRt("NET_PRICE",16) |
|
566 |
|
ext_price:label in frame dent = getTermLabelRt("NET_PRICE",16). |
|
567 |
|
|
|
568 |
|
/* Label it "Shipped" */ |
|
569 |
|
assign |
|
570 |
|
idh_qty_inv:label in frame d = getTermLabelRt("SHIPPED",8) |
|
571 |
|
idh_qty_inv:label in frame dent = getTermLabelRt("SHIPPED",8). |
|
572 |
|
|
|
573 |
|
/* Record the tax data for print */ |
|
574 |
|
run RecordTaxData(input "16", |
|
575 |
|
input if available ih_hist then ih_inv_nbr |
|
576 |
|
else idh_inv_nbr, input idh_nbr, |
|
577 |
|
input idh_line). |
|
578 |
|
|
|
579 |
|
/* Note it is still neccessary to give it a label below. */ |
|
580 |
|
/* This provides room for the alternate labels above. */ |
|
581 |
|
|
|
582 |
|
/* PRINT LINE ITEMS */ |
|
583 |
|
if isDomOrder |
|
584 |
|
then do: |
|
585 |
|
if ih__qadc05 <> "":U and |
|
586 |
|
ih__qadc05 <> ? and |
|
587 |
|
num-entries(ih__qadc05,chr(4)) = 2 |
|
588 |
|
then display idh_part @ ent_ord_line_part |
|
589 |
|
idh_um @ ent_ord_line_uom |
|
590 |
|
absolute(idh_qty_inv) @ idh_qty_inv |
|
591 |
|
qty_bo |
|
592 |
|
idh_taxable |
|
593 |
|
idh_price |
|
594 |
|
ext_price when (not auth_found) |
|
595 |
|
"" when (auth_found) @ ext_price |
|
596 |
|
with frame dent. |
|
597 |
|
else display idh_part @ ent_ord_line_part |
|
598 |
|
idh_um @ ent_ord_line_uom |
|
599 |
|
idh_qty_inv |
|
600 |
|
qty_bo |
|
601 |
|
idh_taxable |
|
602 |
|
idh_price |
|
603 |
|
ext_price when (not auth_found) |
|
604 |
|
"" when (auth_found) @ ext_price |
|
605 |
|
with frame dent. |
|
606 |
|
|
|
607 |
|
|
|
608 |
|
/* Only display the Enterprise Item data if the item id or uom are different */ |
|
609 |
|
/* from the MFG/PRO values. Otherwise it would just be duplicate information */ |
|
610 |
|
if (ent_ord_line_part <> idh_part) or |
|
611 |
|
(ent_ord_line_uom <> idh_um) |
|
612 |
|
then do: |
|
613 |
|
down 1 with frame dent. |
|
614 |
|
if ih__qadc05 <> "":U and |
|
615 |
|
ih__qadc05 <> ? and |
|
616 |
|
num-entries(ih__qadc05,chr(4)) = 2 |
|
617 |
|
then display ent_ord_line_part |
|
618 |
|
ent_ord_line_uom |
|
619 |
|
absolute( idh_qty_inv * conversion_factor) @ idh_qty_inv |
|
620 |
|
(qty_bo * conversion_factor) @ qty_bo |
|
621 |
|
"" @ idh_taxable |
|
622 |
|
"" @ idh_price |
|
623 |
|
"" @ ext_price |
|
624 |
|
with frame dent. |
|
625 |
|
|
|
626 |
|
end. /* if isDomOrder */ |
|
627 |
|
|
|
628 |
|
end. |
|
629 |
|
else do: |
|
630 |
|
/* start invoice certification */ |
|
631 |
|
if ih__qadc05 <> "":U and |
|
632 |
|
ih__qadc05 <> ? and |
|
633 |
|
num-entries(ih__qadc05,chr(4)) = 2 |
|
634 |
|
then display |
|
635 |
|
idh_part |
|
636 |
|
idh_um |
|
637 |
|
absolute(idh_qty_inv) |
|
638 |
|
when (idh_fsm_type <> "FSM-RO") |
|
639 |
|
@ idh_qty_inv |
|
640 |
|
label "Invoiced" |
|
641 |
|
absolute(itm_qty_call) |
|
642 |
|
when (idh_fsm_type = "FSM-RO" and available itm_det) |
|
643 |
|
@ idh_qty_inv |
|
644 |
|
absolute(itmh_qty_call) |
|
645 |
|
when (idh_fsm_type = "FSM-RO" and available itmh_hist) |
|
646 |
|
@ idh_qty_inv |
|
647 |
|
qty_bo |
|
648 |
|
when (idh_fsm_type <> "FSM-RO") |
|
649 |
|
idh_taxable |
|
650 |
|
idh_price |
|
651 |
|
when (idh_fsm_type <> "FSM-RO" |
|
652 |
|
or (idh_fsm_type = "FSM-RO" |
|
653 |
|
and idh_fix_pr = no)) |
|
654 |
|
idh_fixed_price |
|
655 |
|
when (idh_fsm_type = "FSM-RO" and idh_fix_pr) |
|
656 |
|
@ idh_price |
|
657 |
|
absolute(ext_price) |
|
658 |
|
when (not auth_found) |
|
659 |
|
@ ext_price |
|
660 |
|
"" |
|
661 |
|
when (auth_found) @ ext_price |
|
662 |
|
with frame d. |
|
663 |
|
else display |
|
664 |
|
idh_part |
|
665 |
|
idh_um |
|
666 |
|
idh_qty_inv label "Invoiced" |
|
667 |
|
when (idh_fsm_type <> "FSM-RO") |
|
668 |
|
itm_qty_call |
|
669 |
|
when (idh_fsm_type = "FSM-RO" and available itm_det) |
|
670 |
|
@ idh_qty_inv |
|
671 |
|
itmh_qty_call |
|
672 |
|
when (idh_fsm_type = "FSM-RO" and available itmh_hist) |
|
673 |
|
@ idh_qty_inv |
|
674 |
|
qty_bo |
|
675 |
|
when (idh_fsm_type <> "FSM-RO") |
|
676 |
|
idh_taxable |
|
677 |
|
idh_price |
|
678 |
|
when (idh_fsm_type <> "FSM-RO" |
|
679 |
|
or (idh_fsm_type = "FSM-RO" |
|
680 |
|
and idh_fix_pr = no)) |
|
681 |
|
idh_fixed_price |
|
682 |
|
when (idh_fsm_type = "FSM-RO" and idh_fix_pr) |
|
683 |
|
@ idh_price |
|
684 |
|
ext_price |
|
685 |
|
when (not auth_found) |
|
686 |
|
"" |
|
687 |
|
when (auth_found) @ ext_price |
|
688 |
|
with frame d. |
|
689 |
|
|
|
690 |
|
end. |
|
691 |
|
/* end invoice certification */ |
|
692 |
|
|
|
693 |
|
|
|
694 |
|
|
|
695 |
|
|
|
696 |
|
if rmaso and restock_amt <> 0 |
|
697 |
|
then do: |
|
698 |
|
|
|
699 |
|
{us/et/etivsa.i d dent} |
|
700 |
|
|
|
701 |
|
put |
|
702 |
|
{us/bbi/gplblfmt.i |
|
703 |
|
&FUNC=getTermLabelRtColon(""RESTOCKING_CHARGE"",17)} |
|
704 |
|
to 20 restock_pct restock_amt |
|
705 |
|
{us/bbi/gplblfmt.i |
|
706 |
|
&FUNC=getTermLabelRtColon(""LIST"",8)} |
|
707 |
|
to 48 restock_prc skip. |
|
708 |
|
end. /* if rmaso */ |
|
709 |
|
|
|
710 |
|
run PrintCustomerItem(input idh_custpart, |
|
711 |
|
input 1). |
|
712 |
|
|
|
713 |
|
{us/et/etivsa.i d dent} |
|
714 |
|
|
|
715 |
|
/* IF WE HAVE A SERVICE CONTRACT AND THIS INVOICE WAS NOT CREATED */ |
|
716 |
|
/* VIA CUSTOMER SCHEDULES, THEN GET THE SERVICE TYPE DESCRIPTION */ |
|
717 |
|
if sacontract |
|
718 |
|
then do: |
|
719 |
|
|
|
720 |
|
find first sv_mstr where sv_domain = global_domain |
|
721 |
|
and sv_code = idh_part |
|
722 |
|
no-lock no-error. |
|
723 |
|
if available sv_mstr then |
|
724 |
|
desc1 = sv_desc. |
|
725 |
|
else |
|
726 |
|
desc1 = "". |
|
727 |
|
end. |
|
728 |
|
|
|
729 |
|
run PrintDescription(input desc1, |
|
730 |
|
input true, |
|
731 |
|
input false, |
|
732 |
|
input 1). |
|
733 |
|
|
|
734 |
|
run PrintDescription(input desc2, |
|
735 |
|
input false, |
|
736 |
|
input true, |
|
737 |
|
input 1). |
|
738 |
|
|
|
739 |
|
if available soc_ctrl and soc_print_ship = yes then do: |
|
740 |
|
for each abs_mstr |
|
741 |
|
where abs_mstr.abs_domain = global_domain |
|
742 |
|
and abs_mstr.abs_order = idh_nbr |
|
743 |
|
and abs_mstr.abs_inv_nbr = idh_inv_nbr |
|
744 |
|
and abs_mstr.abs_line = string(idh_line) |
|
745 |
|
no-lock |
|
746 |
|
by abs_mstr.abs_id: |
|
747 |
|
if abs_shp_date = ? then next. |
|
748 |
|
assign abs_recno = recid(abs_mstr). |
|
749 |
|
{us/bbi/gprun.i ""sososhr6.p""} |
|
750 |
|
assign xab = getTermLabel("SHIPPER_NUMBER",20) |
|
751 |
|
+ ": " + substring(shipper_id,2) |
|
752 |
|
+ " " + getTermLabel("DATE",10) |
|
753 |
|
+ ": " + string(shipper_date). |
|
754 |
|
put xab at 1 format "x(45)" skip. |
|
755 |
|
|
|
756 |
|
end. |
|
757 |
|
end. |
|
758 |
|
|
|
759 |
|
for first rbc_ctrl no-lock where rbc_domain = global_domain and rbc_print_inv_det: |
|
760 |
|
{us/bbi/gprun.i ""sorbrp01.p"" |
|
761 |
|
"(input idh_nbr, |
|
762 |
|
input idh_inv_nbr, |
|
763 |
|
input idh_part, |
|
764 |
|
input isDomOrder)"} |
|
765 |
|
end. |
|
766 |
|
/***********************************************/ |
|
767 |
|
/* Repair Order */ |
|
768 |
|
/***********************************************/ |
|
769 |
|
if idh_fsm_type = fsmro_c |
|
770 |
|
then do: |
|
771 |
|
|
|
772 |
|
if idh_serial <> "" |
|
773 |
|
then do: |
|
774 |
|
svremarks = " " + getTermLabelRtColon("SERIAL", 15) + " " + idh_serial. |
|
775 |
|
end. /* IF idh_serial <> "" and (print_lotserials or call-detail) THEN DO ... */ |
|
776 |
|
|
|
777 |
|
form |
|
778 |
|
svremarks no-label |
|
779 |
|
skip(1) |
|
780 |
|
work-code colon 16 |
|
781 |
|
fwk_desc colon 30 no-label |
|
782 |
|
sv_code colon 16 |
|
783 |
|
sv_desc colon 30 no-label |
|
784 |
|
skip(1) |
|
785 |
|
with frame detaila no-box side-labels width 80. |
|
786 |
|
|
|
787 |
|
/* SET EXTERNAL LABELS */ |
|
788 |
|
setFrameLabels(frame detaila:handle). |
|
789 |
|
|
|
790 |
|
{us/et/etivsa.i d dent} |
|
791 |
|
|
|
792 |
|
if available itm_det |
|
793 |
|
then do: |
|
794 |
|
|
|
795 |
|
work-code = itm_ca_int_type. |
|
796 |
|
find sv_mstr |
|
797 |
|
where sv_domain = global_domain |
|
798 |
|
and sv_code = itm_sv_code |
|
799 |
|
and sv_type = mfblank |
|
800 |
|
no-lock no-error. |
|
801 |
|
end. /* if available itm_det */ |
|
802 |
|
else do: |
|
803 |
|
if available itmh_hist |
|
804 |
|
then |
|
805 |
|
work-code = itmh_ca_int_type. |
|
806 |
|
else |
|
807 |
|
work-code = mfblank. |
|
808 |
|
if available itmh_hist |
|
809 |
|
then |
|
810 |
|
find sv_mstr |
|
811 |
|
where sv_domain = global_domain |
|
812 |
|
and sv_code = itmh_sv_code |
|
813 |
|
and sv_type = mfblank |
|
814 |
|
no-lock no-error. |
|
815 |
|
end. /* else do, not available itm_det, do */ |
|
816 |
|
|
|
817 |
|
if work-code <> mfblank |
|
818 |
|
then do: |
|
819 |
|
|
|
820 |
|
find fwk_mstr |
|
821 |
|
where fwk_domain = global_domain |
|
822 |
|
and fwk_ca_int_type = work-code |
|
823 |
|
no-lock no-error. |
|
824 |
|
display |
|
825 |
|
svremarks when (svremarks <> "") |
|
826 |
|
work-code |
|
827 |
|
fwk_desc when (available fwk_mstr) |
|
828 |
|
sv_code when (available sv_mstr) |
|
829 |
|
sv_desc when (available sv_mstr) |
|
830 |
|
with frame detaila. |
|
831 |
|
end. /* if work-code <> mfblank */ |
|
832 |
|
|
|
833 |
|
if call-detail |
|
834 |
|
then do: |
|
835 |
|
|
|
836 |
|
assign |
|
837 |
|
sfb-line-count = 0 |
|
838 |
|
total-price = 0 |
|
839 |
|
total-covered = 0 |
|
840 |
|
total-billable = 0. |
|
841 |
|
|
|
842 |
|
/* IF PRINTING CALL DETAIL, PRINT THE LOWER LEVEL */ |
|
843 |
|
/* DETAILS (SFH-HIST = BILLING DETAIL) RELATED TO */ |
|
844 |
|
/* THIS REPAIR LINE. THIS DETAIL IS THE PARTS, */ |
|
845 |
|
/* LABOR AND EXPENSES INVOLVED IN THIS REPAIR. */ |
|
846 |
|
for each sfh_hist no-lock |
|
847 |
|
where sfh_domain = global_domain |
|
848 |
|
and sfh_nbr = idh_nbr |
|
849 |
|
and sfh_so_line = idh_line |
|
850 |
|
and sfh_inv_nbr = idh_inv_nbr |
|
851 |
|
break by sfh_pt_type |
|
852 |
|
by sfh_fis_sort |
|
853 |
|
by sfh_line: |
|
854 |
|
|
|
855 |
|
/* SFH_DETAIL INDICATES WE WILL PRINT EVERY */ |
|
856 |
|
/* UNIQUE DETAIL OF THE REPAIR ACTIVITY, */ |
|
857 |
|
/* INSTEAD OF SUMMARIZING BY INVOICE SORT */ |
|
858 |
|
/* (WHERE INVOICE SORT WOULD BE SOMETHING LIKE*/ |
|
859 |
|
/* PARTS, LABOR, TRAVEL EXPENSE...) */ |
|
860 |
|
|
|
861 |
|
/* IF NOT SFH_DETAIL THEN ACCUMULATE TOTAL PRICE */ |
|
862 |
|
/* LESS ANY EXCHANGE AMOUNT (ITEMS ONLY) AND */ |
|
863 |
|
/* TOTAL COVERED AMOUNT FOR THE INVOICE SORT AND */ |
|
864 |
|
/* PRINT ONE DETAIL LINE ONLY WHEN WE GET TO THE */ |
|
865 |
|
/* LAST ONE... */ |
|
866 |
|
|
|
867 |
|
if sfh_detail and |
|
868 |
|
first-of(sfh_fis_sort) |
|
869 |
|
then do: |
|
870 |
|
|
|
871 |
|
/* SO, IF WE'RE PRINTING "DETAIL", PRINT A */ |
|
872 |
|
/* HEADING LINE WHEN WE HIT A NEW INVOICE SORT */ |
|
873 |
|
{us/et/etivsa.i d dent} |
|
874 |
|
|
|
875 |
|
down 1 with frame e-hist. |
|
876 |
|
|
|
877 |
|
put |
|
878 |
|
{us/bbi/gplblfmt.i &FUNC=getTermLabel(""TYPE"",8) |
|
879 |
|
&CONCAT="': '"} at 30 |
|
880 |
|
sfh_fis_sort. |
|
881 |
|
|
|
882 |
|
end. /* if sfh_detail and... */ |
|
883 |
|
|
|
884 |
|
billable-amt = sfh_price * sfh_qty_req . |
|
885 |
|
|
|
886 |
|
run mcpl-mc-curr-rnd |
|
887 |
|
(input-output billable-amt, |
|
888 |
|
input rndmthd, |
|
889 |
|
output mc-error-number). |
|
890 |
|
|
|
891 |
|
billable-amt = billable-amt - sfh_covered_amt. |
|
892 |
|
|
|
893 |
|
if sfh_detail |
|
894 |
|
then do: |
|
895 |
|
|
|
896 |
|
/*****************************************/ |
|
897 |
|
/* IF THIS IS A FIXED PRICE BILLING THEN */ |
|
898 |
|
/* WE DON'T WANT TO PRINT THE PRICE */ |
|
899 |
|
/*****************************************/ |
|
900 |
|
if idh_fix_pr |
|
901 |
|
then |
|
902 |
|
display-price = no. |
|
903 |
|
else |
|
904 |
|
display-price = yes. |
|
905 |
|
|
|
906 |
|
{us/et/etivsa.i d dent} |
|
907 |
|
|
|
908 |
|
/* FOR ALL BUT RETURNS/EXCHANGES PRINT LIKE THIS: */ |
|
909 |
|
if sfh_qty_ret = 0 |
|
910 |
|
then do: |
|
911 |
|
|
|
912 |
|
/* FOR PARTS, PRINT PART NUMBER @ DESCRIPTION, |
|
913 |
|
ELSE, PRINT SERVICE CATEGORY */ |
|
914 |
|
display |
|
915 |
|
sfh_part when (sfh_pt_type = 0) @ sfh_desc |
|
916 |
|
sfh_fsc_code when (sfh_pt_type <> 0) @ sfh_desc |
|
917 |
|
sfh_line |
|
918 |
|
sfh_qty_req |
|
919 |
|
sfh_price when (display-price) |
|
920 |
|
billable-amt when (display-price) |
|
921 |
|
with frame e-hist. |
|
922 |
|
|
|
923 |
|
down 1 with frame e-hist. |
|
924 |
|
|
|
925 |
|
if display-price |
|
926 |
|
then do: |
|
927 |
|
|
|
928 |
|
display |
|
929 |
|
(- sfh_covered_amt) @ sfh_price |
|
930 |
|
sfh_desc |
|
931 |
|
sfh_fcg_code when (not idh_fix_pr) |
|
932 |
|
@ sfh_qty_req |
|
933 |
|
with frame e-hist. |
|
934 |
|
down 1 with frame e-hist. |
|
935 |
|
end. /* if display-price */ |
|
936 |
|
|
|
937 |
|
else |
|
938 |
|
if sfh_desc > "" or not idh_fix_pr |
|
939 |
|
then do: |
|
940 |
|
|
|
941 |
|
display |
|
942 |
|
sfh_desc |
|
943 |
|
sfh_fcg_code when (not idh_fix_pr) |
|
944 |
|
@ sfh_qty_req |
|
945 |
|
with frame e-hist. |
|
946 |
|
down 1 with frame e-hist. |
|
947 |
|
end. /* if sfh_desc > ""... */ |
|
948 |
|
end. /* if sfh_qty_ret = 0 */ |
|
949 |
|
else do: |
|
950 |
|
/* IF THE REPAIR INCLUDED AN EXCHANGE FROM THE */ |
|
951 |
|
/* CUSTOMER (I.E. WE GAVE HIM SOME CREDIT FOR */ |
|
952 |
|
/* THE BROKEN PART THAT HE RETURNED), PRINT */ |
|
953 |
|
/* THAT DETAIL ALSO. */ |
|
954 |
|
display |
|
955 |
|
sfh_part @ sfh_desc |
|
956 |
|
sfh_line |
|
957 |
|
(- sfh_qty_ret) @ sfh_qty_req |
|
958 |
|
(- sfh_exg_price) when (sfh_exchange) |
|
959 |
|
@ sfh_price |
|
960 |
|
(- sfh_exg_price) when (sfh_exchange) |
|
961 |
|
@ billable-amt |
|
962 |
|
with frame e-hist. |
|
963 |
|
down 1 with frame e-hist. |
|
964 |
|
display |
|
965 |
|
sfh_desc |
|
966 |
|
getTermLabel("EXCHANGE",10) when (sfh_exchange) |
|
967 |
|
@ sfh_qty_req |
|
968 |
|
getTermLabel("RETURN",10) when (not sfh_exchange) |
|
969 |
|
@ sfh_qty_req |
|
970 |
|
with frame e-hist. |
|
971 |
|
down 1 with frame e-hist. |
|
972 |
|
|
|
973 |
|
end. /* else, sfh_qty_ret <> 0, do */ |
|
974 |
|
|
|
975 |
|
/* PRINT COMMENTS FOR THE SFH_HISTS ALSO */ |
|
976 |
|
put skip(1). |
|
977 |
|
run PrintLineComment(input sfh_cmtindx, |
|
978 |
|
input vcPriLineComment). |
|
979 |
|
end. /* if sfh_detail */ |
|
980 |
|
|
|
981 |
|
else do: |
|
982 |
|
|
|
983 |
|
/* FOR FIXED PRICE LINES, WE WON'T PRINT ANY PRICES */ |
|
984 |
|
/* AND, IF WE'RE NOT PRINTING ANY DETAIL, SAVE */ |
|
985 |
|
/* OURSELVES THE OVERHEAD OF ALL THIS. */ |
|
986 |
|
if not idh_fix_pr |
|
987 |
|
then do: |
|
988 |
|
|
|
989 |
|
tmp_amt = (sfh_price * sfh_qty_req). |
|
990 |
|
|
|
991 |
|
run mcpl-mc-curr-rnd |
|
992 |
|
(input-output tmp_amt, |
|
993 |
|
input rndmthd, |
|
994 |
|
output mc-error-number). |
|
995 |
|
|
|
996 |
|
/* ACCUMULATE AMOUNTS FOR THIS INVOICE SORT */ |
|
997 |
|
assign |
|
998 |
|
total-covered = total-covered + sfh_covered_amt |
|
999 |
|
total-price = total-price + tmp_amt |
|
1000 |
|
total-billable = total-billable + billable-amt. |
|
1001 |
|
if sfh_exchange |
|
1002 |
|
then do: |
|
1003 |
|
|
|
1004 |
|
assign |
|
1005 |
|
tmp_amt = (sfh_exg_price * sfh_qty_ret) |
|
1006 |
|
total-exchange = total-exchange + tmp_amt. |
|
1007 |
|
|
|
1008 |
|
run mcpl-mc-curr-rnd |
|
1009 |
|
(input-output tmp_amt, |
|
1010 |
|
input rndmthd, |
|
1011 |
|
output mc-error-number). |
|
1012 |
|
|
|
1013 |
|
end. /* if sfh_exchange */ |
|
1014 |
|
|
|
1015 |
|
if last-of (sfh_fis_sort) |
|
1016 |
|
then do: |
|
1017 |
|
|
|
1018 |
|
/* PRINT THE INVOICE SORT HEADING */ |
|
1019 |
|
{us/et/etivsa.i d dent} |
|
1020 |
|
|
|
1021 |
|
down 1 with frame e-hist. |
|
1022 |
|
|
|
1023 |
|
put |
|
1024 |
|
{us/bbi/gplblfmt.i &FUNC=getTermLabel(""TYPE"",8) |
|
1025 |
|
&CONCAT="': '"} at 30 |
|
1026 |
|
sfh_fis_sort. |
|
1027 |
|
{us/et/etivsa.i d dent} |
|
1028 |
|
|
|
1029 |
|
/* ROUND INVOICE SORT TOTAL AMOUNTS */ |
|
1030 |
|
run mcpl-mc-curr-rnd |
|
1031 |
|
(input-output total-covered, |
|
1032 |
|
input rndmthd, |
|
1033 |
|
output mc-error-number). |
|
1034 |
|
|
|
1035 |
|
run mcpl-mc-curr-rnd |
|
1036 |
|
(input-output total-price, |
|
1037 |
|
input rndmthd, |
|
1038 |
|
output mc-error-number). |
|
1039 |
|
|
|
1040 |
|
run mcpl-mc-curr-rnd |
|
1041 |
|
(input-output total-billable, |
|
1042 |
|
input rndmthd, |
|
1043 |
|
output mc-error-number). |
|
1044 |
|
|
|
1045 |
|
run mcpl-mc-curr-rnd |
|
1046 |
|
(input-output total-exchange, |
|
1047 |
|
input rndmthd, |
|
1048 |
|
output mc-error-number). |
|
1049 |
|
|
|
1050 |
|
/* DISPLAY TOTALS FOR THE INVOICE SORT */ |
|
1051 |
|
sfb-line-count = sfb-line-count + 1. |
|
1052 |
|
find fis_mstr |
|
1053 |
|
where fis_domain = global_domain |
|
1054 |
|
and fis_sort = sfh_fis_sort |
|
1055 |
|
no-lock. |
|
1056 |
|
display |
|
1057 |
|
sfb-line-count @ sfh_line |
|
1058 |
|
fis_desc @ sfh_desc |
|
1059 |
|
total-price @ sfh_price |
|
1060 |
|
total-billable @ billable-amt |
|
1061 |
|
with frame e-hist. |
|
1062 |
|
down 1 with frame e-hist. |
|
1063 |
|
display |
|
1064 |
|
getTermLabel("COVERED_AMOUNT",24) @ sfh_desc |
|
1065 |
|
(- total-covered) @ sfh_price |
|
1066 |
|
with frame e-hist. |
|
1067 |
|
down 1 with frame e-hist. |
|
1068 |
|
if total-exchange <> 0 |
|
1069 |
|
then do: |
|
1070 |
|
|
|
1071 |
|
display |
|
1072 |
|
getTermLabel("EXCHANGES",24) @ sfh_desc |
|
1073 |
|
(- total-exchange) @ sfh_price |
|
1074 |
|
(- total-exchange) @ billable-amt |
|
1075 |
|
with frame e-hist. |
|
1076 |
|
down 1 with frame e-hist. |
|
1077 |
|
end. /* if total-exchange <> 0 */ |
|
1078 |
|
|
|
1079 |
|
assign |
|
1080 |
|
total-price = 0 |
|
1081 |
|
total-covered = 0 |
|
1082 |
|
total-billable = 0 |
|
1083 |
|
total-exchange = 0. |
|
1084 |
|
|
|
1085 |
|
end. /* if last-of (sfh_fis_sort) */ |
|
1086 |
|
|
|
1087 |
|
end. /* if not idh_fix_pr */ |
|
1088 |
|
|
|
1089 |
|
end. /* else, not sfh_detail, do */ |
|
1090 |
|
|
|
1091 |
|
end. /********* for each sfh_hist ******/ |
|
1092 |
|
|
|
1093 |
|
end. /* if call-detail */ |
|
1094 |
|
|
|
1095 |
|
end. /* if idh_fsm_type = fsmro_c */ |
|
1096 |
|
|
|
1097 |
|
/* PRINT THE SERVICE CONTRACT INFO ON THE INVOICE IF WE HAVE A |
|
1098 |
|
CONTRACT AND THIS IS NOT AN INVOICE FROM CUSTOMER SCHEDULES */ |
|
1099 |
|
if sacontract |
|
1100 |
|
then do for ihhist: |
|
1101 |
|
|
|
1102 |
|
find ihhist |
|
1103 |
|
where ihhist.ih_domain = global_domain |
|
1104 |
|
and ihhist.ih_inv_nbr = idh_inv_nbr |
|
1105 |
|
and ihhist.ih_nbr = idh_nbr |
|
1106 |
|
no-lock no-error. |
|
1107 |
|
if available ihhist |
|
1108 |
|
then do: |
|
1109 |
|
|
|
1110 |
|
if idh_req_date <> ihhist.ih_req_date or |
|
1111 |
|
idh_due_date <> ihhist.ih_due_date |
|
1112 |
|
then do: |
|
1113 |
|
|
|
1114 |
|
svremarks = getTermLabel("FOR_PERIOD",25) + ": " |
|
1115 |
|
+ string(idh_req_date,"99/99/99") |
|
1116 |
|
+ " " + getTermLabel("TO",10) + ": " |
|
1117 |
|
+ string(idh_due_date,"99/99/99"). |
|
1118 |
|
|
|
1119 |
|
put svremarks at 15. |
|
1120 |
|
end. |
|
1121 |
|
end. /* if avail ihhist */ |
|
1122 |
|
|
|
1123 |
|
{us/et/etivsa.i d dent} |
|
1124 |
|
|
|
1125 |
|
/* If the item under contract has a modified desc use */ |
|
1126 |
|
/* it. Else use the ISB desc, then the part desc. */ |
|
1127 |
|
desc1 = idh_desc. |
|
1128 |
|
if desc1 = "" and available ihhist |
|
1129 |
|
then do: |
|
1130 |
|
|
|
1131 |
|
find isb_mstr where isb_domain = global_domain |
|
1132 |
|
and isb_eu_nbr = ihhist.ih_ship |
|
1133 |
|
and isb_part = idh_for |
|
1134 |
|
and isb_serial = idh_serial |
|
1135 |
|
and isb_ref = idh_ref |
|
1136 |
|
no-lock no-error. |
|
1137 |
|
|
|
1138 |
|
if available isb_mstr and isb_desc1 <> "" then |
|
1139 |
|
desc1 = isb_desc1. |
|
1140 |
|
|
|
1141 |
|
end. /* if desc1 = ""... */ |
|
1142 |
|
|
|
1143 |
|
if desc1 = "" |
|
1144 |
|
then do: |
|
1145 |
|
|
|
1146 |
|
find pt_mstr where pt_domain = global_domain |
|
1147 |
|
and pt_part = idh_for |
|
1148 |
|
no-lock no-error. |
|
1149 |
|
if available pt_mstr then |
|
1150 |
|
desc1 = pt_desc1. |
|
1151 |
|
|
|
1152 |
|
end. /* if desc1 = "" */ |
|
1153 |
|
|
|
1154 |
|
svremarks = idh_for + " " + desc1. |
|
1155 |
|
|
|
1156 |
|
if idh_serial <> "" and |
|
1157 |
|
print_lotserials = no |
|
1158 |
|
then |
|
1159 |
|
svremarks = svremarks + getTermLabelRtColon("SERIAL",15) + " " + idh_serial. |
|
1160 |
|
|
|
1161 |
|
{us/et/etivsa.i d dent} |
|
1162 |
|
|
|
1163 |
|
put svremarks at 3 skip. |
|
1164 |
|
|
|
1165 |
|
if idh_qty_per > 1 or |
|
1166 |
|
idh_qty_item > 1 |
|
1167 |
|
then do: |
|
1168 |
|
|
|
1169 |
|
{us/et/etivsa.i d dent} |
|
1170 |
|
|
|
1171 |
|
put |
|
1172 |
|
{us/bbi/gplblfmt.i &FUNC=getTermLabel(""UNITS"",5) |
|
1173 |
|
&CONCAT="' '"} at 3 |
|
1174 |
|
idh_qty_item at 9 |
|
1175 |
|
|
|
1176 |
|
" x " + |
|
1177 |
|
{us/bbi/gplblfmt.i &FUNC=getTermLabel(""PERIODS"",7) |
|
1178 |
|
&CONCAT="' '"} at 24 |
|
1179 |
|
idh_qty_per at 35 |
|
1180 |
|
|
|
1181 |
|
" = " |
|
1182 |
|
{us/bbi/gplblfmt.i &FUNC=getTermLabel(""SHIPPED"",7) |
|
1183 |
|
&CONCAT="' '"} at 47 |
|
1184 |
|
idh_qty_inv at 58. |
|
1185 |
|
|
|
1186 |
|
end. /* if qty_per or qty_item > 1 */ |
|
1187 |
|
|
|
1188 |
|
end. /* if sacontract */ |
|
1189 |
|
|
|
1190 |
|
if idh_contr_id <> "" |
|
1191 |
|
and (idh_sched or rmaso) |
|
1192 |
|
then do: |
|
1193 |
|
|
|
1194 |
|
{us/et/etivsa.i d dent} |
|
1195 |
|
|
|
1196 |
|
/* MODIFIED PRINT OF 'PURCHASE ORDER' TO ONLY PRINT IF THIS |
|
1197 |
|
INVOICE WAS CREATED VIA CUSTOMER SCHEDULES. |
|
1198 |
|
ACTUALLY, PRINT IF NOT A SERVICE CONTRACT INVOICE. */ |
|
1199 |
|
|
|
1200 |
|
/* PRINT THE PO NUMBER IF A SCHEDULED ORDER INVOICE, */ |
|
1201 |
|
/* ELSE PRINT THE SERVICE CONTRACT FOR AN RMA INVOICE. */ |
|
1202 |
|
if idh_sched |
|
1203 |
|
then |
|
1204 |
|
put {us/bbi/gplblfmt.i &FUNC=getTermLabel(""PURCHASE_ORDER"",15) |
|
1205 |
|
&CONCAT="':'"} at 1 |
|
1206 |
|
idh_contr_id at 20. |
|
1207 |
|
else |
|
1208 |
|
put {us/bbi/gplblfmt.i &FUNC=getTermLabel(""SERVICE_CONTRACT"",16) |
|
1209 |
|
&CONCAT="':'"} at 1 |
|
1210 |
|
idh_contr_id at 20. |
|
1211 |
|
|
|
1212 |
|
/* FIND CORRECT SCHEDULE ORDER WITH SALES ORDER # AND LINE # */ |
|
1213 |
|
find scx_ref where scx_domain = global_domain |
|
1214 |
|
and scx_order = idh_nbr |
|
1215 |
|
and scx_line = idh_line |
|
1216 |
|
no-lock no-error. |
|
1217 |
|
if available scx_ref |
|
1218 |
|
then do: |
|
1219 |
|
|
|
1220 |
|
/* DISPLAY CUSTOMER REF IF NOT NULL AND DIFFERENT FROM CUST PART */ |
|
1221 |
|
if scx_custref <> "" and scx_custref <> idh_custpart |
|
1222 |
|
then |
|
1223 |
|
put {us/bbi/gplblfmt.i &FUNC=getTermLabel(""CUSTOMER_REFERENCE"",16) |
|
1224 |
|
&CONCAT="':'"} at 1 |
|
1225 |
|
scx_custref at 20. |
|
1226 |
|
/* DISPLAY MODEL YEAR IF NOT NULL */ |
|
1227 |
|
if scx_modelyr <> "" then |
|
1228 |
|
put {us/bbi/gplblfmt.i &FUNC=getTermLabel(""MODEL_YEAR"",16) |
|
1229 |
|
&CONCAT="':'"} at 1 |
|
1230 |
|
scx_modelyr at 20. |
|
1231 |
|
end. |
|
1232 |
|
|
|
1233 |
|
end. /* if idh_contr_id */ |
|
1234 |
|
|
|
1235 |
|
/* CHANGE DOMAINS IF USING MULTI-DOMAINS TO LOCATE tr_hist */ |
|
1236 |
|
so_db = global_db. |
|
1237 |
|
find si_mstr where si_domain = global_domain |
|
1238 |
|
and si_site = idh_site |
|
1239 |
|
no-lock. |
|
1240 |
|
if si_db <> so_db |
|
1241 |
|
then do: |
|
1242 |
|
{us/bbi/gprun.i ""gpalias3.p"" "(si_db, output err_flag)" } |
|
1243 |
|
end. |
|
1244 |
|
|
|
1245 |
|
assign |
|
1246 |
|
sonbr = idh_nbr |
|
1247 |
|
soline = idh_line |
|
1248 |
|
soinv = idh_inv_nbr |
|
1249 |
|
sopart = idh_part. |
|
1250 |
|
|
|
1251 |
|
if print_lotserials and lotserials_toprint <> 0 |
|
1252 |
|
then do: |
|
1253 |
|
|
|
1254 |
|
{us/et/etivsa.i d dent} |
|
1255 |
|
|
|
1256 |
|
put |
|
1257 |
|
getTermLabelRtColon("LOT/SERIAL_NUMBERS_SHIPPED",27) |
|
1258 |
|
+ " " + getTermLabelRt("QUANTITY",6) + " " |
|
1259 |
|
+ getTermLabelRt("EXPIRE",8) at 3 format "x(43)" |
|
1260 |
|
{us/bbi/gplblfmt.i &FUNC=getTermLabelRt(""REFERENCE"",13)} |
|
1261 |
|
skip. |
|
1262 |
|
|
|
1263 |
|
/* CHANGE DOMAINS IF USING MULTI-DOMAINS TO LOCATE tr_hist */ |
|
1264 |
|
{us/bbi/gprun.i ""soivrp1d.p"" |
|
1265 |
|
"(input table t_tr_hist1)"} |
|
1266 |
|
|
|
1267 |
|
end. /* if print_lotserials */ |
|
1268 |
|
|
|
1269 |
|
/* CALL ROUTINE SOAUTH.P FOR SCHEDULE ORDERS ONLY */ |
|
1270 |
|
/* WHEN 'INVOICE BY AUTHORIZATION' IS 'YES' */ |
|
1271 |
|
if idh_sched |
|
1272 |
|
and idh__qadc06 = "yes" |
|
1273 |
|
then do: |
|
1274 |
|
/* ROUTINE TO PRINT AUTHORIZATION NUMBER AND PEGGED QTY */ |
|
1275 |
|
{us/bbi/gprun.i ""soauth.p""} |
|
1276 |
|
end. /* IF IDH_SCHED */ |
|
1277 |
|
|
|
1278 |
|
/* RESET THE DOMAIN TO THE SALES ORDER DOMAIN */ |
|
1279 |
|
if si_db <> so_db |
|
1280 |
|
then do: |
|
1281 |
|
{us/bbi/gprun.i ""gpalias3.p"" "(so_db, output err_flag)" } |
|
1282 |
|
end. |
|
1283 |
|
|
|
1284 |
|
/******************************************** |
|
1285 |
|
ibh_serial subfield positions: |
|
1286 |
|
1-4 operation number |
|
1287 |
|
5-10 scrap percent |
|
1288 |
|
11-14 id number of this record |
|
1289 |
|
15-15 structure code |
|
1290 |
|
16-16 "y" (indicates "new" format sob_det record) |
|
1291 |
|
17-34 original qty per parent |
|
1292 |
|
35-35 original mandatory indicator (y/n) |
|
1293 |
|
36-36 original default indicator (y/n) |
|
1294 |
|
37-39 leadtime offset |
|
1295 |
|
*******************************************/ |
|
1296 |
|
|
|
1297 |
|
if print_options and |
|
1298 |
|
can-find(first ibh_hist where ibh_domain = global_domain |
|
1299 |
|
and ibh_inv_nbr = ih_hist.ih_inv_nbr |
|
1300 |
|
and ibh_line = idh_line |
|
1301 |
|
and ibh_nbr = ih_hist.ih_nbr) |
|
1302 |
|
then do: |
|
1303 |
|
/* PRINT DISCOUNTS FOR THE PARENT ITEM */ |
|
1304 |
|
{us/so/sopiprn3.i &nbr=idh_nbr &inv_nbr=idh_inv_nbr |
|
1305 |
|
&line=idh_line &part=idh_part |
|
1306 |
|
&parent="""" &feature="""" &opt="""" |
|
1307 |
|
&qty=idh_qty_inv &list_price=idh_list_pr |
|
1308 |
|
&net_price=idh_price |
|
1309 |
|
&confg_disc="no" |
|
1310 |
|
&command="~{us/so/soivcmd.i~}"} |
|
1311 |
|
|
|
1312 |
|
find first ibh_hist |
|
1313 |
|
where ibh_domain = global_domain |
|
1314 |
|
and ibh_inv_nbr = ih_hist.ih_inv_nbr |
|
1315 |
|
and ibh_line = idh_line |
|
1316 |
|
and ibh_nbr = ih_hist.ih_nbr |
|
1317 |
|
no-lock no-error. |
|
1318 |
|
|
|
1319 |
|
/* NEW STYLE ibh_hist RECORDS DO NOT HAVE DATA IN ibh_parent |
|
1320 |
|
THAT CORRESPONDS TO A pt_part RECORD. THEY CONTAIN A |
|
1321 |
|
SYMBOLIC REFERENCE IDENTIFIED BY BYTES 11-14 IN ibh_serial. |
|
1322 |
|
NEW STYLE ibh_hist RECORDS ARE FOR SALES ORDERS CREATED |
|
1323 |
|
SINCE PATCH GK60. */ |
|
1324 |
|
|
|
1325 |
|
if substring(ibh_serial, 16, 1) = "Y" |
|
1326 |
|
then do: |
|
1327 |
|
{us/bbi/gprun.i ""soivrp1f.p"" "(input """", |
|
1328 |
|
input 0, |
|
1329 |
|
input idh_nbr, |
|
1330 |
|
input idh_line, |
|
1331 |
|
input print_lotserials)"} |
|
1332 |
|
end. |
|
1333 |
|
else do: |
|
1334 |
|
for each ibh_hist |
|
1335 |
|
where ibh_domain = global_domain |
|
1336 |
|
and (ibh_inv_nbr = ih_hist.ih_inv_nbr |
|
1337 |
|
and ibh_nbr = ih_hist.ih_nbr |
|
1338 |
|
and ibh_line = idh_line |
|
1339 |
|
and (ibh_parent = idh_part or ibh_parent = "") |
|
1340 |
|
and ibh_qty_req <> 0) |
|
1341 |
|
no-lock: |
|
1342 |
|
|
|
1343 |
|
if idh_qty_ord = 0 |
|
1344 |
|
then |
|
1345 |
|
sob-qty = 0. |
|
1346 |
|
else |
|
1347 |
|
sob-qty = ibh_qty_req / idh_qty_ord. |
|
1348 |
|
assign |
|
1349 |
|
ibh_desc = "" |
|
1350 |
|
ibh_desc2 = "". |
|
1351 |
|
find pt_mstr |
|
1352 |
|
where pt_domain = global_domain |
|
1353 |
|
and pt_part = ibh_part |
|
1354 |
|
no-lock no-error. |
|
1355 |
|
if available pt_mstr |
|
1356 |
|
then |
|
1357 |
|
assign |
|
1358 |
|
ibh_desc = pt_desc1 |
|
1359 |
|
ibh_desc2 = pt_desc2 |
|
1360 |
|
ibh_um = pt_um. |
|
1361 |
|
|
|
1362 |
|
{us/et/etivsa.i d dent} |
|
1363 |
|
|
|
1364 |
|
put |
|
1365 |
|
ibh_feature format "x(12)" at 5 |
|
1366 |
|
" " ibh_part |
|
1367 |
|
sob-qty |
|
1368 |
|
" " ibh_um. |
|
1369 |
|
|
|
1370 |
|
run PrintDescription(input ibh_desc, |
|
1371 |
|
input false, |
|
1372 |
|
input false, |
|
1373 |
|
input 20). |
|
1374 |
|
|
|
1375 |
|
run PrintDescription(input ibh_desc2, |
|
1376 |
|
input false, |
|
1377 |
|
input true, |
|
1378 |
|
input 20). |
|
1379 |
|
|
|
1380 |
|
/* PRINT DISCOUNTS FOR COMPONENT ITEM */ |
|
1381 |
|
{us/so/sopiprn3.i &nbr=idh_nbr &inv_nbr=idh_inv_nbr |
|
1382 |
|
&line=idh_line &part=idh_part |
|
1383 |
|
&parent=ibh_parent |
|
1384 |
|
&feature="substring(ibh_feature,1,12)" |
|
1385 |
|
&opt=ibh_part |
|
1386 |
|
&qty="(sob-qty * idh_qty_inv)" |
|
1387 |
|
&list_price=ibh_tot_std |
|
1388 |
|
&net_price=ibh_price |
|
1389 |
|
&confg_disc="no" |
|
1390 |
|
&command="~{us/so/soivcmd.i~}"} |
|
1391 |
|
|
|
1392 |
|
if print_lotserials |
|
1393 |
|
then do: |
|
1394 |
|
{us/so/solotspr.i} |
|
1395 |
|
end. /* IF print_lotserials */ |
|
1396 |
|
|
|
1397 |
|
end. /* for each */ |
|
1398 |
|
end. /* else do */ |
|
1399 |
|
|
|
1400 |
|
end. /* if printoptions */ |
|
1401 |
|
|
|
1402 |
|
/* TEST FOR CONFIGURED PARENT WITHOUT COMPONENTS */ |
|
1403 |
|
|
|
1404 |
|
if available pt_mstr |
|
1405 |
|
then do: |
|
1406 |
|
|
|
1407 |
|
pm_code = pt_pm_code. |
|
1408 |
|
find ptp_det |
|
1409 |
|
where ptp_domain = global_domain |
|
1410 |
|
and ptp_part = idh_part |
|
1411 |
|
and ptp_site = idh_site |
|
1412 |
|
no-lock no-error. |
|
1413 |
|
if available ptp_det |
|
1414 |
|
then |
|
1415 |
|
pm_code = ptp_pm_code. |
|
1416 |
|
if pm_code = "C" and |
|
1417 |
|
not can-find(first ibh_hist where ibh_domain = global_domain |
|
1418 |
|
and ibh_inv_nbr = idh_inv_nbr |
|
1419 |
|
and ibh_line = idh_line |
|
1420 |
|
and ibh_nbr = idh_nbr) |
|
1421 |
|
then do: |
|
1422 |
|
|
|
1423 |
|
{us/so/sopiprn3.i &nbr=idh_nbr &inv_nbr=idh_inv_nbr |
|
1424 |
|
&line=idh_line &part=idh_part |
|
1425 |
|
&parent="""" &feature="""" &opt="""" |
|
1426 |
|
&qty=idh_qty_inv &list_price=idh_list_pr |
|
1427 |
|
&net_price=idh_price |
|
1428 |
|
&confg_disc="no" |
|
1429 |
|
&command="~{us/so/soivcmd.i~}"} |
|
1430 |
|
end. |
|
1431 |
|
end. /* if available pt_mstr */ |
|
1432 |
|
|
|
1433 |
|
/* PRINT GLOBAL DISCOUNT FOR ITEM/CONFIGURATION */ |
|
1434 |
|
{us/so/sopiprn3.i &nbr=idh_nbr &inv_nbr=idh_inv_nbr |
|
1435 |
|
&line=idh_line &part=idh_part |
|
1436 |
|
&parent="""" &feature="""" &opt="""" |
|
1437 |
|
&qty=idh_qty_inv &list_price=idh_list_pr |
|
1438 |
|
&net_price=idh_price |
|
1439 |
|
&confg_disc="yes" |
|
1440 |
|
&command="~{us/so/soivcmd.i~}"} |
|
1441 |
|
|
|
1442 |
|
if idh_cmtindx <> 0 then |
|
1443 |
|
do: |
|
1444 |
|
put skip(1). |
|
1445 |
|
run PrintLineComment(input idh_cmtindx, |
|
1446 |
|
input vcPriLineComment). |
|
1447 |
|
end. |
|
1448 |
|
put skip(1). |
|
1449 |
|
|
|
1450 |
|
if using_line_charges |
|
1451 |
|
then do: |
|
1452 |
|
|
|
1453 |
|
/* GET TOTALS FOR LINE CHARGES */ |
|
1454 |
|
{us/gp/gprunmo.i |
|
1455 |
|
&module = "ACL" |
|
1456 |
|
&program = ""soivlcrp.p"" |
|
1457 |
|
¶m = """(input idh_inv_nbr, |
|
1458 |
|
input idh_nbr, |
|
1459 |
|
input idh_line, |
|
1460 |
|
input ih_ship, |
|
1461 |
|
input ih_site, |
|
1462 |
|
input no, |
|
1463 |
|
input '', |
|
1464 |
|
input '', |
|
1465 |
|
input '', |
|
1466 |
|
input '', |
|
1467 |
|
input '', |
|
1468 |
|
input-output line_charge_tot)"""} |
|
1469 |
|
run ip_line_charges |
|
1470 |
|
(input idh_nbr, |
|
1471 |
|
input idh_inv_nbr, |
|
1472 |
|
input idh_line, |
|
1473 |
|
input-output l_nontax_amt, |
|
1474 |
|
input-output l_tax_amt). |
|
1475 |
|
|
|
1476 |
|
end. |
|
1477 |
|
|
|
1478 |
|
/*jpm*/ /*Temporarily remove PRM */ |
|
1479 |
|
/* |
|
1480 |
|
if idh_fsm_type = "PRM" |
|
1481 |
|
then do: |
|
1482 |
|
|
|
1483 |
|
/* SHOW DETAIL LINES */ |
|
1484 |
|
{us/gp/gprunmo.i |
|
1485 |
|
&module="PRM" |
|
1486 |
|
&program="pjivsfh.p" |
|
1487 |
|
¶m="""(input idh_nbr, |
|
1488 |
|
input idh_line)"""} |
|
1489 |
|
end. /* IF IDH_FSM_TYPE = "PRM" */ |
|
1490 |
|
*/ |
|
1491 |
|
|
|
1492 |
|
if last-of(idh_nbr) and using_container_charges |
|
1493 |
|
then do: |
|
1494 |
|
|
|
1495 |
|
/* GET TOTALS FOR CONTAINER CHARGES */ |
|
1496 |
|
{us/gp/gprunmo.i |
|
1497 |
|
&module = "ACL" |
|
1498 |
|
&program = ""soivccrp.p"" |
|
1499 |
|
¶m = """(input ih_inv_nbr, |
|
1500 |
|
input idh_nbr, |
|
1501 |
|
input ih_ship, |
|
1502 |
|
input ih_site, |
|
1503 |
|
input no, |
|
1504 |
|
input '', |
|
1505 |
|
input '', |
|
1506 |
|
input '', |
|
1507 |
|
input '', |
|
1508 |
|
input '', |
|
1509 |
|
input-output container_charge_tot)"""} |
|
1510 |
|
|
|
1511 |
|
|
|
1512 |
|
end. |
|
1513 |
|
if using_container_charges |
|
1514 |
|
then do: |
|
1515 |
|
run ip_container_charges |
|
1516 |
|
(input idh_nbr, |
|
1517 |
|
input idh_inv_nbr, |
|
1518 |
|
input idh_line, |
|
1519 |
|
input-output l_nontax_amt, |
|
1520 |
|
input-output l_tax_amt). |
|
1521 |
|
end. /* IF using_container_charges */ |
|
1522 |
|
|
|
1523 |
|
{us/mf/mfrpchk.i} |
|
1524 |
|
|
|
1525 |
|
end. /* for each idh_hist */ |
|
1526 |
|
|
|
1527 |
|
empty temp-table t_tr_hist1. |
|
1528 |
|
|
|
1529 |
|
/* CUSTOMER SEQUENCE SCHEDULES INSTALLED? */ |
|
1530 |
|
{us/bbi/gpfile.i &file_name = """"rcf_ctrl""""} |
|
1531 |
|
if can-find (mfc_ctrl where mfc_domain = global_domain and |
|
1532 |
|
mfc_field = "enable_sequence_schedules" and |
|
1533 |
|
mfc_logical) |
|
1534 |
|
and file_found |
|
1535 |
|
then do: |
|
1536 |
|
|
|
1537 |
|
/* CHANGE DOMAIN TO LOCATE abss_det */ |
|
1538 |
|
so_db = global_db. |
|
1539 |
|
find si_mstr |
|
1540 |
|
where si_domain = global_domain |
|
1541 |
|
and si_site = ih_site |
|
1542 |
|
no-lock. |
|
1543 |
|
if si_db <> so_db |
|
1544 |
|
then do: |
|
1545 |
|
|
|
1546 |
|
{us/bbi/gprun.i ""gpalias3.p"" "(si_db, output err_flag)" } |
|
1547 |
|
end. |
|
1548 |
|
|
|
1549 |
|
if err_flag <> 0 and err_flag <> 9 |
|
1550 |
|
then do: |
|
1551 |
|
/* DOMAIN # IS NOT AVAILABLE */ |
|
1552 |
|
{us/bbi/pxmsg.i &MSGNUM=6137 &ERRORLEVEL=4 &MSGARG1=getTermLabel(""'FOR_CUSTOMER_SEQUENCES'"",30)} |
|
1553 |
|
end. |
|
1554 |
|
else do: |
|
1555 |
|
/* PRINT SEQUENCE RANGE LIST ON INVOICE */ |
|
1556 |
|
{us/gp/gprunmo.i |
|
1557 |
|
&program=""rcsqps.p"" |
|
1558 |
|
&module="ASQ" |
|
1559 |
|
¶m="""(input ih_inv_nbr)"""} |
|
1560 |
|
|
|
1561 |
|
/* RESET THE DOMAIN TO THE SALES ORDER DOMAIN */ |
|
1562 |
|
if si_db <> so_db |
|
1563 |
|
then do: |
|
1564 |
|
{us/bbi/gprun.i ""gpalias3.p"" "(so_db, output err_flag)" } |
|
1565 |
|
end. |
|
1566 |
|
end. /* else do */ |
|
1567 |
|
|
|
1568 |
|
end. /* if can-find (mfc_ctrl where ... */ |
|
1569 |
|
|
|
1570 |
|
PROCEDURE mcpl-mc-curr-rnd: |
|
1571 |
|
/*----------------------------------------------------------------------- |
|
1572 |
|
Purpose: To round an amount using given rounding method |
|
1573 |
|
|
|
1574 |
|
Parameters: 1. input-output io_amount Amount to be converted |
|
1575 |
|
2. input i_rndmthd Rounding Method |
|
1576 |
|
3. output o_error error number (if any error found) |
|
1577 |
|
|
|
1578 |
|
Note: Procedure created to remove Error "Action Segment has exceeded |
|
1579 |
|
its limit of 63488 bytes". |
|
1580 |
|
-------------------------------------------------------------------------*/ |
|
1581 |
|
|
|
1582 |
|
define input-output parameter io_amount like ar_amt no-undo. |
|
1583 |
|
define input parameter i_rndmthd like rndmthd no-undo. |
|
1584 |
|
define output parameter o_error as integer no-undo. |
|
1585 |
|
|
|
1586 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1587 |
|
"(input-output io_amount, |
|
1588 |
|
input i_rndmthd, |
|
1589 |
|
output o_error)"} |
|
1590 |
|
|
|
1591 |
|
END PROCEDURE. /* mcpl-mc-curr-rnd */ |
|
1592 |
|
|
|
1593 |
|
PROCEDURE ip_line_charges: |
|
1594 |
|
define input parameter p_idh_nbr like idh_nbr no-undo. |
|
1595 |
|
define input parameter p_idh_inv_nbr like idh_inv_nbr no-undo. |
|
1596 |
|
define input parameter p_idh_line like idh_line no-undo. |
|
1597 |
|
define input-output parameter l_nontax_amt like ih_trl2_amt no-undo. |
|
1598 |
|
define input-output parameter l_tax_amt like ih_trl2_amt no-undo. |
|
1599 |
|
|
|
1600 |
|
if can-find(first absl_det |
|
1601 |
|
where absl_domain = global_domain |
|
1602 |
|
and absl_order = p_idh_nbr |
|
1603 |
|
and absl_ord_line = p_idh_line) |
|
1604 |
|
then do: |
|
1605 |
|
for each absl_det |
|
1606 |
|
where absl_domain = global_domain |
|
1607 |
|
and absl_order = p_idh_nbr |
|
1608 |
|
and absl_ord_line = p_idh_line |
|
1609 |
|
and (absl_inv_nbr = "" or absl_inv_nbr = p_idh_inv_nbr) |
|
1610 |
|
and absl_confirm = yes |
|
1611 |
|
and absl_inv_post = yes |
|
1612 |
|
no-lock: |
|
1613 |
|
for first trl_mstr |
|
1614 |
|
where trl_domain = global_domain |
|
1615 |
|
and trl_code = absl_trl_code |
|
1616 |
|
no-lock: |
|
1617 |
|
end. /* FOR FIRST trl_mstr */ |
|
1618 |
|
if available trl_mstr |
|
1619 |
|
then do: |
|
1620 |
|
if trl_taxable |
|
1621 |
|
then |
|
1622 |
|
l_tax_amt = l_tax_amt + absl_ext_price. |
|
1623 |
|
else |
|
1624 |
|
l_nontax_amt = l_nontax_amt + absl_ext_price. |
|
1625 |
|
end. /*IF AVAILABLE trl_mstr */ |
|
1626 |
|
end. /* FOR EACH absl_det */ |
|
1627 |
|
end. /* IF CAN-FIND absl_det */ |
|
1628 |
|
else if not available absl_det |
|
1629 |
|
then do: |
|
1630 |
|
for each idhlc_hist |
|
1631 |
|
where idhlc_domain = global_domain |
|
1632 |
|
and idhlc_nbr = p_idh_nbr |
|
1633 |
|
and idhlc_inv_nbr = p_idh_inv_nbr |
|
1634 |
|
and idhlc_line = p_idh_line |
|
1635 |
|
no-lock: |
|
1636 |
|
for first trl_mstr |
|
1637 |
|
where trl_domain = global_domain |
|
1638 |
|
and trl_code = idhlc_trl |
|
1639 |
|
no-lock: |
|
1640 |
|
if trl_taxable |
|
1641 |
|
then |
|
1642 |
|
l_tax_amt = l_tax_amt + idhlc_price. |
|
1643 |
|
else |
|
1644 |
|
l_nontax_amt = l_nontax_amt + idhlc_price. |
|
1645 |
|
end. /* FOR FIRST trl_mstr */ |
|
1646 |
|
end. /* FOR EACH idhlc_det*/ |
|
1647 |
|
end. /* ELSE if not available absl_det */ |
|
1648 |
|
END PROCEDURE. /* ip_line_charges */ |
|
1649 |
|
|
|
1650 |
|
PROCEDURE ip_container_charges: |
|
1651 |
|
define input parameter p_idh_nbr like idh_nbr no-undo. |
|
1652 |
|
define input parameter p_idh_inv_nbr like idh_inv_nbr no-undo. |
|
1653 |
|
define input parameter p_idh_line like idh_line no-undo. |
|
1654 |
|
define input-output parameter l_nontax_amt like ih_trl2_amt no-undo. |
|
1655 |
|
define input-output parameter l_tax_amt like ih_trl2_amt no-undo. |
|
1656 |
|
|
|
1657 |
|
for each abscc_det |
|
1658 |
|
where abscc_domain = global_domain |
|
1659 |
|
and abscc_order = p_idh_nbr |
|
1660 |
|
and abscc_ord_line = p_idh_line |
|
1661 |
|
and (abscc_inv_nbr = "" or abscc_inv_nbr = p_idh_inv_nbr) |
|
1662 |
|
and abscc_confirm = yes |
|
1663 |
|
and abscc_inv_post = yes |
|
1664 |
|
no-lock: |
|
1665 |
|
if abscc_taxable = yes |
|
1666 |
|
then |
|
1667 |
|
l_tax_amt = l_tax_amt + (abscc_cont_price * abscc_qty). |
|
1668 |
|
else |
|
1669 |
|
l_nontax_amt = l_nontax_amt + (abscc_cont_price * abscc_qty). |
|
1670 |
|
end. /* FOR EACH abscc_det */ |
|
1671 |
|
END PROCEDURE. /* ip_container_charges */ |
|
1672 |
|
|
|
1673 |
|
/* Procedures of Print Settings */ |
|
1674 |
|
{us/so/soprprc2.i &PageEnd="us/so/soivcmd.i"} |
File mfg/2013/base/src/xxivtrl2.i added (mode: 100644) (index 0000000..bf98ce6) |
|
1 |
|
/* xxivtrl2.i - PENDING INVOICE TRAILER */ |
|
2 |
|
/* soivtrl2.i - PENDING INVOICE TRAILER */ |
|
3 |
|
/* Copyright 1986 QAD Inc. All rights reserved. */ |
|
4 |
|
/* $Id$: */ |
|
5 |
|
/* REVISION: 7.4 CREATED: 10/02/95 BY: jym *G0XY* */ |
|
6 |
|
/* REVISION: 7.4 MODIFIED: 11/29/95 BY: rxm *H0GY* */ |
|
7 |
|
/* REVISION: 8.5 MODIFIED: 07/13/95 BY: taf *J053* */ |
|
8 |
|
/* REVISION: 8.5 MODIFIED: 01/08/96 BY: jzw *H0K0* */ |
|
9 |
|
/* REVISION: 8.5 LAST MODIFIED: 09/10/96 BY: *H0MP* Aruna Patil */ |
|
10 |
|
/* REVISION: 8.6 LAST MODIFIED: 11/25/96 BY: *K01X* Jeff Wootton */ |
|
11 |
|
/* REVISION: 8.6 LAST MODIFIED: 10/09/97 BY: *K0JV* Surendra Kumar */ |
|
12 |
|
/* REVISION: 8.6 LAST MODIFIED: 01/15/98 BY: *J2B2* Manish Kulkarni */ |
|
13 |
|
/* REVISION: 8.6E LAST MODIFIED: 02/23/98 BY: *L007* Annasheb Rahane */ |
|
14 |
|
/* REVISION: 8.6E LAST MODIFIED: 05/05/98 BY: *L00V* Ed van de Gevel */ |
|
15 |
|
/* REVISION: 8.6E LAST MODIFIED: 05/09/98 BY: *L00Y* Jeff Wootton */ |
|
16 |
|
/* REVISION: 8.6E LAST MODIFIED: 06/23/98 BY: *L01G* Robin McCarthy */ |
|
17 |
|
/* REVISION: 8.6E LAST MODIFIED: 07/02/98 BY: *L024* Sami Kureishy */ |
|
18 |
|
/* REVISION: 8.6E LAST MODIFIED: 08/10/98 BY: *J2VV* Rajesh Talele */ |
|
19 |
|
/* REVISION: 8.6E LAST MODIFIED: 08/19/98 BY: *J2WV* Surekha Joshi */ |
|
20 |
|
/* REVISION: 9.0 LAST MODIFIED: 09/29/98 BY: *J2CZ* Reetu Kapoor */ |
|
21 |
|
/* REVISION: 9.0 LAST MODIFIED: 11/17/98 BY: *H1LN* Poonam Bahl */ |
|
22 |
|
/* REVISION: 9.0 LAST MODIFIED: 01/22/99 BY: *J38T* Poonam Bahl */ |
|
23 |
|
/* REVISION: 9.0 LAST MODIFIED: 03/13/99 BY: *M0BD* Alfred Tan */ |
|
24 |
|
/* REVISION: 9.0 LAST MODIFIED: 05/07/99 BY: *J3DQ* Niranjan Ranka */ |
|
25 |
|
/* REVISION: 9.1 LAST MODIFIED: 09/08/99 BY: *N02P* Robert Jensen */ |
|
26 |
|
/* REVISION: 9.1 LAST MODIFIED: 10/01/99 BY: *N014* Murali Ayyagari */ |
|
27 |
|
/* REVISION: 9.1 LAST MODIFIED: 02/24/00 BY: *M0K0* Ranjit Jain */ |
|
28 |
|
/* REVISION: 9.1 LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */ |
|
29 |
|
/* REVISION: 9.1 LAST MODIFIED: 07/05/00 BY: *N0F4* Mudit Mehta */ |
|
30 |
|
/* REVISION: 9.1 LAST MODIFIED: 09/05/00 BY: *N0RF* Mark Brown */ |
|
31 |
|
/* REVISION: 9.1 LAST MODIFIED: 09/06/00 BY: *N0D0* Santosh Rao */ |
|
32 |
|
/* REVISION: 9.1 LAST MODIFIED: 10/16/00 BY: *N0W8* Mudit Mehta */ |
|
33 |
|
/* REVISION: 9.1 LAST MODIFIED: 03/05/01 BY: *M12V* Rajaneesh Sarangi */ |
|
34 |
|
/* Revision: 1.42 BY: Ellen Borden DATE: 07/09/01 ECO: *P007* */ |
|
35 |
|
/* Revision: 1.43 BY: Kaustubh Kulkarni DATE: 07/26/01 ECO: *M1DS* */ |
|
36 |
|
/* Revision: 1.44 BY: Mark Christian DATE: 02/07/02 ECO: *N18X* */ |
|
37 |
|
/* Revision: 1.46 BY: Ellen Borden DATE: 03/15/02 ECO: *P00G* */ |
|
38 |
|
/* Revision: 1.47 BY: Jean Miller DATE: 04/09/02 ECO: *P058* */ |
|
39 |
|
/* Revision: 1.48 BY: Manisha Sawant DATE: 07/11/02 ECO: *N1NW* */ |
|
40 |
|
/* Revision: 1.49 BY: Gnanasekar DATE: 11/12/02 ECO: *N1Y0* */ |
|
41 |
|
/* Revision: 1.50 BY: Mamata Samant DATE: 01/23/03 ECO: *N23T* */ |
|
42 |
|
/* Revision: 1.51 BY: Amit Chaturvedi DATE: 01/26/03 ECO: *N20Y* */ |
|
43 |
|
/* Revision: 1.57 BY: Vandna Rohira DATE: 04/28/03 ECO: *N1YL* */ |
|
44 |
|
/* Revision: 1.59 BY: Paul Donnelly (SB) DATE: 06/28/03 ECO: *Q00L* */ |
|
45 |
|
/* Revision: 1.60 BY: Vivek Gogte DATE: 08/02/03 ECO: *N2GZ* */ |
|
46 |
|
/* Revision: 1.61 BY: Manish Dani DATE: 09/01/03 ECO: *P0VZ* */ |
|
47 |
|
/* Revision: 1.62 BY: Ashish Maheshwari DATE: 10/15/03 ECO: *P15L* */ |
|
48 |
|
/* Revision: 1.63 BY: Sunil Fegade DATE: 12/11/03 ECO: *P1F7* */ |
|
49 |
|
/* Revision: 1.64 BY: Vinay Soman DATE: 01/20/04 ECO: *N2NZ* */ |
|
50 |
|
/* Revision: 1.65 BY: Vinay Soman DATE: 01/23/04 ECO: *P1JP* */ |
|
51 |
|
/* Revision: 1.66 BY: Rajaneesh Sarangi DATE: 01/23/04 ECO: *P1GK* */ |
|
52 |
|
/* Revision: 1.69 BY: Swati Sharma DATE: 02/27/04 ECO: *P1R4* */ |
|
53 |
|
/* Revision: 1.70 BY: Prashant Parab DATE: 04/06/04 ECO: *P1WT* */ |
|
54 |
|
/* Revision: 1.72 BY: Robin McCarthy DATE: 04/19/04 ECO: *P15V* */ |
|
55 |
|
/* Revision: 1.74 BY: Somesh Jeswani DATE: 06/16/04 ECO: *P25V* */ |
|
56 |
|
/* Revision: 1.74 BY: Sachin Deshmukh DATE: 07/07/04 ECO: *P268* */ |
|
57 |
|
/* Revision: 1.76 BY: Manish Dani DATE: 09/20/04 ECO: *P2L3* */ |
|
58 |
|
/* Revision: 1.77 BY: Sachin Deshmukh DATE: 09/22/04 ECO: *P2LR* */ |
|
59 |
|
/* Revision: 1.78 BY: Niranjan Ranka DATE: 10/04/04 ECO: *P2MQ* */ |
|
60 |
|
/* Revision: 1.79 BY: Dan Herman DATE: 10/25/04 ECO: *P2QS* */ |
|
61 |
|
/* Revision: 1.80 BY: Bharath Kumar DATE: 11/09/04 ECO: *P2TB* */ |
|
62 |
|
/* Revision: 1.82 BY: Shivganesh Hegde DATE: 01/03/05 ECO: *Q0G5* */ |
|
63 |
|
/* Revision: 1.84 BY: Ed van de Gevel DATE: 03/01/05 ECO: *R00G* */ |
|
64 |
|
/* Revision: 1.85 BY: Dayanand Jethwa DATE: 04/01/05 ECO: *P27M* */ |
|
65 |
|
/* Revision: 1.86 BY: Robin McCarthy DATE: 10/01/05 ECO: *P3MZ* */ |
|
66 |
|
/* Revision: 1.87 BY: Sandeep Panchal DATE: 01/17/06 ECO: *P3HZ* */ |
|
67 |
|
/* Revision: 1.88 BY: Nishit V DATE: 02/06/06 ECO: *P4GY* */ |
|
68 |
|
/* Revision: 1.90 BY: Jean Miller DATE: 02/28/06 ECO: *Q0R5* */ |
|
69 |
|
/* Revision: 1.91 BY: Ashwini G. DATE: 03/28/06 ECO: *P4ML* */ |
|
70 |
|
/* Revision: 1.93 BY: Suyash Keny DATE: 09/07/06 ECO: *R086* */ |
|
71 |
|
/* Revision: 1.94 BY: Rafiq S. DATE: 11/23/06 ECO: *P4YY* */ |
|
72 |
|
/* Revision: 1.95 BY: Nan Zhang DATE: 07/03/07 ECO: *R0C6* */ |
|
73 |
|
/* Revision: 1.98 BY: Jean Miller DATE: 11/17/07 ECO: *P62Q* */ |
|
74 |
|
/* Revision: 1.99 BY: Iram Momin DATE: 03/10/08 ECO: *P6G5* */ |
|
75 |
|
/* Revision: 1.102 BY: Jean Miller DATE: 06/24/08 ECO: *R0VH* */ |
|
76 |
|
/* Revision: 1.103 BY: Katie Hilbert DATE: 11/07/08 ECO: *R175* */ |
|
77 |
|
/* Revision: 1.104 BY: Xiaolei Meng DATE: 12/31/08 ECO: *R179* */ |
|
78 |
|
/* Revision: 1.105 BY: Mukesh singh DATE: 02/05/09 ECO: *P5VC* */ |
|
79 |
|
/* Revision: 1.109 BY: Dipanshu Talwar DATE: 10/01/09 ECO: *P552* */ |
|
80 |
|
/* Revision: 1.111 BY: Jean Miller DATE: 11/23/09 ECO: *R1TW* */ |
|
81 |
|
/* $Revision$ BY: Anurag Sharma DATE: 06/28/10 ECO: *Q45J* */ |
|
82 |
|
/* BGL LAST MODIFIED: 2014-FEB-12 BY: gbg *d2561 */ |
|
83 |
|
/*-Revision end---------------------------------------------------------------*/ |
|
84 |
|
/******************************************************************************/ |
|
85 |
|
/* All patch markers and commented out code have been removed from the source */ |
|
86 |
|
/* code below. For all future modifications to this file, any code which is */ |
|
87 |
|
/* no longer required should be deleted and no in-line patch markers should */ |
|
88 |
|
/* be added. The ECO marker should only be included in the Revision History. */ |
|
89 |
|
/******************************************************************************/ |
|
90 |
|
|
|
91 |
|
/*! |
|
92 |
|
* PARAMETERS: |
|
93 |
|
* |
|
94 |
|
* I/O NAME LIKE DESCRIPTION |
|
95 |
|
* ------ --------------- ------------ --------------------------------------- |
|
96 |
|
* input ref tx2d_ref so_nbr until inv print; then so_inv_nbr |
|
97 |
|
* input nbr tx2d_nbr blank until inv print; then so_nbr |
|
98 |
|
* input col-80 mfc_logical true to print report with 80 columns |
|
99 |
|
* otherwise report uses 132 columns |
|
100 |
|
* input tot_tr_type tx2d_tr_type 13 for Pending SO; 16 for posting |
|
101 |
|
* input tot_cont_charge decimal Total container charge amount |
|
102 |
|
* input tot_line_charge decimal Total line charge amount |
|
103 |
|
* input p_consolidate mfc_logical false to initialize taxable |
|
104 |
|
* and non taxable amounts |
|
105 |
|
*/ |
|
106 |
|
|
|
107 |
|
/*! N1YL HAS CHANGED THE WAY TAXABLE/NON-TAXABLE AMOUNT IS CALCULATED. |
|
108 |
|
* THE ORDER DISCOUNT IS APPLIED FOR EACH LINE TOTAL AND THEN IT IS |
|
109 |
|
* SUMMED UP TO CALCULATE THE TAXABLE/NON-TAXABLE AMOUNT BASED ON THE |
|
110 |
|
* TAXABLE STATUS OF EACH LINE. PREVIOUSLY, TAXABLE/NON-TAXABLE AMOUNT |
|
111 |
|
* WAS OBTAINED FROM THE GTM TABLES. THIS CAUSED PROBLEMS WHEN |
|
112 |
|
* MULTIPLE TAXABLE BASES ARE USED TO CALCULATE TAX. |
|
113 |
|
* |
|
114 |
|
* TAXABLE/NON-TAXABLE AMOUNT WILL NOW BE DISPLAYED IN THE TRAILER |
|
115 |
|
* FRAME BASED ON THE VALUE OF THE FLAG "DISPLAY TAXABLE/NON-TAXABLE |
|
116 |
|
* AMOUNT ON TRAILER" IN THE GLOBAL TAX MANAGEMENT CTRL FILE |
|
117 |
|
*/ |
|
118 |
|
|
|
119 |
|
{us/bbi/mfdeclre.i} |
|
120 |
|
{us/bbi/gplabel.i} /* EXTERNAL LABEL INCLUDE */ |
|
121 |
|
/*d2561*/ {xx2561.i} |
|
122 |
|
/*d2561*/ {xxtaxfn.i} |
|
123 |
|
|
|
124 |
|
{us/so/sotxidef.i} |
|
125 |
|
|
|
126 |
|
{us/gp/gprunpdf.i "sopl" "p"} |
|
127 |
|
{us/gp/gprunpdf.i "mcpl" "p"} |
|
128 |
|
|
|
129 |
|
{us/so/sotrhstb.i} /* DEFINITION FOR TEMP-TABLE t_tr_hist1 */ |
|
130 |
|
|
|
131 |
|
define input parameter ref like tx2d_ref no-undo. |
|
132 |
|
define input parameter nbr like tx2d_nbr no-undo. |
|
133 |
|
define input parameter col-80 like mfc_logical no-undo. |
|
134 |
|
define input parameter tax_tr_type like tx2d_tr_type no-undo. |
|
135 |
|
define input parameter tot_cont_charge as decimal no-undo. |
|
136 |
|
define input parameter tot_line_charge as decimal no-undo. |
|
137 |
|
define input parameter p_consolidate like mfc_logical no-undo. |
|
138 |
|
|
|
139 |
|
define new shared variable undo_txdetrp like mfc_logical. |
|
140 |
|
/* l_txchg IS SET TO TRUE IN TXEDIT.P WHEN TAXES ARE BEING EDITED */ |
|
141 |
|
/* AND NOT JUST VIEWED IN DR/CR MEMO MAINTENANCE */ |
|
142 |
|
define new shared variable l_txchg like mfc_logical initial no. |
|
143 |
|
define shared variable rndmthd like rnd_rnd_mthd. |
|
144 |
|
define shared variable so_recno as recid. |
|
145 |
|
define shared variable maint as logical. |
|
146 |
|
define shared variable consolidate like mfc_logical. |
|
147 |
|
define shared variable addtax like mfc_logical. |
|
148 |
|
define shared variable taxable_amt as decimal format "->>>>,>>>,>>9.99" |
|
149 |
|
label "Taxable". |
|
150 |
|
define shared variable nontaxable_amt like taxable_amt label "Non-Taxable". |
|
151 |
|
define shared variable line_total as decimal format "-zzzz,zzz,zz9.99" |
|
152 |
|
label "Line Total". |
|
153 |
|
define shared variable disc_amt like line_total label "Discount" |
|
154 |
|
format "(zzzz,zzz,zz9.99)". |
|
155 |
|
define shared variable tax_amt like line_total label "Total Tax". |
|
156 |
|
define shared variable ord_amt like line_total label "Total". |
|
157 |
|
define shared variable invcrdt as character format "x(15)". |
|
158 |
|
define shared variable user_desc like trl_desc extent 3. |
|
159 |
|
define shared variable tax_date like so_tax_date. |
|
160 |
|
define shared variable new_order like mfc_logical. |
|
161 |
|
define shared variable tax_edit like mfc_logical. |
|
162 |
|
define shared variable tax_edit_lbl like mfc_char format "x(28)". |
|
163 |
|
define shared variable undo_trl2 like mfc_logical. |
|
164 |
|
define shared variable tot_line_comm as decimal extent 4 |
|
165 |
|
format "->>>>,>>>,>>9.99<<<<". |
|
166 |
|
define shared variable container_charge_total as decimal |
|
167 |
|
format "->>>>>>>>9.99" |
|
168 |
|
label "Containers" no-undo. |
|
169 |
|
define shared variable line_charge_total as decimal |
|
170 |
|
format "->>>>>>>>9.99" |
|
171 |
|
label "Line Charges" no-undo. |
|
172 |
|
define shared variable l_nontaxable_lbl as character format "x(12)" no-undo. |
|
173 |
|
define shared variable l_taxable_lbl as character format "x(12)" no-undo. |
|
174 |
|
|
|
175 |
|
define shared frame sotot. |
|
176 |
|
define shared frame d. |
|
177 |
|
|
|
178 |
|
define variable ext_price like sod_price no-undo. |
|
179 |
|
define variable ext_actual like sod_price no-undo. |
|
180 |
|
define variable tax_lines like tx2d_line initial 0 no-undo. |
|
181 |
|
define variable page_break as integer initial 0 no-undo. |
|
182 |
|
define variable recalc like mfc_logical initial true no-undo. |
|
183 |
|
define variable tax-edited like mfc_logical initial false no-undo. |
|
184 |
|
define variable ext_margin as decimal format "->>>>,>>>,>>9.99" no-undo. |
|
185 |
|
define variable disc_pct like so_disc_pct no-undo. |
|
186 |
|
define variable l_tmp_amt as decimal no-undo. |
|
187 |
|
define variable retval as integer no-undo. |
|
188 |
|
define variable l_retrobill like mfc_logical no-undo. |
|
189 |
|
define variable l_tax_in like tax_amt no-undo. |
|
190 |
|
define variable l_yn like mfc_logical no-undo. |
|
191 |
|
define variable l_tax_amt1 like tax_amt no-undo. |
|
192 |
|
define variable l_tax_amt2 like tax_amt no-undo. |
|
193 |
|
define variable l_nontax_amt like tx2d_nontax_amt no-undo. |
|
194 |
|
define variable auth_price like sod_price no-undo |
|
195 |
|
format "->>>>,>>>,>>9.99". |
|
196 |
|
define variable auth_found like mfc_logical no-undo. |
|
197 |
|
define variable corr_inv like mfc_logical no-undo. |
|
198 |
|
define variable return_status as character no-undo. |
|
199 |
|
define variable undo_flag as logical. /* NOT no-undo */ |
|
200 |
|
define variable invoice_domain as character. /* NOT no-undo */ |
|
201 |
|
define variable l_tmp_line_total as decimal no-undo. |
|
202 |
|
define variable l_old_ord_amt like line_total no-undo. |
|
203 |
|
define variable l_roundedDiscAmt like line_total |
|
204 |
|
format "(zzzz,zzz,zz9.99)" no-undo. |
|
205 |
|
define variable exrate like exr_rate no-undo. |
|
206 |
|
define variable exrate2 like exr_rate no-undo. |
|
207 |
|
define variable ordertotal as decimal no-undo. |
|
208 |
|
define variable before_ordertotal as decimal no-undo. |
|
209 |
|
|
|
210 |
|
define variable hCreditManagementLib as handle no-undo. |
|
211 |
|
define variable iReturnStatus as integer no-undo. |
|
212 |
|
|
|
213 |
|
/* CREDIT MANAGEMENT ROUTINE */ |
|
214 |
|
{us/mf/mfcredpl.i hCreditManagementLib} |
|
215 |
|
|
|
216 |
|
run initialiseCreditManagementLibrary |
|
217 |
|
( input hCreditManagementLib, |
|
218 |
|
output hCreditManagementLib). |
|
219 |
|
|
|
220 |
|
define shared temp-table t_absr_det no-undo |
|
221 |
|
field t_absr_id like absr_id |
|
222 |
|
field t_absr_reference like absr_reference |
|
223 |
|
field t_absr_qty as decimal format "->>>>,>>>,>>9.99" |
|
224 |
|
field t_absr_ext as decimal format "->>>>,>>>,>>9.99" |
|
225 |
|
index t_absr_indx t_absr_id t_absr_reference. |
|
226 |
|
|
|
227 |
|
empty temp-table t_absr_det no-error. |
|
228 |
|
|
|
229 |
|
if execname = "rcrbrp01.p" then |
|
230 |
|
l_retrobill = yes. |
|
231 |
|
|
|
232 |
|
{us/tx/txcalvar.i} |
|
233 |
|
{us/et/etvar.i} /* TOOLKIT GENERAL VARIABLES */ |
|
234 |
|
{us/et/etrpvar.i} /* TOOLKIT REPORTING CURRENCY VARIABLES */ |
|
235 |
|
{us/so/socnvars.i} /* CONSIGNMENT VARIABLES */ |
|
236 |
|
|
|
237 |
|
{us/bbi/gpfilev.i} /* VARIABLE DEFINITIONS FOR gpfile.i */ |
|
238 |
|
|
|
239 |
|
{us/cc/cclc.i} /*DETERMINE IF CONTAINER AND LINE CHARGES ARE ENABLED*/ |
|
240 |
|
|
|
241 |
|
/* CHECK TO SEE IF CONSIGNMENT IS ACTIVE */ |
|
242 |
|
{us/bbi/gprun.i ""gpmfc01.p"" |
|
243 |
|
"(input ENABLE_CUSTOMER_CONSIGNMENT, |
|
244 |
|
input 10, |
|
245 |
|
input ADG, |
|
246 |
|
input CUST_CONSIGN_CTRL_TABLE, |
|
247 |
|
output using_cust_consignment)"} |
|
248 |
|
|
|
249 |
|
for first soc_ctrl where soc_domain = global_domain |
|
250 |
|
no-lock: end. |
|
251 |
|
|
|
252 |
|
for first txc_ctrl where txc_domain = global_domain |
|
253 |
|
no-lock: end. |
|
254 |
|
|
|
255 |
|
invoice_domain = global_domain. |
|
256 |
|
|
|
257 |
|
if maint then |
|
258 |
|
find so_mstr where recid(so_mstr) = so_recno |
|
259 |
|
exclusive-lock no-error. |
|
260 |
|
else |
|
261 |
|
for first so_mstr where recid(so_mstr) = so_recno |
|
262 |
|
no-lock: end. |
|
263 |
|
|
|
264 |
|
/* CREATE TEMP-TABLE TO STORE tr_hist RECORDS AND RETRIEVE THE SAME IN */ |
|
265 |
|
/* soauthbl.p TO IMPROVE THE PERFORMANCE WHILE PRINTING AUTHORIZATION */ |
|
266 |
|
/* NUMBERS FOR SCHEDULE ORDERS. */ |
|
267 |
|
if available so_mstr |
|
268 |
|
and so_sched = yes |
|
269 |
|
and so__qadc03 = "yes" |
|
270 |
|
and not can-find(first t_tr_hist1 where t_tr_nbr = so_nbr) |
|
271 |
|
then do: |
|
272 |
|
{us/bbi/gprun.i ""sotrhstb.p"" |
|
273 |
|
"(input so_nbr, |
|
274 |
|
input '', |
|
275 |
|
input-output table t_tr_hist1)"} |
|
276 |
|
end. /* IF AVAILABLE so_mstr */ |
|
277 |
|
|
|
278 |
|
find cil_mstr where cil_domain = global_domain |
|
279 |
|
and cil_cor_so_nbr = so_nbr |
|
280 |
|
no-lock no-error. |
|
281 |
|
|
|
282 |
|
corr_inv = available cil_mstr. |
|
283 |
|
|
|
284 |
|
/**** FORMS ****/ |
|
285 |
|
form |
|
286 |
|
so_cr_init colon 15 |
|
287 |
|
so_to_inv colon 48 |
|
288 |
|
so_cr_card colon 15 |
|
289 |
|
so_print_so colon 48 |
|
290 |
|
so_stat colon 15 |
|
291 |
|
so_print_pl colon 48 |
|
292 |
|
so_rev colon 15 |
|
293 |
|
so_prepaid colon 48 |
|
294 |
|
so_fob colon 15 |
|
295 |
|
with frame d side-labels width 80. |
|
296 |
|
|
|
297 |
|
/* SET EXTERNAL LABELS */ |
|
298 |
|
setFrameLabels(frame d:handle). |
|
299 |
|
|
|
300 |
|
{us/so/socurvar.i} |
|
301 |
|
{us/tx/txcurvar.i} |
|
302 |
|
/*d2561* {us/so/sototfrm.i} */ |
|
303 |
|
/*d2561*/ {xxtotfrm.i} |
|
304 |
|
|
|
305 |
|
taxloop: |
|
306 |
|
do on endkey undo, leave: |
|
307 |
|
|
|
308 |
|
if can-find (first tx2d_det |
|
309 |
|
where tx2d_domain = global_domain |
|
310 |
|
and tx2d_ref = ref |
|
311 |
|
and tx2d_nbr = nbr |
|
312 |
|
and tx2d_tr_type = tax_tr_type) |
|
313 |
|
then do: |
|
314 |
|
run p_calc. |
|
315 |
|
if undo_txdetrp = true then |
|
316 |
|
undo, leave. |
|
317 |
|
end. /* can-find (first tx2d_det ... */ |
|
318 |
|
|
|
319 |
|
/* UNTIL AN INVOICE IS PRINTED REF IS so_nbr AND */ |
|
320 |
|
/* nbr IS BLANK. ONCE AN INVOICE IS PRINTED */ |
|
321 |
|
/* REF IS so_inv_nbr AND nbr IS so_nbr */ |
|
322 |
|
/* CALCULATE TAX AMOUNTS ONLY IF MAINT */ |
|
323 |
|
if maint then do: |
|
324 |
|
|
|
325 |
|
/* SEE IF ANY TAX DETAIL EXISTS */ |
|
326 |
|
for first tx2d_det where tx2d_domain = global_domain |
|
327 |
|
and tx2d_ref = so_nbr |
|
328 |
|
and tx2d_nbr = nbr |
|
329 |
|
and tx2d_tr_type = tax_tr_type |
|
330 |
|
no-lock: end. |
|
331 |
|
|
|
332 |
|
if available tx2d_det then do: |
|
333 |
|
/* CHECK PREVIOUS DETAIL FOR EDITED VALUES */ |
|
334 |
|
if can-find (first tx2d_det |
|
335 |
|
where tx2d_domain = global_domain |
|
336 |
|
and tx2d_ref = so_nbr |
|
337 |
|
and tx2d_nbr = nbr |
|
338 |
|
and tx2d_tr_type = tax_tr_type |
|
339 |
|
and tx2d_edited) |
|
340 |
|
then do: |
|
341 |
|
/* PREVIOUS TAX VALUES EDITED. RECALCULATE? */ |
|
342 |
|
{us/bbi/pxmsg.i &MSGNUM=917 &ERRORLEVEL=2 &CONFIRM=recalc} |
|
343 |
|
end. |
|
344 |
|
end. |
|
345 |
|
|
|
346 |
|
else do: |
|
347 |
|
tax-edited = no. |
|
348 |
|
|
|
349 |
|
{us/bbi/gprun.i ""txedtchk.p"" |
|
350 |
|
"(input '11' /* SOURCE TR */, |
|
351 |
|
input so_nbr /* SOURCE REF */, |
|
352 |
|
input nbr /* SOURCE NBR */, |
|
353 |
|
input 0 /* ALL LINES */, |
|
354 |
|
output tax-edited)"} /* RETURN VAL */ |
|
355 |
|
|
|
356 |
|
if tax-edited then do: |
|
357 |
|
/* Copy edited tax values? */ |
|
358 |
|
{us/bbi/pxmsg.i &MSGNUM=935 &ERRORLEVEL=2 &CONFIRM=tax-edited} |
|
359 |
|
end. /* IF tax-edited */ |
|
360 |
|
|
|
361 |
|
end. /* ELSE IF AVAILABLE tx2d_det */ |
|
362 |
|
|
|
363 |
|
if recalc then do: |
|
364 |
|
|
|
365 |
|
l_nontax_amt = 0. |
|
366 |
|
|
|
367 |
|
for first tx2d_det where tx2d_domain = global_domain |
|
368 |
|
and tx2d_ref = so_nbr |
|
369 |
|
and tx2d_tr_type = tax_tr_type |
|
370 |
|
and tx2d_nontax_amt <> 0 |
|
371 |
|
no-lock: |
|
372 |
|
l_nontax_amt = tx2d_nontax_amt. |
|
373 |
|
end. /* FOR FIRST tx2d_det */ |
|
374 |
|
|
|
375 |
|
/* THE POST FLAG IS SET TO 'NO' BECAUSE WE ARE NOT CREATING */ |
|
376 |
|
/* QUANTUM REGISTER RECORDS FROM THIS CALL TO TXCALC.P */ |
|
377 |
|
{us/bbi/gprun.i ""txcalc.p"" |
|
378 |
|
"(input tax_tr_type, |
|
379 |
|
input ref, |
|
380 |
|
input nbr, |
|
381 |
|
input tax_lines /* ALL LINES */, |
|
382 |
|
input no, |
|
383 |
|
output result-status)"} |
|
384 |
|
if maint |
|
385 |
|
then do: |
|
386 |
|
if not can-find(first tx2d_det |
|
387 |
|
where tx2d_domain = global_domain |
|
388 |
|
and tx2d_ref = ref |
|
389 |
|
and tx2d_nbr = nbr |
|
390 |
|
and tx2d_tr_type = tax_tr_type |
|
391 |
|
and (tax_lines = 0 |
|
392 |
|
or tx2d_line = tax_lines) |
|
393 |
|
no-lock) |
|
394 |
|
then do: |
|
395 |
|
/* TAX DATA IS INCOMPLETE. TAX DETAIL WAS NOT CREATED */ |
|
396 |
|
{us/bbi/pxmsg.i &MSGNUM=11415 &ERRORLEVEL=2} |
|
397 |
|
/* INVOICE WILL NOT POST FOR THIS SALES ORDER */ |
|
398 |
|
{us/bbi/pxmsg.i &MSGNUM=11416 &ERRORLEVEL=1} |
|
399 |
|
end. /* IF NOT CAN-FIND ... */ |
|
400 |
|
end. /* IF maint */ |
|
401 |
|
|
|
402 |
|
/* CREATES TAX RECORDS WITH TRANSACTION TYPE "11" */ |
|
403 |
|
/* FOR THE QUANTITY BACKORDER DURING PENDING */ |
|
404 |
|
/* INVOICE MAINTENANCE */ |
|
405 |
|
if not so_sched then do: |
|
406 |
|
{us/bbi/gprun.i ""txcalc.p"" |
|
407 |
|
"(input "11", |
|
408 |
|
input ref, |
|
409 |
|
input nbr, |
|
410 |
|
input tax_lines, |
|
411 |
|
input no, |
|
412 |
|
output result-status)"} |
|
413 |
|
end. /* IF NOT so_sched */ |
|
414 |
|
|
|
415 |
|
end. /* IF recalc */ |
|
416 |
|
run p_calc. |
|
417 |
|
|
|
418 |
|
if undo_txdetrp = true then |
|
419 |
|
undo, leave. |
|
420 |
|
|
|
421 |
|
end. /* IF maint */ |
|
422 |
|
|
|
423 |
|
if maint then do on endkey undo taxloop, leave: |
|
424 |
|
|
|
425 |
|
if txc__qad03 then |
|
426 |
|
display |
|
427 |
|
l_nontaxable_lbl |
|
428 |
|
nontaxable_amt |
|
429 |
|
l_taxable_lbl |
|
430 |
|
taxable_amt |
|
431 |
|
with frame sotot. |
|
432 |
|
else |
|
433 |
|
display |
|
434 |
|
"" @ l_nontaxable_lbl |
|
435 |
|
"" @ nontaxable_amt |
|
436 |
|
"" @ l_taxable_lbl |
|
437 |
|
"" @ taxable_amt |
|
438 |
|
with frame sotot. |
|
439 |
|
find ih_hist where |
|
440 |
|
ih_hist.ih_domain = global_domain and |
|
441 |
|
ih_hist.ih_inv_nbr = so_inv_nbr |
|
442 |
|
no-lock no-error. |
|
443 |
|
if available ih_hist and |
|
444 |
|
ih__qadc05 <> "":U and |
|
445 |
|
ih__qadc05 <> ? and |
|
446 |
|
num-entries(ih__qadc05,chr(4)) = 2 |
|
447 |
|
then display |
|
448 |
|
so_curr |
|
449 |
|
absolute(line_total) @ line_total |
|
450 |
|
absolute(so_disc_pct) @ so_disc_pct |
|
451 |
|
absolute(disc_amt) @ disc_amt |
|
452 |
|
tax_date |
|
453 |
|
user_desc[1] so_trl1_cd absolute(so_trl1_amt) @ so_trl1_amt |
|
454 |
|
user_desc[2] so_trl2_cd absolute(so_trl2_amt) @ so_trl2_amt |
|
455 |
|
user_desc[3] so_trl3_cd absolute(so_trl3_amt) @ so_trl3_amt |
|
456 |
|
absolute(tax_amt) @ tax_amt |
|
457 |
|
absolute(ord_amt) @ ord_amt |
|
458 |
|
absolute(container_charge_total) @ container_charge_total |
|
459 |
|
absolute(line_charge_total) @ line_charge_total |
|
460 |
|
tax_edit |
|
461 |
|
invcrdt |
|
462 |
|
with frame sotot. |
|
463 |
|
else display |
|
464 |
|
so_curr |
|
465 |
|
line_total |
|
466 |
|
so_disc_pct |
|
467 |
|
disc_amt |
|
468 |
|
tax_date |
|
469 |
|
user_desc[1] so_trl1_cd so_trl1_amt |
|
470 |
|
user_desc[2] so_trl2_cd so_trl2_amt |
|
471 |
|
user_desc[3] so_trl3_cd so_trl3_amt |
|
472 |
|
tax_amt |
|
473 |
|
ord_amt |
|
474 |
|
container_charge_total |
|
475 |
|
line_charge_total |
|
476 |
|
tax_edit |
|
477 |
|
invcrdt |
|
478 |
|
with frame sotot. |
|
479 |
|
|
|
480 |
|
/* DON'T RE-SET THE TAX DATA */ |
|
481 |
|
trlloop: |
|
482 |
|
do on error undo trlloop, retry |
|
483 |
|
on endkey undo taxloop, leave: |
|
484 |
|
|
|
485 |
|
/* STORING THE DEFAULT VOLUME DISCOUNT PERCENTAGE */ |
|
486 |
|
assign |
|
487 |
|
disc_pct = so_disc_pct. |
|
488 |
|
|
|
489 |
|
set |
|
490 |
|
so_disc_pct when not corr_inv |
|
491 |
|
so_trl1_cd when not corr_inv |
|
492 |
|
so_trl1_amt |
|
493 |
|
so_trl2_cd when not corr_inv |
|
494 |
|
so_trl2_amt |
|
495 |
|
so_trl3_cd when not corr_inv |
|
496 |
|
so_trl3_amt |
|
497 |
|
tax_edit |
|
498 |
|
with frame sotot |
|
499 |
|
editing: |
|
500 |
|
readkey. |
|
501 |
|
if keyfunction(lastkey) = "end-error" |
|
502 |
|
then do: |
|
503 |
|
hide message no-pause. |
|
504 |
|
/* TAX AND TRAILER WILL NOT BE SAVED WHEN <BACK> */ |
|
505 |
|
/* OR <END> PRESSED */ |
|
506 |
|
{us/bbi/pxmsg.i &MSGNUM=4773 &ERRORLEVEL=2} |
|
507 |
|
/* INVOICE WILL NOT POST FOR THIS SALES ORDER */ |
|
508 |
|
{us/bbi/pxmsg.i &MSGNUM=11416 &ERRORLEVEL=1} |
|
509 |
|
/* CONTINUE WITHOUT SAVING? */ |
|
510 |
|
so_disc_pct = disc_pct. |
|
511 |
|
display so_disc_pct with frame sotot. |
|
512 |
|
{us/bbi/pxmsg.i &MSGNUM=4774 &ERRORLEVEL=1 &CONFIRM=l_yn} |
|
513 |
|
so_disc_pct = disc_pct. |
|
514 |
|
display so_disc_pct with frame sotot. |
|
515 |
|
hide message no-pause. |
|
516 |
|
|
|
517 |
|
if l_yn then |
|
518 |
|
undo taxloop, leave. |
|
519 |
|
end. /* IF KEYFUNCTION(LASTKEY) */ |
|
520 |
|
else |
|
521 |
|
apply lastkey. |
|
522 |
|
end. /* EDITING */ |
|
523 |
|
|
|
524 |
|
if so_disc_pct > 100 |
|
525 |
|
or so_disc_pct < - 100 |
|
526 |
|
then do: |
|
527 |
|
{us/bbi/pxmsg.i &MSGNUM=6932 &ERRORLEVEL=3 &MSGARG1=so_disc_pct} |
|
528 |
|
next-prompt so_disc_pct with frame sotot. |
|
529 |
|
undo trlloop, retry. |
|
530 |
|
end. |
|
531 |
|
|
|
532 |
|
/* TO CHECK WHETHER DISCOUNT PERCENTAGE MANUALLY ENTERED?*/ |
|
533 |
|
if so_disc_pct <> disc_pct then |
|
534 |
|
so__qadl01 = yes. |
|
535 |
|
|
|
536 |
|
{us/tx/txedttrl.i &code = "so_trl1_cd" |
|
537 |
|
&amt = "so_trl1_amt" |
|
538 |
|
&desc = "user_desc[1]" |
|
539 |
|
&frame = "sotot" |
|
540 |
|
&loop = "trlloop"} |
|
541 |
|
|
|
542 |
|
/* VALIDATE TRAILER 1 AMOUNT */ |
|
543 |
|
if (so_trl1_amt <> 0) then do: |
|
544 |
|
|
|
545 |
|
{us/bbi/gprun.i ""gpcurval.p"" |
|
546 |
|
"(input so_trl1_amt, |
|
547 |
|
input rndmthd, |
|
548 |
|
output retval)"} |
|
549 |
|
|
|
550 |
|
if retval <> 0 then do: |
|
551 |
|
next-prompt so_trl1_amt with frame sotot. |
|
552 |
|
undo trlloop, retry. |
|
553 |
|
end. |
|
554 |
|
|
|
555 |
|
end. |
|
556 |
|
|
|
557 |
|
{us/tx/txedttrl.i &code = "so_trl2_cd" |
|
558 |
|
&amt = "so_trl2_amt" |
|
559 |
|
&desc = "user_desc[2]" |
|
560 |
|
&frame = "sotot" |
|
561 |
|
&loop = "trlloop"} |
|
562 |
|
|
|
563 |
|
/* VALIDATE TRAILER 2 AMOUNT */ |
|
564 |
|
if (so_trl2_amt <> 0) then do: |
|
565 |
|
{us/bbi/gprun.i ""gpcurval.p"" |
|
566 |
|
"(input so_trl2_amt, |
|
567 |
|
input rndmthd, |
|
568 |
|
output retval)"} |
|
569 |
|
|
|
570 |
|
if retval <> 0 then do: |
|
571 |
|
next-prompt so_trl2_amt with frame sotot. |
|
572 |
|
undo trlloop, retry. |
|
573 |
|
end. |
|
574 |
|
end. |
|
575 |
|
|
|
576 |
|
{us/tx/txedttrl.i &code = "so_trl3_cd" |
|
577 |
|
&amt = "so_trl3_amt" |
|
578 |
|
&desc = "user_desc[3]" |
|
579 |
|
&frame = "sotot" |
|
580 |
|
&loop = "trlloop"} |
|
581 |
|
|
|
582 |
|
/* VALIDATE TRAILER 3 AMOUNT */ |
|
583 |
|
if (so_trl3_amt <> 0) then do: |
|
584 |
|
{us/bbi/gprun.i ""gpcurval.p"" |
|
585 |
|
"(input so_trl3_amt, |
|
586 |
|
input rndmthd, |
|
587 |
|
output retval)"} |
|
588 |
|
|
|
589 |
|
if retval <> 0 then do: |
|
590 |
|
next-prompt so_trl3_amt with frame sotot. |
|
591 |
|
undo trlloop, retry. |
|
592 |
|
end. |
|
593 |
|
end. |
|
594 |
|
|
|
595 |
|
end. /* TRLLOOP */ |
|
596 |
|
|
|
597 |
|
/****** CALCULATE TAXES ************/ |
|
598 |
|
|
|
599 |
|
/* UNTIL AN INVOICE IS PRINTED REF IS so_nbr AND */ |
|
600 |
|
/* nbr IS BLANK. ONCE AN INVOICE IS PRINTED */ |
|
601 |
|
/* REF BECOMES so_inv_nbr AND nbr IS so_nbr */ |
|
602 |
|
|
|
603 |
|
if recalc and not tax-edited then do: |
|
604 |
|
|
|
605 |
|
{us/bbi/gprun.i ""txcalc.p"" |
|
606 |
|
"(input tax_tr_type, |
|
607 |
|
input ref, |
|
608 |
|
input nbr, |
|
609 |
|
input tax_lines, /* ALL LINES */ |
|
610 |
|
input no, |
|
611 |
|
output result-status)"} |
|
612 |
|
|
|
613 |
|
/* CREATES TAX RECORDS WITH TRANSACTION TYPE "11" */ |
|
614 |
|
/* FOR THE QUANTITY BACKORDER DURING PENDING */ |
|
615 |
|
/* INVOICE MAINTENANCE */ |
|
616 |
|
if not so_sched then do: |
|
617 |
|
|
|
618 |
|
{us/bbi/gprun.i ""txcalc.p"" |
|
619 |
|
"(input "11", |
|
620 |
|
input ref, |
|
621 |
|
input nbr, |
|
622 |
|
input tax_lines, |
|
623 |
|
input no, |
|
624 |
|
output result-status)"} |
|
625 |
|
|
|
626 |
|
end. /* IF NOT so_sched */ |
|
627 |
|
|
|
628 |
|
end. |
|
629 |
|
|
|
630 |
|
{us/bbi/gprun.i ""txabsrb.p"" |
|
631 |
|
"(input so_nbr, |
|
632 |
|
input ' ', |
|
633 |
|
input '13', |
|
634 |
|
input-output line_total, |
|
635 |
|
input-output taxable_amt)"} |
|
636 |
|
|
|
637 |
|
/* DO TAX DETAIL DISPLAY / EDIT HERE */ |
|
638 |
|
if tax_edit then do: |
|
639 |
|
|
|
640 |
|
hide frame sotot no-pause. |
|
641 |
|
hide frame d no-pause. |
|
642 |
|
|
|
643 |
|
{us/bbi/gprun.i ""txedit.p"" |
|
644 |
|
"(input tax_tr_type, |
|
645 |
|
input ref, |
|
646 |
|
input nbr, |
|
647 |
|
input tax_lines, /* ALL LINES */ |
|
648 |
|
input so_tax_env, |
|
649 |
|
input so_curr, |
|
650 |
|
input so_ex_ratetype, |
|
651 |
|
input so_ex_rate, |
|
652 |
|
input so_ex_rate2, |
|
653 |
|
input tax_date, |
|
654 |
|
output tax_amt)"} |
|
655 |
|
|
|
656 |
|
run p_calc. |
|
657 |
|
|
|
658 |
|
if undo_txdetrp = true then |
|
659 |
|
undo, leave. |
|
660 |
|
|
|
661 |
|
end. |
|
662 |
|
|
|
663 |
|
end. /* END IF maint BLOCK */ |
|
664 |
|
|
|
665 |
|
l_old_ord_amt = ord_amt. |
|
666 |
|
|
|
667 |
|
run p_calc. |
|
668 |
|
|
|
669 |
|
if l_old_ord_amt <> ord_amt |
|
670 |
|
and execname = "soivmt.p" |
|
671 |
|
then do: |
|
672 |
|
find first so_mstr where recid(so_mstr) = so_recno |
|
673 |
|
exclusive-lock no-error. |
|
674 |
|
if available so_mstr then |
|
675 |
|
assign |
|
676 |
|
so_to_inv = yes |
|
677 |
|
so_invoiced = no. |
|
678 |
|
end. |
|
679 |
|
|
|
680 |
|
if undo_txdetrp = true then |
|
681 |
|
undo, leave. |
|
682 |
|
|
|
683 |
|
if maint then do: |
|
684 |
|
/* CALCULATE SALES ORDR BALANCE BY APPLYING EXCHANGE RATE ENTERED */ |
|
685 |
|
/* BY USER ON SO HEADER ONLY WHEN BASE CURRENCY = CUSTOMER CURRENCY */ |
|
686 |
|
/* AND FIXED RATE = YES AND USER ENTERED EXCHANGE RATE. */ |
|
687 |
|
/* SINCE FINANCIAL SIDE DO NOT KNOW THE USER ENTERED EXCHANGE RATE */ |
|
688 |
|
/* SALES ORDER BALANCE IS CALCULATED HERE BY APPLYING EXCHANGE RATE */ |
|
689 |
|
/* FROM SALES ORDER AND CALLING PROCEDURE updateOpenOrderTotal BY */ |
|
690 |
|
/* PASSING CUSTOMER CURRENCY INSTEAD OF SALES ORDER CURRENCY. */ |
|
691 |
|
/* NOTE: SALES ORDER EXCHANGE RATE IS STORED AS */ |
|
692 |
|
/* SO_EX_RATE = FOREIGN CURR AND SO_EX_RATE2 = BASE CURR */ |
|
693 |
|
|
|
694 |
|
/* GET CURRENCY OF BILL-TO ADDRESS */ |
|
695 |
|
find first cm_mstr |
|
696 |
|
where cm_domain = global_domain |
|
697 |
|
and cm_addr = so_bill |
|
698 |
|
no-lock no-error. |
|
699 |
|
|
|
700 |
|
if base_curr = so_curr |
|
701 |
|
then do: |
|
702 |
|
assign |
|
703 |
|
exrate = 1 |
|
704 |
|
exrate2 = 1. |
|
705 |
|
end. /* base_curr = so_curr */ |
|
706 |
|
else do: |
|
707 |
|
/* IF BASE CURRENCY AND CUSTOMER CURRENCY ARE SAME */ |
|
708 |
|
/* AND SALES ORDER IN FOREIGN CURRENCY AND SO_FXIED_RATE = YES */ |
|
709 |
|
if base_curr = cm_curr and |
|
710 |
|
so_fix_rate = yes |
|
711 |
|
then do: |
|
712 |
|
for first exr_rate |
|
713 |
|
where exr_domain = global_domain |
|
714 |
|
and exr_curr1 = base_curr |
|
715 |
|
and exr_curr2 = so_curr |
|
716 |
|
and exr_ratetype = '' |
|
717 |
|
and exr_start_date <= so_ord_date |
|
718 |
|
and exr_end_date >= so_ord_date |
|
719 |
|
no-lock: |
|
720 |
|
end. |
|
721 |
|
|
|
722 |
|
if available exr_rate then |
|
723 |
|
assign |
|
724 |
|
exrate2 = exr_rate |
|
725 |
|
exrate = exr_rate2. |
|
726 |
|
else do: |
|
727 |
|
for first exr_rate |
|
728 |
|
where exr_domain = global_domain |
|
729 |
|
and exr_curr1 = so_curr |
|
730 |
|
and exr_curr2 = base_curr |
|
731 |
|
and exr_ratetype = '' |
|
732 |
|
and exr_start_date <= so_ord_date |
|
733 |
|
and exr_end_date >= so_ord_date |
|
734 |
|
no-lock: |
|
735 |
|
end. |
|
736 |
|
if available exr_rate then |
|
737 |
|
assign |
|
738 |
|
exrate = exr_rate |
|
739 |
|
exrate2 = exr_rate2. |
|
740 |
|
end. /* else */ |
|
741 |
|
end. /* base_curr = cm_curr and so_fix_rate = yes */ |
|
742 |
|
end. /* base_curr <> so_curr */ |
|
743 |
|
|
|
744 |
|
/* IF BASE CURRENCY AND CUSTOMER CURRENCY ARE SAME */ |
|
745 |
|
/* AND SALES ORDER IN FOREIGN CURRENCY AND SO_FXIED_RATE = YES */ |
|
746 |
|
/* THEN UPDATE DEBTOR BALANCE BASED ON USER ENTERED EXCHANGE RATE */ |
|
747 |
|
if (base_curr = cm_curr and |
|
748 |
|
base_curr <> so_curr) and |
|
749 |
|
so_fix_rate = yes |
|
750 |
|
then do: |
|
751 |
|
|
|
752 |
|
assign |
|
753 |
|
ordertotal = getOrderTotal (input so_nbr) |
|
754 |
|
before_ordertotal = getBeforeOrderTotal(input so_nbr). |
|
755 |
|
/* CONVERT THE ORDER TOTAL */ |
|
756 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-conv" |
|
757 |
|
"(input so_curr, |
|
758 |
|
input base_curr, |
|
759 |
|
input so_ex_rate, |
|
760 |
|
input so_ex_rate2, |
|
761 |
|
input ordertotal, |
|
762 |
|
input false, |
|
763 |
|
output ordertotal, |
|
764 |
|
output mc-error-number)"} |
|
765 |
|
|
|
766 |
|
if mc-error-number <> 0 then do: |
|
767 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
768 |
|
end. |
|
769 |
|
|
|
770 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-conv" |
|
771 |
|
"(input so_curr, |
|
772 |
|
input base_curr, |
|
773 |
|
input so_ex_rate, |
|
774 |
|
input so_ex_rate2, |
|
775 |
|
input before_ordertotal, |
|
776 |
|
input false, |
|
777 |
|
output before_ordertotal, |
|
778 |
|
output mc-error-number)"} |
|
779 |
|
|
|
780 |
|
if mc-error-number <> 0 then do: |
|
781 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
782 |
|
end. |
|
783 |
|
|
|
784 |
|
if (before_ordertotal - ordertotal) <> 0 then do: |
|
785 |
|
/* UPDATE OPEN ORDER TOTAL IN QAD FINANCIALS */ |
|
786 |
|
run updateOpenOrderTotal in hCreditManagementLib |
|
787 |
|
( input so_bill, |
|
788 |
|
input before_ordertotal, |
|
789 |
|
input OrderTotal, |
|
790 |
|
input cm_curr, |
|
791 |
|
output iReturnStatus). |
|
792 |
|
end. /* if (before_ordertotal - ordertotal) <> 0 */ |
|
793 |
|
end. /* base_curr = cm_curr and base_curr <> so_curr */ |
|
794 |
|
else do: |
|
795 |
|
/* UPDATE OPEN ORDER TOTAL IN QAD FINANCIALS */ |
|
796 |
|
run updateOpenOrderTotal in hCreditManagementLib |
|
797 |
|
(input so_bill, |
|
798 |
|
input getBeforeOrderTotal(input so_nbr), |
|
799 |
|
input getOrderTotal (input so_nbr), |
|
800 |
|
input so_curr, |
|
801 |
|
output iReturnStatus). |
|
802 |
|
end. /* else */ |
|
803 |
|
|
|
804 |
|
view frame sotot. |
|
805 |
|
view frame d. |
|
806 |
|
|
|
807 |
|
end. |
|
808 |
|
|
|
809 |
|
/* DISPLAY TRAILER ONLY IF INVOICES ARE NOT CONSOLIDATED */ |
|
810 |
|
if not consolidate then do: |
|
811 |
|
|
|
812 |
|
if txc__qad03 then |
|
813 |
|
display |
|
814 |
|
l_nontaxable_lbl |
|
815 |
|
nontaxable_amt |
|
816 |
|
l_taxable_lbl |
|
817 |
|
taxable_amt |
|
818 |
|
with frame sotot. |
|
819 |
|
else |
|
820 |
|
display |
|
821 |
|
"" @ l_nontaxable_lbl |
|
822 |
|
"" @ nontaxable_amt |
|
823 |
|
"" @ l_taxable_lbl |
|
824 |
|
"" @ taxable_amt |
|
825 |
|
with frame sotot. |
|
826 |
|
/*d2561*/ tr1pct = gettrltaxpct(so_nbr, so_trl1_cd). |
|
827 |
|
/*d2561*/ tr1tax = gettrltaxamt(so_nbr, so_trl1_cd). |
|
828 |
|
/*d2561*/ tr2pct = gettrltaxpct(so_nbr, so_trl2_cd). |
|
829 |
|
/*d2561*/ tr2tax = gettrltaxamt(so_nbr, so_trl2_cd). |
|
830 |
|
/*d2561*/ tr3pct = gettrltaxpct(so_nbr, so_trl3_cd). |
|
831 |
|
/*d2561*/ tr3tax = gettrltaxamt(so_nbr, so_trl3_cd). |
|
832 |
|
display |
|
833 |
|
so_curr |
|
834 |
|
line_total |
|
835 |
|
so_disc_pct |
|
836 |
|
disc_amt |
|
837 |
|
tax_date |
|
838 |
|
user_desc[1] |
|
839 |
|
so_trl1_cd |
|
840 |
|
so_trl1_amt |
|
841 |
|
/*d2561*/ tr1pct |
|
842 |
|
/*d2561*/ tr1tax |
|
843 |
|
user_desc[2] |
|
844 |
|
so_trl2_cd |
|
845 |
|
so_trl2_amt |
|
846 |
|
/*d2561*/ tr2pct |
|
847 |
|
/*d2561*/ tr2tax |
|
848 |
|
user_desc[3] |
|
849 |
|
so_trl3_cd |
|
850 |
|
so_trl3_amt |
|
851 |
|
/*d2561*/ tr3pct |
|
852 |
|
/*d2561*/ tr3tax |
|
853 |
|
tax_amt |
|
854 |
|
ord_amt |
|
855 |
|
container_charge_total |
|
856 |
|
line_charge_total |
|
857 |
|
invcrdt |
|
858 |
|
with frame sotot. |
|
859 |
|
|
|
860 |
|
end. |
|
861 |
|
|
|
862 |
|
undo_trl2 = FALSE. |
|
863 |
|
|
|
864 |
|
end. /* TAXLOOP */ |
|
865 |
|
|
|
866 |
|
empty temp-table t_tr_hist1. |
|
867 |
|
|
|
868 |
|
/* ========================================================================== */ |
|
869 |
|
/* ************************* INTERNAL PROCEDURES **************************** */ |
|
870 |
|
/* ========================================================================== */ |
|
871 |
|
|
|
872 |
|
PROCEDURE ip_calc_amt: |
|
873 |
|
define input-output parameter p_ext_actual like sod_price no-undo. |
|
874 |
|
define input-output parameter p_line_total as decimal no-undo. |
|
875 |
|
define input-output parameter p_taxable_amt as decimal. |
|
876 |
|
define input-output parameter p_nontaxable_amt as decimal. |
|
877 |
|
define input-output parameter l_taxable_amt as decimal. |
|
878 |
|
define parameter buffer somstr for so_mstr. |
|
879 |
|
define parameter buffer soddet for sod_det. |
|
880 |
|
|
|
881 |
|
/* l_ext_actual IS THE EXTENDED AMOUNT EXCLUDING DISCOUNT. IT WILL */ |
|
882 |
|
/* BE USED FOR THE CALCULATION OF taxable_amt AND nontaxable_amt */ |
|
883 |
|
define variable l_ext_actual like sod_price no-undo. |
|
884 |
|
|
|
885 |
|
if somstr.so_fsm_type = "SC" then do: |
|
886 |
|
p_ext_actual = soddet.sod_price * soddet.sod_qty_item. |
|
887 |
|
|
|
888 |
|
if can-find (sac_ctrl where sac_domain = global_domain |
|
889 |
|
and sac_int_rnd) |
|
890 |
|
then do: |
|
891 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
892 |
|
"(input-output p_ext_actual, |
|
893 |
|
input rndmthd, |
|
894 |
|
output mc-error-number)"} |
|
895 |
|
|
|
896 |
|
if mc-error-number <> 0 |
|
897 |
|
then do: |
|
898 |
|
|
|
899 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
900 |
|
|
|
901 |
|
end. /* IF mc-error-number <> 0 */ |
|
902 |
|
end. /* IF CAN-FIND (sac_ctrl... */ |
|
903 |
|
|
|
904 |
|
p_ext_actual = p_ext_actual * soddet.sod_qty_per. |
|
905 |
|
end. /* IF somstr.so_fsm_type = "SC" */ |
|
906 |
|
else |
|
907 |
|
p_ext_actual = (soddet.sod_price * soddet.sod_qty_inv). |
|
908 |
|
|
|
909 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
910 |
|
"(input-output p_ext_actual, |
|
911 |
|
input rndmthd, |
|
912 |
|
output mc-error-number)"} |
|
913 |
|
|
|
914 |
|
if mc-error-number <> 0 then do: |
|
915 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
916 |
|
end. |
|
917 |
|
|
|
918 |
|
/* CHECK AUTHORIZATION RECS FOR DIFFERENT EXT PRICE */ |
|
919 |
|
if soddet.sod_sched = yes |
|
920 |
|
and somstr.so__qadc03 = "yes" |
|
921 |
|
then do: |
|
922 |
|
|
|
923 |
|
auth_found = no. |
|
924 |
|
|
|
925 |
|
/* SECOND PARAMETER IS BLANK IN ORDER TO MATCH */ |
|
926 |
|
/* THE INVOICE TOTAL WITH DR/CR MEMO TOTAL */ |
|
927 |
|
{us/bbi/gprun.i ""soauthbl.p"" |
|
928 |
|
"(input table t_tr_hist1, |
|
929 |
|
input '', |
|
930 |
|
input somstr.so__qadc03, |
|
931 |
|
input soddet.sod_nbr, |
|
932 |
|
input soddet.sod_line, |
|
933 |
|
input soddet.sod_price, |
|
934 |
|
input soddet.sod_site, |
|
935 |
|
input p_ext_actual, |
|
936 |
|
output auth_price, |
|
937 |
|
output auth_found)"} |
|
938 |
|
assign |
|
939 |
|
ext_actual = auth_price |
|
940 |
|
p_ext_actual = auth_price. |
|
941 |
|
|
|
942 |
|
end. /*IF sod_sched */ |
|
943 |
|
l_ext_actual = (p_ext_actual * (1 - somstr.so_disc_pct / 100)). |
|
944 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
945 |
|
"(input-output l_ext_actual, |
|
946 |
|
input rndmthd, |
|
947 |
|
output mc-error-number)"} |
|
948 |
|
|
|
949 |
|
if mc-error-number <> 0 then do: |
|
950 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
951 |
|
end. |
|
952 |
|
|
|
953 |
|
for first t_store_ext_actual |
|
954 |
|
where t_line = sod_line |
|
955 |
|
no-lock: |
|
956 |
|
end. /* FOR FIRST t_store_ext_actual ... */ |
|
957 |
|
|
|
958 |
|
/* CALL THE PROCEDURE TO GET LINE TOTAL ONLY WHEN TAX IS INCLUDED */ |
|
959 |
|
/* AND THE TAX HAS BEEN ALREADY CALCULATED WHICH IS INDICATED BY */ |
|
960 |
|
/* THE EXISTENCE OF TEMPORARY TABLE t_store_ext_actual */ |
|
961 |
|
/* */ |
|
962 |
|
/* AFTER WE GET THE LINE TOTAL WE CAN USE THE EXISTING LOGIC TO */ |
|
963 |
|
/* CALCULATE ORDER TOTAL AND DISCOUNT */ |
|
964 |
|
if not available t_store_ext_actual |
|
965 |
|
then do: |
|
966 |
|
create t_store_ext_actual. |
|
967 |
|
assign |
|
968 |
|
t_line = sod_line |
|
969 |
|
t_ext_actual = l_ext_actual. |
|
970 |
|
end. /* IF NOT AVAILABLE t_store_ext_actual ... */ |
|
971 |
|
|
|
972 |
|
if available t_store_ext_actual |
|
973 |
|
then do: |
|
974 |
|
if soddet.sod_tax_in and soddet.sod_taxable |
|
975 |
|
then do: |
|
976 |
|
run getExtendedAmount |
|
977 |
|
(input rndmthd, |
|
978 |
|
input soddet.sod_line, |
|
979 |
|
input somstr.so_nbr, |
|
980 |
|
input somstr.so_inv_nbr, |
|
981 |
|
input tax_tr_type, |
|
982 |
|
input-output l_ext_actual). |
|
983 |
|
p_line_total = p_line_total + l_ext_actual. |
|
984 |
|
end. /* IF soddet.sod_tax_in */ |
|
985 |
|
else |
|
986 |
|
p_line_total = p_line_total + p_ext_actual. |
|
987 |
|
end. /* IF AVAILABLE t_store_ext_actual ... */ |
|
988 |
|
|
|
989 |
|
/* FOR CALL INVOICES, SFB_TAXABLE (IN 86E) OF SFB_DET DETERMINES */ |
|
990 |
|
/* TAXABILITY AND THERE COULD BE MULTIPLE SFB_DET FOR A SOD_DET. */ |
|
991 |
|
if soddet.sod_fsm_type = "FSM-RO" |
|
992 |
|
and soddet.sod_taxable |
|
993 |
|
and not soddet.sod_fix_pr |
|
994 |
|
then do: |
|
995 |
|
for each sfb_det |
|
996 |
|
where sfb_domain = global_domain |
|
997 |
|
and sfb_nbr = soddet.sod_nbr |
|
998 |
|
and sfb_so_line = soddet.sod_line |
|
999 |
|
no-lock: |
|
1000 |
|
if sfb_exchange then |
|
1001 |
|
p_ext_actual = 0 - (sfb_exg_price * sfb_qty_ret). |
|
1002 |
|
else |
|
1003 |
|
p_ext_actual = sfb_price * sfb_qty_req. |
|
1004 |
|
|
|
1005 |
|
/* ROUND PER DOCUMENT CURRENCY ROUND METHOD */ |
|
1006 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1007 |
|
"(input-output p_ext_actual, |
|
1008 |
|
input rndmthd, |
|
1009 |
|
output mc-error-number)"} |
|
1010 |
|
|
|
1011 |
|
if mc-error-number <> 0 then do: |
|
1012 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
1013 |
|
end. |
|
1014 |
|
|
|
1015 |
|
if sfb_exchange then |
|
1016 |
|
l_ext_actual = p_ext_actual * (1 - somstr.so_disc_pct / 100). |
|
1017 |
|
else |
|
1018 |
|
assign |
|
1019 |
|
p_ext_actual = p_ext_actual - sfb_covered_amt |
|
1020 |
|
l_ext_actual = p_ext_actual * (1 - somstr.so_disc_pct / 100). |
|
1021 |
|
|
|
1022 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1023 |
|
"(input-output l_ext_actual, |
|
1024 |
|
input rndmthd, |
|
1025 |
|
output mc-error-number)"} |
|
1026 |
|
|
|
1027 |
|
if mc-error-number <> 0 then do: |
|
1028 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
1029 |
|
end. |
|
1030 |
|
|
|
1031 |
|
if sfb_taxable then |
|
1032 |
|
if soddet.sod_tax_in |
|
1033 |
|
then |
|
1034 |
|
l_taxable_amt = l_taxable_amt + l_ext_actual. |
|
1035 |
|
else |
|
1036 |
|
p_taxable_amt = p_taxable_amt + p_ext_actual. |
|
1037 |
|
else |
|
1038 |
|
p_nontaxable_amt = p_nontaxable_amt + p_ext_actual. |
|
1039 |
|
|
|
1040 |
|
end. /* FOR EACH SFB_DET */ |
|
1041 |
|
end. /* IF SOD_FSM_TYPE = FSM-RO ... */ |
|
1042 |
|
else |
|
1043 |
|
if soddet.sod_taxable then |
|
1044 |
|
if soddet.sod_tax_in |
|
1045 |
|
then |
|
1046 |
|
l_taxable_amt = l_taxable_amt + l_ext_actual. |
|
1047 |
|
else |
|
1048 |
|
p_taxable_amt = p_taxable_amt + p_ext_actual. |
|
1049 |
|
else |
|
1050 |
|
p_nontaxable_amt = p_nontaxable_amt + p_ext_actual. |
|
1051 |
|
|
|
1052 |
|
if using_line_charges then do: |
|
1053 |
|
|
|
1054 |
|
if can-find(first absl_det |
|
1055 |
|
where absl_domain = global_domain |
|
1056 |
|
and absl_order = sod_nbr |
|
1057 |
|
and absl_ord_line = sod_line) |
|
1058 |
|
and sod_qty_inv <> 0 |
|
1059 |
|
then do: |
|
1060 |
|
for each absl_det |
|
1061 |
|
where absl_domain = global_domain |
|
1062 |
|
and absl_order = sod_nbr |
|
1063 |
|
and absl_ord_line = sod_line |
|
1064 |
|
and (absl_inv_nbr = "" or absl_inv_nbr = ref) |
|
1065 |
|
and absl_confirm = yes |
|
1066 |
|
and absl_inv_post = no |
|
1067 |
|
no-lock: |
|
1068 |
|
for first trl_mstr |
|
1069 |
|
where trl_domain = global_domain |
|
1070 |
|
and trl_code = absl_trl_code |
|
1071 |
|
no-lock: |
|
1072 |
|
if trl_taxable then |
|
1073 |
|
p_taxable_amt = p_taxable_amt + absl_ext_price. |
|
1074 |
|
else |
|
1075 |
|
p_nontaxable_amt = p_nontaxable_amt + absl_ext_price. |
|
1076 |
|
end. /* FOR FIRST trl_mstr */ |
|
1077 |
|
end. /* FOR EACH absl_det */ |
|
1078 |
|
end. /* IF AVAILABLE absl_det */ |
|
1079 |
|
|
|
1080 |
|
if not can-find(first absl_det |
|
1081 |
|
where absl_domain = global_domain |
|
1082 |
|
and absl_order = sod_nbr |
|
1083 |
|
and absl_ord_line = sod_line) |
|
1084 |
|
and sod_qty_inv <> 0 |
|
1085 |
|
then do: |
|
1086 |
|
|
|
1087 |
|
for each sodlc_det |
|
1088 |
|
where sodlc_domain = global_domain |
|
1089 |
|
and sodlc_order = sod_nbr |
|
1090 |
|
and sodlc_ord_line = sod_line |
|
1091 |
|
no-lock: |
|
1092 |
|
if sodlc_one_time |
|
1093 |
|
and sodlc_times_charged > 0 |
|
1094 |
|
then |
|
1095 |
|
next. |
|
1096 |
|
|
|
1097 |
|
for first trl_mstr |
|
1098 |
|
where trl_domain = global_domain |
|
1099 |
|
and trl_code = sodlc_trl_code |
|
1100 |
|
no-lock: |
|
1101 |
|
if trl_taxable then |
|
1102 |
|
p_taxable_amt = p_taxable_amt + sodlc_lc_amt. |
|
1103 |
|
else |
|
1104 |
|
p_nontaxable_amt = p_nontaxable_amt + sodlc_lc_amt. |
|
1105 |
|
end. /* FOR FIRST trl_mstr */ |
|
1106 |
|
|
|
1107 |
|
end. /* FOR EACH sodlc_det*/ |
|
1108 |
|
|
|
1109 |
|
end. /* IF not available absl_det */ |
|
1110 |
|
|
|
1111 |
|
end. /* IF using_line_charges */ |
|
1112 |
|
|
|
1113 |
|
if using_container_charges |
|
1114 |
|
then do: |
|
1115 |
|
|
|
1116 |
|
for each abscc_det |
|
1117 |
|
where abscc_domain = global_domain |
|
1118 |
|
and abscc_order = sod_nbr |
|
1119 |
|
and abscc_ord_line = sod_line |
|
1120 |
|
and (abscc_inv_nbr = "" or abscc_inv_nbr = ref) |
|
1121 |
|
and abscc_confirm = yes |
|
1122 |
|
and abscc_inv_post = no |
|
1123 |
|
no-lock: |
|
1124 |
|
|
|
1125 |
|
if abscc_taxable = yes |
|
1126 |
|
then |
|
1127 |
|
p_taxable_amt = p_taxable_amt |
|
1128 |
|
+ (abscc_cont_price * abscc_qty). |
|
1129 |
|
else |
|
1130 |
|
p_nontaxable_amt = p_nontaxable_amt |
|
1131 |
|
+ (abscc_cont_price * abscc_qty). |
|
1132 |
|
end. /* FOR EACH abscc_det */ |
|
1133 |
|
end. /* IF using_container_charges */ |
|
1134 |
|
|
|
1135 |
|
END PROCEDURE. /* ip_calc_amt */ |
|
1136 |
|
|
|
1137 |
|
/* ========================================================================== */ |
|
1138 |
|
PROCEDURE switchDomain: |
|
1139 |
|
/* -------------------------------------------------------------------------- */ |
|
1140 |
|
define input parameter ip_domain as character no-undo. |
|
1141 |
|
define output parameter op_undo as logical no-undo. |
|
1142 |
|
|
|
1143 |
|
define variable err-flag as integer no-undo. |
|
1144 |
|
|
|
1145 |
|
/* SWITCH TO INVOICE DOMAIN */ |
|
1146 |
|
{us/bbi/gprun.i ""gpmdas.p"" |
|
1147 |
|
"(input ip_domain, |
|
1148 |
|
output err-flag)"} |
|
1149 |
|
|
|
1150 |
|
if err-flag <> 0 then do: |
|
1151 |
|
/* DOMAIN # IS NOT AVAILABLE */ |
|
1152 |
|
{us/bbi/pxmsg.i &MSGNUM=6137 &ERRORLEVEL=4 &MSGARG1=ip_domain} |
|
1153 |
|
assign |
|
1154 |
|
global_domain = ip_domain |
|
1155 |
|
op_undo = yes. |
|
1156 |
|
end. |
|
1157 |
|
|
|
1158 |
|
END PROCEDURE. /* switchDomain */ |
|
1159 |
|
|
|
1160 |
|
PROCEDURE p_calc : |
|
1161 |
|
define buffer b_si_mstr for si_mstr. |
|
1162 |
|
define variable l_taxtot_tax_in_yes as decimal no-undo. |
|
1163 |
|
define variable l_taxtot_tax_in_no as decimal no-undo. |
|
1164 |
|
|
|
1165 |
|
l_tmp_line_total = 0 . |
|
1166 |
|
|
|
1167 |
|
if available so_mstr |
|
1168 |
|
then . |
|
1169 |
|
|
|
1170 |
|
if available soc_ctrl |
|
1171 |
|
then . |
|
1172 |
|
|
|
1173 |
|
empty temp-table t_store_ext_actual no-error. |
|
1174 |
|
|
|
1175 |
|
/* WHERE THE INVOICES HAVE NOT BEEN CONSOLIDATED */ |
|
1176 |
|
if not maint |
|
1177 |
|
and not consolidate |
|
1178 |
|
then do: |
|
1179 |
|
|
|
1180 |
|
undo_txdetrp = true. |
|
1181 |
|
|
|
1182 |
|
{us/bbi/gprun.i ""txdetrp.p"" |
|
1183 |
|
"(input tax_tr_type, |
|
1184 |
|
input ref, |
|
1185 |
|
input nbr, |
|
1186 |
|
input col-80, |
|
1187 |
|
input page_break, |
|
1188 |
|
input '', |
|
1189 |
|
input yes)"} |
|
1190 |
|
|
|
1191 |
|
if undo_txdetrp = true then |
|
1192 |
|
return . |
|
1193 |
|
|
|
1194 |
|
end. /* if not maint */ |
|
1195 |
|
/*** GET TOTALS FOR LINES ***/ |
|
1196 |
|
assign |
|
1197 |
|
ext_actual = 0 |
|
1198 |
|
tax_amt = 0 |
|
1199 |
|
l_tax_in = 0 |
|
1200 |
|
disc_amt = 0 |
|
1201 |
|
line_total = 0 |
|
1202 |
|
tot_line_comm[1] = 0 |
|
1203 |
|
tot_line_comm[2] = 0 |
|
1204 |
|
tot_line_comm[3] = 0 |
|
1205 |
|
tot_line_comm[4] = 0 |
|
1206 |
|
tax_date = so_due_date |
|
1207 |
|
taxable_amt = 0 |
|
1208 |
|
l_taxtot_tax_in_no = 0 |
|
1209 |
|
l_taxtot_tax_in_yes = 0 |
|
1210 |
|
nontaxable_amt = 0 /* when not p_consolidate */ |
|
1211 |
|
container_charge_total = tot_cont_charge when (using_container_charges or |
|
1212 |
|
using_line_charges ) |
|
1213 |
|
line_charge_total = tot_line_charge when (using_container_charges or |
|
1214 |
|
using_line_charges ) |
|
1215 |
|
ord_amt = 0 when (using_container_charges or |
|
1216 |
|
using_line_charges ) |
|
1217 |
|
l_ord_contains_tax_in_lines = can-find (first sod_det |
|
1218 |
|
where sod_domain = global_domain |
|
1219 |
|
and sod_nbr = so_nbr |
|
1220 |
|
and sod_taxable |
|
1221 |
|
and sod_tax_in |
|
1222 |
|
and sod_compl_stat = "") . |
|
1223 |
|
|
|
1224 |
|
if so_tax_date <> ? then |
|
1225 |
|
tax_date = so_tax_date. |
|
1226 |
|
else |
|
1227 |
|
if so_ship_date <> ? then |
|
1228 |
|
tax_date = so_ship_date. |
|
1229 |
|
|
|
1230 |
|
if using_container_charges then |
|
1231 |
|
line_total = line_total + tot_cont_charge. |
|
1232 |
|
if using_line_charges then |
|
1233 |
|
line_total = line_total + tot_line_charge. |
|
1234 |
|
sod_detloop: |
|
1235 |
|
for each sod_det where sod_domain = global_domain |
|
1236 |
|
and sod_nbr = so_nbr |
|
1237 |
|
and sod_compl_stat = "" |
|
1238 |
|
no-lock: |
|
1239 |
|
|
|
1240 |
|
/* IF THE ORDER LINE IS A CONSIGNMENT ORDER LINE */ |
|
1241 |
|
/* THEN WE DON'T WANT THE DOLLAR AMOUNT INCLUDED */ |
|
1242 |
|
/* ON THE INVOICE WHEN THE LINE HAS BEEN SHIPPED, */ |
|
1243 |
|
/* BUT WHEN THE SHIPMENT HAS BEEN USED. */ |
|
1244 |
|
if using_cust_consignment |
|
1245 |
|
and sod_consignment |
|
1246 |
|
then do: |
|
1247 |
|
|
|
1248 |
|
for first b_si_mstr |
|
1249 |
|
where b_si_mstr.si_domain = global_domain |
|
1250 |
|
and b_si_mstr.si_site = sod_site |
|
1251 |
|
no-lock: |
|
1252 |
|
if b_si_mstr.si_db <> global_domain then do: |
|
1253 |
|
/* SWITCH TO INVENTORY DOMAIN */ |
|
1254 |
|
run switchDomain |
|
1255 |
|
(input b_si_mstr.si_db, |
|
1256 |
|
output undo_flag). |
|
1257 |
|
if undo_flag then |
|
1258 |
|
undo. |
|
1259 |
|
end. |
|
1260 |
|
end. /* FOR FIRST b_si_mstr */ |
|
1261 |
|
|
|
1262 |
|
/* IF NON-INVOICED CONSIGNMENT USAGE RECORDS EXIST, INVOICE THEM */ |
|
1263 |
|
{us/bbi/gprun.i ""soivtr2a.p"" |
|
1264 |
|
"(input so_tax_date, |
|
1265 |
|
input so_nbr, |
|
1266 |
|
input sod_line, |
|
1267 |
|
output consign_flag, |
|
1268 |
|
output consign_loc, |
|
1269 |
|
output intrans_loc, |
|
1270 |
|
output max_aging_days, |
|
1271 |
|
output auto_replenish, |
|
1272 |
|
output return_status, |
|
1273 |
|
input-output tax_date)"} |
|
1274 |
|
|
|
1275 |
|
if invoice_domain <> global_domain then do: |
|
1276 |
|
/* SWITCH TO INVOICE DOMAIN */ |
|
1277 |
|
run switchDomain |
|
1278 |
|
(input invoice_domain, |
|
1279 |
|
output undo_flag). |
|
1280 |
|
if undo_flag then |
|
1281 |
|
undo. |
|
1282 |
|
end. |
|
1283 |
|
|
|
1284 |
|
end. /* IF using_cust_consignment */ |
|
1285 |
|
|
|
1286 |
|
run ip_calc_amt |
|
1287 |
|
(input-output ext_actual, |
|
1288 |
|
input-output line_total, |
|
1289 |
|
input-output l_taxtot_tax_in_no, |
|
1290 |
|
input-output nontaxable_amt, |
|
1291 |
|
input-output l_taxtot_tax_in_yes, |
|
1292 |
|
buffer so_mstr, |
|
1293 |
|
buffer sod_det). |
|
1294 |
|
|
|
1295 |
|
ext_margin = ext_actual - round(sod_std_cost * (sod_qty_inv),2). |
|
1296 |
|
|
|
1297 |
|
/* COMMISSIONS BASED ON MARGIN */ |
|
1298 |
|
if soc_margin = yes |
|
1299 |
|
then |
|
1300 |
|
assign |
|
1301 |
|
tot_line_comm[1] = tot_line_comm[1] |
|
1302 |
|
+ ext_margin * sod_comm_pct[1] / 100 |
|
1303 |
|
tot_line_comm[2] = tot_line_comm[2] |
|
1304 |
|
+ ext_margin * sod_comm_pct[2] / 100 |
|
1305 |
|
tot_line_comm[3] = tot_line_comm[3] |
|
1306 |
|
+ ext_margin * sod_comm_pct[3] / 100 |
|
1307 |
|
tot_line_comm[4] = tot_line_comm[4] |
|
1308 |
|
+ ext_margin * sod_comm_pct[4] / 100. |
|
1309 |
|
else /* Commissions based on sales */ |
|
1310 |
|
assign |
|
1311 |
|
tot_line_comm[1] = tot_line_comm[1] |
|
1312 |
|
+ ext_actual * sod_comm_pct[1] / 100 |
|
1313 |
|
tot_line_comm[2] = tot_line_comm[2] |
|
1314 |
|
+ ext_actual * sod_comm_pct[2] / 100 |
|
1315 |
|
tot_line_comm[3] = tot_line_comm[3] |
|
1316 |
|
+ ext_actual * sod_comm_pct[3] / 100 |
|
1317 |
|
tot_line_comm[4] = tot_line_comm[4] |
|
1318 |
|
+ ext_actual * sod_comm_pct[4] / 100. |
|
1319 |
|
|
|
1320 |
|
end. /* FOR EACH SOD_DET */ |
|
1321 |
|
|
|
1322 |
|
/* SKIPPING SALES VOLUME DISCOUNT CALCULATION */ |
|
1323 |
|
/* FOR RETROBILLED ITEMS */ |
|
1324 |
|
if maint |
|
1325 |
|
and not so__qadl01 |
|
1326 |
|
and not l_retrobill |
|
1327 |
|
then do: |
|
1328 |
|
|
|
1329 |
|
for first cm_mstr |
|
1330 |
|
where cm_domain = global_domain |
|
1331 |
|
and cm_addr = so_cust |
|
1332 |
|
no-lock: |
|
1333 |
|
end. |
|
1334 |
|
|
|
1335 |
|
if so_cust <> so_ship |
|
1336 |
|
and can-find (cm_mstr where cm_mstr.cm_domain = global_domain |
|
1337 |
|
and cm_mstr.cm_addr = so_ship) |
|
1338 |
|
then |
|
1339 |
|
for first cm_mstr |
|
1340 |
|
where cm_mstr.cm_domain = global_domain |
|
1341 |
|
and cm_mstr.cm_addr = so_ship |
|
1342 |
|
no-lock: |
|
1343 |
|
end. |
|
1344 |
|
|
|
1345 |
|
{us/bbi/gprun.i ""sosd.p"" |
|
1346 |
|
"(input so_ord_date, |
|
1347 |
|
input so_ex_rate, |
|
1348 |
|
input so_ex_rate2, |
|
1349 |
|
input so_cust, |
|
1350 |
|
input so_curr, |
|
1351 |
|
input line_total, |
|
1352 |
|
output disc_pct)"} |
|
1353 |
|
if disc_pct > cm_disc_pct |
|
1354 |
|
and disc_pct <> 0 |
|
1355 |
|
then |
|
1356 |
|
so_disc_pct = disc_pct. |
|
1357 |
|
else |
|
1358 |
|
so_disc_pct = cm_disc_pct. |
|
1359 |
|
|
|
1360 |
|
end. /* IF maint */ |
|
1361 |
|
|
|
1362 |
|
l_tmp_amt = l_taxtot_tax_in_no * so_disc_pct / 100. |
|
1363 |
|
|
|
1364 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1365 |
|
"(input-output l_tmp_amt, |
|
1366 |
|
input rndmthd, |
|
1367 |
|
output mc-error-number)"} |
|
1368 |
|
if mc-error-number <> 0 then do: |
|
1369 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
1370 |
|
end. |
|
1371 |
|
|
|
1372 |
|
assign |
|
1373 |
|
l_taxtot_tax_in_no = l_taxtot_tax_in_no - l_tmp_amt |
|
1374 |
|
l_tmp_amt = nontaxable_amt * so_disc_pct / 100. |
|
1375 |
|
|
|
1376 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1377 |
|
"(input-output l_tmp_amt, |
|
1378 |
|
input rndmthd, |
|
1379 |
|
output mc-error-number)"} |
|
1380 |
|
if mc-error-number <> 0 then do: |
|
1381 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
1382 |
|
end. |
|
1383 |
|
|
|
1384 |
|
nontaxable_amt = nontaxable_amt - l_tmp_amt. |
|
1385 |
|
|
|
1386 |
|
taxable_amt = l_taxtot_tax_in_no + l_taxtot_tax_in_yes. |
|
1387 |
|
|
|
1388 |
|
if can-find(first sod_det where sod_domain = global_domain |
|
1389 |
|
and sod_nbr = so_nbr |
|
1390 |
|
and sod_fsm_type = "FSM-RO" |
|
1391 |
|
and sod_taxable |
|
1392 |
|
and not sod_fix_pr |
|
1393 |
|
and sod_compl_stat = "") |
|
1394 |
|
then do: |
|
1395 |
|
{us/bbi/gprun.i ""txtotal1.p"" |
|
1396 |
|
"(input tax_tr_type, |
|
1397 |
|
input ref, |
|
1398 |
|
input nbr, |
|
1399 |
|
input tax_lines, /* ALL LINES */ |
|
1400 |
|
output l_tax_in)"} |
|
1401 |
|
|
|
1402 |
|
taxable_amt = taxable_amt - l_tax_in . |
|
1403 |
|
end. /* IF CAN-FIND (FIRST sod_det .. */ |
|
1404 |
|
|
|
1405 |
|
/* USE THE EXISTING LOGIC TO CALCULATE DISCOUNT ONLY WHEN */ |
|
1406 |
|
/* SALES ORDER DOES NOT HAVE TAX INCLUDED LINES */ |
|
1407 |
|
if l_ord_contains_tax_in_lines = no |
|
1408 |
|
then |
|
1409 |
|
assign |
|
1410 |
|
disc_amt = (- line_total * (so_disc_pct / 100)) |
|
1411 |
|
l_roundedDiscAmt = disc_amt. |
|
1412 |
|
|
|
1413 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1414 |
|
"(input-output l_roundedDiscAmt, |
|
1415 |
|
input rndmthd, |
|
1416 |
|
output mc-error-number)"} |
|
1417 |
|
|
|
1418 |
|
if mc-error-number <> 0 |
|
1419 |
|
then do: |
|
1420 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
1421 |
|
end. /* IF mc-error-number <> 0 */ |
|
1422 |
|
|
|
1423 |
|
if addtax |
|
1424 |
|
then do: |
|
1425 |
|
{us/bbi/gprun.i ""txtotal.p"" |
|
1426 |
|
"(input tax_tr_type, |
|
1427 |
|
input ref, |
|
1428 |
|
input nbr, |
|
1429 |
|
input tax_lines, /* ALL LINES */ |
|
1430 |
|
output tax_amt)"} |
|
1431 |
|
|
|
1432 |
|
/* OBTAINING TOTAL INCLUDED TAX FOR THE TRANSACTION */ |
|
1433 |
|
{us/bbi/gprun.i ""txtotal1.p"" |
|
1434 |
|
"(input tax_tr_type, |
|
1435 |
|
input ref, |
|
1436 |
|
input nbr, |
|
1437 |
|
input tax_lines, /* ALL LINES */ |
|
1438 |
|
output l_tax_in)"} |
|
1439 |
|
end. /* IF addtax */ |
|
1440 |
|
else |
|
1441 |
|
assign |
|
1442 |
|
tax_amt = 0 |
|
1443 |
|
l_tax_in = 0. |
|
1444 |
|
|
|
1445 |
|
/* WHEN TAX DETAIL RECORDS ARE NOT AVAILABLE AND SO IS */ |
|
1446 |
|
/* TAXABLE THEN USE THE PROCEDURE TO CALCULATE ORDER */ |
|
1447 |
|
/* TOTAL AND DISCOUNT */ |
|
1448 |
|
/* */ |
|
1449 |
|
/* WHEN TAX INCLUDED IS YES, ORDER DISCOUNT SHOULD BE */ |
|
1450 |
|
/* CALCULATED ON THE ORDER TOTAL AFTER REDUCING THE */ |
|
1451 |
|
/* ORDER TOTAL BY THE INCLUDED TAX */ |
|
1452 |
|
|
|
1453 |
|
if (l_tax_in <> 0 |
|
1454 |
|
or (l_ord_contains_tax_in_lines |
|
1455 |
|
and (not can-find (tx2d_det |
|
1456 |
|
where tx2d_domain = global_domain |
|
1457 |
|
and tx2d_ref = so_nbr |
|
1458 |
|
and tx2d_nbr = so_inv_nbr)))) |
|
1459 |
|
then do: |
|
1460 |
|
|
|
1461 |
|
{us/bbi/gprun.i ""txabsrb.p"" |
|
1462 |
|
"(input so_nbr, |
|
1463 |
|
input ' ', |
|
1464 |
|
input '13', |
|
1465 |
|
input-output line_total, |
|
1466 |
|
input-output taxable_amt)"} |
|
1467 |
|
l_tmp_line_total = taxable_amt + nontaxable_amt . |
|
1468 |
|
|
|
1469 |
|
line_total = l_tmp_line_total * (100 / (100 - so_disc_pct)) . |
|
1470 |
|
|
|
1471 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1472 |
|
"(input-output line_total, |
|
1473 |
|
input rndmthd, |
|
1474 |
|
output mc-error-number)"} |
|
1475 |
|
|
|
1476 |
|
assign |
|
1477 |
|
disc_amt = ( - line_total * (so_disc_pct / 100)) |
|
1478 |
|
l_roundedDiscAmt = disc_amt. |
|
1479 |
|
|
|
1480 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1481 |
|
"(input-output l_roundedDiscAmt, |
|
1482 |
|
input rndmthd, |
|
1483 |
|
output mc-error-number)"} |
|
1484 |
|
|
|
1485 |
|
if mc-error-number <> 0 |
|
1486 |
|
then do: |
|
1487 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
1488 |
|
end. /* IF mc-error-number <> 0 */ |
|
1489 |
|
end. /* IF l_tax_in <> 0 ... */ |
|
1490 |
|
|
|
1491 |
|
/* ADD TRAILER AMOUNTS */ |
|
1492 |
|
{us/tx/txtrltrl.i so_trl1_cd so_trl1_amt user_desc[1]} |
|
1493 |
|
{us/tx/txtrltrl.i so_trl2_cd so_trl2_amt user_desc[2]} |
|
1494 |
|
{us/tx/txtrltrl.i so_trl3_cd so_trl3_amt user_desc[3]} |
|
1495 |
|
|
|
1496 |
|
assign |
|
1497 |
|
tax_amt = tax_amt + l_tax_in |
|
1498 |
|
ord_amt = line_total + l_roundedDiscAmt + so_trl1_amt |
|
1499 |
|
+ so_trl2_amt + so_trl3_amt + tax_amt. |
|
1500 |
|
|
|
1501 |
|
if ord_amt < 0 |
|
1502 |
|
then |
|
1503 |
|
invcrdt = "**" + getTermLabel("C_R_E_D_I_T",11) + "**". |
|
1504 |
|
else |
|
1505 |
|
invcrdt = "". |
|
1506 |
|
|
|
1507 |
|
END PROCEDURE. /* p_calc */ |
|
1508 |
|
|
|
1509 |
|
PROCEDURE getExtendedAmount: |
|
1510 |
|
/* THIS PROCEDURE RETURNS LINE TOTAL, LINE TOTAL IS RE-CALCULATED */ |
|
1511 |
|
/* AFTER SUBTRACTING INCLUDED TAX */ |
|
1512 |
|
|
|
1513 |
|
/* INPUT PARAMETERS */ |
|
1514 |
|
/* p_rndmthd - CURRENCY ROUNDING METHOD */ |
|
1515 |
|
/* p_line - ORDER LINE FOR SALES ORDER, SALES QUOTE ETC. */ |
|
1516 |
|
/* p_tx2d_ref - SALES ORDER NUMBER IF IT IS CALLED BY SALES */ |
|
1517 |
|
/* ORDER FUNCTIONS */ |
|
1518 |
|
/* SALES QUOTE NUMBER IF IT IS CALLED BY SALES */ |
|
1519 |
|
/* QUOTE FUNCTIONS */ |
|
1520 |
|
/* INVOICE NUMBER IF IT IS CALLED BY INVOICE */ |
|
1521 |
|
/* FUNCTIONS */ |
|
1522 |
|
/* p_tx2d_nbr - SALES QUOTE NUMBER OR INVOICE NUMBER IF */ |
|
1523 |
|
/* IT IS CALLED BY SALES ORDER FUNCTIONS */ |
|
1524 |
|
/* BLANK IF IT IS CALLED BY SALES QUOTE FUNCTIONS */ |
|
1525 |
|
/* SALES ORDER NUMBER IF IT IS CALLED BY INVOICE */ |
|
1526 |
|
/* FUNCTIONS */ |
|
1527 |
|
/* p_tax_tr_type - TAX TRANSACTION TYPE */ |
|
1528 |
|
/* */ |
|
1529 |
|
/* INPUT-OUTPUT PARAMETER */ |
|
1530 |
|
/* p_ext_actual - LINE TOTAL */ |
|
1531 |
|
|
|
1532 |
|
define input parameter p_rndmthd like rnd_rnd_mthd no-undo. |
|
1533 |
|
define input parameter p_line like sod_line no-undo. |
|
1534 |
|
define input parameter p_tx2d_ref like so_nbr no-undo. |
|
1535 |
|
define input parameter p_tx2d_nbr like so_inv_nbr no-undo. |
|
1536 |
|
define input parameter p_tax_tr_type like tx2d_tr_type no-undo. |
|
1537 |
|
define input-output parameter p_ext_actual like sod_price no-undo. |
|
1538 |
|
|
|
1539 |
|
define variable mc-error-number like msg_nbr no-undo. |
|
1540 |
|
|
|
1541 |
|
define variable l_ext_actual like sod_price initial 0 no-undo. |
|
1542 |
|
define variable l_ext_actual1 like sod_price initial 0 no-undo. |
|
1543 |
|
|
|
1544 |
|
l_ext_actual = p_ext_actual. |
|
1545 |
|
|
|
1546 |
|
for each tx2d_det |
|
1547 |
|
where tx2d_domain = global_domain |
|
1548 |
|
and tx2d_ref = p_tx2d_ref |
|
1549 |
|
and (tx2d_nbr = "" |
|
1550 |
|
or tx2d_nbr = p_tx2d_ref |
|
1551 |
|
or tx2d_nbr = p_tx2d_nbr) |
|
1552 |
|
and tx2d_line = p_line |
|
1553 |
|
and tx2d_tr_type = p_tax_tr_type |
|
1554 |
|
and tx2d_tax_in = yes |
|
1555 |
|
no-lock : |
|
1556 |
|
|
|
1557 |
|
l_ext_actual1 = l_ext_actual1 + |
|
1558 |
|
(tx2d_cur_tax_amt + tx2d_cur_abs_ret_amt) . |
|
1559 |
|
|
|
1560 |
|
end. /* FOR EACH tx2d_det ... */ |
|
1561 |
|
|
|
1562 |
|
for each tx2d_det |
|
1563 |
|
where tx2d_domain = global_domain |
|
1564 |
|
and tx2d_ref = p_tx2d_nbr |
|
1565 |
|
and (tx2d_nbr = "" |
|
1566 |
|
or tx2d_nbr = p_tx2d_ref |
|
1567 |
|
or tx2d_nbr = p_tx2d_nbr) |
|
1568 |
|
and tx2d_line = p_line |
|
1569 |
|
and tx2d_tr_type = p_tax_tr_type |
|
1570 |
|
and tx2d_tax_in = yes |
|
1571 |
|
no-lock : |
|
1572 |
|
l_ext_actual1 = l_ext_actual1 + |
|
1573 |
|
(tx2d_cur_tax_amt + tx2d_cur_abs_ret_amt) . |
|
1574 |
|
end. /* FOR EACH tx2d_det ... */ |
|
1575 |
|
|
|
1576 |
|
|
|
1577 |
|
|
|
1578 |
|
p_ext_actual = l_ext_actual - l_ext_actual1. |
|
1579 |
|
|
|
1580 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1581 |
|
"(input-output p_ext_actual, |
|
1582 |
|
input p_rndmthd, |
|
1583 |
|
output mc-error-number)"} |
|
1584 |
|
|
|
1585 |
|
if mc-error-number <> 0 |
|
1586 |
|
then do: |
|
1587 |
|
{us/bbi/pxmsg.i &MSGNUM=mc-error-number &ERRORLEVEL=2} |
|
1588 |
|
end. /* IF mc-error-number <> 0 */ |
|
1589 |
|
|
|
1590 |
|
END PROCEDURE. /* getExtendedAmount */ |
File mfg/2013/base/src/xxrp1a01.p added (mode: 100644) (index 0000000..10b176c) |
|
1 |
|
/* xxrp1a01.p - SALES ORDER INVOICE PRINT - LINE DISPLAY AND SUBTOTAL */ |
|
2 |
|
/* sorp1a01.p - SALES ORDER INVOICE PRINT - LINE DISPLAY AND SUBTOTAL */ |
|
3 |
|
/* Copyright 1986 QAD Inc. All rights reserved. */ |
|
4 |
|
/* $Id$: */ |
|
5 |
|
/* REVISION: 7.3 LAST MODIFIED: 08/31/92 BY: afs *G047* */ |
|
6 |
|
/* REVISION: 7.3 LAST MODIFIED: 11/12/92 BY: tjs *G191* */ |
|
7 |
|
/* REVISION: 7.4 LAST MODIFIED: 07/30/93 BY: jjs *H050* */ |
|
8 |
|
/* REVISION: 7.4 LAST MODIFIED: 08/19/93 BY: pcd *H009* */ |
|
9 |
|
/* REVISION: 7.4 LAST MODIFIED: 09/30/93 BY: WUG *H145* */ |
|
10 |
|
/* REVISION: 7.4 LAST MODIFIED: 05/03/94 BY: cdt *FN91* */ |
|
11 |
|
/* REVISION: 7.3 LAST MODIFIED: 06/22/94 BY: WUG *GK60* */ |
|
12 |
|
/* REVISION: 7.4 LAST MODIFIED: 11/17/94 BY: rxm *FT54* */ |
|
13 |
|
/* REVISION: 7.4 LAST MODIFIED: 11/18/94 BY: smp *FT80* */ |
|
14 |
|
/* REVISION: 7.4 LAST MODIFIED: 01/14/94 BY: bcm *G0C4* */ |
|
15 |
|
/* REVISION: 7.4 LAST MODIFIED: 04/27/95 BY: rxm *F0PD* */ |
|
16 |
|
/* REVISION: 8.5 LAST MODIFIED: 03/20/95 BY: nte *J042* */ |
|
17 |
|
/* REVISION: 8.5 LAST MODIFIED: 10/05/95 BY: srk *J08B* */ |
|
18 |
|
/* REVISION: 8.5 LAST MODIFIED: 07/25/95 BY: taf *J053* */ |
|
19 |
|
/* REVISION: 8.5 LAST MODIFIED: 04/10/96 BY: *J04C* Sue Poland */ |
|
20 |
|
/* REVISION: 8.5 LAST MODIFIED: 06/13/96 BY: *J0T0* Dennis Hensen */ |
|
21 |
|
/* REVISION: 8.5 LAST MODIFIED: 06/26/96 BY: *J0WF* Sue Poland */ |
|
22 |
|
/* REVISION: 8.5 LAST MODIFIED: 08/13/96 BY: *G29K* Markus Barone */ |
|
23 |
|
/* REVISION: 8.5 LAST MODIFIED: 10/03/96 BY: *J15C* Markus Barone */ |
|
24 |
|
/* REVISION: 8.5 LAST MODIFIED: 01/17/97 BY: *G2H2* Vinay Nayak-Sujir */ |
|
25 |
|
/* REVISION: 8.5 LAST MODIFIED: 04/14/97 BY: *J1N0* Ajit Deodhar */ |
|
26 |
|
/* REVISION: 8.6 LAST MODIFIED: 12/09/97 BY: *K1DL* Suresh Nayak */ |
|
27 |
|
/* REVISION: 8.6E LAST MODIFIED: 02/23/98 BY: *L007* A. Rahane */ |
|
28 |
|
/* REVISION: 8.6E LAST MODIFIED: 04/23/98 BY: *L00L* Adam Harris */ |
|
29 |
|
/* REVISION: 8.6E LAST MODIFIED: 05/20/98 BY: *K1Q4* Alfred Tan */ |
|
30 |
|
/* Old ECO marker removed, but no ECO header exists *F191* */ |
|
31 |
|
/* Old ECO marker removed, but no ECO header exists *F277* */ |
|
32 |
|
/* Old ECO marker removed, but no ECO header exists *F369* */ |
|
33 |
|
/* Old ECO marker removed, but no ECO header exists *F378* */ |
|
34 |
|
/* REVISION: 8.6E LAST MODIFIED: 06/29/98 BY: *L024* Sami Kureishy */ |
|
35 |
|
/* REVISION: 8.6E LAST MODIFIED: 08/13/98 BY: *J2S3* Dana Tunstall */ |
|
36 |
|
/* REVISION: 8.6E LAST MODIFIED: 02/01/99 BY: *L0D5* Robin McCarthy */ |
|
37 |
|
/* REVISION: 8.6E LAST MODIFIED: 02/17/99 BY: *K1ZK* Reetu Kapoor */ |
|
38 |
|
/* REVISION: 9.1 LAST MODIFIED: 06/01/99 BY: *J3F3* Satish Chavan */ |
|
39 |
|
/* REVISION: 9.1 LAST MODIFIED: 09/01/99 BY: *N004* Steve Nugent */ |
|
40 |
|
/* REVISION: 9.1 LAST MODIFIED: 03/06/00 BY: *N05Q* Luke Pokic */ |
|
41 |
|
/* REVISION: 9.1 LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */ |
|
42 |
|
/* REVISION: 9.1 LAST MODIFIED: 05/17/00 BY: *N0BC* Arul Victoria */ |
|
43 |
|
/* REVISION: 9.1 LAST MODIFIED: 07/01/00 BY: *N0DX* BalbeerS Rajput */ |
|
44 |
|
/* REVISION: 9.1 LAST MODIFIED: 07/10/00 BY: *N0FD* Annasaheb Rahane */ |
|
45 |
|
/* REVISION: 9.1 LAST MODIFIED: 08/12/00 BY: *N0KN* myb */ |
|
46 |
|
/* Old ECO marker removed, but no ECO header exists *F0PN* */ |
|
47 |
|
/* Revision: 1.23.1.13 BY: Katie Hilbert DATE: 04/01/01 ECO: *P002* */ |
|
48 |
|
/* Revision: 1.23.1.16 BY: Steve Nugent DATE: 07/09/01 ECO: *P007* */ |
|
49 |
|
/* Revision: 1.23.1.19 BY: Jeff Wootton DATE: 03/13/02 ECO: *P020* */ |
|
50 |
|
/* Revision: 1.23.1.20 BY: Patrick Rowan DATE: 04/24/01 ECO: *P00G* */ |
|
51 |
|
/* Revision: 1.23.1.22 BY: Katie Hilbert DATE: 04/15/02 ECO: *P03J* */ |
|
52 |
|
/* Revision: 1.23.1.23 BY: Jean Miller DATE: 05/13/02 ECO: *P05M* */ |
|
53 |
|
/* Revision: 1.23.1.24 BY: Gnanasekar DATE: 11/12/02 ECO: *N1Y0* */ |
|
54 |
|
/* Revision: 1.23.1.25 BY: Karan Motwani DATE: 12/02/02 ECO: *N210* */ |
|
55 |
|
/* Revision: 1.23.1.26 BY: Amit Chaturvedi DATE: 01/20/03 ECO: *N20Y* */ |
|
56 |
|
/* Revision: 1.23.1.27 BY: Narathip W. DATE: 05/12/03 ECO: *P0RT* */ |
|
57 |
|
/* Revision: 1.23.1.29 BY: Paul Donnelly(SB) DATE: 06/28/03 ECO: *Q00L* */ |
|
58 |
|
/* Revision: 1.23.1.30 BY: Rajinder Kamra DATE: 06/23/03 ECO *Q003* */ |
|
59 |
|
/* Revision: 1.23.1.31 BY: Gnanasekar DATE: 08/04/03 ECO *P0V7* */ |
|
60 |
|
/* Revision: 1.23.1.32 BY: Ashish Maheshwari DATE: 11/15/03 ECO *P15L* */ |
|
61 |
|
/* Revision: 1.23.1.33 BY: Vinay Soman DATE: 01/20/04 ECO *N2NZ* */ |
|
62 |
|
/* Revision: 1.23.1.34 BY: Anitha Gopal DATE: 03/23/04 ECO *Q06L* */ |
|
63 |
|
/* Revision: 1.23.1.35 BY: Ajay Nair DATE: 05/24/04 ECO *P230* */ |
|
64 |
|
/* Revision: 1.23.1.36 BY: Sachin Deshmukh DATE: 09/22/04 ECO *P2LR* */ |
|
65 |
|
/* Revision: 1.23.1.37 BY: Niranjan R. DATE: 10/04/04 ECO *P2MR* */ |
|
66 |
|
/* Revision: 1.23.1.38 BY: Priyank Khandare DATE: 11/28/05 ECO: *P49L* */ |
|
67 |
|
/* Revision: 1.23.1.39 BY: Nishit V DATE: 02/06/06 ECO: *P4GY* */ |
|
68 |
|
/* Revision: 1.23.1.40 BY: Katie Hilbert DATE: 06/08/06 ECO: *Q0LK* */ |
|
69 |
|
/* Revision: 1.23.1.41 BY: Vaibhav Desai DATE: 09/19/06 ECO: *P56N* */ |
|
70 |
|
/* Revision: 1.23.1.42 BY: Jean Miller DATE: 03/08/07 ECO: *R0C5* */ |
|
71 |
|
/* Revision: 1.23.1.43 BY: Ambrose Almeida DATE: 05/21/08 ECO: *P6TK* */ |
|
72 |
|
/* Revision: 1.23.1.46 BY: Jean Miller DATE: 06/19/08 ECO: *R0VG* */ |
|
73 |
|
/* Revision: 1.23.1.47 BY: Dipanshu Talwar DATE: 06/10/09 ECO: *Q2K3* */ |
|
74 |
|
/* Revision: 1.23.1.49 BY: Xiaolei Meng DATE: 07/31/09 ECO: *R1N2* */ |
|
75 |
|
/* Revision: 1.23.1.50 BY: Dipanshu Talwar DATE: 10/01/09 ECO: *P552* */ |
|
76 |
|
/* $Revision$ BY: Jean Miller DATE: 11/23/09 ECO: *R1TW* */ |
|
77 |
|
/* BGL LAST MODIFIED: 2014-FEB-12 BY: gbg *d2561 */ |
|
78 |
|
/*-Revision end---------------------------------------------------------------*/ |
|
79 |
|
/******************************************************************************/ |
|
80 |
|
/* All patch markers and commented out code have been removed from the source */ |
|
81 |
|
/* code below. For all future modifications to this file, any code which is */ |
|
82 |
|
/* no longer required should be deleted and no in-line patch markers should */ |
|
83 |
|
/* be added. The ECO marker should only be included in the Revision History. */ |
|
84 |
|
/******************************************************************************/ |
|
85 |
|
|
|
86 |
|
{us/bbi/mfdeclre.i} |
|
87 |
|
{us/px/pxmaint.i} |
|
88 |
|
{us/px/pxphdef.i gpumxr} |
|
89 |
|
{us/bbi/gplabel.i} /* EXTERNAL LABEL INCLUDE */ |
|
90 |
|
|
|
91 |
|
{us/et/etvar.i} |
|
92 |
|
{us/et/etrpvar.i} |
|
93 |
|
{us/et/etsotrla.i} |
|
94 |
|
|
|
95 |
|
/* DEFINITION FOR TEMP TABLE t_tr_hist1 */ |
|
96 |
|
{us/so/sotrhstb.i} |
|
97 |
|
|
|
98 |
|
define output parameter tot_cont_charge as decimal no-undo. |
|
99 |
|
define output parameter tot_line_charge as decimal no-undo. |
|
100 |
|
|
|
101 |
|
define new shared variable qty_bo like sod_qty_ord |
|
102 |
|
format "->>>>>>9.9<<<<". |
|
103 |
|
define new shared variable ext_price like sod_price |
|
104 |
|
label "Ext Price" |
|
105 |
|
format "->>>>,>>>,>>9.99". |
|
106 |
|
define new shared variable so_db like dc_name. |
|
107 |
|
define new shared variable sonbr like sod_nbr. |
|
108 |
|
define new shared variable soline like sod_line. |
|
109 |
|
define new shared variable sopart like sod_part. |
|
110 |
|
define new shared variable soinv like idh_inv_nbr no-undo. |
|
111 |
|
|
|
112 |
|
define shared variable rndmthd like rnd_rnd_mthd. |
|
113 |
|
define shared variable inv_only as logical. |
|
114 |
|
define shared variable rmaso like mfc_logical. |
|
115 |
|
define shared variable sacontract like mfc_logical. |
|
116 |
|
define shared variable fsremarks as character format "x(60)". |
|
117 |
|
define shared variable print_lotserials as logical. |
|
118 |
|
define shared variable print_options as logical. |
|
119 |
|
define shared variable ext_actual like sod_price. |
|
120 |
|
define shared variable ext_margin like sod_price. |
|
121 |
|
define shared variable so_recno as recid. |
|
122 |
|
define shared variable comb_inv_nbr like so_inv_nbr. |
|
123 |
|
define shared variable disc_prnt_label as character. |
|
124 |
|
define shared variable call-detail like mfc_logical |
|
125 |
|
label "Print Call Invoice Detail". |
|
126 |
|
/* Invoice Print Settings */ |
|
127 |
|
{us/so/soprsets.i} |
|
128 |
|
|
|
129 |
|
define variable jk as integer no-undo. |
|
130 |
|
define variable desc1 like sod_desc. |
|
131 |
|
define variable desc2 like desc1. |
|
132 |
|
define variable prepaid-lbl as character format "x(12)". |
|
133 |
|
define variable po-lbl as character format "x(8)". |
|
134 |
|
define variable po-lbl2 as character format "x(16)". |
|
135 |
|
define variable lot-lbl as character format "x(43)". |
|
136 |
|
define variable cspart-lbl as character format "x(15)". |
|
137 |
|
define variable call-lbl as character format "x(16)". |
|
138 |
|
define variable lotserial_total like tr_qty_chg. |
|
139 |
|
define variable err_flag as integer. |
|
140 |
|
define variable restock_pct like sv_rstk_pct no-undo. |
|
141 |
|
define variable restock_amt like rmd_restock no-undo. |
|
142 |
|
define variable restock_prc like sod_price no-undo. |
|
143 |
|
define variable ext_price_fmt as character. |
|
144 |
|
define variable tmp_amt as decimal. |
|
145 |
|
define variable billable-amt like sod_price no-undo. |
|
146 |
|
define variable display-price like mfc_logical. |
|
147 |
|
define variable pm_code like pt_pm_code. |
|
148 |
|
define variable hdl_disc_lbl as handle. |
|
149 |
|
define variable total-billable like sfb_price no-undo. |
|
150 |
|
define variable total-covered like sfb_price no-undo. |
|
151 |
|
define variable total-price like sfb_price no-undo. |
|
152 |
|
define variable total-exchange like sfb_price no-undo. |
|
153 |
|
define variable sfb-line-count as integer no-undo. |
|
154 |
|
define variable using_seq_schedules like mfc_logical initial no no-undo. |
|
155 |
|
define variable ent_ord_bill like so_bill no-undo. |
|
156 |
|
define variable ent_ord_ship like so_ship no-undo. |
|
157 |
|
define variable ent_ord_nbr like so_nbr no-undo. |
|
158 |
|
define variable ent_ord_line like sod_line no-undo. |
|
159 |
|
define variable ent_ord_line_part like sod_part no-undo. |
|
160 |
|
define variable ent_ord_line_uom like sod_um no-undo. |
|
161 |
|
define variable conversion_factor as decimal no-undo. |
|
162 |
|
define variable auth_price like sod_price |
|
163 |
|
format "->>>>,>>>,>>9.99" no-undo. |
|
164 |
|
define variable auth_found like mfc_logical no-undo. |
|
165 |
|
define variable l_inv_nbr like so_inv_nbr no-undo. |
|
166 |
|
|
|
167 |
|
define new shared temp-table t_absr_det no-undo |
|
168 |
|
field t_absr_id like absr_id |
|
169 |
|
field t_absr_reference like absr_reference |
|
170 |
|
field t_absr_qty as decimal format "->>>>,>>>,>>9.99" |
|
171 |
|
field t_absr_ext as decimal format "->>>>,>>>,>>9.99" |
|
172 |
|
index t_absr_indx t_absr_id t_absr_reference. |
|
173 |
|
|
|
174 |
|
define temp-table t_seq_lines no-undo |
|
175 |
|
field t_seqnbr like so_nbr |
|
176 |
|
field t_seqln like sod_line. |
|
177 |
|
|
|
178 |
|
define new shared frame d. |
|
179 |
|
define new shared frame dent. |
|
180 |
|
define new shared frame deuro. |
|
181 |
|
/* DEFINE VARIABLE DEFINITIONS FOR us/bbi/gpfile.i */ |
|
182 |
|
{us/bbi/gpfilev.i} |
|
183 |
|
|
|
184 |
|
{us/so/sodiscwk.i} /* Shared workfile for summary discounts */ |
|
185 |
|
|
|
186 |
|
{us/so/so10a01.i} |
|
187 |
|
{us/so/so10e02.i} |
|
188 |
|
{us/fs/fs10b01.i} /* frame e definition for call-details */ |
|
189 |
|
|
|
190 |
|
{us/fs/fsconst.i} /* FIELD SERVICE CONSTANTS */ |
|
191 |
|
|
|
192 |
|
/* CUSTOMER SEQUENCE SCHEDULES INSTALLED? */ |
|
193 |
|
{us/bbi/gpfile.i &file_name = """"rcf_ctrl""""} |
|
194 |
|
if can-find (mfc_ctrl where mfc_domain = global_domain and |
|
195 |
|
mfc_field = "enable_sequence_schedules" and |
|
196 |
|
mfc_logical) |
|
197 |
|
and file_found |
|
198 |
|
then |
|
199 |
|
using_seq_schedules = yes. |
|
200 |
|
|
|
201 |
|
{us/cc/cclc.i} /* DETERMINE IF CONTAINER/LINE CHARGES IS ACTIVE */ |
|
202 |
|
|
|
203 |
|
ext_price_fmt = ext_price:format. |
|
204 |
|
{us/bbi/gprun.i ""gpcurfmt.p"" |
|
205 |
|
"(input-output ext_price_fmt, input rndmthd)"} |
|
206 |
|
|
|
207 |
|
/* IF INCLUDING CALL DETAILS, HANDLE CDR FOR THOSE PRINT FIELDS */ |
|
208 |
|
if call-detail then |
|
209 |
|
assign |
|
210 |
|
billable-amt:format = ext_price_fmt |
|
211 |
|
sfb_price:format = ext_price_fmt. |
|
212 |
|
|
|
213 |
|
/* Set the label for the discount display */ |
|
214 |
|
hdl_disc_lbl = prnt_disc_amt:handle in frame disc_print. |
|
215 |
|
|
|
216 |
|
find first svc_ctrl where svc_domain = global_domain no-lock no-error. |
|
217 |
|
find first rmc_ctrl where rmc_domain = global_domain no-lock no-error. |
|
218 |
|
|
|
219 |
|
find so_mstr where recid(so_mstr) = so_recno no-lock. |
|
220 |
|
|
|
221 |
|
/* sotrhstb.p CREATES TEMP-TABLE TO STORE tr_hist RECORDS AND RETRIEVE IN */ |
|
222 |
|
/* soauthbl.p AND so10h01.p TO IMPROVE THE PERFORMANCE WHILE PRINTING */ |
|
223 |
|
/* AUTHORIZATION NUMBERS FOR SCHEDULE ORDERS AND LOTSERIAL NUMBER RESPECTIVELY*/ |
|
224 |
|
if available so_mstr |
|
225 |
|
and ((so_sched = yes |
|
226 |
|
and so__qadc03 = "yes") |
|
227 |
|
or print_lotserials) |
|
228 |
|
and not can-find(first t_tr_hist1 |
|
229 |
|
where t_tr_nbr = so_nbr) |
|
230 |
|
then do: |
|
231 |
|
|
|
232 |
|
{us/bbi/gprun.i ""sotrhstb.p"" |
|
233 |
|
"(input so_nbr, |
|
234 |
|
input """", |
|
235 |
|
input-output table t_tr_hist1)"} |
|
236 |
|
|
|
237 |
|
end. /* IF AVAILABLE so_mstr */ |
|
238 |
|
|
|
239 |
|
/* Display sub-header for additional SOs on the invoice */ |
|
240 |
|
if comb_inv_nbr <> "" |
|
241 |
|
then do with frame subheada: |
|
242 |
|
|
|
243 |
|
find ad_mstr where ad_domain = global_domain |
|
244 |
|
and ad_addr = so_ship |
|
245 |
|
no-lock no-wait no-error. |
|
246 |
|
|
|
247 |
|
/* SET EXTERNAL LABELS */ |
|
248 |
|
setFrameLabels(frame subheada:handle). |
|
249 |
|
|
|
250 |
|
display |
|
251 |
|
so_nbr label "Order" |
|
252 |
|
ad_name label "Ship-To" when (available ad_mstr) |
|
253 |
|
so_po label "P/O" |
|
254 |
|
with frame subheada side-labels no-box. |
|
255 |
|
|
|
256 |
|
if so_cmtindx <> 0 |
|
257 |
|
then do: |
|
258 |
|
put skip(1). |
|
259 |
|
run PrintHeaderComment(input so_cmtindx, |
|
260 |
|
input vcPriHeadComment). |
|
261 |
|
put skip(1). |
|
262 |
|
end. /* IF so_cmtindx <> 0 */ |
|
263 |
|
|
|
264 |
|
end. /* IF comb_inv_nbr <> "" */ |
|
265 |
|
|
|
266 |
|
/* PRINT ORDER DETAIL */ |
|
267 |
|
for each sod_det where sod_domain = global_domain |
|
268 |
|
and sod_nbr = so_nbr |
|
269 |
|
and (sod_qty_inv <> 0 or not inv_only) |
|
270 |
|
and sod_compl_stat = "" |
|
271 |
|
by sod_line: |
|
272 |
|
|
|
273 |
|
conversion_factor = 1. |
|
274 |
|
|
|
275 |
|
if so_app_owner = 'DOM' then do: |
|
276 |
|
{us/bbi/gprun.i ""sodomxr.p"" |
|
277 |
|
"(input sod_nbr, |
|
278 |
|
input sod_line, |
|
279 |
|
input 'SO', |
|
280 |
|
output ent_ord_nbr, |
|
281 |
|
output ent_ord_line, |
|
282 |
|
output ent_ord_bill, |
|
283 |
|
output ent_ord_ship, |
|
284 |
|
output ent_ord_line_part, |
|
285 |
|
output ent_ord_line_uom)" } |
|
286 |
|
|
|
287 |
|
if sod_um <> ent_ord_line_uom then do: |
|
288 |
|
{us/px/pxrun.i &PROC = 'retrieveUMConversion' &PROGRAM = 'gpumxr.p' |
|
289 |
|
&HANDLE=ph_gpumxr |
|
290 |
|
&PARAM="(input ent_ord_line_part, |
|
291 |
|
input ent_ord_line_uom, |
|
292 |
|
input sod_um, |
|
293 |
|
output conversion_factor)" |
|
294 |
|
&NOAPPERROR=True |
|
295 |
|
&CATCHERROR=True} |
|
296 |
|
end. |
|
297 |
|
end. |
|
298 |
|
|
|
299 |
|
/* IF THIS IS AN RMA RECEIPT LINE WITH ZERO DOLLARS AND */ |
|
300 |
|
/* PRINT RETURNS (RMC_PRT_RTN) IS NO, SKIP IT. */ |
|
301 |
|
/* IF THIS IS A SERVICE CONTRACT LINE WITH ZERO DOLLARS */ |
|
302 |
|
/* AND PRINT NO CHARGE INVOICES (SVC_PRT_0ITM) IS NO, */ |
|
303 |
|
/* SKIP IT. */ |
|
304 |
|
/* IF A ZERO PRICED RMA RECEIPT LINE, AND */ |
|
305 |
|
/* "PRINT NO CHARGE RECEIPTS" IS NO, SKIP IT. */ |
|
306 |
|
if sod_fsm_type = rmarct_c and available rmc_ctrl then |
|
307 |
|
if not rmc_prt_rtn and sod_price = 0 then |
|
308 |
|
next. |
|
309 |
|
|
|
310 |
|
/* IF A ZERO PRICED SERVICE CONTRACT LINE, AND */ |
|
311 |
|
/* "PRINT NO CHARGE LINES" IS NO, SKIP IT. */ |
|
312 |
|
if sod_fsm_type begins scontract_c and available svc_ctrl then |
|
313 |
|
if not svc_prt_0itm and sod_price = 0 then next. |
|
314 |
|
|
|
315 |
|
restock_amt = 0. |
|
316 |
|
|
|
317 |
|
if sod_fsm_type = rmarct_c then do: |
|
318 |
|
restock_amt = sod_covered_amt. |
|
319 |
|
if restock_amt <> 0 then |
|
320 |
|
assign |
|
321 |
|
restock_pct = sod_disc_pct |
|
322 |
|
restock_prc = sod_price + restock_amt. |
|
323 |
|
end. /* if RMA receipt */ |
|
324 |
|
|
|
325 |
|
if sod_qty_ord >= 0 then |
|
326 |
|
qty_bo = max(sod_qty_ord - sod_qty_ship, 0). |
|
327 |
|
else |
|
328 |
|
qty_bo = min(sod_qty_ord - sod_qty_ship, 0). |
|
329 |
|
|
|
330 |
|
if sacontract |
|
331 |
|
then do: |
|
332 |
|
ext_price = sod_price * sod_qty_item. |
|
333 |
|
if can-find (sac_ctrl where sac_domain = global_domain |
|
334 |
|
and sac_int_rnd) |
|
335 |
|
then do: |
|
336 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
337 |
|
"(input-output ext_price, |
|
338 |
|
input rndmthd, |
|
339 |
|
output mc-error-number)"} |
|
340 |
|
end. /* IF CAN-FIND (sac_ctrl... */ |
|
341 |
|
ext_price = ext_price * sod_qty_per. |
|
342 |
|
end. /* IF sacontract */ |
|
343 |
|
else |
|
344 |
|
ext_price = sod_qty_inv * sod_price. |
|
345 |
|
|
|
346 |
|
/* ROUND TO DOCUMENT CURRENCY ROUND METHOD */ |
|
347 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
348 |
|
"(input-output ext_price, |
|
349 |
|
input rndmthd, |
|
350 |
|
output mc-error-number)"} |
|
351 |
|
|
|
352 |
|
/* CHECK AUTHORIZATION RECORDS FOR DIFFERENT EXTENDED PRICE */ |
|
353 |
|
if sod_sched = yes and |
|
354 |
|
so__qadc03 = "yes" |
|
355 |
|
then do: |
|
356 |
|
|
|
357 |
|
auth_found = no. |
|
358 |
|
{us/bbi/gprun.i ""soauthbl.p"" |
|
359 |
|
"(input table t_tr_hist1, |
|
360 |
|
input '', |
|
361 |
|
input so__qadc03, |
|
362 |
|
input sod_nbr, |
|
363 |
|
input sod_line, |
|
364 |
|
input sod_price, |
|
365 |
|
input sod_site, |
|
366 |
|
input ext_price, |
|
367 |
|
output auth_price, |
|
368 |
|
output auth_found)"} |
|
369 |
|
|
|
370 |
|
ext_price = auth_price. |
|
371 |
|
|
|
372 |
|
end. /* IF sod_sched */ |
|
373 |
|
accumulate ext_price (total). |
|
374 |
|
|
|
375 |
|
/* Contract billing line items use sod_part for the */ |
|
376 |
|
/* contract type. Get the contract type description */ |
|
377 |
|
/* from the sv_mstr. The sod_desc field is storing */ |
|
378 |
|
/* the item's under contract (sod_for) modified */ |
|
379 |
|
/* description. */ |
|
380 |
|
if not sacontract then do: |
|
381 |
|
find pt_mstr where pt_domain = global_domain |
|
382 |
|
and pt_part = sod_part |
|
383 |
|
no-lock no-wait no-error. |
|
384 |
|
if available pt_mstr then do: |
|
385 |
|
if sod_desc = "" then |
|
386 |
|
desc1 = pt_desc1. |
|
387 |
|
else |
|
388 |
|
desc1 = sod_desc. |
|
389 |
|
desc2 = pt_desc2. |
|
390 |
|
end. |
|
391 |
|
else |
|
392 |
|
assign |
|
393 |
|
desc1 = sod_desc |
|
394 |
|
desc2 = "". |
|
395 |
|
end. |
|
396 |
|
|
|
397 |
|
else do: |
|
398 |
|
find sv_mstr where sv_domain = global_domain |
|
399 |
|
and sv_code = sod_part |
|
400 |
|
no-lock no-error. |
|
401 |
|
if available sv_mstr then |
|
402 |
|
desc1 = sv_desc. |
|
403 |
|
else |
|
404 |
|
desc1 = "". |
|
405 |
|
end. |
|
406 |
|
|
|
407 |
|
assign |
|
408 |
|
ext_price:format in frame d = ext_price_fmt |
|
409 |
|
ext_price:format in frame dent = ext_price_fmt. |
|
410 |
|
|
|
411 |
|
if sod_fsm_type = fsmro_c then do: |
|
412 |
|
/* THE CALL LINE ITEM (ITM_DET) CORRESPONDS TO THE */ |
|
413 |
|
/* SALES ORDER LINE. IT CONTAINS THE ITEM REPAIRED */ |
|
414 |
|
/* ON THE CALL. */ |
|
415 |
|
find itm_det where itm_domain = global_domain |
|
416 |
|
and itm_nbr = so_nbr |
|
417 |
|
and itm_prefix = caprefix_c |
|
418 |
|
and itm_type = mfblank |
|
419 |
|
and itm_line = sod_line |
|
420 |
|
no-lock no-error. |
|
421 |
|
|
|
422 |
|
sod_qty_inv:label = getTermLabelRt("REPAIRED",10). |
|
423 |
|
end. |
|
424 |
|
else |
|
425 |
|
sod_qty_inv:label = getTermLabelRt("INVOICED",10). |
|
426 |
|
|
|
427 |
|
/* Record the tax data for print */ |
|
428 |
|
run RecordTaxData(input "16", |
|
429 |
|
input if available so_mstr then so_inv_nbr |
|
430 |
|
else sod_inv_nbr, |
|
431 |
|
input sod_nbr, |
|
432 |
|
input sod_line). |
|
433 |
|
/* PRINT LINE ITEMS */ |
|
434 |
|
{us/so/so10e01.i} |
|
435 |
|
|
|
436 |
|
if rmaso and restock_amt <> 0 then do: |
|
437 |
|
|
|
438 |
|
if page-size - line-counter < 1 then do: |
|
439 |
|
page. |
|
440 |
|
{us/so/so10h01.i} |
|
441 |
|
end. |
|
442 |
|
|
|
443 |
|
put {us/bbi/gplblfmt.i &FUNC=getTermLabelRtColon(""RESTOCKING_CHARGE"",16)} |
|
444 |
|
to 20 restock_pct restock_amt |
|
445 |
|
{us/bbi/gplblfmt.i &FUNC=getTermLabelRtColon(""LIST"",8)} |
|
446 |
|
to 48 restock_prc skip. |
|
447 |
|
end. |
|
448 |
|
|
|
449 |
|
run PrintCustomerItem(input sod_custpart, |
|
450 |
|
input 3). |
|
451 |
|
|
|
452 |
|
/* DISPLAY CUSTOMER REF IF NOT NULL AND DIFFERENT FROM CUST PART */ |
|
453 |
|
if ((available sod_det) and (sod_custref <> "") |
|
454 |
|
and (sod_custref <> sod_custpart )) |
|
455 |
|
then do: |
|
456 |
|
put {us/bbi/gplblfmt.i &FUNC=getTermLabel(""CUSTOMER_REFERENCE"",15) |
|
457 |
|
&CONCAT="':'"} at 3 sod_custref at 20 skip. |
|
458 |
|
end. /* IF ((AVAILABLE SOD_DET) AND (SOD_CUSTREF <> ""))" */ |
|
459 |
|
|
|
460 |
|
/* DISPLAY MODEL YEAR IF NOT NULL */ |
|
461 |
|
if ((available sod_det) and (sod_modelyr <> "")) then do: |
|
462 |
|
put {us/bbi/gplblfmt.i &FUNC=getTermLabel(""MODEL_YEAR"",15) |
|
463 |
|
&CONCAT="':'"} at 3 sod_modelyr at 20 skip. |
|
464 |
|
end. /* IF ((AVAILABLE SOD_DET) AND (SOD_MODELYR <> ""))" */ |
|
465 |
|
|
|
466 |
|
run PrintDescription(input desc1, |
|
467 |
|
input true, |
|
468 |
|
input false, |
|
469 |
|
input 3). |
|
470 |
|
|
|
471 |
|
run PrintDescription(input desc2, |
|
472 |
|
input false, |
|
473 |
|
input true, |
|
474 |
|
input 3). |
|
475 |
|
for first rbc_ctrl no-lock where rbc_domain = global_domain and rbc_print_inv_det: |
|
476 |
|
{us/bbi/gprun.i ""sorbrp01.p"" |
|
477 |
|
"(input sod_nbr, |
|
478 |
|
input '', /* Blank invoice number */ |
|
479 |
|
input sod_part, |
|
480 |
|
input so_mstr.so_app_owner = 'DOM')"} |
|
481 |
|
end. |
|
482 |
|
/***********************************************/ |
|
483 |
|
/* Repair Order */ |
|
484 |
|
/***********************************************/ |
|
485 |
|
if sod_fsm_type = fsmro_c then do: |
|
486 |
|
|
|
487 |
|
if sod_serial <> "" |
|
488 |
|
then do: |
|
489 |
|
fsremarks = fsremarks + getTermLabelRtColon("SERIAL", 15) + " " + sod_serial. |
|
490 |
|
end. /* IF sod_serial <> "" and (print_lotserials or call-detail) THEN DO ... */ |
|
491 |
|
|
|
492 |
|
form |
|
493 |
|
fsremarks no-label |
|
494 |
|
skip(1) |
|
495 |
|
itm_ca_int_type colon 16 |
|
496 |
|
fwk_desc colon 30 no-label |
|
497 |
|
sv_code colon 16 |
|
498 |
|
sv_desc colon 30 no-label |
|
499 |
|
skip(1) |
|
500 |
|
with frame detaila no-box side-labels width 80. |
|
501 |
|
|
|
502 |
|
/* SET EXTERNAL LABELS */ |
|
503 |
|
setFrameLabels(frame detaila:handle). |
|
504 |
|
|
|
505 |
|
if page-size - line-counter < 1 then do: |
|
506 |
|
page. |
|
507 |
|
{us/so/so10h01.i} |
|
508 |
|
end. |
|
509 |
|
|
|
510 |
|
if available itm_det then do: |
|
511 |
|
|
|
512 |
|
if page-size - line-counter < 1 then do: |
|
513 |
|
page. |
|
514 |
|
{us/so/so10h01.i} |
|
515 |
|
end. |
|
516 |
|
|
|
517 |
|
/* FWK_MSTR IS THE WORK CODE, SV_MSTR IS SERVICE TYPE */ |
|
518 |
|
find fwk_mst where fwk_domain = global_domain |
|
519 |
|
and fwk_ca_int_type = itm_ca_int_type |
|
520 |
|
no-lock no-error. |
|
521 |
|
|
|
522 |
|
find sv_mstr where sv_domain = global_domain |
|
523 |
|
and sv_code = itm_sv_code |
|
524 |
|
and sv_type = mfblank |
|
525 |
|
no-lock no-error. |
|
526 |
|
|
|
527 |
|
display |
|
528 |
|
fsremarks when (fsremarks <> "") |
|
529 |
|
itm_ca_int_type |
|
530 |
|
fwk_desc when (available fwk_mstr) |
|
531 |
|
sv_code when (available sv_mstr) |
|
532 |
|
sv_desc when (available sv_mstr) |
|
533 |
|
with frame detaila. |
|
534 |
|
|
|
535 |
|
end. /***************itm_det***************/ |
|
536 |
|
|
|
537 |
|
if call-detail then do: |
|
538 |
|
|
|
539 |
|
assign |
|
540 |
|
sfb-line-count = 0 |
|
541 |
|
total-price = 0 |
|
542 |
|
total-covered = 0 |
|
543 |
|
total-billable = 0. |
|
544 |
|
|
|
545 |
|
/* IF PRINTING CALL DETAIL, PRINT THE LOWER LEVEL */ |
|
546 |
|
/* DETAILS (SFB_DET = BILLING DETAIL) RELATED TO */ |
|
547 |
|
/* THIS REPAIR LINE. THIS DETAIL IS THE PARTS, */ |
|
548 |
|
/* LABOR AND EXPENSES INVOLVED IN THIS REPAIR. */ |
|
549 |
|
for each sfb_det no-lock |
|
550 |
|
where sfb_domain = global_domain |
|
551 |
|
and sfb_nbr = sod_nbr |
|
552 |
|
and sfb_so_line = sod_line |
|
553 |
|
break by sfb_pt_type |
|
554 |
|
by sfb_fis_sort |
|
555 |
|
by sfb_line: |
|
556 |
|
|
|
557 |
|
/* SFB_DETAIL INDICATES WE WILL PRINT EVERY */ |
|
558 |
|
/* UNIQUE DETAIL OF THE REPAIR ACTIVITY, */ |
|
559 |
|
/* INSTEAD OF SUMMARIZING BY INVOICE SORT */ |
|
560 |
|
/* (WHERE INVOICE SORT WOULD BE SOMETHING LIKE*/ |
|
561 |
|
/* PARTS, LABOR, TRAVEL EXPENSE...) */ |
|
562 |
|
|
|
563 |
|
/* IF NOT SFB_DETAIL THEN ACCUMULATE TOTAL PRICE */ |
|
564 |
|
/* LESS ANY EXCHANGE AMOUNT (ITEMS ONLY) AND */ |
|
565 |
|
/* TOTAL COVERED AMOUNT FOR THE INVOICE SORT AND */ |
|
566 |
|
/* PRINT ONE DETAIL LINE ONLY WHEN WE GET TO THE */ |
|
567 |
|
/* LAST ONE... */ |
|
568 |
|
|
|
569 |
|
if sfb_detail and first-of(sfb_fis_sort) then do: |
|
570 |
|
|
|
571 |
|
/* SO, IF WE'RE PRINTING "DETAIL", PRINT A */ |
|
572 |
|
/* HEADING LINE WHEN WE HIT A NEW INVOICE SORT */ |
|
573 |
|
if page-size - line-counter < 1 then do: |
|
574 |
|
page. |
|
575 |
|
{us/so/so10h01.i} |
|
576 |
|
end. |
|
577 |
|
|
|
578 |
|
down 1 with frame e. |
|
579 |
|
|
|
580 |
|
put {us/bbi/gplblfmt.i &FUNC=getTermLabel(""TYPE"",8) |
|
581 |
|
&CONCAT="': '"} at 30 |
|
582 |
|
sfb_fis_sort. |
|
583 |
|
|
|
584 |
|
end. /* if sfb_detail and... */ |
|
585 |
|
|
|
586 |
|
billable-amt = sfb_price * sfb_qty_req. |
|
587 |
|
|
|
588 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
589 |
|
"(input-output billable-amt, |
|
590 |
|
input rndmthd, |
|
591 |
|
output mc-error-number)"} |
|
592 |
|
|
|
593 |
|
billable-amt = billable-amt - sfb_covered_amt. |
|
594 |
|
|
|
595 |
|
if sfb_detail then do: |
|
596 |
|
/*****************************************/ |
|
597 |
|
/* IF THIS IS A FIXED PRICE BILLING THEN */ |
|
598 |
|
/* WE DON'T WANT TO PRINT THE PRICE */ |
|
599 |
|
/*****************************************/ |
|
600 |
|
|
|
601 |
|
if sod_fix_pr then |
|
602 |
|
display-price = no. |
|
603 |
|
else |
|
604 |
|
display-price = yes. |
|
605 |
|
|
|
606 |
|
if page-size - line-counter < 2 then do: |
|
607 |
|
page. |
|
608 |
|
{us/so/so10h01.i} |
|
609 |
|
end. |
|
610 |
|
|
|
611 |
|
/* FOR ALL BUT RETURNS/EXCHANGES PRINT LIKE THIS: */ |
|
612 |
|
if sfb_qty_ret = 0 then do: |
|
613 |
|
/* FOR PARTS, PRINT PART NUMBER @ DESCRIPTION, |
|
614 |
|
ELSE, PRINT SERVICE CATEGORY */ |
|
615 |
|
display |
|
616 |
|
sfb_part when (sfb_pt_type = 0) @ sfb_desc |
|
617 |
|
sfb_fsc_code when (sfb_pt_type <> 0) @ sfb_desc |
|
618 |
|
sfb_line |
|
619 |
|
sfb_qty_req |
|
620 |
|
sfb_price when (display-price) |
|
621 |
|
billable-amt when (display-price) |
|
622 |
|
with frame e. |
|
623 |
|
|
|
624 |
|
down 1 with frame e. |
|
625 |
|
if display-price then do: |
|
626 |
|
display |
|
627 |
|
(- sfb_covered_amt) @ sfb_price |
|
628 |
|
sfb_desc |
|
629 |
|
sfb_fcg_code when (not sod_fix_pr) |
|
630 |
|
@ sfb_qty_req |
|
631 |
|
with frame e. |
|
632 |
|
down 1 with frame e. |
|
633 |
|
end. /* if display-price */ |
|
634 |
|
else if sfb_desc > "" or not sod_fix_pr then do: |
|
635 |
|
display |
|
636 |
|
sfb_desc |
|
637 |
|
sfb_fcg_code when (not sod_fix_pr) |
|
638 |
|
@ sfb_qty_req |
|
639 |
|
with frame e. |
|
640 |
|
down 1 with frame e. |
|
641 |
|
end. |
|
642 |
|
end. /* if sfb_qty_ret = 0 */ |
|
643 |
|
else do: |
|
644 |
|
/* IF THE REPAIR INCLUDED AN EXCHANGE FROM THE */ |
|
645 |
|
/* CUSTOMER (I.E. WE GAVE HIM SOME CREDIT FOR */ |
|
646 |
|
/* THE BROKEN PART THAT HE RETURNED), PRINT */ |
|
647 |
|
/* THAT DETAIL ALSO. */ |
|
648 |
|
|
|
649 |
|
tmp_amt = (sfb_exg_price * sfb_qty_ret). |
|
650 |
|
|
|
651 |
|
{us/bbi/gprun.i ""gpcurrnd.p"" |
|
652 |
|
"(input-output tmp_amt, |
|
653 |
|
input rndmthd)"} |
|
654 |
|
|
|
655 |
|
display |
|
656 |
|
sfb_part @ sfb_desc |
|
657 |
|
sfb_line |
|
658 |
|
(- sfb_qty_ret) @ sfb_qty_req |
|
659 |
|
(- sfb_exg_price) when (sfb_exchange) |
|
660 |
|
@ sfb_price |
|
661 |
|
(- tmp_amt ) when (sfb_exchange) |
|
662 |
|
@ billable-amt |
|
663 |
|
with frame e. |
|
664 |
|
|
|
665 |
|
down 1 with frame e. |
|
666 |
|
|
|
667 |
|
display |
|
668 |
|
sfb_desc |
|
669 |
|
getTermLabel("EXCHANGE", 10) when (sfb_exchange) |
|
670 |
|
@ sfb_qty_req |
|
671 |
|
getTermLabel("RETURN", 10) when (not sfb_exchange) |
|
672 |
|
@ sfb_qty_req |
|
673 |
|
with frame e. |
|
674 |
|
|
|
675 |
|
down 1 with frame e. |
|
676 |
|
|
|
677 |
|
end. /* else, sfb_qty_ret <> 0, do */ |
|
678 |
|
|
|
679 |
|
/* PRINT COMMENTS FOR THE SFB_DETS ALSO */ |
|
680 |
|
put skip(1). |
|
681 |
|
run PrintLineComment(input sfb_cmtindx, |
|
682 |
|
input vcPriLineComment). |
|
683 |
|
end. /* if sfb_detail */ |
|
684 |
|
|
|
685 |
|
else do: |
|
686 |
|
|
|
687 |
|
/* FOR FIXED PRICE LINES, WE WON'T PRINT ANY PRICES */ |
|
688 |
|
/* AND, IF WE'RE NOT PRINTING ANY DETAIL, SAVE */ |
|
689 |
|
/* OURSELVES THE OVERHEAD OF ALL THIS. */ |
|
690 |
|
if not sod_fix_pr then do: |
|
691 |
|
tmp_amt = (sfb_price * sfb_qty_req). |
|
692 |
|
|
|
693 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
694 |
|
"(input-output tmp_amt, |
|
695 |
|
input rndmthd, |
|
696 |
|
output mc-error-number)"} |
|
697 |
|
|
|
698 |
|
/* ACCUMULATE AMOUNTS FOR THIS INVOICE SORT */ |
|
699 |
|
assign |
|
700 |
|
total-covered = total-covered + sfb_covered_amt |
|
701 |
|
total-price = total-price + tmp_amt |
|
702 |
|
total-billable = total-billable + billable-amt. |
|
703 |
|
if sfb_exchange then do: |
|
704 |
|
tmp_amt = (sfb_exg_price * sfb_qty_ret). |
|
705 |
|
|
|
706 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
707 |
|
"(input-output tmp_amt, |
|
708 |
|
input rndmthd, |
|
709 |
|
output mc-error-number)"} |
|
710 |
|
|
|
711 |
|
assign total-exchange = total-exchange + tmp_amt. |
|
712 |
|
end. /* if sfb_exchange */ |
|
713 |
|
|
|
714 |
|
if last-of (sfb_fis_sort) then do: |
|
715 |
|
|
|
716 |
|
/* PRINT THE INVOICE SORT HEADING */ |
|
717 |
|
if page-size - line-counter < 1 then do: |
|
718 |
|
page. |
|
719 |
|
{us/so/so10h01.i} |
|
720 |
|
end. |
|
721 |
|
|
|
722 |
|
down 1 with frame e. |
|
723 |
|
|
|
724 |
|
put {us/bbi/gplblfmt.i &FUNC=getTermLabel(""TYPE"",8) |
|
725 |
|
&CONCAT="': '"} at 30 |
|
726 |
|
sfb_fis_sort. |
|
727 |
|
|
|
728 |
|
if page-size - line-counter < 2 then do: |
|
729 |
|
page. |
|
730 |
|
{us/so/so10h01.i} |
|
731 |
|
end. |
|
732 |
|
|
|
733 |
|
/* ROUND INVOICE SORT TOTAL AMOUNTS */ |
|
734 |
|
|
|
735 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
736 |
|
"(input-output total-covered, |
|
737 |
|
input rndmthd, |
|
738 |
|
output mc-error-number)"} |
|
739 |
|
|
|
740 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
741 |
|
"(input-output total-price, |
|
742 |
|
input rndmthd, |
|
743 |
|
output mc-error-number)"} |
|
744 |
|
|
|
745 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
746 |
|
"(input-output total-billable, |
|
747 |
|
input rndmthd, |
|
748 |
|
output mc-error-number)"} |
|
749 |
|
|
|
750 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
751 |
|
"(input-output total-exchange, |
|
752 |
|
input rndmthd, |
|
753 |
|
output mc-error-number)"} |
|
754 |
|
|
|
755 |
|
/* DISPLAY TOTALS FOR THE INVOICE SORT */ |
|
756 |
|
sfb-line-count = sfb-line-count + 1. |
|
757 |
|
|
|
758 |
|
find fis_mstr where fis_domain = global_domain |
|
759 |
|
and fis_sort = sfb_fis_sort |
|
760 |
|
no-lock. |
|
761 |
|
|
|
762 |
|
display |
|
763 |
|
sfb-line-count @ sfb_line |
|
764 |
|
fis_desc @ sfb_desc |
|
765 |
|
total-price @ sfb_price |
|
766 |
|
total-billable @ billable-amt |
|
767 |
|
with frame e. |
|
768 |
|
|
|
769 |
|
down 1 with frame e. |
|
770 |
|
|
|
771 |
|
display |
|
772 |
|
getTermLabel("COVERED_AMOUNT", 24) @ sfb_desc |
|
773 |
|
(- total-covered) @ sfb_price |
|
774 |
|
with frame e. |
|
775 |
|
|
|
776 |
|
down 1 with frame e. |
|
777 |
|
|
|
778 |
|
if total-exchange <> 0 then do: |
|
779 |
|
display |
|
780 |
|
getTermLabel("EXCHANGES", 24) @ sfb_desc |
|
781 |
|
(- total-exchange) @ sfb_price |
|
782 |
|
(- total-exchange) @ billable-amt |
|
783 |
|
with frame e. |
|
784 |
|
down 1 with frame e. |
|
785 |
|
end. /* if total-exchange <> 0 */ |
|
786 |
|
|
|
787 |
|
assign |
|
788 |
|
total-price = 0 |
|
789 |
|
total-covered = 0 |
|
790 |
|
total-billable = 0 |
|
791 |
|
total-exchange = 0. |
|
792 |
|
|
|
793 |
|
end. /* if last-of (sfb_fis_sort) */ |
|
794 |
|
end. /* if not sod_fix_pr */ |
|
795 |
|
end. /* else, not sfb_detail, do */ |
|
796 |
|
|
|
797 |
|
end. /*********for each sfb_det**********/ |
|
798 |
|
|
|
799 |
|
end. /* if call-detail */ |
|
800 |
|
|
|
801 |
|
end. /***************repair order*************/ |
|
802 |
|
|
|
803 |
|
if sacontract then do: |
|
804 |
|
|
|
805 |
|
/**********************************************/ |
|
806 |
|
/* Check to see if this SO is in sas_mstr */ |
|
807 |
|
/**********************************************/ |
|
808 |
|
if sod_req_date <> ? and sod_due_date <> ? |
|
809 |
|
then do: |
|
810 |
|
|
|
811 |
|
/* SUMMARY BILLING DOES NOT POPULATE THESE 2 DATES */ |
|
812 |
|
if sod_req_date <> so_req_date or |
|
813 |
|
sod_due_date <> so_due_date |
|
814 |
|
then do: |
|
815 |
|
|
|
816 |
|
fsremarks = getTermLabel("FOR_THE_PERIOD", 13) + ": " |
|
817 |
|
+ string(sod_req_date,"99/99/99") |
|
818 |
|
+ " " + getTermLabel("TO", 10) + ": " |
|
819 |
|
+ string(sod_due_date,"99/99/99"). |
|
820 |
|
|
|
821 |
|
put fsremarks at 15. |
|
822 |
|
end. |
|
823 |
|
end. |
|
824 |
|
|
|
825 |
|
if page-size - line-counter < 1 then do: |
|
826 |
|
page. |
|
827 |
|
{us/so/so10h01.i} |
|
828 |
|
end. |
|
829 |
|
|
|
830 |
|
/* If the item under contract has a modified desc use */ |
|
831 |
|
/* it. Else use the ISB desc, then the part desc. */ |
|
832 |
|
/* desc1 = "". */ |
|
833 |
|
desc1 = sod_desc. |
|
834 |
|
if desc1 = "" then do: |
|
835 |
|
|
|
836 |
|
find isb_mstr where isb_domain = global_domain |
|
837 |
|
and isb_eu_nbr = so_ship |
|
838 |
|
and isb_part = sod_for |
|
839 |
|
and isb_serial = sod_serial |
|
840 |
|
and isb_ref = sod_ref |
|
841 |
|
no-lock no-error. |
|
842 |
|
|
|
843 |
|
if available isb_mstr and isb_desc1 <> "" then |
|
844 |
|
desc1 = isb_desc1. |
|
845 |
|
else do: |
|
846 |
|
find pt_mstr where pt_domain = global_domain |
|
847 |
|
and pt_part = sod_for |
|
848 |
|
no-lock no-error. |
|
849 |
|
if available pt_mstr then |
|
850 |
|
desc1 = pt_desc1. |
|
851 |
|
end. |
|
852 |
|
end. |
|
853 |
|
|
|
854 |
|
fsremarks = "". |
|
855 |
|
if sod_for <> "" then |
|
856 |
|
fsremarks = sod_for + " ". |
|
857 |
|
fsremarks = fsremarks + desc1. |
|
858 |
|
|
|
859 |
|
if sod_serial <> "" and print_lotserials = no then do: |
|
860 |
|
fsremarks = fsremarks + getTermLabelRtColon("SERIAL", 15) |
|
861 |
|
+ " " + sod_serial. |
|
862 |
|
end. |
|
863 |
|
|
|
864 |
|
if page-size - line-counter < 1 then do: |
|
865 |
|
page. |
|
866 |
|
{us/so/so10h01.i} |
|
867 |
|
end. |
|
868 |
|
|
|
869 |
|
put fsremarks at 3. |
|
870 |
|
|
|
871 |
|
if sod_enduser <> "" then do: |
|
872 |
|
fsremarks = getTermLabelRtColon("END_USER",9) + sod_enduser. |
|
873 |
|
if page-size - line-counter < 1 then do: |
|
874 |
|
page. |
|
875 |
|
{us/so/so10h01.i} |
|
876 |
|
end. |
|
877 |
|
put fsremarks at 3. |
|
878 |
|
end. |
|
879 |
|
|
|
880 |
|
if sod_qty_per > 1 or |
|
881 |
|
sod_qty_item > 1 |
|
882 |
|
then do: |
|
883 |
|
|
|
884 |
|
if page-size - line-counter < 1 then do: |
|
885 |
|
page. |
|
886 |
|
{us/so/so10h01.i} |
|
887 |
|
end. |
|
888 |
|
|
|
889 |
|
put |
|
890 |
|
{us/bbi/gplblfmt.i &FUNC=getTermLabel(""UNITS"",5)} at 3 |
|
891 |
|
sod_qty_item at 9 |
|
892 |
|
" x " at 24 |
|
893 |
|
{us/bbi/gplblfmt.i &FUNC=getTermLabel(""PERIODS"",7)} |
|
894 |
|
sod_qty_per at 35 |
|
895 |
|
" = " at 47 |
|
896 |
|
{us/bbi/gplblfmt.i &FUNC=getTermLabel(""SHIPPED"",7)} |
|
897 |
|
sod_qty_inv at 58. |
|
898 |
|
end. |
|
899 |
|
|
|
900 |
|
end. /*************sacontract ************/ |
|
901 |
|
|
|
902 |
|
/* Do not print P.O.'s for Service Contracts. The contract */ |
|
903 |
|
/* has already been displayed in the invoice header. */ |
|
904 |
|
if sod_contr_id <> "" and (sod_sched or rmaso) then do: |
|
905 |
|
if page-size - line-counter < 1 then do: |
|
906 |
|
page. |
|
907 |
|
{us/so/so10h01.i} |
|
908 |
|
end. |
|
909 |
|
|
|
910 |
|
/* PRINT THE PO NUMBER IF A SCHEDULED ORDER INVOICE, */ |
|
911 |
|
/* ELSE PRINT THE SERVICE CONTRACT FOR AN RMA INVOICE. */ |
|
912 |
|
if sod_sched then |
|
913 |
|
put {us/bbi/gplblfmt.i &FUNC=getTermLabelRtColon(""PURCHASE_ORDER"",16)} |
|
914 |
|
at 3 sod_contr_id at 20 skip. |
|
915 |
|
else |
|
916 |
|
|
|
917 |
|
put {us/bbi/gplblfmt.i &FUNC=getTermLabelRtColon(""SERVICE_CONTRACT"",16)} |
|
918 |
|
at 3 sod_contr_id at 20 skip. |
|
919 |
|
end. |
|
920 |
|
|
|
921 |
|
/* Print Lot/Serial Numbers */ |
|
922 |
|
so_db = global_db. |
|
923 |
|
|
|
924 |
|
find si_mstr where si_domain = global_domain |
|
925 |
|
and si_site = sod_site |
|
926 |
|
no-lock no-error. |
|
927 |
|
|
|
928 |
|
/* CHANGE DOMAINS IF USING MULTI-DOMAINS TO LOCATE tr_hist */ |
|
929 |
|
if si_db <> so_db then do: |
|
930 |
|
{us/bbi/gprun.i ""gpalias3.p"" "(si_db, output err_flag)" } |
|
931 |
|
end. |
|
932 |
|
|
|
933 |
|
assign |
|
934 |
|
sonbr = sod_nbr |
|
935 |
|
soline = sod_line |
|
936 |
|
sopart = sod_part. |
|
937 |
|
|
|
938 |
|
/* Print Lot/Serial Numbers */ |
|
939 |
|
if print_lotserials then do: |
|
940 |
|
{us/bbi/gprun.i ""so10h01.p"" |
|
941 |
|
"(input table t_tr_hist1, |
|
942 |
|
input so_app_owner)"} |
|
943 |
|
end. /* END OF IF print_lotserials */ |
|
944 |
|
|
|
945 |
|
/* CALL ROUTINE SOAUTH.P FOR SCHEDULE ORDERS ONLY */ |
|
946 |
|
/* WHEN 'INVOICE BY AUTHORIZATION' IS 'YES' */ |
|
947 |
|
if sod_sched and |
|
948 |
|
so__qadc03 = "yes" |
|
949 |
|
and can-find (first rqm_det where rqm_domain = global_domain |
|
950 |
|
and rqm_nbr = sonbr |
|
951 |
|
and rqm_line = soline |
|
952 |
|
and rqm_cat = "authnbr") |
|
953 |
|
then do: |
|
954 |
|
|
|
955 |
|
/* ROUTINE TO PRINT AUTHORIZATION NUMBER AND PEGGED QTY */ |
|
956 |
|
{us/bbi/gprun.i ""soauth.p""} |
|
957 |
|
|
|
958 |
|
/* UPDATE SEQUENCE SCHEDULE WITH INVOICE NUMBER */ |
|
959 |
|
if using_seq_schedules |
|
960 |
|
then do: |
|
961 |
|
l_inv_nbr = so_inv_nbr. |
|
962 |
|
{us/gp/gprunmo.i |
|
963 |
|
&program = ""soabssiv.p"" |
|
964 |
|
&module = "ASQ" |
|
965 |
|
¶m="""(input sonbr, |
|
966 |
|
input soline, |
|
967 |
|
input so_inv_nbr)"""} |
|
968 |
|
end. |
|
969 |
|
end. /* IF SOD_SCHED */ |
|
970 |
|
|
|
971 |
|
/* RESET THE DOMAIN TO THE SALES ORDER DOMAIN */ |
|
972 |
|
if si_db <> so_db then do: |
|
973 |
|
{us/bbi/gprun.i ""gpalias3.p"" "(so_db, output err_flag)" } |
|
974 |
|
end. |
|
975 |
|
|
|
976 |
|
/* Print Features and Options */ |
|
977 |
|
/******************************************** |
|
978 |
|
sob_serial subfield positions: |
|
979 |
|
1-4 operation number (old - now 0's) |
|
980 |
|
5-10 scrap percent |
|
981 |
|
11-14 id number of this record |
|
982 |
|
15-15 structure code |
|
983 |
|
16-16 "y" (indicates "new" format sob_det record) |
|
984 |
|
17-34 original qty per parent |
|
985 |
|
35-35 original mandatory indicator (y/n) |
|
986 |
|
36-36 original default indicator (y/n) |
|
987 |
|
37-39 leadtime offset |
|
988 |
|
40-40 price manually updated (y/n) |
|
989 |
|
41-46 operation number (new - 6 digits) |
|
990 |
|
*******************************************/ |
|
991 |
|
|
|
992 |
|
if print_options and |
|
993 |
|
can-find(first sob_det where sob_domain = global_domain |
|
994 |
|
and sob_nbr = so_nbr |
|
995 |
|
and sob_line = sod_line) |
|
996 |
|
then do: |
|
997 |
|
|
|
998 |
|
/* Print discounts for parent item */ |
|
999 |
|
/* added net price parameter */ |
|
1000 |
|
/* changed qty from ordered to invoiced*/ |
|
1001 |
|
{us/so/sopiprn1.i &doctype="1" |
|
1002 |
|
&nbr=sod_nbr |
|
1003 |
|
&line=sod_line |
|
1004 |
|
&part=sod_part |
|
1005 |
|
&parent="""" |
|
1006 |
|
&feature="""" |
|
1007 |
|
&opt="""" |
|
1008 |
|
&qty=sod_qty_inv |
|
1009 |
|
&list_price=sod_list_pr |
|
1010 |
|
&net_price=sod_price |
|
1011 |
|
&confg_disc="no" |
|
1012 |
|
&command="~{us/so/so10h01.i~}"} |
|
1013 |
|
|
|
1014 |
|
find first sob_det where sob_domain = global_domain |
|
1015 |
|
and sob_nbr = sod_nbr |
|
1016 |
|
and sob_line = sod_line |
|
1017 |
|
no-lock no-error. |
|
1018 |
|
|
|
1019 |
|
{us/bbi/gprun.i ""sorp1b01.p"" |
|
1020 |
|
"(input """", |
|
1021 |
|
input 0, |
|
1022 |
|
input sod_nbr, |
|
1023 |
|
input sod_line, |
|
1024 |
|
input print_lotserials)"} |
|
1025 |
|
|
|
1026 |
|
end. |
|
1027 |
|
|
|
1028 |
|
/* Test for configured parent without components */ |
|
1029 |
|
if available pt_mstr then do: |
|
1030 |
|
|
|
1031 |
|
pm_code = pt_pm_code. |
|
1032 |
|
|
|
1033 |
|
find ptp_det where ptp_domain = global_domain |
|
1034 |
|
and ptp_part = sod_part |
|
1035 |
|
and ptp_site = sod_site |
|
1036 |
|
no-lock no-error. |
|
1037 |
|
|
|
1038 |
|
if available ptp_det then |
|
1039 |
|
pm_code = ptp_pm_code. |
|
1040 |
|
|
|
1041 |
|
if pm_code = "C" and |
|
1042 |
|
not can-find(first sob_det where sob_domain = global_domain |
|
1043 |
|
and sob_nbr = sod_nbr |
|
1044 |
|
and sob_line = sod_line) |
|
1045 |
|
then do: |
|
1046 |
|
{us/so/sopiprn1.i &doctype="1" &nbr=sod_nbr &line=sod_line |
|
1047 |
|
&part=sod_part |
|
1048 |
|
&parent="""" &feature="""" &opt="""" |
|
1049 |
|
&qty=sod_qty_inv &list_price=sod_list_pr |
|
1050 |
|
&net_price=sod_price |
|
1051 |
|
&confg_disc="no" |
|
1052 |
|
&command="~{us/so/so10h01.i~}"} |
|
1053 |
|
end. |
|
1054 |
|
end. |
|
1055 |
|
|
|
1056 |
|
/* Print global discounts for item/configuration */ |
|
1057 |
|
{us/so/sopiprn1.i |
|
1058 |
|
&doctype="1" |
|
1059 |
|
&nbr=sod_nbr |
|
1060 |
|
&line=sod_line |
|
1061 |
|
&part=sod_part |
|
1062 |
|
&parent="""" |
|
1063 |
|
&feature="""" |
|
1064 |
|
&opt="""" |
|
1065 |
|
&qty=sod_qty_inv |
|
1066 |
|
&list_price=sod_list_pr |
|
1067 |
|
&net_price=sod_price |
|
1068 |
|
&confg_disc="yes" |
|
1069 |
|
&command="~{us/so/so10h01.i~}"} |
|
1070 |
|
|
|
1071 |
|
if sod_cmtindx <> 0 then |
|
1072 |
|
do: |
|
1073 |
|
put skip(1). |
|
1074 |
|
run PrintLineComment(input sod_cmtindx, |
|
1075 |
|
input vcPriLineComment). |
|
1076 |
|
end. |
|
1077 |
|
|
|
1078 |
|
put skip(1). |
|
1079 |
|
|
|
1080 |
|
/* Accumulate order totals, commissions and taxes */ |
|
1081 |
|
|
|
1082 |
|
if sacontract |
|
1083 |
|
then do: |
|
1084 |
|
ext_actual = sod_price * sod_qty_item. |
|
1085 |
|
if can-find (sac_ctrl where sac_domain = global_domain |
|
1086 |
|
and sac_int_rnd) |
|
1087 |
|
then do: |
|
1088 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1089 |
|
"(input-output ext_actual, |
|
1090 |
|
input rndmthd, |
|
1091 |
|
output mc-error-number)"} |
|
1092 |
|
end. /* IF CAN-FIND (sac_ctrl... */ |
|
1093 |
|
ext_actual = ext_actual * sod_qty_per. |
|
1094 |
|
end. /* IF sacontract */ |
|
1095 |
|
else |
|
1096 |
|
ext_actual = sod_price * sod_qty_inv. |
|
1097 |
|
|
|
1098 |
|
/* ROUND TO DOCUMENT CURRENCY ROUND METHOD */ |
|
1099 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1100 |
|
"(input-output ext_actual, |
|
1101 |
|
input rndmthd, |
|
1102 |
|
output mc-error-number)"} |
|
1103 |
|
|
|
1104 |
|
/* IF WE USED THE PRICE FROM THE AUTHORIZATIONS */ |
|
1105 |
|
assign |
|
1106 |
|
ext_actual = if (sod_sched |
|
1107 |
|
and auth_found) |
|
1108 |
|
then |
|
1109 |
|
auth_price |
|
1110 |
|
else |
|
1111 |
|
ext_actual |
|
1112 |
|
|
|
1113 |
|
ext_margin = (sod_price - sod_std_cost) * sod_qty_inv. |
|
1114 |
|
|
|
1115 |
|
/* ROUND TO DOCUMENT CURRENCY ROUND METHOD */ |
|
1116 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1117 |
|
"(input-output ext_margin, |
|
1118 |
|
input rndmthd, |
|
1119 |
|
output mc-error-number)"} |
|
1120 |
|
|
|
1121 |
|
/* LINE TOTAL IS CALCULATED IN SOIVTRL2.P UNDER NEW TAXES */ |
|
1122 |
|
|
|
1123 |
|
/* Commissions */ |
|
1124 |
|
do jk = 1 to 4: |
|
1125 |
|
if soc_margin then do: |
|
1126 |
|
tmp_amt = ext_margin * sod_comm_pct[jk]. |
|
1127 |
|
/* ROUND TO DOCUMENT CURRENCY ROUND METHOD */ |
|
1128 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1129 |
|
"(input-output tmp_amt, |
|
1130 |
|
input rndmthd, |
|
1131 |
|
output mc-error-number)"} |
|
1132 |
|
|
|
1133 |
|
tot_line_comm[jk] = tot_line_comm[jk] + tmp_amt. |
|
1134 |
|
end. |
|
1135 |
|
else do: |
|
1136 |
|
tmp_amt = ext_actual * sod_comm_pct[jk]. |
|
1137 |
|
/* ROUND TO DOCUMENT CURRENCY ROUND METHOD */ |
|
1138 |
|
{us/gp/gprunp.i "mcpl" "p" "mc-curr-rnd" |
|
1139 |
|
"(input-output tmp_amt, |
|
1140 |
|
input rndmthd, |
|
1141 |
|
output mc-error-number)"} |
|
1142 |
|
|
|
1143 |
|
tot_line_comm[jk] = tot_line_comm[jk] + tmp_amt. |
|
1144 |
|
end. |
|
1145 |
|
end. |
|
1146 |
|
|
|
1147 |
|
/*jpm*/ /*Temporarily remove PRM */ |
|
1148 |
|
/* |
|
1149 |
|
/* DISPLAY PROJECT DETAILS */ |
|
1150 |
|
if so_fsm_type = "PRM" then do: |
|
1151 |
|
{us/gp/gprunmo.i |
|
1152 |
|
&module="PRM" |
|
1153 |
|
&program="pjsorp1a.p" |
|
1154 |
|
¶m="""(input sod_nbr, |
|
1155 |
|
input sod_line)"""} |
|
1156 |
|
end. /* if so_fsm_type = "PRM" */ |
|
1157 |
|
*/ |
|
1158 |
|
if using_line_charges then do: |
|
1159 |
|
/* PROCEDURE TO CALCULATE AND PRINT LINE AND CONTAINER CHARGES */ |
|
1160 |
|
/* ON THE INVOICE OUTPUT. */ |
|
1161 |
|
{us/gp/gprunmo.i |
|
1162 |
|
&module = "ACL" |
|
1163 |
|
&program = ""solcrp.p"" |
|
1164 |
|
¶m = """(input recid(so_mstr), |
|
1165 |
|
input recid(sod_det), |
|
1166 |
|
input comb_inv_nbr, |
|
1167 |
|
input-output tot_line_charge)"""} |
|
1168 |
|
end. |
|
1169 |
|
|
|
1170 |
|
{us/mf/mfrpchk.i} |
|
1171 |
|
|
|
1172 |
|
create t_seq_lines. |
|
1173 |
|
assign |
|
1174 |
|
t_seqnbr = so_nbr |
|
1175 |
|
t_seqln = sod_line. |
|
1176 |
|
end. |
|
1177 |
|
|
|
1178 |
|
empty temp-table t_tr_hist1. |
|
1179 |
|
|
|
1180 |
|
if using_container_charges then do: |
|
1181 |
|
/* PROCEDURE TO CALCULATE AND PRINT LINE AND CONTAINER CHARGES */ |
|
1182 |
|
/* ON THE INVOICE OUTPUT. */ |
|
1183 |
|
{us/gp/gprunmo.i |
|
1184 |
|
&module = "ACL" |
|
1185 |
|
&program = ""soccrp.p"" |
|
1186 |
|
¶m = """(input recid(so_mstr), |
|
1187 |
|
input comb_inv_nbr, |
|
1188 |
|
output tot_cont_charge)"""} |
|
1189 |
|
end. |
|
1190 |
|
|
|
1191 |
|
if using_seq_schedules then do: |
|
1192 |
|
|
|
1193 |
|
/* CHANGE DOMAIN TO LOCATE abss_det */ |
|
1194 |
|
so_db = global_db. |
|
1195 |
|
find si_mstr where si_domain = global_domain |
|
1196 |
|
and si_site = so_site |
|
1197 |
|
no-lock no-error. |
|
1198 |
|
if available si_mstr |
|
1199 |
|
then do: |
|
1200 |
|
if si_db <> so_db then do: |
|
1201 |
|
{us/bbi/gprun.i ""gpalias3.p"" "(si_db, output err_flag)" } |
|
1202 |
|
end. |
|
1203 |
|
|
|
1204 |
|
if err_flag <> 0 and err_flag <> 9 then do: |
|
1205 |
|
/* DOMAIN # IS NOT AVAILABLE */ |
|
1206 |
|
{us/bbi/pxmsg.i &MSGNUM=6137 &ERRORLEVEL=4 |
|
1207 |
|
&MSGARG1=getTermLabel(""FOR_CUSTOMER_SEQUENCES"",35)} |
|
1208 |
|
end. |
|
1209 |
|
else do: |
|
1210 |
|
if comb_inv_nbr = "" then |
|
1211 |
|
l_inv_nbr = so_inv_nbr. |
|
1212 |
|
else |
|
1213 |
|
l_inv_nbr = comb_inv_nbr. |
|
1214 |
|
|
|
1215 |
|
run print_seqdata( input l_inv_nbr). |
|
1216 |
|
|
|
1217 |
|
/* PRINT SEQUENCE RANGE ON INVOICE */ |
|
1218 |
|
{us/gp/gprunmo.i |
|
1219 |
|
&program=""rcsqps.p"" |
|
1220 |
|
&module="ASQ" |
|
1221 |
|
¶m="""(input l_inv_nbr)"""} |
|
1222 |
|
|
|
1223 |
|
/* RESET THE DOMAIN TO THE SALES ORDER DOMAIN */ |
|
1224 |
|
if si_db <> so_db then do: |
|
1225 |
|
{us/bbi/gprun.i ""gpalias3.p"" "(so_db, output err_flag)" } |
|
1226 |
|
end. |
|
1227 |
|
end. /* else do */ |
|
1228 |
|
end. /* IF AVAILABLE si_mstr */ |
|
1229 |
|
end. /* if using_seq_schedules */ |
|
1230 |
|
|
|
1231 |
|
PROCEDURE print_seqdata: |
|
1232 |
|
define input parameter p_inv_nbr like idh_inv_nbr no-undo. |
|
1233 |
|
|
|
1234 |
|
do transaction: |
|
1235 |
|
for each t_seq_lines: |
|
1236 |
|
{us/gp/gprunmo.i |
|
1237 |
|
&program = ""soabssiv.p"" |
|
1238 |
|
&module = "ASQ" |
|
1239 |
|
¶m = """(input t_seqnbr, |
|
1240 |
|
input t_seqln, |
|
1241 |
|
input p_inv_nbr)"""} |
|
1242 |
|
end. /* for each t_seq_lines */ |
|
1243 |
|
|
|
1244 |
|
/* PRINT SEQUENCE RANGE ON INVOICE */ |
|
1245 |
|
/* CHANGED INPUT PARAMETER TO l_inv_nbr */ |
|
1246 |
|
{us/gp/gprunmo.i |
|
1247 |
|
&program = ""rcsqps.p"" |
|
1248 |
|
&module = "ASQ" |
|
1249 |
|
¶m = """(input p_inv_nbr)"""} |
|
1250 |
|
|
|
1251 |
|
undo , leave. |
|
1252 |
|
end. /* transactions */ |
|
1253 |
|
|
|
1254 |
|
END PROCEDURE. /* print_seqdata */ |
|
1255 |
|
|
|
1256 |
|
/* Procedures of Print Settings */ |
|
1257 |
|
/*d2561*/ {xxprprc2.i &PageEnd="us/so/so10h01.i"} |
|
1258 |
|
/*d2561* {us/so/soprprc2.i &PageEnd="us/so/so10h01.i"} */ |