Start a new topic
Answered

Set shipping to taxable via script

By default, our shipping amount is set to non-taxable because we use an API to determine taxes. However, there are certain, rare instances where we do not use the API. In those instances, we would need the shipping to be taxable. I wish to automate this to avoid a user forgetting to make the change manually. Is this doable or is it better to handle it via the taxes directly?


Best Answer

The field you'll want to update is DocumentHeaders.ShippingPricingMethod


One example entry would be:

M 0 Y Product


In this case, the Y might be an N.

I find that setting the value manually, saving it and then reviewing what it looks like in the database will clearly show me what it needs to be automatically set to in the appropriate situation.


(Things like 'Product' relate to the Item Type of shipping, if that's used).


Not quite following, let me try:


You build a quote and, by default, the shipping amount is set to non-taxable.

You use an API (doing what? something you've built) which sets the tax rate. What's shipping being non-taxable got to do with tax values?


What's the logic behind shipping needing to flip to taxable?

We use Avalara's transactional API's to handle taxes for cost of goods, shipping, and processing. Because we hit tax thresholds, I've been using Cost of Goods / Total Tax to determine a tax rate instead of just grabbing the tax rate by zip, etc. I apply this tax rate to the quote to get the total taxes. I have used Avalara's tax calculator to determine the accuracy. In some cases, we will quote a job in a state that Avalara thinks we do not collect taxes on, but need to because the total will push us over the nexus. In this instance, the API will return $0 for taxes. In the same script which calls the API, I also check against a list of states that fall in this 'not yet met nexus' category and ask the user if they want to use the API or use a manually set tax rate. If they select the manual tax rate, I would then need to make sure shipping is taxable. Hopefully that provides enough information.  

"..In the same script which calls the API.."


Is this a script you've built? If so, can you not apply the appropriate additional logic there (or set a flag on a custom field, so that when that flag is set the shipping tax rate is set to taxable)?


Alternatively, a simple MsgBox to query the user if the tax rate on a document is not 0.00 but shipping is still set to non-taxable?


(Perhaps separate, but might be useful to know of if you're not already. This, basically, brings the power of Avalara into QW: https://www.connectit-software.co.uk/bespoke-software-development/quotewerks-avalara-avatax.aspx)

Thought I replied to this.. clearly didn't leave it long enough after hitting 'post comment'.

"..In the same script which calls the API.." Is this a script you wrote? If so, could you not amend that to add the logic you want? Alternatively, throw some sort of flag/warning/reminder if the tax rate is (or isn't) set to 0%?

I don't know if the 3rd party Avalara integration would be useful to you (I think, maybe, linking to that webpage rejected my earlier attempted post)

Yes I could, but I don't know how. What is the code to change the shipping to taxable instead of non-taxable? I only know of a way to set the shipping amount, not its properties.

Answer

The field you'll want to update is DocumentHeaders.ShippingPricingMethod


One example entry would be:

M 0 Y Product


In this case, the Y might be an N.

I find that setting the value manually, saving it and then reviewing what it looks like in the database will clearly show me what it needs to be automatically set to in the appropriate situation.


(Things like 'Product' relate to the Item Type of shipping, if that's used).

I do not see that in the DocumentHeaders help documentation. I'll give that a try and let you know if that works. Thanks.

This worked for me:


iError = Application.DocFunctions.SetDocumentHeaderValue("ShippingPricingMethod", Y, True)


 Thank you.

Login or Signup to post a comment