Codeunit 80 (Sales-Post) |
Scroll |
The following additions have been made to Codeunit 80 (Sales-Post) for archiving in Thereforeā¢ when posting sales 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 Ship THEN
IF ("Document Type" = "Document Type"::Order) OR
(("Document Type" = "Document Type"::Invoice) AND SalesSetup."Shipment on Invoice")
THEN
cTFPostFunctions.AddDocumentToQueue(
cTFPostFunctions.GetTableID( SalesShptHeader.TABLENAME() ), // Tablename
SalesShptHeader."No.", // Document No.
SalesShptHeader."Posting Date", // Posting Date
0, // Entry No.
0, // Document Type
'', // Identification ID
SalesShptHeader."Business Case" // Business Case
);
IF Receive THEN
IF ("Document Type" = "Document Type"::"Return Order") OR
(("Document Type" = "Document Type"::"Credit Memo") AND SalesSetup."Return Receipt on Credit Memo")
THEN
cTFPostFunctions.AddDocumentToQueue(
cTFPostFunctions.GetTableID( ReturnRcptHeader.TABLENAME() ), // Tablename
ReturnRcptHeader."No.", // Document No.
ReturnRcptHeader."Posting Date", // Posting Date
0, // Entry No.
0, // Document Type
'', // Identification ID
ReturnRcptHeader."Business Case" // Business Case
);
IF Invoice THEN
IF "Document Type" IN ["Document Type"::Order,"Document Type"::Invoice] THEN BEGIN
cTFPostFunctions.AddDocumentToQueue(
cTFPostFunctions.GetTableID( SalesInvHeader.TABLENAME() ), // Tablename
SalesInvHeader."No.", // Document No.
SalesInvHeader."Posting Date", // Posting Date
0, // Entry No.
0, // Document Type
'', // Identification ID
SalesInvHeader."Business Case" // Business Case
);
END ELSE BEGIN
cTFPostFunctions.AddDocumentToQueue(
cTFPostFunctions.GetTableID( SalesCrMemoHeader.TABLENAME() ), // Tablename
SalesCrMemoHeader."No.", // Document No.
SalesCrMemoHeader."Posting Date", // Posting Date
0, // Entry No.
0, // Document Type
'', // Identification ID
SalesCrMemoHeader."Business Case" // Business Case
);
END;
END;
//+TF
Figure 4: Codeunit 80 (Sales-Post) C/AL Thereforeā¢ additions (part 1)
Figure 5: Codeunit 80 (Sales Post) C/AL Thereforeā¢ additions (part 2)