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

📄 frmyh_yhcxtj.frm

📁 一个用VB写的财务软件源码
💻 FRM
字号:
VERSION 5.00
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Begin VB.Form frmYH_Yhcxtj 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "查询条件录入"
   ClientHeight    =   3360
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5700
   Icon            =   "frmYH_Yhcxtj.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3360
   ScaleWidth      =   5700
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Visible         =   0   'False
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消(&C)"
      Height          =   345
      Left            =   4140
      TabIndex        =   11
      Top             =   2850
      Width           =   1065
   End
   Begin VB.CommandButton cmdOk 
      Caption         =   "确认(&O)"
      Height          =   345
      Left            =   2340
      TabIndex        =   10
      Top             =   2850
      Width           =   1065
   End
   Begin VB.CheckBox chkNoFilter 
      Caption         =   "取消筛选"
      Height          =   285
      Left            =   180
      TabIndex        =   12
      Top             =   2880
      Visible         =   0   'False
      Width           =   1575
   End
   Begin VB.Frame Frame1 
      Height          =   2355
      Left            =   60
      TabIndex        =   0
      Top             =   210
      Width           =   5565
      Begin VB.TextBox txtJsje 
         Height          =   315
         Left            =   3630
         MaxLength       =   20
         TabIndex        =   9
         Top             =   1800
         Width           =   1785
      End
      Begin VB.TextBox txtQsje 
         Height          =   315
         Left            =   1110
         MaxLength       =   20
         TabIndex        =   8
         Top             =   1800
         Width           =   1785
      End
      Begin VB.OptionButton optDf 
         Caption         =   "贷方"
         Height          =   285
         Left            =   4410
         TabIndex        =   7
         Top             =   1380
         Width           =   675
      End
      Begin VB.OptionButton optJf 
         Caption         =   "借方"
         Height          =   315
         Left            =   2760
         TabIndex        =   6
         Top             =   1350
         Width           =   705
      End
      Begin VB.OptionButton optNolimit 
         Caption         =   "不限"
         Height          =   255
         Left            =   1080
         TabIndex        =   5
         Top             =   1380
         Value           =   -1  'True
         Width           =   705
      End
      Begin VB.TextBox txtBill 
         Height          =   315
         Left            =   3630
         MaxLength       =   12
         TabIndex        =   4
         Top             =   870
         Width           =   1785
      End
      Begin MSMask.MaskEdBox txtJsrq 
         Height          =   315
         Left            =   3630
         TabIndex        =   2
         Top             =   360
         Width           =   1785
         _ExtentX        =   3149
         _ExtentY        =   556
         _Version        =   393216
         MaxLength       =   10
         Format          =   "yyyy-mm-dd"
         Mask            =   "####-##-##"
         PromptChar      =   "_"
      End
      Begin MSMask.MaskEdBox txtQsrq 
         Height          =   315
         Left            =   1110
         TabIndex        =   1
         Top             =   360
         Width           =   1785
         _ExtentX        =   3149
         _ExtentY        =   556
         _Version        =   393216
         MaxLength       =   10
         Format          =   "yyyy-mm-dd"
         Mask            =   "####-##-##"
         PromptChar      =   "_"
      End
      Begin VB.ComboBox cboJsfs 
         Height          =   300
         Left            =   1110
         Style           =   2  'Dropdown List
         TabIndex        =   3
         Top             =   870
         Width           =   1785
      End
      Begin VB.Label Label7 
         Caption         =   "至"
         Height          =   255
         Left            =   3060
         TabIndex        =   19
         Top             =   1860
         Width           =   405
      End
      Begin VB.Label Label6 
         Caption         =   "金额:"
         Height          =   315
         Left            =   150
         TabIndex        =   18
         Top             =   1800
         Width           =   705
      End
      Begin VB.Label Label5 
         Caption         =   "方向:"
         Height          =   315
         Left            =   150
         TabIndex        =   17
         Top             =   1410
         Width           =   675
      End
      Begin VB.Label Label4 
         Caption         =   "票号:"
         Height          =   255
         Left            =   3060
         TabIndex        =   16
         Top             =   900
         Width           =   585
      End
      Begin VB.Label Label3 
         Caption         =   "结算方式:"
         Height          =   315
         Left            =   150
         TabIndex        =   15
         Top             =   900
         Width           =   945
      End
      Begin VB.Label Label2 
         Caption         =   "至"
         Height          =   255
         Left            =   3060
         TabIndex        =   14
         Top             =   390
         Width           =   345
      End
      Begin VB.Label Label1 
         Caption         =   "日期:"
         Height          =   315
         Left            =   150
         TabIndex        =   13
         Top             =   420
         Width           =   615
      End
   End
