Just as in the desktop or web application, where it is possible to allocate additional costs to the price of goods, this functionality is also available via the API.
In the API, the allocation of additional costs is always performed on a warehouse document (i.e., a goods receipt). It is the only document on which the allocation function is available.
Additional costs can be allocated in two ways:
By price
By quantity
If you choose by price, the costs to be allocated are distributed proportionally across all unit prices. For example, if the delivery price is 1,000 CZK and the additional costs amount to 500 CZK, that is 50% of the purchase price. Therefore, each purchase price per unit will also be increased by 50%.
If you choose by quantity, the costs to be allocated are divided by the number of units in the delivery, and the resulting amount is added to the acquisition price per unit. For example, if a delivery contains 20 units and the additional costs amount to 500 CZK, the price per unit for each line item will be increased by 25 CZK, regardless of the existing purchase prices per unit.
XML example for allocating additional costs of 500 CZK by price:
<winstrom version="1.0">
<skladovy-pohyb>
<id>1015</id>
<rozuctuj>
<vedlejsiNaklady>500</vedlejsiNaklady>
<podleCeny>true</podleCeny>
</rozuctuj>
</skladovy-pohyb>
</winstrom>
XML example for allocating additional costs of 500 CZK by quantity:
<winstrom version="1.0">
<skladovy-pohyb>
<id>1015</id>
<rozuctuj>
<vedlejsiNaklady>500</vedlejsiNaklady>
<podleCeny>false</podleCeny>
</rozuctuj>
</skladovy-pohyb>
</winstrom>
The response on success in the case of XML is:
<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>1015</id>
<request-id>1015</request-id>
<ref>/c/testovaci_2/skladovy-pohyb/1015.xml</ref>
</result>
</results>
</winstrom>
JSON example for allocating additional costs of 500 CZK by price:
{
"winstrom":{
"skladovy-pohyb":[
{
"id":"46",
"rozuctuj":{
"vedlejsiNaklady": 500,
"podleCeny": true
}
}
],
"@version":"1.0"
}
}
JSON example for allocating additional costs of 500 CZK by quantity:
{
"winstrom":{
"skladovy-pohyb":[
{
"id":"46",
"rozuctuj":{
"vedlejsiNaklady": 500,
"podleCeny": false
}
}
],
"@version":"1.0"
}
}
The response on success in the case of JSON is:
{
"winstrom":{
"@version":"1.0",
"success":"true",
"stats":{
"created":"0",
"updated":"1",
"deleted":"0",
"skipped":"0",
"failed":"0"
},
"results":[
{
"id":"1015",
"request-id":"1015",
"ref":"/c/testovaci_2/skladovy-pohyb/1015.json"
}
]
}
}