16,552
社区成员
发帖
与我相关
我的任务
分享
Private Function MakeVouchPack(PropString As String, DataString As Variant) As Object
'入口参数
'1.PropString 为账套连接字符串
'2.DataString 为传入的凭证所需要保存的信息与数据
Dim i As Long, j As Long, k As Long
Dim Vdict As KFO.Dictionary, EVect As KFO.Vector, ent As KFO.Dictionary
Dim Dt As KFO.Dictionary, dtVect As KFO.Vector
Dim itemID, ItemClassID
Dim ItemNumber As Integer '核算项目数
Dim VchEntryNumber As Integer '凭证分录数
'此处检查相关的凭证信息是否有效(省略)
Set Vdict = New KFO.Dictionary '一张凭证,包含的凭证头的信息
'凭证日期
Vdict ("FDate")
'业务日期
Vdict ("FTransDate")
'凭证字ID
Vdict ("FGroupID")
'参考信息
Vdict ("FReference")
'附件张数
Vdict ("FAttachments")
'会计主管
Vdict ("FHandler")
'凭证序号
Vdict ("FSerialNum")
'不为空是 机制凭证(不能修改删除)
Vdict ("FInternalInd")
'其他系统传入凭证对象接口描述
Vdict ("FObjectName")
'接口参数
Vdict ("FParameter")
5
Set EVect = New KFO.Vector '一张凭证,所包含的业务信息的数据包
For i = 0 To VchEntryNumber - 1
Set ent = New KFO.Dictionary ''此处表示的是存储一条凭证分录所需要的信息
'摘要
ent ("FExplanation")
'科目
ent ("FAccountID")
FAccountNumber
'币别
ent ("FCurrencyID")
'计量单位
ent ("FMeasureUnitID")
'汇率
ent ("FExchangeRate")
'借方
ent ("FDebit")
'贷方
ent ("FCredit")
'总计
ent ("FAmountFor")
'核算项目
'此处表示存储一条核算项目的方法
Set dtVect = New KFO.Vector
For k = 0 To ItemNumber - 1
Set Dt = New KFO.Dictionary
Dt ("FItemID")
Dt ("FItemClassID")
dtVect.Add Dt
Next k
'===========================
Set ent("_Details") = dtVect
'===========================
'现金流转
ent ("CashFlowDetail")
Set dtVect = New KFO.Vector
For k = 0 To ItemNumber - 1
Set Dt = New KFO.Dictionary
Dt ("FItemID")
Dt ("FAmountFor")
Dt ("FAmount")
dtVect.Add Dt
Next k
'===========================
6
Set ent("CashFlow") = dtVect
'===========================
EVect.Add ent
Next i '下一条分录
If EVect.Size < 2 Then Exit Function '分录小于2 条
'分账制检查原币平衡
'检查借贷平衡
Set Vdict("_Entries") = EVect
Set MakeVouchPack = Vdict
End Function
Private Function MakeVouchPack() As Object
'入口参数
Dim i As Long, k As Long
Dim Vdict As KFO.Dictionary, EVect As KFO.Vector, ent As KFO.Dictionary
Dim Dt As KFO.Dictionary, dtVect As KFO.Vector
'Dim itemID, ItemClassID
Dim ItemNumber As Integer = 1 '核算项目数
Dim VchEntryNumber As Integer = 1 '凭证分录数
'此处检查相关的凭证信息是否有效(省略)
Vdict = New KFO.Dictionary '一张凭证,包含的凭证头的信息
'凭证日期
Vdict("FDate") = CDate("2013-12-01")
'业务日期
Vdict("FTransDate") = CDate("2013-12-01")
'凭证字ID
Vdict("FGroupID") = CLng("121")
'参考信息
Vdict("FReference") = "xx"
'附件张数
Vdict("FAttachments") = CLng("1")
'会计主管
' Vdict("FHandler") = "kevin"
'凭证序号
Vdict("FSerialNum") = CLng("1")
'不为空是 机制凭证(不能修改删除)
'Vdict("FInternalInd") = ""
''其他系统传入凭证对象接口描述
'Vdict("FObjectName") = ""
''接口参数
'Vdict("FParameter") = ""
EVect = New KFO.Vector '一张凭证,所包含的业务信息的数据包
' For i = 0 To VchEntryNumber - 1
ent = New KFO.Dictionary ''此处表示的是存储一条凭证分录所需要的信息
'摘要
ent("FExplanation") = "xxxccxcxcxc"
'科目
ent("FAccountID") = CLng("1000")
' FAccountNumber()
'币别
ent("FCurrencyID") = CInt("1")
'计量单位
ent("FMeasureUnitID") = CLng("0")
'汇率
ent("FExchangeRate") = CDec("1")
'借方
ent("FDebit") = CDec("100")
'贷方
ent("FCredit") = CDec("100")
'总计
ent("FAmountFor") = CDec("100")
'核算项目
'此处表示存储一条核算项目的方法
dtVect = New KFO.Vector
' For k = 0 To ItemNumber - 1
Dt = New KFO.Dictionary
Dt("FItemID") = CLng("236")
Dt("FItemClassID") = CLng("8")
dtVect.Add(Dt)
'Next k
'===========================
ent("_Details") = dtVect
'===========================
'现金流转
' ent("CashFlowDetail") = ""
dtVect = New KFO.Vector
' For k = 0 To ItemNumber - 1
Dt = New KFO.Dictionary
Dt("FItemID") = CLng("236")
Dt("FAmountFor") = CDec("100")
Dt("FAmount") = CDec("100")
dtVect.Add(Dt)
'Next k
'===========================
ent("CashFlow") = dtVect
'===========================
EVect.Add(ent)
' Next i '下一条分录
'If EVect.Size < 2 Then
' Exit Function
'End If
'分录小于2 条
'分账制检查原币平衡
'检查借贷平衡
Vdict("_Entries") = EVect
MakeVouchPack = Vdict
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim hasconn As Boolean
objK3Login = CreateObject("K3Login.ClsLogin")
If Not objK3Login.CheckLogin Then
hasconn = False '设置为未连接状态s
objK3Login = Nothing
MsgBox("未登录账套")
End
Else
My.Settings.erpserver = Trim(TextBox1.Text)
My.Settings.erpuser = Trim(TextBox2.Text)
My.Settings.erppw = Trim(TextBox3.Text)
My.Settings.erpdb = Trim(TextBox4.Text)
My.Settings.jdserver = Trim(TextBox5.Text)
My.Settings.jduser = Trim(TextBox6.Text)
My.Settings.jdpw = Trim(TextBox7.Text)
My.Settings.jddb = Trim(TextBox8.Text)
MsgBox("登录账套成功")
MakeVouchPack()
endif