You can’t freeze data in a database per se. What you can do is copy the data you want to save to a new table that is not edited.
So for an invoice, you would make a new table with the invoice information. Then for each line item, you would copy that item information to a new table and link that item to the invoice. I would also include a link to the original item so that when a user clicks on the item in their invoice it takes them to the listing to buy it again.
Like this:
Here is a good overview on linking datatypes: Linking Data Types Types