📄 unit6.pas
字号:
unit Unit6;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, LvNeoForm, DB, DBTables, Grids, DBGrids, LvNeoButton,
StdCtrls;
type
TForm6 = class(TForm)
LvNeoForm1: TLvNeoForm;
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
Label1: TLabel;
Edit1: TEdit;
LvNeoButton1: TLvNeoButton;
LvNeoButton2: TLvNeoButton;
LvNeoButton3: TLvNeoButton;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
Table1: TTable;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
Edit2: TEdit;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
RadioButton5: TRadioButton;
ComboBox3: TComboBox;
procedure LvNeoButton3Click(Sender: TObject);
procedure LvNeoButton1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure RadioButton4Click(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure RadioButton5Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form6: TForm6;
implementation
uses CMP;
{$R *.dfm}
procedure TForm6.LvNeoButton3Click(Sender: TObject);
begin
form6.Close;
form3.WindowState:=wsnormal;
end;
procedure TForm6.LvNeoButton1Click(Sender: TObject);
begin
if radiobutton1.Checked=true then
begin
if edit1.Text='' then
messagebox(handle,'请输入查询对象!','提示',mb_ok+mb_iconinformation)
else
begin
try
with table1 do
begin
table1.Open;
table1.Filter:='菜名编号='+edit1.Text;
table1.Filtered:=true;
if findkey([edit1.text]) then
dbgrid1.DataSource:=datasource1
else
messagebox(form6.handle,'没有此记录!','提示',mb_ok+mb_iconinformation)
end;
except
messagebox(handle,'菜名编号输入有误!','提示',mb_ok+mb_iconinformation);
edit1.SetFocus;
end;
end;
end
else
if radiobutton2.Checked=true then
begin
if edit1.Text='' then
messagebox(handle,'请输入查询对象!','提示',mb_ok+mb_iconinformation)
else
begin
with table1 do
begin
table1.Open;
table1.Filter:='菜名='+''''+edit1.Text+'''';
table1.Filtered:=true;
dbgrid1.DataSource:=datasource1;
end;
end;
end
else
if radiobutton3.Checked=true then
begin
if edit1.Text='' then
messagebox(handle,'请输入查询对象!','提示',mb_ok+mb_iconinformation)
else
begin
with table1 do
begin
table1.Open;
table1.Filter:='经手人='+''''+edit1.Text+'''';
table1.Filtered:=true;
dbgrid1.DataSource:=datasource1;
end;
end;
end
else
if radiobutton4.Checked=true then
begin
if (edit2.Text='')or(combobox1.Text='')or(combobox2.Text='') then
messagebox(handle,'请把日期输入完整!','提示',mb_ok+mb_iconinformation)
else
begin
try
with table1 do
begin
table1.Open;
table1.Filter:='收货日期='+''''+edit2.Text+'-'+combobox1.text+'-'+combobox2.text+'''';
table1.Filtered:=true;
dbgrid1.DataSource:=datasource1;
end;
except
messagebox(handle,'日期输入错误!','警告',mb_ok+mb_iconwarning);
end;
end;
end
else
if radiobutton5.Checked=true then
begin
if combobox3.Text='' then
messagebox(handle,'请输入查询对象!','提示',mb_ok+mb_iconinformation)
else
begin
with table1 do
begin
table1.Open;
table1.Filter:='菜类='+''''+combobox3.Text+'''';
table1.Filtered:=true;
dbgrid1.DataSource:=datasource1;
end;
end;
end
else
messagebox(handle,'请选择一种查询方式!','警告',mb_ok+mb_iconwarning);
end;
procedure TForm6.FormCreate(Sender: TObject);
begin
edit2.Hide;
combobox3.Hide;
combobox1.Hide;
combobox2.Hide;
label3.Hide;
label4.Hide;
label2.Hide;
edit1.Show;
end;
procedure TForm6.RadioButton4Click(Sender: TObject);
begin
edit1.Hide;
label4.Show;
label3.Show;
label2.Show;
edit2.Show;
combobox1.Show;
combobox2.Show;
combobox3.Hide;
end;
procedure TForm6.RadioButton1Click(Sender: TObject);
begin
combobox3.Hide;
edit2.Hide;
label3.Hide;
label2.Hide;
label4.Hide;
combobox1.Hide;
combobox2.Hide;
edit1.Show;
end;
procedure TForm6.FormShow(Sender: TObject);
begin
form6.Left:=171;
form6.Top:=98;
end;
procedure TForm6.RadioButton5Click(Sender: TObject);
begin
edit2.Hide;
label3.Hide;
label2.Hide;
label4.Hide;
combobox1.Hide;
combobox2.Hide;
edit1.hide;
combobox3.Show;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -