Why do you need this change?
Many of our customers wonder why, when they select the "1,000" rounding option in analyses and financial reports, the amounts still include a decimal place. They want the amounts to be rounded to whole numbers.
Describe the request
Add integration event in procedure RoundAmount in Matrix Management codeunit after amount rounding:
procedure RoundAmount(Amount: Decimal; RoundingFactor: Enum "Analysis Rounding Factor"): Decimal
begin
if Amount = 0 then
exit(0);
case RoundingFactor of
RoundingFactor::"1":
exit(Round(Amount, 1));
RoundingFactor::"1000":
exit(Round(Amount / 1000, 0.1));
RoundingFactor::"1000000":
exit(Round(Amount / 1000000, 0.1));
else
OnRoundAmountOnElse(Amount, RoundingFactor);
end;
// add event here to allow changing Amount based on RoundingFactor - begin
OnRoundAmountAfterRound(Amount, RoundingFactor);
// add event here to allow changing Amount based on RoundingFactor - end
exit(Amount);
end;
Add integration event in procedure FormatRoundingFactor in Matrix Management codeunit after set AmountDecimal:
procedure FormatRoundingFactor(RoundingFactor: Enum "Analysis Rounding Factor"; AddCurrency: Boolean; NegativeAmountFormat: Enum "Analysis Negative Format") Result: Text
var
AmountDecimal: Text;
begin
case RoundingFactor of
RoundingFactor::None:
AmountDecimal := ReadNormalDecimalFormat(AddCurrency);
RoundingFactor::"1":
AmountDecimal := Format(0);
RoundingFactor::"1000", RoundingFactor::"1000000":
AmountDecimal := Format(1);
else
OnFormatRoundingFactorOnElse(AmountDecimal, RoundingFactor);
end;
// add event here to allow changing AmountDecimal based on RoundingFactor - begin
OnFormatRoundingFactorAfterSetAmountDecimal(RoundingFactor, AmountDecimal);
// add event here to allow changing AmountDecimal based on RoundingFactor - end
case NegativeAmountFormat of
NegativeAmountFormat::"Minus Sign":
Result := StrSubstNo(RoundingFormatTxt, AmountDecimal, '');
NegativeAmountFormat::"Parentheses":
Result := StrSubstNo(RoundingFormatTxt, AmountDecimal, NegativeInParenthesesFormatTxt);
else
OnFormatRoundingFactorNegativeFormatOnElse(AmountDecimal, NegativeAmountFormat, Result);
end;
end;
Events could be like this:
[IntegrationEvent(false, false)]
local procedure OnFormatRoundingFactorAfterSetAmountDecimal(RoundingFactor: Enum "Analysis Rounding Factor"; var AmountDecimal: Text)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnRoundAmountAfterRound(var Amount: Decimal; RoundingFactor: Enum "Analysis Rounding Factor")
begin
end;
Why do you need this change?
Many of our customers wonder why, when they select the "1,000" rounding option in analyses and financial reports, the amounts still include a decimal place. They want the amounts to be rounded to whole numbers.
Describe the request
Add integration event in procedure RoundAmount in Matrix Management codeunit after amount rounding:
Add integration event in procedure FormatRoundingFactor in Matrix Management codeunit after set AmountDecimal:
Events could be like this: