fix(budget): correct VAT storage semantics for planned amounts#1387
Merged
steilerDev merged 1 commit intomainfrom Apr 29, 2026
Merged
fix(budget): correct VAT storage semantics for planned amounts#1387steilerDev merged 1 commit intomainfrom
steilerDev merged 1 commit intomainfrom
Conversation
Previously, in direct pricing mode with "price includes VAT" checked, plannedAmount was divided by 1.19 before storage. In unit mode, VAT was baked into the stored amount at save time, causing double-VAT after display. plannedAmount is now always stored as the net amount (exactly as entered or computed). VAT is applied at display/calculation time via a new effectivePlannedAmount() shared utility exported from @cornerstone/shared. A DB migration (0031) converts existing unit-mode includes_vat=false lines from VAT-inclusive back to net amounts to avoid double-counting after the semantic change. Co-Authored-By: Claude dev-team-lead (Sonnet 4.6) <noreply@anthropic.com> Co-Authored-By: Claude backend-developer (Haiku 4.5) <noreply@anthropic.com> Co-Authored-By: Claude frontend-developer (Haiku 4.5) <noreply@anthropic.com>
Contributor
|
🎉 This PR is included in version 2.4.4 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Contributor
|
🎉 This PR is included in version 2.5.0-beta.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
maindirectly — this is an untracked fix for a data-correctness bug in VAT handlingplannedAmountis now always stored as the net amount (as entered). VAT is applied at display/calculation time via a neweffectivePlannedAmount()shared utility in@cornerstone/shared0031_fix_vat_storage_semantics.sql) converts existing unit-modeincludes_vat=falselines from VAT-inclusive back to net amounts to prevent double-counting after the semantic changeRoot Cause
In direct pricing mode with "price includes VAT" checked,
plannedAmountwas divided by the VAT multiplier before storage. In unit mode, VAT was baked into the stored amount at save time. This caused double-VAT on display after the stored value was used as a base for further calculation.Files Changed
server/src/db/migrations/0031_fix_vat_storage_semantics.sqlserver/src/services/budgetOverviewService.tsshared/src/types/budget.tseffectivePlannedAmount()utility type/functionshared/src/index.tsclient/src/lib/budgetConstants.tsclient/src/hooks/useBudgetSection.tseffectivePlannedAmount()at display timeclient/src/components/budget/BudgetLineCard.tsxclient/src/components/budget/BudgetSection.tsxclient/src/pages/WorkItemDetailPage/WorkItemDetailPage.tsxclient/src/pages/HouseholdItemDetailPage/HouseholdItemDetailPage.tsxPost-merge Action Required
After this PR merges to
main, the hotfix must be cherry-picked tobetato keep the integration branch in sync.Test Plan
maintarget)Co-Authored-By: Claude dev-team-lead (Sonnet 4.6) noreply@anthropic.com