· 6 years ago · Mar 26, 2019, 03:36 PM
1OBJECT Table 38 Purchase Header
2{
3 OBJECT-PROPERTIES
4 {
5 Date=01/03/19;
6 Time=14:21:28;
7 Modified=Yes;
8 Version List=NAVGB7.10.00.36281,.88,.22r1,QSSD07.01.01.28,QSSD07.01.01.37,07.01.01.59,QSSD07.01.19045,QSSD07.01.19620,QSSD07.01.20310,QSSD07.01.19619 EXP,QSSD07.01.20364,QSSD07.01.19619-T001,QSSD07.01.20188,OP9496,OP9678,OP10181,OP9679,OP11639,OP12061,OP13008;
9 }
10 PROPERTIES
11 {
12 DataCaptionFields=No.,Buy-from Vendor Name;
13 OnInsert=BEGIN
14 IF Rec."Expense Type" > Rec."Expense Type"::" " THEN ExpensesMgt.PurchaseHeaderInsert(Rec); //QSSD07.01.19619 EXP
15
16 IF "No." = '' THEN BEGIN
17 TestNoSeries;
18 NoSeriesMgt.InitSeries(GetNoSeriesCode,xRec."No. Series","Posting Date","No.","No. Series");
19 END;
20
21 //IN36000 - Assigning value for field
22 "Invoice Creation Date" := WORKDATE;
23
24 InitRecord;
25
26 IF GETFILTER("Buy-from Vendor No.") <> '' THEN
27 IF GETRANGEMIN("Buy-from Vendor No.") = GETRANGEMAX("Buy-from Vendor No.") THEN
28 VALIDATE("Buy-from Vendor No.",GETRANGEMIN("Buy-from Vendor No."));
29
30 "Doc. No. Occurrence" := ArchiveManagement.GetNextOccurrenceNo(DATABASE::"Purchase Header","Document Type","No.");
31 //QSSD07.01.01.09>>
32 IF "Document Type"="Document Type"::Order THEN
33 IdentifyUser;
34 //QSSD07.01.01.09<<
35
36 //QSSD07.01.01.25>>
37 IF (("Document Type"="Document Type"::Order) OR ("Document Type"="Document Type"::Invoice)) THEN
38 BEGIN
39 VALIDATE("Transaction Type",'10');
40 VALIDATE("Transport Method",'3');
41 END;
42 IF "Document Type"="Document Type"::"Credit Memo" THEN
43 BEGIN
44 VALIDATE("Transaction Type",'16');
45 VALIDATE("Transport Method",'3');
46 END;
47 //QSSD07.01.01.25<<
48
49
50 "Created By USERID" := USERID; //QSSD07.01.19619 EXP
51
52 //DOC OP10181 DB 03/04/2017 -
53 "Created Date" := WORKDATE;
54 "Created By" := USERID;
55 //DOC OP10181 DB 03/04/2017 +
56
57 VALIDATE("Credit Note Date", TODAY); //DOC OP11639 JF 28/02/2018 -+
58 END;
59
60 OnModify=BEGIN
61 //QSSD07.01.01.09>>
62 IF "Document Type"="Document Type"::Order THEN
63 IdentifyUser;
64 //QSSD07.01.01.09<<
65 END;
66
67 OnDelete=BEGIN
68 IF NOT UserSetupMgt.CheckRespCenter(1,"Responsibility Center") THEN
69 ERROR(
70 Text023,
71 RespCenter.TABLECAPTION,UserSetupMgt.GetPurchasesFilter);
72
73 PurchPost.DeleteHeader(
74 Rec,PurchRcptHeader,PurchInvHeader,PurchCrMemoHeader,
75 ReturnShptHeader,PurchInvHeaderPrepmt,PurchCrMemoHeaderPrepmt);
76 VALIDATE("Applies-to ID",'');
77
78 ApprovalMgt.DeleteApprovalEntry(DATABASE::"Purchase Header","Document Type","No.");
79 PurchLine.LOCKTABLE;
80
81 WhseRequest.SETRANGE("Source Type",DATABASE::"Purchase Line");
82 WhseRequest.SETRANGE("Source Subtype","Document Type");
83 WhseRequest.SETRANGE("Source No.","No.");
84 WhseRequest.DELETEALL(TRUE);
85
86 PurchLine.SETRANGE("Document Type","Document Type");
87 PurchLine.SETRANGE("Document No.","No.");
88 PurchLine.SETRANGE(Type,PurchLine.Type::"Charge (Item)");
89 DeletePurchaseLines;
90 PurchLine.SETRANGE(Type);
91 DeletePurchaseLines;
92
93 PurchCommentLine.SETRANGE("Document Type","Document Type");
94 PurchCommentLine.SETRANGE("No.","No.");
95 PurchCommentLine.DELETEALL;
96
97 IF (PurchRcptHeader."No." <> '') OR
98 (PurchInvHeader."No." <> '') OR
99 (PurchCrMemoHeader."No." <> '') OR
100 (ReturnShptHeader."No." <> '') OR
101 (PurchInvHeaderPrepmt."No." <> '') OR
102 (PurchCrMemoHeaderPrepmt."No." <> '')
103 THEN BEGIN
104 COMMIT;
105
106 IF PurchRcptHeader."No." <> '' THEN
107 IF CONFIRM(
108 Text000,TRUE,
109 PurchRcptHeader."No.")
110 THEN BEGIN
111 PurchRcptHeader.SETRECFILTER;
112 PurchRcptHeader.PrintRecords(TRUE);
113 END;
114
115 IF PurchInvHeader."No." <> '' THEN
116 IF CONFIRM(
117 Text001,TRUE,
118 PurchInvHeader."No.")
119 THEN BEGIN
120 PurchInvHeader.SETRECFILTER;
121 PurchInvHeader.PrintRecords(TRUE);
122 END;
123
124 IF PurchCrMemoHeader."No." <> '' THEN
125 IF CONFIRM(
126 Text002,TRUE,
127 PurchCrMemoHeader."No.")
128 THEN BEGIN
129 PurchCrMemoHeader.SETRECFILTER;
130 PurchCrMemoHeader.PrintRecords(TRUE);
131 END;
132
133 IF ReturnShptHeader."No." <> '' THEN
134 IF CONFIRM(
135 Text024,TRUE,
136 ReturnShptHeader."No.")
137 THEN BEGIN
138 ReturnShptHeader.SETRECFILTER;
139 ReturnShptHeader.PrintRecords(TRUE);
140 END;
141
142 IF PurchInvHeaderPrepmt."No." <> '' THEN
143 IF CONFIRM(
144 Text043,TRUE,
145 PurchInvHeader."No.")
146 THEN BEGIN
147 PurchInvHeaderPrepmt.SETRECFILTER;
148 PurchInvHeaderPrepmt.PrintRecords(TRUE);
149 END;
150
151 IF PurchCrMemoHeaderPrepmt."No." <> '' THEN
152 IF CONFIRM(
153 Text044,TRUE,
154 PurchCrMemoHeaderPrepmt."No.")
155 THEN BEGIN
156 PurchCrMemoHeaderPrepmt.SETRECFILTER;
157 PurchCrMemoHeaderPrepmt.PrintRecords(TRUE);
158 END;
159 END;
160 END;
161
162 OnRename=BEGIN
163 ERROR(Text003,TABLECAPTION);
164 END;
165
166 CaptionML=[ENU=Purchase Header;
167 ENG=Purchase Header];
168 LookupPageID=Page53;
169 }
170 FIELDS
171 {
172 { 1 ; ;Document Type ;Option ;CaptionML=[ENU=Document Type;
173 ENG=Document Type];
174 OptionCaptionML=[ENU=Quote,Order,Invoice,Credit Memo,Blanket Order,Return Order;
175 ENG=Quote,Order,Invoice,Credit Memo,Blanket Order,Return Order];
176 OptionString=Quote,Order,Invoice,Credit Memo,Blanket Order,Return Order }
177 { 2 ; ;Buy-from Vendor No. ;Code20 ;TableRelation=Vendor;
178 OnValidate=BEGIN
179 TESTFIELD(Status,Status::Open);
180 IF ("Buy-from Vendor No." <> xRec."Buy-from Vendor No.") AND
181 (xRec."Buy-from Vendor No." <> '')
182 THEN BEGIN
183 IF HideValidationDialog THEN
184 Confirmed := TRUE
185 ELSE
186 Confirmed := CONFIRM(Text004,FALSE,FIELDCAPTION("Buy-from Vendor No."));
187 IF Confirmed THEN BEGIN
188 PurchLine.SETRANGE("Document Type","Document Type");
189 PurchLine.SETRANGE("Document No.","No.");
190 IF "Buy-from Vendor No." = '' THEN BEGIN
191 IF NOT PurchLine.ISEMPTY THEN
192 ERROR(
193 Text005,
194 FIELDCAPTION("Buy-from Vendor No."));
195 INIT;
196 PurchSetup.GET;
197 "No. Series" := xRec."No. Series";
198 InitRecord;
199 IF xRec."Receiving No." <> '' THEN BEGIN
200 "Receiving No. Series" := xRec."Receiving No. Series";
201 "Receiving No." := xRec."Receiving No.";
202 END;
203 IF xRec."Posting No." <> '' THEN BEGIN
204 "Posting No. Series" := xRec."Posting No. Series";
205 "Posting No." := xRec."Posting No.";
206 END;
207 IF xRec."Return Shipment No." <> '' THEN BEGIN
208 "Return Shipment No. Series" := xRec."Return Shipment No. Series";
209 "Return Shipment No." := xRec."Return Shipment No.";
210 END;
211 IF xRec."Prepayment No." <> '' THEN BEGIN
212 "Prepayment No. Series" := xRec."Prepayment No. Series";
213 "Prepayment No." := xRec."Prepayment No.";
214 END;
215 IF xRec."Prepmt. Cr. Memo No." <> '' THEN BEGIN
216 "Prepmt. Cr. Memo No. Series" := xRec."Prepmt. Cr. Memo No. Series";
217 "Prepmt. Cr. Memo No." := xRec."Prepmt. Cr. Memo No.";
218 END;
219 EXIT;
220 END;
221 IF "Document Type" = "Document Type"::Order THEN
222 PurchLine.SETFILTER("Quantity Received",'<>0')
223 ELSE
224 IF "Document Type" = "Document Type"::Invoice THEN BEGIN
225 PurchLine.SETRANGE("Buy-from Vendor No.",xRec."Buy-from Vendor No.");
226 PurchLine.SETFILTER("Receipt No.",'<>%1','');
227 END;
228 IF PurchLine.FINDFIRST THEN
229 IF "Document Type" = "Document Type"::Order THEN
230 PurchLine.TESTFIELD("Quantity Received",0)
231 ELSE
232 PurchLine.TESTFIELD("Receipt No.",'');
233
234 PurchLine.SETRANGE("Receipt No.");
235 PurchLine.SETRANGE("Quantity Received");
236 PurchLine.SETRANGE("Buy-from Vendor No.");
237
238 IF "Document Type" = "Document Type"::Order THEN BEGIN
239 PurchLine.SETFILTER("Prepmt. Amt. Inv.",'<>0');
240 IF PurchLine.FIND('-') THEN
241 PurchLine.TESTFIELD("Prepmt. Amt. Inv.",0);
242 PurchLine.SETRANGE("Prepmt. Amt. Inv.");
243 END;
244
245 IF "Document Type" = "Document Type"::"Return Order" THEN
246 PurchLine.SETFILTER("Return Qty. Shipped",'<>0')
247 ELSE
248 IF "Document Type" = "Document Type"::"Credit Memo" THEN BEGIN
249 PurchLine.SETRANGE("Buy-from Vendor No.",xRec."Buy-from Vendor No.");
250 PurchLine.SETFILTER("Return Shipment No.",'<>%1','');
251 END;
252 IF PurchLine.FINDFIRST THEN
253 IF "Document Type" = "Document Type"::"Return Order" THEN
254 PurchLine.TESTFIELD("Return Qty. Shipped",0)
255 ELSE
256 PurchLine.TESTFIELD("Return Shipment No.",'');
257
258 PurchLine.RESET;
259 END ELSE BEGIN
260 Rec := xRec;
261 EXIT;
262 END;
263 END;
264
265 GetVend("Buy-from Vendor No.");
266 //SSI.Upgrade >>
267 Vend.CheckInsuranceExpired;
268 //SSI.Upgrade <<
269 Vend.CheckBlockedVendOnDocs(Vend,FALSE);
270 Vend.TESTFIELD("Gen. Bus. Posting Group");
271 "Buy-from Vendor Name" := Vend.Name;
272 "Buy-from Vendor Name 2" := Vend."Name 2";
273 "Buy-from Address" := Vend.Address;
274 "Buy-from Address 2" := Vend."Address 2";
275 "Buy-from City" := Vend.City;
276 "Buy-from Post Code" := Vend."Post Code";
277 "Buy-from County" := Vend.County;
278 "Buy-from Country/Region Code" := Vend."Country/Region Code";
279 IF NOT SkipBuyFromContact THEN
280 "Buy-from Contact" := Vend.Contact;
281 "Gen. Bus. Posting Group" := Vend."Gen. Bus. Posting Group";
282 "VAT Bus. Posting Group" := Vend."VAT Bus. Posting Group";
283 "Tax Area Code" := Vend."Tax Area Code";
284 "Tax Liable" := Vend."Tax Liable";
285 "VAT Country/Region Code" := Vend."Country/Region Code";
286 "VAT Registration No." := Vend."VAT Registration No.";
287 VALIDATE("Lead Time Calculation",Vend."Lead Time Calculation");
288 "Type of Supply Code" := Vend."Type of Supply Code";
289 "Responsibility Center" := UserSetupMgt.GetRespCenter(1,Vend."Responsibility Center");
290 VALIDATE("Sell-to Customer No.",'');
291 VALIDATE("Location Code",UserSetupMgt.GetLocation(1,Vend."Location Code","Responsibility Center"));
292
293 IF "Buy-from Vendor No." = xRec."Pay-to Vendor No." THEN BEGIN
294 IF ReceivedPurchLinesExist OR ReturnShipmentExist THEN BEGIN
295 TESTFIELD("VAT Bus. Posting Group",xRec."VAT Bus. Posting Group");
296 TESTFIELD("Gen. Bus. Posting Group",xRec."Gen. Bus. Posting Group");
297 END;
298 END;
299
300 "Buy-from IC Partner Code" := Vend."IC Partner Code";
301 "Send IC Document" := ("Buy-from IC Partner Code" <> '') AND ("IC Direction" = "IC Direction"::Outgoing);
302
303 IF Vend."Pay-to Vendor No." <> '' THEN
304 VALIDATE("Pay-to Vendor No.",Vend."Pay-to Vendor No.")
305 ELSE BEGIN
306 IF "Buy-from Vendor No." = "Pay-to Vendor No." THEN
307 SkipPayToContact := TRUE;
308 VALIDATE("Pay-to Vendor No.","Buy-from Vendor No.");
309 SkipPayToContact := FALSE;
310 END;
311 "Order Address Code" := '';
312
313 VALIDATE("Order Address Code");
314
315 IF (xRec."Buy-from Vendor No." <> "Buy-from Vendor No.") OR
316 (xRec."Currency Code" <> "Currency Code") OR
317 (xRec."Gen. Bus. Posting Group" <> "Gen. Bus. Posting Group") OR
318 (xRec."VAT Bus. Posting Group" <> "VAT Bus. Posting Group")
319 THEN
320 RecreatePurchLines(FIELDCAPTION("Buy-from Vendor No."));
321
322 IF NOT SkipBuyFromContact THEN
323 UpdateBuyFromCont("Buy-from Vendor No.");
324 END;
325
326 CaptionML=[ENU=Buy-from Vendor No.;
327 ENG=Buy-from Vendor No.] }
328 { 3 ; ;No. ;Code20 ;OnValidate=BEGIN
329 IF "No." <> xRec."No." THEN BEGIN
330 PurchSetup.GET;
331 NoSeriesMgt.TestManual(GetNoSeriesCode);
332 "No. Series" := '';
333 END;
334 END;
335
336 CaptionML=[ENU=No.;
337 ENG=No.] }
338 { 4 ; ;Pay-to Vendor No. ;Code20 ;TableRelation=Vendor;
339 OnValidate=BEGIN
340 TESTFIELD(Status,Status::Open);
341 IF (xRec."Pay-to Vendor No." <> "Pay-to Vendor No.") AND
342 (xRec."Pay-to Vendor No." <> '')
343 THEN BEGIN
344 IF HideValidationDialog THEN
345 Confirmed := TRUE
346 ELSE
347 Confirmed := CONFIRM(Text004,FALSE,FIELDCAPTION("Pay-to Vendor No."));
348 IF Confirmed THEN BEGIN
349 PurchLine.SETRANGE("Document Type","Document Type");
350 PurchLine.SETRANGE("Document No.","No.");
351
352 IF "Document Type" = "Document Type"::Order THEN
353 PurchLine.SETFILTER("Quantity Received",'<>0');
354 IF "Document Type" = "Document Type"::Invoice THEN
355 PurchLine.SETFILTER("Receipt No.",'<>%1','');
356 IF PurchLine.FINDFIRST THEN
357 IF "Document Type" = "Document Type"::Order THEN
358 PurchLine.TESTFIELD("Quantity Received",0)
359 ELSE
360 PurchLine.TESTFIELD("Receipt No.",'');
361
362 PurchLine.SETRANGE("Receipt No.");
363 PurchLine.SETRANGE("Quantity Received");
364
365 IF "Document Type" = "Document Type"::Order THEN BEGIN
366 PurchLine.SETFILTER("Prepmt. Amt. Inv.",'<>0');
367 IF PurchLine.FIND('-') THEN
368 PurchLine.TESTFIELD("Prepmt. Amt. Inv.",0);
369 PurchLine.SETRANGE("Prepmt. Amt. Inv.");
370 END;
371
372 IF "Document Type" = "Document Type"::"Return Order" THEN
373 PurchLine.SETFILTER("Return Qty. Shipped",'<>0');
374 IF "Document Type" = "Document Type"::"Credit Memo" THEN
375 PurchLine.SETFILTER("Return Shipment No.",'<>%1','');
376 IF PurchLine.FINDFIRST THEN
377 IF "Document Type" = "Document Type"::"Return Order" THEN
378 PurchLine.TESTFIELD("Return Qty. Shipped",0)
379 ELSE
380 PurchLine.TESTFIELD("Return Shipment No.",'');
381
382 PurchLine.RESET;
383 END ELSE
384 "Pay-to Vendor No." := xRec."Pay-to Vendor No.";
385 END;
386
387 GetVend("Pay-to Vendor No.");
388 Vend.CheckBlockedVendOnDocs(Vend,FALSE);
389 Vend.TESTFIELD("Vendor Posting Group");
390
391 "Pay-to Name" := Vend.Name;
392 "Pay-to Name 2" := Vend."Name 2";
393 "Pay-to Address" := Vend.Address;
394 "Pay-to Address 2" := Vend."Address 2";
395 "Pay-to City" := Vend.City;
396 "Pay-to Post Code" := Vend."Post Code";
397 "Pay-to County" := Vend.County;
398 "Pay-to Country/Region Code" := Vend."Country/Region Code";
399 IF NOT SkipPayToContact THEN
400 "Pay-to Contact" := Vend.Contact;
401 "Payment Terms Code" := Vend."Payment Terms Code";
402 "Prepmt. Payment Terms Code" := Vend."Payment Terms Code";
403
404 IF "Document Type" = "Document Type"::"Credit Memo" THEN BEGIN
405 "Payment Method Code" := '';
406 IF PaymentTerms.GET("Payment Terms Code") THEN
407 IF PaymentTerms."Calc. Pmt. Disc. on Cr. Memos" THEN
408 "Payment Method Code" := Vend."Payment Method Code"
409 END ELSE
410 "Payment Method Code" := Vend."Payment Method Code";
411
412 "Shipment Method Code" := Vend."Shipment Method Code";
413 "Vendor Posting Group" := Vend."Vendor Posting Group";
414 GLSetup.GET;
415 IF GLSetup."Bill-to/Sell-to VAT Calc." = GLSetup."Bill-to/Sell-to VAT Calc."::"Bill-to/Pay-to No." THEN BEGIN
416 "VAT Bus. Posting Group" := Vend."VAT Bus. Posting Group";
417 "VAT Country/Region Code" := Vend."Country/Region Code";
418 "VAT Registration No." := Vend."VAT Registration No.";
419 "Gen. Bus. Posting Group" := Vend."Gen. Bus. Posting Group";
420 END;
421 "Prices Including VAT" := Vend."Prices Including VAT";
422 "Currency Code" := Vend."Currency Code";
423 "Invoice Disc. Code" := Vend."Invoice Disc. Code";
424 "Language Code" := Vend."Language Code";
425 "Purchaser Code" := Vend."Purchaser Code";
426 VALIDATE("Payment Terms Code");
427 VALIDATE("Prepmt. Payment Terms Code");
428 VALIDATE("Payment Method Code");
429 VALIDATE("Currency Code");
430 VALIDATE("Creditor No.",Vend."Creditor No.");
431
432 IF "Document Type" = "Document Type"::Order THEN
433 VALIDATE("Prepayment %",Vend."Prepayment %");
434
435 IF "Pay-to Vendor No." = xRec."Pay-to Vendor No." THEN BEGIN
436 IF ReceivedPurchLinesExist THEN
437 TESTFIELD("Currency Code",xRec."Currency Code");
438 END;
439
440 InitDefaultDim;
441
442 IF (xRec."Buy-from Vendor No." = "Buy-from Vendor No.") AND
443 (xRec."Pay-to Vendor No." <> "Pay-to Vendor No.")
444 THEN
445 RecreatePurchLines(FIELDCAPTION("Pay-to Vendor No."));
446
447 IF NOT SkipPayToContact THEN
448 UpdatePayToCont("Pay-to Vendor No.");
449
450 "Pay-to IC Partner Code" := Vend."IC Partner Code";
451 END;
452
453 CaptionML=[ENU=Pay-to Vendor No.;
454 ENG=Pay-to Vendor No.];
455 NotBlank=Yes }
456 { 5 ; ;Pay-to Name ;Text50 ;CaptionML=[ENU=Pay-to Name;
457 ENG=Pay-to Name] }
458 { 6 ; ;Pay-to Name 2 ;Text50 ;CaptionML=[ENU=Pay-to Name 2;
459 ENG=Pay-to Name 2] }
460 { 7 ; ;Pay-to Address ;Text50 ;CaptionML=[ENU=Pay-to Address;
461 ENG=Pay-to Address] }
462 { 8 ; ;Pay-to Address 2 ;Text50 ;CaptionML=[ENU=Pay-to Address 2;
463 ENG=Pay-to Address 2] }
464 { 9 ; ;Pay-to City ;Text30 ;TableRelation=IF (Pay-to Country/Region Code=CONST()) "Post Code".City
465 ELSE IF (Pay-to Country/Region Code=FILTER(<>'')) "Post Code".City WHERE (Country/Region Code=FIELD(Pay-to Country/Region Code));
466 OnValidate=BEGIN
467 PostCode.ValidateCity(
468 "Pay-to City","Pay-to Post Code","Pay-to County","Pay-to Country/Region Code",(CurrFieldNo <> 0) AND GUIALLOWED);
469 END;
470
471 ValidateTableRelation=No;
472 TestTableRelation=No;
473 CaptionML=[ENU=Pay-to City;
474 ENG=Pay-to City] }
475 { 10 ; ;Pay-to Contact ;Text50 ;CaptionML=[ENU=Pay-to Contact;
476 ENG=Pay-to Contact] }
477 { 11 ; ;Your Reference ;Text35 ;CaptionML=[ENU=Your Reference;
478 ENG=Your Reference] }
479 { 12 ; ;Ship-to Code ;Code10 ;TableRelation="Ship-to Address".Code WHERE (Customer No.=FIELD(Sell-to Customer No.));
480 OnValidate=BEGIN
481 IF ("Document Type" = "Document Type"::Order) AND
482 (xRec."Ship-to Code" <> "Ship-to Code")
483 THEN BEGIN
484 PurchLine.SETRANGE("Document Type",PurchLine."Document Type"::Order);
485 PurchLine.SETRANGE("Document No.","No.");
486 PurchLine.SETFILTER("Sales Order Line No.",'<>0');
487 IF NOT PurchLine.ISEMPTY THEN
488 ERROR(
489 Text006,
490 FIELDCAPTION("Ship-to Code"));
491 END;
492
493 IF "Ship-to Code" <> '' THEN BEGIN
494 ShipToAddr.GET("Sell-to Customer No.","Ship-to Code");
495 "Ship-to Name" := ShipToAddr.Name;
496 "Ship-to Name 2" := ShipToAddr."Name 2";
497 "Ship-to Address" := ShipToAddr.Address;
498 "Ship-to Address 2" := ShipToAddr."Address 2";
499 "Ship-to City" := ShipToAddr.City;
500 "Ship-to Post Code" := ShipToAddr."Post Code";
501 "Ship-to County" := ShipToAddr.County;
502 "Ship-to Country/Region Code" := ShipToAddr."Country/Region Code";
503 "Ship-to Contact" := ShipToAddr.Contact;
504 "Shipment Method Code" := ShipToAddr."Shipment Method Code";
505 IF ShipToAddr."Location Code" <> '' THEN
506 VALIDATE("Location Code",ShipToAddr."Location Code");
507 END ELSE BEGIN
508 TESTFIELD("Sell-to Customer No.");
509 Cust.GET("Sell-to Customer No.");
510 "Ship-to Name" := Cust.Name;
511 "Ship-to Name 2" := Cust."Name 2";
512 "Ship-to Address" := Cust.Address;
513 "Ship-to Address 2" := Cust."Address 2";
514 "Ship-to City" := Cust.City;
515 "Ship-to Post Code" := Cust."Post Code";
516 "Ship-to County" := Cust.County;
517 "Ship-to Country/Region Code" := Cust."Country/Region Code";
518 "Ship-to Contact" := Cust.Contact;
519 "Shipment Method Code" := Cust."Shipment Method Code";
520 IF Cust."Location Code" <> '' THEN
521 VALIDATE("Location Code",Cust."Location Code");
522 END;
523 END;
524
525 CaptionML=[ENU=Ship-to Code;
526 ENG=Ship-to Code] }
527 { 13 ; ;Ship-to Name ;Text50 ;CaptionML=[ENU=Ship-to Name;
528 ENG=Ship-to Name] }
529 { 14 ; ;Ship-to Name 2 ;Text50 ;CaptionML=[ENU=Ship-to Name 2;
530 ENG=Ship-to Name 2] }
531 { 15 ; ;Ship-to Address ;Text50 ;CaptionML=[ENU=Ship-to Address;
532 ENG=Ship-to Address] }
533 { 16 ; ;Ship-to Address 2 ;Text50 ;CaptionML=[ENU=Ship-to Address 2;
534 ENG=Ship-to Address 2] }
535 { 17 ; ;Ship-to City ;Text30 ;TableRelation=IF (Ship-to Country/Region Code=CONST()) "Post Code".City
536 ELSE IF (Ship-to Country/Region Code=FILTER(<>'')) "Post Code".City WHERE (Country/Region Code=FIELD(Ship-to Country/Region Code));
537 OnValidate=BEGIN
538 PostCode.ValidateCity(
539 "Ship-to City","Ship-to Post Code","Ship-to County","Ship-to Country/Region Code",(CurrFieldNo <> 0) AND GUIALLOWED);
540 END;
541
542 ValidateTableRelation=No;
543 TestTableRelation=No;
544 CaptionML=[ENU=Ship-to City;
545 ENG=Ship-to City] }
546 { 18 ; ;Ship-to Contact ;Text50 ;CaptionML=[ENU=Ship-to Contact;
547 ENG=Ship-to Contact] }
548 { 19 ; ;Order Date ;Date ;OnValidate=BEGIN
549 TESTFIELD(Status,Status::Open);
550 IF ("Document Type" IN ["Document Type"::Quote,"Document Type"::Order]) AND
551 NOT ("Order Date" = xRec."Order Date")
552 THEN
553 PriceMessageIfPurchLinesExist(FIELDCAPTION("Order Date"));
554 END;
555
556 CaptionML=[ENU=Order Date;
557 ENG=Order Date] }
558 { 20 ; ;Posting Date ;Date ;OnValidate=BEGIN
559 TestNoSeriesDate(
560 "Posting No.","Posting No. Series",
561 FIELDCAPTION("Posting No."),FIELDCAPTION("Posting No. Series"));
562 TestNoSeriesDate(
563 "Prepayment No.","Prepayment No. Series",
564 FIELDCAPTION("Prepayment No."),FIELDCAPTION("Prepayment No. Series"));
565 TestNoSeriesDate(
566 "Prepmt. Cr. Memo No.","Prepmt. Cr. Memo No. Series",
567 FIELDCAPTION("Prepmt. Cr. Memo No."),FIELDCAPTION("Prepmt. Cr. Memo No. Series"));
568 //QSSD07.01.20330 >>
569 //VALIDATE("Document Date","Posting Date");
570 IF "Document Type" <> "Document Type"::Invoice THEN
571 VALIDATE("Document Date","Posting Date");
572 //QSSD07.01.20330 <<
573
574 IF ("Document Type" IN ["Document Type"::Invoice,"Document Type"::"Credit Memo"]) AND
575 NOT ("Posting Date" = xRec."Posting Date")
576 THEN
577 PriceMessageIfPurchLinesExist(FIELDCAPTION("Posting Date"));
578
579 IF "Currency Code" <> '' THEN BEGIN
580 UpdateCurrencyFactor;
581 IF "Currency Factor" <> xRec."Currency Factor" THEN
582 ConfirmUpdateCurrencyFactor;
583 END;
584 IF PurchLinesExist THEN
585 JobUpdatePurchLines;
586 END;
587
588 CaptionML=[ENU=Posting Date;
589 ENG=Posting/Tax Point Date] }
590 { 21 ; ;Expected Receipt Date;Date ;OnValidate=BEGIN
591 UpdatePurchLines(FIELDCAPTION("Expected Receipt Date"));
592 END;
593
594 CaptionML=[ENU=Expected Receipt Date;
595 ENG=Expected Receipt Date] }
596 { 22 ; ;Posting Description ;Text50 ;CaptionML=[ENU=Posting Description;
597 ENG=Posting Description] }
598 { 23 ; ;Payment Terms Code ;Code10 ;TableRelation="Payment Terms";
599 OnValidate=BEGIN
600 IF ("Payment Terms Code" <> '') AND ("Document Date" <> 0D) THEN BEGIN
601 PaymentTerms.GET("Payment Terms Code");
602 IF (("Document Type" IN ["Document Type"::"Return Order","Document Type"::"Credit Memo"]) AND
603 NOT PaymentTerms."Calc. Pmt. Disc. on Cr. Memos")
604 THEN BEGIN
605 VALIDATE("Due Date","Document Date");
606 VALIDATE("Pmt. Discount Date",0D);
607 VALIDATE("Payment Discount %",0);
608 END ELSE BEGIN
609 "Due Date" := CALCDATE(PaymentTerms."Due Date Calculation","Document Date");
610 "Pmt. Discount Date" := CALCDATE(PaymentTerms."Discount Date Calculation","Document Date");
611 IF NOT UpdateDocumentDate THEN
612 VALIDATE("Payment Discount %",PaymentTerms."Discount %");
613 //SSI.Upgrade >>
614 //CITP001>>
615 "Pmt. Discount Date 2" := CALCDATE(PaymentTerms."Discount Date Calculation 2","Document Date");
616 "Pmt. Discount Date 3" := CALCDATE(PaymentTerms."Discount Date Calculation 3","Document Date");
617 "Pmt. Discount Date 4" := CALCDATE(PaymentTerms."Discount Date Calculation 4","Document Date");
618 VALIDATE("Payment Discount % 2",PaymentTerms."Discount % 2");
619 VALIDATE("Payment Discount % 3",PaymentTerms."Discount % 3");
620 VALIDATE("Payment Discount % 4",PaymentTerms."Discount % 4");
621 //CITP001<<
622 //SSI.Upgrade <<
623 END;
624 END ELSE BEGIN
625 VALIDATE("Due Date","Document Date");
626 IF NOT UpdateDocumentDate THEN BEGIN
627 VALIDATE("Pmt. Discount Date",0D);
628 VALIDATE("Payment Discount %",0);
629 END;
630 END;
631 IF xRec."Payment Terms Code" = "Prepmt. Payment Terms Code" THEN
632 VALIDATE("Prepmt. Payment Terms Code","Payment Terms Code");
633 UpdatePmtDiscDate;
634 END;
635
636 CaptionML=[ENU=Payment Terms Code;
637 ENG=Payment Terms Code] }
638 { 24 ; ;Due Date ;Date ;CaptionML=[ENU=Due Date;
639 ENG=Due Date] }
640 { 25 ; ;Payment Discount % ;Decimal ;OnValidate=BEGIN
641 IF NOT (CurrFieldNo IN [0,FIELDNO("Posting Date"),FIELDNO("Document Date")]) THEN
642 TESTFIELD(Status,Status::Open);
643 GLSetup.GET;
644 IF "Payment Discount %" < GLSetup."VAT Tolerance %" THEN
645 "VAT Base Discount %" := "Payment Discount %"
646 ELSE
647 "VAT Base Discount %" := GLSetup."VAT Tolerance %";
648 VALIDATE("VAT Base Discount %");
649 UpdatePmtDiscDate;
650 END;
651
652 CaptionML=[ENU=Payment Discount %;
653 ENG=Payment Discount %];
654 DecimalPlaces=0:5;
655 MinValue=0;
656 MaxValue=100 }
657 { 26 ; ;Pmt. Discount Date ;Date ;OnValidate=BEGIN
658 UpdatePmtDiscDate;
659 END;
660
661 CaptionML=[ENU=Pmt. Discount Date;
662 ENG=Pmt. Discount Date] }
663 { 27 ; ;Shipment Method Code;Code10 ;TableRelation="Shipment Method";
664 OnValidate=BEGIN
665 TESTFIELD(Status,Status::Open);
666 END;
667
668 CaptionML=[ENU=Shipment Method Code;
669 ENG=Shipment Method Code] }
670 { 28 ; ;Location Code ;Code10 ;TableRelation=Location WHERE (Use As In-Transit=CONST(No));
671 OnValidate=BEGIN
672 TESTFIELD(Status,Status::Open);
673 IF ("Location Code" <> xRec."Location Code") AND
674 (xRec."Buy-from Vendor No." = "Buy-from Vendor No.")
675 THEN
676 MessageIfPurchLinesExist(FIELDCAPTION("Location Code"));
677
678 UpdateShipToAddress;
679
680 IF "Location Code" = '' THEN BEGIN
681 IF InvtSetup.GET THEN
682 "Inbound Whse. Handling Time" := InvtSetup."Inbound Whse. Handling Time";
683 END ELSE BEGIN
684 IF Location.GET("Location Code") THEN;
685 "Inbound Whse. Handling Time" := Location."Inbound Whse. Handling Time";
686 END;
687 END;
688
689 CaptionML=[ENU=Location Code;
690 ENG=Location Code] }
691 { 29 ; ;Shortcut Dimension 1 Code;Code20 ;TableRelation="Dimension Value".Code WHERE (Global Dimension No.=CONST(1));
692 OnValidate=BEGIN
693 ValidateShortcutDimCode(1,"Shortcut Dimension 1 Code");
694 END;
695
696 CaptionML=[ENU=Shortcut Dimension 1 Code;
697 ENG=Shortcut Dimension 1 Code];
698 CaptionClass='1,2,1' }
699 { 30 ; ;Shortcut Dimension 2 Code;Code20 ;TableRelation="Dimension Value".Code WHERE (Global Dimension No.=CONST(2));
700 OnValidate=BEGIN
701 ValidateShortcutDimCode(2,"Shortcut Dimension 2 Code");
702 END;
703
704 CaptionML=[ENU=Shortcut Dimension 2 Code;
705 ENG=Shortcut Dimension 2 Code];
706 CaptionClass='1,2,2' }
707 { 31 ; ;Vendor Posting Group;Code10 ;TableRelation="Vendor Posting Group";
708 CaptionML=[ENU=Vendor Posting Group;
709 ENG=Vendor Posting Group];
710 Editable=No }
711 { 32 ; ;Currency Code ;Code10 ;TableRelation=Currency;
712 OnValidate=VAR
713 CurrencyRec@1000000000 : Record 4;
714 BEGIN
715 //QSSD07.01.01.37 >>
716 IF CurrencyRec.GET("Currency Code") THEN
717 CurrencyRec.TESTFIELD(Blocked,FALSE);
718 //QSSD07.01.01.37 <<
719
720
721 //SSI.Upgrade >>
722 IF "Currency Code" = '' THEN
723 "Fixed Exchange Rate" := FALSE;
724 //SSI.Upgrade <<
725 IF NOT (CurrFieldNo IN [0,FIELDNO("Posting Date")]) OR ("Currency Code" <> xRec."Currency Code") THEN
726 TESTFIELD(Status,Status::Open);
727 IF (CurrFieldNo <> FIELDNO("Currency Code")) AND ("Currency Code" = xRec."Currency Code") THEN
728 UpdateCurrencyFactor
729 ELSE BEGIN
730 IF "Currency Code" <> xRec."Currency Code" THEN BEGIN
731 UpdateCurrencyFactor;
732 IF PurchLinesExist THEN
733 IF CONFIRM(ChangeCurrencyQst,FALSE,FIELDCAPTION("Currency Code")) THEN BEGIN
734 SetHideValidationDialog(TRUE);
735 RecreatePurchLines(FIELDCAPTION("Currency Code"));
736 SetHideValidationDialog(FALSE);
737 END ELSE
738 ERROR(Text018,FIELDCAPTION("Currency Code"));
739 END ELSE
740 IF "Currency Code" <> '' THEN BEGIN
741 UpdateCurrencyFactor;
742 IF "Currency Factor" <> xRec."Currency Factor" THEN
743 ConfirmUpdateCurrencyFactor;
744 END;
745 END;
746 END;
747
748 CaptionML=[ENU=Currency Code;
749 ENG=Currency Code] }
750 { 33 ; ;Currency Factor ;Decimal ;OnValidate=BEGIN
751 IF "Currency Factor" <> xRec."Currency Factor" THEN
752 UpdatePurchLines(FIELDCAPTION("Currency Factor"));
753 END;
754
755 CaptionML=[ENU=Currency Factor;
756 ENG=Currency Factor];
757 DecimalPlaces=0:15;
758 MinValue=0;
759 Editable=No }
760 { 35 ; ;Prices Including VAT;Boolean ;OnValidate=VAR
761 PurchLine@1000 : Record 39;
762 Currency@1001 : Record 4;
763 RecalculatePrice@1002 : Boolean;
764 BEGIN
765 TESTFIELD(Status,Status::Open);
766
767 IF "Prices Including VAT" <> xRec."Prices Including VAT" THEN BEGIN
768 PurchLine.SETRANGE("Document Type","Document Type");
769 PurchLine.SETRANGE("Document No.","No.");
770 PurchLine.SETFILTER("Direct Unit Cost",'<>%1',0);
771 PurchLine.SETFILTER("VAT %",'<>%1',0);
772 IF PurchLine.FIND('-') THEN BEGIN
773 RecalculatePrice :=
774 CONFIRM(
775 STRSUBSTNO(
776 Text025 +
777 Text027,
778 FIELDCAPTION("Prices Including VAT"),PurchLine.FIELDCAPTION("Direct Unit Cost")),
779 TRUE);
780 PurchLine.SetPurchHeader(Rec);
781
782 IF "Currency Code" = '' THEN
783 Currency.InitRoundingPrecision
784 ELSE
785 Currency.GET("Currency Code");
786
787 REPEAT
788 PurchLine.TESTFIELD("Quantity Invoiced",0);
789 PurchLine.TESTFIELD("Prepmt. Amt. Inv.",0);
790 IF NOT RecalculatePrice THEN BEGIN
791 PurchLine."VAT Difference" := 0;
792 PurchLine.InitOutstandingAmount;
793 END ELSE
794 IF "Prices Including VAT" THEN BEGIN
795 PurchLine."Direct Unit Cost" :=
796 ROUND(
797 PurchLine."Direct Unit Cost" * (1 + PurchLine."VAT %" / 100),
798 Currency."Unit-Amount Rounding Precision");
799 IF PurchLine.Quantity <> 0 THEN BEGIN
800 PurchLine."Line Discount Amount" :=
801 ROUND(
802 PurchLine.Quantity * PurchLine."Direct Unit Cost" * PurchLine."Line Discount %" / 100,
803 Currency."Amount Rounding Precision");
804 PurchLine.VALIDATE("Inv. Discount Amount",
805 ROUND(
806 PurchLine."Inv. Discount Amount" * (1 + PurchLine."VAT %" / 100),
807 Currency."Amount Rounding Precision"));
808 END;
809 END ELSE BEGIN
810 PurchLine."Direct Unit Cost" :=
811 ROUND(
812 PurchLine."Direct Unit Cost" / (1 + PurchLine."VAT %" / 100),
813 Currency."Unit-Amount Rounding Precision");
814 IF PurchLine.Quantity <> 0 THEN BEGIN
815 PurchLine."Line Discount Amount" :=
816 ROUND(
817 PurchLine.Quantity * PurchLine."Direct Unit Cost" * PurchLine."Line Discount %" / 100,
818 Currency."Amount Rounding Precision");
819 PurchLine.VALIDATE("Inv. Discount Amount",
820 ROUND(
821 PurchLine."Inv. Discount Amount" / (1 + PurchLine."VAT %" / 100),
822 Currency."Amount Rounding Precision"));
823 END;
824 END;
825 PurchLine.MODIFY;
826 UNTIL PurchLine.NEXT = 0;
827 END;
828 END;
829 END;
830
831 CaptionML=[ENU=Prices Including VAT;
832 ENG=Prices Including VAT] }
833 { 37 ; ;Invoice Disc. Code ;Code20 ;OnValidate=BEGIN
834 TESTFIELD(Status,Status::Open);
835 MessageIfPurchLinesExist(FIELDCAPTION("Invoice Disc. Code"));
836 END;
837
838 CaptionML=[ENU=Invoice Disc. Code;
839 ENG=Invoice Disc. Code] }
840 { 41 ; ;Language Code ;Code10 ;TableRelation=Language;
841 OnValidate=BEGIN
842 MessageIfPurchLinesExist(FIELDCAPTION("Language Code"));
843 END;
844
845 CaptionML=[ENU=Language Code;
846 ENG=Language Code] }
847 { 43 ; ;Purchaser Code ;Code10 ;TableRelation=Salesperson/Purchaser;
848 OnValidate=VAR
849 ApprovalEntry@1001 : Record 454;
850 BEGIN
851 ApprovalEntry.SETRANGE("Table ID",DATABASE::"Purchase Header");
852 ApprovalEntry.SETRANGE("Document Type","Document Type");
853 ApprovalEntry.SETRANGE("Document No.","No.");
854 ApprovalEntry.SETFILTER(Status,'<>%1&<>%2',ApprovalEntry.Status::Canceled,ApprovalEntry.Status::Rejected);
855 IF NOT ApprovalEntry.ISEMPTY THEN
856 ERROR(Text042,FIELDCAPTION("Purchaser Code"));
857
858 InitDefaultDim;
859
860 // IN36649 MCI 27/03/2017 -
861 // IN31678 - Addition of Project Manager autofill BW -
862 // ProjManager.RESET;
863 // ProjManager.SETRANGE(ProjManager."Purchaser Code", "Purchaser Code");
864 // IF ProjManager.FINDSET THEN
865 // "Project Manager":= ProjManager."Project Manager";
866 // IN31678 - Addition of Project Manager autofill BW +
867 // IN36649 MCI 27/03/2017 +
868 END;
869
870 CaptionML=[ENU=Purchaser Code;
871 ENG=Purchaser Code] }
872 { 45 ; ;Order Class ;Code10 ;CaptionML=[ENU=Order Class;
873 ENG=Order Class] }
874 { 46 ; ;Comment ;Boolean ;FieldClass=FlowField;
875 CalcFormula=Exist("Purch. Comment Line" WHERE (Document Type=FIELD(Document Type),
876 No.=FIELD(No.),
877 Document Line No.=CONST(0)));
878 CaptionML=[ENU=Comment;
879 ENG=Comment];
880 Editable=No }
881 { 47 ; ;No. Printed ;Integer ;CaptionML=[ENU=No. Printed;
882 ENG=No. Printed];
883 Editable=No }
884 { 51 ; ;On Hold ;Code3 ;CaptionML=[ENU=On Hold;
885 ENG=On Hold] }
886 { 52 ; ;Applies-to Doc. Type;Option ;CaptionML=[ENU=Applies-to Doc. Type;
887 ENG=Applies-to Doc. Type];
888 OptionCaptionML=[ENU=" ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund";
889 ENG=" ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund"];
890 OptionString=[ ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund] }
891 { 53 ; ;Applies-to Doc. No. ;Code20 ;OnValidate=BEGIN
892 IF "Applies-to Doc. No." <> '' THEN
893 TESTFIELD("Bal. Account No.",'');
894
895 IF ("Applies-to Doc. No." <> xRec."Applies-to Doc. No.") AND (xRec."Applies-to Doc. No." <> '') AND
896 ("Applies-to Doc. No." <> '')
897 THEN BEGIN
898 SetAmountToApply("Applies-to Doc. No.","Buy-from Vendor No.");
899 SetAmountToApply(xRec."Applies-to Doc. No.","Buy-from Vendor No.");
900 END ELSE
901 IF ("Applies-to Doc. No." <> xRec."Applies-to Doc. No.") AND (xRec."Applies-to Doc. No." = '') THEN
902 SetAmountToApply("Applies-to Doc. No.","Buy-from Vendor No.")
903 ELSE
904 IF ("Applies-to Doc. No." <> xRec."Applies-to Doc. No.") AND ("Applies-to Doc. No." = '') THEN
905 SetAmountToApply(xRec."Applies-to Doc. No.","Buy-from Vendor No.");
906 END;
907
908 OnLookup=BEGIN
909 TESTFIELD("Bal. Account No.",'');
910 VendLedgEntry.SETCURRENTKEY("Vendor No.",Open,Positive,"Due Date");
911 VendLedgEntry.SETRANGE("Vendor No.","Pay-to Vendor No.");
912 VendLedgEntry.SETRANGE(Open,TRUE);
913 IF "Applies-to Doc. No." <> '' THEN BEGIN
914 VendLedgEntry.SETRANGE("Document Type","Applies-to Doc. Type");
915 VendLedgEntry.SETRANGE("Document No.","Applies-to Doc. No.");
916 IF VendLedgEntry.FINDFIRST THEN;
917 VendLedgEntry.SETRANGE("Document Type");
918 VendLedgEntry.SETRANGE("Document No.");
919 END ELSE
920 IF "Applies-to Doc. Type" <> 0 THEN BEGIN
921 VendLedgEntry.SETRANGE("Document Type","Applies-to Doc. Type");
922 IF VendLedgEntry.FINDFIRST THEN;
923 VendLedgEntry.SETRANGE("Document Type");
924 END ELSE
925 IF Amount <> 0 THEN BEGIN
926 VendLedgEntry.SETRANGE(Positive,Amount < 0);
927 IF VendLedgEntry.FINDFIRST THEN;
928 VendLedgEntry.SETRANGE(Positive);
929 END;
930 ApplyVendEntries.SetPurch(Rec,VendLedgEntry,PurchHeader.FIELDNO("Applies-to Doc. No."));
931 ApplyVendEntries.SETTABLEVIEW(VendLedgEntry);
932 ApplyVendEntries.SETRECORD(VendLedgEntry);
933 ApplyVendEntries.LOOKUPMODE(TRUE);
934 IF ApplyVendEntries.RUNMODAL = ACTION::LookupOK THEN BEGIN
935 ApplyVendEntries.GetVendLedgEntry(VendLedgEntry);
936 GenJnlApply.CheckAgainstApplnCurrency(
937 "Currency Code",VendLedgEntry."Currency Code",GenJnILine."Account Type"::Vendor,TRUE);
938 "Applies-to Doc. Type" := VendLedgEntry."Document Type";
939 "Applies-to Doc. No." := VendLedgEntry."Document No.";
940 END;
941 CLEAR(ApplyVendEntries);
942 END;
943
944 CaptionML=[ENU=Applies-to Doc. No.;
945 ENG=Applies-to Doc. No.] }
946 { 55 ; ;Bal. Account No. ;Code20 ;TableRelation=IF (Bal. Account Type=CONST(G/L Account)) "G/L Account"
947 ELSE IF (Bal. Account Type=CONST(Bank Account)) "Bank Account";
948 OnValidate=BEGIN
949 IF "Bal. Account No." <> '' THEN
950 CASE "Bal. Account Type" OF
951 "Bal. Account Type"::"G/L Account":
952 BEGIN
953 GLAcc.GET("Bal. Account No.");
954 GLAcc.CheckGLAcc;
955 GLAcc.TESTFIELD("Direct Posting",TRUE);
956 END;
957 "Bal. Account Type"::"Bank Account":
958 BEGIN
959 BankAcc.GET("Bal. Account No.");
960 BankAcc.TESTFIELD(Blocked,FALSE);
961 BankAcc.TESTFIELD("Currency Code","Currency Code");
962 END;
963 END;
964 END;
965
966 CaptionML=[ENU=Bal. Account No.;
967 ENG=Bal. Account No.] }
968 { 57 ; ;Receive ;Boolean ;CaptionML=[ENU=Receive;
969 ENG=Receive] }
970 { 58 ; ;Invoice ;Boolean ;CaptionML=[ENU=Invoice;
971 ENG=Invoice] }
972 { 59 ; ;Print Posted Documents;Boolean ;CaptionML=[ENU=Print Posted Documents;
973 ENG=Print Posted Documents] }
974 { 60 ; ;Amount ;Decimal ;FieldClass=FlowField;
975 CalcFormula=Sum("Purchase Line".Amount WHERE (Document Type=FIELD(Document Type),
976 Document No.=FIELD(No.)));
977 CaptionML=[ENU=Amount;
978 ENG=Amount];
979 Editable=No;
980 AutoFormatType=1;
981 AutoFormatExpr="Currency Code" }
982 { 61 ; ;Amount Including VAT;Decimal ;FieldClass=FlowField;
983 CalcFormula=Sum("Purchase Line"."Amount Including VAT" WHERE (Document Type=FIELD(Document Type),
984 Document No.=FIELD(No.)));
985 CaptionML=[ENU=Amount Including VAT;
986 ENG=Amount Including VAT];
987 Editable=No;
988 AutoFormatType=1;
989 AutoFormatExpr="Currency Code" }
990 { 62 ; ;Receiving No. ;Code20 ;CaptionML=[ENU=Receiving No.;
991 ENG=Receiving No.] }
992 { 63 ; ;Posting No. ;Code20 ;CaptionML=[ENU=Posting No.;
993 ENG=Posting No.] }
994 { 64 ; ;Last Receiving No. ;Code20 ;TableRelation="Purch. Rcpt. Header";
995 CaptionML=[ENU=Last Receiving No.;
996 ENG=Last Receiving No.];
997 Editable=No }
998 { 65 ; ;Last Posting No. ;Code20 ;TableRelation="Purch. Inv. Header";
999 CaptionML=[ENU=Last Posting No.;
1000 ENG=Last Posting No.];
1001 Editable=No }
1002 { 66 ; ;Vendor Order No. ;Code35 ;CaptionML=[ENU=Vendor Order No.;
1003 ENG=Vendor Order No.] }
1004 { 67 ; ;Vendor Shipment No. ;Code35 ;CaptionML=[ENU=Vendor Shipment No.;
1005 ENG=Vendor Shipment No.] }
1006 { 68 ; ;Vendor Invoice No. ;Code35 ;OnValidate=BEGIN
1007 //SSI.Upgrade >>
1008 IF (("Document Type" = "Document Type"::Order) OR ("Document Type" = "Document Type"::Invoice)) THEN
1009 CheckDuplicateVendorInvNo("Vendor Invoice No.","Buy-from Vendor No.","No.");
1010 //SSI.Upgrade <<
1011 END;
1012
1013 CaptionML=[ENU=Vendor Invoice No.;
1014 ENG=Vendor Invoice No.] }
1015 { 69 ; ;Vendor Cr. Memo No. ;Code35 ;OnValidate=BEGIN
1016 //QSSD07.01.20188 >>
1017 IF "Document Type" = "Document Type"::"Credit Memo" THEN
1018 CheckDuplicateVendorCMNo("Vendor Cr. Memo No.","Buy-from Vendor No.","No.");
1019 //QSSD07.01.20188 <<
1020 END;
1021
1022 CaptionML=[ENU=Vendor Cr. Memo No.;
1023 ENG=Vendor Cr. Memo No.] }
1024 { 70 ; ;VAT Registration No.;Text20 ;CaptionML=[ENU=VAT Registration No.;
1025 ENG=VAT Registration No.] }
1026 { 72 ; ;Sell-to Customer No.;Code20 ;TableRelation=Customer;
1027 OnValidate=BEGIN
1028 IF ("Document Type" = "Document Type"::Order) AND
1029 (xRec."Sell-to Customer No." <> "Sell-to Customer No.")
1030 THEN BEGIN
1031 PurchLine.SETRANGE("Document Type",PurchLine."Document Type"::Order);
1032 PurchLine.SETRANGE("Document No.","No.");
1033 PurchLine.SETFILTER("Sales Order Line No.",'<>0');
1034 IF NOT PurchLine.ISEMPTY THEN
1035 ERROR(
1036 Text006,
1037 FIELDCAPTION("Sell-to Customer No."));
1038 END;
1039
1040 IF "Sell-to Customer No." = '' THEN
1041 VALIDATE("Location Code",UserSetupMgt.GetLocation(1,'',"Responsibility Center"))
1042 ELSE
1043 VALIDATE("Ship-to Code",'');
1044
1045 CheckCustomer; //SSI.Upgrader1
1046 END;
1047
1048 CaptionML=[ENU=Sell-to Customer No.;
1049 ENG=Sell-to Customer No.] }
1050 { 73 ; ;Reason Code ;Code10 ;TableRelation="Reason Code";
1051 CaptionML=[ENU=Reason Code;
1052 ENG=Reason Code] }
1053 { 74 ; ;Gen. Bus. Posting Group;Code10 ;TableRelation="Gen. Business Posting Group";
1054 OnValidate=BEGIN
1055 TESTFIELD(Status,Status::Open);
1056 IF (xRec."Buy-from Vendor No." = "Buy-from Vendor No.") AND
1057 (xRec."Gen. Bus. Posting Group" <> "Gen. Bus. Posting Group")
1058 THEN
1059 IF GenBusPostingGrp.ValidateVatBusPostingGroup(GenBusPostingGrp,"Gen. Bus. Posting Group") THEN BEGIN
1060 "VAT Bus. Posting Group" := GenBusPostingGrp."Def. VAT Bus. Posting Group";
1061 RecreatePurchLines(FIELDCAPTION("Gen. Bus. Posting Group"));
1062 END;
1063 END;
1064
1065 CaptionML=[ENU=Gen. Bus. Posting Group;
1066 ENG=Gen. Bus. Posting Group] }
1067 { 76 ; ;Transaction Type ;Code10 ;TableRelation="Transaction Type";
1068 OnValidate=BEGIN
1069 UpdatePurchLines(FIELDCAPTION("Transaction Type"));
1070 END;
1071
1072 CaptionML=[ENU=Transaction Type;
1073 ENG=Transaction Nature Code] }
1074 { 77 ; ;Transport Method ;Code10 ;TableRelation="Transport Method";
1075 OnValidate=BEGIN
1076 UpdatePurchLines(FIELDCAPTION("Transport Method"));
1077 END;
1078
1079 CaptionML=[ENU=Transport Method;
1080 ENG=Transport Method] }
1081 { 78 ; ;VAT Country/Region Code;Code10 ;TableRelation=Country/Region;
1082 CaptionML=[ENU=VAT Country/Region Code;
1083 ENG=VAT Country/Region Code] }
1084 { 79 ; ;Buy-from Vendor Name;Text50 ;CaptionML=[ENU=Buy-from Vendor Name;
1085 ENG=Buy-from Vendor Name] }
1086 { 80 ; ;Buy-from Vendor Name 2;Text50 ;CaptionML=[ENU=Buy-from Vendor Name 2;
1087 ENG=Buy-from Vendor Name 2] }
1088 { 81 ; ;Buy-from Address ;Text50 ;CaptionML=[ENU=Buy-from Address;
1089 ENG=Buy-from Address] }
1090 { 82 ; ;Buy-from Address 2 ;Text50 ;CaptionML=[ENU=Buy-from Address 2;
1091 ENG=Buy-from Address 2] }
1092 { 83 ; ;Buy-from City ;Text30 ;TableRelation=IF (Buy-from Country/Region Code=CONST()) "Post Code".City
1093 ELSE IF (Buy-from Country/Region Code=FILTER(<>'')) "Post Code".City WHERE (Country/Region Code=FIELD(Buy-from Country/Region Code));
1094 OnValidate=BEGIN
1095 PostCode.ValidateCity(
1096 "Buy-from City","Buy-from Post Code","Buy-from County","Buy-from Country/Region Code",(CurrFieldNo <> 0) AND GUIALLOWED);
1097 END;
1098
1099 ValidateTableRelation=No;
1100 TestTableRelation=No;
1101 CaptionML=[ENU=Buy-from City;
1102 ENG=Buy-from City] }
1103 { 84 ; ;Buy-from Contact ;Text50 ;CaptionML=[ENU=Buy-from Contact;
1104 ENG=Buy-from Contact] }
1105 { 85 ; ;Pay-to Post Code ;Code20 ;TableRelation=IF (Pay-to Country/Region Code=CONST()) "Post Code"
1106 ELSE IF (Pay-to Country/Region Code=FILTER(<>'')) "Post Code" WHERE (Country/Region Code=FIELD(Pay-to Country/Region Code));
1107 OnValidate=BEGIN
1108 PostCode.ValidatePostCode(
1109 "Pay-to City","Pay-to Post Code","Pay-to County","Pay-to Country/Region Code",(CurrFieldNo <> 0) AND GUIALLOWED);
1110 END;
1111
1112 ValidateTableRelation=No;
1113 TestTableRelation=No;
1114 CaptionML=[ENU=Pay-to Post Code;
1115 ENG=Pay-to Post Code] }
1116 { 86 ; ;Pay-to County ;Text30 ;CaptionML=[ENU=Pay-to County;
1117 ENG=Pay-to County] }
1118 { 87 ; ;Pay-to Country/Region Code;Code10 ;TableRelation=Country/Region;
1119 CaptionML=[ENU=Pay-to Country/Region Code;
1120 ENG=Pay-to Country/Region Code] }
1121 { 88 ; ;Buy-from Post Code ;Code20 ;TableRelation=IF (Buy-from Country/Region Code=CONST()) "Post Code"
1122 ELSE IF (Buy-from Country/Region Code=FILTER(<>'')) "Post Code" WHERE (Country/Region Code=FIELD(Buy-from Country/Region Code));
1123 OnValidate=BEGIN
1124 PostCode.ValidatePostCode(
1125 "Buy-from City","Buy-from Post Code","Buy-from County","Buy-from Country/Region Code",(CurrFieldNo <> 0) AND GUIALLOWED);
1126 END;
1127
1128 ValidateTableRelation=No;
1129 TestTableRelation=No;
1130 CaptionML=[ENU=Buy-from Post Code;
1131 ENG=Buy-from Post Code] }
1132 { 89 ; ;Buy-from County ;Text30 ;CaptionML=[ENU=Buy-from County;
1133 ENG=Buy-from County] }
1134 { 90 ; ;Buy-from Country/Region Code;Code10;TableRelation=Country/Region;
1135 CaptionML=[ENU=Buy-from Country/Region Code;
1136 ENG=Buy-from Country/Region Code] }
1137 { 91 ; ;Ship-to Post Code ;Code20 ;TableRelation=IF (Ship-to Country/Region Code=CONST()) "Post Code"
1138 ELSE IF (Ship-to Country/Region Code=FILTER(<>'')) "Post Code" WHERE (Country/Region Code=FIELD(Ship-to Country/Region Code));
1139 OnValidate=BEGIN
1140 PostCode.ValidatePostCode(
1141 "Ship-to City","Ship-to Post Code","Ship-to County","Ship-to Country/Region Code",(CurrFieldNo <> 0) AND GUIALLOWED);
1142 END;
1143
1144 ValidateTableRelation=No;
1145 TestTableRelation=No;
1146 CaptionML=[ENU=Ship-to Post Code;
1147 ENG=Ship-to Post Code] }
1148 { 92 ; ;Ship-to County ;Text30 ;CaptionML=[ENU=Ship-to County;
1149 ENG=Ship-to County] }
1150 { 93 ; ;Ship-to Country/Region Code;Code10 ;TableRelation=Country/Region;
1151 CaptionML=[ENU=Ship-to Country/Region Code;
1152 ENG=Ship-to Country/Region Code] }
1153 { 94 ; ;Bal. Account Type ;Option ;CaptionML=[ENU=Bal. Account Type;
1154 ENG=Bal. Account Type];
1155 OptionCaptionML=[ENU=G/L Account,Bank Account;
1156 ENG=G/L Account,Bank Account];
1157 OptionString=G/L Account,Bank Account }
1158 { 95 ; ;Order Address Code ;Code10 ;TableRelation="Order Address".Code WHERE (Vendor No.=FIELD(Buy-from Vendor No.));
1159 OnValidate=BEGIN
1160 IF "Order Address Code" <> '' THEN BEGIN
1161 OrderAddr.GET("Buy-from Vendor No.","Order Address Code");
1162 "Buy-from Vendor Name" := OrderAddr.Name;
1163 "Buy-from Vendor Name 2" := OrderAddr."Name 2";
1164 "Buy-from Address" := OrderAddr.Address;
1165 "Buy-from Address 2" := OrderAddr."Address 2";
1166 "Buy-from City" := OrderAddr.City;
1167 "Buy-from Contact" := OrderAddr.Contact;
1168 "Buy-from Post Code" := OrderAddr."Post Code";
1169 "Buy-from County" := OrderAddr.County;
1170 "Buy-from Country/Region Code" := OrderAddr."Country/Region Code";
1171
1172 IF ("Document Type" = "Document Type"::"Return Order") OR
1173 ("Document Type" = "Document Type"::"Credit Memo")
1174 THEN BEGIN
1175 "Ship-to Name" := OrderAddr.Name;
1176 "Ship-to Name 2" := OrderAddr."Name 2";
1177 "Ship-to Address" := OrderAddr.Address;
1178 "Ship-to Address 2" := OrderAddr."Address 2";
1179 "Ship-to City" := OrderAddr.City;
1180 "Ship-to Post Code" := OrderAddr."Post Code";
1181 "Ship-to County" := OrderAddr.County;
1182 "Ship-to Country/Region Code" := OrderAddr."Country/Region Code";
1183 "Ship-to Contact" := OrderAddr.Contact;
1184 END
1185 END ELSE BEGIN
1186 GetVend("Buy-from Vendor No.");
1187 "Buy-from Vendor Name" := Vend.Name;
1188 "Buy-from Vendor Name 2" := Vend."Name 2";
1189 "Buy-from Address" := Vend.Address;
1190 "Buy-from Address 2" := Vend."Address 2";
1191 "Buy-from City" := Vend.City;
1192 "Buy-from Contact" := Vend.Contact;
1193 "Buy-from Post Code" := Vend."Post Code";
1194 "Buy-from County" := Vend.County;
1195 "Buy-from Country/Region Code" := Vend."Country/Region Code";
1196
1197 IF ("Document Type" = "Document Type"::"Return Order") OR
1198 ("Document Type" = "Document Type"::"Credit Memo")
1199 THEN BEGIN
1200 "Ship-to Name" := Vend.Name;
1201 "Ship-to Name 2" := Vend."Name 2";
1202 "Ship-to Address" := Vend.Address;
1203 "Ship-to Address 2" := Vend."Address 2";
1204 "Ship-to City" := Vend.City;
1205 "Ship-to Post Code" := Vend."Post Code";
1206 "Ship-to County" := Vend.County;
1207 "Ship-to Country/Region Code" := Vend."Country/Region Code";
1208 "Ship-to Contact" := Vend.Contact;
1209 "Shipment Method Code" := Vend."Shipment Method Code";
1210 IF Vend."Location Code" <> '' THEN
1211 VALIDATE("Location Code",Vend."Location Code");
1212 END
1213 END;
1214 END;
1215
1216 CaptionML=[ENU=Order Address Code;
1217 ENG=Order Address Code] }
1218 { 97 ; ;Entry Point ;Code10 ;TableRelation="Entry/Exit Point";
1219 OnValidate=BEGIN
1220 UpdatePurchLines(FIELDCAPTION("Entry Point"));
1221 END;
1222
1223 CaptionML=[ENU=Entry Point;
1224 ENG=Entry Point] }
1225 { 98 ; ;Correction ;Boolean ;CaptionML=[ENU=Correction;
1226 ENG=Correction] }
1227 { 99 ; ;Document Date ;Date ;OnValidate=BEGIN
1228 IF xRec."Document Date" <> "Document Date" THEN
1229 UpdateDocumentDate := TRUE;
1230 VALIDATE("Payment Terms Code");
1231 VALIDATE("Prepmt. Payment Terms Code");
1232 END;
1233
1234 CaptionML=[ENU=Document Date;
1235 ENG=Document Date] }
1236 { 101 ; ;Area ;Code10 ;TableRelation=Area;
1237 OnValidate=BEGIN
1238 UpdatePurchLines(FIELDCAPTION(Area));
1239 END;
1240
1241 CaptionML=[ENU=Area;
1242 ENG=Area] }
1243 { 102 ; ;Transaction Specification;Code10 ;TableRelation="Transaction Specification";
1244 OnValidate=BEGIN
1245 UpdatePurchLines(FIELDCAPTION("Transaction Specification"));
1246 END;
1247
1248 CaptionML=[ENU=Transaction Specification;
1249 ENG=Transaction Specification] }
1250 { 104 ; ;Payment Method Code ;Code10 ;TableRelation="Payment Method";
1251 OnValidate=BEGIN
1252 PaymentMethod.INIT;
1253 IF "Payment Method Code" <> '' THEN
1254 PaymentMethod.GET("Payment Method Code");
1255 "Bal. Account Type" := PaymentMethod."Bal. Account Type";
1256 "Bal. Account No." := PaymentMethod."Bal. Account No.";
1257 IF "Bal. Account No." <> '' THEN BEGIN
1258 TESTFIELD("Applies-to Doc. No.",'');
1259 TESTFIELD("Applies-to ID",'');
1260 END;
1261 END;
1262
1263 CaptionML=[ENU=Payment Method Code;
1264 ENG=Payment Method Code] }
1265 { 107 ; ;No. Series ;Code10 ;TableRelation="No. Series";
1266 CaptionML=[ENU=No. Series;
1267 ENG=No. Series];
1268 Editable=No }
1269 { 108 ; ;Posting No. Series ;Code10 ;TableRelation="No. Series";
1270 OnValidate=BEGIN
1271 IF "Posting No. Series" <> '' THEN BEGIN
1272 PurchSetup.GET;
1273 TestNoSeries;
1274 NoSeriesMgt.TestSeries(GetPostingNoSeriesCode,"Posting No. Series");
1275 END;
1276 TESTFIELD("Posting No.",'');
1277 END;
1278
1279 OnLookup=BEGIN
1280 WITH PurchHeader DO BEGIN
1281 PurchHeader := Rec;
1282 PurchSetup.GET;
1283 TestNoSeries;
1284 IF NoSeriesMgt.LookupSeries(GetPostingNoSeriesCode,"Posting No. Series") THEN
1285 VALIDATE("Posting No. Series");
1286 Rec := PurchHeader;
1287 END;
1288 END;
1289
1290 CaptionML=[ENU=Posting No. Series;
1291 ENG=Posting No. Series] }
1292 { 109 ; ;Receiving No. Series;Code10 ;TableRelation="No. Series";
1293 OnValidate=BEGIN
1294 IF "Receiving No. Series" <> '' THEN BEGIN
1295 PurchSetup.GET;
1296 PurchSetup.TESTFIELD("Posted Receipt Nos.");
1297 NoSeriesMgt.TestSeries(PurchSetup."Posted Receipt Nos.","Receiving No. Series");
1298 END;
1299 TESTFIELD("Receiving No.",'');
1300 END;
1301
1302 OnLookup=BEGIN
1303 WITH PurchHeader DO BEGIN
1304 PurchHeader := Rec;
1305 PurchSetup.GET;
1306 PurchSetup.TESTFIELD("Posted Receipt Nos.");
1307 IF NoSeriesMgt.LookupSeries(PurchSetup."Posted Receipt Nos.","Receiving No. Series") THEN
1308 VALIDATE("Receiving No. Series");
1309 Rec := PurchHeader;
1310 END;
1311 END;
1312
1313 CaptionML=[ENU=Receiving No. Series;
1314 ENG=Receiving No. Series] }
1315 { 114 ; ;Tax Area Code ;Code20 ;TableRelation="Tax Area";
1316 OnValidate=BEGIN
1317 TESTFIELD(Status,Status::Open);
1318 MessageIfPurchLinesExist(FIELDCAPTION("Tax Area Code"));
1319 END;
1320
1321 CaptionML=[ENU=Tax Area Code;
1322 ENG=VAT Area Code] }
1323 { 115 ; ;Tax Liable ;Boolean ;OnValidate=BEGIN
1324 TESTFIELD(Status,Status::Open);
1325 MessageIfPurchLinesExist(FIELDCAPTION("Tax Liable"));
1326 END;
1327
1328 CaptionML=[ENU=Tax Liable;
1329 ENG=VAT Liable] }
1330 { 116 ; ;VAT Bus. Posting Group;Code10 ;TableRelation="VAT Business Posting Group";
1331 OnValidate=BEGIN
1332 TESTFIELD(Status,Status::Open);
1333 IF (xRec."Buy-from Vendor No." = "Buy-from Vendor No.") AND
1334 (xRec."VAT Bus. Posting Group" <> "VAT Bus. Posting Group")
1335 THEN
1336 RecreatePurchLines(FIELDCAPTION("VAT Bus. Posting Group"));
1337 END;
1338
1339 CaptionML=[ENU=VAT Bus. Posting Group;
1340 ENG=VAT Bus. Posting Group] }
1341 { 118 ; ;Applies-to ID ;Code50 ;OnValidate=VAR
1342 TempVendLedgEntry@1000 : Record 25;
1343 BEGIN
1344 IF "Applies-to ID" <> '' THEN
1345 TESTFIELD("Bal. Account No.",'');
1346 IF ("Applies-to ID" <> xRec."Applies-to ID") AND (xRec."Applies-to ID" <> '') THEN BEGIN
1347 VendLedgEntry.SETCURRENTKEY("Vendor No.",Open);
1348 VendLedgEntry.SETRANGE("Vendor No.","Pay-to Vendor No.");
1349 VendLedgEntry.SETRANGE(Open,TRUE);
1350 VendLedgEntry.SETRANGE("Applies-to ID",xRec."Applies-to ID");
1351 IF VendLedgEntry.FINDFIRST THEN
1352 VendEntrySetApplID.SetApplId(VendLedgEntry,TempVendLedgEntry,'');
1353 VendLedgEntry.RESET;
1354 END;
1355 END;
1356
1357 CaptionML=[ENU=Applies-to ID;
1358 ENG=Applies-to ID] }
1359 { 119 ; ;VAT Base Discount % ;Decimal ;OnValidate=BEGIN
1360 GLSetup.GET;
1361 IF "VAT Base Discount %" > GLSetup."VAT Tolerance %" THEN BEGIN
1362 IF HideValidationDialog THEN
1363 Confirmed := TRUE
1364 ELSE
1365 Confirmed :=
1366 CONFIRM(
1367 Text007 +
1368 Text008,FALSE,
1369 FIELDCAPTION("VAT Base Discount %"),
1370 GLSetup.FIELDCAPTION("VAT Tolerance %"),
1371 GLSetup.TABLECAPTION);
1372 IF NOT Confirmed THEN
1373 "VAT Base Discount %" := xRec."VAT Base Discount %";
1374 END;
1375
1376 IF ("VAT Base Discount %" = xRec."VAT Base Discount %") AND
1377 (CurrFieldNo <> 0)
1378 THEN
1379 EXIT;
1380
1381 PurchLine.SETRANGE("Document Type","Document Type");
1382 PurchLine.SETRANGE("Document No.","No.");
1383 PurchLine.SETFILTER(Type,'<>%1',PurchLine.Type::" ");
1384 PurchLine.SETFILTER(Quantity,'<>0');
1385 PurchLine.LOCKTABLE;
1386 IF PurchLine.FINDSET THEN BEGIN
1387 MODIFY;
1388 REPEAT
1389 PurchLine.UpdateAmounts;
1390 PurchLine.MODIFY;
1391 UNTIL PurchLine.NEXT = 0;
1392 END;
1393 PurchLine.RESET;
1394 END;
1395
1396 CaptionML=[ENU=VAT Base Discount %;
1397 ENG=VAT Base Discount %];
1398 DecimalPlaces=0:5;
1399 MinValue=0;
1400 MaxValue=100 }
1401 { 120 ; ;Status ;Option ;CaptionML=[ENU=Status;
1402 ENG=Status];
1403 OptionCaptionML=[ENU=Open,Released,Pending Approval,Pending Prepayment;
1404 ENG=Open,Released,Pending Approval,Pending Prepayment];
1405 OptionString=Open,Released,Pending Approval,Pending Prepayment;
1406 Editable=Yes }
1407 { 121 ; ;Invoice Discount Calculation;Option;CaptionML=[ENU=Invoice Discount Calculation;
1408 ENG=Invoice Discount Calculation];
1409 OptionCaptionML=[ENU=None,%,Amount;
1410 ENG=None,%,Amount];
1411 OptionString=None,%,Amount;
1412 Editable=No }
1413 { 122 ; ;Invoice Discount Value;Decimal ;CaptionML=[ENU=Invoice Discount Value;
1414 ENG=Invoice Discount Value];
1415 Editable=No;
1416 AutoFormatType=1 }
1417 { 123 ; ;Send IC Document ;Boolean ;OnValidate=BEGIN
1418 IF "Send IC Document" THEN BEGIN
1419 TESTFIELD("Buy-from IC Partner Code");
1420 TESTFIELD("IC Direction","IC Direction"::Outgoing);
1421 END;
1422 END;
1423
1424 CaptionML=[ENU=Send IC Document;
1425 ENG=Send IC Document] }
1426 { 124 ; ;IC Status ;Option ;CaptionML=[ENU=IC Status;
1427 ENG=IC Status];
1428 OptionCaptionML=[ENU=New,Pending,Sent;
1429 ENG=New,Pending,Sent];
1430 OptionString=New,Pending,Sent }
1431 { 125 ; ;Buy-from IC Partner Code;Code20 ;TableRelation="IC Partner";
1432 CaptionML=[ENU=Buy-from IC Partner Code;
1433 ENG=Buy-from IC Partner Code];
1434 Editable=No }
1435 { 126 ; ;Pay-to IC Partner Code;Code20 ;TableRelation="IC Partner";
1436 CaptionML=[ENU=Pay-to IC Partner Code;
1437 ENG=Pay-to IC Partner Code];
1438 Editable=No }
1439 { 129 ; ;IC Direction ;Option ;OnValidate=BEGIN
1440 IF "IC Direction" = "IC Direction"::Incoming THEN
1441 "Send IC Document" := FALSE;
1442 END;
1443
1444 CaptionML=[ENU=IC Direction;
1445 ENG=IC Direction];
1446 OptionCaptionML=[ENU=Outgoing,Incoming;
1447 ENG=Outgoing,Incoming];
1448 OptionString=Outgoing,Incoming }
1449 { 130 ; ;Prepayment No. ;Code20 ;CaptionML=[ENU=Prepayment No.;
1450 ENG=Prepayment No.] }
1451 { 131 ; ;Last Prepayment No. ;Code20 ;TableRelation="Purch. Inv. Header";
1452 CaptionML=[ENU=Last Prepayment No.;
1453 ENG=Last Prepayment No.] }
1454 { 132 ; ;Prepmt. Cr. Memo No.;Code20 ;CaptionML=[ENU=Prepmt. Cr. Memo No.;
1455 ENG=Prepmt. Cr. Memo No.] }
1456 { 133 ; ;Last Prepmt. Cr. Memo No.;Code20 ;TableRelation="Purch. Cr. Memo Hdr.";
1457 CaptionML=[ENU=Last Prepmt. Cr. Memo No.;
1458 ENG=Last Prepmt. Cr. Memo No.] }
1459 { 134 ; ;Prepayment % ;Decimal ;OnValidate=BEGIN
1460 IF CurrFieldNo <> 0 THEN
1461 UpdatePurchLines(FIELDCAPTION("Prepayment %"));
1462 END;
1463
1464 CaptionML=[ENU=Prepayment %;
1465 ENG=Prepayment %];
1466 DecimalPlaces=0:5;
1467 MinValue=0;
1468 MaxValue=100 }
1469 { 135 ; ;Prepayment No. Series;Code10 ;TableRelation="No. Series";
1470 OnValidate=BEGIN
1471 IF "Prepayment No. Series" <> '' THEN BEGIN
1472 PurchSetup.GET;
1473 PurchSetup.TESTFIELD("Posted Prepmt. Inv. Nos.");
1474 NoSeriesMgt.TestSeries(GetPostingPrepaymentNoSeriesCode,"Prepayment No. Series");
1475 END;
1476 TESTFIELD("Prepayment No.",'');
1477 END;
1478
1479 OnLookup=BEGIN
1480 WITH PurchHeader DO BEGIN
1481 PurchHeader := Rec;
1482 PurchSetup.GET;
1483 PurchSetup.TESTFIELD("Posted Prepmt. Inv. Nos.");
1484 IF NoSeriesMgt.LookupSeries(GetPostingPrepaymentNoSeriesCode,"Prepayment No. Series") THEN
1485 VALIDATE("Prepayment No. Series");
1486 Rec := PurchHeader;
1487 END;
1488 END;
1489
1490 CaptionML=[ENU=Prepayment No. Series;
1491 ENG=Prepayment No. Series] }
1492 { 136 ; ;Compress Prepayment ;Boolean ;InitValue=Yes;
1493 CaptionML=[ENU=Compress Prepayment;
1494 ENG=Compress Prepayment] }
1495 { 137 ; ;Prepayment Due Date ;Date ;CaptionML=[ENU=Prepayment Due Date;
1496 ENG=Prepayment Due Date] }
1497 { 138 ; ;Prepmt. Cr. Memo No. Series;Code10 ;TableRelation="No. Series";
1498 OnValidate=BEGIN
1499 IF "Prepmt. Cr. Memo No. Series" <> '' THEN BEGIN
1500 PurchSetup.GET;
1501 PurchSetup.TESTFIELD("Posted Prepmt. Cr. Memo Nos.");
1502 NoSeriesMgt.TestSeries(GetPostingPrepaymentNoSeriesCode,"Prepmt. Cr. Memo No. Series");
1503 END;
1504 TESTFIELD("Prepmt. Cr. Memo No.",'');
1505 END;
1506
1507 OnLookup=BEGIN
1508 WITH PurchHeader DO BEGIN
1509 PurchHeader := Rec;
1510 PurchSetup.GET;
1511 PurchSetup.TESTFIELD("Posted Prepmt. Cr. Memo Nos.");
1512 IF NoSeriesMgt.LookupSeries(GetPostingPrepaymentNoSeriesCode,"Prepmt. Cr. Memo No. Series") THEN
1513 VALIDATE("Prepmt. Cr. Memo No. Series");
1514 Rec := PurchHeader;
1515 END;
1516 END;
1517
1518 CaptionML=[ENU=Prepmt. Cr. Memo No. Series;
1519 ENG=Prepmt. Cr. Memo No. Series] }
1520 { 139 ; ;Prepmt. Posting Description;Text50 ;CaptionML=[ENU=Prepmt. Posting Description;
1521 ENG=Prepmt. Posting Description] }
1522 { 142 ; ;Prepmt. Pmt. Discount Date;Date ;CaptionML=[ENU=Prepmt. Pmt. Discount Date;
1523 ENG=Prepmt. Pmt. Discount Date] }
1524 { 143 ; ;Prepmt. Payment Terms Code;Code10 ;TableRelation="Payment Terms";
1525 OnValidate=VAR
1526 PaymentTerms@1000 : Record 3;
1527 BEGIN
1528 IF ("Prepmt. Payment Terms Code" <> '') AND ("Document Date" <> 0D) THEN BEGIN
1529 PaymentTerms.GET("Prepmt. Payment Terms Code");
1530 IF (("Document Type" IN ["Document Type"::"Return Order","Document Type"::"Credit Memo"]) AND
1531 NOT PaymentTerms."Calc. Pmt. Disc. on Cr. Memos")
1532 THEN BEGIN
1533 VALIDATE("Prepayment Due Date","Document Date");
1534 VALIDATE("Prepmt. Pmt. Discount Date",0D);
1535 VALIDATE("Prepmt. Payment Discount %",0);
1536 END ELSE BEGIN
1537 "Prepayment Due Date" := CALCDATE(PaymentTerms."Due Date Calculation","Document Date");
1538 "Prepmt. Pmt. Discount Date" := CALCDATE(PaymentTerms."Discount Date Calculation","Document Date");
1539 IF NOT UpdateDocumentDate THEN
1540 VALIDATE("Prepmt. Payment Discount %",PaymentTerms."Discount %")
1541 END;
1542 END ELSE BEGIN
1543 VALIDATE("Prepayment Due Date","Document Date");
1544 IF NOT UpdateDocumentDate THEN BEGIN
1545 VALIDATE("Prepmt. Pmt. Discount Date",0D);
1546 VALIDATE("Prepmt. Payment Discount %",0);
1547 END;
1548 END;
1549 END;
1550
1551 CaptionML=[ENU=Prepmt. Payment Terms Code;
1552 ENG=Prepmt. Payment Terms Code] }
1553 { 144 ; ;Prepmt. Payment Discount %;Decimal ;OnValidate=BEGIN
1554 IF NOT (CurrFieldNo IN [0,FIELDNO("Posting Date"),FIELDNO("Document Date")]) THEN
1555 TESTFIELD(Status,Status::Open);
1556 GLSetup.GET;
1557 IF "Payment Discount %" < GLSetup."VAT Tolerance %" THEN
1558 "VAT Base Discount %" := "Payment Discount %"
1559 ELSE
1560 "VAT Base Discount %" := GLSetup."VAT Tolerance %";
1561 VALIDATE("VAT Base Discount %");
1562 END;
1563
1564 CaptionML=[ENU=Prepmt. Payment Discount %;
1565 ENG=Prepmt. Payment Discount %];
1566 DecimalPlaces=0:5;
1567 MinValue=0;
1568 MaxValue=100 }
1569 { 151 ; ;Quote No. ;Code20 ;CaptionML=[ENU=Quote No.;
1570 ENG=Quote No.];
1571 Editable=No }
1572 { 160 ; ;Job Queue Status ;Option ;OnLookup=VAR
1573 JobQueueEntry@1000 : Record 472;
1574 BEGIN
1575 IF "Job Queue Status" = "Job Queue Status"::" " THEN
1576 EXIT;
1577 JobQueueEntry.ShowStatusMsg("Job Queue Entry ID");
1578 END;
1579
1580 CaptionML=[ENU=Job Queue Status;
1581 ENG=Job Queue Status];
1582 OptionCaptionML=[ENU=" ,Scheduled for Posting,Error,Posting";
1583 ENG=" ,Scheduled for Posting,Error,Posting"];
1584 OptionString=[ ,Scheduled for Posting,Error,Posting];
1585 Editable=No }
1586 { 161 ; ;Job Queue Entry ID ;GUID ;CaptionML=[ENU=Job Queue Entry ID;
1587 ENG=Job Queue Entry ID];
1588 Editable=No }
1589 { 165 ; ;Incoming Document Entry No.;Integer;TableRelation="Incoming Document" WHERE (Status=FILTER(New|Approved));
1590 OnValidate=VAR
1591 IncomingDocument@1000 : Record 130;
1592 BEGIN
1593 IncomingDocument.SetPurchDoc(Rec);
1594 END;
1595
1596 CaptionML=[ENU=Incoming Document Entry No.;
1597 ENG=Incoming Document Entry No.] }
1598 { 170 ; ;Creditor No. ;Code20 ;CaptionML=[ENU=Creditor No.;
1599 ENG=Creditor No.];
1600 Numeric=Yes }
1601 { 171 ; ;Payment Reference ;Code50 ;OnValidate=BEGIN
1602 IF "Payment Reference" <> '' THEN
1603 TESTFIELD("Creditor No.");
1604 END;
1605
1606 CaptionML=[ENU=Payment Reference;
1607 ENG=Payment Reference];
1608 Numeric=Yes }
1609 { 480 ; ;Dimension Set ID ;Integer ;TableRelation="Dimension Set Entry";
1610 OnLookup=BEGIN
1611 ShowDocDim;
1612 END;
1613
1614 CaptionML=[ENU=Dimension Set ID;
1615 ENG=Dimension Set ID];
1616 Editable=No }
1617 { 1305; ;Invoice Discount Amount;Decimal ;FieldClass=FlowField;
1618 CalcFormula=Sum("Purchase Line"."Inv. Discount Amount" WHERE (Document No.=FIELD(No.),
1619 Document Type=FIELD(Document Type)));
1620 CaptionML=[ENU=Invoice Discount Amount;
1621 ENG=Invoice Discount Amount];
1622 Editable=No;
1623 AutoFormatType=1 }
1624 { 5043; ;No. of Archived Versions;Integer ;FieldClass=FlowField;
1625 CalcFormula=Max("Purchase Header Archive"."Version No." WHERE (Document Type=FIELD(Document Type),
1626 No.=FIELD(No.),
1627 Doc. No. Occurrence=FIELD(Doc. No. Occurrence)));
1628 CaptionML=[ENU=No. of Archived Versions;
1629 ENG=No. of Archived Versions];
1630 Editable=No }
1631 { 5048; ;Doc. No. Occurrence ;Integer ;CaptionML=[ENU=Doc. No. Occurrence;
1632 ENG=Doc. No. Occurrence] }
1633 { 5050; ;Campaign No. ;Code20 ;TableRelation=Campaign;
1634 OnValidate=BEGIN
1635 InitDefaultDim;
1636 END;
1637
1638 CaptionML=[ENU=Campaign No.;
1639 ENG=Campaign No.] }
1640 { 5052; ;Buy-from Contact No.;Code20 ;TableRelation=Contact;
1641 OnValidate=VAR
1642 ContBusinessRelation@1000 : Record 5054;
1643 Cont@1002 : Record 5050;
1644 BEGIN
1645 TESTFIELD(Status,Status::Open);
1646
1647 IF ("Buy-from Contact No." <> xRec."Buy-from Contact No.") AND
1648 (xRec."Buy-from Contact No." <> '')
1649 THEN BEGIN
1650 IF HideValidationDialog THEN
1651 Confirmed := TRUE
1652 ELSE
1653 Confirmed := CONFIRM(Text004,FALSE,FIELDCAPTION("Buy-from Contact No."));
1654 IF Confirmed THEN BEGIN
1655 PurchLine.SETRANGE("Document Type","Document Type");
1656 PurchLine.SETRANGE("Document No.","No.");
1657 IF ("Buy-from Contact No." = '') AND ("Buy-from Vendor No." = '') THEN BEGIN
1658 IF NOT PurchLine.ISEMPTY THEN
1659 ERROR(
1660 Text005,
1661 FIELDCAPTION("Buy-from Contact No."));
1662 INIT;
1663 PurchSetup.GET;
1664 InitRecord;
1665 "No. Series" := xRec."No. Series";
1666 IF xRec."Receiving No." <> '' THEN BEGIN
1667 "Receiving No. Series" := xRec."Receiving No. Series";
1668 "Receiving No." := xRec."Receiving No.";
1669 END;
1670 IF xRec."Posting No." <> '' THEN BEGIN
1671 "Posting No. Series" := xRec."Posting No. Series";
1672 "Posting No." := xRec."Posting No.";
1673 END;
1674 IF xRec."Return Shipment No." <> '' THEN BEGIN
1675 "Return Shipment No. Series" := xRec."Return Shipment No. Series";
1676 "Return Shipment No." := xRec."Return Shipment No.";
1677 END;
1678 IF xRec."Prepayment No." <> '' THEN BEGIN
1679 "Prepayment No. Series" := xRec."Prepayment No. Series";
1680 "Prepayment No." := xRec."Prepayment No.";
1681 END;
1682 IF xRec."Prepmt. Cr. Memo No." <> '' THEN BEGIN
1683 "Prepmt. Cr. Memo No. Series" := xRec."Prepmt. Cr. Memo No. Series";
1684 "Prepmt. Cr. Memo No." := xRec."Prepmt. Cr. Memo No.";
1685 END;
1686 EXIT;
1687 END;
1688 END ELSE BEGIN
1689 Rec := xRec;
1690 EXIT;
1691 END;
1692 END;
1693
1694 IF ("Buy-from Vendor No." <> '') AND ("Buy-from Contact No." <> '') THEN BEGIN
1695 Cont.GET("Buy-from Contact No.");
1696 ContBusinessRelation.RESET;
1697 ContBusinessRelation.SETCURRENTKEY("Link to Table","No.");
1698 ContBusinessRelation.SETRANGE("Link to Table",ContBusinessRelation."Link to Table"::Vendor);
1699 ContBusinessRelation.SETRANGE("No.","Buy-from Vendor No.");
1700 IF ContBusinessRelation.FINDFIRST THEN
1701 IF ContBusinessRelation."Contact No." <> Cont."Company No." THEN
1702 ERROR(Text038,Cont."No.",Cont.Name,"Buy-from Vendor No.");
1703 END;
1704
1705 UpdateBuyFromVend("Buy-from Contact No.");
1706 END;
1707
1708 OnLookup=VAR
1709 Cont@1001 : Record 5050;
1710 ContBusinessRelation@1000 : Record 5054;
1711 BEGIN
1712 IF "Buy-from Vendor No." <> '' THEN BEGIN
1713 IF Cont.GET("Buy-from Contact No.") THEN
1714 Cont.SETRANGE("Company No.",Cont."Company No.")
1715 ELSE BEGIN
1716 ContBusinessRelation.RESET;
1717 ContBusinessRelation.SETCURRENTKEY("Link to Table","No.");
1718 ContBusinessRelation.SETRANGE("Link to Table",ContBusinessRelation."Link to Table"::Vendor);
1719 ContBusinessRelation.SETRANGE("No.","Buy-from Vendor No.");
1720 IF ContBusinessRelation.FINDFIRST THEN
1721 Cont.SETRANGE("Company No.",ContBusinessRelation."Contact No.")
1722 ELSE
1723 Cont.SETRANGE("No.",'');
1724 END;
1725 END;
1726
1727 IF "Buy-from Contact No." <> '' THEN
1728 IF Cont.GET("Buy-from Contact No.") THEN ;
1729 IF PAGE.RUNMODAL(0,Cont) = ACTION::LookupOK THEN BEGIN
1730 xRec := Rec;
1731 VALIDATE("Buy-from Contact No.",Cont."No.");
1732 END;
1733 END;
1734
1735 CaptionML=[ENU=Buy-from Contact No.;
1736 ENG=Buy-from Contact No.] }
1737 { 5053; ;Pay-to Contact No. ;Code20 ;TableRelation=Contact;
1738 OnValidate=VAR
1739 ContBusinessRelation@1004 : Record 5054;
1740 Cont@1002 : Record 5050;
1741 BEGIN
1742 TESTFIELD(Status,Status::Open);
1743
1744 IF ("Pay-to Contact No." <> xRec."Pay-to Contact No.") AND
1745 (xRec."Pay-to Contact No." <> '')
1746 THEN BEGIN
1747 IF HideValidationDialog THEN
1748 Confirmed := TRUE
1749 ELSE
1750 Confirmed := CONFIRM(Text004,FALSE,FIELDCAPTION("Pay-to Contact No."));
1751 IF Confirmed THEN BEGIN
1752 PurchLine.SETRANGE("Document Type","Document Type");
1753 PurchLine.SETRANGE("Document No.","No.");
1754 IF ("Pay-to Contact No." = '') AND ("Pay-to Vendor No." = '') THEN BEGIN
1755 IF NOT PurchLine.ISEMPTY THEN
1756 ERROR(
1757 Text005,
1758 FIELDCAPTION("Pay-to Contact No."));
1759 INIT;
1760 PurchSetup.GET;
1761 InitRecord;
1762 "No. Series" := xRec."No. Series";
1763 IF xRec."Receiving No." <> '' THEN BEGIN
1764 "Receiving No. Series" := xRec."Receiving No. Series";
1765 "Receiving No." := xRec."Receiving No.";
1766 END;
1767 IF xRec."Posting No." <> '' THEN BEGIN
1768 "Posting No. Series" := xRec."Posting No. Series";
1769 "Posting No." := xRec."Posting No.";
1770 END;
1771 IF xRec."Return Shipment No." <> '' THEN BEGIN
1772 "Return Shipment No. Series" := xRec."Return Shipment No. Series";
1773 "Return Shipment No." := xRec."Return Shipment No.";
1774 END;
1775 IF xRec."Prepayment No." <> '' THEN BEGIN
1776 "Prepayment No. Series" := xRec."Prepayment No. Series";
1777 "Prepayment No." := xRec."Prepayment No.";
1778 END;
1779 IF xRec."Prepmt. Cr. Memo No." <> '' THEN BEGIN
1780 "Prepmt. Cr. Memo No. Series" := xRec."Prepmt. Cr. Memo No. Series";
1781 "Prepmt. Cr. Memo No." := xRec."Prepmt. Cr. Memo No.";
1782 END;
1783 EXIT;
1784 END;
1785 END ELSE BEGIN
1786 "Pay-to Contact No." := xRec."Pay-to Contact No.";
1787 EXIT;
1788 END;
1789 END;
1790
1791 IF ("Pay-to Vendor No." <> '') AND ("Pay-to Contact No." <> '') THEN BEGIN
1792 Cont.GET("Pay-to Contact No.");
1793 ContBusinessRelation.RESET;
1794 ContBusinessRelation.SETCURRENTKEY("Link to Table","No.");
1795 ContBusinessRelation.SETRANGE("Link to Table",ContBusinessRelation."Link to Table"::Vendor);
1796 ContBusinessRelation.SETRANGE("No.","Pay-to Vendor No.");
1797 IF ContBusinessRelation.FINDFIRST THEN
1798 IF ContBusinessRelation."Contact No." <> Cont."Company No." THEN
1799 ERROR(Text038,Cont."No.",Cont.Name,"Pay-to Vendor No.");
1800 END;
1801
1802 UpdatePayToVend("Pay-to Contact No.");
1803 END;
1804
1805 OnLookup=VAR
1806 Cont@1000 : Record 5050;
1807 ContBusinessRelation@1001 : Record 5054;
1808 BEGIN
1809 IF "Pay-to Vendor No." <> '' THEN BEGIN
1810 IF Cont.GET("Pay-to Contact No.") THEN
1811 Cont.SETRANGE("Company No.",Cont."Company No.")
1812 ELSE BEGIN
1813 ContBusinessRelation.RESET;
1814 ContBusinessRelation.SETCURRENTKEY("Link to Table","No.");
1815 ContBusinessRelation.SETRANGE("Link to Table",ContBusinessRelation."Link to Table"::Vendor);
1816 ContBusinessRelation.SETRANGE("No.","Pay-to Vendor No.");
1817 IF ContBusinessRelation.FINDFIRST THEN
1818 Cont.SETRANGE("Company No.",ContBusinessRelation."Contact No.")
1819 ELSE
1820 Cont.SETRANGE("No.",'');
1821 END;
1822 END;
1823
1824 IF "Pay-to Contact No." <> '' THEN
1825 IF Cont.GET("Pay-to Contact No.") THEN ;
1826 IF PAGE.RUNMODAL(0,Cont) = ACTION::LookupOK THEN BEGIN
1827 xRec := Rec;
1828 VALIDATE("Pay-to Contact No.",Cont."No.");
1829 END;
1830 END;
1831
1832 CaptionML=[ENU=Pay-to Contact No.;
1833 ENG=Pay-to Contact No.] }
1834 { 5700; ;Responsibility Center;Code10 ;TableRelation="Responsibility Center";
1835 OnValidate=BEGIN
1836 TESTFIELD(Status,Status::Open);
1837 IF NOT UserSetupMgt.CheckRespCenter(1,"Responsibility Center") THEN
1838 ERROR(
1839 Text028,
1840 RespCenter.TABLECAPTION,UserSetupMgt.GetPurchasesFilter);
1841
1842 "Location Code" := UserSetupMgt.GetLocation(1,'',"Responsibility Center");
1843 IF "Location Code" = '' THEN BEGIN
1844 IF InvtSetup.GET THEN
1845 "Inbound Whse. Handling Time" := InvtSetup."Inbound Whse. Handling Time";
1846 END ELSE BEGIN
1847 IF Location.GET("Location Code") THEN;
1848 "Inbound Whse. Handling Time" := Location."Inbound Whse. Handling Time";
1849 END;
1850
1851 UpdateShipToAddress;
1852
1853 InitDefaultDim;
1854
1855 IF xRec."Responsibility Center" <> "Responsibility Center" THEN BEGIN
1856 RecreatePurchLines(FIELDCAPTION("Responsibility Center"));
1857 "Assigned User ID" := '';
1858 END;
1859 END;
1860
1861 CaptionML=[ENU=Responsibility Center;
1862 ENG=Responsibility Centre] }
1863 { 5752; ;Completely Received ;Boolean ;FieldClass=FlowField;
1864 CalcFormula=Min("Purchase Line"."Completely Received" WHERE (Document Type=FIELD(Document Type),
1865 Document No.=FIELD(No.),
1866 Type=FILTER(<>' '),
1867 Location Code=FIELD(Location Filter)));
1868 CaptionML=[ENU=Completely Received;
1869 ENG=Completely Received];
1870 Editable=No }
1871 { 5753; ;Posting from Whse. Ref.;Integer ;CaptionML=[ENU=Posting from Whse. Ref.;
1872 ENG=Posting from Whse. Ref.] }
1873 { 5754; ;Location Filter ;Code10 ;FieldClass=FlowFilter;
1874 TableRelation=Location;
1875 CaptionML=[ENU=Location Filter;
1876 ENG=Location Filter] }
1877 { 5790; ;Requested Receipt Date;Date ;OnValidate=BEGIN
1878 TESTFIELD(Status,Status::Open);
1879 IF "Promised Receipt Date" <> 0D THEN
1880 ERROR(
1881 Text034,
1882 FIELDCAPTION("Requested Receipt Date"),
1883 FIELDCAPTION("Promised Receipt Date"));
1884
1885 IF "Requested Receipt Date" <> xRec."Requested Receipt Date" THEN
1886 UpdatePurchLines(FIELDCAPTION("Requested Receipt Date"));
1887 END;
1888
1889 CaptionML=[ENU=Requested Receipt Date;
1890 ENG=Requested Receipt Date] }
1891 { 5791; ;Promised Receipt Date;Date ;OnValidate=BEGIN
1892 TESTFIELD(Status,Status::Open);
1893 IF "Promised Receipt Date" <> xRec."Promised Receipt Date" THEN
1894 UpdatePurchLines(FIELDCAPTION("Promised Receipt Date"));
1895 END;
1896
1897 CaptionML=[ENU=Promised Receipt Date;
1898 ENG=Promised Receipt Date] }
1899 { 5792; ;Lead Time Calculation;DateFormula ;OnValidate=BEGIN
1900 TESTFIELD(Status,Status::Open);
1901 IF "Lead Time Calculation" <> xRec."Lead Time Calculation" THEN
1902 UpdatePurchLines(FIELDCAPTION("Lead Time Calculation"));
1903 END;
1904
1905 CaptionML=[ENU=Lead Time Calculation;
1906 ENG=Lead Time Calculation] }
1907 { 5793; ;Inbound Whse. Handling Time;DateFormula;
1908 OnValidate=BEGIN
1909 TESTFIELD(Status,Status::Open);
1910 IF "Inbound Whse. Handling Time" <> xRec."Inbound Whse. Handling Time" THEN
1911 UpdatePurchLines(FIELDCAPTION("Inbound Whse. Handling Time"));
1912 END;
1913
1914 CaptionML=[ENU=Inbound Whse. Handling Time;
1915 ENG=Inbound Whse. Handling Time] }
1916 { 5796; ;Date Filter ;Date ;FieldClass=FlowFilter;
1917 CaptionML=[ENU=Date Filter;
1918 ENG=Date Filter] }
1919 { 5800; ;Vendor Authorization No.;Code35 ;CaptionML=[ENU=Vendor Authorization No.;
1920 ENG=Vendor Authorisation No.] }
1921 { 5801; ;Return Shipment No. ;Code20 ;CaptionML=[ENU=Return Shipment No.;
1922 ENG=Return Shipment No.] }
1923 { 5802; ;Return Shipment No. Series;Code10 ;TableRelation="No. Series";
1924 OnValidate=BEGIN
1925 IF "Return Shipment No. Series" <> '' THEN BEGIN
1926 PurchSetup.GET;
1927 PurchSetup.TESTFIELD("Posted Return Shpt. Nos.");
1928 NoSeriesMgt.TestSeries(PurchSetup."Posted Return Shpt. Nos.","Return Shipment No. Series");
1929 END;
1930 TESTFIELD("Return Shipment No.",'');
1931 END;
1932
1933 OnLookup=BEGIN
1934 WITH PurchHeader DO BEGIN
1935 PurchHeader := Rec;
1936 PurchSetup.GET;
1937 PurchSetup.TESTFIELD("Posted Return Shpt. Nos.");
1938 IF NoSeriesMgt.LookupSeries(PurchSetup."Posted Return Shpt. Nos.","Return Shipment No. Series") THEN
1939 VALIDATE("Return Shipment No. Series");
1940 Rec := PurchHeader;
1941 END;
1942 END;
1943
1944 CaptionML=[ENU=Return Shipment No. Series;
1945 ENG=Return Shipment No. Series] }
1946 { 5803; ;Ship ;Boolean ;CaptionML=[ENU=Ship;
1947 ENG=Ship] }
1948 { 5804; ;Last Return Shipment No.;Code20 ;TableRelation="Return Shipment Header";
1949 CaptionML=[ENU=Last Return Shipment No.;
1950 ENG=Last Return Shipment No.];
1951 Editable=No }
1952 { 9000; ;Assigned User ID ;Code50 ;TableRelation="User Setup";
1953 OnValidate=BEGIN
1954 IF NOT UserSetupMgt.CheckRespCenter2(1,"Responsibility Center","Assigned User ID") THEN
1955 ERROR(
1956 Text049,"Assigned User ID",
1957 RespCenter.TABLECAPTION,UserSetupMgt.GetPurchasesFilter2("Assigned User ID"));
1958
1959 //SSI.Upgrade
1960 IF "Sent To Approver Date" = 0D THEN
1961 "Sent To Approver Date" := WORKDATE;
1962 IF "Approve By Date" = 0D THEN;
1963 "Approve By Date" := CALCDATE('14D',WORKDATE);
1964
1965 //SSI.Upgrade
1966 END;
1967
1968 CaptionML=[ENU=Assigned User ID;
1969 ENG=Assigned User ID] }
1970 { 10501; ;Type of Supply Code ;Code10 ;TableRelation="Type of Supply";
1971 CaptionML=[ENU=Type of Supply Code;
1972 ENG=Type of Supply Code] }
1973 { 50001; ;Payment Discount % 2;Decimal ;DecimalPlaces=0:5;
1974 Description=CITP001(7508),SSI.Upgrade }
1975 { 50002; ;Pmt. Discount Date 2;Date ;Description=CITP001(7508),SSI.Upgrade }
1976 { 50003; ;Payment Discount % 3;Decimal ;DecimalPlaces=0:5;
1977 Description=CITP001(7508),SSI.Upgrade }
1978 { 50004; ;Pmt. Discount Date 3;Date ;Description=CITP001(7508),SSI.Upgrade }
1979 { 50005; ;Payment Discount % 4;Decimal ;DecimalPlaces=0:5;
1980 Description=CITP001(7508),SSI.Upgrade }
1981 { 50006; ;Pmt. Discount Date 4;Date ;Description=CITP001(7508),SSI.Upgrade }
1982 { 50007; ;Quote Resp. Date ;Date ;Description=CITP001(7508),SSI.Upgrade }
1983 { 50008; ;Sent To Supplier Date;Text50 ;Description=CITP002(9044),SSI.Upgrade }
1984 { 50009; ;Project Manager ;Text30 ;Description=MDJ-23052011,SSI.Upgrade }
1985 { 50010; ;Fixed Exchange Rate ;Boolean ;Description=QSSD06.00.00.38,SSI.Upgrade;
1986 Editable=Yes }
1987 { 50020; ;Authoriser ;Code10 ;TableRelation=Salesperson/Purchaser;
1988 OnValidate=BEGIN
1989 //SSI.Upgrade
1990 IF "Shortcut Dimension 1 Code" <> '2' THEN BEGIN
1991 IF Authoriser <> '' THEN BEGIN
1992 UserSetup.SETRANGE("Salespers./Purch. Code",Authoriser);
1993 IF UserSetup.FINDFIRST THEN BEGIN
1994 IF UserSetup."User ID" = USERID THEN
1995 ERROR(Text50002);
1996 END ELSE
1997 ERROR(Text50003);
1998 END;
1999 END;
2000 //SSI.Upgrade
2001 END;
2002
2003 Description=QSSD06.00.00.23,SSI.Upgrade }
2004 { 50021; ;Offshore/Onshore ;Option ;OptionString=[ ,Standard,Offshore,Onshore];
2005 Description=SSI.Upgrade }
2006 { 50022; ;Direct Ship. Sales Order No.;Code20;TableRelation="Sales Header".No.;
2007 Description=SSI.Upgrade;
2008 Editable=No }
2009 { 50023; ;Gross Invoice Amount;Decimal ;Description=SSI.Upgrade }
2010 { 50024; ;Complete ;Boolean ;OnValidate=BEGIN
2011 //SSI.Upgrade >>
2012 IF InvoiceTotalAmountIncVAT <> "Gross Invoice Amount" THEN BEGIN
2013 ERROR('Values from Gross Invoice Amount field and Total Incl. VAT from Statistics page do not match');
2014 END ELSE
2015 IF Complete THEN
2016 "Completed Date" := WORKDATE;
2017 //SSI.Upgrade <<
2018
2019 //QSSD07.01.01.59 if BCT Approval required this must be set on the Invoice status field before clicking Complete.
2020 //DOC 120058 EK 01/03/2019 -
2021 //IF (("Invoice Approval Status" = "Invoice Approval Status"::"Awaiting Approval") OR
2022 // ("Invoice Approval Status" = "Invoice Approval Status"::"With Administrator to Complete") OR
2023 // ("Invoice Approval Status" = "Invoice Approval Status"::"Awaiting Others") OR
2024 // ("Invoice Approval Status" = "Invoice Approval Status"::"Awaiting Finance Dept."))
2025 IF NOT (("Invoice Approval Status" = "Invoice Approval Status"::"BCT UK PM Approved") OR
2026 ("Invoice Approval Status" = "Invoice Approval Status"::"BCT Approved"))
2027 //DOC 120058 EK 01/03/2019 +
2028 AND ("Document Type" = "Document Type"::"Credit Memo") THEN BEGIN
2029 PCML.RESET;
2030 PCML.SETRANGE("Document Type","Document Type");
2031 PCML.SETRANGE("Document No.","No.");
2032 PCML.SETFILTER(Quantity,'>%1',0);
2033 IF PCML.FINDFIRST THEN REPEAT
2034 PCML.CALCFIELDS("Job Task CC Code");
2035 IF (PCML."Job Task CC Code" <> '') THEN
2036 ERROR(Text50007);
2037 UNTIL
2038 PCML.NEXT = 0;
2039 END;
2040
2041 //DOC 120058 EK 01/03/2019 -
2042 //IF (("Invoice Approval Status" = "Invoice Approval Status"::"Awaiting Approval") OR
2043 // ("Invoice Approval Status" = "Invoice Approval Status"::"With Administrator to Complete") OR
2044 // ("Invoice Approval Status" = "Invoice Approval Status"::"Awaiting Others") OR
2045 // ("Invoice Approval Status" = "Invoice Approval Status"::"Awaiting Finance Dept."))
2046 IF NOT (("Invoice Approval Status" = "Invoice Approval Status"::"BCT UK PM Approved") OR
2047 ("Invoice Approval Status" = "Invoice Approval Status"::"BCT Approved"))
2048 //DOC 120058 EK 01/03/2019 +
2049 AND ("Document Type" = "Document Type"::Invoice) THEN BEGIN
2050 PIL.RESET;
2051 PIL.SETRANGE("Document Type","Document Type");
2052 PIL.SETRANGE("Document No.","No.");
2053 PIL.SETFILTER(Quantity,'>%1',0);
2054 IF PIL.FINDFIRST THEN REPEAT
2055 PIL.CALCFIELDS("Job Task CC Code");
2056 IF (PIL."Job Task CC Code" <> '') THEN
2057 ERROR(Text50007);
2058 UNTIL
2059 PIL.NEXT = 0;
2060 END;
2061 //QSSD07.01.01.59 if BCT Approval required this must be set on the Invoice status field before clicking Complete.
2062 END;
2063
2064 Description=SSI.Upgrade }
2065 { 50025; ;Production Order No.;Code20 ;TableRelation="Production Order".No.;
2066 Description=SSI.Upgrade }
2067 { 50030; ;Sent To Approver Date;Date ;Description=SSI.Upgrade;
2068 Editable=No }
2069 { 50031; ;Approve By Date ;Date ;OnValidate=BEGIN
2070 //QSSD07.01.19620
2071 IF UserSetup.GET(USERID) THEN
2072 BEGIN
2073 IF UserSetup."Amend/Post Purch. Invoice" = FALSE THEN
2074 ERROR('You do not have permission to change Approve By Date');
2075 END
2076 ELSE
2077 ERROR('You do not have permission to change Approve By Date');
2078
2079 //QSSD07.01.19620
2080 END;
2081
2082 Description=SSI.Upgrade }
2083 { 50032; ;Completed Date ;Date ;Description=SSI.Upgrade;
2084 Editable=No }
2085 { 50035; ;Purchase Order No. ;Code20 ;TableRelation="Purchase Header".No. WHERE (Document Type=CONST(Order),
2086 Buy-from Vendor No.=FIELD(Buy-from Vendor No.));
2087 OnValidate=VAR
2088 lPH@1000000000 : Record 38;
2089 ldimMgt@1000000001 : Codeunit 408;
2090 lTempDimSetEntry@1000000002 : TEMPORARY Record 480;
2091 BEGIN
2092 //QSSD07.01.20364
2093 //DOC OP9679 JF 09/05/2017 -
2094 //IF "Purchase Order No." <> '' THEN
2095 // IF lPH.GET("Document Type"::Order,"Purchase Order No.") THEN BEGIN
2096 // IF lPH."Dimension Set ID" <> 0 THEN BEGIN
2097 // ldimMgt.GetDimensionSet(lTempDimSetEntry,lPH."Dimension Set ID");
2098 // "Dimension Set ID" := lPH."Dimension Set ID";
2099 // "Purchaser Code" := lPH."Purchaser Code";//SEP
2100 // MODIFY(FALSE);
2101 // ldimMgt.UpdateGlobalDimFromDimSetID("Dimension Set ID","Shortcut Dimension 1 Code","Shortcut Dimension 2 Code");
2102 // END;
2103 // VALIDATE("Purchaser Code",lPH."Purchaser Code"); //BH
2104 // VALIDATE("Project Manager",lPH."Project Manager"); // IN36649 MCI 27/03/2017 +
2105 // END;
2106 //DOC OP9679 JF 09/05/2017 +
2107 //QSSD07.01.20364
2108
2109 //DOC OP9679 JF 09/05/2017 -
2110 IF "Purchase Order No." <> '' THEN BEGIN
2111 lPH.GET("Document Type"::Order, "Purchase Order No.");
2112
2113 VALIDATE("Purchaser Code",lPH."Purchaser Code");
2114 VALIDATE("Project Manager",lPH."Project Manager");
2115
2116 "Dimension Set ID" := lPH."Dimension Set ID";
2117 ldimMgt.UpdateGlobalDimFromDimSetID("Dimension Set ID","Shortcut Dimension 1 Code","Shortcut Dimension 2 Code");
2118
2119 PurchLine.RESET;
2120 PurchLine.SETRANGE("Document Type", "Document Type");
2121 PurchLine.SETRANGE("Document No.", "No.");
2122 IF NOT PurchLine.ISEMPTY THEN BEGIN
2123 IF CONFIRM(Text50008 + '\' + Text033) THEN BEGIN
2124 PurchLine.FINDSET;
2125 REPEAT
2126 PurchLine."Dimension Set ID" := "Dimension Set ID";
2127 DimMgt.UpdateGlobalDimFromDimSetID(PurchLine."Dimension Set ID", PurchLine."Shortcut Dimension 1 Code", PurchLine."Shortcut Dimension 2 Code");
2128 PurchLine.MODIFY;
2129 UNTIL PurchLine.NEXT = 0;
2130 END;
2131 END;
2132 END;
2133 //DOC OP9679 JF 09/05/2017 +
2134 END;
2135
2136 Description=SSI.Upgrade,QSSD07.01.20364 }
2137 { 50036; ;Sent To Supplier ;Boolean ;Description=SSI.Upgrade }
2138 { 50037; ;SSI Sales Order No. ;Code20 ;TableRelation="Sales Header".No.;
2139 Description=QSSD07.01.19045;
2140 Editable=No }
2141 { 50040; ;Job No. ;Code20 ;TableRelation=Job.No.;
2142 OnValidate=VAR
2143 Job@1000000000 : Record 167;
2144 DimMngmnt@1000000001 : Codeunit 408;
2145 BEGIN
2146 //DOC OP9678 DB 28/03/2017 -
2147 IF "Job No."<>xRec."Job No." THEN BEGIN
2148 InitDefaultDim;
2149 IF PurchLinesExist THEN BEGIN
2150 PurchLine.RESET;
2151 PurchLine.SETRANGE("Document Type","Document Type");
2152 PurchLine.SETRANGE("Document No.","No.");
2153 PurchLine.LOCKTABLE;
2154 IF PurchLine.FIND('-') THEN
2155 REPEAT
2156 PurchLine.VALIDATE("Job No.", "Job No.");
2157 PurchLine.MODIFY(TRUE);
2158 UNTIL PurchLine.NEXT = 0;
2159 END;
2160 END;
2161 //DOC OP9678 DB 28/03/2017 +
2162 END;
2163
2164 Description=OP9678 }
2165 { 50045; ;Created Date ;Date ;Description=OP10181 }
2166 { 50046; ;Created By ;Code50 ;Description=OP10181 }
2167 { 50047; ;Purchase Invoice Assigned To;Code50;TableRelation=User."User Name";
2168 ValidateTableRelation=No;
2169 TestTableRelation=No;
2170 Description=OP10181 }
2171 { 50048; ;Credit Note Date ;Date ;CaptionML=[ENU=Credit Note Date;
2172 ENG=Credit Note Date];
2173 Description=//DOC OP11639 JF 28/02/2018 - }
2174 { 50049; ;SMO No ;Code20 ;TableRelation="Service Header".No.;
2175 Description=OP12061 }
2176 { 50050; ;Net Invoice Amount ;Decimal ;Description=SSI.Upgrade }
2177 { 50100; ;Attachment No. ;Integer ;Description=QSSD07.01.00.02r2;
2178 Editable=No }
2179 { 50101; ;Exported ;Boolean ;OnValidate=VAR
2180 PurchaseLine@1000000000 : Record 39;
2181 BEGIN
2182 //DOC OP12712 DS 17/05/2018 -
2183 IF NOT Exported THEN BEGIN
2184 PurchaseLine.RESET;
2185 PurchaseLine.SETRANGE("Document Type","Document Type");
2186 PurchaseLine.SETRANGE("Document No.","No.");
2187 IF PurchaseLine.FINDSET THEN BEGIN
2188 REPEAT
2189 PurchaseLine."Export Entry No.":='';
2190 PurchaseLine.Exported:=FALSE;
2191 PurchaseLine.MODIFY(TRUE);
2192 UNTIL PurchaseLine.NEXT=0;
2193 END;
2194 END;
2195 //DOC OP12712 DS 17/05/2018 +
2196 END;
2197
2198 Description=QSSD07.01.01.59 }
2199 { 50102; ;BCT PO Requestor ;Text20 ;Description=QSSD07.01.01.59 }
2200 { 50103; ;BCT IC PO Nr. ;Text20 ;Description=QSSD07.01.01.59 }
2201 { 50110; ;Invoice Approval Status;Option ;OnValidate=BEGIN
2202 //QSSD07.01.01.59 if for BCT Approval and a Credit Memo then BCT PI No. must be specified.
2203 IF (("Invoice Approval Status" = "Invoice Approval Status"::"BCT UK PM Approved") OR ("Invoice Approval Status" = "Invoice Approval Status"::"BCT Approval Required")
2204 //DOC OP9496 NM 23/11/16 -
2205 OR ("Invoice Approval Status" = "Invoice Approval Status"::"BCT Update Rejected Invoice")
2206 //DOC OP9496 NM 23/11/16 -
2207 )
2208 AND ("Document Type" = "Document Type"::"Credit Memo") THEN BEGIN
2209 PCML.RESET;
2210 PCML.SETRANGE("Document Type","Document Type");
2211 PCML.SETRANGE("Document No.","No.");
2212 PCML.SETFILTER(Quantity,'>%1',0);
2213 IF PCML.FINDFIRST THEN REPEAT
2214 PCML.CALCFIELDS("Job Task CC Code");
2215 IF (PCML."Job Task CC Code" <> '') AND (PCML."BCT Related PI No." = '') THEN
2216 ERROR(Text50004);
2217 IF PCML."Job Task CC Code" = '' THEN
2218 ERROR(Text50005);
2219 UNTIL
2220 PCML.NEXT = 0;
2221
2222 END;
2223 IF (("Invoice Approval Status" = "Invoice Approval Status"::"BCT UK PM Approved") OR ("Invoice Approval Status" = "Invoice Approval Status"::"BCT Approval Required")
2224 //DOC OP9496 NM 23/11/16 -
2225 OR ("Invoice Approval Status" = "Invoice Approval Status"::"BCT Update Rejected Invoice")
2226 //DOC OP9496 NM 23/11/16 -
2227 )
2228 AND ("Document Type" = "Document Type"::Invoice) THEN BEGIN
2229 PIL.RESET;
2230 PIL.SETRANGE("Document Type","Document Type");
2231 PIL.SETRANGE("Document No.","No.");
2232 PIL.SETFILTER(Quantity,'>%1',0);
2233 IF PIL.FINDFIRST THEN REPEAT
2234 PIL.CALCFIELDS("Job Task CC Code");
2235 IF PIL."Job Task CC Code" = '' THEN
2236 ERROR(Text50005);
2237 UNTIL
2238 PIL.NEXT = 0;
2239 END;
2240
2241 //QSSD07.01.20876 >>
2242 {IF (("Invoice Approval Status" = "Invoice Approval Status"::"BCT Approved") OR ("Invoice Approval Status" = "Invoice Approval Status"::"BCT Rejected"))
2243 AND ("Document Type" = "Document Type"::Invoice) THEN
2244 ERROR(Text50006);
2245 IF (("Invoice Approval Status" = "Invoice Approval Status"::"BCT Approved") OR ("Invoice Approval Status" = "Invoice Approval Status"::"BCT Rejected"))
2246 AND ("Document Type" = "Document Type"::"Credit Memo") THEN
2247 ERROR(Text50006);}
2248 //QSSD07.01.20876 << code removed
2249
2250 //QSSD07.01.01.59
2251 END;
2252
2253 OptionCaptionML=[ENU=Awaiting Approval,With Administrator to Complete,Awaiting Others,Awaiting Finance Dept.,BCT UK PM Approved,BCT Approval Required,BCT Approved,BCT Rejected,BCT Update Rejected Invoice;
2254 ENG=Awaiting Approval,With Administrator to Complete,Awaiting Others,Awaiting Finance Dept.,BCT UK PM Approved,BCT Approval Required,BCT Approved,BCT Rejected,BCT Update Rejected Invoice];
2255 OptionString=Awaiting Approval,With Administrator to Complete,Awaiting Others,Awaiting Finance Dept.,BCT UK PM Approved,BCT Approval Required,BCT Approved,BCT Rejected,BCT Update Rejected Invoice;
2256 Description=[QSSD07.01.00.02r3; QSSD07.01.01.59,OP9496] }
2257 { 50120; ;CSS Back Charge Order;Boolean ;Description=QSSD07.01.01.22 }
2258 { 50121; ;SO On Hold ;Boolean ;OnValidate=BEGIN
2259 //QSSD07.01.01.28 >>
2260 IF Rec."SO On Hold" <> xRec."SO On Hold" THEN
2261 BEGIN
2262 IF "SO On Hold" THEN
2263 BEGIN
2264 "Date On Hold" := WORKDATE;
2265 "Date Off Hold" := 0D;
2266 END
2267 ELSE
2268 BEGIN
2269 "Date On Hold" := 0D;
2270 "Date Off Hold" := WORKDATE;
2271 END
2272 END;
2273 //QSSD07.01.01.28 <<
2274 END;
2275
2276 Description=QSSD07.01.01.28 }
2277 { 50122; ;Date On Hold ;Date ;Description=QSSD07.01.01.28 }
2278 { 50123; ;Date Off Hold ;Date ;Description=QSSD07.01.01.28 }
2279 { 50124; ;Back Charge Vendor ;Code20 ;TableRelation=Vendor;
2280 Description=QSSD07.01.01.22r1 }
2281 { 50125; ;Back Charge Reason ;Text150 ;Description=QSSD07.01.01.22r1 }
2282 { 50126; ;Back Charge Responsible User;Code20;TableRelation="User Setup";
2283 Description=QSSD07.01.01.22r1 }
2284 { 50130; ;SAP Information ;Text100 ;CaptionML=[ENU=SAP Information;
2285 ENG=SAP Information];
2286 Description=QSSD07.01.20188 }
2287 { 50900; ;Expense Type ;Option ;OptionCaptionML=ENU=" ,Business,HR";
2288 OptionString=[ ,Business,HR];
2289 Description=For normal Purchases this is blank QSSD07.01.19619 EXP }
2290 { 50901; ;Opening Mileage ;Integer ;Description=QSSD07.01.19619 EXP }
2291 { 50902; ;Closing Mileage ;Integer ;Description=QSSD07.01.19619 EXP }
2292 { 50903; ;Expense Status ;Option ;OptionCaptionML=ENU=Open,Submitted,Rejected,Approved;
2293 OptionString=Open,Submitted,Rejected,Approved;
2294 Description=QSSD07.01.19619 EXP;
2295 Editable=No }
2296 { 50904; ;Expense Approver ID ;Code50 ;TableRelation="User Setup";
2297 CaptionML=[ENU=Approver ID;
2298 ENG=Approver ID];
2299 Description=QSSD07.01.19619 EXP;
2300 Editable=No }
2301 { 50905; ;Expense Approval Date;Date ;CaptionML=[ENU=Approval Date;
2302 ENG=Approval Date];
2303 Description=QSSD07.01.19619 EXP;
2304 Editable=No }
2305 { 50910; ;Receipt Available ;Boolean ;Description=QSSD07.01.19619-T001 }
2306 { 50999; ;Created By USERID ;Code50 ;Description=QSSD07.01.19619 EXP;
2307 Editable=No }
2308 { 51000; ;Invoice Creation Date;Date ;CaptionML=[ENU=Invoice Creation Date;
2309 ENG=Invoice Creation Date];
2310 Description=IN36000;
2311 Editable=No }
2312 }
2313 KEYS
2314 {
2315 { ;Document Type,No. ;Clustered=Yes }
2316 { ;No.,Document Type }
2317 { ;Document Type,Buy-from Vendor No. }
2318 { ;Document Type,Pay-to Vendor No. }
2319 { ;Buy-from Vendor No. }
2320 { ;Incoming Document Entry No. }
2321 { ;Expense Type,Document Date }
2322 }
2323 FIELDGROUPS
2324 {
2325 }
2326 CODE
2327 {
2328 VAR
2329 Text000@1000 : TextConst 'ENU=Do you want to print receipt %1?;ENG=Do you want to print receipt %1?';
2330 Text001@1001 : TextConst 'ENU=Do you want to print invoice %1?;ENG=Do you want to print invoice %1?';
2331 Text002@1002 : TextConst 'ENU=Do you want to print credit memo %1?;ENG=Do you want to print credit memo %1?';
2332 Text003@1003 : TextConst 'ENU=You cannot rename a %1.;ENG=You cannot rename a %1.';
2333 Text004@1004 : TextConst 'ENU=Do you want to change %1?;ENG=Do you want to change %1?';
2334 Text005@1005 : TextConst 'ENU=You cannot reset %1 because the document still has one or more lines.;ENG=You cannot reset %1 because the document still has one or more lines.';
2335 Text006@1006 : TextConst 'ENU=You cannot change %1 because the order is associated with one or more sales orders.;ENG=You cannot change %1 because the order is associated with one or more sales orders.';
2336 Text007@1007 : TextConst 'ENU=%1 is greater than %2 in the %3 table.\;ENG=%1 is greater than %2 in the %3 table.\';
2337 Text008@1008 : TextConst 'ENU=Confirm change?;ENG=Confirm change?';
2338 Text009@1009 : TextConst 'ENU="Deleting this document will cause a gap in the number series for receipts. ";ENG="Deleting this document will cause a gap in the number series for receipts. "';
2339 Text010@1010 : TextConst 'ENU=An empty receipt %1 will be created to fill this gap in the number series.\\;ENG=An empty receipt %1 will be created to fill this gap in the number series.\\';
2340 Text011@1011 : TextConst 'ENU=Do you want to continue?;ENG=Do you want to continue?';
2341 Text012@1012 : TextConst 'ENU="Deleting this document will cause a gap in the number series for posted invoices. ";ENG="Deleting this document will cause a gap in the number series for posted invoices. "';
2342 Text013@1013 : TextConst 'ENU=An empty posted invoice %1 will be created to fill this gap in the number series.\\;ENG=An empty posted invoice %1 will be created to fill this gap in the number series.\\';
2343 Text014@1014 : TextConst 'ENU="Deleting this document will cause a gap in the number series for posted credit memos. ";ENG="Deleting this document will cause a gap in the number series for posted credit memos. "';
2344 Text015@1015 : TextConst 'ENU=An empty posted credit memo %1 will be created to fill this gap in the number series.\\;ENG=An empty posted credit memo %1 will be created to fill this gap in the number series.\\';
2345 Text016@1016 : TextConst 'ENU=If you change %1, the existing purchase lines will be deleted and new purchase lines based on the new information in the header will be created.\\;ENG=If you change %1, the existing purchase lines will be deleted and new purchase lines based on the new information in the header will be created.\\';
2346 Text018@1017 : TextConst 'ENU=You must delete the existing purchase lines before you can change %1.;ENG=You must delete the existing purchase lines before you can change %1.';
2347 Text019@1018 : TextConst 'ENU=You have changed %1 on the purchase header, but it has not been changed on the existing purchase lines.\;ENG=You have changed %1 on the purchase header, but it has not been changed on the existing purchase lines.\';
2348 Text020@1019 : TextConst 'ENU=You must update the existing purchase lines manually.;ENG=You must update the existing purchase lines manually.';
2349 Text021@1020 : TextConst 'ENU=The change may affect the exchange rate used on the price calculation of the purchase lines.;ENG=The change may affect the exchange rate used on the price calculation of the purchase lines.';
2350 Text022@1021 : TextConst 'ENU=Do you want to update the exchange rate?;ENG=Do you want to update the exchange rate?';
2351 Text023@1022 : TextConst 'ENU=You cannot delete this document. Your identification is set up to process from %1 %2 only.;ENG=You cannot delete this document. Your identification is set up to process from %1 %2 only.';
2352 Text024@1023 : TextConst 'ENU=Do you want to print return shipment %1?;ENG=Do you want to print return shipment %1?';
2353 Text025@1024 : TextConst 'ENU="You have modified the %1 field. Note that the recalculation of VAT may cause penny differences, so you must check the amounts afterwards. ";ENG="You have modified the %1 field. Note that the recalculation of VAT may cause penny differences, so you must check the amounts afterwards. "';
2354 Text027@1026 : TextConst 'ENU=Do you want to update the %2 field on the lines to reflect the new value of %1?;ENG=Do you want to update the %2 field on the lines to reflect the new value of %1?';
2355 Text028@1027 : TextConst 'ENU=Your identification is set up to process from %1 %2 only.;ENG=Your identification is set up to process from %1 %2 only.';
2356 Text029@1028 : TextConst 'ENU="Deleting this document will cause a gap in the number series for return shipments. ";ENG="Deleting this document will cause a gap in the number series for return shipments. "';
2357 Text030@1029 : TextConst 'ENU=An empty return shipment %1 will be created to fill this gap in the number series.\\;ENG=An empty return shipment %1 will be created to fill this gap in the number series.\\';
2358 Text032@1031 : TextConst 'ENU=You have modified %1.\\;ENG=You have modified %1.\\';
2359 Text033@1032 : TextConst 'ENU=Do you want to update the lines?;ENG=Do you want to update the lines?';
2360 PurchSetup@1033 : Record 312;
2361 GLSetup@1034 : Record 98;
2362 GLAcc@1035 : Record 15;
2363 PurchLine@1036 : Record 39;
2364 xPurchLine@1080 : Record 39;
2365 VendLedgEntry@1037 : Record 25;
2366 Vend@1038 : Record 23;
2367 PaymentTerms@1039 : Record 3;
2368 PaymentMethod@1040 : Record 289;
2369 CurrExchRate@1041 : Record 330;
2370 PurchHeader@1042 : Record 38;
2371 PurchCommentLine@1043 : Record 43;
2372 ShipToAddr@1044 : Record 222;
2373 Cust@1045 : Record 18;
2374 CompanyInfo@1046 : Record 79;
2375 PostCode@1047 : Record 225;
2376 OrderAddr@1048 : Record 224;
2377 BankAcc@1049 : Record 270;
2378 PurchRcptHeader@1050 : Record 120;
2379 PurchInvHeader@1051 : Record 122;
2380 PurchCrMemoHeader@1052 : Record 124;
2381 ReturnShptHeader@1053 : Record 6650;
2382 PurchInvHeaderPrepmt@1090 : Record 122;
2383 PurchCrMemoHeaderPrepmt@1089 : Record 124;
2384 GenBusPostingGrp@1054 : Record 250;
2385 GenJnILine@1055 : Record 81;
2386 RespCenter@1056 : Record 5714;
2387 Location@1057 : Record 14;
2388 WhseRequest@1058 : Record 5765;
2389 InvtSetup@1059 : Record 313;
2390 NoSeriesMgt@1060 : Codeunit 396;
2391 TransferExtendedText@1061 : Codeunit 378;
2392 GenJnlApply@1062 : Codeunit 225;
2393 PurchPost@1063 : Codeunit 90;
2394 VendEntrySetApplID@1064 : Codeunit 111;
2395 DimMgt@1065 : Codeunit 408;
2396 ApprovalMgt@1082 : Codeunit 439;
2397 UserSetupMgt@1066 : Codeunit 5700;
2398 ArchiveManagement@1074 : Codeunit 5063;
2399 ReservePurchLine@1081 : Codeunit 99000834;
2400 ApplyVendEntries@1068 : Page 233;
2401 CurrencyDate@1069 : Date;
2402 HideValidationDialog@1070 : Boolean;
2403 Confirmed@1071 : Boolean;
2404 Text034@1072 : TextConst 'ENU=You cannot change the %1 when the %2 has been filled in.;ENG=You cannot change the %1 when the %2 has been filled in.';
2405 Text037@1076 : TextConst 'ENU=Contact %1 %2 is not related to vendor %3.;ENG=Contact %1 %2 is not related to vendor %3.';
2406 Text038@1075 : TextConst 'ENU=Contact %1 %2 is related to a different company than vendor %3.;ENG=Contact %1 %2 is related to a different company than vendor %3.';
2407 Text039@1077 : TextConst 'ENU=Contact %1 %2 is not related to a vendor.;ENG=Contact %1 %2 is not related to a vendor.';
2408 SkipBuyFromContact@1030 : Boolean;
2409 SkipPayToContact@1078 : Boolean;
2410 Text040@1079 : TextConst 'ENU="You can not change the %1 field because %2 %3 has %4 = %5 and the %6 has already been assigned %7 %8.";ENG="You can not change the %1 field because %2 %3 has %4 = %5 and the %6 has already been assigned %7 %8."';
2411 Text041@1182 : TextConst 'ENU=The purchase %1 %2 has item tracking. Do you want to delete it anyway?;ENG=The purchase %1 %2 has item tracking. Do you want to delete it anyway?';
2412 Text042@1084 : TextConst 'ENU=You must cancel the approval process if you wish to change the %1.;ENG=You must cancel the approval process if you wish to change the %1.';
2413 Text043@1083 : TextConst 'ENU=Do you want to print prepayment invoice %1?;ENG=Do you want to print prepayment invoice %1?';
2414 Text044@1085 : TextConst 'ENU=Do you want to print prepayment credit memo %1?;ENG=Do you want to print prepayment credit memo %1?';
2415 Text045@1086 : TextConst 'ENU=Deleting this document will cause a gap in the number series for prepayment invoices. An empty prepayment invoice %1 will be created to fill this gap in the number series.\\Do you want to continue?;ENG=Deleting this document will cause a gap in the number series for prepayment invoices. An empty prepayment invoice %1 will be created to fill this gap in the number series.\\Do you want to continue?';
2416 Text046@1087 : TextConst 'ENU=Deleting this document will cause a gap in the number series for prepayment credit memos. An empty prepayment credit memo %1 will be created to fill this gap in the number series.\\Do you want to continue?;ENG=Deleting this document will cause a gap in the number series for prepayment credit memos. An empty prepayment credit memo %1 will be created to fill this gap in the number series.\\Do you want to continue?';
2417 Text049@1092 : TextConst 'ENU=%1 is set up to process from %2 %3 only.;ENG=%1 is set up to process from %2 %3 only.';
2418 Text050@1067 : TextConst 'ENU=Reservations exist for this order. These reservations will be canceled if a date conflict is caused by this change.\\;ENG=Reservations exist for this order. These reservations will be cancelled if a date conflict is caused by this change.\\';
2419 Text051@1025 : TextConst 'ENU=You may have changed a dimension.\\Do you want to update the lines?;ENG=You may have changed a dimension.\\Do you want to update the lines?';
2420 Text052@1091 : TextConst 'ENU=The %1 field on the purchase order %2 must be the same as on sales order %3.;ENG=The %1 field on the purchase order %2 must be the same as on sales order %3.';
2421 NameAddressDetails@1093 : Text[512];
2422 DropShptNameAddressDetails@1094 : Text[512];
2423 SpecOrderNameAddressDetails@1121 : Text[512];
2424 UpdateDocumentDate@1120 : Boolean;
2425 Text053@1095 : TextConst 'ENU=There are unposted prepayment amounts on the document of type %1 with the number %2.;ENG=There are unposted prepayment amounts on the document of type %1 with the number %2.';
2426 Text054@1096 : TextConst 'ENU=There are unpaid prepayment invoices that are related to the document of type %1 with the number %2.;ENG=There are unpaid prepayment invoices that are related to the document of type %1 with the number %2.';
2427 ChangeCurrencyQst@1073 : TextConst 'ENU=If you change %1, the existing purchase lines will be deleted and new purchase lines based on the new information in the header will be created. You may need to update the price information manually.\\Do you want to change %1?;ENG=If you change %1, the existing purchase lines will be deleted and new purchase lines based on the new information in the header will be created. You may need to update the price information manually.\\Do you want to change %1?';
2428 Text50001@1000000000 : TextConst 'ENU=Customer is Blocked [%1], Special Purchase Orders are not allowed';
2429 UserSetup@1000000001 : Record 91;
2430 Text50002@1000000002 : TextConst 'ENU=You cannot authorise your own Purchase order, please select a different Authoriser.;ENG=You cannot authorise your own Purchase order, please select a different Authoriser.';
2431 Text50003@1000000003 : TextConst 'ENU=The Authoriser you have selected is not setup correctly as an Authoriser, please report this to the Finance department.;ENG=The Authoriser you have selected is not setup correctly as an Authoriser, please report this to the Finance department.';
2432 PCML@1000000004 : Record 39;
2433 Text50004@1000000005 : TextConst 'ENU=You must specify the Related PI No. and PI Line No. before selecting this Status.;ENG=You must specify the Related PI No. and PI Line No. before selecting this Status.';
2434 Text50005@1000000006 : TextConst 'ENU=The Job Task No. you have specified does not need BCT approval.;ENG=The Job Task No. you have specified does not need BCT approval.';
2435 PIL@1000000007 : Record 39;
2436 Text50006@1000000008 : TextConst 'ENU=You cannot select the BCT Approved or BCT Rejected Status, only the system can update this field.;ENG=You cannot select the BCT Approved or BCT Rejected Status, only the system can update this field.';
2437 Text50007@1000000009 : TextConst 'ENU=You cannot Complete this document until it has received BCT Approval.;ENG=You cannot Complete this document until it has received BCT Approval.';
2438 "==QSSD07.01.19619 EXP"@1000000011 : Integer;
2439 ExpensesMgt@1000000010 : Codeunit 50091;
2440 DocumentOption@1000000013 : Integer;
2441 ProjManager@1000000012 : Record 38;
2442 Text50008@1000000014 : TextConst 'ENU=Dimensions updated.;ENG=Dimensions updated.';
2443
2444 PROCEDURE InitRecord@10();
2445 BEGIN
2446 PurchSetup.GET;
2447
2448 CASE "Document Type" OF
2449 "Document Type"::Quote,"Document Type"::Order:
2450 BEGIN
2451 NoSeriesMgt.SetDefaultSeries("Posting No. Series",PurchSetup."Posted Invoice Nos.");
2452 NoSeriesMgt.SetDefaultSeries("Receiving No. Series",PurchSetup."Posted Receipt Nos.");
2453 IF "Document Type" = "Document Type"::Order THEN BEGIN
2454 NoSeriesMgt.SetDefaultSeries("Prepayment No. Series",PurchSetup."Posted Prepmt. Inv. Nos.");
2455 NoSeriesMgt.SetDefaultSeries("Prepmt. Cr. Memo No. Series",PurchSetup."Posted Prepmt. Cr. Memo Nos.");
2456 END;
2457 END;
2458 "Document Type"::Invoice:
2459 BEGIN
2460 IF ("No. Series" <> '') AND
2461 (PurchSetup."Invoice Nos." = PurchSetup."Posted Invoice Nos.")
2462 THEN
2463 "Posting No. Series" := "No. Series"
2464 ELSE
2465 NoSeriesMgt.SetDefaultSeries("Posting No. Series",PurchSetup."Posted Invoice Nos.");
2466 IF PurchSetup."Receipt on Invoice" THEN
2467 NoSeriesMgt.SetDefaultSeries("Receiving No. Series",PurchSetup."Posted Receipt Nos.");
2468 END;
2469 "Document Type"::"Return Order":
2470 BEGIN
2471 NoSeriesMgt.SetDefaultSeries("Posting No. Series",PurchSetup."Posted Credit Memo Nos.");
2472 NoSeriesMgt.SetDefaultSeries("Return Shipment No. Series",PurchSetup."Posted Return Shpt. Nos.");
2473 END;
2474 "Document Type"::"Credit Memo":
2475 BEGIN
2476 IF ("No. Series" <> '') AND
2477 (PurchSetup."Credit Memo Nos." = PurchSetup."Posted Credit Memo Nos.")
2478 THEN
2479 "Posting No. Series" := "No. Series"
2480 ELSE
2481 NoSeriesMgt.SetDefaultSeries("Posting No. Series",PurchSetup."Posted Credit Memo Nos.");
2482 IF PurchSetup."Return Shipment on Credit Memo" THEN
2483 NoSeriesMgt.SetDefaultSeries("Return Shipment No. Series",PurchSetup."Posted Return Shpt. Nos.");
2484 END;
2485 END;
2486
2487 IF "Document Type" IN ["Document Type"::Order,"Document Type"::Invoice,"Document Type"::"Return Order"] THEN
2488 "Order Date" := WORKDATE;
2489
2490 IF "Document Type" = "Document Type"::Invoice THEN
2491 "Expected Receipt Date" := WORKDATE;
2492
2493 IF NOT ("Document Type" IN ["Document Type"::"Blanket Order","Document Type"::Quote]) AND
2494 ("Posting Date" = 0D)
2495 THEN
2496 "Posting Date" := WORKDATE;
2497
2498 IF PurchSetup."Default Posting Date" = PurchSetup."Default Posting Date"::"No Date" THEN
2499 "Posting Date" := 0D;
2500
2501 "Document Date" := WORKDATE;
2502
2503 VALIDATE("Sell-to Customer No.",'');
2504
2505 IF "Document Type" IN ["Document Type"::"Return Order","Document Type"::"Credit Memo"] THEN BEGIN
2506 GLSetup.GET;
2507 Correction := GLSetup."Mark Cr. Memos as Corrections";
2508 END;
2509
2510 "Posting Description" := FORMAT("Document Type") + ' ' + "No.";
2511
2512 IF InvtSetup.GET THEN
2513 "Inbound Whse. Handling Time" := InvtSetup."Inbound Whse. Handling Time";
2514
2515 "Responsibility Center" := UserSetupMgt.GetRespCenter(1,"Responsibility Center");
2516 END;
2517
2518 PROCEDURE AssistEdit@2(OldPurchHeader@1000 : Record 38) : Boolean;
2519 VAR
2520 NoSeries@1001 : Code[10];
2521 BEGIN
2522 PurchSetup.GET;
2523 TestNoSeries;
2524 NoSeries := "No. Series";
2525 IF NoSeriesMgt.SelectSeries(GetNoSeriesCode,OldPurchHeader."No. Series","No. Series") AND
2526 (NoSeries <> "No. Series")
2527 THEN BEGIN
2528 PurchSetup.GET;
2529 TestNoSeries;
2530 NoSeriesMgt.SetSeries("No.");
2531 EXIT(TRUE);
2532 END;
2533 END;
2534
2535 LOCAL PROCEDURE TestNoSeries@6() : Boolean;
2536 BEGIN
2537 PurchSetup.GET;
2538 CASE "Document Type" OF
2539 "Document Type"::Quote:
2540 PurchSetup.TESTFIELD("Quote Nos.");
2541 "Document Type"::Order:
2542 PurchSetup.TESTFIELD("Order Nos.");
2543 "Document Type"::Invoice:
2544 BEGIN
2545 PurchSetup.TESTFIELD("Invoice Nos.");
2546 PurchSetup.TESTFIELD("Posted Invoice Nos.");
2547 END;
2548 "Document Type"::"Return Order":
2549 PurchSetup.TESTFIELD("Return Order Nos.");
2550 "Document Type"::"Credit Memo":
2551 BEGIN
2552 PurchSetup.TESTFIELD("Credit Memo Nos.");
2553 PurchSetup.TESTFIELD("Posted Credit Memo Nos.");
2554 END;
2555 "Document Type"::"Blanket Order":
2556 PurchSetup.TESTFIELD("Blanket Order Nos.");
2557 END;
2558 END;
2559
2560 LOCAL PROCEDURE GetNoSeriesCode@9() : Code[10];
2561 BEGIN
2562 CASE "Document Type" OF
2563 "Document Type"::Quote:
2564 EXIT(PurchSetup."Quote Nos.");
2565 "Document Type"::Order:
2566 EXIT(PurchSetup."Order Nos.");
2567 "Document Type"::Invoice:
2568 EXIT(PurchSetup."Invoice Nos.");
2569 "Document Type"::"Return Order":
2570 EXIT(PurchSetup."Return Order Nos.");
2571 "Document Type"::"Credit Memo":
2572 EXIT(PurchSetup."Credit Memo Nos.");
2573 "Document Type"::"Blanket Order":
2574 EXIT(PurchSetup."Blanket Order Nos.");
2575 END;
2576 END;
2577
2578 LOCAL PROCEDURE GetPostingNoSeriesCode@8() : Code[10];
2579 BEGIN
2580 IF "Document Type" IN ["Document Type"::"Return Order","Document Type"::"Credit Memo"] THEN
2581 EXIT(PurchSetup."Posted Credit Memo Nos.");
2582 EXIT(PurchSetup."Posted Invoice Nos.");
2583 END;
2584
2585 LOCAL PROCEDURE GetPostingPrepaymentNoSeriesCode@37() : Code[10];
2586 BEGIN
2587 IF "Document Type" IN ["Document Type"::"Return Order","Document Type"::"Credit Memo"] THEN
2588 EXIT(PurchSetup."Posted Prepmt. Cr. Memo Nos.");
2589 EXIT(PurchSetup."Posted Prepmt. Inv. Nos.");
2590 END;
2591
2592 LOCAL PROCEDURE TestNoSeriesDate@40(No@1000 : Code[20];NoSeriesCode@1001 : Code[10];NoCapt@1002 : Text[1024];NoSeriesCapt@1004 : Text[1024]);
2593 VAR
2594 NoSeries@1005 : Record 308;
2595 BEGIN
2596 IF (No <> '') AND (NoSeriesCode <> '') THEN BEGIN
2597 NoSeries.GET(NoSeriesCode);
2598 IF NoSeries."Date Order" THEN
2599 ERROR(
2600 Text040,
2601 FIELDCAPTION("Posting Date"),NoSeriesCapt,NoSeriesCode,
2602 NoSeries.FIELDCAPTION("Date Order"),NoSeries."Date Order","Document Type",
2603 NoCapt,No);
2604 END;
2605 END;
2606
2607 PROCEDURE ConfirmDeletion@11() : Boolean;
2608 BEGIN
2609 PurchPost.TestDeleteHeader(
2610 Rec,PurchRcptHeader,PurchInvHeader,PurchCrMemoHeader,
2611 ReturnShptHeader,PurchInvHeaderPrepmt,PurchCrMemoHeaderPrepmt);
2612 IF PurchRcptHeader."No." <> '' THEN
2613 IF NOT CONFIRM(
2614 Text009 +
2615 Text010 +
2616 Text011,TRUE,
2617 PurchRcptHeader."No.")
2618 THEN
2619 EXIT;
2620 IF PurchInvHeader."No." <> '' THEN
2621 IF NOT CONFIRM(
2622 Text012 +
2623 Text013 +
2624 Text011,TRUE,
2625 PurchInvHeader."No.")
2626 THEN
2627 EXIT;
2628 IF PurchCrMemoHeader."No." <> '' THEN
2629 IF NOT CONFIRM(
2630 Text014 +
2631 Text015 +
2632 Text011,TRUE,
2633 PurchCrMemoHeader."No.")
2634 THEN
2635 EXIT;
2636 IF ReturnShptHeader."No." <> '' THEN
2637 IF NOT CONFIRM(
2638 Text029 +
2639 Text030 +
2640 Text011,TRUE,
2641 ReturnShptHeader."No.")
2642 THEN
2643 EXIT;
2644 IF "Prepayment No." <> '' THEN
2645 IF NOT CONFIRM(
2646 Text045,TRUE,
2647 PurchInvHeaderPrepmt."No.")
2648 THEN
2649 EXIT;
2650 IF "Prepmt. Cr. Memo No." <> '' THEN
2651 IF NOT CONFIRM(
2652 Text046,TRUE,
2653 PurchCrMemoHeaderPrepmt."No.")
2654 THEN
2655 EXIT;
2656 EXIT(TRUE);
2657 END;
2658
2659 LOCAL PROCEDURE GetVend@1(VendNo@1000 : Code[20]);
2660 BEGIN
2661 IF VendNo <> Vend."No." THEN
2662 Vend.GET(VendNo);
2663 END;
2664
2665 PROCEDURE PurchLinesExist@3() : Boolean;
2666 BEGIN
2667 PurchLine.RESET;
2668 PurchLine.SETRANGE("Document Type","Document Type");
2669 PurchLine.SETRANGE("Document No.","No.");
2670 EXIT(PurchLine.FINDFIRST);
2671 END;
2672
2673 PROCEDURE RecreatePurchLines@4(ChangedFieldName@1000 : Text[100]);
2674 VAR
2675 PurchLineTmp@1001 : TEMPORARY Record 39;
2676 ItemChargeAssgntPurch@1005 : Record 5805;
2677 TempItemChargeAssgntPurch@1004 : TEMPORARY Record 5805;
2678 TempInteger@1003 : TEMPORARY Record 2000000026;
2679 SalesHeader@1006 : Record 36;
2680 SalesLine@1007 : Record 37;
2681 CopyDocMgt@1008 : Codeunit 6620;
2682 ExtendedTextAdded@1002 : Boolean;
2683 BEGIN
2684 IF PurchLinesExist THEN BEGIN
2685 IF HideValidationDialog THEN
2686 Confirmed := TRUE
2687 ELSE
2688 Confirmed :=
2689 CONFIRM(
2690 Text016 +
2691 Text004,FALSE,ChangedFieldName);
2692 IF Confirmed THEN BEGIN
2693 PurchLine.LOCKTABLE;
2694 ItemChargeAssgntPurch.LOCKTABLE;
2695 MODIFY;
2696
2697 PurchLine.RESET;
2698 PurchLine.SETRANGE("Document Type","Document Type");
2699 PurchLine.SETRANGE("Document No.","No.");
2700 IF PurchLine.FINDSET THEN BEGIN
2701 REPEAT
2702 PurchLine.TESTFIELD("Quantity Received",0);
2703 PurchLine.TESTFIELD("Quantity Invoiced",0);
2704 PurchLine.TESTFIELD("Return Qty. Shipped",0);
2705 PurchLine.CALCFIELDS("Reserved Qty. (Base)");
2706 PurchLine.TESTFIELD("Reserved Qty. (Base)",0);
2707 PurchLine.TESTFIELD("Receipt No.",'');
2708 PurchLine.TESTFIELD("Return Shipment No.",'');
2709 PurchLine.TESTFIELD("Blanket Order No.",'');
2710 IF PurchLine."Drop Shipment" OR PurchLine."Special Order" THEN BEGIN
2711 CASE TRUE OF
2712 PurchLine."Drop Shipment":
2713 SalesHeader.GET(SalesHeader."Document Type"::Order,PurchLine."Sales Order No.");
2714 PurchLine."Special Order":
2715 SalesHeader.GET(SalesHeader."Document Type"::Order,PurchLine."Special Order Sales No.");
2716 END;
2717 TESTFIELD("Sell-to Customer No.",SalesHeader."Sell-to Customer No.");
2718 TESTFIELD("Ship-to Code",SalesHeader."Ship-to Code");
2719 END;
2720
2721 PurchLine.TESTFIELD("Prepmt. Amt. Inv.",0);
2722 PurchLineTmp := PurchLine;
2723 IF PurchLine.Nonstock THEN BEGIN
2724 PurchLine.Nonstock := FALSE;
2725 PurchLine.MODIFY;
2726 END;
2727 PurchLineTmp.INSERT;
2728 UNTIL PurchLine.NEXT = 0;
2729
2730 ItemChargeAssgntPurch.SETRANGE("Document Type","Document Type");
2731 ItemChargeAssgntPurch.SETRANGE("Document No.","No.");
2732 IF ItemChargeAssgntPurch.FINDSET THEN BEGIN
2733 REPEAT
2734 TempItemChargeAssgntPurch.INIT;
2735 TempItemChargeAssgntPurch := ItemChargeAssgntPurch;
2736 TempItemChargeAssgntPurch.INSERT;
2737 UNTIL ItemChargeAssgntPurch.NEXT = 0;
2738 ItemChargeAssgntPurch.DELETEALL;
2739 END;
2740
2741 PurchLine.DELETEALL(TRUE);
2742
2743 PurchLine.INIT;
2744 PurchLine."Line No." := 0;
2745 PurchLineTmp.FINDSET;
2746 ExtendedTextAdded := FALSE;
2747 REPEAT
2748 IF PurchLineTmp."Attached to Line No." = 0 THEN BEGIN
2749 PurchLine.INIT;
2750 PurchLine."Line No." := PurchLine."Line No." + 10000;
2751 PurchLine.VALIDATE(Type,PurchLineTmp.Type);
2752 IF PurchLineTmp."No." = '' THEN BEGIN
2753 PurchLine.VALIDATE(Description,PurchLineTmp.Description);
2754 PurchLine.VALIDATE("Description 2",PurchLineTmp."Description 2");
2755 PurchLine.INSERT;
2756 END ELSE BEGIN
2757 PurchLine.VALIDATE("No.",PurchLineTmp."No.");
2758 IF PurchLine.Type <> PurchLine.Type::" " THEN
2759 CASE TRUE OF
2760 PurchLineTmp."Drop Shipment":
2761 BEGIN
2762 SalesLine.GET(SalesLine."Document Type"::Order,
2763 PurchLineTmp."Sales Order No.",
2764 PurchLineTmp."Sales Order Line No.");
2765 CopyDocMgt.TransfldsFromSalesToPurchLine(SalesLine,PurchLine);
2766 PurchLine."Drop Shipment" := PurchLineTmp."Drop Shipment";
2767 PurchLine."Purchasing Code" := SalesLine."Purchasing Code";
2768 PurchLine."Sales Order No." := PurchLineTmp."Sales Order No.";
2769 PurchLine."Sales Order Line No." := PurchLineTmp."Sales Order Line No.";
2770 EVALUATE(PurchLine."Inbound Whse. Handling Time",'<0D>');
2771 PurchLine.VALIDATE("Inbound Whse. Handling Time");
2772 PurchLine."Fixed Exchange Rate" := "Fixed Exchange Rate"; //SSI.Upgrade QSSD06.00.00.38
2773 PurchLine.INSERT;
2774
2775 SalesLine.VALIDATE("Unit Cost (LCY)",PurchLine."Unit Cost (LCY)");
2776 SalesLine."Purchase Order No." := PurchLine."Document No.";
2777 SalesLine."Purch. Order Line No." := PurchLine."Line No.";
2778 SalesLine.MODIFY;
2779 END;
2780 PurchLineTmp."Special Order":
2781 BEGIN
2782 SalesLine.GET(SalesLine."Document Type"::Order,
2783 PurchLineTmp."Special Order Sales No.",
2784 PurchLineTmp."Special Order Sales Line No.");
2785 CopyDocMgt.TransfldsFromSalesToPurchLine(SalesLine,PurchLine);
2786 PurchLine."Special Order" := PurchLineTmp."Special Order";
2787 PurchLine."Purchasing Code" := SalesLine."Purchasing Code";
2788 PurchLine."Special Order Sales No." := PurchLineTmp."Special Order Sales No.";
2789 PurchLine."Special Order Sales Line No." := PurchLineTmp."Special Order Sales Line No.";
2790 PurchLine."Fixed Exchange Rate" := "Fixed Exchange Rate"; //SSI.Upgrade QSSD06.00.00.38
2791 PurchLine.INSERT;
2792
2793 SalesLine.VALIDATE("Unit Cost (LCY)",PurchLine."Unit Cost (LCY)");
2794 SalesLine."Special Order Purchase No." := PurchLine."Document No.";
2795 SalesLine."Special Order Purch. Line No." := PurchLine."Line No.";
2796 SalesLine.MODIFY;
2797 END;
2798 ELSE BEGIN
2799 PurchLine.VALIDATE("Unit of Measure Code",PurchLineTmp."Unit of Measure Code");
2800 PurchLine.VALIDATE("Variant Code",PurchLineTmp."Variant Code");
2801 PurchLine."Prod. Order No." := PurchLineTmp."Prod. Order No.";
2802 IF PurchLine."Prod. Order No." <> '' THEN BEGIN
2803 PurchLine.Description := PurchLineTmp.Description;
2804 PurchLine.VALIDATE("VAT Prod. Posting Group",PurchLineTmp."VAT Prod. Posting Group");
2805 PurchLine.VALIDATE("Gen. Prod. Posting Group",PurchLineTmp."Gen. Prod. Posting Group");
2806 PurchLine.VALIDATE("Expected Receipt Date",PurchLineTmp."Expected Receipt Date");
2807 PurchLine.VALIDATE("Requested Receipt Date",PurchLineTmp."Requested Receipt Date");
2808 PurchLine.VALIDATE("Qty. per Unit of Measure",PurchLineTmp."Qty. per Unit of Measure");
2809 END;
2810 IF (PurchLineTmp."Job No." <> '') AND (PurchLineTmp."Job Task No." <> '') THEN BEGIN
2811 PurchLine.VALIDATE("Job No.",PurchLineTmp."Job No.");
2812 PurchLine.VALIDATE("Job Task No.",PurchLineTmp."Job Task No.");
2813 PurchLine."Job Line Type" := PurchLineTmp."Job Line Type";
2814 END;
2815 IF PurchLineTmp.Quantity <> 0 THEN
2816 PurchLine.VALIDATE(Quantity,PurchLineTmp.Quantity);
2817 IF "Currency Code" = xRec."Currency Code" THEN
2818 PurchLine.VALIDATE("Direct Unit Cost",PurchLineTmp."Direct Unit Cost");
2819 PurchLine."Routing No." := PurchLineTmp."Routing No.";
2820 PurchLine."Routing Reference No." := PurchLineTmp."Routing Reference No.";
2821 PurchLine."Operation No." := PurchLineTmp."Operation No.";
2822 PurchLine."Work Center No." := PurchLineTmp."Work Center No.";
2823 PurchLine."Prod. Order Line No." := PurchLineTmp."Prod. Order Line No.";
2824 PurchLine."Overhead Rate" := PurchLineTmp."Overhead Rate";
2825 PurchLine."Fixed Exchange Rate" := "Fixed Exchange Rate"; //SSI.Upgrade QSSD06.00.00.38
2826 PurchLine.INSERT;
2827 END;
2828 END;
2829 END;
2830 ExtendedTextAdded := FALSE;
2831
2832 IF PurchLine.Type = PurchLine.Type::Item THEN BEGIN
2833 ClearItemAssgntPurchFilter(TempItemChargeAssgntPurch);
2834 TempItemChargeAssgntPurch.SETRANGE("Applies-to Doc. Type",PurchLineTmp."Document Type");
2835 TempItemChargeAssgntPurch.SETRANGE("Applies-to Doc. No.",PurchLineTmp."Document No.");
2836 TempItemChargeAssgntPurch.SETRANGE("Applies-to Doc. Line No.",PurchLineTmp."Line No.");
2837 IF TempItemChargeAssgntPurch.FINDSET THEN
2838 REPEAT
2839 IF NOT TempItemChargeAssgntPurch.MARK THEN BEGIN
2840 TempItemChargeAssgntPurch."Applies-to Doc. Line No." := PurchLine."Line No.";
2841 TempItemChargeAssgntPurch.Description := PurchLine.Description;
2842 TempItemChargeAssgntPurch.MODIFY;
2843 TempItemChargeAssgntPurch.MARK(TRUE);
2844 END;
2845 UNTIL TempItemChargeAssgntPurch.NEXT = 0;
2846 END;
2847 IF PurchLine.Type = PurchLine.Type::"Charge (Item)" THEN BEGIN
2848 TempInteger.INIT;
2849 TempInteger.Number := PurchLine."Line No.";
2850 TempInteger.INSERT;
2851 END;
2852 END ELSE
2853 IF NOT ExtendedTextAdded THEN BEGIN
2854 TransferExtendedText.PurchCheckIfAnyExtText(PurchLine,TRUE);
2855 TransferExtendedText.InsertPurchExtText(PurchLine);
2856 PurchLine.FINDLAST;
2857 ExtendedTextAdded := TRUE;
2858 END;
2859 UNTIL PurchLineTmp.NEXT = 0;
2860
2861 ClearItemAssgntPurchFilter(TempItemChargeAssgntPurch);
2862 PurchLineTmp.SETRANGE(Type,PurchLine.Type::"Charge (Item)");
2863 IF PurchLineTmp.FINDSET THEN
2864 REPEAT
2865 TempItemChargeAssgntPurch.SETRANGE("Document Line No.",PurchLineTmp."Line No.");
2866 IF TempItemChargeAssgntPurch.FINDSET THEN BEGIN
2867 REPEAT
2868 TempInteger.FINDFIRST;
2869 ItemChargeAssgntPurch.INIT;
2870 ItemChargeAssgntPurch := TempItemChargeAssgntPurch;
2871 ItemChargeAssgntPurch."Document Line No." := TempInteger.Number;
2872 ItemChargeAssgntPurch.VALIDATE("Unit Cost",0);
2873 ItemChargeAssgntPurch.INSERT;
2874 UNTIL TempItemChargeAssgntPurch.NEXT = 0;
2875 TempInteger.DELETE;
2876 END;
2877 UNTIL PurchLineTmp.NEXT = 0;
2878
2879 PurchLineTmp.SETRANGE(Type);
2880 PurchLineTmp.DELETEALL;
2881 ClearItemAssgntPurchFilter(TempItemChargeAssgntPurch);
2882 TempItemChargeAssgntPurch.DELETEALL;
2883 END;
2884 END ELSE
2885 ERROR(
2886 Text018,ChangedFieldName);
2887 END;
2888 END;
2889
2890 PROCEDURE MessageIfPurchLinesExist@5(ChangedFieldName@1000 : Text[100]);
2891 BEGIN
2892 IF PurchLinesExist AND NOT HideValidationDialog THEN
2893 MESSAGE(
2894 Text019 +
2895 Text020,
2896 ChangedFieldName);
2897 END;
2898
2899 PROCEDURE PriceMessageIfPurchLinesExist@7(ChangedFieldName@1000 : Text[100]);
2900 BEGIN
2901 IF PurchLinesExist AND NOT HideValidationDialog THEN
2902 MESSAGE(
2903 Text019 +
2904 Text021,ChangedFieldName);
2905 END;
2906
2907 LOCAL PROCEDURE UpdateCurrencyFactor@12();
2908 BEGIN
2909 IF "Currency Code" <> '' THEN BEGIN
2910 IF "Posting Date" <> 0D THEN
2911 CurrencyDate := "Posting Date"
2912 ELSE
2913 CurrencyDate := WORKDATE;
2914
2915 "Currency Factor" := CurrExchRate.ExchangeRate(CurrencyDate,"Currency Code");
2916 END ELSE
2917 "Currency Factor" := 0;
2918 END;
2919
2920 LOCAL PROCEDURE ConfirmUpdateCurrencyFactor@13();
2921 VAR
2922 PurchaseLine@1000000002 : Record 39;
2923 Job@1000000001 : Record 167;
2924 JobExists@1000000000 : Boolean;
2925 BEGIN
2926 //DOC OP13008 APL 03/05/2018 - Stop exchnage rate alteration if job attached -
2927
2928 PurchaseLine.SETRANGE("Document Type","Document Type");
2929 PurchaseLine.SETRANGE("Document No.","No.");
2930 PurchaseLine.SETFILTER("Job No.",'<>%1','');
2931 IF PurchaseLine.FINDSET THEN REPEAT
2932 Job.GET(PurchaseLine."Job No.");
2933 IF Job."Fixed Exchange Rate" <> 0 THEN BEGIN
2934 JobExists := TRUE; // Dont update if fixed by Job.
2935 "Currency Factor" := xRec."Currency Factor";
2936 END;
2937 UNTIL PurchaseLine.NEXT = 0;
2938
2939 IF NOT JobExists THEN BEGIN
2940 //DOC OP13008 APL 03/05/2018 - Stop exchnage rate alteration if job attached +
2941
2942
2943
2944 IF HideValidationDialog THEN
2945 Confirmed := TRUE
2946 ELSE
2947 Confirmed := CONFIRM(Text022,FALSE);
2948 IF Confirmed THEN
2949 VALIDATE("Currency Factor")
2950 ELSE
2951 "Currency Factor" := xRec."Currency Factor";
2952
2953 END; //OP13008
2954 END;
2955
2956 PROCEDURE SetHideValidationDialog@14(NewHideValidationDialog@1000 : Boolean);
2957 BEGIN
2958 HideValidationDialog := NewHideValidationDialog;
2959 END;
2960
2961 PROCEDURE UpdatePurchLines@15(ChangedFieldName@1000 : Text[100]);
2962 VAR
2963 UpdateConfirmed@1002 : Boolean;
2964 BEGIN
2965 IF NOT PurchLinesExist THEN
2966 EXIT;
2967
2968 IF NOT GUIALLOWED THEN
2969 UpdateConfirmed := TRUE
2970 ELSE
2971 CASE ChangedFieldName OF
2972 FIELDCAPTION("Expected Receipt Date"):
2973 BEGIN
2974 UpdateConfirmed :=
2975 CONFIRM(
2976 STRSUBSTNO(
2977 Text032 +
2978 Text033,ChangedFieldName));
2979 IF UpdateConfirmed THEN
2980 ConfirmResvDateConflict;
2981 END;
2982 FIELDCAPTION("Requested Receipt Date"):
2983 BEGIN
2984 UpdateConfirmed :=
2985 CONFIRM(
2986 STRSUBSTNO(
2987 Text032 +
2988 Text033,ChangedFieldName));
2989 IF UpdateConfirmed THEN
2990 ConfirmResvDateConflict;
2991 END;
2992 FIELDCAPTION("Promised Receipt Date"):
2993 BEGIN
2994 UpdateConfirmed :=
2995 CONFIRM(
2996 STRSUBSTNO(
2997 Text032 +
2998 Text033,ChangedFieldName));
2999 IF UpdateConfirmed THEN
3000 ConfirmResvDateConflict;
3001 END;
3002 FIELDCAPTION("Lead Time Calculation"):
3003 BEGIN
3004 UpdateConfirmed :=
3005 CONFIRM(
3006 STRSUBSTNO(
3007 Text032 +
3008 Text033,ChangedFieldName));
3009 IF UpdateConfirmed THEN
3010 ConfirmResvDateConflict;
3011 END;
3012 FIELDCAPTION("Inbound Whse. Handling Time"):
3013 BEGIN
3014 UpdateConfirmed :=
3015 CONFIRM(
3016 STRSUBSTNO(
3017 Text032 +
3018 Text033,ChangedFieldName));
3019 IF UpdateConfirmed THEN
3020 ConfirmResvDateConflict;
3021 END;
3022 FIELDCAPTION("Prepayment %"):
3023 UpdateConfirmed :=
3024 CONFIRM(
3025 STRSUBSTNO(
3026 Text032 +
3027 Text033,ChangedFieldName));
3028 END;
3029
3030 PurchLine.LOCKTABLE;
3031 MODIFY;
3032
3033 REPEAT
3034 xPurchLine := PurchLine;
3035 CASE ChangedFieldName OF
3036 FIELDCAPTION("Expected Receipt Date"):
3037 IF UpdateConfirmed AND (PurchLine."No." <> '') THEN
3038 PurchLine.VALIDATE("Expected Receipt Date","Expected Receipt Date");
3039 FIELDCAPTION("Currency Factor"):
3040 IF PurchLine.Type <> PurchLine.Type::" " THEN BEGIN //SSI.Upgrade
3041 PurchLine.VALIDATE("Direct Unit Cost");
3042 PurchLine.VALIDATE("Fixed Exchange Rate");
3043 //QSSD.06.00.38v5<<
3044 IF ("Currency Factor"<>0) AND ("Fixed Exchange Rate") THEN
3045 PurchLine."Fixed Exchange Rate":=TRUE;
3046 //QSSD.06.00.38v5<<
3047 END;
3048 FIELDCAPTION("Transaction Type"):
3049 PurchLine.VALIDATE("Transaction Type","Transaction Type");
3050 FIELDCAPTION("Transport Method"):
3051 PurchLine.VALIDATE("Transport Method","Transport Method");
3052 FIELDCAPTION("Entry Point"):
3053 PurchLine.VALIDATE("Entry Point","Entry Point");
3054 FIELDCAPTION(Area):
3055 PurchLine.VALIDATE(Area,Area);
3056 FIELDCAPTION("Transaction Specification"):
3057 PurchLine.VALIDATE("Transaction Specification","Transaction Specification");
3058 FIELDCAPTION("Requested Receipt Date"):
3059 IF UpdateConfirmed AND (PurchLine."No." <> '') THEN
3060 PurchLine.VALIDATE("Requested Receipt Date","Requested Receipt Date");
3061 FIELDCAPTION("Prepayment %"):
3062 IF UpdateConfirmed AND (PurchLine."No." <> '') THEN
3063 PurchLine.VALIDATE("Prepayment %","Prepayment %");
3064 FIELDCAPTION("Promised Receipt Date"):
3065 IF UpdateConfirmed AND (PurchLine."No." <> '') THEN
3066 PurchLine.VALIDATE("Promised Receipt Date","Promised Receipt Date");
3067 FIELDCAPTION("Lead Time Calculation"):
3068 IF UpdateConfirmed AND (PurchLine."No." <> '') THEN
3069 PurchLine.VALIDATE("Lead Time Calculation","Lead Time Calculation");
3070 FIELDCAPTION("Inbound Whse. Handling Time"):
3071 IF UpdateConfirmed AND (PurchLine."No." <> '') THEN
3072 PurchLine.VALIDATE("Inbound Whse. Handling Time","Inbound Whse. Handling Time");
3073 END;
3074 PurchLine.MODIFY(TRUE);
3075 ReservePurchLine.VerifyChange(PurchLine,xPurchLine);
3076 UNTIL PurchLine.NEXT = 0;
3077 END;
3078
3079 PROCEDURE ConfirmResvDateConflict@31();
3080 VAR
3081 ResvEngMgt@1000 : Codeunit 99000831;
3082 BEGIN
3083 IF ResvEngMgt.ResvExistsForPurchHeader(Rec) THEN
3084 IF NOT CONFIRM(Text050 + Text011,FALSE) THEN
3085 ERROR('');
3086 END;
3087
3088 PROCEDURE CreateDim@16(Type1@1000 : Integer;No1@1001 : Code[20];Type2@1002 : Integer;No2@1003 : Code[20];Type3@1004 : Integer;No3@1005 : Code[20];Type4@1006 : Integer;No4@1007 : Code[20]);
3089 VAR
3090 SourceCodeSetup@1010 : Record 242;
3091 TableID@1011 : ARRAY [10] OF Integer;
3092 No@1012 : ARRAY [10] OF Code[20];
3093 OldDimSetID@1008 : Integer;
3094 BEGIN
3095 SourceCodeSetup.GET;
3096 TableID[1] := Type1;
3097 No[1] := No1;
3098 TableID[2] := Type2;
3099 No[2] := No2;
3100 TableID[3] := Type3;
3101 No[3] := No3;
3102 TableID[4] := Type4;
3103 No[4] := No4;
3104 "Shortcut Dimension 1 Code" := '';
3105 "Shortcut Dimension 2 Code" := '';
3106 OldDimSetID := "Dimension Set ID";
3107 "Dimension Set ID" :=
3108 DimMgt.GetDefaultDimID(TableID,No,SourceCodeSetup.Purchases,"Shortcut Dimension 1 Code","Shortcut Dimension 2 Code",0,0);
3109
3110 IF (OldDimSetID <> "Dimension Set ID") AND PurchLinesExist THEN BEGIN
3111 MODIFY;
3112 UpdateAllLineDim("Dimension Set ID",OldDimSetID);
3113 END;
3114 END;
3115
3116 PROCEDURE CreateDim2@1000000012(Type1@1000 : Integer;No1@1001 : Code[20]);
3117 VAR
3118 SourceCodeSetup@1010 : Record 242;
3119 TableID@1011 : ARRAY [10] OF Integer;
3120 No@1012 : ARRAY [10] OF Code[20];
3121 OldDimSetID@1008 : Integer;
3122 BEGIN
3123 //DOC OP9678 DB 28/03/2017 -
3124 SourceCodeSetup.GET;
3125 TableID[1] := Type1;
3126 No[1] := No1;
3127 "Shortcut Dimension 1 Code" := '';
3128 "Shortcut Dimension 2 Code" := '';
3129 OldDimSetID := "Dimension Set ID";
3130 "Dimension Set ID" :=
3131 DimMgt.GetDefaultDimID(TableID,No,SourceCodeSetup.Purchases,"Shortcut Dimension 1 Code","Shortcut Dimension 2 Code",0,0);
3132
3133 IF (OldDimSetID <> "Dimension Set ID") AND PurchLinesExist THEN BEGIN
3134 MODIFY;
3135 UpdateAllLineDim("Dimension Set ID",OldDimSetID);
3136 END;
3137 //DOC OP9678 DB 28/03/2017 +
3138 END;
3139
3140 PROCEDURE InitDefaultDim@38();
3141 BEGIN
3142 //DOC OP9678 DB 28/03/2017 -
3143 IF "Job No."<>'' THEN
3144 CreateDim2(DATABASE::Job,"Job No.")
3145 ELSE
3146 //DOC OP9678 DB 28/03/2017 +
3147 CreateDim(
3148 DATABASE::Vendor,"Pay-to Vendor No.",
3149 DATABASE::"Salesperson/Purchaser","Purchaser Code",
3150 DATABASE::Campaign,"Campaign No.",
3151 DATABASE::"Responsibility Center","Responsibility Center");
3152 END;
3153
3154 PROCEDURE ValidateShortcutDimCode@19(FieldNumber@1000 : Integer;VAR ShortcutDimCode@1001 : Code[20]);
3155 VAR
3156 OldDimSetID@1005 : Integer;
3157 BEGIN
3158 OldDimSetID := "Dimension Set ID";
3159 DimMgt.ValidateShortcutDimValues(FieldNumber,ShortcutDimCode,"Dimension Set ID");
3160 IF "No." <> '' THEN
3161 MODIFY;
3162
3163 IF OldDimSetID <> "Dimension Set ID" THEN BEGIN
3164 MODIFY;
3165 IF PurchLinesExist THEN
3166 UpdateAllLineDim("Dimension Set ID",OldDimSetID);
3167 END;
3168 END;
3169
3170 PROCEDURE ReceivedPurchLinesExist@20() : Boolean;
3171 BEGIN
3172 PurchLine.RESET;
3173 PurchLine.SETRANGE("Document Type","Document Type");
3174 PurchLine.SETRANGE("Document No.","No.");
3175 PurchLine.SETFILTER("Quantity Received",'<>0');
3176 EXIT(PurchLine.FINDFIRST);
3177 END;
3178
3179 PROCEDURE ReturnShipmentExist@5800() : Boolean;
3180 BEGIN
3181 PurchLine.RESET;
3182 PurchLine.SETRANGE("Document Type","Document Type");
3183 PurchLine.SETRANGE("Document No.","No.");
3184 PurchLine.SETFILTER("Return Qty. Shipped",'<>0');
3185 EXIT(PurchLine.FINDFIRST);
3186 END;
3187
3188 LOCAL PROCEDURE UpdateShipToAddress@21();
3189 BEGIN
3190 IF "Document Type" IN ["Document Type"::"Return Order","Document Type"::"Credit Memo"] THEN
3191 EXIT;
3192
3193 IF ("Location Code" <> '') AND
3194 Location.GET("Location Code") AND
3195 ("Sell-to Customer No." = '')
3196 THEN BEGIN
3197 "Ship-to Name" := Location.Name;
3198 "Ship-to Name 2" := Location."Name 2";
3199 "Ship-to Address" := Location.Address;
3200 "Ship-to Address 2" := Location."Address 2";
3201 "Ship-to City" := Location.City;
3202 "Ship-to Post Code" := Location."Post Code";
3203 "Ship-to County" := Location.County;
3204 "Ship-to Country/Region Code" := Location."Country/Region Code";
3205 "Ship-to Contact" := Location.Contact;
3206 END;
3207
3208 IF ("Location Code" = '') AND
3209 ("Sell-to Customer No." = '')
3210 THEN BEGIN
3211 CompanyInfo.GET;
3212 "Ship-to Code" := '';
3213 "Ship-to Name" := CompanyInfo."Ship-to Name";
3214 "Ship-to Name 2" := CompanyInfo."Ship-to Name 2";
3215 "Ship-to Address" := CompanyInfo."Ship-to Address";
3216 "Ship-to Address 2" := CompanyInfo."Ship-to Address 2";
3217 "Ship-to City" := CompanyInfo."Ship-to City";
3218 "Ship-to Post Code" := CompanyInfo."Ship-to Post Code";
3219 "Ship-to County" := CompanyInfo."Ship-to County";
3220 "Ship-to Country/Region Code" := CompanyInfo."Ship-to Country/Region Code";
3221 "Ship-to Contact" := CompanyInfo."Ship-to Contact";
3222 END;
3223 END;
3224
3225 LOCAL PROCEDURE DeletePurchaseLines@17();
3226 BEGIN
3227 IF PurchLine.FINDSET THEN BEGIN
3228 HandleItemTrackingDeletion;
3229 REPEAT
3230 PurchLine.SuspendStatusCheck(TRUE);
3231 PurchLine.DELETE(TRUE);
3232 UNTIL PurchLine.NEXT = 0;
3233 END;
3234 END;
3235
3236 PROCEDURE HandleItemTrackingDeletion@36();
3237 VAR
3238 ReservEntry@1000 : Record 337;
3239 ReservEntry2@1001 : Record 337;
3240 BEGIN
3241 WITH ReservEntry DO BEGIN
3242 RESET;
3243 SETCURRENTKEY(
3244 "Source ID","Source Ref. No.","Source Type","Source Subtype",
3245 "Source Batch Name","Source Prod. Order Line","Reservation Status");
3246 SETRANGE("Source Type",DATABASE::"Purchase Line");
3247 SETRANGE("Source Subtype","Document Type");
3248 SETRANGE("Source ID","No.");
3249 SETRANGE("Source Batch Name",'');
3250 SETRANGE("Source Prod. Order Line",0);
3251 SETFILTER("Item Tracking",'> %1',"Item Tracking"::None);
3252 IF ISEMPTY THEN
3253 EXIT;
3254
3255 IF HideValidationDialog OR NOT GUIALLOWED THEN
3256 Confirmed := TRUE
3257 ELSE
3258 Confirmed := CONFIRM(Text041,FALSE,LOWERCASE(FORMAT("Document Type")),"No.");
3259
3260 IF NOT Confirmed THEN
3261 ERROR('');
3262
3263 IF FINDSET THEN
3264 REPEAT
3265 ReservEntry2 := ReservEntry;
3266 ReservEntry2.ClearItemTrackingFields;
3267 ReservEntry2.MODIFY;
3268 UNTIL NEXT = 0;
3269 END;
3270 END;
3271
3272 LOCAL PROCEDURE ClearItemAssgntPurchFilter@22(VAR TempItemChargeAssgntPurch@1000 : Record 5805);
3273 BEGIN
3274 TempItemChargeAssgntPurch.SETRANGE("Document Line No.");
3275 TempItemChargeAssgntPurch.SETRANGE("Applies-to Doc. Type");
3276 TempItemChargeAssgntPurch.SETRANGE("Applies-to Doc. No.");
3277 TempItemChargeAssgntPurch.SETRANGE("Applies-to Doc. Line No.");
3278 END;
3279
3280 PROCEDURE UpdateBuyFromCont@24(VendorNo@1000 : Code[20]);
3281 VAR
3282 ContBusRel@1003 : Record 5054;
3283 Vend@1004 : Record 23;
3284 BEGIN
3285 IF Vend.GET(VendorNo) THEN BEGIN
3286 IF Vend."Primary Contact No." <> '' THEN
3287 "Buy-from Contact No." := Vend."Primary Contact No."
3288 ELSE BEGIN
3289 ContBusRel.RESET;
3290 ContBusRel.SETCURRENTKEY("Link to Table","No.");
3291 ContBusRel.SETRANGE("Link to Table",ContBusRel."Link to Table"::Vendor);
3292 ContBusRel.SETRANGE("No.","Buy-from Vendor No.");
3293 IF ContBusRel.FINDFIRST THEN
3294 "Buy-from Contact No." := ContBusRel."Contact No."
3295 ELSE
3296 "Buy-from Contact No." := '';
3297 END;
3298 "Buy-from Contact" := Vend.Contact;
3299 END;
3300 END;
3301
3302 PROCEDURE TestPostingDate@1040000(BatchPost@1040000 : Boolean);
3303 VAR
3304 Text1041000@1041000 : TextConst 'ENU=%1 %2 is different from Work Date %3.\\;ENG=%1 %2 is different from Work Date %3.\\';
3305 Text1041001@1041001 : TextConst 'ENU=Do you want to continue?;ENG=Do you want to continue?';
3306 BEGIN
3307 PurchSetup.GET;
3308 IF NOT PurchSetup."Posting Date Check on Posting" THEN
3309 EXIT;
3310 IF "Posting Date" <> WORKDATE THEN BEGIN
3311 IF BatchPost THEN
3312 ERROR('');
3313 IF NOT CONFIRM(
3314 Text1041000 +
3315 Text1041001,
3316 FALSE,FIELDCAPTION("Posting Date"),"Posting Date",WORKDATE)
3317 THEN
3318 ERROR('');
3319 END;
3320 END;
3321
3322 PROCEDURE UpdatePayToCont@27(VendorNo@1000 : Code[20]);
3323 VAR
3324 ContBusRel@1003 : Record 5054;
3325 Vend@1001 : Record 23;
3326 BEGIN
3327 IF Vend.GET(VendorNo) THEN BEGIN
3328 IF Vend."Primary Contact No." <> '' THEN
3329 "Pay-to Contact No." := Vend."Primary Contact No."
3330 ELSE BEGIN
3331 ContBusRel.RESET;
3332 ContBusRel.SETCURRENTKEY("Link to Table","No.");
3333 ContBusRel.SETRANGE("Link to Table",ContBusRel."Link to Table"::Vendor);
3334 ContBusRel.SETRANGE("No.","Pay-to Vendor No.");
3335 IF ContBusRel.FINDFIRST THEN
3336 "Pay-to Contact No." := ContBusRel."Contact No."
3337 ELSE
3338 "Pay-to Contact No." := '';
3339 END;
3340 "Pay-to Contact" := Vend.Contact;
3341 END;
3342 END;
3343
3344 PROCEDURE UpdateBuyFromVend@25(ContactNo@1002 : Code[20]);
3345 VAR
3346 ContBusinessRelation@1007 : Record 5054;
3347 Vend@1006 : Record 23;
3348 Cont@1005 : Record 5050;
3349 BEGIN
3350 IF Cont.GET(ContactNo) THEN BEGIN
3351 "Buy-from Contact No." := Cont."No.";
3352 IF Cont.Type = Cont.Type::Person THEN
3353 "Buy-from Contact" := Cont.Name
3354 ELSE
3355 IF Vend.GET("Buy-from Vendor No.") THEN
3356 "Buy-from Contact" := Vend.Contact
3357 ELSE
3358 "Buy-from Contact" := ''
3359 END ELSE BEGIN
3360 "Buy-from Contact" := '';
3361 EXIT;
3362 END;
3363
3364 ContBusinessRelation.RESET;
3365 ContBusinessRelation.SETCURRENTKEY("Link to Table","Contact No.");
3366 ContBusinessRelation.SETRANGE("Link to Table",ContBusinessRelation."Link to Table"::Vendor);
3367 ContBusinessRelation.SETRANGE("Contact No.",Cont."Company No.");
3368 IF ContBusinessRelation.FINDFIRST THEN BEGIN
3369 IF ("Buy-from Vendor No." <> '') AND
3370 ("Buy-from Vendor No." <> ContBusinessRelation."No.")
3371 THEN
3372 ERROR(Text037,Cont."No.",Cont.Name,"Buy-from Vendor No.");
3373 IF "Buy-from Vendor No." = '' THEN BEGIN
3374 SkipBuyFromContact := TRUE;
3375 VALIDATE("Buy-from Vendor No.",ContBusinessRelation."No.");
3376 SkipBuyFromContact := FALSE;
3377 END;
3378 END ELSE
3379 ERROR(Text039,Cont."No.",Cont.Name);
3380
3381 IF ("Buy-from Vendor No." = "Pay-to Vendor No.") OR
3382 ("Pay-to Vendor No." = '')
3383 THEN
3384 VALIDATE("Pay-to Contact No.","Buy-from Contact No.");
3385 END;
3386
3387 PROCEDURE UpdatePayToVend@26(ContactNo@1000 : Code[20]);
3388 VAR
3389 ContBusinessRelation@1005 : Record 5054;
3390 Vend@1004 : Record 23;
3391 Cont@1003 : Record 5050;
3392 BEGIN
3393 IF Cont.GET(ContactNo) THEN BEGIN
3394 "Pay-to Contact No." := Cont."No.";
3395 IF Cont.Type = Cont.Type::Person THEN
3396 "Pay-to Contact" := Cont.Name
3397 ELSE
3398 IF Vend.GET("Pay-to Vendor No.") THEN
3399 "Pay-to Contact" := Vend.Contact
3400 ELSE
3401 "Pay-to Contact" := '';
3402 END ELSE BEGIN
3403 "Pay-to Contact" := '';
3404 EXIT;
3405 END;
3406
3407 ContBusinessRelation.RESET;
3408 ContBusinessRelation.SETCURRENTKEY("Link to Table","Contact No.");
3409 ContBusinessRelation.SETRANGE("Link to Table",ContBusinessRelation."Link to Table"::Vendor);
3410 ContBusinessRelation.SETRANGE("Contact No.",Cont."Company No.");
3411 IF ContBusinessRelation.FINDFIRST THEN BEGIN
3412 IF "Pay-to Vendor No." = '' THEN BEGIN
3413 SkipPayToContact := TRUE;
3414 VALIDATE("Pay-to Vendor No.",ContBusinessRelation."No.");
3415 SkipPayToContact := FALSE;
3416 END ELSE
3417 IF "Pay-to Vendor No." <> ContBusinessRelation."No." THEN
3418 ERROR(Text037,Cont."No.",Cont.Name,"Pay-to Vendor No.");
3419 END ELSE
3420 ERROR(Text039,Cont."No.",Cont.Name);
3421 END;
3422
3423 PROCEDURE CreateInvtPutAwayPick@29();
3424 VAR
3425 WhseRequest@1000 : Record 5765;
3426 BEGIN
3427 TESTFIELD(Status,Status::Released);
3428
3429 WhseRequest.RESET;
3430 WhseRequest.SETCURRENTKEY("Source Document","Source No.");
3431 CASE "Document Type" OF
3432 "Document Type"::Order:
3433 WhseRequest.SETRANGE("Source Document",WhseRequest."Source Document"::"Purchase Order");
3434 "Document Type"::"Return Order":
3435 WhseRequest.SETRANGE("Source Document",WhseRequest."Source Document"::"Purchase Return Order");
3436 END;
3437 WhseRequest.SETRANGE("Source No.","No.");
3438 REPORT.RUNMODAL(REPORT::"Create Invt Put-away/Pick/Mvmt",TRUE,FALSE,WhseRequest);
3439 END;
3440
3441 PROCEDURE ShowDocDim@32();
3442 VAR
3443 OldDimSetID@1000 : Integer;
3444 BEGIN
3445 OldDimSetID := "Dimension Set ID";
3446 "Dimension Set ID" :=
3447 DimMgt.EditDimensionSet2(
3448 "Dimension Set ID",STRSUBSTNO('%1 %2',"Document Type","No."),
3449 "Shortcut Dimension 1 Code","Shortcut Dimension 2 Code");
3450
3451 IF OldDimSetID <> "Dimension Set ID" THEN BEGIN
3452 MODIFY;
3453 IF PurchLinesExist THEN
3454 UpdateAllLineDim("Dimension Set ID",OldDimSetID);
3455 END;
3456 END;
3457
3458 LOCAL PROCEDURE UpdateAllLineDim@34(NewParentDimSetID@1000 : Integer;OldParentDimSetID@1001 : Integer);
3459 VAR
3460 NewDimSetID@1002 : Integer;
3461 BEGIN
3462 // Update all lines with changed dimensions.
3463
3464 IF NewParentDimSetID = OldParentDimSetID THEN
3465 EXIT;
3466 IF NOT CONFIRM(Text051) THEN
3467 EXIT;
3468
3469 PurchLine.RESET;
3470 PurchLine.SETRANGE("Document Type","Document Type");
3471 PurchLine.SETRANGE("Document No.","No.");
3472 PurchLine.LOCKTABLE;
3473 IF PurchLine.FIND('-') THEN
3474 REPEAT
3475 NewDimSetID := DimMgt.GetDeltaDimSetID(PurchLine."Dimension Set ID",NewParentDimSetID,OldParentDimSetID);
3476 IF PurchLine."Dimension Set ID" <> NewDimSetID THEN BEGIN
3477 PurchLine."Dimension Set ID" := NewDimSetID;
3478 DimMgt.UpdateGlobalDimFromDimSetID(
3479 PurchLine."Dimension Set ID",PurchLine."Shortcut Dimension 1 Code",PurchLine."Shortcut Dimension 2 Code");
3480 PurchLine.MODIFY;
3481 END;
3482 UNTIL PurchLine.NEXT = 0;
3483 END;
3484
3485 PROCEDURE SetAmountToApply@18(AppliesToDocNo@1000 : Code[20];VendorNo@1001 : Code[20]);
3486 VAR
3487 VendLedgEntry@1002 : Record 25;
3488 BEGIN
3489 VendLedgEntry.SETCURRENTKEY("Document No.");
3490 VendLedgEntry.SETRANGE("Document No.",AppliesToDocNo);
3491 VendLedgEntry.SETRANGE("Vendor No.",VendorNo);
3492 VendLedgEntry.SETRANGE(Open,TRUE);
3493 IF VendLedgEntry.FINDFIRST THEN BEGIN
3494 IF VendLedgEntry."Amount to Apply" = 0 THEN BEGIN
3495 VendLedgEntry.CALCFIELDS("Remaining Amount");
3496 VendLedgEntry."Amount to Apply" := VendLedgEntry."Remaining Amount";
3497 END ELSE
3498 VendLedgEntry."Amount to Apply" := 0;
3499 VendLedgEntry."Accepted Payment Tolerance" := 0;
3500 VendLedgEntry."Accepted Pmt. Disc. Tolerance" := FALSE;
3501 CODEUNIT.RUN(CODEUNIT::"Vend. Entry-Edit",VendLedgEntry);
3502 END;
3503 END;
3504
3505 PROCEDURE SetShipToForSpecOrder@23();
3506 BEGIN
3507 IF Location.GET("Location Code") THEN BEGIN
3508 "Ship-to Code" := '';
3509 "Ship-to Name" := Location.Name;
3510 "Ship-to Name 2" := Location."Name 2";
3511 "Ship-to Address" := Location.Address;
3512 "Ship-to Address 2" := Location."Address 2";
3513 "Ship-to City" := Location.City;
3514 "Ship-to Post Code" := Location."Post Code";
3515 "Ship-to County" := Location.County;
3516 "Ship-to Country/Region Code" := Location."Country/Region Code";
3517 "Ship-to Contact" := Location.Contact;
3518 "Location Code" := Location.Code;
3519 END ELSE BEGIN
3520 CompanyInfo.GET;
3521 "Ship-to Code" := '';
3522 "Ship-to Name" := CompanyInfo."Ship-to Name";
3523 "Ship-to Name 2" := CompanyInfo."Ship-to Name 2";
3524 "Ship-to Address" := CompanyInfo."Ship-to Address";
3525 "Ship-to Address 2" := CompanyInfo."Ship-to Address 2";
3526 "Ship-to City" := CompanyInfo."Ship-to City";
3527 "Ship-to Post Code" := CompanyInfo."Ship-to Post Code";
3528 "Ship-to County" := CompanyInfo."Ship-to County";
3529 "Ship-to Country/Region Code" := CompanyInfo."Ship-to Country/Region Code";
3530 "Ship-to Contact" := CompanyInfo."Ship-to Contact";
3531 "Location Code" := '';
3532 END;
3533 END;
3534
3535 PROCEDURE JobUpdatePurchLines@28();
3536 BEGIN
3537 WITH PurchLine DO BEGIN
3538 SETFILTER("Job No.",'<>%1','');
3539 SETFILTER("Job Task No.",'<>%1','');
3540 LOCKTABLE;
3541 IF FINDSET(TRUE,FALSE) THEN BEGIN
3542 SetPurchHeader(Rec);
3543 REPEAT
3544 JobSetCurrencyFactor;
3545 CreateTempJobJnlLine(FALSE);
3546 UpdateJobPrices;
3547 MODIFY;
3548 UNTIL NEXT = 0;
3549 END;
3550 END
3551 END;
3552
3553 PROCEDURE GetPstdDocLinesToRevere@47();
3554 VAR
3555 PurchPostedDocLines@1002 : Page 5855;
3556 BEGIN
3557 GetVend("Buy-from Vendor No.");
3558 PurchPostedDocLines.SetToPurchHeader(Rec);
3559 PurchPostedDocLines.SETRECORD(Vend);
3560 PurchPostedDocLines.LOOKUPMODE := TRUE;
3561 IF PurchPostedDocLines.RUNMODAL = ACTION::LookupOK THEN
3562 PurchPostedDocLines.CopyLineToDoc;
3563
3564 CLEAR(PurchPostedDocLines);
3565 END;
3566
3567 PROCEDURE SetSecurityFilterOnRespCenter@43();
3568 BEGIN
3569 IF UserSetupMgt.GetPurchasesFilter <> '' THEN BEGIN
3570 FILTERGROUP(2);
3571 SETRANGE("Responsibility Center",UserSetupMgt.GetPurchasesFilter);
3572 FILTERGROUP(0);
3573 END;
3574
3575 SETRANGE("Date Filter",0D,WORKDATE - 1);
3576 END;
3577
3578 PROCEDURE CalcInvDiscForHeader@45();
3579 VAR
3580 PurchaseInvDisc@1000 : Codeunit 70;
3581 BEGIN
3582 PurchSetup.GET;
3583 IF PurchSetup."Calc. Inv. Discount" THEN
3584 PurchaseInvDisc.CalculateIncDiscForHeader(Rec);
3585 END;
3586
3587 PROCEDURE AddShipToAddress@46(SalesHeader@1000 : Record 36;ShowError@1001 : Boolean);
3588 VAR
3589 PurchLine2@1002 : Record 39;
3590 BEGIN
3591 IF ShowError THEN BEGIN
3592 PurchLine2.RESET;
3593 PurchLine2.SETRANGE("Document Type","Document Type"::Order);
3594 PurchLine2.SETRANGE("Document No.","No.");
3595 IF NOT PurchLine2.ISEMPTY THEN BEGIN
3596 IF "Ship-to Name" <> SalesHeader."Ship-to Name" THEN
3597 ERROR(Text052,FIELDCAPTION("Ship-to Name"),"No.",SalesHeader."No.");
3598 IF "Ship-to Name 2" <> SalesHeader."Ship-to Name 2" THEN
3599 ERROR(Text052,FIELDCAPTION("Ship-to Name 2"),"No.",SalesHeader."No.");
3600 IF "Ship-to Address" <> SalesHeader."Ship-to Address" THEN
3601 ERROR(Text052,FIELDCAPTION("Ship-to Address"),"No.",SalesHeader."No.");
3602 IF "Ship-to Address 2" <> SalesHeader."Ship-to Address 2" THEN
3603 ERROR(Text052,FIELDCAPTION("Ship-to Address 2"),"No.",SalesHeader."No.");
3604 IF "Ship-to Post Code" <> SalesHeader."Ship-to Post Code" THEN
3605 ERROR(Text052,FIELDCAPTION("Ship-to Post Code"),"No.",SalesHeader."No.");
3606 IF "Ship-to City" <> SalesHeader."Ship-to City" THEN
3607 ERROR(Text052,FIELDCAPTION("Ship-to City"),"No.",SalesHeader."No.");
3608 IF "Ship-to Contact" <> SalesHeader."Ship-to Contact" THEN
3609 ERROR(Text052,FIELDCAPTION("Ship-to Contact"),"No.",SalesHeader."No.");
3610 END ELSE BEGIN
3611 // no purchase line exists
3612 "Ship-to Name" := SalesHeader."Ship-to Name";
3613 "Ship-to Name 2" := SalesHeader."Ship-to Name 2";
3614 "Ship-to Address" := SalesHeader."Ship-to Address";
3615 "Ship-to Address 2" := SalesHeader."Ship-to Address 2";
3616 "Ship-to Post Code" := SalesHeader."Ship-to Post Code";
3617 "Ship-to City" := SalesHeader."Ship-to City";
3618 "Ship-to Contact" := SalesHeader."Ship-to Contact";
3619 END;
3620 END;
3621 END;
3622
3623 PROCEDURE DropShptOrderExists@48(SalesHeader@1000 : Record 36) : Boolean;
3624 VAR
3625 SalesLine2@1001 : Record 37;
3626 BEGIN
3627 // returns TRUE if sales is either Drop Shipment of Special Order
3628 SalesLine2.RESET;
3629 SalesLine2.SETRANGE("Document Type",SalesLine2."Document Type"::Order);
3630 SalesLine2.SETRANGE("Document No.",SalesHeader."No.");
3631 SalesLine2.SETRANGE("Drop Shipment",TRUE);
3632 EXIT(NOT SalesLine2.ISEMPTY);
3633 END;
3634
3635 PROCEDURE SpecialOrderExists@81(SalesHeader@1000 : Record 36) : Boolean;
3636 VAR
3637 SalesLine3@1001 : Record 37;
3638 BEGIN
3639 SalesLine3.RESET;
3640 SalesLine3.SETRANGE("Document Type",SalesLine3."Document Type"::Order);
3641 SalesLine3.SETRANGE("Document No.",SalesHeader."No.");
3642 SalesLine3.SETRANGE("Special Order",TRUE);
3643 EXIT(NOT SalesLine3.ISEMPTY);
3644 END;
3645
3646 PROCEDURE QtyToReceiveIsZero@30() : Boolean;
3647 BEGIN
3648 PurchLine.RESET;
3649 PurchLine.SETRANGE("Document Type","Document Type");
3650 PurchLine.SETRANGE("Document No.","No.");
3651 PurchLine.SETFILTER("Qty. to Receive",'<>0');
3652 EXIT(PurchLine.ISEMPTY);
3653 END;
3654
3655 PROCEDURE IsApprovedForPosting@50() : Boolean;
3656 VAR
3657 SalesHeader@1000 : Record 36;
3658 BEGIN
3659 SalesHeader.INIT;
3660 IF ApprovalMgt.PrePostApprovalCheck(SalesHeader,Rec) THEN BEGIN
3661 IF ApprovalMgt.TestPurchasePrepayment(Rec) THEN
3662 ERROR(STRSUBSTNO(Text053,"Document Type","No."));
3663 IF ApprovalMgt.TestPurchasePayment(Rec) THEN
3664 IF NOT CONFIRM(STRSUBSTNO(Text054,"Document Type","No."),TRUE) THEN
3665 EXIT(FALSE);
3666 EXIT(TRUE);
3667 END;
3668 END;
3669
3670 PROCEDURE IsApprovedForPostingBatch@51() : Boolean;
3671 VAR
3672 SalesHeader@1000 : Record 36;
3673 BEGIN
3674 SalesHeader.INIT;
3675 IF ApprovalMgt.PrePostApprovalCheck(SalesHeader,Rec) THEN BEGIN
3676 IF ApprovalMgt.TestPurchasePrepayment(Rec) THEN
3677 EXIT(FALSE);
3678 IF ApprovalMgt.TestPurchasePayment(Rec) THEN
3679 EXIT(FALSE);
3680 EXIT(TRUE);
3681 END;
3682 END;
3683
3684 PROCEDURE UpdatePmtDiscDate@1140000();
3685 BEGIN
3686 // Updates the payment discount date to due date if discount % is zero
3687 IF "Payment Discount %" = 0 THEN
3688 // credit memo and return order behave different
3689 IF NOT ("Document Type" IN ["Document Type"::"Credit Memo","Document Type"::"Return Order"]) THEN
3690 "Pmt. Discount Date" := "Due Date";
3691 END;
3692
3693 PROCEDURE SendToPosting@57(PostingCodeunitID@1000 : Integer);
3694 BEGIN
3695 IF NOT IsApprovedForPosting THEN
3696 EXIT;
3697 CODEUNIT.RUN(PostingCodeunitID,Rec);
3698 END;
3699
3700 PROCEDURE CancelBackgroundPosting@33();
3701 VAR
3702 PurchasePostViaJobQueue@1000 : Codeunit 98;
3703 BEGIN
3704 PurchasePostViaJobQueue.CancelQueueEntry(Rec);
3705 END;
3706
3707 PROCEDURE CheckDropShptAddressDetails@79(SalesHeader@1000 : Record 36) : Boolean;
3708 BEGIN
3709 NameAddressDetails := DropShptNameAddressDetails;
3710 DropShptNameAddressDetails :=
3711 SalesHeader."Ship-to Name" + SalesHeader."Ship-to Name 2" +
3712 SalesHeader."Ship-to Address" + SalesHeader."Ship-to Address 2" +
3713 SalesHeader."Ship-to Post Code" + SalesHeader."Ship-to City" +
3714 SalesHeader."Ship-to Contact";
3715 IF NameAddressDetails = '' THEN
3716 NameAddressDetails := DropShptNameAddressDetails;
3717 EXIT(NameAddressDetails = DropShptNameAddressDetails);
3718 END;
3719
3720 PROCEDURE AddSpecialOrderToAddress@80(SalesHeader@1000 : Record 36;ShowError@1001 : Boolean);
3721 VAR
3722 PurchLine3@1003 : Record 39;
3723 LocationCode@1004 : Record 14;
3724 BEGIN
3725 IF ShowError THEN BEGIN
3726 PurchLine3.RESET;
3727 PurchLine3.SETRANGE("Document Type","Document Type"::Order);
3728 PurchLine3.SETRANGE("Document No.","No.");
3729 IF NOT PurchLine3.ISEMPTY THEN BEGIN
3730 LocationCode.GET("Location Code");
3731 IF "Ship-to Name" <> LocationCode.Name THEN
3732 ERROR(Text052,FIELDCAPTION("Ship-to Name"),"No.",SalesHeader."No.");
3733 IF "Ship-to Name 2" <> LocationCode."Name 2" THEN
3734 ERROR(Text052,FIELDCAPTION("Ship-to Name 2"),"No.",SalesHeader."No.");
3735 IF "Ship-to Address" <> LocationCode.Address THEN
3736 ERROR(Text052,FIELDCAPTION("Ship-to Address"),"No.",SalesHeader."No.");
3737 IF "Ship-to Address 2" <> LocationCode."Address 2" THEN
3738 ERROR(Text052,FIELDCAPTION("Ship-to Address 2"),"No.",SalesHeader."No.");
3739 IF "Ship-to Post Code" <> LocationCode."Post Code" THEN
3740 ERROR(Text052,FIELDCAPTION("Ship-to Post Code"),"No.",SalesHeader."No.");
3741 IF "Ship-to City" <> LocationCode.City THEN
3742 ERROR(Text052,FIELDCAPTION("Ship-to City"),"No.",SalesHeader."No.");
3743 IF "Ship-to Contact" <> LocationCode.Contact THEN
3744 ERROR(Text052,FIELDCAPTION("Ship-to Contact"),"No.",SalesHeader."No.");
3745 END ELSE
3746 SetShipToForSpecOrder;
3747 END;
3748 END;
3749
3750 PROCEDURE CheckSpecOrderAddressDetails@82(SalesHeader@1000 : Record 36) : Boolean;
3751 VAR
3752 LocationCode@1001 : Record 14;
3753 BEGIN
3754 NameAddressDetails := SpecOrderNameAddressDetails;
3755 IF LocationCode.GET(SalesHeader."Location Code") THEN
3756 SpecOrderNameAddressDetails :=
3757 LocationCode.Name + LocationCode."Name 2" +
3758 LocationCode.Address + LocationCode."Address 2" +
3759 LocationCode."Post Code" + LocationCode.City +
3760 LocationCode.Contact
3761 ELSE BEGIN
3762 CompanyInfo.GET;
3763 SpecOrderNameAddressDetails :=
3764 CompanyInfo."Ship-to Name" + CompanyInfo."Ship-to Name 2" +
3765 CompanyInfo."Ship-to Address" + CompanyInfo."Ship-to Address 2" +
3766 CompanyInfo."Ship-to Post Code" + CompanyInfo."Ship-to City" +
3767 CompanyInfo."Ship-to Contact";
3768 END;
3769 IF NameAddressDetails = '' THEN
3770 NameAddressDetails := SpecOrderNameAddressDetails;
3771 EXIT(NameAddressDetails = SpecOrderNameAddressDetails);
3772 END;
3773
3774 PROCEDURE ZeroAmountInLines@35();
3775 VAR
3776 PurchLine@1001 : Record 39;
3777 BEGIN
3778 PurchLine.SetPurchHeader(PurchHeader);
3779 PurchLine.SETRANGE("Document Type","Document Type");
3780 PurchLine.SETRANGE("Document No.","No.");
3781 PurchLine.SETFILTER(Type,'>0');
3782 PurchLine.SETFILTER(Quantity,'<>0');
3783 IF PurchLine.FINDSET(TRUE) THEN
3784 REPEAT
3785 PurchLine.Amount := 0;
3786 PurchLine."Amount Including VAT" := 0;
3787 PurchLine."VAT Base Amount" := 0;
3788 PurchLine.InitOutstandingAmount;
3789 PurchLine.MODIFY;
3790 UNTIL PurchLine.NEXT = 0;
3791 END;
3792
3793 PROCEDURE "==>>SSI.Upgrade"@1000000000();
3794 BEGIN
3795 END;
3796
3797 PROCEDURE OrderTotalAmountIncVAT@1000000001() rTotal : Decimal;
3798 VAR
3799 lPurchLine@1000000000 : Record 39;
3800 BEGIN
3801 //SSI.UPGRADE >>
3802 lPurchLine.RESET;
3803 lPurchLine.SETRANGE(lPurchLine."Document Type",lPurchLine."Document Type"::Order);
3804 lPurchLine.SETRANGE(lPurchLine."Document No.","No.");
3805 IF lPurchLine.FIND('-') THEN
3806 REPEAT
3807 rTotal += lPurchLine."Amount Including VAT";
3808 UNTIL lPurchLine.NEXT = 0;
3809 //SSI.UPGRADE <<
3810 END;
3811
3812 PROCEDURE OrderTotalAmountReceived@1000000004() rTotal : Decimal;
3813 VAR
3814 lPurchLine@1000000000 : Record 39;
3815 BEGIN
3816 //SSI.UPGRADE >>
3817 lPurchLine.RESET;
3818 lPurchLine.SETRANGE(lPurchLine."Document Type",lPurchLine."Document Type"::Order);
3819 lPurchLine.SETRANGE(lPurchLine."Document No.","No.");
3820 IF lPurchLine.FIND('-') THEN
3821 REPEAT
3822 rTotal += lPurchLine."Amount Including VAT" - lPurchLine."Outstanding Amount";
3823 UNTIL lPurchLine.NEXT = 0;
3824 //SSI.UPGRADE <<
3825 END;
3826
3827 PROCEDURE CheckDuplicateVendorInvNo@1000000002(VendorInvNo@1000000000 : Code[20];VendNo@1000000003 : Code[20];CurrentOne@1000000004 : Code[20]);
3828 VAR
3829 PurchHeaderRec@1000000001 : Record 38;
3830 PurchInvHeaderRec@1000000002 : Record 122;
3831 BEGIN
3832 //SSI.UPGRADE >>
3833 PurchHeaderRec.RESET;
3834 PurchHeaderRec.SETRANGE("Document Type",PurchHeaderRec."Document Type"::Order);
3835 PurchHeaderRec.SETFILTER("No.",'<>%1',CurrentOne);//QSSD07.01.00.88
3836 PurchHeaderRec.SETRANGE("Buy-from Vendor No.",VendNo);
3837 PurchHeaderRec.SETRANGE(PurchHeaderRec."Vendor Invoice No.",VendorInvNo);
3838 IF PurchHeaderRec.FIND('-') THEN
3839 //QSSD07.01.00.88>>
3840 //MESSAGE('Be aware that Vendor Invoice No. ' + VendorInvNo + ' has already been used, at least, in Purchase Order No. ' +
3841 ERROR('Be aware that Vendor Invoice No. ' + VendorInvNo + ' has already been used, at least, in Purchase Order No. ' +
3842 PurchHeaderRec."No."+'.');
3843 //QSSD07.01.00.88<<
3844
3845 PurchHeaderRec.RESET;
3846 PurchHeaderRec.SETRANGE("Document Type",PurchHeaderRec."Document Type"::Invoice);
3847 PurchHeaderRec.SETFILTER("No.",'<>%1',CurrentOne);//QSSD07.01.00.88
3848 PurchHeaderRec.SETRANGE("Buy-from Vendor No.",VendNo);
3849 PurchHeaderRec.SETRANGE(PurchHeaderRec."Vendor Invoice No.",VendorInvNo);
3850 IF PurchHeaderRec.FIND('-') THEN
3851 //QSSD07.01.00.88>>
3852 //MESSAGE('Be aware that Vendor Invoice No. ' + VendorInvNo + ' has already been used, at least, in Purchase Invoice No. ' +
3853 ERROR('Be aware that Vendor Invoice No. ' + VendorInvNo + ' has already been used, at least, in Purchase Invoice No. ' +
3854 PurchHeaderRec."No."+'.');
3855 //QSSD07.01.00.88<<
3856
3857 PurchInvHeaderRec.RESET;
3858 PurchInvHeaderRec.SETRANGE(PurchInvHeaderRec."Vendor Invoice No.",VendorInvNo);
3859 PurchInvHeaderRec.SETRANGE("Buy-from Vendor No.",VendNo);
3860 IF PurchInvHeaderRec.FIND('-') THEN
3861 //QSSD07.01.00.88>>
3862 //MESSAGE('Be aware that Vendor Invoice No. ' +VendorInvNo+ ' has already been used, at least, in Posted Purchase Invoice No. ' +
3863 ERROR('Be aware that Vendor Invoice No. ' +VendorInvNo+ ' has already been used, at least, in Posted Purchase Invoice No. ' +
3864 PurchInvHeaderRec."No."+'.');
3865 //QSSD07.01.00.88<<
3866
3867 //SSI.UPGRADE <<
3868 END;
3869
3870 PROCEDURE InvoiceTotalAmountIncVAT@1000000003() rTotal : Decimal;
3871 VAR
3872 lPurchLine@1000000000 : Record 39;
3873 lTempPurchLine@1000000001 : TEMPORARY Record 39;
3874 lTotalPurchLine@1000000005 : Record 39;
3875 lTotalPurchLineLCY@1000000004 : Record 39;
3876 lPurchPost@1000000003 : Codeunit 90;
3877 lVATAmount@1000000007 : Decimal;
3878 lVATAmountText@1000000006 : Text[30];
3879 lTotalAmount1@1000000008 : Decimal;
3880 lTotalAmount2@1000000002 : Decimal;
3881 BEGIN
3882 //QSSD07.01.20310 >>
3883 {
3884 //SSI.UPGRADE >>
3885 lPurchLine.RESET;
3886 lPurchLine.SETRANGE(lPurchLine."Document Type","Document Type");
3887 lPurchLine.SETRANGE(lPurchLine."Document No.","No.");
3888 IF lPurchLine.FIND('-') THEN
3889 REPEAT
3890 rTotal += lPurchLine."Amount Including VAT";
3891 UNTIL lPurchLine.NEXT = 0;
3892 //SSI.UPGRADE <<
3893 }
3894 CLEAR(lPurchLine);
3895 CLEAR(lTotalPurchLine);
3896 CLEAR(lTotalPurchLineLCY);
3897 CLEAR(lPurchPost);
3898
3899 lPurchPost.GetPurchLines(Rec,lTempPurchLine,0);
3900 CLEAR(lPurchPost);
3901 lPurchPost.SumPurchLinesTemp(
3902 Rec,lTempPurchLine,0,lTotalPurchLine,lTotalPurchLineLCY,lVATAmount,lVATAmountText);
3903
3904 IF Rec."Prices Including VAT" THEN BEGIN
3905 lTotalAmount2 := lTotalPurchLine.Amount;
3906 lTotalAmount1 := lTotalAmount2 + lVATAmount;
3907 lTotalPurchLine."Line Amount" := lTotalAmount1 + lTotalPurchLine."Inv. Discount Amount";
3908 END ELSE BEGIN
3909 lTotalAmount1 := lTotalPurchLine.Amount;
3910 lTotalAmount2 := lTotalPurchLine."Amount Including VAT";
3911 END;
3912 rTotal := lTotalAmount2;
3913 //MESSAGE('Total: ' +FORMAT(rTotal));
3914 //QSSD07.01.20310 <<
3915 END;
3916
3917 PROCEDURE "==fnSSI.Upgrader1"@1000000005();
3918 BEGIN
3919 END;
3920
3921 PROCEDURE CheckCustomer@1000000006();
3922 VAR
3923 lCustomer@1000000000 : Record 18;
3924 BEGIN
3925 IF Rec."Sell-to Customer No." = '' THEN EXIT;
3926 IF (Rec."Document Type" <> "Document Type"::Order) THEN EXIT;
3927
3928 lCustomer.GET(Rec."Sell-to Customer No.");
3929 CASE lCustomer.Blocked OF
3930 lCustomer.Blocked::"On Stop": ERROR(Text50001,FORMAT(lCustomer.Blocked));
3931 lCustomer.Blocked::"Non-Trading": ERROR(Text50001,FORMAT(lCustomer.Blocked));
3932 END;//CASE
3933 END;
3934
3935 PROCEDURE "==SSI.Upgrader2"@1000000007();
3936 BEGIN
3937 END;
3938
3939 PROCEDURE OrderTotalAmountExcVAT@1000000009() rTotal : Decimal;
3940 VAR
3941 lPurchLine@1000000000 : Record 39;
3942 BEGIN
3943 //SSI.UPGRADE >>
3944 lPurchLine.RESET;
3945 lPurchLine.SETRANGE(lPurchLine."Document Type",lPurchLine."Document Type"::Order);
3946 lPurchLine.SETRANGE(lPurchLine."Document No.","No.");
3947 IF lPurchLine.FIND('-') THEN
3948 REPEAT
3949 //rTotal += lPurchLine."Amount Including VAT";
3950 rTotal += lPurchLine."Line Amount";
3951 UNTIL lPurchLine.NEXT = 0;
3952 //SSI.UPGRADE <<
3953 END;
3954
3955 PROCEDURE OrderTotalAmountReceivedExcVat@1000000008() rTotal : Decimal;
3956 VAR
3957 lPurchLine@1000000000 : Record 39;
3958 BEGIN
3959 //SSI.UPGRADE >>
3960 lPurchLine.RESET;
3961 lPurchLine.SETRANGE(lPurchLine."Document Type",lPurchLine."Document Type"::Order);
3962 lPurchLine.SETRANGE(lPurchLine."Document No.","No.");
3963 IF lPurchLine.FIND('-') THEN
3964 REPEAT
3965 //rTotal += lPurchLine."Amount Including VAT" - lPurchLine."Outstanding Amount";
3966 IF lPurchLine.Quantity <> 0 THEN
3967 rTotal += lPurchLine."Line Amount" - (lPurchLine."Line Amount" * lPurchLine."Outstanding Quantity" / lPurchLine.Quantity);
3968 //ELSE
3969 //rTotal += lPurchLine.Amount - (lPurchLine.Amount * lPurchLine."Outstanding Quantity" / lPurchLine.Quantity)
3970 UNTIL lPurchLine.NEXT = 0;
3971 //SSI.UPGRADE <<
3972 END;
3973
3974 PROCEDURE IdentifyUser@1000000010();
3975 BEGIN
3976 //QSSD07.01.01.09>>
3977 IF "Assigned User ID" = '' THEN
3978 "Assigned User ID":=USERID;
3979 //QSSD07.01.01.09<<
3980 END;
3981
3982 PROCEDURE CheckDuplicateVendorCMNo@1000000011(VendorCMNo@1000000000 : Code[20];VendNo@1000000003 : Code[20];CurrentOne@1000000004 : Code[20]);
3983 VAR
3984 PurchHeaderRec@1000000001 : Record 38;
3985 PurchCMHeaderRec@1000000002 : Record 124;
3986 BEGIN
3987 //QSSD07.01.20188
3988 PurchHeaderRec.RESET;
3989 PurchHeaderRec.SETRANGE("Document Type",PurchHeaderRec."Document Type"::"Credit Memo");
3990 PurchHeaderRec.SETFILTER("No.",'<>%1',CurrentOne);
3991 PurchHeaderRec.SETRANGE("Buy-from Vendor No.",VendNo);
3992 PurchHeaderRec.SETRANGE(PurchHeaderRec."Vendor Cr. Memo No.",VendorCMNo);
3993 IF PurchHeaderRec.FIND('-') THEN
3994 ERROR('Be aware that Vendor Cr. Memo No. ' + VendorCMNo + ' has already been used, at least, in Purchase Credit Memo No. ' +
3995 PurchHeaderRec."No."+'.');
3996
3997 PurchCMHeaderRec.RESET;
3998 PurchCMHeaderRec.SETRANGE(PurchCMHeaderRec."Vendor Cr. Memo No.",VendorCMNo);
3999 PurchCMHeaderRec.SETRANGE("Buy-from Vendor No.",VendNo);
4000 IF PurchCMHeaderRec.FIND('-') THEN
4001 ERROR('Be aware that Vendor Cr. Memo No. ' +VendorCMNo+ ' has already been used, at least, in Posted Purchase Credit Memo No. ' +
4002 PurchCMHeaderRec."No."+'.');
4003 END;
4004
4005 BEGIN
4006 {
4007 QSSD Modification History
4008 Version Who Date Description
4009 SSI.Upgrade RS 14/08/2014 Add code within the Buy-from Vendor No. - Onvalidate to run the CheckInsuranceExpired function from Vendor table;
4010 SSI.Upgrade RS 15/08/2014 Add fields 50001..50010 and 50020, brought from old nav.
4011 SSI.Upgrade RS 18/08/2014 Add Offshore/Onshore option field. Add OrderTotalAmountIncVAT and OrderTotalAmountReceived functions.
4012 SSI.Upgrade RS 22/08/2014 Add Direct Ship. Sales Order No. to be populated when the PO is created when releasing a direct shipment Sales Order.
4013 SSI.Upgrade RS 17/09/2014 Create CheckDuplicateVendorInvNo function and run it when validating "Vendor Invoice No." field if document type
4014 is Order or Invoice.
4015 SSI.Upgrade RS 18/09/2014 Add Gross Invoice Amount decimal field and Complete boolean field.
4016 Add InvoiceTotalAmountIncVAT function and code when setting the Complete field, to check
4017 if the Gross Invoice Amount and the Amount Incl. VAT from the Statistics page are the same; Error if not.
4018 SSI.Upgrade RS 26/09/2014 Add Production Order No. field, to be used when creating Purchase Orders from Released Production Orders.
4019 SSI.Upgrade RS 29/09/2014 Add code within the Payment Terms code OnValidate, from old nav related to Payment discounts
4020 SSI.Upgrade RS 16/10/2014 Add Fixed Exchange Rate field(QSSD06.00.00.38)
4021 SSI.Upgrade SEP 17/10/2014 Added new fields
4022 SSI.Upgrade SEP 18/10/2014 Added Purchase Order No.
4023 SSI.Upgrader2 RS 28/10/2014 Add OrderTotalAmountExcVAT and OrderTotalAmountReceivedExcVAT functions to show them within the Purchase Order card
4024 and List, instead the IncVat functions.
4025 SSI.Upgrade SEP 27/11/2014 Added Net Invoice amount
4026 QSSD07.01.00.02r2 CR 23/01/2015 Added Attachment No.
4027 QSSD07.01.00.02r3 SEP 11/03/2015 Added Invoice Approval Status.
4028 QSSD07.01.00.88 DD 21/03/2015 Amend CheckDuplicateVendorInvNo to include current "Purchase Header" and show an error message.
4029 QSSD07.01.01.09 DD 19/06/2015 Function was created to save the user who has created a Purchase Order or modified it
4030 QSSD07.01.01.22 SEP 29/07/2015 Added new field "CSS Back Charge Order" for use on Orders only.
4031 QSSD07.01.01.25 RS 05/08/2015 Added code on the oninsert section to set Transaction Nature Code and Transport Method with some default values.
4032 QSSD07.01.01.28 RS 17/08/2015 Add SO On Hold boolean field.
4033 QSSD07.01.01.28 RS 24/08/2015 Add Date On Hold and Date Off Hold fields.
4034 Add code to the SO On Hold / VALIDATE to set the Date On Hold and the Date Off Hold when unticking it manually.
4035 QSSD07.01.00.22r1 SEP 18/09/2015 Added new fields as per version.
4036 QSSD07.01.01.37 RS 07/10/2015 Add code within the Currency Code-OnValidate to ensure the Currency Code being validated is not Blocked.
4037 QSSD07.01.01.59 SEP 22/01/2016 Added additional option to the "Invoice Approval Status" field.
4038 QSSD07.01.19045 RS 24/02/2016 Add SSI Sales Order No. new field to be populated when creating the PO from the Sales Order subform\Create SSI Purchase Order.
4039 QSSD07.01.01.59 SEP 06/04/2016 Added new fields for the BCT export file as per version - for the PO header.
4040 QSSD07.01.19620 CR 11/05/2016 Approve By Date made editable for USer Setup record with "Amend/Post Purch. Invoice" = TRUE
4041 QSSD07.01.20310 RS 06/06/2016 Amend InvoiceTotalAmountIncVAT for it to calculate the amount in exactly the same way as the Statistics page does as
4042 there were rounding issues.
4043 QSSD07.01.20364 SEP 13/06/2016 Code added to OnValidate."Purchase Order No." to populate DimSetId and GD1 and GD2. InProgress
4044 QSSD07.01.19619 RS 20/06/2016 EXP: Add Expenses fields. Add "Expense Type" as key and code
4045 QSSD07.01.20188 CR 27/06/2016 New field for report 50052 SAP Information
4046 New Function CheckDuplicateVendorCMNo
4047 QSSD07.01.20330 RS 01/07/2016 Amend code so that Document Date is not populated with Posting Date when this is changed on Purchase Invoices.
4048 QSSD07.01.20364 RS 11/07/2016 Fix code added by Sarah to OnValidate."Purchase Order No." to populate DimSetId and Header dimensions.
4049 QSSD07.01.19619-T001 GJF 13/07/2016 Add code missing from EXP as basis for code was not the latest version
4050 qSSD07.01.20876 SEP 04/08/2016 REmoved code OnValidate Invoice Approval Status to allow users to manually set the invoice to BCT Approved or BDT Rejected.
4051 QSSD07.01.19619-T001 CR 16/08/2016 New field Receipt Available
4052
4053 //DOC OP9496 NM 23/11/2016 Added option "BCT Update Rejected Invoice" to field "Invoice Approval Status"
4054
4055 //IN31678 BW 30/11/2016 Added Autofill of Project Manager.
4056
4057 //IN36000 NP 09/03/2017 Invoice Creation Date field added, with date assignment in OnInsert()
4058 //DOC IN36649 MCI 27/03/2017 - Change in modification IN31678 to get Project Manager
4059 //DOC OP9678 DB 28/03/2017 - Added "Job No." field. Added CreateDim2 function and amended InitDefaultDim.
4060 //DOC OP10181 DB 03/04/2017 - Added fields "Created Date", "Created By", "Purchase Invoice Assigned To". Initializing the first two on OnInsert.
4061 //DOC OP9679 JF 09/05/2017 - Update purchase lines dimensions.
4062 //DOC OP11639 JF 28/02/2018 - New field "Credit Note Date".
4063 //DOC OP12061 APL 04/04/2018 - New Field SMO No
4064
4065 //DOC OP13008 APL 03/05/2018 - Stop exchnage rate alteration if job attached
4066 //DOC OP12712 DS 11/05/2018 - Added logic to OnValidate trigger of Exported field
4067 //DOC 120058 EK 01/03/2019 - Code change to allow Complete only when 'Invoice Approval Status' = "BCT UK PM Approved" or "BCT Approved"
4068 }
4069 END.
4070 }
4071}