我正在使用 python-quickbooks
创建发票.我正在使用以下代码在中创建多个行条目:
#------------------------------------------------------
# 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
但是,我会为每个行条目启用税,并将总税设置为 12% 的“联邦税”知道怎么做吗?
最佳答案
由于您的赏金声明您正在寻找信誉良好的来源的答案,因此我想我会提供来源和您要求的具体示例。
使用默认的 QuickBooks 费率
应用默认的联邦税是直接的。 This关于 python-quickbooks
的问题GitHub 展示了如何:
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.
美国唯一允许的值为“TAX”(表示标准销售税)或“NON”(表示无税)。
IE。:
美国的销售税将是这样完成的:
line_detail.TaxRef = Ref()
line_detail.TaxRef.value = "TAX"
如果您不想为某件商品征税:line_detail.TaxRef = Ref()
line_detail.TaxRef.value = "NON"
自己指定税率您可以在 Intuit 的 API 引用 here 中找到有关税码的更多详细信息.
您可以在 Manage sales tax for US locales 找到有关如何进行实际税收计算的详细信息。 .
其要点是首先检查 ref 标签,唯一有效的值是
"TAX"
和 "NON"
.关联的 TaxService 将使用这些代码来计算实际税费。您可以使用 TaxService 创建更多应用您自己指定的特定费率的代码。 .创建您自己的
TaxCode
即 "Federal Tax"
以 12%
的速率,你会这样做: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)
关于python - 如何使用python quickbooks为Quickbook Invoice中的每个行条目设置税金?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62929034/