Quantcast
Channel: Acumatica Singapore
Viewing all articles
Browse latest Browse all 110

Customizing Numbering in Acumatica

$
0
0
Hi Guys,

Acumatica has flexible numbering sequences that allow us to create prefixes, separate numbering sets and basically serves well when there is a uniformity for the numbering for a given screen.

For example, when we issue specific number for specific month or year we can always create separate numbering sets with starting date from effective date for that month or year and problem will be solved.
Here is the example of numbering set for AR payment screen, where each month system will generate numbers for Payment Reference ID starting from predefined prefix and month code:


When we look at AR Setup screen, this numbering sequence ID is specified at Payment Numbering Sequence:

But this example is too simple. What if we need to use special numbering under specific condition. For example, when you do synchronization with external system, Oracle for example, it may be that you are getting Payment ID numbers from there, and need to override the Auto numbering sequence that is in force at your setup. Another words, from Oracle you can get number starting from IV instead of RV and the number itself should be from Oracle, not generated by Acumatica.

To solve it, we can add Numbering Sequence as a custom field to our setup screen. Just add a field to AR Setup, and make it same as other payment numbering sequence fields:

 Here is the customization code behind it:
<DAC type="PX.Objects.AR.ARSetup">
<Field FieldName="UsrARImportID" TypeName="string" MapDbTable="ARSetup" TextAttributes="#CDATA">
<CDATA name="TextAttributes"><![CDATA[[PXDBString(10, IsKey=false, BqlTable=typeof(PX.Objects.AR.ARSetup), IsFixed=false, IsUnicode=true)]
[PXDefault("ARIMPORT")]
[PXSelector(typeof(Numbering.numberingID))]
[PXUIField(DisplayName="Import Numbering Sequence")]]]></CDATA>
</Field>
</DAC>

And then we should create a new Numbering Sequence called ARIMPORT. Here is the hint, if we need number to come automatically from Acumatica, then we should feel it with something, but if number is provided from outside, say MANUALLY, then we can just create the ID ARIMPORT, leaving content blank:
Now next step, somehow we need to identify that the Data Import is going on. We have a special function to do it. So now I will go to the AR screen, then add data event Row Persisting, to the Document Level. Basically the number for the AR Invoice or payment is issued on save :)

Please take note of this.IsImport it changes to True when we do data import from Oracle.
Next we should tell the screen if this is Data Import process, not to use standard numbering sequence but to look at newly defined ARImport one:

So here we only do at Inserting the row, then we create numbering variable and pass whatever we keep in AR Setup, in our case it will be ARIMPORT value. Then we select from table Numbering the content for the ARIMPORT row. If we do have it there, we set autonumber variable to False.

So now we can decide what do we do, we manually populate the number from our Import file or call autonumbering process from ARIMPORT predefined sequence.

I do here manual population from the field UsrOrigRefNbr from the Import file.
But you can use commented code to call AutoNumberAttribute process to generate the number based on ARIMPORT Numbering Sequence content.

All the best,

Sergey.

Viewing all articles
Browse latest Browse all 110

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>