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

📄 frm_clfyzc.frm

📁 行政管理系统VB写的有源代码也有可执行文件,本系统界面美观、操作简单。 程序操作流程清晰
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         EndProperty
      EndProperty
      BorderStyle     =   1
   End
   Begin VB.Label Label9 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Label9"
      Height          =   180
      Left            =   4920
      TabIndex        =   14
      Top             =   4800
      Width           =   540
   End
   Begin VB.Line Line1 
      BorderColor     =   &H00008000&
      X1              =   150
      X2              =   7860
      Y1              =   1680
      Y2              =   1680
   End
   Begin VB.Label Label6 
      Caption         =   "备注"
      Height          =   240
      Left            =   2100
      TabIndex        =   10
      Top             =   1365
      Width           =   690
   End
   Begin VB.Label Label5 
      Caption         =   "经手人"
      Height          =   225
      Left            =   120
      TabIndex        =   7
      Top             =   1320
      Width           =   645
   End
   Begin VB.Label Label4 
      Caption         =   "金额"
      Height          =   180
      Left            =   6285
      TabIndex        =   5
      Top             =   945
      Width           =   450
   End
   Begin VB.Label Label3 
      Caption         =   "费用名称"
      Height          =   210
      Left            =   4260
      TabIndex        =   3
      Top             =   945
      Width           =   1020
   End
   Begin VB.Label Label2 
      Caption         =   "车牌号码"
      Height          =   225
      Left            =   2115
      TabIndex        =   2
      Top             =   945
      Width           =   840
   End
   Begin VB.Label Label1 
      Caption         =   "日期"
      Height          =   210
      Left            =   120
      TabIndex        =   1
      Top             =   945
      Width           =   465
   End
End
Attribute VB_Name = "frm_clfyzc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim c
Dim Strs As String
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
     Text1(1).SetFocus
  End If
End Sub

Private Sub Dgr_Sjll_Click()
   On Error Resume Next
   If Adodc1.Recordset.RecordCount > 0 Then
      DT1.Value = Adodc1.Recordset.Fields(1)
      Combo1.Text = Adodc1.Recordset.Fields(2)
      Text1(1).Text = Adodc1.Recordset.Fields(3)
      Text1(2).Text = Adodc1.Recordset.Fields(4)
      Text1(3).Text = Adodc1.Recordset.Fields(5)
      Text1(4).Text = Adodc1.Recordset.Fields(6)
    End If
End Sub
Private Sub Cbx_bm_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
    Text1(1).SetFocus
  End If
End Sub
Private Sub DT1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
    Combo1.SetFocus
  End If
End Sub

Private Sub Form_Load()
   Call LoadFile
   DT1.Value = Date
   Adodc1.ConnectionString = PublicStr
   Adodc1.RecordSource = "select * from 车辆费用支出管理 order by ID"
   Adodc1.Refresh
      AdoRs.Open "select sum(金额) from 车辆费用支出管理 ", Cnn, adOpenKeyset
           If AdoRs.RecordCount > 0 Then
              Label9.Left = 5535
              Label9.Caption = "支出费用总计金额为 " & AdoRs.Fields(0) & " 元"
           End If
      AdoRs.Close
     Call RefreshData
     Call AddCombo
     Call Tbr_cortrol(Tbr_xxcz, True)
     Tbr_xxcz.Buttons(9).Enabled = False
