VFP客房管理系统 第5页
(1)在客房管理系统的项目中,添加一个新表单,名称为Tsjz。
(2)在表单中添加Label控件、Combo控件、Text控件、Commandgroup控件。
(3)重要控件属性如表3所示。
表3 重要控件的重要属性及值
控件名 |
属性 |
值 |
Combo1 |
RowSourceType Style |
6-字段 2-下拉列表 |
Text4 |
Format InputMask |
999999.99 |
在表单的Resize事件中添加以下代码:
store .f. to thisform.combo1.enabled,thisform.combo2.enabled,thisform.combo3.enabled,;
thisform.combo4.enabled,thisform.combo5.enabled,thisform.text2.enabled,;
thisform.text3.enabled,thisform.text6.enabled,thisform.text7.enabled,;
thisform.text9.enabled,thisform.text10.enabled,thisform.text11.enabled,;
thisform.text12.enabled,thisform.text13.enabled,thisform.text14.enabled,;
thisform.text15.enabled,thisform.text16.enabled,thisform.text17.enabled,;
thisform.text18.enabled,thisform.text19.enabled,thisform.text20.enabled,;
thisform.text21.enabled,thisform.text22.enabled,thisform.text23.enabled &&设置控件无效
在表单的Init事件中添加以下代码:
thisform.resize &&执行表单的Resize事件
thisform.combo1.enabled=.f.
thisform.gzdw.visible=.f. &&隐藏Gzdw
thisform.combo6.visible=.f.
thisform.commandgroup1.csave.enabled=.f.
thisform.commandgroup1.ccancel.enabled=.f.
thisform.commandgroup1.cadd.enabled=.t.
thisform.commandgroup1.cexit.enabled=.t.
在combo2控件的KeyPress事件中添加以下代码:
select tabkflx
if nKeyCode=13
thisform.text8.setfocus
thisform.text8.value=价格
endif
在Combo2控件的InteractiveChange事件中添加以下代码:
thisform.text8.value=tabkflx.价格
在“结帐”按钮的Click事件中添加以下代码:
store .t. to thisform.combo3.enabled,thisform.combo4.enabled,thisform.combo5.enabled,;
thisform.combo6.enabled,thisform.text9.enabled,thisform.text11.enabled,;
thisform.text13.enabled,thisform.text17.enabled,thisform.text22.enabled
store date() to thisform.text1.value,thisform.text9.value
store time() to thisform.text4.value,thisform.text11.value
thisform.text5.value=manager
store 0 to thisform.text8.value,thisform.text10.value,thisform.text16.value,;
thisform.text18.value,thisform.text19.value,thisform.text20.value,;
thisform.text22.value,thisform.text23.value
thisform.text17.value=100
store '' to thisform.text2.value,thisform.text3.value,thisform.text6.value,;
thisform.text7.value,thisform.text12.value,thisform.text13.value,thisform.text14.value,;
thisform.text15.displayvalue,thisform.text21.value,thisform.combo1.displayvalue,;
thisform.combo2.displayvalue,thisform.combo3.displayvalue,;
thisform.combo4.displayvalue,thisform.combo5.displayvalue
select *;
from roommanage!tabdjb;
where 是否结帐=.f.;
order by tabdjb.凭证号码;
into cursor lin
thisform.combo5.rowsource='lin.凭证号码' &&赋数据源
thisform.combo5.setfocus &&Combo5获得焦点
thisform.refresh &&刷新表单
thisform.commandgroup1.cadd.enabled=.f.
thisform.commandgroup1.csave.enabled=.t.
thisform.commandgroup1.ccancel.enabled=.t.
thisform.commandgroup1.cexit.enabled=.f.
单击“保存”按钮,将结帐信息保存到退房单“Tabtfd”表中,同时修改客房信息表“Tabkfinfo”中该凭证号码的记录的房态为“空闲”和登记表“Tabdjb”中该凭证号码的记录的“是否结帐”为“.T.”,并判断“结帐方式”是否为“挂帐”,如果是再将该信息保存到挂帐明细表“Tabgzmx”中。具体代码如下:
pzno=alltrim(thisform.combo5.displayvalue) &&获得输入信息
zsdate=thisform.text1.value
pznumber=alltrim(thisform.text14.value)
cname=alltrim(thisform.text2.value)
zjnumber=alltrim(thisform.text3.value)
zstime=alltrim(thisform.text4.value)
manager=alltrim(thisform.text5.value)
zsyy=alltrim(thisform.text6.value)
area=alltrim(thisform.text7.value)
price=thisform.text8.value
tfdate=thisform.text9.value
tftime=alltrim(thisform.text11.value)
zsday=thisform.text10.value
tel=alltrim(thisform.text12.value)
cmemo=alltrim(thisform.text13.value)
kflx=alltrim(thisform.combo2.displayvalue)
zjname=alltrim(thisform.combo1.displayvalue)
jkfs=alltrim(thisform.combo3.displayvalue)
fjno=alltrim(thisform.text15.displayvalue)
sjmoney=thisform.text16.value
zk=thisform.text17.value
ysmoney=thisform.text18.value
yfmoney=thisform.text19.value
jezj=thisform.text20.value
workdw=alltrim(thisform.text21.value)
thmoney=thisform.text23.value
dhf=val(thisform.dhf.caption)
zf=val(thisform.zf.caption)
hyf=val(thisform.hyf.caption)
ccf=val(thisform.ccf.caption)
pcf=val(thisform.pcf.caption)
gzdw=alltrim(thisform.combo6.value)
sfjz=.t.
cmessagetitle='退宿结帐'
cmessagetext='确定要保存吗?'
ndialogtype=4+32
nAnswer=messagebox(cmessagetext,ndialogtype,cmessagetitle)
if nAnswer=6
if empty(pznumber) &&判断证件号码是否为空
messagebox('凭证号码不能为空',48,'操作失败!')
thisform.combo5.setfocus
else
if alltrim(thisform.combo3.displayvalue)='挂帐'
if empty(gzdw)
messagebox('挂帐单位不能为空!',48,'操作失败!')
thisform.combo6.setfocus
else
select tabtfd
set order to 凭证号码
seek pznumber
insert into tabtfd values(pznumber,cname,zjname,zjnumber,area,workdw, zsyy,fjno,;
kflx,price,zsdate,zstime,zsday,sjmoney,jkfs,zk,ysmoney,zf,dhf,hyf,ccf,pcf,jezj,;
ysmoney,thmoney,tfdate,tftime,cmemo,tel,manager) &&追加新记录
update tabkfinfo set 房态='空闲' where 房间号=fjno &&更新数据表
update tabdjb set 是否结帐=.t. where 凭证号码=pzno
if thisform.combo3.displayvalue='挂帐'
zy='住宿时间:'+alltrim(dtoc(zsdate))+' 住宿天数:'+alltrim(str(zsday,8,2))
qkmoney=ysmoney-yfmoney
moneylj=qkmoney
insert into tabgzmx values(tfdate,gzdw,zy,ysmoney,qkmoney,0,moneylj,;
cname,zjname,zjnumber,pzno,tftime,kflx,price,.f.)
endif
messagebox('数据保存完毕',48,'操作成功!')
thisform.Resize &&执行表单的Resize事件
thisform.combo6.enabled=.f.
thisform.commandgroup1.cexit.enabled=.t.
thisform.commandgroup1.ccancel.enabled=.f.
thisform.commandgroup1.csave.enabled=.f.
thisform.commandgroup1.cadd.enabled=.t.
endif
else
select tabtfd
set order to 凭证号码
seek pznumber
insert into tabtfd values(pznumber,cname,zjname,zjnumber,area,workdw,zsyy, fjno,kflx,;
price,zsdate,zstime,zsday,sjmoney,jkfs,zk,ysmoney,zf,dhf,hyf,ccf,pcf,jezj,ysmoney,;
thmoney,tfdate,tftime,cmemo,tel,manager) &&追加新记录
update tabkfinfo set 房态='空闲' where 房间号=fjno &&更新数据表
update tabdjb set 是否结帐=.t. where 凭证号码=pzno
messagebox('数据保存完毕',48,'操作成功!')
thisform.resize &&执行表单的Resize事件
thisform.commandgroup1.cexit.enabled=.t.
thisform.commandgroup1.ccancel.enabled=.f.
thisform.commandgroup1.csave.enabled=.f.
thisform.commandgroup1.cadd.enabled=.t.
endif
endif
endif
thisform.refresh &&刷新表单
在“取消”按钮的Click事件中添加以下代码:
thisform.Resize &&执行表单的Resize事件
thisform.gzdw.visible=.f.
thisform.combo6.visible=.f.
thisform.refresh
thisform.commandgroup1.cadd.enabled=.t.
thisform.commandgroup1.csave.enabled=.f.
thisform.commandgroup1.ccancel.enabled=.f.
thisform.commandgroup1.cexit.enabled=.t.
在text1控件的InteractiveChange事件中添加以下代码:
sf=thisform.text1.value
yf=thisform.text4.value
thisform.text5.value=yf-sf &&求出未收金额赋给文本框text5
在text9控件的InteractiveChange事件中添加以下代码:
thisform.text10.value=thisform.text9.value-thisform.text1.value
if thisform.text10.value=0
thisform.text10.value=1
endif
thisform.text16.value=thisform.text8.value*thisform.text10.value
thisform.text20.value=thisform.text16.value+val(thisform.dhf.caption)+val(thisform.zf.caption)+;
val(thisform.hyf.caption)+val(thisform.ccf.caption)+val(thisform.pcf.caption)
thisform.text18.value=thisform.text20.value*thisform.text17.value/100
thisform.text23.value=thisform.text19.value-thisform.text18.value
在text10控件的InteractiveChange事件中添加以下代码:
thisform.text16.value=thisform.text10.value*thisform.text8.value
根据用户选择的“结帐方式”自动计算应收宿费。如果选择的是“挂帐”将要求用户输入挂帐单位。
在combo3控件的InteractiveChange事件中添加以下代码:
zk=thisform.text17.value
sjxf=thisform.text16.value
do case
case thisform.combo3.displayvalue='招待'
thisform.text17.enabled=.f.
thisform.text19.enabled=.f.
thisform.gzdw.visible=.f.
thisform.combo6.visible=.f.
thisform.text17.value=0
thisform.text18.value=0
case thisform.combo3.displayvalue='折扣'
thisform.text17.enabled=.t.
thisform.text19.enabled=.t.
thisform.gzdw.visible=.f.
thisform.combo6.visible=.f. &&显示Combo6控件
thisform.text18.value=thisform.text20.value*thisform.text17.value/100
thisform.text23.value=thisform.text19.value-thisform.text18.value
case thisform.combo3.displayvalue='挂帐'
thisform.text17.enabled=.f.
thisform.text17.value=100
thisform.text18.value=thisform.text20.value
thisform.gzdw.visible=.t.
thisform.combo6.visible=.t.
select tabgzdwinfo &&选择Tabgzdwinfo工作区为当前工作区
thisform.combo6.rowsource='tabgzdwinfo.单位全称' &&赋数据源
endcase
在text17控件的InteractiveChange事件中添加以下代码:
sjxf=thisform.text16.value
zk=thisform.text17.value
thisform.text18.value=thisform.text20.value*thisform.text17.value/100
thisform.text23.value=thisform.text19.value-thisform.text18.value
在Text22控件的InteractiveChange事件中添加以下代码:
do case
case thisform.combo4.displayvalue='电话费'
thisform.dhf.caption=alltrim(str(thisform.text22.value,8,2))
case thisform.combo4.displayvalue='杂费'
thisform.zf.caption=alltrim(str(thisform.text22.value,8,2))
case thisform.combo4.displayvalue='会议费'
thisform.hyf.caption=alltrim(str(thisform.text22.value,8,2))
case thisform.combo4.displayvalue='存车费'
thisform.ccf.caption=alltrim(str(thisform.text22.value,8,2))
case thisform.combo4.displayvalue='赔偿费'
thisform.pcf.caption=alltrim(str(thisform.text22.value,8,2))
endcase
thisform.text20.value=thisform.text16.value+val(thisform.dhf.caption)+val(thisform.zf.caption)+;
val(thisform.ccf.caption)+val(thisform.hyf.caption)+val(thisform.pcf.caption)
thisform.text18.value=thisform.text20.value*thisform.text17.value/100
thisform.text23.value=thisform.text19.value-thisform.text18.value
在text20控件的InteractiveChange事件中添加以下代码:
thisform.text18.value=thisform.text20.value*thisform.text17.value/100
在combo4控件的InteractiveChange事件中添加以下代码:
thisform.text22.value=0
在combo5控件的InteractiveChange事件中添加以下代码:
pzno=alltrim(thisform.combo5.displayvalue)
thisform.text14.value=alltrim('T'+pzno)
select * from roommanage!tabdjb where 凭证号码=pzno order by tabdjb.凭证号码;
into cursor lindeping
thisform.combo1.displayvalue=lindeping.证件名称 &&赋值给Combo1等
thisform.combo2.displayvalue=lindeping.客房类型
thisform.combo3.displayvalue=lindeping.结款方式
thisform.text2.value=lindeping.姓名
thisform.text3.value=lindeping.证件号码
thisform.text1.value=lindeping.住宿日期
thisform.text4.value=lindeping.住宿时间
thisform.text6.value=lindeping.住宿原由
thisform.text7.value=lindeping.详细地址
thisform.text8.value=lindeping.房间价格
thisform.text9.value=date()
thisform.text11.value=time()
thisform.text10.value=thisform.text9.value-thisform.text1.value
if thisform.text10.value=0
thisform.text10.value=1
endif
thisform.text12.value=lindeping.联系电话
thisform.text13.value=lindeping.备注
thisform.text15.displayvalue=lindeping.房间号
thisform.text16.value=thisform.text8.value*thisform.text10.value
thisform.text17.value=lindeping.折扣
thisform.text19.value=lindeping.预付金额
thisform.text20.value=thisform.text16.value+val(thisform.dhf.caption)+val(thisform.zf.caption)+;
val(thisform.hyf.caption)+val(thisform.ccf.caption)+val(thisform.pcf.caption)
thisform.text21.value=lindeping.工作单位
thisform.text22.value=0
thisform.text18.value=thisform.text20.value*thisform.text17.value/100
thisform.text23.value=thisform.text19.value-thisform.text18.value
if thisform.combo3.displayvalue='挂帐'
thisform.gzdw.visible=.t.
thisform.combo6.visible=.t.
select tabgzdwinfo
thisform.combo6.rowsource='tabgzdwinfo.单位全称' &&赋数据源
endif
用户进入系统后,单击主菜单查询统计下的住宿查询子菜单选项,进入住宿查询界面,住宿查询界面主要提供了四种不同类型的查询方式。住宿查询表单运行结果如图6所示。
上一页 [1] [2] [3] [4] [5] [6] [7] 下一页