Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}

12 changes: 12 additions & 0 deletions src/Layers/APAC/BaseApp/Sales/Posting/SalesPost.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

/// <summary>
/// Raised before inserting temporary line for extended text during create prepayment lines.
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions src/Layers/BE/BaseApp/Sales/Posting/SalesPost.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

/// <summary>
/// Raised before inserting temporary line for extended text during create prepayment lines.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}

12 changes: 12 additions & 0 deletions src/Layers/CH/BaseApp/Sales/Posting/SalesPost.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

/// <summary>
/// Raised before inserting temporary line for extended text during create prepayment lines.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}

12 changes: 12 additions & 0 deletions src/Layers/ES/BaseApp/Sales/Posting/SalesPost.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

/// <summary>
/// Raised before inserting temporary line for extended text during create prepayment lines.
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions src/Layers/FI/BaseApp/Sales/Posting/SalesPost.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

/// <summary>
/// Raised before inserting temporary line for extended text during create prepayment lines.
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions src/Layers/FR/BaseApp/Sales/Posting/SalesPost.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

/// <summary>
/// Raised before inserting temporary line for extended text during create prepayment lines.
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions src/Layers/GB/BaseApp/Sales/Posting/SalesPost.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

/// <summary>
/// Raised before inserting temporary line for extended text during create prepayment lines.
/// </summary>
Expand Down
Loading
Loading