> ## Documentation Index
> Fetch the complete documentation index at: https://docs.virtuous.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Receipts

> All tables in the receipts hub — receipted gifts, receipting runs, statement runs, and sent emails.

<Note>
  **Grain:** `RECEIPTS` — one row per receipt issued to a contact. `RECEIPTED_GIFTS` — one row per gift included in a receipt.
</Note>

A `RECEIPT` is the acknowledgment document issued to a donor. It can cover one or more gifts (`RECEIPTED_GIFTS`). Receipts are generated through two mechanisms: a `RECEIPTING_GROUP_RUN` (a batch run across many donors) or a `RECEIPTING_STATEMENT_RUN` (a year-end statement for an individual contact). Both can deliver via email, tracked in `SENT_EMAILS`.

```mermaid theme={null}
flowchart TD
    RECEIPTS:::hub

    RECEIPTS -->|"RECEIPT_KEY"| RECEIPTED_GIFTS
    RECEIPTED_GIFTS -->|"GIFT_KEY"| GIFTS

    RECEIPTS -->|"RECEIPT_KEY"| SENT_EMAILS
    RECEIPTING_GROUP_RUNS -->|"RECEIPTING_GROUP_RUN_KEY"| RECEIPTING_GROUP_RUN_GIFTS
    RECEIPTING_GROUP_RUNS -->|"RECEIPTING_GROUP_RUN_KEY"| SENT_EMAILS
    RECEIPTING_GROUP_RUN_GIFTS -->|"GIFT_KEY"| GIFTS

    RECEIPTING_STATEMENT_RUNS -->|"RECEIPTING_STATEMENT_RUN_KEY"| RECEIPTS
    RECEIPTING_STATEMENT_RUNS -->|"RECEIPTING_STATEMENT_RUN_KEY"| SENT_EMAILS

    classDef hub fill:#00A3E0,color:#ffffff,stroke:#081F2C
    classDef entity fill:#CEE7F2,color:#243746,stroke:#41B6E6
    class RECEIPTED_GIFTS,GIFTS,SENT_EMAILS,RECEIPTING_GROUP_RUNS,RECEIPTING_GROUP_RUN_GIFTS,RECEIPTING_STATEMENT_RUNS entity
```

> **Solid lines** — required join (FK always populated). **Dotted lines** — optional join (FK is nullable; always use `LEFT JOIN`).

## Table columns

