glfycx.~pas

来自「应对服装行业的生产成本控制系统」· ~PAS 代码 · 共 1,221 行 · 第 1/2 页

~PAS
1,221
字号
 end
 else
 begin
qbxr.Text:='';
end;

if cqrq.Checked then
 begin
if commandstring=commandtring1 then
begin
relation:=' >= ''';
    cx:='';
commandstring:=commandstring+' where (dbo.scfyb.rq'+ relation+FormatDateTime('yyyy-mm-dd',qrq.Date)+cx+''')';
end
else
begin
relation:=' >= ''';
    cx:='';
commandstring:=commandstring+' and (dbo.scfyb.rq'+ relation+FormatDateTime('yyyy-mm-dd',qrq.Date)+cx+''')';
end;
end;
if czrq.Checked then
 begin
if commandstring=commandtring1 then
begin
relation:=' < ''';
    cx:='';
commandstring:=commandstring+' where (dbo.scfyb.rq'+ relation+FormatDateTime('yyyy-mm-dd',zrq.Date+1)+cx+''')';
end
else
begin
relation:=' < ''';
    cx:='';
commandstring:=commandstring+' and (dbo.scfyb.rq'+ relation+FormatDateTime('yyyy-mm-dd',zrq.Date+1)+cx+''')';
end;
end;
if (trim(qfb.Text)<>'') and (cfb.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.fb'+relation+cx+trim(qfb.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.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.scfyb.fz'+relation+cx+trim(qfz.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.fz'+relation+cx+trim(qfz.Text)+cx+''')';
end;
end
else
begin
qfz.Text:='';
end;
if (trim(qzy.Text)<>'') and (czy.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.zy'+relation+cx+trim(qzy.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.zy'+relation+cx+trim(qzy.Text)+cx+''')';
end;
end
else
begin
qzy.Text:='';
end;
if (trim(qfylb.Text)<>'') and (cfylb.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.fylb'+relation+cx+trim(qfylb.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.fylb'+relation+cx+trim(qfylb.Text)+cx+''')';
end;
end
else
begin
qfylb.Text:='';
end;
if (trim(qje.Text)<>'') and (cje.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.je'+relation+cx+trim(qje.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.je'+relation+cx+trim(qje.Text)+cx+''')';
end;
end
else
begin
qje.Text:='';
end;
if (trim(qddh.Text)<>'') and (cddh.Checked) then
   begin
    relation:=' like ''';
    cx:='';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.ddh'+relation+cx+trim(qbz.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.ddh'+relation+cx+trim(qbz.Text)+cx+''')';
end;
end
else
begin
qddh.Text:='';
end;
if (trim(qbz.Text)<>'') and (cbz.Checked) then
   begin
    relation:=' like ''';
    cx:='';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.bz'+relation+cx+trim(qbz.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.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.scfyb.czy'+relation+cx+trim(qczy.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.czy'+relation+cx+trim(qczy.Text)+cx+''')';
end;
end
else
begin
qczy.Text:='';
end;
commandstring:=commandstring+' group by fb,fz ';
commandstring:=commandstring+' order by fb,fz ';
commandstringq:=commandstring;
try
DataModule1.ClientDataSet26.DisableControls;
DataModule1.ClientDataSet26.Close;
DataModule1.ClientDataSet26.CommandText:=commandstring;
DataModule1.ClientDataSet26.Open;
DataModule1.ClientDataSet26.EnableControls;
bprint.Enabled:=true;
help.Caption:='   查询完毕!';
except
DataModule1.clientdataset26.EnableControls;
showmessage('数据库没有打开!');
end;
end;

procedure TFrmglfycx.BkhhzClick(Sender: TObject);
var
commandtring1,relation,cx:string;
begin
 relation:=' like ''';
    cx:='%';
commandstring:='select fb, fz, bxr, sum(je) je from dbo.scfyb';
commandtring1:=commandstring;
if (trim(qbxr.Text)<>'') and (cbxr.Checked) then
   begin
  if  commandstring=commandtring1 then
  BEGIN
  commandstring:=commandstring+' where (dbo.scfyb.bxr'+relation+cx+TRIM(qbxr.Text)+cx+''')'
 END
  else
  BEGIN
  commandstring:=commandstring+' and (dbo.scfyb.bxr'+relation+cx+TRIM(qbxr.Text)+cx+''')'
  end;
 end
 else
 begin