End Sub

Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
    Adodc1.RecordSource = "select * from 车辆费用支出管理 where 费用名称='" + ListView1.SelectedItem + "'"
    Adodc1.Refresh
    On Error Resume Next
    If Adodc1.Recordset.RecordCount > 0 Then
      DT1.Value = Adodc1.Recordset.Fields(1)
      Combo1.Text = Adodc1.Recordset.Fields(2)
      Text1(1).Text = Adodc1.Recordset.Fields(3)
      Text1(2).Text = Adodc1.Recordset.Fields(4)
      Text1(3).Text = Adodc1.Recordset.Fields(5)
      Text1(4).Text = Adodc1.Recordset.Fields(6)
      Strs = ListView1.SelectedItem
      Tbr_xxcz.Buttons(9).Enabled = True
    End If
    
      AdoRs.Open "select sum(金额) from 车辆费用支出管理 where 费用名称='" + ListView1.SelectedItem + "' ", Cnn, adOpenKeyset
           If AdoRs.RecordCount > 0 Then
              Label9.Left = 4500
              Label9.Caption = ListView1.SelectedItem & " 支出费用总计金额为 " & AdoRs.Fields(0) & " 元"
           End If
      AdoRs.Close

End Sub

Private Sub Tbr_xxcz_ButtonClick(ByVal Button As MSComctlLib.Button)
  Select Case Button.Key
     Case "Add"
         Call Tbr_cortrol(Tbr_xxcz, False)
         
             AdoRs.Open "select * from 车辆费用支出管理 order by ID", Cnn, adOpenKeyset
               If AdoRs.RecordCount > 0 Then
                 AdoRs.MoveLast
                   StrNum = AdoRs.Fields("ID") + 1
               Else
                   StrNum = 1
               End If
             AdoRs.Close

             For i = 1 To 4
                Text1(i).Text = ""
                Text1(i).Locked = False
             Next i
             DT1.SetFocus
     Case "Del"                             '删除信息
         Call Deletes
     Case "Edit"                            '修改信息
         Call Edits
     Case "Save"                            '保存信息
         Call Saves
     Case "DY"                              '打印信息
         Call DY
     Case "Cancel"
         Call Tbr_cortrol(Tbr_xxcz, True)
         For i = 1 To 4
            Text1(i).Locked = True
         Next i
         Call LoadFile
           Combo1.SetFocus
        Tbr_xxcz.Buttons(9).Enabled = False
        Adodc1.RecordSource = "select * from 车辆费用支出管理 order by ID"
        Adodc1.Refresh
           AdoRs.Open "select sum(金额) from 车辆费用支出管理 ", Cnn, adOpenKeyset
                If AdoRs.RecordCount > 0 Then
                   Label9.Left = 5535
                   Label9.Caption = "支出费用总计金额为 " & AdoRs.Fields(0) & " 元"
                End If
           AdoRs.Close
     Case "Exit"
        Unload Me
  End Select
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
  On Error Resume Next
  
  If KeyCode = 38 Then
    If Index = 1 Then
      Combo1.SetFocus
      Exit Sub
    End If
  End If

   If Index < 5 And KeyCode = 38 Then Text1(Index - 1).SetFocus
   If Index >= 0 And KeyCode = 13 Then Text1(Index + 1).SetFocus
   If Index = 4 And KeyCode = 13 Then
      Call Saves
      Exit Sub
   End If
End Sub
Private Sub Saves()     '保存信息的事件过程
  If Combo1.Text = "" Or Text1(1).Text = "" Then
      MsgBox "重要信息不能为空值", 48, "提示信息"
  Else
    If IsNumeric(Text1(2)) Then
       AdoRs.Open "select * from 车辆费用支出管理 where 车牌号码='" + Combo1.Text + "' and 费用名称='" + Text1(1).Text + "'", Cnn, adOpenKeyset
         If AdoRs.RecordCount > 0 Then
              MsgBox "该信息已经存在", 48, "提示信息"
              AdoRs.Close
         Else
              AdoRs.Close
              c = MsgBox("确认保存信息吗?", 33, "提示信息")
              If c = vbOK Then
                Set AdoRs = Cnn.Execute("insert into 车辆费用支出管理 values(" & StrNum & ",'" & STR(DT1.Value) _
                & "','" & Combo1 & "','" & Text1(1) & "'," & Text1(2) & ",'" & Text1(3) & "','" & Text1(4) & "')")
                MsgBox "数据保存成功", 64, "提示信息"
                Call RefreshData
                Adodc1.RecordSource = "select * from 车辆费用支出管理 order by ID"
                Adodc1.Refresh
            Else
            End If
         End If
         Call Tbr_cortrol(Tbr_xxcz, True)
      Else
        MsgBox "输入的金额数值非法", 48, "提示信息"
        Text1(2).Text = ""
        Text1(2).SetFocus
      End If
  End If
