Skip to content
Closed
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 @@ -3689,16 +3689,24 @@ codeunit 22 "Item Jnl.-Post Line"
DirCostACY := Round(DirCost * ItemJnlLine."Vendor Exchange Rate (ACY)");
OvhdCostACY := Round(OvhdCost * ItemJnlLine."Vendor Exchange Rate (ACY)");
ItemJnlLine."Unit Cost (ACY)" := Round(ItemJnlLine."Unit Cost" * ItemJnlLine."Vendor Exchange Rate (ACY)");
end else begin

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Error\ Handling}$

In the APAC layer only, the new ShouldUseDocumentAmountForACY() branch sets PurchVarACY := 0, but the final PurchVarACY assignment (near line 3722, PurchVarACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity" - DirCostACY - OvhdCostACY;) sits outside that conditional and always executes afterward regardless of which branch was taken. This silently overwrites the zeroed PurchVarACY, defeating the document-amount path and producing an incorrect ACY purchase variance for costing-method-driven ACY postings. Although agent findings are capped at minor severity, the underlying impact is major/blocker-level (wrong posted amounts) and should be fixed before merge. Note that the sibling layers (W1, CH, ES, IT, RU) do not have this bug: their equivalent code correctly nests the PurchVarACY calculation inside the else-branch of ShouldUseDocumentAmountForACY(), so only APAC needs the fix. The recommended fix moves the final PurchVarACY assignment inside the non-document-amount else branch (mirroring the other layers' structure) so it only recomputes PurchVarACY for the CalcACYAmt/CurrExchRate fallback path.

Suggested fix (apply manually — could not be anchored as a one-click suggestion):

            end else begin
                if ShouldUseDocumentAmountForACY() then begin
                    if Expected then
                        DirCostACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine.Quantity + RoundingResidualAmountACY
                    else
                        DirCostACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity";
                    OvhdCostACY := 0;
                    PurchVarACY := 0;
                end else begin
                    DirCostACY := ACYMgt.CalcACYAmt(DirCost, ItemJnlLine."Posting Date", false);
                    OvhdCostACY := ACYMgt.CalcACYAmt(OvhdCost, ItemJnlLine."Posting Date", false);
                    ItemJnlLine."Unit Cost (ACY)" :=
                      Round(
                        CurrExchRate.ExchangeAmtLCYToFCY(
                          ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency", ItemJnlLine."Unit Cost",
                          CurrExchRate.ExchangeRate(
                            ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency")),
                        Currency."Unit-Amount Rounding Precision");
                    PurchVarACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity" - DirCostACY - OvhdCostACY;
                end;
            end else begin
                DirCostACY := ACYMgt.CalcACYAmt(DirCost, ItemJnlLine."Posting Date", false);
                OvhdCostACY := ACYMgt.CalcACYAmt(OvhdCost, ItemJnlLine."Posting Date", false);
                ItemJnlLine."Unit Cost (ACY)" :=
                  Round(
                    CurrExchRate.ExchangeAmtLCYToFCY(
                      ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency", ItemJnlLine."Unit Cost",
                      CurrExchRate.ExchangeRate(
                        ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency")),
                    Currency."Unit-Amount Rounding Precision");
                PurchVarACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity" - DirCostACY - OvhdCostACY;
            end;

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4

if ShouldUseDocumentAmountForACY() then begin
if Expected then
DirCostACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine.Quantity + RoundingResidualAmountACY
else
DirCostACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity";
OvhdCostACY := 0;
PurchVarACY := 0;
end else begin
DirCostACY := ACYMgt.CalcACYAmt(DirCost, ItemJnlLine."Posting Date", false);
OvhdCostACY := ACYMgt.CalcACYAmt(OvhdCost, ItemJnlLine."Posting Date", false);
ItemJnlLine."Unit Cost (ACY)" :=
Round(
CurrExchRate.ExchangeAmtLCYToFCY(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency", ItemJnlLine."Unit Cost",
CurrExchRate.ExchangeRate(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency")),
Currency."Unit-Amount Rounding Precision");
DirCostACY := ACYMgt.CalcACYAmt(DirCost, ItemJnlLine."Posting Date", false);
OvhdCostACY := ACYMgt.CalcACYAmt(OvhdCost, ItemJnlLine."Posting Date", false);
ItemJnlLine."Unit Cost (ACY)" :=
Round(
CurrExchRate.ExchangeAmtLCYToFCY(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency", ItemJnlLine."Unit Cost",
CurrExchRate.ExchangeRate(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency")),
Currency."Unit-Amount Rounding Precision");
end;
end else begin
DirCostACY := ACYMgt.CalcACYAmt(DirCost, ItemJnlLine."Posting Date", false);
Expand All @@ -3711,8 +3719,8 @@ codeunit 22 "Item Jnl.-Post Line"
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency")),
Currency."Unit-Amount Rounding Precision");
end;
PurchVarACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity" - DirCostACY - OvhdCostACY;
end;
PurchVarACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity" - DirCostACY - OvhdCostACY;
end;
CalcUnitCost := (DirCost <> 0) and (ItemJnlLine."Unit Cost" = 0);

OnAfterCalcPosShares(ItemJnlLine, DirCost, OvhdCost, PurchVar, DirCostACY, OvhdCostACY, PurchVarACY, CalcUnitCost, CalcPurchVar, Expected, GlobalItemLedgEntry);
Expand Down Expand Up @@ -6076,6 +6084,16 @@ codeunit 22 "Item Jnl.-Post Line"
exit(false);
end;

local procedure ShouldUseDocumentAmountForACY(): Boolean
begin
exit(
(ItemJnlLine."Source Currency Code" = GLSetup."Additional Reporting Currency") and
(Item."Costing Method" <> Item."Costing Method"::Standard) and
(ItemJnlLine."Discount Amount" = 0) and
(ItemJnlLine."Indirect Cost %" = 0) and
(ItemJnlLine."Overhead Rate" = 0));
end;

[IntegrationEvent(false, false)]
local procedure OnBeforeAllowProdApplication(OldItemLedgerEntry: Record "Item Ledger Entry"; ItemLedgerEntry: Record "Item Ledger Entry"; var AllowApplication: Boolean)
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3673,18 +3673,26 @@ codeunit 22 "Item Jnl.-Post Line"
end;
end;

if GLSetup."Additional Reporting Currency" <> '' then begin
DirCostACY := ACYMgt.CalcACYAmt(DirCost, ItemJnlLine."Posting Date", false);
OvhdCostACY := ACYMgt.CalcACYAmt(OvhdCost, ItemJnlLine."Posting Date", false);
ItemJnlLine."Unit Cost (ACY)" :=
Round(
CurrExchRate.ExchangeAmtLCYToFCY(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency", ItemJnlLine."Unit Cost",
CurrExchRate.ExchangeRate(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency")),
Currency."Unit-Amount Rounding Precision");
PurchVarACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity" - DirCostACY - OvhdCostACY;
end;
if GLSetup."Additional Reporting Currency" <> '' then
if ShouldUseDocumentAmountForACY() then begin
if Expected then
DirCostACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine.Quantity + RoundingResidualAmountACY
else
DirCostACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity";
OvhdCostACY := 0;
PurchVarACY := 0;
end else begin
DirCostACY := ACYMgt.CalcACYAmt(DirCost, ItemJnlLine."Posting Date", false);
OvhdCostACY := ACYMgt.CalcACYAmt(OvhdCost, ItemJnlLine."Posting Date", false);
ItemJnlLine."Unit Cost (ACY)" :=
Round(
CurrExchRate.ExchangeAmtLCYToFCY(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency", ItemJnlLine."Unit Cost",
CurrExchRate.ExchangeRate(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency")),
Currency."Unit-Amount Rounding Precision");
PurchVarACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity" - DirCostACY - OvhdCostACY;
end;
CalcUnitCost := (DirCost <> 0) and (ItemJnlLine."Unit Cost" = 0);

OnAfterCalcPosShares(ItemJnlLine, DirCost, OvhdCost, PurchVar, DirCostACY, OvhdCostACY, PurchVarACY, CalcUnitCost, CalcPurchVar, Expected, GlobalItemLedgEntry);
Expand Down Expand Up @@ -6047,6 +6055,16 @@ codeunit 22 "Item Jnl.-Post Line"
exit(false);
end;

local procedure ShouldUseDocumentAmountForACY(): Boolean
begin
exit(
(ItemJnlLine."Source Currency Code" = GLSetup."Additional Reporting Currency") and
(Item."Costing Method" <> Item."Costing Method"::Standard) and
(ItemJnlLine."Discount Amount" = 0) and
(ItemJnlLine."Indirect Cost %" = 0) and
(ItemJnlLine."Overhead Rate" = 0));
end;

[IntegrationEvent(false, false)]
local procedure OnBeforeAllowProdApplication(OldItemLedgerEntry: Record "Item Ledger Entry"; ItemLedgerEntry: Record "Item Ledger Entry"; var AllowApplication: Boolean)
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3682,18 +3682,26 @@ codeunit 22 "Item Jnl.-Post Line"
end;
end;

if GLSetup."Additional Reporting Currency" <> '' then begin
DirCostACY := ACYMgt.CalcACYAmt(DirCost, ItemJnlLine."Posting Date", false);
OvhdCostACY := ACYMgt.CalcACYAmt(OvhdCost, ItemJnlLine."Posting Date", false);
ItemJnlLine."Unit Cost (ACY)" :=
Round(
CurrExchRate.ExchangeAmtLCYToFCY(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency", ItemJnlLine."Unit Cost",
CurrExchRate.ExchangeRate(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency")),
Currency."Unit-Amount Rounding Precision");
PurchVarACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity" - DirCostACY - OvhdCostACY;
end;
if GLSetup."Additional Reporting Currency" <> '' then
if ShouldUseDocumentAmountForACY() then begin
if Expected then
DirCostACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine.Quantity + RoundingResidualAmountACY
else
DirCostACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity";
OvhdCostACY := 0;
PurchVarACY := 0;
end else begin
DirCostACY := ACYMgt.CalcACYAmt(DirCost, ItemJnlLine."Posting Date", false);
OvhdCostACY := ACYMgt.CalcACYAmt(OvhdCost, ItemJnlLine."Posting Date", false);
ItemJnlLine."Unit Cost (ACY)" :=
Round(
CurrExchRate.ExchangeAmtLCYToFCY(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency", ItemJnlLine."Unit Cost",
CurrExchRate.ExchangeRate(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency")),
Currency."Unit-Amount Rounding Precision");
PurchVarACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity" - DirCostACY - OvhdCostACY;
end;
CalcUnitCost := (DirCost <> 0) and (ItemJnlLine."Unit Cost" = 0);

OnAfterCalcPosShares(ItemJnlLine, DirCost, OvhdCost, PurchVar, DirCostACY, OvhdCostACY, PurchVarACY, CalcUnitCost, CalcPurchVar, Expected, GlobalItemLedgEntry);
Expand Down Expand Up @@ -6057,6 +6065,16 @@ codeunit 22 "Item Jnl.-Post Line"
exit(false);
end;

local procedure ShouldUseDocumentAmountForACY(): Boolean
begin
exit(
(ItemJnlLine."Source Currency Code" = GLSetup."Additional Reporting Currency") and
(Item."Costing Method" <> Item."Costing Method"::Standard) and
(ItemJnlLine."Discount Amount" = 0) and
(ItemJnlLine."Indirect Cost %" = 0) and
(ItemJnlLine."Overhead Rate" = 0));
end;

[IntegrationEvent(false, false)]
local procedure OnBeforeAllowProdApplication(OldItemLedgerEntry: Record "Item Ledger Entry"; ItemLedgerEntry: Record "Item Ledger Entry"; var AllowApplication: Boolean)
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3700,18 +3700,26 @@ codeunit 22 "Item Jnl.-Post Line"
end;
end;

if GLSetup."Additional Reporting Currency" <> '' then begin
DirCostACY := ACYMgt.CalcACYAmt(DirCost, ItemJnlLine."Posting Date", false);
OvhdCostACY := ACYMgt.CalcACYAmt(OvhdCost, ItemJnlLine."Posting Date", false);
ItemJnlLine."Unit Cost (ACY)" :=
Round(
CurrExchRate.ExchangeAmtLCYToFCY(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency", ItemJnlLine."Unit Cost",
CurrExchRate.ExchangeRate(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency")),
Currency."Unit-Amount Rounding Precision");
PurchVarACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity" - DirCostACY - OvhdCostACY;
end;
if GLSetup."Additional Reporting Currency" <> '' then
if ShouldUseDocumentAmountForACY() then begin
if Expected then
DirCostACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine.Quantity + RoundingResidualAmountACY
else
DirCostACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity";
OvhdCostACY := 0;
PurchVarACY := 0;
end else begin
DirCostACY := ACYMgt.CalcACYAmt(DirCost, ItemJnlLine."Posting Date", false);
OvhdCostACY := ACYMgt.CalcACYAmt(OvhdCost, ItemJnlLine."Posting Date", false);
ItemJnlLine."Unit Cost (ACY)" :=
Round(
CurrExchRate.ExchangeAmtLCYToFCY(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency", ItemJnlLine."Unit Cost",
CurrExchRate.ExchangeRate(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency")),
Currency."Unit-Amount Rounding Precision");
PurchVarACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity" - DirCostACY - OvhdCostACY;
end;
CalcUnitCost := (DirCost <> 0) and (ItemJnlLine."Unit Cost" = 0);

OnAfterCalcPosShares(ItemJnlLine, DirCost, OvhdCost, PurchVar, DirCostACY, OvhdCostACY, PurchVarACY, CalcUnitCost, CalcPurchVar, Expected, GlobalItemLedgEntry);
Expand Down Expand Up @@ -6074,6 +6082,16 @@ codeunit 22 "Item Jnl.-Post Line"
exit(false);
end;

local procedure ShouldUseDocumentAmountForACY(): Boolean
begin
exit(
(ItemJnlLine."Source Currency Code" = GLSetup."Additional Reporting Currency") and
(Item."Costing Method" <> Item."Costing Method"::Standard) and
(ItemJnlLine."Discount Amount" = 0) and
(ItemJnlLine."Indirect Cost %" = 0) and
(ItemJnlLine."Overhead Rate" = 0));
end;

[IntegrationEvent(false, false)]
local procedure OnBeforeAllowProdApplication(OldItemLedgerEntry: Record "Item Ledger Entry"; ItemLedgerEntry: Record "Item Ledger Entry"; var AllowApplication: Boolean)
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3712,18 +3712,26 @@ codeunit 22 "Item Jnl.-Post Line"
end;
end;

if GLSetup."Additional Reporting Currency" <> '' then begin
DirCostACY := ACYMgt.CalcACYAmt(DirCost, ItemJnlLine."Posting Date", false);
OvhdCostACY := ACYMgt.CalcACYAmt(OvhdCost, ItemJnlLine."Posting Date", false);
ItemJnlLine."Unit Cost (ACY)" :=
Round(
CurrExchRate.ExchangeAmtLCYToFCY(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency", ItemJnlLine."Unit Cost",
CurrExchRate.ExchangeRate(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency")),
Currency."Unit-Amount Rounding Precision");
PurchVarACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity" - DirCostACY - OvhdCostACY;
end;
if GLSetup."Additional Reporting Currency" <> '' then
if ShouldUseDocumentAmountForACY() then begin
if Expected then
DirCostACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine.Quantity + RoundingResidualAmountACY
else
DirCostACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity";
OvhdCostACY := 0;
PurchVarACY := 0;
end else begin
DirCostACY := ACYMgt.CalcACYAmt(DirCost, ItemJnlLine."Posting Date", false);
OvhdCostACY := ACYMgt.CalcACYAmt(OvhdCost, ItemJnlLine."Posting Date", false);
ItemJnlLine."Unit Cost (ACY)" :=
Round(
CurrExchRate.ExchangeAmtLCYToFCY(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency", ItemJnlLine."Unit Cost",
CurrExchRate.ExchangeRate(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency")),
Currency."Unit-Amount Rounding Precision");
PurchVarACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity" - DirCostACY - OvhdCostACY;
end;
CalcUnitCost := (DirCost <> 0) and (ItemJnlLine."Unit Cost" = 0);

OnAfterCalcPosShares(ItemJnlLine, DirCost, OvhdCost, PurchVar, DirCostACY, OvhdCostACY, PurchVarACY, CalcUnitCost, CalcPurchVar, Expected, GlobalItemLedgEntry);
Expand Down Expand Up @@ -6392,6 +6400,16 @@ codeunit 22 "Item Jnl.-Post Line"
exit(false);
end;

local procedure ShouldUseDocumentAmountForACY(): Boolean
begin
exit(
(ItemJnlLine."Source Currency Code" = GLSetup."Additional Reporting Currency") and
(Item."Costing Method" <> Item."Costing Method"::Standard) and
(ItemJnlLine."Discount Amount" = 0) and
(ItemJnlLine."Indirect Cost %" = 0) and
(ItemJnlLine."Overhead Rate" = 0));
end;

[IntegrationEvent(false, false)]
local procedure OnBeforeAllowProdApplication(OldItemLedgerEntry: Record "Item Ledger Entry"; ItemLedgerEntry: Record "Item Ledger Entry"; var AllowApplication: Boolean)
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3669,18 +3669,26 @@ codeunit 22 "Item Jnl.-Post Line"
end;
end;

if GLSetup."Additional Reporting Currency" <> '' then begin
DirCostACY := ACYMgt.CalcACYAmt(DirCost, ItemJnlLine."Posting Date", false);
OvhdCostACY := ACYMgt.CalcACYAmt(OvhdCost, ItemJnlLine."Posting Date", false);
ItemJnlLine."Unit Cost (ACY)" :=
Round(
CurrExchRate.ExchangeAmtLCYToFCY(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency", ItemJnlLine."Unit Cost",
CurrExchRate.ExchangeRate(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency")),
Currency."Unit-Amount Rounding Precision");
PurchVarACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity" - DirCostACY - OvhdCostACY;
end;
if GLSetup."Additional Reporting Currency" <> '' then
if ShouldUseDocumentAmountForACY() then begin
if Expected then
DirCostACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine.Quantity + RoundingResidualAmountACY
else
DirCostACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity";
OvhdCostACY := 0;
PurchVarACY := 0;
end else begin
DirCostACY := ACYMgt.CalcACYAmt(DirCost, ItemJnlLine."Posting Date", false);
OvhdCostACY := ACYMgt.CalcACYAmt(OvhdCost, ItemJnlLine."Posting Date", false);
ItemJnlLine."Unit Cost (ACY)" :=
Round(
CurrExchRate.ExchangeAmtLCYToFCY(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency", ItemJnlLine."Unit Cost",
CurrExchRate.ExchangeRate(
ItemJnlLine."Posting Date", GLSetup."Additional Reporting Currency")),
Currency."Unit-Amount Rounding Precision");
PurchVarACY := ItemJnlLine."Unit Cost (ACY)" * ItemJnlLine."Invoiced Quantity" - DirCostACY - OvhdCostACY;
end;
CalcUnitCost := (DirCost <> 0) and (ItemJnlLine."Unit Cost" = 0);

OnAfterCalcPosShares(ItemJnlLine, DirCost, OvhdCost, PurchVar, DirCostACY, OvhdCostACY, PurchVarACY, CalcUnitCost, CalcPurchVar, Expected, GlobalItemLedgEntry);
Expand Down Expand Up @@ -6043,6 +6051,16 @@ codeunit 22 "Item Jnl.-Post Line"
exit(false);
end;

local procedure ShouldUseDocumentAmountForACY(): Boolean
begin
exit(
(ItemJnlLine."Source Currency Code" = GLSetup."Additional Reporting Currency") and
(Item."Costing Method" <> Item."Costing Method"::Standard) and
(ItemJnlLine."Discount Amount" = 0) and
(ItemJnlLine."Indirect Cost %" = 0) and
(ItemJnlLine."Overhead Rate" = 0));
end;

[IntegrationEvent(false, false)]
local procedure OnBeforeAllowProdApplication(OldItemLedgerEntry: Record "Item Ledger Entry"; ItemLedgerEntry: Record "Item Ledger Entry"; var AllowApplication: Boolean)
begin
Expand Down
Loading