0%
balqalam Logo
balqalam
FeaturesCommunityPricingDocumentation
Login
  • Introduction
  • Help center
  • Common questions
  • Get Started
  • Localhost
  • Architecture
  • Structure
  • Pattern
  • Page
  • Layout
  • Content
  • Types
  • Config
  • Actions
  • Queries
  • Authorization
  • Validation
  • Form
  • Table
  • Detail
  • Card
  • Util
  • Hooks
  • List Params
  • Views
  • README.md
  • ISSUE.md
  • Technology Stack
  • Database
  • File
  • CDN Assets
  • Entry Points
  • Dashboard
  • Authentication
  • Credentials
  • OAuth
  • Flow Diagrams
  • Multi-Tenancy
  • Offline
  • Onboarding
  • Onboarding Videos
  • Add Values
  • Admission
  • Application
  • Attendance
  • Compliance
  • Profile
  • Exams
  • Exam Wizard
  • Timetable
  • Classrooms
  • Notifications
  • Conference
  • LMS (Lumos)
  • Finance
  • Fee Management
  • Invoice
  • Wallet
  • Salary
  • Payroll
  • Timesheet
  • Expenses
  • Budget
  • Receipt
  • Accounts
  • Banking
  • Reports
  • Dashboard
  • Permissions
  • Messages
  • Integration Flow
  • Provision
  • AI Document Processing
  • Document Intelligence
  • Internationalization
  • Translation
  • Translation Guide
  • Icons
  • Docs Factory
  • Inspiration
  • Listings
  • Teachers
  • Students
  • Catalog
  • Library
  • Contributing
  • Code of conduct
  • GitHub Workflow
  • Database Seeds
  • Database Safety
  • Test Accounts
  • Bulk import
  • Playwright
  • Prettier
  • Block Rebound
  • Transportation

Payroll

PreviousNext

Pay-period runs that generate per-teacher salary slips with an approve → disburse workflow. The core works, but tax is a flat-15% stub, there is no payslip PDF, and disbursement does not post to the ledger.

Payroll turns each teacher's active salary structure into salary slips for a pay period, totals the run, routes it through approval, and on payment marks every slip PAID with notifications. Disbursement is a single status flip — there is no bank file and no journal entry.

Pipeline

1. Create payroll run (DRAFT)                          — createPayrollRun
2. Generate slips → PROCESSING → PENDING_APPROVAL      — generateSalarySlips
     gross = base + allowances · tax = gross × 0.15 · net = gross − tax − deductions
3. Approve (→ APPROVED) or Reject (→ DRAFT)            — approvePayroll / rejectPayroll
4. Process payments → all slips PAID, run PAID, notify  — processPayments

Status

FeatureStatus
Payroll run CRUD + listingProduction
Salary slip generationProduction (math is stubbed — see below)
Approval / rejection workflowProduction (one-way: APPROVED triggers disburse)
Disbursement (mark PAID) + notificationsProduction
Progressive tax / social securityStubbed — flat 15%; config.ts brackets unused
daysWorked / daysPresent from timesheetStubbed — hardcoded to 22
Create-run UI formStubbed — "coming soon" placeholder page
Payslip PDFPlanned
Bank transfer batch file (ACH/SWIFT)Planned
Journal entry postingPlanned — relation exists, never written

Routes

RoutePageStatus
/{lang}/finance/payrollOverviewReady
/{lang}/finance/payroll/runsRuns listReady
/{lang}/finance/payroll/runs/newCreate runStubbed (placeholder)
/{lang}/finance/payroll/runs/[id]Run detailReady

Server actions

All use auth() + getTenantContext() for schoolId. RBAC is enforced in content.tsx via checkCurrentUserPermission() (not inside the actions). None wrap their writes in db.$transaction.

ActionPurpose
getPayrollRunsList runs (optional status filter)
getPayrollRunOne run + slips + teacher
createPayrollRunCreate DRAFT run
generateSalarySlipsBuild slips, compute totals, notify admins
approvePayrollPENDING_APPROVAL → APPROVED + notify
rejectPayrollPENDING_APPROVAL → DRAFT + notify
processPaymentsAPPROVED → PAID, slips PAID, notify each teacher
getTeacherSalarySlips / getSalarySlipRead slips for a teacher / one slip
getPayrollSummaryCounts + total paid
deletePayrollRunDelete (DRAFT only)

Statuses

EnumValues
PayrollStatusDRAFT, PROCESSING, PENDING_APPROVAL, APPROVED, PAID, CANCELLED
SlipStatusGENERATED, REVIEWED, PAID, CANCELLED

Note: config.ts defines a divergent status set (PENDING/COMPLETED/FAILED) that does not match the Prisma enum — prefer the Prisma values above.

Ledger / accounting

Does not post to the ledger today. postSalaryPayment exists in finance/lib/accounting/actions.ts but has zero callers, and PayrollRun.journalEntryId is reserved in the schema but never set. So disbursing payroll moves the run to PAID without any debit/credit entries. See the double-entry model.

Schema

prisma/models/finance-payroll.prisma:

  • PayrollRun — runNumber, payPeriodStart/End, payDate, status, totalGross/Deductions/Net, processedBy, approvedBy, journalEntryId (reserved).
  • SalarySlip — slipNumber, baseSalary, allowances (Json), grossSalary, taxAmount, otherDeductions (Json), totalDeductions, netSalary, daysWorked/Present/Absent, hoursWorked, status.

No lang field; allowance/deduction names embedded as JSON are also untagged.

Stubs

  • payroll/actions.ts:286 — const taxAmount = grossSalary * 0.15 // Simplified 15% tax rate (the same flat rate is in salary/actions.ts).
  • payroll/actions.ts:257-258 — daysWorked / daysPresent hardcoded to 22 (timesheet integration not wired).
  • payroll/runs/new/page.tsx — create-run form is a "coming soon" placeholder; createPayrollRun is callable programmatically only.
  • config.ts ships a real TAX_BRACKETS array + social-security rates that the action ignores.

Tests

None.

Key files

ComponentPath
Server actionssrc/components/school-dashboard/finance/payroll/actions.ts
Config (unused brackets)src/components/school-dashboard/finance/payroll/config.ts
Contentsrc/components/school-dashboard/finance/payroll/content.tsx
Run detail pagesrc/app/[lang]/s/[subdomain]/(school-dashboard)/finance/payroll/runs/[id]/page.tsx
Schemaprisma/models/finance-payroll.prisma

See also

  • Finance — the block overview + status matrix
  • Salary — the structures payroll reads
  • Timesheet — intended (not yet wired) source of days/hours
  • Accounts — where salary payments should post
SalaryTimesheet

On This Page

PipelineStatusRoutesServer actionsStatusesLedger / accountingSchemaStubsTestsKey filesSee also

Built by Databayt ·

Welcome to balqalam.

A great journey is about to begin.