我可以在线购买quickbook上的发票,但是当我在线检查quickbook发票时,它会创建项目列表,但缺少价格和说明。我做错了什么。
invoice.AlternateId = new NameValue[] { new NameValue() { Name = "InvoiceID", Value = service.InvoiceId } };
InvoiceHeader Header = new InvoiceHeader();
Header.DocNumber = service.InvoiceId;
Header.TxnDate = service.ServiceDate;
Header.TxnDateSpecified = true;
Header.Msg = service.Note.ToString();
Header.Note = service.Note.ToString();
Header.CustomerId = new IdType() { idDomain = idDomainEnum.QBO, Value = service.CustomerNumberOnline };
Header.Currency = currencyCode.USD;
Header.ShipDate = service.ServiceDate;
Header.ShipDateSpecified = true;
//Print and Email Option fields
if (EmailPrintOption == "Both")
{
Header.ToBeEmailed = true;
Header.ToBeEmailedSpecified = true;
Header.ToBePrinted = true;
Header.ToBePrintedSpecified = true;
}
else if (EmailPrintOption == "print")
{
Header.ToBePrinted = true;
Header.ToBePrintedSpecified = true;
}
else if (EmailPrintOption == "email")
{
Header.ToBeEmailed = true;
Header.ToBeEmailedSpecified = true;
}
else
{
Header.ToBeEmailed = false;
Header.ToBeEmailedSpecified = false;
Header.ToBePrinted = false;
Header.ToBePrintedSpecified = false;
}
PhysicalAddress BillAddress = new PhysicalAddress();
BillAddress.Line1 = service.SoldToAddress;
BillAddress.City = service.SoldToCity;
BillAddress.CountrySubDivisionCode = service.SoldToState;
BillAddress.PostalCode = service.SoldToZip;
BillAddress.Tag = new string[] { "Billing" };
Header.BillAddr = BillAddress;
PhysicalAddress ShipAddress = new PhysicalAddress();
ShipAddress.Line1 = service.JobJocationAddress;
ShipAddress.City = service.JobLocationCity;
ShipAddress.CountrySubDivisionCode = service.JobLocationState;
ShipAddress.PostalCode = service.JobLocationZip;
BillAddress.Tag = new string[] { "Shipping" };
Header.ShipAddr = ShipAddress;
decimal discount;
if (decimal.TryParse(service.Discount, out discount))
{
Header.ItemElementName = ItemChoiceType2.DiscountAmt;
Header.Item = -1 * discount; //discount must be negative
}
InvoiceLine[] InvoiceLines = new InvoiceLine[TaskOnlineIDs.Count];
object[] intuitItems = new object[TaskOnlineIDs.Count];
for (int i = 0; i < InvoiceLines.Length; i++)
{
InvoiceLines[i] = new InvoiceLine();
InvoiceLines[i].ItemsElementName = new Intuit.Ipp.Data.Qbo.ItemsChoiceType2[]
{
Intuit.Ipp.Data.Qbo.ItemsChoiceType2.ItemId
};
InvoiceLines[i].Items = new object[] {
new IdType(){idDomain=idDomainEnum.QBO, Value=TaskOnlineIDs[i]}
};
}
invoice.Line = InvoiceLines;
Header.SalesTermName = service.PaymentType;
Header.SalesRepName = service.TechName;
Header.PONumber = service.PurchaseOrder;
invoice.Header = Header;
我想念的是什么? 这里发生的是,当我将发票行添加到发票时,它将每个项目的金额设置为&#34; 0&#34;默认情况下,所以当我尝试以实际方式添加折扣时,它会给出折扣误差大于小计的错误。但我的问题是,为什么我需要在我之前已经定义它们时明确地为每个项目增加成本。我们应该只添加itemId,其余的QB应该计算。