1

我需要在销售行、采购行和项目主文件(销售选项卡)的价格字段中显示 5 位小数。我创建了带有 5 个小数位的新 EDT 来替换 salesLine.SalesPrice 和 InventTableModule.Price 字段。但是一旦创建了销售线。SalesPrice 字段中的值四舍五入到小数点后两位。例如,项目主数据中的值为 10.12345,但在销售行上显示为 10.12000。最后 3 位数字消失了。

到目前为止,我从各种帖子/博客中听到了多种方法。

  1. 在 RealBase EDT 上将 NoOfDecimals 属性更改为 5,从而有效地更改应用程序中的 Amount 字段。我不想这样做。

  2. 在 GL>Setup>Currency>Rounding rules 中更改舍入规则。这些字段不可编辑。

  3. 我将 PriceDiscTable.Amount 字段的 EDT 更改为 5 位小数。但没有帮助。我猜我的情况下的 SalesPrice 不是来自贸易协议。

有什么我忽略/遗漏的吗?

谢谢

4

2 回答 2

1

看看 PriceDisc.price() 方法。即使您更改 EDT 中的小数或创建新的 EDT 方法,Dynamics 也会按代码四舍五入价格,无论您是从贸易协议还是从 InventTableModule 价格字段中获取价格。

PriceDisc.price() 方法稍后将调用 Currency.priceTypeRound(...) 方法,将四舍五入为 2 位小数:

private Price priceTyperound(Price          _price,
                         PriceRoundOff  _unit)
{
Price   price;
real    decimals;
;

switch (this.RoundOffTypePrice)
{
    case RoundOffType::Ordinary:
        if (_unit)
            price = round(_price, _unit);
        else
            price = round(_price,0.01);
        break;
        (...)

舍入类型取决于汇率表格中最后一个选项卡(舍入)的值。因此,如果您希望小数正常工作,则必须修改更多内容。

我希望这可以帮到你。

于 2012-12-20T08:20:25.523 回答
0

aariste i think you are refering to AX version 2009 since Currency.priceTypeRound method is deprecated in 2012. But i did find similar methods in Currency table and in a new class called CurrencyExchangeHelper added in 2012. Sadly, the whole pricing mechanism is too complex and i decided not to meddle with it. Another difference in 2012 is that few methods run in IL so normal debugger cant catch them until you change a setting in Tools called "Execute business operations in IL". I am now forcefully pushing the salesPrice and recalculating the lineAmount overriding the Trade agreements pricing logic. I am totally in favor of increasing the Price Unit as David Lawson suggested instead of code changes. Thank you both for looking into the problem and advising.

于 2012-12-26T17:16:19.063 回答