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

📄 metercreate.frm

📁 适合乡镇供电所使用电费处理系统v3 软件
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Top             =   1680
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "辅 助 号"
         Height          =   180
         Index           =   3
         Left            =   180
         TabIndex        =   4
         Top             =   1320
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "抄 表 码"
         Height          =   180
         Index           =   2
         Left            =   180
         TabIndex        =   3
         Top             =   960
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "多表序号"
         Height          =   180
         Index           =   1
         Left            =   180
         TabIndex        =   2
         Top             =   600
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "用户编码"
         Height          =   180
         Index           =   0
         Left            =   180
         TabIndex        =   1
         Top             =   240
         Width           =   720
      End
   End
End
Attribute VB_Name = "MeterCreate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim JbRec As Recordset
Dim Yhbh As String

Private Sub Combo1_GotFocus(Index As Integer)
    If MonthView1.Visible = True Then
      Text1(6).Text = MonthView1.Value
      MonthView1.Visible = False
      Combo1(0).SetFocus
    End If
    Combo1(Index).BackColor = &HFFC0FF
End Sub

Private Sub Combo1_KeyPress(Index As Integer, KeyAscii As Integer)
    If KeyAscii = 13 Or KeyAscii = 40 Then
      Select Case Index
             Case 0
               Combo1(1).SetFocus
             Case 1
               Text1(7).SetFocus
             Case 2
               Combo1(3).SetFocus
             Case 3
               Combo1(4).SetFocus
             Case 4
               Combo1(5).SetFocus
             Case 5
               Combo1(6).SetFocus
             Case 6
               Combo1(7).SetFocus
             Case 7
               Command1.SetFocus
       End Select
    End If
End Sub

Private Sub Combo1_LostFocus(Index As Integer)
    Combo1(Index).BackColor = &H80000005
End Sub

