Sales tax based on gallons not dollars

We have a requirement to charge a flat percentage for sales tax on oil and gas products but tax is based on gallons sold and not invoice amount. I was thinking a customization which would use a UD field for the tax rate and then updating the tax amount on the order and invoice. Has anyone else setup sales tax on quantity instead of $'s?

You would be better using a Misc Charge and then a BPM to calculate it based on values of the line item and tax code.