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

# invoice_sum table

> This table is used temporarily when listing invoice statistics. It is used because we need to sort balances from both customers and companies.

## invoice\_sum Table (266)

This table is used temporarily when listing invoice statistics. It is used because we need to sort balances from both customers and companies.

## Fields

| Name         | Description                                                                                  | Type                        | Nullable |
| ------------ | -------------------------------------------------------------------------------------------- | --------------------------- | :------: |
| id           | The primary key (auto-incremented)                                                           | PK                          |    No    |
| login\_id    | The id of the user using the table.                                                          | FK [login](./login.mdx)     |    No    |
| name         | The name of the entry.                                                                       | String(255)                 |    Yes   |
| customer\_id | The reference of the customer entry this entry is connected to. NULL or -1 if not connected. | FK [person](./person.mdx)   |    No    |
| company\_id  | The reference of the company entry this entry is connected to. NULL or -1 if not connected.  | FK [contact](./contact.mdx) |    No    |
| balance      | The balance for the given customer or company.                                               | Int                         |    Yes   |

<img src="https://mintcdn.com/superofficeas/6OcOTPa_ISkjXJg4/media/loc/en/database/tables/invoice_sum.png?fit=max&auto=format&n=6OcOTPa_ISkjXJg4&q=85&s=85de08f30bceb33580a4c833b5e5983d" alt="invoice_sum table relationship diagram" width="589" height="592" data-path="media/loc/en/database/tables/invoice_sum.png" />

## Indexes

| Fields       | Types | Description |
| ------------ | ----- | ----------- |
| login\_id    | FK    | Index       |
| customer\_id | FK    | Index       |
| company\_id  | FK    | Index       |

## Relationships

| Table                | Description                                        |
| -------------------- | -------------------------------------------------- |
| [contact](./contact) | Companies and Organizations.                       |
| [login](./login)     | This table contains entries for the user sessions. |
| [person](./person)   | Persons                                            |

## Replication Flags

* None

## Security Flags

* No access control via user's Role.


## Related topics

- [invoice_entry table](/en/database/tables/invoice-entry.md)
- [invoice table](/en/database/tables/invoice.md)
- [invoice_type table](/en/database/tables/invoice-type.md)
- [login table](/en/database/tables/login.md)
- [contact table](/en/database/tables/contact.md)
- [person table](/en/database/tables/person.md)
