frmAddGS.frm
上传用户:yexiandon
上传日期:2022-07-12
资源大小:895k
文件大小:16k
- VERSION 5.00
- Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
- Begin VB.Form frmAddGS
- BorderStyle = 3 'Fixed Dialog
- Caption = "配件信息"
- ClientHeight = 3300
- ClientLeft = 5295
- ClientTop = 5025
- ClientWidth = 6495
- Icon = "frmAddGS.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 3300
- ScaleWidth = 6495
- ShowInTaskbar = 0 'False
- Begin VB.Frame Frame1
- Caption = "定损报件"
- Height = 2655
- Left = 120
- TabIndex = 20
- Top = 120
- Width = 6255
- Begin VB.TextBox txtDemo
- Height = 780
- Left = 1080
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 17
- Top = 1680
- Width = 4935
- End
- Begin VB.ComboBox cboClerk
- Height = 300
- ItemData = "frmAddGS.frx":000C
- Left = 4680
- List = "frmAddGS.frx":000E
- Style = 2 'Dropdown List
- TabIndex = 11
- Top = 1320
- Width = 1335
- End
- Begin VB.ComboBox cboCar
- Height = 300
- ItemData = "frmAddGS.frx":0010
- Left = 1080
- List = "frmAddGS.frx":0012
- Style = 2 'Dropdown List
- TabIndex = 1
- Top = 240
- Width = 1695
- End
- Begin VB.TextBox txtName
- Height = 300
- Left = 1080
- TabIndex = 9
- Text = "txtName"
- Top = 1320
- Width = 2895
- End
- Begin VB.TextBox txtPrice
- Alignment = 1 'Right Justify
- BorderStyle = 0 'None
- Height = 225
- Left = 4680
- TabIndex = 15
- Text = "0"
- Top = 1000
- Width = 735
- End
- Begin MSComCtl2.DTPicker fDTP
- BeginProperty DataFormat
- Type = 1
- Format = "HH:mm:ss"
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 4
- EndProperty
- Height = 300
- Index = 1
- Left = 2760
- TabIndex = 4
- Top = 600
- Width = 1215
- _ExtentX = 2143
- _ExtentY = 529
- _Version = 393216
- Format = 25559042
- UpDown = -1 'True
- CurrentDate = 39448.3333333333
- End
- Begin MSComCtl2.DTPicker fDTP
- BeginProperty DataFormat
- Type = 1
- Format = "yyyy""年""M""月""d""日"""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 3
- EndProperty
- Height = 300
- Index = 0
- Left = 1080
- TabIndex = 3
- Top = 600
- Width = 1695
- _ExtentX = 2990
- _ExtentY = 529
- _Version = 393216
- Format = 25559040
- CurrentDate = 39448.3333333333
- End
- Begin MSComCtl2.DTPicker tDTP
- BeginProperty DataFormat
- Type = 1
- Format = "HH:mm:ss"
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 4
- EndProperty
- Height = 300
- Index = 1
- Left = 2760
- TabIndex = 7
- Top = 960
- Width = 1215
- _ExtentX = 2143
- _ExtentY = 529
- _Version = 393216
- Format = 25559042
- UpDown = -1 'True
- CurrentDate = 39448.3333333333
- End
- Begin VB.TextBox txtMin
- Alignment = 1 'Right Justify
- BorderStyle = 0 'None
- Enabled = 0 'False
- Height = 225
- Left = 4680
- Locked = -1 'True
- TabIndex = 13
- Text = "0"
- Top = 640
- Width = 735
- End
- Begin MSComCtl2.DTPicker tDTP
- BeginProperty DataFormat
- Type = 1
- Format = "yyyy""年""M""月""d""日"""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 3
- EndProperty
- Height = 300
- Index = 0
- Left = 1080
- TabIndex = 6
- Top = 960
- Width = 1695
- _ExtentX = 2990
- _ExtentY = 529
- _Version = 393216
- Format = 25559040
- CurrentDate = 39448.3333333333
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "(元/分)"
- Height = 180
- Index = 5
- Left = 5400
- TabIndex = 22
- Top = 1020
- Width = 630
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "详细说明"
- Height = 180
- Index = 9
- Left = 240
- TabIndex = 16
- Top = 1740
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "(分钟)"
- Height = 180
- Index = 8
- Left = 5400
- TabIndex = 21
- Top = 660
- Width = 540
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "工 时"
- Height = 180
- Index = 7
- Left = 4080
- TabIndex = 12
- Top = 660
- Width = 540
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "结束时间"
- Height = 180
- Index = 6
- Left = 240
- TabIndex = 5
- Top = 1020
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "维修车号"
- Height = 180
- Index = 3
- Left = 240
- TabIndex = 0
- Top = 300
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "开始时间"
- Height = 180
- Index = 1
- Left = 240
- TabIndex = 2
- Top = 660
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "维修内容"
- Height = 180
- Index = 0
- Left = 240
- TabIndex = 8
- Top = 1380
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "单 价"
- Height = 180
- Index = 4
- Left = 4080
- TabIndex = 14
- Top = 1020
- Width = 540
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "维修人"
- Height = 180
- Index = 2
- Left = 4080
- TabIndex = 10
- Top = 1380
- Width = 540
- End
- End
- Begin VB.CommandButton OKButton
- Caption = "确定"
- Height = 300
- Left = 3960
- TabIndex = 18
- Top = 2880
- Width = 975
- End
- Begin VB.CommandButton CancelButton
- Caption = "取消"
- Height = 300
- Left = 5160
- TabIndex = 19
- Top = 2880
- Width = 975
- End
- End
- Attribute VB_Name = "frmAddGS"
- 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 OK As Boolean
- Public carID As Integer
- Const allSQL = "select ID,wName,wFdate,wTdate,wMin,carID,cID,wPrice,wDemo from WeiXiu"
- '根据对话框的显示方式来确定显示的数据
- 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 = "添加客户信息"
- SetDefaultValue
- Case vtModify '修改客户信息
- OKButton.Caption = "保存"
- Me.Caption = "修改客户信息"
- SetDefaultValue g_Conn.Execute("select * from WeiXiu 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 WeiXiu 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 AllClerksToCombo(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
- Call cbo.AddItem(objTypes(1), i - 1)
- cbo.ItemData(i - 1) = objTypes(0)
- objTypes.MoveNext
- Next i
- End Sub
- Public Sub AllCarsToCombo(ByRef cbo As ComboBox)
- Dim i As Long
- Dim objTypes As New Recordset
- cbo.Clear '清除当前的列表内容
- Set objTypes = g_Conn.Execute("Select ID,carNo from Client")
- For i = 1 To objTypes.RecordCount
- 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 fDTP_Change(Index As Integer)
- If Index = 0 Then fDTP(1) = fDTP(0) Else fDTP(0) = fDTP(1)
- txtMin.Text = DateDiff("n", fDTP(1), tDTP(1))
- End Sub
- Private Sub Form_Load()
- OK = False
- SetStatus
- End Sub
- Private Sub SetDefaultValue(Optional objClient As ADODB.Recordset)
- Dim ctl As Control
- Dim i As Integer
-
- AllClerksToCombo cboClerk
- AllCarsToCombo cboCar
- If objClient Is Nothing Then
- For Each ctl In Controls
- If TypeOf ctl Is TextBox Then
- ctl.Text = ""
- End If
- Next
- For i = 0 To cboCar.ListCount - 1
- If cboCar.ItemData(i) = carID Then
- cboCar.ListIndex = i
- Exit For
- End If
- Next i
- fDTP(0) = Now()
- tDTP(0) = Now()
- fDTP(1) = Now()
- tDTP(1) = Now()
- Else
- For i = 0 To cboClerk.ListCount - 1
- If cboClerk.ItemData(i) = objClient("cID") Then
- cboClerk.ListIndex = i
- Exit For
- End If
- Next i
- For i = 0 To cboCar.ListCount - 1
- If cboCar.ItemData(i) = objClient("carID") Then
- cboCar.ListIndex = i
- Exit For
- End If
- Next i
-
- With objClient
- txtName.Text = .Fields("wName")
- txtMin.Text = .Fields("wMin")
- txtPrice.Text = .Fields("wPrice")
- fDTP(0) = .Fields("wFdate")
- tDTP(0) = .Fields("wTdate")
- fDTP(1) = .Fields("wFdate")
- tDTP(1) = .Fields("wTdate")
- txtDemo.Text = .Fields("wDemo")
- End With
- End If
- End Sub
- Private Sub OKButton_Click()
- If GetValueByID("Client", "ID", cboCar.ItemData(cboCar.ListIndex), "isfns") Then MsgBox cboCar.Text & "已完工,不能再做改动!": Exit Sub
- Dim ErrMsg As String
- Select Case mvarViewType
- Case vtadd '添加客户
- If Chk Then If RunSql("insert into WeiXiu(wName,wFdate,wTdate,wMin,carID,cID,wPrice,wDemo) " & _
- "Values('" & txtName.Text & "','" & fDTP(1).Value & "','" & tDTP(1).Value & _
- "'," & Val(txtMin.Text) & ",'" & cboCar.ItemData(cboCar.ListIndex) & "','" & cboClerk.ItemData(cboClerk.ListIndex) & _
- "'," & Val(txtPrice.Text) & ",'" & txtDemo.Text & "')", ErrMsg) Then Else MsgBox ErrMsg: Exit Sub Else Exit Sub
- Case vtModify '修改客户信息
- ' ModiData
- If Chk Then If RunSql("Update WeiXiu set wName='" & txtName.Text & "',wFdate='" & fDTP(1).Value & _
- "',wTdate='" & tDTP(1).Value & "',wMin=" & txtMin.Text & ",carID=" & cboCar.ItemData(cboCar.ListIndex) & _
- ",cID=" & cboClerk.ItemData(cboClerk.ListIndex) & ",wPrice=" & txtPrice.Text & ",wDemo='" & txtDemo.Text & _
- "' 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 cboCar = "" Then
- MsgBox "维修车号不能为空!"
- Chk = False
- Exit Function
- ElseIf cboClerk = "" Then
- MsgBox "维修人不能为空!"
- Chk = False
- Exit Function
- ElseIf Trim(txtName) = "" Then
- MsgBox "维修内容不能为空!"
- Chk = False
- Exit Function
- ElseIf Val(txtMin) <= 0 Then
- MsgBox "维修工时必需大于零!"
- Chk = False
- Exit Function
- ElseIf Val(txtPrice) < 0 Then
- MsgBox "单价不能小于零!"
- Chk = False
- Exit Function
- End If
- Chk = True
- End Function
- Private Sub tDTP_Change(Index As Integer)
- If Index = 0 Then tDTP(1) = tDTP(0) Else tDTP(0) = tDTP(1)
- txtMin.Text = DateDiff("n", fDTP(1), tDTP(1))
- End Sub
- Private Sub txtPrice_Change()
- txtPrice.Text = Val(txtPrice.Text)
- End Sub