A mutual offset (netting) is a fictitious bank statement used mainly to settle receivables and liabilities based on the principle of mutual offsetting. In the API, this is handled by the vzajemny-zapocet record.
ℹ️ Both sides of the offset are created as separate documents and are linked by a matching offset number in the <cisSouhrnne> element. The receivables side has typPohybu.prijem, the liabilities side has typPohybu.vydej; amounts are always entered as positive.
Preparing invoices
For this example, we will first create an issued and a received invoice between which the offset will be performed:
<?xml version="1.0"?>
<winstrom version="1.0">
<faktura-vydana>
<id>code:FAV1</id>
<typDokl>code:FAKTURA</typDokl>
<bezPolozek>true</bezPolozek>
<sumOsv>100.0</sumOsv>
</faktura-vydana>
<faktura-prijata>
<id>code:FAP1</id>
<typDokl>code:FAKTURA</typDokl>
<cisDosle>F123</cisDosle>
<datSplat>2017-12-31+01:00</datSplat>
<bezPolozek>true</bezPolozek>
<sumOsv>100.0</sumOsv>
</faktura-prijata>
</winstrom>
Performing the offset
For the prepared invoices, the offset can be performed as follows:
<?xml version="1.0"?>
<winstrom version="1.0">
<vzajemny-zapocet>
<id>code:ZAP+0016/2017</id>
<typDokl>code:ZAPOCET</typDokl>
<typPohybuK>typPohybu.prijem</typPohybuK>
<!-- částka úhrady -->
<sumOsv>1.0</sumOsv>
<bezPolozek>true</bezPolozek>
<sparovani>
<uhrazovanaFak type="faktura-vydana">code:FAV1</uhrazovanaFak>
<zbytek>castecnaUhrada</zbytek>
</sparovani>
<!-- číslo zápočtu -->
<cisSouhrnne>ZAP-123</cisSouhrnne>
</vzajemny-zapocet>
<vzajemny-zapocet>
<id>code:ZAP+0017/2017</id>
<typDokl>code:ZAPOCET</typDokl>
<typPohybuK>typPohybu.vydej</typPohybuK>
<sumOsv>1.0</sumOsv>
<bezPolozek>true</bezPolozek>
<sparovani>
<uhrazovanaFak type="faktura-prijata">code:FAP1</uhrazovanaFak>
<zbytek>castecnaUhrada</zbytek>
</sparovani>
<cisSouhrnne>ZAP-123</cisSouhrnne>
</vzajemny-zapocet>
</winstrom>
It may happen that the amounts on the settling document and the settled document do not match (part remains to be paid). In such a case, the import is governed by the value in the <zbytek> tag. The following two values are most commonly used for offsets:
ne— no remainder is allowed to occur; if it does, it is considered an error.castecnaUhrada— if the amount on the settling document is smaller than on the settled document, it is treated as a partial payment.
ℹ️ The <zbytek> element accepts the same values as when matching payments — besides the two above, also zauctovat, ignorovat, castecnaUhradaNeboZauctovat, and castecnaUhradaNeboIgnorovat. An invalid value returns 400 elementInvalidValue.
Settling an invoice with a credit note
Offsets can also be used to settle an issued invoice with an issued credit note. Amounts are again both entered as positive, with the credit note distinguished by the movement type — outgoing:
<?xml version="1.0"?>
<winstrom version="1.0">
<vzajemny-zapocet>
<typDokl>code:ZAPOCET</typDokl>
<typPohybuK>typPohybu.vydej</typPohybuK>
<bezPolozek>true</bezPolozek>
<sumOsv>1000</sumOsv>
<sparovani>
<uhrazovanaFak type="faktura-vydana">code:DOBROPIS1</uhrazovanaFak>
<zbytek>ne</zbytek>
</sparovani>
<primUcet>code:395000</primUcet>
<protiUcet>code:311001</protiUcet>
<cisSouhrnne>ZAP1</cisSouhrnne>
</vzajemny-zapocet>
<vzajemny-zapocet>
<typDokl>code:ZAPOCET</typDokl>
<typPohybuK>typPohybu.prijem</typPohybuK>
<bezPolozek>true</bezPolozek>
<sumOsv>1000</sumOsv>
<sparovani>
<uhrazovanaFak type="faktura-vydana">code:FAV1</uhrazovanaFak>
<zbytek>ne</zbytek>
</sparovani>
<primUcet>code:395000</primUcet>
<protiUcet>code:311001</protiUcet>
<cisSouhrnne>ZAP1</cisSouhrnne>
</vzajemny-zapocet>
</winstrom>
Unmatching
Unmatching can be performed in a similar way — instead of the <sparovani> element, <odparovani> is used:
<?xml version="1.0"?>
<winstrom version="1.0">
<vzajemny-zapocet>
<id>code:ZAP+0016/2017</id>
<odparovani>
<uhrazovanaFak type="faktura-vydana">code:FAV1</uhrazovanaFak>
</odparovani>
</vzajemny-zapocet>
</winstrom>
Offsetting multiple invoices in JSON
The request can, of course, also be sent in JSON format. The following example addresses this situation:
On the receivables side, there are two issued invoices (VF1-0033/2023 and VF1-0031/2023) with a total amount of CZK 1,210.
On the liabilities side, there is one received invoice, also with a total amount of CZK 1,210.
The result is the creation of both sides of the offset, matched to each other via the matching offset number (cisSouhrnne):
{
"winstrom": {
"vzajemny-zapocet": [
{
"datVyst": "2023-09-07",
"sumOsv": 1000,
"bezPolozek": true,
"typDokl": "code:ZAPOCET",
"typPohybuK": "typPohybu.prijem",
"sparovani": {
"uhrazovanaFak@type": "faktura-vydana",
"uhrazovanaFak": "code:VF1-0033/2023",
"zbytek": "ne"
},
"cisSouhrnne": "5"
},
{
"datVyst": "2023-09-07",
"sumOsv": 210,
"bezPolozek": true,
"typDokl": "code:ZAPOCET",
"typPohybuK": "typPohybu.prijem",
"sparovani": {
"uhrazovanaFak@type": "faktura-vydana",
"uhrazovanaFak": "code:VF1-0031/2023",
"zbytek": "ne"
},
"cisSouhrnne": "5"
},
{
"datVyst": "2023-09-07",
"sumOsv": 1210,
"bezPolozek": true,
"typDokl": "code:ZAPOCET",
"typPohybuK": "typPohybu.vydej",
"sparovani": {
"uhrazovanaFak@type": "faktura-prijata",
"uhrazovanaFak": "code:PF0016/2023",
"zbytek": "ne"
},
"cisSouhrnne": "5"
}
]
}
}
Offset in a foreign currency
A mutual offset can also be created in a foreign currency. Matching then works on the same principle as for offsets in the local currency — instead of sumOsv, sumOsvMen is specified, along with kurz and mena:
{
"winstrom": {
"vzajemny-zapocet": [
{
"typDokl": "code:ZAPOCET",
"typPohybuK": "typPohybu.vydej",
"sumOsvMen": 200,
"bezPolozek": true,
"kurz": 23.527,
"mena": "code:EUR"
}
]
}
}
