⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dt_cklb.frm

📁 一个简单的酒店管理系统 用VB.net+SQL2000实现
💻 FRM
📖 第 1 页 / 共 2 页
字号:
    cmd_func(0).Enabled = t_ft
    cmd_func(1).Enabled = t_ft
    dt_cklb.KeyPreview = t_ft
End Sub

'**************************************************************************************************
'*  功    能 :
'*  作    者 : 梁卫
'*  作成日期 : 1999.02.25
'*  修改日期 : 1999.02.25
'**************************************************************************************************
Private Sub flex_refresh()
    flex_rec.Requery
    Call Flex_full(gd1, t_bt, flex_rec, t_fields, t_fdcounts - 1, t_fdxs)
    lb_jls.Caption = gd1.Rows - 1
    
    gd1.Refresh
    
    Call button_refresh(True)
End Sub


'**************************************************************************************************
'*  功    能 :
'*  作    者 : 梁卫
'*  作成日期 : 1999.02.25
'*  修改日期 : 1999.02.25
'**************************************************************************************************
Private Sub CMD_EXIT_Click()
    flex_rec.Close
    Unload Me
End Sub

'**************************************************************************************************
'*  功    能 :
'*  作    者 : 梁卫
'*  作成日期 : 1999.02.25
'*  修改日期 : 1999.02.25
'**************************************************************************************************
Private Sub cmd_func_Click(Index As Integer)
    Select Case Index
    Case 0  '选中
            If gd1.Rows - 1 <> 0 Then
                If IsNumeric(gd1.TextArray(gd1.Row * t_fdcounts)) Then
                    clkl_xh = gd1.TextArray(gd1.Row * t_fdcounts)
                Else
                    clkl_xh = 0
                End If
            Else
                clkl_xh = 0
            
            End If
            
            CMD_EXIT_Click
            
    Case 1  '筛选
            tPkjEnabledFT t_funcNo, True
            m_gjdm.SetFocus

    End Select

End Sub


Private Sub Form_Activate()
    gd1.SetFocus
End Sub

'**************************************************************************************************
'*  功    能 :
'*  作    者 : 梁卫
'*  作成日期 : 1999.02.25
'*  修改日期 : 1999.02.25
'**************************************************************************************************
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    key_index = 100
    
    Select Case KeyCode
    Case vbKeyReturn
            key_index = 0   '选中
    Case vbKeyF6
            key_index = 1   '筛选
    Case vbKeyEscape
            key_index = 101 '退出
    End Select
    
    If key_index = 101 Then
        Call CMD_EXIT_Click
    Else
        Call cmd_func_Click(key_index)
    End If

End Sub




'**************************************************************************************************
'*  功    能 :
'*  作    者 : 梁卫
'*  作成日期 : 1999.03.15
'*  修改日期 : 1999.03.15
'**************************************************************************************************
Private Sub m_gjdm_LostFocus()
    m_gjdm.Text = UCase(Trim(m_gjdm.Text))
    Call PUB_DMLostFocus(m_gjdm, cm_gjmc, frm_msg, "不适当的国籍代码")

End Sub

'**************************************************************************************************
'*  功    能 :
'*  作    者 : 梁卫
'*  作成日期 : 1999.03.15
'*  修改日期 : 1999.03.15
'**************************************************************************************************
Private Sub cm_gjmc_LostFocus()

    Call PUB_MCLostFocus(m_gjdm, cm_gjmc, frm_msg, "不适当的国籍信息")

End Sub

'**************************************************************************************************
'*  功    能 :
'*  作    者 : 梁卫
'*  作成日期 : 1999.03.15
'*  修改日期 : 1999.03.15
'**************************************************************************************************
Private Sub cm_gjmc_Click()
    m_gjdm.Text = cm_gjmc.List(cm_gjmc.ListIndex, 0)
    cm_gjmc.Text = cm_gjmc.List(cm_gjmc.ListIndex, 1)
End Sub

