Files
accounted/supabase/migrations/20260512200000_salary_optional_vacation_accrual.sql
Mattsson 3fa871c742 Bug/accounting suggestion (#456)
* feat: add bike benefit handling and optional vacation accrual

- Introduced bike benefit (cykelförmån) with calculations for annual market value and monthly taxable value.
- Updated schemas to include new benefit types and validation rules.
- Implemented API routes for creating, updating, and deleting employee benefits.
- Enhanced salary calculation logic to accommodate new vacation rule options, including a 'none' option for no accrual.
- Added UI components for managing employee benefits, including input for bike benefit specifics.
- Created database migrations for employee benefits and updated salary line items to support new benefit types.

* chore: remove Langfuse env var checks

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat: enhance OAuth callback URL handling and update default scopes for Visma integration

* feat: remove trade_name field and simplify company naming in invoices

* refactor: destructure canWrite from useCanWrite for consistency across components

* feat: enhance PATCH endpoint to validate existing benefits and handle bike benefit updates

* feat: add missing label for bike benefit in salary line item types

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 00:26:04 +02:00

18 lines
949 B
SQL

-- =============================================================================
-- Salary: optional vacation accrual ("none" mode)
-- =============================================================================
-- Adds a third value to employees.vacation_rule so a company can disable
-- semesteravsättning entirely. Useful for sole owners (ägare = enda anställd)
-- who don't accrue semester — booking otherwise creates a phantom 2920 liability.
--
-- procentregeln — 12% (or 14.4% for 30+ days) accrued to 2920 (Semesterlagen 26§)
-- sammaloneregeln — semestertillägg only (Semesterlagen 16a§)
-- none — no accrual; salary expense is the full cost
ALTER TABLE public.employees DROP CONSTRAINT IF EXISTS employees_vacation_rule_check;
ALTER TABLE public.employees ADD CONSTRAINT employees_vacation_rule_check
CHECK (vacation_rule IN ('procentregeln', 'sammaloneregeln', 'none'));
NOTIFY pgrst, 'reload schema';