I designed a db for orders. An order exists of one or more positions (lines) and each position can be delivered separately. Now, I want to make an invoice containing all orders and positions that have been delivered.
Eg: order #521 has 3 positions (1, 2 and 3). Positions 1 and 2 have been delivered, 3 not yet. My invoice of order #521 should contain position 1 and 2. When position 3 is delivered, another invoice will be created. Remark: the invoice number depends on the delivery note (inserted manually).
In order to produce invoices that list only those items that have been delivered, you will need to have an item status field on the item records that record whether they have been delivered yet.
Then I suggest you include a calc which references the invoiceID conditionally based on the item status. Eg:
If( ItemStatus = "Delivered"; InvoiceID)
The create a relationship from your invopice table to the items table which matches to the above calc. Only items that have a status of delivered will be addressed via this relationship. Now base the invoice layout that you want to print from on the new relationship and it should work as you've described.