'**************************************************************************************************
'*  功    能 :
'*  作    者 : 梁卫
'*  作成日期 : 1999.02.25
'*  修改日期 : 1999.02.25
'**************************************************************************************************
Private Sub Form_Load()

    frm_msg.Visible = False
    frm_msg.Caption = ""

    dt_cklb.KeyPreview = True

    Call PUB_GetCMDB(PUB_data, cm_gjmc, "DT_KRGJK", "GJDM", "GJMC")
    
    Set flex_rec = PUB_data.OpenRecordset("SELECT * FROM DT_CKQD ORDER BY KR_X,KR_M,YW_X,YW_M", 4, 0, 2)
    If Not flex_rec.BOF Then
        flex_rec.MoveLast
        flex_rec.MoveFirst
    End If

    t_fields = Array("XH", "KR_X", "KR_M", "YW_X", "YW_M", "KR_XBMC", "GJMC") '设置显示字段
    t_fdxs = Array(0, 0, 0, 0, 0, 0, 0) '设置显示字段
    t_bt = ">序号  |<客  人  姓|<客  人  名|<英  文  姓|<英  文  名|^性别|<国  籍                 "   '设置显示表头格式
    t_fdcounts = 7
    
    Call flex_refresh
    
    tPkjTextSet flex_rec, 0  '把当前字段清空
    
    tPkjEnabledFT "", False

End Sub


'**************************************************************************************************
'*  功    能 :
'*  作    者 : 梁卫
'*  作成日期 : 1999.02.25
'*  修改日期 : 1999.02.25
'**************************************************************************************************
Private Sub gd1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then
        cmd_func(0).SetFocus
    End If
End Sub


'**************************************************************************************************
'*  功    能 : 按照条件进行筛选
'*  作    者 : 梁卫
'*  作成日期 : 1999.03.26
'*  修改日期 : 1999.03.26
'**************************************************************************************************
Private Sub m_yw_m_LostFocus()
    Dim temp_tj As String
    Dim temp_and As Boolean
    
    If Trim(m_gjdm.Text) <> "*" Or Trim(m_kr_x.Text) <> "" Or Trim(m_kr_m.Text) <> "" Or Trim(m_yw_x.Text) <> "" Or Trim(m_yw_m.Text) <> "" Then
        temp_and = False
        If Trim(m_gjdm.Text) <> "*" Then
            temp_and = True
            temp_tj = temp_tj & " TRIM(GJDM)='" & Trim(m_gjdm.Text) & "'"
        End If
        If Trim(m_kr_x.Text) <> "" Then
            temp_and = True
            temp_tj = temp_tj & IIf(temp_and, " AND ", "") & " LEFT(TRIM(KR_X)," & Len(Trim(m_kr_x.Text)) & ")='" & Trim(m_kr_x.Text) & "' "
        End If
        If Trim(m_kr_m.Text) <> "" Then
            temp_and = True
            temp_tj = temp_tj & IIf(temp_and, " AND ", "") & " LEFT(TRIM(KR_M)," & Len(Trim(m_kr_m.Text)) & ")='" & Trim(m_kr_m.Text) & "' "
        End If
        If Trim(m_yw_x.Text) <> "" Then
            temp_and = True
            temp_tj = temp_tj & IIf(temp_and, " AND ", "") & " LEFT(TRIM(YW_X)," & Len(Trim(m_yw_x.Text)) & ")='" & Trim(m_yw_x.Text) & "' "
        End If
        If Trim(m_yw_m.Text) <> "" Then
            temp_and = True
            temp_tj = temp_tj & IIf(temp_and, " AND ", "") & " LEFT(TRIM(YW_M)," & Len(Trim(m_yw_m.Text)) & ")='" & Trim(m_yw_m.Text) & "' "
        End If
    End If
    Set flex_rec = PUB_data.OpenRecordset("SELECT * FROM DT_CKQD " & IIf(temp_and, " WHERE " & temp_tj, "") & " ORDER BY KR_X,KR_M,YW_X,YW_M", 4, 0, 2)
    If Not flex_rec.BOF Then
        flex_rec.MoveLast
        flex_rec.MoveFirst
    End If
    
    Call flex_refresh
    
    tPkjEnabledFT 0, False
    
    gd1.SetFocus
    
End Sub


Public Property Get XH() As Integer
    XH = clkl_xh
End Property

Public Property Let XH(ByVal temp_xh As Integer)
    clkl_xh = temp_xh
End Property

'************************************************************************************
'* 功    能 : 根据名称查找代码; 若该名称和代码为一组时, 则退出, 否则,按照名称查找代码
'* 作 成 者 : 梁 卫
'* 生成日期 : 1999.03.06
'* 修改日期 : 1999.03.06
'* 参数说明:  tp_dm : 代码字段控件名
'*            tp_mc : 名称字段控件名
'************************************************************************************

