function TDlg_FSProcess.GetCurrDay(CurrDate: TDateTime): Integer;
var
  Year,Month,Day:word;
  TempDate   :   TDateTime;
begin
  DecodeDate(CurrDate,Year,Month,Day);
  if Month=12 then
    Result := 30
  else
  begin
    TempDate   :=   EncodeDate(Year,Month+1,1)-1;
    DecodeDate(TempDate,Year,Month,Day);
    Result   :=   Day;
  end;
end;