> ## 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.

# CalculateSalesEntity

> Recalculate prices, discounts, and taxes for a sales entity from a client-supplied state without persisting it.

If a request with this mutation's Idempotency-Key was already completed, the response's `extensions` contains an `idempotency.{responseName}` entry with `wasReplayed: true`.



**mutation** `CalculateSalesEntity(request: CalculateSalesEntityCommandRequestInput!): CalculateSalesEntityCommandResponse!`

## Arguments

**`request`**: `CalculateSalesEntityCommandRequestInput!` (required)

## Returns

`CalculateSalesEntityCommandResponse!`

**`lineItems`**: `[CalculateSalesEntityLineItemResponse!]!`

The list of calculated sales entity line items.

---

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

The total net amount for the sales entity.

---

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

The total gross amount for the sales entity.

---

**`totalNetAmountExcludingShipping`**: `Decimal!`

The total net amount for the sales entity excluding shipping costs.

---

**`totalGrossAmountExcludingShipping`**: `Decimal!`

The total gross amount for the sales entity excluding shipping costs.

---

**`vatId`**: `String!`

The VAT ID of the company for the departure country.

---

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

The ISO code of the currency used for the calculated prices.

---

**`currencyFactor`**: `Decimal!`

The currency factor used for the price conversion.

---

**`shippingCostNet`**: `Decimal!`

The net shipping cost.

---

**`shippingCostGross`**: `Decimal!`

The gross shipping cost.

---

**`vatAmounts`**: `[SalesOrderVatAmountPerRate!]!`

The VAT amounts grouped by tax rate.

---

**`taxSetting`**: `TaxSetting!`

The tax setting applied to the sales entity.

---

**`taxReference`**: `TaxReference!`

The tax reference used during tax calculation - the value from the request after all changes, or ShipmentAddress if none was sent. Read-only.

## Examples

```graphql Mutation
mutation CalculateSalesEntity($request: CalculateSalesEntityCommandRequestInput!) {
  CalculateSalesEntity(request: $request) {
    lineItems {
      syncNumber
      lineItemType
      itemId
      quantity
      salesPriceNet
      salesPriceGross
    }
    totalNetAmount
    totalGrossAmount
    totalNetAmountExcludingShipping
    totalGrossAmountExcludingShipping
    vatId
  }
}
```

```json Variables
{
  "request": {
    "calculateSalesEntityRequest": {
      "companyId": "id",
      "customerId": "id",
      "lineItems": [
        {
          "syncNumber": 1,
          "quantity": "value",
          "taxRate": "value",
          "totalSalesPriceNet": "value",
          "totalSalesPriceGross": "value",
          "lineItemType": "CUSTOM"
        }
      ],
      "currencyIso": "string",
      "currencyFactor": "value",
      "departureCountryIso": "string",
      "taxSetting": "DELIVERY_WITH_VAT"
    },
    "recalculateTaxMode": "NO_RECALCULATION",
    "changes": [
      {}
    ]
  }
}
```

```json Response
{
  "data": {
    "CalculateSalesEntity": {
      "lineItems": [
        {
          "syncNumber": 1,
          "lineItemType": "CUSTOM",
          "itemId": "id",
          "quantity": "value",
          "salesPriceNet": "value",
          "salesPriceGross": "value"
        }
      ],
      "totalNetAmount": "value",
      "totalGrossAmount": "value",
      "totalNetAmountExcludingShipping": "value",
      "totalGrossAmountExcludingShipping": "value",
      "vatId": "string"
    }
  }
}
```
