機房收費系統 退卡

2021-08-14 20:24:10 字數 2325 閱讀 1447

做每個窗體之前最重要的是屢清思路,縷清思路的最好的方法就是畫流程圖,畫流程圖前要考慮做的窗體需要哪幾個表。退卡中,要判斷卡號是否存在肯定就用到了student表,退卡,肯定就用到了本身的退卡表,卡號需要判斷是否上機,這時就用到了on_line正在上機表,如果在上機,就要先下機在退卡。

流程圖:

**如下:

private

sub cmdok_click()

dim txtsql as

string

dim msgtext as

string

dim mrc as adodb.recordset

dim mrc1 as adodb.recordset

dim mrc2 as adodb.recordset

dim a, b, c, d, e as

string

'判斷卡號是否為空

if trim(txtcardno.text) = ""

then

msgbox "卡號為空,請重新輸入", vbexclamation, "警告"

txtcardno.setfocus

exit

subelse

'判斷卡號是否為數字

ifnot isnumeric(txtcardno.text) then

msgbox "卡號不是數字,請重新輸入!", vbexclamation, "警告"

txtcardno.text = ""

txtcardno.setfocus

endifend

if'新建查詢

txtsql = "select * from student_info where cardno = '" & trim(txtcardno.text) & "'"

set mrc = executesql(txtsql, msgtext)

'判斷卡號是否存在

if mrc.eof = true

then

msgbox "該卡號不存在,請重新輸入!", vbexclamation, "警告"

txtcardno.text = ""

txtcardno.setfocus

endif'判斷卡號是否已經退卡

'新建查詢

txtsql = "select * from online_info where cardno=' " & trim(txtcardno.text) & "' "

set mrc1 = executesql(txtsql, msgtext)

if mrc1.eof = false

then

msgbox "該卡沒有下機,請下機後退卡!", vbexclamation, "警告"

txtcardno.text = ""

txtcardno.setfocus

endif txtsql = "select * from cancelcard_info"

set mrc2 = executesql(txtsql, msgtext)

'把學生表賦值給退卡表

with mrc2

mrc2.addnew

mrc2.fields(0) = trim(mrc.fields(1))

mrc2.fields(1) = trim(mrc.fields(0))

mrc2.fields(2) = trim(mrc.fields(7))

mrc2.fields(3) = date

mrc2.fields(4) = time

mrc2.fields(5) = mrc.fields(9)

mrc2.fields(6) = mrc.fields(11)

mrc.fields(10) = "不使用"

mrc.update '更新學生表

mrc2.update '更新退卡表

endwith

a = val(mrc2.fields(1)) '卡號

b = val(mrc2.fields(2)) '應退金額

c = val(mrc2.fields(3)) '退卡日期

d = val(mrc2.fields(4)) '退卡時間

e = val(mrc2.fields(5)) '操作員

txtblackcash.text = b '顯示退卡金額

msgbox "退卡成功!", vbokonly + vbexclamation, "警告"

**部分寫的不是很完善,後期會繼續完善。

機房收費系統 退卡

具體思路如圖 如下 判斷卡號是否為空 if not testtxt txtcardno.text then msgbox 請輸入卡號 vbokonly vbexclamation,提示 txtcardno.setfocus exit sub end if 新建查詢 strsql select sta...

機房收費系統之退卡窗體

該窗體的功能 退卡,並修改有關該卡的資訊表。步驟 1,判斷該卡是否已註冊 通過在學生資訊表中查詢該卡號的資訊 若未註冊提示資訊並退出。此時不能退卡 2,判斷該卡是否正在上機 通過在上機記錄表中查詢該卡號的上機狀態 若正在上機則提示資訊 若該卡沒有上過機則不進行操作。此時不能退卡 3,若滿足條件則執行...

機房收費系統(二)之下機退卡

今天我又回顧了一下 機房管理系統,看見了我熟悉的花費了我三天才敲好的窗體 當然想了兩天 然後今天我就來總結一下下機退卡吧!第一句話是讓子窗體在父窗體中的框裡顯示!其他的然後就是定義函式名稱 然後接下來就是 呼叫函式,並計算上機時間的消費金額 接下來就是將 寫上資料庫中 寫完之後就關閉掉資料庫 整理思...