📄 frmcustomer.frm
字号:
FontPitchAndFamily= 34
ParagraphAlign = 3
End
Begin MSForms.CommandButton cmdPopupMenu
Height = 348
Index = 0
Left = 50
TabIndex = 9
Tag = "1018"
Top = 3240
WhatsThisHelpID = 5010
Width = 1308
Caption = "编辑"
PicturePosition = 196613
Size = "2307;614"
FontName = "宋体"
FontHeight = 180
FontCharSet = 134
FontPitchAndFamily= 34
ParagraphAlign = 3
End
Begin VB.Label lblFindKind
AutoSize = -1 'True
Caption = "查找(&B)"
Height = 181
Left = 50
TabIndex = 0
Top = 151
Width = 630
End
Begin VB.Label lblFind
AutoSize = -1 'True
Caption = "内容(&C)"
Height = 180
Left = 2535
TabIndex = 2
Top = 151
Width = 630
End
End
Attribute VB_Name = "frmCustomerList"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'''''''''''''''''''''''''''''''''''''''
' 往来单位列表
' 作者:郑权
' 日期:98.6.23
' 引出属性:IsShowCard 功能:判断往来单位卡片是否关闭
' 引入参数:msgCustomer 功能:判断往来单位卡片是否发出(增加或修改)改变消息
'
'''''''''''''''''''''''''''''''''''''''
Option Explicit
Private mIsShowCard(4) As Boolean '卡片窗口显示标志
Private mblnCheckNoChange As Boolean '不需要响应chkshowAll控件Change事件
Private mblnComboxNoClick As Boolean
Private WithEvents mclsMainControl As MainControl '主控对象
Attribute mclsMainControl.VB_VarHelpID = -1
Private WithEvents mclsSubClass As SubClass32.SubClass '钩子对象
Attribute mclsSubClass.VB_VarHelpID = -1
Private WithEvents mclsSubClassform As SubClass32.SubClass
Attribute mclsSubClassform.VB_VarHelpID = -1
Private mclsList(2) As list '列表对象
Private blnIsLoad(2) As Boolean
Private intViewID(2) As Integer
Private intShowall(2) As Integer
Private strFieldName, strFieldType As String '单位名称和单位类型
Private Const FieldName = "单位名称"
Private Const FieldType = "单位性质"
'
'方法及函数
'
'产生往来单位列表记录集
Public Function GetList(ByVal intTab As Integer) As rdoResultset
Dim recRecordset As rdoResultset
Dim strSelectOfSql As String
Dim strFromOfSql As String
Dim strWhereOfSql As String
Dim strSql As String
strSelectOfSql = mclsList(intTab).ListSet.GetSelect
strFromOfSql = mclsList(intTab).ListSet.FromOfSql
strWhereOfSql = mclsList(intTab).ListSet.WhereOfSql
Select Case intTab
Case 0
strSelectOfSql = "Select CustomerType.lngCustomerTypeID As id,decode(CustomerType.blnIsInActive,1,'√','') As ""停用""," & strSelectOfSql
If Trim(strWhereOfSql) <> "" Then
strWhereOfSql = " where " & strWhereOfSql
End If
Case 1
strSelectOfSql = "Select Customer.lngCustomerID As id,decode(Customer.blnIsInActive,1,'√','') As ""停用""," & strSelectOfSql
If Trim(strWhereOfSql) <> "" Then
strWhereOfSql = " where " & strWhereOfSql
End If
Case 2
strSelectOfSql = "Select Job.lngJobID As id,decode(Job.blnIsInActive,1,'√','') As ""停用""," & strSelectOfSql
If Trim(strWhereOfSql) <> "" Then
strWhereOfSql = " Where " & strWhereOfSql
End If
End Select
strSql = strSelectOfSql & strFromOfSql & strWhereOfSql
Set recRecordset = gclsBase.BaseDB.OpenResultset(strSql, rdOpenStatic)
'列表是否为空
If recRecordset.RowCount = 0 Then
mclsList(intTab).FlexGrid.HighLight = flexHighlightNever
cmdAgain.Enabled = False
Else
mclsList(intTab).FlexGrid.HighLight = flexHighlightAlways
cmdAgain.Enabled = True
End If
mclsList(intTab).ShowAll = True
Set GetList = recRecordset
End Function
'调用接口
Public Function ShowList(ByVal lngID As Long, Optional intTab As Integer = 0) As Boolean
Dim intCount As Integer
Dim strSortField As String
Dim strSortDec As String
Dim strSql As String
Dim recTemp As rdoResultset
Dim strofFrom As String
Dim strofWhere As String
' Me.Show
' Me.ZOrder 0
With frmMain.mnuListCustomer
If IsNumeric(.Tag) Then
If CLng(.Tag) > 0 Then
BringWindowToTop .Tag
Else
Me.BindingResultSet
End If
Else
Me.BindingResultSet
End If
End With
Me.sstCustomer.Tab = intTab
With mclsList(intTab).ListSet
'得到排序字段
For intCount = 1 To .Columns
If .ColumnOrderType(intCount) <> 0 Then
strSortField = .ColumnFieldName(intCount)
strSortDec = .ColumnDesc(intCount)
Exit For
End If
Next
If intCount > .Columns Then
ShowList = False
Exit Function
End If
strofFrom = .FromOfSql
strofWhere = .WhereOfSql
End With
'根据lngID得到排序字段值
strSql = "Select " & strSortField & " As " & strSortDec
Select Case intTab
Case 0
If strofWhere <> "" Then
strofWhere = " where " & strofWhere & " and CustomerType.lngCustomerTypeID=" & lngID
Else
strofWhere = " where CustomerType.lngCustomerTypeID=" & lngID
End If
Case 1
If strofWhere <> "" Then
strofWhere = " where " & strofWhere & " and Customer.lngCustomerID=" & lngID
Else
strofWhere = " where Customer.lngCustomerID=" & lngID
End If
Case 2
If strofWhere <> "" Then
strofWhere = " where " & strofWhere & " and Job.lngJobID=" & lngID
Else
strofWhere = " where Job.lngJobID=" & lngID
End If
End Select
strSql = strSql & strofFrom & strofWhere
Set recTemp = gclsBase.BaseDB.OpenResultset(strSql, rdOpenStatic)
With recTemp
If .RowCount > 0 Then
txtfind.Text = recTemp(strSortDec) '查找
With mclsList(intTab).FlexGrid
If .TextMatrix(.Row, 0) = lngID Then '是否找到
ShowList = True
Else
ShowList = False
End If
End With
Else
ShowList = False
End If
.Close
End With
End Function
'反映是否有卡片存在
Public Property Let IsShowCard(ByVal Index As Integer, ByVal vNewValue As Boolean)
mIsShowCard(Index) = vNewValue
End Property
Public Property Get IsShowCard(ByVal Index As Integer) As Boolean
IsShowCard = mIsShowCard(Index)
End Property
'按照往来单位ID提取记录
Public Function GetbyListID(ByVal intTab As Integer, ByVal lngID As Long) As rdoResultset
Dim recRecordset As rdoResultset
Dim strSql As String
Select Case intTab
Case 0
strSql = "Select * From CustomerType Where lngCustomerTypeID = " & lngID
Case 1
strSql = "Select * From Customer Where lngCustomerID = " & lngID
Case 2
strSql = "Select * From Job Where lngJobID = " & lngID
End Select
Set recRecordset = gclsBase.BaseDB.OpenResultset(strSql, rdOpenStatic)
Set GetbyListID = recRecordset
End Function
'按照往来单位ID更新停用标志
Private Function UpdateListInActive(ByVal intTab As Integer, ByVal lngID As Long, ByVal blnIsInActive As Boolean) As Boolean
Dim strSql As String
Select Case intTab
Case 0
strSql = "UPDATE CustomerType SET blnIsInActive = " & IIf(blnIsInActive, 1, 0) & " WHERE lngCustomerTypeID = " & lngID
Case 1
strSql = "UPDATE Customer SET blnIsInActive = " & IIf(blnIsInActive, 1, 0) & " WHERE lngCustomerID = " & lngID
Case 2
strSql = "UPDATE Job SET blnIsInActive = " & IIf(blnIsInActive, 1, 0) & " WHERE lngJobID = " & lngID
End Select
UpdateListInActive = gclsBase.ExecSQL(strSql)
End Function
'删除往来单位ID指定记录
Private Function DelByCustomerID(ByVal lngID As Long, ByVal intTab As Integer) As Boolean
Dim strSql As String
Select Case intTab
Case 0
strSql = "Delete From CustomerType WHERE lngCustomerTypeID = " & lngID
Case 1
strSql = "Delete From Customer WHERE lngCustomerID = " & lngID
Case 2
strSql = "Delete From Job WHERE lngJobID = " & lngID
End Select
DelByCustomerID = gclsBase.ExecSQL(strSql)
End Function
'判断往来单位ID是否使用
Private Function IsUseCustomerID(ByVal lngID As Long, ByVal intTab As Integer) As Boolean
Dim recRecordset As rdoResultset
Dim strSql As String
If intTab = 0 Then
strSql = "Select lngCustomerTypeID From CustomerType Where lngCustomerTypeID = " & lngID
ElseIf intTab = 1 Then
strSql = "Select lngCustomerID From Customer Where lngCustomerID = " & lngID
ElseIf intTab = 2 Then
strSql = "Select lngJobID From Job Where lngJobID = " & lngID
End If
Set recRecordset = gclsBase.BaseDB.OpenResultset(strSql, rdOpenStatic)
IsUseCustomerID = (recRecordset.RowCount >= 1)
recRecordset.Close
End Function
' 往来单位ID
Public Property Get ListID(ByVal intTab As Integer) As Long
With mclsList(intTab).FlexGrid
If .TextArray(.Row * .Cols) <> "" And .Row > 0 Then
ListID = CLng(.TextArray(.Row * .Cols))
Else
ListID = 0
End If
End With
End Property
' 往来单位停用标志
Public Property Get ListIsInActive(ByVal intTab As Integer) As Boolean
If chkShowAll.Value Then
With mclsList(intTab).FlexGrid
ListIsInActive = Not (.TextArray(.Row * .Cols + 1) = "")
End With
Else
ListIsInActive = False
End If
End Property
'根据列表中记录数,设置菜单可用属性
Private Sub UpdateMenuStatus()
Dim blnIsnotEmpty As Boolean
Dim blnFindNoChange As Boolean
Dim IsHaveRight As Boolean
Select Case sstCustomer.Tab
Case 0, 1
IsHaveRight = IsCanDo(11, gclsBase.OperatorID)
Case 2
IsHaveRight = IsCanDo(15, gclsBase.OperatorID)
End Select
With mclsList(sstCustomer.Tab).FlexGrid
If .Rows > 1 And .ColSel <> 0 And .RowHeight(.Row) > 0 Then
blnIsnotEmpty = True
Else
blnIsnotEmpty = False
End If
End With
With frmMain
.mnuEditEdit.Caption = "修改(&E)"
.mnuEditNew.Caption = "新增(&N)"
.mnuEditDel.Caption = "删除(&D)"
.mnuEditCopy.Enabled = blnIsnotEmpty
.mnuEditEdit.Enabled = blnIsnotEmpty And IsHaveRight
.mnuEditNew.Enabled = True And IsHaveRight
.mnuEditDel.Enabled = blnIsnotEmpty And IsHaveRight
.mnuEditInActive.Checked = False
.mnuEditInActive.Visible = False
.mnuEditInActive.Enabled = blnIsnotEmpty And IsHaveRight
.mnuEditShowAll.Checked = chkShowAll.Value
.mnuEditShowAll.Enabled = True
.mnuEditSearch.Enabled = True
.mnuEditUse.Enabled = blnIsnotEmpty
If sstCustomer.Tab = 1 Or sstCustomer.Tab = 2 Then
.mnuEditNotepad.Enabled = blnIsnotEmpty
Else
.mnuEditNotepad.Enabled = False
End If
.mnuEditColumn.Enabled = True
.mnuEditFilter.Enabled = True
.mnuFilePrint.Enabled = True
.mnuFilePrintSetup.Enabled = True
' .mnuReportQuick.Enabled = blnIsNotEmpty
.mnuToolRefresh.Enabled = True
End With
If sstCustomer.Tab = 0 Or (blnIsnotEmpty = False) Then
strFieldName = ""
Else
GetCustomerType '取单位名称和单位类型
End If
If mclsList(sstCustomer.Tab).FlexGrid.ColSel = 0 Then '无当前选定行
blnFindNoChange = mclsList(sstCustomer.Tab).FindNoChange
mclsList(sstCustomer.Tab).FindNoChange = True
txtfind.Text = ""
mclsList(sstCustomer.Tab).FindNoChange = blnFindNoChange
cmdAgain.Enabled = False
strFieldName = ""
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -