unit U_RZCK; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.ToolWin, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxStyles, dxSkinsCore, dxSkinsDefaultPainters, cxCustomData, cxFilter, cxData, cxDataStorage, cxEdit, cxNavigator, dxDateRanges, Data.DB, cxDBData, cxGridLevel, cxClasses, cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid, Data.Win.ADODB; type TfrmRZCK = class(TForm) ToolBar1: TToolBar; TBClose: TToolButton; TV1: TcxGridDBTableView; cxGrid1Level1: TcxGridLevel; cxGrid1: TcxGrid; DataSource1: TDataSource; ADOQueryMain: TADOQuery; TV1Column1: TcxGridDBColumn; TV1Column2: TcxGridDBColumn; TV1Column3: TcxGridDBColumn; TV1Column4: TcxGridDBColumn; TV1Column5: TcxGridDBColumn; TV1Column6: TcxGridDBColumn; cxStyleRepository1: TcxStyleRepository; cxStyle1: TcxStyle; procedure FormShow(Sender: TObject); private procedure DoQuery(); { Private declarations } public ForderNO1: string; { Public declarations } end; var frmRZCK: TfrmRZCK; implementation {$R *.dfm} procedure TfrmRZCK.DoQuery(); var mbegdate, menddate: string; begin // mbegdate:=formatDatetime('yyyy-MM-dd',begDate.Date); // // menddate:=formatDatetime('yyyy-MM-dd',endDate.Date+1); try with ADOQueryMain do begin close; sql.clear; filtered := false; sql.add('select A.* '); sql.add('from SY_sysLog A'); // if CheckBox1.Checked then // begin // sql.Add('where OperTime>='+quotedStr(mbegdate)); // sql.Add('and OperTime<'+quotedStr(menddate)); // end // else // begin // sql.Add('where 1=1'); // end; // sql.Add(' and isnull(Mainid,'''')='''+Trim(FMainid)+''' and isnull(Mainid,'''')<>'''' '); // if trim(facction)<>'' then sql.add('where acction like ''¼Æ»®µ¥%'' '); sql.add('and OPmainid=''' + Trim(FOrderNo1) + ''''); // if trim(fOtherWhere)<>'' then // begin // sql.add(fOtherWhere); // end; sql.Add('order by operOr,Opertime'); Open; end; finally end; end; procedure TfrmRZCK.FormShow(Sender: TObject); begin DoQuery(); end; end.