📄 frm_yd1.frm
字号:
' frm_main.msglist.row = crrow
' frm_main.msglist.TopRow = tcrrow
Unload Me
'SSTab1_Click (0)
End Sub
Private Sub Command2_Click()
'Dim myscratchds As Recordset
Dim myscratchds As ADODB.Recordset
sql$ = "select roomyd_num,daima,time_yd,name,tell1,tell2 from room_yd where"
If chk_yd.Value = 1 Then
sql$ = sql$ & " flag_yd=true and "
End If
sql$ = sql$ & " time_yd>=#" & txt_starttime(2).Value & "#"
sql$ = sql$ & " and time_yd<=#" & txt_starttime(3).Value & "#"
sql$ = sql$ & " order by roomyd_num"
' Set myscratchds = myDB.OpenRecordset(sql$, dbOpenSnapshot)
Set myscratchds = ExecuteSQL(sql$, msgtext)
If myscratchds.EOF Then
MsgBox "当前无预定信息打印呀!", vbOKOnly, "提示"
Exit Sub
End If
print_x = 0
printdocument Printer, myscratchds
Printer.EndDoc
End Sub
Private Sub Command5_Click()
Unload Me
End Sub
Private Sub Command6_Click()
Dim yesno As Integer
Dim temp As ADODB.Recordset
yesno = MsgBox("确实要删除!", vbYesNo + vbQuestion, "删除")
If yesno = 6 Then
sql$ = "delete from room_yd where "
sql$ = sql$ & " time_yd>=#" & txt_starttime(2).Value & "#"
sql$ = sql$ & " and time_yd<=#" & txt_starttime(3).Value & "#"
' myDB.Execute sql$
Set temp = ExecuteSQL(sql$, msgtext)
End If
End Sub
Private Sub Command9_Click()
Unload Me
End Sub
Private Sub num_find_Click()
'Dim mytemp As Recordset
Dim mytemp As ADODB.Recordset
If IsNumeric(Txt_find) Then
sql$ = "select * from room_yd where roomyd_num=" & Txt_find
' Set mytemp = myDB.OpenRecordset(sql$, dbOpenSnapshot)
Set mytemp = ExecuteSQL(sql$, msgtext)
If mytemp.EOF Then
MsgBox "没有找到!!!", vbOKOnly, "提示"
Else
recordtoscreen mytemp
End If
Else
MsgBox "请输入数字", vbOKOnly, "提示"
End If
End Sub
Private Sub Command3_Click()
'Dim mytemp As Recordset
Dim mytemp As ADODB.Recordset
sql$ = "select * from room_yd where roomyd_num=" & lab_no - 1
' Set mytemp = myDB.OpenRecordset(sql$, dbOpenSnapshot)
Set mytemp = ExecuteSQL(sql$, msgtext)
If mytemp.EOF Then
MsgBox "已经到了最前面啦!!!", vbOKOnly, "提示"
Exit Sub
Else
recordtoscreen mytemp
End If
End Sub
Private Sub Command4_Click()
SSTab1_Click (1)
End Sub
Private Sub Command7_Click()
'Dim mytemp As Recordset
Dim mytemp As ADODB.Recordset
sql$ = "select * from room_yd where roomyd_num=" & lab_no + 1
' Set mytemp = myDB.OpenRecordset(sql$, dbOpenSnapshot)
Set mytemp = ExecuteSQL(sql$, msgtext)
If mytemp.EOF Then
MsgBox "已经到最后啦!", vbOKOnly, "提示"
Exit Sub
Else
recordtoscreen mytemp
End If
End Sub
Private Sub Command8_Click()
'Dim mytemp As Recordset
Dim yesorno As Integer
Dim mytemp As ADODB.Recordset
sql$ = "select * from room_yd where roomyd_num=" & Val(lab_no)
' Set mytemp = myDB.OpenRecordset(sql$, dbOpenDynaset)
Set mytemp = ExecuteSQL(sql$, msgtext)
If mytemp.EOF Then
init_frm
Else
yesorno = MsgBox("当前预定未保存", vbYesNoCancel, "提示")
Select Case yesorno
Case 6
screentorecord mytemp, True
init_frm
Case 7
init_frm
Case 2
Exit Sub
End Select
End If
End Sub
Private Sub Form_Activate()
txt_starttime(2).Value = Format(Now, "yyyy-MM-dd 12:00:00")
txt_starttime(3).Value = Format(Now + 1, "yyyy-MM-dd 3:00:00")
init_frm
init_grid
End Sub
Public Sub init_frm()
' Dim mytemp As Recordset
Dim yd_no As Integer
Dim mytemp As ADODB.Recordset
sql$ = "select room_number from roominfo order by room_number"
' Set mytemp = myDB.OpenRecordset(sql$, dbOpenSnapshot)
Set mytemp = ExecuteSQL(sql$, msgtext)
yd_cmb.Clear
If mytemp.EOF = -1 Then Exit Sub
Do Until mytemp.EOF
yd_cmb.AddItem "" & mytemp!room_number
mytemp.MoveNext
Loop
yd_name.text = ""
yd_tell1.text = ""
yd_tell2.text = ""
yd_number.text = ""
yd_note.text = ""
Txt_find = ""
yd_flag.Value = 1
yd_time.Value = Format(Now, "yyyy-MM-dd HH:mm:00")
sql$ = "select * from counterid where tablename='room_yd'"
' Set mytemp = myDB.OpenRecordset(sql$, dbOpenSnapshot)
Set mytemp = ExecuteSQL(sql$, msgtext)
yd_no = mytemp!CountNum
lab_no.Caption = yd_no
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
'Dim mytemp As Recordset
Dim mytemp As ADODB.Recordset
Select Case SSTab1.Tab
Case 0
Case 1
sql$ = "select * from room_yd where"
If chk_yd.Value = 1 Then
sql$ = sql$ & " flag_yd=true and "
End If
sql$ = sql$ & " time_yd>=#" & txt_starttime(2).Value & "#"
sql$ = sql$ & " and time_yd<=#" & txt_starttime(3).Value & "#"
sql$ = sql$ & " order by roomyd_num"
' Set mytemp = myDB.OpenRecordset(sql$, dbOpenSnapshot)
Set mytemp = ExecuteSQL(sql$, msgtext)
recordtogrid mytemp
End Select
End Sub
Private Sub Txt_find_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
num_find_Click
End If
End Sub
Private Sub yd_cmb_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
yd_name.SetFocus
End If
End Sub
Private Sub yd_name_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
yd_time.SetFocus
'yd_tell1.SetFocus
End If
End Sub
Private Sub yd_tell1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
yd_tell2.SetFocus
End If
End Sub
Private Sub yd_tell2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
yd_number.SetFocus
End If
End Sub
Public Sub recordtoscreen(temps As Object)
lab_no.Caption = temps!roomyd_num
yd_cmb = " " & temps!daima
yd_time = " " & temps!time_yd
yd_name = "" & temps!Name
yd_tell1 = "" & temps!tell1
yd_tell2 = "" & temps!tell2
yd_number = "" & temps!Number
yd_note = "" & temps!note
If temps!flag_yd = False Then
yd_flag.Value = 0
Else
yd_flag.Value = 1
End If
End Sub
Public Sub screentorecord(temps As Object, aore As Boolean)
If aore = False Then
' temps.Edit
' Else
temps.AddNew
End If
temps!roomyd_num = lab_no.Caption
temps!daima = Trim(yd_cmb)
temps!time_yd = Format(yd_time.Value, "yyyy-MM-dd hh:mm:ss")
temps!Name = yd_name
temps!tell1 = yd_tell1
temps!tell2 = yd_tell2
temps!Number = yd_number
temps!note = yd_note
temps!flag_yd = yd_flag.Value
temps.Update
End Sub
Public Sub init_grid()
Dim tempwidth As Integer
grd_Main.Cols = 9
grd_Main.row = 0
grd_Main.col = 0
'set column titles
grd_Main.colWidth(0) = 600
grd_Main.text = "编号"
grd_Main.col = 1
grd_Main.colWidth(1) = 700
grd_Main.text = "房号"
grd_Main.col = 2
grd_Main.colWidth(2) = 600
grd_Main.text = "状态"
grd_Main.col = 3
grd_Main.colWidth(3) = 1700
grd_Main.text = "客户名称"
grd_Main.col = 4
grd_Main.colWidth(4) = 1900
grd_Main.text = "预定时间"
grd_Main.col = 5
grd_Main.colWidth(5) = 1600
grd_Main.text = "联系电话1"
grd_Main.col = 6
grd_Main.colWidth(6) = 1600
grd_Main.text = "联系电话2"
grd_Main.col = 7
grd_Main.colWidth(7) = 600
grd_Main.text = "人数"
grd_Main.col = 8
grd_Main.colWidth(8) = 1600
grd_Main.text = "备注"
grd_Main.FixedRows = 1
grd_Main.FixedCols = 0
tempwidth = 0
For i = 0 To grd_Main.Cols - 1
tempwidth = tempwidth + grd_Main.colWidth(i)
Next i
grd_Main.width = tempwidth + 200
End Sub
Public Sub recordtogrid(temps As Object)
Dim i As Integer
i = 1
grd_Main.rows = 2
Do Until temps.EOF
grd_Main.rows = grd_Main.rows + 1
grd_Main.row = i
grd_Main.col = 0
grd_Main.text = "" & temps!roomyd_num
grd_Main.col = 1
grd_Main.text = "" & temps!daima
grd_Main.col = 2
grd_Main.text = "" & temps!flag_yd
grd_Main.col = 3
grd_Main.text = "" & temps!Name
grd_Main.col = 4
grd_Main.text = "" & temps!time_yd
grd_Main.col = 5
grd_Main.text = "" & temps!tell1
grd_Main.col = 6
grd_Main.text = "" & temps!tell2
grd_Main.col = 7
grd_Main.text = "" & temps!Number
grd_Main.col = 8
grd_Main.text = "" & temps!note
i = i + 1
temps.MoveNext
Loop
End Sub
Private Sub printdocument(obj As Object, mybank As Object)
Dim xu_x As Single
Dim texttxt As String
Dim xu_y As Single
Dim totalfinalprint As Double
Dim totalcountprint As Double
xu_y = print_y
obj.Font.Bold = False
obj.Font.Italic = False
obj.Font.Name = "arial"
obj.Font.Strikethrough = False
obj.Font.Underline = False
obj.Font.Size = 12
texttxt = Trim(print_title) & "包厢预定信息"
printstring obj, texttxt, 800 + xu_y, xu_x, 0, 300, 7200, 0, 0, 0, 0
print_x = print_x + 300
xu_x = print_x
texttxt = "编号"
printstring obj, texttxt, 500 + xu_y, xu_x, 0, 300, 7200, 0, 0, 0, 0
texttxt = "房号"
printstring obj, texttxt, 1200 + xu_y, xu_x, 0, 300, 7200, 0, 0, 0, 0
texttxt = "客户名称"
printstring obj, texttxt, 2100 + xu_y, xu_x, 0, 300, 7200, 0, 0, 0, 0
texttxt = "预定时间"
printstring obj, texttxt, 3300 + xu_y, xu_x, 0, 300, 7200, 0, 0, 0, 0
texttxt = "联系电话1"
printstring obj, texttxt, 4300 + xu_y, xu_x, 0, 300, 7200, 0, 0, 0, 0
texttxt = "联系电话2"
printstring obj, texttxt, 5600 + xu_y, xu_x, 0, 300, 7200, 0, 0, 0, 0
print_x = print_x + 300
If obj.ScaleHeight - 1440 * 0.2 - 300 < print_x Then
obj.NewPage
print_x = 0
End If
xu_x = print_x
totalcountprint = 0
totalfinalprint = 0
Do Until mybank.EOF
xu_x = print_x
texttxt = "" & mybank!roomyd_num
printstring obj, texttxt, 500 + xu_y, xu_x, 0, 300, 7200, 0, 0, 0, 0
texttxt = "" & mybank!daima
printstring obj, texttxt, 1200 + xu_y, xu_x, 0, 300, 7200, 0, 0, 0, 0
texttxt = "" & mybank!Name
printstring obj, texttxt, 2100 + xu_y, xu_x, 0, 300, 7200, 0, 0, 0, 0
texttxt = "" & Format(mybank!time_yd, "dd hh:mm")
printstring obj, texttxt, 3300 + xu_y, xu_x, 0, 300, 7200, 0, 0, 0, 0
texttxt = "" & mybank!tell1
printstring obj, texttxt, 4300 + xu_y, xu_x, 0, 300, 7200, 0, 0, 0, 0
texttxt = "" & mybank!tell2
printstring obj, texttxt, 5600 + xu_y, xu_x, 0, 300, 7200, 0, 0, 0, 0
totalcountprint = totalcountprint + 1
mybank.MoveNext
texttxt = ""
print_x = print_x + 300
If obj.ScaleHeight - 1440 * 0.2 - 300 < print_x Then
obj.NewPage
print_x = 0
End If
Loop
xu_x = print_x
texttxt = "打印时间" & Format(Now, "yyyy-MM-dd hh:mm:ss")
printstring obj, texttxt, 1000 + xu_y, xu_x, 0, 300, 7200, 0, 0, 0, 0
xu_x = print_x
print_x = print_x + 300
If obj.ScaleHeight - 1440 * 0.2 - 300 < print_x Then
obj.NewPage
print_x = 0
End If
xu_x = print_x
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -