📄 frmvisitclientcard.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmVisitClientCard
BorderStyle = 3 'Fixed Dialog
Caption = "拜访客户资料"
ClientHeight = 4635
ClientLeft = 30
ClientTop = 330
ClientWidth = 7860
KeyPreview = -1 'True
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4635
ScaleWidth = 7860
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox cboClient
Height = 300
Index = 1
Left = 4980
TabIndex = 3
Top = 120
Width = 1380
End
Begin VB.TextBox txtInput
Appearance = 0 'Flat
Height = 324
Left = 3024
MaxLength = 20
TabIndex = 4
Top = 2160
Visible = 0 'False
Width = 1140
End
Begin VB.CommandButton cmdOK
Height = 345
Index = 2
Left = 6528
Style = 1 'Graphical
TabIndex = 8
Tag = "1012"
Top = 1260
Width = 1215
End
Begin VB.CommandButton cmdOK
Height = 345
Index = 1
Left = 6528
Style = 1 'Graphical
TabIndex = 7
Tag = "1002"
Top = 864
Width = 1215
End
Begin VB.CommandButton cmdOK
Height = 345
Index = 0
Left = 6528
Style = 1 'Graphical
TabIndex = 6
Tag = "1001"
Top = 480
Width = 1215
End
Begin MSFlexGridLib.MSFlexGrid msgClient
Height = 4092
Left = 120
TabIndex = 5
Top = 480
Width = 6252
_ExtentX = 11033
_ExtentY = 7223
_Version = 393216
Cols = 8
FixedCols = 0
BackColorBkg = -2147483643
FormatString = "|月份|工作天数|拜访次数|拜访内容 |联系人 "
End
Begin VB.ComboBox cboClient
Height = 300
Index = 0
Left = 816
TabIndex = 1
Top = 120
Width = 3000
End
Begin VB.Label lblClient
AutoSize = -1 'True
Caption = "年度(&Y)"
Height = 180
Index = 1
Left = 4290
TabIndex = 2
Top = 165
Width = 630
End
Begin VB.Label lblClient
AutoSize = -1 'True
Caption = "职员(&E)"
Height = 180
Index = 0
Left = 120
TabIndex = 0
Top = 168
Width = 648
End
End
Attribute VB_Name = "frmVisitClientCard"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Compare Text
Private mclsGrid As Grid
Private mintYear As Integer
Private mlngEmployeeID As Long
Private mlngRow As Long
Private mlngCol As Long
Private mbytIDCol As Byte
Private mbytMonthCol As Byte
Private mbytWorkingCol As Byte
Private mbytPlanTimeCol As Byte
Private mbytTimeCol As Byte
Private mbytNoteCol As Byte
Private mbytContCol As Byte
Private mblnIsChanged As Boolean
Private mblnIsRefer As Boolean
Public Property Let Employee(ByVal lngEmployeeID As Long)
mlngEmployeeID = lngEmployeeID
End Property
Private Sub GetColNO()
Dim b As Byte
For b = 0 To msgClient.Cols - 1
Select Case msgClient.TextMatrix(0, b)
Case "lngVisitID": mbytIDCol = b
Case "月份": mbytMonthCol = b
Case "工作天数": mbytWorkingCol = b
Case "计划拜访次数": mbytPlanTimeCol = b
Case "拜访次数": mbytTimeCol = b
Case "拜访内容": mbytNoteCol = b
Case "联系人": mbytContCol = b
End Select
Next b
End Sub
Private Sub InitCbo()
Dim recE As rdoResultset, strSql As String, strEmployee As String
strEmployee = ""
strSql = "SELECT lngEmployeeID,strEmployeeCode,strEmployeeName " _
& "FROM Employee WHERE blnSale ORDER BY strEmployeeCode"
Set recE = gclsBase.BaseDB.OpenResultset(strSql, rdOpenForwardOnly)
While Not recE.EOF
cboClient(0).AddItem recE("strEmployeeCode") & " " & recE("strEmployeeName")
cboClient(0).ItemData(cboClient(0).NewIndex) = recE("lngEmployeeID")
If recE("lngEmployeeID") = mlngEmployeeID Then
strEmployee = recE("strEmployeeCode") & " " & recE("strEmployeeName")
End If
recE.MoveNext
Wend
recE.Close
If strEmployee <> "" Then
cboClient(0).Text = strEmployee
Else
If cboClient(0).ListCount > 0 Then cboClient(0).ListIndex = 0
End If
strSql = "SELECT intYear FROM AccountYear ORDER BY intYear"
Set recE = gclsBase.BaseDB.OpenResultset(strSql, rdOpenForwardOnly)
While Not recE.EOF
cboClient(1).AddItem recE("intYear")
recE.MoveNext
Wend
recE.Close
cboClient(1).ListIndex = 0
End Sub
Private Sub ClearGrid()
Dim bytRow As Byte, bytCol As Byte
For bytRow = 1 To 12
For bytCol = 2 To msgClient.Cols - 1
msgClient.TextMatrix(bytRow, bytCol) = ""
Next bytCol
Next bytRow
End Sub
Private Sub InitGrid()
Dim b As Byte, strSql As String, recData As rdoResultset
ClearGrid
strSql = "SELECT * FROM CustomerVisit WHERE CustomerVisit.lngEmployeeID=" & mlngEmployeeID _
& " AND intYear=" & mintYear & " ORDER BY bytPeriod"
Set recData = gclsBase.BaseDB.OpenResultset(strSql, rdOpenForwardOnly)
With msgClient
While Not recData.EOF
.TextMatrix(recData("bytPeriod"), 2) = IIf(recData("intWorkDays") = 0, "", recData("intWorkDays"))
.TextMatrix(recData("bytPeriod"), 3) = IIf(recData("lngPlanTimes") = 0, "", recData("lngPlanTimes"))
.TextMatrix(recData("bytPeriod"), 4) = IIf(recData("dblTimes") = 0, "", recData("dblTimes"))
.TextMatrix(recData("bytPeriod"), 5) = recData("strNote")
.TextMatrix(recData("bytPeriod"), 6) = recData("strContactName")
recData.MoveNext
Wend
recData.Close
For b = 0 To .Cols - 1
.FixedAlignment(b) = flexAlignCenterCenter
Next b
.ColAlignment(2) = flexAlignRightCenter
.ColAlignment(3) = flexAlignRightCenter
.ColAlignment(4) = flexAlignRightCenter
.ColWidth(0) = 0
.ColWidth(1) = 450
.ColWidth(2) = 1300
.ColWidth(3) = 1200
.ColWidth(4) = 1200
.ColWidth(5) = 1000
.ColWidth(6) = 800
End With
mlngRow = 0
mlngCol = 1
mclsGrid.SetupStyle
End Sub
Private Sub cboClient_Click(index As Integer)
If index = 0 Then
If cboClient(0).ItemData(cboClient(0).ListIndex) <> mlngEmployeeID Then
If mblnIsChanged Then SaveData
mlngEmployeeID = cboClient(0).ItemData(cboClient(0).ListIndex)
InitGrid
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -