-
Notifications
You must be signed in to change notification settings - Fork 0
Exports
StaffPortal has two finance-grade exports: an Excel timesheet workbook and a bank-statement reconciliation flow.
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.
Upload a CSV bank statement at /admin/reconciliation. The matcher pairs each statement line to an expense row by:
- exact match on date and amount, or
- amount match with the date within a two-day window, or
- 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.
Both exports are gated by role. The audit log records every export with the user, the time, and a summary of what was exported.