Lookup the default invoice number

Hello All

Is there away to lookup the default invoice number using a ODBC query? This has to work on Quantum 2010.

Thank you,

Nick

Parents
  • Hi Nick_Alpha,

    Yes, the next invoice number is stored in tCompShr.lInvNum

    lInvNum Number FT_LONG 4 Next invoice number

    lNxtPONum Number FT_LONG 4 Next purchase order number

    lNxtSONum Number FT_LONG 4 Next sales order number

    lNxtRcNum Number FT_LONG 4 Next receipt number

    lNxtDpNum Number FT_LONG 4 Next deposit number

    lNxtMBNum Number FT_LONG 4 Next other payments number

    I hope that helps, please flag this as the answer if it was what you were looking for.

    Randy

Reply
  • Hi Nick_Alpha,

    Yes, the next invoice number is stored in tCompShr.lInvNum

    lInvNum Number FT_LONG 4 Next invoice number

    lNxtPONum Number FT_LONG 4 Next purchase order number

    lNxtSONum Number FT_LONG 4 Next sales order number

    lNxtRcNum Number FT_LONG 4 Next receipt number

    lNxtDpNum Number FT_LONG 4 Next deposit number

    lNxtMBNum Number FT_LONG 4 Next other payments number

    I hope that helps, please flag this as the answer if it was what you were looking for.

    Randy

Children
  • Thanks Randy

    If  I import invoices with incremented invoice

    Numbers would the IInvnum be updated.

    Thanks,

    Nick

  • Hi,

    If you're using the invoice import capability built into the software (not the SDK, a utility, or some other method)

    The documentation in Dev-Import for the .IMP file format states that you can specify an invoice number, max 20 characters, or "If blank the next invoice number will be used"  The same warnings / info / dialog box questions may pop up during import.

    Using the program interface to manually key information in, it works like:

    If the 'next invoice number' is 12345  and invoices 12346, 12347, 12348, and 12349 are posted, the 'next invoice number' is still 12345. 

    At each entry, a dialog will pop up an information dialog that the invoice is higher than the last invoice entered, and ask to continue with the new numbering, or not.  Assuming that the software was directed to not increment the 'next invoice number' at each entry:

    Trying to add invoice 12346 will pop up a warning dialog stating that the invoice number has been used for another customer.

    Trying to add invoice 12346 for the same customer will pop up an error, because the customer ID and invoice number is a composite key.

    Using invoice 12345 and posting it will increment the 'next invoice number' to 12346 (which is already taken), and if you're entering manually you have to try a succession of invoice numbers, then agree to the 'continue with the new numbering' question.

    Importing by using the methods of the SDK would behave similarly to the user interface, except the dialogs are exceptions that you have to handle.

    I didn't test out to see exactly what happens when importing from a text file, as in dev-import.pdf

    You didn't mention what method you were using to import the data?

    I hope that helps,

    Randy

     

     

  • Thanks Randy

    I am planing to use com sdk import object methods to create an import abject, add the fields and import from

    a .cvs file. For the invoice numbers,

    I was planing to lookup then next_invoice number and then fill an array with a range of numbers starting from next_invoice and ending with next_invoice+number_of_invoices_to_import. Then I do query for existing invoices in this range and if there are any,I will remove them from the array . I will replete this process until I have the array filled with enough  unique invoice numbers then

    I will use these numbers in my imports. Do you think this skim will work.

    Thanks ,

    Nick.

  • Hi Nick,

    It sounds right, provided there can't be a race condition, such as invoice 12346 was unused a minute ago, and now it's been used.  

    If a race condition is possible (non single-user mode entry), then you have to handle a situation where the software may choose the next invoice number to assign to the transaction you just entered.  

    Test, test, test!