Acumatica:销售订单自定义计算不一致 [英] Acumatica: Sales Order custom calculation inconsistency

查看:94
本文介绍了Acumatica:销售订单自定义计算不一致的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有了一些帮助和大量的反复试验,我能够创建一个允许以下操作的自定义项:

With some help and a lot of trial and error I was able to create a customization that allowed for the following:


  1. 总计销售订单摘要区域上的利润字段

  2. 销售订单摘要区域上的 GP%字段

  3. 销售的总利润字段订单明细区域(按行)

  4. 销售订单明细区域(按行) GP%字段

  1. "Total Profit" field on the Sales Order summary area
  2. "GP %" field on the Sales Order summary area
  3. "Total Profit" field on the Sales Order details area (by line)
  4. "GP %" field on the Sales Order details area (by line)

总利润=分机。价格-分机成本
GP%=(总利润/附加价格)* 100

Total Profit = Ext. Price - Ext. Cost GP % = (Total Profit / Ext. Price) * 100

这四个字段的计算有时会起作用,但是我注意到我通过输入新行或使用Control + Enter来提交该行,然后返回并更改Ext。费用,总利润和GP%不会更新。即使我保存并刷新它也可以做到这一点。似乎唯一可行的方法是100%的运行时间是我一次非常有条不紊地一次输入它。但这不是开箱即用总数的计算方式。输入数量,价格等顺序都无所谓-开箱即用的总额始终会更新。如何在Acumatica中像这样创建四个自定义字段?

The calculation for these four fields works some of the time, but I have noticed when I commit the line either by entering a new line or with Control + Enter, and then go back and change the Ext. Cost, the Total Profit and GP% don't update. Even when I save and refresh it does this. The only time it seems to work 100% is when I enter it in very methodically going one step at a time. But this is not how the out of the box totals are calculated. It doesn't matter which order you enter in your quantity, price, etc. - the out of the box totals always update. How do I make my four custom fields like this in Acumatica?

SOLine自定义字段(每个字段用空行分隔):

SOLine Custom fields (each field separated by a blank line):

[PXDBCurrency(typeof(SOLine.curyInfoID), typeof(SOLineExt.usrTotalProfit))]
[PXUIField(DisplayName = "Total Profit", Enabled = false)]
[PXFormula(typeof(Sub<SOLine.curyLineAmt, SOLine.curyExtCost>))]
[PXDefault(TypeCode.Decimal, "0.0")]
[PXFormula(null, typeof(SumCalc<SOOrderExt.usrCuryOrderTotalProfit>))]

[PXDBDecimal(4)]
[PXDefault(TypeCode.Decimal, "0.0")]

[PXFormula(typeof(Switch<Case<Where<SOLine.curyLineAmt, Equal<decimal0>>, decimal0>, Div<SOLineExt.usrTotalProfit, SOLine.curyLineAmt>>))]
[PXDefault(TypeCode.Decimal, "0.0")]

[PXUIField(DisplayName = "GP %", Enabled = false)] 
[PXFormula(typeof(Mult<SOLineExt.usrGPPercent, decimal100>))]
[PXDefault(TypeCode.Decimal, "0.0")]

SOOrder自定义字段(每个字段用空白行分隔):

SOOrder Custom fields (each field separated by a blank line):

[PXDBCurrency(typeof(SOOrder.curyInfoID), typeof(SOOrderExt.usrOrderTotalProfit))] 
[PXUIField(DisplayName = "Total Profit", Enabled = false)] 
[PXDefault(TypeCode.Decimal, "0.0")]

[PXDBDecimal(4)]
[PXDefault(TypeCode.Decimal, "0.0")]

[PXFormula(typeof(Switch<Case<Where<SOOrder.curyOrderTotal, Equal<decimal0>>, decimal0>, Div<SOOrderExt.usrOrderTotalProfit, SOOrder.curyOrderTotal>>))]
[PXDefault(TypeCode.Decimal, "0.0")]

[PXUIField(DisplayName = "GP %", Enabled = false)] 
[PXFormula(typeof(Mult<SOOrderExt.usrOrderGPPercent, decimal100>))]


推荐答案

PXFormula的DAC扩展名和自定义字段应该没有问题。仅查看字段属性很难分辨出问题所在。至少,请使用DAC字段声明更新您的代码段,以便更清楚地了解哪些属性属于哪个字段。

PXFormula should have no problems with DAC extensions and custom fields. It's really hard to tell what the issue is by looking only at field attributes. Please, at least, update your code snippet with DAC field declarations, so it becomes more clear what attributes belong to what field.

这篇关于Acumatica:销售订单自定义计算不一致的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