If you require the invoice to calculate values based on optional fields, then this won't be possible for you. For example, you have a field 'current payment due this invoice' which is a calculation of subtracting 'previously applied' from 'total earned less retainage'. There are no Invoices spec codes such as 'Total Amount minus Optional Field 1' - because optional fields could also be defined as text or dates. This is where the problem will probably lie for you.
In a more general sense, you are looking to do partial billing - which Adagio Invoices is not really set up to do at this time.