Import invoices to Xero (detailed line items and fees)

Continuing the discussion from Create report with info for importing invoices into accounting (e.g. Xero):

Invoice Detail

This report is designed to create a detailed invoices in your accounting system, with each produce line item described. See sheet two of Xero Invoice Importing

NB. because some fees are tax-inc and some are tax-excl., the fees cannot be included in the item cost (the importers need to know tax code for each line item), so fees will still be reported separately

In addition to points 1-5:

  1. Create row for each line item, populating *Description with concat of Product name: variant label: unit (Rob has a nice bit of logic for this)
  2. For each line item row, *ItemCost is single unit product cost without fees and *Quantity is the number of units
  3. Once the line item rows are finished, generate rows for fee totals and shipping
    [We could possibly make this report work for international just by splitting out the fee rows so that they sum by fees with the same tax code. They will just have to manually map data to the correct Xero tax codes]
    . . then start next customer