退卡问题
???? 雖然在寫代價時犯過很多邏輯錯誤,出現了很多漏洞,但是改了幾次,都基本找出來了,但是對于退卡問題,我是真心傷了。。。。。。。。
????? 一,退過卡的人,不能再次上機。
????? 二, 每人只能退卡一次。
????? 三,退卡人員的記錄不能刪除,要保留,但是在注冊新用戶時,不能用退卡人員的主鍵。
????? 四,退卡的金額:什么都不寫,默認全部退還。
????? 五,退過卡的人不能再次充值。
??????
If Trim(txtCardNum.Text) = "" Then '卡號為空的情況MsgBox "卡號不能為空,請輸入卡號!", vbOKOnly + vbExclamation, "警告"txtReturnRmb.Text = ""Exit SubEnd If'先判斷該學生是否存在SQL = "select * from stubaseinfo where 卡號='" & Trim(txtCardNum.Text) & "' and 狀態='使用'"Set Rst = ExecuteSQL(SQL, strMsg)If Rst.BOF And Rst.EOF Then '如果數據表中沒有記錄,則顯示查無此卡的警告!MsgBox "此卡不存在!", vbOKOnly + vbExclamation, "警告"txtCardNum.Text = ""txtReturnRmb.Text = ""txtCardNum.SetFocusExit SubEnd IfIf Rst.EOF Then '如果數據表中有記錄,但是查找不到該卡號MsgBox "此卡不存在!請重新檢查后輸入!", vbOKOnly + vbInformation, "提示"txtCardNum.Text = ""txtCardNum.SetFocusExit SubElse'如果查找到該卡'退卡錢先判斷用戶是否在上機SQL = "select * from stuonline where 卡號='" & Trim(txtCardNum.Text) & "'"Set mrc = ExecuteSQL(SQL, strMsg)If Not (mrc.EOF And mrc.BOF) ThenMsgBox "該用戶正在上機,請稍后退卡!", vbOKOnly + vbInformation, "提示"txtCardNum.Text = ""txtReturnRmb.Text = ""Exit SubEnd If'如果沒有上機lastRMB = Rst.Fields(9) '退卡錢金額的賦值'如果沒有填寫退卡的金額,則默認為全部退還If Trim(txtReturnRmb.Text) = "" ThentxtReturnRmb.Text = lastRMBEnd IfnowRMB = lastRMB - Val(Trim(txtReturnRmb.Text)) '計算退卡后卡里的錢SQL = "update stubaseinfo set 金額='" & nowRMB & "',狀態='不使用'" & " " & "where 卡號='" & Trim(txtCardNum.Text) & "'" '注意where前面一定要有個空格Call ExecuteSQL(SQL, strMsg) '執行更新操作listMsg.AddItem "退卡卡號:" & Trim(txtCardNum.Text)listMsg.AddItem "應退款金額:" & Trim(txtReturnRmb.Text)listMsg.AddItem "退卡日期:" & Format(GetSqlTime, "yyyy-mm-dd")listMsg.AddItem "退卡時間:" & Format(GetSqlTime, "hh:mm:ss")listMsg.AddItem "辦理退卡教師:" & strUserName'寫入退卡表里面SQL = "insert into teareturncard values('" & Trim(txtCardNum.Text) & "','" & Trim(txtReturnRmb.Text) & "','" & strUserName & "','" & Format(GetSqlTime, "yyyy-mm-dd") & "','" & Format(GetSqlTime, "hh:mm:ss") & "','未結賬')"Call ExecuteSQL(SQL, strMsg)'提示退卡成功,并清空文本框If (MsgBox("退卡成功!退卡金額" & Trim(txtReturnRmb.Text), vbOKOnly + vbInformation, "提示")) ThentxtCardNum.Text = ""txtReturnRmb.Text = ""listMsg.ClearExit SubEnd IfEnd If?????
總結
- 上一篇: IOM计算机组成原理,计算机组成原理设计
- 下一篇: 生成树协议中的五种状态Spanning