📄 skkdunit.pas
字号:
unit SKKDUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, SUIButton, StdCtrls, SUIListBox, SUIEdit, SUIComboBox,
SUIPageControl, SUITabControl, ExtCtrls, SUIImagePanel, ComCtrls,
SUIGroupBox, Grids, DBGrids, DB, DBClient, Menus;
type
TSKKDForm = class(TForm)
suiPanel1: TsuiPanel;
suiButton1: TsuiButton;
suiButton2: TsuiButton;
lbl1: TLabel;
lbl2: TLabel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label5: TLabel;
suiEdit1: TsuiEdit;
Label4: TLabel;
Label6: TLabel;
suiGroupBox1: TsuiGroupBox;
suiListBox2: TsuiListBox;
btn3: TsuiButton;
btn4: TsuiButton;
suiListBox1: TsuiListBox;
suiComboBox1: TsuiComboBox;
suiCheckBox1: TsuiCheckBox;
suiCheckBox2: TsuiCheckBox;
procedure suiButton2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormActivate(Sender: TObject);
procedure suiEdit1KeyPress(Sender: TObject; var Key: Char);
procedure suiComboBox1KeyPress(Sender: TObject; var Key: Char);
procedure suiComboBox1DropDown(Sender: TObject);
procedure suiCheckBox1Click(Sender: TObject);
procedure btn3Click(Sender: TObject);
procedure btn4Click(Sender: TObject);
procedure suiButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
ifguest,ifsave:boolean;
id,guestid:string;
ifguestselect:boolean;
end;
var
SKKDForm: TSKKDForm;
implementation
uses MainUnit, LoginUnit, ZJXFUnit;
{$R *.dfm}
procedure TSKKDForm.suiButton2Click(Sender: TObject);
begin
close;
end;
procedure TSKKDForm.FormCreate(Sender: TObject);
begin
suiEdit1.Clear;
self.suiComboBox1.Clear;
suiPanel1.Caption:='用餐单号:YC'+FormatDateTime('yyyymmddhhnnss',now);
id:=suiPanel1.Caption;
delete(id,1,10);
self.lbl2.Caption:=mainform.roomnum;
self.Label6.Caption:=mainform.typename;
self.Label2.Caption:=formatfloat('¥0.00',strtofloat(mainform.menoy));
suiListBox2.Items.Clear;
suiListBox2.Items.BeginUpdate;
loginform.ExecuteSQL('select roomtype.type_mc,room.room_num from room,roomtype '+
'where (room.room_type=roomtype.type_xh) and '+
'(room.room_state=''可供'') and '+
'(room.room_num<>'''+mainform.roomnum+''') '+
'order by room.room_num');
LoginForm.dsQuery.First;
while not LoginForm.dsQuery.Eof do
begin
suiListBox2.Items.Add(LoginForm.dsQuery.Fields[0].AsString+':'+LoginForm.dsQuery.Fields[1].AsString);
LoginForm.dsQuery.Next;
end;
suiListBox2.Items.EndUpdate;
self.suiListBox2.Sorted:=true;
suiListBox1.Items.Clear;
self.suiCheckBox1.Checked:=false;
self.suiListBox1.Enabled:=false;
self.suiListBox2.Enabled:=false;
self.btn3.Enabled:=false;
self.btn4.Enabled:=false;
end;
procedure TSKKDForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if Self.suiCheckBox2.Checked then
begin
application.CreateForm(TZJXFForm,ZJXFForm);
ZJXFForm.Show;
Enabled:=False;
end
else
begin
MainForm.RefrushRoomState(0);
mainform.Enabled:=true;
end;
end;
procedure TSKKDForm.FormActivate(Sender: TObject);
begin
self.suiEdit1.Text:='1';
self.suiEdit1.SetFocus;
end;
procedure TSKKDForm.suiEdit1KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in [#48..#57,#13,#8]) then
key:=#0
else
if key=#13 then
self.suiComboBox1.SetFocus;
end;
procedure TSKKDForm.suiComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
self.suiButton1.SetFocus;
end;
procedure TSKKDForm.suiComboBox1DropDown(Sender: TObject);
begin
suiComboBox1.Items.Clear;
suiComboBox1.Items.BeginUpdate;
loginform.ExecuteSQL('select id,name from server');
loginform.dsQuery.First;
while not loginform.dsQuery.Eof do
begin
suiComboBox1.Items.Add('【'+loginform.dsQuery.Fields[0].AsString+'】'+loginform.dsQuery.Fields[1].AsString);
loginform.dsQuery.Next;
end;
loginform.dsQuery.Close;
suiComboBox1.Items.EndUpdate;
end;
procedure TSKKDForm.suiCheckBox1Click(Sender: TObject);
begin
if self.suiCheckBox1.Checked then
begin
self.suiListBox1.Enabled:=true;
self.suiListBox2.Enabled:=true;
self.btn3.Enabled:=True;
self.btn4.Enabled:=true;
end
else
begin
self.suiListBox1.Enabled:=false;
self.suiListBox2.Enabled:=false;
self.btn3.Enabled:=false;
self.btn4.Enabled:=false;
end;
end;
procedure TSKKDForm.btn3Click(Sender: TObject);
var
index:Integer;
begin
for index:=Self.suiListBox2.Items.Count-1 downto 0 do
if Self.suiListBox2.Selected[index] then
begin
Self.suiListBox1.Items.Add(Self.suiListBox2.Items.Strings[index]);
self.suiListBox2.Items.Delete(index);
end;
self.suiListBox2.Sorted:=true;
Self.suiListBox1.Sorted:=true;
end;
procedure TSKKDForm.btn4Click(Sender: TObject);
var
index:Integer;
begin
for index:=Self.suiListBox1.Items.Count-1 downto 0 do
if Self.suiListBox1.Selected[index] then
begin
Self.suiListBox2.Items.Add(Self.suiListBox1.Items.Strings[index]);
self.suiListBox1.Items.Delete(index);
end;
self.suiListBox1.Sorted:=true;
Self.suiListBox2.Sorted:=true;
end;
procedure TSKKDForm.suiButton1Click(Sender: TObject);
var
room:string;
peopelnum:string;
serverinfo:string;
memozs:string;
entertime:string;
index:integer;
temp:string;
sql:string;
begin
room:=self.lbl2.Caption;
peopelnum:=self.suiEdit1.Text;
serverinfo:=self.suiComboBox1.Text;
if self.suiCheckBox1.Checked then
for index:=0 to self.suiListBox1.Items.Count-1 do
begin
temp:=self.suiListBox1.Items.Strings[index];
delete(temp,1,pos(':',temp));
memozs:=memozs+temp+'@';
end;
entertime:=FormatDateTime('yyyy-mm-dd hh:nn:ss',now);
loginform.ExecuteSQL('insert into house '+
'values('''+id+''','''','''+peopelnum+''','''+room+'@'+memozs+''','''+room+''','+
''''+entertime+''','''','''+serverinfo+''')');
sql:='update room set room_state=''占用'',room_id='''+id+''' where room_num='''+room+'''';
temp:=memozs;
if temp='' then
while Pos('@',temp)>0 do
begin
sql:=sql+' or room_num='''+Copy(temp,1,Pos('@',temp)-1)+'''';
loginform.ExecuteSQL('insert into house '+
'values('''+id+''','''','''+peopelnum+''','''+room+'@'+memozs+''','+
''''+Copy(temp,1,Pos('@',temp)-1)+''','+
''''+entertime+''','''','''+serverinfo+''')');
Delete(temp,1,Pos('@',temp));
end;
loginform.ExecuteSQL(sql);
loginform.ExecuteSQL('insert into log '+
'values('''+entertime+''','''+loginform.userid+''','''+LoginForm.username+
''',''餐台【'+room+'】于'+entertime+'开单成功'')');
MessageDlg('餐台【'+room+'】于'+entertime+'开单成功!',mtConfirmation, [mbYes], 0);
close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -