Package org.adempiere.model
Interface ITaxProvider
- All Known Implementing Classes:
StandardTaxProvider
public interface ITaxProvider
Tax calculation interface
- Author:
- Elaine
-
Method Summary
Modifier and TypeMethodDescriptionbooleancalculateInvoiceTaxTotal(MTaxProvider provider, MInvoice invoice) Calculate invoice tax totalbooleancalculateOrderTaxTotal(MTaxProvider provider, MOrder order) Calculate order taxbooleancalculateRMATaxTotal(MTaxProvider provider, MRMA rma) Calculate rma tax totaldefault booleanDoes this provider correctly handle a tax-included price combined with a summary tax?booleanrecalculateTax(MTaxProvider provider, MInvoiceLine line, boolean newRecord) Re-calculate invoice tax for line (if line tax id change)booleanrecalculateTax(MTaxProvider provider, MOrderLine line, boolean newRecord) Re-calculate order tax for line (if line tax id change)booleanrecalculateTax(MTaxProvider provider, MRMALine line, boolean newRecord) Re-calculate rma tax for ram line (if line tax id change)booleanupdateHeaderTax(MTaxProvider provider, MInvoiceLine line) Update invoice tax totalbooleanupdateHeaderTax(MTaxProvider provider, MOrderLine line) Update order tax totalbooleanupdateHeaderTax(MTaxProvider provider, MRMALine line) Update rma header totalbooleanupdateInvoiceTax(MTaxProvider provider, MInvoiceLine line) Update invoice tax for linedefault booleanupdateLineTax(MTaxProvider provider, MInvoiceLine line) Update the line net amount, tax amount and line total amount of an invoice line.
Called when the line's tax amount must be calculated (before save, and when the line is created from an RMA line).
The default callsMInvoiceLine.setTaxAmt(), which: recalculates LineNetAmt (MInvoiceLine.setLineNetAmt()) stops there if the tax is document level and the invoice is a sales transaction calculates TaxAmt with the rate of the line's tax sets LineTotalAmt to LineNetAmt if the price includes tax, otherwise to LineNetAmt + TaxAmt A provider that calculates the tax itself can override this method, so that the line shows the same tax as the provider's document tax lines (see IDEMPIERE-7145).booleanupdateOrderTax(MTaxProvider provider, MOrderLine line) Update order tax for linebooleanupdateRMATax(MTaxProvider provider, MRMALine line) Update rma tax for rma linevalidateConnection(MTaxProvider provider, ProcessInfo pi) Validate connection to online tax calculation service.
-
Method Details
-
calculateOrderTaxTotal
Calculate order tax- Parameters:
provider-order-- Returns:
- true if success, false otherwise
-
updateOrderTax
Update order tax for line- Parameters:
provider-line-- Returns:
- true if success, false otherwise
-
recalculateTax
Re-calculate order tax for line (if line tax id change)- Parameters:
provider-line-newRecord-- Returns:
- true if success, false otherwise
-
updateHeaderTax
Update order tax total- Parameters:
provider-line-- Returns:
- true if success, false otherwise
-
calculateInvoiceTaxTotal
Calculate invoice tax total- Parameters:
provider-invoice-- Returns:
- true if success, false otherwise
-
updateInvoiceTax
Update invoice tax for line- Parameters:
provider-line-- Returns:
- true if success, false otherwise
-
recalculateTax
Re-calculate invoice tax for line (if line tax id change)- Parameters:
provider-line-newRecord-- Returns:
- true if success, false otherwise
-
updateHeaderTax
Update invoice tax total- Parameters:
provider-line-- Returns:
- true if success, false otherwise
-
calculateRMATaxTotal
Calculate rma tax total- Parameters:
provider-rma-- Returns:
- true if success, false otherwise
-
updateRMATax
Update rma tax for rma line- Parameters:
provider-line-- Returns:
- true if success, false otherwise
-
recalculateTax
Re-calculate rma tax for ram line (if line tax id change)- Parameters:
provider-line-newRecord-- Returns:
- true if success, false otherwise
-
updateHeaderTax
Update rma header total- Parameters:
provider-line-- Returns:
- true if success, false otherwise
-
validateConnection
Validate connection to online tax calculation service.- Parameters:
provider-pi-- Returns:
- error message or null
- Throws:
Exception
-
isTaxIncludedSummarySupported
default boolean isTaxIncludedSummarySupported()Does this provider correctly handle a tax-included price combined with a summary tax?
The native calculation (StandardTaxProvider) does not, so this combination is forbidden for it (see IDEMPIERE-6749).
A custom provider that delegates the whole tax calculation and computes this case correctly can override this method to return true, allowing the line to be saved (see IDEMPIERE-7069).- Returns:
- true if the provider computes a tax-included summary tax correctly - false by default
-
updateLineTax
Update the line net amount, tax amount and line total amount of an invoice line.
Called when the line's tax amount must be calculated (before save, and when the line is created from an RMA line).
The default callsMInvoiceLine.setTaxAmt(), which:- recalculates LineNetAmt (
MInvoiceLine.setLineNetAmt()) - stops there if the tax is document level and the invoice is a sales transaction
- calculates TaxAmt with the rate of the line's tax
- sets LineTotalAmt to LineNetAmt if the price includes tax, otherwise to LineNetAmt + TaxAmt
- Parameters:
provider- tax provider of the line's taxline- invoice line- Returns:
- true if success, false otherwise
- recalculates LineNetAmt (
-