End Sub

Private Sub Edits()     '修改信息的事件过程
    c = MsgBox("确认修改信息吗?", 33, "提示信息")
      If c = vbOK Then
          Set AdoRs = Cnn.Execute("UPDATE 车辆费用支出管理 SET 车牌号码='" + Combo1 + "',费用名称='" + Text1(1) + "',金额=" + Text1(2) + ",经手人='" _
          + Text1(3) + "',备注='" + Text1(4) + "',日期='" + STR(DT1.Value) + "' where 车牌号码='" + Combo1.Text + "' and 费用名称='" + Text1(1).Text + "'")
          MsgBox "数据修改成功", 64, "提示信息"
          Call RefreshData
          Adodc1.RecordSource = "select * from 车辆费用支出管理 order by ID"
          Adodc1.Refresh
            StrId = Combo1.Text
            StrTitle = Text1(1).Text
            Call joinRZ
      Else
      End If
End Sub
Private Sub LoadFile()
   On Error Resume Next
   AdoRs.Open "select * from 车辆费用支出管理", Cnn, adOpenKeyset
      If AdoRs.RecordCount > 0 Then
         DT1.Value = AdoRs.Fields(1)
         Combo1.Text = AdoRs.Fields(2)
         Text1(1).Text = AdoRs.Fields(3)
         Text1(2).Text = AdoRs.Fields(4)
         Text1(3).Text = AdoRs.Fields(5)
         Text1(4).Text = AdoRs.Fields(6)
      End If
   AdoRs.Close
End Sub
Private Sub Deletes()                     '删除信息
   c = MsgBox("确认删除该信息吗?", 17, "提示信息")
      If c = vbOK Then
         Set AdoRs = Cnn.Execute("Delete 车辆费用支出管理 from 车辆费用支出管理 where 车牌号码='" + Combo1.Text + "' and 费用名称='" + Text1(1).Text + "'")
         Call RefreshData
         Adodc1.RecordSource = "select * from 车辆费用支出管理 order by ID"
         Adodc1.Refresh
      End If
      For i = 1 To 4
         Text1(i).Text = ""
      Next i
End Sub

Private Sub RefreshData()
   AdoRs.Open "select distinct 费用名称 from 车辆费用支出管理", Cnn, adOpenKeyset
    If AdoRs.RecordCount > 0 Then
      ListView1.ListItems.Clear
      ListView1.Enabled = True
      AdoRs.MoveFirst
          Do While AdoRs.EOF = False
              Key = AdoRs.Fields("费用名称")
              Set itmX = ListView1.ListItems.Add(, , Key, 1)
              AdoRs.MoveNext
          Loop
   Else
      ListView1.Enabled = False
   End If
   AdoRs.Close
End Sub

Private Sub DY()
 On Error Resume Next
   DEV1.rsCom_dhfy.Open "select * from 车辆费用支出管理 where 费用名称='" + Strs + "'"
     If DEV1.rsCom_dhfy.RecordCount > 0 Then
        DRp_clfyzc.Show 1
     Else
        MsgBox "没有符合条件的打印信息", 48, "提示信息"
     End If
End Sub

Private Sub AddCombo()
  AdoRs.Open "select distinct 车牌号码 from 车辆登记", Cnn, adOpenKeyset
    If AdoRs.RecordCount > 0 Then
      AdoRs.MoveFirst
        Do While AdoRs.EOF = False
           Combo1.AddItem (AdoRs.Fields("车牌号码"))
           AdoRs.MoveNext
        Loop
    End If
    AdoRs.Close
End Sub

⌨️ 快捷键说明

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