コード例 #1
0
 // Determines the Contract Date of a Phase or a Task, based on the Standard
 // Duration in Days of the Standard Phase or the Standard Task
 private String calculateContractDate(
     String strStartDate, String strStdDuration, DateFormat DateFormatter) throws ParseException {
   String strContractDate = "";
   if (strStartDate != null
       && !strStartDate.equals("")
       && strStdDuration != null
       && !strStdDuration.equals("")) {
     strContractDate = strStartDate; // Contract Date equals to Starting
     // Date
     Integer StdDuration = Integer.parseInt(strStdDuration) - 1;
     int DaysLeft = StdDuration;
     while (DaysLeft > 0) {
       strContractDate = Utility.addDaysToDate(strContractDate, "1", DateFormatter); // Contract
       // Date equals
       // to Starting
       // Date
       // plus one day until the standard
       // duration in days is reached
       if (!Utility.isWeekendDay(strContractDate, DateFormatter))
         DaysLeft--; // If strContractDate is a weekend day, looks
       // for the next labor day
     }
   }
   return strContractDate;
 }
コード例 #2
0
 // Determines the Starting Date of a Phase or a Task
 private String calculateStartDate(String strLastContractDate, DateFormat DateFormatter)
     throws ParseException {
   String strStartDate = "";
   if (strLastContractDate != null && !strLastContractDate.equals("")) {
     strStartDate = strLastContractDate; // Start Date equals to Last
     // Contract Date
     do {
       strStartDate = Utility.addDaysToDate(strStartDate, "1", DateFormatter); // Start Date equals
       // to Last Contract
       // Date plus one day
     } while (Utility.isWeekendDay(strStartDate, DateFormatter)); // If
     // strStartDate
     // is a
     // weekend
     // day,
     // looks
     // for
     // the
     // next
     // labor
     // day
   }
   return strStartDate;
 }