Private Sub Command1_Click()
    On Error Resume Next
    Dim BiRec As Recordset
    Set BiRec = NdMd.OpenRecordset("select * from 表计档案 where 抄表码='" & ListView2.SelectedItem & "' and 镇村代码='" & UserSeek & "'")
    With BiRec
      If .RecordCount <> 0 Then
        .Edit
        If Text1(4) <> "" Then
          .Fields!局编号码 = Trim(Text1(4))
          ListView2.SelectedItem.SubItems(3) = Trim(Text1(4))
        End If
        If Text1(5) <> "" Then
          .Fields!表位 = Trim(Text1(5))
          ListView2.SelectedItem.SubItems(4) = Trim(Text1(5))
        End If
        If Text1(6) <> "" Then
          .Fields!装表日期 = Trim(Text1(6))
           ListView2.SelectedItem.SubItems(5) = Trim(Text1(6))
        End If
        If Combo1(0) <> "" Then
          .Fields!型号 = Trim(Combo1(0))
           ListView2.SelectedItem.SubItems(6) = Trim(Combo1(0))
        End If
        If Combo1(1) <> "" Then
          .Fields!厂家 = Trim(Combo1(1))
           ListView2.SelectedItem.SubItems(7) = Trim(Combo1(1))
        End If
        If Text1(7) <> "" Then
          .Fields!编号 = Trim(Text1(7))
           ListView2.SelectedItem.SubItems(8) = Trim(Text1(7))
        End If
        If Trim(Combo1(2)) <> "" Then
          .Fields!相数 = Trim(Combo1(2))
           ListView2.SelectedItem.SubItems(9) = Trim(Combo1(2))
        End If
        If Trim(Combo1(3)) <> "" Then
           .Fields!电流 = Trim(Combo1(3))
            ListView2.SelectedItem.SubItems(10) = Trim(Combo1(3))
        End If
        If Trim(Combo1(4)) <> "" Then
          .Fields!电压 = Trim(Combo1(4))
           ListView2.SelectedItem.SubItems(11) = Trim(Combo1(4))
        End If
        If Trim(Combo1(5)) <> "" Then
          .Fields!精度 = Trim(Combo1(5))
           ListView2.SelectedItem.SubItems(12) = Format(Trim(Combo1(5)), "0.00")
        End If
        If Trim(Combo1(6)) <> "" Then
          .Fields!常数 = Trim(Combo1(6))
           ListView2.SelectedItem.SubItems(13) = Trim(Combo1(6))
        End If
        If Trim(Combo1(7)) <> "" Then
          .Fields!性能 = Trim(Combo1(7))
           ListView2.SelectedItem.SubItems(14) = Trim(Combo1(7))
        End If
       .Update
      Else
        .AddNew
        .Fields!镇村代码 = UserSeek
        .Fields!用户编码 = Yhbh
        .Fields!组合编码 = UserSeek & Yhbh
        If Text1(1) <> "" Then .Fields!多表序号 = Trim(Text1(1))
        If Text1(2) <> "" Then .Fields!抄表码 = Trim(Text1(2))
        If Text1(3) <> "" Then .Fields!辅助号 = Trim(Text1(3))
        If Text1(4) <> "" Then
          .Fields!局编号码 = Trim(Text1(4))
          ListView2.SelectedItem.SubItems(3) = Trim(Text1(4))
        End If
        If Text1(5) <> "" Then
          .Fields!表位 = Trim(Text1(5))
          ListView2.SelectedItem.SubItems(4) = Trim(Text1(5))
        End If
        If Text1(6) <> "" Then
          .Fields!装表日期 = Trim(Text1(6))
           ListView2.SelectedItem.SubItems(5) = Trim(Text1(6))
        End If
        If Combo1(0) <> "" Then
          .Fields!型号 = Trim(Combo1(0))
           ListView2.SelectedItem.SubItems(6) = Trim(Combo1(0))
        End If
        If Combo1(1) <> "" Then
          .Fields!厂家 = Trim(Combo1(1))
           ListView2.SelectedItem.SubItems(7) = Trim(Combo1(1))
        End If
        If Text1(7) <> "" Then
          .Fields!编号 = Trim(Text1(7))
           ListView2.SelectedItem.SubItems(8) = Trim(Text1(7))
        End If
        If Trim(Combo1(2)) <> "" Then
          .Fields!相数 = Trim(Combo1(2))
           ListView2.SelectedItem.SubItems(9) = Trim(Combo1(2))
        End If
        If Trim(Combo1(3)) <> "" Then
           .Fields!电流 = Trim(Combo1(3))
            ListView2.SelectedItem.SubItems(10) = Trim(Combo1(3))
        End If
        If Trim(Combo1(4)) <> "" Then
          .Fields!电压 = Trim(Combo1(4))
           ListView2.SelectedItem.SubItems(11) = Trim(Combo1(4))
        End If
        If Trim(Combo1(5)) <> "" Then
          .Fields!精度 = Trim(Combo1(5))
           ListView2.SelectedItem.SubItems(12) = Format(Trim(Combo1(5)), "0.00")
        End If
        If Trim(Combo1(6)) <> "" Then
          .Fields!常数 = Trim(Combo1(6))
           ListView2.SelectedItem.SubItems(13) = Trim(Combo1(6))
        End If
        If Trim(Combo1(7)) <> "" Then
          .Fields!性能 = Trim(Combo1(7))
           ListView2.SelectedItem.SubItems(14) = Trim(Combo1(7))
        End If
        .Update
      End If
    End With
    Dim Item As ListItem, Index As Integer, Cistr As String
    Index = ListView2.SelectedItem.Index
    If ListView2.ListItems.Item(Index + 1) <> "" Then
      If Err = 36500 Then Exit Sub
      Cistr = ListView2.ListItems.Item(Index + 1)
      Set Item = ListView2.FindItem(Cistr, , Index + 1, lvwPartial)
    End If
    If Not (Item Is Nothing) Then
        Set ListView2.SelectedItem = Item
        Call xiansi(ListView2, CStr(Item))
        Item.EnsureVisible
        Text1(4).SetFocus
    End If
End Sub

