Skip to main content

Advance Payment Deduction and Tax Document for Payment - API

Deducting a Deposit and Tax Document (Issuing a Tax Invoice for Payment)

Written by Petr Pech

When creating documents (e.g., invoices), it is necessary to allow deduction by another document (e.g., an advance payment).

In addition to deducting advances and tax documents on advance payments (ZDD), you can also create an invoice directly from paid advances. Find out how to do it.

Advance deduction (issuing a tax document for payment)

<?xml version="1.0"?>
<winstrom version="1.0">
<faktura-vydana>
<id>code:VF-123/2021</id>
<!-- Typ faktury (objekt) - max. délka: 20 -->
<typDokl>code:FAKTURA</typDokl> ...dal&#x161;&#xED; n&#xE1;le&#x17E;itosti faktury
<polozkyFaktury>
<faktura-vydana-polozka>
<cenik>code:CANON XS1</cenik>
<typPolozkyK>typPolozky.katalog</typPolozkyK>
<mnozMj>1.0</mnozMj>
<sklad>code:SKLAD</sklad>
</faktura-vydana-polozka>
</polozkyFaktury>
<odpocty-zaloh>
<odpocet>
<!-- odpočet zálohy -->
<castkaMen>16300.0</castkaMen>
<!-- částka v měně určená pro odpočet -->
<doklad>code:ZALOHA0001\/2010</doklad>
<!-- identifikátor dokladu pro odpočet -->
<id>ext:odpocet1</id>
<!-- externí identifikátor vytvořené odpočtové položky -->
</odpocet>
</odpocty-zaloh>
</faktura-vydana>
</winstrom>

Example in JSON, does not contain the faktura-vydana-polozka and odpocet elements:

{    "winstrom": {        "faktura-vydana": {            "polozkyFaktury": [                {                    "cenik": "code:CANON XS1",                    "sklad": "code:SKLAD",                    "mnozMj": 1                }            ],            "odpocty-zaloh": [                {                    "castkaMen": 16300,                    "doklad": "code:ZALOHA0001\/2021"                }            ],            "typDokl": "code:FAKTURA"        }    }}

ZDD Deduction

Example

<winstrom version="1.0">
<faktura-vydana>
<id>code:VF-12/2014</id>
<!-- Typ faktury (objekt) - max. délka: 20 -->
<typDokl>code:FAKTURA</typDokl>
<odpocty-zaloh>
<odpocet>
<!-- odpočet zdd -->
<castkaZaklMen>400.0</castkaZaklMen>
<!-- částka základní sazby v měně určená pro odpočet -->
<castkaSnizMen>400.0</castkaSnizMen>
<!-- částka snížené sazby v měně určená pro odpočet -->
<castkaSniz2Men>400.0</castkaSniz2Men>
<!-- částka 2. snížené sazby v měně určená pro odpočet -->
<castkaOsvMen>400.0</castkaOsvMen>
<!-- částka osvobozená od DPH v měně určená pro odpočet -->
<doklad>code:ZDD0001/2010</doklad>
<!-- identifikátor dokladu pro odpočet -->
<id>ext:odpocet1</id>
<!-- externí identifikátor vytvořených odpočtových položek -->
<!-- identifikátor jednotlivých položek je doplněn o posfix -ZAKL, -SNIZ, -SNIZ2, -OSV -->
<castkyBezDph>true</castkyBezDph>
<!-- zda jsou uvedené částky včetně, nebo bez DPH -->
<prijmoutDoporuceni>true</prijmoutDoporuceni>
<!-- zda se má automaticky aplikovat doporučení úpravy faktury, nepovinné -->
<castkyVseDostupne>true</castkyVseDostupne>
<!-- pokud je true, odpočítá se ze zálohy vše, co ještě není odpočteno - nepovinné-->
</odpocet>
</odpocty-zaloh>
</faktura-vydana>
</winstrom>

Deduction method

When deducting an advance tax document, deduction items are first created based on the amounts available on the invoice (VAT rates are taken from the invoice).
Subsequently, deduction items for any remaining amount to be deducted are created as overpayment items (VAT rates from the ZDD).

Amounts excluding VAT vs. including VAT

The element castkyBezDph determines whether the specified amounts include or exclude VAT.
For backward compatibility, the default value is false, but since ZDD deductions internally work with amounts excluding VAT, we recommend sending amounts excluding VAT.

Fulfillment group

If the element skupPlneni is specified, the deduction only counts amounts from invoice line items belonging to that fulfillment group.
If the value is empty, only items without a fulfillment group are counted.
The fulfillment group is not taken into account if the element is not present or has the value ALL.

Automatic invoice adjustment

When deducting a ZDD from an invoice, the goal is often to obtain a fully paid invoice. Due to differences in rounding or VAT correction, the invoice may not be fully settled.
Correct invoice settings can eliminate this issue. The system is able to suggest the necessary adjustments.
If <prijmoutDoporuceni>true</prijmoutDoporuceni> is specified, the recommended invoice adjustment will be applied automatically.
The list of recommendations can be retrieved at https://instance/c/firma/faktura-vydana/ID_FAKTURY/zalohy-k-odpoctu.xml?relations=doporuceni.

Deducting all available amounts

Instead of filling in amounts in the castka*Men fields, you can use the element castkyVseDostupne with the value true. This will deduct everything from the advance that has not yet been deducted.

Automatic deduction

When creating documents, you can also use automatic deduction of advance documents and advance tax documents.

<?xml version="1.0"?><winstrom version="1.0">  <faktura-vydana>    <!-- Typ faktury (objekt) - max. délka: 20 -->    <typDokl>code:FAKTURA</typDokl>    <odpocty-zaloh>      <!-- automatický odpočet zálohy a zdd, které mají automatický odpočet povolen v typu dokladu -->      <automaticky-odpocet>true</automaticky-odpocet>    </odpocty-zaloh>  </faktura-vydana></winstrom>

Advance invoices and ZDD must have the checkbox "Allow automatic deduction when creating a new document" enabled in the document type settings.


If you are importing multiple invoices with automatic deduction in a single XML import, use the mode atomic="false".

If you are importing an invoice with rounding configured, create the invoice first and only then deduct the advance documents.

<?xml version="1.0"?><winstrom version="1.0">  <faktura-vydana atomic="false">    <!-- Vytvoření faktury se zaokrouhlením -->    <id>ext:mojeId</id>    <typDokl>code:FAKTURA</typDokl>  </faktura-vydana>  <faktura-vydana>    <id>ext:mojeId</id>    <odpocty-zaloh>      <!-- automatický odpočet zálohy a zdd, které mají automatický odpočet povolen v typu dokladu -->      <automaticky-odpocet>true</automaticky-odpocet>    </odpocty-zaloh>  </faktura-vydana></winstrom>
Did this answer your question?