I'm creating an invoice system where I would like to move records from the line items table to an invoice items table. Copying the order table to the invoice table is quite easy using variables. On the order layout I have created a portal where we can enter the order line items. This basically copies the product information from the products table so that the prices and other fields can be customized without editing the original product record in the product table.
Orders <-> Order Line Items
Invoice <-> Invoice Line Items
It must be unable for the users to edit the invoices for tax authorities purposes. This is why I want it to be copied so users can modify orders as they like but are unable to edit or delete the invoices. I am thinking of a loop for counting the records in the order line items and then copy them? Thing is I can't really understand how to construct the loop if this is the way to go. Hopefully somebody can help me a little, thanks in advance :-)