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
public class MTax extends X_C_Tax implements 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:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.compiere.model.X_C_Tax
SOPOTYPE_AD_Reference_ID, SOPOTYPE_Both, SOPOTYPE_PurchaseTax, SOPOTYPE_SalesTax
-
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, 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_To_Country_ID, COLUMNNAME_To_Region_ID, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, COLUMNNAME_ValidFrom, Model, Table_ID, Table_Name
-
-
Constructor Summary
Constructors Constructor Description MTax(Properties ctx, int C_Tax_ID, String trxName)Standard ConstructorMTax(Properties ctx, String Name, BigDecimal Rate, int C_TaxCategory_ID, String trxName)New ConstructorMTax(Properties ctx, ResultSet rs, String trxName)Load ConstructorMTax(Properties ctx, MTax copy)MTax(Properties ctx, MTax copy, String trxName)MTax(MTax copy)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanafterSave(boolean newRecord, boolean success)After Saveprotected booleanbeforeSave(boolean newRecord)Called before Save for Pre-Save OperationBigDecimalcalculateTax(BigDecimal amount, boolean taxIncluded, int scale)Calculate Tax - no roundingstatic MTaxget(int C_Tax_ID)Get Tax from Cache (immutable)static MTaxget(Properties ctx, int C_Tax_ID)Get Tax from Cache (immutable)static MTax[]getAll(Properties ctx)Get All Tax codes (for AD_Client)MTax[]getChildTaxes(boolean requery)Get Child Taxesstatic MTaxgetCopy(Properties ctx, int C_Tax_ID, String trxName)Get updateable copy of MTax from cacheMTaxPostal[]getPostals(boolean requery)Get Postal QualifiersbooleanisPostal()Do we have Postal CodesbooleanisZeroTax()Is Zero TaxMTaxmarkImmutable()mark PO as immutableStringtoString()String representation-
Methods 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, 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, setTo_Country_ID, setTo_Region_ID, setValidFrom
-
Methods inherited from class org.compiere.model.PO
afterDelete, beforeDelete, 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_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, 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, load, loadByUU, loadComplete, loadDefaults, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, 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, 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 Detail
-
MTax
public MTax(Properties ctx, int C_Tax_ID, String trxName)
Standard Constructor- Parameters:
ctx- contextC_Tax_ID- idtrxName- transaction
-
MTax
public MTax(Properties ctx, ResultSet rs, String trxName)
Load Constructor- Parameters:
ctx- contextrs- result settrxName- transaction
-
MTax
public MTax(Properties ctx, String Name, BigDecimal Rate, int C_TaxCategory_ID, String trxName)
New Constructor- Parameters:
ctx-Name-Rate-C_TaxCategory_ID-trxName- transaction
-
MTax
public MTax(MTax copy)
- Parameters:
copy-
-
MTax
public MTax(Properties ctx, MTax copy)
- Parameters:
ctx-copy-
-
MTax
public MTax(Properties ctx, MTax copy, String trxName)
- Parameters:
ctx-copy-trxName-
-
-
Method Detail
-
getAll
public static MTax[] getAll(Properties ctx)
Get All Tax codes (for AD_Client)- Parameters:
ctx- context- Returns:
- MTax
-
get
public static MTax get(int C_Tax_ID)
Get Tax from Cache (immutable)- Parameters:
C_Tax_ID- id- Returns:
- MTax
-
get
public static MTax get(Properties ctx, int C_Tax_ID)
Get Tax from Cache (immutable)- Parameters:
ctx- contextC_Tax_ID- id- Returns:
- MTax
-
getCopy
public static MTax getCopy(Properties ctx, int C_Tax_ID, String trxName)
Get updateable copy of MTax from cache- Parameters:
ctx-C_Tax_ID-trxName-- Returns:
- MTax
-
getChildTaxes
public MTax[] getChildTaxes(boolean requery)
Get Child Taxes- Parameters:
requery- reload- Returns:
- array of taxes or null
-
getPostals
public MTaxPostal[] getPostals(boolean requery)
Get Postal Qualifiers- Parameters:
requery- requery- Returns:
- array of postal codes
-
isPostal
public boolean isPostal()
Do we have Postal Codes- Returns:
- true if postal codes exist
-
isZeroTax
public boolean isZeroTax()
Is Zero Tax- Returns:
- true if tax rate is 0
-
calculateTax
public BigDecimal calculateTax(BigDecimal amount, boolean taxIncluded, int scale)
Calculate Tax - no rounding- Parameters:
amount- amounttaxIncluded- if true tax is calculated from gross otherwise from netscale- scale- Returns:
- tax amount
-
beforeSave
protected boolean beforeSave(boolean newRecord)
Description copied from class:POCalled before Save for Pre-Save Operation- Overrides:
beforeSavein classPO- Parameters:
newRecord- new record- Returns:
- true if record can be saved
-
afterSave
protected boolean afterSave(boolean newRecord, boolean success)After Save
-
markImmutable
public MTax markImmutable()
Description copied from interface:ImmutablePOSupportmark PO as immutable- Specified by:
markImmutablein interfaceImmutablePOSupport- Returns:
- PO
-
-