⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qtkdsz.pas

📁 日昌餐饮管理系统是用Delphi7+SQL写的管理系统
💻 PAS
📖 第 1 页 / 共 2 页
字号:
     qtform.labelededit6.Text:=query1twmc.Value;
     qtmain.twbh:=query1twbh.AsString;
     IF query1.FieldByName('djh').AsInteger<>0 THEN qtmain.djhh:=query1.FieldByName('djh').AsString
     ELSE qtmain.djhh:='-1';
     query1.Close;
//     qtform.Edit7.Text:=query1twbh.AsString;
     qtmain.jzbz:='qt';
     timer1.Enabled:=false;
     qtform.showmodal;
     timer1.Enabled:=true;
     query1.Parameters[0].Value:=ss;
     query1.Open;
     query1.Edit;
     query1czbz.AsBoolean:=false;
     query1.Post;
     listview1det;
end;

procedure TqtkdForm.FormCreate(Sender: TObject);
var i,j:integer;
begin
     for i:=0 to 99 do
     begin
       bbtt[i+1]:=Tbitbtn.Create(Self);
       bbtt[i+1].Height:=44;
       bbtt[i+1].Width:=117;
       j:=trunc(i/4);
       bbtt[i+1].Top:=1+(bbtt[i+1].Height+1) * j;
       j:=i mod 4;
       bbtt[i+1].Left:=bbtt[i+1].Width*(j);
       bbtt[i+1].Name:='sp_'+inttostr(i+1);
       bbtt[i+1].Parent:=scrollbox1;
       bbtt[i+1].Caption:='';
       bbtt[i+1].Visible:=false;
       bbtt[i+1].OnClick:=speedbuttonclick;
//
       bb[i+1]:=Tbitbtn.Create(Self);
       bb[i+1].Height:=30;
       bb[i+1].Width:=315;
       j:=trunc(i/2);
       bb[i+1].Top:=1+(bb[i+1].Height+1) * j;
       j:=i mod 2;
       bb[i+1].Left:=bb[i+1].Width*(j);
       bb[i+1].Name:='bb_'+inttostr(i+1);
       bb[i+1].Parent:=scrollbox2;
       bb[i+1].Caption:='';
       bb[i+1].OnClick:=SpdButtonClick;
       bb[i+1].Visible:=false;
       application.ProcessMessages;
     end;
end;

procedure TqtkdForm.BitBtn1Click(Sender: TObject);
begin
     query1.Close;
     query2.Close;
     query3.Close;
     qtkdform.Close;
end;

procedure TqtkdForm.SpeedButton1Click(Sender: TObject);
var i,djh1,djh2:integer;
    jjee:real;
