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

📄 电费管理.frm

📁 小区物业管理系统vb开发的,曾用于本科毕业设计
💻 FRM
📖 第 1 页 / 共 2 页
字号:
   Begin CSCommand.Command Cmdsave 
      Height          =   375
      Left            =   6960
      TabIndex        =   4
      Top             =   1920
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   661
      Icon            =   "电费管理.frx":5683
      Caption         =   "  保存"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin CSCommand.Command Cmdadd 
      Height          =   375
      Left            =   6960
      TabIndex        =   5
      Top             =   1200
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   661
      Icon            =   "电费管理.frx":738D
      Caption         =   "  添加"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin MSDataGridLib.DataGrid DataGrid1 
      Bindings        =   "电费管理.frx":81DF
      Height          =   2055
      Left            =   0
      TabIndex        =   19
      Top             =   3480
      Width           =   8295
      _ExtentX        =   14631
      _ExtentY        =   3625
      _Version        =   393216
      AllowUpdate     =   0   'False
      BackColor       =   16777215
      ForeColor       =   16711680
      HeadLines       =   1
      RowHeight       =   15
      FormatLocked    =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   7
      BeginProperty Column00 
         DataField       =   "大楼名称"
         Caption         =   "大楼名称"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   "房号"
         Caption         =   "房号"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column02 
         DataField       =   "前月抄表日期"
         Caption         =   "前月抄表日期"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column03 
         DataField       =   "前月抄表数据"
         Caption         =   "前月抄表数据"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column04 
         DataField       =   "本月抄表日期"
         Caption         =   "本月抄表日期"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column05 
         DataField       =   "本月抄表数据"
         Caption         =   "本月抄表数据"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column06 
         DataField       =   "实际用电量"
         Caption         =   "实际用电量"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
            ColumnWidth     =   929.764
         EndProperty
         BeginProperty Column01 
            ColumnWidth     =   569.764
         EndProperty
         BeginProperty Column02 
            ColumnWidth     =   1260.284
         EndProperty
         BeginProperty Column03 
            ColumnWidth     =   1244.976
         EndProperty
         BeginProperty Column04 
            ColumnWidth     =   1335.118
         EndProperty
         BeginProperty Column05 
            ColumnWidth     =   1365.165
         EndProperty
         BeginProperty Column06 
            ColumnWidth     =   1365.165
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "电费管理"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim objcn As Connection
Dim objhome As Recordset
Dim objlight As Recordset
Dim isadding As Boolean
'添加记录状态
Private Sub Cmdadd_Click()
Cmbroom.Clear
If isadding = False Then
   Adodc1.Caption = "添加新记录"
   isadding = True
   Adodc1.Recordset.AddNew
   Combo1.Enabled = True
   Cmbroom.Enabled = True
   Combo2.Enabled = True
   DTP1.Enabled = True
   Text3.Enabled = True
   DTP2.Enabled = True
   Text5.Enabled = True
   Text6.Enabled = True
Else
   MsgBox "已是添加记录状态!", vbInformation, "温馨提示"
End If
End Sub

Private Sub Cmddelect_Click()
If isadding = True Then
MsgBox "当前状态为添加记录,不能删除记录", , "温馨提示"
Adodc1.Recordset.CancelBatch
'Adodc1.Recordset.Requery
Adodc1.Refresh
Else
    If MsgBox("是否要删除当前记录?", vbYesNo + vbQuestion, "温馨提示") = vbYes Then
     Adodc1.Recordset.Delete
     Adodc1.Recordset.Requery
  End If
End If
End Sub

Private Sub Cmdexit_Click()
物业管理系统.Show
Unload Me
End Sub

'保存用电信息
Private Sub Cmdsave_Click()
If isadding = False Then
   MsgBox "此状态不允许添加记录!", vbCritical, "温馨提示"
   Exit Sub
End If
If Trim(Combo1.Text) = "" Or Trim(Cmbroom.Text) = "" Then
    MsgBox "请输入数据!", vbInformation, "温馨提示"
