X0010GetNextNumber

Next Numbers

Minor Business Rule

Object Name: X0010

Parent DLL: CALLBSFN

Location: Client/Server

Language: C

Functional Description

Purpose

This function is used to retrieve a unique Next Number for a particular item (Batch, Journal Entry, 

Voucher, Invoice, etc...)


Setup Notes and Prerequisites

The Next Number Constant field will be checked by the function, to determine the type of Next 

Numbering that the J.D. World Source Company software is set up for.


Possible values are:

"0" or blank - NN by System Code method

"1" or blank - NN by Company/Document Type method

"2" or blank - NN by Company/Document Type/Fiscal Year/Century method


If using the System Code method, the function will retrieve the Next Number for the System Code and 

Index specified in the parameters.  If not found, it will return an error.  If no Index is specified, 

it will use a default Index.  If the System Code is '09', it will default to Index 02.  If the System 

Code is 03, 03B, or 04, it will use the UDC table to determine the default Index by document type.  You 

can put the Index number in the first two positions of the second description.  If System Code is 03 

or 03B, it uses UDC 00/DI - A/R Document Types.  If System Code is 04, it uses UDC 00/DV - A/P 

Document Types.  If the Index is still zero at this point, it defaults to Index 01.  The Index can not be 

greater than 10 or an error is returned.


If using the Company/Document Type method, the function will attempt to find the Next Number specific 

to the Company and Document Type passed in the parameters.  If not found it will add it.


If using the Company/Document Type/Fiscal Year/Century method, the function will attempt to find the 

Next Number specific to the Company, Document Type, Fiscal Year, and Century passed in the parameters. 

 If no records exist for the Company and Document Type only, the function will default to the Next 

Number by System Code method.  If records exist, but not in the specified Fiscal Year Century, it will 

be added for that Fiscal Year and Century.


The Same As Document Type functionality will work with a Next Number Constant of "1" or "2" only.  

This will cause the function to use the Next Number of another Document Type, so that multiple Document 

Types may use unique Next Numbers.


The Next Number retrieved will be returned in the Next Number 001 parameter of the function.  When 

using NN by System Code method, the next number can not be zero.  If it is zero, it is incremented to 1.



Technical Specification


Data Structure

D0000065 - Get Next Number

Parameter NameData ItemData TypeReq/OptI/O/Both
szSystemCodeSYcharNONENONE

Special Input Expected
Pass in the desired System Code to be used for the Next Number.

^

mnNextNumberingIndexNoNNIXMATH_NUMERICNONENONE


^

szCompanyKeyKCOcharNONENONE

Special Input Expected
If use of Next Numbers by Company/Document Type is allowed, pass the Company Number to be used to 

find the right Company in the F00021 table.

^

szDocumentTypeDCTcharNONENONE

Special Input Expected
If use of Next Numbers by Company/Document Type is allowed, pass the Document Type to be used to find 

the right Company/Document Type in the F00021 table.


^

mnCenturyCTRYMATH_NUMERICNONENONE

Special Input Expected
If use of Next Numbers by Company/Document Type is allowed, pass the Century to be used to find the 

right Company/Document Type/Century/Fiscal Year in the F00021 table.  The adding of Century and Fiscal 

Year to Company/Document Type allows Companies to reset their Next Numbers every year.


^

mnFiscalYear1FYMATH_NUMERICNONENONE

Special Input Expected
If use of Next Numbers by Company/Document Type is allowed, pass the Fiscal Year to be used to find 

the right Company/Document Type/Century/Fiscal Year in the F00021 table.  The adding of Century and 

Fiscal Year to Company/Document Type allows Companies to reset their Next Numbers every year.



^

szSameAsDocumentTypeSMAScharNONENONE

Special Input Expected
If use of Next Numbers by Company/Document Type is allowed, pass the Same As Document Type to be used 

to find the right Company/Document Type/Century/Fiscal Year in the F00021 table.  The use of the Same 

As Document Type parameter allows applications to use a set number of different document types that 

all point to a single set Next Numbers of a certain Document Type.

^

mnNextNumber001N001MATH_NUMERICNONENONE

Special Output Returned
This is the returned Next Number Value.

^

Related Functions

None

Related Tables

F0002 Next Numbers - Automatic
F00021 Next Numbers by Company/Fiscal Year - Automatic
F0005 User Defined Codes