Solved

How to change decimal point to 3 digit

  • 31 August 2023
  • 9 replies
  • 419 views

Userlevel 3
Badge

 

icon

Best answer by Brian Stevens 31 August 2023, 04:59

View original

9 replies

Badge +11

According to the DAC attribute on Ext Cost, the precision comes from the Companies ‘Price/Cost Decimal Places’ preference.

 

Userlevel 6
Badge +4

I believe the field is POLine.CuryLineAmt.  This field is marked with the attribute PXDBCurrency which I believe looks up the precision from the currency (Currencies screen).

#region CuryLineAmt
public abstract class curyLineAmt : PX.Data.BQL.BqlDecimal.Field<curyLineAmt> { }
protected Decimal? _CuryLineAmt;
[PXDBCurrency(typeof(POLine.curyInfoID), typeof(POLine.lineAmt))]
[PXUIField(DisplayName = "Ext. Cost")]
[PXFormula(typeof(Mult<POLine.orderQty, POLine.curyUnitCost>))]
[PXDefault(TypeCode.Decimal, "0.0")]
[PXUIVerify(typeof(Where<curyLineAmt, GreaterEqual<decimal0>, Or<Not<POLineType.Goods.Contains<lineType>>>>), PXErrorLevel.Error, CS.Messages.FieldShouldNotBeNegative, typeof(curyLineAmt), MessageArgumentsAreFieldNames = true, CheckOnRowSelected = true)]
public virtual Decimal? CuryLineAmt
{
get
{
return this._CuryLineAmt;
}
set
{
this._CuryLineAmt = value;
}
}
#endregion

Unfortunately, to the best of my knowledge, this precision cannot be updated once the currency has been used.  However, this isn’t a dead end!  With a simple CacheAttached in a graph extension for the screen you want to modify, you can PXRemoveAttribute(PXDBCurrencyAttriubute) and then add PXDBDecimal(3) to make it display as 3 decimal places.

That code would looks something like this:

#region POLine_CuryLineAmt_CacheAttached
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXRemoveBaseAttribute(typeof(PXDBCurrencyAttribute))]
[PXDBDecimal(3)]
protected virtual void POLine_CuryLineAmt_CacheAttached(PXCache sender) { }
#endregion

 

Userlevel 3
Badge

Do we have user interface preference to pre setup this. no need to customize. I setup setting in companies but it’s not effected in purchase

 

Userlevel 6
Badge +4

Do we have user interface preference to pre setup this. no need to customize. I setup setting in companies but it’s not effected in purchase

 

I believe the price/cost preference you marked is tied to the attribute [PXDBPriceCost].  (I think the quantity one is tied to PXDBQuantityAttribute.)  Again, this would require a minor customization to change the instruction in the DAC (or override for a specific graph/screen) to use that preference over that of the currency for precision.  The issue is that the field is currently defined with the attribute that instructs Acumatica to format the number of decimal places in accordance with the precision defined in the currency… and that precision cannot be updated once used at the currency level.

The level of difficulty of this sort of modification is minor, but I am not aware of any means of making such a change to this particular field without a customization.

Userlevel 3
Badge

Do we have user interface preference to pre setup this. no need to customize. I setup setting in companies but it’s not effected in purchase

 

I believe the PurchaseOrder.ExtCost (POLine.CuryLineAmt) precision can be changed on the currency screen however you can edit the precision in the currency if it is not yet used. The ExtCost field's precision can be changed to depend on the CommonSetup.decPlPrcCst in the company screen by creating a new custom attribute. This is possible because, according to the standard code, the ExtCost field uses the PXDBCurrency attribute, which depends on the currency's precision, while the UnitCost (POLine.CuryUnitCost) field uses the PXDBCurrencyPriceCost attribute, which depends on the Company by having an overridden function.

Badge +18

Hello,

To add to the above answers, the settings in Company screen are for Quantity and Unit Cost/Unit Price fields, and they are working correctly on your PO.

The Base Currency shown on your company is USD, a currency with only 2 Decimal places.  How will you pay a vendor with less than a penny, if your PO extends the Dollars to 3 decimal places?

Therefore you may choose another currency, or accept the amounts rounded to the nearest penny, in addition to the customization options mentioned above.

 

Laura

Userlevel 7
Badge +10

Hi @kevinheng21 ,

You need to set the DisplayFormat property to #0.000 for a decimal field.

 

Regards,

Sweta

Userlevel 7
Badge +17

@kevinheng21  As mentioned by @Brian Stevens  have you checked the code below? I have used same code in multiple projects and It is working fine.

 

#region POLine_CuryLineAmt_CacheAttached
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXRemoveBaseAttribute(typeof(PXDBCurrencyAttribute))]
[PXDBDecimal(3)]
protected virtual void POLine_CuryLineAmt_CacheAttached(PXCache sender) { }
#endregion

 

hi I have a same issue but on configuation entry screen- AM306000. any recommendations if this is only dev work and cannot be controlled from any settings in the system.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved