diff --git a/src/Layers/APAC/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al b/src/Layers/APAC/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al index 4302a209ae..a376339e0f 100644 --- a/src/Layers/APAC/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al +++ b/src/Layers/APAC/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al @@ -2754,17 +2754,21 @@ codeunit 22 "Item Jnl.-Post Line" var CalcUnitCost: Boolean; IsHandled: Boolean; + ShouldCalculateCostPerUnit: Boolean; begin OnBeforeCalcCostPerUnitForPositiveValuedQty(ItemJournalLine, ValueEntry, IsHandled); if IsHandled then exit; - if (ValueEntry."Valued Quantity" > 0) and + ShouldCalculateCostPerUnit := + (ValueEntry."Valued Quantity" > 0) and (ValueEntry."Item Ledger Entry Type" in [ValueEntry."Item Ledger Entry Type"::Purchase, ValueEntry."Item Ledger Entry Type"::"Assembly Output"]) and (ValueEntry."Entry Type" = ValueEntry."Entry Type"::"Direct Cost") and - not ItemJnlLine.Adjustment - then begin + not ItemJnlLine.Adjustment; + OnCalcCostPerUnitForPositiveValuedQtyOnBeforeCheckShouldCalculateCostPerUnit(ValueEntry, ItemJournalLine, ShouldCalculateCostPerUnit); + + if ShouldCalculateCostPerUnit then begin if Item."Costing Method" = Item."Costing Method"::Standard then ItemJnlLine."Unit Cost" := ValueEntry."Cost per Unit"; CalcPosShares( @@ -8879,5 +8883,10 @@ codeunit 22 "Item Jnl.-Post Line" local procedure OnBeforeCalcCostPerUnitForPositiveValuedQty(var ItemJournalLine: Record "Item Journal Line"; var ValueEntry: Record "Value Entry"; var IsHandled: Boolean) begin end; + + [IntegrationEvent(false, false)] + local procedure OnCalcCostPerUnitForPositiveValuedQtyOnBeforeCheckShouldCalculateCostPerUnit(ValueEntry: Record "Value Entry"; ItemJournalLine: Record "Item Journal Line"; var ShouldCalculateCostPerUnit: Boolean) + begin + end; } diff --git a/src/Layers/APAC/BaseApp/Sales/Posting/SalesPost.Codeunit.al b/src/Layers/APAC/BaseApp/Sales/Posting/SalesPost.Codeunit.al index f196687bca..6ab2505247 100644 --- a/src/Layers/APAC/BaseApp/Sales/Posting/SalesPost.Codeunit.al +++ b/src/Layers/APAC/BaseApp/Sales/Posting/SalesPost.Codeunit.al @@ -5383,6 +5383,7 @@ codeunit 80 "Sales-Post" TempPrepmtSalesLine."Prepayment %" := TempSalesLine."Prepayment %"; OnBeforeTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Modify(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader); FillPrepmtLineNoBuf(TempSalesLine."Line No.", TempPrepmtSalesLine."Line No."); end else begin TempPrepmtSalesLine.Init(); @@ -5433,6 +5434,7 @@ codeunit 80 "Sales-Post" end; OnBeforeTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Insert(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader); IsHandled := false; OnBeforeCreatePrepaymentTextLines(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality, IsHandled); @@ -12697,6 +12699,16 @@ codeunit 80 "Sales-Post" begin end; + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + /// /// Raised before inserting temporary line for extended text during create prepayment lines. /// diff --git a/src/Layers/BE/BaseApp/Sales/Posting/SalesPost.Codeunit.al b/src/Layers/BE/BaseApp/Sales/Posting/SalesPost.Codeunit.al index 0d34bd616a..aa4b3d59ce 100644 --- a/src/Layers/BE/BaseApp/Sales/Posting/SalesPost.Codeunit.al +++ b/src/Layers/BE/BaseApp/Sales/Posting/SalesPost.Codeunit.al @@ -5315,6 +5315,7 @@ codeunit 80 "Sales-Post" TempPrepmtSalesLine."Prepayment %" := TempSalesLine."Prepayment %"; OnBeforeTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Modify(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader); end else begin TempPrepmtSalesLine.Init(); TempPrepmtSalesLine."Document Type" := SalesHeader."Document Type"; @@ -5347,6 +5348,7 @@ codeunit 80 "Sales-Post" NextLineNo := NextLineNo + 10000; OnBeforeTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Insert(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader); IsHandled := false; OnBeforeCreatePrepaymentTextLines(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality, IsHandled); @@ -12381,6 +12383,16 @@ codeunit 80 "Sales-Post" begin end; + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + /// /// Raised before inserting temporary line for extended text during create prepayment lines. /// diff --git a/src/Layers/CH/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al b/src/Layers/CH/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al index cc5905f866..aca9f8217c 100644 --- a/src/Layers/CH/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al +++ b/src/Layers/CH/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al @@ -2744,17 +2744,21 @@ codeunit 22 "Item Jnl.-Post Line" var CalcUnitCost: Boolean; IsHandled: Boolean; + ShouldCalculateCostPerUnit: Boolean; begin OnBeforeCalcCostPerUnitForPositiveValuedQty(ItemJournalLine, ValueEntry, IsHandled); if IsHandled then exit; - if (ValueEntry."Valued Quantity" > 0) and + ShouldCalculateCostPerUnit := + (ValueEntry."Valued Quantity" > 0) and (ValueEntry."Item Ledger Entry Type" in [ValueEntry."Item Ledger Entry Type"::Purchase, ValueEntry."Item Ledger Entry Type"::"Assembly Output"]) and (ValueEntry."Entry Type" = ValueEntry."Entry Type"::"Direct Cost") and - not ItemJnlLine.Adjustment - then begin + not ItemJnlLine.Adjustment; + OnCalcCostPerUnitForPositiveValuedQtyOnBeforeCheckShouldCalculateCostPerUnit(ValueEntry, ItemJournalLine, ShouldCalculateCostPerUnit); + + if ShouldCalculateCostPerUnit then begin if Item."Costing Method" = Item."Costing Method"::Standard then ItemJnlLine."Unit Cost" := ValueEntry."Cost per Unit"; CalcPosShares( @@ -8850,5 +8854,10 @@ codeunit 22 "Item Jnl.-Post Line" local procedure OnBeforeCalcCostPerUnitForPositiveValuedQty(var ItemJournalLine: Record "Item Journal Line"; var ValueEntry: Record "Value Entry"; var IsHandled: Boolean) begin end; + + [IntegrationEvent(false, false)] + local procedure OnCalcCostPerUnitForPositiveValuedQtyOnBeforeCheckShouldCalculateCostPerUnit(ValueEntry: Record "Value Entry"; ItemJournalLine: Record "Item Journal Line"; var ShouldCalculateCostPerUnit: Boolean) + begin + end; } diff --git a/src/Layers/CH/BaseApp/Sales/Posting/SalesPost.Codeunit.al b/src/Layers/CH/BaseApp/Sales/Posting/SalesPost.Codeunit.al index f0068a2da4..6ddf062de1 100644 --- a/src/Layers/CH/BaseApp/Sales/Posting/SalesPost.Codeunit.al +++ b/src/Layers/CH/BaseApp/Sales/Posting/SalesPost.Codeunit.al @@ -5309,6 +5309,7 @@ codeunit 80 "Sales-Post" TempPrepmtSalesLine."Prepayment %" := TempSalesLine."Prepayment %"; OnBeforeTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Modify(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader); end else begin TempPrepmtSalesLine.Init(); TempPrepmtSalesLine."Document Type" := SalesHeader."Document Type"; @@ -5341,6 +5342,7 @@ codeunit 80 "Sales-Post" NextLineNo := NextLineNo + 10000; OnBeforeTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Insert(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader); IsHandled := false; OnBeforeCreatePrepaymentTextLines(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality, IsHandled); @@ -12454,6 +12456,16 @@ codeunit 80 "Sales-Post" begin end; + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + /// /// Raised before inserting temporary line for extended text during create prepayment lines. /// diff --git a/src/Layers/ES/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al b/src/Layers/ES/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al index e7eda4fa2f..c6008d0d17 100644 --- a/src/Layers/ES/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al +++ b/src/Layers/ES/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al @@ -2753,17 +2753,21 @@ codeunit 22 "Item Jnl.-Post Line" var CalcUnitCost: Boolean; IsHandled: Boolean; + ShouldCalculateCostPerUnit: Boolean; begin OnBeforeCalcCostPerUnitForPositiveValuedQty(ItemJournalLine, ValueEntry, IsHandled); if IsHandled then exit; - if (ValueEntry."Valued Quantity" > 0) and + ShouldCalculateCostPerUnit := + (ValueEntry."Valued Quantity" > 0) and (ValueEntry."Item Ledger Entry Type" in [ValueEntry."Item Ledger Entry Type"::Purchase, ValueEntry."Item Ledger Entry Type"::"Assembly Output"]) and (ValueEntry."Entry Type" = ValueEntry."Entry Type"::"Direct Cost") and - not ItemJnlLine.Adjustment - then begin + not ItemJnlLine.Adjustment; + OnCalcCostPerUnitForPositiveValuedQtyOnBeforeCheckShouldCalculateCostPerUnit(ValueEntry, ItemJournalLine, ShouldCalculateCostPerUnit); + + if ShouldCalculateCostPerUnit then begin if Item."Costing Method" = Item."Costing Method"::Standard then ItemJnlLine."Unit Cost" := ValueEntry."Cost per Unit"; CalcPosShares( @@ -8860,5 +8864,10 @@ codeunit 22 "Item Jnl.-Post Line" local procedure OnBeforeCalcCostPerUnitForPositiveValuedQty(var ItemJournalLine: Record "Item Journal Line"; var ValueEntry: Record "Value Entry"; var IsHandled: Boolean) begin end; + + [IntegrationEvent(false, false)] + local procedure OnCalcCostPerUnitForPositiveValuedQtyOnBeforeCheckShouldCalculateCostPerUnit(ValueEntry: Record "Value Entry"; ItemJournalLine: Record "Item Journal Line"; var ShouldCalculateCostPerUnit: Boolean) + begin + end; } diff --git a/src/Layers/ES/BaseApp/Sales/Posting/SalesPost.Codeunit.al b/src/Layers/ES/BaseApp/Sales/Posting/SalesPost.Codeunit.al index c5b092b47e..cd0404c76c 100644 --- a/src/Layers/ES/BaseApp/Sales/Posting/SalesPost.Codeunit.al +++ b/src/Layers/ES/BaseApp/Sales/Posting/SalesPost.Codeunit.al @@ -5359,6 +5359,7 @@ codeunit 80 "Sales-Post" TempPrepmtSalesLine."Prepayment %" := TempSalesLine."Prepayment %"; OnBeforeTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Modify(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader); end else begin TempPrepmtSalesLine.Init(); TempPrepmtSalesLine."Document Type" := SalesHeader."Document Type"; @@ -5391,6 +5392,7 @@ codeunit 80 "Sales-Post" NextLineNo := NextLineNo + 10000; OnBeforeTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Insert(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader); IsHandled := false; OnBeforeCreatePrepaymentTextLines(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality, IsHandled); @@ -12501,6 +12503,16 @@ codeunit 80 "Sales-Post" begin end; + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + /// /// Raised before inserting temporary line for extended text during create prepayment lines. /// diff --git a/src/Layers/FI/BaseApp/Sales/Posting/SalesPost.Codeunit.al b/src/Layers/FI/BaseApp/Sales/Posting/SalesPost.Codeunit.al index 25b6c0b55a..78ace5b55b 100644 --- a/src/Layers/FI/BaseApp/Sales/Posting/SalesPost.Codeunit.al +++ b/src/Layers/FI/BaseApp/Sales/Posting/SalesPost.Codeunit.al @@ -5275,6 +5275,7 @@ codeunit 80 "Sales-Post" TempPrepmtSalesLine."Prepayment %" := TempSalesLine."Prepayment %"; OnBeforeTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Modify(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader); end else begin TempPrepmtSalesLine.Init(); TempPrepmtSalesLine."Document Type" := SalesHeader."Document Type"; @@ -5307,6 +5308,7 @@ codeunit 80 "Sales-Post" NextLineNo := NextLineNo + 10000; OnBeforeTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Insert(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader); IsHandled := false; OnBeforeCreatePrepaymentTextLines(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality, IsHandled); @@ -12350,6 +12352,16 @@ codeunit 80 "Sales-Post" begin end; + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + /// /// Raised before inserting temporary line for extended text during create prepayment lines. /// diff --git a/src/Layers/FR/BaseApp/Sales/Posting/SalesPost.Codeunit.al b/src/Layers/FR/BaseApp/Sales/Posting/SalesPost.Codeunit.al index 308d529cc7..c5fec4cb51 100644 --- a/src/Layers/FR/BaseApp/Sales/Posting/SalesPost.Codeunit.al +++ b/src/Layers/FR/BaseApp/Sales/Posting/SalesPost.Codeunit.al @@ -5274,6 +5274,7 @@ codeunit 80 "Sales-Post" TempPrepmtSalesLine."Prepayment %" := TempSalesLine."Prepayment %"; OnBeforeTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Modify(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader); end else begin TempPrepmtSalesLine.Init(); TempPrepmtSalesLine."Document Type" := SalesHeader."Document Type"; @@ -5306,6 +5307,7 @@ codeunit 80 "Sales-Post" NextLineNo := NextLineNo + 10000; OnBeforeTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Insert(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader); IsHandled := false; OnBeforeCreatePrepaymentTextLines(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality, IsHandled); @@ -12374,6 +12376,16 @@ codeunit 80 "Sales-Post" begin end; + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + /// /// Raised before inserting temporary line for extended text during create prepayment lines. /// diff --git a/src/Layers/GB/BaseApp/Sales/Posting/SalesPost.Codeunit.al b/src/Layers/GB/BaseApp/Sales/Posting/SalesPost.Codeunit.al index cc655fb21a..eb6a806581 100644 --- a/src/Layers/GB/BaseApp/Sales/Posting/SalesPost.Codeunit.al +++ b/src/Layers/GB/BaseApp/Sales/Posting/SalesPost.Codeunit.al @@ -5306,6 +5306,7 @@ codeunit 80 "Sales-Post" TempPrepmtSalesLine."Prepayment %" := TempSalesLine."Prepayment %"; OnBeforeTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Modify(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader); end else begin TempPrepmtSalesLine.Init(); TempPrepmtSalesLine."Document Type" := SalesHeader."Document Type"; @@ -5338,6 +5339,7 @@ codeunit 80 "Sales-Post" NextLineNo := NextLineNo + 10000; OnBeforeTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Insert(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader); IsHandled := false; OnBeforeCreatePrepaymentTextLines(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality, IsHandled); @@ -12409,6 +12411,16 @@ codeunit 80 "Sales-Post" begin end; + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + /// /// Raised before inserting temporary line for extended text during create prepayment lines. /// diff --git a/src/Layers/IT/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al b/src/Layers/IT/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al index 367f70b51a..45f928eb21 100644 --- a/src/Layers/IT/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al +++ b/src/Layers/IT/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al @@ -2771,17 +2771,21 @@ codeunit 22 "Item Jnl.-Post Line" var CalcUnitCost: Boolean; IsHandled: Boolean; + ShouldCalculateCostPerUnit: Boolean; begin OnBeforeCalcCostPerUnitForPositiveValuedQty(ItemJournalLine, ValueEntry, IsHandled); if IsHandled then exit; - if (ValueEntry."Valued Quantity" > 0) and + ShouldCalculateCostPerUnit := + (ValueEntry."Valued Quantity" > 0) and (ValueEntry."Item Ledger Entry Type" in [ValueEntry."Item Ledger Entry Type"::Purchase, ValueEntry."Item Ledger Entry Type"::"Assembly Output"]) and (ValueEntry."Entry Type" = ValueEntry."Entry Type"::"Direct Cost") and - not ItemJnlLine.Adjustment - then begin + not ItemJnlLine.Adjustment; + OnCalcCostPerUnitForPositiveValuedQtyOnBeforeCheckShouldCalculateCostPerUnit(ValueEntry, ItemJournalLine, ShouldCalculateCostPerUnit); + + if ShouldCalculateCostPerUnit then begin if Item."Costing Method" = Item."Costing Method"::Standard then ItemJnlLine."Unit Cost" := ValueEntry."Cost per Unit"; CalcPosShares( @@ -8877,5 +8881,10 @@ codeunit 22 "Item Jnl.-Post Line" local procedure OnBeforeCalcCostPerUnitForPositiveValuedQty(var ItemJournalLine: Record "Item Journal Line"; var ValueEntry: Record "Value Entry"; var IsHandled: Boolean) begin end; + + [IntegrationEvent(false, false)] + local procedure OnCalcCostPerUnitForPositiveValuedQtyOnBeforeCheckShouldCalculateCostPerUnit(ValueEntry: Record "Value Entry"; ItemJournalLine: Record "Item Journal Line"; var ShouldCalculateCostPerUnit: Boolean) + begin + end; } diff --git a/src/Layers/IT/BaseApp/Inventory/Requisition/ReqWkshMakeOrder.Codeunit.al b/src/Layers/IT/BaseApp/Inventory/Requisition/ReqWkshMakeOrder.Codeunit.al index 0547702f1d..3e49b67b17 100644 --- a/src/Layers/IT/BaseApp/Inventory/Requisition/ReqWkshMakeOrder.Codeunit.al +++ b/src/Layers/IT/BaseApp/Inventory/Requisition/ReqWkshMakeOrder.Codeunit.al @@ -529,6 +529,8 @@ codeunit 333 "Req. Wksh.-Make Order" TempFailedReqLine, TempDocumentEntry); ReqWkshMakeOrders.SetSuppressCommit(SuppressCommit); + + OnTryCarryOutReqLineActionOnBeforeRun(ReqLine); if ReqWkshMakeOrders.Run(ReqLine) then begin ReqWkshMakeOrders.GetTryParam( PurchOrderHeader, @@ -539,6 +541,7 @@ codeunit 333 "Req. Wksh.-Make Order" PrevLocationCode, OrderCounter, OrderLineCounter); + OnTryCarryOutReqLineActionOnAfterGetTryParam(ReqLine, PurchOrderHeader, LineCount, NextLineNo, PrevPurchCode, PrevShipToCode, PrevLocationCode, OrderCounter, OrderLineCounter); if PrintPurchOrders and PlanningResiliency then if PurchOrderHeader."No." <> '' then @@ -1844,6 +1847,16 @@ codeunit 333 "Req. Wksh.-Make Order" begin end; + [IntegrationEvent(false, false)] + local procedure OnTryCarryOutReqLineActionOnBeforeRun(var RequisitionLine: Record "Requisition Line") + begin + end; + + [IntegrationEvent(false, false)] + local procedure OnTryCarryOutReqLineActionOnAfterGetTryParam(var RequisitionLine: Record "Requisition Line"; var PurchaseHeader: Record "Purchase Header"; var LineCount: Integer; var NextLineNo: Integer; var PrevPurchCode: Code[10]; var PrevShipToCode: Code[10]; var PrevLocationCode: Code[10]; var OrderCounter: Integer; var OrderLineCounter: Integer) + begin + end; + [IntegrationEvent(false, false)] local procedure OnBeforeCheckLocation(var RequisitionLine: Record "Requisition Line"; var IsHandled: Boolean) begin diff --git a/src/Layers/IT/BaseApp/Sales/Posting/SalesPost.Codeunit.al b/src/Layers/IT/BaseApp/Sales/Posting/SalesPost.Codeunit.al index bfaf67c53f..ca64053497 100644 --- a/src/Layers/IT/BaseApp/Sales/Posting/SalesPost.Codeunit.al +++ b/src/Layers/IT/BaseApp/Sales/Posting/SalesPost.Codeunit.al @@ -5320,6 +5320,7 @@ codeunit 80 "Sales-Post" TempPrepmtSalesLine."Prepayment %" := TempSalesLine."Prepayment %"; OnBeforeTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Modify(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader); end else begin TempPrepmtSalesLine.Init(); TempPrepmtSalesLine."Document Type" := SalesHeader."Document Type"; @@ -5353,6 +5354,7 @@ codeunit 80 "Sales-Post" NextLineNo := NextLineNo + 10000; OnBeforeTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Insert(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader); IsHandled := false; OnBeforeCreatePrepaymentTextLines(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality, IsHandled); @@ -12547,6 +12549,16 @@ codeunit 80 "Sales-Post" begin end; + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + /// /// Raised before inserting temporary line for extended text during create prepayment lines. /// diff --git a/src/Layers/NA/BaseApp/Inventory/Requisition/ReqWkshMakeOrder.Codeunit.al b/src/Layers/NA/BaseApp/Inventory/Requisition/ReqWkshMakeOrder.Codeunit.al index 809630e541..38017b9168 100644 --- a/src/Layers/NA/BaseApp/Inventory/Requisition/ReqWkshMakeOrder.Codeunit.al +++ b/src/Layers/NA/BaseApp/Inventory/Requisition/ReqWkshMakeOrder.Codeunit.al @@ -541,6 +541,8 @@ codeunit 333 "Req. Wksh.-Make Order" TempFailedReqLine, TempDocumentEntry); ReqWkshMakeOrders.SetSuppressCommit(SuppressCommit); + + OnTryCarryOutReqLineActionOnBeforeRun(ReqLine); if ReqWkshMakeOrders.Run(ReqLine) then begin ReqWkshMakeOrders.GetTryParam( PurchOrderHeader, @@ -551,6 +553,7 @@ codeunit 333 "Req. Wksh.-Make Order" PrevLocationCode, OrderCounter, OrderLineCounter); + OnTryCarryOutReqLineActionOnAfterGetTryParam(ReqLine, PurchOrderHeader, LineCount, NextLineNo, PrevPurchCode, PrevShipToCode, PrevLocationCode, OrderCounter, OrderLineCounter); if PrintPurchOrders and PlanningResiliency then if PurchOrderHeader."No." <> '' then @@ -1884,6 +1887,16 @@ codeunit 333 "Req. Wksh.-Make Order" begin end; + [IntegrationEvent(false, false)] + local procedure OnTryCarryOutReqLineActionOnBeforeRun(var RequisitionLine: Record "Requisition Line") + begin + end; + + [IntegrationEvent(false, false)] + local procedure OnTryCarryOutReqLineActionOnAfterGetTryParam(var RequisitionLine: Record "Requisition Line"; var PurchaseHeader: Record "Purchase Header"; var LineCount: Integer; var NextLineNo: Integer; var PrevPurchCode: Code[10]; var PrevShipToCode: Code[10]; var PrevLocationCode: Code[10]; var OrderCounter: Integer; var OrderLineCounter: Integer) + begin + end; + [IntegrationEvent(false, false)] local procedure OnBeforeCheckLocation(var RequisitionLine: Record "Requisition Line"; var IsHandled: Boolean) begin diff --git a/src/Layers/NA/BaseApp/Sales/Posting/SalesPost.Codeunit.al b/src/Layers/NA/BaseApp/Sales/Posting/SalesPost.Codeunit.al index 3c28de547e..da140175de 100644 --- a/src/Layers/NA/BaseApp/Sales/Posting/SalesPost.Codeunit.al +++ b/src/Layers/NA/BaseApp/Sales/Posting/SalesPost.Codeunit.al @@ -5433,6 +5433,7 @@ codeunit 80 "Sales-Post" TempPrepmtSalesLine."Prepayment %" := TempSalesLine."Prepayment %"; OnBeforeTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Modify(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader); end else begin TempPrepmtSalesLine.Init(); TempPrepmtSalesLine."Document Type" := SalesHeader."Document Type"; @@ -5471,6 +5472,7 @@ codeunit 80 "Sales-Post" NextLineNo := NextLineNo + 10000; OnBeforeTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Insert(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader); IsHandled := false; OnBeforeCreatePrepaymentTextLines(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality, IsHandled); @@ -12880,6 +12882,16 @@ codeunit 80 "Sales-Post" begin end; + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + /// /// Raised before inserting temporary line for extended text during create prepayment lines. /// diff --git a/src/Layers/NO/BaseApp/Sales/Posting/SalesPost.Codeunit.al b/src/Layers/NO/BaseApp/Sales/Posting/SalesPost.Codeunit.al index c3bf617cf7..140c6c28c3 100644 --- a/src/Layers/NO/BaseApp/Sales/Posting/SalesPost.Codeunit.al +++ b/src/Layers/NO/BaseApp/Sales/Posting/SalesPost.Codeunit.al @@ -5281,6 +5281,7 @@ codeunit 80 "Sales-Post" TempPrepmtSalesLine."Prepayment %" := TempSalesLine."Prepayment %"; OnBeforeTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Modify(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader); end else begin TempPrepmtSalesLine.Init(); TempPrepmtSalesLine."Document Type" := SalesHeader."Document Type"; @@ -5313,6 +5314,7 @@ codeunit 80 "Sales-Post" NextLineNo := NextLineNo + 10000; OnBeforeTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Insert(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader); IsHandled := false; OnBeforeCreatePrepaymentTextLines(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality, IsHandled); @@ -12349,6 +12351,16 @@ codeunit 80 "Sales-Post" begin end; + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + /// /// Raised before inserting temporary line for extended text during create prepayment lines. /// diff --git a/src/Layers/RU/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al b/src/Layers/RU/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al index dcd14584c0..66682c6e17 100644 --- a/src/Layers/RU/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al +++ b/src/Layers/RU/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al @@ -2767,17 +2767,21 @@ codeunit 22 "Item Jnl.-Post Line" var CalcUnitCost: Boolean; IsHandled: Boolean; + ShouldCalculateCostPerUnit: Boolean; begin OnBeforeCalcCostPerUnitForPositiveValuedQty(ItemJournalLine, ValueEntry, IsHandled); if IsHandled then exit; - if (ValueEntry."Valued Quantity" > 0) and + ShouldCalculateCostPerUnit := + (ValueEntry."Valued Quantity" > 0) and (ValueEntry."Item Ledger Entry Type" in [ValueEntry."Item Ledger Entry Type"::Purchase, ValueEntry."Item Ledger Entry Type"::"Assembly Output"]) and (ValueEntry."Entry Type" = ValueEntry."Entry Type"::"Direct Cost") and - not ItemJnlLine.Adjustment - then begin + not ItemJnlLine.Adjustment; + OnCalcCostPerUnitForPositiveValuedQtyOnBeforeCheckShouldCalculateCostPerUnit(ValueEntry, ItemJournalLine, ShouldCalculateCostPerUnit); + + if ShouldCalculateCostPerUnit then begin if Item."Costing Method" = Item."Costing Method"::Standard then ItemJnlLine."Unit Cost" := ValueEntry."Cost per Unit"; CalcPosShares( @@ -9195,5 +9199,10 @@ codeunit 22 "Item Jnl.-Post Line" local procedure OnBeforeCalcCostPerUnitForPositiveValuedQty(var ItemJournalLine: Record "Item Journal Line"; var ValueEntry: Record "Value Entry"; var IsHandled: Boolean) begin end; + + [IntegrationEvent(false, false)] + local procedure OnCalcCostPerUnitForPositiveValuedQtyOnBeforeCheckShouldCalculateCostPerUnit(ValueEntry: Record "Value Entry"; ItemJournalLine: Record "Item Journal Line"; var ShouldCalculateCostPerUnit: Boolean) + begin + end; } diff --git a/src/Layers/RU/BaseApp/Sales/Posting/SalesPost.Codeunit.al b/src/Layers/RU/BaseApp/Sales/Posting/SalesPost.Codeunit.al index 61d9dddcc1..c5befb1e2b 100644 --- a/src/Layers/RU/BaseApp/Sales/Posting/SalesPost.Codeunit.al +++ b/src/Layers/RU/BaseApp/Sales/Posting/SalesPost.Codeunit.al @@ -5386,6 +5386,7 @@ codeunit 80 "Sales-Post" TempPrepmtSalesLine."Prepayment %" := TempSalesLine."Prepayment %"; OnBeforeTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Modify(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader); end else begin TempPrepmtSalesLine.Init(); TempPrepmtSalesLine."Document Type" := SalesHeader."Document Type"; @@ -5418,6 +5419,7 @@ codeunit 80 "Sales-Post" NextLineNo := NextLineNo + 10000; OnBeforeTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Insert(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader); IsHandled := false; OnBeforeCreatePrepaymentTextLines(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality, IsHandled); @@ -13074,6 +13076,16 @@ codeunit 80 "Sales-Post" begin end; + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + /// /// Raised before inserting temporary line for extended text during create prepayment lines. /// diff --git a/src/Layers/W1/BaseApp/Assembly/Document/AssemblyLineManagement.Codeunit.al b/src/Layers/W1/BaseApp/Assembly/Document/AssemblyLineManagement.Codeunit.al index 22edc066d4..e45db3aac5 100644 --- a/src/Layers/W1/BaseApp/Assembly/Document/AssemblyLineManagement.Codeunit.al +++ b/src/Layers/W1/BaseApp/Assembly/Document/AssemblyLineManagement.Codeunit.al @@ -638,6 +638,10 @@ codeunit 905 "Assembly Line Management" CopyInventoriableItemAsmLines(TempAssemblyLine2, TempAssemblyLine); AvailToPromise(TempAssemblyHeader, TempAssemblyLine2, QtyAvailToMake, EarliestAvailableDateX); QtyAvailTooLow := QtyAvailToMake < TempAssemblyHeader."Remaining Quantity"; + IsHandled := false; + OnShowAvailabilityOnAfterCalcQtyAvailTooLow(TempAssemblyHeader, TempAssemblyLine, ShowPageEvenIfEnoughComponentsAvailable, QtyAvailToMake, EarliestAvailableDateX, QtyAvailTooLow, Rollback, IsHandled); + if IsHandled then + exit(Rollback); if QtyAvailTooLow and not ShowPageEvenIfEnoughComponentsAvailable then Rollback := CreateAndSendNotification(TempAssemblyHeader, TempAssemblyLine) @@ -1013,6 +1017,11 @@ codeunit 905 "Assembly Line Management" begin end; + [IntegrationEvent(false, false)] + local procedure OnShowAvailabilityOnAfterCalcQtyAvailTooLow(var TempAssemblyHeader: Record "Assembly Header" temporary; var TempAssemblyLine: Record "Assembly Line" temporary; ShowPageEvenIfEnoughComponentsAvailable: Boolean; QtyAvailToMake: Decimal; EarliestAvailableDate: Date; var QtyAvailTooLow: Boolean; var RollBack: Boolean; var IsHandled: Boolean) + begin + end; + [IntegrationEvent(false, false)] local procedure OnBeforeUpdateAssemblyLines(var AsmHeader: Record "Assembly Header"; OldAsmHeader: Record "Assembly Header"; FieldNum: Integer; ReplaceLinesFromBOM: Boolean; CurrFieldNo: Integer; CurrentFieldNum: Integer; var IsHandled: Boolean; HideValidationDialog: Boolean) begin diff --git a/src/Layers/W1/BaseApp/Assembly/Inventory/Tracking/AsmGetDemandToReserve.Codeunit.al b/src/Layers/W1/BaseApp/Assembly/Inventory/Tracking/AsmGetDemandToReserve.Codeunit.al index 36a010e918..834e297173 100644 --- a/src/Layers/W1/BaseApp/Assembly/Inventory/Tracking/AsmGetDemandToReserve.Codeunit.al +++ b/src/Layers/W1/BaseApp/Assembly/Inventory/Tracking/AsmGetDemandToReserve.Codeunit.al @@ -143,6 +143,7 @@ codeunit 929 "Asm. Get Demand To Reserve" ReservationWkshLine: Record "Reservation Wksh. Line"; TempAssemblyLine: Record "Assembly Line" temporary; ReservationWorksheetMgt: Codeunit "Reservation Worksheet Mgt."; + DoInsertReservationWkshLine: Boolean; RemainingQty, RemainingQtyBase : Decimal; AvailableQtyBase, InventoryQtyBase, ReservedQtyBase, WarehouseQtyBase : Decimal; LineNo: Integer; @@ -199,11 +200,20 @@ codeunit 929 "Asm. Get Demand To Reserve" if (ReservationWkshLine."Remaining Qty. to Reserve" > 0) and (ReservationWkshLine."Available Qty. to Reserve" > 0) - then - ReservationWkshLine.Insert(true); + then begin + DoInsertReservationWkshLine := true; + OnSyncAssemblyOrderLinesOnBeforeInsertReservationWkshLine(ReservationWkshLine, TempAssemblyLine, DoInsertReservationWkshLine); + if DoInsertReservationWkshLine then + ReservationWkshLine.Insert(true); + end; until TempAssemblyLine.Next() = 0; end; + [IntegrationEvent(false, false)] + local procedure OnSyncAssemblyOrderLinesOnBeforeInsertReservationWkshLine(var ReservationWkshLine: Record "Reservation Wksh. Line"; var TempAssemblyLine: Record "Assembly Line" temporary; var DoInsertReservationWkshLine: Boolean) + begin + end; + #if not CLEAN27 [Obsolete('This event is never raised.', '27.0')] [IntegrationEvent(false, false)] diff --git a/src/Layers/W1/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al b/src/Layers/W1/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al index 3ec23a8f0d..0f7219d25f 100644 --- a/src/Layers/W1/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al +++ b/src/Layers/W1/BaseApp/Inventory/Posting/ItemJnlPostLine.Codeunit.al @@ -2740,17 +2740,21 @@ codeunit 22 "Item Jnl.-Post Line" var CalcUnitCost: Boolean; IsHandled: Boolean; + ShouldCalculateCostPerUnit: Boolean; begin OnBeforeCalcCostPerUnitForPositiveValuedQty(ItemJournalLine, ValueEntry, IsHandled); if IsHandled then exit; - if (ValueEntry."Valued Quantity" > 0) and + ShouldCalculateCostPerUnit := + (ValueEntry."Valued Quantity" > 0) and (ValueEntry."Item Ledger Entry Type" in [ValueEntry."Item Ledger Entry Type"::Purchase, ValueEntry."Item Ledger Entry Type"::"Assembly Output"]) and (ValueEntry."Entry Type" = ValueEntry."Entry Type"::"Direct Cost") and - not ItemJnlLine.Adjustment - then begin + not ItemJnlLine.Adjustment; + OnCalcCostPerUnitForPositiveValuedQtyOnBeforeCheckShouldCalculateCostPerUnit(ValueEntry, ItemJournalLine, ShouldCalculateCostPerUnit); + + if ShouldCalculateCostPerUnit then begin if Item."Costing Method" = Item."Costing Method"::Standard then ItemJnlLine."Unit Cost" := ValueEntry."Cost per Unit"; CalcPosShares( @@ -8846,5 +8850,10 @@ codeunit 22 "Item Jnl.-Post Line" local procedure OnBeforeCalcCostPerUnitForPositiveValuedQty(var ItemJournalLine: Record "Item Journal Line"; var ValueEntry: Record "Value Entry"; var IsHandled: Boolean) begin end; + + [IntegrationEvent(false, false)] + local procedure OnCalcCostPerUnitForPositiveValuedQtyOnBeforeCheckShouldCalculateCostPerUnit(ValueEntry: Record "Value Entry"; ItemJournalLine: Record "Item Journal Line"; var ShouldCalculateCostPerUnit: Boolean) + begin + end; } diff --git a/src/Layers/W1/BaseApp/Inventory/Requisition/ReqWkshMakeOrder.Codeunit.al b/src/Layers/W1/BaseApp/Inventory/Requisition/ReqWkshMakeOrder.Codeunit.al index 3d8b0e803f..b18256d23f 100644 --- a/src/Layers/W1/BaseApp/Inventory/Requisition/ReqWkshMakeOrder.Codeunit.al +++ b/src/Layers/W1/BaseApp/Inventory/Requisition/ReqWkshMakeOrder.Codeunit.al @@ -526,6 +526,8 @@ codeunit 333 "Req. Wksh.-Make Order" TempFailedReqLine, TempDocumentEntry); ReqWkshMakeOrders.SetSuppressCommit(SuppressCommit); + + OnTryCarryOutReqLineActionOnBeforeRun(ReqLine); if ReqWkshMakeOrders.Run(ReqLine) then begin ReqWkshMakeOrders.GetTryParam( PurchOrderHeader, @@ -536,6 +538,7 @@ codeunit 333 "Req. Wksh.-Make Order" PrevLocationCode, OrderCounter, OrderLineCounter); + OnTryCarryOutReqLineActionOnAfterGetTryParam(ReqLine, PurchOrderHeader, LineCount, NextLineNo, PrevPurchCode, PrevShipToCode, PrevLocationCode, OrderCounter, OrderLineCounter); if PrintPurchOrders and PlanningResiliency then if PurchOrderHeader."No." <> '' then @@ -1829,6 +1832,16 @@ codeunit 333 "Req. Wksh.-Make Order" begin end; + [IntegrationEvent(false, false)] + local procedure OnTryCarryOutReqLineActionOnBeforeRun(var RequisitionLine: Record "Requisition Line") + begin + end; + + [IntegrationEvent(false, false)] + local procedure OnTryCarryOutReqLineActionOnAfterGetTryParam(var RequisitionLine: Record "Requisition Line"; var PurchaseHeader: Record "Purchase Header"; var LineCount: Integer; var NextLineNo: Integer; var PrevPurchCode: Code[10]; var PrevShipToCode: Code[10]; var PrevLocationCode: Code[10]; var OrderCounter: Integer; var OrderLineCounter: Integer) + begin + end; + [IntegrationEvent(false, false)] local procedure OnBeforeCheckLocation(var RequisitionLine: Record "Requisition Line"; var IsHandled: Boolean) begin diff --git a/src/Layers/W1/BaseApp/Inventory/UndoPostingManagement.Codeunit.al b/src/Layers/W1/BaseApp/Inventory/UndoPostingManagement.Codeunit.al index e292e79926..9a8963a6d6 100644 --- a/src/Layers/W1/BaseApp/Inventory/UndoPostingManagement.Codeunit.al +++ b/src/Layers/W1/BaseApp/Inventory/UndoPostingManagement.Codeunit.al @@ -708,7 +708,13 @@ codeunit 5817 "Undo Posting Management" procedure CollectItemLedgEntries(var TempItemLedgEntry: Record "Item Ledger Entry" temporary; SourceType: Integer; DocumentNo: Code[20]; LineNo: Integer; BaseQty: Decimal; EntryRef: Integer) var ItemLedgEntry: Record "Item Ledger Entry"; + IsHandled: Boolean; begin + IsHandled := false; + OnBeforeCollectItemLedgEntries(TempItemLedgEntry, SourceType, DocumentNo, LineNo, BaseQty, EntryRef, IsHandled); + if IsHandled then + exit; + TempItemLedgEntry.Reset(); if not TempItemLedgEntry.IsEmpty() then TempItemLedgEntry.DeleteAll(); @@ -1293,6 +1299,11 @@ codeunit 5817 "Undo Posting Management" begin end; + [IntegrationEvent(false, false)] + local procedure OnBeforeCollectItemLedgEntries(var TempItemLedgEntry: Record "Item Ledger Entry" temporary; SourceType: Integer; DocumentNo: Code[20]; LineNo: Integer; BaseQty: Decimal; EntryReference: Integer; var IsHandled: Boolean) + begin + end; + [IntegrationEvent(false, false)] local procedure OnBeforeCheckMissingItemLedgers(var TempItemLedgEntry: Record "Item Ledger Entry" temporary; SourceType: Integer; DocumentNo: Code[20]; LineNo: Integer; BaseQty: Decimal; var IsHandled: Boolean) begin diff --git a/src/Layers/W1/BaseApp/Manufacturing/Inventory/Tracking/MfgGetDemandToReserve.Codeunit.al b/src/Layers/W1/BaseApp/Manufacturing/Inventory/Tracking/MfgGetDemandToReserve.Codeunit.al index 28d846ec0e..81cbef6619 100644 --- a/src/Layers/W1/BaseApp/Manufacturing/Inventory/Tracking/MfgGetDemandToReserve.Codeunit.al +++ b/src/Layers/W1/BaseApp/Manufacturing/Inventory/Tracking/MfgGetDemandToReserve.Codeunit.al @@ -142,6 +142,7 @@ codeunit 99000858 "Mfg. Get Demand To Reserve" ReservationWkshLine: Record "Reservation Wksh. Line"; TempProdOrderComponent: Record "Prod. Order Component" temporary; ReservationWorksheetMgt: Codeunit "Reservation Worksheet Mgt."; + DoInsertReservationWkshLine: Boolean; RemainingQty, RemainingQtyBase : Decimal; AvailableQtyBase, InventoryQtyBase, ReservedQtyBase, WarehouseQtyBase : Decimal; LineNo: Integer; @@ -199,11 +200,20 @@ codeunit 99000858 "Mfg. Get Demand To Reserve" if (ReservationWkshLine."Remaining Qty. to Reserve" > 0) and (ReservationWkshLine."Available Qty. to Reserve" > 0) - then - ReservationWkshLine.Insert(true); + then begin + DoInsertReservationWkshLine := true; + OnSyncProdOrderComponentsOnBeforeInsertReservationWkshLine(ReservationWkshLine, TempProdOrderComponent, DoInsertReservationWkshLine); + if DoInsertReservationWkshLine then + ReservationWkshLine.Insert(true); + end; until TempProdOrderComponent.Next() = 0; end; + [IntegrationEvent(false, false)] + local procedure OnSyncProdOrderComponentsOnBeforeInsertReservationWkshLine(var ReservationWkshLine: Record "Reservation Wksh. Line"; var TempProdOrderComponent: Record "Prod. Order Component" temporary; var DoInsertReservationWkshLine: Boolean) + begin + end; + #if not CLEAN27 [Obsolete('This event is never raised.', '27.0')] [IntegrationEvent(false, false)] diff --git a/src/Layers/W1/BaseApp/Projects/Project/Planning/JobPlanningLineGetDemand.Codeunit.al b/src/Layers/W1/BaseApp/Projects/Project/Planning/JobPlanningLineGetDemand.Codeunit.al index 4e24ca480f..008904177d 100644 --- a/src/Layers/W1/BaseApp/Projects/Project/Planning/JobPlanningLineGetDemand.Codeunit.al +++ b/src/Layers/W1/BaseApp/Projects/Project/Planning/JobPlanningLineGetDemand.Codeunit.al @@ -144,6 +144,7 @@ codeunit 99000847 "Job Planning Line Get Demand" Job: Record Job; Customer: Record Customer; ReservationWorksheetMgt: Codeunit "Reservation Worksheet Mgt."; + DoInsertReservationWkshLine: Boolean; RemainingQty, RemainingQtyBase : Decimal; AvailableQtyBase, InventoryQtyBase, ReservedQtyBase, WarehouseQtyBase : Decimal; LineNo: Integer; @@ -207,11 +208,20 @@ codeunit 99000847 "Job Planning Line Get Demand" if (ReservationWkshLine."Remaining Qty. to Reserve" > 0) and (ReservationWkshLine."Available Qty. to Reserve" > 0) - then - ReservationWkshLine.Insert(true); + then begin + DoInsertReservationWkshLine := true; + OnSyncJobPlanningLinesOnBeforeInsertReservationWkshLine(ReservationWkshLine, TempJobPlanningLine, DoInsertReservationWkshLine); + if DoInsertReservationWkshLine then + ReservationWkshLine.Insert(true); + end; until TempJobPlanningLine.Next() = 0; end; + [IntegrationEvent(false, false)] + local procedure OnSyncJobPlanningLinesOnBeforeInsertReservationWkshLine(var ReservationWkshLine: Record "Reservation Wksh. Line"; var TempJobPlanningLine: Record "Job Planning Line" temporary; var DoInsertReservationWkshLine: Boolean) + begin + end; + #if not CLEAN27 [Obsolete('This event is never raised.', '27.0')] [IntegrationEvent(false, false)] diff --git a/src/Layers/W1/BaseApp/Sales/Posting/SalesPost.Codeunit.al b/src/Layers/W1/BaseApp/Sales/Posting/SalesPost.Codeunit.al index e42ff7fbd3..7e94ee8fe4 100644 --- a/src/Layers/W1/BaseApp/Sales/Posting/SalesPost.Codeunit.al +++ b/src/Layers/W1/BaseApp/Sales/Posting/SalesPost.Codeunit.al @@ -5274,6 +5274,7 @@ codeunit 80 "Sales-Post" TempPrepmtSalesLine."Prepayment %" := TempSalesLine."Prepayment %"; OnBeforeTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Modify(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(TempPrepmtSalesLine, TempSalesLine, SalesHeader); end else begin TempPrepmtSalesLine.Init(); TempPrepmtSalesLine."Document Type" := SalesHeader."Document Type"; @@ -5306,6 +5307,7 @@ codeunit 80 "Sales-Post" NextLineNo := NextLineNo + 10000; OnBeforeTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality); TempPrepmtSalesLine.Insert(); + OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(TempPrepmtSalesLine, TempSalesLine, SalesHeader); IsHandled := false; OnBeforeCreatePrepaymentTextLines(TempPrepmtSalesLine, TempSalesLine, SalesHeader, CompleteFunctionality, IsHandled); @@ -12340,6 +12342,16 @@ codeunit 80 "Sales-Post" begin end; + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineModify(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + + [IntegrationEvent(false, false)] + local procedure OnCreatePrepaymentLinesOnAfterTempPrepmtSalesLineInsert(var TempPrepmtSalesLine: Record "Sales Line" temporary; var TempSalesLine: Record "Sales Line" temporary; SalesHeader: Record "Sales Header") + begin + end; + /// /// Raised before inserting temporary line for extended text during create prepayment lines. /// diff --git a/src/Layers/W1/BaseApp/Service/Inventory/Tracking/ServGetDemandToReserve.Codeunit.al b/src/Layers/W1/BaseApp/Service/Inventory/Tracking/ServGetDemandToReserve.Codeunit.al index 8968d20e81..44ecbcc4d8 100644 --- a/src/Layers/W1/BaseApp/Service/Inventory/Tracking/ServGetDemandToReserve.Codeunit.al +++ b/src/Layers/W1/BaseApp/Service/Inventory/Tracking/ServGetDemandToReserve.Codeunit.al @@ -146,6 +146,7 @@ codeunit 6485 "Serv. Get Demand To Reserve" ServiceHeader: Record "Service Header"; Customer: Record Customer; ReservationWorksheetMgt: Codeunit "Reservation Worksheet Mgt."; + DoInsertReservationWkshLine: Boolean; RemainingQty, RemainingQtyBase : Decimal; AvailableQtyBase, InventoryQtyBase, ReservedQtyBase, WarehouseQtyBase : Decimal; LineNo: Integer; @@ -209,11 +210,20 @@ codeunit 6485 "Serv. Get Demand To Reserve" if (ReservationWkshLine."Remaining Qty. to Reserve" > 0) and (ReservationWkshLine."Available Qty. to Reserve" > 0) - then - ReservationWkshLine.Insert(true); + then begin + DoInsertReservationWkshLine := true; + OnSyncServiceOrderLinesOnBeforeInsertReservationWkshLine(ReservationWkshLine, TempServiceLine, DoInsertReservationWkshLine); + if DoInsertReservationWkshLine then + ReservationWkshLine.Insert(true); + end; until TempServiceLine.Next() = 0; end; + [IntegrationEvent(false, false)] + local procedure OnSyncServiceOrderLinesOnBeforeInsertReservationWkshLine(var ReservationWkshLine: Record "Reservation Wksh. Line"; var TempServiceLine: Record "Service Line" temporary; var DoInsertReservationWkshLine: Boolean) + begin + end; + #if not CLEAN27 [Obsolete('This event is never raised.', '27.0')] [IntegrationEvent(false, false)] diff --git a/src/Layers/W1/BaseApp/Warehouse/Document/WhsePostShipment.Codeunit.al b/src/Layers/W1/BaseApp/Warehouse/Document/WhsePostShipment.Codeunit.al index ec3f27324a..8cd8a7f0b1 100644 --- a/src/Layers/W1/BaseApp/Warehouse/Document/WhsePostShipment.Codeunit.al +++ b/src/Layers/W1/BaseApp/Warehouse/Document/WhsePostShipment.Codeunit.al @@ -303,6 +303,7 @@ codeunit 5763 "Whse.-Post Shipment" OnPostUpdateWhseDocumentsOnBeforeUpdateWhseShptHeader(WhseShptHeaderParam); WhseShptLine2.SetRange("No.", WhseShptHeaderParam."No."); + OnPostUpdateWhseDocumentsOnAfterWhseShptLineSetFilters(WhseShptLine2, WhseShptHeaderParam); if WhseShptLine2.IsEmpty() then begin WhseShptHeaderParam.DeleteRelatedLines(); WhseShptHeaderParam.Delete(); @@ -882,6 +883,11 @@ codeunit 5763 "Whse.-Post Shipment" begin end; + [IntegrationEvent(false, false)] + local procedure OnPostUpdateWhseDocumentsOnAfterWhseShptLineSetFilters(var WhseShptLine2: Record "Warehouse Shipment Line"; var WhseShptHeaderParam: Record "Warehouse Shipment Header") + begin + end; + [IntegrationEvent(false, false)] local procedure OnAfterSetCurrentKeyForWhseShptLine(var WarehouseShipmentLine: Record "Warehouse Shipment Line"); begin diff --git a/src/Layers/W1/BaseApp/Warehouse/Request/GetOutboundSourceDocuments.Report.al b/src/Layers/W1/BaseApp/Warehouse/Request/GetOutboundSourceDocuments.Report.al index bbeafaaaa9..486a097225 100644 --- a/src/Layers/W1/BaseApp/Warehouse/Request/GetOutboundSourceDocuments.Report.al +++ b/src/Layers/W1/BaseApp/Warehouse/Request/GetOutboundSourceDocuments.Report.al @@ -262,8 +262,15 @@ report 7304 "Get Outbound Source Documents" Location.Get(LocationCode2); end; - local procedure IsPickToBeMadeForAsmLine(AsmLine: Record "Assembly Line"): Boolean + local procedure IsPickToBeMadeForAsmLine(AsmLine: Record "Assembly Line") Result: Boolean + var + IsHandled: Boolean; begin + IsHandled := false; + OnBeforeIsPickToBeMadeForAsmLine(AsmLine, Result, IsHandled); + if IsHandled then + exit(Result); + if not AsmLine.IsInventoriableItem() then exit(false); @@ -308,6 +315,11 @@ report 7304 "Get Outbound Source Documents" begin end; + [IntegrationEvent(false, false)] + local procedure OnBeforeIsPickToBeMadeForAsmLine(AssemblyLine: Record "Assembly Line"; var Result: Boolean; var IsHandled: Boolean) + begin + end; + [IntegrationEvent(false, false)] local procedure OnBeforeWhsePickRequestOnAfterGetRecord(var WhsePickRequest: Record "Whse. Pick Request"; PickWkshTemplate: Code[10]; PickWkshName: Code[10]; LocationCode: Code[10]; var LineCreated: Boolean; var SkipRecord: Boolean) begin