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

📄 frmin_pztempletnew.frm

📁 一个用VB写的财务软件源码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmIN_PzTempletNew 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "模板"
   ClientHeight    =   2385
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5490
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2385
   ScaleWidth      =   5490
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消(&C)"
      CausesValidation=   0   'False
      Height          =   345
      Left            =   4200
      TabIndex        =   9
      Top             =   1920
      Width           =   1065
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定(&O)"
      Height          =   345
      Left            =   2760
      TabIndex        =   8
      Top             =   1920
      Width           =   1065
   End
   Begin VB.TextBox txtFJZS 
      Height          =   285
      Left            =   1530
      MaxLength       =   3
      TabIndex        =   7
      Top             =   1328
      Width           =   705
   End
   Begin VB.ComboBox cboPZZL 
      Height          =   300
      Left            =   1530
      Style           =   2  'Dropdown List
      TabIndex        =   5
      Top             =   940
      Width           =   1515
   End
   Begin VB.TextBox txtComment 
      Height          =   285
      Left            =   1530
      MaxLength       =   25
      TabIndex        =   3
      Top             =   568
      Width           =   3765
   End
   Begin VB.TextBox txtCode 
      Height          =   285
      Left            =   1530
      MaxLength       =   3
      TabIndex        =   1
      Top             =   188
      Width           =   1065
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "附件张数:"
      Height          =   180
      Left            =   210
      TabIndex        =   6
      Top             =   1380
      Width           =   900
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "模板凭证种类:"
      Height          =   180
      Left            =   210
      TabIndex        =   4
      Top             =   1000
      Width           =   1260
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "模板说明:"
      Height          =   180
      Left            =   210
      TabIndex        =   2
      Top             =   620
      Width           =   900
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "模板编码:"
      Height          =   180
      Left            =   210
      TabIndex        =   0
      Top             =   240
      Width           =   900
   End
End
Attribute VB_Name = "frmIN_PzTempletNew"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private m_sFunction As String
Private m_sTempletCode As String
Private m_sTempletComment As String
Private m_sTempletPzzl As String
Private m_iTempletFjzs As Integer
Public OK As Boolean


Public Property Let usFunction(ByVal NewFunc As String)
    m_sFunction = NewFunc
End Property
Public Property Get usFunction() As String
    usFunction = m_sFunction
End Property

Public Property Let usTempletCode(ByVal NewCode As String)
    m_sTempletCode = NewCode
End Property
Public Property Get usTempletCode() As String
    usTempletCode = m_sTempletCode
End Property

Public Property Let usTempletComment(ByVal NewComment As String)
    m_sTempletComment = NewComment
End Property
Public Property Get usTempletComment() As String
    usTempletComment = m_sTempletComment
End Property

Public Property Let usTempletPzzl(ByVal NewPZZL As String)
    m_sTempletPzzl = NewPZZL
End Property
Public Property Get usTempletPzzl() As String
    usTempletPzzl = m_sTempletPzzl
End Property

Public Property Let uiTempletFjzs(ByVal NewFjzs As Integer)
    m_iTempletFjzs = NewFjzs
End Property
Public Property Get uiTempletFjzs() As Integer
    uiTempletFjzs = m_iTempletFjzs
End Property



Private Sub cmdCancel_Click()
    OK = False
    Me.Hide
End Sub

Private Sub cmdOk_Click()
    
    Select Case Me.usFunction
        Case "新增"
            If txtCode.text = "" Then
                MsgBox "必须输入模板编码!", vbInformation
                txtCode.SetFocus
                Exit Sub
            ElseIf Len(txtCode.text) <> 3 Then
                MsgBox "模板编码必须为三位数字!", vbInformation
                txtCode.SetFocus
                Exit Sub
            ElseIf CodeExist(txtCode.text) Then
                MsgBox "该编码业已存在!", vbInformation
                txtCode.SetFocus
                Exit Sub
            ElseIf cboPZZL.ListIndex = -1 Then
                MsgBox "请选择凭证类别!", vbInformation
                cboPZZL.SetFocus
                Exit Sub
            End If
        Case "修改"
        Case Else
    End Select
    
    m_sTempletCode = txtCode.text
    m_sTempletComment = Trim$("" & txtComment.text)
    m_sTempletPzzl = cboPZZL.text
    m_iTempletFjzs = Val(txtFJZS.text)
    OK = True
    Me.Hide
    
End Sub

Private Function CodeExist(ByVal NewCode As String) As Boolean
    Dim rSt As ADODB.Recordset
    
    Set rSt = New ADODB.Recordset
    With rSt
        .CursorLocation = adUseClient
        .Open "select count(*) from tZW_TempletMain" & glo.sOperateYear & _
                " where cCode='" & NewCode & "'", _
            glo.cnnMain, adOpenStatic, adLockReadOnly
        If .Fields(0).Value = 0 Then
            CodeExist = False
        Else
            CodeExist = True
        End If
        .Close
    End With

End Function


Private Sub Form_Activate()
    txtCode.text = Me.usTempletCode
    txtComment.text = Me.usTempletComment
    If Me.usTempletPzzl = "" Then
        cboPZZL.ListIndex = -1
    Else
        cboPZZL.text = Me.usTempletPzzl
    End If
    txtFJZS.text = Me.uiTempletFjzs
    Select Case Me.usFunction
        Case "新增"
            txtCode.Enabled = True
            txtCode.BackColor = vbWhite
            txtCode.SetFocus
        Case "修改"
            txtCode.Enabled = False
            txtCode.BackColor = vb3DLight
            txtComment.SetFocus
    End Select
End Sub


Private Sub form_load()
    Dim rstPZZL As ADODB.Recordset
    
    '打开凭证种类数据集,置凭证种类组合框
    Set rstPZZL = New ADODB.Recordset
    With rstPZZL
        .CursorLocation = adUseClient
        .Open "select * from tZW_type" & glo.sOperateYear & " order by signID", _
                    glo.cnnMain, adOpenStatic, adLockReadOnly
        If .RecordCount <> 0 Then
            .MoveFirst
            Do Until .EOF
                cboPZZL.AddItem .Fields("sign").Value
                .MoveNext
            Loop
        End If
        .Close
    End With
    
End Sub

Private Sub txtCode_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        SendKeys "{tab}"
    Else
        KeyAscii = IntegerEnabled(KeyAscii)
    End If
End Sub

Private Sub txtComment_KeyPress(KeyAscii As Integer)
SqlStringValidText txtComment.text, txtComment.SelStart, txtComment.SelLength, KeyAscii
End Sub

Private Sub txtFJZS_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        SendKeys "{tab}"
    Else
        KeyAscii = IntegerEnabled(KeyAscii)
    End If
End Sub

Private Sub txtFJZS_Validate(Cancel As Boolean)
    If Val(txtFJZS.text) > 255 Then
        MsgBox "数字过大!", vbInformation
        Cancel = True
    End If
End Sub

⌨️ 快捷键说明

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