qbxr.Text:='';
end;

if cqrq.Checked then
 begin
if commandstring=commandtring1 then
begin
relation:=' >= ''';
    cx:='';
commandstring:=commandstring+' where (dbo.scfyb.rq'+ relation+FormatDateTime('yyyy-mm-dd',qrq.Date)+cx+''')';
end
else
begin
relation:=' >= ''';
    cx:='';
commandstring:=commandstring+' and (dbo.scfyb.rq'+ relation+FormatDateTime('yyyy-mm-dd',qrq.Date)+cx+''')';
end;
end;
if czrq.Checked then
 begin
if commandstring=commandtring1 then
begin
relation:=' < ''';
    cx:='';
commandstring:=commandstring+' where (dbo.scfyb.rq'+ relation+FormatDateTime('yyyy-mm-dd',zrq.Date+1)+cx+''')';
end
else
begin
relation:=' < ''';
    cx:='';
commandstring:=commandstring+' and (dbo.scfyb.rq'+ relation+FormatDateTime('yyyy-mm-dd',zrq.Date+1)+cx+''')';
end;
end;
if (trim(qfb.Text)<>'') and (cfb.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.fb'+relation+cx+trim(qfb.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.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.scfyb.fz'+relation+cx+trim(qfz.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.fz'+relation+cx+trim(qfz.Text)+cx+''')';
end;
end
else
begin
qfz.Text:='';
end;
if (trim(qzy.Text)<>'') and (czy.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.zy'+relation+cx+trim(qzy.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.zy'+relation+cx+trim(qzy.Text)+cx+''')';
end;
end
else
begin
qzy.Text:='';
end;
if (trim(qfylb.Text)<>'') and (cfylb.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.fylb'+relation+cx+trim(qfylb.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.fylb'+relation+cx+trim(qfylb.Text)+cx+''')';
end;
end
else
begin
qfylb.Text:='';
end;
if (trim(qje.Text)<>'') and (cje.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.je'+relation+cx+trim(qje.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.je'+relation+cx+trim(qje.Text)+cx+''')';
end;
end
else
begin
qje.Text:='';
end;
if (trim(qddh.Text)<>'') and (cddh.Checked) then
   begin
    relation:=' like ''';
    cx:='';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.ddh'+relation+cx+trim(qbz.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.ddh'+relation+cx+trim(qbz.Text)+cx+''')';
end;
end
else
begin
qddh.Text:='';
end;
if (trim(qbz.Text)<>'') and (cbz.Checked) then
   begin
    relation:=' like ''';
    cx:='';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.bz'+relation+cx+trim(qbz.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.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.scfyb.czy'+relation+cx+trim(qczy.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.czy'+relation+cx+trim(qczy.Text)+cx+''')';
end;
end
else
begin
qczy.Text:='';
end;
commandstring:=commandstring+' group by fb,fz,bxr ';
commandstring:=commandstring+' order by fb,fz,bxr ';
commandstringq:=commandstring;
try
DataModule1.ClientDataSet26.DisableControls;
DataModule1.ClientDataSet26.Close;
DataModule1.ClientDataSet26.CommandText:=commandstring;
DataModule1.ClientDataSet26.Open;
DataModule1.ClientDataSet26.EnableControls;
bprint.Enabled:=true;
help.Caption:='   查询完毕!';
except
DataModule1.clientdataset26.EnableControls;
showmessage('数据库没有打开!');
end;
end;

procedure TFrmglfycx.bprintClick(Sender: TObject);
begin
help.Caption:=' 暂不提供打印功能!';
end;

procedure TFrmglfycx.BddhhzClick(Sender: TObject);
var
commandtring1,relation,cx:string;
begin
 relation:=' like ''';
    cx:='%';
commandstring:='select ddh, sum(je) je from dbo.scfyb';
commandtring1:=commandstring;
if (trim(qbxr.Text)<>'') and (cbxr.Checked) then
   begin
  if  commandstring=commandtring1 then
  BEGIN
  commandstring:=commandstring+' where (dbo.scfyb.bxr'+relation+cx+TRIM(qbxr.Text)+cx+''')'
 END
  else
  BEGIN
  commandstring:=commandstring+' and (dbo.scfyb.bxr'+relation+cx+TRIM(qbxr.Text)+cx+''')'
  end;
 end
 else
 begin