begin
    bingzhouu.czbz:='bt';
    if bingzhouf.ShowModal=mrok then
    if messagedlg('确实要将 '+bingzhouF.Edit1.Text+' 并入 '+bingzhouf.Edit2.Text+' 吗?',mtinformation,[mbyes,mbno],0)=mryes then
    begin
        i:=pos('__',bingzhouf.Edit1.Text);
        ctbh1:=copy(bingzhouf.Edit1.Text,1,i-1);
        twbh1:=copy(bingzhouf.Edit1.Text,i+2,length(bingzhouf.Edit1.Text));
        if adoquery1.Active then adoquery1.close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add('select * from cantai where ctmc=:cs1 and twmc=:cs2 ');
        adoquery1.Parameters.ParamByName('cs1').Value:=ctbh1;
        adoquery1.Parameters.ParamByName('cs2').Value:=twbh1;
        adoquery1.Open;
        if adoquery1.RecordCount<1 then
        begin
           messagedlg('将 '+bingzhouF.Edit1.Text+' 并入 '+bingzhouf.Edit2.Text+'失败!',mtinformation,[mbok],0);
           exit;
        end
        else if adoquery1czbz.AsBoolean=true then
        begin
           messagedlg('您不能合并正在点菜的餐台!并桌被终止!',mtinformation,[mbok],0);
           exit;
        end;
        ctbh1:=adoquery1ctbh.AsString;
        twbh1:=adoquery1twbh.AsString;
        djh1:=adoquery1djh.AsInteger;
        i:=pos('__',bingzhouf.Edit2.Text);
        ctbh2:=copy(bingzhouf.Edit2.Text,1,i-1);
        twbh2:=copy(bingzhouf.Edit2.Text,i+2,length(bingzhouf.Edit2.Text));
        if adoquery1.Active then adoquery1.close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add('select * from cantai where ctmc=:cs1 and twmc=:cs2');
        adoquery1.Parameters.ParamByName('cs1').Value:=ctbh2;
        adoquery1.Parameters.ParamByName('cs2').Value:=twbh2;
        adoquery1.Open;
        if adoquery1.RecordCount<1 then
        begin
           messagedlg('将 '+bingzhouF.Edit1.Text+' 并入 '+bingzhouf.Edit2.Text+'失败!',mtinformation,[mbok],0);
           exit;
        end
        else if adoquery1czbz.AsBoolean=true then
        begin
           messagedlg('您不能合并正在点菜的餐台!并桌被终止!',mtinformation,[mbok],0);
           exit;
        end;
        ctbh2:=adoquery1ctbh.AsString;
        twbh2:=adoquery1twbh.AsString;
        djh2:=adoquery1djh.AsInteger;
        mainform.RJSADO.BeginTrans;
        if dcdq.Active then dcdq.Close;
        dcdq.Parameters.ParamByName('cs1').Value:=djh1;
        dcdq.Open;
        while not dcdq.Eof do
        begin
          dcdq.Edit;
          dcdqdjh.Value:=djh2;
          dcdqtwbh.Value:=twbh2;
          dcdq.Post;
          dcdq.Next;
        end;
        dcdq.Close;
        if adoquery1.Active then adoquery1.close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add('select * from cantai where ctbh=:cs1 and twbh=:cs2');
        adoquery1.Parameters.ParamByName('cs1').Value:=ctbh1;
        adoquery1.Parameters.ParamByName('cs2').Value:=twbh1;
        adoquery1.Open;
        if adoquery1.RecordCount<1 then
        begin
           messagedlg('将 '+bingzhouF.Edit1.Text+' 并入 '+bingzhouf.Edit2.Text+'失败!',mtinformation,[mbok],0);
           mainform.RJSADO.RollbackTrans;
           exit;
        end;
        adoquery1.Edit;
        adoquery1twzt.Value:='K';
        adoquery1djh.Value:=0;
        adoquery1xfje.Value:=0;
        adoquery1.Post;
        if sumdcdq.Active then sumdcdq.Close;
        sumdcdq.Parameters.ParamByName('cs1').Value:=djh2;
        sumdcdq.Open;
        jjee:=sumdcdqjje.AsFloat;
        sumdcdq.Close;
        if adoquery1.Active then adoquery1.close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add('select * from cantai where ctbh=:cs1 and twbh=:cs2');
        adoquery1.Parameters.ParamByName('cs1').Value:=ctbh2;
        adoquery1.Parameters.ParamByName('cs2').Value:=twbh2;
        adoquery1.Open;
        if adoquery1.RecordCount<1 then
        begin
           messagedlg('将 '+bingzhouF.Edit1.Text+' 并入 '+bingzhouf.Edit2.Text+'失败!',mtinformation,[mbok],0);
           mainform.RJSADO.RollbackTrans;
           exit;
        end;
        adoquery1.Edit;
        adoquery1djh.Value:=djh2;
        adoquery1twzt.Value:='Z';
        adoquery1xfje.AsFloat:=round(jjee*100)/100;
        adoquery1.Post;
        mainform.RJSADO.CommitTrans;
//        messagedlg('将 '+bingzhouF.Edit1.Text+' 成功并入 '+bingzhouf.Edit2.Text+'!',mtinformation,[mbok],0);
        treeview1det;
     end;
end;

procedure TqtkdForm.SpeedButton2Click(Sender: TObject);

var i,djh1:integer;
    jjee:real;
begin
    bingzhouu.czbz:='zt';
    if bingzhouf.ShowModal=mrok then
    if messagedlg('确实要将 '+bingzhouF.Edit1.Text+' 转入 '+bingzhouf.Edit2.Text+' 吗?',mtinformation,[mbyes,mbno],0)=mryes then
    begin
        i:=pos('__',bingzhouf.Edit1.Text);
        ctbh1:=copy(bingzhouf.Edit1.Text,1,i-1);
        twbh1:=copy(bingzhouf.Edit1.Text,i+2,length(bingzhouf.Edit1.Text));
        if adoquery1.Active then adoquery1.close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add('select * from cantai where ctmc=:cs1 and twmc=:cs2');
        adoquery1.Parameters.ParamByName('cs1').Value:=ctbh1;
        adoquery1.Parameters.ParamByName('cs2').Value:=twbh1;
        adoquery1.Open;
        if adoquery1.RecordCount<1 then
        begin
           messagedlg('将 '+bingzhouF.Edit1.Text+' 转入 '+bingzhouf.Edit2.Text+'失败!',mtinformation,[mbok],0);
           exit;
        end
        else if adoquery1czbz.AsBoolean=true then
        begin
           messagedlg('您不能转移正在点菜的餐台!转台被终止!',mtinformation,[mbok],0);
           exit;
        end;
        ctbh1:=adoquery1ctbh.AsString;
        twbh1:=adoquery1twbh.AsString;
        djh1:=adoquery1djh.AsInteger;
        i:=pos('__',bingzhouf.Edit2.Text);
        ctbh2:=copy(bingzhouf.Edit2.Text,1,i-1);
        twbh2:=copy(bingzhouf.Edit2.Text,i+2,length(bingzhouf.Edit2.Text));
        if adoquery1.Active then adoquery1.close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add('select * from cantai where ctmc=:cs1 and twmc=:cs2');
        adoquery1.Parameters.ParamByName('cs1').Value:=ctbh2;
        adoquery1.Parameters.ParamByName('cs2').Value:=twbh2;
        adoquery1.Open;
        if adoquery1.RecordCount<1 then
        begin
           messagedlg('将 '+bingzhouF.Edit1.Text+' 转入 '+bingzhouf.Edit2.Text+'失败!',mtinformation,[mbok],0);
           exit;
        end
        else if adoquery1czbz.AsBoolean=true then
        begin
           messagedlg('您不能转移到正在点菜的餐台!转台被终止!',mtinformation,[mbok],0);
           exit;
        end;
        ctbh2:=adoquery1ctbh.AsString;
        twbh2:=adoquery1twbh.AsString;
        mainform.RJSADO.BeginTrans;
        if dcdq.Active then dcdq.Close;
        dcdq.Parameters.ParamByName('cs1').Value:=djh1;
        dcdq.Open;
        while not dcdq.Eof do
        begin
          dcdq.Edit;
          dcdqtwbh.Value:=twbh2;
          dcdq.Post;
          dcdq.Next;
        end;
        dcdq.Close;
        if adoquery1.Active then adoquery1.close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add('select * from cantai where ctbh=:cs1 and twbh=:cs2');
        adoquery1.Parameters.ParamByName('cs1').Value:=ctbh1;
        adoquery1.Parameters.ParamByName('cs2').Value:=twbh1;
        adoquery1.Open;
        if adoquery1.RecordCount<1 then
        begin
           messagedlg('将 '+bingzhouF.Edit1.Text+' 转入 '+bingzhouf.Edit2.Text+'失败!',mtinformation,[mbok],0);
           mainform.RJSADO.RollbackTrans;
           exit;
        end;
        adoquery1.Edit;
        adoquery1twzt.Value:='K';
        adoquery1djh.Value:=0;
        adoquery1xfje.Value:=0;
        adoquery1.Post;
        if dcdq.Active then dcdq.Close;
        dcdq.Parameters.ParamByName('cs1').Value:=djh1;
        dcdq.Open;
        jjee:=0;
        while not dcdq.Eof do
        begin
          if dcdqzfbz.AsBoolean<>true then jjee:=jjee+dcdqje.AsFloat;
          dcdq.Next;
        end;
        dcdq.Close;
        if adoquery1.Active then adoquery1.close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add('select * from cantai where ctbh=:cs1 and twbh=:cs2');
        adoquery1.Parameters.ParamByName('cs1').Value:=ctbh2;
        adoquery1.Parameters.ParamByName('cs2').Value:=twbh2;
        adoquery1.Open;
        if adoquery1.RecordCount<1 then
        begin
           messagedlg('将 '+bingzhouF.Edit1.Text+' 转入 '+bingzhouf.Edit2.Text+'失败!',mtinformation,[mbok],0);
           mainform.RJSADO.RollbackTrans;
           exit;
        end;
        adoquery1.Edit;
        adoquery1djh.Value:=djh1;
        adoquery1twzt.Value:='Z';
        adoquery1xfje.AsFloat:=round(jjee*100)/100;
        adoquery1.Post;
        mainform.RJSADO.CommitTrans;