End
Attribute VB_Name = "frmYH_Yhcxtj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public IsOk As Boolean
'判断数据合法性。
Private Function IsValidate() As Boolean
    IsValidate = False
    If txtQsrq.text <> "____-__-__" Then
        If Not IsDate(txtQsrq.text) Then
            If Not IsOk Then
                txtQsrq.text = "____-__-__"
            Else
                MsgBox "不合法的日期形式!", vbInformation + vbOKOnly
                txtQsrq.SetFocus
                Exit Function
            End If
        End If
        If txtQsrq.text > "2050-12-31" Or txtQsrq.text < "1990-01-01" Then
            MsgBox "日期范围应在1999-01-01至2050-12-31之间!", vbOKOnly + vbInformation
            txtQsrq.SetFocus
            Exit Function
        End If
    End If
    If txtJsrq.text <> "____-__-__" Then
        If Not IsDate(txtJsrq.text) Then
            If Not IsOk Then
                txtQsrq.text = "____-__-__"
            Else
                MsgBox "不合法的日期形式!", vbInformation + vbOKOnly
                txtJsrq.SetFocus
                Exit Function
            End If
        End If
        If txtJsrq.text > "2050-12-31" Or txtJsrq.text < "1990-01-01" Then
            MsgBox "日期范围应在1999-01-01至2050-12-31之间!", vbOKOnly + vbInformation
            txtJsrq.SetFocus
            Exit Function
        End If
    End If
    If txtQsrq.text <> "____-__-__" And txtJsrq.text <> "____-__-__" Then
        If CDate(txtQsrq.text) > CDate(txtJsrq.text) Then
            MsgBox "起始日期不能大于结束日期", vbInformation + vbOKOnly
            txtQsrq.SetFocus
            Exit Function
        End If
    End If
    If txtQsje.text <> "" And txtJsje.text <> "" Then
        If Val(Format(txtQsje.text, "###0.00")) > Val(Format(txtJsje.text, "###0.00")) Then
            MsgBox "起始金额不能大于截止金额!", vbOKOnly + vbInformation
            txtQsje.SetFocus
            Exit Function
        End If
    End If
    IsValidate = True
End Function


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


Private Sub chkNoFilter_Click()
    If chkNoFilter.Value = 1 Then
        txtQsrq.Enabled = False
        txtJsrq.Enabled = False
        cboJsfs.Enabled = False
        txtBill.Enabled = False
        optNolimit.Enabled = False
        optJf.Enabled = False
        optDf.Enabled = False
        txtQsje.Enabled = False
        txtJsje.Enabled = False
    Else
        txtQsrq.Enabled = True
        txtJsrq.Enabled = True
        cboJsfs.Enabled = True
        txtBill.Enabled = True
        optNolimit.Enabled = True
        optJf.Enabled = True
        optDf.Enabled = True
        txtQsje.Enabled = True
        txtJsje.Enabled = True
    End If
End Sub

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

Private Sub cmdOk_Click()
    IsOk = True
    If chkNoFilter.Value = 1 Then
        Me.Hide
    Else
        If IsValidate Then
            Me.Hide
        End If
    End If
End Sub

