Here’s what causes a gap in sale numbers (“missing sale numbers”). When someone starts an online sale, a sales record with a unique number is created (the next sequential number in your database). If the customer does not complete the sale for any reason (shopping cart times out, abandoned sale, etc.), that sale never gets completed, and goes away once the shopping cart has timed out. By that time, several other people could have started other online sales, which would all have unique sequential sale numbers. For instance, imagine you started a sale and were number 1000, then I started a sale as 1001 and Bruce started a sale as 1002. You and Bruce complete your sales, but I am just checking prices and need to come back and purchase later after I know how many friends I’m bringing. My shopping cart times out, and no sale is written to the database.
In this case, sales 1000 and 1002 are in the database, yet 1001 is not because I never completed the sale. Yet, that number needs to be assigned to the sales record at the beginning of the online sale, whether it is completed or not.