Reputation: 21
I have a couple of custom fields, they are the same and created as follows:
DB Script:
IF COL_LENGTH('ARInvoice', 'UsrNormalVat') IS NULL
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;
}
}
}
So depending on the data on an invoice the value may be UsrNormalVAT = 39.6758 where the TaxTotal = 39.6800
Any idea how to set the fields to round to two decimal places?
Upvotes: 1
Views: 665
Reputation: 21
Found the solution:
UsrNormalVat = PXDBCurrencyAttribute.Round(cache, row, (decimal)(UsrNormalVatBase * VATRate), CMPrecision.TRANCURY);
Upvotes: 1