Skip to content

[Event Request] Table 846 "Cash Flow Worksheet Line" #29342

@LorenzoSartori-NBT

Description

@LorenzoSartori-NBT

Why do you need this change?

Hello,
I need two new events in the CalculateForPostedDocuments procedure. This is required for a migration I am performing from NAV to Business Central.
The addition of these events would allow for the re-implementation of this logic as an extension in Business Central.
In our previous NAV environment, the following customization was present in the code:
LOCAL PROCEDURE CalculateForPostedDocuments@4(CashFlowForecast@1000000000 : Record 840);
VAR
CFDiscountDate@1002 : Date;
CheckCrMemo@1003 : Boolean;
BEGIN
CASE "Document Type" OF
"Document Type"::Invoice:
CheckCrMemo := FALSE;
"Document Type"::"Credit Memo":
CheckCrMemo := TRUE;
ELSE
//>FIN.32-001
BEGIN
IF "Substitute Date" <> 0D THEN
"Document Date" := "Original Document Date";
//<FIN.32-001
EXIT;
END; //FIN.32-001
END;

  IF NOT CashFlowForecast."Consider Discount" THEN
    //>FIN.32-001
    IF "Substitute Date" <> 0D THEN
      "Document Date" := "Original Document Date";
    //<FIN.32-001
    EXIT;

  IF CashFlowForecast."Consider Pmt. Disc. Tol. Date" THEN
    CFDiscountDate := "Pmt. Disc. Tolerance Date"
  ELSE
    CFDiscountDate := "Pmt. Discount Date";

  IF CFDiscountDate <> 0D THEN BEGIN
    IF CFDiscountDate >= WORKDATE THEN BEGIN
      "Cash Flow Date" := CFDiscountDate;
      "Amount (LCY)" := "Amount (LCY)" - "Payment Discount";
    END ELSE
      "Payment Discount" := 0;
    EXIT;
  END;
END;

Describe the request

I would therefore need these two events as shown in the example below:

local procedure CalculateForPostedDocuments(CashFlowForecast: Record "Cash Flow Forecast")
var
CFDiscountDate: Date;
CheckCrMemo: Boolean;
begin
case "Document Type" of
"Document Type"::Invoice:
CheckCrMemo := false;
"Document Type"::"Credit Memo":
CheckCrMemo := true;
else begin
OnCalculateForPostedDocumentsOnCheckDocumentType(Rec);
exit;
end;
end;

    if not CashFlowForecast."Consider Discount" then begin
        OnCheckCashFlowForecastConsiderDiscount(Rec);
        exit;
    end;

    if CashFlowForecast."Consider Pmt. Disc. Tol. Date" then
        CFDiscountDate := "Pmt. Disc. Tolerance Date"
    else
        CFDiscountDate := "Pmt. Discount Date";

    if CFDiscountDate <> 0D then begin
        if CFDiscountDate >= WorkDate() then begin
            "Cash Flow Date" := CFDiscountDate;
            "Amount (LCY)" := "Amount (LCY)" - "Payment Discount";
        end else
            "Payment Discount" := 0;
        exit;
    end;
end;

[IntegrationEvent(false, false)]
local procedure OnCalculateForPostedDocumentsOnCheckDocumentType(var CashFlowWorksheetLine: Record "Cash Flow Worksheet Line")
begin
end;

[IntegrationEvent(false, false)]
local procedure OnCheckCashFlowForecastConsiderDiscount(var CashFlowWorksheetLine: Record "Cash Flow Worksheet Line")
begin
end;

Internal work item: AB#611660

Metadata

Metadata

Assignees

No one assigned

    Labels

    FinanceGitHub request for Finance areaevent-requestRequest for adding an eventships-in-future-updateFix ships in a future update

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions