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

📄 frm_bxfy.frm

📁 很好的行政管理系统,供大家享用,功能非常强大,希望大家的支持
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      BackStyle       =   0  'Transparent
      Height          =   180
      Left            =   4920
      TabIndex        =   18
      Top             =   4800
      Width           =   90
   End
   Begin VB.Line Line1 
      BorderColor     =   &H00008000&
      X1              =   150
      X2              =   7860
      Y1              =   1680
      Y2              =   1680
   End
   Begin VB.Label Label8 
      Caption         =   "备注"
      Height          =   210
      Left            =   5535
      TabIndex        =   13
      Top             =   1320
      Width           =   405
   End
   Begin VB.Label Label7 
      Caption         =   "审核人"
      Height          =   225
      Left            =   4020
      TabIndex        =   12
      Top             =   1335
      Width           =   555
   End
   Begin VB.Label Label6 
      Caption         =   "经手人"
      Height          =   240
      Left            =   2085
      TabIndex        =   11
      Top             =   1350
      Width           =   690
   End
   Begin VB.Label Label5 
      Caption         =   "部门"
      Height          =   225
      Left            =   150
      TabIndex        =   8
      Top             =   1335
      Width           =   450
   End
   Begin VB.Label Label4 
      Caption         =   "金额"
      Height          =   255
      Left            =   6000
      TabIndex        =   6
      Top             =   945
      Width           =   720
   End
   Begin VB.Label Label3 
      Caption         =   "时间"
      Height          =   210
      Left            =   4185
      TabIndex        =   4
      Top             =   930
      Width           =   525
   End
   Begin VB.Label Label2 
      Caption         =   "费用类型"
      Height          =   225
      Left            =   2085
      TabIndex        =   2
      Top             =   945
      Width           =   840
   End
   Begin VB.Label Label1 
      Caption         =   "费用名称"
      Height          =   210
      Left            =   135
      TabIndex        =   0
      Top             =   945
      Width           =   765
   End
End
Attribute VB_Name = "frm_bxfy"
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 Dgr_Sjll_Click()
'   On Error Resume Next
   If Adodc1.Recordset.RecordCount > 0 Then
      Text1(0).Text = Adodc1.Recordset.Fields(1)
      Cbx_lx.Text = Adodc1.Recordset.Fields(2)
      DT1.Value = Adodc1.Recordset.Fields(3)
      Text1(1).Text = Adodc1.Recordset.Fields(4)
      Cbx_bm.Text = Adodc1.Recordset.Fields(5)
      Text1(2).Text = Adodc1.Recordset.Fields(6)
      Text1(3).Text = Adodc1.Recordset.Fields(7)
      Text1(4).Text = Adodc1.Recordset.Fields(8)
         If Text1(3).Text = "" Then
             Tbr_xxcz.Buttons(12).Enabled = True
         Else
             Tbr_xxcz.Buttons(12).Enabled = False
         End If
    End If
End Sub
Private Sub Cbx_bm_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
    Text1(2).SetFocus
  End If
End Sub
Private Sub Cbx_lx_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
    DT1.SetFocus
  End If
End Sub
Private Sub DT1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
    Text1(1).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
     Call Tj              '统计费用金额
     Call RefreshData
     Call Tbr_cortrol(Tbr_xxcz, True)
     Tbr_xxcz.Buttons(12).Enabled = False
     Tbr_xxcz.Buttons(9).Enabled = False
End Sub

Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
    Adodc1.RecordSource = "select * from 报销费用管理 where 部门='" + ListView1.SelectedItem + "' order by ID"
    Adodc1.Refresh
    On Error Resume Next
    If Adodc1.Recordset.RecordCount > 0 Then
      Text1(0).Text = Adodc1.Recordset.Fields(1)
      Cbx_lx.Text = Adodc1.Recordset.Fields(2)
      DT1.Value = Adodc1.Recordset.Fields(3)
      Text1(1).Text = Adodc1.Recordset.Fields(4)
      Cbx_bm.Text = Adodc1.Recordset.Fields(5)
      Text1(2).Text = Adodc1.Recordset.Fields(6)
      Text1(3).Text = Adodc1.Recordset.Fields(7)
      Text1(4).Text = Adodc1.Recordset.Fields(8)
      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 = 4700
            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
             Tbr_xxcz.Buttons(12).Enabled = False
             For i = 0 To 4
                Text1(i).Text = ""
                Text1(i).Locked = False
             Next i
             Cbx_lx.Text = ""
             Cbx_bm.Text = ""
             Text1(0).SetFocus
     Case "Del"                             '删除信息
         Call Deletes
     Case "Edit"                            '修改信息
         Call Edits
     Case "Save"                            '保存信息
         Call Saves
     Case "Cancel"
         Call Tbr_cortrol(Tbr_xxcz, True)
         Call LoadFile
           Text1(0).SetFocus
        Adodc1.RecordSource = "select * from 报销费用管理 order by ID"
        Adodc1.Refresh
        Call Tj
        For i = 0 To 4
          Text1(i).Locked = True
        Next i
     Case "DY"
        Call DY
     Case "SH"
        Call SH                              '审核信息
     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 = 13 Then
    If Index = 0 Then
      Cbx_lx.SetFocus
      Exit Sub
    ElseIf Index = 1 Then
      Cbx_bm.SetFocus
      Exit Sub
    ElseIf Index = 2 Then
      Text1(4).SetFocus
      Exit Sub
    End If
  End If
  
  If KeyCode = 38 Then
    If Index = 2 Then
      Cbx_bm.SetFocus
      Exit Sub
    ElseIf Index = 1 Then
      DT1.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()     '保存信息的事件过程
   On Error Resume Next
   If Text1(0).Text = "" Or Text1(2).Text = "" Then
      MsgBox "重要信息不能为空值", 48, "提示信息"
   Else
      If IsNumeric(Text1(1)) Then
        AdoRs.Open "select * from 报销费用管理 where 名称='" + Text1(0).Text + "' and 部门='" + Cbx_bm.Text + "' and 时间='" + STR(DT1.Value) + "'", Cnn, adOpenKeyset
          If AdoRs.RecordCount > 0 Then
                MsgBox "该信息已经存在", 48, "提示信息"
                AdoRs.Close
           Else
              c = MsgBox("确认保存信息吗?", 33, "提示信息")
              If c = vbOK Then
                 Set AdoRs = Cnn.Execute("insert into 报销费用管理 values(" & StrNum & ",'" & Text1(0) _
                 & "','" & Cbx_lx & "','" & STR(DT1.Value) & "'," & Text1(1) & ",'" & Cbx_bm & "','" & Text1(2) & "','','" & Text1(4) & "',' ',' ')")
                 MsgBox "数据保存成功", 64, "提示信息"
                 Call RefreshData
                 Adodc1.RecordSource = "select * from 报销费用管理 order by ID"
                 Adodc1.Refresh
              End If
             Call Tbr_cortrol(Tbr_xxcz, True)
           End If
        AdoRs.Close
      Else
        MsgBox "输入的金额数值非法", 48, "提示信息"
        Text1(1).Text = ""
        Text1(1).SetFocus
      End If
   End If
