frmAddClient.frm
上传用户:yexiandon
上传日期:2022-07-12
资源大小:895k
文件大小:33k
- VERSION 5.00
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
- Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
- Begin VB.Form frmAddClient
- BorderStyle = 3 'Fixed Dialog
- Caption = "维修车辆登记表"
- ClientHeight = 5010
- ClientLeft = 5295
- ClientTop = 5025
- ClientWidth = 7230
- Icon = "frmAddClient.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 5010
- ScaleWidth = 7230
- ShowInTaskbar = 0 'False
- Begin VB.ComboBox cboState
- Height = 300
- ItemData = "frmAddClient.frx":000C
- Left = 840
- List = "frmAddClient.frx":000E
- Style = 2 'Dropdown List
- TabIndex = 19
- Top = 4560
- Width = 1575
- End
- Begin VB.ComboBox cboClerk
- Height = 300
- ItemData = "frmAddClient.frx":0010
- Left = 3120
- List = "frmAddClient.frx":0012
- Style = 2 'Dropdown List
- TabIndex = 21
- Top = 4560
- Width = 1455
- End
- Begin VB.CommandButton OKButton
- Caption = "确定"
- Height = 300
- Left = 4800
- TabIndex = 38
- Top = 4560
- Width = 975
- End
- Begin VB.CommandButton CancelButton
- Caption = "关闭"
- Height = 300
- Left = 6000
- TabIndex = 39
- Top = 4560
- Width = 975
- End
- Begin TabDlg.SSTab SSTabClient
- Height = 4305
- Left = 120
- TabIndex = 40
- Top = 90
- Width = 6975
- _ExtentX = 12303
- _ExtentY = 7594
- _Version = 393216
- Tabs = 4
- TabsPerRow = 4
- TabHeight = 520
- WordWrap = 0 'False
- OLEDropMode = 1
- TabCaption(0) = "前台登记"
- TabPicture(0) = "frmAddClient.frx":0014
- Tab(0).ControlEnabled= -1 'True
- Tab(0).Control(0)= "Label2"
- Tab(0).Control(0).Enabled= 0 'False
- Tab(0).Control(1)= "frabaseInfo"
- Tab(0).Control(1).Enabled= 0 'False
- Tab(0).Control(2)= "Frame1"
- Tab(0).Control(2).Enabled= 0 'False
- Tab(0).Control(3)= "IDnumber"
- Tab(0).Control(3).Enabled= 0 'False
- Tab(0).ControlCount= 4
- TabCaption(1) = "维修用件"
- TabPicture(1) = "frmAddClient.frx":0030
- Tab(1).ControlEnabled= 0 'False
- Tab(1).Control(0)= "Frame2"
- Tab(1).ControlCount= 1
- TabCaption(2) = "维修工时"
- TabPicture(2) = "frmAddClient.frx":004C
- Tab(2).ControlEnabled= 0 'False
- Tab(2).Control(0)= "Frame3"
- Tab(2).ControlCount= 1
- TabCaption(3) = "费用结算"
- TabPicture(3) = "frmAddClient.frx":0068
- Tab(3).ControlEnabled= 0 'False
- Tab(3).Control(0)= "Frame4"
- Tab(3).ControlCount= 1
- Begin VB.TextBox IDnumber
- Alignment = 2 'Center
- Appearance = 0 'Flat
- BackColor = &H8000000A&
- Height = 270
- Left = 4320
- Locked = -1 'True
- TabIndex = 48
- Top = 533
- Width = 2055
- End
- Begin VB.Frame Frame4
- Height = 3615
- Left = -74760
- TabIndex = 47
- Top = 480
- Width = 6495
- Begin VB.TextBox cboUser
- Appearance = 0 'Flat
- BorderStyle = 0 'None
- Enabled = 0 'False
- Height = 225
- Left = 4080
- TabIndex = 35
- Text = "txtMainNo"
- Top = 1800
- Width = 1695
- End
- Begin VB.CommandButton Command2
- Caption = "完工"
- Height = 300
- Left = 4440
- TabIndex = 37
- Top = 2760
- Width = 975
- End
- Begin VB.CommandButton Command1
- Caption = "编辑"
- Height = 300
- Left = 3240
- TabIndex = 36
- Top = 2760
- Width = 975
- End
- Begin VB.TextBox txtfpn
- Appearance = 0 'Flat
- BorderStyle = 0 'None
- Enabled = 0 'False
- Height = 225
- Left = 4080
- TabIndex = 29
- Text = "txtCarNo"
- Top = 720
- Width = 1815
- End
- Begin VB.TextBox txtgs
- Appearance = 0 'Flat
- BorderStyle = 0 'None
- Enabled = 0 'False
- Height = 225
- Left = 1080
- TabIndex = 25
- Text = "txtCarNo"
- Top = 720
- Width = 1695
- End
- Begin VB.TextBox txtpj
- Appearance = 0 'Flat
- BorderStyle = 0 'None
- Enabled = 0 'False
- Height = 225
- Left = 1080
- TabIndex = 23
- Text = "txtCarNo"
- Top = 360
- Width = 1695
- End
- Begin VB.ComboBox cboWay
- Appearance = 0 'Flat
- Enabled = 0 'False
- Height = 300
- ItemData = "frmAddClient.frx":0084
- Left = 1080
- List = "frmAddClient.frx":0091
- TabIndex = 30
- Top = 1380
- Width = 1695
- End
- Begin VB.TextBox txtfp
- Appearance = 0 'Flat
- BorderStyle = 0 'None
- Enabled = 0 'False
- Height = 225
- Left = 4080
- TabIndex = 27
- Text = "txtCarNo"
- Top = 360
- Width = 1815
- End
- Begin VB.TextBox txtjsje
- Appearance = 0 'Flat
- BorderStyle = 0 'None
- Enabled = 0 'False
- Height = 225
- Left = 1080
- TabIndex = 33
- Text = "txtMainNo"
- Top = 1800
- Width = 1695
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "开票金额"
- Height = 180
- Index = 13
- Left = 3240
- TabIndex = 28
- Top = 720
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "工时费用"
- Height = 180
- Index = 12
- Left = 240
- TabIndex = 24
- Top = 720
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "配件费用"
- Height = 180
- Index = 11
- Left = 240
- TabIndex = 22
- Top = 360
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "开票内容"
- Height = 180
- Index = 10
- Left = 3240
- TabIndex = 26
- Top = 360
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "经 手 人"
- Height = 180
- Index = 9
- Left = 3240
- TabIndex = 34
- Top = 1800
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "结算金额"
- Height = 180
- Index = 8
- Left = 240
- TabIndex = 32
- Top = 1800
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "结算方式"
- Height = 180
- Index = 7
- Left = 240
- TabIndex = 31
- Top = 1440
- Width = 720
- End
- End
- Begin VB.Frame Frame3
- Height = 3735
- Left = -74760
- TabIndex = 45
- Top = 480
- Width = 6495
- Begin MSComctlLib.ListView ListView1
- Height = 3105
- Left = 120
- TabIndex = 46
- Top = 240
- Width = 6300
- _ExtentX = 11113
- _ExtentY = 5477
- View = 3
- LabelEdit = 1
- LabelWrap = 0 'False
- HideSelection = 0 'False
- FullRowSelect = -1 'True
- _Version = 393217
- Icons = "imlViewBIcon"
- SmallIcons = "imlViewSIcon"
- ForeColor = -2147483640
- BackColor = -2147483643
- BorderStyle = 1
- Appearance = 1
- NumItems = 0
- End
- Begin VB.Label lbsumGS
- Caption = "0"
- Height = 255
- Left = 4200
- TabIndex = 53
- Top = 3360
- Width = 1695
- End
- Begin VB.Label Label5
- Caption = "合计"
- Height = 255
- Left = 3720
- TabIndex = 52
- Top = 3360
- Width = 375
- End
- End
- Begin VB.Frame Frame2
- Height = 3735
- Left = -74760
- TabIndex = 43
- Top = 480
- Width = 6495
- Begin MSComctlLib.ListView ListView0
- Height = 3105
- Left = 120
- TabIndex = 44
- Top = 240
- Width = 6300
- _ExtentX = 11113
- _ExtentY = 5477
- View = 3
- LabelEdit = 1
- LabelWrap = 0 'False
- HideSelection = 0 'False
- FullRowSelect = -1 'True
- _Version = 393217
- Icons = "imlViewBIcon"
- SmallIcons = "imlViewSIcon"
- ForeColor = -2147483640
- BackColor = -2147483643
- BorderStyle = 1
- Appearance = 1
- NumItems = 0
- End
- Begin VB.Label Label6
- Caption = "合计"
- Height = 255
- Left = 3840
- TabIndex = 51
- Top = 3360
- Width = 375
- End
- Begin VB.Label lbsumPJ
- Caption = "0"
- Height = 255
- Left = 4320
- TabIndex = 50
- Top = 3360
- Width = 1695
- End
- End
- Begin VB.Frame Frame1
- Caption = "客户信息"
- Height = 795
- Left = 240
- TabIndex = 42
- Top = 3360
- Width = 6495
- Begin VB.TextBox txtTel
- Height = 300
- Left = 4080
- TabIndex = 17
- Text = "txtTel"
- Top = 300
- Width = 2055
- End
- Begin VB.TextBox txtClientName
- Height = 300
- Left = 960
- TabIndex = 15
- Text = "txtClientName"
- Top = 300
- Width = 2055
- End
- Begin VB.Label Label3
- AutoSize = -1 'True
- Caption = "联系电话"
- Height = 180
- Left = 3240
- TabIndex = 16
- Top = 360
- Width = 720
- End
- Begin VB.Label Label8
- AutoSize = -1 'True
- Caption = "客户姓名"
- Height = 180
- Left = 120
- TabIndex = 14
- Top = 360
- Width = 720
- End
- End
- Begin VB.Frame frabaseInfo
- Caption = "车辆信息"
- Height = 2475
- Left = 240
- TabIndex = 41
- Top = 840
- Width = 6495
- Begin VB.TextBox txtDemo
- Height = 780
- Left = 960
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 13
- Top = 1560
- Width = 5175
- End
- Begin MSComCtl2.DTPicker DTP
- BeginProperty DataFormat
- Type = 1
- Format = "HH:mm:ss"
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 4
- EndProperty
- Height = 300
- Index = 1
- Left = 4080
- TabIndex = 3
- Top = 300
- Width = 2055
- _ExtentX = 3625
- _ExtentY = 529
- _Version = 393216
- Format = 25493506
- UpDown = -1 'True
- CurrentDate = 39448.3333333333
- End
- Begin VB.TextBox txtCarType
- Height = 300
- Left = 4080
- TabIndex = 7
- Text = "txtCarType"
- Top = 720
- Width = 2055
- End
- Begin VB.TextBox txtMainNo
- Height = 300
- Left = 4080
- TabIndex = 11
- Text = "txtMainNo"
- Top = 1140
- Width = 2055
- End
- Begin VB.TextBox txtMotoNo
- Height = 300
- Left = 960
- TabIndex = 9
- Text = "txtMotoNo"
- Top = 1140
- Width = 2055
- End
- Begin VB.TextBox txtCarNo
- Height = 300
- Left = 960
- TabIndex = 5
- Text = "txtCarNo"
- Top = 720
- Width = 2055
- End
- Begin MSComCtl2.DTPicker DTP
- BeginProperty DataFormat
- Type = 1
- Format = "yyyy""年""M""月""d""日"""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 3
- EndProperty
- Height = 300
- Index = 0
- Left = 960
- TabIndex = 1
- Top = 300
- Width = 2055
- _ExtentX = 3625
- _ExtentY = 529
- _Version = 393216
- Format = 25493504
- CurrentDate = 39448.3333333333
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "维修备注"
- Height = 180
- Index = 6
- Left = 120
- TabIndex = 12
- Top = 1560
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "入场日期"
- Height = 180
- Index = 5
- Left = 120
- TabIndex = 0
- Top = 360
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "车型厂牌"
- Height = 180
- Index = 4
- Left = 3240
- TabIndex = 6
- Top = 780
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "底 盘 号"
- Height = 180
- Index = 3
- Left = 3240
- TabIndex = 10
- Top = 1200
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "发动机号"
- Height = 180
- Index = 2
- Left = 120
- TabIndex = 8
- Top = 1200
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "入厂时间"
- Height = 180
- Index = 1
- Left = 3240
- TabIndex = 2
- Top = 360
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "车 牌 号"
- Height = 180
- Index = 0
- Left = 120
- TabIndex = 4
- Top = 780
- Width = 720
- End
- End
- Begin VB.Label Label2
- AutoSize = -1 'True
- Caption = "工单号"
- Height = 180
- Left = 3720
- TabIndex = 49
- Top = 570
- Width = 540
- End
- End
- Begin VB.Label Label4
- AutoSize = -1 'True
- Caption = "类别"
- Height = 180
- Left = 360
- TabIndex = 18
- Top = 4620
- Width = 360
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "接待员"
- Height = 180
- Left = 2520
- TabIndex = 20
- Top = 4620
- Width = 540
- End
- End
- Attribute VB_Name = "frmAddClient"
- 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
- ' 如果您有新的好的代码别忘记给枕善居哦!
- '****************************************************************************
- Option Explicit
- Public mvarViewType As gxcViewType
- Public mvarID As String
- Public mvarTreeID As String
- Public sumPJ, sumGS As Single
- Public OK As Boolean
- 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("ID"), , bIcon, sIcon)
- End If
- With objClient '这里要与InitClientListview相对应
- itm.SmallIcon = sIcon
- itm.Icon = bIcon
- itm.Text = GetValueByID("PeiJian", "ID", .Fields(1).Value, "pName")
- itm.SubItems(1) = GetValueByID("PeiJian", "ID", .Fields(1).Value, "pType")
- itm.SubItems(2) = GetValueByID("PeiJian", "ID", .Fields(1).Value, "pUnit")
- itm.SubItems(3) = .Fields(2).Value
- itm.SubItems(4) = .Fields(3).Value
- itm.SubItems(5) = .Fields(4).Value
- itm.SubItems(6) = .Fields(5).Value
- End With
- Set itm = Nothing
- End Sub
- Public Sub ClientsToListview(ByVal objClients As Recordset, ByRef lvw As ListView)
- Dim i As Long
- sumPJ = 0
- If lvw.ColumnHeaders.Count = 0 Then InitClientListview lvw
- lvw.ListItems.Clear '清除当前的列表内容
-
- For i = 1 To objClients.RecordCount
- AddClientToLvw objClients.DataSource, lvw, False
- sumPJ = sumPJ + objClients(4).Value
- objClients.MoveNext
- Next i
- lbsumPJ = sumPJ
- End Sub
- Public Sub AddToLvw(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("ID"), , bIcon, sIcon)
- End If
- With objClient '这里要与InitClientListview相对应
- itm.SmallIcon = sIcon
- itm.Icon = bIcon
- itm.Text = .Fields("wName").Value
- itm.SubItems(1) = GetValueByID("Clerk", "clkID", .Fields("cID").Value, "clkName")
- itm.SubItems(2) = .Fields("wMin").Value
- itm.SubItems(3) = .Fields("wPrice").Value
- itm.SubItems(4) = .Fields("wmin").Value * .Fields("wprice")
- itm.SubItems(5) = .Fields("wDemo").Value
- End With
- Set itm = Nothing
- End Sub
- Public Sub ToListview(ByVal objClients As Recordset, ByRef lvw As ListView)
- Dim i As Long
- sumGS = 0
- If lvw.ColumnHeaders.Count = 0 Then InitListview lvw
- lvw.ListItems.Clear '清除当前的列表内容
-
- For i = 1 To objClients.RecordCount
- AddToLvw objClients.DataSource, lvw, False
- sumGS = sumGS + objClients("wMin").Value * objClients("wPrice").Value
- objClients.MoveNext
- Next i
- lbsumGS = sumGS
- End Sub
- '根据对话框的显示方式来确定显示的数据
- Private Sub SetStatus()
- Dim ctl As Control
- Dim intBorderStyle As Integer
- Dim lngbkColor As Long
- Dim boolLocked As Boolean
-
- '默认的文本框风格设置
- intBorderStyle = 1 '3D
- lngbkColor = &H80000009
- boolLocked = False
- OKButton.Visible = True
- CancelButton.Caption = "取消"
- Select Case mvarViewType
- Case vtadd '添加客户
- OKButton.Caption = "确定"
- Me.Caption = "添加客户信息"
- Me.Command1.Enabled = False
- Me.Command2.Enabled = False
- mvarID = "A0"
- SetDefaultValue
- Case vtModify '修改客户信息
- OKButton.Caption = "保存"
- Me.Caption = "修改客户信息"
- SetDefaultValue g_Conn.Execute("Select * from Client WHERE ID=" & GetID(mvarID))
- Case vtinfo '查看客户信息
- '只读的文本框风格设置
- intBorderStyle = 0 '3D
- lngbkColor = &H8000000F
- boolLocked = True
- OKButton.Visible = False
- CancelButton.Caption = "关闭"
- Me.Caption = "查看客户信息"
- SetDefaultValue g_Conn.Execute("Select * from Client where ID=" & GetID(mvarID))
- Case Else
- End Select
- '根据显示状态不同设置文本框风格
- For Each ctl In Controls
- If (TypeOf ctl Is TextBox) Then
- ctl.BorderStyle = intBorderStyle
- ctl.BackColor = lngbkColor
- ctl.Locked = boolLocked
- ElseIf (TypeOf ctl Is ComboBox) Or _
- (TypeOf ctl Is DTPicker) Or _
- (TypeOf ctl Is CheckBox) Or _
- (TypeOf ctl Is Slider) Then
- ctl.Enabled = Not boolLocked
- End If
- Next
-
- End Sub
- Public Sub AllClientsTypeToCombo(ByRef cbo As ComboBox)
- '传入参数为客户的集合类与列表框
- Dim i As Long
- Dim objTypes As New Recordset
- cbo.Clear '清除当前的列表内容
- Set objTypes = g_Conn.Execute("Select clkID,clkName from Clerk")
- For i = 1 To objTypes.RecordCount
- '将每个“客户”都加入到该列表中,调用了单独的函数,没有全部做到这
- '个函数中,为什么呢?参看AddClientToLvw函数
- Call cbo.AddItem(objTypes(1), i - 1)
- cbo.ItemData(i - 1) = objTypes(0)
- objTypes.MoveNext
- Next i
- End Sub
- Public Sub AllStatesTypeToCombo(ByRef cbo As ComboBox)
- '传入参数为客户的集合类与列表框
- Dim i As Long
- Dim objTypes As New Recordset
- cbo.Clear '清除当前的列表内容
- Set objTypes = g_Conn.Execute("Select ID,State from State")
- For i = 1 To objTypes.RecordCount
- '将每个“客户”都加入到该列表中,调用了单独的函数,没有全部做到这
- '个函数中,为什么呢?参看AddClientToLvw函数
- Call cbo.AddItem(objTypes(1), i - 1)
- cbo.ItemData(i - 1) = objTypes(0)
- objTypes.MoveNext
- Next i
- End Sub
- Private Sub CancelButton_Click()
- OK = False
- Unload Me
- End Sub
- Private Sub Command8_Click()
- End Sub
- Private Sub Command1_Click()
- If g_QX(8) Then
- If IsFinish(GetID(mvarID)) Then MsgBox "已完工,不能再修改!": Exit Sub
- frmEdit.mvarID = mvarID
- frmEdit.Show vbModal
- Else
- MsgBox qMSG
- End If
- End Sub
- Private Sub Command2_Click()
- If g_QX(2) Then
- Dim ErrMsg As String
- If RunSql("Update Client set isfns=1 where ID=" & GetID(mvarID), ErrMsg) Then Command2.Enabled = False Else MsgBox ErrMsg
- Else
- MsgBox qMSG
- End If
- End Sub
- Private Sub DTP_Change(Index As Integer)
- If Index = 0 Then DTP(1).Value = DTP(0).Value Else DTP(0).Value = DTP(1).Value
- End Sub
- Private Sub Form_Load()
- OK = False
- InitClientListview ListView0
- InitListview ListView1
- SetStatus
- End Sub
- Private Sub SetDefaultValue(Optional objClient As ADODB.Recordset)
- Dim ctl As Control
- Dim i As Integer
-
- '添加所有的客户类型到组合框
- AllClientsTypeToCombo cboClerk
- AllStatesTypeToCombo cboState
- If objClient Is Nothing Then
- For Each ctl In Controls
- If TypeOf ctl Is TextBox Then
- ctl.Text = ""
- End If
- Next
- DTP(0).Value = Now()
- DTP(1).Value = Now()
- IDnumber.Text = IDnum("WXD", "Client")
- Else
- For i = 0 To cboClerk.ListCount - 1
- If cboClerk.ItemData(i) = objClient("clkID") Then
- cboClerk.ListIndex = i
- Exit For
- End If
- Next i
- For i = 0 To cboState.ListCount - 1
- If cboState.ItemData(i) = objClient("stID") Then
- cboState.ListIndex = i
- Exit For
- End If
- Next i
- With objClient
- IDnumber.Text = .Fields("IDN")
- txtCarNo.Text = .Fields("CarNo")
- txtCarType.Text = .Fields("CarType")
- txtMotoNo.Text = .Fields("MotoNo")
- txtMainNo.Text = .Fields("MainNo")
- txtDemo.Text = .Fields("Demo")
- DTP(0).Value = .Fields("inDate")
- DTP(1).Value = .Fields("inDate")
- txtTel.Text = .Fields("cTel")
- txtClientName.Text = .Fields("cName")
- txtfp.Text = .Fields("fpnr")
- txtfpn.Text = .Fields("fpje")
- cboWay.Text = .Fields("jsfs")
- txtjsje.Text = .Fields("jsje")
- cboUser.Text = .Fields("jsr")
- Command2.Enabled = IIf(.Fields("isfns").Value, False, True)
- End With
- ClientsToListview g_Conn.Execute("select B.ID,B.pID,B.pNum,B.pPrice,B.pNum*B.pPrice,B.pDemo from SubStore B inner join Store A on A.id=b.sid where A.type=-1 and A.carID=" & GetID(mvarID)), ListView0
- ToListview g_Conn.Execute("select * from WeiXiu where carID=" & GetID(mvarID)), ListView1
- End If
- txtpj = lbsumPJ
- txtgs = lbsumGS
- End Sub
- Public Sub InitClientListview(ByRef lvw As ListView)
- With lvw
- .ColumnHeaders.Clear
- '加入四个列首
- .ColumnHeaders.Add , , "名称", 1200
- .ColumnHeaders.Add , , "规格型号", 900
- .ColumnHeaders.Add , , "单位", 900
- .ColumnHeaders.Add , , "数量", 900
- .ColumnHeaders.Add , , "单价", 900
- .ColumnHeaders.Add , , "金额", 900
- .ColumnHeaders.Add , , "备注", 1800
- End With
- End Sub
- Public Sub InitListview(ByRef lvw As ListView)
- With lvw
- .ColumnHeaders.Clear
- '加入四个列首
- .ColumnHeaders.Add , , "维修内容", 1200
- .ColumnHeaders.Add , , "维修人", 900
- .ColumnHeaders.Add , , "维修时间", 900
- .ColumnHeaders.Add , , "单价", 900
- .ColumnHeaders.Add , , "金额", 900
- .ColumnHeaders.Add , , "备注", 1800
- End With
- End Sub
- Private Sub OKButton_Click()
- If IsFinish(GetID(mvarID)) Then MsgBox "已完工,不能再修改!": Exit Sub
- Dim ErrMsg As String
- Select Case mvarViewType
- Case vtadd '添加客户
- ' SaveData
- If ExistByName("Client", "CarNo", txtCarNo.Text) Then
- If MsgBox("车号已经存在,确认继续保存吗?", vbQuestion + vbYesNo + _
- vbDefaultButton2) = vbNo Then Exit Sub
- End If
- If Chk Then If RunSql("insert into Client(IDN,CarNo,CarType,MotoNo,MainNo,Demo,inDate,cName,cTel,clkID,stID) " & _
- "Values('" & IDnumber.Text & "','" & txtCarNo.Text & "','" & txtCarType.Text & "','" & txtMotoNo.Text & _
- "','" & txtMainNo.Text & "','" & txtDemo.Text & "','" & DTP(0).Value & _
- "','" & txtClientName.Text & "','" & txtTel.Text & "','" & cboClerk.ItemData(cboClerk.ListIndex) & _
- "','" & cboState.ItemData(cboState.ListIndex) & "')", ErrMsg) Then Else MsgBox ErrMsg: Exit Sub Else Exit Sub
- Case vtModify '修改客户信息
- ' ModiData
- If ExistByValueID("Client", "ID", GetID(mvarID), "CarNo", txtCarNo.Text) Then
- If MsgBox("车号已经存在,确认继续保存吗?", vbQuestion + vbYesNo + _
- vbDefaultButton2) = vbNo Then Exit Sub
- End If
- If Chk Then If RunSql("Update Client set CarNo='" & txtCarNo.Text & "',CarType='" & txtCarType.Text & _
- "',MotoNo='" & txtMotoNo.Text & "',MainNo='" & txtMainNo.Text & "',Demo='" & txtDemo.Text & _
- "',inDate='" & DTP(0).Value & "',cName='" & txtClientName.Text & "',IDN='" & IDnumber.Text & _
- "',cTel='" & txtTel.Text & "',clkID='" & cboClerk.ItemData(cboClerk.ListIndex) & _
- "',stID='" & cboState.ItemData(cboState.ListIndex) & "' where ID=" & _
- GetID(mvarID), ErrMsg) Then Else MsgBox ErrMsg: Exit Sub Else Exit Sub
- Case Else
- End Select
- OK = True
- Unload Me
- End Sub
- Private Function Chk() As Boolean
- If Trim(txtCarNo) = "" Then
- MsgBox "车号不能为空!"
- Chk = False
- Exit Function
- ElseIf txtMotoNo = "" Then
- MsgBox "发动机号不能为空!"
- Chk = False
- Exit Function
- ElseIf txtMainNo = "" Then
- MsgBox "底盘号不能为空!"
- Chk = False
- Exit Function
- ElseIf cboState.Text = "" Then
- MsgBox "状态类别不能为空!"
- Chk = False
- Exit Function
- ElseIf cboClerk.Text = "" Then
- MsgBox "接待员不能为空!"
- Chk = False
- Exit Function
- End If
- Chk = True
- End Function
- Private Function IsFinish(ByVal lngID As Integer) As Boolean
- Dim Rs As Recordset
- Set Rs = g_Conn.Execute("Select isfns from Client where ID=" & lngID)
- If Rs.RecordCount = 1 Then
- IsFinish = Rs(0).Value
- Else
- IsFinish = False
- End If
- Set Rs = Nothing
- End Function