After checking many sources, it seems there is (almost) no hard rule regarding invoice numbers. Some countries prefers global sequentially increasing number, which is fine but leaks number of invoices. Some countries prefer per customer sequentially increasing number, prefixed by customer identifier. The primary requirement is that having sequentially increasing number with no gaps in between. Also, many companies prefer to add prefixes/suffixes that are meaningful to them. One good convention is adding date to the invoice so it is easier to identify invoice date just from the invoice number. When all things considered, we opted to use the following format; YYMM-CCCCCCCCCC-DDDD YY: Last 2 digits of the year MM: Month number, 0-padded CCCCCCCC: 10 character customer identifier; same as last 10 characters of the project's UBID. We chose last 10 characters rather than first because it is easier to extend that to 12 characters if we need without hitting "-" DDDD: Sequentially increasing number for this particular project, 0-padded Using last 10 characters of the project in invoice number requires that 10 characters to be unique. We ensure that by creating a unique constraint on the last 10 characters of the project id. 16^10 = 1099511627776, which is 1 trillion projects.
319 B
319 B