# Monthly cycle

Every month, Salaxy runs a scheduled batch for every employer. It closes the **previous month**: accounting reports, the monthly summary to the Incomes Register and the tax invoices. You do not call it. You fetch its outputs through the normal API, so the day of the month is your contract. Salary slips are not part of it: each paid calculation has its own slip, see [Salary slips and e-payslips](https://code.salaxy.com/integration/salary-slips.md).
Examples use the **test** environment; see [Environments](https://code.salaxy.com/get-started/environments.md) for demo and production.

*Diagram: A timeline with four steps, all in Helsinki time and all for the previous month. On the 4th business day Salaxy creates the accounting reports and sends the monthly report emails. On day 5 it files the monthly summary to the Incomes Register. On day 6 it releases the tax invoice and the union invoice to the payment channel. On day 10 it creates the tax payments made from a customer funds account. (Helsinki time, previous month's salaries. The 4th business day skips weekends and Finnish public holidays.)*

## The outputs

| # | When | Output | Where you see it |
|---|---|---|---|
| 1 | 4th business day | **Accounting reports**: accounting data of the previous month per employer, mapped to the employer's accounting target. A PDF summary and a spreadsheet are archived too. | The accounting endpoints: see [Accounting data](https://code.salaxy.com/integration/accounting-data.md) |
| 2 | 4th business day | **Monthly report emails**: the reports of output 1, emailed to the employers and accounting firms on file. | Email only, not the API |
| 3 | Day 5 | **PSR, the Payer Summary Report**: the monthly summary (*työnantajan erillisilmoitus*) to the Incomes Register. | Filed for you: see [Incomes Register filing](https://code.salaxy.com/integration/incomes-register.md) |
| 4 | Day 6 | **TAS invoice**: tax and social security invoice (*vero- ja sotumaksulasku*), the monthly total of withheld tax and employer social security charges. | The normal invoice flow: see [Invoices and payments](https://code.salaxy.com/integration/invoices-and-payments.md) |
| 5 | Day 6 | **Union invoice**: trade union membership fees withheld from workers, one per union. Only for employers who have a union deduction in the period. | Same as the TAS invoice |
| 6 | Day 10, or the previous workday | **Tax payments** that Salaxy makes from a customer funds account. Only on customer funds account channels. | Nothing to fetch on other channels: their tax is paid through the TAS invoice (output 4) |

- **Calendar day or business day.** Outputs 1 and 2 run on the 4th business day. Outputs 3 to 5 run on the calendar day shown. Output 6 falls back to the previous workday when day 10 is not a workday.
- **Previous month.** Day 4 of March produces the February reports.

## What the invoices do

This section describes most payment channels. Customer funds account channels work differently (see below), and a few channels release the invoice as soon as all its salaries are paid.

The tax and union invoices are created as **preview** when a payment is committed. The day-6 run finalises them and releases them to the payment channel as `unread`. The TAS invoice is due on the next workday on or after the 12th. The union invoice is due on the next workday on or after the 15th.

**On these channels, a salary that is not paid before the day-6 run is missing from that month's tax invoice.** The run takes the calculations that have reached `paymentSucceeded` by then, and it does not return to a past month. If a salary can be paid late, for example because of a bank approval, plan for it with your customer.

## Rules to build on

- **Once a month, no automatic retry.** An output that misses its slot is not repeated. Ask Salaxy support to re-run it for the employer.
- **Incomes Register: two flows.** The PSR is monthly, on day 5. The per-salary report (EPR) is a separate flow: it is created when a salary is paid and sent 4 days after its salary date, or at once if that day has passed. See [Incomes Register filing](https://code.salaxy.com/integration/incomes-register.md).
- **Customer funds account channels differ.** Tax remittance follows another path, and some channels add a monthly pension payment record on day 25. If a customer is on such a channel, ask Salaxy for the addendum.

## Test and demo

The monthly cycle **does not run end to end** in test or demo. Only a subset runs, on the same days as in production:

| Output | In test and demo |
|---|---|
| Accounting data | Generated as data on the 4th business day. No PDF, spreadsheet or report email. |
| TAS and union invoices | Generated by the same code as in production, on day 6. |
| PSR | Generated on day 5, **not** sent to the Incomes Register. |
| Report emails, tax payments | Skipped. |

For a full rehearsal that shows where each output lands, ask Salaxy support to schedule a manual run. In your own tests you need not wait for the 4th business day: call the period report for a past month, or use `POST /v03/api/reports/accounting/{refDate}/close` to write the saved report on demand. See [Accounting data](https://code.salaxy.com/integration/accounting-data.md).

## Checklist

- Pull the period report on or after the 5th of the next month. Read a saved report only after the 4th business day, which can fall after the 5th.
- In test, pull the period report or call `close` instead of waiting for output 1.
- Make sure salaries are paid before the day-6 run, so they are in the month's tax invoice.
- Do not file anything to the Incomes Register yourself.
- If an output is missing in production, ask Salaxy support to re-run it. It will not retry by itself.

**Next:** [Incomes Register filing](https://code.salaxy.com/integration/incomes-register.md)
