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 |
|
|