Codeunit 90 (Purch.-Post) |
Scroll |
The following additions have been made to Codeunit 90 (Purch.-Post) for archiving in Thereforeā¢ when posting purchase orders.
Function onRun()
//-TF
recPerm.GET( recPerm."Object Type"::Codeunit, CODEUNIT::"Pre-Post Functions" );
IF( recPerm."Execute Permission" = recPerm."Execute Permission"::Yes ) THEN BEGIN
IF Receive THEN
IF ("Document Type" = "Document Type"::Order) OR
(("Document Type" = "Document Type"::Invoice) AND PurchSetup."Receipt on Invoice")
THEN
cTFPostFunctions.AddDocumentToQueue(
cTFPostFunctions.GetTableID( PurchRcptHeader.TABLENAME() ), // Tablename
PurchRcptHeader."No.", // Document No.
PurchRcptHeader."Posting Date", // Posting Date
0, // Entry No.
0, // Document Type
'', // Identification ID
PurchRcptHeader."Business Case" // Business Case
);
IF Ship THEN
IF ("Document Type" = "Document Type"::"Return Order") OR
(("Document Type" = "Document Type"::"Credit Memo") AND PurchSetup."Return Shipment on Credit Memo")
THEN
cTFPostFunctions.AddDocumentToQueue(
cTFPostFunctions.GetTableID( ReturnShptHeader.TABLENAME() ), // Tablename
ReturnShptHeader."No.", // Document No.
ReturnShptHeader."Posting Date", // Posting Date
0, // Entry No.
0, // Document Type
'', // Identification ID
ReturnShptHeader."Business Case" // Business Case
);
IF Invoice THEN
IF "Document Type" IN ["Document Type"::Order,"Document Type"::Invoice] THEN BEGIN
cTFPostFunctions.AddDocumentToQueue(
cTFPostFunctions.GetTableID( PurchInvHeader.TABLENAME() ), // Tablename
PurchInvHeader."No.", // Document No.
PurchInvHeader."Posting Date", // Posting Date
0, // Entry No.
0, // Document Type
'', // Identification ID
PurchInvHeader."Business Case" // Business Case
);
cTFPostFunctions.CheckDocumentInQueue(
cTFPostFunctions.GetTableID( PurchInvHeader.TABLENAME() ), // Tablename
PurchInvHeader."No.", // Document No.
PurchInvHeader."Posting Date", // Posting Date
0, // Entry No.
0, // Document Type
'', // Identification ID
PurchInvHeader."Business Case", // Business Case
"No." // Temp. Document No. for Queue
);
END ELSE BEGIN
cTFPostFunctions.AddDocumentToQueue(
cTFPostFunctions.GetTableID( PurchCrMemoHeader.TABLENAME() ), // Tablename
PurchCrMemoHeader."No.", // Document No.
PurchCrMemoHeader."Posting Date", // Posting Date
0, // Entry No.
0, // Document Type
'', // Identification ID
PurchCrMemoHeader."Business Case" // Business Case
);
END;
END;
//+TF
Figure 6: Codeunit 90 (Purch.-Post) C/AL Thereforeā¢ additions (part 1)
Figure 7: Codeunit 90 (Purch.-Post) C/AL Thereforeā¢ additions (part 2)