Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the tax for each line entry in the Quickbook Invoice using python quickbooks?

I am creating the invoice using python-quickbooks. I am creating multiple line-entries in the using the following code:

        #------------------------------------------------------
        #   Line Details
        #------------------------------------------------------

        line_detail = SalesItemLineDetail()
        line_detail.UnitPrice = 100  # in dollars
        line_detail.Qty = 1  # quantity can be decimal
        line_detail.ServiceDate = "2020-03-18"
       
        item_ref = Ref()
        item_ref.value = "1"
        item_ref.name = "Services"
        
        line = SalesItemLine()
        line.Amount = 100  # in dollars
        line.Description = "Line Entry Description"
        line.SalesItemLineDetail = line_detail
        line.SalesItemLineDetail.ItemRef = item_ref

However, I would to enable tax for each of the line entries and set the overall tax as "Federal Tax" at 12%

Any idea how to do it?

enter image description here

like image 421
Kiran Avatar asked Jul 16 '20 06:07

Kiran


People also ask

Can Python interact with QuickBooks?

With the CData Python Connector for QuickBooks, you can work with QuickBooks data just like you would with any database, including direct access to data in ETL packages like petl.

How to set up sales tax in QuickBooks Desktop?

Go to the Edit menu at the top, then select Preferences on the drop-down. 2. On the Preferences window, choose Sales Tax on the left pane. 3. Click on the Company Preferences tab. 4. Select Yes to turn on sales tax. Once done, you can now set up sales tax item. Here's how: 1. On the Company Preferences tab, click Add Sales Tax item. 2.

Can you show sales tax per line item in QuickBooks?

We're unable to show the tax per line item. The tax is not based per item but is based on location. I've got this article handy for your reference about managing sales tax in QuickBooks Online. Here's another one if you want to use automated sales tax on an invoice or sales receipt. Let me know if you have other questions. October 09, 2020 07:44 PM

Can I set up a tax inclusive price in Quickbooks Point of sale?

For now, we're unable to set up a tax inclusive price in QuickBooks Point of Sale. As a workaround, you can create a different item to represent your sales tax, then the price should be lesser. Or, you can discount the price by a standard rate. I will surely submit this idea to our management team.

What is QuickBooks income tax management?

The QuickBooks income tax management feature allows you to keep track of the income tax you own to the government. You’ll need to set up a liability account for this, but it’s a good idea to consult with your accountant on any account specifics when recording the liability to avoid any future issues.


1 Answers

Since your bounty states you are looking for an answer from a reputable source, I thought I'd give sources and the specific example you asked for.

Using default QuickBooks Rates

Applying the default Federal Tax is straigthforward. This issue on the python-quickbooks GitHub shows how:

line_detail.TaxRef = Ref()
line_detail.TaxRef.value = #TAX CODE HERE#

You will need to use the correct Tax Reference code for your country/region.

The only allowed values for the USA are "TAX" for standard sales tax or "NON" for no tax.

i.e.:

Sales tax for USA would be done like this:

line_detail.TaxRef = Ref()
line_detail.TaxRef.value = "TAX" 

If you want no tax for an item:

line_detail.TaxRef = Ref()
line_detail.TaxRef.value = "NON"  

Specifying a tax rate yourself

You can find more details about TaxCodes in Intuit's API Reference here.

You can find details about how the actual tax calculations are made at Manage sales tax for US locales.

The gist of it is that the ref tag is first checked, with the only valid values being "TAX" and "NON". The associated TaxService will use those codes to calculate the actual tax. You can create more codes that apply specific rates you specify yourself using TaxService.

To create your own TaxCode that is "Federal Tax" at a rate of 12%, you would do this:

from quickbooks.objects.taxservice import TaxService, TaxRateDetails

taxservice = TaxService()
taxservice.TaxCode = "Federal Tax"

tax_rate_detail = TaxRateDetails()
tax_rate_detail.TaxRateName = "Federal Tax"
tax_rate_detail.RateValue = 12
tax_rate_detail.TaxAgencyId = 1
tax_rate_detail.TaxApplicableOn = "Sales"   

taxservice.TaxRateDetails.append(tax_rate_detail)
created_taxservice = taxservice.save(qb=handle_to_your_quickbooks_client)
like image 102
Matthew Salvatore Viglione Avatar answered Sep 19 '22 11:09

Matthew Salvatore Viglione