**Tables on this page:** [RECEIPTS](#receipts) · [RECEIPTED\_GIFTS](#receipted-gifts) · [GIFTS (boundary)](#gifts) · [RECEIPTING\_GROUP\_RUNS](#receipting-group-runs) · [RECEIPTING\_GROUP\_RUN\_GIFTS](#receipting-group-run-gifts) · [RECEIPTING\_STATEMENT\_RUNS](#receipting-statement-runs) · [SENT\_EMAILS](#sent-emails)

#### **RECEIPTS**

One row per receipt issued to a contact. `RECEIPT_TYPE` and `RECEIPT_MEDIUM` are numeric codes. Individual gifts covered by this receipt are in `RECEIPTED_GIFTS`.

| **Column**                      | **Type** | **Notes**                                                                                                         |
| :------------------------------ | :------- | :---------------------------------------------------------------------------------------------------------------- |
| `RECEIPT_KEY`                   | TEXT     | Primary key                                                                                                       |
| `CONTACT_KEY`                   | TEXT     | FK → CONTACTS                                                                                                     |
| `RECEIPTING_STATEMENT_RUN_KEY`  | TEXT     | FK → RECEIPTING\_STATEMENT\_RUNS (optional) — the statement batch that generated this receipt                     |
| `RECEIPT_TYPE`                  | NUMBER   | Type of receipt — decode with TYPE\_REFERENCES (Entity: `Receipt`, Property: `ReceiptType`)                       |
| `RECEIPT_MEDIUM`                | NUMBER   | Delivery medium (email, mail, etc.) — decode with TYPE\_REFERENCES (Entity: `Receipt`, Property: `ReceiptMedium`) |
| `YEAR`                          | NUMBER   | Tax year for this receipt                                                                                         |
| `EMAIL_ADDRESS`                 | TEXT     | Email address the receipt was sent to                                                                             |
| `RECEIPT_IS_AVAILABLE_TO_DONOR` | BOOLEAN  | Receipt is visible in the donor portal                                                                            |
| `RECEIPT_IS_DELETED`            | BOOLEAN  | Soft delete flag                                                                                                  |

#### **RECEIPTED\_GIFTS**

One row per gift included in a receipt. A single receipt can cover multiple gifts; this is the junction table between `RECEIPTS` and `GIFTS`.

| **Column**                  | **Type** | **Notes**        |
| :-------------------------- | :------- | :--------------- |
| `RECEIPTED_GIFT_KEY`        | TEXT     | Primary key      |
| `RECEIPT_KEY`               | TEXT     | FK → RECEIPTS    |
| `GIFT_KEY`                  | TEXT     | FK → GIFTS       |
| `RECEIPTED_GIFT_IS_DELETED` | BOOLEAN  | Soft delete flag |

#### **GIFTS**

`GIFTS` appears in this diagram as the endpoint for both `RECEIPTED_GIFTS` and `RECEIPTING_GROUP_RUN_GIFTS`. The full gift structure is documented in [<u>Gifts — extended reference</u>](https://github.com/jgunkelvirtuous/mintlify-virtuous-data-documentation/blob/main/data-models/reference/gifts).

| **Column**        | **Type**  | **Notes**              |
| :---------------- | :-------- | :--------------------- |
| `GIFT_KEY`        | TEXT      | Primary key            |
| `CONTACT_KEY`     | TEXT      | FK → CONTACTS          |
| `GIFT_DATE_UTC`   | TIMESTAMP | Date the gift was made |
| `AMOUNT`          | NUMBER    | Total gift amount      |
| `GIFT_IS_DELETED` | BOOLEAN   | Soft delete flag       |

#### **RECEIPTING\_GROUP\_RUNS**

One row per receipting batch run — a bulk operation that generates receipts for a group of donors at once. Summary totals show how many receipts were produced and by which channel.

| **Column**                        | **Type** | **Notes**                                                                                     |
| :-------------------------------- | :------- | :-------------------------------------------------------------------------------------------- |
| `RECEIPTING_GROUP_RUN_KEY`        | TEXT     | Primary key                                                                                   |
| `RECEIPTING_GROUP_NAME`           | TEXT     | Name of the receipting group                                                                  |
| `QUERY_NAME`                      | TEXT     | Name of the query used to select donors                                                       |
| `TEMPLATE_NAME`                   | TEXT     | Receipt template used                                                                         |
| `RECEIPT_MEDIUM`                  | NUMBER   | Delivery medium — decode with TYPE\_REFERENCES (Entity: `Receipt`, Property: `ReceiptMedium`) |
| `RECEIPT_CODE`                    | TEXT     | Receipt code identifier                                                                       |
| `TOTAL_GIFTS_RECEIPTED`           | NUMBER   | Total gifts included in this run                                                              |
| `TOTAL_EMAIL_RECEIPTS`            | NUMBER   | Number of receipts delivered by email                                                         |
| `TOTAL_MAIL_RECEIPTS`             | NUMBER   | Number of receipts delivered by mail                                                          |
| `TOTAL_LETTER_ON_DEMAND_RECEIPTS` | NUMBER   | Number of letter-on-demand receipts                                                           |
| `RECEIPTING_GROUP_RUN_IS_DELETED` | BOOLEAN  | Soft delete flag                                                                              |

#### **RECEIPTING\_GROUP\_RUN\_GIFTS**

One row per gift processed in a receipting group run. Junction table between `RECEIPTING_GROUP_RUNS` and `GIFTS`.

| **Column**                             | **Type** | **Notes**                    |
| :------------------------------------- | :------- | :--------------------------- |
| `RECEIPTING_GROUP_RUN_GIFT_KEY`        | TEXT     | Primary key                  |
| `RECEIPTING_GROUP_RUN_KEY`             | TEXT     | FK → RECEIPTING\_GROUP\_RUNS |
| `GIFT_KEY`                             | TEXT     | FK → GIFTS                   |
| `RECEIPTING_GROUP_RUN_GIFT_IS_DELETED` | BOOLEAN  | Soft delete flag             |

#### **RECEIPTING\_STATEMENT\_RUNS**

One row per year-end statement run. A statement run generates year-end tax summary receipts and can target a single contact or a query-based group.

| **Column**                                       | **Type**  | **Notes**                                                    |
| :----------------------------------------------- | :-------- | :----------------------------------------------------------- |
| `RECEIPTING_STATEMENT_RUN_KEY`                   | TEXT      | Primary key                                                  |
| `CONTACT_KEY`                                    | TEXT      | FK → CONTACTS (optional) — populated for single-contact runs |
| `TITLE`                                          | TEXT      | Statement title                                              |
| `STATEMENT_DATE`                                 | TIMESTAMP | Date the statement covers                                    |
| `RECEIPT_FORMAT`                                 | NUMBER    | Output format (PDF, email, etc.)                             |
| `RECEIPTING_STATEMENT_RUN_IS_AVAILABLE_TO_DONOR` | BOOLEAN   | Statement is visible in the donor portal                     |
| `RECEIPTING_STATEMENT_RUN_IS_DELETED`            | BOOLEAN   | Soft delete flag                                             |

#### **SENT\_EMAILS**

One row per email delivery record. In the receipts context, `SENT_EMAILS` tracks receipt and statement emails delivered to donors. Also linked to email marketing — see [<u>Campaigns — extended reference</u>](https://github.com/jgunkelvirtuous/mintlify-virtuous-data-documentation/blob/main/data-models/reference/campaigns) for the full email structure.

| **Column**                     | **Type** | **Notes**                                                                                         |
| :----------------------------- | :------- | :------------------------------------------------------------------------------------------------ |
| `SENT_EMAIL_KEY`               | TEXT     | Primary key                                                                                       |
| `CONTACT_INDIVIDUAL_KEY`       | TEXT     | FK → CONTACT\_INDIVIDUALS — the recipient                                                         |
| `RECEIPT_KEY`                  | TEXT     | FK → RECEIPTS (optional) — set when this is a receipt delivery                                    |
| `RECEIPTING_GROUP_RUN_KEY`     | TEXT     | FK → RECEIPTING\_GROUP\_RUNS (optional) — set when sent as part of a group run                    |
| `RECEIPTING_STATEMENT_RUN_KEY` | TEXT     | FK → RECEIPTING\_STATEMENT\_RUNS (optional) — set when sent as part of a statement run            |
| `EMAIL_VERSION_KEY`            | TEXT     | FK → EMAIL\_VERSIONS (optional) — set for marketing emails                                        |
| `EMAIL_ADDRESS`                | TEXT     | Recipient email address                                                                           |
| `DELIVERY_STATUS`              | NUMBER   | Delivery outcome — decode with TYPE\_REFERENCES (Entity: `SentEmail`, Property: `DeliveryStatus`) |
| `OPENED`                       | BOOLEAN  | Email was opened                                                                                  |
| `CLICKED`                      | BOOLEAN  | Email was clicked                                                                                 |
| `UNSUBSCRIBE`                  | BOOLEAN  | Recipient globally unsubscribed                                                                   |
| `MARKED_AS_SPAM`               | BOOLEAN  | Recipient marked as spam                                                                          |
| `SENT_EMAIL_IS_DELETED`        | BOOLEAN  | Soft delete flag                                                                                  |

<Tip>
  **Data freshness:** These tables sync continuously from Virtuous CRM. Typical lag is under 4 hours. To check when a record was last updated, inspect the `SF__ROW_SYNCED_DATE_TIME_UTC` column on any table.
</Tip>
