frmAddPJ.frm
上传用户:yexiandon
上传日期:2022-07-12
资源大小:895k
文件大小:11k
- VERSION 5.00
- Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
- Begin VB.Form frmAddPJ
- BorderStyle = 3 'Fixed Dialog
- Caption = "配件信息"
- ClientHeight = 2250
- ClientLeft = 5295
- ClientTop = 5025
- ClientWidth = 6765
- Icon = "frmAddPJ.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 2250
- ScaleWidth = 6765
- ShowInTaskbar = 0 'False
- Begin VB.Frame Frame1
- Caption = "定损报件"
- Height = 1455
- Left = 120
- TabIndex = 14
- Top = 120
- Width = 6495
- Begin VB.TextBox txtNum
- Height = 300
- Left = 4200
- TabIndex = 11
- Text = "0"
- Top = 960
- Width = 2055
- End
- Begin VB.TextBox txtName
- Height = 300
- Left = 1080
- TabIndex = 5
- Text = "txtName"
- Top = 600
- Width = 2055
- End
- Begin VB.TextBox txtUnit
- Height = 300
- Left = 1080
- TabIndex = 9
- Text = "txtUnit"
- Top = 960
- Width = 2055
- End
- Begin VB.TextBox txtType
- Height = 300
- Left = 4200
- TabIndex = 7
- Text = "txtType"
- Top = 600
- Width = 2055
- 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 = 4200
- TabIndex = 3
- Top = 240
- Width = 2055
- _ExtentX = 3625
- _ExtentY = 529
- _Version = 393216
- Format = 64880642
- UpDown = -1 'True
- CurrentDate = 39448.3333333333
- 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 = 1080
- TabIndex = 1
- Top = 240
- Width = 2055
- _ExtentX = 3625
- _ExtentY = 529
- _Version = 393216
- Format = 64880640
- CurrentDate = 39448.3333333333
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "报件数量"
- Height = 180
- Index = 3
- Left = 3360
- TabIndex = 10
- Top = 1020
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "报件时间"
- Height = 180
- Index = 1
- Left = 3360
- TabIndex = 2
- Top = 300
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "报件日期"
- Height = 180
- Index = 5
- Left = 240
- TabIndex = 0
- Top = 300
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "配件名称"
- Height = 180
- Index = 0
- Left = 240
- TabIndex = 4
- Top = 660
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "计量单位"
- Height = 180
- Index = 2
- Left = 240
- TabIndex = 8
- Top = 1020
- Width = 720
- End
- Begin VB.Label Labels
- AutoSize = -1 'True
- Caption = "规格型号"
- Height = 180
- Index = 4
- Left = 3360
- TabIndex = 6
- Top = 660
- Width = 720
- End
- End
- Begin VB.CommandButton OKButton
- Caption = "确定"
- Height = 300
- Left = 4440
- TabIndex = 12
- Top = 1800
- Width = 975
- End
- Begin VB.CommandButton CancelButton
- Caption = "取消"
- Height = 300
- Left = 5520
- TabIndex = 13
- Top = 1800
- Width = 975
- End
- End
- Attribute VB_Name = "frmAddPJ"
- 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,pName,pType,pCID,pUnit,pDemo from PeiJian"
- '根据对话框的显示方式来确定显示的数据
- 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 PeiJian 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 PeiJian 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
- Private Sub CancelButton_Click()
- OK = False
- Unload Me
- 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
- SetStatus
- End Sub
- Private Sub SetDefaultValue(Optional objClient As ADODB.Recordset)
- Dim ctl As Control
- Dim i As Integer
-
- If objClient Is Nothing Then
- For Each ctl In Controls
- If TypeOf ctl Is TextBox Then
- ctl.Text = ""
- End If
- Next
- DTP(0) = Now()
- DTP(1) = Now()
- Else
- With objClient
- txtName.Text = .Fields("pName")
- txtType.Text = .Fields("pType")
- txtUnit.Text = .Fields("pUnit")
- txtNum.Text = .Fields("pNum")
- DTP(0) = .Fields("pDemo")
- DTP(1) = .Fields("pDemo")
- End With
- End If
- End Sub
- Private Sub OKButton_Click()
- Dim ErrMsg As String
- Select Case mvarViewType
- Case vtadd '添加客户
- ' SaveData
- If ExistByName("PeiJian", "pName", txtName.Text) Then
- If MsgBox("配件名已经存在,确认继续保存吗?", vbQuestion + vbYesNo + _
- vbDefaultButton2) = vbNo Then Exit Sub
- End If
- If Chk Then If RunSql("insert into PeiJian(pName,pType,pUnit,pDemo,pCID,pNum) " & _
- "Values('" & txtName.Text & "','" & txtType.Text & "','" & txtUnit.Text & _
- "','" & DTP(0).Value & "','" & carID & _
- "'," & Val(txtNum.Text) & ")", ErrMsg) Then Else MsgBox ErrMsg: Exit Sub Else Exit Sub
- Case vtModify '修改客户信息
- ' ModiData
- If ExistByValueID("PeiJian", "ID", GetID(mvarID), "pName", txtName.Text) Then
- If MsgBox("配件名已经存在,确认继续保存吗?", vbQuestion + vbYesNo + _
- vbDefaultButton2) = vbNo Then Exit Sub
- End If
- If Chk Then If RunSql("Update PeiJian set pName='" & txtName.Text & "',pType='" & txtType.Text & _
- "',pUnit='" & txtUnit.Text & "',pNum=" & txtNum.Text & ",pDemo='" & DTP(0).Value & _
- "' 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(txtName) = "" Then
- MsgBox "配件名不能为空!"
- Chk = False
- Exit Function
- ElseIf txtUnit = "" Then
- MsgBox "单位不能为空!"
- Chk = False
- Exit Function
- ElseIf Val(txtNum) = 0 Then
- MsgBox "数量不能为0!"
- Chk = False
- Exit Function
- End If
- Chk = True
- End Function
- Private Sub txtNum_Change()
- txtNum.Text = Val(txtNum)
- txtNum.SelStart = Len(txtNum)
- End Sub