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); procedure TBCloseClick(Sender: TObject); private procedure DoQuery(); { Private declarations } public ForderNO1: string; FLX: string; { Public declarations } end; var frmRZCK: TfrmRZCK; implementation uses U_DataLink, U_RTFun; {$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 if FLX = '销售合同' then begin sql.add('where Model like ''销售合同%'' '); end; if FLX = '计划单' then begin sql.add('where acction like ''计划单%'' '); sql.add('and OPmainid=''' + Trim(FOrderNo1) + ''''); end; // 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; procedure TfrmRZCK.TBCloseClick(Sender: TObject); begin close; end; end.