Just be aware...
Getting the next order number and sending it to the processor can be problematic
There is NO guarantee that when the processor says OK that the calculated next order number will still be available

In most cases it will be...
However there will always be the case where another order is completed before the processor returns
So that your order number sent to processor will differ to the one now used by your shop

That's probably why the previous programmer didn't send that number to the processor, as it cannot ALWAYS be relied upon.