Package org.compiere.model
Class MDepreciationWorkfile
- java.lang.Object
-
- org.compiere.model.PO
-
- org.compiere.model.X_A_Depreciation_Workfile
-
- org.compiere.model.MDepreciationWorkfile
-
- All Implemented Interfaces:
Serializable,Cloneable,Comparator<Object>,I_A_Depreciation_Workfile,I_Persistent,SetGetModel,Evaluatee,org.idempiere.fa.feature.UseLife
public class MDepreciationWorkfile extends X_A_Depreciation_Workfile implements org.idempiere.fa.feature.UseLife
Depreciation Workfile Model- Author:
- Teo Sarca, SC ARHIPAC SERVICE SRL
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.compiere.model.X_A_Depreciation_Workfile
A_TIP_FINANTARE_AD_Reference_ID, A_TIP_FINANTARE_Cofinantare, A_TIP_FINANTARE_Proprie, A_TIP_FINANTARE_Terti, POSTINGTYPE_Actual, POSTINGTYPE_AD_Reference_ID, POSTINGTYPE_Budget, POSTINGTYPE_Commitment, POSTINGTYPE_Reservation, POSTINGTYPE_Statistical
-
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, p_ctx, p_info, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
-
Fields inherited from interface org.compiere.model.I_A_Depreciation_Workfile
accessLevel, COLUMNNAME_A_Accumulated_Depr, COLUMNNAME_A_Accumulated_Depr_F, COLUMNNAME_A_Asset_Cost, COLUMNNAME_A_Asset_ID, COLUMNNAME_A_Asset_Life_Current_Year, COLUMNNAME_A_Asset_Life_Years, COLUMNNAME_A_Asset_Life_Years_F, COLUMNNAME_A_Asset_Remaining, COLUMNNAME_A_Asset_Remaining_F, COLUMNNAME_A_Base_Amount, COLUMNNAME_A_Calc_Accumulated_Depr, COLUMNNAME_A_Curr_Dep_Exp, COLUMNNAME_A_Current_Period, COLUMNNAME_A_Depreciation_Workfile_ID, COLUMNNAME_A_Depreciation_Workfile_UU, COLUMNNAME_A_Expense_SL, COLUMNNAME_A_Expense_SL_F, COLUMNNAME_A_FundingMode_ID, COLUMNNAME_A_Life_Period, COLUMNNAME_A_Life_Period_F, COLUMNNAME_A_Life_Period_Max, COLUMNNAME_A_Life_Period_Min, COLUMNNAME_A_Period_Forecast, COLUMNNAME_A_Period_Posted, COLUMNNAME_A_Prior_Year_Accumulated_Depr, COLUMNNAME_A_QTY_Current, COLUMNNAME_A_Salvage_Value, COLUMNNAME_A_Tip_Finantare, COLUMNNAME_A_Valoare_Cofinantare, COLUMNNAME_A_Valoare_Tert, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_AssetDepreciationDate, COLUMNNAME_C_AcctSchema_ID, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_DateAcct, COLUMNNAME_Description, COLUMNNAME_IsActive, COLUMNNAME_IsDepreciated, COLUMNNAME_PostingType, COLUMNNAME_Processed, COLUMNNAME_Processing, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, COLUMNNAME_UseLifeMonths, COLUMNNAME_UseLifeMonths_F, COLUMNNAME_UseLifeYears, COLUMNNAME_UseLifeYears_F, Model, Table_ID, Table_Name
-
-
Constructor Summary
Constructors Constructor Description MDepreciationWorkfile(Properties ctx, int A_Depreciation_Workfile_ID, String trxName)Default ConstructorMDepreciationWorkfile(Properties ctx, ResultSet rs, String trxName)Load ConstructorMDepreciationWorkfile(Properties ctx, MDepreciationWorkfile copy)MDepreciationWorkfile(Properties ctx, MDepreciationWorkfile copy, String trxName)MDepreciationWorkfile(MAsset asset, String postingType, MAssetGroupAcct assetgrpacct)MDepreciationWorkfile(MDepreciationWorkfile copy)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadjustAccumulatedDepr(BigDecimal amt, BigDecimal amt_F, boolean reset)Adjust Accumulated depreciationvoidadjustCost(BigDecimal deltaAmt, BigDecimal deltaQty, boolean reset)voidadjustUseLife(int deltaUseLifeYears, int deltaUseLifeYears_F, boolean reset)Adjust use life yearsprotected booleanafterSave(boolean newRecord)After saveprotected booleanbeforeSave(boolean newRecord)Called before Save for Pre-Save OperationvoidbuildDepreciation()Build depreciation (A_Depreciation_Exp) entries.static Collection<MDepreciationWorkfile>forA_Asset_ID(Properties ctx, int asset_id, String trxName)static MDepreciationWorkfileget(Properties ctx, int A_Asset_ID, String postingType)static MDepreciationWorkfileget(Properties ctx, int A_Asset_ID, String postingType, String trxName)Get/load workfile from cache (if trxName is null)static MDepreciationWorkfileget(Properties ctx, int A_Asset_ID, String postingType, String trxName, int C_AcctSchema_ID)Objectget_AttrValue(String ColumnName)BigDecimalgetA_Accumulated_Depr(boolean fiscal)MAssetAcctgetA_AssetAcct(Timestamp dateAcct, String trxName)Get Asset Accounting for this workfileBigDecimalgetAccumulatedCost()BigDecimalgetActualCost()Returns the current cost of FAs.BigDecimalgetActualCost(BigDecimal assetCost)MAssetgetAsset()Get AssetMAssetgetAsset(boolean requery)Get asset using this trxNameTimestampgetAssetServiceDate()Gets asset's service date (commissioning)TimestampgetLastActionDate()Returns the date of the last actionBigDecimalgetReevaluationCost()BigDecimalgetRemainingCost(BigDecimal accumAmt)Returns the residual (remaining) valueBigDecimalgetRemainingCost(BigDecimal accumAmt, boolean fiscal)Returns the residual (remaining) valueintgetRemainingPeriods(int A_Current_Period)intgetRemainingPeriods(int A_Current_Period, MDepreciation method)intgetUseLifeMonths(boolean fiscal)voidincA_Current_Period()Increment the current period (A_Current_Period) 1, and a month DateAcctbooleanis_AttrValueChanged(String ColumnName)booleanisDepreciated(Timestamp date)Check if the asset is depreciated at the specified datebooleanisFiscal()booleanisFullyDepreciated()Asset is fully depreciated If PostingType !booleanset_AttrValue(String ColumnName, Object value)voidsetA_Current_Period()Set A Current Period (and Data Act) processed just after the last expense.voidsetAsset(MAsset asset)Set assetvoidsetFiscal(boolean fiscal)Set fiscal flag (temporary - is not modifing the workfile)voidtruncDepreciation()Truncate not processed depreciation entries.static voidupdateFinantare(SetGetModel m, String changedColumnName)Update Founding Mode related fields-
Methods inherited from class org.compiere.model.X_A_Depreciation_Workfile
get_AccessLevel, getA_Accumulated_Depr, getA_Accumulated_Depr_F, getA_Asset, getA_Asset_Cost, getA_Asset_ID, getA_Asset_Life_Current_Year, getA_Asset_Life_Years, getA_Asset_Life_Years_F, getA_Asset_Remaining, getA_Asset_Remaining_F, getA_Base_Amount, getA_Calc_Accumulated_Depr, getA_Curr_Dep_Exp, getA_Current_Period, getA_Depreciation_Workfile_ID, getA_Depreciation_Workfile_UU, getA_Expense_SL, getA_Expense_SL_F, getA_FundingMode, getA_FundingMode_ID, getA_Life_Period, getA_Life_Period_F, getA_Life_Period_Max, getA_Life_Period_Min, getA_Period_Forecast, getA_Period_Posted, getA_Prior_Year_Accumulated_Depr, getA_QTY_Current, getA_Salvage_Value, getA_Tip_Finantare, getA_Valoare_Cofinantare, getA_Valoare_Tert, getAssetDepreciationDate, getC_AcctSchema, getC_AcctSchema_ID, getDateAcct, getDescription, getKeyNamePair, getPostingType, getUseLifeMonths, getUseLifeMonths_F, getUseLifeYears, getUseLifeYears_F, initPO, isDepreciated, isProcessed, isProcessing, setA_Accumulated_Depr, setA_Accumulated_Depr_F, setA_Asset_Cost, setA_Asset_ID, setA_Asset_Life_Current_Year, setA_Asset_Life_Years, setA_Asset_Life_Years_F, setA_Asset_Remaining, setA_Asset_Remaining_F, setA_Base_Amount, setA_Calc_Accumulated_Depr, setA_Curr_Dep_Exp, setA_Current_Period, setA_Depreciation_Workfile_ID, setA_Depreciation_Workfile_UU, setA_Expense_SL, setA_Expense_SL_F, setA_FundingMode_ID, setA_Life_Period, setA_Life_Period_F, setA_Life_Period_Max, setA_Life_Period_Min, setA_Period_Forecast, setA_Period_Posted, setA_Prior_Year_Accumulated_Depr, setA_QTY_Current, setA_Salvage_Value, setA_Tip_Finantare, setA_Valoare_Cofinantare, setA_Valoare_Tert, setAssetDepreciationDate, setC_AcctSchema_ID, setDateAcct, setDescription, setIsDepreciated, setPostingType, setProcessed, setProcessing, setUseLifeMonths, setUseLifeMonths_F, setUseLifeYears, setUseLifeYears_F, toString
-
Methods inherited from class org.compiere.model.PO
afterDelete, afterSave, 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_A_Depreciation_Workfile
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
-
Methods inherited from interface org.compiere.model.SetGetModel
get_Table_ID, get_TableName, get_TrxName
-
-
-
-
Constructor Detail
-
MDepreciationWorkfile
public MDepreciationWorkfile(Properties ctx, int A_Depreciation_Workfile_ID, String trxName)
Default Constructor- Parameters:
ctx- contextA_Depreciation_Workfile_ID- linetrxName-
-
MDepreciationWorkfile
public MDepreciationWorkfile(Properties ctx, ResultSet rs, String trxName)
Load Constructor- Parameters:
ctx- contextrs- result set
-
MDepreciationWorkfile
public MDepreciationWorkfile(MAsset asset, String postingType, MAssetGroupAcct assetgrpacct)
-
MDepreciationWorkfile
public MDepreciationWorkfile(MDepreciationWorkfile copy)
- Parameters:
copy-
-
MDepreciationWorkfile
public MDepreciationWorkfile(Properties ctx, MDepreciationWorkfile copy)
- Parameters:
ctx-copy-
-
MDepreciationWorkfile
public MDepreciationWorkfile(Properties ctx, MDepreciationWorkfile copy, String trxName)
- Parameters:
ctx-copy-trxName-
-
-
Method Detail
-
getAsset
public MAsset getAsset()
Get Asset
-
getAsset
public MAsset getAsset(boolean requery)
Get asset using this trxName- Parameters:
requery- requery asset- Returns:
- parent asset
-
setAsset
public void setAsset(MAsset asset)
Set asset- Parameters:
asset-
-
getAssetServiceDate
public Timestamp getAssetServiceDate()
Gets asset's service date (commissioning)- Specified by:
getAssetServiceDatein interfaceorg.idempiere.fa.feature.UseLife- Returns:
- asset service date
-
afterSave
protected boolean afterSave(boolean newRecord)
After save- Parameters:
newRecord-- Returns:
- true on success
-
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
-
isFullyDepreciated
public boolean isFullyDepreciated()
Asset is fully depreciated- If PostingType != ACTUAL then return false
- Do not check your current asset
- Returns:
- true if the asset is fully depreciated, false otherwise
-
forA_Asset_ID
public static Collection<MDepreciationWorkfile> forA_Asset_ID(Properties ctx, int asset_id, String trxName)
-
get
public static MDepreciationWorkfile get(Properties ctx, int A_Asset_ID, String postingType)
- Parameters:
ctx-A_Asset_ID-postingType-- Returns:
- workfile
- See Also:
get(Properties, int, String, String)
-
get
public static MDepreciationWorkfile get(Properties ctx, int A_Asset_ID, String postingType, String trxName, int C_AcctSchema_ID)
- Parameters:
ctx-A_Asset_ID-postingType-trxName-C_AcctSchema_ID- Account Schema- Returns:
- workfile
- See Also:
get(Properties, int, String, String)
-
get
public static MDepreciationWorkfile get(Properties ctx, int A_Asset_ID, String postingType, String trxName)
Get/load workfile from cache (if trxName is null)- Parameters:
ctx-A_Asset_ID-postingType-trxName-- Returns:
- workfile
-
getLastActionDate
public Timestamp getLastActionDate()
Returns the date of the last action
-
isDepreciated
public boolean isDepreciated(Timestamp date)
Check if the asset is depreciated at the specified date- Parameters:
date-- Returns:
- true if you amortized until the specified date, otherwise false
-
getA_AssetAcct
public MAssetAcct getA_AssetAcct(Timestamp dateAcct, String trxName)
Get Asset Accounting for this workfile- Returns:
- asset accounting model
-
getActualCost
public BigDecimal getActualCost()
Returns the current cost of FAs. It is calculated as the difference between acquisition value and the value that you (A_Salvage_Value)- Returns:
- the current cost of FAs
-
getActualCost
public BigDecimal getActualCost(BigDecimal assetCost)
-
adjustCost
public void adjustCost(BigDecimal deltaAmt, BigDecimal deltaQty, boolean reset)
- Parameters:
deltaAmt-deltaQty-reset-
-
adjustAccumulatedDepr
public boolean adjustAccumulatedDepr(BigDecimal amt, BigDecimal amt_F, boolean reset)
Adjust Accumulated depreciation- Parameters:
amt-amt_F-reset-- Returns:
-
adjustUseLife
public void adjustUseLife(int deltaUseLifeYears, int deltaUseLifeYears_F, boolean reset)Adjust use life years
-
getUseLifeMonths
public int getUseLifeMonths(boolean fiscal)
-
getA_Accumulated_Depr
public BigDecimal getA_Accumulated_Depr(boolean fiscal)
-
getAccumulatedCost
public BigDecimal getAccumulatedCost()
-
getReevaluationCost
public BigDecimal getReevaluationCost()
-
getRemainingCost
public BigDecimal getRemainingCost(BigDecimal accumAmt, boolean fiscal)
Returns the residual (remaining) value
-
getRemainingCost
public BigDecimal getRemainingCost(BigDecimal accumAmt)
Returns the residual (remaining) value
-
getRemainingPeriods
public int getRemainingPeriods(int A_Current_Period, MDepreciation method)
-
getRemainingPeriods
public int getRemainingPeriods(int A_Current_Period)
-
isFiscal
public boolean isFiscal()
-
setFiscal
public void setFiscal(boolean fiscal)
Set fiscal flag (temporary - is not modifing the workfile)- Parameters:
fiscal-
-
incA_Current_Period
public void incA_Current_Period()
Increment the current period (A_Current_Period) 1, and a month DateAcct
-
setA_Current_Period
public void setA_Current_Period()
Set A Current Period (and Data Act) processed just after the last expense. Do not save.
-
buildDepreciation
public void buildDepreciation()
Build depreciation (A_Depreciation_Exp) entries. More exactly, is deleting not Processed entries. and create new ones again. WARNING: IS NOT modifying workfile (this)
-
truncDepreciation
public void truncDepreciation()
Truncate not processed depreciation entries. IS NOT modifying workfile.
-
updateFinantare
public static void updateFinantare(SetGetModel m, String changedColumnName)
Update Founding Mode related fields- Parameters:
m- modelchangedColumnName- column name that has been changed
-
set_AttrValue
public boolean set_AttrValue(String ColumnName, Object value)
- Specified by:
set_AttrValuein interfaceSetGetModel
-
get_AttrValue
public Object get_AttrValue(String ColumnName)
- Specified by:
get_AttrValuein interfaceSetGetModel
-
is_AttrValueChanged
public boolean is_AttrValueChanged(String ColumnName)
- Specified by:
is_AttrValueChangedin interfaceSetGetModel
-
-