Else
  With objlight
  If .RecordCount > 0 Then
     .MoveFirst
     .Find "房号='" & Trim(Cmbroom.Text) & "'"
     If Not .EOF Then
        If Trim(Cmbroom.Text) = Trim(.Fields("房号")) Then
           MsgBox "此用户数据已记录!", vbInformation, "温馨提示"
           Adodc1.Recordset.CancelBatch
         End If
     Else
           If isadding Then
              .AddNew
              .Fields("大楼名称") = Trim(Combo1.Text)
              .Fields("房号") = Trim(Cmbroom.Text)
              .Fields("仪表名称") = Trim(Combo2.Text)
              .Fields("前月抄表日期") = Trim(DTP1.Value)
              .Fields("前月抄表数据") = Trim(Text3.Text)
              .Fields("本月抄表日期") = Trim(DTP2.Value)
              .Fields("本月抄表数据") = Trim(Text5.Text)
              .Fields("实际用电量") = Trim(Text6.Text)
              .Update
               MsgBox "录入数据成功!", , "温馨提示"
              isadding = False
            End If
      End If
    Combo1.Enabled = False
    Cmbroom.Enabled = False
    Combo2.Enabled = False
    DTP1.Enabled = False             '前月抄表日期
    Text3.Enabled = False
    DTP2.Enabled = False             '本月抄表日期
    Text5.Enabled = False
    Text6.Enabled = False

    Adodc1.Refresh
    Adodc1.Caption = "当前记录:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCount
 
   End If
 End With
End If
End Sub

Private Sub Combo1_Click()
'获取楼房区信息
 Set objhome = New Recordset
 With objhome
      Set .ActiveConnection = objcn
          .CursorLocation = adUseClient
          .CursorType = adOpenStatic
          .LockType = adLockOptimistic
          .Open "select * from " & Trim(Combo1.Text)
          'Set .ActiveConnection = Nothing                  '断开数据库联接
End With
With objhome
     If .RecordCount > 0 Then
        .MoveFirst
        While Not .EOF
              Cmbroom.AddItem .Fields("房号")
              .MoveNext
        Wend
     End If
End With
'获取电费信息数据
    Set objlight = New Recordset
    With objlight
         Set .ActiveConnection = objcn
             .CursorLocation = adUseClient
             .CursorType = adOpenStatic
             .LockType = adLockOptimistic
             .Open "select * from 电表信息 where 大楼名称='" & Trim(Combo1.Text) & "'"  '获取某栋大楼信息
    End With
End Sub

'计算容量
Private Sub Command1_Click()
If Text3.Text = "" Or Text5.Text = "" Then
   MsgBox "请输入用电量", vbInformation, "温馨提示"
   Text3.SetFocus
Else
   If CInt(CInt(Text5) < CInt(Text3)) Then
      MsgBox "数据输入有误" & vbCrLf & "请重新输入", vbCritical, "温馨提示"
      Text3.Text = ""
      Text5.Text = ""
      Text3.SetFocus
    Else
      Text6 = CInt(CInt(Text5) - CInt(Text3))
    End If
End If
End Sub
'返回主窗体
Private Sub Cmdback_Click()

End Sub

'放弃添加记录
Private Sub Command2_Click()
If MsgBox("是否放弃添加记录?", vbYesNo + vbQuestion, "温馨提示") = vbYes Then
   isadding = False
   Adodc1.Recordset.CancelBatch                   '恢复到更改以前的操作
   Adodc1.Recordset.Requery                       '回到第一条记录状态
   Adodc1.Caption = "当前记录:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCount
   Combo1.Enabled = False
   Combo2.Enabled = False
   Cmbroom.Enabled = False
   DTP1.Enabled = False
   DTP2.Enabled = False
   Text3.Enabled = False
   Text5.Enabled = False
   Text6.Enabled = False
End If
End Sub

Private Sub Form_Load()
 '建立数据库联接
    Set objcn = New Connection                 '实例化联接对象
    With objcn                                 '建立数据库联接
        .Provider = "SQLOLEDB"
        .ConnectionString = "User ID=sa;PWD=sa;Data Source=(local);" & _
                            "Initial Catalog=物业管理系统"
        .Open
    End With

 Adodc1.Caption = "当前记录:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCount

End Sub



⌨️ 快捷键说明

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