I have a Windows Form application developed in C # and with SQL database.
One of the functions of the system is to carry out SALES for different companies and different POS (different point of sale), however, using a single database. I use ID to control the sale it is bigint AUTO_INCREMENT
in the database.
Problem: Company 1 sells 1, 3, and 5 company 2 sells 2, 4, 6 the customer thinks the system is wrong because it is not following a sequential sales order.
I thought about putting Company Code + Number of the sale.
However, the company is recorded in the same customer table so I can easily a company with code 9000 and I can have a sale with the code 10000 I am afraid of then this field blind. What kind of data could I use to prevent this?
Problem 2: I have a registered company 1 and 11 the system can be lost when making the sale when company 1 makes the sale 11 or when the company 11 makes the sale 1.
How can I solve this problem?