From a stock movement, you can create a cash movement via the API. Depending on whether it is a goods receipt or a goods issue, either an expense or an income movement will be created. For a goods receipt, an expense cash movement will be created; for a goods issue, an income cash movement will be created instead.
The key is to provide the correct identifier of the stock movement — Flexi will take care of the rest.
Example of calling the PUT/POST method to pay a stock movement:
<winstrom version="1.0">
<skladovy-pohyb>
<id>code:S-0118/2022</id>
<!-- lze uvést i další vlastnosti, jako při běžném importu -->
<zaplat>
<pokladna>code:POKLADNA KČ</pokladna>
<typDokl>code:STANDARD</typDokl>
</zaplat>
</skladovy-pohyb>
</winstrom>
Example of a call in JSON format:
{
"winstrom":{
"skladovy-pohyb":{
"id":"code:S-0118/2022",
"zaplat":[
{
"pokladna":"code:POKLADNA KČ",
"typDokl":"code:STANDARD"
}
]
}
}
}
The response may look like this, for example:
<?xml version="1.0" encoding="utf-8"?>
<winstrom version="1.0">
<success>true</success>
<stats>
<created>0</created>
<updated>1</updated>
<deleted>0</deleted>
<skipped>0</skipped>
<failed>0</failed>
</stats>
<results>
<result>
<id>1129</id>
<request-id>code:S-0118/2022</request-id>
<ref>/c/testovaci_2/skladovy-pohyb/1129.xml</ref>
</result>
</results>
</winstrom>
In JSON format:
{
"winstrom":{
"@version":"1.0",
"success":"true",
"stats":{
"created":"0",
"updated":"1",
"deleted":"0",
"skipped":"0",
"failed":"0"
},
"results":[
{
"id":"1131",
"request-id":"code:S-0118/2022",
"ref":"/c/testovaci_2/skladovy-pohyb/1131.json"
}
]
}
}
More important, however, is the result — the cash movement:
<winstrom version="1.0">
<pokladni-pohyb>
<id>code:P+0008/2022</id>
<typDokl>code:STANDARD</typDokl>
<typPohybuK>typPohybu.prijem</typPohybuK>
<vazby>
<vazba>
<a>code:P+0008/2022</a>
<b>code:S-0118/2022</b>
</vazba>
</vazby>
</pokladni-pohyb>
</winstrom>
In JSON format:
{
"winstrom":{
"@version":"1.0",
"pokladni-pohyb":[
{
"id":"code:P+0008/2022",
"typPohybuK":"typPohybu.prijem",
"vazby":[
{
"a":"code:P+0008/2022",
"b":"code:S-0118/2022"
}
]
}
]
}
}
FAQ
Can a goods receipt or goods issue be settled with multiple cash documents in this way?
No, this functionality only supports creating a single cash document. It cannot match a goods issue with multiple cash documents.
Can I also create an invoice from a goods receipt or goods issue?
Just as a cash movement can be created from a goods receipt or goods issue, an invoice can also be created from a stock movement. You can find more details in our other guide.
