vb调用K3接口

xiaqunfeng 2009-12-28 07:39:34
现在我们有一个项目,他们公司用的K3的财务软件,现在我们有些业务想实时的调用K3的财务凭证,所以我们尝试用vb来调用k3凭证接口,来达到新增凭证,默认是凭证的审核状态,由于我都VB之前都不是很了解,请各位大侠只能我一下
Private Sub Command1_Click()
Dim voucher As New KFO.Dictionary
Dim GlData As New EBCGLView.GlData
Dim GLView As New EBCGLView.GLView
Dim dtvect As KFO.Vector
Dim Dt As KFO.Dictionary
Dim obj As ADODB.Recordset
Dim ReturnCollection As Object
'vchdate = DateSerial(GlData.SystemProfile.GLGetCurrentYear, GlData.SystemProfile.GLGetCurrentPeriod, 1)
vchdate = DateSerial(2009, 12, 1)
voucher("FDate") = vchdate
voucher("FGroup") = "记"
voucher("FNumber") = Val(111)

Dim voucherentry As New KFO.Vector
Dim tempentry As New KFO.Dictionary

'Set tempentry = New KFO.Dictionary
tempentry("FExplanation") = "凭证录入检测-分录1"
tempentry("FAccountID") = 1014
tempentry("FCurrencyID") = 1
tempentry("FDC") = 1
tempentry("FAmountFor") = 100
tempentry("FAmount") = 100
tempentry("Fdebit") = 100
tempentry("Fcredit") = -100
Set dtvect = New KFO.Vector
Set obj = GlData.GetAccountItem(1014)
For i = 0 To obj.RecordCount - 1
Set ReturnCollection = GLView.ItemLookup(obj("FItemClassID"))
Set Dt = New KFO.Dictionary
Dt("FItemClassID") = ReturnCollection.ReturnObject.ItemClassID
Dt("FItemID") = ReturnCollection.ReturnObject.ItemID
dtvect.Add Dt
obj.MoveNext
Next i
Set tempentry("_Details") = dtvect
voucherentry.Add tempentry


Set tempentry = New KFO.Dictionary
tempentry("FExplanation") = "凭证录入检测-分录2"
tempentry("FAccountID") = 1045
tempentry("FCurrencyID") = 1
tempentry("FDC") = 0
tempentry("FAmountFor") = 100
tempentry("FAmount") = 100
Set dtvect = New KFO.Vector
Set obj = GlData.GetAccountItem(1045)
For i = 0 To obj.RecordCount - 1
'Set ReturnCollection = GLView.ItemLookup(obj("FItemClassID"))
Set Dt = New KFO.Dictionary
'Dt("FItemClassID") = ReturnCollection.ReturnObject.ItemClassID
'Dt("FItemID") = ReturnCollection.ReturnObject.ItemID
dtvect.Add Dt
obj.MoveNext
Next i
Set tempentry("_Details") = dtvect
voucherentry.Add tempentry

Set voucher("_Entries") = voucherentry

Dim cre As Object, voucherid As Long
Set cre = CreateObject("EBSGLVoucher.VoucherUpdate")
voucherid = cre.Create(k3login.PropsString, voucher)
Set cre = Nothing

End Sub

报错的是这句Set obj = GlData.GetAccountItem(1014) ,报的错是没有发现数据源名称且没有制定默认驱动程序,大哥们,急啊!
...全文
574 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
king06 2009-12-30
  • 打赏
  • 举报
回复
Dim GlData As New EBCGLView.GlData
从这里切入,分析这个EBCGLView.GlData对象连接数据库的状态
孤独剑_LPZ 2009-12-30
  • 打赏
  • 举报
回复
没有连上数据库吧,直接连数据库,写入新凭证不行吗
vansoft 2009-12-29
  • 打赏
  • 举报
回复
以前搞过..
饮水需思源 2009-12-28
  • 打赏
  • 举报
回复
也可以直接向财务数据库写入凭证记录
xiaqunfeng 2009-12-28
  • 打赏
  • 举报
回复
自己顶啊!

863

社区成员

发帖
与我相关
我的任务
社区描述
VB COM/DCOM/COM+
c++ 技术论坛(原bbs)
社区管理员
  • COM/DCOM/COM+社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