# Invoice history

## Short description

The ERP Cache Invoice interface is used to keep a record of the invoices in the ERP system. The Invoices in the ERP Cache are used to show invoice history to the user.

## Delivery method

**Update Frequency**: Batch at least once a day\
**Incremental or complete set:** Incremental

**Filetype:** Zipped XML

**Filename: \[SHOPNAME]\_ErpCache\_Invoice**\_**\[INDEXNUMBER]\(**\_**\[SUBNUMBER])**.xml\
**Transport:** over FTPS, FTPS Vendisto server hosted by INTEGRACE, file will be placed on FTPS server by ERP party.

**Location within FTP root:** \ErpCache\\

## Structure XML

```markup
<?xml version="1.0" encoding="utf-8"?>
<Import>
    <ImportSettings>
        <Importer>ErpCache_Invoices</Importer>
        <Version>1.0</Version>
    </ImportSettings>
    <Invoices>
        <Invoice>
            <InvoiceNumber></InvoiceNumber>
            <AccountNumber></AccountNumber>
            <InvoiceDate></InvoiceDate>
            <DownloadablePdfUri></DownloadablePdfUri>
            <InvoicePdf></InvoicePdf>
            <TotalOutstanding></TotalOutstanding>
            <TotalPrice></TotalPrice>
        </Invoice>
    </Invoices>
</Import>
```

## Fields XML

**Import element:**

| Name           | Description                          | Type    | Required/Optional |
| -------------- | ------------------------------------ | ------- | ----------------- |
| ImportSettings | Container element for importsettings | Element | Required          |
| Invoices       | Container element for invoice data   | Element | Required          |

**ImportSettings element:**

| Name     | Description                                                              | Type                                          | Required/Optional |
| -------- | ------------------------------------------------------------------------ | --------------------------------------------- | ----------------- |
| Importer | <p>Name of the importer.<br>Should be ErpCache\_Invoices.</p>            | <p>Text,</p><p>default ErpCache\_Invoices</p> | Required          |
| Version  | Version of the import xml. To be used for backward compatibility issues. | <p>Text,<br>default 1.0</p>                   | Required          |

**Order element:**

| Name               | Description                                                                           | Type         | Required/Optional |
| ------------------ | ------------------------------------------------------------------------------------- | ------------ | ----------------- |
| InvoiceNumber      | Invoice number                                                                        | Text         | Required          |
| AccountNumber      | Customer's account number                                                             | Text         | Required          |
| InvoiceDate        | Invoice date                                                                          | Date         | Required          |
| DownloadablePdfUri | A link to the Invoice document (PDF format) which will be generated by the ERP system | Uri          | Optional          |
| InvoicePdf         | The PDF containing the invoice                                                        | Base64Binary | Optional          |
| TotalOutstanding   | The total outstanding amount of the invoice                                           | Decimal      | Optional          |
| TotalPrice         | The total price of the invoice                                                        | Decimal      | Optional          |

**Types:**

| Type         | Values                                                           |
| ------------ | ---------------------------------------------------------------- |
| Date         | yyyy-MM-dd                                                       |
| Base64Binary | Base64 encoded equivalent of an array of 8-bit unsigned integers |
