📄 mc_dcgl_dc.~pas
字号:
end;
//-------------------------------------------
//-------------------------------------------
3: begin
if TLCYGLXT.CJFYXXB.Locate('编号',DCGrid.Cells[1,X],[loCaseInsensitive]) then
begin
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;
//--------------------------------
DCGrid.Col:=4;
end
else
begin
ShowMessage('没有此编号餐具信息');
Abort;
end;
end;
//-------------------------------------------
else
begin
if TLCYGLXT.CPFYXXB.Locate('编号',DCGrid.Cells[1,X],[loCaseInsensitive]) then
begin
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;
//--------------------------------
DCGrid.Col:=4;
end
else
begin
ShowMessage('没有此编号菜谱信息');
Abort;
end;
end;
//-------------------
end;
//----------------------
end;
//----------------------------------------------------------
if DCGrid.Col<8 then DCGrid.Col:=DCGrid.Col+1
else
if DCGrid.row<>50 then
begin
DCGrid.row:=DCGrid.row+1;
DCGrid.Col:=1;
end;
end
else
if (DCgrid.Col=1) or (DCgrid.Col=5) then
begin
//if Length(DCGrid.Cells[Y,X-1])=0 then key:=#0
{if Length(DCGrid.Cells[1,X])=0 then key:=#0
else}
if DCGrid.Col=5 then
begin
if key=#8 then key:=#8 else
if (key<'0') or (Key>'9') then key:=#0;
if Length(DCGrid.Cells[2,x])=0 then
begin
Key:=#0;
end;
end;
if DCGrid.col=1 then
if Length(DCGrid.Cells[2,X-1])=0 then
begin
Key:=#0;
end
else
begin
if key=#8 then key:=#8 else
if (key<'0') or (Key>'9') then key:=#0;
end;
end
else
if DCGrid.Col=7 then
begin
if Length(DcGrid.Cells[1,x])=0 then key:=#0
else
begin
Listbox2.Visible:=True;
Listbox2.ItemIndex:=0;
ListBox2.SetFocus;
end;
end
else
if (DCGrid.Col=1) or (DCGrid.Col=2) or (DCGrid.Col=3) or (DCGrid.Col=4)
or (DCGrid.Col=6) or (DCGrid.Col=7) or (DCGrid.Col=8) then Key:=#0;
//------------------------------------------------------------------
end;
procedure TDCGL_DC.BitBtn2Click(Sender: TObject);
begin
Query1.Open;//打开库存水酒记录
DCGrid.Enabled:=True;
DCGrid.setFocus;
end;
procedure TDCGL_DC.ListBox2KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
DCGrid.Cells[Y,X]:=ListBox2.items[ListBox2.ItemIndex];
ListBox2.Visible:=False;
DCGrid.col:=DCGrid.col+1;
DCGrid.setfocus;
end;
end;
procedure TDCGL_DC.BitBtn1Click(Sender: TObject);
var a,b:integer;
begin
if MessageDLG('确认放弃此次加菜吗?',mtCustom
,[mbYes,mbNo],0)=mrYes then
begin
for a:=1 to 51 do
begin
for b:=1 to 8 do
begin
DCGrid.Cells[b,a]:='';
end;
end;
end;
end;
procedure TDCGL_DC.BitBtn3Click(Sender: TObject);
var a:integer;
b:integer;
begin
if Length(DCGrid.Cells[1,1])=0 then
begin
ShowMessage('对不起,没有加菜是无法保存的.');
end
else
begin
for a:=1 to 51 do
begin
if Length(DCGrid.Cells[1,a])=0 then
begin
b:=a;
Break;
end
else
begin
if Length(DCGrid.Cells[2,a])=0 then
begin
ShowMessage('数据有误,请修改.');
DCGrid.Col:=2;
DCGrid.Row:=a;
DCGrid.SetFocus;
Exit;
end;
if Length(DCGrid.Cells[3,a])=0 then
begin
ShowMessage('数据有误,请修改.');
DCGrid.Col:=3;
DCGrid.Row:=a;
DCGrid.SetFocus;
Exit;
end;
if Length(DCGrid.Cells[4,a])=0 then
begin
ShowMessage('数据有误,请修改.');
DCGrid.Col:=4;
DCGrid.Row:=a;
DCGrid.SetFocus;
Exit;
end;
if Length(DCGrid.Cells[5,a])=0 then
begin
ShowMessage('数据有误,请修改.');
DCGrid.Col:=5;
DCGrid.Row:=a;
DCGrid.SetFocus;
Exit;
end;
if Length(DCGrid.Cells[6,a])=0 then
begin
ShowMessage('数据有误,请修改.');
DCGrid.Col:=6;
DCGrid.Row:=a;
DCGrid.SetFocus;
Exit;
end;
if Length(DCGrid.Cells[7,a])=0 then
begin
ShowMessage('数据有误,请修改.');
DCGrid.Col:=7;
DCGrid.Row:=a;
DCGrid.SetFocus;
Exit;
end;
if Length(DCGrid.Cells[8,a])=0 then
begin
ShowMessage('数据有误,请修改.');
DCGrid.Col:=8;
DCGrid.Row:=a;
DCGrid.SetFocus;
Exit;
end;
end;
end;
//----------------------------------------
Query2.Close;
Query2.SQL.Clear;
Query2.SQL.Add('Insert 点菜临时表 (房间台号,编号,名称,类型,单位,数量,价格,合计,服务员编号,服务员姓名,状态,点单日期,结帐编号,是否结单)');
Query2.SQl.Add('Values(:房间台号,:编号,:名称,:类型,:单位,:数量,:价格,:合计,:服务员编号,:服务员名称,:状态,:点单日期,:结帐编号,:是否结单)');
//----------------------------------------
For a:=1 to b-1 do //b-1
begin
Query2.Params[0].AsInteger:=StrToInt(TLCYGLXT.KT_FJTHXXB.FieldByName('编号').AsString);
Query2.Params[1].AsInteger:=StrToInt(DCGrid.Cells[1,a]);
Query2.Params[2].AsString:=DCGrid.Cells[2,a];
Query2.Params[3].AsString:=DCGrid.Cells[3,a];
Query2.Params[4].AsString:=DCGrid.Cells[4,a];
Query2.Params[5].AsInteger:=StrToInt(DCGrid.Cells[5,a]);
Query2.Params[6].AsFloat:=StrToFloat(DCGrid.Cells[6,a]);
Query2.Params[7].AsFloat:=StrToFloat(DCGrid.Cells[8,a]);
Query2.Params[8].AsInteger:=StrToInt(Label15.Caption);
Query2.Params[9].AsString:=Label16.Caption;
Query2.Params[10].AsString:=DCGrid.Cells[7,a];
Query2.Params[11].AsDateTime:=StrToDateTime(Label17.Caption);
Query2.Params[12].AsInteger:=StrToInt(Label18.Caption);
Query2.Params[13].Asstring:='否';
Query2.ExecSQL;
//-----------------------------------------------
end;
for a:=1 to 51 do
begin
for b:=1 to 8 do
begin
DCGrid.Cells[b,a]:='';
end;
end;
ShowMessage('加菜成功!!');
Query3.Close;
Query3.Open;
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:=FloatToStr(Query4.Fields[0].AsFloat+TLCYGLXT.KT_FJTHXXB.FieldByName('服务费').AsFloat);
//-------------------------
//Label14.Caption:=Query4.Fields[0].AsString;
//TLCYGLXT.DCLSB.Open;//打开点菜临时表;
//TLCYGLXT.DCLSB.Close;//关闭点菜临时表;
end;//结束判断点菜的信息是否为空.
end;
procedure TDCGL_DC.Edit1Enter(Sender: TObject);
begin
Edit1.Color:=ClAqua;
end;
procedure TDCGL_DC.Edit1Exit(Sender: TObject);
begin
Edit1.Color:=ClWindow;
end;
procedure TDCGL_DC.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then BitBtn7.Click
else
if key=#8 then key:=#8
else
if Copy(Edit1.Text,0,1)<>'0' then
begin
if (key<'0')or(key>'9') then key:=#0
end
else
key:=#0;
end;
procedure TDCGL_DC.BitBtn8Click(Sender: TObject);
begin
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;
procedure TDCGL_DC.BitBtn6Click(Sender: TObject);
begin
DCGrid.Enabled:=False;
DBGrid2.Enabled:=False;
BitBtn1.Enabled:=False;
BitBtn2.Enabled:=False;
BitBtn3.Enabled:=False;
BitBtn4.Enabled:=False;
BitBtn5.Enabled:=False;
BitBtn6.Enabled:=False;
Edit1.Text:=Query3.FieldByName('数量').AsString;
GroupBox2.Visible:=True;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -