Hi Rick,
If you wrote this query yourself, I have to say I am proud of you. That is a good looking and complicated query.
For the Gross profit and percentage, you can use the GrossBuyPr field from INV1 and RIN1
For the sales tax (VAT I take it ?), you will have to elaborate a little, because you can go through INV1 / RIN1 or through OINV / ORIN, depending on whether you just need a bulk sum, or say an item-wise percentage.
Sorry, COGS means what ? Cognitively and Overtly Gallivanting Scientists ?
Regards,
Johan