📄 scgl_bdth.frm
字号:
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 6930
TabIndex = 8
Top = 225
Width = 945
End
End
Begin VB.CommandButton Cmd3
Caption = "退出(ESC)"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 555
Left = 10200
TabIndex = 6
Top = 8040
Width = 1575
End
Begin VB.Label frm_msg
BackColor = &H8000000A&
ForeColor = &H00FF0000&
Height = 495
Left = 5640
TabIndex = 40
Top = 0
Width = 6375
End
Begin VB.Label Label1
BackColor = &H00C0C0C0&
BeginProperty Font
Name = "黑体"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 0
TabIndex = 41
Top = 0
Width = 11775
End
End
Attribute VB_Name = "scgl_bdth"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim key_index As Integer
Dim t_bt As String
Dim t_fields As Variant
Dim response As Integer
Dim t_rec3 As Recordset 'ADDNEW,EDIT,DELETE
Dim t_rec4 As Recordset 'LOCK_NO
Dim t_rec As Recordset 'MSFLEXGRID
Dim t_rec1 As Recordset
Dim rec As Recordset
Dim t_rq As String
Dim dh As String
Dim T_TJ As String '筛选条件
Dim OPT As String
Private Sub Form_Load()
Dim sys_uid As String, sys_pwd As String
JZ_USER = SYS_USER + Space(1) + SYS_NAME
JZ_JRSJ2 = Time()
sys_uid = "db2user"
sys_pwd = "db2user"
KeyPreview = True
tab_nam.Caption = "本地酒店信息一览表"
Call first(True)
t_fields = Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
t_bt = "^ 日期 |^ 酒店名称 |^ 住客人数 |^ 外宾人数|^ 团队外宾数|^ 团队内宾数|^ 入住率|^ 平均房价 |^ 备注 |^ LSH"
Set rec = YX_data.OpenRecordset("select FSRQ,DWMC,ZKRS,WBRS,TDWBRS,TDNBRS,CZL,PJ_FZ,BZ,LSH,LOCK_NO from YX_BDTH", 4)
If Not rec.BOF Then
rec.MoveLast
Call pub_memo.Flex_full(FLEX1, t_bt, rec, t_fields, 9, Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
End If
rec_no.Caption = "当前记录数:" + CStr(FLEX1.Rows - 1)
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
key_index = 100
Select Case KeyCode
Case vbKeyF2
key_index = 0 '增加
Case vbKeyF3
key_index = 1 '修改
Case vbKeyF4
key_index = 2 '解除
Case vbKeyF5
key_index = 3 '打印
Case vbKeyF9
key_index = 4 '刷新
Case vbKeyEscape
key_index = 99 '退出
End Select
If key_index = 99 Then
If Frame2.Enabled = False Then
Call Cmd3_Click
Else
Call first(True)
End If
Else
If Frame2.Enabled = False Then
Call Cmd2_Click(key_index)
End If
End If
End Sub
Sub MAIN(t_gnmc As String)
Label1.Caption = t_gnmc
JZ_USER = SYS_USER + Space(1) + SYS_NAME
JZ_JRSJ2 = Time()
JZ_DQSJ2 = Time()
End Sub
Private Sub Cmd3_Click()
Unload Me
yx_main.Show (1)
End Sub
Private Sub flex1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
Cmd2(0).SetFocus
End If
End Sub
Private Sub Cmd2_Click(Index As Integer)
Select Case Index
Case 0
OPT = "0" '建立
Call first(False)
m_fsrq.SetFocus
m_fsrq.Text = " - - "
m_dwmc.Text = ""
m_zkrs.Text = ""
m_wbrs.Text = ""
m_tdwbrs.Text = ""
m_tdnbrs.Text = ""
m_czl.Text = ""
m_pj_fj.Text = ""
m_bz.Text = ""
Case 1
OPT = "1" '修改
Call first(False)
m_fsrq.SetFocus
m_fsrq.SelStart = 0
m_fsrq.SelLength = 10
Case 2
OPT = "2" '解除
Call first(False)
m_fsrq.Enabled = False
m_dwmc.Enabled = False
m_zkrs.Enabled = False
m_wbrs.Enabled = False
m_tdwbrs.Enabled = False
m_tdnbrs.Enabled = False
m_czl.Enabled = False
m_pj_fj.Enabled = False
m_bz.Enabled = False
CMD1(0).SetFocus
Case 3
If T_TJ = "" Then
Set rec = YX_data.OpenRecordset("select FSRQ,DWMC,BZ,ZKRS,WBRS,TDWBRS,TDNBRS,CZL,PJ_FZ from YX_BDTH", 4)
If Not rec.BOF Then
rec.MoveLast
Call print_tabler(rec, "本地同行信息", Array("日期", "酒店名称", "备注", "住客人数", "外宾人数", "团队外宾数", "团队内宾数", "入住率", "平均房价"), Array(12, 20, 20, 10, 10, 12, 12, 10, 12), 10, Array(11, 11, 11, 21, 21, 21, 21, 21, 21))
Else
MsgBox "无可打印信息!", 64
Exit Sub
End If
Else
Set rec = YX_data.OpenRecordset("select FSRQ,DWMC,BZ,ZKRS,WBRS,TDWBRS,TDNBRS,CZL,PJ_FZ from YX_BDTH WHERE " & T_TJ & "", 4)
If Not rec.BOF Then
rec.MoveLast
Call print_tabler(rec, "本地同行信息", Array("日期", "酒店名称", "备注", "住客人数", "外宾人数", "团队外宾数", "团队内宾数", "入住率", "平均房价"), Array(12, 20, 20, 10, 10, 12, 12, 10, 12), 10, Array(11, 11, 11, 21, 21, 21, 21, 21, 21))
Else
MsgBox "无可打印信息!", 64
Exit Sub
End If
End If
Case 4
Call flex1_ref
End Select
End Sub
Private Sub first(t As Boolean)
Frame2.Enabled = Not (t)
FLEX1.Enabled = t
Cmd2(0).Enabled = t
Cmd2(1).Enabled = t
Cmd2(2).Enabled = t
Cmd2(3).Enabled = t
Cmd2(4).Enabled = t
End Sub
Private Sub m_bz_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Or KeyCode = vbKeyDown Then
CMD1(0).SetFocus
End If
End Sub
Private Sub m_czl_Change()
frm_msg.Caption = ""
End Sub
Private Sub m_czl_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Or KeyCode = vbKeyDown Then
If Not Trim(m_czl.Text) = "" Then
Call m_czl_LostFocus
Else
m_czl.Text = "0"
m_pj_fj.SetFocus
m_pj_fj.SelStart = 0
m_pj_fj.SelLength = Len(Trim(m_pj_fj.Text))
End If
End If
End Sub
Private Sub m_czl_LostFocus()
If Frame2.Enabled = True Then
If Not Trim(m_czl.Text) = "" Then
If IsNumeric(Trim(m_czl.Text)) Then
m_pj_fj.SetFocus
m_pj_fj.SelStart = 0
m_pj_fj.SelLength = Len(Trim(m_pj_fj.Text))
Else
frm_msg.Caption = "无效入住率!"
m_czl.SetFocus
m_czl.SelStart = 0
m_czl.SelLength = Len(Trim(m_czl.Text))
End If
Else
m_czl.Text = "0"
m_pj_fj.SetFocus
m_pj_fj.SelStart = 0
m_pj_fj.SelLength = Len(Trim(m_pj_fj.Text))
End If
End If
End Sub
Private Sub m_dwmc_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Or KeyCode = vbKeyDown Then
m_zkrs.SetFocus
m_zkrs.SelStart = 0
m_zkrs.SelLength = Len(Trim(m_zkrs.Text))
End If
End Sub
Private Sub m_fsrq_Change()
frm_msg.Caption = ""
End Sub
Private Sub m_fsrq_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Or KeyCode = vbKeyDown Then
If Not m_fsrq.Text = " - - " Then
Call m_fsrq_LostFocus
End If
End If
End Sub
Private Sub m_fsrq_LostFocus()
If Frame2.Enabled = True Then
If Not m_fsrq.Text = " - - " Then
t_rq = date_cl(m_fsrq.Text)
If Not t_rq <> "F" Then
m_fsrq = t_rq
End If
If IsDate(m_fsrq.Text) Then
m_dwmc.SetFocus
m_dwmc.SelStart = 0
m_dwmc.SelLength = Len(Trim(m_dwmc.Text))
Else
frm_msg.Caption = "无效日期!"
m_fsrq.SetFocus
m_fsrq.SelStart = 0
m_fsrq.SelLength = Len(m_fsrq.Text)
End If
End If
End If
End Sub
Private Sub m_pj_fj_Change()
frm_msg.Caption = ""
End Sub
Private Sub m_pj_fj_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Or KeyCode = vbKeyDown Then
If Not Trim(m_pj_fj.Text) = "" Then
Call m_pj_fj_LostFocus
End If
End If
End Sub
Private Sub FLEX1_GotFocus()
On Error GoTo error1
m_fsrq.Text = IIf(Trim(FLEX1.TextArray(FLEX1.Row * 10)) = "", " - - ", Format(FLEX1.TextArray(FLEX1.Row * 10), "yyyy-mm-dd"))
m_dwmc.Text = IIf(FLEX1.TextArray(FLEX1.Row * 10 + 1) = "*", "", Trim(FLEX1.TextArray(FLEX1.Row * 10 + 1)))
m_zkrs.Text = Trim(FLEX1.TextArray(FLEX1.Row * 10 + 2))
m_wbrs.Text = Trim(FLEX1.TextArray(FLEX1.Row * 10 + 3))
m_tdwbrs.Text = Trim(FLEX1.TextArray(FLEX1.Row * 10 + 4))
m_tdnbrs.Text = Trim(FLEX1.TextArray(FLEX1.Row * 10 + 5))
m_czl.Text = Trim(FLEX1.TextArray(FLEX1.Row * 10 + 6))
m_pj_fj.Text = Trim(FLEX1.TextArray(FLEX1.Row * 10 + 7))
m_bz.Text = IIf(Trim(FLEX1.TextArray(FLEX1.Row * 10 + 8)) = "*", "", Trim(FLEX1.TextArray(FLEX1.Row * 10 + 8)))
m_lsh.Text = Trim(FLEX1.TextArray(FLEX1.Row * 10 + 9))
Exit Sub
error1:
If Err() = 383 Then
Resume Next
End If
End Sub
Private Sub FLEX1_RowColChange()
On Error GoTo error1
m_fsrq.Text = IIf(Trim(FLEX1.TextArray(FLEX1.Row * 10)) = "", " - - ", Format(FLEX1.TextArray(FLEX1.Row * 10), "yyyy-mm-dd"))
m_dwmc.Text = IIf(FLEX1.TextArray(FLEX1.Row * 10 + 1) = "*", "", Trim(FLEX1.TextArray(FLEX1.Row * 10 + 1)))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -