Skip to content

Exports

sarmakska edited this page Jun 1, 2026 · 1 revision

Exports

StaffPortal has two finance-grade exports: an Excel timesheet workbook and a bank-statement reconciliation flow.

Timesheet Excel export

The Timesheets page has Export buttons that build an xlsx workbook with exceljs. The workbook has the following sheets:

  • One sheet per employee with daily rows, clock-in and clock-out times, total hours, status, and notes.
  • A monthly summary sheet aggregating total hours, leave days, WFH days, and late arrivals per user.
  • A WFH records sheet listing WFH days with reasons.
  • A leave records sheet listing approved leave with dates and types.

The same export is available for a single user or for the whole team over a chosen date range. Admin, accounts, and director roles can export anyone; employees can export themselves.

The implementation lives in lib/actions/timesheet-export.ts.

Bank statement reconciliation

Upload a CSV bank statement at /admin/reconciliation. The matcher pairs each statement line to an expense row by:

  1. exact match on date and amount, or
  2. amount match with the date within a two-day window, or
  3. amount match with the last four digits of the card number aligned.

Matches are shown with a confidence score. An Approve Match button writes the link to expenses.bank_match_ref and stamps the bank-statement-line ID. Unmatched lines are flagged for manual reconciliation.

The page supports incremental upload: re-uploading a CSV does not duplicate rows, because each statement line is identified by its bank-line ID.

Privacy

Both exports are gated by role. The audit log records every export with the user, the time, and a summary of what was exported.

Clone this wiki locally