📄 mc_dcgl_dc.~pas
字号:
StringGrid1.Cells[8,X]:=IntToStr(Round(StrToint(StringGrid1.Cells[5,X])*StrToFloat(StringGrid1.Cells[6,X])));
Except
End;
//StringGrid1.Col:=7;
end;
end;
end;
//----------------------------------------------------------
if StringGrid1.Col=6 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
StringGrid1.Cells[8,X]:=IntToStr(Round(StrToint(StringGrid1.Cells[5,X])*StrToFloat(StringGrid1.Cells[6,X])));
Except
End;
//StringGrid1.Col:=7;
end;
end;
end;
//----------------------------------------------------------
if StringGrid1.col=8 then
begin
end;
//------------------------------------------------------------------
if StringGrid1.Col<8 then StringGrid1.Col:=StringGrid1.Col+1
else
if StringGrid1.row<>50 then
begin
StringGrid1.row:=StringGrid1.row+1;
StringGrid1.Col:=1;
end;
end//---结速判断回车键--------------------------------------------------
else
if (StringGrid1.Col=1) or (StringGrid1.Col=5) or (StringGrid1.Col=6) or (StringGrid1.col=8) then
begin
if StringGrid1.col=1 then
if Length(StringGrid1.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;
//-------------------------------------------------------------
if StringGrid1.Col=5 then
begin
if key=#8 then key:=#8 else
if (key<'0') or (Key>'9') then key:=#0;
if Length(StringGrid1.Cells[2,x])=0 then
begin
Key:=#0;
end;
end;
//-------------------------------------------------------------
if StringGrid1.Col=6 then
begin
if key=#8 then key:=#8 else
if key='.' then key:='.' else
if (key<'0') or (Key>'9') then key:=#0;
if Length(StringGrid1.Cells[2,x])=0 then
begin
Key:=#0;
end;
end;
//-------------------------------------------------------------
if StringGrid1.Col=8 then
begin
if key=#8 then key:=#8 else
if (key<'0') or (Key>'9') then key:=#0;
if Length(StringGrid1.Cells[2,x])=0 then
begin
Key:=#0;
end;
end;
//-------------------------------------------------------------
end
else
if StringGrid1.Col=7 then
begin
if Length(StringGrid1.Cells[1,x])=0 then key:=#0
else
begin
if StringGrid1.Cells[y,x]='点单' then
begin
StringGrid1.Cells[y,x]:='赠单'
end
else
StringGrid1.Cells[y,x]:='点单';
key:=#0;
end
end;
{else
if (StringGrid1.Col=1) or (StringGrid1.Col=2) or (StringGrid1.Col=3) or (StringGrid1.Col=4)
or (StringGrid1.Col=6) or (StringGrid1.Col=7) or (StringGrid1.Col=8) then Key:=#0;}
//------------------------------------------------------------------
end;
procedure TDCGL_DC.BitBtn10Click(Sender: TObject);
var a:integer;
b:integer;
begin
if Length(StringGrid1.Cells[1,1])=0 then
begin
ShowMessage('对不起,没有菜是无法保存的.');
end
else
begin
for a:=1 to 51 do
begin
if Length(StringGrid1.Cells[1,a])=0 then
begin
b:=a;
Break;
end
else
begin
if Length(StringGrid1.Cells[2,a])=0 then
begin
ShowMessage('数据有误,请修改.');
StringGrid1.Col:=2;
StringGrid1.Row:=a;
StringGrid1.SetFocus;
Exit;
end;
if Length(StringGrid1.Cells[3,a])=0 then
begin
ShowMessage('数据有误,请修改.');
StringGrid1.Col:=3;
StringGrid1.Row:=a;
StringGrid1.SetFocus;
Exit;
end;
if Length(StringGrid1.Cells[4,a])=0 then
begin
ShowMessage('数据有误,请修改.');
StringGrid1.Col:=4;
StringGrid1.Row:=a;
StringGrid1.SetFocus;
Exit;
end;
if Length(StringGrid1.Cells[5,a])=0 then
begin
ShowMessage('数据有误,请修改.');
StringGrid1.Col:=5;
StringGrid1.Row:=a;
StringGrid1.SetFocus;
Exit;
end;
if Length(StringGrid1.Cells[6,a])=0 then
begin
ShowMessage('数据有误,请修改.');
StringGrid1.Col:=6;
StringGrid1.Row:=a;
StringGrid1.SetFocus;
Exit;
end;
if Length(StringGrid1.Cells[7,a])=0 then
begin
ShowMessage('数据有误,请修改.');
StringGrid1.Col:=7;
StringGrid1.Row:=a;
StringGrid1.SetFocus;
Exit;
end;
if Length(StringGrid1.Cells[8,a])=0 then
begin
ShowMessage('数据有误,请修改.');
StringGrid1.Col:=8;
StringGrid1.Row:=a;
StringGrid1.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
begin
Query2.Params[0].AsInteger:=StrToInt(TLCYGLXT.KT_FJTHXXB.FieldByName('编号').AsString);
Query2.Params[1].AsInteger:=StrToInt(StringGrid1.Cells[1,a]);
Query2.Params[2].AsString:=StringGrid1.Cells[2,a];
Query2.Params[3].AsString:=StringGrid1.Cells[3,a];
Query2.Params[4].AsString:=StringGrid1.Cells[4,a];
Query2.Params[5].AsInteger:=StrToInt(StringGrid1.Cells[5,a]);
Query2.Params[6].AsFloat:=StrToFloat(StringGrid1.Cells[6,a]);
Query2.Params[7].AsFloat:=StrToFloat(StringGrid1.Cells[8,a]);
Query2.Params[8].AsInteger:=StrToInt(Label15.Caption);
Query2.Params[9].AsString:=Label16.Caption;
Query2.Params[10].AsString:=StringGrid1.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
StringGrid1.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;//结束判断点菜的信息是否为空.
//------------------------------------------------------------------------------
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.StringGrid1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
//----------------------------------------------------------
if StringGrid1.Col=5 then
begin
if Length(STringGrid1.Cells[1,X])<>0 then
begin
if Length(StringGrid1.Cells[5,X])=0 then
begin
//ShowMessage('数量不正确');
Exit;
end
else
begin
Try
StringGrid1.Cells[8,X]:=IntToStr(Round(StrToint(StringGrid1.Cells[5,X])*StrToFloat(StringGrid1.Cells[6,X])));
Except
End;
//StringGrid1.Col:=7;
end;
end;
end;
//----------------------------------------------------------
if StringGrid1.Col=6 then
begin
if Length(StringGrid1.Cells[1,X])<>0 then
begin
if Length(StringGrid1.Cells[5,X])=0 then
begin
//ShowMessage('数量不正确');
Exit;
end
else
begin
Try
StringGrid1.Cells[8,X]:=IntToStr(Round(StrToint(StringGrid1.Cells[5,X])*StrToFloat(StringGrid1.Cells[6,X])));
Except
end;
//StringGrid1.Col:=7;
end;
end;
end;
end;
procedure TDCGL_DC.DCGridKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if DCGrid.Col=5 then
begin
if Length(DCGrid.Cells[1,X])<>0 then
begin
if Length(DCGrid.Cells[5,X])=0 then
begin
//ShowMessage('数量不正确');
Exit;
end
else
begin
Try
DCGrid.Cells[8,X]:=IntToStr(Round(StrToint(DCGrid.Cells[5,X])*StrToFloat(DCGrid.Cells[6,X])));
Except
End;
end;
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -