Skip to content

Table 39 "Purchase Line" - new Event on field 5794 "Planned Receipt Date" #30103

@DanielSmutek

Description

@DanielSmutek

Why do you need this change?

We need this event for implementing of customer funkcionality

Describe the request

    field(5794; "Planned Receipt Date"; Date)
    {
        AccessByPermission = TableData "Order Promising Line" = R;
        Caption = 'Planned Receipt Date';

        trigger OnValidate()
        var
            CustomCalendarChange: array[2] of Record "Customized Calendar Change";
            IsHandled: Boolean;
        begin
            IsHandled := false;
            OnBeforeValidatePlannedReceiptDate(Rec, xRec, CurrFieldNo, TrackingBlocked, IsHandled);
            if IsHandled then
                exit;

            if "Promised Receipt Date" <> 0D then begin
                if "Planned Receipt Date" <> 0D then begin
                    CustomCalendarChange[1].SetSource(CalChange."Source Type"::Location, "Location Code", '', '');
                    "Expected Receipt Date" :=
                      CalendarMgmt.CalcDateBOC(InternalLeadTimeDays("Planned Receipt Date"), "Planned Receipt Date", CustomCalendarChange, false)
                end else
                    "Expected Receipt Date" := "Planned Receipt Date";
            end else
                if "Planned Receipt Date" <> 0D then begin
                    CustomCalendarChange[1].SetSource(CalChange."Source Type"::Vendor, "Buy-from Vendor No.", '', '');
                    CustomCalendarChange[2].SetSource(CalChange."Source Type"::Location, "Location Code", '', '');
                    UpdateOrderDateFromPlannedReceiptDate(CustomCalendarChange);
                    CustomCalendarChange[1].SetSource(CalChange."Source Type"::Location, "Location Code", '', '');
                    "Expected Receipt Date" :=
                      CalendarMgmt.CalcDateBOC(InternalLeadTimeDays("Planned Receipt Date"), "Planned Receipt Date", CustomCalendarChange, false)
                end else
                    if "Requested Receipt Date" <> 0D then
                        Validate("Requested Receipt Date")
                    else
                        GetUpdateBasicDates();
            NEW EVENT >>
            IsHandled := false;
            OnValidatePlannedReceiptDateBeforePurchLineCheck(Rec, xRec, IsHandled);
            if not IsHandled then
            NEW EVENT <<
            if not TrackingBlocked then
                CheckDateConflict.PurchLineCheck(Rec, CurrFieldNo <> 0);
        end;
    }

NEW EVENT >>
[IntegrationEvent(false, false)]
local procedure OnValidatePlannedReceiptDateBeforePurchLineCheck(var PurchaseLine: Record "Purchase Line"; xPurchaseLine: Record "Purchase Line"; var IsHandled: Boolean)
begin
end;
NEW EVENT >>

Metadata

Metadata

Assignees

No one assigned

    Labels

    missing-infoThe issue misses information that prevents it from completion.

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions