# Accruals

## **Prerequisites**

Before setting up and testing an invoice integration other integrations need to be in place:

* [Invoice Integration](https://api.dataloy.com/api-release-8.16/user-guides/accounting-integration-api/invoicing)
* [Actuals Integration](https://api.dataloy.com/api-release-8.16/user-guides/accounting-integration-api/actuals-1)

## **Integration Set-Up**

When accruals have been verified and posted in Dataloy VMS, the document status is set to *Ready-for-Posting*.

More information, go to Accruals and Period-End-Closing.

## **Data Transactions**

To get accruals that are ready for posting in [Webhooks](https://api.dataloy.com/api-release-8.16/dataloy-rest-api/webhooks) the following subscription can be created:

```
{
    "eventType":"U",
    "user": the user code to be used in the subscription,
    "objectType":"Document",
    "expression": "dlpObject.getInvoicingStatus() != null && dlpObject.getInvoicingStatus().getStatusTypeCode().equals(\"RFP\") && (dlpObject.getDocumentType().getDocumentType().equals(\"ACR\") || dlpObject.getDocumentType().getDocumentType().equals(\"ACP\"))",
    "url":"your webhook url"
}
```

Alternativel&#x79;**,** a scheduled job can be setup to use the following request:

**Get accruals and accrual reversals that are ready for posting to accounting**

| `GET /Document?filter=invoicingStatus.statusTypeCode(EQ)RFP&filter=documentType.documentType(IN)ACP,ACR,CAP,CAR` |
| ---------------------------------------------------------------------------------------------------------------- |

## **Test Data**

Test data for accruals integration can be generated in the Accruals module in Dataloy VMS. Generate and batch post the accruals.

## **Post Transaction** &#x20;

When an accrual is successfully transferred to an accounting system, the accrual status must to be updated to *Posted* in Dataloy VMS. This is done in a PUT request:&#x20;

**Update status to posted for a specific invoice**

```
PUT /Document/{key}
  
{
    "invoicingStatus": "POS"
}
```

## **Additional Information**

### **List of Document Statuses in Dataloy VMS**

| Document Status Code | Document Status Description | Description                                                                                                                                                                                                  |
| -------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| PEN                  | Pending                     | <p>Invoice is in the Pending section of either Accounts Payable  (AP), Accounts Receivable (AR) or Hire Payable (HP)<br>in Dataloy VMS.</p>                                                                  |
| INV                  | Approval                    | <p>Invoice is in the Assembled section of either Accounts Payable  (AP), Accounts Receivable (AR) or Hire Payable (HP)<br>in Dataloy VMS.</p>                                                                |
| RFP                  | Ready-For-Posting           | <p>Invoice is in the Posted section section of either Accounts Payable  (AP), Accounts Receivable (AR) or Hire Payable (HP)<br>in Dataloy VMS, but has not yet been transferred to an accounting system.</p> |
| POS                  | Posted                      | <p>Invoice is in Posted section of either Accounts Payable  (AP), Accounts Receivable (AR) or Hire Payable (HP)<br>in Dataloy VMS and has been transferred to an accounting system.</p>                      |

### **List of Document Line Fields**

| Field Name                     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | Not possible to user in filters |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
| documentAmount                 | <ul><li>For /DocumentTypes INO, INI, CRI, CRO: Amount in order currency/sales currency. The original currency.</li><li>For /DocumentTypes PMI, PMO: Amount in Invoice Currency.</li><li>For /DocumentTypes ACR, ACP: Amount in Voyage Currency.</li><li>For /DocumentTypes APR: Amount in Advance Currency</li><li>For /DocumentTypes ACC: Amount in Invoice Currency (use Voyage currency if Invoice Currency is not present)</li></ul>                                                                                                                                                                                                                   |                                 |
| companyCurrencyAmount          | For all /DocumentTypes : Amount in Company Currency for the Document.Company.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |                                 |
| sourceCurrencyAmount           | <ul><li>For /DocumentTypes INO, INI, CRI, CRO: Amount in order currency/sales currency. The original currency.</li><li>For /DocumentTypes PMI, PMO: Amount in Original Payment Currency.</li><li>For /DocumentTypes ACR, ACP: Amount in Voyage Currency.</li><li>For /DocumentTypes APR: Amount in Advance Currency</li><li>For /DocumentTypes ACC: Amount in Voyage Currency</li></ul>                                                                                                                                                                                                                                                                    |                                 |
| documentCurrency.currencyCode  | Currency Code for documentAmount. More information, see documentAmount                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                 |
| sourceCurrencyCode             | Currency code for sourceCurrencyAmount. More information see sourceCurrencyAmount                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |                                 |
| exchangeRate                   | Exchange Rate between documentAmount and sourceCurrencyAmount                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |                                 |
| exchangeRateDate               | Exchange Rate Date                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |                                 |
| glAccount                      | General Ledger Account                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | X                               |
| quantity                       | <p>Has Different Meaning Depending on Document Type:<br></p><ul><li>Accruals - <em>Onhire Days Within Accrual Period</em></li><li>Bunkers - <em>Bunker Quantity</em></li><li>Freight - <em>Cargo Quantity</em></li><li>Charter Hire - <em>Days</em></li><li>Meals and Cables - <em>Days</em></li><li>VAT - <em>VAT Amount is Quantity \* vatRate</em></li><li>Various, Days - <em>Voyage Days</em></li><li>Various, Rate - <em>Cargo Quantity</em></li><li>Offhire - <em>Offhire Days</em></li><li>Deadfreight - <em>Deadfreight Quantity</em></li><li>Demurrage/Despatch - <em>Days</em></li></ul>                                                        |                                 |
| unitPrice                      | Unit Price. Quantity \* Unit Price = Document Amount                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |                                 |
| invoicingStatus.statusTypeCode | Status Code, see Document Status List                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |                                 |
| documentLineText               | Document Line Text/Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                 |
| businessPartner                | <p>Business Partner Object. (Value: businessPartnerCode or businessPartner Key).</p><p>Invoice and Payment/Receipt:</p><ul><li><p>Outgoing invoice:</p><ul><li>document.company is the company in Dataloy VMS issuing the invoice.</li><li>document.businessPartner is the business partner receiving the invoice.</li><li>On the referring payment, document.company is receiving the payment.</li></ul></li><li><p>Incoming invoice:</p><ul><li>document.businessPartner is issuing the invoice.</li><li>document.company is receiving the invoice.</li><li>On the referring payment document.company is the one paying the invoice.</li></ul></li></ul> |                                 |
| isAccountsPayable              | <p>false = Accounts Receivable, true = Accounts Payable<br><br>Inserting Payment/Receipt:<br>For payments referring to Accounts Receivable invoices set value to 0. For payments referring to Accounts Payable invoice set value to 1. This value should always have the same value as for the referring invoice.</p>                                                                                                                                                                                                                                                                                                                                      |                                 |
| refDocument                    | <p>Referring Document for Reversals, Payments and Receipts. To set refDocument use Document Number or Key.</p><p>Payment/Receipts: Setting refDocument for payment receipts, documentLine.voyage will be set equal to the documentLine.voyage of the referring invoice.</p>                                                                                                                                                                                                                                                                                                                                                                                |                                 |
| vatRate.vatRate                | VAT Rate                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                 |
| vatRate.vat.vatCode            | VAT Code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                 |
| freightRate                    | Freight Rate Object                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |                                 |
| portCall                       | portCall Object                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |                                 |
| handlingCost                   | handlingCost Object                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |                                 |
| businessUnit                   | businessUnit Object                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |                                 |
| account                        | Account Object, use glAccount instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |                                 |
| handlingCostCode               | handlingCostCode Object, use glAccount instead                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                 |
| billOfLading                   | billOfLading Object                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |                                 |
| claim                          | Claim Object                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |                                 |
| offhire                        | Offhire Object                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                 |
| voyage                         | Voyage Object                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |                                 |

**Bank Fields List**

| Field Name   | Description  | Required | Unique | Not Possible to Set in Filters |
| ------------ | ------------ | -------- | ------ | ------------------------------ |
| bankName     | Bank Name    | Yes      |        |                                |
| swiftAddress | SWIFT Code   | Yes      | Yes    |                                |
| chip         | Chip ID      |          |        |                                |
| abaNumber    | ABA Code     |          |        |                                |
| addresses    | Address      |          |        | X                              |
| contactInfo  | Contact Info |          |        | X                              |
