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:
-
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_StatisticalFields 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, UUID_NEW_RECORD, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_IDFields 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
ConstructorsConstructorDescriptionMDepreciationWorkfile(Properties ctx, int A_Depreciation_Workfile_ID, String trxName) Default ConstructorMDepreciationWorkfile(Properties ctx, String A_Depreciation_Workfile_UU, String trxName) UUID based ConstructorMDepreciationWorkfile(Properties ctx, ResultSet rs, String trxName) Load ConstructorMDepreciationWorkfile(Properties ctx, MDepreciationWorkfile copy) Copy constructorMDepreciationWorkfile(Properties ctx, MDepreciationWorkfile copy, String trxName) Copy constructorMDepreciationWorkfile(MAsset asset, String postingType, MAssetGroupAcct assetgrpacct) Copy constructor -
Method Summary
Modifier and TypeMethodDescriptionbooleanadjustAccumulatedDepr(BigDecimal amt, BigDecimal amt_F, boolean reset) Adjust Accumulated depreciationvoidadjustCost(BigDecimal deltaAmt, BigDecimal deltaQty, boolean reset) Adjust asset cost and qty with deltaAmt and deltaQtyvoidadjustUseLife(int deltaUseLifeYears, int deltaUseLifeYears_F, boolean reset) Adjust use life yearsprotected booleanafterSave(boolean newRecord, boolean success) Called after Save for Post-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.protected booleanbeforeSave(boolean newRecord) Called before Save for Pre-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.voidBuild depreciation (A_Depreciation_Exp) entries.
More exactly, is deleting not Processed entries and create new ones again.
WARNING: IS NOT modifying workfile (this).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) get_AttrValue(String ColumnName) Get column valuegetA_Accumulated_Depr(boolean fiscal) getA_AssetAcct(Timestamp dateAcct, String trxName) Get Asset Accounting for this workfileReturns the current cost of FAs.getActualCost(BigDecimal assetCost) getAsset()Get AssetgetAsset(boolean requery) Get asset using this trxNameGets asset's service date (commissioning)getRemainingCost(BigDecimal accumAmt) getRemainingCost(BigDecimal accumAmt, boolean fiscal) intgetRemainingPeriods(int A_Current_Period) intgetRemainingPeriods(int A_Current_Period, MDepreciation method) intgetUseLifeMonths(boolean fiscal) voidIncrement the current period (A_Current_Period) 1, and a month DateAcct.booleanis_AttrValueChanged(String ColumnName) Is column changebooleanisDepreciated(Timestamp date) Check if the asset is depreciated at the specified datebooleanisFiscal()booleanAsset is fully depreciated If PostingType !booleanset_AttrValue(String ColumnName, Object value) Set column valuevoidSet A Current Period (and Data Act) to period after the latest expense (MDepreciationExp) record.voidSet assetvoidsetFiscal(boolean fiscal) Set fiscal flag (in memory only - this is not modifying the work file)voidTruncate not processed depreciation entries.static voidupdateFinantare(SetGetModel m, String changedColumnName) Update Funding Mode related fieldsMethods 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, toStringMethods 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_TableAttribute, get_TableAttributeAsBoolean, get_TableAttributeAsInt, get_TableAttributes, 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, validForeignKeysExMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongMethods inherited from interface org.compiere.model.I_A_Depreciation_Workfile
getAD_Client_ID, getAD_Org_ID, getCreated, getCreatedBy, getUpdated, getUpdatedBy, isActive, setAD_Org_ID, setIsActiveMethods inherited from interface org.compiere.model.I_Persistent
saveMethods inherited from interface org.compiere.model.SetGetModel
get_Table_ID, get_TableName, get_TrxNameMethods inherited from interface org.idempiere.fa.feature.UseLife
getCtx
-
Constructor Details
-
MDepreciationWorkfile
UUID based Constructor- Parameters:
ctx- ContextA_Depreciation_Workfile_UU- UUID keytrxName- Transaction
-
MDepreciationWorkfile
Default Constructor- Parameters:
ctx- contextA_Depreciation_Workfile_ID- linetrxName-
-
MDepreciationWorkfile
Load Constructor- Parameters:
ctx- contextrs- result set
-
MDepreciationWorkfile
- Parameters:
asset-postingType-assetgrpacct-
-
MDepreciationWorkfile
Copy constructor- Parameters:
copy-
-
MDepreciationWorkfile
Copy constructor- Parameters:
ctx-copy-
-
MDepreciationWorkfile
Copy constructor- Parameters:
ctx-copy-trxName-
-
-
Method Details
-
getAsset
Get Asset -
getAsset
Get asset using this trxName- Parameters:
requery- true to re-query from DB- Returns:
- parent asset
-
setAsset
Set asset- Parameters:
asset-
-
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, boolean success) Description copied from class:POCalled after Save for Post-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it. -
beforeSave
protected boolean beforeSave(boolean newRecord) Description copied from class:POCalled before Save for Pre-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.- Overrides:
beforeSavein classPO- Parameters:
newRecord- true if it is a 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) - Parameters:
ctx-asset_id-trxName-- Returns:
- collection of MDepreciationWorkfile
-
get
- Parameters:
ctx-A_Asset_ID-postingType-- Returns:
- workfile
- See Also:
-
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
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
- Returns:
- last day of previous month of DateAcct
-
isDepreciated
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
Get Asset Accounting for this workfile- Parameters:
dateAcct-trxName-- Returns:
- asset accounting model
-
getActualCost
Returns the current cost of FAs. It is calculated as the difference between acquisition value and salvage value (A_Salvage_Value).- Returns:
- the current cost of FAs
-
getActualCost
- Parameters:
assetCost-- Returns:
- assetCost - A_Salvage_Value
-
adjustCost
Adjust asset cost and qty with deltaAmt and deltaQty- Parameters:
deltaAmt-deltaQty-reset- true to use deltaAmt and deltaQty as current asset cost and qty
-
adjustAccumulatedDepr
Adjust Accumulated depreciation- Parameters:
amt-amt_F-reset- true to use amt and amt_F as new value- Returns:
- true
-
adjustUseLife
public void adjustUseLife(int deltaUseLifeYears, int deltaUseLifeYears_F, boolean reset) Adjust use life years- Parameters:
deltaUseLifeYears-deltaUseLifeYears_F-reset- true to use deltaUseLifeYears and deltaUseLifeYears_F as new value
-
getUseLifeMonths
public int getUseLifeMonths(boolean fiscal) - Parameters:
fiscal- true for UseLifeMonths_F, false for getUseLifeMonths- Returns:
- use life in months
-
getA_Accumulated_Depr
- Parameters:
fiscal- true for A_Accumulated_Depr_F, false for A_Accumulated_Depr- Returns:
- accumulated depreciation
-
getAccumulatedCost
- Returns:
- accumulated cost
-
getReevaluationCost
- Returns:
- re-evaluation cost
-
getRemainingCost
- Parameters:
accumAmt- null to use current A_Accumulated_Depr/A_Accumulated_Depr_F valuefiscal- true for A_Accumulated_Depr_F, false for A_Accumulated_Depr- Returns:
- residual (remaining) value (actual cost - accumulated depreciation)
-
getRemainingCost
- Parameters:
accumAmt-- Returns:
- residual (remaining) value (actual cost - accumulated depreciation)
-
getRemainingPeriods
- Parameters:
A_Current_Period-method-- Returns:
- remaining periods
-
getRemainingPeriods
public int getRemainingPeriods(int A_Current_Period) - Parameters:
A_Current_Period-- Returns:
- remaining periods
-
isFiscal
public boolean isFiscal()- Returns:
- true for fiscal, false otherwise
-
setFiscal
public void setFiscal(boolean fiscal) Set fiscal flag (in memory only - this is not modifying the work file)- 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) to period after the latest expense (MDepreciationExp) record. This method do not save to DB. -
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
Update Funding Mode related fields- Parameters:
m- modelchangedColumnName- column name that has been changed
-
set_AttrValue
Description copied from interface:SetGetModelSet column value- Specified by:
set_AttrValuein interfaceSetGetModel- Parameters:
ColumnName- column name- Returns:
- true if successfully set
-
get_AttrValue
Description copied from interface:SetGetModelGet column value- Specified by:
get_AttrValuein interfaceSetGetModel- Parameters:
ColumnName- column name- Returns:
- column value
-
is_AttrValueChanged
Description copied from interface:SetGetModelIs column change- Specified by:
is_AttrValueChangedin interfaceSetGetModel- Returns:
- true if column has change
-