📄 unit9.pas
字号:
unit Unit9;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, LvNeoForm, DB, DBTables, LvNeoButton, StdCtrls;
type
TForm9 = class(TForm)
LvNeoForm1: TLvNeoForm;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
RadioButton5: TRadioButton;
RadioButton6: TRadioButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
LvNeoButton1: TLvNeoButton;
LvNeoButton2: TLvNeoButton;
LvNeoButton3: TLvNeoButton;
Edit4: TEdit;
DataSource1: TDataSource;
Table1: TTable;
procedure LvNeoButton3Click(Sender: TObject);
procedure LvNeoButton1Click(Sender: TObject);
procedure LvNeoButton2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form9: TForm9;
implementation
uses XGform, wineform;
{$R *.dfm}
procedure TForm9.LvNeoButton3Click(Sender: TObject);
begin
if radiobutton1.Checked=true then
begin
if edit1.Text='' then
messagebox(handle,'请输入酒水编号,以便查找!','警告',mb_ok+mb_iconwarning)
else
begin
try
with table1 do
begin
table1.Open;
if findkey([edit1.text]) then
begin
edit2.Text:=fieldvalues['数量'];
edit4.Text:=fieldvalues['货品单位'];
end
else
messagebox(form4.handle,'没有这条记录','提示',mb_ok+mb_iconinformation);
end;
except
messagebox(handle,'数量里的数据有误,请在“新记录”里输入你希望的数据!','提示',mb_ok+mb_iconinformation);
end;
end;
end
else
if radiobutton2.Checked=true then
begin
if edit1.Text='' then
messagebox(handle,'请输入酒水编号,以便查找!','警告',mb_ok+mb_iconwarning)
else
begin
with table1 do
begin
table1.Open;
if findkey([edit1.text]) then
begin
edit2.Text:=fieldvalues['进货单价'];
edit4.Text:='元';
end
else
messagebox(form4.handle,'没有这条记录','提示',mb_ok+mb_iconinformation);
end;
end;
end
else
if radiobutton3.Checked=true then
begin
if edit1.Text='' then
messagebox(handle,'请输入酒水编号,以便查找!','警告',mb_ok+mb_iconwarning)
else
begin
with table1 do
begin
table1.Open;
if findkey([edit1.text]) then
begin
edit2.Text:=fieldvalues['经手人'];
//edit4.Text:='元';
end
else
messagebox(form4.handle,'没有这条记录','提示',mb_ok+mb_iconinformation);
end;
end;
end
else
if radiobutton4.Checked=true then
begin
if edit1.Text='' then
messagebox(handle,'请输入酒水编号,以便查找!','警告',mb_ok+mb_iconwarning)
else
begin
with table1 do
begin
table1.Open;
if findkey([edit1.text]) then
begin
edit2.Text:=fieldvalues['货源公司'];
//edit4.Text:='元';
end
else
messagebox(form4.handle,'没有这条记录','提示',mb_ok+mb_iconinformation);
end;
end;
end
else
if radiobutton5.Checked=true then
begin
if edit1.Text='' then
messagebox(handle,'请输入酒水编号,以便查找!','警告',mb_ok+mb_iconwarning)
else
begin
with table1 do
begin
table1.Open;
if findkey([edit1.text]) then
begin
edit2.Text:=fieldvalues['运货公司'];
//edit4.Text:='元';
end
else
messagebox(form4.handle,'没有这条记录','提示',mb_ok+mb_iconinformation);
end;
end;
end
else
if radiobutton6.Checked=true then
begin
if edit1.Text='' then
messagebox(handle,'请输入酒水编号,以便查找!','警告',mb_ok+mb_iconwarning)
else
begin
try
with table1 do
begin
table1.Open;
if findkey([edit1.text]) then
begin
edit2.Text:=fieldvalues['收货日期'];
//edit4.Text:='元';
end
else
messagebox(form4.handle,'没有这条记录','提示',mb_ok+mb_iconinformation);
end;
except
messagebox(handle,'“收货日期”里的数据有误,请在“新记录”里输入你希望的数据!','提示',mb_ok+mb_iconinformation);
end;
end;
end
else
messagebox(handle,'请选择一种修改对象!','警告',mb_ok+mb_iconwarning);
end;
procedure TForm9.LvNeoButton1Click(Sender: TObject);
begin
if radiobutton1.Checked=true then
begin
if edit1.Text='' then
messagebox(handle,'请输入酒水编号,以便查找!','警告',mb_ok+mb_iconwarning)
else
if edit3.Text='' then
messagebox(handle,'请输入新记录!','警告',mb_ok+mb_iconwarning)
else
begin
with table1 do
begin
try
table1.Open;
if findkey([edit1.text]) then
begin
table1.Edit;
fieldbyname('数量').AsString:=edit3.Text;
if messagebox(form4.handle,'修改成功!','恭喜',mb_ok+mb_iconinformation)=mrok then
begin
edit1.Clear;
edit2.Clear;
edit3.Clear;
edit4.Clear;
end;
end;
except
messagebox(form4.handle,'修改的数据有误,请重新输入!','提示',mb_ok+mb_iconinformation);
end;
end;
end;
end
else
if radiobutton2.Checked=true then
begin
if edit1.Text='' then
messagebox(handle,'请输入酒水编号,以便查找!','警告',mb_ok+mb_iconwarning)
else
if edit3.Text='' then
messagebox(handle,'请输入新记录!','警告',mb_ok+mb_iconwarning)
else
begin
with table1 do
begin
table1.Open;
if findkey([edit1.text]) then
begin
table1.Edit;
fieldbyname('进货单价').AsString:=edit3.Text;
if messagebox(form4.handle,'修改成功!','恭喜',mb_ok+mb_iconinformation)=mrok then
begin
edit1.Clear;
edit2.Clear;
edit3.Clear;
edit4.Clear;
end;
end;
end;
end;
end
else
if radiobutton3.Checked=true then
begin
if edit1.Text='' then
messagebox(handle,'请输入酒水编号,以便查找!','警告',mb_ok+mb_iconwarning)
else
if edit3.Text='' then
messagebox(handle,'请输入新记录!','警告',mb_ok+mb_iconwarning)
else
begin
with table1 do
begin
table1.Open;
if findkey([edit1.text]) then
begin
table1.Edit;
fieldbyname('经手人').AsString:=edit3.Text;
if messagebox(form4.handle,'修改成功!','恭喜',mb_ok+mb_iconinformation)=mrok then
begin
edit1.Clear;
edit2.Clear;
edit3.Clear;
edit4.Clear;
end;
end;
end;
end;
end
else
if radiobutton4.Checked=true then
begin
if edit1.Text='' then
messagebox(handle,'请输入酒水编号,以便查找!','警告',mb_ok+mb_iconwarning)
else
if edit3.Text='' then
messagebox(handle,'请输入新记录!','警告',mb_ok+mb_iconwarning)
else
begin
with table1 do
begin
table1.Open;
if findkey([edit1.text]) then
begin
table1.Edit;
fieldbyname('货源公司').AsString:=edit3.Text;
if messagebox(form4.handle,'修改成功!','恭喜',mb_ok+mb_iconinformation)=mrok then
begin
edit1.Clear;
edit2.Clear;
edit3.Clear;
edit4.Clear;
end;
end;
end;
end;
end
else
if radiobutton5.Checked=true then
begin
if edit1.Text='' then
messagebox(handle,'请输入酒水编号,以便查找!','警告',mb_ok+mb_iconwarning)
else
if edit3.Text='' then
messagebox(handle,'请输入新记录!','警告',mb_ok+mb_iconwarning)
else
begin
with table1 do
begin
table1.Open;
if findkey([edit1.text]) then
begin
table1.Edit;
fieldbyname('运货公司').AsString:=edit3.Text;
if messagebox(form4.handle,'修改成功!','恭喜',mb_ok+mb_iconinformation)=mrok then
begin
edit1.Clear;
edit2.Clear;
edit3.Clear;
edit4.Clear;
end;
end;
end;
end;
end
else
if radiobutton6.Checked=true then
begin
if edit1.Text='' then
messagebox(handle,'请输入酒水编号,以便查找!','警告',mb_ok+mb_iconwarning)
else
if edit3.Text='' then
messagebox(handle,'请输入新记录!','警告',mb_ok+mb_iconwarning)
else
begin
try
with table1 do
begin
table1.Open;
if findkey([edit1.text]) then
begin
table1.Edit;
fieldbyname('收货日期').AsString:=edit3.Text;
if messagebox(form4.handle,'修改成功!','恭喜',mb_ok+mb_iconinformation)=mrok then
begin
edit1.Clear;
edit2.Clear;
edit3.Clear;
edit4.Clear;
end;
end;
end;
except
messagebox(handle,'修改日期的格式不对!'+#13#10+'格式为:年-月-日'+'请在“修改栏”里修改!','提示',mb_ok+mb_iconinformation);
end;
end;
end
else
messagebox(handle,'请选择一种修改对象!','警告',mb_ok+mb_iconwarning);
end;
procedure TForm9.LvNeoButton2Click(Sender: TObject);
begin
form8.WindowState:=wsnormal;
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
form9.Close;
end;
procedure TForm9.FormShow(Sender: TObject);
begin
form9.Left:=130;
form9.Top:=99;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -