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

# CalculateSalesOrder

> Calculate prices, discounts, and taxes for a sales order 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** `CalculateSalesOrder(request: CalculateSalesOrderCommandRequestInput!): CalculateSalesOrderCommandResponse!`

## Arguments

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

## Returns

`CalculateSalesOrderCommandResponse!`

**`lineItems`**: `[CalculateSalesOrderLineItemResponse!]!`

The list of calculated sales order line items.

---

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

The total net amount for the sales order.

---

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

The total gross amount for the sales order.

---

**`totalNetAmountInclShipping`**: `Decimal!`

The total net amount for the sales order including shipping costs.

---

**`totalGrossAmountInclShipping`**: `Decimal!`

The total gross amount for the sales order including shipping costs.

---

**`companyVatId`**: `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.

---

**`vatAmounts`**: `[CalculateSalesOrderVatAmount!]!`

The VAT amounts grouped by tax rate.

---

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

The gross shipping cost.

## Examples

```graphql Mutation
mutation CalculateSalesOrder($request: CalculateSalesOrderCommandRequestInput!) {
  CalculateSalesOrder(request: $request) {
    lineItems {
      syncNumber
      type
      itemId
      quantity
      salesPriceNet
      salesPriceGross
    }
    totalNetAmount
    totalGrossAmount
    totalNetAmountInclShipping
    totalGrossAmountInclShipping
    companyVatId
  }
}
```

```json Variables
{
  "request": {
    "calculateSalesOrderRequest": {
      "companyId": "id",
      "customerId": "id",
      "lineItems": [
        {
          "syncNumber": 1,
          "quantity": "value"
        }
      ],
      "departureCountryIso": "string"
    },
    "recalculateTaxMode": "NO_RECALCULATION",
    "changes": [
      {}
    ]
  }
}
```

```json Response
{
  "data": {
    "CalculateSalesOrder": {
      "lineItems": [
        {
          "syncNumber": 1,
          "type": "CUSTOM",
          "itemId": "id",
          "quantity": "value",
          "salesPriceNet": "value",
          "salesPriceGross": "value"
        }
      ],
      "totalNetAmount": "value",
      "totalGrossAmount": "value",
      "totalNetAmountInclShipping": "value",
      "totalGrossAmountInclShipping": "value",
      "companyVatId": "string"
    }
  }
}
```
