Apply AR Advanced Billing against specific invoice lines when goods shipped

We use Advanced Billing in AR to invoice upfront amounts to customers based on an agreed percentage. When creating the Advanced Billing invoice we apply the percentage individually to each line of the sales order.
Once the goods are shipped however and we invoice the balance to the customer, the total advanced billing amount is applied to the invoice lines with no regard to how they were assigned in the Advanced Billing invoice. Instead, the advanced billed amount is applied such that it starts at the first line of the invoice and continues to apply against each invoice line until there is no more to apply.
The result it that we have a final invoice to the customer that has some lines with zero value, perhaps one line with a part value and the remaining at 100% value. We actually need to have each invoice line showing with a value that is equal to the full amount of the sale less the percentage that was Advance Billed for the line.
Is there a way this can be done, or does anyone have any suggestions as to how we can better process our invoices to achieve the desired outcome.

Have managed to work this out with a bit of testing. Issue was related to multiple releases against a sales order line. Epicor seems to ignore advanced billing at the release level and just looks at the total advanced billing against an order line when allocating it to an invoice line.

Going forward, we will need to only have one release for each order line where we want to use Advanced Billing.