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

📄 frmpaytype.frm

📁 一套简易的MIS系统。带SQLServer数据库。供参考。
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "Command.ocx"
Begin VB.Form frmPayType 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "付款类型维护"
   ClientHeight    =   7170
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   10230
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   7170
   ScaleWidth      =   10230
   ShowInTaskbar   =   0   'False
   Begin MSComctlLib.ListView lstPayType 
      Height          =   6165
      Left            =   30
      TabIndex        =   12
      Top             =   960
      Width           =   10155
      _ExtentX        =   17912
      _ExtentY        =   10874
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   0
   End
   Begin VB.ComboBox cmbState 
      Height          =   300
      Left            =   4470
      Style           =   2  'Dropdown List
      TabIndex        =   7
      Top             =   517
      Width           =   2295
   End
   Begin MSComCtl2.DTPicker inDate 
      Height          =   315
      Left            =   1080
      TabIndex        =   6
      Top             =   510
      Width           =   1695
      _ExtentX        =   2990
      _ExtentY        =   556
      _Version        =   393216
      Format          =   25296896
      CurrentDate     =   38888
   End
   Begin VB.TextBox txtType 
      Appearance      =   0  'Flat
      Height          =   300
      Index           =   0
      Left            =   1080
      TabIndex        =   0
      Top             =   90
      Width           =   2475
   End
   Begin VB.TextBox txtType 
      Appearance      =   0  'Flat
      Height          =   300
      Index           =   1
      Left            =   4470
      TabIndex        =   1
      Top             =   90
      Width           =   2475
   End
   Begin CSCommand.Command cmdOK 
      Height          =   375
      Left            =   7320
      TabIndex        =   8
      Top             =   90
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   661
      Icon            =   "frmPayType.frx":0000
      Caption         =   "确定(&S)"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin CSCommand.Command cmdUpdate 
      Height          =   375
      Left            =   8730
      TabIndex        =   9
      Top             =   90
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   661
      Icon            =   "frmPayType.frx":059A
      Caption         =   "修改(&U)"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin CSCommand.Command cmdQuery 
      Height          =   375
      Left            =   7320
      TabIndex        =   10
      Top             =   540
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   661
      Icon            =   "frmPayType.frx":0B34
      Caption         =   "查询(&Q)"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin CSCommand.Command cmdBack 
      Height          =   375
      Left            =   8730
      TabIndex        =   11
      Top             =   540
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   661
      Icon            =   "frmPayType.frx":10CE
      Caption         =   "返回(&B)"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "状态:"
      Height          =   180
      Index           =   3
      Left            =   3630
      TabIndex        =   5
      Top             =   577
      Width           =   540
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "录入日期:"
      Height          =   180
      Index           =   2
      Left            =   240
      TabIndex        =   4
      Top             =   577
      Width           =   900
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "类型编码:"
      Height          =   180
      Index           =   0
      Left            =   240
      TabIndex        =   3
      Top             =   150
      Width           =   900
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "类型名称:"
      Height          =   180
      Index           =   1
      Left            =   3630
      TabIndex        =   2
      Top             =   150
      Width           =   900
   End
End
Attribute VB_Name = "frmpayType"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmbState_KeyPress(KeyAscii As Integer)
    
    If KeyAscii = vbKeyReturn Then
        cmdOK.SetFocus
        Exit Sub
    End If
    
End Sub

Private Sub cmdBack_Click()
    
    '关闭窗口
    tBackMain Me
    
End Sub

Private Sub cmdOK_Click()
    
    Dim iIndex               As Integer
    
    On Error GoTo ErrInfo
    
    For iIndex = 0 To 1
        If txtType(iIndex).Text = "" Then
            MsgBox "基础信息错误!", vbInformation, "提示:"
            txtType(iIndex).SetFocus
            SendKeys "{Home}+{End}"
            Exit Sub
        End If
    Next
    
    With uShareInfo
        .strCode = txtType(0).Text
        .strName = txtType(1).Text
        .dInDate = Format(inDate.Value, "YYYY年MM月DD日")
        .intFlag = tString(cmbState.Text, "[", "]", 0)
    End With
    
    If tPayTypeInfo(uShareInfo, iAdd_Update) = False Then
        MsgBox "数据处理失败!", vbInformation, "提示:"
        Exit Sub
    End If
    iAdd_Update = 0
    MsgBox "数据处理成功!", vbInformation, "提示:"
    For iIndex = 0 To txtType.Count - 1
        txtType(iIndex).Text = ""
    Next
    
    getPayTypeData ""
    
    If txtType(0).Locked = True Then txtType(0).Locked = False
    txtType(0).SetFocus
    SendKeys "{Home}+{End}"
    
    Exit Sub
ErrInfo:
    MsgBox Err.Description, vbInformation, "提示:"
    
End Sub

Private Sub cmdQuery_Click()
    
    getPayTypeData Trim(txtType(0).Text)
    
End Sub

Private Sub cmdUpdate_Click()
    
    Call cmdOK_Click
    
End Sub

Private Sub Form_Load()

    '计算窗体显示位置
    tFormSpace frmMain, Me, uWindows
    
    '显示基础数据
    inDate.Value = Format(tServerDate, "YYYY年MM月DD日")
    With cmbState
        .Clear
        .AddItem "正常[0]"
        .AddItem "停用[1]"
        .Text = .List(0)
    End With
    getPayType
    getPayTypeData ""

End Sub

'显示列头
Private Sub getPayType()
    
    With lstPayType
        .ListItems.Clear
        .FullRowSelect = True
        .GridLines = True
        .LabelEdit = lvwManual
        .View = lvwReport
        With .ColumnHeaders
            .Clear
            .Add , , "@", 0
            .Add , , Space(8) & "类型编号", 1800
            .Add , , Space(8) & "类型名称", 2800
            .Add , , Space(8) & "录入日期", 2200
            .Add , , Space(8) & "状态", 1800
        End With
    End With
    
