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

📄 frm_dhfy.frm

📁 很好的行政管理系统,供大家享用,功能非常强大,希望大家的支持
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      EndProperty
      BorderStyle     =   1
   End
   Begin VB.Label Label9 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Label9"
      Height          =   180
      Left            =   4920
      TabIndex        =   19
      Top             =   4800
      Width           =   540
   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        =   14
      Top             =   1350
      Width           =   405
   End
   Begin VB.Label Label7 
      Caption         =   "金额"
      Height          =   225
      Left            =   4185
      TabIndex        =   12
      Top             =   1335
      Width           =   480
   End
   Begin VB.Label Label6 
      Caption         =   "月份"
      Height          =   240
      Left            =   2055
      TabIndex        =   11
      Top             =   1365
      Width           =   690
   End
   Begin VB.Label Label5 
      Caption         =   "年份"
      Height          =   225
      Left            =   120
      TabIndex        =   8
      Top             =   1305
      Width           =   450
   End
   Begin VB.Label Label4 
      Caption         =   "使用人"
      Height          =   255
      Left            =   6000
      TabIndex        =   6
      Top             =   960
      Width           =   720
   End
   Begin VB.Label Label3 
      Caption         =   "部门"
      Height          =   210
      Left            =   4185
      TabIndex        =   4
      Top             =   945
      Width           =   525
   End
   Begin VB.Label Label2 
      Caption         =   "电话类型"
      Height          =   225
      Left            =   2070
      TabIndex        =   2
      Top             =   945
      Width           =   840
   End
   Begin VB.Label Label1 
      Caption         =   "电话号码"
      Height          =   210
      Left            =   105
      TabIndex        =   0
      Top             =   945
      Width           =   810
   End
End
Attribute VB_Name = "frm_dhfy"
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)
      Cbx_bm.Text = Adodc1.Recordset.Fields(3)
      Text1(1).Text = Adodc1.Recordset.Fields(4)
      Text1(2).Text = Adodc1.Recordset.Fields(5)
      Text1(3).Text = Adodc1.Recordset.Fields(6)
      Text1(4).Text = Adodc1.Recordset.Fields(7)
      Text1(5).Text = Adodc1.Recordset.Fields(8)
    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 Cbx_lx_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
    Cbx_bm.SetFocus
  End If
End Sub

Private Sub DataGrid1_Click()

End Sub

Private Sub Form_Load()
   Call LoadFile
   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 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 + "' 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)
      Cbx_bm.Text = Adodc1.Recordset.Fields(3)
      Text1(1).Text = Adodc1.Recordset.Fields(4)
      Text1(2).Text = Adodc1.Recordset.Fields(5)
      Text1(3).Text = Adodc1.Recordset.Fields(6)
      Text1(4).Text = Adodc1.Recordset.Fields(7)
      Text1(5).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 = 4920
              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 = 0 To 5
                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 "DY"                              '打印信息
         Call DY
     Case "Cancel"
         Call Tbr_cortrol(Tbr_xxcz, True)
         Call LoadFile
         For i = 0 To 5
            Text1(i).Locked = True
         Next i
           Text1(0).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 = 13 Then
    If Index = 0 Then
      Cbx_lx.SetFocus
      Exit Sub
    End If
  End If
  
  If KeyCode = 38 Then
    If Index = 1 Then
      Cbx_bm.SetFocus
      Exit Sub
    End If
  End If

   If Index < 6 And KeyCode = 38 Then Text1(Index - 1).SetFocus
   If Index >= 0 And KeyCode = 13 Then Text1(Index + 1).SetFocus
   If Index = 5 And KeyCode = 13 Then
      Call Saves
   End If
End Sub
Private Sub Saves()     '保存信息的事件过程
   If Text1(0).Text = "" Or Text1(1).Text = "" Then
      MsgBox "重要信息不能为空值", 48, "提示信息"
   Else
    If IsNumeric(Text1(4)) Then
       AdoRs.Open "select * from 电话费用 where 电话号码='" + Text1(0).Text + "' and 部门='" + Cbx_bm.Text + "' and 年份='" + Text1(2).Text + "' and 月份='" + Text1(3).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 & ",'" & Text1(0) _
                & "','" & Cbx_lx & "','" & Cbx_bm & "','" & Text1(1) & "','" & Text1(2) & "','" & Text1(3) & "'," & Text1(4) & ",'" & Text1(5) & "',' ',' ')")
                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(4).Text = ""
        Text1(4).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 + "',部门='" + Cbx_bm + "',使用人='" _
          + Text1(1) + "',年份='" + Text1(2) + "',月份='" + Text1(3) + "',金额=" + Text1(4) + ",备注='" + Text1(5) + "',记录修改日期='" + STR(Date) + "',记录修改人='" + Name1 + "' where 电话号码='" + Text1(0).Text + "' and 月份='" + Text1(3).Text + "'")
          MsgBox "数据修改成功", 64, "提示信息"
          Call RefreshData
          Adodc1.RecordSource = "select * from 电话费用 order by ID"
          Adodc1.Refresh
            StrId = Text1(0).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
        Text1(0).Text = AdoRs.Fields(1)
        Cbx_lx.Text = AdoRs.Fields(2)
        Cbx_bm.Text = AdoRs.Fields(3)
        Text1(1).Text = AdoRs.Fields(4)
        Text1(2).Text = AdoRs.Fields(5)
        Text1(3).Text = AdoRs.Fields(6)
        Text1(4).Text = AdoRs.Fields(7)
        Text1(5).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 月份='" + Text1(3).Text + "'")
         Call RefreshData
         Adodc1.RecordSource = "select * from 电话费用 order by ID"
         Adodc1.Refresh
      End If
      For i = 0 To 5
         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 DY()
 On Error Resume Next
   DEV1.rsCom_dhfy.Open "select * from 电话费用 where 部门='" + Strs + "'"
     If DEV1.rsCom_dhfy.RecordCount > 0 Then
        DRp_dhfy.Show 1
     Else
        MsgBox "没有符合条件的打印信息", 48, "提示信息"
     End If
End Sub

⌨️ 快捷键说明

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