空白の Quickbooks ストアに IPP 経由で請求書を挿入しようとしています。請求書の項目の項目の ID が存在しないため、挿入は常に失敗します。私はこれをコード化するために複数のパスを試してきましたが、成功しませんでした。アイテムを照会できると思ったのですが、探しているアイテムが見つからない場合は作成します。私はこれを機能させることができないようです。作成した新しいアイテムで請求書を作成することはできますか?
私は現在、次のように請求書を作成しています: (問題は、「object[]invoiceItemValues」で始まる行です) InvoiceHeader.ARAccountName = "売掛金"; InvoiceHeader.BillAddr = physicalAddress; 請求書ヘッダー.顧客名 = 顧客.名前; InvoiceHeader.DocNumber = (invoiceMaxId).ToString().PadLeft(4, '0'); 請求書ヘッダー.TaxAmt = salesTax; 請求書ヘッダー.TotalAmt = 金額;
List<Intuit.Ipp.Data.Qbd.InvoiceLine> listLine = new List<Intuit.Ipp.Data.Qbd.InvoiceLine>();
Intuit.Ipp.Data.Qbd.ItemsChoiceType2[] invoiceItemAttributes = { Intuit.Ipp.Data.Qbd.ItemsChoiceType2.ItemId, Intuit.Ipp.Data.Qbd.ItemsChoiceType2.UnitPrice, Intuit.Ipp.Data.Qbd.ItemsChoiceType2.Qty };
object[] invoiceItemValues = { new Intuit.Ipp.Data.Qbd.IdType() { idDomain = Intuit.Ipp.Data.Qbd.idDomainEnum.QB, Value = "2" }, amount, new decimal(1) };
var invoiceLine = new Intuit.Ipp.Data.Qbd.InvoiceLine();
invoiceLine.Amount = amount;
invoiceLine.AmountSpecified = true;
invoiceLine.Desc = "test " + date.ToShortDateString(); // TODO: This will need to hold the additional fields
invoiceLine.ItemsElementName = invoiceItemAttributes;
invoiceLine.Items = invoiceItemValues;
invoiceLine.ServiceDate = date;
invoiceLine.ServiceDateSpecified = true;
listLine.Add(invoiceLine);
Intuit.Ipp.Data.Qbd.Invoice invoice = new Intuit.Ipp.Data.Qbd.Invoice();
invoice.Header = invoiceHeader;
invoice.Line = listLine.ToArray();
これは私が得るエラーです:「txn_line_rec.item_id INVALID key = 30 domain = QB enum = Itemの検証」
これはアイテムをクエリしようとするものですが、ID も必要とします。
ItemQuery qbdItemQuery = new ItemQuery();
qbdItemQuery.Items = new object[] { new IdSet() { Id = new IdType[] { new IdType() { idDomain = idDomainEnum.NG, Value = "79841" } } } };
qbdItemQuery.ItemsElementName = new ItemsChoiceType4[] { ItemsChoiceType4.ListIdSet };
List<Item> ItemQueryResult = qbdItemQuery.ExecuteQuery<Item>(context).ToList<Item>();