📄 qtmain3.pas
字号:
end;
query6.Open;
if query6bclx.AsString='D' then
query5.ParamByName('cs1').AsDateTime:=date+strtotime('00:00:00')
else if query6bclx.AsString='M' then
begin
sst:=formatdatetime('yyyy-mm',date)+'-01';
query5.ParamByName('cs1').AsDateTime:=strtodate(sst)+strtotime('00:00:00')
end
else
begin
sst:=formatdatetime('yyyy',date)+'-01-01';
query5.ParamByName('cs1').AsDateTime:=strtodate(sst)+strtotime('00:00:00')
end;
query5.ParamByName('cs2').AsDateTime:=date+strtotime('23:59:59');
query5.Open;
maxdjh:= query5.FieldByName('maxdjh').AsInteger;
query5.Close;
query6.Close;
lsq.Parameters.ParamByName('cs').Value:=0;
lsq.Open;
end;
procedure TqtForm.FormCreate(Sender: TObject);
var i,j,r,c:integer;
begin
qtForm.Left:=0;
qtForm.Top:=0;
for i:=1 to 18 do
for j:=1 to 42 do
begin
btlb[i,j]:=Tbitbtn.Create(Self);
case i of
1: btlb[i,j].Parent:=tabsheet1;
2: btlb[i,j].Parent:=tabsheet2;
3: btlb[i,j].Parent:=tabsheet3;
4: btlb[i,j].Parent:=tabsheet4;
5: btlb[i,j].Parent:=tabsheet5;
6: btlb[i,j].Parent:=tabsheet6;
7: btlb[i,j].Parent:=tabsheet7;
8: btlb[i,j].Parent:=tabsheet8;
9: btlb[i,j].Parent:=tabsheet9;
10: btlb[i,j].Parent:=tabsheet10;
11: btlb[i,j].Parent:=tabsheet11;
12: btlb[i,j].Parent:=tabsheet12;
13: btlb[i,j].Parent:=tabsheet13;
14: btlb[i,j].Parent:=tabsheet14;
15: btlb[i,j].Parent:=tabsheet15;
16: btlb[i,j].Parent:=tabsheet16;
17: btlb[i,j].Parent:=tabsheet17;
18: btlb[i,j].Parent:=tabsheet18;
end;
btlb[i,j].Height:=33;
btlb[i,j].Width:=80;
btlb[i,j].Spacing:=4;
if (j>=1) and (j<=6) then r:=1;
if (j>=7) and (j<=12) then r:=2;
if (j>=13) and (j<=18) then r:=3;
if (j>=19) and (j<=24) then r:=4;
if (j>=25) and (j<=30) then r:=5;
if (j>=31) and (j<=36) then r:=6;
if (j>=37) and (j<=42) then r:=7;
c:=j mod 6;
if c=0 then c:=6;
btlb[i,j].left:=4+(c-1)*84;
btlb[i,j].Top:=6+(r-1)*35;
btlb[i,j].Name:='bt_'+inttostr(i)+'_'+inttostr(j);
btlb[i,j].Visible:=true;
btlb[i,j].BringToFront;
btlb[i,j].Caption:='';
btlb[i,j].OnClick:=timer1timer;
end;
end;
procedure TqtForm.Timer1Timer(Sender: TObject);
var i:integer;
st:string;
tcc:boolean;
begin
if hxq='first' then exit;
if activecontrol.ClassType=Tbitbtn then
if copy(activecontrol.Name,1,3)='bt_' then
begin
st:=trim(copy(activecontrol.Name,4,6));
i:=pos('_',st);
rrow:=strtoint(copy(st,1,i-1));
ccol:=strtoint(copy(st,i+1,2));
if query2.Locate('bh',cdbh[rrow,ccol],[]) then
begin
lsq.Append;
lsqrq.AsDateTime:=date+time;
lsqdjh.AsInteger:=maxdjh;
lsqlb.AsString:=cdlb[rrow,ccol];
lsqbh.AsString:=cdbh[rrow,ccol];
lsqmc.AsString:=query2mc.AsString;
lsqdj.AsFloat:=query2dj.AsCurrency;
lsqgg.AsString:=query2gg.AsString;
lsqsl.AsInteger:=1;
lsqje.AsCurrency:=lsqdj.AsFloat*lsqsl.AsInteger;
lsqfkbz.AsBoolean:=false;
lsqzfbz.AsBoolean:=false;
lsqzcbz.AsString:='';
edit1.Text:=floattostr(strtofloat(edit1.Text)+lsqje.AsFloat);
lsq.Post;
hxq:='next';
//处理套餐
if query2.FieldByName('tcbz').AsBoolean then
begin
tclsq.Open;
tcc:=true;
tcwj.ParamByName('cs').AsString:=lsqbh.AsString;
tcwj.Open;
while not tcwj.Eof do
begin
if tcwjpcbh.AsString<>'' then
begin
if query2.Locate('bh',tcwjpcbh.AsString,[]) then
begin
tclsQ.Append;
tclsqrq.AsDateTime:=date+time;
tclsqdjh.AsInteger:=lsqdjh.AsInteger;
tclsqlb.AsString:=query2lbbm.AsString;
tclsqbh.AsString:=query2bh.AsString;
tclsqmc.AsString:=query2mc.AsString;
tclsqdj.AsFloat:=query2dj.AsCurrency;
tclsqgg.AsString:=query2gg.AsString;
tclsqsl.AsInteger:=lsqsl.AsInteger;
tclsqje.AsCurrency:=0;
tclsqfkbz.AsBoolean:=false;
tclsqzfbz.AsBoolean:=false;
tclsqzcbz.asstring:=lsqbh.asstring;
tclsq.Post;
end;
end
else
begin
tcxz.pcbh:=tcwjpclb.AsString;
tcxz.maxsl:=tcwjsl.AsInteger;
tcxz.ssll:=lsQsl.AsInteger;
tcxz.lbbm:=lsQbh.AsString;
tcxz.djh:=lsQdjh.AsInteger;
tcxzform.mxlsQ.Open;
if tcc=true then
if tcxzForm.showmodal<>mrok then
begin
tcxzform.mxlsQ.Close;
tcc:=false;
end
else begin
tcxzform.mxlsQ.First;
while not tcxzform.mxlsQ.Eof do
begin
tclsq.Append;
for i:=0 to tcxzform.mxlsQ.FieldCount -1 do
begin
if uppercase(tcxzform.mxlsQ.Fields[i].FieldName)<>'ID' then
tclsq.FieldByName(tcxzform.mxlsQ.Fields[i].FieldName).Value:=tcxzform.mxlsQ.Fields[i].Value;
end;
tclsq.Post;
tcxzform.mxlsQ.Next;
end;
tcxzform.mxlsQ.Close;
end;
end;
tcwj.Next;
end;
tcwj.Close;
end;
if tcc=true then
begin
tclsq.First;
while not tclsq.Eof do
begin
lsq.Append;
for i:=0 to tclsq.FieldCount -1 do
begin
if uppercase(tclsq.Fields[i].FieldName)<>'ID' then
lsq.FieldByName(tclsq.Fields[i].FieldName).Value:=tclsq.Fields[i].Value;
end;
lsq.Post;
tclsq.Next;
end;
tclsq.Close;
end;
end;
end;
end;
procedure TqtForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if lsq.UpdatesPending then
if messagedlg('菜单数据已经改动,保存吗?'+#13+'Yes__保存 No__放弃!',mtwarning,[mbyes,mbno],0)=mryes
then lsq.ApplyUpdates;
lsq.Close;
query1.Close;
query2.Close;
vvv:='';
end;
procedure TqtForm.SpeedButtonaClick(Sender: TObject);
begin
if lsq.RecordCount>0 then begin
if (lsqzfbz.AsBoolean=false) and (lsqfkbz.AsBoolean=true) then
if tcyyForm.showmodal=mrok then
begin
lsq.Edit;
lsqzfbz.AsBoolean:=true;
lsq.ApplyUpdates;
exit;
end;
if lsqfkbz.AsBoolean=false then
begin
if lsqzfbz.AsBoolean=false then
begin
lsq.Edit;
lsqzfbz.AsBoolean:=true;
edit1.Text:=floattostr(strtofloat(edit1.Text) - lsqje.asfloat);
lsq.ApplyUpdates;
end;
end;
end;
end;
procedure TqtForm.SpeedButtoneClick(Sender: TObject);
begin
if lsq.UpdatesPending then lsq.ApplyUpdates;
end;
procedure TqtForm.SpeedButtondClick(Sender: TObject);
begin
if lsq.RecordCount<=0 then exit;
if (lsqzfbz.AsBoolean=false) and (lsqfkbz.AsBoolean=true) then
if tcyyForm.showmodal=mrok then
begin
treeview1.Selected.ImageIndex:=4;
lsq.First;
while not lsq.Eof do
begin
lsq.Edit;
lsqzfbz.AsBoolean:=true;
lsq.Next;
end;
lsq.ApplyUpdates;
end;
end;
procedure TqtForm.SpeedButtoniClick(Sender: TObject);
var i:integer;
begin
if (hxq='first') or ((hxq='next') and (lsq.UpdatesPending)) then begin
lsq.ApplyUpdates;
maxdjh:=maxdjh+1;
treev:=treeview1.Selected;
treeview1.Items.Add(treev,inttostr(maxdjh));
i:=treeview1.Items.Count;
treeview1.Items[i -1].ImageIndex:=1;
hxq:='11';
end;
query1.Close;
query1.Open;
lsq.Close;
lsq.ParamByName('cs').AsInteger:=0;
lsq.Open;
end;
procedure TqtForm.SpeedButtoncClick(Sender: TObject);
begin
if query1.RecordCount<=0 then exit;
if (query1zfbz.AsBoolean=false) and (lsqfkbz.AsBoolean=false) then jgmsForm.showmodal;
end;
procedure TqtForm.SpeedButtonfClick(Sender: TObject);
begin
if lsq.RecordCount<=0 then exit;
quickrep1.Preview;
end;
procedure TqtForm.SpeedButtongClick(Sender: TObject);
begin
if lsq.RecordCount<=0 then exit;
end;
procedure TqtForm.SpeedButtonhClick(Sender: TObject);
begin
if lsq.RecordCount<=0 then exit;
end;
procedure TqtForm.TreeView1Click(Sender: TObject);
var je:real;
begin
if treeview1.Selected<>nil then
begin
if lsq.UpdatesPending then lsq.ApplyUpdates;
lsq.Close;
lsq.ParamByName('cs').AsInteger:=strtoint(treeview1.Selected.Text);
lsq.Open;
lsq.First;
je:=0;
while not lsq.Eof do
begin
if (lsqzfbz.AsBoolean=false) and (lsqfkbz.AsBoolean=false) then
je:=je+lsqje.AsFloat;
lsq.Next;
end;
edit1.Text:=floattostr(je);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -