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

📄 zhuantai.pas

📁 小管理程序主要管理的小咖啡厅我是从网上下的经测试可用
💻 PAS
字号:
unit zhuantai;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, DBCtrls, DB, ADODB;

type
  TFrmzhuantai = class(TForm)
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Edit1: TEdit;
    Label6: TLabel;
    Label7: TLabel;
    BtnZhuanTai: TSpeedButton;
    BtnClose: TSpeedButton;
    DBText1: TDBText;
    DBText2: TDBText;
    DBText3: TDBText;
    DBText4: TDBText;
    QueryCommand: TADOQuery;
    LabelState: TLabel;
    Labelname: TLabel;
    procedure FormShow(Sender: TObject);
    procedure BtnCloseClick(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure BtnZhuanTaiClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    deskid:integer;
    isok:boolean;
  end;

var
  Frmzhuantai: TFrmzhuantai;

implementation
   uses dbmodule;
{$R *.dfm}

procedure TFrmzhuantai.FormShow(Sender: TObject);
begin
 if not dm.Qfangtai.Active then
     dm.Qfangtai.Open ;
 if not dm.Qfangtaistatus.Active then
     dm.Qfangtaistatus.Open;
  if dm.Qfangtai.Active then
    begin
      dm.Qfangtai.Locate('fangtaiid',deskid,[loCaseInsensitive]);
    end;
  edit1.Text:='';
  Edit1.ReadOnly:=False;
  labelstate.Caption:='';
  labelname.Caption:='';
  BtnZhuanTai.Enabled:=False;
  isok:=False;
end;

procedure TFrmzhuantai.BtnCloseClick(Sender: TObject);
begin
  self.Close;
end;

procedure TFrmzhuantai.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if not (key in ['0'..'9', #8, #13]) then
    begin
     key := #0;
    end;
  if key=#13 then
    begin
      if querycommand.Active then
        querycommand.Close;
      querycommand.SQL.Clear;
      querycommand.SQL.Add('SELECT Q_fangtai.fangtaiid, Q_fangtai.fangtainame,Q_fangtai.statusid, Q_fangtaistatus.statusname');
      querycommand.SQL.Add(' FROM Q_fangtai INNER JOIN Q_fangtaistatus ON Q_fangtai.statusid = Q_fangtaistatus.statusid');
      querycommand.SQL.Add(' WHERE  Q_fangtai.fangtaiid='+edit1.Text);
      querycommand.Open;
      if not querycommand.Eof then
         begin
           labelstate.Caption:=querycommand.FieldValues['statusname'];
           labelname.Caption:=querycommand.FieldValues['fangtainame'];
           if querycommand.FieldByName('statusid').AsInteger=0 then
             begin
               BtnZhuanTai.Enabled:=True;
               edit1.ReadOnly:=True;
             end;
         end
      else
         begin
           application.MessageBox('没有要转向的房台!','提示',mb_ok);
         end;
      querycommand.Close;
    end;
end;

procedure TFrmzhuantai.BtnZhuanTaiClick(Sender: TObject);
begin
   if querycommand.Active then
        querycommand.Close;
   querycommand.SQL.Clear;
   querycommand.SQL.Add('select * from Q_fangtai where fangtaiid='+edit1.Text);
   querycommand.Open;
   if not querycommand.Eof then
     begin
       querycommand.Edit;
       querycommand.FieldByName('zhanghao').AsString:=dm.Qfangtai.FieldValues['zhanghao'];
       querycommand.FieldByName('customer').AsString:=dm.Qfangtai.FieldValues['customer'];
       querycommand.FieldByName('Gustcount').AsInteger:=dm.Qfangtai.FieldValues['Gustcount'];
       querycommand.FieldByName('Gusttime').AsDateTime:=dm.Qfangtai.FieldValues['Gusttime'];
       querycommand.FieldByName('GustMemo').AsString:=dm.Qfangtai.FieldValues['GustMemo'];
       querycommand.FieldByName('Gustmoney').AsFloat:=dm.Qfangtai.FieldValues['Gustmoney'];
       querycommand.FieldByName('statusid').AsInteger:=dm.Qfangtai.FieldValues['statusid'];
       querycommand.Post;
     end;
   querycommand.Close;
   if querycommand.Active then
        querycommand.Close;
   querycommand.SQL.Clear;
   querycommand.SQL.Add('update Q_customertemp set fangtaiid='+edit1.Text+'  where zhanghao='+''''+dm.Qfangtai.FieldValues['zhanghao']+'''');
   querycommand.ExecSQL;
   dm.Qfangtai.Edit;
   dm.Qfangtai.FieldValues['zhanghao']:='';
   dm.Qfangtai.FieldValues['customer']:='';
   dm.Qfangtai.FieldValues['Gustcount']:=0;
   dm.Qfangtai.FieldByName('Gusttime').Clear;
   dm.Qfangtai.FieldValues['GustMemo']:='';
   dm.Qfangtai.FieldValues['Gustmoney']:=0;
   dm.Qfangtai.FieldValues['statusid']:=0;
   dm.Qfangtai.Post;
   dm.Qfangtai.Locate('fangtaiid',strtoint(edit1.Text),[loCaseInsensitive]);
   dm.SaveWorkLog(now(),dm.opratename,'转台操作完成。');
   isok:=true;
   self.Close;
end;

end.

⌨️ 快捷键说明

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