# Receipt type


A receipt: goods that came into one warehouse.

## Fields

### stockVersion

`String`

The document's version for [`confirmStockInExternalSystem`](/chameleoon-max/mutation/confirm-stock-in-external-system). Read it, write the
document to the external system, then confirm that version. Null before the receipt has moved
any stock.

### id

[`UUID!`](/chameleoon-max/type/uuid)

The receipt's MAX id.

### number

`String!`

The receipt's number. Every returned receipt has one.

### status

[`ReceiptStatus!`](/chameleoon-max/type/receipt-status)

The receipt's status.

### version

`Int`

The receipt's last event version, as in the events feed. Null before its first event. Also
null when an event newer than this read was committed while the receipt was being read; read
it again.

### effectiveAt

[`Time!`](/chameleoon-max/type/time)

When the goods count as received.

### completedAt

[`Time`](/chameleoon-max/type/time)

When the receipt was completed. Null until it is completed.

### cancelledAt

[`Time`](/chameleoon-max/type/time)

When the receipt was cancelled. Null unless it is cancelled.

### revision

`Int!`

How many times the completed receipt has been revised. `0` when it was completed and never
revised.

### warehouseId

[`UUID!`](/chameleoon-max/type/uuid)

The MAX id of the warehouse the goods came into.

### warehouse

[`Warehouse`](/chameleoon-max/type/warehouse)

The warehouse the goods came into.

- Requires the `warehouse.read` permission. Without it, the field is null with a
  `FORBIDDEN_ROLE` error at its path (`extensions.permission`).
- Outside your API key's warehouse scope, the field is null with a `FORBIDDEN_SCOPE` error at
  its path (`extensions.scope` `WAREHOUSE`).
- In both cases the rest of the response is returned.

### legalEntityId

[`UUID`](/chameleoon-max/type/uuid)

The MAX id of the legal entity (the company) the receipt belongs to. Null when it belongs to none.

### supplierId

[`UUID`](/chameleoon-max/type/uuid)

The supplier's MAX id. Null when the receipt names no supplier.

### supplier

[`Partner`](/chameleoon-max/type/partner)

The supplier.

- Requires the `partner.read` permission. Without it, the field is null with a
  `FORBIDDEN_ROLE` error at its path (`extensions.permission`).
- A supplier outside your API key's partner scope is null with a `FORBIDDEN_SCOPE` error at
  its path (`extensions.scope` `PARTNER`).
- In both cases the rest of the response is returned.
- An erased supplier keeps its id and code, with `name` null.

### origin

[`ReceiptOrigin!`](/chameleoon-max/type/receipt-origin)

What the receipt was created from.

### receiptAdvice

[`ReceiptAdvice`](/chameleoon-max/type/receipt-advice)

The receipt advice the receipt answers. Null for a receipt that answers none.

- Requires the `advice.read` permission. Without it, null with `FORBIDDEN_ROLE` at its path.
- Null, without an error, when the advice is outside your API key's scope.
- The rest of the response is returned.

### externalReference

`String`

The supplier's delivery note number or invoice number. Null, without an error, when the
supplier is outside your API key's partner scope.

### currencyCode

`String!`

The ISO 4217 code of the receipt's currency.

### pricesCurrencyCode

`String`

The ISO 4217 code of the currency of the lines' `unitPrice`: the receipt advice's, or the
company's when the receipt answers none. It may differ from `currencyCode`. Null when the
receipt's company does not record purchase prices, and on a receipt a stocktake made.

### pricesIncludeVat

`Boolean`

Whether the lines' `unitPrice` includes VAT. Null when the receipt's company does not record
purchase prices, and on a receipt a stocktake made.

### totalValue

[`Decimal`](/chameleoon-max/type/decimal)

The sum of the lines' values, without VAT. Null while the costing of any line is pending. A
completed receipt can still be pending, so read it again later. When the receipt's company does
not value its stock in MAX it is 0, never pending, and means nothing; read the lines'
`unitPrice` instead.

It reads every stock movement of the document.

Costs 10 points.

### costingPending

`Boolean!`

`true` while the costing of any line is pending. A completed receipt can still be pending, and
no event is sent when its costing finishes, so read it again later. Always `false` when the
receipt's company does not value its stock in MAX.

It reads every stock movement of the document.

Costs 10 points.

### lines

[`ReceiptLineConnection`](/chameleoon-max/type/receipt-line-connection)

Arguments:

- `first`: `Int`
- `after`: `String`
- `last`: `Int`
- `before`: `String`

The goods lines, by line number, then id.

- A connection, paged with `first`/`after` or `last`/`before`, at most 250 a page. Its
  cursors belong to this receipt's lines; any other connection refuses them.
- Null, with an error at its path, when its page cannot be read, for example because of a
  cursor of another parent. The rest of the response is returned.
- A page costs 2 + first (or last) × the cost of one node.

### externalRefs

[`ExternalRefConnection`](/chameleoon-max/type/external-ref-connection)

Arguments:

- `first`: `Int`
- `after`: `String`
- `last`: `Int`
- `before`: `String`

The records that external systems made of this receipt ([`setReceiptExternalRef`](/chameleoon-max/mutation/set-receipt-external-ref)),
at most one per external source.

- A connection, paged with `first`/`after` or `last`/`before`, at most 250 a page. Its
  cursors belong to this receipt's references; any other connection refuses them.
- Read together with the receipt: requires the `receipt.read` permission, not
  `integration.read`. Without it, null with `FORBIDDEN_ROLE` at its path.
- Null, with an error at its path, when its page cannot be read, for example because of a
  cursor of another parent. The rest of the response is returned.
- A page costs 2 + first (or last) × the cost of one node.

## Used by

- [`AdviceReceiptConnection`](/chameleoon-max/type/advice-receipt-connection)
- [`ReceiptConnection`](/chameleoon-max/type/receipt-connection)
- [`ReceiptEdge`](/chameleoon-max/type/receipt-edge)
- [`ReceiptExternalRefResult`](/chameleoon-max/type/receipt-external-ref-result)
