📄 frmtaskman.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FrmTaskMan
Caption = "客户跟踪信息管理"
ClientHeight = 6420
ClientLeft = 60
ClientTop = 345
ClientWidth = 8220
LinkTopic = "Form1"
ScaleHeight = 6420
ScaleWidth = 8220
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Cmd_Back
Cancel = -1 'True
Caption = "返 回"
Height = 400
Left = 5960
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 9
Top = 5880
Width = 1100
End
Begin VB.CommandButton Cmd_Modi
Caption = "修 改"
Height = 400
Left = 2760
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 8
Top = 5880
Width = 1100
End
Begin VB.CommandButton Cmd_Add
Caption = "添 加"
Default = -1 'True
Height = 400
Left = 1160
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 7
Top = 5880
Width = 1100
End
Begin VB.CommandButton Cmd_Del
Caption = "删 除"
Height = 400
Left = 4360
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 6
Top = 5880
Width = 1100
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 120
Top = 5640
Visible = 0 'False
Width = 1935
_ExtentX = 3413
_ExtentY = 661
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 = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 4695
Left = 120
TabIndex = 5
Top = 960
Width = 7935
_ExtentX = 13996
_ExtentY = 8281
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Frame Frame1
Height = 735
Left = 120
TabIndex = 0
Top = 120
Width = 7935
Begin VB.CommandButton Cmd_Reset
Caption = "重置"
Height = 375
Left = 6360
TabIndex = 4
Top = 240
Width = 735
End
Begin MSDataListLib.DataCombo dco_PName
Height = 330
Left = 960
TabIndex = 3
Top = 240
Width = 2775
_ExtentX = 4895
_ExtentY = 582
_Version = 393216
Style = 2
Text = ""
End
Begin MSDataListLib.DataCombo dco_Emps
Height = 330
Left = 4800
TabIndex = 10
Top = 240
Width = 1095
_ExtentX = 1931
_ExtentY = 582
_Version = 393216
Style = 2
Text = ""
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "销售人员"
Height = 180
Left = 3960
TabIndex = 2
Top = 315
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "项目名称"
Height = 180
Left = 120
TabIndex = 1
Top = 315
Width = 720
End
End
Begin MSAdodcLib.Adodc AdoPName
Height = 375
Left = 2400
Top = 5640
Visible = 0 'False
Width = 1935
_ExtentX = 3413
_ExtentY = 661
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 = "AdoPName"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc AdoEmps
Height = 330
Left = 120
Top = 6000
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 = "Adodc1"
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
End
Attribute VB_Name = "FrmTaskMan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim SchCnd As String
Private Sub Cmd_Add_Click()
FrmTaskEdit.Modify = False
FrmTaskEdit.txtSaleId = ""
FrmTaskEdit.dco_Emps.Text = ""
FrmTaskEdit.txtTaskDate = Date
FrmTaskEdit.ComboBy.ListIndex = 0
FrmTaskEdit.dco_Contact.Text = ""
FrmTaskEdit.Show 1
RefreshTask
End Sub
Private Sub Cmd_Back_Click()
Unload Me
End Sub
Private Sub Cmd_Del_Click()
If Adodc1.Recordset.EOF Then
MsgBox "请选择记录"
Exit Sub
End If
If MsgBox("是否删除当前记录?", vbYesNo, "确认") = vbYes Then
Call MyTask.Delete(Adodc1.Recordset.Fields(0))
RefreshTask
End If
End Sub
Private Sub Cmd_Modi_Click()
If Adodc1.Recordset.EOF Then
MsgBox "请选择记录"
Exit Sub
End If
FrmTaskEdit.Modify = True
FrmTaskEdit.OriId = Adodc1.Recordset.Fields(0)
FrmTaskEdit.OriCustId = Adodc1.Recordset.Fields(14)
FrmTaskEdit.txtSaleId = Trim(Adodc1.Recordset.Fields(1))
FrmTaskEdit.dco_Emps.Text = Trim(Adodc1.Recordset.Fields(3))
FrmTaskEdit.txtTaskDate = Trim(Adodc1.Recordset.Fields(4))
FrmTaskEdit.ComboBy.Text = Trim(Adodc1.Recordset.Fields(5))
FrmTaskEdit.dco_Contact.Text = Trim(Adodc1.Recordset.Fields(8))
FrmTaskEdit.txtPlace = Trim(Adodc1.Recordset.Fields(9))
FrmTaskEdit.txtPurpose = Trim(Adodc1.Recordset.Fields(6))
FrmTaskEdit.txtSTime = Trim(Adodc1.Recordset.Fields(10))
FrmTaskEdit.txtETime = Trim(Adodc1.Recordset.Fields(11))
FrmTaskEdit.txtDetail = Trim(Adodc1.Recordset.Fields(12))
FrmTaskEdit.txtResult = Trim(Adodc1.Recordset.Fields(13))
FrmTaskEdit.txtSaleId.Enabled = False
FrmTaskEdit.Cmd_Search.Enabled = False
FrmTaskEdit.RefreshSale
FrmTaskEdit.Show 1
RefreshTask
End Sub
Private Sub Cmd_Reset_Click()
dco_PName.Text = ""
dco_Emps.Text = ""
RefreshTask
End Sub
Private Sub dco_Emps_Click(Area As Integer)
RefreshTask
End Sub
Private Sub dco_PName_Click(Area As Integer)
RefreshTask
End Sub
Private Sub Form_Load()
'载入商业机会信息
AdoPName.ConnectionString = Conn
AdoPName.RecordSource = "SELECT * FROM SaleChance ORDER BY Id"
AdoPName.Refresh
Set dco_PName.RowSource = AdoPName
dco_PName.ListField = "ProName"
dco_PName.BoundColumn = "Id"
'读取销售人员数据数据
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"
RefreshTask
End Sub
Private Sub RefreshTask()
Dim AndStr As String
'设置查询条件
If Len(Trim(dco_Emps.Text)) <> 0 Then
AndStr = " AND t.EmpId=" + Trim(dco_Emps.BoundText())
End If
If Len(Trim(dco_PName.Text)) <> 0 Then
AndStr = " AND s.Id='" + Trim(dco_PName.BoundText) + "'"
End If
'设置SELECT语句, 从表SaleTask, SaleChance, Customer, Contact, Employees中读取数据
SchCnd = "SELECT t.Id,t.SaleId AS 销售编号,t.EmpId,e.EmpName AS 销售人员," _
+ "t.TaskDate AS 拜访日期,t.TaskBy AS 拜访方式,t.Purpose AS 拜访目的," _
+ "c.CustName AS 客户名称,ct.CName AS 联系人,t.Place AS 拜访地点," _
+ "t.StartTime AS 开始时间,t.EndTime AS 结束时间,t.Detail AS 过程描述," _
+ "t.Result AS 结论,s.CustId " _
+ " FROM SaleTask t,SaleChance s,Customer c,Contact ct,Employees e " _
+ " WHERE t.SaleId=s.Id AND s.CustId=c.CustId AND t.CtId=ct.Id " _
+ " AND t.EmpId=e.EmpId " + AndStr _
+ " ORDER BY t.SaleId,t.TaskDate DESC"
Adodc1.ConnectionString = Conn
Adodc1.RecordSource = SchCnd
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
DataGrid1.Columns(0).Width = 0
DataGrid1.Columns(1).Width = 1000
DataGrid1.Columns(2).Width = 0
DataGrid1.Columns(3).Width = 1200
DataGrid1.Columns(4).Width = 1200 '拜访日期
DataGrid1.Columns(5).Width = 1000
DataGrid1.Columns(6).Width = 1400
DataGrid1.Columns(7).Width = 1500
DataGrid1.Columns(8).Width = 1000
DataGrid1.Columns(9).Width = 1000 '拜访地点
DataGrid1.Columns(10).Width = 1200
DataGrid1.Columns(11).Width = 1200
DataGrid1.Columns(12).Width = 1600
DataGrid1.Columns(13).Width = 1600
DataGrid1.Columns(14).Width = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -