text: select TXCT as TXCTID, TAX as TAXID, TAX.NME as TAXNME, RATE, sum(SUBT) as SUBT, sum(SUFC) as SUFC
  from
  ( select PUINGDLN.TXCT, PURTLN.SUBT, PURTLN.SUFC from PURTLN
    join PUINGDLN on PUINGDLN.IID=PURTLN.INVL
    where PUINGDLN.TXCT is not null and PURTLN.RVID is null and PURTLN.OWNR=:INVID
  ) as ALLNS
  join TXCT on TXCT.IID=ALLNS.TXCT
  join TXCTLN on TXCTLN.OWNR=TXCT.IID
  join TAX on TXCTLN.TAX=TAX.IID
  group by TXCTID, TAXID, TAXNME, RATE
  order by TAXID;
  