Payroll slips can be sent by email via the REST API. Which payroll records are sent is determined by a filter in the URL; the slips are sent to the email addresses that employees have listed as their contact email in HR records on the Address tab.
Prerequisites
The server has a connection to an SMTP server configured.
A custom email template exists, with the usage for payroll updates selected on the Usage tab, and with the sender and subject filled in on the Settings tab.
Employees have their contact email filled in in HR records.
The full setup, including the Freemarker variables for the template, is described in the article Sending Payroll Slips via SMTP.
Constructing the URL
This service is a sub-record of automaticky-odeslat under the mzda record and is called using the PUT or POST method. The parentheses should contain the filter that selects the payroll records to be sent:
PUT https://demo.flexibee.eu/c/demo/mzda/(rok="2019" and mesic in ("1","2","3") and osbCis = "1")/automaticky-odeslat.xml?jeden-mail-prijemci=true
The properties of the mzda record most commonly used in the filter are: rok, mesic, and osbCis (employee personnel number). The filter is mandatory — without it, all payroll records in the database would be selected.
🚨 This call actually sends emails to employees and has no test mode. Before running it, always verify which payroll records the filter selects — you can send the same filter using the GET method to /c/{firma}/mzda/(…).json?detail=custom:rok,mesic,osbCis.
Result
The response takes the form of a standard import result with a summary in the stats element. If no payroll record matches the filter, the service returns 400, success with the value false, and the warning mzdyNejsouZaznamy:
<?xml version="1.0" encoding="utf-8"?>
<winstrom version="1.0">
<success>false</success>
<stats>
<created>0</created>
<updated>0</updated>
<deleted>0</deleted>
<skipped>0</skipped>
<failed>1</failed>
</stats>
<results>
<result>
<warnings>
<warning messageCode="mzdyNejsouZaznamy">Pro zadaný filtr neexistují mzdy.</warning>
</warnings>
</result>
</results>
</winstrom>
