Re: Inserting item in a receipt from a list of items
Ciao Fabio,
Spero che tu stia bene.
You are correct. The reason you cannot delete certain products is because they have been referenced in one or many invoices.
If you want to remove those products, you would first need to delete all the invoices in which they appear. Once they are no longer referred to anywhere else, you will be able to proceed.
However, I would not be in favour of such an approach because:
1. you would lose visibility of what you have historically sold
2. there would be no audit trail.
However, I know that your system is already 'live' and you'll want to avoid changing your data structure and also keep program changes to a minimum.
One option might be to not remove the products at all but to do something like this.
1. in your program, wherever there is a combobox that show a list of products, change the combobox filter to exclude, for example, any product that contains the phrase 'now discontinued' (see screenshot1 in the attachment).
2. change the description of the product you want to delete; as an example, change 'hats' to 'hats (now discontinued)' or change 'trousers' to 'trousers (now discontinued)' - see screenshot2 and screenshot3.
This means you will still be able to see your old invoices but the description for the product will now read 'xxxxxxx (now discontinued)' (see screenshot4) but when you come to add new invoices, you will not see or be able to see or select those products that are 'now discontinued' (see screenshot5).
All of the above can be seen working in the attached example - just try changing a product description and you'll see how it works.
Maybe this is a possible solution for you?