frmCilent.frm
上传用户:yexiandon
上传日期:2022-07-12
资源大小:895k
文件大小:32k
- VERSION 5.00
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Begin VB.Form frmCilent
- Caption = "维修车辆信息"
- ClientHeight = 5805
- ClientLeft = 2520
- ClientTop = 5190
- ClientWidth = 15240
- Icon = "frmCilent.frx":0000
- LinkTopic = "Form1"
- MDIChild = -1 'True
- ScaleHeight = 5805
- ScaleWidth = 15240
- WindowState = 2 'Maximized
- Begin MSComctlLib.ImageList ImageList1
- Left = 13560
- Top = 1320
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 32
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":08CA
- Key = "A2"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":11A4
- Key = "A1"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":1C6E
- Key = "A0"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":2548
- Key = ""
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":30F2
- Key = ""
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":368C
- Key = ""
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":3C26
- Key = ""
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":41C0
- Key = "gb"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":4D0A
- Key = ""
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":A92C
- Key = ""
- EndProperty
- BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":AEC6
- Key = ""
- EndProperty
- BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":B020
- Key = ""
- EndProperty
- BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":B17A
- Key = ""
- EndProperty
- BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":B2D4
- Key = "f5"
- EndProperty
- BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":B42E
- Key = ""
- EndProperty
- BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":B588
- Key = "del"
- EndProperty
- BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":B6E2
- Key = "cz"
- EndProperty
- BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":B83C
- Key = ""
- EndProperty
- BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":B996
- Key = "new"
- EndProperty
- BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":BF30
- Key = "view"
- EndProperty
- BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":C4CA
- Key = ""
- EndProperty
- BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":CA64
- Key = "save"
- EndProperty
- BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":CFFE
- Key = "cute"
- EndProperty
- BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":D598
- Key = "copy"
- EndProperty
- BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":DB32
- Key = "paste"
- EndProperty
- BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":E0CC
- Key = "xg"
- EndProperty
- BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":E666
- Key = "serch"
- EndProperty
- BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":EC00
- Key = "info"
- EndProperty
- BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":F19A
- Key = ""
- EndProperty
- BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":F734
- Key = ""
- EndProperty
- BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":FCCE
- Key = ""
- EndProperty
- BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":10268
- Key = "exit"
- EndProperty
- EndProperty
- End
- Begin VB.PictureBox picSplitter
- BackColor = &H00808080&
- BorderStyle = 0 'None
- FillColor = &H00808080&
- Height = 4800
- Left = 2040
- ScaleHeight = 2090.126
- ScaleMode = 0 'User
- ScaleWidth = 780
- TabIndex = 6
- Top = 945
- Visible = 0 'False
- Width = 72
- End
- Begin MSComctlLib.TreeView tvTreeView
- Height = 4800
- Left = 0
- TabIndex = 5
- Top = 945
- Width = 2010
- _ExtentX = 3545
- _ExtentY = 8467
- _Version = 393217
- HideSelection = 0 'False
- Indentation = 529
- LabelEdit = 1
- Style = 7
- HotTracking = -1 'True
- SingleSel = -1 'True
- ImageList = "ImageList1"
- Appearance = 1
- End
- Begin MSComctlLib.ListView lvListView
- Height = 4800
- Left = 2055
- TabIndex = 4
- Top = 945
- Width = 13770
- _ExtentX = 24289
- _ExtentY = 8467
- View = 3
- LabelEdit = 1
- LabelWrap = 0 'False
- HideSelection = 0 'False
- FullRowSelect = -1 'True
- _Version = 393217
- Icons = "imlViewBIcon"
- SmallIcons = "imlViewSIcon"
- ColHdrIcons = "imlViewSIcon"
- ForeColor = -2147483640
- BackColor = -2147483643
- BorderStyle = 1
- Appearance = 1
- NumItems = 0
- End
- Begin VB.PictureBox picTitles
- Align = 1 'Align Top
- Appearance = 0 'Flat
- BorderStyle = 0 'None
- ForeColor = &H80000008&
- Height = 300
- Left = 0
- ScaleHeight = 300
- ScaleWidth = 15240
- TabIndex = 1
- TabStop = 0 'False
- Top = 585
- Width = 15240
- Begin VB.Label lblTitle
- BorderStyle = 1 'Fixed Single
- Caption = " 列表视图:"
- Height = 270
- Index = 1
- Left = 2078
- TabIndex = 3
- Tag = " 列表视图:"
- Top = 12
- Width = 3216
- End
- Begin VB.Label lblTitle
- BorderStyle = 1 'Fixed Single
- Caption = " 状态类别:"
- Height = 270
- Index = 0
- Left = 0
- TabIndex = 2
- Tag = " 树形视图:"
- Top = 12
- Width = 2016
- End
- End
- Begin MSComctlLib.Toolbar tbToolBar
- Align = 1 'Align Top
- Height = 585
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 15240
- _ExtentX = 26882
- _ExtentY = 1032
- ButtonWidth = 820
- ButtonHeight = 979
- Appearance = 1
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 12
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "新增"
- Key = "new"
- ImageKey = "new"
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "修改"
- Key = "modi"
- ImageKey = "xg"
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "删除"
- Key = "del"
- ImageKey = "del"
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "查看"
- Key = "info"
- ImageKey = "info"
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "新增"
- Key = "news"
- ImageKey = "new"
- EndProperty
- BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "修改"
- Key = "modis"
- ImageKey = "xg"
- EndProperty
- BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "删除"
- Key = "dels"
- ImageKey = "del"
- EndProperty
- BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "查看"
- Key = "infos"
- ImageKey = "info"
- EndProperty
- BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "图标"
- Key = "view"
- ImageKey = "view"
- Style = 5
- BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628}
- NumButtonMenus = 5
- BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628}
- Key = "dtb"
- Text = "大图标"
- EndProperty
- BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628}
- Key = "xtb"
- Text = "小图标"
- EndProperty
- BeginProperty ButtonMenu3 {66833FEE-8583-11D1-B16A-00C0F0283628}
- Key = "lb"
- Text = "列表"
- EndProperty
- BeginProperty ButtonMenu4 {66833FEE-8583-11D1-B16A-00C0F0283628}
- Key = "xxzl"
- Text = "详细资料"
- EndProperty
- BeginProperty ButtonMenu5 {66833FEE-8583-11D1-B16A-00C0F0283628}
- EndProperty
- EndProperty
- EndProperty
- BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "关闭"
- Key = "exit"
- ImageKey = "exit"
- EndProperty
- EndProperty
- End
- Begin MSComDlg.CommonDialog dlgCommonDialog
- Left = 13560
- Top = 2040
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- End
- Begin MSComctlLib.ImageList imlViewBIcon
- Left = 600
- Top = 0
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 32
- ImageHeight = 32
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 17
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":10642
- Key = "boy"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":10A94
- Key = "girl"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":10EE6
- Key = "bboy1"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":11F3A
- Key = "bgirl"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":12F8E
- Key = "group"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":15740
- Key = "add"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":15B92
- Key = "modify2"
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":15FE4
- Key = "modify"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":162FE
- Key = "del"
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":16458
- Key = "info"
- EndProperty
- BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":169F2
- Key = "info2"
- EndProperty
- BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":18CA4
- Key = "search"
- EndProperty
- BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":1923E
- Key = "warn"
- EndProperty
- BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":195D8
- Key = "setting"
- EndProperty
- BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":198F2
- Key = "lstView"
- EndProperty
- BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":19C0C
- Key = "exit"
- EndProperty
- BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":1FEA6
- Key = "bboy"
- EndProperty
- EndProperty
- End
- Begin MSComctlLib.ImageList imlViewSIcon
- Left = 0
- Top = 0
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 7
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":20780
- Key = "group"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":20BD2
- Key = "group2"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":23384
- Key = "boy"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":237D6
- Key = "girl"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":23C28
- Key = "sboy1"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":2407C
- Key = "sgirl"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmCilent.frx":244D0
- Key = "sboy"
- EndProperty
- EndProperty
- End
- Begin VB.Image imgSplitter
- Height = 4785
- Left = 1965
- MousePointer = 9 'Size W E
- Top = 945
- Width = 150
- End
- End
- Attribute VB_Name = "frmCilent"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '****************************************************************************
- '人人为我,我为人人
- '枕善居收藏整理
- '发布日期:2008/01/21
- '描 述:汽车维修管理系统SQL2000版
- '网 站:http://www.Mndsoft.com/ (VB6源码博客)
- '网 站:http://www.VbDnet.com/ (VB.NET源码博客,主要基于.NET2005)
- 'e-mail :Mndsoft@163.com
- 'e-mail :Mndsoft@126.com
- 'OICQ :88382850
- ' 如果您有新的好的代码别忘记给枕善居哦!
- '****************************************************************************
- Dim mbMoving As Boolean
- Const sglSplitLimit = 500
- Dim strName As String
- Private OK As Boolean '确定用户按了OK还是CANCEL按钮
- Private mvarViewType As gxcViewType '显示类型,即表示当前是添加、查看、修改
- Public Sub AddClientToLvw(ByVal objClient As Recordset, _
- ByRef lvw As ListView, _
- ByVal IsOverWrite As Boolean)
- Dim itm As ListItem
- Dim sIcon As String
- Dim bIcon As String
- ' If objClient("clkSex") = Male Then
- sIcon = "sboy"
- bIcon = "bboy"
- ' Else
- ' sIcon = "sgirl"
- ' bIcon = "bgirl"
- ' End If
-
- '如果是更新(即覆盖),则使用当前选种的元素
- If IsOverWrite Then
- Set itm = lvw.SelectedItem
- If itm Is Nothing Then Exit Sub
- Else
- Set itm = lvw.ListItems.Add(, "A" & objClient(0), , bIcon, sIcon)
- End If
- With objClient '这里要与InitClientListview相对应
- ' itm.SmallIcon = sIcon
- ' itm.Icon = bIcon
- itm.Text = .Fields(1).Value
- itm.SubItems(1) = .Fields(2).Value
- itm.SubItems(2) = .Fields(3).Value
- itm.SubItems(3) = .Fields(4).Value
- itm.SubItems(4) = .Fields(5).Value
- itm.SubItems(5) = .Fields(6).Value
- itm.SubItems(6) = .Fields(7).Value
- itm.SubItems(7) = .Fields(8).Value
- itm.SubItems(8) = GetValueByID("State", "ID", .Fields("stID").Value, "State")
- itm.SubItems(9) = GetValueByID("Clerk", "clkID", .Fields("clkID").Value, "clkName")
- itm.SubItems(10) = .Fields(11).Value
- End With
- Set itm = Nothing
- End Sub
- '按照“客户”设置ListView的显示样式
- Public Sub InitClientListview(ByRef lvw As ListView)
- With lvw
- .ColumnHeaders.Clear
- '加入四个列首
- .ColumnHeaders.Add , , "车牌号", 1500
- .ColumnHeaders.Add , , "工单号", 2000
- .ColumnHeaders.Add , , "入场时间", 2000
- .ColumnHeaders.Add , , "车型厂牌", 1600
- .ColumnHeaders.Add , , "发动机号", 1600
- .ColumnHeaders.Add , , "底盘号", 1600
- .ColumnHeaders.Add , , "客户姓名", 1000
- .ColumnHeaders.Add , , "联系电话", 1300
- .ColumnHeaders.Add , , "类别", 1300
- .ColumnHeaders.Add , , "接待员", 1000
- .ColumnHeaders.Add , , "维修备注", 2000
- End With
- End Sub
- '将职员显示到ListView中
- Public Sub ClientsToListview(ByVal objClients As Recordset, ByRef lvw As ListView)
- Dim i As Long
-
- If lvw.ColumnHeaders.Count = 0 Then InitClientListview lvw
- lvw.ListItems.Clear '清除当前的列表内容
-
- For i = 1 To objClients.RecordCount
- AddClientToLvw objClients.DataSource, lvw, False
- objClients.MoveNext
- Next i
- End Sub
- ' 显示全部客户到列表控件
- Public Sub ListAllClients(ByRef lvw As ListView)
- Dim rstClients As New Recordset
-
- 'Find的两个参数均取默认值,此时查找全部的客户
- Set rstClients = g_Conn.Execute("select ID,carNO,IDN,inDate,carType,MotoNo,MainNo,cName,cTel,stID,clkID,Demo from Client")
-
- '将查找到的客户集合添加到列表控件中
- ClientsToListview rstClients, lvw
-
- Set rstClients = Nothing
-
- End Sub
- Private Sub cmdAddNews_Click()
- frmAddClient.mvarViewType = vtadd
- frmAddClient.Show vbModal
- If frmAddClient.OK = True Then AddClientToLvw g_Conn.Execute("select ID,carNO,IDN,inDate,carType,MotoNo,MainNo,cName,cTel,stID,clkID,Demo from Client where id='" & MaxID("Client", "ID") & "'"), frmCilent.lvListView, False
- End Sub
- Private Sub cmdDeletes_Click()
- 'If MsgBox("真的要删除“" & lvListView.SelectedItem.Text & "”吗?", vbQuestion + vbYesNo + _
- vbDefaultButton2) = vbNo Then Exit Sub
- 'Dim ErrMsg As String
- 'If RunSql("Delete from Client where ID=" & GetID(lvListView.SelectedItem.Key), ErrMsg) Then
- ' lvListView.ListItems.Remove (lvListView.SelectedItem.Index)
- 'Else
- ' MsgBox ErrMsg
- 'End If
- End Sub
- Private Sub cmdModifys_Click()
- If lvListView.SelectedItem Is Nothing Then Exit Sub
- frmAddClient.mvarID = lvListView.SelectedItem.Key
- frmAddClient.mvarViewType = vtModify
- frmAddClient.Show vbModal
- If frmAddClient.OK = True Then AddClientToLvw g_Conn.Execute("select ID,carNO,IDN,inDate,carType,MotoNo,MainNo,cName,cTel,stID,clkID,Demo from Client where id='" & GetID(frmAddClient.mvarID) & "'"), frmCilent.lvListView, True
- End Sub
- Private Sub cmdAddNew_Click()
- Dim sID As Integer
- sID = GetID(tvTreeView.SelectedItem.Key)
- strName = Trim(InputBox("请输入状态类别名称:"))
- If strName = "" Then Exit Sub
- If ExistByName("Depart", "DName", strName) Then MsgBox "有重名的状态类别存在,重新命名!", vbOKOnly + vbExclamation: Exit Sub
- Dim ErrMsg As String
- If RunSql("insert into State(State,superID) Values('" & strName & "','" & sID & "')", ErrMsg) Then
- AddTypeToTvw g_Conn.Execute("select ID,superID,State from State where State='" & strName & "'"), tvTreeView
- Else
- MsgBox ErrMsg
- End If
- strName = ""
- End Sub
- Private Sub cmdClose_Click()
- Unload Me
- End Sub
- Private Sub cmdDelete_Click()
- Dim objID As Integer
- objID = GetID(tvTreeView.SelectedItem.Key)
- If objID = 0 Then Exit Sub
- If MsgBox("真的要删除“" & tvTreeView.SelectedItem.Text & "”吗?", vbQuestion + vbYesNo + _
- vbDefaultButton2) = vbNo Then Exit Sub
- If ExistByID("Client", "stID", objID) Then MsgBox "此类别下有维修车辆存在!不能删除。": Exit Sub
- If ExistByID("State", "superID", objID) Then MsgBox "此类别下有下级存在!不能删除。": Exit Sub
- Dim ErrMsg As String
- If RunSql("Delete from Client where ID='" & objID & "'", ErrMsg) Then
- tvTreeView.Nodes.Remove (tvTreeView.SelectedItem.Index)
- Else
- MsgBox ErrMsg
- End If
- End Sub
- Private Sub cmdModify_Click()
- If tvTreeView.SelectedItem.Key = "A0" Then Exit Sub
- strName = Trim(InputBox("请输入部门名称:", , tvTreeView.SelectedItem.Text))
- If strName = "" Then Exit Sub
- If ExistByName("State", "State", strName) Then
- MsgBox "有重名的类别存在,重新命名!", vbOKOnly + vbExclamation
- Else
- Dim ErrMsg As String
- If RunSql("Update State set State='" & strName & "' where ID=" & GetID(tvTreeView.SelectedItem.Key), ErrMsg) Then
- tvTreeView.SelectedItem.Text = strName
- Else
- MsgBox ErrMsg
- End If
- End If
- strName = ""
- End Sub
- Private Sub Form_Load()
- InitClientListview lvListView '初始化列表
- ' ListAllClients lvListView
- TypeToTreeview tvTreeView
- End Sub
- Private Sub Form_Resize()
- On Error Resume Next
- If Me.Width < 3000 Then Me.Width = 3000
- SizeControls imgSplitter.Left
- End Sub
- Private Sub imgSplitter_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
- With imgSplitter
- picSplitter.Move .Left, .Top, .Width 2, .Height - 20
- End With
- picSplitter.Visible = True
- mbMoving = True
- End Sub
- Private Sub imgSplitter_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
- Dim sglPos As Single
-
- If mbMoving Then
- sglPos = x + imgSplitter.Left
- If sglPos < sglSplitLimit Then
- picSplitter.Left = sglSplitLimit
- ElseIf sglPos > Me.Width - sglSplitLimit Then
- picSplitter.Left = Me.Width - sglSplitLimit
- Else
- picSplitter.Left = sglPos
- End If
- End If
- End Sub
- Private Sub imgSplitter_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
- SizeControls picSplitter.Left
- picSplitter.Visible = False
- mbMoving = False
- End Sub
- Private Sub TreeView1_DragDrop(Source As Control, x As Single, y As Single)
- If Source = imgSplitter Then
- SizeControls x
- End If
- End Sub
- Sub SizeControls(x As Single)
- On Error Resume Next
-
- '设置 Width 属性
- If x < 1500 Then x = 1500
- If x > (Me.Width - 1500) Then x = Me.Width - 1500
- tvTreeView.Width = x
- imgSplitter.Left = x
- lvListView.Left = x + 40
- lvListView.Width = Me.Width - (tvTreeView.Width + 140)
- lblTitle(0).Width = tvTreeView.Width
- lblTitle(1).Left = lvListView.Left + 20
- lblTitle(1).Width = lvListView.Width - 40
- '设置 Top 属性
-
- If tbToolBar.Visible Then
- tvTreeView.Top = tbToolBar.Height + picTitles.Height
- Else
- tvTreeView.Top = picTitles.Height
- End If
- lvListView.Top = tvTreeView.Top
-
- '设置 height 属性
- tvTreeView.Height = Me.ScaleHeight - (picTitles.Top + picTitles.Height)
- lvListView.Height = tvTreeView.Height
- imgSplitter.Top = tvTreeView.Top
- imgSplitter.Height = tvTreeView.Height
- End Sub
- '将一个类型加入到树型图中
- Public Sub AddTypeToTvw(ByVal objType As Recordset, ByRef tvw As TreeView)
- On Error Resume Next
- If objType(1) = 0 Then
- '“A0”中,第一个为字母A,第二个为数字0
- tvw.Nodes.Add "A0", tvwChild, "A" & objType(0), objType(2), "A1"
- Else
- tvw.Nodes.Add "A" & objType(1), tvwChild, "A" & objType(0), objType(2), "A1"
- End If
- End Sub
- Public Sub TypeToTreeview(ByRef tvw As TreeView)
- Dim i As Long
- Dim Nd As Node
- Dim Rs As Recordset
- Set Nd = tvw.Nodes.Add(, , "A0", "所有类别", "A0")
-
- Nd.Expanded = True
- Nd.Selected = True
- Set Rs = g_Conn.Execute("select ID,State from State where superID=0")
- For i = 1 To Rs.RecordCount
- Set Nd = tvw.Nodes.Add("A0", tvwChild, "A" & Rs(0), Rs(1), "A1")
- Nd.Expanded = True
- '加载其下级客户类型节点
- LoadSubNodes tvw, Nd, Rs(0)
- Rs.MoveNext
- Next i
- Set Rs = Nothing
- End Sub
- '调用递归,显示树型的客户类型结构
- Private Sub LoadSubNodes(ByRef tvw As TreeView, Nd As Node, NodeID As Long)
- Dim Nd1 As Node
- Dim Rs As New ADODB.Recordset
- Dim i As Long
- Set Rs = g_Conn.Execute("select ID,State from State where SuperID=" & NodeID) '找到客户类型的所有子客户类型
- For i = 1 To Rs.RecordCount
- Set Nd1 = tvw.Nodes.Add(Nd, tvwChild, "A" & Rs(0), Rs(1), "A1")
- Nd1.Expanded = True
- '递归加载下级客户类型.....
- LoadSubNodes tvw, Nd1, Rs(0)
- Rs.MoveNext
- Next i
- Set Rs = Nothing
- End Sub
- Private Sub lvListView_DblClick()
- If lvListView.SelectedItem Is Nothing Then Exit Sub
- frmAddClient.mvarID = lvListView.SelectedItem.Key
- frmAddClient.mvarViewType = vtinfo
- frmAddClient.Show vbModal
- End Sub
- Private Sub tbToolBar_ButtonClick(ByVal Button As MSComctlLib.Button)
- Select Case Button.Key
- Case "new"
- If g_QX(2) Then cmdAddNew_Click Else MsgBox qMSG
- Case "modi"
- If g_QX(2) Then cmdModify_Click Else MsgBox qMSG
- Case "del"
- If g_QX(2) Then cmdDelete_Click Else MsgBox qMSG
- Case "exit"
- cmdClose_Click
- Case "news"
- If g_QX(3) Then cmdAddNews_Click Else MsgBox qMSG
- Case "modis"
- If g_QX(3) Then cmdModifys_Click Else MsgBox qMSG
- Case "dels"
- If g_QX(3) Then cmdDeletes_Click Else MsgBox qMSG
- Case "infos"
- lvListView_DblClick
- Case "view"
- If lvListView.View = lvwIcon Then
- lvListView.View = lvwSmallIcon
- ElseIf lvListView.View = lvwSmallIcon Then
- lvListView.View = lvwList
- ElseIf lvListView.View = lvwList Then
- lvListView.View = lvwReport
- ElseIf lvListView.View = lvwReport Then
- lvListView.View = lvwIcon
- End If
- End Select
- End Sub
- Private Sub tbToolBar_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
- Select Case ButtonMenu.Key
- Case "dtb"
- lvListView.View = lvwIcon
- Case "xtb"
- lvListView.View = lvwSmallIcon
- Case "lb"
- lvListView.View = lvwList
- Case "xxzl"
- lvListView.View = lvwReport
- End Select
- End Sub
- Private Sub tvTreeView_NodeClick(ByVal Node As MSComctlLib.Node)
- Dim khID As Integer
- khID = GetID(Me.tvTreeView.SelectedItem.Key)
- Dim Rst As New ADODB.Recordset
- If khID = 0 Then
- Set Rst = g_Conn.Execute("select ID,carNO,IDN,inDate,carType,MotoNo,MainNo,cName,cTel,stID,clkID,Demo from Client")
- Else
- Set Rst = g_Conn.Execute("select ID,carNO,IDN,inDate,carType,MotoNo,MainNo,cName,cTel,stID,clkID,Demo from Client where stID=" & khID)
- End If
- ClientsToListview Rst, lvListView
- Set Rst = Nothing
- End Sub