Package org.compiere.model
Class MTax
java.lang.Object
org.compiere.model.PO
org.compiere.model.X_C_Tax
org.compiere.model.MTax
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparator<Object>
,I_C_Tax
,I_Persistent
,Evaluatee
,ImmutablePOSupport
Tax Model
- Version:
- $Id: MTax.java,v 1.3 2006/07/30 00:51:02 jjanke Exp $ red1 - FR: [ 2214883 ] Remove SQL code and Replace for Query trifonnt - BF [2913276] - Allow only one Default Tax Rate per Tax Category mjmckay - BF [2948632] - Allow edits to the Default Tax Rate
- Author:
- Jorg Janke
- See Also:
-
Field Summary
Fields inherited from class org.compiere.model.X_C_Tax
SOPOTYPE_AD_Reference_ID, SOPOTYPE_Both, SOPOTYPE_PurchaseTax, SOPOTYPE_SalesTax, TAXPOSTINGINDICATOR_AD_Reference_ID, TAXPOSTINGINDICATOR_DistributeTaxWithRelevantExpense, TAXPOSTINGINDICATOR_SeparateTaxPosting
Fields inherited from class org.compiere.model.PO
ACCESSLEVEL_ALL, ACCESSLEVEL_CLIENT, ACCESSLEVEL_CLIENTORG, ACCESSLEVEL_ORG, ACCESSLEVEL_SYSTEM, ACCESSLEVEL_SYSTEMCLIENT, ENTITYTYPE_Dictionary, ENTITYTYPE_UserMaintained, I_ZERO, LOCAL_TRX_PREFIX, log, p_ctx, p_info, UUID_NEW_RECORD, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
Fields inherited from interface org.compiere.model.I_C_Tax
accessLevel, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_AD_Rule_ID, COLUMNNAME_C_Country_ID, COLUMNNAME_C_CountryGroupFrom_ID, COLUMNNAME_C_CountryGroupTo_ID, COLUMNNAME_C_Region_ID, COLUMNNAME_C_Tax_ID, COLUMNNAME_C_Tax_UU, COLUMNNAME_C_TaxCategory_ID, COLUMNNAME_C_TaxProvider_ID, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_Description, COLUMNNAME_IsActive, COLUMNNAME_IsDefault, COLUMNNAME_IsDocumentLevel, COLUMNNAME_IsSalesTax, COLUMNNAME_IsSummary, COLUMNNAME_IsTaxExempt, COLUMNNAME_Name, COLUMNNAME_Parent_Tax_ID, COLUMNNAME_Rate, COLUMNNAME_RequiresTaxCertificate, COLUMNNAME_SOPOType, COLUMNNAME_TaxIndicator, COLUMNNAME_TaxPostingIndicator, COLUMNNAME_To_Country_ID, COLUMNNAME_To_Region_ID, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, COLUMNNAME_ValidFrom, Model, Table_ID, Table_Name
-
Constructor Summary
ConstructorDescriptionMTax
(Properties ctx, int C_Tax_ID, String trxName) Standard ConstructorMTax
(Properties ctx, String C_Tax_UU, String trxName) UUID based ConstructorMTax
(Properties ctx, String Name, BigDecimal Rate, int C_TaxCategory_ID, String trxName) New record ConstructorMTax
(Properties ctx, ResultSet rs, String trxName) Load ConstructorMTax
(Properties ctx, MTax copy) Copy constructorMTax
(Properties ctx, MTax copy, String trxName) Copy constructorCopy constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
afterSave
(boolean newRecord, boolean success) After Saveprotected boolean
beforeSave
(boolean newRecord) Called before Save for Pre-Save OperationcalculateTax
(BigDecimal amount, boolean taxIncluded, int scale) Calculate Tax Amountstatic MTax
get
(int C_Tax_ID) Get Tax from Cache (immutable)static MTax
get
(Properties ctx, int C_Tax_ID) Get Tax from Cache (immutable)static MTax[]
getAll
(Properties ctx) Get All Tax codes for client of this session/contextMTax[]
getChildTaxes
(boolean requery) Get Child Taxesstatic MTax
getCopy
(Properties ctx, int C_Tax_ID, String trxName) Get updateable copy of MTax from cachegetPostals
(boolean requery) Get Postal Qualifiersboolean
boolean
isPostal()
Is this tax uses postal code criteriaboolean
Is Zero Taxmark PO as immutabletoString()
String representationMethods inherited from class org.compiere.model.X_C_Tax
get_AccessLevel, getAD_Rule, getAD_Rule_ID, getC_Country_ID, getC_CountryGroupFrom, getC_CountryGroupFrom_ID, getC_CountryGroupTo, getC_CountryGroupTo_ID, getC_Region, getC_Region_ID, getC_Tax_ID, getC_Tax_UU, getC_TaxCategory, getC_TaxCategory_ID, getC_TaxProvider, getC_TaxProvider_ID, getDescription, getKeyNamePair, getName, getParent_Tax, getParent_Tax_ID, getRate, getSOPOType, getTaxIndicator, getTaxPostingIndicator, getTo_Country_ID, getTo_Region, getTo_Region_ID, getValidFrom, initPO, isDefault, isDocumentLevel, isRequiresTaxCertificate, isSalesTax, isSummary, isTaxExempt, setAD_Rule_ID, setC_Country_ID, setC_CountryGroupFrom_ID, setC_CountryGroupTo_ID, setC_Region_ID, setC_Tax_ID, setC_Tax_UU, setC_TaxCategory_ID, setC_TaxProvider_ID, setDescription, setIsDefault, setIsDocumentLevel, setIsSalesTax, setIsSummary, setIsTaxExempt, setName, setParent_Tax_ID, setRate, setRequiresTaxCertificate, setSOPOType, setTaxIndicator, setTaxPostingIndicator, setTo_Country_ID, setTo_Region_ID, setValidFrom
Methods inherited from class org.compiere.model.PO
afterDelete, beforeDelete, buildInsertSQL, checkImmutable, clearCrossTenantSafe, clone, columnExists, columnExists, compare, copyPO, copyValues, copyValues, createAttachment, delete, delete, delete_Accounting, delete_Tree, deleteEx, deleteEx, dump, dump, equals, get_Attribute, get_Attributes, get_ColumnCount, get_ColumnDescription, get_ColumnDisplayType, get_ColumnIndex, get_ColumnLabel, get_ColumnLookup, get_ColumnName, get_DisplayValue, get_HashMap, get_ID, get_IDOld, get_KeyColumns, get_Logger, get_OptimisticLockingColumns, get_Table_ID, get_TableName, get_Translation, get_Translation, get_Translation, get_Translation, get_Translation, get_TrxName, get_UUID, get_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueE, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_WhereClause, get_WhereClause, get_xmlDocument, get_xmlString, getAD_Client_ID, getAD_Org_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getDoc, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, getUUIDColumnName, getUUIDColumnName, hashCode, insert_Accounting, insert_Tree, insert_Tree, is_Changed, is_Immutable, is_new, is_UseOptimisticLocking, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, isReplication, load, load, load, load, loadByUU, loadComplete, loadDefaults, loadPO, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, saveCrossTenantSafe, saveCrossTenantSafeEx, saveCrossTenantSafeEx, saveEx, saveEx, saveNew_afterSetID, saveNew_getID, saveNewSpecial, saveReplica, saveUpdate, set_Attribute, set_ColumnUpdateable, set_CustomColumn, set_CustomColumnReturningBoolean, set_OptimisticLockingColumns, set_TrxName, set_TrxName, set_UseOptimisticLocking, set_Value, set_Value, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueOfColumn, set_ValueOfColumnReturningBoolean, set_ValueOfColumnReturningBoolean, setAD_Client_ID, setAD_Org_ID, setClientOrg, setClientOrg, setCrossTenantSafe, setDoc, setDocWorkflowMgr, setIsActive, setProcessedOn, setReplication, setStandardDefaults, setUpdateable, setUpdatedBy, toInsertSQL, unlock, update_Tree, validForeignKeys
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface org.compiere.model.I_C_Tax
getAD_Client_ID, getAD_Org_ID, getCreated, getCreatedBy, getUpdated, getUpdatedBy, isActive, setAD_Org_ID, setIsActive
Methods inherited from interface org.compiere.model.I_Persistent
save
-
Constructor Details
-
MTax
UUID based Constructor- Parameters:
ctx
- ContextC_Tax_UU
- UUID keytrxName
- Transaction
-
MTax
Standard Constructor- Parameters:
ctx
- contextC_Tax_ID
- idtrxName
- transaction
-
MTax
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- transaction
-
MTax
New record Constructor- Parameters:
ctx
-Name
-Rate
-C_TaxCategory_ID
-trxName
- transaction
-
MTax
Copy constructor- Parameters:
copy
-
-
MTax
Copy constructor- Parameters:
ctx
-copy
-
-
MTax
Copy constructor- Parameters:
ctx
-copy
-trxName
-
-
-
Method Details
-
getAll
Get All Tax codes for client of this session/context- Parameters:
ctx
- context- Returns:
- array of MTax
-
get
Get Tax from Cache (immutable)- Parameters:
C_Tax_ID
- id- Returns:
- MTax
-
get
Get Tax from Cache (immutable)- Parameters:
ctx
- contextC_Tax_ID
- id- Returns:
- MTax
-
getCopy
Get updateable copy of MTax from cache- Parameters:
ctx
-C_Tax_ID
-trxName
-- Returns:
- MTax
-
getChildTaxes
Get Child Taxes- Parameters:
requery
- true to reload from DB- Returns:
- array of taxes or null
-
getPostals
Get Postal Qualifiers- Parameters:
requery
- true to reload from DB- Returns:
- array of MTaxPostal
-
isPostal
public boolean isPostal()Is this tax uses postal code criteria- Returns:
- true if uses postal code criteria
-
isZeroTax
public boolean isZeroTax()Is Zero Tax- Returns:
- true if tax rate is 0
-
toString
Description copied from class:PO
String representation -
calculateTax
Calculate Tax Amount- Parameters:
amount
- base amount to calculate tax amounttaxIncluded
- if true tax amount is already included in the amount parameter and we need to extract tax amount from it.scale
- rounding scale for tax amount- Returns:
- tax amount
-
beforeSave
protected boolean beforeSave(boolean newRecord) Description copied from class:PO
Called before Save for Pre-Save Operation- Overrides:
beforeSave
in classPO
- Parameters:
newRecord
- new record- Returns:
- true if record can be saved
-
afterSave
protected boolean afterSave(boolean newRecord, boolean success) After Save -
markImmutable
Description copied from interface:ImmutablePOSupport
mark PO as immutable- Specified by:
markImmutable
in interfaceImmutablePOSupport
- Returns:
- PO
-
isDistributeTaxWithLineItem
public boolean isDistributeTaxWithLineItem()- Returns:
- - true if tax is posted to the product asset account and added to product cost (non deductible input tax).
- false if tax is posted to a separate GL account from product asset account (deductible input tax).
-