我有几个自定义字段,它们是相同的,并按如下方式创建:
数据库脚本:
如果COL_LENGTH(' ARInvoice',' UsrNormalVat')为空
BEGIN
ALTER TABLE ARInvoice
ADD [UsrNormalVat] Decimal(19,4)
END
ARInvoiceEntry:
public class ARInvoiceExt : PXCacheExtension<ARInvoice>
{
#region UsrNormalVat
public abstract class usrNormalVat : PX.Data.IBqlField
{
}
protected Decimal? _UsrNormalVat;
[PXDBDecimal(2)]
[PXUIField(DisplayName = "Normal Vat")]
public virtual Decimal? UsrNormalVat
{
get
{
return this._UsrNormalVat;
}
set
{
this._UsrNormalVat = value;
}
}
}
因此,根据发票上的数据,该值可能是UsrNormalVAT = 39.6758,其中TaxTotal = 39.6800
知道如何将字段设置为舍入到小数点后两位吗?
答案 0 :(得分:1)
找到解决方案:
UsrNormalVat = PXDBCurrencyAttribute.Round(cache, row, (decimal)(UsrNormalVatBase * VATRate), CMPrecision.TRANCURY);