I would suggest to concatenate the Header tables (Invoice and Orders) and adding a field DocumentType (1 for invoive and 2 for Order).
Then concatenate the detailed tables together.
The link between Header and Details would be done by their numbers (Check that there is no redundant numbers between Orders and invoices)
Then the calendar can be linked to the Header table !
Unfortunately I've same problem on position level too, 'cause I've some other fields that need main master (as item master, so group sales data by item group and so on)
It means that I need to concatenate all these data too .
Do u think I've only this solution or u have in mind something else ?