Skip to main content

ZDD Relationships

How to link ZDD with a bank document in the REST API

Written by Lenka Haringerová

Via the REST API, it is possible to link an advance tax document (ZDD) with the payment of a bank or cash document that settles the advance.

However, a ZDD cannot be created directly based on a received payment, unlike in the desktop application. It must first be created, and only then can a link to the relevant payment be established.

ℹ️ If you want to create a ZDD from a payment in a single call, use the vytvorZDD service on the bank or cash document — see Creating a ZDD via REST API.


Creating a ZDD link

You create a link between a ZDD and a bank document using the <vytvor-vazbu-zdd> element:

<?xml version="1.0"?>
<!-- vytvoření vazby zdd mezi zdd a bankou -->
<winstrom version="1.0">
<faktura-vydana>
<!-- zálohový daňový doklad -->
<id>code:VF1-0001/2017</id>
<!-- lze normálně uvést další vlastnosti dokladu jako při běžném importu -->
<vytvor-vazbu-zdd>
<uhrada type="banka">code:B+0001/2017</uhrada>
</vytvor-vazbu-zdd>
</faktura-vydana>
</winstrom>

A cash document can be linked in the same way, only the type attribute changes:

<?xml version="1.0"?>
<!-- vytvoření vazby zdd mezi zdd a pokladnou -->
<winstrom version="1.0">
<faktura-vydana>
<id>code:VF1-0001/2017</id>
<vytvor-vazbu-zdd>
<uhrada type="pokladni-pohyb">code:P+0001/2017</uhrada>
</vytvor-vazbu-zdd>
</faktura-vydana>
</winstrom>

The identifier of the payment document (the <uhrada> tag) can be specified according to the usual rules. If this payment document is not found, the import will fail with a 400 error with code parovaniZddNenalezenUhrazujiciDoklad:

Úhrada (id = code:B+9999/2017) nebyla nalezena.

If the payment type (the type attribute) is not specified, the payment type is assumed to be a bank document:

<?xml version="1.0"?>
<!-- vytvoření vazby zdd mezi zdd a úhradou bez uvedení typu platby -->
<winstrom version="1.0">
<faktura-vydana>
<id>code:VF1-0001/2017</id>
<vytvor-vazbu-zdd>
<uhrada>code:B+0001/2017</uhrada>
</vytvor-vazbu-zdd>
</faktura-vydana>
</winstrom>

⚠️ The link is always 1:1 — a single ZDD can only be linked to one payment, and a single payment can only be linked to one ZDD. If the ZDD (or payment) is already linked and an attempt is made to link it to a different document, the import will fail with an error.


Removing a ZDD link

It is also possible to remove a ZDD link via the REST API. This is done using an empty <zrus-vazbu-zdd/> element:

<?xml version="1.0"?>
<!-- zrušení vazby zdd -->
<winstrom version="1.0">
<faktura-vydana>
<!-- zálohový daňový doklad -->
<id>code:VF1-0001/2017</id>
<zrus-vazbu-zdd/>
</faktura-vydana>
</winstrom>


Related articles

Did this answer your question?