List of commits:
Subject Hash Author Date (UTC)
Update repos preparing for conversion to git 57c3a6aa7481d0ed4ba0056901275c6936764011 gbg 2018-10-16 23:24:27
d3519 4a99fb0eb70588d54909c5e2c8f146cd62e93fed ec2-user 2016-11-04 03:07:05
d3519 e2b6bc17057791df33c0cfbe97ec1f1e3bcba61a ec2-user 2016-10-25 22:25:36
d3519a 142df02c3ff1b60ec980ec11c36d670f8a322505 ec2-user 2016-10-24 21:56:49
d3519 1e2da81f00b62d82e48aa794bef0c01346c6f98e ec2-user 2016-08-28 23:26:18
d3519 68c6c12487853024255c7dabb46b7bf9ab3a4ec1 ec2-user 2016-08-12 04:01:41
d3519 9ea103181b3b1b3cd968d74c760b9160c8e8c19b ec2-user 2016-07-04 04:10:08
d3519 798474e6cd496ee0daf09776fd070f827e3530bd ec2-user 2016-06-21 08:35:24
d3519 3b19d9578118bec562b2868f702b516c1a95cf1a ec2-user 2016-06-16 23:03:47
c1580 5efbfe70f325ed37582eba8fb8fd609e6e3e42a4 ec2-user 2016-05-31 03:38:23
d3465 5e92f8eb00d4c5e131183741c0b48440a59c41e6 ec2-user 2016-04-27 23:41:43
d3465 7999587f92b8a864f4cbc40a90179ff8e6241281 ec2-user 2016-04-27 04:51:23
d3224 99525a3628e13b692e354b3b6539ee1cc3b83d69 ec2-user 2015-08-25 02:27:35
d3224 f9c625d1ec21fbc36e1299ce6e8fcf59d280a9b3 ec2-user 2015-08-21 01:49:30
d3224 8adf5a92615a52d09e92e82dcb8fb680fba09b1c ec2-user 2015-08-19 02:25:31
c1485 54031cfe6e8c2ba4cdb833be90ffc01ebdf14b07 nac 2015-01-23 01:53:56
c1485b a1a2692751a6743d6f68f6eac84f2b026ebb9307 nac 2014-12-09 05:28:32
c1485 4b886da89f1d50501a37d678c8676a485d47f0c1 nac 2014-12-09 05:27:38
c1485 9b651808f47eccc51a50aebd85c9f59c3c9d1697 gbg 2014-09-17 04:43:53
c1485 7edc5474ef79faad54c8f0ea7ea401d3fe0ee412 gbg 2014-09-17 04:40:17
Commit 57c3a6aa7481d0ed4ba0056901275c6936764011 - Update repos preparing for conversion to git
Author: gbg
Author date (UTC): 2018-10-16 23:24
Committer name: gbg
Committer date (UTC): 2018-10-16 23:24
Parent(s): 4a99fb0eb70588d54909c5e2c8f146cd62e93fed
Signing key:
Tree: 5a01692724b7b33bdd40d8a40b390f10eba96191
File Lines added Lines deleted
mfg/2013/base/src/QAD_TrialBalance.p 550 0
mfg/2013/base/src/so10e01.i 121 0
mfg/2013/base/src/solcal1.p 506 0
mfg/2013/base/src/sopkall.i 196 0
mfg/2013/base/src/sosoall.i 180 0
mfg/2013/base/src/sosoall.p 311 0
mfg/2013/base/src/sosomtlb.p 2711 0
mfg/2013/base/src/xfivto98mx.i 0 0
mfg/2013/base/src/xxcds.i 190 0
mfg/2013/base/src/xxcdsa.p 32 0
File mfg/2013/base/src/QAD_TrialBalance.p added (mode: 100644) (index 0000000..b274125)
1 /* QAD_TrialBalance.p - Trial Balance Report - Reporting Framework */
2 /* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA. */
3 /* All rights reserved worldwide. This is an unpublished work. */
4 /*---------------------------------------------------------------------------*/
5 /* REVISION: 1.0 LAST MODIFIED: 20-MAY-2013 BY: gbg *c1407* */
6 /*---------------------------------------------------------------------------*/
7 /* Report matches gltbrp.p for use by QAD Reporting Framework */
8 /*---------------------------------------------------------------------------*/
9
10 {mfsubdirs.i}
11 {{&US_BBI}mfdeclre.i}
12 {{&US_BBI}gplabel.i}
13 {{&US_BBI}gpfieldv.i}
14 {{&US_BBI}gpfilev.i}
15
16 {etvar.i &new="new"}
17 {etrpvar.i &new="new"}
18
19
20
21 {com/qad/shell/report/dsReportRequest.i}
22 {com/qad/shell/report/ReportConstants.i}
23
24 /*============================================================================*/
25 /* **************************** TEMP TABLES ******************************* */
26 /*============================================================================*/
27
28 /* TEMP-TABLE DEFINITION BLOCK */
29
30
31
32 define temp-table ttTrialBalance no-undo
33 field AccountCode as char
34 field AccountName as char
35 field BalBegin as dec
36 field PrdActivity as dec
37 field BalEnd as dec
38 field AcctAdjust as dec
39 .
40
41 define temp-table ttReportOptions no-undo
42 field rptEnt as char
43 field rptEnt1 as char
44 field rptDateBegin as char
45 field rptEndDate as char
46 field rptSummCC as logical
47 field rptCurr as char
48 field rptZeroFlag as logical
49 field rpt1000 as logical
50 field rptRound as logical
51 field rptReportCurr as char
52 .
53
54
55 define dataset dsReportResults for ttTrialBalance, ttReportOptions.
56
57 {gltrbl01.i NEW}
58
59
60 /*============================================================================*/
61 /* ***************************** MAIN BLOCK ******************************* */
62 /*============================================================================*/
63 define input parameter runReport as logical no-undo.
64 define input parameter reportHandle as handle no-undo.
65 define input parameter dataset for dsReportRequest.
66 define output parameter dataset-handle phReportResults.
67
68 {com/qad/shell/report/reporting.i}
69 define variable bufferName as char no-undo.
70
71
72 empty temp-table tTrialBalance no-error.
73
74
75 for first ttReportRequest no-lock:
76
77 run FillMetaData.
78
79 if runReport then do:
80 run RunReport
81 (output dataset-handle phReportResults).
82 end.
83
84 end.
85
86
87
88 /*============================================================================*/
89 /* ************************* Internal Procedures ************************** */
90 /*============================================================================*/
91 PROCEDURE FillMetaData:
92
93 buffername = "ttTrialBalance".
94 run CreateBufferHeader in reportHandle
95 (buffername,
96 "Trial Balance").
97
98 run CreateField in reportHandle
99 (buffername,
100 "AccountCode",
101 "Account",
102 "character",
103 "x(16)",
104 "",
105 false,
106 true,
107 true,
108 false,
109 false,
110 false,
111 false,
112 "",
113 {&ParameterOperator_Equals},
114 {&ParameterValueType_Constant},
115 "",
116 {&ParameterValueType_Constant}).
117
118 run CreateField in reportHandle
119 (buffername,
120 "AccountName",
121 "Description",
122 "character",
123 "x(24)",
124 "",
125 false,
126 true,
127 true,
128 false,
129 false,
130 false,
131 false,
132 "",
133 {&ParameterOperator_Equals},
134 {&ParameterValueType_Constant},
135 "",
136 {&ParameterValueType_Constant}).
137
138 run CreateField in reportHandle
139 (buffername,
140 "BalBegin",
141 "Beginning Balance",
142 "decimal",
143 "->>>>>>>>9.99",
144 "",
145 false,
146 true,
147 true,
148 false,
149 false,
150 false,
151 false,
152 "",
153 {&ParameterOperator_Equals},
154 {&ParameterValueType_Constant},
155 "",
156 {&ParameterValueType_Constant}).
157
158 run CreateField in reportHandle
159 (buffername,
160 "PrdActivity",
161 "Activity",
162 "decimal",
163 "->>>>>>>>9.99",
164 "",
165 false,
166 true,
167 true,
168 false,
169 false,
170 false,
171 false,
172 "",
173 {&ParameterOperator_Equals},
174 {&ParameterValueType_Constant},
175 "",
176 {&ParameterValueType_Constant}).
177
178 run CreateField in reportHandle
179 (buffername,
180 "BalEnd",
181 "Ending balance",
182 "decimal",
183 "->>>>>>>>9.99",
184 "",
185 false,
186 true,
187 true,
188 false,
189 false,
190 false,
191 false,
192 "",
193 {&ParameterOperator_Equals},
194 {&ParameterValueType_Constant},
195 "",
196 {&ParameterValueType_Constant}).
197
198 run CreateField in reportHandle
199 (buffername,
200 "AcctAdjust",
201 "Account Adjustment",
202 "decimal",
203 "->>>>>>>>9.99",
204 "",
205 false,
206 true,
207 true,
208 false,
209 false,
210 false,
211 false,
212 "",
213 {&ParameterOperator_Equals},
214 {&ParameterValueType_Constant},
215 "",
216 {&ParameterValueType_Constant}).
217
218 buffername = "ttReportOptions".
219 run CreateBufferHeader in reportHandle
220 (buffername,
221 "Report Options").
222
223 run CreateField in reportHandle
224 (buffername,
225 "rptEnt",
226 "Entity From",
227 "character",
228 "x(4)",
229 "",
230 false,
231 true,
232 true,
233 false,
234 false,
235 false,
236 false,
237 "",
238 {&ParameterOperator_Equals},
239 {&ParameterValueType_Constant},
240 "",
241 {&ParameterValueType_Constant}).
242
243 run CreateField in reportHandle
244 (buffername,
245 "rptEnt1",
246 "Entity To",
247 "character",
248 "x(4)",
249 "",
250 false,
251 true,
252 true,
253 false,
254 false,
255 false,
256 false,
257 "",
258 {&ParameterOperator_Equals},
259 {&ParameterValueType_Constant},
260 "",
261 {&ParameterValueType_Constant}).
262
263 run CreateField in reportHandle
264 (buffername,
265 "rptDateBegin",
266 "Date from",
267 "character",
268 "99/99/99",
269 "",
270 false,
271 true,
272 true,
273 false,
274 false,
275 false,
276 false,
277 "",
278 {&ParameterOperator_Equals},
279 {&ParameterValueType_Constant},
280 "",
281 {&ParameterValueType_Constant}).
282
283 run CreateField in reportHandle
284 (buffername,
285 "rptDateEnd",
286 "Date to",
287 "character",
288 "99/99/99",
289 "",
290 false,
291 true,
292 true,
293 false,
294 false,
295 false,
296 false,
297 "",
298 {&ParameterOperator_Equals},
299 {&ParameterValueType_Constant},
300 "",
301 {&ParameterValueType_Constant}).
302
303 run CreateField in reportHandle
304 (buffername,
305 "rptSummCC",
306 "Summ By CC",
307 "character",
308 "x(1)",
309 "",
310 false,
311 true,
312 true,
313 false,
314 false,
315 false,
316 false,
317 "",
318 {&ParameterOperator_Equals},
319 {&ParameterValueType_Constant},
320 "",
321 {&ParameterValueType_Constant}).
322
323 run CreateField in reportHandle
324 (buffername,
325 "rptCurr",
326 "Currency",
327 "character",
328 "x(3)",
329 "",
330 false,
331 true,
332 true,
333 false,
334 false,
335 false,
336 false,
337 "",
338 {&ParameterOperator_Equals},
339 {&ParameterValueType_Constant},
340 "",
341 {&ParameterValueType_Constant}).
342
343 run CreateField in reportHandle
344 (buffername,
345 "rptZeroFlag",
346 "Suppress Zero",
347 "character",
348 "x(1)",
349 "",
350 false,
351 true,
352 true,
353 false,
354 false,
355 false,
356 false,
357 "",
358 {&ParameterOperator_Equals},
359 {&ParameterValueType_Constant},
360 "",
361 {&ParameterValueType_Constant}).
362
363 run CreateField in reportHandle
364 (buffername,
365 "rpt1000",
366 "Round to Thousands",
367 "character",
368 "x(1)",
369 "",
370 false,
371 true,
372 true,
373 false,
374 false,
375 false,
376 false,
377 "",
378 {&ParameterOperator_Equals},
379 {&ParameterValueType_Constant},
380 "",
381 {&ParameterValueType_Constant}).
382
383 run CreateField in reportHandle
384 (buffername,
385 "rptRound",
386 "Round To Nearest Unit",
387 "character",
388 "x(1)",
389 "",
390 false,
391 true,
392 true,
393 false,
394 false,
395 false,
396 false,
397 "",
398 {&ParameterOperator_Equals},
399 {&ParameterValueType_Constant},
400 "",
401 {&ParameterValueType_Constant}).
402
403 run CreateField in reportHandle
404 (buffername,
405 "rptReportCurr",
406 "Reporting Currency",
407 "character",
408 "x(3)",
409 "",
410 false,
411 true,
412 true,
413 false,
414 false,
415 false,
416 false,
417 "",
418 {&ParameterOperator_Equals},
419 {&ParameterValueType_Constant},
420 "",
421 {&ParameterValueType_Constant}).
422
423
424 END. /* PROCEDURE FillMetaData */
425
426
427 /******************************************************************************/
428 PROCEDURE RunReport:
429 define output parameter dataset-handle phReportResults.
430
431 define var stringVar as char.
432
433
434 /* get Report Options from input */
435 /* chars */
436 entity = GetFiltervalue("ttReportOptions", "rpEnt", "").
437 entity1 = GetFiltervalue("ttReportOptions", "rpEnt1", "").
438 rpt_curr = GetFiltervalue("ttReportOptions", "rptCurr", "").
439 et_report_curr = GetFiltervalue("ttReportOptions", "rptReportCurr", "").
440
441 /* logicals */
442 stringVar = getFilterValue("ttReportOptions", "rptSummCC", "n").
443 ccFlag = if stringVar begins "y" then true else false.
444 stringVar = getFilterValue("ttReportOptions", "rptZeroFlag", "n").
445 zeroflag = if stringVar begins "y" then true else false.
446 stringVar = getFilterValue("ttReportOptions", "rpt1000", "n").
447 prt1000 = if stringVar begins "y" then true else false.
448 stringVar = getFilterValue("ttReportOptions", "rptRound", "n").
449 round_cnts = if stringVar begins "y" then true else false.
450
451 /* dates */
452 stringVar = getFilterValue("ttReportOptions", "rptDateBegin", "").
453 begdt = date(stringVar) no-error.
454 stringVar = getFilterValue("ttReportOptions", "rptEndDate", "").
455 enddt = date(stringVar) no-error.
456
457 if begdt = ?
458 then do:
459 find last glc_cal no-lock
460 where glc_domain = global_domain
461 and glc_start <= today
462 no-error.
463 if available glc_cal
464 then do:
465 assign
466 begdt = glc_start.
467 end.
468 else do:
469 find last glc_cal no-lock
470 where glc_domain = global_domain
471 no-error.
472 if available glc_cal
473 then do:
474 assign
475 begdt = glc_start.
476 end.
477 end.
478 end.
479 if enddt = ?
480 then do:
481 find last glc_cal no-lock
482 where glc_domain = global_domain
483 and glc_start <= today
484 no-error.
485 if available glc_cal
486 then do:
487 assign
488 enddt = glc_end.
489 end.
490 else do:
491 find last glc_cal no-lock
492 where glc_domain = global_domain
493 no-error.
494 if available glc_cal
495 then do:
496 assign
497 enddt = glc_end.
498 end.
499 end.
500 end.
501
502
503 if rpt_curr = "" then rpt_curr = base_curr.
504 if et_report_curr = "" then et_report_curr = rpt_curr.
505
506 /* initialise dates from calendar */
507 find first glc_cal no-lock
508 where glc_domain = global_domain
509 and glc_start <= enddt
510 and glc_end >= begdt
511 no-error.
512 if available glc_cal
513 then do:
514 yr = glc_year.
515 find first glc_cal no-lock
516 where glc_domain = global_domain
517 and glc_year = yr
518 and glc_per = 1
519 no-error.
520 if available glc_cal
521 then do:
522 yr_beg = glc_start.
523 end.
524 find last glc_cal no-lock
525 where glc_domain = global_domain
526 and glc_year = yr
527 no-error.
528 if available glc_cal
529 then do:
530 yr_end = glc_end.
531 end.
532 end.
533
534
535
536
537 /* Run the Trial Balance Report */
538 {gprun.i ""gltrbl01.p""}
539
540
541 /* Copy the data to the Result Dataset */
542 for each tTrialBalance:
543 create ttTrialBalance.
544 buffer-copy tTrialBalance to ttTrialBalance.
545 end.
546
547 phReportResults = dataset dsReportResults:handle.
548
549
550 END. /* Procedure runreport */
File mfg/2013/base/src/so10e01.i added (mode: 100644) (index 0000000..3bcc11a)
1 /* so10e01.i - DEFINE FRAME FOR INVOICE LINE ITEM INFORMATION */
2 /* Copyright 1986 QAD Inc. All rights reserved. */
3 /* $Id$: */
4 /*so10e01.i INVOICE PRINT include file */
5 /* REVISION: 5.0 LAST MODIFIED: 03/12/89 BY: MLB *B615 */
6 /* REVISION: 6.0 LAST MODIFIED: 07/05/90 BY: WUG *D043* */
7 /* REVISION: 8.5 LAST MODIFIED: 08/31/95 BY: taf *J053* */
8 /* REVISION: 8.5 LAST MODIFIED: 06/26/96 BY: *J0WF* Sue Poland */
9 /* REVISION: 8.5 LAST MODIFIED: 08/16/96 BY: *G29K* Markus Barone */
10 /* REVISION: 8.6E LAST MODIFIED: 02/23/98 BY: *L007* A. Rahane */
11 /* REVISION: 8.6E LAST MODIFIED: 04/23/98 BY: *L00L* EvdGevel */
12 /* REVISION: 8.6E LAST MODIFIED: 05/20/98 BY: *K1Q4* Alfred Tan */
13 /* REVISION: 8.6E LAST MODIFIED: 06/04/98 BY: *L01M* Jean Miller */
14 /* REVISION: 9.0 LAST MODIFIED: 11/20/98 BY: *J33Y* Poonam Bahl */
15 /* REVISION: 9.0 LAST MODIFIED: 03/13/99 BY: *M0BD* Alfred Tan */
16 /* REVISION: 9.1 LAST MODIFIED: 10/07/99 BY: *K23H* Sachin Shinde */
17 /* REVISION: 9.1 LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
18 /* REVISION: 9.1 LAST MODIFIED: 05/02/00 BY: *L0X1* Veena Lad */
19 /* REVISION: 9.1 LAST MODIFIED: 08/12/00 BY: *N0JM* Mudit Mehta */
20 /* REVISION: 9.1 LAST MODIFIED: 08/25/00 BY: *N0P0* Arul Victoria */
21 /* Old ECO marker removed, but no ECO header exists *F0PN* */
22 /* Revision: 1.19 BY: Jean Miller DATE: 04/16/02 ECO: *P05S* */
23 /* Revision: 1.20 BY: Amit Chaturvedi DATE: 01/20/03 ECO: *N20Y* */
24 /* Revision: 1.21 BY: Narathip W. DATE: 05/13/03 ECO: *P0RT* */
25 /* Revision: 1.23 BY: Katie Hilbert DATE: 06/08/06 ECO: *Q0LK* */
26 /* Revision: 1.24 BY: Xiaolei Meng DATE: 07/31/09 ECO: *R1N2* */
27 /* $Revision$ BY: Jean Miller DATE: 11/23/09 ECO: *R1TW* */
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 /* THE TRANSLATED TEXT SHOULD BE THE SAME SIZE IF POSSIBLE*/
36 /* THIS INCLUDE FILE IS CALLED BY sorp1a01.p */
37 /* INVOICE REPRINT, ANY CHANGES MADE HERE WILL BE NEEDED IN SOIVRP1A.P */
38
39 /* FOR CALL INVOICES, WE DON'T ALWAYS PRINT THE PRICE BECAUSE, */
40 /* WHEN IT'S NOT A 'FIXED PRICE REPAIR' (MEANING WHENEVER PART */
41 /* NUMBER X GETS FIXED, IT COSTS $100, FOR EXAMPLE), SOD_PRICE IS */
42 /* THE TOTAL OF ALL LABOR/EXPENSES/PARTS USED IN THE REPAIR LESS */
43 /* EXCHANGE CREDITS, LESS CONTRACT COVERAGE. AND, THAT PRICE IS */
44 /* FOR THE FULL QUANTITY OF PARTS REPAIRED - IT'S NOT A UNIT PRICE */
45 /* SO, IT DOESN'T MAKE SENSE TO PRINT IT THAT WAY. HOWEVER, WHEN */
46 /* FIXED PRICE REPAIRS ARE BEING INVOICED, THE GROSS FIXED PRICE */
47 /* DOES PRINT IN THE 'PRICE' COLUMN. THE NET PRICE DISPLAYED IS */
48 /* NET OF ANY EXCHANGE CREDIT GIVEN. */
49
50 /* ALSO, FOR CALL INVOICES, AS WE DON'T REALLY 'SHIP' ANYTHING, */
51 /* THE QUANTITY OF INTEREST IS THE QUANTITY REPAIRED ON THE CALL */
52 /* LINE. THEREFORE, PRINT THAT INSTEAD OF QTY TO INVOICE AND */
53 /* PRINT NO BACKORDER QUANTITY (BECAUSE THERE ISN'T ANY). */
54
55 if sod_fsm_type <> "FSM-RO"
56 then
57 assign
58 ext_price:label in frame d = getTermLabel("EXTENDED_PRICE",16)
59 ext_price:label in frame dent = getTermLabel("EXTENDED_PRICE",16).
60 else
61 assign
62 ext_price:label in frame d = getTermLabel("NET_PRICE",16)
63 ext_price:label in frame dent = getTermLabel("NET_PRICE",16).
64
65 if so_app_owner = 'DOM'
66 then do:
67 display
68 sod_part @ ent_ord_line_part
69 sod_um @ ent_ord_line_uom
70 sod_qty_inv
71 qty_bo
72 sod_taxable
73 sod_price
74 ext_price when (not auth_found)
75 "" when (auth_found) @ ext_price
76 with frame dent.
77
78 /* Only display the Enterprise Item data if the item id or uom are different */
79 /* from the MFG/PRO values. Otherwise it would just be duplicate information */
80 if (ent_ord_line_part <> sod_part) or
81 (ent_ord_line_uom <> sod_um)
82 then do:
83 down 1 with frame dent.
84
85 display
86 ent_ord_line_part
87 ent_ord_line_uom
88 (sod_qty_inv * conversion_factor) @ sod_qty_inv format "->>>>>>9.9<<<<<"
89 (qty_bo * conversion_factor) @ qty_bo format "->>>>>>9.9<<<<"
90 "" @ sod_taxable
91 "" @ sod_price
92 "" @ ext_price
93 with frame dent.
94 end. /* if so_app_owner = 'DOM' */
95
96 if vdPrintWidth = 0.0 then
97 vdPrintWidth = frame dent:width-chars.
98 end.
99
100 else do:
101 display
102 sod_part
103 sod_um
104 sod_qty_inv format "->>>>>>9.9<<<<<" when (sod_fsm_type <> "FSM-RO")
105 itm_qty_call when (sod_fsm_type = "FSM-RO"
106 and available itm_det) @ sod_qty_inv
107 format "->>>>>>9.9<<<<<"
108 qty_bo column-label "Backorder" when (sod_fsm_type <> "FSM-RO")
109 sod_taxable
110 sod_price when (sod_fsm_type <> "FSM-RO"
111 or (sod_fsm_type = "FSM-RO"
112 and sod_fix_pr = no))
113 sod_fixed_price when (sod_fsm_type = "FSM-RO"
114 and sod_fix_pr) @ sod_price
115 ext_price when (not auth_found)
116 "" when (auth_found) @ ext_price
117 with frame d.
118
119 if vdPrintWidth = 0.0 then
120 vdPrintWidth = frame d:width-chars.
121 end. /* IF NOT et_dc_print THEN */
File mfg/2013/base/src/solcal1.p added (mode: 100644) (index 0000000..7e24410)
1 /* solcal1.p - SALES ORDER LOCATION ALLOCATION DETAIL WITH INPUT PARAMETERS */
2 /* Copyright 1986 QAD Inc. All rights reserved. */
3 /* $Id$: */
4 /* REVISION: 7.2 LAST MODIFIED: 08/26/94 BY: dpm *FQ53**/
5 /* REVISION: 7.2 LAST MODIFIED: 10/21/94 BY: rmh *FQ08**/
6 /* REVISION: 7.2 LAST MODIFIED: 11/09/94 BY: ljm *FT51**/
7 /* REVISION: 7.2 LAST MODIFIED: 12/29/94 BY: jpm *F0C5**/
8 /* REVISION: 7.3 LAST MODIFIED: 10/17/95 BY: ais *G0ZP**/
9 /* REVISION: 7.2 LAST MODIFIED: 12/08/95 BY: ais *F0WJ**/
10 /* REVISION: 8.5 LAST MODIFIED: 03/04/96 BY: *J04C* Markus Barone */
11 /* REVISION: 8.5 LAST MODIFIED: 10/08/96 BY: *J15V* Sue Poland */
12 /* REVISION: 8.5 LAST MODIFIED: 09/09/97 BY: *H1F2* Todd Runkle */
13 /* REVISION: 8.6E LAST MODIFIED: 07/08/99 BY: *J3HS* Anup Pereira */
14 /* REVISION: 9.1 LAST MODIFIED: 04/25/00 BY: *N0CF* Santosh Rao */
15 /* REVISION: 9.1 LAST MODIFIED: 07/03/00 BY: *N0DX* Rajinder Kamra */
16 /* REVISION: 8.6E LAST MODIFIED: 02/23/98 BY: *L007* A. Rahane */
17 /* REVISION: 8.6E LAST MODIFIED: 05/20/98 BY: *K1Q4* Alfred Tan */
18 /* REVISION: 8.6E LAST MODIFIED: 10/04/98 BY: *J314* Alfred Tan */
19 /* REVISION: 9.1 LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
20 /* REVISION: 9.1 LAST MODIFIED: 08/12/00 BY: *N0KN* Mark Brown */
21 /* REVISION: 9.1 LAST MODIFIED: 10/14/00 BY: *N0WB* Mudit Mehta */
22 /* Old ECO marker removed, but no ECO header exists *F0PN* */
23 /* Revision: 1.8.2.10 BY: Russ Witt DATE: 06/01/01 ECO: *P00J* */
24 /* Revision: 1.8.2.10 BY: Seema Tyagi DATE: 06/01/01 ECO: *M19H* */
25 /* Revision: 1.8.2.11 BY: Hareesh V DATE: 10/22/01 ECO: *P027* */
26 /* Revision: 1.8.2.12 BY: Anitha Gopal DATE: 05/08/02 ECO: *N1J1* */
27 /* Revision: 1.8.2.14 BY: Jean Miller DATE: 05/23/02 ECO: *P074* */
28 /* Revision: 1.8.2.15 BY: Anitha Gopal DATE: 04/08/03 ECO: *N2CK* */
29 /* Revision: 1.8.2.17 BY: Paul Donnelly (SB) DATE: 06/28/03 ECO: *Q00L* */
30 /* Revision: 1.8.2.18 BY: Ed van de Gevel DATE: 18/03/05 ECO: *R00F* */
31 /* Revision: 1.8.2.19 BY: Shilpa Kamath DATE: 06/12/06 ECO: *R05X* */
32 /* Revision: 1.8.2.20 BY: Antony LejoS DATE: 05/02/07 ECO: *P5SP* */
33 /* Revision: 1.8.2.21 BY: Jean Miller DATE: 06/21/08 ECO: *R0VG* */
34 /* $Revision$ BY: Rajalaxmi Ganji DATE: 12/17/08 ECO: *Q22R* */
35 /* BUDERIM GINGER 2013SE LAST MODIFIED: 11-AUG-2017 BY: nac *d3873 */
36 /*-Revision end---------------------------------------------------------------*/
37
38 /******************************************************************************/
39 /* All patch markers and commented out code have been removed from the source */
40 /* code below. For all future modifications to this file, any code which is */
41 /* no longer required should be deleted and no in-line patch markers should */
42 /* be added. The ECO marker should only be included in the Revision History. */
43 /******************************************************************************/
44 /*!
45 This routine is same as solcal.p, the difference is solcal.p has parameters
46 and there is no find for sod_det record. The values of sod_det record
47 are in the Input parameters , as sod_det is not created at the remote site
48 at this point, when this routine is used in Multiple Database Env.
49
50 This routine outputs the Total Qty allocated.
51 */
52
53 {us/bbi/mfdeclre.i}
54 {us/bbi/gplabel.i} /* EXTERNAL LABEL INCLUDE */
55 {us/px/pxmaint.i}
56 {us/px/pxphdef.i ppitxr}
57
58 /* Input parameters */
59 define input parameter site like sod_site.
60 define input parameter sodnbr like sod_nbr.
61 define input parameter line like sod_line.
62 define input parameter part like sod_part.
63 define input parameter um_conv like sod_um_conv.
64 define input parameter loc like sod_loc.
65 define input parameter serial like sod_serial.
66 define input parameter qty_ord like sod_qty_ord.
67 define input parameter qty_all like sod_qty_all.
68 define input parameter qty_pick like sod_qty_pick.
69 define input parameter qty_ship like sod_qty_ship.
70 define input parameter duedate as date.
71 define input-output parameter totallqty like sod_qty_all.
72
73 define shared variable window_recid as recid.
74
75 /* Local variables */
76 define variable del-yn like mfc_logical.
77 define variable yn like mfc_logical.
78 define variable ret-flag as integer no-undo.
79 define variable rl-loc like locc_loc no-undo.
80 define variable msg-arg as character format "x(16)" no-undo.
81 define variable l_pt_lot_ser as character no-undo.
82 define shared variable corr_inv like mfc_logical no-undo.
83 define variable l_det_view like mfc_logical initial yes no-undo.
84
85 /*d3873*/ define variable xx_cpexpire as integer.
86
87 for first pt_mstr
88 fields( pt_domain pt_lot_ser pt_part pt_sngl_lot pt_um)
89 where pt_mstr.pt_domain = global_domain and pt_part = part
90 no-lock: end.
91
92 loopb0:
93 repeat with frame alloc:
94
95 form
96 lad_loc at 2
97 lad_lot
98 lad_ref format "x(8)" column-label "Ref"
99 lad_qty_all format "->,>>>,>>9.9<<<<<<"
100 with frame alloc centered row 9 overlay 8 down width 60
101 title color normal (getFrameTitle("SITE:",14)) + site +
102 " " + getTermLabel("ALLOCATION_DETAIL",20) + ": "
103 + pt_um + " ".
104
105 /* SET EXTERNAL LABELS */
106 setFrameLabels(frame alloc:handle).
107
108 /* TO DISPLAY DETAIL ALLOCATION INITIALY */
109 if l_det_view
110 then do:
111 for each lad_det no-lock
112 where lad_domain = global_domain
113 and lad_dataset = "sod_det"
114 and lad_nbr = sodnbr
115 and lad_line = string(line)
116 with frame alloc:
117
118 display
119 lad_loc
120 lad_lot
121 lad_ref
122 lad_qty_all
123 lad_qty_all.
124 down.
125 end. /* FOR EACH lad_det */
126 l_det_view = no.
127 end. /* IF l_det_view */
128
129 if not retry then
130 display
131 loc @ lad_loc
132 serial @ lad_lot.
133
134 global_site = site.
135
136 prompt-for
137 lad_loc lad_lot lad_ref
138 editing:
139
140 assign
141 window_recid = ?
142 global_loc = input lad_loc
143 global_lot = input lad_lot.
144
145 {us/mf/mfnp06.i lad_det lad_det
146 " lad_det.lad_domain = global_domain and lad_dataset = ""sod_det""
147 and lad_nbr = sodnbr and
148 lad_line = string(line)"
149 lad_loc "input lad_loc" lad_lot "input lad_lot"}
150
151 if recno <> ? then do:
152 display
153 lad_loc lad_lot
154 lad_ref
155 lad_qty_all lad_qty_all.
156 end.
157
158 if window_recid <> ? then do:
159
160 for first ld_det
161 fields( ld_domain ld_expire ld_loc ld_lot ld_part ld_qty_all
162 ld_qty_oh ld_ref ld_site ld_status)
163 where recid(ld_det) = window_recid
164 no-lock: end.
165
166 if available ld_det then do:
167 assign
168 global_loc = ld_loc
169 global_lot = ld_lot.
170 display
171 ld_loc @ lad_loc
172 ld_lot @ lad_lot
173 ld_ref @ lad_ref
174 with frame alloc.
175 end.
176 end. /* if window_recid <> ? */
177
178 end.
179
180 status input.
181
182 {us/px/pxrun.i &PROC = 'getFieldDefault' &PROGRAM = 'ppitxr.p'
183 &HANDLE = ph_ppitxr
184 &PARAM = "( input part,
185 input site,
186 input ""pt_lot_ser"",
187 output l_pt_lot_ser)"
188 &NOAPPERROR = true
189 &CATCHERROR = true}
190
191 if index("LS",l_pt_lot_ser) > 0 and input lad_lot = "" then do:
192 /* Lot/Serial Number Required */
193 {us/bbi/pxmsg.i &MSGNUM=1119 &ERRORLEVEL=3}
194 next-prompt lad_lot.
195 undo loopb0, retry.
196 end.
197
198 /* EXCLUSIVE LOCK ON in_mstr INTRODUCED ONLY TO AVOID */
199 /* DEADLY EMBRACE AND NOT FOR ANY ADD/MOD/DELETE/UPDATE. */
200 find first in_mstr
201 where in_mstr.in_domain = global_domain and in_part = part
202 and in_site = site
203 exclusive-lock no-error.
204
205 find ld_det where ld_det.ld_domain = global_domain and ld_site = site and
206 ld_part = part and
207 ld_loc = input lad_loc and ld_lot = input lad_lot
208 and ld_ref = input lad_ref
209 exclusive-lock no-error.
210
211 if not available ld_det then do:
212 /* Location/Item/Lot/Serial does not exist */
213 {us/bbi/pxmsg.i &MSGNUM=305 &ERRORLEVEL=3}
214 next-prompt lad_loc.
215 undo loopb0, retry.
216 end.
217
218 /* ISSUE ERROR IS THIS IS A RESTRICTED TRANSACTION */
219 for first isd_det fields( isd_domain isd_status isd_tr_type isd_bdl_allowed)
220 where isd_det.isd_domain = global_domain and isd_status = ld_status and
221 isd_tr_type = "ISS-SO"
222 no-lock:
223 if batchrun = no or (batchrun = yes and isd_bdl_allowed = no)
224 then do:
225 /* RESTRICTED TRANSACTION FOR STATUS CODE: */
226 {us/bbi/pxmsg.i &MSGNUM=373 &ERRORLEVEL=3 &MSGARG1=isd_status}
227 next-prompt lad_loc.
228 undo loopb0, retry.
229 end.
230 end.
231
232 /* CHECK TO SEE IF RESERVED LOCATION EXISTS FOR THIS CUSTOMER-- */
233 rl-loc = input lad_loc.
234 run check-reserved-location.
235
236 if ret-flag = 0 then do:
237 /* THIS LOCATION RESERVED FOR ANOTHER CUSTOMER */
238 {us/bbi/pxmsg.i &MSGNUM=3346 &ERRORLEVEL=3}
239 next-prompt lad_loc.
240 undo loopb0, retry.
241 end.
242
243 if corr_inv = no
244 then do:
245 if ret-flag = 2
246 then do:
247 if not can-find(is_mstr
248 where is_mstr.is_domain = global_domain
249 and is_status = ld_status
250 and is_avail = yes)
251 then do:
252 /* Location status not available, cannot allocate */
253 {us/bbi/pxmsg.i &MSGNUM=4998 &ERRORLEVEL=3}
254 next-prompt lad_loc.
255 undo loopb0, retry.
256 end. /* IF NOT CAN-FIND is_mstr */
257 end. /* IF ret-flag = 2 */
258 end. /* IF corr_inv = no */
259
260 /*d3873>>*/
261
262 find first so_mstr
263 where so_domain = global_domain
264 and so_nbr = sodnbr
265 no-lock no-error.
266 xx_cpexpire = 0.
267 find first cp_mstr
268 where cp_domain = global_domain
269 and cp_cust = so_cust
270 and cp_part = part
271 no-lock no-error.
272
273 if available cp_mstr then do:
274 xx_cpexpire = int(cp_user1) no-error.
275 if error-status:error then
276 xx_cpexpire = 0.
277 end.
278 /*nac*/ message "socal1.p 1" so_cust part xx_cpexpire. pause. /**/
279
280 /*d3873<<*/
281
282 /*d3873 if ld_expire <> ? and ld_expire < today then do: */
283 /*d3873*/ if ld_expire <> ? and ld_expire < today + xx_cpexpire then do:
284 /* Lot/serial has expired */
285 /*d3873 {pxmsg.i &MSGNUM=76 &ERRORLEVEL=2} */
286 /*d3873*/ {pxmsg.i &MSGNUM=9760 &ERRORLEVEL=3}
287 /*d3873*/ undo, retry.
288 end.
289 /*d3873 if ld_expire <> ? and ld_expire < duedate then do: */
290 /*d3873*/ if ld_expire <> ? and ld_expire < duedate + xx_cpexpire then do:
291 /* Lot/serial due to expire before due date */
292 /*d3873 {pxmsg.i &MSGNUM=4994 &ERRORLEVEL=2} */
293 /*d3873*/ {pxmsg.i &MSGNUM=9762 &ERRORLEVEL=3}
294 /*d3873*/ undo, retry.
295 end.
296
297 find lad_det
298 where lad_det.lad_domain = global_domain
299 and lad_dataset = "sod_det"
300 and lad_nbr = sodnbr
301 and lad_line = string(line)
302 and lad_site = site
303 and lad_loc = input lad_loc
304 and lad_part = part
305 and lad_lot = input lad_lot
306 and lad_ref = input lad_ref
307 exclusive-lock no-error.
308
309 if available lad_det then do:
310 /* Modifying existing record */
311 {us/bbi/pxmsg.i &MSGNUM=10 &ERRORLEVEL=1}
312
313 find ld_det
314 where ld_det.ld_domain = global_domain and ld_site = site
315 and ld_ref = input lad_ref
316 and ld_part = part
317 and ld_loc = input lad_loc
318 and ld_lot = input lad_lot
319 exclusive-lock no-error.
320
321 if available ld_det then
322 ld_qty_all = ld_qty_all - lad_qty_all.
323 totallqty = totallqty - (lad_qty_all / um_conv).
324 end.
325
326 else do:
327
328 if ld_expire <> ? and ld_expire < today then do:
329 /* Lot/serial has expired */
330 {us/bbi/pxmsg.i &MSGNUM=76 &ERRORLEVEL=3}
331 next-prompt lad_loc.
332 undo loopb0, retry.
333 end.
334 if pt_sngl_lot and totallqty <> 0 then do:
335 /* Total lot/ser qty entered */
336 {us/bbi/pxmsg.i &MSGNUM=4986 &ERRORLEVEL=2}
337 end.
338
339 /* Adding new record*/
340 {us/bbi/pxmsg.i &MSGNUM=1 &ERRORLEVEL=1}
341
342 /* Lot/ser qty left to allocate*/
343 msg-arg = string((qty_all - totallqty) * um_conv).
344 {us/bbi/pxmsg.i &MSGNUM=4996 &ERRORLEVEL=1 &MSGARG1=msg-arg}
345
346 create lad_det. lad_det.lad_domain = global_domain.
347 assign
348 lad_dataset = "sod_det"
349 lad_site = site
350 lad_nbr = sodnbr
351 lad_line = string(line)
352 lad_loc = input lad_loc
353 lad_lot = input lad_lot
354 lad_ref = input lad_ref
355 lad_part = part.
356
357 {us/px/pxrun.i &PROC = 'getFieldDefault' &PROGRAM = 'ppitxr.p'
358 &HANDLE = ph_ppitxr
359 &PARAM = "( input part,
360 input site,
361 input ""pt_lot_ser"",
362 output l_pt_lot_ser)"
363 &NOAPPERROR = true
364 &CATCHERROR = true
365 }
366
367 if l_pt_lot_ser = "S" then
368 if qty_all > 0 then
369 lad_qty_all = 1.
370 else lad_qty_all = -1.
371 end.
372
373 ststatus = stline[2].
374 status input ststatus.
375
376 display lad_qty_all.
377 {us/so/sorevqty.i
378 &nbr = sodnbr
379 &line = line
380 &site = site
381 &part = part
382 &location= lad_loc
383 &lotserial= lad_lot}
384
385
386 do on error undo, retry with frame alloc:
387
388 set
389 lad_qty_all
390 go-on (F5 CTRL-D).
391
392 if lastkey = keycode("F5")
393 or lastkey = keycode("CTRL-D")
394 then do:
395 del-yn = yes.
396 /* Please confirm delete */
397 {us/bbi/pxmsg.i &MSGNUM=11 &ERRORLEVEL=1 &CONFIRM=del-yn}
398 if not del-yn then undo, retry.
399 end.
400
401 if del-yn then do:
402 delete lad_det.
403 del-yn = no.
404 next loopb0.
405 end.
406
407 {us/px/pxrun.i &PROC = 'getFieldDefault' &PROGRAM = 'ppitxr.p'
408 &HANDLE = ph_ppitxr
409 &PARAM = "( input part,
410 input site,
411 input ""pt_lot_ser"",
412 output l_pt_lot_ser)"
413 &NOAPPERROR = true
414 &CATCHERROR = true
415 }
416
417 if (l_pt_lot_ser = "S"
418 and lad_qty_all <> 1
419 and lad_qty_all <> -1
420 and corr_inv = no)
421 or (l_pt_lot_ser = "S"
422 and lad_qty_all <> 1
423 and lad_qty_all <> -1
424 and lad_qty_all <> 0
425 and corr_inv = yes)
426 then do:
427 /* Qty must be -1 or 1 */
428 {us/bbi/pxmsg.i &MSGNUM=314 &ERRORLEVEL=3}
429 undo, retry.
430 end. /* IF (pt_lot_ser = "S" AND ... */
431 end.
432
433 if qty_ord >= 0 and qty_ord < totallqty +
434 (lad_qty_all / um_conv) +
435 qty_pick + qty_ship
436 then do:
437 /* Qty ord cannot be less than all + pick + ship*/
438 {us/bbi/pxmsg.i &MSGNUM=4999 &ERRORLEVEL=2}
439 next-prompt lad_qty_all.
440 end.
441
442
443 if qty_ord >= 0
444 and lad_qty_all > 0
445 and ld_qty_oh - ld_qty_all - lad_qty_all
446 - (if available qad_wkfl then qad_decfld[1] else 0) < 0
447 and not (corr_inv
448 and can-find(first is_mstr
449 where is_domain = global_domain
450 and is_status = ld_status
451 and is_overissue = yes))
452 then do:
453 /* Qty allocated would exceed qty avail for this loc/lot*/
454 {us/bbi/pxmsg.i &MSGNUM=4997 &ERRORLEVEL=3}
455 next-prompt lad_qty_all with frame alloc.
456 undo, retry.
457 end.
458
459 if available qad_wkfl
460 then
461 qad_decfld[1] = 0.
462
463 assign
464 ld_qty_all = ld_qty_all + lad_qty_all
465 totallqty = totallqty + (lad_qty_all / um_conv).
466
467 if lad_qty_all = 0 and lad_qty_chg = 0 and lad_qty_pick = 0 then do:
468 delete lad_det.
469 end.
470
471 if totallqty = qty_ord - qty_ship - qty_pick then
472 leave.
473 end. /*loopb0*/
474
475 if qty_all - totallqty > 0 then
476 repeat:
477 /* Total lot quantity less than qty allocated*/
478 {us/bbi/pxmsg.i &MSGNUM=4995 &ERRORLEVEL=2}
479 if not batchrun then pause.
480 leave.
481 end.
482
483 hide frame alloc no-pause.
484
485 /* DETERMINE IF LOC TO BE USED IS VALID */
486 PROCEDURE check-reserved-location:
487
488 ret-flag = 2.
489
490 for first so_mstr where so_mstr.so_domain = global_domain
491 and so_nbr = sodnbr
492 and so_compl_stat = ""
493 no-lock:
494 /* bypass checking SSM orders */
495 if so_fsm_type = "" then do:
496 {us/bbi/gprun.i ""sorlchk.p""
497 "(input so_ship,
498 input so_bill,
499 input so_cust,
500 input site,
501 input rl-loc,
502 output ret-flag)"}
503 end.
504 end. /* for first so_mstr...*/
505
506 END PROCEDURE.
File mfg/2013/base/src/sopkall.i added (mode: 100755) (index 0000000..242c18b)
1 /* sopkall.i - SALES ORDER PICK LIST HARD ALLOCATIONS */
2 /* Copyright 1986 QAD Inc. All rights reserved. */
3 /* $Id$: */
4
5 /* $Revision$ */
6
7 /* REVISION: 6.0 LAST MODIFIED: 04/03/90 BY: MLB **D024**/
8 /* REVISION: 6.0 LAST MODIFIED: 05/30/90 BY: emb */
9 /* REVISION: 6.0 LAST MODIFIED: 10/05/91 BY: SMM *D887*/
10 /* REVISION: 7.3 LAST MODIFIED: 12/15/94 BY: pxd *F09X*/
11 /* REVISION: 8.6 LAST MODIFIED: 05/20/98 BY: *K1Q4* Alfred Tan */
12 /* REVISION: 9.0 LAST MODIFIED: 10/30/98 BY: *M00D* Robert Jensen*/
13 /* REVISION: 9.0 LAST MODIFIED: 03/13/99 BY: *M0BD* Alfred Tan */
14 /* REVISION: 9.0 LAST MODIFIED: 05/04/00 BY: *M0MC* Ashwini G. */
15 /* REVISION: 9.1 LAST MODIFIED: 09/05/00 BY: *N0RF* Mark Brown */
16 /* Old ECO marker removed, but no ECO header exists *F0PN* */
17 /* Revision: 1.16 BY: Russ Witt DATE: 06/04/01 ECO: *P00J* */
18 /* Revision: 1.18 BY: Paul Donnelly (SB) DATE: 06/28/03 ECO: *Q00L* */
19 /* Revision: 1.19 BY: Salil Pradhan DATE: 10/05/04 ECO: *P2MT* */
20 /* $Revision$ BY: Priya Idnani DATE: 10/31/05 ECO: *P46V* */
21 /* BUDERIM GINGER 2013SE LAST MODIFIED: 11-AUG-2017 BY: nac *d3873 */
22 /*-Revision end---------------------------------------------------------------*/
23
24
25 /*V8:ConvertMode=Maintenance */
26
27 /******************************************************************************/
28 /* All patch markers and commented out code have been removed from the source */
29 /* code below. For all future modifications to this file, any code which is */
30 /* no longer required should be deleted and no in-line patch markers should */
31 /* be added. The ECO marker should only be included in the Revision History. */
32 /******************************************************************************/
33
34 /***********************************************************/
35 /* &sort1 = field &sort2 = "" or descending */
36 /***********************************************************/
37 /* Note: This routine completely rewritten by ECO *P00J* */
38
39 /* LOAD ALL CUSTOMERS TO BE CHECKED INTO ARRAY */
40 i = i + 1.
41 cust-to-allocate[i] = so_ship.
42
43 if so_cust <> so_ship then do:
44 i = i + 1.
45 cust-to-allocate[i] = so_cust.
46 end.
47
48 if so_bill <> so_ship and so_bill <> so_cust then do:
49 i = i + 1.
50 cust-to-allocate[i] = so_bill.
51 end.
52
53 allocate-proc:
54 do i = 1 to 3:
55 if cust-to-allocate[i] <> "" then do:
56
57 /* CLEAR TEMP FILE THAT STORES RESERVED LOCATIONS */
58 /*FOR THIS ADDRESS */
59 for each tt_resv_loc exclusive-lock:
60 delete tt_resv_loc.
61 end.
62
63 /* LOAD LOCATIONS TO TEMP TABLE */
64 for each locc_det
65 fields( locc_domain locc_site locc_loc locc_primary_loc locc_addr)
66 where locc_det.locc_domain = global_domain and locc_site = sod_site
67 and locc_addr = cust-to-allocate[i]
68 no-lock:
69 create tt_resv_loc.
70 assign
71 tt_loc = locc_loc
72 tt_primary_loc = locc_primary_loc.
73 end. /* FOR EACH LOCC_DET */
74
75 /*d3873>>*/
76 xx_cpexpire = 0.
77 find first cp_mstr
78 where cp_domain = global_domain
79 and cp_cust = cust-to-allocate[i]
80 and cp_part = sod_part
81 no-lock no-error.
82
83 if available cp_mstr then do:
84 xx_cpexpire = int(cp_user1) no-error.
85 if error-status:error then
86 xx_cpexpire = 0.
87 end.
88 if xx_cpexpire = 0 then
89 xx_cpexpire = icc_ctrl.icc_iss_days.
90 /*nac*/ message "sopkall.i" cust-to-allocate[i] sod_part xx_cpexpire. pause. /**/
91 /*d3873<<*/
92
93 /* BEGIN ALLOCATIONS NOW */
94 /* FIRST CHECK FOR PRIMARY RESERVED LOCATION */
95 for each tt_resv_loc where tt_primary_loc = yes:
96 for each ld_det
97 fields( ld_domain ld_site ld_part ld_loc ld_qty_oh ld_qty_all
98 ld_expire ld_lot ld_ref ld_status ld_date)
99 where ld_det.ld_domain = global_domain and ( ld_site = sod_site
100 and ld_part = sod_part
101 and ld_loc = tt_loc
102 and ld_qty_oh - ld_qty_all > 0
103 /*d3873 and (ld_expire > today + icc_ctrl.icc_iss_days */
104 /*d3873*/ and (ld_expire > today + xx_cpexpire
105 or ld_expire = ?)
106 ) exclusive-lock
107 by {&sort1} {&sort2}:
108 if (this_lot <> ? and ld_lot <> this_lot) or
109 (this_ref <> ? and ld_ref <> this_ref)
110 then next.
111
112 run detail-allocate.
113
114 if qty_to_all = 0 then leave allocate-proc.
115
116 if available tt_resv_loc
117 then
118 delete tt_resv_loc.
119 end. /*FOR EACH LD_DET*/
120 end. /* FOR EACH TT_PRIMARY_LOC... */
121
122 /* NOW CHECK FOR ALL NON-PRIMARY RESERVED LOCATIONS */
123 for each ld_det
124 fields( ld_domain ld_site ld_part ld_loc ld_qty_oh ld_qty_all
125 ld_expire ld_lot ld_ref ld_status ld_date)
126 where ld_det.ld_domain = global_domain and ( ld_site = sod_site
127 and ld_part = sod_part
128 and can-find(tt_resv_loc where tt_loc = ld_loc)
129 and ld_qty_oh - ld_qty_all > 0
130 /*d3873 and (ld_expire > today + icc_iss_days */
131 /*d3873*/ and (ld_expire > today + xx_cpexpire
132 or ld_expire = ?)
133 ) exclusive-lock
134 by {&sort1} {&sort2}:
135 if (this_lot <> ? and ld_lot <> this_lot) or
136 (this_ref <> ? and ld_ref <> this_ref)
137 then next.
138
139 run detail-allocate.
140
141 if qty_to_all = 0 then leave allocate-proc.
142 end. /*FOR EACH LD_DET*/
143
144 end. /* cust-to-allocate[i] <> 0 */
145
146 end. /* allocate-proc block */
147
148 /*d3873>>*/
149 xx_cpexpire = 0.
150 find first cp_mstr
151 where cp_domain = global_domain
152 and cp_cust = so_cust
153 and cp_part = sod_part
154 no-lock no-error.
155
156 if available cp_mstr then do:
157 xx_cpexpire = int(cp_user1) no-error.
158 if error-status:error then
159 xx_cpexpire = 0.
160 end.
161 if xx_cpexpire = 0 then
162 xx_cpexpire = icc_ctrl.icc_iss_days.
163 /*nac*/ message "sopkall.i 1" so_cust sod_part xx_cpexpire. pause. /**/
164 /*d3873<<*/
165
166 /* NOW CHECK FOR NON-RESERVED LOCATIONS */
167 if qty_to_all <> 0
168 then
169 for each ld_det
170 fields( ld_domain ld_site ld_part ld_loc ld_qty_oh ld_qty_all
171 ld_expire ld_lot ld_ref ld_status ld_date)
172 where ld_det.ld_domain = global_domain
173 and ( ld_site = sod_det.sod_site
174 and ld_part = sod_part
175 and can-find(is_mstr
176 where is_mstr.is_domain = global_domain
177 and ( is_status = ld_status
178 and is_avail = yes))
179 and ld_qty_oh - ld_qty_all > 0
180 /*d3873 and (ld_expire > today + icc_iss_days */
181 /*d3873*/ and (ld_expire > today + xx_cpexpire
182 or ld_expire = ?))
183 exclusive-lock
184 by {&sort1} {&sort2}:
185 if (this_lot <> ?
186 and ld_lot <> this_lot)
187 or (this_ref <> ?
188 and ld_ref <> this_ref)
189 then next.
190
191 run detail-allocate.
192
193 if qty_to_all = 0
194 then
195 leave.
196 end. /*FOR EACH LD_DET*/
File mfg/2013/base/src/sosoall.i added (mode: 100644) (index 0000000..48b9c6d)
1 /* sosoall.i - DIRECT SALES ORDER ALLOCATIONS BTB - HARD ALLOCATIONS */
2 /* Copyright 1986 QAD Inc. All rights reserved. */
3 /* $Id$: */
4
5 /* $Revision$ */
6
7 /* REVISION: 8.6 LAST MODIFIED: 19mai96 BY: Elke Van Maele *K004**/
8 /* REVISION: 8.6 LAST MODIFIED: 05/20/98 BY: *K1Q4* Alfred Tan */
9 /* REVISION: 9.1 LAST MODIFIED: 08/12/00 BY: *N0KN* myb */
10 /* Revision: 1.3.2.2 BY: Russ Witt DATE: 06/04/01 ECO: *P00J* */
11 /* Revision: 1.3.2.3 BY: Russ Witt DATE: 10/17/01 ECO: *P021* */
12 /* Revision: 1.3.2.5 BY: Paul Donnelly (SB) DATE: 06/28/03 ECO: *Q00L* */
13 /* $Revision$ BY: Xavier Prat DATE: 06/15/06 ECO: *R03Q* */
14 /* BUDERIM GINGER 2013SE LAST MODIFIED: 11-AUG-2017 BY: nac *d3873 */
15 /*-Revision end---------------------------------------------------------------*/
16
17
18 /*V8:ConvertMode=Maintenance */
19
20 /******************************************************************************/
21 /* All patch markers and commented out code have been removed from the source */
22 /* code below. For all future modifications to this file, any code which is */
23 /* no longer required should be deleted and no in-line patch markers should */
24 /* be added. The ECO marker should only be included in the Revision History. */
25 /******************************************************************************/
26
27 /* logic copied from sopkall.i */
28
29 /***********************************************************/
30 /* &sort1 = field &sort2 = "" or descending */
31 /***********************************************************/
32
33 /* THIS PROGRAM HAS BEEN COMPLETELY REWRITTEN VIA P00J */
34
35 /* LOAD ALL CUSTOMERS TO BE CHECKED INTO ARRAY */
36 i = i + 1.
37 cust-to-allocate[i] = p-ship.
38
39 if p-cust <> p-ship then do:
40 i = i + 1.
41 cust-to-allocate[i] = p-cust.
42 end.
43
44 if p-bill <> p-ship and p-bill <> p-cust then do:
45 i = i + 1.
46 cust-to-allocate[i] = p-bill.
47 end.
48
49 allocate-proc:
50 do i = 1 to 3:
51 if cust-to-allocate[i] <> "" then do:
52
53 /* CLEAR TEMP FILE THAT STORES RESERVED LOCATIONS */
54 /*FOR THIS ADDRESS */
55 for each tt_resv_loc exclusive-lock:
56 delete tt_resv_loc.
57 end.
58
59 /* LOAD LOCATIONS TO TEMP TABLE */
60 for each locc_det
61 fields( locc_domain locc_site locc_loc locc_primary_loc locc_addr)
62 where locc_det.locc_domain = global_domain and locc_site = p-btb-site
63 and locc_addr = cust-to-allocate[i]
64 no-lock:
65 create tt_resv_loc.
66 assign
67 tt_loc = locc_loc
68 tt_primary_loc = locc_primary_loc.
69 end. /* FOR EACH LOCC_DET */
70
71 /*d3873>>*/
72 xx_cpexpire = 0.
73 find first cp_mstr
74 where cp_domain = global_domain
75 and cp_cust = cust-to-allocate[i]
76 and cp_part = p-part
77 no-lock no-error.
78
79 if available cp_mstr then do:
80 xx_cpexpire = int(cp_user1) no-error.
81 if error-status:error then
82 xx_cpexpire = 0.
83 end.
84 if xx_cpexpire = 0 then
85 xx_cpexpire = icc_ctrl.icc_iss_days.
86 /*nac*/ message "sosoall.i 2" cust-to-allocate[i] p-part xx_cpexpire. pause. /**/
87 /*d3873<<*/
88
89
90 /* BEGIN ALLOCATIONS NOW */
91 /* FIRST CHECK FOR PRIMARY RESERVED LOCATION */
92 for each tt_resv_loc where tt_primary_loc = yes:
93 for each ld_det
94 fields( ld_domain ld_site ld_part ld_loc ld_qty_oh ld_qty_all
95 ld_expire ld_lot ld_ref ld_status ld_date ld_exp_qtyout)
96 where ld_det.ld_domain = global_domain and ( ld_site = p-btb-site
97 and ld_part = p-part
98 and ld_loc = tt_loc
99 and ld_qty_oh - max(ld_qty_all,ld_exp_qtyout) > 0
100 /*d3873 and (ld_expire > today + icc_ctrl.icc_iss_days */
101 /*d3873*/ and (ld_expire > today + xx_cpexpire
102 or ld_expire = ?)
103 ) exclusive-lock
104 by {&sort1} {&sort2}:
105
106 if (this_lot <> ? and ld_lot <> this_lot)
107 then next.
108
109 run detail-allocate.
110
111 if qty_to_all = 0 then leave allocate-proc.
112 delete tt_resv_loc.
113 end. /*FOR EACH LD_DET*/
114 end. /* FOR EACH TT_PRIMARY_LOC... */
115
116 /* NOW CHECK FOR ALL NON-PRIMARY RESERVED LOCATIONS */
117 for each ld_det
118 fields( ld_domain ld_site ld_part ld_loc ld_qty_oh ld_qty_all
119 ld_expire ld_lot ld_ref ld_status ld_date)
120 where ld_det.ld_domain = global_domain and ( ld_site = p-btb-site
121 and ld_part = p-part
122 and can-find(tt_resv_loc where tt_loc = ld_loc)
123 and ld_qty_oh - ld_qty_all > 0
124 /*d3873 and (ld_expire > today + icc_iss_days */
125 /*d3873*/ and (ld_expire > today + xx_cpexpire
126 or ld_expire = ?)
127 ) exclusive-lock
128 by {&sort1} {&sort2}:
129 if (this_lot <> ? and ld_lot <> this_lot)
130 then next.
131
132 run detail-allocate.
133
134 if qty_to_all = 0 then leave allocate-proc.
135 end. /*FOR EACH LD_DET*/
136
137 end. /* cust-to-allocate[i] <> 0 */
138
139 end. /* allocate-proc block */
140
141 /*d3873>>*/
142 xx_cpexpire = 0.
143 find first cp_mstr
144 where cp_domain = global_domain
145 and cp_cust = p-cust
146 and cp_part = p-part
147 no-lock no-error.
148
149 if available cp_mstr then do:
150 xx_cpexpire = int(cp_user1) no-error.
151 if error-status:error then
152 xx_cpexpire = 0.
153 end.
154 if xx_cpexpire = 0 then
155 xx_cpexpire = icc_ctrl.icc_iss_days.
156 /*nac*/ message "sosoall.i 2" p-cust p-part xx_cpexpire. pause. /**/
157 /*d3873<<*/
158
159 /* NOW CHECK FOR NON-RESERVED LOCATIONS */
160 for each ld_det
161 fields( ld_domain ld_site ld_part ld_loc ld_qty_oh ld_qty_all
162 ld_expire ld_lot ld_ref ld_status ld_date)
163 where ld_det.ld_domain = global_domain and ( ld_site = p-btb-site
164 and ld_part = p-part
165 and can-find(is_mstr where is_mstr.is_domain = global_domain and ( is_status
166 = ld_status
167 and is_avail = yes))
168 and ld_qty_oh - ld_qty_all > 0
169 /*d3873 and (ld_expire > today + icc_iss_days */
170 /*d3873*/ and (ld_expire > today + xx_cpexpire
171 or ld_expire = ?)
172 ) exclusive-lock
173 by {&sort1} {&sort2}:
174 if (this_lot <> ? and ld_lot <> this_lot)
175 then next.
176
177 run detail-allocate.
178
179 if qty_to_all = 0 then leave.
180 end. /*FOR EACH LD_DET*/
File mfg/2013/base/src/sosoall.p added (mode: 100644) (index 0000000..b9021ff)
1 /* sosoall.p - DIRECT SALES ORDER ALLOCATIONS BTB ON SBU */
2 /* Copyright 1986 QAD Inc. All rights reserved. */
3 /* Main logic copied from sopkall.p */
4 /* */
5 /* This procedure will */
6 /* 1. create a fictive allocation on the SBU system location where */
7 /* the goods have to be booked. This allocation consits in the */
8 /* creation of allocation detail records (lad_det) with Data Set */
9 /* type "btb" instead of the regular "sod_det" and the update of */
10 /* qty allocated in the inventory master (in_mstr) and in the */
11 /* inventory detail (ld_det). The use of data set type "btb" makes */
12 /* the allocation "invisible" for the time needed to transfer, */
13 /* load and confirm the corresponding Secondary SO. */
14 /* 2. look for existing fictive allocations and delete them. */
15 /* */
16 /* Parameters: */
17 /* p-nbr : Primary SO for which the allocation must be */
18 /* created or deleted */
19 /* p-line : Primary SO line */
20 /* p-ship : Primary SO Ship-to customer */
21 /* p-bill : Primary SO Bill-to customer */
22 /* p-cust : Primary SO Sold-to customer */
23 /* p-fsm-type : Primary SO FSM type */
24 /* p-part : Primary SO part */
25 /* p-qty : 1. create lad_det: Primary SO quantity ordered */
26 /* 2. delete lad_det: Primary SO quantity allocated */
27 /* + quantity picked */
28 /* p-umconv : Primary SO unit of measure conversion */
29 /* p-btb-site : Contains the site on which the allocation has to */
30 /* be created or deleted */
31 /* p-delete : if p-delete = no then situation 1 */
32 /* (create lad_det) */
33 /* else situation 2 (delete lad_det) */
34 /* */
35 /******************************************************************************/
36 /* REVISION: 8.6 LAST MODIFIED: 06/19/96 BY: *K004* Elke Van Maele */
37 /* REVISION: 8.6 LAST MODIFIED: 03/31/97 BY: *K09L* Kieu Nguyen */
38 /* REVISION: 8.6 LAST MODIFIED: 05/20/98 BY: *K1Q4* Alfred Tan */
39 /* REVISION: 9.1 LAST MODIFIED: 08/12/00 BY: *N0KN* myb */
40 /* Old ECO marker removed, but no ECO header exists *F0PN* */
41 /* Revision: 1.4.2.2 BY: Russ Witt DATE: 06/04/01 ECO: *P00J* */
42 /* Revision: 1.4.2.5 BY: Russ Witt DATE: 10/17/01 ECO: *P021* */
43 /* Revision: 1.4.2.7 BY: Paul Donnelly (SB) DATE: 06/28/03 ECO: *Q00L* */
44 /* Revision: 1.4.2.8 BY: Jean Miller DATE: 02/20/04 ECO: *Q062* */
45 /* $Revision$ BY: Tejasvi Kulkarni DATE: 01/05/06 ECO: *P4CV* */
46 /* BUDERIM GINGER 2013SE LAST MODIFIED: 11-AUG-2017 BY: nac *d3873 */
47 /*-Revision end---------------------------------------------------------------*/
48
49 /*V8:ConvertMode=Maintenance */
50
51 /******************************************************************************/
52 /* All patch markers and commented out code have been removed from the source */
53 /* code below. For all future modifications to this file, any code which is */
54 /* no longer required should be deleted and no in-line patch markers should */
55 /* be added. The ECO marker should only be included in the Revision History. */
56 /******************************************************************************/
57
58 {mfdeclre.i}
59
60 define input parameter p-nbr like so_nbr.
61 define input parameter p-line like sod_line.
62 define input parameter p-ship like so_ship.
63 define input parameter p-bill like so_bill.
64 define input parameter p-cust like so_cust.
65 define input parameter p-fsm-type like so_fsm_type.
66 define input parameter p-part like sod_part.
67 define input parameter p-qty like sod_qty_ord.
68 define input parameter p-umconv like sod_um_conv.
69 define input parameter p-btb-site like si_site.
70 define input parameter p-delete as logical.
71
72 define variable all_thisloc like sod_qty_all no-undo.
73 define variable qty_to_all like sod_qty_all no-undo.
74 define variable this_lot like ld_lot no-undo.
75 define variable qty like sod_qty_all no-undo.
76 define variable qty_adj like sod_qty_all no-undo.
77 define variable cust-to-allocate like so_cust extent 3 no-undo.
78 define variable i as integer no-undo.
79 define variable avl_qoh like in_qty_oh no-undo.
80 define variable avl_qty_ord like in_qty_ord no-undo.
81 define variable avl_alloc like in_qty_oh no-undo.
82 /*d3873*/ define variable xx_cpexpire as integer.
83
84 /*DEFINE TEMP TABLE USED IN RESERVED LOCATION ALLOCATIONS */
85 define temp-table tt_resv_loc
86 field tt_loc like ld_loc
87 field tt_primary_loc like locc_primary_loc
88 index tt_loc is unique primary
89 tt_loc.
90
91 find first icc_ctrl where icc_domain = global_domain no-lock.
92 find first soc_ctrl where soc_domain = global_domain no-lock.
93
94 /* CREATE DIRECT ALLCATIONS */
95 if p-delete = no then do:
96
97 /* Get Quantity Available */
98 {gprun.i ""gpgetavl.p""
99 "(input p-part,
100 input p-btb-site,
101 input p-ship,
102 input p-bill,
103 input p-cust,
104 input p-fsm-type,
105 output avl_qoh,
106 output avl_qty_ord,
107 output avl_alloc,
108 input 0,
109 input 0)"}
110
111 assign
112 avl_alloc = max (avl_alloc, 0) / p-umconv.
113
114 if soc_all_avl = no then
115 qty_to_all = max( p-qty , 0).
116 else
117 qty_to_all = max( min(p-qty , avl_alloc) , 0).
118
119 this_lot = ?.
120
121 /* CHECK FOR EXISTING "INVISIBLE" ALLOCATIONS ON THE SBU SYSTEM */
122 for each lad_det where lad_domain = global_domain
123 and lad_dataset = "btb"
124 and lad_nbr = p-nbr
125 and lad_line = string(p-line)
126 and lad_part = p-part no-lock:
127 if this_lot = ? and lad_qty_all > 0 then this_lot = lad_lot.
128 end.
129
130 qty = qty_to_all.
131
132 if qty_to_all > 0 then do:
133
134 find pt_mstr where pt_domain = global_domain
135 and pt_part = p-part
136 no-lock no-error.
137
138 if available pt_mstr and pt_sngl_lot = no then this_lot = ?.
139
140 if icc_ascend then do:
141 if icc_pk_ord <= 2 then do:
142 /* DETAIL ALLOCATE CONFORM PICKING LOGIC */
143 {sosoall.i &sort1 = "(if icc_pk_ord = 1 then ld_loc
144 else ld_lot)" }
145 end.
146 else do:
147 /* DETAIL ALLOCATE CONFORM PICKING LOGIC */
148 {sosoall.i &sort1 = "(if icc_pk_ord = 3 then ld_date
149 else ld_expire)" }
150 end.
151 end. /* ascending picking logic */
152
153 else do:
154 if icc_pk_ord <= 2 then do:
155 /* DETAIL ALLOCATE CONFORM PICKING LOGIC */
156 {sosoall.i &sort1 = "(if icc_pk_ord = 1 then ld_loc
157 else ld_lot)"
158 &sort2 = "descending" }
159 end.
160 else do:
161 /* DETAIL ALLOCATE CONFORM PICKING LOGIC */
162 {sosoall.i &sort1 = "(if icc_pk_ord = 3 then ld_date
163 else ld_expire)"
164 &sort2 = "descending" }
165 end.
166 end. /* descending picking logic */
167
168 end. /* if qty_to_all > 0 */
169
170 if qty <> qty_to_all then do:
171 /* UPDATE INVENTORY MASTER */
172 find first in_mstr where in_domain = global_domain
173 and in_site = p-btb-site
174 and in_part = p-part
175 exclusive-lock no-error.
176 if available in_mstr then
177 assign
178 in_qty_all = in_qty_all + (qty - qty_to_all) * p-umconv.
179 end.
180
181 end. /* p-delete = no --- create direct allocations */
182
183 else do: /* p-delete = yes --- delete direct allocations */
184
185 qty_adj = 0.
186
187 for each lad_det where lad_domain = global_domain
188 and lad_dataset = "btb"
189 and lad_nbr = p-nbr
190 and lad_line = string(p-line)
191 exclusive-lock:
192
193 qty_adj = qty_adj + lad_qty_all + lad_qty_pick.
194
195 find ld_det where ld_domain = global_domain
196 and ld_site = lad_site
197 and ld_loc = lad_loc
198 and ld_lot = lad_lot
199 and ld_ref = lad_ref
200 and ld_part = lad_part.
201
202 ld_qty_all = ld_qty_all - (lad_qty_all + lad_qty_pick).
203
204 delete lad_det.
205
206 end.
207
208 /* UPDATE INVENTORY MASTER */
209 find first in_mstr where in_domain = global_domain
210 and in_site = p-btb-site
211 and in_part = p-part
212 exclusive-lock no-error.
213
214 if available in_mstr and qty_adj > 0 then
215 assign in_qty_all = in_qty_all - qty_adj.
216
217 end. /* p-delete = yes --- delete direct allocations */
218
219
220 /* I N T E R N A L P R O C E D U R E S */
221
222 PROCEDURE detail-allocate:
223 define buffer lddet for ld_det.
224
225 allocate-proc:
226 do:
227
228 /* BYPASS ALLOCATION IS THIS IS A RESTRICTED TRANSACTION */
229 for first isd_det
230 fields(isd_domain isd_status isd_tr_type isd_bdl_allowed)
231 where isd_domain = global_domain
232 and isd_status = ld_det.ld_status
233 and isd_tr_type = "ISS-SO"
234 no-lock:
235 if batchrun = no or (batchrun = yes and isd_bdl_allowed = no)
236 then leave allocate-proc.
237 end.
238
239 if qty_to_all < ld_qty_oh - ld_qty_all then
240 all_thisloc = qty_to_all.
241 else
242 all_thisloc = ld_qty_oh - ld_qty_all.
243
244 if pt_mstr.pt_sngl_lot and all_thisloc < qty_to_all
245 and this_lot = ?
246 then do for lddet:
247
248 for each lddet where
249 lddet.ld_domain = global_domain
250 and (lddet.ld_site = p-btb-site
251 and lddet.ld_part = p-part
252 and lddet.ld_lot = ld_det.ld_lot
253 and lddet.ld_ref = ld_det.ld_ref
254 and can-find(is_mstr where is_domain = global_domain
255 and (is_status = lddet.ld_status
256 and is_avail = yes))
257 and (ld_expire > today or ld_expire = ?)
258 and lddet.ld_qty_oh - lddet.ld_qty_all > 0)
259 no-lock:
260 accum (lddet.ld_qty_oh - lddet.ld_qty_all) (total).
261 end.
262
263 if (accum total (lddet.ld_qty_oh - lddet.ld_qty_all) ) >= qty_to_all
264 then
265 this_lot = ld_det.ld_lot.
266
267 end. /* pt_sngl_lot and all_thisloc < qty_to_all and this_lot = ? */
268
269 /* IF ALL AVAILABLE TO ALLOCATE OR NOT SINGLE LOT */
270 /* THEN CREATE LAD_DET */
271 if all_thisloc = qty_to_all or pt_sngl_lot = no
272 or (this_lot <> ? and ld_lot = this_lot)
273 then do:
274
275 find lad_det where lad_domain = global_domain
276 and lad_dataset = "btb"
277 and lad_nbr = p-nbr
278 and lad_line = string(p-line)
279 and lad_part = p-part
280 and lad_site = p-btb-site
281 and lad_loc = ld_loc
282 and lad_lot = ld_lot
283 and lad_ref = ld_ref
284 exclusive-lock no-error .
285
286 /* IF SNGL LOT AND LAD EXISTS THEN ALLOCATE ALL TO EXISTING */
287 /* LAD_DET */
288 if not available lad_det then do:
289 create lad_det.
290 assign
291 lad_domain = global_domain
292 lad_dataset = "btb"
293 lad_nbr = p-nbr
294 lad_line = string(p-line)
295 lad_site = p-btb-site
296 lad_loc = ld_loc
297 lad_part = p-part
298 lad_lot = ld_lot
299 lad_ref = ld_ref.
300 end.
301
302 qty_to_all = qty_to_all - all_thisloc.
303 ld_qty_all = ld_qty_all + all_thisloc.
304 lad_qty_all = lad_qty_all + all_thisloc.
305
306 end. /* if all avail to allocate or not single lot */
307
308 end. /* do block */
309
310 END PROCEDURE.
311
File mfg/2013/base/src/sosomtlb.p added (mode: 100644) (index 0000000..1373bef)
1 /* sosomtlb.p - SALES ORDER MAINTENANCE LINE DETAIL SUBROUTINE */
2 /* Copyright 1986 QAD Inc. All rights reserved. */
3 /* $Id$: */
4 /* REVISION: 6.0 LAST MODIFIED: 01/31/91 BY: afs *D327* */
5 /* REVISION: 6.0 LAST MODIFIED: 09/19/91 BY: afs *F040* */
6 /* REVISION: 6.0 LAST MODIFIED: 11/13/91 BY: WUG *D887* */
7 /* REVISION: 7.0 LAST MODIFIED: 01/13/92 BY: afs *F042* */
8 /* REVISION: 7.0 LAST MODIFIED: 02/21/92 BY: afs *F223* */
9 /* REVISION: 7.0 LAST MODIFIED: 03/24/92 BY: dld *F297* */
10 /* REVISION: 7.0 LAST MODIFIED: 04/06/92 BY: afs *F356* */
11 /* REVISION: 7.0 LAST MODIFIED: 04/16/92 BY: dld *F382* */
12 /* REVISION: 7.0 LAST MODIFIED: 06/12/92 BY: tjs *F504* */
13 /* REVISION: 7.0 LAST MODIFIED: 06/16/92 BY: afs *F519* */
14 /* REVISION: 7.0 LAST MODIFIED: 06/26/92 BY: afs *F711* */
15 /* REVISION: 7.0 LAST MODIFIED: 07/27/92 BY: tjs *F765* */
16 /* REVISION: 7.0 LAST MODIFIED: 07/27/92 BY: tjs *F802* */
17 /* REVISION: 7.3 LAST MODIFIED: 09/17/92 BY: tjs *G035* */
18 /* REVISION: 7.3 LAST MODIFIED: 10/06/92 BY: mpp *G013* */
19 /* REVISION: 7.3 LAST MODIFIED: 01/26/93 BY: bcm *G429* */
20 /* REVISION: 7.3 LAST MODIFIED: 02/08/93 BY: bcm *G415* */
21 /* REVISION: 7.3 LAST MODIFIED: 04/05/93 BY: bcm *G889* */
22 /* REVISION: 7.3 LAST MODIFIED: 04/15/93 BY: tjs *G948* */
23 /* REVISION: 7.4 LAST MODIFIED: 06/21/93 BY: pcd *H008* */
24 /* REVISION: 7.4 LAST MODIFIED: 08/23/93 BY: cdt *H049* */
25 /* REVISION: 7.4 LAST MODIFIED: 10/19/93 BY: cdt *H184* */
26 /* REVISION: 7.4 LAST MODIFIED: 02/11/94 BY: dpm *FM10* */
27 /* REVISION: 7.4 LAST MODIFIED: 03/18/94 BY: dpm *FM25* */
28 /* REVISION: 7.4 LAST MODIFIED: 06/10/94 BY: qzl *H380* */
29 /* REVISION: 7.4 LAST MODIFIED: 07/11/94 BY: bcm *H438* */
30 /* REVISION: 7.4 LAST MODIFIED: 08/17/94 BY: dpm *FQ29* */
31 /* REVISION: 7.4 LAST MODIFIED: 08/29/94 BY: bcm *H494* */
32 /* REVISION: 7.4 LAST MODIFIED: 09/02/94 BY: dpm *FQ53* */
33 /* REVISION: 7.4 LAST MODIFIED: 10/28/94 BY: dpm *FR95* */
34 /* REVISION: 7.4 LAST MODIFIED: 11/07/94 BY: str *FT44* */
35 /* REVISION: 7.4 LAST MODIFIED: 11/16/94 BY: qzl *FT43* */
36 /* REVISION: 7.4 LAST MODIFIED: 11/21/94 BY: afs *H605* */
37 /* REVISION: 7.4 LAST MODIFIED: 01/13/95 BY: dpm *F0DR* */
38 /* REVISION: 7.4 LAST MODIFIED: 01/17/95 BY: srk *G0C1* */
39 /* REVISION: 7.4 LAST MODIFIED: 01/31/95 BY: bcm *F0G8* */
40 /* REVISION: 7.4 LAST MODIFIED: 02/23/95 BY: jzw *H0BM* */
41 /* REVISION: 7.4 LAST MODIFIED: 03/06/95 BY: wjk *H0BT* */
42 /* REVISION: 7.4 LAST MODIFIED: 03/09/95 BY: kjm *F0K6* */
43 /* REVISION: 7.4 LAST MODIFIED: 03/31/95 BY: rxm *F0PR* */
44 /* REVISION: 7.4 LAST MODIFIED: 04/17/95 BY: jpm *H0CJ* */
45 /* REVISION: 8.5 LAST MODIFIED: 03/05/95 BY: DAH *J042* */
46 /* REVISION: 7.4 LAST MODIFIED: 10/23/95 BY: rxm *G19G* */
47 /* REVISION: 7.4 LAST MODIFIED: 11/22/95 BY: ais *H0H2* */
48 /* REVISION: 8.5 LAST MODIFIED: 11/07/95 BY: taf *J053* */
49 /* REVISION: 8.5 LAST MODIFIED: 12/01/95 BY: *J04C* Sue Poland */
50 /* REVISION: 8.5 LAST MODIFIED: 12/04/95 BY: *J04C* Tom Vogten */
51 /* REVISION: 8.6 LAST MODIFIED: 09/27/96 BY: svs *K007* */
52 /* REVISION: 8.6 LAST MODIFIED: 10/22/96 BY: *K004* Elke Van Maele */
53 /* REVISION: 8.6 LAST MODIFIED: 11/05/96 BY: *H0NR* Suresh Nayak */
54 /* REVISION: 8.6 LAST MODIFIED: 12/31/96 BY: *K03Y* Jean Miller */
55 /* REVISION: 8.6 LAST MODIFIED: 06/16/97 BY: *J1SY* Suresh Nayak */
56 /* REVISION: 8.6 LAST MODIFIED: 06/25/97 BY: *K0FM* Kieu Nguyen */
57 /* REVISION: 8.6 LAST MODIFIED: 07/15/97 BY: *K0G6* Arul Victoria */
58 /* REVISION: 8.6 LAST MODIFIED: 07/01/97 BY: *K0DH* Jim Williams */
59 /* REVISION: 8.6 LAST MODIFIED: 08/06/97 BY: *J1YG* Seema Varma */
60 /* REVISION: 8.6 LAST MODIFIED: 07/22/97 BY: *H1B1* Suresh Nayak */
61 /* REVISION: 8.6 LAST MODIFIED: 09/09/97 BY: *H1F2* Todd Runkle */
62 /* REVISION: 8.6 LAST MODIFIED: 09/29/97 BY: *K0HB* Kieu Nguyen */
63 /* REVISION: 8.6 LAST MODIFIED: 10/08/97 BY: *K0N5* Kieu Nguyen */
64 /* REVISION: 8.6 LAST MODIFIED: 11/18/97 BY: *J25B* Aruna Patil */
65 /* REVISION: 8.6 LAST MODIFIED: 12/18/97 BY: *K15N* Jerry Zhou */
66 /* REVISION: 8.6 LAST MODIFIED: 01/23/98 BY: *J2BW* Nirav Parikh */
67 /* REVISION: 8.6 LAST MODIFIED: 01/31/98 BY: *J2D6* Seema Varma */
68 /* REVISION: 8.6E LAST MODIFIED: 02/23/98 BY: *L007* A. Rahane */
69 /* REVISION: 8.6E LAST MODIFIED: 03/21/98 BY: *K1KQ* Niranjan R. */
70 /* REVISION: 8.6E LAST MODIFIED: 05/09/98 BY: *L00Y* Jeff Wootton */
71 /* Old ECO marker removed, but no ECO header exists *G501* */
72 /* REVISION: 8.6E LAST MODIFIED: 08/03/98 BY: *L024* Sami Kureishy */
73 /* REVISION: 8.6E LAST MODIFIED: 03/11/99 BY: *J3C5* Anup Pereira */
74 /* REVISION: 9.1 LAST MODIFIED: 10/01/99 BY: *N014* Patti Gaultney */
75 /* REVISION: 9.1 LAST MODIFIED: 12/15/99 BY: *N05D* Steve Nugent */
76 /* REVISION: 9.1 LAST MODIFIED: 01/19/2000 BY: *L0PY* Kedar Deherkar */
77 /* REVISION: 9.1 LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
78 /* REVISION: 9.1 LAST MODIFIED: 04/25/00 BY: *N0CG* Santosh Rao */
79 /* REVISION: 9.1 LAST MODIFIED: 06/30/00 BY: *N0DX* Mudit Mehta */
80 /* REVISION: 9.1 LAST MODIFIED: 08/12/00 BY: *N0KN* myb */
81 /* REVISION: 9.1 LAST MODIFIED: 09/25/00 BY: *L121* Gurudev C */
82 /* REVISION: 9.1 LAST MODIFIED: 12/18/00 BY: *M0TZ* Veena Lad */
83 /* REVISION: 9.1 LAST MODIFIED: 10/17/00 BY: *N0WB* Mudit Mehta */
84 /* REVISION: 9.1 LAST MODIFIED: 02/26/01 BY: *M126* Sandeep P */
85 /* Revision: 1.34.1.16 BY: Katie Hilbert DATE: 04/01/01 ECO: *P002* */
86 /* Revision: 1.34.1.19 BY: Sandeep P. DATE: 03/14/01 ECO: *M13J* */
87 /* Revision: 1.34.1.22 BY: Russ Witt DATE: 06/13/01 ECO: *P00J* */
88 /* REVISION: 9.1 LAST MODIFIED: 29 JUN 2001 BY: *N0ZX* Ed van de Gevel */
89 /* Revision: 1.34.1.23 BY: Dan Herman DATE: 07/09/01 ECO: *P007* */
90 /* Revision: 1.34.1.25 BY: Reetu Kapoor DATE: 08/01/01 ECO: *N0ZT* */
91 /* Revision: 1.34.1.26 BY: Russ Witt DATE: 09/21/01 ECO: *P01H* */
92 /* Revision: 1.34.1.27 BY: Russ Witt DATE: 10/17/01 ECO: *P021* */
93 /* Revision: 1.34.1.28 BY: Steve Nugent DATE: 10/22/01 ECO: *P004* */
94 /* Revision: 1.34.1.30 BY: Santhosh Nair DATE: 12/10/01 ECO: *M1H1* */
95 /* Revision: 1.34.1.31 BY: B. Gates DATE: 03/04/02 ECO: *N1BT* */
96 /* Revision: 1.34.1.32 BY: Inna Fox DATE: 02/14/02 ECO: *M12Q* */
97 /* Revision: 1.34.1.33 BY: Patrick Rowan DATE: 03/24/02 ECO: *P00G* */
98 /* Revision: 1.34.1.34 BY: Inna Fox DATE: 04/17/02 ECO: *P05J* */
99 /* Revision: 1.34.1.35 BY: Ashish M. DATE: 05/20/02 ECO: *P04J* */
100 /* Revision: 1.34.1.36 BY: Russ Witt DATE: 06/03/02 ECO: *P07M* */
101 /* Revision: 1.34.1.37 BY: Anitha Gopal DATE: 06/17/02 ECO: *N1KQ* */
102 /* Revision: 1.34.1.38 BY: Steve Nugent DATE: 08/08/02 ECO: *P0DN* */
103 /* Revision: 1.34.1.41 BY: John Pison DATE: 08/30/02 ECO: *P0HM* */
104 /* Revision: 1.34.1.43 BY: Ed van de Gevel DATE: 12/03/02 ECO: *N1XD* */
105 /* Revision: 1.34.1.45 BY: Paul Donnelly (SB) DATE: 06/28/03 ECO: *Q00L* */
106 /* Revision: 1.34.1.46 BY: Rajinder Kamra DATE: 06/23/03 ECO: *Q003* */
107 /* Revision: 1.34.1.47 BY: Rajinder Kamra DATE: 07/17/03 ECO: *Q013* */
108 /* Revision: 1.34.1.48 BY:Mercy Chittilapilly DATE:08/04/03 ECO: *N2DJ* */
109 /* Revision: 1.34.1.49 BY:Somesh Jeswani DATE:09/29/03 ECO: *P14M* */
110 /* Revision: 1.34.1.50 BY: Ashish Maheshwari DATE:11/28/03 ECO: *P1CN* */
111 /* Revision: 1.34.1.51 BY: Ed van de Gevel DATE: 12/02/03 ECO: *P0QT* */
112 /* Revision: 1.34.1.54 BY: Katie Hilbert DATE: 03/05/04 ECO: *Q06B* */
113 /* Revision: 1.34.1.55 BY: Matthew Lee DATE: 09/21/04 ECO: *N2XY* */
114 /* Revision: 1.34.1.56 BY: Tejasvi Kulkarni DATE: 02/14/05 ECO: *P36W* */
115 /* Revision: 1.34.1.59 BY: Ed van de Gevel DATE: 03/01/05 ECO: *R00G* */
116 /* Revision: 1.34.1.60 BY: Bhavik Rathod DATE: 03/15/05 ECO: *P3B6* */
117 /* Revision: 1.34.1.61 BY: Tejasvi Kulkarni DATE: 03/31/05 ECO: *P3B5* */
118 /* Revision: 1.34.1.63 BY: Niranjan Ranka DATE: 05/03/05 ECO: *R01B* */
119 /* Revision: 1.34.1.65 BY: Paul Dreslinski DATE: 08/15/05 ECO: *Q0KY* */
120 /* Revision: 1.34.1.61.1.2 BY: Tiziana Giustozzi DATE: 08/22/05 ECO: *R021* */
121 /* Revision: 1.34.1.66 BY: Michael Hansen DATE: 10/04/05 ECO: *R021* */
122 /* Revision: 1.34.1.67 BY: Sushant Pradhan DATE: 04/17/06 ECO: *P4PD* */
123 /* Revision: 1.34.1.68 BY: Shilpa Kamath DATE: 06/12/06 ECO: *R05X* */
124 /* Revision: 1.34.1.69 BY: Dinesh Dubey DATE: 01/07/07 ECO: *R0C6* */
125 /* Revision: 1.34.1.70 BY: Sumit Karunakaran DATE: 01/07/08 ECO: *P5MB* */
126 /* Revision: 1.34.1.72 BY: Vivek Kamath DATE: 02/05/08 ECO: *P5S6* */
127 /* Revision: 1.34.1.75 BY: Kunal Pandya DATE: 08/04/08 ECO: *Q1QM* */
128 /* Revision: 1.34.1.76 BY: Niranjan Ranka DATE: 10/27/08 ECO: *R16D* */
129 /* Revision: 1.34.1.77 BY: Rajalaxmi Ganji DATE: 12/17/08 ECO: *Q22R* */
130 /* Revision: 1.34.1.78 BY: Trupti Khairnar DATE: 03/13/09 ECO: *Q2J1* */
131 /* $Revision$ BY: Sandeep Rohila DATE: 06/29/09 ECO: *R1KQ* */
132 /* BUDERIM GINGER 2013SE LAST MODIFIED: 11-AUG-2017 BY: nac *d3873 */
133 /*-Revision end---------------------------------------------------------------*/
134
135 /******************************************************************************/
136 /* All patch markers and commented out code have been removed from the source */
137 /* code below. For all future modifications to this file, any code which is */
138 /* no longer required should be deleted and no in-line patch markers should */
139 /* be added. The ECO marker should only be included in the Revision History. */
140 /******************************************************************************/
141
142
143
144 /*!
145 SOSOMTLB.P is called by SOSOMTLA.P to maintain data elements in the
146 larger line item data entry frame in SO and RMA Maintenance.
147 */
148
149 /*!
150 Input parameters are:
151
152 this-is-rma: Will be yes in RMA Maintenance and no in Sales
153 Order Maintenance.
154 rma-recno: When processing an RMA, this is the rma_mstr (the
155 RMA header) recid.
156 rma-issue-line: When processing RMA's, this will be yes when
157 maintaining the issue (outgoing) lines, and no
158 when maintaining the receipt (incoming) lines.
159 In SO Maintenance, this will be yes.
160 rmd-recno: In RMA Maintenance, this will contain the recid
161 for rmd_det (the RMA line). For SO Maintenance,
162 this will be ?.
163 l_prev_um_conv: When the User changes the type to "M" on sales
164 Order or RMA Maintenance then the Inventory will
165 be correctly de-allocated using correct Um
166 l_sodqtyord : Store the previous Quantity to Order to reduce the
167 Quantity Required when user changes the Ship Type
168 from <blank> to Memo.
169
170 Input/Output parameters are:
171
172 confirmApoAtpOrderLine:
173 Logical whether to confirm APO ATP request in
174 Adexa model.
175
176 Output parameters are:
177
178 atp-site: Site returned from APO ATP request.
179 atp-cum-qty: Quantity returned from APO ATP request.
180 atp-qty-site-changed: Logical whether Site or Quantity from APO ATP
181 changed from orginal order line request.
182
183 */
184
185 {us/bbi/mfdeclre.i}
186 {us/bbi/gplabel.i} /* EXTERNAL LABEL INCLUDE */
187 {us/gp/gprunpdf.i "gpglvpl" "p"}
188
189
190 /* CHANGES MADE HERE MAY ALSO NEED TO BE MADE IN fseomtlb.p */
191
192 define input parameter this-is-rma as logical.
193 define input parameter rma-recno as recid.
194 define input parameter rma-issue-line as logical.
195 define input parameter rmd-recno as recid.
196 define input parameter l_prev_um_conv like sod_um_conv no-undo.
197 define input parameter using_consignment like mfc_logical no-undo.
198 define input parameter l_sodqtyord like sod_qty_ord no-undo.
199 define input-output parameter confirmApoAtpOrderLine
200 as logical no-undo.
201 define output parameter atp-site like sod_site no-undo.
202 define output parameter atp-cum-qty like sod_qty_ord no-undo.
203 define output parameter atp-qty-site-changed as logical no-undo.
204
205 define new shared variable zone_to like txz_tax_zone.
206 define new shared variable zone_from like txz_tax_zone.
207 define new shared variable tax_usage like so_tax_usage no-undo.
208 define new shared variable tax_env like so_tax_env no-undo.
209 define new shared variable temp_zone like txz_tax_zone.
210 define new shared variable l_loop_seta like mfc_logical no-undo.
211
212 /* DEFINE RNDMTHD FOR CALL TO GPFRLWT.P */
213 define shared variable rndmthd like rnd_rnd_mthd.
214 define shared variable prev_type like sod_type.
215 define shared variable all_days as integer.
216 define shared variable clines as integer.
217 define shared variable desc1 like pt_desc1.
218 define shared variable line like sod_line.
219 define shared variable sngl_ln like soc_ln_fmt.
220 define shared variable sod_recno as recid.
221 define shared variable sodcmmts like soc_lcmmts.
222 define shared variable sod-detail-all like soc_det_all.
223 define shared variable so_recno as recid.
224 define shared variable totallqty like sod_qty_all.
225 define shared variable so_db like dc_name.
226 define shared variable inv_db like dc_name.
227 define shared variable undo_all2 like mfc_logical.
228 define shared variable mult_slspsn like mfc_logical no-undo.
229 define shared variable new_line like mfc_logical.
230 define shared variable old_sod_site like sod_site no-undo.
231 define shared variable freight_ok like mfc_logical.
232 define shared variable old_ft_type like ft_type.
233 define shared variable calc_fr like mfc_logical.
234 define shared variable disp_fr like mfc_logical.
235 define shared variable soc_pc_line like mfc_logical.
236 define shared variable err-flag as integer.
237 define shared variable sonbr like sod_nbr.
238 define shared variable soline like sod_line.
239 define shared variable exch-rate like exr_rate.
240 define shared variable exch-rate2 like exr_rate2.
241 define shared variable discount as decimal.
242 define shared variable reprice_dtl like mfc_logical.
243 define shared variable promise_date as date.
244 define shared variable new_order like mfc_logical.
245 /* TAX_IN IS USED BY FSRMAVAT.P */
246 define shared variable tax_in like cm_tax_in.
247 /* THE SHARED VARIABLE current_fr_terms IS DEFINED IN pppivar.i, BUT */
248 /* SINCE ONLY THIS VARIABLE IS REQUIRED, TO AVOID OVERHEADS IT HAS */
249 /* BEEN EXPLICITLY DEFINED HERE, INSTEAD OF CALLING PPPIVAR.I */
250 define shared variable current_fr_terms like so_fr_terms.
251
252 define variable sort as character format "x(28)"
253 extent 4 no-undo.
254 define variable counter as integer no-undo.
255 define variable valid_acct like mfc_logical.
256 define variable glvalid like mfc_logical.
257 define variable detqty like sod_qty_ord.
258 define variable old_site like sod_site.
259 define variable continue like mfc_logical no-undo.
260 define variable prev_qty_all like sod_qty_all no-undo.
261 define variable warn like mfc_logical no-undo.
262 define variable rma-receipt-line as logical.
263 define variable frametitle as character format "x(20)".
264 define variable sodstdcost like sod_std_cost no-undo.
265 define variable mc-error-number like msg_nbr no-undo.
266 define variable pkg_code_alt like pt_part extent 7 no-undo.
267 define variable ord_mult_alt like sod_ord_mult extent 7 no-undo.
268 define variable charge_type_alt like cct_charge_type extent 7 no-undo.
269 define variable i as integer no-undo.
270 define variable old_pkg_code like sod_pkg_code no-undo.
271 define variable last-field as character no-undo.
272 define variable old_charge_type like cct_charge_type no-undo.
273 define variable v_charge_type like cct_charge_type no-undo.
274 define variable msgnbr as integer no-undo.
275 define variable chargeable like mfc_logical no-undo.
276 define variable c-alt-container as character format "x(20)" no-undo.
277 define variable c-std-pack as character format "x(12)" no-undo.
278 define variable c-charge-type as character format "x(12)" no-undo.
279 define variable this-is-so as logical no-undo.
280 define variable atp-ok as logical no-undo.
281 define variable atp-due-date like sod_due_date no-undo.
282 define variable auto-prom-date like sod_promise_date no-undo.
283 define variable prev-confirm like sod_confirm no-undo.
284 define variable atp-due-date-changed like mfc_logical no-undo.
285 define variable l_prompt like mfc_logical no-undo.
286 define variable l_undo like mfc_logical no-undo.
287 define variable proc_id as character no-undo.
288 define variable set-sod-type like mfc_logical initial no no-undo.
289
290 /* BTB VARIABLES */
291 define shared variable s-btb-so as logical.
292 define shared variable s-sec-due as date.
293 define variable exp-del as date.
294 define variable pri-due as date.
295 define variable transnbr like cmf_trans_nbr.
296 define variable prev-promise-date like sod_promise_date.
297 define shared variable prev-due-date like sod_due_date.
298 define shared variable po-ack-wait as logical no-undo.
299 define variable p-edi-rollback as logical no-undo initial no.
300 define variable net_avail like sod_qty_all no-undo.
301 define variable new_record as logical no-undo.
302
303 define variable l_use_edi like mfc_logical initial yes no-undo.
304 define variable l_update_qty_all like mfc_logical initial no no-undo.
305 define variable l_invalid_category like mfc_logical initial no no-undo.
306 define variable l_old_fr_list like sod_fr_list no-undo.
307 define variable l_undo_all2 like mfc_logical no-undo.
308
309 define variable moduleGroup as character no-undo.
310 define variable checkAtp as logical no-undo.
311 define variable useApoAtp as logical no-undo.
312 define variable errorResult as character no-undo.
313 define variable apoAtpDelAvail as logical no-undo initial yes.
314 define variable apoAtpDelAvailMsg as integer no-undo.
315 define variable stdAtpUsed as logical no-undo.
316 define variable lv_error_num as integer no-undo.
317 define variable lv_name as character no-undo.
318
319 define variable l_ret-flag as integer no-undo.
320 define variable l_err_flag as integer no-undo.
321
322 define variable l_input_sod_qty_all like sod_qty_all no-undo.
323 define variable l_det-flag like mfc_logical no-undo.
324 define variable l_prev_qty_pick like sod_qty_pick no-undo.
325
326 define new shared variable alc_sod_nbr like sod_nbr.
327 define new shared variable alc_sod_line like sod_line.
328 define new shared variable tot_qty_all like lad_qty_all.
329
330 define variable l_pt_lot_ser as character no-undo.
331 {us/so/sotmpdef.i new}
332
333 define shared stream apoAtpStream.
334
335 {us/px/pxmaint.i}
336
337 /* Define Handles for the programs. */
338 {us/px/pxphdef.i ppitxr}
339 {us/px/pxphdef.i sosoxr1}
340 {us/px/pxphdef.i giapoxr}
341 {us/px/pxphdef.i gpcodxr}
342 /* End Define Handles for the programs. */
343
344 /* APO ATP Global Defines */
345 {us/gi/giapoatp.i}
346
347 define variable c1-discount like discount no-undo.
348 define shared variable corr_inv like mfc_logical no-undo.
349 define variable err_level as integer no-undo.
350 define variable v_is_avail as logical no-undo.
351 define shared variable inv_org like cil_prev_inv no-undo.
352
353 {us/so/sobtbvar.i} /* BACK TO BACK SHARED WORKFILES AND VARIABLES */
354
355 {us/gp/gptxcdec.i} /* DECLARATIONS FOR us/gp/gptxcval.i */
356
357 {us/bbi/gpfilev.i} /* VARIABLE DEFINITIONS FOR gpfile.i */
358
359 define shared frame c.
360 define shared frame d.
361 define shared frame a.
362
363 /*THIS TEMP TABLE IS CREATED TO CALCULATE FREIGHT CHARGES */
364 /*WHEN A NEW SALES ORDER LINE IS ADDED TO AN EXISTING ORDER*/
365 /*WHEN THE FREIGHT TYPE IS "INCLUDE". */
366 define shared temp-table l_fr_table
367 field l_fr_sonbr like sod_nbr
368 field l_fr_soline like sod_line
369 field l_fr_chrg like sod_fr_chg
370 field l_sodlist_pr like sod_list_pr
371 index nbrline is primary l_fr_sonbr l_fr_soline.
372
373 /*DEFINE SHARED FORMS*/
374 {us/so/solinfrm.i}
375
376 /* Update Restrictions Temp Table Definition */
377 {us/up/updaterestriction.i}
378
379 /* CONSIGNMENT VARIABLES */
380 {us/so/socnvars.i}
381 using_cust_consignment = using_consignment.
382
383 form
384 sod_pkg_code colon 20 label "Container Item"
385 sod_ord_mult colon 20
386 sod_charge_type colon 20
387 sod_alt_pkg colon 20
388 with frame cont_pop overlay side-labels centered row 12.
389 /* SET EXTERNAL LABELS */
390 setFrameLabels(frame cont_pop:handle).
391
392 form
393 so_nbr colon 7 label "Order"
394 so_cust colon 25 label "Bill-To"
395 sngl_ln colon 42 label "Ln Fmt"
396 inv_org colon 55 label "Org"
397 with frame a side-labels width 80.
398
399 /* SET EXTERNAL LABELS */
400 setFrameLabels(frame a:handle).
401
402 form
403 pkg_code_alt[1]
404 pkg_code_alt[2]
405 pkg_code_alt[3]
406 pkg_code_alt[4]
407 pkg_code_alt[5]
408 pkg_code_alt[6]
409 pkg_code_alt[7]
410 with frame alt overlay centered side-labels
411 title color normal (getFrameTitle("ALTERNATE_CONTAINERS",29)).
412 /* SET EXTERNAL LABELS */
413 setFrameLabels(frame alt:handle).
414
415 form
416 c-alt-container at 8
417 c-std-pack at 28
418 c-charge-type at 42 skip(1)
419
420 " 01." at 3
421 pkg_code_alt[1] at 8
422 ord_mult_alt[1] at 30
423 charge_type_alt[1] at 44 skip
424
425 " 02." at 3
426 pkg_code_alt[2] at 8
427 ord_mult_alt[2] at 30
428 charge_type_alt[2] at 44 skip
429
430 " 03." at 3
431 pkg_code_alt[3] at 8
432 ord_mult_alt[3] at 30
433 charge_type_alt[3] at 44 skip
434
435 " 04." at 3
436 pkg_code_alt[4] at 8
437 ord_mult_alt[4] at 30
438 charge_type_alt[4] at 44 skip
439
440 " 05." at 3
441 pkg_code_alt[5] at 8
442 ord_mult_alt[5] at 30
443 charge_type_alt[5] at 44 skip
444
445 " 06." at 3
446 pkg_code_alt[6] at 8
447 ord_mult_alt[6] at 30
448 charge_type_alt[6] at 44 skip
449
450 " 07." at 3
451 pkg_code_alt[7] at 8
452 ord_mult_alt[7] at 30
453 charge_type_alt[7] at 44 skip
454 with frame alt-clc overlay centered no-labels width 60
455 title color normal (getFrameTitle("ALTERNATE_CONTAINERS",29)).
456 /* SET EXTERNAL LABELS */
457 setFrameLabels(frame alt-clc:handle).
458
459 /* DETERMINE IF CONTAINER AND LINE CHARGES ARE ENABLED */
460 {us/cc/cclc.i}
461
462 define shared temp-table tt_soddet no-undo like sod_det.
463
464 assign
465 c-alt-container = getTermLabel("ALTERNATE_CONTAINER",20)
466 c-std-pack = getTermLabel("STD_PACK_QTY",12)
467 c-charge-type = getTermLabel("CHARGE_TYPE",12).
468
469 /* ENSURE NECESSARY CODE_MSTR RECORDS EXIST */
470 if this-is-rma and
471 not can-find(code_mstr where code_domain = global_domain
472 and code_fldname = "tr_type"
473 and code_value = "ISS-RMA")
474 then run createCodeMstr.
475
476 find first so_mstr
477 where recid(so_mstr) = so_recno exclusive-lock no-error.
478
479 find first sod_det
480 where recid(sod_det) = sod_recno exclusive-lock no-error.
481
482 for first soc_ctrl
483 fields(soc_domain
484 soc_all_avl
485 soc_due_calc
486 soc_lcmmts
487 soc_atp_enabled
488 soc_horizon
489 soc_shp_lead
490 soc_calc_promise_date
491 soc_use_btb)
492 where soc_domain = global_domain no-lock:
493 end. /* FOR FIRST SOC_CTRL */
494
495 rma-receipt-line = no.
496 if this-is-rma then do:
497 find rma_mstr where recid(rma_mstr) = rma-recno
498 exclusive-lock no-error.
499 find rmd_det where recid(rmd_det) = rmd-recno
500 exclusive-lock no-error.
501
502 for first rmc_ctrl
503 fields( rmc_domain rmc_lcmmts)
504 where rmc_domain = global_domain
505 no-lock:
506 end. /* FOR FIRST RMC_CTRL */
507
508 if not rma-issue-line then
509 rma-receipt-line = yes.
510 end.
511
512 this-is-so = if so_fsm_type = "" then yes else no.
513
514 find first tt_soddet no-error.
515 if available tt_soddet then
516 old_site = tt_soddet.sod_site.
517
518 run siteChanged.
519
520 for first si_mstr
521 fields( si_domain si_auto_loc si_db si_site si_status)
522 where si_domain = global_domain
523 and si_site = sod_det.sod_site
524 no-lock:
525 end. /* FOR FIRST SI_MSTR */
526
527 /* SET SLS, DISC ACCTS BASED ON PRODUCT LINE, SITE, CUST TYPE, CHANNEL */
528
529 for first pt_mstr
530 fields( pt_domain pt_part)
531 where pt_domain = global_domain
532 and pt_part = sod_det.sod_part
533 no-lock:
534 end. /* FOR FIRST PT_MSTR */
535
536 if available pt_mstr
537 then pt_recno = recid(pt_mstr).
538 else pt_recno = ?.
539 if new_line and corr_inv = no then do:
540 {us/bbi/gprun.i ""soplsd.p""}
541 end.
542
543 sodcmmts = (sod_det.sod_cmtindx <> 0 or (new_line and soc_lcmmts)).
544 if not sodcmmts then
545 if this-is-rma and new_line then
546 sodcmmts = rmc_lcmmts.
547
548 if sngl_ln then do:
549 /* Convert cost from remote base currency to local base currency */
550 {us/gp/gprunp.i "mcpl" "p" "mc-curr-conv"
551 "(input """",
552 input base_curr,
553 input exch-rate,
554 input exch-rate2,
555 input sod_det.sod_std_cost,
556 input false,
557 output sodstdcost,
558 output mc-error-number)" }
559 if mc-error-number <> 0 then
560 run display_msg (input mc-error-number, input 2).
561
562 display
563 sod_det.sod_site
564 sod_det.sod_loc
565 sod_det.sod_serial
566 sod_det.sod_qty_all
567 sod_det.sod_qty_pick
568 sod_det.sod_pricing_dt
569 sodstdcost @ sod_det.sod_std_cost
570 sod_det.sod_due_date
571 sod_det.sod_req_date
572 sod_det.sod_per_date
573 sod_det.sod_promise_date
574 sod_det.sod_fr_list
575 sod_det.sod_acct
576 sod_det.sod_sub
577 sod_det.sod_cc
578 sod_det.sod_project
579 sod_det.sod_dsc_acct
580 sod_det.sod_dsc_sub
581 sod_det.sod_dsc_cc
582 sod_det.sod_dsc_project
583 sod_det.sod_confirm
584 sod_det.sod_type
585 sod_det.sod_um_conv
586 sod-detail-all
587 sod_det.sod_taxable
588 sod_det.sod_taxc
589 sod_det.sod_order_category
590 sodcmmts
591 with frame d.
592 end. /* if sngl_ln */
593
594 seta:
595 /* Prompt for rest of the line information on single line screen */
596 do on error undo, retry:
597
598 /* Initialize to no so that if could not connect to APO ATP */
599 /* and user starts all over, that APO ATP processing will be */
600 /* attempted again. */
601 stdAtpUsed = no.
602
603 if sngl_ln
604 then do:
605 /* ADD EDITING TO SET GLOBAL LOC FOR LOT/SER LOOKUP */
606 assign
607 prev_qty_all = if new sod_det
608 then
609 0
610 else
611 sod_det.sod_qty_all
612 l_prev_qty_pick = if new sod_det
613 then
614 0
615 else
616 sod_det.sod_qty_pick
617 prev-promise-date = sod_det.sod_promise_date
618 prev-due-date = sod_det.sod_due_date
619 prev-confirm = sod_det.sod_confirm.
620
621 if not so_secondary and soc_use_btb then
622 rollback:
623 do on error undo, retry:
624
625 for first cm_mstr
626 fields( cm_domain cm_addr)
627 where cm_domain = global_domain
628 and cm_addr = so_cust
629 no-lock:
630 end. /* FOR FIRST CM_ADDR */
631
632 /* CONVERT A DATE TO A STRING VARIABLE */
633 s-cmdval = string ( sod_det.sod_due_date ).
634
635 /* ROLL-BACK */
636 {us/bbi/gprun.i ""sobtbrb.p""
637 "(input recid(so_mstr),
638 input sod_det.sod_line,
639 input ""pod_det"",
640 input ""pod_due_date"",
641 input p-edi-rollback,
642 output return-msg)" }
643
644 /* DISPLAY ERROR MESSAGE RETURN FROM SOBTBRB.P */
645 if return-msg <> 0 then do:
646 run display_msg (input return-msg, input 4).
647 assign
648 s-rb-init = no
649 return-msg = 0.
650 if not (batchrun or {us/bbi/gpiswrap.i}) then pause.
651 undo rollback, return.
652
653 end.
654
655 /* CONVERT A STRING VARIABLE TO A DATE */
656 sod_det.sod_due_date = date(s-cmdval).
657 display
658 sod_det.sod_due_date
659 with frame d.
660 end. /* rollback */
661
662 l_old_fr_list = sod_det.sod_fr_list.
663
664 run setUpdateQtyAll.
665
666 /* ALLOW TYPE TO BE SET WHEN NEW ORDER LINE FOR PART THAT IS IN */
667 /* ITEM MASTER AND TYPE IS NOT BLANK. */
668 if sod_det.sod_type <> "" and available pt_mstr and new_line then
669 set-sod-type = yes.
670
671 /* RMA RECEIPT LINES DO NOT GET ALLOCATIONS. */
672 if corr_inv then do:
673 sod_det.sod_qty_all = sod_det.sod_qty_ord.
674 if sod_det.sod_qty_all < 0 then assign sod_det.sod_qty_all = 0.
675 display sod_det.sod_qty_all with frame d.
676 end.
677
678 set
679 sod_det.sod_loc
680 sod_det.sod_std_cost when (not available pt_mstr)
681 sod_det.sod_serial
682 sod_det.sod_qty_all when (not rma-receipt-line) and
683 (not s-btb-so or l_update_qty_all)
684 /* BTB DIR-SHIP LINES DO NOT GET ALLOCATIONS IN PBU */
685 /* BTB TRANSHIP WITH EDI LINES DO NOT GET ALLOCATIONS IN PBU */
686 sod_det.sod_comm_pct[1] when (sod_det.sod_slspsn[1] <> "")
687 sod_det.sod_acct
688 sod_det.sod_sub
689 sod_det.sod_cc
690 sod_det.sod_project
691 sod_det.sod_dsc_acct when (new_line or reprice_dtl)
692 sod_det.sod_dsc_sub when (new_line or reprice_dtl)
693 sod_det.sod_dsc_cc when (new_line or reprice_dtl)
694 sod_det.sod_dsc_project when (new_line or reprice_dtl)
695 sod_det.sod_confirm when (sod_det.sod_confirm = no or new_line)
696 sod_det.sod_req_date
697 sod_det.sod_promise_date when (not po-ack-wait or so_primary)
698 sod_det.sod_due_date when (not po-ack-wait or not so_primary)
699 sod_det.sod_per_date
700 sod_det.sod_fix_pr
701 sod_det.sod_type when (sod_det.sod_qty_inv = 0 and
702 sod_det.sod_qty_ship = 0 and
703 sod_det.sod_type = ""
704 or set-sod-type)
705
706 sod_det.sod_um_conv when (sod_det.sod_btb_type = "01")
707 /* RMA RECEIPT LINES DO NOT GET TO CONSUME FORECAST */
708 /* NOR DO THEY GET ALLOCATIONS */
709 sod_det.sod_consume when (not rma-receipt-line)
710 sod-detail-all when (not rma-receipt-line)
711 /* DETAIL ALLOCATIONS ARE NOT ALLOWED ON BTB SO LINES */
712 and (not s-btb-so)
713 sod_det.sod_taxable
714 sod_det.sod_taxc
715 sod_det.sod_fr_list
716 sod_det.sod_order_category
717 sodcmmts
718 with frame d
719 editing:
720 if frame-field = "sod_serial" and
721 input sod_det.sod_loc <> global_loc then
722 global_loc = input sod_det.sod_loc.
723 readkey.
724 apply lastkey.
725 end. /* END EDITING */
726
727 if sod_det.sod_qty_all = ?
728 then
729 sod_det.sod_qty_all = 0.
730
731 /* FOR RMA RECEIPT LINES, BECAUSE WE'RE EXPECTING */
732 /* TO RECEIVE THESE ITEMS INTO THE SPECIFIED SITE */
733 /* LOC, BE SURE IT'S VALID. */
734 if this-is-rma and not rma-issue-line then do:
735 /* SOD_SITE IS SCHEMA-VALIDATED */
736
737 for first si_mstr
738 fields( si_domain si_auto_loc si_db si_site si_status)
739 where si_domain = global_domain
740 and si_site = sod_det.sod_site
741 no-lock:
742 end. /* FOR FIRST SI_MSTR */
743
744 if not can-find(loc_mstr
745 where loc_domain = global_domain
746 and loc_site = sod_det.sod_site
747 and loc_loc = sod_det.sod_loc)
748 then do:
749 /* WARN USER OF MISSING LOC IF AUTOLOCATIONS FOR SITE */
750 if si_auto_loc then
751 run display_msg (input 229, input 2).
752 /* LOCATION MASTER DOES NOT EXIST */
753 /* IF SITE DOESN'T HAVE AUTOLOCATIONS, GIVE ERROR */
754 else do:
755 run display_msg (input 229, input 3).
756 next-prompt sod_det.sod_loc with frame d.
757 undo, retry.
758 end.
759 end. /* if not can-find loc_mstr */
760 else do:
761
762 /* ENSURE THIS SITE/LOCATION VALID FOR ISS-RMA */
763
764 for first loc_mstr
765 fields( loc_domain loc_loc loc_site loc_status)
766 where loc_domain = global_domain
767 and loc_site = sod_det.sod_site
768 and loc_loc = sod_det.sod_loc
769 no-lock:
770 end. /* FOR FIRST LOC_MSTR */
771
772 for first ld_det
773 fields( ld_domain ld_loc ld_lot ld_part
774 ld_ref ld_site ld_status)
775 where ld_domain = global_domain
776 and ld_site = sod_det.sod_site
777 and ld_loc = sod_det.sod_loc
778 and ld_part = sod_det.sod_part
779 and ld_lot = sod_det.sod_serial
780 and ld_ref = string(sod_det.sod_ref)
781 no-lock:
782 end. /* FOR FIRST LD_DET */
783
784 if can-find(isd_det
785 where isd_domain = global_domain
786 and isd_tr_type = "ISS-RMA"
787 and isd_status = (if available ld_det then ld_status else
788 if available loc_mstr then loc_status else
789 si_status))
790 then do:
791 /* RESTRICTED TRANSACTION FOR STATUS CODE: */
792 {us/bbi/pxmsg.i &MSGNUM=373 &ERRORLEVEL=3
793 &MSGARG1=
794 "if available ld_det then ld_status
795 else
796 if available loc_mstr then loc_status
797 else si_status"}
798 if sngl_ln then
799 next-prompt sod_det.sod_loc
800 with frame d.
801 undo, retry.
802 end.
803 end. /* else can-find loc_mstr, do */
804 end. /* if this-is-rma and ... */
805
806 if execname = "sosomt.p" or /* SO Maintenance */
807 execname = "fsrmamt.p" then /* RMA Maintenance */
808 do:
809 /* Update Restriction Procedure Library */
810 run mfairunh.p
811 (input "mgurpl.p",
812 input ?,
813 output hUpdateRestrictedLibrary).
814
815 /* Update Restriction Constants */
816 {us/mg/mgurpl.i "hUpdateRestrictedLibrary"}
817
818 /* VALIDATE LINE IS NOT RESTRICTED FOR USER UPDATES */
819 /* CLEAR TEMP TABLE RECORDS BEFORE CREATING NEW RECORD */
820 empty temp-table ttUpdateRestrictionSignature.
821
822 /* CREATE TEMP-TABLE RECORD */
823 create ttUpdateRestrictionSignature.
824 assign
825 ttUpdateRestrictionSignature.program = execname
826 ttUpdateRestrictionSignature.category
827 = if execname = "fsrmamt.p"
828 then {&SSM}
829 else {&SOMT}
830 ttUpdateRestrictionSignature.part
831 = sod_det.sod_part
832 ttUpdateRestrictionSignature.inventoryStatus = ?
833 ttUpdateRestrictionSignature.inventoryStatusTo = ?
834 ttUpdateRestrictionSignature.account = ?
835 ttUpdateRestrictionSignature.subAccount = ?
836 ttUpdateRestrictionSignature.costCenter = ?
837 ttUpdateRestrictionSignature.project = ?
838 ttUpdateRestrictionSignature.changeInventoryStatus = ?.
839
840 /* Check if a RMA or SO */
841 if this-is-rma then
842 do:
843 /* Check if an issue or receipt order line */
844 if rma-issue-line then
845 do:
846 assign
847 ttUpdateRestrictionSignature.site = sod_det.sod_site
848 ttUpdateRestrictionSignature.siteTo = rma_mstr.rma_site_rec
849 ttUpdateRestrictionSignature.location = sod_det.sod_loc
850 ttUpdateRestrictionSignature.locationTo = rma_mstr.rma_loc_rec.
851 end.
852 else do:
853 assign
854 ttUpdateRestrictionSignature.site = rma_mstr.rma_site_iss
855 ttUpdateRestrictionSignature.siteTo = sod_det.sod_site
856 ttUpdateRestrictionSignature.location = rma_mstr.rma_loc_iss
857 ttUpdateRestrictionSignature.locationTo = sod_det.sod_loc.
858 end.
859 end.
860 else do:
861 /* Sales Order */
862 assign
863 ttUpdateRestrictionSignature.site = sod_det.sod_site
864 ttUpdateRestrictionSignature.siteTo = ?
865 ttUpdateRestrictionSignature.location = sod_det.sod_loc
866 ttUpdateRestrictionSignature.locationTo = ?.
867 end.
868
869 if isUpdateRestricted(input table ttUpdateRestrictionSignature,
870 input yes)
871 then do:
872 undo seta, retry.
873 end.
874 end. /* end if lookup */
875
876 assign
877 continue = yes
878 warn = no
879 atp-ok = yes
880 atp-due-date = ?.
881
882 /* Determine promise date and due date defaulting */
883 if sod_det.sod_confirm = yes
884 and ((not this-is-rma) or rma-issue-line)
885 and soc_calc_promise_date = yes
886 /* DO FOR RMA ISSUE LINES, NOT RECEIPT LINES */
887 and not (s-btb-so = yes and sod_det.sod_btb_type > "01")
888 then do:
889 run p-calc-date-defaults (input so_ship,
890 input sod_det.sod_site,
891 input sod_det.sod_req_date,
892 input-output sod_det.sod_promise_date,
893 input-output sod_det.sod_due_date).
894
895 display
896 sod_det.sod_promise_date
897 sod_det.sod_due_date
898 with frame d.
899 pause 0.
900 end. /* sod_confirm = yes... */
901
902 run checkSiteDB.
903
904 if err-flag = 0 or err-flag = 9 then do:
905
906 /* Validate ATP if necessary */
907 if sod_det.sod_qty_ord - sod_det.sod_qty_ship > 0
908 and not sod_det.sod_sched
909 and ((not this-is-rma) or rma-issue-line)
910 /* DO FOR RMA ISSUE LINES, NOT RECEIPT LINES */
911 and not (s-btb-so = yes and sod_det.sod_btb_type > "01")
912 then do:
913 hide frame d.
914 hide frame c.
915 hide frame a.
916
917 /* When an APO ATP request was processed with insufficient demand, */
918 /* the user may choose to modify the order line to match the APO */
919 /* ATP results. If the atp-due-date field is populated, this */
920 /* indicates that the user has chosen to override the original */
921 /* input with data returned from APO ATP. */
922 /* Order line site, date and quantity are modified to the APO ATP */
923 /* site, date and quantity only for: */
924 /* - multi line order entry or */
925 /* - single line order entry when quantity has changed or */
926 /* - site has changed */
927
928 run updateWithApoAtpData.
929
930 /* DETERMINE IF TO USE APO ATP FOR MODULE */
931 run setUpForApoAtp.
932
933 if checkAtp then
934 run p-check-atp.
935
936 view frame a.
937 view frame c.
938 view frame d.
939 pause 0.
940
941 if checkAtp and useApoAtp then do:
942 if keyfunction(lastkey) = "end-error" then do:
943 next-prompt sod_det.sod_loc with frame d.
944 undo, retry.
945 end.
946
947 if not continue then do:
948 next-prompt sod_det.sod_due_date with frame d.
949 undo, retry.
950 end.
951
952 run updateWithApoAtpData.
953
954 /* errorResult 0 - Confirm Order Line */
955 /* errorResult 1 - Change date for order line */
956 /* errorResult 2 - Change quantity for order line */
957 /* errorResult 3 - Site changed for order line */
958 /* When date, quantity or site changed, */
959 /* return user to order line. */
960 if errorResult = "0" then
961 confirmApoAtpOrderLine = yes.
962 else if errorResult = "1" then do:
963 display sod_det.sod_due_date with frame d.
964 next-prompt sod_det.sod_due_date with frame d.
965 undo, retry.
966 end.
967 else if errorResult = "2" then do:
968 display sod_det.sod_qty_ord with frame c.
969 atp-qty-site-changed = true.
970 end.
971 else if errorResult = "3" then do:
972 display sod_det.sod_due_date with frame d.
973 atp-qty-site-changed = true.
974 end.
975 end. /* checkAtp and useApoAtp */
976 end. /* Validate ATP if necessary */
977
978 end. /* if err-flag */
979
980 if si_db <> so_db then do:
981 {us/bbi/gprun.i ""gpalias3.p"" "(so_db,output err-flag)" }
982 end. /* if si_db <> so_db */
983
984 if warn then do:
985 /* QTY AVAILABLE FOR ITEM */
986 {us/bbi/pxmsg.i &MSGNUM=237 &ERRORLEVEL=2
987 &MSGARG1=" sod_det.sod_part + "": "" + string(net_avail) "}
988 if not batchrun
989 then do:
990 /* DO YOU WISH TO CONTINUE? */
991 {us/bbi/pxmsg.i &MSGNUM=7734 &ERRORLEVEL=2 &CONFIRM=continue
992 &CONFIRM-TYPE='LOGICAL'}
993 end. /* IF NOT BATCHRUN */
994 next-prompt sod_det.sod_qty_all with frame d.
995 if not continue then do:
996 hide message.
997 undo, retry.
998 end.
999 else hide message.
1000 end.
1001
1002
1003 if checkAtp
1004 and useApoAtp = no
1005 then do:
1006 /* CHANGE DUE DATE IF DIFFERENT DATE RETURNED */
1007 atp-due-date-changed = no.
1008
1009 if atp-due-date <> ?
1010 and atp-due-date <> sod_det.sod_due_date
1011 then
1012 assign
1013 atp-due-date-changed = yes
1014 sod_det.sod_due_date = atp-due-date.
1015
1016 if atp-due-date-changed
1017 then
1018 display
1019 sod_det.sod_due_date
1020 with frame d.
1021
1022 if atp-ok = no
1023 then do:
1024 /* ATP ENFORCEMENT ERROR, QTY ORDERED NOT ALLOWED */
1025 /* FOR DUE DATE xxxxxxxx */
1026 {us/bbi/pxmsg.i &MSGNUM=4099 &ERRORLEVEL=3 &MSGARG1=sod_det.sod_due_date}
1027 next-prompt
1028 sod_det.sod_due_date with frame d.
1029 if not batchrun
1030 and not {us/bbi/gpiswrap.i}
1031 then
1032 pause.
1033 undo, retry.
1034 end.
1035
1036 /* RESET PROMISE DATE IF NEEDED */
1037 /* ONLY RESET IF CALC PROMISE DATE = YES */
1038
1039 if soc_calc_promise_date = yes
1040 and (sod_det.sod_due_date <> prev-due-date
1041 or sod_det.sod_confirm <> prev-confirm
1042 or sod_det.sod_promise_date = ?
1043 or atp-due-date-changed = yes)
1044 and sod_det.sod_confirm = yes
1045 and sod_det.sod_due_date <> ?
1046 /* DO FOR RMA ISSUE LINES, NOT RECEIPT LINES */
1047 and ((not this-is-rma)
1048 or rma-issue-line)
1049 /* BYPASS EMT ITEMS */
1050 and not (s-btb-so = yes
1051 and sod_det.sod_btb_type > "01")
1052 then do:
1053 auto-prom-date = ?.
1054
1055 run p-calc-prom-or-due-date (input so_ship,
1056 input sod_det.sod_site,
1057 input-output sod_det.sod_due_date,
1058 input-output auto-prom-date).
1059
1060 if auto-prom-date <> ?
1061 then do:
1062 sod_det.sod_promise_date = auto-prom-date.
1063 display
1064 sod_det.sod_promise_date
1065 with frame d.
1066 pause 0.
1067 end. /* IF auto-prom-date <> ? */
1068
1069 end. /* IF soc_calc_promise_date = yes */
1070 end. /* IF checkAtp and useApoAtp = no */
1071
1072 /* Allow only zero or positive quantity for allocation */
1073 if sod_det.sod_qty_all < 0 then do:
1074 /* Qty allocated cannot be < 0 */
1075 run display_msg (input 6230, input 3).
1076 next-prompt sod_det.sod_qty_all with frame d.
1077 undo, retry.
1078 end.
1079
1080 /* Allow allocations only for confirmed lines */
1081 if sod_det.sod_qty_all <> 0 and not sod_det.sod_confirm then do:
1082 run display_msg (input 688, input 3).
1083 /* Allocs not allowed for unconfirmed lines */
1084 next-prompt sod_det.sod_confirm with frame d.
1085 undo, retry.
1086 end.
1087
1088 /* VALIDATE THE AVAILABILITY OF THE REMOTE DOMAIN */
1089 if sod_det.sod_confirm then do:
1090
1091 for first si_mstr
1092 fields( si_domain si_auto_loc si_db si_site si_status)
1093 where si_domain = global_domain
1094 and si_site = sod_det.sod_site
1095 no-lock:
1096 end. /* FOR FIRST SI_MSTR */
1097 if global_db <> si_db then do:
1098 {us/gp/gprunp.i "mgdompl" "p" "ppDomainConnect"
1099 "(input si_db,
1100 output lv_error_num,
1101 output lv_name)"}
1102
1103 if lv_error_num <> 0 then do:
1104 run display_msg (input lv_error_num, input 3).
1105 next-prompt sod_det.sod_confirm with frame d.
1106 undo, retry.
1107 end.
1108 end. /* if global_db <> si_db then do: */
1109 end.
1110
1111 /* MULTI EMT DO NOT ALLOW DATE CHANGE AT THE SBU */
1112 if so_secondary and not new_line
1113 and sod_det.sod_promise_date <> prev-promise-date
1114 and (sod_det.sod_btb_type = "03" or sod_det.sod_btb_type = "02")
1115 then do:
1116 run display_msg (input 2825, input 3).
1117 /* NO CHANGE IS ALLOWED ON EMT SO */
1118 next-prompt sod_det.sod_promise_date with frame d.
1119 undo, retry.
1120 end.
1121
1122 if so_secondary and not new_line
1123 and sod_det.sod_due_date <> prev-due-date
1124 and (sod_det.sod_btb_type = "03" or sod_det.sod_btb_type = "02")
1125 then do:
1126 run display_msg (input 2825, input 3).
1127 /* NO CHANGE IS ALLOWED ON EMT SO */
1128 next-prompt sod_det.sod_due_date with frame d.
1129 undo, retry.
1130 end.
1131
1132 /* VALIDATE FREIGHT LIST */
1133 if sod_det.sod_fr_list <> "" then do:
1134
1135 for first fr_mstr
1136 fields( fr_domain fr_curr fr_list fr_site)
1137 where fr_domain = global_domain
1138 and fr_list = sod_det.sod_fr_list
1139 and fr_site = sod_det.sod_site
1140 and fr_curr = so_curr
1141 no-lock:
1142 end. /* FOR FIRST FR_MSTR */
1143
1144 if not available fr_mstr then
1145
1146 for first fr_mstr
1147 fields( fr_domain fr_curr fr_list fr_site)
1148 where fr_mstr.fr_domain = global_domain
1149 and fr_list = sod_det.sod_fr_list
1150 and fr_site = sod_det.sod_site
1151 and fr_curr = base_curr
1152 no-lock:
1153 end. /* FOR FIRST FR_MSTR */
1154
1155 if not available fr_mstr then do:
1156 /* FREIGHT LIST # NOT FOUND FOR SITE # CURRENCY */
1157 {us/bbi/pxmsg.i &MSGNUM=670
1158 &MSGARG1=sod_det.sod_fr_list
1159 &MSGARG2=sod_det.sod_site
1160 &MSGARG3=so_curr}
1161 next-prompt sod_det.sod_fr_list with frame d.
1162 undo, retry.
1163 end.
1164 end. /* if sod_fr_list <> "" */
1165
1166 if sod_det.sod_fr_list <> l_old_fr_list
1167 then
1168 sod_det.sod_manual_fr_list = yes.
1169
1170 /* ACCT/SUB/CC/PROJ VALIDATION */
1171 run ip_validate_fullcode
1172 (input sod_det.sod_acct,
1173 input sod_det.sod_sub,
1174 input sod_det.sod_cc,
1175 input sod_det.sod_project,
1176 input "sod_acct",
1177 output valid_acct).
1178
1179 if valid_acct = no then
1180 next-prompt sod_det.sod_acct with frame d.
1181 if valid_acct = no then
1182 undo, retry.
1183
1184 /* ACCT/SUB/CC/PROJ VALIDATION */
1185 run ip_validate_fullcode
1186 (input sod_det.sod_dsc_acct,
1187 input sod_det.sod_dsc_sub,
1188 input sod_det.sod_dsc_cc,
1189 input sod_det.sod_dsc_project,
1190 input "sod_dsc_acct",
1191 output valid_acct).
1192
1193 if valid_acct = no then
1194 next-prompt sod_det.sod_dsc_acct with frame d.
1195 if valid_acct = no then
1196 undo, retry.
1197
1198 if so_curr <> base_curr then do:
1199
1200 for first ac_mstr
1201 fields( ac_domain ac_code ac_curr)
1202 where ac_domain = global_domain
1203 and ac_code = sod_det.sod_acct
1204 no-lock:
1205 end. /* FOR FIRST AC_MSTR */
1206
1207 if available ac_mstr and ac_curr <> so_curr
1208 and ac_curr <> base_curr
1209 then do:
1210 run display_msg (input 134, input 3).
1211 /*ACCT CURR MUST EITHER BE TRANS OR BASE CURR*/
1212 next-prompt sod_det.sod_acct with frame d.
1213 undo, retry.
1214 end.
1215
1216 for first ac_mstr
1217 fields( ac_domain ac_code ac_curr)
1218 where ac_domain = global_domain
1219 and ac_code = sod_det.sod_dsc_acct no-lock:
1220 end. /* FOR FIRST AC_MSTR */
1221
1222 if available ac_mstr and ac_curr <> so_curr
1223 and ac_curr <> base_curr
1224 then do:
1225 run display_msg (input 134, input 3).
1226 /*ACCT CURR MUST EITHER BE TRANS OR BASE CURR*/
1227 next-prompt sod_det.sod_dsc_acct with frame d.
1228 undo, retry.
1229 end.
1230 end.
1231
1232 /* VALIDATE TAXCODE*/
1233 {us/gp/gptxcval.i &code=sod_det.sod_taxc &frame="d"}
1234
1235 /* VALIDATE sod_order_category AGAINST GENERALIZED CODES */
1236 l_invalid_category = no.
1237 if sod_det.sod_order_category <> "" then
1238 run ValidateCategory
1239 (input sod_det.sod_order_category,
1240 output l_invalid_category).
1241 if l_invalid_category then
1242 next-prompt sod_det.sod_order_category with frame d.
1243 if l_invalid_category then undo, retry.
1244
1245
1246 /* FOLLOWING TESTS NOT NEEDED FOR RMA RECEIPT LINES BECAUSE */
1247 /* ALLOCATIONS ON THEM WILL ALWAYS BE ZERO. */
1248 /* VALIDATE IF QTY ORD > 0 */
1249 if sod_det.sod_qty_ord >= 0 and
1250 sod_det.sod_qty_ord < sod_det.sod_qty_all
1251 + sod_det.sod_qty_pick
1252 + sod_det.sod_qty_ship
1253 and not sod_det.sod_sched
1254 and not rma-receipt-line
1255 /* ALLOCATIONS ON BTB SO LINES ARE ZERO */
1256 and not s-btb-so
1257 then do:
1258 repeat:
1259 run display_msg (input 4999, input 3).
1260 /* Ord qty cannot be < alloc+pick+ship */
1261 update sod_det.sod_qty_all with frame d.
1262 if sod_det.sod_qty_all = ?
1263 then
1264 sod_det.sod_qty_all = 0.
1265 continue = yes.
1266 warn = no.
1267
1268 for first si_mstr
1269 fields( si_domain si_auto_loc si_db si_site si_status)
1270 where si_mstr.si_domain = global_domain
1271 and si_site = sod_det.sod_site no-lock:
1272 end. /* FOR FIRST SI_MSTR */
1273
1274 run allocationCheck.
1275
1276 if warn then do:
1277 /* QTY AVAILABLE FOR ITEM */
1278 {us/bbi/pxmsg.i &MSGNUM=237 &ERRORLEVEL=2
1279 &MSGARG1=" sod_det.sod_part + "": ""
1280 + string(net_avail) "}
1281 if not batchrun
1282 then do:
1283 /* DO YOU WISH TO CONTINUE? */
1284 {us/bbi/pxmsg.i &MSGNUM=7734 &ERRORLEVEL=2 &CONFIRM=continue
1285 &CONFIRM-TYPE='LOGICAL'}
1286 end. /* IF NOT BATCHRUN */
1287 if not continue then
1288 undo, retry.
1289 end. /* if warn */
1290
1291 if sod_det.sod_qty_all < 0 then do:
1292 run display_msg (input 6230, input 3).
1293 /* Qty allocated cannot be < 0 */
1294 next-prompt sod_det.sod_qty_all with frame d.
1295 undo, retry.
1296 end.
1297 if sod_det.sod_qty_ord >= sod_det.sod_qty_all +
1298 sod_det.sod_qty_pick + sod_det.sod_qty_ship
1299 then leave.
1300 end. /* repeat */
1301 if keyfunction(lastkey) = "end-error" then undo, retry.
1302 end. /* if sod_qty_ord >= 0 ... */
1303
1304 /* FOLLOWING TESTS NOT NEEDED FOR RMA RECEIPT LINES BECAUSE */
1305 /* ALLOCATIONS ON THEM WILL ALWAYS BE ZERO. */
1306 /* VALIDATE IF QTY ORD < 0 */
1307
1308 if sod_det.sod_qty_ord < 0
1309 and not sod_det.sod_sched
1310 and not rma-receipt-line
1311 then do:
1312 repeat on error undo, retry:
1313
1314 if (sod_det.sod_qty_all<> 0 or sod_det.sod_qty_ship > 0 or
1315 sod_det.sod_qty_pick > 0)
1316 then do:
1317 /* ORD QTY CANNOT BE < ALLOC+PICK+SHIP */
1318 run display_msg (input 4999, input 3).
1319 update sod_det.sod_qty_all with frame d.
1320 if sod_det.sod_qty_all = ?
1321 then
1322 sod_det.sod_qty_all = 0.
1323 end.
1324 else leave.
1325
1326 end. /* END OF REPEAT ON ERROR, UNDO RETRY */
1327 if keyfunction(lastkey) = "end-error" then undo, retry.
1328 end. /* END OF IF sod_qty_ord < 0 */
1329
1330 /* Update commission percentages if there are multiple salespersons. */
1331 if mult_slspsn and sngl_ln then
1332 set_comm:
1333 do on error undo, retry on endkey undo, leave seta:
1334 form
1335 sod_det.sod_slspsn[1] colon 15 label "Salesperson 1"
1336 sod_det.sod_comm_pct[1] colon 26 no-label
1337 sort[1] colon 35 no-label
1338 sod_det.sod_slspsn[2] colon 15 label "Salesperson 2"
1339 sod_det.sod_comm_pct[2] colon 26 no-label
1340 sort[2] colon 35 no-label
1341 sod_det.sod_slspsn[3] colon 15 label "Salesperson 3"
1342 sod_det.sod_comm_pct[3] colon 26 no-label
1343 sort[3] colon 35 no-label
1344 sod_det.sod_slspsn[4] colon 15 label "Salesperson 4"
1345 sod_det.sod_comm_pct[4] colon 26 no-label
1346 sort[4] colon 35 no-label
1347 with frame set_comm overlay side-labels
1348 centered row 16 width 66.
1349
1350 run setSort.
1351
1352 /* SET EXTERNAL LABELS */
1353 setFrameLabels(frame set_comm:handle).
1354 display
1355 sod_det.sod_slspsn
1356 sod_det.sod_comm_pct
1357 sort
1358 with frame set_comm.
1359 update sod_det.sod_comm_pct with frame set_comm.
1360 hide frame set_comm no-pause.
1361 end.
1362
1363 /* FREIGHT WEIGHTS */
1364 if sod_det.sod_fr_list <> "" then do:
1365 set_wt:
1366 do on error undo, retry:
1367 freight_ok = yes.
1368 if sngl_ln and (calc_fr or disp_fr) then do:
1369 detqty = sod_det.sod_qty_ord - sod_det.sod_qty_ship.
1370
1371 /* ASSIGN so_fr_terms WITH THE FREIGHT TERMS FROM */
1372 /* THE BEST PRICING ROUTINE TO PREVENT ANY ERROR */
1373 /* OR WARNING MESSAGES FROM BEING DISPLAYED AT */
1374 /* THE LINE LEVEL */
1375
1376 if current_fr_terms <> ""
1377 and so_manual_fr_terms = no
1378 then
1379 so_fr_terms = current_fr_terms.
1380
1381 if old_ft_type = "5"
1382 then do:
1383 for first l_fr_table
1384 where l_fr_sonbr = sod_det.sod_nbr
1385 and l_fr_soline = sod_det.sod_line
1386 no-lock:
1387 end. /* FOR FIRST l_fr_table */
1388 if not available l_fr_table
1389 then do:
1390 create l_fr_table.
1391 assign
1392 l_fr_sonbr = sod_det.sod_nbr
1393 l_fr_soline = sod_det.sod_line
1394 l_fr_chrg = 0
1395 l_sodlist_pr = (if reprice_dtl
1396 then sod_det.sod_list_pr
1397 else 0).
1398 end. /* IF NOT AVAILABLE l_fr_table */
1399
1400 l_fr_chrg = (if new_line
1401 then 0
1402 else sod_det.sod_fr_chg).
1403 end. /* IF old_ft_type = "5" */
1404
1405 /* IF IT IS A VALID DATE, USE THE DUE DATE. OTHERWISE, USE */
1406 /* THE CURRENT DATE. */
1407 /* ADDED SECOND EXCHANGE RATE BELOW */
1408 /* ADDED INPUT PARAMETERS sod_nbr, sod_line AND sod_sob_std */
1409 {us/bbi/gprun.i ""gpfrlwt.p""
1410 "(input so_curr,
1411 input so_ex_rate,
1412 input so_ex_rate2,
1413 input so_fr_min_wt,
1414 input so_fr_terms,
1415 input so_ship,
1416 if sod_det.sod_due_date <> ?
1417 then sod_det.sod_due_date
1418 else today,
1419 input sod_det.sod_fr_list,
1420 input sod_det.sod_part,
1421 input detqty,
1422 input sod_det.sod_site,
1423 input sod_det.sod_type,
1424 input sod_det.sod_um,
1425 input calc_fr,
1426 input disp_fr,
1427 input sod_det.sod_nbr,
1428 input sod_det.sod_line,
1429 input sod_det.sod_sob_std,
1430 input-output sod_det.sod_fr_wt,
1431 input-output sod_det.sod_fr_wt_um,
1432 input-output sod_det.sod_fr_class,
1433 input-output sod_det.sod_fr_chg,
1434 input-output freight_ok)"}
1435 end. /* if sngl_ln and... */
1436
1437 if not freight_ok then do:
1438 /* FREIGHT ERROR DETECTED - CHARGES MAY BE INCOMPLETE */
1439 run display_msg (input 669, input 2).
1440 if not {us/bbi/gpiswrap.i} then
1441 pause.
1442 undo set_wt, leave set_wt.
1443 end.
1444 end.
1445 end. /* if sod_fr_lst <> "" */
1446
1447 /*d3873*/ if sod_det.sod_serial <> "" then sod-detail-all = yes.
1448
1449 run determineQuantityAllocated.
1450
1451 run checkReservedLocation.
1452
1453 if not corr_inv then do:
1454 if (sod-detail-all or sod_det.sod_qty_ord entered
1455 and l_ret-flag <> 1
1456 and totallqty <> 0)
1457 and (sod_det.sod_qty_all > 0
1458 or (sod_det.sod_qty_all = 0
1459 and (available tt_soddet
1460 and tt_soddet.sod_qty_all > 0)))
1461 and sod_det.sod_type = ""
1462 then
1463 /* DO DETAIL ALLOCATIONS */
1464 run doDetailAllocations.
1465
1466 if sod_det.sod_qty_ord >= 0
1467 and sod_det.sod_qty_ord < totallqty +
1468 sod_det.sod_qty_pick +
1469 sod_det.sod_qty_ship
1470 then do:
1471 /* Qty ord cannot be less than all + pick + ship*/
1472 {us/bbi/pxmsg.i &MSGNUM=4999 &ERRORLEVEL=3}
1473 undo seta, retry seta.
1474 end. /* IF sod_det.sod_qty_ord >= 0 AND ... */
1475 end.
1476 else do:
1477 do on error undo,retry on endkey undo, leave:
1478 v_is_avail = yes.
1479 if sod_det.sod_loc <> "" then do:
1480 for first loc_mstr no-lock where loc_domain = global_domain
1481 and loc_site = sod_det.sod_site
1482 and loc_loc = sod_det.sod_loc:
1483 for first is_mstr no-lock
1484 where is_domain = global_domain
1485 and is_status = loc_mstr.loc_status :
1486 if is_mstr.is_avail = no then v_is_avail = no.
1487 end.
1488 end.
1489 end.
1490
1491 {us/px/pxrun.i &PROC = 'getFieldDefault'
1492 &PROGRAM = 'ppitxr.p'
1493 &HANDLE = ph_ppitxr
1494 &PARAM = "( input sod_det.sod_part,
1495 input sod_det.sod_site,
1496 input ""pt_lot_ser"",
1497 output l_pt_lot_ser)"
1498 &NOAPPERROR = true
1499 &CATCHERROR = true
1500 }
1501 if (sod-detail-all or sod_det.sod_qty_ord entered)
1502 and sod_det.sod_qty_all >= 0
1503 and sod_det.sod_type = ""
1504 and ((l_pt_lot_ser = "L" or l_pt_lot_ser = "S")
1505 or v_is_avail
1506 or sod_det.sod_serial <> "")
1507 then do:
1508 run doDetailAllocations.
1509
1510 if sod_det.sod_qty_ord >= 0
1511 and sod_det.sod_qty_ord < totallqty +
1512 sod_det.sod_qty_pick +
1513 sod_det.sod_qty_ship
1514 then do:
1515 /* Qty ord cannot be less than all + pick + ship*/
1516 {us/bbi/pxmsg.i &MSGNUM=4999 &ERRORLEVEL=3}
1517 undo seta, retry seta.
1518 end. /* IF sod_det.sod_qty_ord >= 0 AND ... */
1519
1520 if totallqty <> sod_det.sod_qty_ord then do:
1521 {us/bbi/pxmsg.i &MSGNUM=6428 &ERRORLEVEL=3}
1522 /* Quantity allocated <> quantity ordered */
1523 undo seta, retry seta.
1524 end.
1525 end.
1526 end.
1527 end.
1528
1529 if sod_det.sod_qty_all < totallqty
1530 and not l_update_qty_all
1531 then
1532 sod_det.sod_qty_all = totallqty.
1533
1534 if corr_inv then sod_det.sod_qty_all = sod_det.sod_qty_ord.
1535
1536 /* GET TAX MANAGEMENT DATA */
1537 {us/bbi/gprun.i ""sosomtlc.p"" "(input this-is-rma)"}
1538 if not l_loop_seta then leave seta.
1539
1540 end. /* if sngl_ln */
1541 else do: /* multi line */
1542
1543 {us/gp/gptxcval.i &code=sod_det.sod_taxc &frame="NO-FRAME"}
1544 /* Validate accounts and cost centers as they don't get validated */
1545 /* In multi line format */
1546
1547 /* ACCT/SUB/CC/PROJ VALIDATION */
1548 run ip_validate_fullcode
1549 (input sod_det.sod_acct,
1550 input sod_det.sod_sub,
1551 input sod_det.sod_cc,
1552 input sod_det.sod_project,
1553 input "sod_acct",
1554 output glvalid).
1555
1556 if glvalid = no then undo seta , leave.
1557
1558 /* ACCT/SUB/CC/PROJ VALIDATION */
1559 run ip_validate_fullcode
1560 (input sod_det.sod_dsc_acct,
1561 input sod_det.sod_dsc_sub,
1562 input sod_det.sod_dsc_cc,
1563 input sod_det.sod_dsc_project,
1564 input "sod_acct",
1565 output glvalid).
1566 if glvalid = no then undo seta , leave.
1567
1568 if so_curr <> base_curr then do:
1569
1570 for first ac_mstr
1571 fields( ac_domain ac_code ac_curr)
1572 where ac_domain = global_domain
1573 and ac_code = sod_det.sod_acct
1574 no-lock:
1575 end. /* FOR FIRST AC_CODE */
1576
1577 if available ac_mstr and ac_curr <> so_curr
1578 and ac_curr <> base_curr
1579 then do:
1580 run display_msg (input 134, input 3).
1581 /*ACCT CURR MUST EITHER BE TRANS OR BASE CURR*/
1582 undo seta, leave.
1583 end.
1584
1585 for first ac_mstr
1586 fields( ac_domain ac_code ac_curr)
1587 where ac_domain = global_domain
1588 and ac_code = sod_det.sod_dsc_acct
1589 no-lock:
1590 end. /* FOR FIRST AC_MSTR */
1591
1592 if available ac_mstr and ac_curr <> so_curr
1593 and ac_curr <> base_curr
1594 then do:
1595 run display_msg (input 134, input 3).
1596 /*ACCT CURR MUST EITHER BE TRANS OR BASE CURR*/
1597 undo seta, leave.
1598 end.
1599 end. /* if so_curr <> base_curr */
1600
1601 /* VALIDATE IF QTY ORD > 0 */
1602
1603 if ((sod_det.sod_qty_ord >= 0
1604 and sod_det.sod_qty_ord < sod_det.sod_qty_all
1605 + sod_det.sod_qty_pick
1606 + sod_det.sod_qty_ship)
1607 or (sod_det.sod_qty_ord < 0 and
1608 (sod_det.sod_qty_all <>0 or sod_det.sod_qty_pick >0
1609 or sod_det.sod_qty_ship > 0))
1610 and not sod_det.sod_sched)
1611 then do:
1612 run display_msg (input 4999, input 3).
1613 /* Ord qty cannot be < alloc+pick+ship */
1614 undo seta, leave.
1615 end.
1616 end. /* multi line */
1617
1618 if {us/bbi/gpiswrap.i} then pause 0. /* This prevents cases of DT UI "hanging"*/
1619
1620 if (not sod-detail-all)
1621 then do:
1622 run checkReservedLocation.
1623
1624 /* CHECK FOR NEW LINE (RECORD) AND HANDLE QUANTITY ALLOCATED */
1625 if l_ret-flag = 1
1626 and l_det-flag
1627 and new_line
1628 then do:
1629 assign
1630 alc_sod_nbr = sod_det.sod_nbr
1631 alc_sod_line = sod_det.sod_line
1632 tot_qty_all = sod_det.sod_qty_all.
1633
1634 run detailAllocate.
1635 run determineQuantityAllocated.
1636
1637 if sod_det.sod_qty_all > totallqty
1638 then
1639 sod_det.sod_qty_all = totallqty.
1640 end. /* IF l_ret-flag = 1 AND l_det-flag ... */
1641
1642 /* HANDLE QUANTITY ALLOCATED FOR THE EXISTING LINE */
1643 else if l_ret-flag = 1
1644 and l_det-flag
1645 and (not new_line)
1646 and (input sod_det.sod_qty_all <> prev_qty_all)
1647 then do:
1648 l_input_sod_qty_all = input sod_det.sod_qty_all.
1649 run updateDetailAllocations.
1650 end. /* ELSE DO */
1651 end. /* IF NOT sod-detail-all */
1652
1653
1654 /* DISPLAY CONSIGNMENT FRAMES */
1655 if using_cust_consignment and this-is-so then do:
1656 proc_id = "popup-update".
1657 {us/gp/gprunmo.i
1658 &program=""socnsod.p""
1659 &module="ACN"
1660 &param="""(input proc_id,
1661 input sod_det.sod_nbr,
1662 input string(sod_det.sod_line),
1663 input sod_det.sod_part,
1664 input so_ship,
1665 input sod_det.sod_site,
1666 input no,
1667 input sod_det.sod_type,
1668 output l_undo_all2)"""}
1669 end. /* IF using_cust_consignment */
1670
1671 if l_undo_all2
1672 then do:
1673 undo_all2 = yes.
1674 undo seta, leave.
1675 end. /* IF l_undo_all2 */
1676
1677 if using_container_charges and this-is-so then do:
1678 setcontainer:
1679 /* Prompt for rest of the line information on single line screen */
1680 do on error undo, retry on endkey undo, leave setcontainer:
1681 display
1682 sod_det.sod_pkg_code
1683 sod_det.sod_ord_mult
1684 sod_det.sod_charge_type
1685 sod_det.sod_alt_pkg
1686 with frame cont_pop.
1687
1688 assign
1689 v_charge_type = ""
1690 last-field = ""
1691 old_pkg_code = sod_det.sod_pkg_code
1692 old_charge_type = sod_det.sod_charge_type.
1693
1694 set
1695 sod_det.sod_pkg_code
1696 sod_det.sod_ord_mult
1697 sod_det.sod_charge_type
1698 sod_det.sod_alt_pkg
1699 with frame cont_pop editblk: editing:
1700 if frame-field <> "" then last-field = frame-field.
1701 readkey.
1702 apply lastkey.
1703 hide message.
1704 if (go-pending or (last-field <> frame-field))
1705 then do:
1706 if go-pending then do:
1707 if last-field = "sod_pkg_code" and
1708 frame-field = "sod_pkg_code"
1709 then do:
1710
1711 if input sod_det.sod_pkg_code = "" then
1712 sod_det.sod_charge_type = "".
1713 else
1714 if old_pkg_code <> input sod_det.sod_pkg_code
1715 then do:
1716
1717 run validate_container
1718 (input (input sod_det.sod_pkg_code),
1719 output chargeable,
1720 output v_charge_type,
1721 output msgnbr).
1722
1723 if msgnbr > 0 then do:
1724 run display_msg (input msgnbr, input 4).
1725 /* ITEM HAS NOT BEEN DEFINED AS A CONTAINER */
1726 next-prompt
1727 sod_det.sod_pkg_code
1728 with frame cont_pop.
1729 next editblk.
1730 end. /*IF MSGNBR > 0*/
1731
1732 if chargeable then
1733 run get_charge_type
1734 (input (input sod_det.sod_pkg_code),
1735 input (if sod_det.sod_dock > "" then
1736 sod_det.sod_dock
1737 else if sod_det.sod_ship > "" then
1738 sod_det.sod_ship
1739 else so_ship),
1740 input so_curr,
1741 input-output v_charge_type).
1742 display
1743 v_charge_type @ sod_det.sod_charge_type
1744 with frame cont_pop.
1745 end. /* else if old_pkg_code */
1746 end. /*IF LAST-FIELD = "SOD_PKG_CODE"*/
1747
1748 else if last-field = "sod_charge_type" and
1749 frame-field = "sod_charge_type" and
1750 old_charge_type <> input sod_det.sod_charge_type
1751 and input sod_det.sod_charge_type > ""
1752 then do:
1753 run validate_charge_type
1754 (input (input sod_det.sod_charge_type),
1755 input yes,
1756 output msgnbr).
1757
1758 if msgnbr > 0 then do:
1759 run display_msg (input msgnbr, input 4).
1760 /* NOT A VALID CHARGE TYPE */
1761 next-prompt
1762 sod_det.sod_charge_type
1763 with frame cont_pop.
1764 next editblk.
1765 end.
1766 end. /*ELSE IF*/
1767 end. /* IF go-pending then do*/
1768 else
1769 if last-field = "sod_pkg_code" and
1770 frame-field <> "sod_pkg_code" and
1771 input sod_det.sod_pkg_code > "" and
1772 input sod_det.sod_pkg_code <> old_pkg_code
1773 then do:
1774
1775 run validate_container (input (input sod_det.sod_pkg_code),
1776 output chargeable,
1777 output v_charge_type,
1778 output msgnbr).
1779
1780 if msgnbr > 0 then do:
1781 run display_msg (input msgnbr,
1782 input 4).
1783 /* ITEM HAS NOT BEEN DEFINED AS A CONTAINER */
1784 next-prompt sod_det.sod_pkg_code with frame cont_pop.
1785 next editblk.
1786 end. /*IF MSGNBR > 0*/
1787
1788 if chargeable then
1789 run get_charge_type (input (input sod_det.sod_pkg_code),
1790 input (if sod_det.sod_dock > "" then
1791 sod_det.sod_dock else
1792 if sod_det.sod_ship > "" then
1793 sod_det.sod_ship
1794 else so_ship),
1795 input so_curr,
1796 input-output v_charge_type).
1797 display
1798 v_charge_type @ sod_det.sod_charge_type
1799 with frame cont_pop.
1800 old_pkg_code = input sod_det.sod_pkg_code.
1801
1802 end. /*if last-field = "sod_pkg_code"*/
1803
1804 else
1805 if last-field = "sod_charge_type" and
1806 frame-field <> "sod_charge_type" and
1807 input sod_det.sod_charge_type > "" and
1808 input sod_det.sod_charge_type <> old_charge_type
1809 then do:
1810 run validate_charge_type
1811 (input (input sod_det.sod_charge_type),
1812 input yes,
1813 output msgnbr).
1814
1815 if msgnbr > 0 then do:
1816 run display_msg (input msgnbr,
1817 input 4).
1818 /* NOT A VALID CHARGE TYPE */
1819 next-prompt sod_det.sod_charge_type
1820 with frame cont_pop.
1821 next editblk.
1822 end.
1823 old_charge_type = input sod_det.sod_charge_type.
1824 end. /*if last-field = "sod_charge_type" */
1825 end. /*go-pending or (last-field <> frame-field))*/
1826 end. /*EDITBLK*/
1827
1828 hide frame cont_pop no-pause.
1829
1830 if sod_det.sod_alt_pkg then do:
1831 {us/rc/rcsomtac.i}
1832 end.
1833 end. /*Setcontainer*/
1834 end. /* IF USING_CONT_CHARGES */
1835
1836 if using_line_charges and this-is-so then
1837 run UpdateLineCharges
1838 (input recid(so_mstr),
1839 input recid(sod_det)).
1840
1841
1842 /* FOR RMA'S, UPDATE RMD_DET SPECIFIC DATA ELEMENTS. */
1843 /* IF THIS ISN'T SINGLE-LINE MODE, FSRMALIN.P WILL */
1844 /* NOT GIVE THE USER A POPUP WINDOW... */
1845 if this-is-rma then do:
1846 {us/bbi/gprun.i ""fsrmalin.p""
1847 "(input rma-issue-line,
1848 input new_line,
1849 input rma-recno,
1850 input rmd-recno,
1851 input sod_recno,
1852 input tax_in,
1853 input so_db)"}
1854 end.
1855
1856 /* SECONDARY SO */
1857 /* VALIDATE MODIFICATION OF SOD_DUE_DATE */
1858
1859 if so_secondary and not new_line
1860 and sod_det.sod_promise_date <> prev-promise-date
1861 then do:
1862
1863 /* DUE TO THE FACT THAT THE CMD_VAL IS MANDATORY THE ? CAN
1864 * NOT BE PASSED AND THE VALUE OF "" GOES INSTEAD - OTHERWISE
1865 * YOU GET HIDDEN PROGRESS ERRORS DURING SOSOBTB2.P */
1866 /* TRANSMIT CHANGES ON SECONDARY SO TO PRIMARY PO AND SO */
1867 {us/bbi/gprun.i ""sosobtb2.p""
1868 "(input recid(sod_det),
1869 input ""sod_promise_date"",
1870 input if prev-promise-date = ? then string('')
1871 else string(prev-promise-date) ,
1872 output return-msg)"}
1873
1874 /* DISPLAY ERROR MESSAGE RETURN FROM SOSOBTB2.P */
1875 if return-msg <> 0 then do:
1876 run display_msg (input return-msg, input 3).
1877 if not (batchrun or {us/bbi/gpiswrap.i}) then pause.
1878 undo seta, retry seta.
1879 end.
1880
1881 end. /* not so_primary and change of sod_due_date */
1882
1883 /* PRIMARY SO */
1884 /* CALCULATE DUE DATE WHEN CHANGING SOD_REQ_DATE OR AT CREATION */
1885 if s-btb-so and not so_secondary
1886 and (new_line or sod_det.sod_due_date <> prev-due-date)
1887 and soc_due_calc
1888 then do:
1889
1890 {us/bbi/gprun.i ""sodueclc.p""
1891 "(input sod_det.sod_due_date,
1892 input sod_det.sod_part,
1893 input so_cust,
1894 input sod_det.sod_btb_type,
1895 input sod_det.sod_site,
1896 output s-sec-due,
1897 output pri-due,
1898 output exp-del,
1899 input yes)" }
1900
1901 assign
1902 sod_det.sod_promise_date = exp-del when ( soc_ctrl.soc_calc_promise_date
1903 and sod_det.sod_promise_date = ?)
1904 sod_det.sod_exp_del = exp-del
1905 sod_det.sod_due_date = pri-due.
1906
1907 end. /* due date calculation */
1908
1909 /* Delete allocations if the ship_type is not blank */
1910 if sod_det.sod_type <> ""
1911 and (prev_type <> sod_det.sod_type)
1912 and not new sod_det
1913 then do:
1914 {us/bbi/gprun.i ""gpalias3.p"" "( si_db, output err-flag)" }
1915 if err-flag = 0 or err-flag = 9 then do:
1916
1917 /* ADDITIONAL PARAMETERS prev_qty_all old_sod_site */
1918 /* l_prev_um_conv PASSED TO SOLADDEL.P SO THAT INVENTORY */
1919 /* WILL BE CORRECTLY DE-ALLOCATED WHEN THE SHIP TYPE IS */
1920 /* CHANGED TO "M" ON EXISTING SALES ORDERS. */
1921
1922 {us/bbi/gprun.i ""soladdel.p""
1923 "(input sod_det.sod_nbr,
1924 input sod_det.sod_line,
1925 input prev_qty_all,
1926 input old_sod_site,
1927 input l_prev_um_conv,
1928 input l_sodqtyord,
1929 input l_prev_qty_pick)"}
1930
1931 end.
1932 {us/bbi/gprun.i ""gpalias3.p"" "(so_db, output err-flag)"}
1933 end.
1934 undo_all2 = false.
1935 end. /* seta: set up for update block */
1936
1937 hide frame set_comm no-pause.
1938
1939 hide frame cont_pop no-pause.
1940
1941 PROCEDURE display_msg:
1942 define input parameter ip_msg_nbr as integer no-undo.
1943 define input parameter ip_error_level as integer no-undo.
1944
1945 {us/bbi/pxmsg.i &MSGNUM = ip_msg_nbr &ERRORLEVEL = ip_error_level}
1946
1947 END PROCEDURE. /*DISPLAY_MSG*/
1948
1949 PROCEDURE validate_container:
1950 define input parameter ip_container like ptc_part no-undo.
1951 define output parameter op_chargeable like mfc_logical no-undo.
1952 define output parameter op_charge_type like cct_charge_type no-undo.
1953 define output parameter op_msg_nbr as integer no-undo.
1954
1955 assign
1956 op_chargeable = false
1957 op_charge_type = ""
1958 op_msg_nbr = 4447. /* ITEM HAS NOT BEEN DEFINED AS A CONTAINER*/
1959
1960 for first ptc_det
1961 fields( ptc_domain ptc_part ptc_charge ptc_charge_type)
1962 no-lock
1963 where ptc_domain = global_domain and
1964 ptc_part = ip_container:
1965 assign
1966 op_chargeable = ptc_charge
1967 op_msg_nbr = 0.
1968 if ptc_charge then op_charge_type = ptc_charge_type.
1969 end.
1970
1971 END PROCEDURE. /* VALIDATE_CONTAINER*/
1972
1973 PROCEDURE get_charge_type:
1974 define input parameter ip_container like ptc_part no-undo.
1975 define input parameter ip_shipto like so_ship no-undo.
1976 define input parameter ip_curr like so_curr no-undo.
1977 define input-output parameter io_charge_type like cct_charge_type.
1978
1979 for first cclsc_mstr
1980 fields(cclsc_domain cclsc_shipto cclsc_part
1981 cclsc_curr cclsc_charge_type)
1982 no-lock
1983 where cclsc_domain = global_domain
1984 and cclsc_shipto = ip_shipto
1985 and cclsc_part = ip_container
1986 and cclsc_curr = ip_curr:
1987 end.
1988 if not available cclsc_mstr then
1989 for first cclsc_mstr
1990 fields(cclsc_domain cclsc_shipto cclsc_part
1991 cclsc_curr cclsc_charge_type)
1992 no-lock
1993 where cclsc_domain = global_domain
1994 and cclsc_shipto = ""
1995 and cclsc_part = ip_container
1996 and cclsc_curr = ip_curr:
1997 end.
1998 if available cclsc_mstr then
1999 io_charge_type = cclsc_charge_type.
2000
2001 END PROCEDURE. /*GET_CHARGE_TYPE*/
2002
2003 PROCEDURE validate_charge_type:
2004 define input parameter ip_container like ptc_part no-undo.
2005 define input parameter ip_container_type like mfc_logical no-undo.
2006 define output parameter op_msg_nbr as integer no-undo.
2007
2008 op_msg_nbr = 4396. /* NOT A VALID CHARGE TYPE */
2009
2010 for first cct_mstr
2011 fields( cct_domain cct_charge_type cct_container_type)
2012 no-lock
2013 where cct_domain = global_domain
2014 and cct_charge_type = ip_container
2015 and cct_container_type = ip_container_type:
2016 op_msg_nbr = 0.
2017 end.
2018
2019 END PROCEDURE. /*VALIDATE_CHARGE_TYPE*/
2020
2021 /* Calculate promise and/or due date via transit time table */
2022 PROCEDURE p-calc-prom-or-due-date:
2023
2024 define input parameter p-cust like cm_addr no-undo.
2025 define input parameter p-site like pt_site no-undo.
2026 define input-output parameter p-due-date
2027 like sod_det.sod_due_date no-undo.
2028 define input-output parameter p-promise-date
2029 like sod_det.sod_promise_date no-undo.
2030
2031 /* attempt to calculate promise date now... */
2032 /* retrieve address record of ship-to customer */
2033 for first ad_mstr
2034 fields( ad_domain ad_addr
2035 ad_ctry
2036 ad_state
2037 ad_city)
2038 where ad_domain = global_domain
2039 and ad_addr = p-cust :
2040
2041 for first si_mstr
2042 fields( si_domain si_site si_db)
2043 where si_domain = global_domain
2044 and si_site = p-site
2045 no-lock:
2046 /* Switch to the Inventory site */
2047 {us/bbi/gprun.i ""gpalias3.p"" "(si_db, output err-flag)" }
2048
2049 {us/bbi/gprun.i ""sopromdt.p""
2050 "(input p-site,
2051 input ad_ctry,
2052 input ad_state,
2053 input ad_city,
2054 input """",
2055 input-output p-due-date,
2056 input-output p-promise-date)" }
2057
2058 /* Switch back to the sales order site */
2059 {us/bbi/gprun.i ""gpalias3.p"" "(so_db, output err-flag)" }
2060
2061 end. /* FOR FIRST si_mstr */
2062 end. /* for first ad_mstr */
2063
2064 END PROCEDURE. /* p-calc-prom-or-due-date */
2065
2066 /* Calculate promise and due date defaults */
2067 PROCEDURE p-calc-date-defaults:
2068
2069 define input parameter p-cust like cm_addr no-undo.
2070 define input parameter p-site like pt_site no-undo.
2071 define input parameter p-required-date
2072 like sod_det.sod_req_date no-undo.
2073 define input-output parameter p-promise-date
2074 like sod_det.sod_promise_date no-undo.
2075 define input-output parameter p-due-date
2076 like sod_det.sod_due_date no-undo.
2077
2078 /* If promise <> ? and due <> ? the no defaulting */
2079 if p-due-date <> ? and p-promise-date <> ? then leave.
2080
2081 /* If promise = ? and due <> ? then */
2082 /* calc promise date from due date now... */
2083 if p-promise-date = ? and p-due-date <> ? then do:
2084 run p-calc-prom-or-due-date (input p-cust,
2085 input p-site,
2086 input-output p-due-date,
2087 input-output p-promise-date).
2088 leave.
2089 end. /* calculate promise date... */
2090
2091 /* If promise = <> ? and due = ? then */
2092 /* calc due date from promise date now... */
2093 if p-promise-date <> ? and p-due-date = ? then do:
2094 run p-calc-prom-or-due-date (input p-cust,
2095 input p-site,
2096 input-output p-due-date,
2097 input-output p-promise-date).
2098 leave.
2099 end. /* calculate due date... */
2100
2101 if p-promise-date = ?
2102 and p-due-date = ?
2103 then do:
2104 if p-required-date <> ?
2105 then do:
2106 /* 1. DEFAULT PROMISE DATE FROM REQUIRED DATE */
2107 p-promise-date = p-required-date.
2108
2109 /* 2. ATTEMPT TO CALCULATE DUE DATE FROM PROMISE DATE NOW */
2110 run p-calc-prom-or-due-date (input p-cust,
2111 input p-site,
2112 input-output p-due-date,
2113 input-output p-promise-date).
2114
2115 /* 3. IF DUE NOT CALCULATED, DEFAULT TO REQUIRED DATE */
2116 if p-due-date = ?
2117 then
2118 p-due-date = p-required-date.
2119 leave.
2120 end. /* IF p-required-date <> ? */
2121
2122 else do:
2123 /* 1. DUE DATE = TODAY + SHIPPING LEAD TIME */
2124 p-due-date = today + soc_ctrl.soc_shp_lead.
2125
2126 /* 2. CALC PROMISE DATE FROM DUE DATE NOW... */
2127 run p-calc-prom-or-due-date (input p-cust,
2128 input p-site,
2129 input-output p-due-date,
2130 input-output p-promise-date).
2131 leave.
2132 end. /* p-required-date = ? */
2133 /* NOTE: IF new_line = no, AND ATP IS ON, USE BEST AVAIL */
2134 /* DUE DATE, BUT THIS IS DONE LATER IN THE CODE... */
2135 end. /* IF promise and due = ? */
2136 END PROCEDURE. /* p-calc-date-defaults */
2137
2138
2139 PROCEDURE createRemoteLines:
2140 /* WE DON'T CREATE THE REMOTE LINES UNLESS THE LINE IS CONFIRMED */
2141 if si_mstr.si_db <> so_db and sod_det.sod_confirm then do:
2142 {us/bbi/gprun.i ""gpalias3.p"" "(si_db, output err-flag)" }
2143 if err-flag = 0 or err-flag = 9 then do:
2144
2145 /* ADDED INPUT PARAMETER no TO NOT EXECUTE MFSOFC01.I */
2146 /* AND MFSOFC02.I WHEN CALLED FROM DETAIL LINE */
2147 {us/bbi/gprun.i ""solndel.p""
2148 "(input no)"}
2149 end.
2150 /* Reset the domain to the sales order domain */
2151 {us/bbi/gprun.i ""gpalias3.p"" "(so_db, output err-flag)" }
2152 sod_recno = recid(sod_det).
2153 end.
2154 else do:
2155 {us/bbi/gprun.i ""solndel1.p""}
2156 end.
2157 END PROCEDURE. /* createRemoteLines */
2158
2159
2160 PROCEDURE determineQuantityAllocated:
2161 /* Determine total quantity allocated */
2162 {us/bbi/gprun.i ""gpalias3.p"" "(si_mstr.si_db, output err-flag)" }
2163 if err-flag = 0 or err-flag = 9 then do:
2164 {us/bbi/gprun.i ""soladqty.p"" "(sod_det.sod_nbr, sod_det.sod_line,
2165 sod_det.sod_um_conv, output totallqty )"}
2166 end.
2167 {us/bbi/gprun.i ""gpalias3.p"" "(so_db, output err-flag)"}
2168
2169 END PROCEDURE. /* determineQuantityAllocated */
2170
2171 PROCEDURE doDetailAllocations:
2172 {us/bbi/gprun.i ""gpalias3.p"" "(si_mstr.si_db, output err-flag)" }
2173 if err-flag = 0 or err-flag = 9 then do:
2174 {us/bbi/gprun.i ""solcal1.p"" "( input sod_det.sod_site,
2175 input sod_det.sod_nbr,
2176 input sod_det.sod_line,
2177 input sod_det.sod_part,
2178 input sod_det.sod_um_conv,
2179 input sod_det.sod_loc,
2180 input sod_det.sod_serial,
2181 input sod_det.sod_qty_ord,
2182 input sod_det.sod_qty_all,
2183 input sod_det.sod_qty_pick,
2184 input sod_det.sod_qty_ship,
2185 input sod_det.sod_due_date,
2186 input-output totallqty )"}
2187 end.
2188 {us/bbi/gprun.i ""gpalias3.p"" "(so_db, output err-flag)"}
2189
2190 END PROCEDURE. /* doDetailAllocations */
2191
2192 PROCEDURE allocationCheck:
2193 if si_mstr.si_db <> so_db then do:
2194 {us/bbi/gprun.i ""gpalias2.p"" "(sod_det.sod_site,output err-flag)" }
2195 end.
2196
2197 if err-flag = 0 or err-flag = 9 then do:
2198 if soc_ctrl.soc_all_avl and sod_det.sod_qty_all > 0
2199 and sod_det.sod_type = ""
2200 then do:
2201 assign new_record = new sod_det.
2202
2203 {us/bbi/gprun.i ""soallchk.p""
2204 "(sod_det.sod_part,
2205 sod_det.sod_site,
2206 prev_qty_all * l_prev_um_conv,
2207 sod_det.sod_qty_all * sod_det.sod_um_conv,
2208 new_record,
2209 so_mstr.so_ship,
2210 so_bill,
2211 so_cust,
2212 so_fsm_type,
2213 output warn,
2214 output net_avail)" }
2215
2216 end. /* if soc_all_avl */
2217 end. /* if err-flag */
2218
2219 if si_db <> so_db then do:
2220 {us/bbi/gprun.i ""gpalias3.p"" "(so_db,output err-flag)" }
2221 end. /* if si_db <> so_db */
2222 END PROCEDURE. /* allocationCheck */
2223
2224 PROCEDURE ValidateCategory:
2225 define input parameter ip_category like sod_det.sod_order_category no-undo.
2226 define output parameter op_error like mfc_logical no-undo.
2227
2228 {us/px/pxrun.i &PROC = 'validateGeneralizedCodes' &PROGRAM = 'gpcodxr.p'
2229 &HANDLE=ph_gpcodxr
2230 &PARAM="(input 'ip_category',
2231 input 'line_category',
2232 input ip_category,
2233 input '')"
2234 &NOAPPERROR=True
2235 &CATCHERROR=True}
2236 if return-value <> {&SUCCESS-RESULT}
2237 then op_error = yes.
2238 else op_error = no.
2239 END PROCEDURE. /* ValidateCategory */
2240
2241 PROCEDURE UpdateLineCharges:
2242 define input parameter ip_sorecid as recid no-undo.
2243 define input parameter ip_sodrecid as recid no-undo.
2244
2245 {us/gp/gprunmo.i
2246 &module = "ACL"
2247 &program = ""rcsolcmt.p""
2248 &param = """(input ip_sorecid,
2249 input ip_sodrecid)"""}
2250
2251 END PROCEDURE.
2252
2253 PROCEDURE createCodeMstr:
2254 create code_mstr.
2255 assign
2256 code_domain = global_domain
2257 code_fldname = "tr_type"
2258 code_value = "ISS-RMA".
2259 code_cmmt = getTermLabel("PSEUDO_TRANS-TYPE_FOR_RMA_RECEIPT",40).
2260 if recid(code_mstr) = -1 then .
2261
2262 END PROCEDURE.
2263
2264 PROCEDURE siteChanged:
2265
2266 /* ON SITE CHANGE IF THE ITEM IN NEW SITE IS NOT CONFIGURED THEN */
2267 /* DELETE SALES ORDER BILL RECORDS (sob_det), ALLOCATION DETAIL */
2268 /* RECORDS (lad_det), COST RECORDS (sct_det); UPDATES FORECAST */
2269 /* AND MRP DETAIL (mrp_det) AND UPDATES INVENTORY DETAIL BY */
2270 /* LOCATION (ld_det) FOR PREVIOUS SITE */
2271
2272 if sod_det.sod_site <> old_site
2273 and new_line = no
2274 and ((can-find (first pt_mstr
2275 where pt_domain = global_domain
2276 and ( pt_part = sod_det.sod_part
2277 and pt_pm_code <> "c"))
2278 or can-find (first ptp_det
2279 where ptp_domain = global_domain
2280 and ptp_part = sod_det.sod_part
2281 and ptp_site = old_site
2282 and ptp_pm_code <> "c"))
2283 and (can-find (first ptp_det
2284 where ptp_domain = global_domain
2285 and ptp_part = sod_det.sod_part
2286 and ptp_site = sod_det.sod_site
2287 and ptp_pm_code <> "c" )))
2288 then do:
2289
2290 for first si_mstr
2291 fields( si_domain si_auto_loc si_db si_site si_status)
2292 where si_domain = global_domain
2293 and si_site = old_site
2294 no-lock:
2295 end. /* FOR FIRST SI_MSTR */
2296
2297 assign
2298 sonbr = sod_det.sod_nbr
2299 soline = sod_det.sod_line.
2300
2301 run createRemoteLines.
2302 end.
2303 END PROCEDURE.
2304
2305 PROCEDURE setSort:
2306 sort = "".
2307 do counter = 1 to 4:
2308
2309 for first ad_mstr
2310 where ad_mstr.ad_domain = global_domain
2311 and ad_mstr.ad_addr = sod_det.sod_slspsn[counter]
2312 no-lock:
2313 end. /* FOR FIRST ad_mstr */
2314 if available ad_mstr
2315 then
2316 sort[counter] = ad_sort.
2317
2318 end.
2319 END PROCEDURE.
2320
2321 PROCEDURE setUpdateQtyAll:
2322 for first po_mstr
2323 fields( po_domain po_inv_mthd)
2324 where po_domain = global_domain
2325 and po_nbr = sod_det.sod_btb_po
2326 no-lock:
2327 end. /* FOR FIRST po_mstr */
2328 if available po_mstr
2329 and (right-trim(substring(po_inv_mthd,2,24)) = "")
2330 then
2331 l_use_edi = no.
2332 if (sod_det.sod_btb_type = "02"
2333 and sod_det.sod_qty_all > 0
2334 and not l_use_edi)
2335 then
2336 l_update_qty_all = yes.
2337 END PROCEDURE.
2338
2339 PROCEDURE checkSiteDB:
2340
2341 for first si_mstr
2342 fields( si_domain si_auto_loc si_db si_site si_status)
2343 where si_domain = global_domain
2344 and si_site = sod_det.sod_site
2345 no-lock:
2346 end. /* FOR FIRST SI_MSTR */
2347
2348 if si_db <> so_db then do:
2349 {us/bbi/gprun.i ""gpalias2.p"" "(sod_det.sod_site,output err-flag)" }
2350 end.
2351
2352 if err-flag = 0 or err-flag = 9 then do:
2353 if soc_ctrl.soc_all_avl and sod_det.sod_qty_all > 0
2354 and sod_det.sod_type = ""
2355 then do:
2356 assign new_record = new sod_det.
2357
2358 /* CONVERTED THIRD PARAMETER PREV_QTY_ALL AND FOURTH */
2359 /* PARAMETER SOD_QTY_ALL TO INVENTORY UM */
2360 {us/bbi/gprun.i ""soallchk.p""
2361 "(sod_det.sod_part,
2362 sod_det.sod_site,
2363 prev_qty_all * l_prev_um_conv,
2364 sod_det.sod_qty_all * sod_det.sod_um_conv,
2365 new_record,
2366 so_mstr.so_ship,
2367 so_bill,
2368 so_cust,
2369 so_fsm_type,
2370 output warn,
2371 output net_avail)" }
2372
2373 find cil_mstr where cil_mstr.cil_domain = global_domain and
2374 cil_cor_so_nbr = sod_nbr
2375 no-lock no-error.
2376
2377 if available cil_mstr then do:
2378 if can-find(cild_det where cild_domain = global_domain
2379 and cild_cor_inv = cil_cor_inv
2380 and cild_cor_so_nbr = cil_cor_so_nbr
2381 and cild_cor_line = sod_line
2382 and cild_line_type = "R") then .
2383 else do:
2384 find idh_hist where idh_domain = global_domain
2385 and idh_inv_nbr = cil_prev_inv
2386 and idh_nbr = cil_prev_so_nbr
2387 and idh_line = sod_line no-lock no-error.
2388 assign
2389 net_avail = net_avail +
2390 (if available idh_hist then idh_qty_inv else 0).
2391 if net_avail >= sod_qty_all then warn = no.
2392 end.
2393
2394 end.
2395 end. /* if soc_all_avl */
2396 end. /* if err-flag = 0 or err-flag = 9 */
2397
2398 END PROCEDURE.
2399
2400 PROCEDURE setUpForApoAtp:
2401 /* ---------------------------------------------------------------------------
2402 Purpose: This procedure determines APO ATP should be used.
2403 If it is in use then open io stream used for APO ATP.
2404 Exceptions: None
2405 Conditions:
2406 Pre:
2407 Post:
2408 Notes:
2409 History:
2410 ----------------------------------------------------------------------------*/
2411
2412 if this-is-rma then moduleGroup = "RMA".
2413 else moduleGroup = "SO".
2414
2415 /* Get Apo Atp setup only if standard Atp was not used. */
2416 /* If standard Atp is used and the setup is run, */
2417 /* useApoAtp will be set incorrectly. */
2418 if stdAtpUsed = no then do:
2419 /* Determine if Apo Atp is in Use */
2420 {us/px/pxrun.i &proc='getApoAtpSetup' &program='sosoxr1.p'
2421 &handle=ph_sosoxr1
2422 &param="(input sod_det.sod_site,
2423 input sod_det.sod_part,
2424 input sod_det.sod_confirm,
2425 input sod_det.sod_type,
2426 input sod_det.sod_btb_type,
2427 input sod_det.sod_due_date,
2428 input sod_det.sod_qty_ord,
2429 input sod_det.sod_um_conv,
2430 input moduleGroup,
2431 input new_line,
2432 input prev-confirm,
2433 output checkAtp,
2434 output useApoAtp,
2435 output apoAtpDelAvail,
2436 output apoAtpDelAvailMsg)"}
2437 end.
2438
2439 if checkAtp and useApoAtp then do:
2440 /* After a new order line has been entered or an existing line */
2441 /* is modified where the confirm flag is changed from no to yes */
2442 /* then initialize Apo Atp values based on order line. */
2443
2444 assign
2445 atp-site = sod_det.sod_site
2446 atp-cum-qty = sod_det.sod_qty_ord
2447 atp-due-date = sod_det.sod_due_date.
2448
2449 if apoAtpDelAvail then do:
2450 /* A Shared Stream cannot be used with app server logic */
2451 /* Open the apoAtpStream */
2452 {us/px/pxrun.i &proc='openApoAtpIOStream' &program='giapoxr.p'
2453 &handle=ph_giapoxr
2454 &catcherror=TRUE
2455 &noapperror=TRUE
2456 &module='GI1'}
2457 end.
2458 end. /* checkAtp and useApoAtp */
2459
2460 END PROCEDURE. /* setUpForApoAtp */
2461
2462 PROCEDURE p-check-atp:
2463 /* ---------------------------------------------------------------------------
2464 Purpose: This procedure determines if there are any problems
2465 with ATP Enforcement for the confirmed order line.
2466 APO ATP or standard ATP enforcement will be used for
2467 determining the output.
2468 Exceptions: None
2469 Conditions:
2470 Pre:
2471 Post:
2472 Notes:
2473 History:
2474 ----------------------------------------------------------------------------*/
2475
2476 {us/bbi/gprun.i ""soatpck.p""
2477 "(input so_mstr.so_cust,
2478 input so_ship,
2479 input so_bill,
2480 input sod_det.sod_nbr,
2481 input sod_det.sod_line,
2482 input sod_det.sod_site,
2483 input sod_det.sod_part,
2484 input sod_det.sod_due_date,
2485 input sod_det.sod_um_conv,
2486 input sod_det.sod_um,
2487 input (sod_det.sod_qty_ord - sod_det.sod_qty_ship),
2488 input sod_det.sod_btb_type,
2489 input sod_det.sod_confirm,
2490 input no,
2491 input soc_ctrl.soc_atp_enabled,
2492 input soc_horizon,
2493 input sod_det.sod_type,
2494 input sod_det.sod_consume,
2495 input sngl_ln,
2496 input useApoAtp,
2497 input moduleGroup,
2498 input apoAtpDelAvail,
2499 input apoAtpDelAvailMsg,
2500 output atp-ok,
2501 output atp-due-date,
2502 output atp-cum-qty,
2503 output atp-site,
2504 output errorResult,
2505 output continue,
2506 output stdAtpUsed)"}
2507
2508 /* If Standard Atp enforcement was used, */
2509 /* No Apo Atp checks should be done. */
2510 if stdAtpUsed then useApoAtp = no.
2511
2512 END PROCEDURE. /* p-check-atp */
2513
2514 PROCEDURE updateWithApoAtpData:
2515 /* ---------------------------------------------------------------------------
2516 Purpose: This procedure updates site, date and quantity
2517 returned from apo atp.
2518 This is for single line processing only.
2519 Exceptions: None
2520 Conditions:
2521 Pre:
2522 Post:
2523 Notes:
2524 History:
2525
2526 Inputs/Outputs:
2527 None
2528 ----------------------------------------------------------------------------*/
2529
2530 /* When atp-due-date = ? then */
2531 /* no changes were made by APO ATP */
2532 if atp-due-date <> ? then do:
2533 if sod_det.sod_site <> atp-site or
2534 sod_det.sod_qty_ord <> atp-cum-qty then
2535 atp-qty-site-changed.
2536
2537 /* If Users Selects To Confirm Order Line with Atp Due Date */
2538 if errorResult = "0" and sod_det.sod_due_date <> atp-due-date
2539 then
2540 sod_det.sod_due_date = atp-due-date.
2541
2542 if (errorResult = "2" or errorResult = "3") then
2543 assign
2544 sod_det.sod_site = atp-site
2545 sod_det.sod_due_date = atp-due-date
2546 sod_det.sod_qty_ord = atp-cum-qty.
2547 else if errorResult = "1" then
2548 assign
2549 sod_det.sod_site = atp-site
2550 sod_det.sod_due_date = atp-due-date.
2551 end.
2552
2553 END PROCEDURE. /* updateWithApoAtpData */
2554
2555 PROCEDURE ip_validate_fullcode:
2556 /* ---------------------------------------------------------------------------
2557 Purpose: Validate Accout/Sub/CC/Project combination
2558
2559 Parameters: 1. input i_acct
2560 2. input i_sub
2561 3. input i_cc
2562 4. input i_project
2563 5. output o_valid_acct
2564
2565 Note: Procedure created to remove Error "Action Segment has exceeded
2566 its limit of 63488 bytes".
2567 ----------------------------------------------------------------------------*/
2568
2569 define input parameter i_acct like sod_det.sod_acct no-undo.
2570 define input parameter i_sub like sod_det.sod_sub no-undo.
2571 define input parameter i_cc like sod_det.sod_cc no-undo.
2572 define input parameter i_project like sod_det.sod_project no-undo.
2573 define input parameter i_acctfldname like sod_det.sod_acct no-undo.
2574 define output parameter o_valid_acct as logical no-undo.
2575
2576 /* INITIALIZE SETTINGS */
2577 {us/gp/gprunp.i "gpglvpl" "p" "initialize"}
2578
2579 /* ACCT/SUB/CC/PROJ VALIDATION */
2580 {us/gp/gprunp.i "gpglvpl" "p" "validate_fullcode"
2581 "(input i_acct,
2582 input i_sub,
2583 input i_cc,
2584 input i_project,
2585 input i_acctfldname,
2586 output o_valid_acct)"}
2587
2588
2589 END PROCEDURE. /* ip_validate_fullcode */
2590
2591 PROCEDURE checkReservedLocation:
2592
2593 assign
2594 l_ret-flag = 2
2595 l_det-flag = no.
2596
2597 /* BYPASS CHECKING SSM ORDERS */
2598 if so_mstr.so_fsm_type = ""
2599 then do:
2600 {us/bbi/gprun.i ""sorlchk1.p""
2601 "(input so_mstr.so_ship,
2602 input so_mstr.so_bill,
2603 input so_mstr.so_cust,
2604 input sod_det.sod_site,
2605 input sod_det.sod_loc,
2606 output l_ret-flag,
2607 output l_det-flag)"}
2608 end. /* IF so_mstr.so_fsm_type = "" */
2609 END PROCEDURE. /* PROCEDURE checkReservedLocation */
2610
2611 PROCEDURE updateDetailAllocations:
2612 define variable l_undeallo_qty like sod_det.sod_qty_all no-undo.
2613
2614 if l_input_sod_qty_all < totallqty
2615 then do:
2616 {us/bbi/gprun.i ""gpalias3.p"" "(si_mstr.si_db, output err-flag)"}
2617 if err-flag = 0
2618 or err-flag = 9
2619 then do:
2620 {us/bbi/gprun.i ""sodeall.p""
2621 "(sod_det.sod_nbr,
2622 sod_det.sod_line,
2623 sod_det.sod_um_conv,
2624 totallqty - l_input_sod_qty_all,
2625 l_input_sod_qty_all)"}
2626
2627 end. /* IF err-flag = 0 or err-flag = 9 */
2628 {us/bbi/gprun.i ""gpalias3.p"" "(so_db, output err-flag)"}
2629 end. /* IF l_input_sod_qty_all < totallqty */
2630 else do:
2631 assign
2632 alc_sod_nbr = sod_det.sod_nbr
2633 alc_sod_line = sod_det.sod_line
2634 tot_qty_all = sod_det.sod_qty_all.
2635 run detailAllocate.
2636 run determineQuantityAllocated.
2637 if sod_qty_all > totallqty
2638 then
2639 sod_det.sod_qty_all = totallqty.
2640 end. /* ELSE DO */
2641 END PROCEDURE. /* PROCEDURE updateDetailAllocations */
2642
2643 PROCEDURE detailAllocate:
2644
2645 for first sod_det
2646 where recid(sod_det) = sod_recno
2647 and sod_det.sod_domain = global_domain
2648 no-lock:
2649 end. /* FOR FIRST sod_det */
2650
2651 if sod_type = ""
2652 then do:
2653 assign
2654 so_db = global_db
2655 alc_sod_nbr = sod_nbr
2656 alc_sod_line = sod_line
2657 sod_recno = sod_recno
2658 so_recno = so_recno.
2659
2660 for first si_mstr
2661 fields(si_db si_site)
2662 where si_site = sod_det.sod_site
2663 and si_mstr.si_domain = global_domain
2664 no-lock:
2665 end. /* FOR FIRST si_mstr */
2666
2667 if si_db <> so_db
2668 then do:
2669 /*CREATE HARD ALLOCATIONS IN THE INVENTORY SITE*/
2670
2671 /* SWITCH TO THE INVENTORY SITE */
2672 {us/bbi/gprun.i ""gpalias3.p"" "(input si_db, output l_err_flag)"}
2673
2674 if l_err_flag = 0
2675 or l_err_flag = 9
2676 then do:
2677
2678 /* DO THE DETAIL ALLOCATIONS */
2679 {us/bbi/gprun.i ""sopkall.p""}
2680
2681 /* UPDATE SALES ORDER QTY PICK AND QTY ALLOC AND PICK DATE */
2682 if so_db <> global_db
2683 then do:
2684
2685 /* UPDATE DETAIL QTY ALL, */
2686 {us/bbi/gprun.i ""sodetall.p""
2687 "(input alc_sod_nbr,
2688 input alc_sod_line,
2689 input tot_qty_all)"}
2690 end. /* IF so_db <> global_db */
2691
2692 /* SWITCH BACK TO THE SALES ORDER DATABASE */
2693 {us/bbi/gprun.i ""gpalias3.p"" "(so_db, output l_err_flag)"}
2694
2695 /* UPDATE SOD IN SO DATABASE, UPDATE DETAIL QTY ALL */
2696 {us/bbi/gprun.i ""sodetall.p""
2697 "(input alc_sod_nbr,
2698 input alc_sod_line,
2699 input tot_qty_all)"}
2700 end. /* IF l_err_flag = 0 or l_err_flag = 9 */
2701 end. /* IF si_db <> so_db */
2702 else do:
2703
2704 {us/bbi/gprun.i ""sopkall.p""}
2705 {us/bbi/gprun.i ""sodetall.p""
2706 "(input alc_sod_nbr,
2707 input alc_sod_line,
2708 input tot_qty_all)"}
2709 end. /* ELSE DO */
2710 end. /* IF sod_type = "" */
2711 END PROCEDURE. /* PROCEDURE detailAllocate */
File mfg/2013/base/src/xfivto98mx.i added (mode: 100644) (index 0000000..9f716ae)
File mfg/2013/base/src/xxcds.i added (mode: 100644) (index 0000000..d17eb00)
1 /* xxcds.i - Misc Functions */
2 /* Copyright 1986-2016 QAD Inc. All rights reserved. */
3 /*----------------------------------------------------------------------------*/
4 /* BGL LAST MODIFIED: 2017-Nov-16 BY: nac *D4120* */
5 /*----------------------------------------------------------------------------*/
6
7 def var BottleUM as char.
8 def var BottleTaxCode as char.
9
10 BottleUM = "BT".
11 for first code_mstr no-lock
12 where code_domain = global_domain
13 and code_fldname = "BottleUM"
14 and code_value = "BottleUM":
15 BottleUM = code_cmmt.
16 end.
17
18 BottleTaxCode = "CDS".
19 for first code_mstr no-lock
20 where code_domain = global_domain
21 and code_fldname = "CDSTaxCode"
22 and code_value = "CDSTaxCode":
23 BottleTaxCode = code_cmmt.
24 end.
25
26 /*-----------------------------------------------------------------*/
27 function fcds returns dec (ipnbr as char).
28 define var vcds as dec.
29
30 vcds = ?.
31 {us/bbi/gprun.i ""xxcdsa.p"" "(ipnbr, output vcds)"}
32 return vcds.
33
34
35 end. /* function fcds */
36 /*-----------------------------------------------------------------*/
37 function fbtlcnv returns dec (ippart as char, ipum as char, ipBottleUM as char).
38 def var vcnv as dec.
39 vcnv = 0.0.
40
41 find first um_mstr no-lock
42 where um_domain = global_domain
43 and um_part = ippart
44 and um_um = ipum
45 and um_alt_um = ipBottleUM
46 no-error.
47 if not available um_mstr
48 then do:
49 find first um_mstr no-lock
50 where um_domain = global_domain
51 and um_part = ""
52 and um_um = ipum
53 and um_alt_um = ipBottleUM
54 no-error.
55 end.
56 if available um_mstr then vcnv = um_conv.
57 return vcnv.
58 end. /* function fbtlcnv */
59 /*=================================================================*/
60
61 function fbtlchg returns dec (ipnbr as char,
62 ipline as int,
63 ipivso as char,
64 iptaxcode as char).
65 for first tx2d_det no-lock
66 where tx2d_domain = global_domain
67 and ipivso = "SO"
68 and tx2d_nbr = ipnbr
69 and tx2d_line = ipline
70 and tx2d_tax_code = iptaxcode:
71 return tx2d_tax_amt.
72 end.
73 for first tx2d_det no-lock
74 where tx2d_domain = global_domain
75 and ipivso = "IV"
76 and tx2d_ref = ipnbr
77 and tx2d_line = ipline
78 and tx2d_tax_code = iptaxcode:
79 return tx2d_tax_amt.
80 end.
81 return 0.0.
82 end. /* function fbtlchg */
83 /*=================================================================*/
84
85
86 function fbtlchgtot returns dec (ipnbr as char,
87 ipivso as char,
88 iptaxcode as char).
89 def var retCDSCharge as dec.
90 returnCDSCharge = 0.0.
91 for each tx2d_det no-lock
92 where tx2d_domain = global_domain
93 and ipivso = "SO"
94 and tx2d_nbr = ipnbr
95 and tx2d_tax_code = iptaxcode:
96 retCDSCharge = retCDSCharge + tx2d_tax_amt.
97 end.
98 for each tx2d_det no-lock
99 where tx2d_domain = global_domain
100 and ipivso = "IV"
101 and tx2d_ref = ipnbr
102 and tx2d_tax_code = iptaxcode:
103 retCDSCharge = retCDSCharge + tx2d_tax_amt.
104 end.
105 return retCDSCharge.
106 end. /* function fbtlchg */
107 /*=================================================================*/
108
109
110 function fGetInvCDS returns dec (ipinvnbr as char,
111 ipline as int,
112 iptype as char).
113 def var retCDSCharge as dec.
114 retCDSCharge = 0.0.
115 for each tx2d_det no-lock
116 where tx2d_domain = global_domain
117 and tx2d_ref = ipinvnbr
118 and tx2d_line = ipline
119 and tx2d_tr_type = iptype
120 and tx2d_tax_type = BottleTaxCode:
121 retCDSCharge = retCDSCharge + tx2d_cur_tax_amt.
122 end. /* for each tx2d_det */
123 return retCDSCharge.
124 end. /* function fGetInvCDS */
125
126 /*=================================================================*/
127
128 function fGetInvGST returns dec (ipinvnbr as char,
129 ipline as int,
130 iptype as char).
131 def var retGST as dec.
132 retGST = 0.0.
133 for each tx2d_det no-lock
134 where tx2d_domain = global_domain
135 and tx2d_ref = ipinvnbr
136 and tx2d_line = ipline
137 and tx2d_tr_type = iptype
138 and tx2d_tax_type = "GST-O":
139 retGST = retGST + tx2d_cur_tax_amt.
140 end. /* for each tx2d_det */
141 return retGST.
142 end. /* function fGetInvGST */
143
144 /*=================================================================*/
145
146 function fGetInvGSTtot returns dec (ipinvnbr as char,
147 iptype as char).
148 def var retGST as dec.
149 retGST = 0.0.
150 for each tx2d_det no-lock
151 where tx2d_domain = global_domain
152 and tx2d_ref = ipinvnbr
153 and tx2d_line = ipline
154 and tx2d_tr_type = iptype
155 and tx2d_tax_type = "GST-O":
156 retGST = retGST + tx2d_cur_tax_amt.
157 end. /* for each tx2d_det */
158 return retGST.
159 end. /* function fGetInvGST */
160
161
162 function fGetInvGSTTot returns dec (ipinvnbr as char,
163 iptype as char).
164 def var retGST as dec.
165 retGST = 0.0.
166 for each tx2d_det no-lock
167 where tx2d_domain = global_domain
168 and tx2d_ref = ipinvnbr
169 and tx2d_tr_type = iptype
170 and tx2d_tax_type = "GST-O":
171 retGST = retGST + tx2d_cur_tax_amt.
172 end. /* for each tx2d_det */
173 return retGST.
174 end. /* function fGetInvGST */
175
176 /*=================================================================*/
177
178 function fGetInvTxblTot returns dec (ipinvnbr as char,
179 iptype as char).
180 def var retGST as dec.
181 retGST = 0.0.
182 for each tx2d_det no-lock
183 where tx2d_domain = global_domain
184 and tx2d_ref = ipinvnbr
185 and tx2d_tr_type = iptype
186 and tx2d_tax_type = "GST-O":
187 retGST = retGST + tx2d_tottax.
188 end. /* for each tx2d_det */
189 return retGST.
190 end. /* function fGetInvGST */
File mfg/2013/base/src/xxcdsa.p added (mode: 100644) (index 0000000..0a65802)
1 /* xxcdsa.p - CDS Lookup function */
2 /* Copyright 1986-2016 QAD Inc. All rights reserved. */
3 /*----------------------------------------------------------------------------*/
4 /* BGL LAST MODIFIED: 2017-Nov-16 BY: nac *D4120* */
5 /*----------------------------------------------------------------------------*/
6 {mfdeclre.i}
7
8 define input parameter ipnbr as char.
9 define output parameter opcds as dec.
10
11 for first ih_hist no-lock
12 where ih_domain = global_domain
13 and ih_inv_nbr = ipnbr,
14 first ad_mstr no-lock
15 where ad_domain = global_domain
16 and ad_addr = ih_ship:
17 opcds = decimal(ad_misc1_id) no-error.
18 if error-status:error then opcds = 0.0.
19 return.
20 end.
21 for first so_mstr no-lock
22 where so_domain = global_domain
23 and so_nbr = ipnbr,
24 first ad_mstr no-lock
25 where ad_domain = global_domain
26 and ad_addr = so_ship:
27 opcds = decimal(ad_misc1_id) no-error.
28 if error-status:error then opcds = 0.0.
29 return.
30 end.
31 opcds = 0.0.
32
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/gbfg55/gbg-20-git

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/gbfg55/gbg-20-git

Clone this repository using git:
git clone git://git.rocketgit.com/user/gbfg55/gbg-20-git

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main