金蝶 凭证相关代码转化 VB 转化为C# ole 编程
//创建凭证 已实现
System.Type oType = System.Type.GetTypeFromProgID("Mvedit.MVoucherEdit");
object o = System.Activator.CreateInstance(oType);
//调用凭证新增界面
oType.InvokeMember("LoadVoucher", System.Reflection.BindingFlags.InvokeMethod, null, o, new object[] { 0, null, null, null, null });
//创建凭证 并添加凭证数据 请问 创建凭证 代码转化处理 VB 代码如下:
'建立界面显示凭证数据
Private Function CreateVoucher() As Object
Dim Voucher As Object '凭证对象
Dim VoucherEntrys As Object '凭证分录对象
Set Voucher = CreateObject("EBCGL.Voucher")
Voucher.Construct Nothing, Nothing '建立凭证数据对象
Set VoucherEntrys = Voucher.Entries '设置凭证分录对象
Voucher.InternalInd = "Super" '机制凭证信息(可选)
'设置凭证默认日期(可选)
' Voucher.TransDate = Format(Now, "yyyy-mm-dd") '业务日期
' Voucher.VoucherDate = Format(Now, "yyyy-mm-dd") '凭证日期
Voucher.GroupID = CboGroup.ItemData(CboGroup.ListIndex) '凭证字
Voucher.Number = Val(TxtNumber.Text) '凭证号
'下面输入凭证分录数据
'借方分录数据
Dim Acct1 As Long, Acct2 As Long
GetRndAccountID Acct1, Acct2
If Acct1 * Acct2 = 0 Then Exit Function
VoucherEntrys.Add
With Voucher.Entries(Voucher.Entries.Count)
.Explanation = "凭证录入检测-分录1"
.AccountID = Acct1
.Amount = 100
.AmountFor = 100
.ExchangeRate = 1
.CurrencyID = 1
.DC = 1 '借方
End With
'贷方分录数据
VoucherEntrys.Add
With Voucher.Entries(Voucher.Entries.Count)
.Explanation = "凭证录入检测-分录1"
.AccountID = Acct2
.Amount = 100 '本位币
.AmountFor = 100 '原币
.ExchangeRate = 1 '汇率
.CurrencyID = 1 '币别
.DC = 0 '贷方
End With
Set CreateVoucher = Voucher
End Function
//另外请问 如果科目又核算项目 怎么添加核算项目 ^_^ 分不多,还请大侠 不吝赐教