?? bos_mgtoaccbill_plugins.cls
字號(hào):
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "BOS_MgToAccBill_PlugIns"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Attribute VB_Description = "This is BillEvent Interface Class, made by K3BOSPLUGINSWIZAED"
Option Explicit
'定義 BillEvent 接口. 必須具有的聲明, 以此來獲得事件
Private WithEvents m_BillInterface As BillEvent
Attribute m_BillInterface.VB_VarHelpID = -1
Public Sub Show(ByVal oBillInterface As Object)
'BillEvent 接口實(shí)現(xiàn)
'注意: 此方法必須存在, 請(qǐng)勿修改
Set m_BillInterface = oBillInterface
End Sub
Private Sub Class_Terminate()
'釋放接口對(duì)象
'注意: 此方法必須存在, 請(qǐng)勿修改
Set m_BillInterface = Nothing
End Sub
'************************************************************
'新增單據(jù)后,自動(dòng)給代碼付值
'************************************************************
Private Sub m_BillInterface_AfterNewBill()
Dim sSql As String
Dim rs As New ADODB.Recordset
With m_BillInterface
sSql = "select max(cast(FNumber as decimal)) as maxNum from t_EP_ER_AccToMgAcc "
Set rs = .K3Lib.GetData(sSql)
If rs.State = adStateOpen And rs.RecordCount > 0 Then
.SetFieldValue "FNumber", CStr(CNulls(rs("maxNum"), 0)) + 1
End If
End With
Set rs = Nothing
End Sub
'************************************************************
'在保存前判斷是否是重復(fù)的會(huì)計(jì)科目在部門
'************************************************************
Private Sub m_BillInterface_BeforeSave(bCancel As Boolean)
Dim iAccId As Long
Dim iDepId As Long
Dim sSql As String
Dim rs As New ADODB.Recordset
On Error GoTo ERR
With m_BillInterface
iAccId = .GetFieldValue("FAcctID")
iDepId = .GetFieldValue("FDepID")
sSql = "select count(*) as cun from t_EP_ER_AccToMgAccEntry1 where FAcctid=" & iAccId & " and FDepID= " & iDepId & " and fid<> " & .CurBillID
Set rs = .K3Lib.GetData(sSql)
If rs.State = adStateOpen And rs("cun") > 0 Then
bCancel = True
MsgBox "不能輸入重復(fù)的會(huì)計(jì)科目和部門的組合!", vbOKOnly + vbInformation, HINTINFO
End If
End With
Set rs = Nothing
Exit Sub
ERR:
Set rs = Nothing
MsgBox ERR.Number & ERR.Description, vbOKOnly + vbExclamation, HINTINFO
End Sub
Private Sub m_BillInterface_Change(ByVal dct As KFO.IDictionary, ByVal dctFld As KFO.IDictionary, ByVal Col As Long, ByVal Row As Long, Cancel As Boolean)
Dim bret As Boolean
Dim sErr As String
If dct("FFieldName") = "FBudgetItemNum" Then
bret = getMgInfo(m_BillInterface.GetFieldValue("FBudgetItemNum"), sErr)
If bret = False Then MsgBox sErr, vbOKOnly + vbExclamation, HINTINFO
End If
End Sub
Private Function getMgInfo(sBudGetItemNum As String, ByRef sErr As String) As Boolean
Dim sSql As String
Dim rs As New ADODB.Recordset
With m_BillInterface
sSql = "select * from t_MgAcct where FNumber='" & sBudGetItemNum & "'"
' sSql = "CASE WHEN (ISNULL(t3.Fname,'')<>'') THEN t3.Fname +'-'+t2.fname+'-'+t1.Fname ELSE t2.fname+'-'+t1.Fname END AS FDSP" & _
' " ,T1.* from t_mgacct t1 " & _
' " left join t_mgacct t2 on t2.Fmgacctid=t1.FParentid " & _
' " left join t_mgacct t3 on t3.Fmgacctid=t2.FParentid " & _
' " Where t1.fDetail = 1 " & _
' " order by t1.fnumber "
Set rs = .K3Lib.GetData(sSql)
If rs.State = adStateOpen And rs.RecordCount = 1 Then
If rs("FDetail") <> True Then
sErr = "您所選的預(yù)算科目不是明細(xì)科目!"
GoTo ERR
End If
' .SetFieldValue "FBudgetItemNum", rs("FNumber")
.SetFieldValue "FBudgetItem", rs("FMgAcctId")
.SetFieldValue "FBudgetItemName", rs("FName")
getMgInfo = True
Else
sErr = "沒有您所輸入的預(yù)算科目!"
GoTo ERR
End If
End With
Exit Function
ERR:
getMgInfo = False
m_BillInterface.SetFieldValue "FBudgetItemNum", ""
m_BillInterface.SetFieldValue "FBudgetItem", ""
m_BillInterface.SetFieldValue "FBudgetItemName", ""
Set rs = Nothing
Exit Function
End Function
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -