Before we proceed to creating a payroll component with specific data regarding hours worked, etc., it is first necessary to create a person and, if applicable, permanent payroll components.
As an absolute first step, a person (i.e., an employee) must exist to whom the payroll components will belong. In the XML file examples you can find a sample XML for creating a person. It is also possible to create a person directly in the application.
So-called permanent payroll components must be assigned to the given person. More information can again be found in the documentation for HR (i.e., for the person/employee).
Once the above has been configured, we can move on to the actual process — transferring attendance data into ABRA Flexi.
First, you need to retrieve the IDs of the payroll components from Flexi that you will be updating. It is necessary to update specific payroll components for the given months, which are prepared based on the creation of a permanent payroll component.
The ID of the relevant payroll component is obtained using a GET request to a URL of the following type:
/mzdova-slozka/(cisMzdSloz = 'code:HODINOVÁ MZDA' and rok = 2022 and mesic = 1).xml?detail=custom:id,osoba(osbCis,jmeno,prijmeni,titul),hodiny,zmenaCasu,zmenaCastMzd,castkaHod,castMzd&includes=/mzdova-slozka/osoba&limit=0
By filtering as shown in the example above — by year and month — you will retrieve all payroll components that correspond to the hourly wage for the given period. You can of course use any level of detail.
From the payroll component code list you can of course select a component other than hourly wage.
It could, for example, relate to an absence; in that case the URL for retrieval would look something like this:
/nepritomnost/(cisMzdSloz = 'code:NEMOC' and (platiOd >= '2022-01-01' and platiOd <= '2022-01-31' or platiDo >= '2022-01-01' and platiDo <= '2022-01-31')).xml?detail=full
The retrieved XML of the payroll component based on the first example may look like this:
<?xml version="1.0" encoding="utf-8"?>
<winstrom version="1.0">
<mzdova-slozka>
<id>9258</id>
<osoba>
<osoba-hlavicka>
<id>4</id>
<osbCis>432423423</osbCis>
<jmeno>Karel</jmeno>
<prijmeni>Novák</prijmeni>
<titul>Ing.</titul>
</osoba-hlavicka>
</osoba>
<hodiny>0.0</hodiny>
<zmenaCasu>false</zmenaCasu>
<zmenaCastMzd>false</zmenaCastMzd>
<castkaHod>0.0</castkaHod>
<castMzd>0.0</castMzd>
</mzdova-slozka>
</winstrom>
You now need to fill in the appropriate value — in our example, we will be entering the number of hours worked. The same approach can be applied when filling in days — depending on the logic of the given payroll component from the payroll component code list.
The part of the XML file relating to the person can be omitted during the import in this case, as we only want to make a change to the hours.
<?xml version="1.0" encoding="utf-8"?>
<winstrom version="1.0">
<mzdova-slozka>
<id>9258</id>
<hodiny>100.0</hodiny>
<zmenaCasu>false</zmenaCasu>
<zmenaCastMzd>false</zmenaCastMzd>
<castkaHod>0.0</castkaHod>
<castMzd>0.0</castMzd>
</mzdova-slozka>
</winstrom>
Send the XML using a POST/PUT request to the /mzdova-slozka endpoint. If the import is successful, the API will return the following response and the payroll component will be updated.
<?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>9258</id>
<request-id>9258</request-id>
<ref>/c/testovaci_2/mzdova-slozka/9258.xml</ref>
</result>
</results>
</winstrom>
