📄 unit8.~pas
字号:
adotable1.fieldbyname('订房日期').asdatetime:=strtodatetime(edit11.text);
adotable1.fieldbyname('操作人').asstring:=denglu.usename;
adotable1.post;
adotable1.close;
end;}
procedure Tbookroom.BitBtn1Click(Sender: TObject);
begin
roomfind.showmodal;
end;
procedure Tbookroom.BitBtn2Click(Sender: TObject);
var
adodataset1:Tadodataset;
begin
maskedit1.Text:=datetostr(datetimepicker1.Date);
if trim(edit1.Text)='' then
begin
Application.MessageBox('客户名称不能为空!','提示信息',mb_ok);
edit1.SetFocus;
exit;
end;
if trim(edit2.Text)='' then
begin
Application.MessageBox('性别不能为空!','提示信息',mb_ok);
edit2.SetFocus;
exit;
end;
if trim(edit3.Text)='' then
begin
Application.MessageBox('籍贯不能为空!','提示信息',mb_ok);
edit3.SetFocus;
exit;
end;
if trim(edit4.Text)='' then
begin
Application.MessageBox('证件名称不能为空!','提示信息',mb_ok);
edit4.SetFocus;
exit;
end;
if trim(edit5.Text)='' then
begin
Application.MessageBox('证件号码不能为空!','提示信息',mb_ok);
edit5.SetFocus;
exit;
end;
if trim(edit6.Text)='' then
begin
Application.MessageBox('工作单位不能为空!','提示信息',mb_ok);
edit6.SetFocus;
exit;
end;
if trim(edit7.Text)='' then
begin
Application.MessageBox('通信地址不能为空!','提示信息',mb_ok);
edit7.SetFocus;
exit;
end;
if trim(edit8.Text)='' then
begin
Application.MessageBox('联系方式不能为空!','提示信息',mb_ok);
edit8.SetFocus;
exit;
end;
if trim(edit9.Text)='' then
begin
Application.MessageBox('源地不能为空!','提示信息',mb_ok);
edit9.SetFocus;
exit;
end;
if trim(edit10.Text)='' then
begin
Application.MessageBox('目的地不能为空!','提示信息',mb_ok);
edit10.SetFocus;
exit;
end;
if trim(edit12.Text)='' then
begin
Application.MessageBox('预计天数不能为空!','提示信息',mb_ok);
edit12.SetFocus;
exit;
end;
if trim(edit14.Text)='' then
begin
Application.MessageBox('折扣率不能为空!','提示信息',mb_ok);
edit14.SetFocus;
exit;
end;
if trim(edit15.Text)='' then
begin
Application.MessageBox('交纳押金不能为空!','提示信息',mb_ok);
edit15.SetFocus;
exit;
end;
if trim(edit17.Text)='' then
begin
Application.MessageBox('其他费用不能为空!','提示信息',mb_ok);
edit17.SetFocus;
exit;
end;
if (not (radiobutton1.Checked or radiobutton2.Checked or radiobutton3.Checked)) then
application.messagebox('没有选择住房类型,请重新选择!','提示信息',mb_ok)
else
begin
adodataset1:=tadodataset.Create(self);
adodataset1.Connection:=adoconnection1;
adodataset1.Parameters.Clear;
adodataset1.Parameters.add;
adodataset1.Parameters[0].name:='s0';
adodataset1.Parameters[0].DataType:=ftstring;
adodataset1.Parameters[0].Size:=6;
adodataset1.Parameters[0].Value:=combobox1.Items[combobox1.ItemIndex];
adodataset1.CommandText:='select * from 客房管理 where 客房编号=:s0';
adodataset1.Active:=true;
adodataset1.Edit;
if ((radiobutton1.Checked=true) or (radiobutton2.Checked=true)) then
adodataset1.FieldByName('使用标志').asboolean:=true;
if radiobutton3.Checked=true then
adodataset1.FieldByName('保留标志').asboolean:=true;
adodataset1.post;
adodataset1.Close;
// adodataset1.Active:=false;
makebooknumber;
savetobookroomtable;
savetobookroomhistorytable;
// savezjqstable;
// savetozjqslstable;
savetodtsztable;
savetoszlstable;
bitbtn2.Enabled:=false;
bitbtn3.Enabled:=true;
application.messagebox('订房成功!','提示信息',mb_ok);
while application.MessageBox('是否打印订房单(是/否)','提示信息',mb_yesno)=IDYes do
bookprint;
end;
end;
procedure Tbookroom.BitBtn3Click(Sender: TObject);
begin
initiate;
edit1.setfocus;
bitbtn2.Enabled:=true;
bitbtn3.Enabled:=false;
end;
procedure Tbookroom.BitBtn4Click(Sender: TObject);
begin
initiate;
bitbtn2.Enabled:=true;
bitbtn3.Enabled:=false;
close;
end;
procedure Tbookroom.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.Close;
//adodataset1.Active:=false;
end;
//procedure Tbookroom.Edit11Exit(Sender: TObject);
//begin
//edit11.text:=DateTimeToStr(now);
//end;
procedure Tbookroom.FormActivate(Sender: TObject);
begin
initiate;
datetimepicker1.Date:=now;
edit1.SetFocus;
edit11.Enabled:=false;
edit13.Enabled:=false;
end;
procedure Tbookroom.RadioButton1Click(Sender: TObject);
var
adodataset1:TAdodataset;
begin
combobox1.Text:='';
if radiobutton1.Checked=true 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.Parameters.AddParameter;
adodataset1.Parameters[2].Name:='s2';
adodataset1.Parameters[2].DataType:=ftboolean;
adodataset1.Parameters[2].Direction:=pdinput;
adodataset1.Parameters[2].Value:=false;
adodataset1.CommandText:='select * from 客房管理 where 使用标志=:s0 and 钟点房标志=:s1 and 保留标志=:s2';
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 Tbookroom.RadioButton2Click(Sender: TObject);
var
adodataset1:TAdodataset;
begin
combobox1.Text:='';
if radiobutton2.Checked=true 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:=false;
adodataset1.Parameters.AddParameter;
adodataset1.Parameters[2].Name:='s2';
adodataset1.Parameters[2].DataType:=ftboolean;
adodataset1.Parameters[2].Direction:=pdinput;
adodataset1.Parameters[2].Value:=false;
adodataset1.CommandText:='select * from 客房管理 where 使用标志=:s0 and 保留标志=:s1 and 钟点房标志=:s2';
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 Tbookroom.RadioButton3Click(Sender: TObject);
var
adodataset1:TAdodataset;
begin
combobox1.Text:='';
if radiobutton3.Checked=true 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:=false;
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);
radiobutton3.Checked:=false;
end;
adodataset1.close;
end;
end;
procedure Tbookroom.Edit1Exit(Sender: TObject);
begin
edit11.text:=DatetimeToStr(now);
end;
//procedure Tbookroom.BitBtn5Click(Sender: TObject);
//begin
//brprintform.QRLabel3.Caption:=edit1.Text;
//brprintform.QuickRep1.Preview;
//end;
procedure Tbookroom.Edit12Change(Sender: TObject);
var
new,old:string;
len:integer;
begin
if edit12.Text<>'' then
begin
old:=edit12.Text;
len:=length(old);
new:=copy(old,len,1);
if ((new<'0') or (new>'9')) then
begin
showmessage('您输入了无效的值!');
delete(old,len,1);
edit12.Text:='';
exit;
end;
end;
end;
procedure Tbookroom.Edit15Change(Sender: TObject);
var
xx,yy:string;
len:integer;
begin
if edit15.Text<>'' then
begin
xx:=edit15.Text;
len:=length(xx);
yy:=copy(xx,len,1);
if (yy<'0') or (yy>'9') then
begin
showmessage('您输入的'+yy+'不是有效的值!');
delete(xx,len,1);
edit15.Text:=trim(xx);
exit;
end;
end;
end;
procedure Tbookroom.Edit17Change(Sender: TObject);
var
xx,yy:string;
len:integer;
begin
if edit17.Text<>'' then
begin
xx:=edit17.Text;
len:=length(xx);
yy:=copy(xx,len,1);
if (yy<'0') or (yy>'9') then
begin
showmessage('您输入了无效的值!');
//delete(xx,len,1);
edit17.Text:=trim(xx);
exit;
end;
end;
end;
procedure Tbookroom.Edit14Change(Sender: TObject);
var
xx,yy:string;
len:integer;
begin
if edit14.Text<>'' then
begin
xx:=edit14.Text;
len:=length(xx);
yy:=copy(xx,len,1);
if yy<>'.'then
begin
if (yy<'0') or (yy>'9') then
begin
showmessage('您输入了无效的值!');
delete(xx,len,1);
edit14.Text:='';
edit14.SetFocus;
exit;
end;
end;
end;
end;
procedure Tbookroom.Edit14Exit(Sender: TObject);
var
number:integer;
begin
number:=strtoint(edit14.Text);
if (number<0) or (number>100) then
begin
showmessage('您输入的折扣率有误请重新输入');
edit14.Text:='';
//edit14.SetFocus;
exit;
end;
end;
procedure Tbookroom.RadioButton4Click(Sender: TObject);
begin
if radiobutton4.Checked=true then
edit2.Text:='男';
end;
procedure Tbookroom.RadioButton5Click(Sender: TObject);
begin
if radiobutton5.Checked=true then
edit2.Text:='女';
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -