question: public void buildDepreciation ( ) { if ( ! isDepreciated ( ) ) { return ; } StringBuffer sb = new StringBuffer ( ) ; load ( get_TrxName ( ) ) ; MAssetAcct assetacct = getA_AssetAcct ( null , get_TrxName ( ) ) ; MDepreciation depreciation_C = MDepreciation . get ( getCtx ( ) , assetacct . getA_Depreciation_ID ( ) ) ; MDepreciation depreciation_F = MDepreciation . get ( getCtx ( ) , assetacct . getA_Depreciation_F_ID ( ) ) ; int offset_C = 0 , offset_F = 0 ; BigDecimal assetCost = getActualCost ( ) ; BigDecimal accumDep_C = getA_Accumulated_Depr ( false ) ; BigDecimal accumDep_F = getA_Accumulated_Depr ( true ) ; int lifePeriods_C = getUseLifeMonths ( false ) + offset_C ; int lifePeriods_F = getUseLifeMonths ( true ) + offset_F ; int lifePeriods = ( lifePeriods_C > lifePeriods_F ? lifePeriods_C : lifePeriods_F ) ; BigDecimal exp_C = Env . ZERO ; BigDecimal exp_F = Env . ZERO ; if ( CLogMgt . isLevelFine ( ) ) { sb . append ( "currentPeriod=" + getA_Current_Period ( ) + ", AssetServiceDate=" + getAssetDepreciationDate ( ) + "\n" ) ; sb . append ( "offset: C|F=" + offset_C + "|" + offset_F + "\n" ) ; sb . append ( "life: C|F=" + lifePeriods_C + "|" + lifePeriods_F + " + offset =" + lifePeriods + "\n" ) ; } truncDepreciation ( ) ; int A_Current_Period = getA_Current_Period ( ) ; for ( int currentPeriod = A_Current_Period , cnt = 1 ; currentPeriod <= lifePeriods ; currentPeriod ++ , cnt ++ ) { exp_C = Env . ZERO ; exp_F = Env . ZERO ; String help = "" + accumDep_C + "|" + accumDep_F + " + " ; if ( lifePeriods_C > currentPeriod || ! depreciation_C . requireLastPeriodAdjustment ( ) ) { setFiscal ( false ) ; exp_C = depreciation_C . invoke ( this , assetacct , currentPeriod , accumDep_C ) ; accumDep_C = accumDep_C . add ( exp_C ) ; } else if ( lifePeriods_C == currentPeriod ) { exp_C = assetCost . subtract ( accumDep_C ) ; accumDep_C = assetCost ; } if ( lifePeriods_F > currentPeriod || ! depreciation_F . requireLastPeriodAdjustment ( ) ) { setFiscal ( true ) ; exp_F = depreciation_F . invoke ( this , assetacct , currentPeriod , accumDep_F ) ; accumDep_F = accumDep_F . add ( exp_F ) ; } else if ( lifePeriods_F == currentPeriod ) { exp_F = assetCost . subtract ( accumDep_F ) ; accumDep_F = assetCost ; } help += "" + exp_C + "|" + exp_F + " = " + accumDep_C + "|" + accumDep_F ; int months = 0 ; months = months + ( currentPeriod - A_Current_Period ) ; Timestamp dateAcct = TimeUtil . getMonthLastDay ( TimeUtil . addMonths ( getDateAcct ( ) , months ) ) ; MDepreciationExp . createDepreciation ( this , currentPeriod , dateAcct , exp_C , exp_F , accumDep_C , accumDep_F , help , get_TrxName ( ) ) ; if ( CLogMgt . isLevelFine ( ) ) { String info = "" + cnt + ": period=" + currentPeriod + "/" + lifePeriods_C + "|" + lifePeriods_F + ", exp=" + exp_C + "|" + exp_F + ", accumDep=" + accumDep_C + "|" + accumDep_F + ", DateAcct=" + dateAcct ; log . fine ( "=> " + info + Env . NL + Env . NL ) ; sb . append ( info + Env . NL ) ; } } log . fine ( sb . toString ( ) ) ; m_buildDepreciation = false ; }
target:  Build depreciation (A_Depreciation_Exp) entries. More exactly, is deleting not Processed entries. and create new ones again. WARNING: IS NOT modifying workfile (this)