⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lldcx.~pas

📁 应对服装行业的生产成本控制系统
💻 ~PAS
📖 第 1 页 / 共 4 页
字号:
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.llr'+relation+cx+trim(qllr.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.llr'+relation+cx+trim(qllr.Text)+cx+''')';
end;
end
else
begin
qllr.Text:='';
end;
if (trim(qflr.Text)<>'') and (cflr.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.flr'+relation+cx+trim(qflr.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.flr'+relation+cx+trim(qflr.Text)+cx+''')';
end;
end
else
begin
qflr.Text:='';
end;
if (trim(qzgr.Text)<>'') and (czgr.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.zgr'+relation+cx+trim(qzgr.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.zgr'+relation+cx+trim(qzgr.Text)+cx+''')';
end;
end
else
begin
qzgr.Text:='';
end;
if (trim(qbz.Text)<>'') and (cbz.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.bz'+relation+cx+trim(qbz.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.bz'+relation+cx+trim(qbz.Text)+cx+''')';
end;
end
else
begin
qbz.Text:='';
end;
if  commandstring=commandtring1 then
  begin
    relation:=' = ''';
    cx:='';
commandstring:=commandstring+' where (dbo.llb.shbj'+relation+cx+'0'+cx+''')';
end
else
begin
    relation:=' = ''';
    cx:='';
commandstring:=commandstring+' and (dbo.llb.shbj'+relation+cx+'0'+cx+''')';
end;
commandstring:=commandstring+' group by fz,clmc,clfl,dw,ggxh,ys,dj ';
commandstring:=commandstring+' order by fz,clfl,clmc,ys,ggxh ';
commandstringq:=commandstring;
DataModule1.ClientDataSet20.DisableControls;
DataModule1.ClientDataSet20.Close;
DataModule1.ClientDataSet20.CommandText:=commandstring;
DataModule1.ClientDataSet20.Open;
hz;
DataModule1.ClientDataSet20.EnableControls;
help.Caption:='   查询完毕!';
pz.Enabled:=true;
except
DataModule1.clientdataset20.EnableControls;
showmessage('数据库没有打开!');
end;
end;

procedure TFrmlldcx.BllrhzClick(Sender: TObject);
var
commandtring1,relation,cx:string;
begin
 relation:=' like ''';
    cx:='%';
commandstring:='select llr,clmc,clfl,dw,ggxh,ys,sum(sl) as sl,dj,sum(je) as je from dbo.llb';
commandtring1:=commandstring;
  try
if (trim(qddh.Text)<>'') and (cddh.Checked) then
   begin
 relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.ddh'+relation+cx+trim(qddh.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.ddh'+relation+cx+trim(qddh.Text)+cx+''')';
end;
end
else
begin
qddh.Text:='';
end;
if (trim(qlldh.Text)<>'') and (clldh.Checked) then
   begin
 relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.lldh'+relation+cx+trim(qlldh.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.lldh'+relation+cx+trim(qlldh.Text)+cx+''')';
end;
end
else
begin
qlldh.Text:='';
end;
if cqq.Checked then
 begin
if commandstring=commandtring1 then
begin
relation:=' >= ''';
    cx:='';
commandstring:=commandstring+' where (dbo.llb.rq'+ relation+FormatDateTime('yyyy-mm-dd',qq.Date)+cx+''')';
end
else
begin
relation:=' >= ''';
    cx:='';
commandstring:=commandstring+' and (dbo.llb.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.llb.rq'+ relation+FormatDateTime('yyyy-mm-dd',zq.Date+1)+cx+''')';
end
else
begin
relation:=' < ''';
    cx:='';
