ARInvoice.GetShipments - Incorrect Invoice Header Total

Happy Friday All,
We have been using ERS (Auto Invoice) since go live and it’s always been a bit of a nuisance, because

  1. It posts straight away, which requires RMAs for incorrect shipments
  2. it’s bloody slow

Finally created a funtion that creates a daily Invoice group and add’s each shipment invoice. Works fast and also created a function to delete the invoice from the shipment.
Looked great until I realised the invoice header calculation total is incorrect.
What I mean is:
I ship one line of 100 part a at $0.4 = 40$
Australian Tax is simple, 10% GST on top
So the line shows subtotal of $40 + $4 Tax = $44
BUT
The Invoice Header shows Line Amounts $36 + $4 Tax = Total $40 ???

It looks like it’s deducting the tax amount from the Line Amounts when creating the header.
When I pull in the invoice through invoice entry - Get Shipments, it works correctly
The Invoice Header shows Line Amounts $40 + $4 Tax = Total $44

The trace doesn’t show any other method involved, and no errors occur.
Any ideas or hints???
Thanks