📄 bookroom.~pas
字号:
adotable1.FieldByName('其他费用').Asinteger:=strtoint(edit17.text);
adotable1.FieldByName('操作员').AsString:=username;
adotable1.FieldByName('操作日期').Asdatetime:=date;
adotable1.post;
adotable1.close;
end;
procedure tbookroomform.savetobookroomhistorytable;
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;
adotable1.FieldByName('其他费用').Asinteger:=strtoint(edit17.text);
adotable1.FieldByName('操作员').AsString:=username;
adotable1.FieldByName('操作日期').Asdatetime:=date;
adotable1.post;
adotable1.close;
end;
procedure tbookroomform.makebooknumber;
var
adotable1:tadotable;
oldnumber:string;
s1,s2,s3:string;
year,month,day,t:integer;
begin
year:=yearof(now);
month:=monthof(now);
day:=dayof(now);
s1:=inttostr(year);
if month<10 then
s1:=s1+'0'+inttostr(month)
else
s1:=s1+inttostr(month);
if day<10 then
s1:=s1+'0'+inttostr(day)
else
s1:=s1+inttostr(day);
adotable1:=TAdoTable.Create(self);
adotable1.Connection:=adoconnection1;
adotable1.TableName:='订房数据历史表';
adotable1.Open;
if not adotable1.eof then
begin
adotable1.Last;
oldnumber:=adotable1.fieldByname('订房序号').asstring;
s2:=copy(oldnumber,1,8);
if s1=s2 then
begin
s2:=copy(oldnumber,9,12);
t:=strtoint(s2);
t:=t+1;
if t<10 then
s3:='000'+inttostr(t)
else if t<100 then
s3:='00'+inttostr(t)
else if t<1000 then
s3:='0'+inttostr(t)
else
s3:=inttostr(t);
end
else
s3:='0001';
end
else
s3:='0001';
adotable1.Close;
booknumber:=s1+s3;
end;
procedure TbookroomForm.BitBtn2Click(Sender: TObject);
var
adodataset1:Tadodataset;
begin
if (not (radiobutton1.Checked or radiobutton2.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;
adodataset1.FieldByName('使用标志').asboolean:=true;
adodataset1.post;
adodataset1.Active:=false;
makebooknumber;
savetobookroomtable;
savetobookroomhistorytable;
savezjqstable;
savetozjqslstable;
savetodtsztable;
savetoszlstable;
while application.MessageBox('是否打印订房单(Yes/No)','提示信息',mb_yesno)=IDYes do
printbook;
bitbtn2.Enabled:=false;
end;
end;
procedure TBookRoomForm.printbook;
begin
bookroomprnform.QRLabel3.caption:=edit1.text;
bookroomprnform.QRLabel5.caption:=edit2.text;
bookroomprnform.QRLabel7.caption:=edit3.text;
bookroomprnform.QRLabel9.caption:=maskedit1.text;
bookroomprnform.QRLabel11.caption:=edit4.text;
bookroomprnform.QRLabel13.caption:=edit5.text;
bookroomprnform.QRLabel15.caption:=edit6.text;
bookroomprnform.QRLabel17.caption:=edit8.text;
bookroomprnform.QRLabel19.caption:=edit11.text;
bookroomprnform.QRLabel21.caption:=edit12.text;
bookroomprnform.QRLabel23.caption:=combobox1.Items[combobox1.itemindex];
bookroomprnform.QRLabel25.caption:=edit13.text;
bookroomprnform.QRLabel27.caption:=edit14.text;
bookroomprnform.QRLabel29.caption:=edit15.text;
bookroomprnform.QRLabel31.caption:=edit17.text;
bookroomprnform.QRLabel33.caption:=edit16.text;
if radiobutton1.checked then
bookroomprnform.QRLabel41.caption:='钟点房'
else
bookroomprnform.QRLabel41.caption:='正常住宿';
bookroomprnform.QRLabel39.caption:=username;
bookroomprnform.QRLabel35.caption:=booknumber;
bookroomprnform.QRLabel37.caption:=datetostr(date());
bookroomprnform.QuickRep1.Preview;
end;
procedure TbookroomForm.BitBtn3Click(Sender: TObject);
begin
initiate;
edit1.setfocus;
bitbtn2.Enabled:=true;
end;
procedure TBookRoomForm.savezjqstable;
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:=combobox1.Items[combobox1.itemindex];
adotable1.FieldByName('客人名称').asstring:=edit1.text;
adotable1.FieldByName('证件编号').asstring:=edit5.text;
adotable1.FieldByName('押金').AsCurrency:=strtoint(edit15.text);
adotable1.FieldByName('预计每天费用').ascurrency:=strtoint(edit13.text)*strtofloat(edit14.text);
adotable1.FieldByName('预计天数').asinteger:=strtoint(edit12.text);
adotable1.FieldByName('事由').asstring:='交住房押金';
adotable1.fieldbyname('订房日期').asdatetime:=strtodatetime(edit11.text);
adotable1.fieldbyname('操作人').asstring:=username;
adotable1.post;
adotable1.close;
end;
procedure TBookRoomForm.savetozjqslstable;
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:=combobox1.Items[combobox1.itemindex];
adotable1.FieldByName('客人名称').asstring:=edit1.text;
adotable1.FieldByName('证件编号').asstring:=edit5.text;
adotable1.FieldByName('押金').AsCurrency:=strtoint(edit15.text);
adotable1.FieldByName('预计每天费用').ascurrency:=strtoint(edit13.text)*strtofloat(edit14.text);
adotable1.FieldByName('预计天数').asinteger:=strtoint(edit12.text);
adotable1.FieldByName('事由').asstring:='交住房押金';
adotable1.fieldbyname('订房日期').asdatetime:=strtodatetime(edit11.text);
adotable1.fieldbyname('操作人').asstring:=username;
adotable1.fieldbyname('打印发票').asboolean:=false;
adotable1.post;
adotable1.close;
end;
procedure TBookRoomForm.savetodtsztable;
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:=combobox1.Items[combobox1.itemindex];
adotable1.FieldByName('客人名称').asstring:=edit1.text;
adotable1.FieldByName('证件编号').asstring:=edit5.text;
adotable1.FieldByName('实收金额').AsCurrency:=strtoint(edit15.text);
adotable1.FieldByName('说明').asstring:='交住房押金';
adotable1.fieldbyname('日期').asdatetime:=strtodatetime(edit11.text);
adotable1.fieldbyname('操作人').asstring:=username;
adotable1.post;
adotable1.close;
end;
procedure tBookroomForm.savetoszlstable;
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:=combobox1.Items[combobox1.itemindex];
adotable1.FieldByName('客人名称').asstring:=edit1.text;
adotable1.FieldByName('证件编号').asstring:=edit5.text;
adotable1.FieldByName('实收金额').AsCurrency:=strtoint(edit15.text);
adotable1.FieldByName('说明').asstring:='交住房押金';
adotable1.fieldbyname('日期').asdatetime:=strtodatetime(edit11.text);
adotable1.fieldbyname('操作人').asstring:=username;
adotable1.post;
adotable1.close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -