et!总金额)
Else
SUMBook=0
EndIf
Adodc1.CommandType=adCmdText
Adodc1.RecordSource="select[会员标准]from[会员政策]where[会员级别]='★☆☆☆☆'"
Adodc1.Refresh
Adodc1.Recordset.MoveFirst
BiaoZhun=CInt(Adodc1.Recordset!会员标准)
IfSUMBook>=BiaoZhunThen
Adodc1.CommandType=adCmdText
Adodc1.RecordSource="select*from[会员表]where[会员卡号]="""&HYKaHao&""""
Adodc1.Refresh
IfAdodc1.Recordset.RecordCount>0Then
Adodc1.Recordset.MoveFirst
Adodc1.Recordset!会员等级="★☆☆☆☆"
Adodc1.Recordset.Update
EndIf
EndIf
Adodc1.CommandType=adCmdText
Adodc1.RecordSource="select[会员标准]from[会员政策]where[会员级别]='★★☆☆☆'"
Adodc1.Refresh
Adodc1.Recordset.MoveFirst
BiaoZhun=CInt(Adodc1.Recordset!会员标准)
IfSUMBook>=BiaoZhunThen
Adodc1.CommandType=adCmdText
Adodc1.RecordSource="select*from[会员表]where[会员卡号]="""&HYKaHao&""""
Adodc1.Refresh
IfAdodc1.Recordset.RecordCount>0Then
Adodc1.Recordset.MoveFirst
Adodc1.Recordset!会员等级="★★☆☆☆"
Adodc1.Recordset.Update
EndIf
EndIf
Adodc1.CommandType=adCmdText
Adodc1.RecordSource="select[会员标准]from[会员政策]where[会员级别]='★★★☆☆'"
Adodc1.Refresh
Adodc1.Recordset.MoveFirst
BiaoZhun=CInt(Adodc1.Recordset!会员标准)
IfSUMBook>=BiaoZhunThen
Adodc1.CommandType=adCmdText
Adodc1.RecordSource="select*from[会员表]where[会员卡号]="""&HYKaHao&""""
Adodc1.Refresh
IfAdodc1.Recordset.RecordCount>0Then
Adodc1.Recordset.MoveFirst
Adodc1.Recordset!会员等级="★★★☆☆"
Adodc1.Recordset.Update
EndIf
EndIf
Adodc1.CommandType=adCmdText
Adodc1.RecordSource="select[会员标准]from[会员政策]where[会员级别]='★★★★☆'"
Adodc1.Refresh
Adodc1.Recordset.MoveFirst
BiaoZhun=CInt(Adodc1.Recordset!会员标准)
IfSUMBook>=BiaoZhunThen
Adodc1.CommandType=adCmdText
Adodc1.RecordSource="select*from[会员表]where[会员卡号]="""&HYKaHao&""""
Adodc1.Refresh
IfAdodc1.Recordset.RecordCount>0Then
Adodc1.Recordset.MoveFirst
Adodc1.Recordset!会员等级="★★★★☆"
Adodc1.Recordset.Update
EndIf
EndIf
Adodc1.CommandType=adCmdText
Adodc1.RecordSource="select[会员标准]from[会员政策]where[会员级别]='★★★★★'"
Adodc1.Refresh
Adodc1.Recordset.MoveFirst
BiaoZhun=CInt(Adodc1.Recordset!会员标准)
IfSUMBook>=BiaoZhunThen
Adodc1.CommandType=adCmdText
Adodc1.RecordSource="select*from[会员表]where[会员卡号]="""&HYKaHao&""""
Adodc1.Refresh
IfAdodc1.Recordset.RecordCount>0Then
Adodc1.Recordset.MoveFirst
Adodc1.Recordset!会员等级="★★★★★"
Adodc1.Recordset.Update
EndIf
EndIf
CommitTrans
HYShengJi=False
ExitFunction
errEnd:
Rollback
HYShengJi=True
Screen.MousePointer=vbDefault
MsgBox"检查会员是否应升级时操作失败!",vbOKOnly+vbExclamation,"图书销售"
CmdOK.Enabled=True
EndFunction
模块名:CmdSellBook_Click
模块原型:PrivateSubCmdSellBook_Click()
代码:
PrivateSubCmdSellBook_Click()
GoToerrEnd
DimQDAsInteger
CmdSellBook.Enabled=False
IfTxtShuLiang.Text=""Then
MsgBox"请输入交易的数量!",vbOKOnly+vbExclamation,"填写数量"
TxtShuLiang.SetFocus
CmdSellBook.Enabled=True
ExitSub
EndIf
IfGetKuCun(TuShuBianHao)<=0OrGetKuCun(TuShuBianHao)
1Then
MsgBox"实际折扣率填写错误!请在0与1之间选择.",vbOKOnly+vbExclamation,"填写折扣"
TxtZheKou.SetFocus
CmdSellBook.Enabled=True
ExitSub
EndIf
IfTxtSJJinE.Text=""Then
MsgBox"请输入交易的实际金额!",vbOKOnly+vbExclamation,"填写金额"
TxtSJJinE.SetFocus
CmdSellBook.Enabled=True
ExitSub
EndIf
IfTxtMemo.Text=""ThenTxtMemo.Text="无"
QD=MsgBox("确定入帐吗?",vbOKCancel+vbQuestion,"确认入帐")
IfQD=vbCancelThen
CmdSellBook.Enabled=True
ExitSub
EndIf
'售书入帐
Screen.MousePointer=11
BeginTrans
Adodc1.CommandType=adCmdTable
Adodc1.RecordSource="售书记录"
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset!图书编号=TuShuBianHao
Adodc1.Recordset!数量=TxtShuLiang.Text
Adodc1.Recordset!会员卡号=HuiYuanKaHao
Adodc1.Recordset!实际打折=TxtZheKou.Text
Adodc1.Recordset!实收金额=TxtSJJinE.Text
Adodc1.Recordset!日期=Year(Now)&"-"&Month(Now)&"-"&Day(Now)&"."
Adodc1.Recordset!备注=TxtMemo.Text
Adodc1.Recordset.Update
Adodc1.CommandType=adCmdText
Adodc1.RecordSource="select*from[Book]where[图书编号]="""&TuShuBianHao&""""
Adodc1.Refresh
IfAdodc1.Recordset.RecordCount>0Then
Adodc1.Recordset.MoveFirst
Adodc1.Recordset!库存量=Adodc1.Recordset!库存量-TxtShuLiang.Text
Adodc1.Recordset.Update
Else
Rollback
Screen.MousePointer=vbDefault
MsgBox"图书资料丢失,请与仓库管理员联系!",vbOKOnly+vbExclamation,"交易失败"
CmdSellBook.Enabled=True
ExitSub
EndIf
IfHYShengJi(HuiYuanKaHao)ThenRollback
CommitTrans
Screen.MousePointer=vbDefault
MsgBox"恭喜您,交易成功!",vbOKOnly+vbInformation,"交易成功"
UnloadMe
ExitSub
errEnd:
Rollback
Screen.MousePointer=vbDefault
MsgBoxErr.Description,vbOKOnly+vbExclamation,"操作数据库出错交易失败"
CmdSellBook.Enabled=True
EndSub
8.5.3系统模块详解
模块名:checkGYSID
模块原型:PublicFunctioncheckGYSID(UIDAsString)AsBoolean
代码:
PublicFunctioncheckGYSID(UIDAsString)AsBoolean
DimuserDBAsDatabase
DimuserRDAsRecordset
DimdbNameAsString
DimSTRSQLAsString
Screen.MousePointer=11
GoToerrEnd
dbName=App.Path
IfRight(dbName,1)<>"\"ThendbName=dbName+"\"
dbName=dbName+"DataBase\WFSSDataBase.mdb"
STRSQL="select[图书分类]from[图书分类]where[图书分类号]="""&UID&""""
'打开数据库
SetuserDB=DBEngine.Workspaces(0).OpenDatabase(dbName,False,True)
'检索用户,验证密码
SetuserRD=userDB.OpenRecordset(STRSQL,dbOpenSnapshot)
IfuserRD.RecordCount>0Then
'关闭数据库
userRD.Close
SetuserRD=Nothing
userDB.Close
SetuserDB=Nothing
checkGYSID=True
Screen.MousePointer=vbDefault
Else
'关闭数据库
userRD.Close
SetuserRD=Nothing
userDB.Close
SetuserDB=Nothing
Screen.MousePointer=vbDefault
checkGYSID=False
EndIf
ExitFunction
errEnd:
Screen.MousePointer=vbDefault
MsgBoxErr.Description,vbOKOnly+vbExclamation,"创建类别"
Err.Clear
'关闭数据库
userRD.Close
SetuserRD=Nothing
userDB.Close
SetuserDB=Nothing
EndFunc
上一篇:vb图书管理系统(文档+源代码)(论文和程序)
下一篇:那些令你为之触动的好句子,感慨万分