Private Sub Command2_Click()
    Frame1.Enabled = True
    Command1.Enabled = True
    Text1(4).SetFocus
End Sub

Private Sub Command3_Click()
    On Error Resume Next
    JbRec.Close
    Unload Me
End Sub


Private Sub Form_Load()
    Dim I As Integer
    Dim itm As ListItem
    Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 1 - 1250
    OpenMdb
    Set MdbR = NdMd.OpenRecordset("select 用户编码,用户名称 from 用户电费  where 镇村代码='" & UserSeek & "' and 多表序号='" & 1 & "' order by 用户编码 asc")
    Set JbRec = NdMd.OpenRecordset("select * from 基本数据")
    ListView1.ListItems.Clear
    With ListView1
      While Not MdbR.eof
        Set itm = .ListItems.Add(, , CStr(MdbR.Fields!用户编码))
        If Trim(MdbR.Fields!用户名称) <> "" Then itm.SubItems(1) = MdbR.Fields!用户名称
        MdbR.MoveNext
      Wend
    End With
    For I = 0 To 7
      Call ComFill(I, I + 1)
    Next
    Text1(0).Enabled = False
    Text1(1).Enabled = False
    Text1(2).Enabled = False
    Text1(3).Enabled = False
    Frame1.Enabled = False
    Command2.Enabled = False
    Command1.Enabled = False
    MonthView1.Visible = False
End Sub

Sub ComFill(m As Integer, n As Integer)
    Dim l As Integer
    If JbRec.RecordCount = 0 Then Exit Sub
    JbRec.MoveLast
    JbRec.MoveFirst
    For l = 0 To JbRec.RecordCount - 1
      If JbRec.Fields(Choose(n, "型号", "厂家", "相数", "电流", "电压", "精度", "常数", "性能")) <> "" Then
        Combo1(m).AddItem JbRec.Fields(Choose(n, "型号", "厂家", "相数", "电流", "电压", "精度", "常数", "性能"))
      End If
      JbRec.MoveNext
    Next
End Sub

Sub xiansi(Lis As ListView, cCbm As String)
    If Yhbh <> "" Then
      Text1(0) = Yhbh
    Else
      Text1(0) = ""
    End If
    With Lis.SelectedItem
      Text1(2) = cCbm
      If .SubItems(1) <> "" Then
        Text1(1) = .SubItems(1)
      Else
        Text1(1) = ""
      End If
      If .SubItems(2) <> "" Then
        Text1(3) = .SubItems(2)
      Else
        Text1(3) = ""
      End If
      If .SubItems(3) <> "" Then
        Text1(4) = .SubItems(3)
      Else
        Text1(4) = ""
      End If
      If .SubItems(4) <> "" Then
        Text1(5) = .SubItems(4)
      Else
        Text1(5) = ""
      End If
      If .SubItems(5) <> "" Then
        Text1(6) = .SubItems(5)
      Else
        Text1(6) = ""
      End If
      If .SubItems(6) <> "" Then
        Combo1(0) = .SubItems(6)
      Else
        Combo1(0) = ""
      End If
      If .SubItems(7) <> "" Then
        Combo1(1) = .SubItems(7)
      Else
        Combo1(1) = ""
      End If
      If .SubItems(8) <> "" Then
        Text1(7) = .SubItems(8)
      Else
        Text1(7) = ""
      End If
      If .SubItems(9) <> "" Then
        Combo1(2) = .SubItems(9)
      Else
        Combo1(2) = ""
      End If
      If .SubItems(10) <> "" Then
        Combo1(3) = .SubItems(10)
      Else
        Combo1(3) = ""
      End If
      If .SubItems(11) <> "" Then
        Combo1(4) = .SubItems(11)
      Else
        Combo1(4) = ""
      End If
      If .SubItems(12) <> "" Then
        Combo1(5) = .SubItems(12)
      Else
        Combo1(5) = ""
      End If
      If .SubItems(13) <> "" Then
        Combo1(6) = .SubItems(13)
      Else
        Combo1(6) = ""
      End If
      If .SubItems(14) <> "" Then
        Combo1(7) = .SubItems(14)
      Else
        Combo1(7) = ""
      End If
    End With
