一个特殊的日期计算问题:
已经知道一个工作开始日期,假定为:todate(date),和工作的时限,假定为:lmtdate(integer).
和知道那些日期是非工作日,都在数据表(Fdate)中。字段名为nodate。怎样知道工作
完成的日期呢?(非工作日是不工作的,不能简单把开始日期todate+工作的时限lmdate)
最好有代码说明

解决方案 »

  1.   

    function ResultDate(startdate; TDateTime; days: integer): TDateTime;
    var
      tmpDate :TDateTime;
      nowork  :integer;
    begin
       tmpDate := IncDay(StartDate, Days);
       //nowork := StartDate到timpDate这段时间不工作的天数
       if nowork = 0 then
          result := tmpdate
       else 
          result := resultDate(tmpdate, nowork);
    end;
    //以上程序只供参考
      

  2.   

    function IsWorkDay(Day: TDate): Boolean;
    begin
      //这里的代码应该你来填
    end;function GetEndDate(BeginDate: TDate; WorkDays: Integer): TDate;
    var
      I: Integer;
    begin
      Result := BeginDate;
      I := 0;
      while I < WorkDays do begin
        Result := Result + 1;
        if IsWorkDay(Result) then Inc(I);//如果是工作日则计数加1
      end;
    end;