我一直在尝试向QBO发送日记帐分录(JE),我无法完全掌握如何创建对象。
所以我有我的整体JE对象并设置基本值。然后,在每个JE对象中,存在与JE中的每一行对应的Line对象的数组。然后每一行都有一个需要设置为JournalEntryLineDetail的DetailType,然后你应该创建包含更多行信息的JournalEntryLineDetail对象。但是,您将这个JournalEntryLineDetail对象放在Line对象中的哪个位置?你把它附加到Line.AnyIntuitObject对象?
我一直在阅读文档,并且没有明确的答案说“这是JournalEntryLineDetail去的地方”,我无法在任何地方找到答案。
我目前接近这个:
Dim je As New Intuit.Ipp.Data.JournalEntry()
Dim l As New Intuit.Ipp.Data.Line()
Dim jeld As New Intuit.Ipp.Data.JournalEntryLineDetail()
je.PrivateNote = "Something"
je.TxnDate = Now
l.Description = "Something Squared"
l.Amount = 100000000.00
l.DetailType = Intuit.Ipp.Data.LineDetailTypeEnum.JournalEntryLineDetail
jeld.PostingType = Intuit.Ipp.Data.PostingTypeEnum.Credit
jeld.AccountRef = 80
'Line to put jeld into the line - This is what I don't know how to do.
je.Line = {l}
注意:
这段代码并没有反映我在命名约定方面的实际编码能力,只是将它们放在一起以获得一个例子。
答案 0 :(得分:4)
创建JournalEntry对象并将行保存到对象时,需要将JournalEntryLineDetail保存到Line.AnyIntuitObject
对象。
答案 1 :(得分:4)
JournalEntry journalEntry = new JournalEntry();
journalEntry.Adjustment = true;
journalEntry.AdjustmentSpecified = true;
//journalEntry.JournalEntryEx =
journalEntry.DocNumber = "DocNu1";
journalEntry.TxnDate = DateTime.UtcNow.Date;
journalEntry.TxnDateSpecified = true;
journalEntry.HomeTotalAmt = 100;
journalEntry.HomeTotalAmtSpecified = true;
journalEntry.TotalAmt = 100;
journalEntry.TotalAmtSpecified = true;
List<Line> lineList = new List<Line>();
Line debitLine = new Line();
debitLine.Description = "nov portion of rider insurance";
debitLine.Amount = new Decimal(100.00);
debitLine.AmountSpecified = true;
debitLine.DetailType = LineDetailTypeEnum.JournalEntryLineDetail;
debitLine.DetailTypeSpecified = true;
JournalEntryLineDetail journalEntryLineDetail = new JournalEntryLineDetail();
journalEntryLineDetail.PostingType = PostingTypeEnum.Debit;
journalEntryLineDetail.PostingTypeSpecified = true;
journalEntryLineDetail.AccountRef = new ReferenceType() { name = "Accumulated Depreciation", Value = "36" };
debitLine.AnyIntuitObject = journalEntryLineDetail;
lineList.Add(debitLine);
Line creditLine = new Line();
creditLine.Description = "nov portion of rider insurance";
creditLine.Amount = new Decimal(100.00);
creditLine.AmountSpecified = true;
creditLine.DetailType = LineDetailTypeEnum.JournalEntryLineDetail;
creditLine.DetailTypeSpecified = true;
JournalEntryLineDetail journalEntryLineDetailCredit = new JournalEntryLineDetail();
journalEntryLineDetailCredit.PostingType = PostingTypeEnum.Credit;
journalEntryLineDetailCredit.PostingTypeSpecified = true;
journalEntryLineDetailCredit.AccountRef = new ReferenceType() { name = "Accumulated Depreciation", Value = "36" };
creditLine.AnyIntuitObject = journalEntryLineDetailCredit;
lineList.Add(creditLine);
journalEntry.Line = lineList.ToArray();
JournalEntry result = commonServiceQBO.Add(journalEntry) as JournalEntry;
您可以参考上面的dotnet。
答案 2 :(得分:0)
我没有任何使用devkit创建JE对象的.Net代码。
您可能需要参考以下java代码。
public JournalEntry getJournalEntryFields() throws FMSException {
JournalEntry journalEntry = new JournalEntry();
Line line1 = new Line();
line1.setDetailType(LineDetailTypeEnum.JOURNAL_ENTRY_LINE_DETAIL);
JournalEntryLineDetail journalEntryLineDetail1 = new JournalEntryLineDetail();
journalEntryLineDetail1.setPostingType(PostingTypeEnum.DEBIT);
//Account debitAccount = qboHelper.getCashBankAccount();
//journalEntryLineDetail1.setAccountRef(qboHelper.getAccountRef(debitAccount));
ReferenceType accountReferenceType = new ReferenceType();
accountReferenceType.setValue("10");
accountReferenceType.setName("Dues and Subscriptions");
journalEntryLineDetail1.setAccountRef(accountReferenceType);
line1.setJournalEntryLineDetail(journalEntryLineDetail1);
line1.setAmount(new BigDecimal("100.00"));
Line line2 = new Line();
line2.setDetailType(LineDetailTypeEnum.JOURNAL_ENTRY_LINE_DETAIL);
JournalEntryLineDetail journalEntryLineDetail2 = new JournalEntryLineDetail();
journalEntryLineDetail2.setPostingType(PostingTypeEnum.CREDIT);
// /Account creditAccount = qboHelper.getCreditCardBankAccount();
journalEntryLineDetail2.setAccountRef(accountReferenceType);
line2.setJournalEntryLineDetail(journalEntryLineDetail2);
line2.setAmount(new BigDecimal("100.00"));
List<Line> lines1 = new ArrayList<Line>();
lines1.add(line1);
lines1.add(line2);
journalEntry.setLine(lines1);
return journalEntry;
}
由于