# Participant Statement Detail

The `{statement}` tag found on Maica NDIS Plan Participant Statement email template is the bread and butter of how Maica generates statements for your Participants.  This single `{statement}` tag essentially instructs or controls what information from the `Plan` should be displayed in the **Plan Summary**, as well as what `Invoice` + `Invoice Line Item` records should be retrieved and displayed in the **Service Details** table.

In this article, we will do a deep dive to explain the logic of how this all comes together.

![Populated Participant Statement Email](https://558904096-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKdn9R0jFmixyPeVowFpF%2Fuploads%2Ft7NGZgzv9ppChTAsg6vi%2Fimage.png?alt=media\&token=293aee65-837a-4380-a977-2b755b0d52c0)

The `{statement}` tag is comprised of the following 4 sections which are described below:

* Participant Details
* NDIS Plan Management Summary
* Service Summary
* Service Details

### Participant Details

The **Participant Detail** section displays data from the `Contact` and the selected `Plan`

| Field Label        | Value Returned                                           |
| ------------------ | -------------------------------------------------------- |
| `Participant`      | Participant's First Name and Last Name                   |
| `NDIS Number`      | Participant's NDIS Number                                |
| `Plan Period`      | Start Date and End Date of the selected Plan             |
| `Statement Period` | Start Date and End date of the selected Statement Period |
| `Issue Date`       | TODAY or the date when the statement was generated       |

![Example Participant Details section](https://558904096-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKdn9R0jFmixyPeVowFpF%2Fuploads%2FwO2rqHOjMzRPv5tXJ5f5%2Fimage.png?alt=media\&token=ba35e94c-8777-4136-ba2f-2034318a31cf)

### NDIS Plan Management Summary

The **NDIS Plan Management** summary section displays 4 distinct tiles, summarising the utilisation of the `Plan`:

| Field Label          | Value Returned                                                                                                                                       |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Total Approved`     | Total `Amount Approved` to the selected `Plan`                                                                                                       |
| `Opening Balance`    | `Total Remaining` at the beginning of the Statement Period. This is the cumulative expenditure from the `Plan` `Start Date` up to the previous month |
| `Period Expenditure` | The `Total Expenditure` of the selected Statement Period                                                                                             |
| `Closing Balance`    | Total Remaining at the end of the Statement Period. This is the difference between the `Opening Balance` and `Period Expenditure`                    |

![Example Plan Management Summary taken from the Participant Statement](https://558904096-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKdn9R0jFmixyPeVowFpF%2Fuploads%2FiTwKXCMUW3vAhroXGH62%2Fimage.png?alt=media\&token=86895971-07b7-46c0-ab31-5e8093123988)

### Service Summary

The **Service Summary** section groups the `Service Booking Items` by `Support Purpose`, displaying the `Total Allocated`, `Total Expenditure` and `Total Remaining` at each of the following levels:

* `Booking Item`
* `Support Purpose`
* `Provider`

| Field Label         | Value Returned for Support Purpose               | Value Returned for Support Category             |
| ------------------- | ------------------------------------------------ | ----------------------------------------------- |
| `Total Allocated`   | SUM of `Allocated Amount` by `Support Purpose`   | SUM of `Allocated Amount` by `Support Category` |
| `Total Expenditure` | SUM of `Expenditure Amount` by `Support Purpose` | SUM of `Allocated Amount` by `Support Category` |
| `Remaining`         | SUM of `Remaining Amount` by `Support Purpose`   | SUM of `Allocated Amount` by `Support Category` |

![Example Service Summary taken from the Participant Statement](https://558904096-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKdn9R0jFmixyPeVowFpF%2Fuploads%2FHXtL5AJPONJmPta9lcWe%2Fimage.png?alt=media\&token=0ad482a4-b5e0-4444-be25-836181e035ca)

### Service Details

The **Service Details** section displays the `Invoice Line Item` records created during the selected statement period.

| Field Label        | Value Returned                                                                   |
| ------------------ | -------------------------------------------------------------------------------- |
| `Invoice Date`     | `Invoice Date` of the `Invoice` related to the `Invoice Line Item`               |
| `Support`          | `Support Item Number` and `Product Name` specified on the `Invoice Line Item`    |
| `Service Provider` | `Service Provider` specified on the `Invoice` related to the `Invoice Line Item` |
| `Service Date`     | `Service Date` specified on the `Invoice Line Item`                              |
| `Invoice Number`   | `Invoice Number` specified on the `Invoice` related to the `Invoice Line Item`   |
| `Quantity`         | `Quantity` specified on the `Invoice Line Item`                                  |
| `Price`            | `Unit Price` specified on the `Invoice Line Item`                                |
| `Total`            | `Line Total` specified on the `Invoice Line Item`                                |
| `TOTAL`            | The **SUM** total of all `Invoice Line Item` records retrieved                   |

![Example Service Details taken from the Participant Statement](https://558904096-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKdn9R0jFmixyPeVowFpF%2Fuploads%2FxntRQIbBppRfYAJHibTK%2Fimage.png?alt=media\&token=236efce0-69e8-4178-88d6-4a650f2d74a8)

### Statement Query Summary

How does Maica determine what `Invoice` and `Invoice Line Item` details to include in the Participant Statement?  Great question!  The **Service Summary** and **Service Details** sections will be populated based on the following criteria:

* The Participant on the `Invoice` record matches the `Contact`
* The `Invoice` `Date` is within the `Start Date` and `End Date` you specified in the filters
  * Applies to the Participant Statement Quick Action on `Contact` and the Email Statements option under `Maica Settings`
* The `Invoice` `Status` equals `Partially Paid` OR `Fully Paid`
* The `Invoice Line Item` `Status` equals `Partially Paid` OR `Fully Paid`
* The `Invoice` `Funding Structure` equals `Plan Managed`

Or, for a more technical user:

{% code overflow="wrap" lineNumbers="true" %}

```
SELECT Id, Service_Date__c, Quantity__c, Product__c, Product__r.Name, Product__r.Support_Item_Number__c, Invoice__r.Service_Provider__r.Name, Invoice__r.Provider_Invoice_Number__c, Unit_Price__c, Line_Total__c, Support_Category__r.Name, Invoice__r.Invoice_Date__c
FROM Invoice_Line_Item__c
WHERE Invoice__r.Participant__c = :this.participantId
AND Invoice__r.Invoice_Date__c >= :startDate AND Invoice__r.Invoice_Date__c <= :endDate
AND Invoice__r.Status__c IN ('Partially Paid', 'Fully Paid')
AND Status__c IN ('Partially Paid', 'Fully Paid')
AND Invoice__r.Funding_Structure__c = 'Plan Managed'
ORDER BY Invoice__r.Invoice_Date__c ASC
```

{% endcode %}

{% hint style="info" %}
When the Statements are sent on an automated schedule - the Statement looks for `Invoice` records where the `Invoice Date` is in the **previous month**
{% endhint %}
