File mfg/2013/base/src/txmeth60.p added (mode: 100644) (index 0000000..05a4409) |
|
1 |
|
/* txmeth60.p - qad TAX CALCULATION ROUTINE THAT CALLS QUANTUM */ |
|
2 |
|
/* txmeth20.p - qad TAX CALCULATION ROUTINE THAT CALLS QUANTUM */ |
|
3 |
|
/* Copyright 1986 QAD Inc. All rights reserved. */ |
|
4 |
|
/* REVISION: 8.6 CREATED : 10/20/97 *K0JV* Shankar Subramanian */ |
|
5 |
|
/* REVISION: 8.6E LAST MODIFIED: 02/23/98 BY: *L007* A. Rahane */ |
|
6 |
|
/* REVISION: 8.6E LAST MODIFIED: 05/09/98 BY: *L00Y* Jeff Wootton */ |
|
7 |
|
/* REVISION: 8.6E LAST MODIFIED: 06/22/98 BY: *J2D9* Sachin Shah */ |
|
8 |
|
/* REVISION: 8.6E LAST MODIFIED: 06/30/98 BY: *L01B* Jim Josey */ |
|
9 |
|
/* REVISION: 8.6E LAST MODIFIED: 10/11/98 BY: *L0BG* Surendra Kumar */ |
|
10 |
|
/* REVISION: 8.6E LAST MODIFIED: 10/26/98 BY: *L0CF* Sami Kureishy */ |
|
11 |
|
/* REVISION: 8.6E LAST MODIFIED: 08/12/99 BY: *J3KY* Sachin Shinde */ |
|
12 |
|
/* REVISION: 9.1 LAST MODIFIED: 08/12/00 BY: *N0KC* myb */ |
|
13 |
|
/* REVISION: 9.1 LAST MODIFIED: 09/25/00 BY: *N0W4* BalbeerS Rajput */ |
|
14 |
|
/* REVISION: 9.1 LAST MODIFIED: 02/12/01 BY: *M11P* Veena Lad */ |
|
15 |
|
/* Old ECO marker removed, but no ECO header exists *F0PN* */ |
|
16 |
|
/* Revision: 1.9.2.6 BY: Ashish M. DATE: 12/10/01 ECO: *M1R1* */ |
|
17 |
|
/* Revision: 1.9.2.8 BY: Paul Donnelly (SB) DATE: 06/28/03 ECO: *Q00M* */ |
|
18 |
|
/* Revision: 1.9.2.9 BY: Veena Lad DATE: 09/17/03 ECO: *N2KV* */ |
|
19 |
|
/* Revision: 1.9.2.10 BY: Manjusha Inglay DATE: 11/22/03 ECO: *P19S* */ |
|
20 |
|
/* Revision: 1.9.2.11 BY: Sajan Chhetri DATE: 01/21/04 ECO: *Q05H* */ |
|
21 |
|
/* Revision: 1.9.2.12 BY: Priya Idnani DATE: 01/07/05 ECO: *Q0GD* */ |
|
22 |
|
/* Revision: 1.9.2.13 BY: Katie Hilbert DATE: 01/07/05 ECO: *Q0GH* */ |
|
23 |
|
/* $Revision$ BY: Tejasvi Kulkarni DATE: 02/21/06 ECO: *Q0R7* */ |
|
24 |
|
/* Buderim LAST MODIFIED: 2016-Apr-27 BY: gbg *D3465* */ |
|
25 |
|
/*-Revision end---------------------------------------------------------------*/ |
|
26 |
|
|
|
27 |
|
/*V8:ConvertMode=Maintenance */ |
|
28 |
|
/******************************************************************************/ |
|
29 |
|
/* All patch markers and commented out code have been removed from the source */ |
|
30 |
|
/* code below. For all future modifications to this file, any code which is */ |
|
31 |
|
/* no longer required should be deleted and no in-line patch markers should */ |
|
32 |
|
/* be added. The ECO marker should only be included in the Revision History. */ |
|
33 |
|
/******************************************************************************/ |
|
34 |
|
/*! |
|
35 |
|
txmeth20.p qad Quantum Tax Calculation routine |
|
36 |
|
|
|
37 |
|
I/O Parameter Like Description |
|
38 |
|
------ ------------------- ------------- --------------------------- |
|
39 |
|
input tax_code tx2_tax_code Tax Code |
|
40 |
|
input tax_round txed_round Rounding Method |
|
41 |
|
input rndmthd rnd_rnd_mthd Rounding Method |
|
42 |
|
input tax_by_line tx2_by_line Tax By Line |
|
43 |
|
input amt_curr tx2d_curr Tax Currency |
|
44 |
|
input tax_in sod_tax_in Tax Included |
|
45 |
|
input entity en_entity Entity |
|
46 |
|
input entity_exrate exr_rate Exchange Rate |
|
47 |
|
input exrate exr_rate |
|
48 |
|
input tr_type tx2d_tr_type Tax Transaction Type |
|
49 |
|
input ref tx2d_ref Document Reference |
|
50 |
|
input nbr tx2d_nbr Second Reference |
|
51 |
|
input line tx2d_line Line Number |
|
52 |
|
input trlr_code tx2d_trl Trailer_code |
|
53 |
|
input tax_line tx2d_line Tax Line Number |
|
54 |
|
input tax_date tx2d_effdate Tax Rate Effective date |
|
55 |
|
input tax_post_date tx2d_effdate GL Posted Date |
|
56 |
|
input adj_factor mfc_decimal Adjustment Factor |
|
57 |
|
input company-code en_entity Company Code |
|
58 |
|
input divn-code sod_site Division Code |
|
59 |
|
input cmvd-addr ad_addr Customer Id |
|
60 |
|
input cmvd-taxclass ad_taxc Customer Tax Class |
|
61 |
|
input shipfrom-taxzone ad_tax_zone Ship-from Tax Zone |
|
62 |
|
input shipto-taxzone ad_tax_zone Ship-to Tax Zone |
|
63 |
|
input orderaccept-taxzone ad_tax_zone Order Acceptance Tax Zone |
|
64 |
|
input shipfrom-incity mfc_logical Ship-from Incity indicator |
|
65 |
|
input shipto-incity mfc_logical Ship-to Incity indicator |
|
66 |
|
input orderaccept-incity mfc_logical Ord Accept Incity indicator |
|
67 |
|
input lineitem-qty sod_qty_ord Line Item Quantity |
|
68 |
|
input taxc tx2_pt_taxc Item Tax Class |
|
69 |
|
input first-taxtype mfc_logical First Tax Type |
|
70 |
|
input taxable so_taxable Taxable |
|
71 |
|
input vq-post mfc_logical Quantum Register Post flag |
|
72 |
|
input vq-exch-rate exr_rate Exch Rate: Trans Curr - USD |
|
73 |
|
input vq-exch-rate2 exr_rate2 Exch Rate: Trans Curr - USD |
|
74 |
|
input vq-rndmthd cu_rnd_mthd Rounding Method:Trans Curr- US |
|
75 |
|
output result-status integer Result Status |
|
76 |
|
input-output tot_amt tx2d_totamt Extended Amount |
|
77 |
|
output taxes tx2d_totamt Taxes |
|
78 |
|
output adj_amt tx2d_totamt Taxable Base Amount |
|
79 |
|
output recoverable tx2d_totamt Taxable Base Amount |
|
80 |
|
output tax_base_amt tx2d_totamt Taxable Base Amount |
|
81 |
|
output ntax_amt tx2d_totamt Non-Taxable Amount |
|
82 |
|
|
|
83 |
|
*/ |
|
84 |
|
/*! |
|
85 |
|
NOTE: ANY CHANGES MADE TO THIS PROGRAM SHOULD ALSO BE MADE TO |
|
86 |
|
all TXMETH*.P PROGRAMS |
|
87 |
|
*/ |
|
88 |
|
/***************************************************************************/ |
|
89 |
|
{us/bbi/mfdeclre.i} |
|
90 |
|
{us/cx/cxcustom.i "TXMETH20.P"} |
|
91 |
|
|
|
92 |
|
define input parameter tax_code like tx2_tax_code no-undo. |
|
93 |
|
define input parameter tax_round like txed_round no-undo. |
|
94 |
|
define input parameter rndmthd like rnd_rnd_mthd no-undo. |
|
95 |
|
define input parameter tax_by_line like tx2_by_line no-undo. |
|
96 |
|
define input parameter amt_curr like tx2d_curr no-undo. |
|
97 |
|
define input parameter tax_in like sod_tax_in no-undo. |
|
98 |
|
define input parameter entity like en_entity no-undo. |
|
99 |
|
define input parameter entity_exrate like exr_rate no-undo. |
|
100 |
|
define input parameter exrate like exr_rate no-undo. |
|
101 |
|
define input parameter tr_type like tx2d_tr_type no-undo. |
|
102 |
|
define input parameter ref like tx2d_ref no-undo. |
|
103 |
|
define input parameter nbr like tx2d_nbr no-undo. |
|
104 |
|
define input parameter line like tx2d_line no-undo. |
|
105 |
|
define input parameter trlr_code like tx2d_trl no-undo. |
|
106 |
|
define input parameter tax_line like tx2d_line no-undo. |
|
107 |
|
define input parameter tax_date like tx2d_effdate no-undo. |
|
108 |
|
define input parameter tax_post_date like tx2d_effdate no-undo. |
|
109 |
|
define input parameter adj_factor like mfc_decimal no-undo. |
|
110 |
|
define input parameter company-code as character no-undo. |
|
111 |
|
define input parameter divn-code as character no-undo. |
|
112 |
|
define input parameter cmvd-addr as character no-undo. |
|
113 |
|
define input parameter cmvd-taxclass as character no-undo. |
|
114 |
|
define input parameter shipfrom-taxzone as character no-undo. |
|
115 |
|
define input parameter shipto-taxzone as character no-undo. |
|
116 |
|
define input parameter orderaccept-taxzone as character no-undo. |
|
117 |
|
define input parameter shipfrom-incity as logical no-undo. |
|
118 |
|
define input parameter shipto-incity as logical no-undo. |
|
119 |
|
define input parameter orderaccept-incity as logical no-undo. |
|
120 |
|
define input parameter lineitem-qty like mfc_decimal no-undo. |
|
121 |
|
define input parameter taxc like tx2_pt_taxc no-undo. |
|
122 |
|
define input parameter first-taxtype as logical no-undo. |
|
123 |
|
define input parameter taxable like so_taxable no-undo. |
|
124 |
|
define input parameter vq-post as logical no-undo. |
|
125 |
|
define input parameter vq-exch-rate like exr_rate no-undo. |
|
126 |
|
define input parameter vq-exch-rate2 like exr_rate2 no-undo. |
|
127 |
|
define input parameter vq-rndmthd like cu_rnd_mthd no-undo. |
|
128 |
|
define output parameter result-status as integer no-undo. |
|
129 |
|
define input-output parameter tot_amt like tx2d_totamt no-undo. |
|
130 |
|
define output parameter taxes like tx2d_totamt no-undo. |
|
131 |
|
define output parameter adj_amt like tx2d_totamt no-undo. |
|
132 |
|
define output parameter recoverable like tx2d_totamt no-undo. |
|
133 |
|
define output parameter tax_base_amt like tx2d_totamt no-undo. |
|
134 |
|
define output parameter ntax_amt like tx2d_totamt no-undo. |
|
135 |
|
|
|
136 |
|
define variable mc-error-number like msg_nbr no-undo. |
|
137 |
|
|
|
138 |
|
/* DEFINE VARIABLES TO HOLD THE EXTENDED AMOUNT, TAXES AND */ |
|
139 |
|
/* NON-TAX AMOUNT IN US DOLLARS. THIS IS BECAUSE QUANTUM CAN */ |
|
140 |
|
/* CALCULATE TAXES IN US DOLLARS ONLY. WE ARE CONVERTING TOT-AMT */ |
|
141 |
|
/* TO US DOLLARS BEFORE CALLING QUANTUM TO CALCULATE TAXES AND */ |
|
142 |
|
/* CONVERTING TOT-AMT, TAXES AND NON-TAX AMOUNTS BACK TO */ |
|
143 |
|
/* TRANSACTION CURRENCY FROM US DOLLARS */ |
|
144 |
|
|
|
145 |
|
define variable vq-tot-amt like tx2d_totamt no-undo. |
|
146 |
|
define variable vq-taxes like tx2d_totamt no-undo. |
|
147 |
|
define variable vq-ntax-amt like tx2d_totamt no-undo. |
|
148 |
|
|
|
149 |
|
/* INCLUDE VQ WORKFILE HERE. THIS FILE HAS A FEW VARIABLE(S) */ |
|
150 |
|
/* DEFINED THAT WILL ENSURE CALLING OF THE QUANTUM API ONLY ONCE */ |
|
151 |
|
/* FOR A DOCUMENT. IT HAS A TEMP-TABLE DEFINITION THAT WILL HOLD */ |
|
152 |
|
/* ALL THE LINE ITEM, TAX TYPE INFORMATION AND WILL CALL */ |
|
153 |
|
/* VQTXCALC.P AFTER THE LAST LINE ITEM IN A FOR EACH ... LOOP */ |
|
154 |
|
/* IS PROCESSED. */ |
|
155 |
|
|
|
156 |
|
{us/vq/vqwrkdef.i} |
|
157 |
|
|
|
158 |
|
/*d3465* start added code >>>> */ |
|
159 |
|
def var vmessage as char. |
|
160 |
|
def var vqty as dec. |
|
161 |
|
def var vinv as log. |
|
162 |
|
|
|
163 |
|
vqty = 0. |
|
164 |
|
vinv = no. |
|
165 |
|
|
|
166 |
|
|
|
167 |
|
for first ih_hist no-lock |
|
168 |
|
where ih_domain = global_domain |
|
169 |
|
and ih_inv_nbr = ref, |
|
170 |
|
first idh_hist no-lock |
|
171 |
|
where idh_domain = global_domain |
|
172 |
|
and idh_inv_nbr = ih_inv_nbr |
|
173 |
|
and idh_line = line |
|
174 |
|
, |
|
175 |
|
first pt_mstr no-lock |
|
176 |
|
where pt_domain = global_domain |
|
177 |
|
and pt_part = idh_part: |
|
178 |
|
vinv = yes. |
|
179 |
|
vqty = idh_qty_inv * idh_um_conv * pt_size * pt__dec01. |
|
180 |
|
end. |
|
181 |
|
|
|
182 |
|
if not vinv |
|
183 |
|
or vqty = ? |
|
184 |
|
then do: |
|
185 |
|
for first so_mstr no-lock |
|
186 |
|
where so_domain = global_domain |
|
187 |
|
and so_nbr = nbr, |
|
188 |
|
first sod_det no-lock |
|
189 |
|
where sod_domain = global_domain |
|
190 |
|
and sod_nbr = so_nbr |
|
191 |
|
and sod_line = line, |
|
192 |
|
first pt_mstr no-lock |
|
193 |
|
where pt_domain = global_domain |
|
194 |
|
and pt_part = sod_part: |
|
195 |
|
vqty = sod_qty_ord * sod_um_conv * pt_size * pt__dec01. |
|
196 |
|
end. |
|
197 |
|
end. |
|
198 |
|
if vqty = ? then vqty = 0. |
|
199 |
|
|
|
200 |
|
/*d3465* End added code <<<<<< */ |
|
201 |
|
|
|
202 |
|
if taxable |
|
203 |
|
then do: |
|
204 |
|
|
|
205 |
|
/* FIND TAX RATE MASTER */ |
|
206 |
|
|
|
207 |
|
for first tx2_mstr |
|
208 |
|
fields(tx2_domain tx2_apr_use tx2_ara_use tx2_pct_recv tx2_tax_code |
|
209 |
|
tx2_tax_pct tx2_tax_type) |
|
210 |
|
where tx2_mstr.tx2_domain = global_domain and tx2_tax_code = tax_code |
|
211 |
|
no-lock: |
|
212 |
|
end. /* FOR FIRST tx2_mstr */ |
|
213 |
|
|
|
214 |
|
if not available(tx2_mstr) |
|
215 |
|
then do: |
|
216 |
|
/* TAX MASTER DOES NOT EXIST */ |
|
217 |
|
{us/bbi/pxmsg.i &MSGNUM=872 &ERRORLEVEL=4} |
|
218 |
|
end. /* IF NOT AVAILABLE(tx2_mstr) */ |
|
219 |
|
|
|
220 |
|
/* CHECK TAX INCLUDED */ |
|
221 |
|
if tax_in |
|
222 |
|
then |
|
223 |
|
tot_amt = (tot_amt * 100)/(100 + tx2_tax_pct). |
|
224 |
|
|
|
225 |
|
/*d3465*/ tot_amt = vqty. |
|
226 |
|
end. /* IF taxable */ |
|
227 |
|
|
|
228 |
|
assign |
|
229 |
|
taxes = 0 |
|
230 |
|
ntax_amt = 0 |
|
231 |
|
tax_base_amt = tot_amt |
|
232 |
|
vq-tot-amt = tot_amt. |
|
233 |
|
|
|
234 |
|
/* NEED US CURRENCY CODE FOR MC-CURR-CONV */ |
|
235 |
|
for first mfc_ctrl |
|
236 |
|
fields(mfc_domain mfc_module mfc_field mfc_char) |
|
237 |
|
where mfc_ctrl.mfc_domain = global_domain |
|
238 |
|
and mfc_module = "vq" |
|
239 |
|
and mfc_field = "vqc_us_curr" |
|
240 |
|
no-lock: |
|
241 |
|
end. /* FOR FIRST mfc_ctrl */ |
|
242 |
|
|
|
243 |
|
if available mfc_ctrl |
|
244 |
|
then do: |
|
245 |
|
|
|
246 |
|
/* DO NOT CONVERT THE AMOUNTS PASSED TO AND FROM VERTEX */ |
|
247 |
|
/* FOR TAX CALCULATION PURPOSES. */ |
|
248 |
|
|
|
249 |
|
assign |
|
250 |
|
vq-taxes = 0 |
|
251 |
|
vq-ntax-amt = 0. |
|
252 |
|
|
|
253 |
|
/* CALL QUANTUM TO CALCULATE TAXES */ |
|
254 |
|
|
|
255 |
|
/* CREATE TEMP FILE AND STORE ALL THE VALUES IN IT. WHEN WE ARE */ |
|
256 |
|
/* DONE PROCESSING THE LAST TAX TYPE OF THE LAST LINE, WE WILL */ |
|
257 |
|
/* CALL VQTXCALC.P SO THAT QUANTUM API WILL BE CALLED ONLY ONCE */ |
|
258 |
|
/* TO CALCULATE TAXES FOR THE ENTIRE DOCUMENT. THIS APPROACH IS */ |
|
259 |
|
/* EXPECTED TO REDUCE PROCESSING TIME SIGNIFICANTLY. */ |
|
260 |
|
|
|
261 |
|
/* WE ARE FORCING THE LINE NUMBERS SINCE TR-TYPE = 18 HAS JUST ONE LINE */ |
|
262 |
|
/* WITH THE LINE NUMBER AS ZERO . IN THE CASE OF MULTIPLE LINE ITEMS, */ |
|
263 |
|
/* QUANTUM CANNOT DISTINGUISH BETWEEN LINES */ |
|
264 |
|
|
|
265 |
|
if tr_type = "18" |
|
266 |
|
then |
|
267 |
|
assign |
|
268 |
|
line-ctr = line-ctr + 1 |
|
269 |
|
line = line-ctr. |
|
270 |
|
|
|
271 |
|
if taxable |
|
272 |
|
or (not vq-post |
|
273 |
|
and not taxable) |
|
274 |
|
then do: |
|
275 |
|
|
|
276 |
|
create temp_file. |
|
277 |
|
assign |
|
278 |
|
temp_nbr = nbr |
|
279 |
|
temp_tax_code = tax_code |
|
280 |
|
temp_tax_round = tax_round |
|
281 |
|
temp_rndmthd = rndmthd |
|
282 |
|
temp_tax_by_line = tax_by_line |
|
283 |
|
temp_entity_exrate = temp_entity_exrate |
|
284 |
|
temp_exrate = exrate |
|
285 |
|
temp_tax_curr = amt_curr |
|
286 |
|
temp_tax_in = tax_in |
|
287 |
|
temp_trlr_code = trlr_code |
|
288 |
|
temp_tax_line = tax_line |
|
289 |
|
temp_adj_factor = adj_factor |
|
290 |
|
temp_vq_exch_rate = vq-exch-rate |
|
291 |
|
temp_vq_rndmthd = vq-rndmthd |
|
292 |
|
temp_line = line |
|
293 |
|
temp_divn_code = divn-code |
|
294 |
|
temp_cmvd_addr = cmvd-addr |
|
295 |
|
temp_cmvd_taxclass = cmvd-taxclass |
|
296 |
|
temp_tax_date = tax_date |
|
297 |
|
temp_posted_date = tax_post_date |
|
298 |
|
temp_shipfrom_taxzone = shipfrom-taxzone |
|
299 |
|
temp_shipto_taxzone = shipto-taxzone |
|
300 |
|
temp_orderaccept_taxzone = orderaccept-taxzone |
|
301 |
|
temp_shipfrom_incity = shipfrom-incity |
|
302 |
|
temp_shipto_incity = shipto-incity |
|
303 |
|
temp_orderaccept_incity = orderaccept-incity |
|
304 |
|
temp_lineitem_qty = lineitem-qty |
|
305 |
|
temp_taxc = taxc |
|
306 |
|
temp_tax_type = tx2_tax_type |
|
307 |
|
temp_tot_amt = tot_amt. |
|
308 |
|
|
|
309 |
|
/* TO SATISFY ORACLE STANDARDS ... */ |
|
310 |
|
if recid(temp_file) = -1 |
|
311 |
|
then . |
|
312 |
|
|
|
313 |
|
end. /* IF taxable OR (NOT vq-post ...) */ |
|
314 |
|
|
|
315 |
|
/* CALL VQTXCALC.P ONLY WHEN WE ARE PROCESSING THE LAST LINE, */ |
|
316 |
|
/* THE LAST TAX TYPE */ |
|
317 |
|
if (last-line and last-taxtype) |
|
318 |
|
then do: |
|
319 |
|
{us/bbi/gprun.i ""vqtxcalc.p"" |
|
320 |
|
"(input company-code, |
|
321 |
|
input entity, |
|
322 |
|
input tr_type, |
|
323 |
|
input ref, |
|
324 |
|
input nbr, |
|
325 |
|
input vq-post, |
|
326 |
|
input first-taxtype)"} |
|
327 |
|
/* WE ARE DONE. SO INITIALIZE THE VALUES BACK TO 'NO'. */ |
|
328 |
|
assign |
|
329 |
|
last-line = no |
|
330 |
|
last-taxtype = no. |
|
331 |
|
end. /* IF last-line and last-taxtype ... */ |
|
332 |
|
|
|
333 |
|
end. /* IF AVAILABLE MFC_CTRL */ |