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

📄 lldcx.~pas

📁 应对服装行业的生产成本控制系统
💻 ~PAS
📖 第 1 页 / 共 4 页
字号:
unit lldcx;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ComCtrls, Grids, DBGrids, ExtCtrls, DBCtrls,
  DB, ADODB, DBClient;

type
  TFrmlldcx = class(TForm)
    Pz: TPanel;
    help: TLabel;
    Label7: TLabel;
    Pd: TPanel;
    pq: TPanel;
    cqq: TCheckBox;
    cddh: TCheckBox;
    qddh: TEdit;
    clldh: TCheckBox;
    czq: TCheckBox;
    zq: TDateTimePicker;
    qlldh: TEdit;
    cclfl: TCheckBox;
    qclfl: TEdit;
    cclmc: TCheckBox;
    qclmc: TEdit;
    cje: TCheckBox;
    ccldw: TCheckBox;
    qje: TEdit;
    qcldw: TEdit;
    cggxh: TCheckBox;
    cfb: TCheckBox;
    qggxh: TEdit;
    qfb: TEdit;
    qq: TDateTimePicker;
    cys: TCheckBox;
    cfz: TCheckBox;
    qys: TEdit;
    qfz: TEdit;
    GroupBox1: TGroupBox;
    DBGrid5: TDBGrid;
    Cflr: TCheckBox;
    qflr: TEdit;
    Czgr: TCheckBox;
    qzgr: TEdit;
    Cbz: TCheckBox;
    qbz: TEdit;
    Csl: TCheckBox;
    qsl: TEdit;
    qdj: TEdit;
    Cdj: TCheckBox;
    Cllr: TCheckBox;
    qllr: TEdit;
    bprint: TBitBtn;
    breturn: TBitBtn;
    Bquery: TBitBtn;
    bprintc: TBitBtn;
    Bddhz: TBitBtn;
    Bfbhz: TBitBtn;
    Bfzhz: TBitBtn;
    Bllrhz: 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 bprintcClick(Sender: TObject);
    procedure BddhzClick(Sender: TObject);
    procedure BfbhzClick(Sender: TObject);
    procedure BfzhzClick(Sender: TObject);
    procedure BllrhzClick(Sender: TObject);
    procedure DBGrid5KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
      rzczy,rzsj,rzjsj,rzcsj:string;
      errzt: integer;
      errcode:boolean;
  commandstring,commandstringq: string;
  function hz():boolean;
  public
    { Public declarations }
  end;

var
  Frmlldcx: TFrmlldcx;

implementation

uses unit28, Unit1, Unit16, func;

{$R *.dfm}

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

procedure TFrmlldcx.breturnClick(Sender: TObject);
begin
try
rzcsj:=datetimetostr(now);
form16.WriteTorz(rzczy,rzsj,rzjsj,rzcsj);
DataModule1.ClientDataSet20.IndexFieldNames:='';
if DataModule1.clientdataset20.Active then  DataModule1.ClientDataSet20.Active:=false;
except
showmessage('数据库没有打开!');
end;
close;
end;

procedure TFrmlldcx.FormActivate(Sender: TObject);
begin
rzjsj:=datetimetostr(now);
rzczy:=form1.StatusBar1.Panels[4].Text;
rzsj:='领料审核';
qq.DateTime:=date-31;
zq.DateTime:=date;
help.Caption:='';
help.Caption:='  请您点击<查询>按钮开始查询数据!';
end;

procedure TFrmlldcx.FormClose(Sender: TObject; var Action: TCloseAction);
begin
try
DataModule1.ClientDataSet20.IndexFieldNames:='';
if DataModule1.clientdataset20.Active then  DataModule1.ClientDataSet20.Active:=false;
if rzcsj<>'' then exit;
rzcsj:=datetimetostr(now);
form16.WriteTorz(rzczy,rzsj,rzjsj,rzcsj);
except
showmessage('数据库没有打开!');
end;
close;
end;

procedure TFrmlldcx.BqueryClick(Sender: TObject);
var
commandtring1,relation,cx:string;
begin
 relation:=' like ''';
    cx:='%';
commandstring:='select * from dbo.llb';
commandtring1:='select * from dbo.llb';
  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+' order by ddh,lldh desc ';
commandstringq:=commandstring;
DataModule1.ClientDataSet20.DisableControls;
DataModule1.ClientDataSet20.Close;
DataModule1.ClientDataSet20.CommandText:=commandstring;
DataModule1.ClientDataSet20.Open;
hz;
DataModule1.ClientDataSet20.EnableControls;
help.Caption:='   查询完毕!';
except
DataModule1.clientdataset20.EnableControls;
showmessage('数据库没有打开!');
end;
end;

procedure TFrmlldcx.DBGrid5TitleClick(Column: TColumn);
var i : integer;

⌨️ 快捷键说明

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