1

我们有一个名为“支付组”的组。在该组中,有两个项目是书籍,轮胎修理。我们正在尝试将此组添加到发票中。但是我们在创建发票时遇到了问题。

QBInvoiceService iInvoiceSer = QBServiceFactory.getService(platformSessionContext, QBInvoiceService.class);
 QBInvoice myInvoice = QBObjectFactory.getQBObject(platformSessionContext, QBInvoice.class);


  InvoiceHeader invoiceHeader = QBObjectFactory.getQBObject(platformSessionContext, InvoiceHeader.class);
  invoiceHeader.setCustomerName("John");
  invoiceHeader.setPONumber("999");
  invoiceHeader.setSalesTermName("Net 10");
  Calendar dueDate = Calendar.getInstance();
  dueDate.set(2013, 12, 01);
  invoiceHeader.setDueDate(dueDate);

  ArrayList<InvoiceLine> invoiceLineList = new ArrayList<InvoiceLine>();
  InvoiceLine invoiceLine = QBObjectFactory.getQBObject(platformSessionContext, InvoiceLine.class);
  invoiceLine.setItemName("Payment Group");   

  InvoiceLine invoiceLine1 = QBObjectFactory.getQBObject(platformSessionContext, InvoiceLine.class);
  invoiceLine1.setItemName("Books"); 
  invoiceLine1.setDesc("");
  invoiceLine1.setAmount(new BigDecimal(500));
  invoiceLine1.setQty(new BigDecimal(5));

  InvoiceLine invoiceLine2 = QBObjectFactory.getQBObject(platformSessionContext, InvoiceLine.class);
  invoiceLine2.setItemName("Tire Repair");
  invoiceLine2.setDesc("Tire Repair");
  invoiceLine2.setAmount(new BigDecimal(500));
  invoiceLine2.setQty(new BigDecimal(5));

  InvoiceLine invoiceLine3 = QBObjectFactory.getQBObject(platformSessionContext, InvoiceLine.class);
  invoiceLine3.setDesc("group description");
  invoiceLine3.setAmount(new BigDecimal(1000));    

invoiceLineList.add(invoiceLine);
invoiceLineList.add(invoiceLine1);
invoiceLineList.add(invoiceLine2);  

ArrayList<TaxLine> taxLineList = new ArrayList<TaxLine>();
           TaxLine taxLine = QBObjectFactory.getQBObject(platformSessionContext, TaxLine.class);
           taxLine.setTaxName("Net 10");
           taxLineList.add(taxLine);

           myInvoice.setHeader(invoiceHeader);
           myInvoice.setLine(invoiceLineList);
           myInvoice.setTaxLine(taxLineList);

           QBInvoice newInvoice = iInvoiceSer.addInvoice(platformSessionContext, myInvoice);    

发票创建成功。但不与桌面 QuickBooks 软件同步。对此有任何想法吗?是否可以在使用 ipp Java devkit 2.0.7 创建发票时添加组项目?API 是否可用?

4

0 回答 0