Try this
Group on On InvoiceID
Create RT1 as "StartAmount":
Field to Summarize=Field A (inoice start amount)
Type of Summary=SUM
Evaluate=On CHange of Group (group1-invoiceID)
Reset=On CHange of Group (group1 invoiceGRoup)
Create a formula field 'PosNeg':
if invoicetype in ['credit', 'return'] then table.fieldBamount *-1 else table.fieldBamount
Create another RT as 'Rows'
Type of SUmmary=SUM
Evaluate=For each record
Reset=On CHange of group 1
Create a final Formual field as RowTotals (adding your 2 RTs togther)
#StartAmount + #Rows
Place on Details to see each row amount or in group footer to see the final for the invoice.
Can suppress details and still get total for group footer