The basis for calculating the 13th is determined in the item's settings. Go to Settings, Salary items :

Position yourself on the Thirteenth Salary heading on the left-hand side of the window and click on the Applied to tab.

The 13th will be based on the items that have been checked to make the calculations.

You have to check some items such as "Unpaid days" so that in case of salary decrease, the 13th salary is not paid in full. You have to check the "Paid vacations based on days" section because in case of paid vacations, they have to be paid on the basis of the annual salary, including the 13th.

The 13th is calculated on the basis of paid amounts only, without taking into account periods (unless specific dates have been entered in the employee management).