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

📄 xgform.pas

📁 酒店管理系统
💻 PAS
字号:
unit XGform;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, LvNeoForm, LvNeoButton, DB, DBTables;

type
  TForm4 = class(TForm)
    LvNeoForm1: TLvNeoForm;
    GroupBox1: TGroupBox;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton4: TRadioButton;
    RadioButton5: TRadioButton;
    RadioButton6: TRadioButton;
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    Label3: TLabel;
    Edit3: TEdit;
    LvNeoButton1: TLvNeoButton;
    LvNeoButton2: TLvNeoButton;
    DataSource1: TDataSource;
    Table1: TTable;
    LvNeoButton3: TLvNeoButton;
    Edit4: TEdit;
    procedure LvNeoButton3Click(Sender: TObject);
    procedure LvNeoButton2Click(Sender: TObject);
    procedure LvNeoButton1Click(Sender: TObject);
    procedure RadioButton3Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form4: TForm4;

implementation

uses CMP;

{$R *.dfm}

procedure TForm4.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 TForm4.LvNeoButton2Click(Sender: TObject);
begin
form4.Close;
form3.WindowState:=wsnormal;
edit1.Clear;
edit2.Clear;
edit3.Clear;
edit4.Clear;
end;

procedure TForm4.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 TForm4.RadioButton3Click(Sender: TObject);
begin
edit4.Text:='';
end;

procedure TForm4.FormShow(Sender: TObject);
begin
form4.Left:=135;
form4.Top:=109;
end;

end.

⌨️ 快捷键说明

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