我必须将日记帐分录应用/附加到VendorPayment以便排除,以便我尝试了两种方式:
首先更新(RecordRef)createdFrom Journal Journal =(recordRef)vendorPayment
这是我的代码:
RecordRef vPaymentRef = new RecordRef();
vPaymentRef.internalId = "7850";
vPaymentRef.type = RecordType.vendorPayment;
vPaymentRef.typeSpecified = true;
RecordRef currency = new RecordRef();
currency.internalId = "1";
currency.type = RecordType.currency;
RecordRef mySubsidiary = new RecordRef();
mySubsidiary.internalId = "3";
mySubsidiary.type = RecordType.subsidiary;
JournalEntry newJournalEntry = new JournalEntry();
newJournalEntry.subsidiary = mySubsidiary;
newJournalEntry.createdFrom = vPaymentRef;
//newJournalEntry.reversalEntry = "99";
newJournalEntry.reversalDate = DateTime.Now;
newJournalEntry.reversalDateSpecified = true;
//newJournalEntry.reversalDefer = true;
//newJournalEntry.reversalDeferSpecified = true;
RecordRef myCurrency = new RecordRef();
myCurrency.internalId = "1";
newJournalEntry.currency = myCurrency;
newJournalEntry.exchangeRate = .911;
newJournalEntry.exchangeRateSpecified = true;
RecordRef myDebitAccount = new RecordRef();
myDebitAccount.internalId = "290"; //account
RecordRef myCreditAccount = new RecordRef();
myCreditAccount.internalId = "25"; //a/p account
newJournalEntry.lineList = new JournalEntryLineList();
newJournalEntry.lineList.line = new JournalEntryLine[2];
newJournalEntry.lineList.line[0] = new JournalEntryLine();
newJournalEntry.lineList.line[0].account = myDebitAccount;
newJournalEntry.lineList.line[0].debit = 3333;
newJournalEntry.lineList.line[0].debitSpecified = true;
newJournalEntry.lineList.line[0].entity = vPayment.entity;
newJournalEntry.lineList.line[1] = new JournalEntryLine();
newJournalEntry.lineList.line[1].account = myCreditAccount;
newJournalEntry.lineList.line[1].credit = 3333;
newJournalEntry.lineList.line[1].creditSpecified = true;
newJournalEntry.lineList.line[1].entity = vPayment.entity;
WriteResponse wr = _service.add(newJournalEntry);
如您所见,我已向VendatedProm添加了VendorPayment,WriteResponse状态返回true,StatusDetail = null。但是当我访问刚刚在Netsuite网站上创建的日记帐分录时,VOID OF为空(不显示)。日记帐分录的类型是" Journal",它必须是" Voiding Journal"并且没有"逆转付款应用"在条目号旁边。
然后,我尝试第二种方式:更新供应商付款的voidJournal以使用刚创建的日记帐分录。
这是我的代码:
RecordRef recordRef = new RecordRef();
recordRef.internalId = "7850";
recordRef.type = RecordType.vendorPayment;
recordRef.typeSpecified = true;
ReadResponse response2 = _service.get(recordRef);
VendorPayment vPayment = (VendorPayment)response2.record;
RecordRef recordRefJournal = new RecordRef();
recordRefJournal.internalId = "8356";
recordRefJournal.type = RecordType.journalEntry;
recordRefJournal.typeSpecified = true;
vPayment.voidJournal = recordRefJournal;
vPayment.status = "VOIDED";
WriteResponse wr2 = _service.update(vPayment);
通过这种方式,WriteResponse状态仍为true,并且StatusDetail仍为null。当我在Netsuite网站上刷新此vendorPayment时,没有任何变化,VOIDED ON和状态不会改变。
我的观点是通过SuiteTalk消除VendorPayment。
我真的被困在这里,请帮忙。非常感谢!!
答案 0 :(得分:1)
Create From字段是一个只能由系统设置的字段。它只会在转换事务时填充。
只有在单击销售订单的“帐单”按钮时,才会填充“发票的创建自”字段,而另一个方案是单击“项目收货的创建自”字段的“接收”按钮时。
在suitescirpt中
nlapiTransformRecord('salesorder', 1, 'invoice');
使用标准的Created From字段无法实现您的目的。
答案 1 :(得分:1)
事实上,之前的评论是正确的。
您需要做的是两步:
考虑文章I wrote about writing off Customer Invoices with a Journal Entry的代码模式。
创始人Marty Zigman Prolecto Resources,Inc。 NetSuite系统集成 南加州领先的创新和实施实践