commandstring:=commandstring+' and (dbo.llb.rq'+ relation+FormatDateTime('yyyy-mm-dd',zq.Date+1)+cx+''')';
end;
end;
if (trim(qclfl.Text)<>'') and (cclfl.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.clfl'+relation+cx+trim(qclfl.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.clfl'+relation+cx+trim(qclfl.Text)+cx+''')';
end;
end
else
begin
qclfl.Text:='';
end;
if (trim(qclmc.Text)<>'') and (cclmc.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.clmc'+relation+cx+trim(qclmc.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.clmc'+relation+cx+trim(qclmc.Text)+cx+''')';
end;
end
else
begin
qclmc.Text:='';
end;
if (trim(qcldw.Text)<>'') and (ccldw.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.dw'+relation+cx+trim(qcldw.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.dw'+relation+cx+trim(qcldw.Text)+cx+''')';
end;
end
else
begin
qcldw.Text:='';
end;
if (trim(qggxh.Text)<>'') and (cggxh.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.ggxh'+relation+cx+trim(qggxh.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.ggxh'+relation+cx+trim(qggxh.Text)+cx+''')';
end;
end
else
begin
qggxh.Text:='';
end;
if (trim(qys.Text)<>'') and (cys.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.ys'+relation+cx+trim(qys.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.ys'+relation+cx+trim(qys.Text)+cx+''')';
end;
end
else
begin
qys.Text:='';
end;
if (trim(qsl.Text)<>'') and (csl.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.sl'+relation+cx+trim(qsl.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.sl'+relation+cx+trim(qsl.Text)+cx+''')';
end;
end
else
begin
qsl.Text:='';
end;
if (trim(qdj.Text)<>'') and (cdj.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.dj'+relation+cx+trim(qdj.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.dj'+relation+cx+trim(qdj.Text)+cx+''')';
end;
end
else
begin
qdj.Text:='';
end;
if (trim(qje.Text)<>'') and (cje.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.je'+relation+cx+trim(qje.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.je'+relation+cx+trim(qje.Text)+cx+''')';
end;
end
else
begin
qje.Text:='';
end;
if (trim(qfb.Text)<>'') and (cfb.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.fb'+relation+cx+trim(qfb.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.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.llb.fz'+relation+cx+trim(qfz.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.fz'+relation+cx+trim(qfz.Text)+cx+''')';
end;
end
else
begin
qfz.Text:='';
end;
if (trim(qllr.Text)<>'') and (cllr.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.llr'+relation+cx+trim(qllr.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.llr'+relation+cx+trim(qllr.Text)+cx+''')';
end;
end
else
begin
qllr.Text:='';
end;
if (trim(qflr.Text)<>'') and (cflr.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.flr'+relation+cx+trim(qflr.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.flr'+relation+cx+trim(qflr.Text)+cx+''')';
end;
end
else
begin
qflr.Text:='';
end;
if (trim(qzgr.Text)<>'') and (czgr.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.zgr'+relation+cx+trim(qzgr.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.zgr'+relation+cx+trim(qzgr.Text)+cx+''')';
end;
end
else
begin
qzgr.Text:='';
end;
if (trim(qbz.Text)<>'') and (cbz.Checked) then
   begin
    relation:=' like ''';
    cx:='%';
  if  commandstring=commandtring1 then
  begin
commandstring:=commandstring+' where (dbo.llb.bz'+relation+cx+trim(qbz.Text)+cx+''')';
end
else
begin
commandstring:=commandstring+' and (dbo.llb.bz'+relation+cx+trim(qbz.Text)+cx+''')';
end;
end
else
begin
qbz.Text:='';
end;
if  commandstring=commandtring1 then
  begin
    relation:=' = ''';
    cx:='';
commandstring:=commandstring+' where (dbo.llb.shbj'+relation+cx+'0'+cx+''')';
end
else
begin
    relation:=' = ''';
    cx:='';
commandstring:=commandstring+' and (dbo.llb.shbj'+relation+cx+'0'+cx+''')';
end;
commandstring:=commandstring+' group by llr,clmc,clfl,dw,ggxh,ys,dj ';
commandstring:=commandstring+' order by llr,clfl,clmc,ys,ggxh ';
commandstringq:=commandstring;
DataModule1.ClientDataSet20.DisableControls;
DataModule1.ClientDataSet20.Close;
DataModule1.ClientDataSet20.CommandText:=commandstring;
DataModule1.ClientDataSet20.Open;
hz;
DataModule1.ClientDataSet20.EnableControls;
help.Caption:='   查询完毕!';
pz.Enabled:=true;
except
DataModule1.clientdataset20.EnableControls;
showmessage('数据库没有打开!');
end;
end;
function TFrmlldcx.hz():boolean;
var
  sl,je: String;
  i: integer;
begin
sl:='0';
je:='0';
if not DataModule1.ClientDataSet20.RecordCount>0 then exit;
   DataModule1.ClientDataSet20.First;
   for i := 1 to DataModule1.ClientDataSet20.RecordCount do
  begin
 if DataModule1.ClientDataSet20.FieldByName('sl').AsString<>'' then sl:= formatfloat('0',strtofloat(sl)+DataModule1.ClientDataSet20.FieldByName('sl').AsFloat);
 if DataModule1.ClientDataSet20.FieldByName('je').AsString<>'' then je:= formatfloat('0.00',strtofloat(je)+DataModule1.ClientDataSet20.FieldByName('je').AsFloat);
 DataModule1.ClientDataSet20.Next;
  end;
 DataModule1.ClientDataSet20.First;
help.Caption:='  合计数量为'+sl+'  合计金额为'+je;
end;


procedure TFrmlldcx.DBGrid5KeyPress(Sender: TObject; var Key: Char);
var
  sl,je: String;
  i: integer;
begin
sl:='0';
je:='0';
if key=#13 then
begin
   for i := 0 to (DBGrid5.SelectedRows.Count - 1) do
  begin
    DBGrid5.DataSource.DataSet.GotoBookmark(pointer(DBGrid5.SelectedRows.Items[i]));
 if DBGrid5.DataSource.DataSet.FieldByName('sl').AsString<>'' then sl:= formatfloat('0',strtofloat(sl)+DBGrid5.DataSource.DataSet.FieldByName('sl').AsFloat);
 if DBGrid5.DataSource.DataSet.FieldByName('je').AsString<>'' then je:= formatfloat('0.00',strtofloat(je)+DBGrid5.DataSource.DataSet.FieldByName('je').AsFloat);
  end;
help.Caption:='  合计数量为'+sl+'  合计金额为'+je;
end;
end;

end.

⌨️ 快捷键说明

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