End Sub

Private Sub Edits()     '修改信息的事件过程
    c = MsgBox("确认修改信息吗?", 33, "提示信息")
      If c = vbOK Then
          Set AdoRs = Cnn.Execute("UPDATE 报销费用管理 SET 名称='" + Text1(0) + "',类型='" + Cbx_lx + "',时间='" + STR(DT1.Value) + "',金额=" _
          + Text1(1) + ",部门='" + Cbx_bm + "',经手人='" + Text1(2) + "',审核人='" + Text1(3) + "',备注='" + Text1(4) + "',记录修改日期='" + STR(Date) + "',记录修改人='" + Name1 + "' where 名称='" + Text1(0).Text + "' and 时间='" + STR(DT1.Value) + "'")
          MsgBox "数据修改成功", 64, "提示信息"
          Call RefreshData
          Adodc1.RecordSource = "select * from 报销费用管理 order by ID"
          Adodc1.Refresh
            StrId = Text1(0).Text
            StrTitle = Cbx_bm.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
        Text1(0).Text = AdoRs.Fields(1)
        Cbx_lx.Text = AdoRs.Fields(2)
        DT1.Value = AdoRs.Fields(3)
        Text1(1).Text = AdoRs.Fields(4)
        Cbx_bm.Text = AdoRs.Fields(5)
        Text1(2).Text = AdoRs.Fields(6)
        Text1(3).Text = AdoRs.Fields(7)
        Text1(4).Text = AdoRs.Fields(8)
      End If
   AdoRs.Close
End Sub
Private Sub Deletes()                     '删除信息
   c = MsgBox("确认删除该信息吗?", 17, "提示信息")
      If c = vbOK Then
         Set AdoRs = Cnn.Execute("Delete 报销费用管理 from 报销费用管理 where 名称='" + Text1(0).Text + "' and 时间='" + STR(DT1.Value) + "'")
         Call RefreshData
         Adodc1.RecordSource = "select * from 报销费用管理 order by ID"
         Adodc1.Refresh
      End If
      For i = 0 To 4
         Text1(i).Text = ""
      Next i
        Cbx_lx.Text = ""
        Cbx_bm.Text = ""
End Sub

Private Sub RefreshData()
   AdoRs.Open "select distinct 部门 from 报销费用管理", Cnn, adOpenKeyset
    If AdoRs.RecordCount > 0 Then
      AdoRs.MoveFirst
      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 Tj()
   AdoRs.Open "select sum(金额) from 报销费用管理 ", Cnn, adOpenKeyset
     If AdoRs.RecordCount > 0 Then
        Label9.Left = 5300
        Label9.Caption = "报销费用总计金额为 " & AdoRs.Fields(0) & " 元"
     End If
   AdoRs.Close
End Sub

Private Sub SH()     '审核信息的事件过程
    c = MsgBox("确认审核该信息吗?", 33, "提示信息")
      If c = vbOK Then
          Set AdoRs = Cnn.Execute("UPDATE 报销费用管理 SET 审核人='" + Text1(3) + "' where 名称='" + Text1(0).Text + "' and 时间='" + STR(DT1.Value) + "' and 部门='" + Cbx_bm + "'")
          MsgBox "记录审核成功", 64, "提示信息"
          Call RefreshData
          Adodc1.RecordSource = "select * from 报销费用管理 order by ID"
          Adodc1.Refresh
      Else
      End If
End Sub

Private Sub DY()
' On Error Resume Next
   DEV1.rsCom_bxfy.Open "select * from 报销费用管理 where 部门='" + Strs + "'"
     If DEV1.rsCom_bxfy.RecordCount > 0 Then
        DRp_bxfy.Show 1
     Else
        MsgBox "没有符合条件的打印信息", 48, "提示信息"
     End If
End Sub

⌨️ 快捷键说明

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