# 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](/files/EVYvSka23wOjAKRmBa3Q)

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](/files/dMqkI7soBlhizJY5NRS5)

### 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](/files/0M0FELkyeEXiI89Acfhg)

### 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](/files/lr3TA6B97LfC4gMWetf9)

### 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](/files/ANrN2YJgAB1jQb4TbTNs)

### 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kb.maica.com.au/ndis-management/participant-statement/participant-statement-email-template/participant-statement-detail.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