End Sub

'显示数据
Private Function getPayTypeData(strInfo As String)
    
    Dim rsTemp                  As New ADODB.Recordset
    Dim iIndex                  As Integer
    Dim strSQL                  As String
    
    strSQL = " Where PaySort_id Like '" & strInfo & "%' Or PaySort_name Like '" & strInfo & "%' "
    Set rsTemp = DBCN.Execute("Select PaySort_id,PaySort_name,Oper_date,Instate From tbCCPaySort " _
                & " " & strSQL & " Order By PaySort_ID ")
    If rsTemp.EOF = False Then
        iIndex = 1
        lstPayType.ListItems.Clear
        Do Until rsTemp.EOF
            lstPayType.ListItems.Add iIndex, , iIndex
            With lstPayType.ListItems(iIndex)
                .SubItems(1) = IIf(IsNull(rsTemp.Fields("PaySort_ID")), "", rsTemp.Fields("PaySort_ID"))
                .SubItems(2) = IIf(IsNull(rsTemp.Fields("PaySort_name")), "", rsTemp.Fields("PaySort_name"))
                .SubItems(3) = IIf(IsNull(rsTemp.Fields("Oper_date")), "", rsTemp.Fields("Oper_date"))
                If rsTemp.Fields("Instate") = 0 Then
                    .SubItems(4) = "正常[0]"
                Else
                    .SubItems(4) = "停用[1]"
                End If
                Dim iRedList                 As Integer
                For iRedList = 1 To lstPayType.ColumnHeaders.Count - 1
                    If rsTemp.Fields("Instate") = 1 Then
                        .ListSubItems(iRedList).ForeColor = vbRed
                    End If
                Next
            End With
            rsTemp.MoveNext
            iIndex = iIndex + 1
        Loop
    Else
        MsgBox "没有符合条件的数据!", vbInformation, "提示:"
    End If

End Function

Private Sub inDate_KeyDown(KeyCode As Integer, Shift As Integer)
    
    If KeyCode = vbKeyReturn Then
        cmbState.SetFocus
        SendKeys "%{Down}"
        Exit Sub
    End If
    
End Sub

Private Sub lstPayType_DblClick()
    
    On Error Resume Next
    
    iAdd_Update = 1
    txtType(0).Text = lstPayType.SelectedItem.SubItems(1)
    txtType(1).Text = lstPayType.SelectedItem.SubItems(2)
    inDate.Value = Format(lstPayType.SelectedItem.SubItems(3), "YYYY年MM月DD日")
    cmbState.Text = lstPayType.SelectedItem.SubItems(4)
    txtType(0).Locked = True
    txtType(1).SetFocus
    SendKeys "{Home}+{End}"
    
End Sub

Private Sub txtType_GotFocus(Index As Integer)
    
    txtType(Index).BackColor = &HC0FFC0
    txtType(Index).ForeColor = vbRed
    
End Sub

Private Sub txtType_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
    
    Select Case KeyCode
        Case vbKeyDown
            If Index = txtType.Count - 1 Then Exit Sub
            txtType(Index + 1).SetFocus
            SendKeys "{Home}+{End}"
            Exit Sub
        Case vbKeyUp
            If Index = 0 Then Exit Sub
            txtType(Index - 1).SetFocus
            SendKeys "{Home}+{End}"
            Exit Sub
        Case Else
            Exit Sub
    End Select
    
End Sub

Private Sub txtType_KeyPress(Index As Integer, KeyAscii As Integer)
    
    Select Case KeyAscii
        Case vbKeyReturn
            Select Case Index
                Case 0
                    If txtType(Index).Text = "" Then
                        If MsgBox("系统将自动生成最大编码?", vbInformation + vbYesNo, "提示:") = vbYes Then
                            txtType(Index).Text = tBigCode("tbCCpaySort", "PaySort_id")
                            txtType(Index + 1).SetFocus
                            SendKeys "{Home}+{End}"
                            Exit Sub
                        Else
                            txtType(Index).SetFocus
                            SendKeys "{Home}+{End}"
                            Exit Sub
                        End If
                    End If
                    If tWhileCode("tbCCpaySort", "PaySort_id", Format(Trim(txtType(Index).Text), "0000")) = False Then
                        MsgBox "编码重复!请检查您的输入是否正确?", vbInformation, "提示:"
                        txtType(Index).SetFocus
                        SendKeys "{Home}+{End}"
                        Exit Sub
                    Else
                        txtType(Index).Text = Format(txtType(Index).Text, "0000")
                        txtType(Index + 1).SetFocus
                        SendKeys "{Home}+{End}"
                        Exit Sub
                    End If
                Case 1
                    If txtType(Index).Text = "" Then
                        txtType(Index).SetFocus
                        SendKeys "{Home}+{End}"
                        Exit Sub
                    End If
                    If tWhileCode("tbCCpaySort", "PaySort_name", Trim(txtType(Index).Text)) = False Then
                        MsgBox "信息重复!请检查您的输入是否正确?", vbInformation, "提示:"
                        txtType(Index).SetFocus
                        SendKeys "{Home}+{End}"
                        Exit Sub
                    Else
                        inDate.SetFocus
                        Exit Sub
                    End If
            End Select
        Case Else
            Exit Sub
    End Select
    
End Sub

Private Sub txtType_LostFocus(Index As Integer)
    
    txtType(Index).BackColor = vbWhite
    txtType(Index).ForeColor = vbBlack
    
End Sub

⌨️ 快捷键说明

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