Class 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:
  • Constructor Details

    • MDepreciationWorkfile

      public MDepreciationWorkfile(Properties ctx, String A_Depreciation_Workfile_UU, String trxName)
      UUID based Constructor
      Parameters:
      ctx - Context
      A_Depreciation_Workfile_UU - UUID key
      trxName - Transaction
    • MDepreciationWorkfile

      public MDepreciationWorkfile(Properties ctx, int A_Depreciation_Workfile_ID, String trxName)
      Default Constructor
      Parameters:
      ctx - context
      A_Depreciation_Workfile_ID - line
      trxName -
    • MDepreciationWorkfile

      public MDepreciationWorkfile(Properties ctx, ResultSet rs, String trxName)
      Load Constructor
      Parameters:
      ctx - context
      rs - result set
    • MDepreciationWorkfile

      public MDepreciationWorkfile(MAsset asset, String postingType, MAssetGroupAcct assetgrpacct)
      Parameters:
      asset -
      postingType -
      assetgrpacct -
    • MDepreciationWorkfile

      public MDepreciationWorkfile(MDepreciationWorkfile copy)
      Copy constructor
      Parameters:
      copy -
    • MDepreciationWorkfile

      public MDepreciationWorkfile(Properties ctx, MDepreciationWorkfile copy)
      Copy constructor
      Parameters:
      ctx -
      copy -
    • MDepreciationWorkfile

      public MDepreciationWorkfile(Properties ctx, MDepreciationWorkfile copy, String trxName)
      Copy constructor
      Parameters:
      ctx -
      copy -
      trxName -
  • Method Details

    • getAsset

      public MAsset getAsset()
      Get Asset
    • getAsset

      public MAsset getAsset(boolean requery)
      Get asset using this trxName
      Parameters:
      requery - true to re-query from DB
      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:
      getAssetServiceDate in interface org.idempiere.fa.feature.UseLife
      Returns:
      asset service date
    • afterSave

      protected boolean afterSave(boolean newRecord, boolean success)
      After save
      Overrides:
      afterSave in class PO
      Parameters:
      newRecord -
      success -
      Returns:
      true on success
    • beforeSave

      protected boolean beforeSave(boolean newRecord)
      Description copied from class: PO
      Called before Save for Pre-Save Operation
      Overrides:
      beforeSave in class PO
      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)
      Parameters:
      ctx -
      asset_id -
      trxName -
      Returns:
      collection of MDepreciationWorkfile
    • get

      public static MDepreciationWorkfile get(Properties ctx, int A_Asset_ID, String postingType)
      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

      public Timestamp getLastActionDate()
      Returns:
      last day of previous month of DateAcct
    • 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
      Parameters:
      dateAcct -
      trxName -
      Returns:
      asset accounting model
    • getActualCost

      public BigDecimal 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

      public BigDecimal getActualCost(BigDecimal assetCost)
      Parameters:
      assetCost -
      Returns:
      assetCost - A_Salvage_Value
    • adjustCost

      public void adjustCost(BigDecimal deltaAmt, BigDecimal deltaQty, boolean reset)
      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

      public boolean adjustAccumulatedDepr(BigDecimal amt, BigDecimal amt_F, boolean reset)
      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

      public BigDecimal getA_Accumulated_Depr(boolean fiscal)
      Parameters:
      fiscal - true for A_Accumulated_Depr_F, false for A_Accumulated_Depr
      Returns:
      accumulated depreciation
    • getAccumulatedCost

      public BigDecimal getAccumulatedCost()
      Returns:
      accumulated cost
    • getReevaluationCost

      public BigDecimal getReevaluationCost()
      Returns:
      re-evaluation cost
    • getRemainingCost

      public BigDecimal getRemainingCost(BigDecimal accumAmt, boolean fiscal)
      Parameters:
      accumAmt - null to use current A_Accumulated_Depr/A_Accumulated_Depr_F value
      fiscal - true for A_Accumulated_Depr_F, false for A_Accumulated_Depr
      Returns:
      residual (remaining) value (actual cost - accumulated depreciation)
    • getRemainingCost

      public BigDecimal getRemainingCost(BigDecimal accumAmt)
      Parameters:
      accumAmt -
      Returns:
      residual (remaining) value (actual cost - accumulated depreciation)
    • getRemainingPeriods

      public int getRemainingPeriods(int A_Current_Period, MDepreciation method)
      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

      public static void updateFinantare(SetGetModel m, String changedColumnName)
      Update Funding Mode related fields
      Parameters:
      m - model
      changedColumnName - column name that has been changed
    • set_AttrValue

      public boolean set_AttrValue(String ColumnName, Object value)
      Specified by:
      set_AttrValue in interface SetGetModel
    • get_AttrValue

      public Object get_AttrValue(String ColumnName)
      Specified by:
      get_AttrValue in interface SetGetModel
    • is_AttrValueChanged

      public boolean is_AttrValueChanged(String ColumnName)
      Specified by:
      is_AttrValueChanged in interface SetGetModel