Tuesday, 17 June 2014

Get different number seq base on asset group in ax 2012 R2

Get different number seq base on asset group :-

NumberSeq                   assetIdNumberSeq;
NumberSequenceTable         numberSequenceTable;
NumberSequenceReference     numberSequenceReference
;
 if (assetIdNumberSeq)
        assetIdNumberSeq.abort();
assetIdNumberSeq = assetTable.initAssetNumberSeq(FleetAsset::find(FleetTable.FleetGroup).AssetGroup);
if (assetIdNumberSeq)
{
    info(strfmt('%1',assetIdNumberSeq.num());
}

public server NumberSeq initAssetNumberSeq(AssetGroupId _assetGroupId = '')
{
    AssetParameters assetParameters = AssetParameters::find();
    AssetGroup      assetGroup = AssetGroup::find(_assetGroupId ? _assetGroupId : this.AssetGroup);
    NumberSeq       assetNumberSeq;
    ;

    if (assetGroup.AutoNumber && assetGroup.AutoNumberSequenceTable)
    {
        assetNumberSeq = NumberSeq::newGetNumFromId(assetGroup.AutoNumberSequenceTable, true);
    }

    if (!assetNumberSeq && assetParameters.AutoNumber)
    {
        assetNumberSeq = NumberSeq::newGetNum(AssetParameters::numRefAssetId(),true);
    }

    return assetNumberSeq;
}

http://allaboutax.blogspot.in/2012/03/multiple-auto-manual-number-sequences.html

http://allaboutax.blogspot.in/2012/03/add-new-number-sequence-to-existing-ax.html

No comments:

Post a Comment