Monday, 14 August 2017

Number to Words Localization

Good Day.

Today want to give you an idea on how can you customize amount to words transcription in Acumatica.That might be required for any language localization.
customize amount to words transcription in Acumatica
Here you can find simple example, but real complexity might be related to your language rules.

All the main work around that feature is done by [PX.Objects.AP.ToWordsAttribute]
It can be defined on virtual field, and upon accessing by UI or Report will do automatic transcription from number to text.
e.ReturnValue = LangEN.ToWords((decimal)((PXDecimalState)DecimalVal).Value, ((PXDecimalState)DecimalVal).Precision);

If you need you can apply that attribute to other amounts and reuse transcription for other reports.
You can read more about it on StackOverflow.
Here you can find gif how to apply customization as well:
customize amount to words transcription in Acumatica

In the code realization it is basically calls another class - PX.Objects.AP.LangEN, that actually does transcription.

For our localization we need to replace both of the classes. And in the code snippet below you can find an example of transcription on Russia language.

In the end we can just replace original attribute with our own.
public virtual string AmountToWords {get; set;}


Have a nice localization!

No comments: