# SyncInvoiceInput input


The whole document, as the accounting system holds it now.

## Input fields

### source

`String!` · required

The code of the accounting system's external source. The source must be of kind `ERP`.

### externalId

`String!` · required

The accounting system's own id of the document. At most 200 characters on an issued
`INVOICE`.

### sourceChangedAt

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

When the document last changed in the accounting system. A call older than the one MAX holds
writes nothing and returns `STALE`.

### direction

[`InvoiceDirection!`](/chameleoon-max/type/invoice-direction) · required

Whether your organisation issued the invoice or received it. It cannot change later.

### kind

[`InvoiceKind!`](/chameleoon-max/type/invoice-kind) · required

What kind of document it is. It cannot change later.

### legalEntity

`String`

The company (legal entity) the invoice belongs to, by code. If omitted, MAX takes the company
whose company registration number (IČO) is printed on your organisation's side of the invoice
(the seller of an issued invoice, the buyer of a received one). If none matches, MAX takes the
organisation's default company.

### legalEntityId

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

The company (legal entity) the invoice belongs to, by MAX id (as in `SalesOrder.legalEntityId`).
Send it instead of `legalEntity`, never with it (`VALIDATION` on `legalEntityId`).

### partner

[`InvoiceRecordRefInput`](/chameleoon-max/type/invoice-record-ref-input)

The partner, when your integration knows it.

If you omit it, or send an `externalId` that no partner holds yet, MAX finds the partner from
the invoice's party: the buyer of an issued invoice, the seller of a received one.

1. MAX looks the partner up by the party's company registration number (IČO), then by its
   e-mail. When several partners match, MAX takes the oldest and returns a warning.
2. When none matches, MAX creates the partner from the party.

A partner already on the invoice stays.

### sourceDocumentType

`String`

The accounting system's own name for the type of document.

### cancelled

`Boolean` · default `false`

Whether the document is cancelled in the accounting system.

### number

`String!` · required

The document's number. At most 100 characters on an issued `INVOICE`.

### variableSymbol

`String`

The variable symbol (the payment reference).

### constantSymbol

`String`

The constant symbol.

### specificSymbol

`String`

The specific symbol.

### supplierNumber

`String`

The supplier's own number of the document. Only on a received invoice.

### orderNumber

`String`

The number of the order the invoice names.

On an issued invoice, when the number is new (the first call, or a changed number) and exactly
one sales order matches it (not counting drafts and merged orders), MAX links that order
(`AUTO`), with its shipped consignments and their stock issues. An order matches when its MAX
`number` equals `orderNumber` and it belongs to the invoice's company, or when its order number
or id in an external source equals `orderNumber`, in any company. Linking requires the
`order.read` permission for the order, `fulfilment.read` for the consignments, and
`issue.read` for their stock issues.
An order that is still a draft is linked once it is confirmed, if the invoice links no sales
order by then.

### issueDate

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

The issue date.

### taxPointDate

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

The tax point date.

### dueDate

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

The due date.

### receivedDate

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

The date the invoice was received. Only on a received invoice.

### vatClaimDate

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

The date the VAT is claimed.

### seller

[`InvoicePartyInput`](/chameleoon-max/type/invoice-party-input)

The seller as printed.

### buyer

[`InvoicePartyInput`](/chameleoon-max/type/invoice-party-input)

The buyer as printed.

### delivery

[`InvoicePartyInput`](/chameleoon-max/type/invoice-party-input)

The delivery address as printed.

### paymentMethod

[`InvoicePaymentMethod`](/chameleoon-max/type/invoice-payment-method)

How the invoice is to be paid.

### paymentMethodName

`String`

The accounting system's own label for the payment method.

### bankAccountNumber

`String`

The bank account number for the payment.

### bankCode

`String`

The bank code.

### bankName

`String`

The bank's name.

### iban

`String`

The IBAN for the payment.

### swift

`String`

The SWIFT (BIC) code.

### currencyCode

`String!` · required

The ISO 4217 code of the document's currency.

### exchangeRate

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

The exchange rate to the home currency. Must be positive.

### exchangeRateAmount

`Int`

The number of units of the document's currency that `exchangeRate` is quoted for. Must be positive.

### homeCurrencyCode

`String`

The ISO 4217 code of the home currency. If omitted, the document's currency.

### textBeforeItems

`String`

The text printed before the lines.

### textAfterItems

`String`

The text printed after the lines.

### printedNote

`String`

The note printed on the document.

### vatNote

`String`

The statutory VAT wording printed on the document, for example "Dodanie je oslobodené od dane
podľa § 43 zákona o DPH". If omitted, it is cleared, like the other header texts.

### reverseCharge

`Boolean` · default `false`

Whether the reverse charge applies.

### oss

`Boolean` · default `false`

Whether the invoice falls under the One-Stop Shop (OSS) scheme.

### totalNet

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

The total without VAT.

### totalVat

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

The VAT total.

### totalGross

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

The total including VAT.

### rounding

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

The rounding.

### advancesDeducted

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

The advances deducted.

### amountDue

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

The amount due.

### totalNetHome

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

The total without VAT, in the home currency.

### totalVatHome

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

The VAT total, in the home currency.

### totalGrossHome

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

The total including VAT, in the home currency.

### paymentStatus

[`InvoicePaymentStatus`](/chameleoon-max/type/invoice-payment-status) · default `UNKNOWN`

How much of the invoice is paid, as the accounting system states it.

### paidAmount

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

The amount paid. Null when the accounting system does not state it.

### remainingAmount

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

The amount still to be paid. Null when the accounting system does not state it.

### paidAt

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

When the invoice was paid.

### correctsInvoice

[`InvoiceRefInput`](/chameleoon-max/type/invoice-ref-input)

On a credit note only, the invoice it corrects. If MAX does not know it, `correctsInvoiceId`
stays null and `correctedNumber` is kept.

### correctedNumber

`String`

On a credit note only, the number of the invoice it corrects.

### correctedIssueDate

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

On a credit note only, the issue date of the invoice it corrects.

### correctedTaxPointDate

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

On a credit note only, the tax point date of the invoice it corrects.

### correctionReason

`String`

On a credit note only, why the invoice is corrected.

### lines

[`[InvoiceLineInput!]`](/chameleoon-max/type/invoice-line-input)

The lines. They replace every line MAX holds.

### vatSummary

[`[InvoiceVatRowInput!]`](/chameleoon-max/type/invoice-vat-row-input)

The VAT summary. It replaces the one MAX holds.

### settlements

[`[InvoiceSettlementInput!]`](/chameleoon-max/type/invoice-settlement-input)

The settlements. They replace the ones MAX holds.

### links

[`[InvoiceLinkTargetInput!]`](/chameleoon-max/type/invoice-link-target-input)

The MAX documents to link the invoice to. MAX adds them and never removes a link because you
left it out.

## Used by

- [`syncInvoice`](/chameleoon-max/mutation/sync-invoice) (mutation)
