I am in a situation where I need your help, I have a sales system made in Javafx (well it is more like a CRM), the fact is that in one of the modules is a billing or sales system, what happens is that for legal issues I have to correct or redo some entities of the database. I detail it:
Table goes out (Sale): - sale_id - sale_date - sale_state - customer_id - employee_id - sale_document (Invoice - Receipt) - sale_subtotal - sale_discount - sale_total
Product_sale table - sale_id - product_sale_id - product_sale_name - product_sale_unit - product_sale_price - product_sale_discount - product_sale_tax - product_sale_total
The fact is that due to legal issues in my country the invoices must be correlated by serial number and date, and it is recommended that the receipts follow the same rule (Although it is not mandatory, I want to respect it, to avoid problems with customers) . Well, the fact is that I used as invoice number the number of sales ie id_sale, and this generated me jumps in the series.
How could you solve this problem, that is, have the invoice numbers of the receipts independent, adding a field or creating another entity?