microsoft / ALAppExtensions

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

[Event Request] Table 5878 Phys. Invt. Record Line - Procedure ShowUsedTrackLines - OnBeforeRunPhysInvtTrackingLinesOnShowUsedTrackLines #26919

Closed MH1612 closed 1 month ago

MH1612 commented 1 month ago

Describe the request

Please add the following Event/-s OnBeforeRunPhysInvtTrackingLinesOnShowUsedTrackLines to Procedure ShowUsedTrackLines in Table 5878 Phys. Invt. Record Line.

[Event Request] Table 5878 Phys. Invt. Record Line - Procedure ShowUsedTrackLines
    procedure ShowUsedTrackLines()
    var
        PhysInvtOrderHeader: Record "Phys. Invt. Order Header";
        ItemLedgEntry: Record "Item Ledger Entry";
        WhseEntry: Record "Warehouse Entry";
        TempPhysInvtTracking: Record "Phys. Invt. Tracking" temporary;
        PhysInvtTrackingLines: Page "Phys. Invt. Tracking Lines";
        IsHandled: Boolean;
    begin
        IsHandled := false;
        OnBeforeShowUsedTrackLines(Rec, CurrFieldNo, IsHandled);
        if IsHandled then
            exit;

        GetItem();

        TempPhysInvtTracking.Reset();
        TempPhysInvtTracking.DeleteAll();

        PhysInvtOrderHeader.Get("Order No.");

        if PhysInvtTrackingMgt.LocationIsBinMandatory("Location Code") and
           PhysInvtTrackingMgt.GetTrackingNosFromWhse(Item)
        then begin
            WhseEntry.Reset();
            WhseEntry.SetCurrentKey("Location Code", "Bin Code", "Item No.", "Variant Code");
            WhseEntry.SetRange("Location Code", "Location Code");
            WhseEntry.SetRange("Bin Code", "Bin Code");
            WhseEntry.SetRange("Item No.", "Item No.");
            WhseEntry.SetRange("Variant Code", "Variant Code");
            WhseEntry.SetRange("Registering Date", 0D, PhysInvtOrderHeader."Posting Date");
            OnShowUsedTrackLinesSetWhseEntryFilters(WhseEntry, Rec);
            if WhseEntry.Find('-') then
                repeat
                    OnBeforeInsertTrackingBufferLocationIsBinMandatory(WhseEntry, Rec);
                    InsertTrackingBuffer(
                      TempPhysInvtTracking, WhseEntry."Serial No.", WhseEntry."Lot No.", WhseEntry."Qty. (Base)");
                    OnShowUsedTrackLinesOnAfterInsertFromWhseEntry(TempPhysInvtTracking, WhseEntry);
                until WhseEntry.Next() = 0;
        end else begin
            ItemLedgEntry.SetItemVariantLocationFilters(
              "Item No.", "Variant Code", "Location Code", PhysInvtOrderHeader."Posting Date");
            OnShowUsedTrackLinesSetItemLedgerEntryFilters(ItemLedgEntry, Rec, TempPhysInvtTracking);
            if ItemLedgEntry.Find('-') then
                repeat
                    InsertTrackingBuffer(
                      TempPhysInvtTracking, ItemLedgEntry."Serial No.", ItemLedgEntry."Lot No.", ItemLedgEntry.Quantity);
                    OnShowUsedTrackLinesOnAfterInsertFromItemLedgEntry(TempPhysInvtTracking, ItemLedgEntry);
                until ItemLedgEntry.Next() = 0;
        end;

      // NEW
      IsHandled := FALSE;
      OnBeforeRunPhysInvtTrackingLinesOnShowUsedTrackLines(Rec,TempPhysInvtTracking,IsHandled);
     IF NOT IsHandled THEN
      // NEW  
      if TempPhysInvtTracking.FindFirst() then begin
            PhysInvtTrackingLines.SetRecord(TempPhysInvtTracking);
            PhysInvtTrackingLines.SetSources(TempPhysInvtTracking);
            PhysInvtTrackingLines.LookupMode(true);
            if PhysInvtTrackingLines.RunModal() = ACTION::LookupOK then begin
                PhysInvtTrackingLines.GetRecord(TempPhysInvtTracking);
                Validate("Serial No.", TempPhysInvtTracking."Serial No.");
                Validate("Lot No.", TempPhysInvtTracking."Lot No");
                OnShowUsedTrackLinesOnAfterLookupOK(Rec, TempPhysInvtTracking);
            end;
        end;
    end;
 [IntegrationEvent(false, false)]
 local procedure OnBeforeRunPhysInvtTrackingLinesOnShowUsedTrackLines(var PhysInvtRecordLine: Record "Phys. Invt. Record Line"; var TempPhysInvtTracking: Record "Phys. Invt. Tracking" temporary; var IsHandled : Boolean)
    begin
    end;

Additional context

Show an Own Window Internal work item: AB#542999

azure-boards[bot] commented 1 month ago

✅ Successfully linked to Azure Boards work item(s):

AleksandricMarko commented 1 month ago

Hello @MH1612 Part of the procedure where you request event is surrounded with "IF NOT CLEAN 24" tags We are not adding new events for the code which is deprecated. Please check if something else can help with your need and make new request