Module Reference

Payroll

Monthly payroll for Thai companies: social security, withholding tax and student loan from Staff pay, payslips, bank salary files, ภ.ง.ด.1, ภ.ง.ด.1ก, 50 ทวิ and สปส.1-10.

Payroll runs each company's pay once a month. A draft gathers the month's closed pay runs from Staff, which it needs, so hours, overtime and late deductions come from the roster and the clock instead of being typed in again. Payroll works out social security, withholding tax and student loan for each person, the owner approves the run, and once it's paid each person gets a payslip and the company gets its bank salary file and its filings. A month a firm or accountant ran somewhere else can be recorded as paid, so the year's forms still add up. With Accounting on, every paid run posts itself to the books; Payroll's forms don't need Accounting.

What it handles

  • Everyone a company pays, in one list. Every Staff person shows under their company with the details payroll needs (national ID, address, social security number, bank account, allowances), and someone paid only through payroll can be added without a Staff record. A whole team comes in from one spreadsheet, matched by national ID, and one bad row applies nothing. Tested: "Payroll: employee details" Tested: "Payroll: employee upload"
  • The month's draft from Staff pay. A draft takes every closed Staff pay run whose period ends in that month at that company, and works itself out again on every read. Deductions can be set by hand with a reason, and one-off bonuses or deductions added to a line, including a salary advance paid back. Tested: "Payroll: drafts"
  • Tax over the whole year. Withholding tax is worked out on the year so far plus the rest of the year at this month's pay, less allowances, so a raise, a bonus or a leaver doesn't leave the year's tax wrong. Opening totals from before the business switched count in the year. Tested: "Payroll: tax over the year" Tested: "Payroll: opening totals"
  • Approval by someone else. Approving freezes the run. Nobody can approve or pay a run with their own line on it, a run whose Staff pay changed since it was read is refused, and a Staff pay run that an approved or paid payroll run holds can't be reopened in Staff. Until an approved run is paid, what it was worked out from and the bank accounts it pays to stay as they were. Tested: "Payroll: approval" Tested: "Payroll: mark paid"
  • Paying. KBank and SCB salary files come from the run, and anyone the file can't pay is named. Marking a run paid twice records it once. A paid run never changes again: a correction goes in the next month. Once a bank file was downloaded, taking the approval back asks you to confirm the upload was cancelled at the bank first. Those files are then marked cancelled and can't be downloaded again. Tested: "Payroll: bank salary files" Tested: "Payroll: mark paid"
  • Expenses paid back with pay. With Expenses on, a person's approved expenses that were paid from their own money ride on their pay, untaxed, unless you leave one off to pay back separately. An expense spent after the run's pay day waits for the next run, and the run can't be marked paid before the day of its latest expense. Once the run is approved, Expenses holds them so nobody pays them back there as well, and marking the run paid records them paid back. Tested: "Payroll × Expenses: expenses paid back with pay"
  • Social security reminder. Three days before the 15th, whoever subscribed in Settings → Notifications hears that last month's social security is due, once per company. Tested: "Payroll × Notifications: social security due"
  • Payslips. Each person sees their own paid payslips on their phone, in Thai or English. Tested: "Payroll: payslips"
  • Filings. ภ.ง.ด.1 for the month and ภ.ง.ด.1ก for the year as upload files in the Revenue Department's format, each employee's yearly 50 ทวิ, and the month's สปส.1-10 with the SSO upload file. New hires and leavers wait under Waiting for you until their social security form is filed. Tested: "Payroll: forms" Tested: "Payroll: social security return" Tested: "Payroll: social security notices" Tested: "Payroll: payroll paid elsewhere"
  • Rates by date. Social security, the tax brackets and the allowance caps change from a date, and a month already paid keeps the numbers it was paid with. A business can add its own rule from a day, such as a temporary social security cut. Tested: "Payroll: rates"
  • Only the people you choose. Seeing, preparing and approving payroll are three separate permissions, and only Admin has them until you grant them to another role. Tested: "Payroll: access"

What you build on top

  • Switch it on. Payroll is sold on its own, on any plan from Core up. Ask Stardeck to add it, then turn it on in the app's Modules tab (see two switches).
  • Before the first run. Grant payroll:read and payroll:run to whoever keeps the employee details and payroll:approve to the owner who signs off each month. Set each company's social security employer account, fill in the employee details (or upload the sheet), add the salary account for the bank file, and enter opening totals when the business switches mid-year.
  • With an agent. Your coding agent, or an agent over MCP, uses the same routes as the screens and can do only what the person it acts for can. It can bring over employees and opening totals as rows, checked with a dry run first.
  • In code. Your coding agent imports Payroll only through its public API: index.ts and server/index.ts in apps/web/src/modules/payroll/. It never writes Payroll's tables directly. See Build on a Module.

Limits

  • Thai rules only: Thai social security, personal income tax, student loan (กยศ.), Revenue Department and SSO formats, and Buddhist-era dates.
  • Stardeck doesn't send the money. The bank salary file is uploaded and approved in the bank's own business banking. KBank and SCB are the only banks with a file.
  • The social security file is checked against the SSO's published layout, not a live upload.

Facts

  • Kind: feature Module, can be switched on and off
  • Needs: Audit log, Branches, Formatting, i18n, Identity, Infra, Staff, Standard UI
  • Needed by: Nothing
  • Adds to these when they're on: Expenses, Outbox
  • Added to by: Accounting
  • Not built by default for these business types: Website, Spa or salon, Restaurant or café, Retail, Tour operator, Gym or studio, Online classes, Car hire, Online store
  • Offered as an add-on for these business types: none

Pages

WherePath
Admin/admin/payroll

Permissions

Admin holds every key. The other roles listed hold it when the app first gets the Module; after that, roles are yours to change under Settings → Roles & Permissions.

PermissionWhat it allowsOrganization roles that start with it
payroll:readSee the people each company pays with their details, the payroll runs, everyone's payslips and the filings.Admin
payroll:runEnter and change employee details and company payroll settings, upload the employee sheet, and prepare payroll runs.Admin
payroll:approveApprove a payroll run and mark it paid; never a run with your own line on it.Admin

Data

  • Tables: payroll_employee, payroll_company, payroll_company_clock, payroll_rate, payroll_bank_account, payroll_run, payroll_run_staff, payroll_line, payroll_line_item, payroll_line_reimbursement, payroll_opening, payroll_bank_file

Slots

Places other Modules and your app code can add to. See Extend a Module.

  • payroll.payment-fields

Tested workflows

  • Payroll: employee details
  • Payroll: employee upload
  • Payroll: access
  • Payroll: rates
  • Payroll: payroll paid elsewhere
  • Payroll: forms
  • Payroll: approval
  • Payroll: drafts
  • Payroll: opening totals
  • Payroll: tax over the year
  • Payroll: bank salary files
  • Payroll: mark paid
  • Payroll: payslips
  • Payroll: social security return
  • Payroll: social security notices
  • Payroll × Expenses: paid back with pay, in the books (with Expenses on)
  • Payroll × Expenses: the payslip (with Expenses on)
  • Payroll × Expenses: expenses paid back with pay (with Expenses on)
  • Payroll × Notifications: social security due (with Outbox on)