Set m_BillTransfer = oBillTransfer
Set mdlCallIndustryBill.m_BillTransfer = m_BillTransfer
End Sub
Private Sub Class_Initialize()
CurRow = 0
End Sub
Private Sub Class_Terminate()
Set m_BillTransfer = Nothing
End Sub
Private Sub m_BillTransfer_BillInitialize()
m_BillTransfer.AddUserMenuItem "客户地址(&A)", "客户地址"
End Sub
Private Sub m_BillTransfer_HeadChange(ByVal CtlIndex As Long, ByVal Value As Variant, ByVal bNewBill As Boolean, Cancel As Boolean)
Dim rs As New ADODB.Recordset
Dim cnn As ADODB.Connection
Dim strSQL As String
aa = dovalue("购货单位:")
If (CtlIndex = aa) And Len(m_BillTransfer.GetHeadNumber(aa)) > 0 Then
' For intI = 1 To UBound(m_BillTransfer.HeadCtl)
' If UCase(m_BillTransfer.HeadCtl(intI).Caption) = UCase("地址") Then
' FAddNo = intI
' Exit For
' End If
'Next
FAddNo = dovalue("地址")
strSQL = " Select TOP 1 客户代码,客户名称,地址代码,客户地址 From CustInfo Where 客户代码 = '" & m_BillTransfer.GetHeadNumber(aa) & "' and isdefault=1"
Set cnn = New ADODB.Connection
cnn.Open m_BillTransfer.Cnnstring
Set rs = New ADODB.Recordset
rs.Open strSQL, cnn
'确认地址所在列
'For intI = 1 To UBound(m_BillTransfer.HeadCtl)
' If UCase(m_BillTransfer.HeadCtl(intI).Caption) = UCase("地址") Then
' FAddNo = intI
' Exit For
' End If
'Next
FAddNo = dovalue("地址")
' MsgBox FAddNo
aa = dovalue("购货单位:")
' For intIi = 1 To UBound(m_BillTransfer.HeadCtl)
' If UCase(m_BillTransfer.HeadCtl(intIi).FieldName) = UCase("fcustid") Then
' aa = intIi
' Exit For
' End If
' Next
If Len(m_BillTransfer.GetHeadNumber(aa)) = 0 Then
MsgBox "请先选择客户信息"
End If
If Len(m_BillTransfer.GetHeadNumber(aa)) > 0 Then
mm = m_BillTransfer.GetHeadNumber(aa) 'fcustid 位置
Formpt.Show
End If
Case Else
End Select
End Sub
Function dovalue(a As String)
For intI = 1 To UBound(m_BillTransfer.HeadCtl)
If UCase(m_BillTransfer.HeadCtl(intI).Caption) = UCase(a) Then
dovalue = intI
Exit For
End If
Next
End Function