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

# QuerySalesInvoiceTotals

> Queries per-currency totals ("TotalGrossAmount", "TotalNetAmount", "TotalVatAmount") and the number of matching invoices ("DocumentCount") for the same set of sales invoices returned by "GET /v2/sales-invoices" or "QuerySalesInvoices" (no separate exclusion of drafts, cancelled or archived invoices; "SalesInvoiceCorrectionTotalGrossAmount" is not netted), restricted to a required, inclusive date range ["From", "To"] compared against "SalesInvoiceDate": invoices with a "SalesInvoiceDate" at or after "From" and at or before "To" are included. "GET /v2/sales-invoices" or "QuerySalesInvoices" already exposes "salesInvoiceDateAfter"/"salesInvoiceDateBefore", but those are optional filters on the paged list endpoint that exclude the boundary value itself. "From" and "To" here are a separate, required, always-inclusive pair, dedicated to this aggregate endpoint: an invoice with "SalesInvoiceDate" exactly equal to "From" or "To" is included, never excluded. Both bounds are compared as full timestamps, not calendar dates; a "To" at the start of a day (00:00:00) excludes invoices later that same day, so pass the end of the day to include it. The UTC offset of "From" and "To" is ignored: their wall-clock date and time are compared against "SalesInvoiceDate", the same way "GET /v2/sales-invoices" or "QuerySalesInvoices" filters, and the check that "From" is not later than "To" also uses these wall-clock values. The "x-companyid" header does not restrict the result, the same as for "GET /v2/sales-invoices" or "QuerySalesInvoices": invoices of every company are included. Results are grouped once per "CurrencyIso" from the same per-invoice "TotalGrossAmount"/"TotalNetAmount" fields already returned by "SalesInvoiceListItem" for "GET /v2/sales-invoices" or "QuerySalesInvoices". The result set is small and bounded by the number of distinct currencies in use, so it is not paged, sorted, filtered, or projectable.



**query** `QuerySalesInvoiceTotals(from: DateTime!, to: DateTime!): [SalesInvoiceTotal!]!`

## Arguments

**`from`**: `DateTime!` (required)

---

**`to`**: `DateTime!` (required)

## Returns

`[SalesInvoiceTotal!]!`

**`currencyIso`**: `String!`

ISO code of the currency this row aggregates. Taken from "CurrencyIso" of "SalesInvoiceListItem"; one row per distinct value found among the invoices in range.

---

**`totalGrossAmount`**: `Decimal!`

Sum of "TotalGrossAmount" (see "SalesInvoiceListItem") across every sales invoice dated within ["From", "To"] whose "CurrencyIso" matches this row. The per-invoice values are summed unrounded; no per-invoice rounding is applied before summation.

---

**`totalNetAmount`**: `Decimal!`

Sum of "TotalNetAmount" (see "SalesInvoiceListItem") across every sales invoice dated within ["From", "To"] whose "CurrencyIso" matches this row. Summed unrounded, the same way as "TotalGrossAmount".

---

**`totalVatAmount`**: `Decimal!`

"TotalGrossAmount" minus "TotalNetAmount", computed once per currency group after both sums are formed. This is not the sum of the per-invoice VAT amounts, and neither "TotalGrossAmount" nor "TotalNetAmount" is rounded per invoice before the subtraction.

---

**`documentCount`**: `Int!`

Number of sales invoices dated within ["From", "To"] whose "CurrencyIso" matches this row, counted over the same invoice set whose amounts are summed into "TotalGrossAmount" and "TotalNetAmount".

