📄 mc_dcgl_dc.~pas
字号:
Edit1.SetFocus;
end;
procedure TDCGL_DC.BitBtn7Click(Sender: TObject);
begin
if Length(Edit1.Text)=0 then
begin
ShowMessage('请输入数量');
Edit1.SetFocus;
end
else
if Edit1.Text='0' then
begin
ShowMessage('数量为[0]无意义.');
Edit1.SetFocus;
end
else
begin
//Query3.RequestLive:=True;//打开修改权限
Query3.Edit;
Query3.FieldByName('数量').AsInteger:=StrToInt(Edit1.Text);
Query3.FieldByName('合计').AsFloat:=StrToInt(Edit1.Text)*
Query3.FieldByName('价格').AsFloat;
Query3.Post;
//Query3.RequestLive:=False;//关闭修改权限
Query4.Close;
Query4.SQL.Clear;
Query4.SQL.Add('Select Sum(合计) From 点菜临时表');
Query4.SQL.Add('Where 房间台号=:A and 是否结单=:B');
Query4.Params[0].AsInteger:=TLCYGLXT.KT_FJTHXXB.FieldByName('编号').AsInteger;
Query4.Params[1].AsString:='否';
Query4.Open;
Label14.Caption:=Query4.Fields[0].AsString;
DCGrid.Enabled:=True;
BitBtn1.Enabled:=True;
DBGrid2.Enabled:=True;
BitBtn2.Enabled:=True;
BitBtn3.Enabled:=True;
BitBtn4.Enabled:=True;
BitBtn5.Enabled:=True;
BitBtn6.Enabled:=True;
GroupBox2.Visible:=False;
end;
end;
procedure TDCGL_DC.BitBtn5Click(Sender: TObject);
begin
if MessageDlg('确认客人不要['+Query3
.FieldByName('名称').AsString+']了吗?'
,mtCustom,[mbYes,mbNo],0)=mrYes then
begin
Query3.Delete;
Query4.Close;
Query4.SQL.Clear;
Query4.SQL.Add('Select Sum(合计) From 点菜临时表');
Query4.SQL.Add('Where 房间台号=:A and 是否结单=:B');
Query4.Params[0].AsInteger:=TLCYGLXT.KT_FJTHXXB.FieldByName('编号').AsInteger;
Query4.Params[1].AsString:='否';
Query4.Open;
Label14.Caption:=Query4.Fields[0].AsString;
end;
end;
procedure TDCGL_DC.BitBtn4Click(Sender: TObject);
begin
close;
end;
procedure TDCGL_DC.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if GroupBox2.Visible=True then
begin
ShowMessage('请将数据保存!');
Abort;
end;
end;
procedure TDCGL_DC.DCGridKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
//-----------------------
X:=DCGrid.Row;
Y:=DCGrid.Col;
//-----------------------
DBGrid3.Visible:=False;
DBGrid4.Visible:=False;
DBGrid5.Visible:=False;
if Length(DCGrid.Cells[2,X-1])=0 then
begin
end
else
begin
//------------------------------------------------------------------------------
if key=$6A then//按*键
begin
DBGrid3.Visible:=True;//餐具
DBGrid3.SetFocus;
end;
if key=$6D then//按键-
begin
DBGrid5.Visible:=True;//菜
DBGrid5.SetFocus;
end;
if key=$6F then//按键/
begin
DBGrid4.Visible:=True;//酒
DBGrid4.SetFocus;
end;
//------------------------------------------------------------------------------
end;
end;
procedure TDCGL_DC.DBGrid5KeyPress(Sender: TObject; var Key: Char);
begin
if key=#27 then//按Esc隐藏DBGrid1
begin
DBGrid5.Visible:=False;
DCGrid.SetFocus;
DCGrid.Col:=5;
Exit;
end;
//------------------------------------------------------------------------------
if key=#13 then
begin
DCGrid.Cells[1,X]:=TLCYGLXT.CPFYXXB.FieldByName('编号').AsString;
DCGrid.Cells[2,X]:=TLCYGLXT.CPFYXXB.FieldByName('菜名').AsString;
DCGrid.Cells[4,x]:=TLCYGLXT.CPFYXXB.FieldByName('单位').AsString;
DCGrid.Cells[3,x]:=TLCYGLXT.CPFYXXB.FieldByName('菜系类别').AsString;
DCGrid.Cells[6,x]:=TLCYGLXT.CPFYXXB.FieldByName('价格').AsString;
DCGrid.Cells[7,x]:='点单';
DCGrid.Cells[5,x]:='1';
//----后加的----------------------
DCGrid.Cells[8,x]:=TLCYGLXT.CPFYXXB.FieldByName('价格').AsString;
//--------------------------------
DBGrid5.Visible:=False;
DCGrid.SetFocus;
DCGrid.Col:=5;
end;
end;
procedure TDCGL_DC.DBGrid4KeyPress(Sender: TObject; var Key: Char);
begin
if key=#27 then//按Esc隐藏DBGrid1
begin
DBGrid4.Visible:=False;
DCGrid.SetFocus;
DCGrid.Col:=5;
Exit;
end;
//------------------------------------------------------------------------------
if key=#13 then
begin
PJ[DCGrid.row]:=Query1.FieldByName('数量').AsInteger;
DCGrid.Cells[1,X]:=TLCYGLXT.SJFYXXB.FieldByName('编号').AsString;
DCGrid.Cells[2,X]:=TLCYGLXT.SJFYXXB.FieldByName('酒水名称').AsString;
DCGrid.Cells[4,x]:=TLCYGLXT.SJFYXXB.FieldByName('单位').AsString;
DCGrid.Cells[3,x]:=TLCYGLXT.SJFYXXB.FieldByName('酒水类别').AsString;
DCGrid.Cells[6,x]:=TLCYGLXT.SJFYXXB.FieldByName('价格').AsString;
DCGrid.Cells[7,x]:='点单';
DCGrid.Cells[5,x]:='1';
//----后加的----------------------
DCGrid.Cells[8,x]:=TLCYGLXT.SJFYXXB.FieldByName('价格').AsString;
//--------------------------------
DBGrid4.Visible:=False;
DCGrid.SetFocus;
DCGrid.Col:=5;
end;
end;
procedure TDCGL_DC.DBGrid3KeyPress(Sender: TObject; var Key: Char);
begin
if key=#27 then//按Esc隐藏DBGrid1
begin
DBGrid3.Visible:=False;
DCGrid.SetFocus;
DCGrid.Col:=5;
Exit;
end;
//------------------------------------------------------------------------------
if key=#13 then
begin
DCGrid.Cells[1,X]:=TLCYGLXT.CJFYXXB.FieldByName('编号').AsString;
DCGrid.Cells[2,X]:=TLCYGLXT.CJFYXXB.FieldByName('餐具名称').AsString;
DCGrid.Cells[4,x]:=TLCYGLXT.CJFYXXB.FieldByName('单位').AsString;
DCGrid.Cells[3,x]:=TLCYGLXT.CJFYXXB.FieldByName('餐具类别').AsString;
DCGrid.Cells[6,x]:=TLCYGLXT.CJFYXXB.FieldByName('价格').AsString;
DCGrid.Cells[7,x]:='点单';
DCGrid.Cells[5,x]:='1';
//----后加的----------------------
DCGrid.Cells[8,x]:=TLCYGLXT.CJFYXXB.FieldByName('价格').AsString;
//--------------------------------
DBGrid3.Visible:=False;
DCGrid.SetFocus;
DCGrid.Col:=5;
end;
end;
procedure TDCGL_DC.DBGrid3DblClick(Sender: TObject);
begin
DCGrid.Cells[1,X]:=TLCYGLXT.CJFYXXB.FieldByName('编号').AsString;
DCGrid.Cells[2,X]:=TLCYGLXT.CJFYXXB.FieldByName('餐具名称').AsString;
DCGrid.Cells[4,x]:=TLCYGLXT.CJFYXXB.FieldByName('单位').AsString;
DCGrid.Cells[3,x]:=TLCYGLXT.CJFYXXB.FieldByName('餐具类别').AsString;
DCGrid.Cells[6,x]:=TLCYGLXT.CJFYXXB.FieldByName('价格').AsString;
DCGrid.Cells[7,x]:='点单';
DCGrid.Cells[5,x]:='1';
//----后加的----------------------
DCGrid.Cells[8,x]:=TLCYGLXT.CJFYXXB.FieldByName('价格').AsString;
//--------------------------------
DBGrid3.Visible:=False;
DCGrid.SetFocus;
DCGrid.Col:=5;
end;
procedure TDCGL_DC.DBGrid5DblClick(Sender: TObject);
begin
DCGrid.Cells[1,X]:=TLCYGLXT.CPFYXXB.FieldByName('编号').AsString;
DCGrid.Cells[2,X]:=TLCYGLXT.CPFYXXB.FieldByName('菜名').AsString;
DCGrid.Cells[4,x]:=TLCYGLXT.CPFYXXB.FieldByName('单位').AsString;
DCGrid.Cells[3,x]:=TLCYGLXT.CPFYXXB.FieldByName('菜系类别').AsString;
DCGrid.Cells[6,x]:=TLCYGLXT.CPFYXXB.FieldByName('价格').AsString;
DCGrid.Cells[7,x]:='点单';
DCGrid.Cells[5,x]:='1';
//----后加的----------------------
DCGrid.Cells[8,x]:=TLCYGLXT.CPFYXXB.FieldByName('价格').AsString;
//--------------------------------
DBGrid5.Visible:=False;
DCGrid.SetFocus;
DCGrid.Col:=5;
end;
procedure TDCGL_DC.DBGrid4DblClick(Sender: TObject);
begin
PJ[DCGrid.row]:=Query1.FieldByName('数量').AsInteger;
DCGrid.Cells[1,X]:=TLCYGLXT.SJFYXXB.FieldByName('编号').AsString;
DCGrid.Cells[2,X]:=TLCYGLXT.SJFYXXB.FieldByName('酒水名称').AsString;
DCGrid.Cells[4,x]:=TLCYGLXT.SJFYXXB.FieldByName('单位').AsString;
DCGrid.Cells[3,x]:=TLCYGLXT.SJFYXXB.FieldByName('酒水类别').AsString;
DCGrid.Cells[6,x]:=TLCYGLXT.SJFYXXB.FieldByName('价格').AsString;
DCGrid.Cells[7,x]:='点单';
DCGrid.Cells[5,x]:='1';
//----后加的----------------------
DCGrid.Cells[8,x]:=TLCYGLXT.SJFYXXB.FieldByName('价格').AsString;
//--------------------------------
DBGrid4.Visible:=False;
DCGrid.SetFocus;
DCGrid.Col:=5;
end;
procedure TDCGL_DC.BitBtn9Click(Sender: TObject);
begin
StringGrid1.Visible:=True;
BitBtn1.Enabled:=False;
BitBtn2.Enabled:=False;
BitBtn3.Enabled:=False;
BitBtn5.Enabled:=False;
BitBtn6.Enabled:=False;
BitBtn10.Enabled:=True;
BitBtn11.Enabled:=True;
StringGrid1.SetFocus;
end;
procedure TDCGL_DC.BitBtn11Click(Sender: TObject);
var a,b:integer;
begin
for a:=1 to 51 do
begin
for b:=1 to 8 do
begin
StringGrid1.Cells[b,a]:='';
end;
end;
StringGrid1.Visible:=False;
BitBtn1.Enabled:=True;
BitBtn2.Enabled:=True;
BitBtn3.Enabled:=True;
BitBtn5.Enabled:=True;
BitBtn6.Enabled:=True;
BitBtn10.Enabled:=False;
BitBtn11.Enabled:=False;
end;
procedure TDCGL_DC.StringGrid1KeyPress(Sender: TObject; var Key: Char);
//var zjje:Real;
// aa:integer;
begin
X:=StringGrid1.Row;
Y:=StringGrid1.Col;
//-----------------------
if key=#13 then
begin
//----------------------------------------------------------
if StringGrid1.Col=1 then
begin
if Length(StringGrid1.Cells[1,x])<>0 then
begin
StringGrid1.Cells[5,x]:='1';
StringGrid1.Cells[6,x]:='1';
StringGrid1.Cells[8,x]:='1';
StringGrid1.Cells[7,x]:='点单';
end;
end;
//----------------------------------------------------------
if StringGrid1.Col=5 then
begin
if Length(STringGrid1.Cells[1,X])<>0 then
begin
if StrToInt(StringGrid1.Cells[5,X])=0 then
begin
ShowMessage('数量不正确');
Exit;
end
else
begin
Try
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -