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

📄 mrscdd_cx.pas

📁 生产管理系统:系统具有数据备份及数据还原功能。能够保证系统数据的安全性方便的全方位的数据查询。在相应的权限下
💻 PAS
字号:
unit MRSCDD_CX;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ComCtrls;

type
  TFRM_SCDD_CX = class(TForm)
    GroupBox1: TGroupBox;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    RadioButton3: TRadioButton;
    RadioButton4: TRadioButton;
    RadioButton5: TRadioButton;
    DateTimePicker1: TDateTimePicker;
    ComboBox3: TComboBox;
    DateTimePicker2: TDateTimePicker;
    procedure FormShow(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure RadioButton1Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
    procedure RadioButton5Click(Sender: TObject);
    procedure RadioButton3Click(Sender: TObject);
    procedure RadioButton4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FRM_SCDD_CX: TFRM_SCDD_CX;

implementation
  uses MR_DATA, MRSCDD;
{$R *.dfm}

procedure TFRM_SCDD_CX.FormShow(Sender: TObject);
begin
  combobox1.Clear;
  combobox2.Clear;
  combobox3.Text := '';
  DateTimePicker1.Date := now();
  DateTimePicker2.Date := now();
  with data.ADOD do
  begin
    close;
    sql.Clear;
    sql.Add('select * from tb_scdd');
    open;
  end;
  if data.ADOD.RecordCount>0 then
  begin
    while not data.adoD.Eof do
    begin
      combobox1.Items.Add(data.ADOD.fieldbyname('scddh').AsString);
      combobox2.Items.Add(data.ADOD.fieldbyname('hh').AsString);
      data.ADOD.Next;
    end;
  end;
end;

procedure TFRM_SCDD_CX.BitBtn1Click(Sender: TObject);
var
  s,p : string;
  year,month,day : word;
begin
  p := 'aa';
  if RadioButton1.Checked = true then
  begin
    s := 'scddh';
    p := combobox1.Text;
  end;
  if RadioButton2.Checked = true then
  begin
    s := 'hh';
    p := combobox2.Text;
  end;
  if (RadioButton3.Checked = true)or(RadioButton4.Checked = true) then
  begin
    if RadioButton3.Checked = true then
    begin
      s := 'll';
      decodedate(DateTimePicker1.Date,year,month,day);
      with data.ADOa do
      begin
        close;
        sql.Clear;
        sql.Add('select * from tb_scdd where year(ktime)='+floattostr(year)+' and month(ktime)='+floattostr(month)+' and day(ktime)='+floattostr(day));
        open;
      end;
    end;
    if RadioButton4.Checked = true then
    begin
      s := 'll';
      decodedate(DateTimePicker2.Date,year,month,day);
      with data.ADOa do
      begin
        close;
        sql.Clear;
        sql.Add('select * from tb_scdd where year(wtime)='+floattostr(year)+' and month(wtime)='+floattostr(month)+' and day(wtime)='+floattostr(day));
        open;
      end;
    end;
    if data.ADOa.RecordCount>0 then
    begin
      FRM_SCDD.edit1.Text := data.ADOa.fieldbyname('scddh').AsString;
      FRM_SCDD.edit2.Text := data.ADOa.fieldbyname('hh').AsString;
      FRM_SCDD.edit3.Text := floattostr(data.ADOa.fieldbyname('sl').AsFloat);
      FRM_SCDD.combobox1.Text := data.ADOa.fieldbyname('cpmc').AsString;
      FRM_SCDD.combobox2.Text := data.ADOa.fieldbyname('yn').AsString;
      FRM_SCDD.DateTimePicker1.Date := data.ADOa.fieldbyname('ktime').AsDateTime;
      FRM_SCDD.DateTimePicker2.Date := data.ADOa.fieldbyname('wtime').AsDateTime;
      FRM_SCDD.ToolButton8.Enabled := true;
      FRM_SCDD.ToolButton9.Enabled := true;
      FRM_SCDD.ToolButton10.Enabled := true;
      FRM_SCDD.ToolButton11.Enabled := true;
    end
    else
    begin
      FRM_SCDD.edit1.Text := '';
      FRM_SCDD.edit2.Text := '';
      FRM_SCDD.edit3.Text := '';
      FRM_SCDD.combobox1.Text := '';
      FRM_SCDD.combobox2.Text := '';
      FRM_SCDD.DateTimePicker1.Date := now();
      FRM_SCDD.DateTimePicker2.Date := now();
      FRM_SCDD.ToolButton8.Enabled := false;
      FRM_SCDD.ToolButton9.Enabled := false;
      FRM_SCDD.ToolButton10.Enabled := false;
      FRM_SCDD.ToolButton11.Enabled := false;
    end;
  end;
  if RadioButton5.Checked = true then
  begin
    s := 'yn';
    p := combobox3.Text;
  end;
  if s <> 'll' then
  begin
    if (p = '')or(p = 'aa') then
    begin
      showmessage('查询条件不能为空。');
    end
    else
    begin
        with data.ADOa do
        begin
          close;
          sql.Clear;
          sql.Add('select * from tb_scdd where '+s+'='+''''+p+'''');
          open;
        end;
        if data.ADOa.RecordCount>0 then
        begin
          FRM_SCDD.edit1.Text := data.ADOa.fieldbyname('scddh').AsString;
          FRM_SCDD.edit2.Text := data.ADOa.fieldbyname('hh').AsString;
          FRM_SCDD.edit3.Text := floattostr(data.ADOa.fieldbyname('sl').AsFloat);
          FRM_SCDD.combobox1.Text := data.ADOa.fieldbyname('cpmc').AsString;
          FRM_SCDD.combobox2.Text := data.ADOa.fieldbyname('yn').AsString;
          FRM_SCDD.DateTimePicker1.Date := data.ADOa.fieldbyname('ktime').AsDateTime;
          FRM_SCDD.DateTimePicker2.Date := data.ADOa.fieldbyname('wtime').AsDateTime;
          FRM_SCDD.ToolButton8.Enabled := true;
          FRM_SCDD.ToolButton9.Enabled := true;
          FRM_SCDD.ToolButton10.Enabled := true;
          FRM_SCDD.ToolButton11.Enabled := true;
        end
        else
        begin
          FRM_SCDD.edit1.Text := '';
          FRM_SCDD.edit2.Text := '';
          FRM_SCDD.edit3.Text := '';
          FRM_SCDD.combobox1.Text := '';
          FRM_SCDD.combobox2.Text := '';
          FRM_SCDD.DateTimePicker1.Date := now();
          FRM_SCDD.DateTimePicker2.Date := now();
          FRM_SCDD.ToolButton8.Enabled := false;
          FRM_SCDD.ToolButton9.Enabled := false;
          FRM_SCDD.ToolButton10.Enabled := false;
          FRM_SCDD.ToolButton11.Enabled := false;
        end;
    end;
  end;

end;

procedure TFRM_SCDD_CX.BitBtn2Click(Sender: TObject);
begin
  close;
end;

procedure TFRM_SCDD_CX.RadioButton1Click(Sender: TObject);
begin
  combobox2.Text := '';
  combobox3.Text := '';
  DateTimePicker1.Date := now();
  DateTimePicker2.Date := now();
end;

procedure TFRM_SCDD_CX.RadioButton2Click(Sender: TObject);
begin
  combobox1.Text := '';
  combobox3.Text := '';
  DateTimePicker1.Date := now();
  DateTimePicker2.Date := now();
end;

procedure TFRM_SCDD_CX.RadioButton5Click(Sender: TObject);
begin
  combobox2.Text := '';
  combobox1.Text := '';
  DateTimePicker1.Date := now();
  DateTimePicker2.Date := now();
end;

procedure TFRM_SCDD_CX.RadioButton3Click(Sender: TObject);
begin
  combobox2.Text := '';
  combobox3.Text := '';
  combobox1.Text := '';
  DateTimePicker2.Date := now();
end;

procedure TFRM_SCDD_CX.RadioButton4Click(Sender: TObject);
begin
  combobox2.Text := '';
  combobox3.Text := '';
  combobox1.Text := '';
  DateTimePicker1.Date := now();
end;

end.

⌨️ 快捷键说明

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