如何插入的QuickBook发票多个项目(How to insert multiple items

2019-10-18 18:06发布

我需要插入特定客户一个新的发票,我可以可以插入,但我没有关于如何在发票插入多个项目的任何想法。 如何使用物业项目及ItemsElementName插入多个项目。 如果我的问题不清楚,请让我知道。 我附上快照和代码以供参考。

码:

protected void btnsendInvoiceDetails_Click(object sender, EventArgs e)
        {
                string accessToken = "lvprdRM1HLr6o11Bnip2fGizlXWbFfADnS1Btvm2L4VPOTRI";
                string appToken = "297db54bb5526b494adb86fb2a41063192cd";
                string accessTokenSecret = "JfSTrprW83JTXrSVHD3uf7th23gP0SOzBQcn4Nrt";
                string consumerKey = "qyprdKLN5YHpCPSlWQZTiKVc28dywR";
                string consumerSecret = "JPMNB37YnCPGU9m9vuXkF2M71lbDb7blhcLB7HeF";
                string companyID = "813162085";
                OAuthRequestValidator oauthValidator = new OAuthRequestValidator(accessToken, accessTokenSecret, consumerKey, consumerSecret);
                ServiceContext context = new ServiceContext(oauthValidator,appToken,companyID, IntuitServicesType.QBO);
                DataServices service = new DataServices(context);

                InvoiceHeader a = new InvoiceHeader();
                a.CustomerName = "Antivirus Norton Security";
                a.CustomerId = new IdType { idDomain = idDomainEnum.QBO, Value = "6" };
                a.TotalAmt = 157.00m;
                a.SubTotalAmt = 37.00m;
                a.ShipMethodName = "Gmail";
                a.ShipMethodId = new IdType { idDomain = idDomainEnum.QBO, Value = "41" };
                a.DocNumber = "1040";
                a.DueDateSpecified = true;
               // a.Item = 10.00m;
               //a.ItemElementName = ItemChoiceType2.DiscountAmt;
                DateTime dt = Convert.ToDateTime("08/07/2013");
                a.DueDate = dt;

                InvoiceLine mnm = new InvoiceLine();
                mnm.Desc = "Antivirus Norton Security The Best Security ";
                mnm.Id = new IdType { idDomain = idDomainEnum.QBO, Value = "25" };
                mnm.Amount = 65.00m;
                mnm.AmountSpecified = true;
               // mnm.Items = "Europe";
               //mnm.ItemsElementName = "Zebronic";
                InvoiceLine[] invline = new InvoiceLine[] { mnm };
                var invoices = new Intuit.Ipp.Data.Qbo.Invoice();
                invoices.Header = a;
                invoices.Line = invline;
                var addedInvoice = service.Add(invoices);
                var qboInvoices = service.FindAll(invoices, 1,10);
                foreach (var qboinv in qboInvoices)
                {
                    string id = Convert.ToString(qboinv.Id.Value);
                }
                GridView1.DataSource = invoices;
                GridView1.DataBind();
        }

图片:

Answer 1:

尝试这个:

InvoiceLine i = new InvoiceLine();
i.ItemsElementName = new ItemsChoiceType2[1];
i.ItemsElementName[0] = ItemsChoiceType2.ItemId;
i.Items = new Intuit.Ipp.Data.Qbd.IdType[1];
i.Items[0] = new Intuit.Ipp.Data.Qbd.IdType() { idDomain = Intuit.Ipp.Data.Qbd.idDomainEnum.QBO, Value = "6" };


文章来源: How to insert multiple items in Quickbook Invoice