qbxr.Text:='';
end;

if cqrq.Checked then
 begin
if commandstring=commandtring1 then
begin
relation:=' >= ''';
    cx:='';
commandstring:=commandstring+' where (dbo.scfyb.rq'+ relation+FormatDateTime('yyyy-mm-dd',qrq.Date)+cx+''')';
end
else
begin
relation:=' >= ''';
    cx:='';
commandstring:=commandstring+' and (dbo.scfyb.rq'+ relation+FormatDateTime('yyyy-mm-dd',qrq.Date)+cx+''')';
end;
end;
if czrq.Checked then
 begin
if commandstring=commandtring1 then
begin
relation:=' < ''';
    cx:='';
commandstring:=commandstring+' where (dbo.scfyb.rq'+ relation+FormatDateTime('yyyy-mm-dd',zrq.Date+1)+cx+''')';
end
else
begin
relation:=' < ''';
    cx:='';
commandstring:=commandstring+' and (dbo.scfyb.rq'+ relation+FormatDateTime('yyyy-mm-dd',zrq.Date+1)+cx+''')';
end;
end;
if (trim(qfb.Text)<>'') and (cfb.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.fb'+relation+cx+trim(qfb.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.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.scfyb.fz'+relation+cx+trim(qfz.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.fz'+relation+cx+trim(qfz.Text)+cx+''')';
end;
end
else
begin
qfz.Text:='';
end;
if (trim(qzy.Text)<>'') and (czy.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.zy'+relation+cx+trim(qzy.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.zy'+relation+cx+trim(qzy.Text)+cx+''')';
end;
end
else
begin
qzy.Text:='';
end;
if (trim(qfylb.Text)<>'') and (cfylb.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.fylb'+relation+cx+trim(qfylb.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.fylb'+relation+cx+trim(qfylb.Text)+cx+''')';
end;
end
else
begin
qfylb.Text:='';
end;
if (trim(qje.Text)<>'') and (cje.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.je'+relation+cx+trim(qje.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.je'+relation+cx+trim(qje.Text)+cx+''')';
end;
end
else
begin
qje.Text:='';
end;
if (trim(qddh.Text)<>'') and (cddh.Checked) then
   begin
    relation:=' like ''';
    cx:='';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.ddh'+relation+cx+trim(qbz.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.ddh'+relation+cx+trim(qbz.Text)+cx+''')';
end;
end
else
begin
qddh.Text:='';
end;
if (trim(qbz.Text)<>'') and (cbz.Checked) then
   begin
    relation:=' like ''';
    cx:='';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.scfyb.bz'+relation+cx+trim(qbz.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.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.scfyb.czy'+relation+cx+trim(qczy.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.scfyb.czy'+relation+cx+trim(qczy.Text)+cx+''')';
end;
end
else
begin
qczy.Text:='';
end;
commandstringq:=commandstring;
commandstring:=commandstring+' group by ddh ';
commandstring:=commandstring+' order by ddh ';
  try
DataModule1.ClientDataSet26.DisableControls;
DataModule1.ClientDataSet26.Close;
DataModule1.ClientDataSet26.CommandText:=commandstring;
DataModule1.ClientDataSet26.Open;
DataModule1.ClientDataSet26.EnableControls;
bprint.Enabled:=true;
help.Caption:='   查询完毕!';
except
DataModule1.clientdataset26.EnableControls;
showmessage('数据库没有打开!');
end;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?