Public Function PUB_GetTXCode(tp_dm As Control, tp_cm As Control) As Boolean

    Dim i As Integer
    Dim tp_rt As Boolean
    Dim tp_find As Boolean

    tp_rt = False
    tp_find = False

    For i = 0 To tp_cm.ListCount - 1
        If Trim(tp_cm.List(i, 1)) = Trim(tp_cm.Text) Then
            tp_dm.Text = Trim(tp_cm.List(i, 0))
            tp_rt = True
            Exit For
        End If
    Next i
    
    PUB_GetTXCode = tp_rt

End Function






'**************************************************************************************************
'*  功    能 : 在字典表中, 代码字段失去焦点时的处理
'*  作    者 : 梁卫
'*  作成日期 : 1999.03.08
'*  修改日期 : 1999.03.08
'**************************************************************************************************
Public Sub PUB_DMLostFocus(temp_dm As Control, temp_mc As Control, temp_frmmsg As Control, temp_msg As String)
    Dim temp_rt As Boolean
    
    temp_frmmsg.Visible = False
    temp_frmmsg.Caption = ""
    
    If Trim(temp_dm.Text) = "" Or Trim(temp_dm.Text) = "*" Then
        temp_mc.Text = "*"
    Else
        temp_rt = PUB_GetCMName(temp_dm, temp_mc)
        If temp_rt Then
        Else
            temp_frmmsg.Visible = True
            temp_frmmsg.Caption = temp_msg
            temp_dm.SetFocus
        End If
    End If
End Sub

'**************************************************************************************************
'*  功    能 : 在字典表中, 名称字段失去焦点时的处理
'*  作    者 : 梁卫
'*  作成日期 : 1999.03.08
'*  修改日期 : 1999.03.08
'**************************************************************************************************
Public Function PUB_MCLostFocus(temp_dm As Control, temp_mc As Control, temp_frmmsg As Control, temp_msg As String) As Boolean
    
    temp_frmmsg.Visible = False
    temp_frmmsg.Caption = ""
    
    PUB_MCLostFocus = True
    
    If Trim(temp_mc.Text) = "" Or Trim(temp_mc.Text) = "*" Then
        temp_dm.Text = "*"
    Else
        PUB_MCLostFocus = PUB_GetTXCode(temp_dm, temp_mc)
        If PUB_MCLostFocus Then
        Else
            temp_frmmsg.Visible = True
            temp_frmmsg.Caption = temp_msg
            temp_dm.SetFocus
        End If
    End If

End Function
'***********************************************************************
'* 功    能 : 根据代码生成名称
'* 作 成 者 : 梁 卫
'* 生成日期 : 1999.03.06
'* 修改日期 : 1999.03.06
'* 参数说明:  tp_dm : 代码字段控件名
'*            tp_mc : 名称字段控件名
'***********************************************************************

Public Function PUB_GetCMName(tp_dm As Control, tp_cm As Control) As Boolean

    Dim i As Integer
    Dim tp_rt As Boolean

    tp_rt = False

    For i = 0 To tp_cm.ListCount - 1
        If Trim(tp_cm.List(i, 0)) = Trim(tp_dm.Text) Then
            tp_cm.Text = Trim(tp_cm.List(i, 1))
            tp_rt = True
            Exit For
        End If
    Next i

    PUB_GetCMName = tp_rt
    
End Function

'***********************************************************************
'* 功    能 : 给Combobox控件赋值
'* 作 成 者 : 梁 卫
'* 生成日期 : 1999.03.01
'* 修改日期 : 1999.03.04
'* 参数说明:  tp_com     : 控件的名称
'*            tp_table   : 所使用的表名
'*            tp_fdname0 : 代码字段的字段名
'*            tp_fdname1 : 名称字段的字段名
'***********************************************************************

Public Sub PUB_GetCMDB(tp_data As Database, tp_com As Control, tp_table As String, tp_fdname0 As String, tp_fdname1 As String)

    Dim i As Integer
    Dim tp_rec As Recordset
    Dim tp_recordcount As Integer

    tp_com.Clear
    
    Set tp_rec = tp_data.OpenRecordset("select " & tp_fdname0 & "," & tp_fdname1 & " from " & tp_table & " order by " & tp_fdname0, 4, 0, 2)
    If Not tp_rec.BOF Then
        tp_rec.MoveLast
        tp_recordcount = tp_rec.RecordCount
        
        tp_rec.MoveFirst

        For i = 0 To tp_recordcount - 1
            tp_com.AddItem
            tp_com.List(i, 0) = tp_rec.Fields(tp_fdname0)
            tp_com.List(i, 1) = tp_rec.Fields(tp_fdname1)
            tp_rec.MoveNext
        Next i
    End If
    tp_rec.Close

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -