Numbering
SendInvoiceNumber as "Next" to generate it automatically:
- If the company does not use e-Invoice: the SATFATNO number series.
- If the company uses e-Invoice: the invoice is an e-Invoice when the customer is a registered e-Invoice user or
ProfileIdisIHRACAT, and an e-Archive invoice otherwise, and the number comes from the company’s default e-Invoice or e-Archive numbering: a fixed prefix, the year and a 9-digit sequence. The sequence continues from the highest number with the same prefix and year among the company’s sales and purchase return invoices, so it starts again at 1 every year. If there is no default numbering definition, the request fails (3080).
"Next" cannot be sent on update. Sales and purchase return invoices share one numbering, so InvoiceNumber must be unique in the company among both.
Stock movement
Every line’s stock movement is outbound for a sales invoice (stock decreases), soLots/SerialNumbers follow the outbound rules: a Lot-tracked product (StockType 3) names the lot to consume from, a FIFO/LIFO/FEFO product leaves Lots empty and the API selects lots automatically, and serial numbers must already be registered and not yet dispatched.
Risk limit
When the customer’sRiskAction is 2, an invoice that would exceed the customer’s risk limit is rejected with 3028. The amount checked is the customer ledger amount described below.
Customer ledger
A sales invoice’s customer ledger entry is always a debit (a sales invoice increases what the customer owes the company). If it has already been closed by a collection, the invoice’s customer, amount and currency can no longer be changed, and the invoice cannot be deleted (3016).
The entry’s amount is the invoice’s GrandTotal. On a sales invoice with InvoiceTypeCode IHRACKAYITLI (registered export), the deferred taxes are deducted from it: the VAT of lines whose VatExemptionCode is 701, 702 or 704, plus the special consumption tax (ÖTV) of lines whose VatExemptionCode is 703 or 704.