private List < TimephasedCost > getTimephasedCostFixedAmount ( ) { List < TimephasedCost > result = new LinkedList < TimephasedCost > ( ) ; ProjectCalendar cal = getCalendar ( ) ; double remainingCost = getRemainingCost ( ) . doubleValue ( ) ; if ( remainingCost > 0 ) { AccrueType accrueAt = getResource ( ) . getAccrueAt ( ) ; if ( accrueAt == AccrueType . START ) { result . add ( splitCostStart ( cal , remainingCost , getStart ( ) ) ) ; } else if ( accrueAt == AccrueType . END ) { result . add ( splitCostEnd ( cal , remainingCost , getFinish ( ) ) ) ; } else { //for prorated, we have to deal with it differently depending on whether or not //any actual has been entered, since we want to mimic the other timephased data //where planned and actual values do not overlap double numWorkingDays = cal . getWork ( getStart ( ) , getFinish ( ) , TimeUnit . DAYS ) . getDuration ( ) ; double standardAmountPerDay = getCost ( ) . doubleValue ( ) / numWorkingDays ; if ( getActualCost ( ) . intValue ( ) > 0 ) { //need to get three possible blocks of data: one for the possible partial amount //overlap with timephased actual cost; one with all the standard amount days //that happen after the actual cost stops; and one with any remaining //partial day cost amount int numActualDaysUsed = ( int ) Math . ceil ( getActualCost ( ) . doubleValue ( ) / standardAmountPerDay ) ; Date actualWorkFinish = cal . getDate ( getStart ( ) , Duration . getInstance ( numActualDaysUsed , TimeUnit . DAYS ) , false ) ; double partialDayActualAmount = getActualCost ( ) . doubleValue ( ) % standardAmountPerDay ; if ( partialDayActualAmount > 0 ) { double dayAmount = standardAmountPerDay < remainingCost ? standardAmountPerDay - partialDayActualAmount : remainingCost ; result . add ( splitCostEnd ( cal , dayAmount , actualWorkFinish ) ) ; remainingCost -= dayAmount ; } //see if there's anything left to work with if ( remainingCost > 0 ) { //have to split up the amount into standard prorated amount days and whatever is left result . addAll ( splitCostProrated ( cal , remainingCost , standardAmountPerDay , cal . getNextWorkStart ( actualWorkFinish ) ) ) ; } } else { //no actual cost to worry about, so just a standard split from the beginning of the assignment result . addAll ( splitCostProrated ( cal , remainingCost , standardAmountPerDay , getStart ( ) ) ) ; } } } return result ; }
Generates timephased costs from the assignment s cost value . Used for Cost type Resources .