code: private List<TimephasedCost> splitCostProrated(ProjectCalendar calendar, double totalAmount, double standardAmountPerDay, Date start)
     {
        List<TimephasedCost> result = new LinkedList<TimephasedCost>();
  
        double numStandardAmountDays = Math.floor(totalAmount / standardAmountPerDay);
        double amountForLastDay = totalAmount % standardAmountPerDay;
  
        //first block contains all the normal work at the beginning of the assignments life, if any
  
        if (numStandardAmountDays > 0)
        {
           Date finishStandardBlock = calendar.getDate(start, Duration.getInstance(numStandardAmountDays, TimeUnit.DAYS), false);
  
           TimephasedCost standardBlock = new TimephasedCost();
           standardBlock.setAmountPerDay(Double.valueOf(standardAmountPerDay));
           standardBlock.setStart(start);
           standardBlock.setFinish(finishStandardBlock);
           standardBlock.setTotalAmount(Double.valueOf(numStandardAmountDays * standardAmountPerDay));
  
           result.add(standardBlock);
  
           start = calendar.getNextWorkStart(finishStandardBlock);
        }
  
        //next block contains the partial day amount, if any
        if (amountForLastDay > 0)
        {
           TimephasedCost nextBlock = new TimephasedCost();
           nextBlock.setAmountPerDay(Double.valueOf(amountForLastDay));
           nextBlock.setTotalAmount(Double.valueOf(amountForLastDay));
           nextBlock.setStart(start);
           nextBlock.setFinish(calendar.getDate(start, Duration.getInstance(1, TimeUnit.DAYS), false));
  
           result.add(nextBlock);
        }
  
        return result;
     }
docs: Used for Cost type Resources.
  
  Generates up to two TimephasedCost blocks for a cost amount. The first block will contain
  all the days using the standardAmountPerDay, and a second block will contain any
  final amount that is not enough for a complete day. This is useful for Cost resources
  who have an AccrueAt value of Prorated.
  
  @param calendar calendar used by this assignment
  @param totalAmount cost amount to be prorated
  @param standardAmountPerDay cost amount for a normal working day
  @param start date of the first timephased cost block
  @return timephased cost