End Sub

Private Sub ListView1_Click()
    Frame1.Enabled = False
    Command2.Enabled = False
    Command1.Enabled = False
End Sub

Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
    Dim BjRec As Recordset, DbRec As Recordset
    Dim BjItm As ListItem
    Yhbh = Item
    ListView2.ListItems.Clear
    Set BjRec = NdMd.OpenRecordset("SELECT 用户电费.多表序号,用户电费.抄表码, 用户电费.辅助号 from 用户电费 where 用户编码='" & Item & "' and 镇村代码='" & UserSeek & "'")
    While Not BjRec.eof
       Set BjItm = ListView2.ListItems.Add(, , CStr(BjRec.Fields!抄表码))
       Set DbRec = NdMd.OpenRecordset("select 局编号码,表位,装表日期,型号,厂家,编号,相数,电流,电压,精度,常数,性能 from 表计档案 where 抄表码='" & BjRec.Fields!抄表码 & "'")
       BjItm.SubItems(1) = BjRec.Fields!多表序号
       BjItm.SubItems(2) = BjRec.Fields!辅助号
       With DbRec
         If .RecordCount <> 0 Then
           If Trim(.Fields!局编号码) <> "" Then BjItm.SubItems(3) = DbRec.Fields!局编号码
           If Trim(.Fields!表位) <> "" Then BjItm.SubItems(4) = DbRec.Fields!表位
           If Trim(.Fields!装表日期) <> "" Then BjItm.SubItems(5) = DbRec.Fields!装表日期
           If Trim(.Fields!型号) <> "" Then BjItm.SubItems(6) = DbRec.Fields!型号
           If Trim(.Fields!厂家) <> "" Then BjItm.SubItems(7) = DbRec.Fields!厂家
           If Trim(.Fields!编号) <> "" Then BjItm.SubItems(8) = DbRec.Fields!编号
           If Trim(.Fields!相数) <> "" Then BjItm.SubItems(9) = DbRec.Fields!相数
           If Trim(.Fields!电流) <> "" Then BjItm.SubItems(10) = DbRec.Fields!电流
           If Trim(.Fields!电压) <> "" Then BjItm.SubItems(11) = DbRec.Fields!电压
           If Trim(.Fields!精度) <> "" Then BjItm.SubItems(12) = Format(DbRec.Fields!精度, "0.00")
           If Trim(.Fields!常数) <> "" Then BjItm.SubItems(13) = DbRec.Fields!常数
           If Trim(.Fields!性能) <> "" Then BjItm.SubItems(14) = DbRec.Fields!性能
         End If
       End With
       BjRec.MoveNext
    Wend
End Sub
Private Sub ListView2_Click()
    If Trim(Text1(2)) <> "" Then Command2.Enabled = True
End Sub

Private Sub ListView2_ItemClick(ByVal Item As MSComctlLib.ListItem)
    Call xiansi(ListView2, CStr(Item))
End Sub

Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
    Text1(6).Text = MonthView1.Value
    MonthView1.Visible = False
    Combo1(0).SetFocus
End Sub

Private Sub Text1_GotFocus(Index As Integer)
    If Index = 6 Then
      MonthView1.Visible = True
    End If
    If MonthView1.Visible = True And Index <> 6 Then
      Text1(6).Text = MonthView1.Value
      MonthView1.Visible = False
    End If
    Text1(Index).BackColor = &HFFC0FF
End Sub

Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
    If KeyAscii = 13 Or KeyAscii = 40 Then
      Select Case Index
             Case 4
               Text1(5).SetFocus
             Case 5
               Text1(6).SetFocus
             Case 6
               Combo1(0).SetFocus
             Case 7
               Combo1(2).SetFocus
       End Select
    End If
End Sub

Private Sub Text1_LostFocus(Index As Integer)
    Text1(Index).BackColor = &H80000005
End Sub

⌨️ 快捷键说明

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