?? cllrsh.pas
字號:
unit cllrsh;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ComCtrls, Grids, DBGrids, ExtCtrls, DBCtrls,
DB, ADODB, DBClient;
type
TFrmcllrsh = class(TForm)
Pz: TPanel;
help: TLabel;
Label7: TLabel;
Pd: TPanel;
pq: TPanel;
GroupBox1: TGroupBox;
DBGrid5: TDBGrid;
Ccm: TCheckBox;
cqq: TCheckBox;
cddh: TCheckBox;
qddh: TEdit;
cclh: TCheckBox;
czq: TCheckBox;
zq: TDateTimePicker;
qclh: TEdit;
cgh: TCheckBox;
qgh: TEdit;
cfb: TCheckBox;
qfb: TEdit;
csl: TCheckBox;
cfz: TCheckBox;
qsl: TEdit;
qfz: TEdit;
cyg: TCheckBox;
cgxmc: TCheckBox;
qyg: TEdit;
qgxmc: TEdit;
qq: TDateTimePicker;
cbh: TCheckBox;
cdj: TCheckBox;
qbh: TEdit;
qdj: TEdit;
Ccz: TCheckBox;
qcz: TEdit;
Cbz: TCheckBox;
qbz: TEdit;
Cczy: TCheckBox;
qczy: TEdit;
Cys: TCheckBox;
qys: TEdit;
qcm: TEdit;
Cxs: TCheckBox;
qxs: TEdit;
bprint: TBitBtn;
breturn: TBitBtn;
Bquery: TBitBtn;
bprintc: TBitBtn;
bsh: TBitBtn;
bfs: TBitBtn;
bquerys: TBitBtn;
OpenDialog1: TOpenDialog;
procedure bprintClick(Sender: TObject);
procedure breturnClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure BqueryClick(Sender: TObject);
procedure DBGrid5TitleClick(Column: TColumn);
procedure DBGrid5DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure bshClick(Sender: TObject);
procedure bquerysClick(Sender: TObject);
procedure bfsClick(Sender: TObject);
procedure bprintcClick(Sender: TObject);
private
{ Private declarations }
rzczy,rzsj,rzjsj,rzcsj,clh:string;
errzt: integer;
errcode:boolean;
commandstring,commandstringq: string;
public
{ Public declarations }
end;
var
Frmcllrsh: TFrmcllrsh;
implementation
uses unit28, Unit1, Unit16, func;
{$R *.dfm}
procedure TFrmcllrsh.bprintClick(Sender: TObject);
begin
help.Caption:=' 暫不提供打印功能!';
end;
procedure TFrmcllrsh.breturnClick(Sender: TObject);
begin
try
rzcsj:=datetimetostr(now);
form16.WriteTorz(rzczy,rzsj,rzjsj,rzcsj);
DataModule1.ClientDataSet25.IndexFieldNames:='';
if DataModule1.clientdataset25.Active then DataModule1.ClientDataSet25.Active:=false;
except
showmessage('數據庫沒有打開!');
end;
close;
end;
procedure TFrmcllrsh.FormActivate(Sender: TObject);
var
commandstring,relation,cx,str:string;
begin
rzjsj:=datetimetostr(now);
rzczy:=form1.StatusBar1.Panels[4].Text;
rzsj:='員工產量審核';
qq.DateTime:=date-30;
zq.DateTime:=date;
help.Caption:='';
help.Caption:=' 請您點擊< 查詢>按鈕開始查詢產量記錄!';
end;
procedure TFrmcllrsh.FormClose(Sender: TObject; var Action: TCloseAction);
begin
try
DataModule1.ClientDataSet25.IndexFieldNames:='';
if DataModule1.clientdataset25.Active then DataModule1.ClientDataSet25.Active:=false;
if rzcsj<>'' then exit;
rzcsj:=datetimetostr(now);
form16.WriteTorz(rzczy,rzsj,rzjsj,rzcsj);
except
showmessage('數據庫沒有打開!');
end;
close;
end;
procedure TFrmcllrsh.BqueryClick(Sender: TObject);
var
commandtring1,relation,cx:string;
begin
relation:=' like ''';
cx:='%';
commandstring:='select * from dbo.cllrb';
commandtring1:='select * from dbo.cllrb';
try
if (trim(qddh.Text)<>'') and (cddh.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.ddh'+relation+cx+trim(qddh.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.ddh'+relation+cx+trim(qddh.Text)+cx+''')';
end;
end
else
begin
qddh.Text:='';
end;
if (trim(qclh.Text)<>'') and (cclh.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.clh'+relation+cx+trim(qclh.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.clh'+relation+cx+trim(qclh.Text)+cx+''')';
end;
end
else
begin
qclh.Text:='';
end;
if cqq.Checked then
begin
if commandstring=commandtring1 then
begin
relation:=' >= ''';
cx:='';
commandstring:=commandstring+' where (dbo.cllrb.rq'+ relation+FormatDateTime('yyyy-mm-dd',qq.Date)+cx+''')';
end
else
begin
relation:=' >= ''';
cx:='';
commandstring:=commandstring+' and (dbo.cllrb.rq'+ relation+FormatDateTime('yyyy-mm-dd',qq.Date)+cx+''')';
end;
end;
if czq.Checked then
begin
if commandstring=commandtring1 then
begin
relation:=' < ''';
cx:='';
commandstring:=commandstring+' where (dbo.cllrb.rq'+ relation+FormatDateTime('yyyy-mm-dd',zq.Date+1)+cx+''')';
end
else
begin
relation:=' < ''';
cx:='';
commandstring:=commandstring+' and (dbo.cllrb.rq'+ relation+FormatDateTime('yyyy-mm-dd',zq.Date+1)+cx+''')';
end;
end;
if (trim(qgh.Text)<>'') and (cgh.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.gh'+relation+cx+trim(qgh.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.gh'+relation+cx+trim(qgh.Text)+cx+''')';
end;
end
else
begin
qgh.Text:='';
end;
if (trim(qfb.Text)<>'') and (cfb.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.fb'+relation+cx+trim(qfb.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.fb'+relation+cx+trim(qfb.Text)+cx+''')';
end;
end
else
begin
qfb.Text:='';
end;
if (trim(qfz.Text)<>'') and (cfz.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.fz'+relation+cx+trim(qfz.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.fz'+relation+cx+trim(qfz.Text)+cx+''')';
end;
end
else
begin
qfz.Text:='';
end;
if (trim(qyg.Text)<>'') and (cyg.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.yg'+relation+cx+trim(qyg.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.yg'+relation+cx+trim(qyg.Text)+cx+''')';
end;
end
else
begin
qyg.Text:='';
end;
if (trim(qbh.Text)<>'') and (cbh.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.bh'+relation+cx+trim(qbh.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.bh'+relation+cx+trim(qbh.Text)+cx+''')';
end;
end
else
begin
qbh.Text:='';
end;
if (trim(qys.Text)<>'') and (cys.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.ys'+relation+cx+trim(qys.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.ys'+relation+cx+trim(qys.Text)+cx+''')';
end;
end
else
begin
qys.Text:='';
end;
if (trim(qcm.Text)<>'') and (ccm.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.cm'+relation+cx+trim(qcm.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.cm'+relation+cx+trim(qcm.Text)+cx+''')';
end;
end
else
begin
qcm.Text:='';
end;
if (trim(qsl.Text)<>'') and (csl.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.sl'+relation+cx+trim(qsl.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.sl'+relation+cx+trim(qsl.Text)+cx+''')';
end;
end
else
begin
qsl.Text:='';
end;
if (trim(qgxmc.Text)<>'') and (cgxmc.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.gxmc'+relation+cx+trim(qgxmc.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.gxmc'+relation+cx+trim(qgxmc.Text)+cx+''')';
end;
end
else
begin
qgxmc.Text:='';
end;
if (trim(qdj.Text)<>'') and (cdj.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.dj'+relation+cx+trim(qdj.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.dj'+relation+cx+trim(qdj.Text)+cx+''')';
end;
end
else
begin
qdj.Text:='';
end;
if (trim(qxs.Text)<>'') and (cxs.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.xs'+relation+cx+trim(qxs.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.xs'+relation+cx+trim(qxs.Text)+cx+''')';
end;
end
else
begin
qxs.Text:='';
end;
if (trim(qcz.Text)<>'') and (ccz.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.cz'+relation+cx+trim(qcz.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.cz'+relation+cx+trim(qcz.Text)+cx+''')';
end;
end
else
begin
qcz.Text:='';
end;
if (trim(qbz.Text)<>'') and (cbz.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.bz'+relation+cx+trim(qbz.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.bz'+relation+cx+trim(qbz.Text)+cx+''')';
end;
end
else
begin
qbz.Text:='';
end;
if (trim(qczy.Text)<>'') and (cczy.Checked) then
begin
relation:=' like ''';
cx:='%';
if commandstring=commandtring1 then
begin
commandstring:=commandstring+' where (dbo.cllrb.czy'+relation+cx+trim(qczy.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.cllrb.czy'+relation+cx+trim(qczy.Text)+cx+''')';
end;
end
else
begin
qczy.Text:='';
end;
if commandstring=commandtring1 then
begin
relation:=' = ''';
cx:='';
commandstring:=commandstring+' where (dbo.cllrb.shbj'+relation+cx+'0'+cx+''')';
end
else
begin
relation:=' = ''';
cx:='';
commandstring:=commandstring+' and (dbo.cllrb.shbj'+relation+cx+'0'+cx+''')';
end;
commandstring:=commandstring+' order by ddh,clh';
commandstringq:=commandstring;
DataModule1.ClientDataSet25.DisableControls;
DataModule1.ClientDataSet25.Close;
DataModule1.ClientDataSet25.CommandText:=commandstring;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -