Have you seen this report?
ftp://ftp.iea-software.com/Emerald/reports/cr60/tax_sum.rpt
It does a lot of what you want.
> SQL Query follows....kinda
>
> /* tax summary for month by taxid */
> set nocount on
> declare @begindate char(10), @enddate char(10)
>
> select @begindate = '1/1/2000'
> select @enddate = '1/31/2000'
>
> set nocount off
A side note:
Tax is tracked at the line item detail, rather than the invoice
detail (so some items are taxable and some are not).
This is just a rough guess and hasn't been double checked:
Select TaxID, beforetax=sum(amount*quantity), taxes=sum(tax)+sum(tax2),
total=sum(amount*quantity)+sum(tax)+sum(tax2)