Ian Grieve drops some code to Get Next Journal Entry Number over at Azure curve.