# Accruals

## **Prerequisites**

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

* [Invoice Integration](https://api.dataloy.com/user-guides/accounting-integration-api/invoicing)
* [Actuals Integration](https://api.dataloy.com/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**

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

To get accruals that are ready for posting in [Webhooks](https://api.dataloy.com/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 /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"
}
```
