金蝶K3凭证导入二次开发之核算项目和现金流
金蝶K3凭证导入二次开发之核算项目和现金流 X
1.添加组件引用
2.登录验证,获取K/3连接字符串。
Private K3Login As Object '当前连接对象
Private Sub Login()
On Error GoTo Conn_Error
Set K3Login = CreateObject('K3Login.ClsLogin')
If Not K3Login.CheckLogin Then
AddString '连接不成功'
Set K3Login = Nothing
Exit Sub
End If
Conn_Error:
AddString 'ErrCode:' & Err & ' ErrDescription:' & Err.Description
End Sub
3.保存凭证(包括凭证分录,核算科目及现金流)
Private Function SaveVoucher() As Long
On Error GoTo ErrHandle
Dim Voucher As New KFO.Dictionary
Dim Dt As New KFO.Dictionary
Dim dtVector As New KFO.Vector
Dim VoucherEntry As New KFO.Vector
Dim tempEntry As KFO.Dictionary
'当前期间凭证日期
Voucher('FDate') = '2015/9/1'
'凭证字
Voucher('FGroup') = '记'
'凭证号 注意不能重复,重复则报错
Voucher('FNumber') = 611
'***********************************************
'添加第一条分录
Set tempEntry = New KFO.Dictionary
'摘要
tempEntry('FExplanation') = '凭证录入检测-分录1'
'科目ID t_Account表的FAccountID字段
tempEntry('FAccountID') = 1020