0

我需要为特定客户插入一张新发票,我可以插入,但我不知道如何在发票中插入多个项目。如何使用属性 Items 和 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();
        }

图片:

在此处输入图像描述

4

1 回答 1

0

尝试这个:

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" };
于 2013-10-10T09:17:51.763 回答