📄 frmsaleedit.frm
字号:
Left = 1200
TabIndex = 2
Top = 120
Width = 1455
End
Begin VB.Frame Frame1
Caption = "客户信息"
Height = 1095
Left = 120
TabIndex = 0
Top = 600
Width = 6135
Begin MSDataListLib.DataCombo dco_Contact
Height = 330
Left = 1080
TabIndex = 9
Top = 600
Width = 1815
_ExtentX = 3201
_ExtentY = 582
_Version = 393216
Style = 2
Text = ""
End
Begin VB.TextBox txtTitle
Enabled = 0 'False
Height = 330
Left = 4320
TabIndex = 8
Top = 600
Width = 1455
End
Begin MSDataListLib.DataCombo dco_Customer
Height = 330
Left = 1080
TabIndex = 5
Top = 240
Width = 1815
_ExtentX = 3201
_ExtentY = 582
_Version = 393216
Style = 2
Text = ""
End
Begin VB.TextBox txtArea
Enabled = 0 'False
Height = 330
Left = 4320
TabIndex = 4
Top = 240
Width = 1455
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "职务名称"
Height = 180
Left = 3360
TabIndex = 11
Top = 675
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "所属地域"
Height = 180
Left = 3360
TabIndex = 10
Top = 315
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "联 系 人"
Height = 180
Left = 120
TabIndex = 7
Top = 675
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "客户名称"
Height = 180
Left = 120
TabIndex = 3
Top = 315
Width = 720
End
End
Begin MSAdodcLib.Adodc AdoEmps
Height = 330
Left = 0
Top = 5760
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "AdoEmps"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label lbl_CreateDate
AutoSize = -1 'True
Caption = "lbl_CreateDate"
Height = 180
Left = 1440
TabIndex = 30
Top = 5160
Width = 1260
End
Begin VB.Label lbl_Poster
AutoSize = -1 'True
Caption = "lbl_Poster"
Height = 180
Left = 4560
TabIndex = 27
Top = 5160
Width = 900
End
Begin VB.Label Label15
AutoSize = -1 'True
Caption = "填 写 人"
Height = 180
Left = 3720
TabIndex = 26
Top = 5160
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "登记日期"
Height = 180
Left = 480
TabIndex = 6
Top = 5160
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "机会编号"
Height = 180
Left = 240
TabIndex = 1
Top = 195
Width = 720
End
End
Attribute VB_Name = "FrmSaleEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OriSaleId As String
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
If Len(Trim(txtSaleId)) = 0 Then
MsgBox "请输入商业机会编号"
txtSaleId.SetFocus
Exit Sub
End If
If Len(Trim(dco_Customer.Text)) = 0 Then
MsgBox "请选择客户"
dco_Customer.SetFocus
Exit Sub
End If
If Len(Trim(dco_Contact.Text)) = 0 Then
MsgBox "请选择联系人"
dco_Contact.SetFocus
Exit Sub
End If
If Len(Trim(txtPName)) = 0 Then
MsgBox "请输入项目名称"
txtPName.SetFocus
Exit Sub
End If
If Len(Trim(dco_PType.Text)) = 0 Then
MsgBox "请选择项目类型"
dco_PType.SetFocus
Exit Sub
End If
If Len(Trim(dco_Emps.Text)) = 0 Then
MsgBox "请选择负责的销售人员"
ComboName.SetFocus
Exit Sub
End If
If Len(Trim(txtSignDate)) = 0 Then
MsgBox "请输入预计签订日期"
txtSignDate.SetFocus
Exit Sub
End If
If Val(txtSum) = 0 Then
MsgBox "请输入预计销售金额"
txtSum.SetFocus
Exit Sub
End If
If Len(Trim(ComboPercent.Text)) = 0 Then
MsgBox "请选择项目进展百分比程度"
ComboPercent.SetFocus
Exit Sub
End If
With MyChance
.Id = Trim(txtSaleId)
.CustId = Val(dco_Customer.BoundText)
.CtId = Val(dco_Contact.BoundText)
.PName = Trim(txtPName)
.PTypeId = Val(dco_PType.BoundText)
.PPercent = Trim(ComboPercent.Text)
.SignDate = Trim(txtSignDate)
.SignSum = Val(txtSum)
.EmpId = Val(dco_Emps.BoundText)
.Status = Trim(lbl_Status.Caption)
.Detail = Trim(txtDetail)
.Poster = Trim(CurUser.UserName)
.CreateDate = Date
If Modify = False Then
.Insert
Else
.Update (OriSaleId)
End If
End With
Unload Me
End Sub
Private Sub dco_Contact_Change()
If Len(Trim(dco_Customer.Text)) = 0 Then
MsgBox "请选择客户"
dco_Customer.SetFocus
Exit Sub
End If
'提取联系人职务名称
txtTitle = MyContact.GetTitle(Val(dco_Contact.BoundText))
End Sub
Private Sub dco_Customer_Change()
'载入地域名称
MyCust.GetInfo (Val(dco_Customer.BoundText))
txtArea = Trim(MyArea.GetName(MyCust.AreaId))
'提取联系人信息
LoadContact
End Sub
Private Sub Form_Load()
'载入项目进度
ComboPercent.AddItem "10%", 0
ComboPercent.AddItem "20%", 1
ComboPercent.AddItem "40%", 2
ComboPercent.AddItem "60%", 3
ComboPercent.AddItem "80%", 4
ComboPercent.AddItem "100%", 5
LoadData
End Sub
Private Sub LoadData()
'载入项目类型
AdoPType.ConnectionString = Conn
AdoPType.RecordSource = "SELECT * FROM Types " _
+ " WHERE Flag=4 ORDER BY TypeName"
AdoPType.Refresh
Set dco_PType.RowSource = AdoPType
dco_PType.ListField = "TypeName"
dco_PType.BoundColumn = "Id"
'载入客户信息
AdoCust.ConnectionString = Conn
AdoCust.RecordSource = "SELECT * FROM Customer " _
+ " ORDER BY CustId"
AdoCust.Refresh
Set dco_Customer.RowSource = AdoCust
dco_Customer.ListField = "CustName"
dco_Customer.BoundColumn = "CustId"
'读取销售人员数据数据
AdoEmps.ConnectionString = Conn
AdoEmps.RecordSource = "SELECT EmpId,EmpName FROM Employees Order By EmpName"
AdoEmps.Refresh
Set dco_Emps.RowSource = AdoEmps
dco_Emps.ListField = "EmpName"
dco_Emps.BoundColumn = "EmpId"
End Sub
Public Sub LoadContact()
'根据客户编号载入客户联系人信息
AdoContact.ConnectionString = Conn
AdoContact.RecordSource = "SELECT * FROM Contact " _
+ " WHERE CustId=" + Trim(dco_Customer.BoundText) + " ORDER BY Id"
AdoContact.Refresh
Set dco_Contact.RowSource = AdoContact
dco_Contact.ListField = "CName"
dco_Contact.BoundColumn = "Id"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -