microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
770 stars 610 forks source link

[Event Request] Codeunit 442 - "Sales-Post Prepayments" - OnCodeOnAfterBuildInvLineBuffer #14210

Closed chliebich closed 3 years ago

chliebich commented 3 years ago

Please add the event OnCodeOnAfterBuildInvLineBuffer in Codeunit 442:

[...]

  // Create Lines
  TempPrepmtInvLineBuffer.DeleteAll();
  CalcVATAmountLines(SalesHeader, SalesLine, TempVATAmountLine, DocumentType);
  TempVATAmountLine.DeductVATAmountLine(TempVATAmountLineDeduct);
  UpdateVATOnLines(SalesHeader, SalesLine, TempVATAmountLine, DocumentType);
  BuildInvLineBuffer(SalesHeader, SalesLine, DocumentType, TempPrepmtInvLineBuffer, true);
+ OnCodeOnAfterBuildInvLineBuffer(TempVATAmountLine, TempPrepmtInvLineBuffer);
  TempPrepmtInvLineBuffer.Find('-');
  repeat
      LineCount := LineCount + 1;
      Window.Update(2, LineCount);
      if TempPrepmtInvLineBuffer."Line No." <> 0 then
          LineNo := PrevLineNo + TempPrepmtInvLineBuffer."Line No."
      else
          LineNo := PrevLineNo + 10000;
      case DocumentType of
          DocumentType::Invoice:
              begin
                  InsertSalesInvLine(SalesInvHeader, LineNo, TempPrepmtInvLineBuffer, SalesHeader);
                  PostedDocTabNo := DATABASE::"Sales Invoice Line";
              end;
          DocumentType::"Credit Memo":
              begin
                  InsertSalesCrMemoLine(SalesCrMemoHeader, LineNo, TempPrepmtInvLineBuffer, SalesHeader);
                  PostedDocTabNo := DATABASE::"Sales Cr.Memo Line";
              end;
      end;
      PrevLineNo := LineNo;
      InsertExtendedText(
        PostedDocTabNo, GenJnlLineDocNo, TempPrepmtInvLineBuffer."G/L Account No.", "Document Date", "Language Code", PrevLineNo);
  until TempPrepmtInvLineBuffer.Next() = 0;

  if "Compress Prepayment" then
      case DocumentType of
          DocumentType::Invoice:
              CopyLineCommentLinesCompressedPrepayment("No.", DATABASE::"Sales Invoice Header", SalesInvHeader."No.");
          DocumentType::"Credit Memo":
              CopyLineCommentLinesCompressedPrepayment("No.", DATABASE::"Sales Cr.Memo Header", SalesCrMemoHeader."No.");
      end;

  OnAfterCreateLinesOnBeforeGLPosting(SalesHeader, SalesInvHeader, SalesCrMemoHeader, TempPrepmtInvLineBuffer, DocumentType, LineNo);

  // G/L Posting

[...]

New integration event:

[IntegrationEvent(false, false)]
local procedure OnCodeOnAfterBuildInvLineBuffer(var TempVATAmountLine: Record "VAT Amount Line" temporary; var TempPrepmtInvLineBuffer: Record "Prepayment Inv. Line Buffer" temporary)
begin
end;    
JesperSchulz commented 3 years ago

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.