//        messagedlg('将 '+bingzhouF.Edit1.Text+' 成功转入 '+bingzhouf.Edit2.Text+'!',mtinformation,[mbok],0);
        treeview1det;
     end;
end;


procedure TqtkdForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
     timer1.Enabled:=false;
end;

procedure TqtkdForm.Timer1Timer(Sender: TObject);
var i:integer;
begin
     ctydq.Close;
     ctydq.Parameters.ParamByName('cs1').Value:=date;
     ctydq.Open;
     i:=0;
     while not ctydq.Eof do
     begin
       bb[i+1].Caption:=ctydqid.AsString+ ' 号 ['+ctydqctmc.Value+'] 厅 ['+ctydqtwmc.Value+'] 台 预计 '+formatdatetime('hh:mm:ss', ctydqqssj.AsDateTime)+ ' 到';
       bb[i+1].OnClick:=SpdButtonClick;
       bb[i+1].Visible:=true;
       if (ctydqqssj.AsDateTime >= date+time) then bb[i+1].Font.color:=clblack else bb[i+1].Font.color:=clred;
       if (ctydqqssj.AsDateTime >= date+time) and (ctydqqssj.AsDateTime <= date+(time + strtotime('0:05:00'))) then messagedlg(ctydqct.AsString+' 厅的 '+ctydqth.AsString+ ' 台预定时间 5 分钟后到达!',mtwarning,[mbok],0);
       i:=i+1;
       ctydq.Next;
     end;
     ctydq.Close;
     for i:=i to 99 do
     begin
       bb[i+1].Caption:=' ';
       bb[i+1].OnClick:=SpdButtonClick;
       bb[i+1].Font.color:=clblack;
       bb[i+1].Visible:=false;
     end;
     listview1det;
end;

procedure TqtkdForm.SpdButtonClick(Sender:Tobject);
var ss:string;
    i,ii:integer;
begin
     if activecontrol.ClassType<>Tbitbtn then exit;
     if copy(activecontrol.Name,1,3)<>'bb_' then exit;
     ii:=strtoint(copy(activecontrol.Name,4,3));
     i:=pos('号', bb[ii].Caption);
     ss:=trim(copy(bb[ii].Caption,1,i -1));
     if messagedlg('查看预定信息吗?'+#13+'Yes_查看,No_不查看!',mtinformation,[mbyes,mbno],0)=mryes then
     begin
       cyydform:=Tcyydform.Create(Self);
       cyyd.func:=ss;
       cyydform.showmodal;
       cyydform.Free;
     end;
{     if messagedlg('处理预定信息吗?'+#13+'Yes_处理,No_不处理!',mtinformation,[mbyes,mbno],0)=mryes then
     begin
       ctydq.Close;
       ctydq.Parameters.ParamByName('cs1').Value:=date;
       ctydq.Open;
       ctydq.Locate('id',ss,[]);
       if (ctydqqssj.AsDateTime >= date+time) then
        if messagedlg('客人预定时间到达吗?'+#13+'Yes_是的,No_不是!',mtinformation,[mbyes,mbno],0)=mryes then

     end;}
end;

procedure TqtkdForm.BitBtn2Click(Sender: TObject);
var xx:string;
begin
     if messagedlg('台位清理可能造成台位显示不完整!'+#13+'您确实要继续吗?!',mtwarning,[mbyes,mbno],0)<> mryes then exit;
     xx:=inputbox('台位编号','请输入台位','');
     if xx<>'' then
     begin
        if adoquery1.Active then adoquery1.close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add('update cantai set twzt='+''''+'K'+''''+',djh=0,xfje=0,czbz=0 where twbh='+''''+xx+'''');
        adoquery1.ExecSQL;
        adoquery1.Close;
        treeview1det;
     end;
end;

procedure TqtkdForm.BitBtn3Click(Sender: TObject);
var xx:string;
begin
     xx:=inputbox('台位编号','请输入台位','');
     if xx<>'' then
     begin
        if adoquery1.Active then adoquery1.close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add('update cantai set czbz=0 where twbh='+''''+xx+'''');
        adoquery1.ExecSQL;
        adoquery1.Close;
        treeview1det;
     end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -