Einzelnen Beitrag anzeigen

danten

Registriert seit: 19. Feb 2012
Ort: Czech Republic, Prag
126 Beiträge
 
Delphi 10.1 Berlin Architect
 
#16

AW: Filtering two IBTable and insert or edit IBTable

  Alt 5. Mär 2014, 07:20
Thank you to all friends
Delphi-Quellcode:
function Tfrm_main.Attendant_Filter:boolean;
var
  myYear,myMonth,myDay:word;
  set_day, my_day,
  set_week,start_week,end_week,
  set_month,start_month,end_month,
  day_month,
  set_year, start_year,end_year:string;
begin

  DecodeDate(NOW, myYear, myMonth, myDay);

  ///////////////////////////////////////////////////////////

    (* Filter day *)
  my_day := DateToStr(NOW);
  set_day := '("WHEN" >= ' + QuotedStr(my_day) + ')';

  (* Filter week *)
  start_week := IntToStr(dayofweek(now -1))+'.'+ IntToStr(myMonth)+'.'+IntToStr(myYear);
  end_week := IntToStr(dayofweek(now -1)+7)+'.'+ IntToStr(myMonth)+'.'+IntToStr(myYear);

  set_week := '("WHEN" >= ' + QuotedStr(start_week)
              + ') and ("WHEN" <= ' + QuotedStr(end_week)
              + ')';

  (* Filter  month *)
  start_month := '1.'+ IntToStr(myMonth)+ '.' + IntToStr(myYear);
// day_month := IntToStr(MonthDays[IsLeapYear(myYear)][2]); //
  end_month := '1.' + IntToStr(myMonth + 1) + '.' + IntToStr(myYear);

  set_month := '("WHEN" >= ' + QuotedStr(start_month)
              + ') and ("WHEN" <= ' + QuotedStr(end_month)
              + ')';

  (* Filter year*)
  start_year := '1.1.'+ IntToStr(myYear);
  end_year := '1.1.'+ IntToStr(myYear +1);

  set_year := '("WHEN" >= ' + QuotedStr(start_year)
              + ') and ("WHEN" <= ' + QuotedStr(end_year)
              + ')';

  ///////////////////////////////////////////////////////////////

  ShowMessage(QuotedStr(start_year) + ' : '+ QuotedStr(end_year));
  ShowMessage(QuotedStr(start_month) + ' : '+ QuotedStr(end_month));
  ShowMessage(QuotedStr(start_week) + ' : '+ QuotedStr(end_week));
  ShowMessage(QuotedStr(my_day));
  ........
  Result := True;

end;
Daniel
  Mit Zitat antworten Zitat