Private Sub Form_Activate()
    txtQsrq.SetFocus
End Sub

Private Sub form_load()
    Dim rstTemp As ADODB.Recordset
    Dim sSQL As String
    IsOk = False
    Set rstTemp = New ADODB.Recordset
    rstTemp.CursorLocation = adUseClient
    sSQL = "SELECT * FROM tZW_jsfs" & glo.sOperateYear & " WHERE bEnd =-1"
    rstTemp.Open sSQL, glo.cnnMain, adOpenStatic, adLockReadOnly
    With rstTemp
        If .RecordCount <> 0 Then
            .MoveFirst
            cboJsfs.AddItem ""
            Do Until .EOF
                cboJsfs.AddItem Trim$("" & .Fields("cCode").Value) & " " & Trim$("" & .Fields("cName").Value)
                .MoveNext
            Loop
        End If
    End With
'    cboJsfs.ListIndex = 0
    rstTemp.Close
    Set rstTemp = Nothing
End Sub

Private Sub optDf_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        SendKeys "{tab}"
    End If
End Sub
Private Sub optJf_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        SendKeys "{tab}"
    End If
End Sub

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

Private Sub txtBill_GotFocus()
    txtBill.Alignment = 0
    txtBill.SelStart = 0
    txtBill.SelLength = Len(txtBill.text)
End Sub

Private Sub txtBill_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        SendKeys "{tab}"
    Else
        KeyAscii = NegativeDoubleEnabled(txtJsje, KeyAscii)
    End If
End Sub

Private Sub txtBill_LostFocus()
    txtBill.Alignment = 1
End Sub

Private Sub txtJsje_GotFocus()
    txtJsje.Alignment = 0
    txtJsje.SelStart = 0
    txtJsje.text = Format(txtJsje.text, "###0.00")
    txtJsje.SelLength = Len(txtJsje.text)
End Sub

Private Sub txtJsje_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        SendKeys "{tab}"
    Else
        If Len(txtJsje.text) = 15 And txtJsje.SelLength = 0 Then
            KeyAscii = 0
        Else
            If Len(txtJsje.text) = 12 And KeyAscii <> 8 And KeyAscii <> 10 Then
                If InStr(1, txtJsje.text, ".") = 0 Then
                    KeyAscii = Asc(".")
                End If
            Else
                KeyAscii = NegativeDoubleEnabled(txtJsje, KeyAscii)
            End If
        End If
    End If
End Sub

Private Sub txtJsje_LostFocus()
    txtJsje.Alignment = 1
    txtJsje.text = Format(txtJsje.text, "##,##0.00")
End Sub

Private Sub txtPh_GotFocus()
    txtBill.Alignment = 0
    txtBill.SelStart = 0
    txtBill.SelLength = Len(txtBill.text)
End Sub

Private Sub txtPh_LostFocus()
    txtBill.Alignment = 1
End Sub

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

Private Sub txtQsje_GotFocus()
    txtQsje.Alignment = 0
    txtQsje.SelStart = 0
    txtQsje.text = Format(txtQsje.text, "###0.00")
    txtQsje.SelLength = Len(txtQsje.text)
End Sub

Private Sub txtQsje_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        SendKeys "{tab}"
    Else
        If Len(txtQsje.text) = 15 And txtQsje.SelLength = 0 Then
            KeyAscii = 0
        Else
            If Len(txtQsje.text) = 12 And KeyAscii <> 8 And KeyAscii <> 10 Then
                If InStr(1, txtQsje.text, ".") = 0 Then
                    KeyAscii = Asc(".")
                End If
            Else
                KeyAscii = NegativeDoubleEnabled(txtQsje, KeyAscii)
            End If
        End If
    End If
End Sub

Private Sub txtQsje_LostFocus()
    txtQsje.Alignment = 1
    txtQsje.text = Format(txtQsje.text, "##,##0.00")
End Sub

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

⌨️ 快捷键说明

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