0

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 ?

user2870778
  • 107
  • 2
  • 13

1 Answers1

0

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

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
  • I know how to do it but I am not able to do it for Voucher number, I am not able to find the VOUCHER edt in LoadModule to add the parameter of fiscal year to it. – user2870778 Sep 01 '14 at 04:49
  • As previously told voucher numbers are not defined in `loadModule`: http://stackoverflow.com/questions/25486294/voucher-number-sequence – Jan B. Kjeldsen Sep 01 '14 at 19:11
  • I don't need year in it , I just want month in the number sequence, yes I know it is not an easy job to do it for voucher number – user2870778 Sep 02 '14 at 08:45
  • Well, this does not change the answer, you still need a sequence for each and every fiscal period. – Jan B. Kjeldsen Sep 02 '14 at 09:03