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

📄 bookroom.pas

📁 我自己写的一个有关酒店管理系统的代码 大家
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit bookroom;

interface

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

type
  TbookroomForm = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    Label3: TLabel;
    Edit3: TEdit;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    MaskEdit1: TMaskEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Label7: TLabel;
    Edit6: TEdit;
    Label8: TLabel;
    Edit7: TEdit;
    Label9: TLabel;
    Edit8: TEdit;
    GroupBox2: TGroupBox;
    Label10: TLabel;
    Edit9: TEdit;
    Edit10: TEdit;
    Label11: TLabel;
    Label12: TLabel;
    Edit11: TEdit;
    Label13: TLabel;
    Edit12: TEdit;
    Label14: TLabel;
    Edit13: TEdit;
    GroupBox3: TGroupBox;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    Label15: TLabel;
    Edit14: TEdit;
    Label16: TLabel;
    Edit15: TEdit;
    Label17: TLabel;
    Edit16: TEdit;
    Label18: TLabel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    BitBtn4: TBitBtn;
    ComboBox1: TComboBox;
    ADOConnection1: TADOConnection;
    Label19: TLabel;
    Edit17: TEdit;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure RadioButton1Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
    procedure Edit1Exit(Sender: TObject);
    procedure ComboBox1Exit(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure initiate;
    procedure savetobookroomtable;
    procedure savetobookroomhistorytable;
    procedure makebooknumber;
    procedure printbook;
    procedure savezjqstable;
    procedure savetozjqslstable;
    procedure savetodtsztable;
    procedure savetoszlstable;
  end;

var
  bookroomForm: TbookroomForm;
  booknumber:string;
implementation
  USES BOOK_FIND,main,bookroomrpt;
{$R *.dfm}

procedure TbookroomForm.BitBtn1Click(Sender: TObject);
begin
    BOOKFINDFORM.ShowModal;
end;

procedure TbookroomForm.BitBtn4Click(Sender: TObject);
begin
    close;
end;
procedure TBookRoomForm.initiate;
begin
    edit1.Text:='';
    edit2.Text:='';
    edit3.Text:='';
    edit4.Text:='';
    edit5.Text:='';
    edit6.Text:='';
    edit7.Text:='';
    edit8.Text:='';
    edit9.Text:='';
    edit10.Text:='';
    edit11.Text:='';
    edit12.Text:='';
    edit13.Text:='';
    edit14.Text:='';
    edit15.Text:='';
    edit16.Text:='';
    edit17.Text:='0';
    maskedit1.Text:='';
    combobox1.Text:='';
    radiobutton1.Checked:=false;
    radiobutton2.Checked:=false;
end;
procedure TbookroomForm.FormActivate(Sender: TObject);
begin
    initiate;
    edit1.SetFocus;
    edit11.Enabled:=false; 
    edit13.Enabled:=false;
end;

procedure TbookroomForm.RadioButton1Click(Sender: TObject);
var
    adodataset1:TAdodataset;
begin
    if radiobutton1.Checked then
    begin
          adodataset1:=TAdodataSet.Create(self);
          adodataset1.Connection:=adoconnection1;
          adodataset1.Close;
          adodataset1.Parameters.clear;
          adodataset1.Parameters.AddParameter;
          adodataset1.Parameters[0].Name:='s0';
          adodataset1.Parameters[0].DataType:=ftboolean;
          adodataset1.Parameters[0].Direction:=pdinput;
          adodataset1.Parameters[0].Value:=false;
          adodataset1.Parameters.AddParameter;
          adodataset1.Parameters[1].Name:='s1';
          adodataset1.Parameters[1].DataType:=ftboolean;
          adodataset1.Parameters[1].Direction:=pdinput;
          adodataset1.Parameters[1].Value:=true;
          adodataset1.CommandText:='select * from 客房管理 where 使用标志=:s0 and 钟点房标志=:s1';
          adodataset1.Active:=true;
          combobox1.Items.clear;
          while not adodataset1.Eof do
          begin
                combobox1.Items.add(adodataset1.fieldbyname('客房编号').asstring);
                adodataset1.next;
          end;
          if adodataset1.RecordCount=0 then
          begin
              application.MessageBox('对不起,已经没有钟点房间了!','提示信息',mb_ok);
              radiobutton1.Checked:=false;  
          end;
          adodataset1.close;
    end;
end;

procedure TbookroomForm.RadioButton2Click(Sender: TObject);
var
    adodataset1:TAdodataset;
begin
    if radiobutton2.Checked then
    begin
          adodataset1:=TAdodataSet.Create(self);
          adodataset1.Connection:=adoconnection1;
          adodataset1.Close;
          adodataset1.Parameters.clear;
          adodataset1.Parameters.AddParameter;
          adodataset1.Parameters[0].Name:='s0';
          adodataset1.Parameters[0].DataType:=ftboolean;
          adodataset1.Parameters[0].Direction:=pdinput;
          adodataset1.Parameters[0].Value:=false;
          adodataset1.CommandText:='select * from 客房管理 where 使用标志=:s0';
          adodataset1.Active:=true;
          combobox1.Items.clear;
          while not adodataset1.Eof do
          begin
                combobox1.Items.add(adodataset1.fieldbyname('客房编号').asstring);
                adodataset1.next;
          end;
          if adodataset1.RecordCount=0 then
          begin
              application.MessageBox('对不起,已经没有房间了!','提示信息',mb_ok);
              radiobutton2.Checked:=false;
          end;
          adodataset1.close;
    end;
end;

procedure TbookroomForm.Edit1Exit(Sender: TObject);
begin
    edit11.text:=DateTimeToStr(now);
end;

procedure TbookroomForm.ComboBox1Exit(Sender: TObject);
var
      adodataset1:TAdoDataset;
begin
      adodataset1:=TadoDataset.Create(self);
      adodataset1.Connection:=adoconnection1;
      adodataset1.Parameters.Clear;
      adodataset1.Parameters.AddParameter;
      adodataset1.Parameters[0].Name:='s0';
      adodataset1.Parameters[0].DataType:=ftstring;
      adodataset1.Parameters[0].Size:=6;
      adodataset1.Parameters[0].Direction:=pdinput;
      adodataset1.Parameters[0].Value:=combobox1.Items[combobox1.ItemIndex];
      adodataset1.CommandText:='select * from 客房管理 where 客房编号=:s0';
      adodataset1.Active:=true;
      edit13.Text:=IntToStr(adodataset1.fieldByname('客房单价').asinteger);
      adodataset1.Active:=false;
end;
procedure tbookroomform.savetobookroomtable;
var
      adotable1:TadoTable;
begin
      adotable1:=TAdoTable.Create(self);
      adotable1.Connection:=adoconnection1;
      adotable1.TableName:='订房数据表';
      adotable1.Open;
      adotable1.Append;
      adotable1.Edit;
      adotable1.FieldByName('订房序号').AsString:=booknumber;
      adotable1.FieldByName('客户名称').AsString:=EDIT1.TEXT;
      adotable1.FieldByName('性别').AsString:=EDIT2.TEXT;
      adotable1.FieldByName('籍贯').AsString:=EDIT3.TEXT;
      adotable1.FieldByName('出生年月').AsDATETIME:=strtodate(MASKEDIT1.TEXT);
      adotable1.FieldByName('证件名称').AsString:=EDIT4.TEXT;
      adotable1.FieldByName('证件号码').AsString:=EDIT5.TEXT;
      adotable1.FieldByName('工作单位').AsString:=EDIT6.TEXT;
      adotable1.FieldByName('通信地址').AsString:=EDIT7.TEXT;
      adotable1.FieldByName('联系方式').AsString:=EDIT8.TEXT;
      adotable1.FieldByName('钟点房').Asboolean:=radiobutton1.Checked;
      adotable1.FieldByName('源地').AsString:=EDIT9.TEXT;
      adotable1.FieldByName('目的地').AsString:=EDIT10.TEXT;
      adotable1.FieldByName('登记日期').AsDATETIME:=strtodatetime(EDIT11.TEXT);
      adotable1.FieldByName('预计天数').Asinteger:=strtoint(EDIT12.TEXT);
      adotable1.FieldByName('房间编号').AsString:=combobox1.Items[combobox1.itemindex];
      adotable1.FieldByName('住房单价').Asinteger:=strtoint(EDIT13.TEXT);
      adotable1.FieldByName('折扣率').Asfloat:=strtofloat(EDIT14.TEXT);
      adotable1.FieldByName('押金数').Asinteger:=strtoint(EDIT15.TEXT);
      adotable1.FieldByName('说明').AsString:=EDIT16.TEXT;

⌨️ 快捷键说明

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