user2870778
user2870778

Reputation: 107

Voucher Number Sequence according to months?

I want to update existing voucher number sequence to new one that change according to month i.e if the month is feb then number sequence should be like 02-0001. As i have researched and found that number sequence is auto generated from the wizard so i am facing some problem how to update this.

There is a method called newGetVoucherFromCode in number seq class that might be used to change the scope of voucher number sequence. The method is as follows :

public static NumberSeq newGetVoucherFromCode(
        NumberSequenceCode  _voucherSequenceCode,
        NumberSeqScope      _scope = NumberSeqScopeFactory::createDefaultScope(),
        boolean             _makeDecisionLater           = false,
        boolean             _dontThrowOnMissingRefSetUp  = false,
        //<GEERU><GEEU>
        UnknownNoYes        _allowManual                 = UnknownNoYes::Unknown)
        //</GEERU></GEEU>
{
    return NumberSeq::newGetVoucherFromId(
                NumberSequenceTable::findByNaturalKey(_voucherSequenceCode, _scope.getId()).RecId,
                _makeDecisionLater,
                _dontThrowOnMissingRefSetUp,
                //<GEERU><GEEU>
                _allowManual);
                //</GEERU></GEEU>
}

now how can I change its scope to makes it to generate number sequence month wise ?

Upvotes: 0

Views: 1581

Answers (1)

Jan B. Kjeldsen
Jan B. Kjeldsen

Reputation: 18051

It is a standard feature to make a number sequence follow the fiscal year and month.

See here how to do it: Year in number sequence

You will have to make a number sequence for each period:

Number sequence form with fiscal period

In order to use a period number sequence you will have to provide the company and fiscal period.

FiscalCalendarPeriod p;
select firstOnly p //This is not the way to find a fiscal period:
    where p.Month == FiscalPeriodMonth::Month1 && 
          p.StartDate == 01\01\2014 && 
          p.Type == FiscalPeriodType::Operating;
info(NumberSeq::newGetNumFromCode('Test', NumberSeqScopeFactory::createDataAreaFiscalCalendarPeriodScope(curext(),p.RecId)).num());

You will have to change the voucher number generation in journals to cope with this, which is not going to be an easy job.

Also see Customize Existing Number Sequence to Fiscal Year Number Sequence

Upvotes: 0

Related Questions