Annual leave your staff have earned but not taken is a liability, and at month end somebody has to reflect that in the books. In practice that means pulling each employee's leave balance out of payroll, working out what it is worth in dollars, comparing it with last month, and posting the difference.

Done by hand it is a slow, fiddly job that is easy to put off. It also repeats for every company you look after, and every month is a new chance to pick the wrong month or post the same entry twice.

This article walks through how we automate the month-end leave accrual from Xero Payroll (NZ), and why we built it to report first and post second.

How it works

  1. It reads the leave balances. For each employee, it reads the annual leave balance from Xero Payroll (NZ).
  2. It values them in dollars. Each employee has a leave valuation rate, set up once when the automation is configured, and the balances are turned into a dollar figure per employee and in total.
  3. It compares with last month. The new total is set against the previous month's provision.
  4. It proposes the entry. If the provision has gone up, it proposes a bill. If it has gone down, it proposes a credit note. Either one goes against the leave provision account.
  5. It deals with the pay-run timing. If a pay run was paid early in the new month but partly belongs to last month, it accrues the share that belongs to last month. It then reverses that accrual on the 1st.
  6. It reports first. You see a summary of everything it intends to post.
  7. You approve, then it posts. Nothing goes to Xero until you say so.

The AI (Anthropic's Claude) does the reading and the judgement, such as deciding which part of a pay run belongs to which month. Small scripts do the arithmetic and the Xero API calls, so the numbers come from code rather than from an AI's estimate.

What to watch out for

Report first, post second. Month-end entries change your financial statements. We think the right design is a summary the owner or accountant reads and approves before anything is posted, rather than a process that books straight into Xero.

Make every posting unique. Each posting carries a unique reference, so running the process again cannot post the same entry twice. If you ever have to re-run month end after a correction, that matters a lot.

Weekly and fortnightly pay cycles differ. Two businesses can be on different cycles. One of our studios pays weekly and the other pays fortnightly, so the share of a pay run that belongs to the previous month is not calculated the same way for both. Do not assume one rule fits every company.

Early pay runs cross the month boundary. When a pay run is paid in the first days of the new month, part of it is last month's cost. Accruing that share and reversing it on the 1st keeps both months right.

Bill or credit note depends on the direction. The entry type follows the movement in the provision. A rising provision is a bill, a falling one is a credit note. Check that your chart of accounts has a leave provision account set up the way the process expects.

What still needs a person

  • Reading the summary and giving the OK before anything is posted.
  • Deciding what to do when a movement looks unusual, for example a large change in one employee's balance.
  • Checking that the right payroll period and month have been chosen.
  • Your accountant's usual review of the figures at the end of the period.

Real example

We run this for two franchise fitness studios in Auckland that are related companies of ours. Each studio is a separate company with its own Xero organisation and its own payroll; one pays weekly and the other fortnightly. Each month the process reads the leave balances, proposes the bill or credit note against the leave provision account, and handles the payroll-timing accrual and its reversal. The owner reviews the summary and approves before anything posts. The month-end job used to take about an hour; it now takes about five minutes.

Read the case study

Want this for your business?

We build automations like this at a fixed price, from NZ$1,000 + GST. If month-end leave accruals take up time in your practice or your business, we can look at your set-up and tell you whether this fits.

Book a free 30-minute automation audit

FAQ

Will it post anything to Xero without my approval? No. It shows you the summary first and waits for your OK.

What happens if I run it twice for the same month? Each posting has a unique reference, so a second run cannot double-post.

Does it work if my staff are paid weekly, or fortnightly? Yes. We have it running for one weekly and one fortnightly pay cycle.