Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new Events in TableData Payments Terms #27865

Open
camadorsummar opened this issue Dec 30, 2024 · 0 comments
Open

Add new Events in TableData Payments Terms #27865

camadorsummar opened this issue Dec 30, 2024 · 0 comments
Labels
event-request Request for adding an event Finance GitHub request for Finance area

Comments

@camadorsummar
Copy link

camadorsummar commented Dec 30, 2024

Describe the request

Hello,

Would it be possible to include an event in each of the following functions?

Thank you.

procedure CalculateMaxDueDate(BaseDate: Date): Date    
    //
    var
     CalculatedDate: Date;
     IsHandled: Boolean;
    //
    begin        
        //        
        OnBeforeCalculateMaxDueDate(Rec,BaseDate,CalculatedDate,IsHandle);
        if IsHandle then
          exit(CalculatedDate);
        //
        if "Max. No. of Days till Due Date" = 0 then
            exit(99991231D);
        exit(CalcDate(StrSubstNo('<%1D>', "Max. No. of Days till Due Date"), BaseDate));
    end;

    procedure VerifyMaxNoDaysTillDueDate(DueDate: Date; DocumentDate: Date; MessageFieldCaption: Text[50])
    //
    var
     IsHandled: Boolean;
    //
    begin
        //
        OnBeforeVerifyMaxNoDaysTillDueDate(Rec,DueDate,DocumentDate,MessageFieldCaption,IsHandle);
        if IsHandle then
          exit;
        //
        if (DueDate <> 0D) and ("Max. No. of Days till Due Date" > 0) then
            if DueDate - DocumentDate > "Max. No. of Days till Due Date" then
                Error(Text10700, MessageFieldCaption, FieldCaption("Max. No. of Days till Due Date"), TableCaption);
    end;

    //
    IntegrationEvent(false, false)]
    local procedure     OnBeforeCalculateMaxDueDate(PaymentTerms: Record "Payment Terms";BaseDate:Date;var CalculatedDate:Date; var IsHandle:boolean)
      begin
      end;

    [IntegrationEvent(false, false)]
    local procedure     OnBeforeVerifyMaxNoDaysTillDueDate(PaymentTerms: Record "Payment Terms";DueDate:Date; DocumentDate:Date; MessageFieldCaption: Text[50]; var IsHandle:boolean)
      begin
     end;
     //

Additional context

My client needs to be able to calculate these two functions in a fully customised way. And since they are called from many points of the application I consider that my best option is these two events.
Internal work item: AB#561473

@JesperSchulz JesperSchulz added event-request Request for adding an event Finance GitHub request for Finance area labels Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event-request Request for adding an event Finance GitHub request for Finance area
Projects
None yet
Development

No branches or pull requests

2 participants