@tailor-platform/erp-kit 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/README.md +18 -14
- package/dist/cli.mjs +477 -139
- package/package.json +1 -1
- package/skills/erp-kit-app-1-requirements/SKILL.md +33 -17
- package/skills/erp-kit-app-2-requirements-review/SKILL.md +12 -0
- package/skills/erp-kit-app-3-plan/SKILL.md +18 -4
- package/skills/erp-kit-app-3-plan/references/resolver-extraction.md +1 -1
- package/skills/erp-kit-app-3-plan/references/screen-extraction.md +1 -1
- package/skills/erp-kit-app-4-plan-review/SKILL.md +12 -0
- package/skills/erp-kit-app-5-impl-backend/SKILL.md +17 -5
- package/skills/erp-kit-app-5-impl-backend/references/app-config.md +1 -1
- package/skills/erp-kit-app-5-impl-backend/references/module-wiring.md +37 -12
- package/skills/erp-kit-app-6-impl-frontend/SKILL.md +15 -1
- package/skills/erp-kit-app-6-impl-frontend/references/component.md +90 -0
- package/skills/erp-kit-app-6-impl-frontend/references/detail-view.md +255 -0
- package/skills/erp-kit-app-6-impl-frontend/references/pages.md +1 -5
- package/skills/erp-kit-app-7-impl-review/SKILL.md +16 -3
- package/skills/erp-kit-app-7-impl-review/references/module-wiring-parity.md +14 -8
- package/skills/erp-kit-app-shared/references/progress-protocol.md +77 -0
- package/skills/erp-kit-mock-scenario/SKILL.md +1 -1
- package/skills/erp-kit-module-1-requirements/SKILL.md +1 -1
- package/skills/erp-kit-module-3-plan/SKILL.md +3 -3
- package/skills/erp-kit-module-3-update-plan/SKILL.md +3 -3
- package/skills/erp-kit-module-5-impl/SKILL.md +1 -1
- package/skills/erp-kit-module-6-impl-review/SKILL.md +16 -19
- package/skills/erp-kit-module-shared/references/commands.md +68 -1
- package/src/commands/app/index.ts +2 -0
- package/src/commands/app/progress/git-context.ts +16 -0
- package/src/commands/app/progress/index.ts +45 -0
- package/src/commands/app/progress/log.ts +49 -0
- package/src/commands/app/progress/progress.test.ts +128 -0
- package/src/commands/app/progress/schema-cmd.ts +10 -0
- package/src/commands/check.test.ts +4 -4
- package/src/commands/index.ts +8 -2
- package/src/commands/init.test.ts +24 -8
- package/src/commands/init.ts +5 -12
- package/src/commands/lib/discovery.test.ts +5 -7
- package/src/commands/lib/discovery.ts +8 -8
- package/src/commands/lib/distribute.test.ts +1 -20
- package/src/commands/lib/distribute.ts +0 -14
- package/src/commands/lib/sync-check-source.test.ts +1 -1
- package/src/commands/lib/sync-check-source.ts +6 -1
- package/src/commands/lib/sync-check-tests.test.ts +43 -0
- package/src/commands/lib/sync-check-tests.ts +20 -2
- package/src/commands/sync-check.ts +3 -0
- package/src/commands/update.test.ts +1 -1
- package/src/generator/generate-app-code.test.ts +0 -6
- package/src/generator/generate-app-code.ts +3 -13
- package/src/generator/generate-code.test.ts +10 -40
- package/src/generator/generate-code.ts +6 -12
- package/src/generator/scaffold.ts +25 -4
- package/src/generator/stub-templates.test.ts +0 -7
- package/src/generator/stub-templates.ts +0 -14
- package/src/module.ts +4 -1
- package/src/modules/accounting/README.md +63 -0
- package/src/modules/accounting/command/activateBudget.generated.ts +6 -0
- package/src/modules/accounting/command/activateBudget.test.ts +119 -0
- package/src/modules/accounting/command/activateBudget.ts +77 -0
- package/src/modules/accounting/command/activateCostElement.generated.ts +6 -0
- package/src/modules/accounting/command/activateCostElement.test.ts +59 -0
- package/src/modules/accounting/command/activateCostElement.ts +41 -0
- package/src/modules/accounting/command/activateProfitCenter.generated.ts +6 -0
- package/src/modules/accounting/command/activateProfitCenter.test.ts +60 -0
- package/src/modules/accounting/command/activateProfitCenter.ts +38 -0
- package/src/modules/accounting/command/approveBudget.generated.ts +6 -0
- package/src/modules/accounting/command/approveBudget.test.ts +69 -0
- package/src/modules/accounting/command/approveBudget.ts +47 -0
- package/src/modules/accounting/command/assignCostCenterToHierarchyNode.generated.ts +6 -0
- package/src/modules/accounting/command/assignCostCenterToHierarchyNode.test.ts +112 -0
- package/src/modules/accounting/command/assignCostCenterToHierarchyNode.ts +67 -0
- package/src/modules/accounting/command/assignProfitCenterToHierarchyNode.generated.ts +6 -0
- package/src/modules/accounting/command/assignProfitCenterToHierarchyNode.test.ts +123 -0
- package/src/modules/accounting/command/assignProfitCenterToHierarchyNode.ts +71 -0
- package/src/modules/accounting/command/closeBudget.generated.ts +6 -0
- package/src/modules/accounting/command/closeBudget.test.ts +93 -0
- package/src/modules/accounting/command/closeBudget.ts +40 -0
- package/src/modules/accounting/command/closeInternalOrder.generated.ts +6 -0
- package/src/modules/accounting/command/closeInternalOrder.test.ts +74 -0
- package/src/modules/accounting/command/closeInternalOrder.ts +38 -0
- package/src/modules/accounting/command/consumeCommitment.generated.ts +6 -0
- package/src/modules/accounting/command/consumeCommitment.test.ts +123 -0
- package/src/modules/accounting/command/consumeCommitment.ts +62 -0
- package/src/modules/accounting/command/createAllocationCycle.generated.ts +6 -0
- package/src/modules/accounting/command/createAllocationCycle.test.ts +166 -0
- package/src/modules/accounting/command/createAllocationCycle.ts +68 -0
- package/src/modules/accounting/command/createAllocationRule.generated.ts +6 -0
- package/src/modules/accounting/command/createAllocationRule.test.ts +195 -0
- package/src/modules/accounting/command/createAllocationRule.ts +103 -0
- package/src/modules/accounting/command/createBudget.generated.ts +6 -0
- package/src/modules/accounting/command/createBudget.test.ts +159 -0
- package/src/modules/accounting/command/createBudget.ts +100 -0
- package/src/modules/accounting/command/createBudgetLineItem.generated.ts +6 -0
- package/src/modules/accounting/command/createBudgetLineItem.test.ts +178 -0
- package/src/modules/accounting/command/createBudgetLineItem.ts +104 -0
- package/src/modules/accounting/command/createCostCenter.generated.ts +6 -0
- package/src/modules/accounting/command/createCostCenter.test.ts +179 -0
- package/src/modules/accounting/command/createCostCenter.ts +112 -0
- package/src/modules/accounting/command/createCostCenterHierarchy.generated.ts +6 -0
- package/src/modules/accounting/command/createCostCenterHierarchy.test.ts +91 -0
- package/src/modules/accounting/command/createCostCenterHierarchy.ts +48 -0
- package/src/modules/accounting/command/createCostCenterHierarchyNode.generated.ts +6 -0
- package/src/modules/accounting/command/createCostCenterHierarchyNode.test.ts +171 -0
- package/src/modules/accounting/command/createCostCenterHierarchyNode.ts +117 -0
- package/src/modules/accounting/command/createCostElement.generated.ts +6 -0
- package/src/modules/accounting/command/createCostElement.test.ts +317 -0
- package/src/modules/accounting/command/createCostElement.ts +149 -0
- package/src/modules/accounting/command/createInternalOrder.generated.ts +6 -0
- package/src/modules/accounting/command/createInternalOrder.test.ts +206 -0
- package/src/modules/accounting/command/createInternalOrder.ts +104 -0
- package/src/modules/accounting/command/createPlanVersion.generated.ts +6 -0
- package/src/modules/accounting/command/createPlanVersion.test.ts +230 -0
- package/src/modules/accounting/command/createPlanVersion.ts +71 -0
- package/src/modules/accounting/command/createProfitCenter.generated.ts +6 -0
- package/src/modules/accounting/command/createProfitCenter.test.ts +227 -0
- package/src/modules/accounting/command/createProfitCenter.ts +81 -0
- package/src/modules/accounting/command/createProfitCenterHierarchy.generated.ts +6 -0
- package/src/modules/accounting/command/createProfitCenterHierarchy.test.ts +91 -0
- package/src/modules/accounting/command/createProfitCenterHierarchy.ts +46 -0
- package/src/modules/accounting/command/createProfitCenterHierarchyNode.generated.ts +6 -0
- package/src/modules/accounting/command/createProfitCenterHierarchyNode.test.ts +160 -0
- package/src/modules/accounting/command/createProfitCenterHierarchyNode.ts +109 -0
- package/src/modules/accounting/command/deactivateCostElement.generated.ts +6 -0
- package/src/modules/accounting/command/deactivateCostElement.test.ts +59 -0
- package/src/modules/accounting/command/deactivateCostElement.ts +41 -0
- package/src/modules/accounting/command/deactivateProfitCenter.generated.ts +6 -0
- package/src/modules/accounting/command/deactivateProfitCenter.test.ts +60 -0
- package/src/modules/accounting/command/deactivateProfitCenter.ts +42 -0
- package/src/modules/accounting/command/deleteAllocationCycle.generated.ts +6 -0
- package/src/modules/accounting/command/deleteAllocationCycle.test.ts +90 -0
- package/src/modules/accounting/command/deleteAllocationCycle.ts +39 -0
- package/src/modules/accounting/command/deleteAllocationRule.generated.ts +6 -0
- package/src/modules/accounting/command/deleteAllocationRule.test.ts +98 -0
- package/src/modules/accounting/command/deleteAllocationRule.ts +40 -0
- package/src/modules/accounting/command/deleteBudget.generated.ts +6 -0
- package/src/modules/accounting/command/deleteBudget.test.ts +90 -0
- package/src/modules/accounting/command/deleteBudget.ts +35 -0
- package/src/modules/accounting/command/deleteBudgetLineItem.generated.ts +6 -0
- package/src/modules/accounting/command/deleteBudgetLineItem.test.ts +85 -0
- package/src/modules/accounting/command/deleteBudgetLineItem.ts +50 -0
- package/src/modules/accounting/command/deleteCostCenter.generated.ts +6 -0
- package/src/modules/accounting/command/deleteCostCenter.test.ts +79 -0
- package/src/modules/accounting/command/deleteCostCenter.ts +67 -0
- package/src/modules/accounting/command/deleteCostCenterHierarchyNode.generated.ts +6 -0
- package/src/modules/accounting/command/deleteCostCenterHierarchyNode.test.ts +59 -0
- package/src/modules/accounting/command/deleteCostCenterHierarchyNode.ts +58 -0
- package/src/modules/accounting/command/deleteCostElement.generated.ts +6 -0
- package/src/modules/accounting/command/deleteCostElement.test.ts +58 -0
- package/src/modules/accounting/command/deleteCostElement.ts +33 -0
- package/src/modules/accounting/command/deleteInternalOrder.generated.ts +6 -0
- package/src/modules/accounting/command/deleteInternalOrder.test.ts +81 -0
- package/src/modules/accounting/command/deleteInternalOrder.ts +37 -0
- package/src/modules/accounting/command/deleteProfitCenter.generated.ts +6 -0
- package/src/modules/accounting/command/deleteProfitCenter.test.ts +68 -0
- package/src/modules/accounting/command/deleteProfitCenter.ts +39 -0
- package/src/modules/accounting/command/deleteProfitCenterHierarchyNode.generated.ts +6 -0
- package/src/modules/accounting/command/deleteProfitCenterHierarchyNode.test.ts +72 -0
- package/src/modules/accounting/command/deleteProfitCenterHierarchyNode.ts +61 -0
- package/src/modules/accounting/command/executeAllocationCycle.generated.ts +6 -0
- package/src/modules/accounting/command/executeAllocationCycle.test.ts +167 -0
- package/src/modules/accounting/command/executeAllocationCycle.ts +94 -0
- package/src/modules/accounting/command/finalizeVarianceReport.generated.ts +6 -0
- package/src/modules/accounting/command/finalizeVarianceReport.test.ts +60 -0
- package/src/modules/accounting/command/finalizeVarianceReport.ts +45 -0
- package/src/modules/accounting/command/generateVarianceReport.generated.ts +6 -0
- package/src/modules/accounting/command/generateVarianceReport.test.ts +386 -0
- package/src/modules/accounting/command/generateVarianceReport.ts +219 -0
- package/src/modules/accounting/command/invalidateAllocationCycle.generated.ts +6 -0
- package/src/modules/accounting/command/invalidateAllocationCycle.test.ts +84 -0
- package/src/modules/accounting/command/invalidateAllocationCycle.ts +45 -0
- package/src/modules/accounting/command/moveCostCenterHierarchyNode.generated.ts +6 -0
- package/src/modules/accounting/command/moveCostCenterHierarchyNode.test.ts +135 -0
- package/src/modules/accounting/command/moveCostCenterHierarchyNode.ts +81 -0
- package/src/modules/accounting/command/postAllocationCycle.generated.ts +6 -0
- package/src/modules/accounting/command/postAllocationCycle.test.ts +98 -0
- package/src/modules/accounting/command/postAllocationCycle.ts +65 -0
- package/src/modules/accounting/command/reactivateCostElement.generated.ts +6 -0
- package/src/modules/accounting/command/reactivateCostElement.test.ts +59 -0
- package/src/modules/accounting/command/reactivateCostElement.ts +41 -0
- package/src/modules/accounting/command/reactivateProfitCenter.generated.ts +6 -0
- package/src/modules/accounting/command/reactivateProfitCenter.test.ts +60 -0
- package/src/modules/accounting/command/reactivateProfitCenter.ts +42 -0
- package/src/modules/accounting/command/recordCommitment.generated.ts +6 -0
- package/src/modules/accounting/command/recordCommitment.test.ts +157 -0
- package/src/modules/accounting/command/recordCommitment.ts +113 -0
- package/src/modules/accounting/command/rejectBudget.generated.ts +6 -0
- package/src/modules/accounting/command/rejectBudget.test.ts +105 -0
- package/src/modules/accounting/command/rejectBudget.ts +51 -0
- package/src/modules/accounting/command/releaseCommitment.generated.ts +6 -0
- package/src/modules/accounting/command/releaseCommitment.test.ts +94 -0
- package/src/modules/accounting/command/releaseCommitment.ts +51 -0
- package/src/modules/accounting/command/releaseInternalOrder.generated.ts +6 -0
- package/src/modules/accounting/command/releaseInternalOrder.test.ts +74 -0
- package/src/modules/accounting/command/releaseInternalOrder.ts +38 -0
- package/src/modules/accounting/command/reverseAllocationCycle.generated.ts +6 -0
- package/src/modules/accounting/command/reverseAllocationCycle.test.ts +124 -0
- package/src/modules/accounting/command/reverseAllocationCycle.ts +63 -0
- package/src/modules/accounting/command/submitBudget.generated.ts +6 -0
- package/src/modules/accounting/command/submitBudget.test.ts +60 -0
- package/src/modules/accounting/command/submitBudget.ts +51 -0
- package/src/modules/accounting/command/technicallyCompleteInternalOrder.generated.ts +6 -0
- package/src/modules/accounting/command/technicallyCompleteInternalOrder.test.ts +74 -0
- package/src/modules/accounting/command/technicallyCompleteInternalOrder.ts +42 -0
- package/src/modules/accounting/command/updateAllocationCycle.generated.ts +6 -0
- package/src/modules/accounting/command/updateAllocationCycle.test.ts +112 -0
- package/src/modules/accounting/command/updateAllocationCycle.ts +41 -0
- package/src/modules/accounting/command/updateBudget.generated.ts +6 -0
- package/src/modules/accounting/command/updateBudget.test.ts +112 -0
- package/src/modules/accounting/command/updateBudget.ts +44 -0
- package/src/modules/accounting/command/updateCostCenter.generated.ts +6 -0
- package/src/modules/accounting/command/updateCostCenter.test.ts +105 -0
- package/src/modules/accounting/command/updateCostCenter.ts +79 -0
- package/src/modules/accounting/command/updateCostElement.generated.ts +6 -0
- package/src/modules/accounting/command/updateCostElement.test.ts +265 -0
- package/src/modules/accounting/command/updateCostElement.ts +158 -0
- package/src/modules/accounting/command/updateInternalOrder.generated.ts +6 -0
- package/src/modules/accounting/command/updateInternalOrder.test.ts +209 -0
- package/src/modules/accounting/command/updateInternalOrder.ts +88 -0
- package/src/modules/accounting/command/updateProfitCenter.generated.ts +6 -0
- package/src/modules/accounting/command/updateProfitCenter.test.ts +162 -0
- package/src/modules/accounting/command/updateProfitCenter.ts +73 -0
- package/src/modules/accounting/command/validateAllocationCycle.generated.ts +6 -0
- package/src/modules/accounting/command/validateAllocationCycle.test.ts +141 -0
- package/src/modules/accounting/command/validateAllocationCycle.ts +80 -0
- package/src/modules/accounting/db/allocationCycle.ts +59 -0
- package/src/modules/accounting/db/allocationResult.ts +58 -0
- package/src/modules/accounting/db/allocationRule.ts +48 -0
- package/src/modules/accounting/db/budget.ts +84 -0
- package/src/modules/accounting/db/budgetLineItem.ts +64 -0
- package/src/modules/accounting/db/commitment.ts +60 -0
- package/src/modules/accounting/db/costCenter.ts +73 -0
- package/src/modules/accounting/db/costCenterHierarchy.ts +37 -0
- package/src/modules/accounting/db/costCenterHierarchyNode.ts +48 -0
- package/src/modules/accounting/db/costElement.ts +56 -0
- package/src/modules/accounting/db/internalOrder.ts +69 -0
- package/src/modules/accounting/db/planVersion.ts +47 -0
- package/src/modules/accounting/db/profitCenter.ts +52 -0
- package/src/modules/accounting/db/profitCenterHierarchy.ts +36 -0
- package/src/modules/accounting/db/profitCenterHierarchyAssignment.ts +62 -0
- package/src/modules/accounting/db/profitCenterHierarchyNode.ts +48 -0
- package/src/modules/accounting/db/varianceReport.ts +54 -0
- package/src/modules/accounting/db/varianceReportLine.ts +62 -0
- package/src/modules/accounting/docs/commands/ActivateBudget.md +54 -0
- package/src/modules/accounting/docs/commands/ActivateCostElement.md +43 -0
- package/src/modules/accounting/docs/commands/ActivateProfitCenter.md +43 -0
- package/src/modules/accounting/docs/commands/ApproveBudget.md +46 -0
- package/src/modules/accounting/docs/commands/AssignCostCenterToHierarchyNode.md +46 -0
- package/src/modules/accounting/docs/commands/AssignProfitCenterToHierarchyNode.md +47 -0
- package/src/modules/accounting/docs/commands/CloseBudget.md +47 -0
- package/src/modules/accounting/docs/commands/CloseInternalOrder.md +45 -0
- package/src/modules/accounting/docs/commands/ConsumeCommitment.md +53 -0
- package/src/modules/accounting/docs/commands/CreateAllocationCycle.md +55 -0
- package/src/modules/accounting/docs/commands/CreateAllocationRule.md +60 -0
- package/src/modules/accounting/docs/commands/CreateBudget.md +65 -0
- package/src/modules/accounting/docs/commands/CreateBudgetLineItem.md +66 -0
- package/src/modules/accounting/docs/commands/CreateCostCenter.md +64 -0
- package/src/modules/accounting/docs/commands/CreateCostCenterHierarchy.md +45 -0
- package/src/modules/accounting/docs/commands/CreateCostCenterHierarchyNode.md +61 -0
- package/src/modules/accounting/docs/commands/CreateCostElement.md +91 -0
- package/src/modules/accounting/docs/commands/CreateInternalOrder.md +72 -0
- package/src/modules/accounting/docs/commands/CreatePlanVersion.md +59 -0
- package/src/modules/accounting/docs/commands/CreateProfitCenter.md +63 -0
- package/src/modules/accounting/docs/commands/CreateProfitCenterHierarchy.md +45 -0
- package/src/modules/accounting/docs/commands/CreateProfitCenterHierarchyNode.md +60 -0
- package/src/modules/accounting/docs/commands/DeactivateCostElement.md +43 -0
- package/src/modules/accounting/docs/commands/DeactivateProfitCenter.md +44 -0
- package/src/modules/accounting/docs/commands/DeleteAllocationCycle.md +46 -0
- package/src/modules/accounting/docs/commands/DeleteAllocationRule.md +45 -0
- package/src/modules/accounting/docs/commands/DeleteBudget.md +46 -0
- package/src/modules/accounting/docs/commands/DeleteBudgetLineItem.md +45 -0
- package/src/modules/accounting/docs/commands/DeleteCostCenter.md +50 -0
- package/src/modules/accounting/docs/commands/DeleteCostCenterHierarchyNode.md +45 -0
- package/src/modules/accounting/docs/commands/DeleteCostElement.md +43 -0
- package/src/modules/accounting/docs/commands/DeleteInternalOrder.md +45 -0
- package/src/modules/accounting/docs/commands/DeleteProfitCenter.md +46 -0
- package/src/modules/accounting/docs/commands/DeleteProfitCenterHierarchyNode.md +46 -0
- package/src/modules/accounting/docs/commands/ExecuteAllocationCycle.md +54 -0
- package/src/modules/accounting/docs/commands/FinalizeVarianceReport.md +44 -0
- package/src/modules/accounting/docs/commands/GenerateVarianceReport.md +83 -0
- package/src/modules/accounting/docs/commands/InvalidateAllocationCycle.md +45 -0
- package/src/modules/accounting/docs/commands/MoveCostCenterHierarchyNode.md +51 -0
- package/src/modules/accounting/docs/commands/PostAllocationCycle.md +58 -0
- package/src/modules/accounting/docs/commands/ReactivateCostElement.md +43 -0
- package/src/modules/accounting/docs/commands/ReactivateProfitCenter.md +43 -0
- package/src/modules/accounting/docs/commands/RecordCommitment.md +60 -0
- package/src/modules/accounting/docs/commands/RejectBudget.md +49 -0
- package/src/modules/accounting/docs/commands/ReleaseCommitment.md +45 -0
- package/src/modules/accounting/docs/commands/ReleaseInternalOrder.md +44 -0
- package/src/modules/accounting/docs/commands/ReverseAllocationCycle.md +55 -0
- package/src/modules/accounting/docs/commands/SubmitBudget.md +47 -0
- package/src/modules/accounting/docs/commands/TechnicallyCompleteInternalOrder.md +44 -0
- package/src/modules/accounting/docs/commands/UpdateAllocationCycle.md +45 -0
- package/src/modules/accounting/docs/commands/UpdateBudget.md +47 -0
- package/src/modules/accounting/docs/commands/UpdateCostCenter.md +50 -0
- package/src/modules/accounting/docs/commands/UpdateCostElement.md +82 -0
- package/src/modules/accounting/docs/commands/UpdateInternalOrder.md +62 -0
- package/src/modules/accounting/docs/commands/UpdateProfitCenter.md +56 -0
- package/src/modules/accounting/docs/commands/ValidateAllocationCycle.md +57 -0
- package/src/modules/accounting/docs/features/budget-management.md +147 -0
- package/src/modules/accounting/docs/features/cost-allocation.md +129 -0
- package/src/modules/accounting/docs/features/cost-center-management.md +118 -0
- package/src/modules/accounting/docs/features/cost-element-management.md +114 -0
- package/src/modules/accounting/docs/features/internal-order-management.md +111 -0
- package/src/modules/accounting/docs/features/profit-center-management.md +120 -0
- package/src/modules/accounting/docs/features/variance-analysis.md +130 -0
- package/src/modules/accounting/docs/models/AllocationCycle.md +81 -0
- package/src/modules/accounting/docs/models/AllocationResult.md +37 -0
- package/src/modules/accounting/docs/models/AllocationRule.md +41 -0
- package/src/modules/accounting/docs/models/Budget.md +77 -0
- package/src/modules/accounting/docs/models/BudgetLineItem.md +40 -0
- package/src/modules/accounting/docs/models/Commitment.md +45 -0
- package/src/modules/accounting/docs/models/CostCenter.md +51 -0
- package/src/modules/accounting/docs/models/CostCenterHierarchy.md +38 -0
- package/src/modules/accounting/docs/models/CostCenterHierarchyNode.md +41 -0
- package/src/modules/accounting/docs/models/CostElement.md +66 -0
- package/src/modules/accounting/docs/models/InternalOrder.md +67 -0
- package/src/modules/accounting/docs/models/PlanVersion.md +36 -0
- package/src/modules/accounting/docs/models/ProfitCenter.md +66 -0
- package/src/modules/accounting/docs/models/ProfitCenterHierarchy.md +36 -0
- package/src/modules/accounting/docs/models/ProfitCenterHierarchyAssignment.md +36 -0
- package/src/modules/accounting/docs/models/ProfitCenterHierarchyNode.md +39 -0
- package/src/modules/accounting/docs/models/VarianceReport.md +58 -0
- package/src/modules/accounting/docs/models/VarianceReportLine.md +43 -0
- package/src/modules/accounting/docs/queries/CalculateBudgetAvailability.md +64 -0
- package/src/modules/accounting/docs/queries/GetAllocationCycle.md +43 -0
- package/src/modules/accounting/docs/queries/GetBudget.md +42 -0
- package/src/modules/accounting/docs/queries/GetCostCenter.md +38 -0
- package/src/modules/accounting/docs/queries/GetCostCenterHierarchy.md +45 -0
- package/src/modules/accounting/docs/queries/GetCostElement.md +39 -0
- package/src/modules/accounting/docs/queries/GetInternalOrder.md +42 -0
- package/src/modules/accounting/docs/queries/GetProfitCenter.md +38 -0
- package/src/modules/accounting/docs/queries/GetProfitCenterHierarchy.md +46 -0
- package/src/modules/accounting/docs/queries/GetVarianceReport.md +45 -0
- package/src/modules/accounting/docs/queries/ListAllocationCycles.md +63 -0
- package/src/modules/accounting/docs/queries/ListBudgets.md +70 -0
- package/src/modules/accounting/docs/queries/ListCostCenters.md +55 -0
- package/src/modules/accounting/docs/queries/ListCostElements.md +63 -0
- package/src/modules/accounting/docs/queries/ListInternalOrders.md +62 -0
- package/src/modules/accounting/docs/queries/ListProfitCenters.md +49 -0
- package/src/modules/accounting/generated/enums.ts +110 -0
- package/src/modules/accounting/generated/kysely-tailordb.ts +302 -0
- package/src/modules/accounting/index.ts +2 -0
- package/src/modules/accounting/lib/_db_deps.ts +70 -0
- package/src/modules/accounting/lib/actualAmounts.ts +93 -0
- package/src/modules/accounting/lib/allocationPosting.ts +152 -0
- package/src/modules/accounting/lib/errors.generated.ts +432 -0
- package/src/modules/accounting/lib/permissions.generated.ts +61 -0
- package/src/modules/accounting/lib/types.ts +114 -0
- package/src/modules/accounting/module.ts +428 -0
- package/src/modules/accounting/permissions.ts +3 -0
- package/src/modules/accounting/query/calculateBudgetAvailability.generated.ts +5 -0
- package/src/modules/accounting/query/calculateBudgetAvailability.test.ts +229 -0
- package/src/modules/accounting/query/calculateBudgetAvailability.ts +147 -0
- package/src/modules/accounting/query/getAllocationCycle.generated.ts +5 -0
- package/src/modules/accounting/query/getAllocationCycle.test.ts +94 -0
- package/src/modules/accounting/query/getAllocationCycle.ts +37 -0
- package/src/modules/accounting/query/getBudget.generated.ts +5 -0
- package/src/modules/accounting/query/getBudget.test.ts +80 -0
- package/src/modules/accounting/query/getBudget.ts +31 -0
- package/src/modules/accounting/query/getCostCenter.generated.ts +5 -0
- package/src/modules/accounting/query/getCostCenter.test.ts +50 -0
- package/src/modules/accounting/query/getCostCenter.ts +33 -0
- package/src/modules/accounting/query/getCostCenterHierarchy.generated.ts +5 -0
- package/src/modules/accounting/query/getCostCenterHierarchy.test.ts +100 -0
- package/src/modules/accounting/query/getCostCenterHierarchy.ts +80 -0
- package/src/modules/accounting/query/getCostElement.generated.ts +5 -0
- package/src/modules/accounting/query/getCostElement.test.ts +57 -0
- package/src/modules/accounting/query/getCostElement.ts +21 -0
- package/src/modules/accounting/query/getInternalOrder.generated.ts +5 -0
- package/src/modules/accounting/query/getInternalOrder.test.ts +73 -0
- package/src/modules/accounting/query/getInternalOrder.ts +21 -0
- package/src/modules/accounting/query/getProfitCenter.generated.ts +5 -0
- package/src/modules/accounting/query/getProfitCenter.test.ts +65 -0
- package/src/modules/accounting/query/getProfitCenter.ts +31 -0
- package/src/modules/accounting/query/getProfitCenterHierarchy.generated.ts +5 -0
- package/src/modules/accounting/query/getProfitCenterHierarchy.test.ts +97 -0
- package/src/modules/accounting/query/getProfitCenterHierarchy.ts +87 -0
- package/src/modules/accounting/query/getVarianceReport.generated.ts +5 -0
- package/src/modules/accounting/query/getVarianceReport.test.ts +108 -0
- package/src/modules/accounting/query/getVarianceReport.ts +31 -0
- package/src/modules/accounting/query/listAllocationCycles.generated.ts +5 -0
- package/src/modules/accounting/query/listAllocationCycles.test.ts +152 -0
- package/src/modules/accounting/query/listAllocationCycles.ts +96 -0
- package/src/modules/accounting/query/listBudgets.generated.ts +5 -0
- package/src/modules/accounting/query/listBudgets.test.ts +150 -0
- package/src/modules/accounting/query/listBudgets.ts +85 -0
- package/src/modules/accounting/query/listCostCenters.generated.ts +5 -0
- package/src/modules/accounting/query/listCostCenters.test.ts +111 -0
- package/src/modules/accounting/query/listCostCenters.ts +71 -0
- package/src/modules/accounting/query/listCostElements.generated.ts +5 -0
- package/src/modules/accounting/query/listCostElements.test.ts +138 -0
- package/src/modules/accounting/query/listCostElements.ts +105 -0
- package/src/modules/accounting/query/listInternalOrders.generated.ts +5 -0
- package/src/modules/accounting/query/listInternalOrders.test.ts +129 -0
- package/src/modules/accounting/query/listInternalOrders.ts +94 -0
- package/src/modules/accounting/query/listProfitCenters.generated.ts +5 -0
- package/src/modules/accounting/query/listProfitCenters.test.ts +94 -0
- package/src/modules/accounting/query/listProfitCenters.ts +56 -0
- package/src/modules/accounting/seed/index.ts +19 -0
- package/src/modules/accounting/tailor.config.ts +13 -0
- package/src/modules/accounting/testing/commandTestUtils.ts +35 -0
- package/src/modules/accounting/testing/fixtures.ts +502 -0
- package/src/modules/audit/command/logAuditEvent.ts +43 -38
- package/src/modules/audit/command/updateAuditPolicy.ts +2 -2
- package/src/modules/audit/docs/commands/UpdateAuditPolicy.md +1 -1
- package/src/modules/audit/module.ts +4 -0
- package/src/modules/business-partner/command/updateContactPerson.ts +3 -4
- package/src/modules/business-partner/command/updatePartner.ts +13 -6
- package/src/modules/business-partner/command/updatePartnerAddress.ts +13 -6
- package/src/modules/business-partner/command/updatePartnerBankAccount.ts +3 -4
- package/src/modules/business-partner/command/updatePartnerIdentification.ts +3 -4
- package/src/modules/business-partner/docs/commands/UpdateContactPerson.md +3 -3
- package/src/modules/business-partner/docs/commands/UpdatePartner.md +2 -2
- package/src/modules/business-partner/docs/commands/UpdatePartnerAddress.md +2 -2
- package/src/modules/business-partner/docs/commands/UpdatePartnerIdentification.md +2 -2
- package/src/modules/coa-management/command/updateAccount.ts +3 -3
- package/src/modules/coa-management/command/updateAccountGroup.test.ts +22 -0
- package/src/modules/coa-management/command/updateAccountGroup.ts +30 -18
- package/src/modules/coa-management/command/updateChartOfAccounts.ts +3 -4
- package/src/modules/coa-management/docs/commands/UpdateAccountGroup.md +4 -3
- package/src/modules/finance-ledger/README.md +50 -0
- package/src/modules/finance-ledger/command/addJournalLine.generated.ts +6 -0
- package/src/modules/finance-ledger/command/addJournalLine.test.ts +438 -0
- package/src/modules/finance-ledger/command/addJournalLine.ts +122 -0
- package/src/modules/finance-ledger/command/approveAndLockPeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/approveAndLockPeriod.test.ts +107 -0
- package/src/modules/finance-ledger/command/approveAndLockPeriod.ts +72 -0
- package/src/modules/finance-ledger/command/beginClose.generated.ts +6 -0
- package/src/modules/finance-ledger/command/beginClose.test.ts +106 -0
- package/src/modules/finance-ledger/command/beginClose.ts +58 -0
- package/src/modules/finance-ledger/command/closePeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/closePeriod.test.ts +87 -0
- package/src/modules/finance-ledger/command/closePeriod.ts +44 -0
- package/src/modules/finance-ledger/command/createAccountingPeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/createAccountingPeriod.test.ts +425 -0
- package/src/modules/finance-ledger/command/createAccountingPeriod.ts +133 -0
- package/src/modules/finance-ledger/command/createFiscalYear.generated.ts +6 -0
- package/src/modules/finance-ledger/command/createFiscalYear.test.ts +197 -0
- package/src/modules/finance-ledger/command/createFiscalYear.ts +70 -0
- package/src/modules/finance-ledger/command/createJournalEntry.generated.ts +6 -0
- package/src/modules/finance-ledger/command/createJournalEntry.test.ts +261 -0
- package/src/modules/finance-ledger/command/createJournalEntry.ts +121 -0
- package/src/modules/finance-ledger/command/deleteAccountingPeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/deleteAccountingPeriod.test.ts +71 -0
- package/src/modules/finance-ledger/command/deleteAccountingPeriod.ts +55 -0
- package/src/modules/finance-ledger/command/deleteFiscalYear.generated.ts +6 -0
- package/src/modules/finance-ledger/command/deleteFiscalYear.test.ts +38 -0
- package/src/modules/finance-ledger/command/deleteFiscalYear.ts +34 -0
- package/src/modules/finance-ledger/command/deleteJournalEntry.generated.ts +6 -0
- package/src/modules/finance-ledger/command/deleteJournalEntry.test.ts +58 -0
- package/src/modules/finance-ledger/command/deleteJournalEntry.ts +43 -0
- package/src/modules/finance-ledger/command/executeYearEndClose.generated.ts +6 -0
- package/src/modules/finance-ledger/command/executeYearEndClose.test.ts +239 -0
- package/src/modules/finance-ledger/command/executeYearEndClose.ts +415 -0
- package/src/modules/finance-ledger/command/finalCloseAndLockPeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/finalCloseAndLockPeriod.test.ts +102 -0
- package/src/modules/finance-ledger/command/finalCloseAndLockPeriod.ts +76 -0
- package/src/modules/finance-ledger/command/finalizeFinancialStatement.generated.ts +6 -0
- package/src/modules/finance-ledger/command/finalizeFinancialStatement.test.ts +73 -0
- package/src/modules/finance-ledger/command/finalizeFinancialStatement.ts +73 -0
- package/src/modules/finance-ledger/command/generateFinancialStatement.generated.ts +6 -0
- package/src/modules/finance-ledger/command/generateFinancialStatement.test.ts +311 -0
- package/src/modules/finance-ledger/command/generateFinancialStatement.ts +275 -0
- package/src/modules/finance-ledger/command/generatePreliminaryStatements.generated.ts +6 -0
- package/src/modules/finance-ledger/command/generatePreliminaryStatements.test.ts +152 -0
- package/src/modules/finance-ledger/command/generatePreliminaryStatements.ts +140 -0
- package/src/modules/finance-ledger/command/generateTrialBalance.generated.ts +6 -0
- package/src/modules/finance-ledger/command/generateTrialBalance.test.ts +439 -0
- package/src/modules/finance-ledger/command/generateTrialBalance.ts +268 -0
- package/src/modules/finance-ledger/command/initiatePeriodClose.generated.ts +6 -0
- package/src/modules/finance-ledger/command/initiatePeriodClose.test.ts +153 -0
- package/src/modules/finance-ledger/command/initiatePeriodClose.ts +84 -0
- package/src/modules/finance-ledger/command/openForAdvanceEntry.generated.ts +6 -0
- package/src/modules/finance-ledger/command/openForAdvanceEntry.test.ts +87 -0
- package/src/modules/finance-ledger/command/openForAdvanceEntry.ts +44 -0
- package/src/modules/finance-ledger/command/openPeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/openPeriod.test.ts +90 -0
- package/src/modules/finance-ledger/command/openPeriod.ts +44 -0
- package/src/modules/finance-ledger/command/permanentlyClosePeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/permanentlyClosePeriod.test.ts +87 -0
- package/src/modules/finance-ledger/command/permanentlyClosePeriod.ts +48 -0
- package/src/modules/finance-ledger/command/postAdjustingEntries.generated.ts +6 -0
- package/src/modules/finance-ledger/command/postAdjustingEntries.test.ts +392 -0
- package/src/modules/finance-ledger/command/postAdjustingEntries.ts +156 -0
- package/src/modules/finance-ledger/command/postJournalEntry.generated.ts +6 -0
- package/src/modules/finance-ledger/command/postJournalEntry.test.ts +346 -0
- package/src/modules/finance-ledger/command/postJournalEntry.ts +160 -0
- package/src/modules/finance-ledger/command/processInventoryHandoff.generated.ts +6 -0
- package/src/modules/finance-ledger/command/processInventoryHandoff.test.ts +211 -0
- package/src/modules/finance-ledger/command/processInventoryHandoff.ts +133 -0
- package/src/modules/finance-ledger/command/processManufacturingHandoff.generated.ts +6 -0
- package/src/modules/finance-ledger/command/processManufacturingHandoff.test.ts +221 -0
- package/src/modules/finance-ledger/command/processManufacturingHandoff.ts +133 -0
- package/src/modules/finance-ledger/command/processPurchaseHandoff.generated.ts +6 -0
- package/src/modules/finance-ledger/command/processPurchaseHandoff.test.ts +222 -0
- package/src/modules/finance-ledger/command/processPurchaseHandoff.ts +133 -0
- package/src/modules/finance-ledger/command/processSalesHandoff.generated.ts +6 -0
- package/src/modules/finance-ledger/command/processSalesHandoff.test.ts +257 -0
- package/src/modules/finance-ledger/command/processSalesHandoff.ts +135 -0
- package/src/modules/finance-ledger/command/regenerateFinancialStatement.generated.ts +6 -0
- package/src/modules/finance-ledger/command/regenerateFinancialStatement.test.ts +129 -0
- package/src/modules/finance-ledger/command/regenerateFinancialStatement.ts +186 -0
- package/src/modules/finance-ledger/command/removeJournalLine.generated.ts +6 -0
- package/src/modules/finance-ledger/command/removeJournalLine.test.ts +65 -0
- package/src/modules/finance-ledger/command/removeJournalLine.ts +39 -0
- package/src/modules/finance-ledger/command/reopenPeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/reopenPeriod.test.ts +87 -0
- package/src/modules/finance-ledger/command/reopenPeriod.ts +44 -0
- package/src/modules/finance-ledger/command/reverseJournalEntry.generated.ts +6 -0
- package/src/modules/finance-ledger/command/reverseJournalEntry.test.ts +337 -0
- package/src/modules/finance-ledger/command/reverseJournalEntry.ts +140 -0
- package/src/modules/finance-ledger/command/revertSoftLock.generated.ts +6 -0
- package/src/modules/finance-ledger/command/revertSoftLock.test.ts +96 -0
- package/src/modules/finance-ledger/command/revertSoftLock.ts +67 -0
- package/src/modules/finance-ledger/command/updateFiscalYear.generated.ts +6 -0
- package/src/modules/finance-ledger/command/updateFiscalYear.test.ts +138 -0
- package/src/modules/finance-ledger/command/updateFiscalYear.ts +84 -0
- package/src/modules/finance-ledger/command/updateJournalEntry.generated.ts +6 -0
- package/src/modules/finance-ledger/command/updateJournalEntry.test.ts +178 -0
- package/src/modules/finance-ledger/command/updateJournalEntry.ts +78 -0
- package/src/modules/finance-ledger/command/updateJournalLine.generated.ts +6 -0
- package/src/modules/finance-ledger/command/updateJournalLine.test.ts +385 -0
- package/src/modules/finance-ledger/command/updateJournalLine.ts +154 -0
- package/src/modules/finance-ledger/command/verifySubledgerTransfers.generated.ts +6 -0
- package/src/modules/finance-ledger/command/verifySubledgerTransfers.test.ts +201 -0
- package/src/modules/finance-ledger/command/verifySubledgerTransfers.ts +113 -0
- package/src/modules/finance-ledger/command/verifyTrialBalance.generated.ts +6 -0
- package/src/modules/finance-ledger/command/verifyTrialBalance.test.ts +136 -0
- package/src/modules/finance-ledger/command/verifyTrialBalance.ts +97 -0
- package/src/modules/finance-ledger/db/accountingPeriod.ts +58 -0
- package/src/modules/finance-ledger/db/financialStatement.ts +92 -0
- package/src/modules/finance-ledger/db/financialStatementLineItem.ts +76 -0
- package/src/modules/finance-ledger/db/fiscalYear.ts +41 -0
- package/src/modules/finance-ledger/db/journalEntry.ts +101 -0
- package/src/modules/finance-ledger/db/journalLine.ts +64 -0
- package/src/modules/finance-ledger/db/periodClose.ts +97 -0
- package/src/modules/finance-ledger/db/trialBalance.ts +63 -0
- package/src/modules/finance-ledger/db/trialBalanceLine.ts +63 -0
- package/src/modules/finance-ledger/docs/commands/AddJournalLine.md +74 -0
- package/src/modules/finance-ledger/docs/commands/ApproveAndLockPeriod.md +53 -0
- package/src/modules/finance-ledger/docs/commands/BeginClose.md +47 -0
- package/src/modules/finance-ledger/docs/commands/ClosePeriod.md +45 -0
- package/src/modules/finance-ledger/docs/commands/CreateAccountingPeriod.md +69 -0
- package/src/modules/finance-ledger/docs/commands/CreateFiscalYear.md +56 -0
- package/src/modules/finance-ledger/docs/commands/CreateJournalEntry.md +63 -0
- package/src/modules/finance-ledger/docs/commands/DeleteAccountingPeriod.md +46 -0
- package/src/modules/finance-ledger/docs/commands/DeleteFiscalYear.md +40 -0
- package/src/modules/finance-ledger/docs/commands/DeleteJournalEntry.md +44 -0
- package/src/modules/finance-ledger/docs/commands/ExecuteYearEndClose.md +81 -0
- package/src/modules/finance-ledger/docs/commands/FinalCloseAndLockPeriod.md +49 -0
- package/src/modules/finance-ledger/docs/commands/FinalizeFinancialStatement.md +43 -0
- package/src/modules/finance-ledger/docs/commands/GenerateFinancialStatement.md +86 -0
- package/src/modules/finance-ledger/docs/commands/GeneratePreliminaryStatements.md +53 -0
- package/src/modules/finance-ledger/docs/commands/GenerateTrialBalance.md +75 -0
- package/src/modules/finance-ledger/docs/commands/InitiatePeriodClose.md +58 -0
- package/src/modules/finance-ledger/docs/commands/OpenForAdvanceEntry.md +44 -0
- package/src/modules/finance-ledger/docs/commands/OpenPeriod.md +45 -0
- package/src/modules/finance-ledger/docs/commands/PermanentlyClosePeriod.md +45 -0
- package/src/modules/finance-ledger/docs/commands/PostAdjustingEntries.md +61 -0
- package/src/modules/finance-ledger/docs/commands/PostJournalEntry.md +81 -0
- package/src/modules/finance-ledger/docs/commands/ProcessInventoryHandoff.md +72 -0
- package/src/modules/finance-ledger/docs/commands/ProcessManufacturingHandoff.md +68 -0
- package/src/modules/finance-ledger/docs/commands/ProcessPurchaseHandoff.md +68 -0
- package/src/modules/finance-ledger/docs/commands/ProcessSalesHandoff.md +71 -0
- package/src/modules/finance-ledger/docs/commands/RegenerateFinancialStatement.md +60 -0
- package/src/modules/finance-ledger/docs/commands/RemoveJournalLine.md +42 -0
- package/src/modules/finance-ledger/docs/commands/ReopenPeriod.md +45 -0
- package/src/modules/finance-ledger/docs/commands/ReverseJournalEntry.md +62 -0
- package/src/modules/finance-ledger/docs/commands/RevertSoftLock.md +49 -0
- package/src/modules/finance-ledger/docs/commands/UpdateFiscalYear.md +60 -0
- package/src/modules/finance-ledger/docs/commands/UpdateJournalEntry.md +47 -0
- package/src/modules/finance-ledger/docs/commands/UpdateJournalLine.md +61 -0
- package/src/modules/finance-ledger/docs/commands/VerifySubledgerTransfers.md +59 -0
- package/src/modules/finance-ledger/docs/commands/VerifyTrialBalance.md +53 -0
- package/src/modules/finance-ledger/docs/features/accounting-period-management.md +110 -0
- package/src/modules/finance-ledger/docs/features/financial-statement-generation.md +115 -0
- package/src/modules/finance-ledger/docs/features/journal-entry-management.md +138 -0
- package/src/modules/finance-ledger/docs/features/period-end-close.md +102 -0
- package/src/modules/finance-ledger/docs/features/subledger-integration.md +141 -0
- package/src/modules/finance-ledger/docs/features/trial-balance.md +99 -0
- package/src/modules/finance-ledger/docs/features/year-end-close.md +84 -0
- package/src/modules/finance-ledger/docs/models/AccountingPeriod.md +71 -0
- package/src/modules/finance-ledger/docs/models/FinancialStatement.md +76 -0
- package/src/modules/finance-ledger/docs/models/FinancialStatementLineItem.md +41 -0
- package/src/modules/finance-ledger/docs/models/FiscalYear.md +41 -0
- package/src/modules/finance-ledger/docs/models/JournalEntry.md +80 -0
- package/src/modules/finance-ledger/docs/models/JournalLine.md +47 -0
- package/src/modules/finance-ledger/docs/models/PeriodClose.md +83 -0
- package/src/modules/finance-ledger/docs/models/TrialBalance.md +56 -0
- package/src/modules/finance-ledger/docs/models/TrialBalanceLine.md +37 -0
- package/src/modules/finance-ledger/docs/queries/GetAccountingPeriod.md +35 -0
- package/src/modules/finance-ledger/docs/queries/GetFinancialStatement.md +38 -0
- package/src/modules/finance-ledger/docs/queries/GetFiscalYear.md +35 -0
- package/src/modules/finance-ledger/docs/queries/GetJournalEntry.md +37 -0
- package/src/modules/finance-ledger/docs/queries/GetPeriodByDate.md +38 -0
- package/src/modules/finance-ledger/docs/queries/GetPeriodClose.md +36 -0
- package/src/modules/finance-ledger/docs/queries/GetSubledgerTransferStatus.md +45 -0
- package/src/modules/finance-ledger/docs/queries/GetTrialBalance.md +38 -0
- package/src/modules/finance-ledger/docs/queries/ListAccountingPeriods.md +46 -0
- package/src/modules/finance-ledger/docs/queries/ListFinancialStatements.md +46 -0
- package/src/modules/finance-ledger/docs/queries/ListFiscalYears.md +42 -0
- package/src/modules/finance-ledger/docs/queries/ListJournalEntries.md +48 -0
- package/src/modules/finance-ledger/docs/queries/ListPeriodCloses.md +46 -0
- package/src/modules/finance-ledger/docs/queries/ListTrialBalances.md +51 -0
- package/src/modules/finance-ledger/generated/enums.ts +109 -0
- package/src/modules/finance-ledger/generated/kysely-tailordb.ts +202 -0
- package/src/modules/finance-ledger/index.ts +2 -0
- package/src/modules/finance-ledger/lib/_db_deps.ts +56 -0
- package/src/modules/finance-ledger/lib/errors.generated.ts +332 -0
- package/src/modules/finance-ledger/lib/permissions.generated.ts +41 -0
- package/src/modules/finance-ledger/lib/types.ts +66 -0
- package/src/modules/finance-ledger/module.ts +262 -0
- package/src/modules/finance-ledger/package.json +26 -0
- package/src/modules/finance-ledger/permissions.ts +3 -0
- package/src/modules/finance-ledger/query/getAccountingPeriod.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getAccountingPeriod.test.ts +31 -0
- package/src/modules/finance-ledger/query/getAccountingPeriod.ts +21 -0
- package/src/modules/finance-ledger/query/getFinancialStatement.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getFinancialStatement.test.ts +35 -0
- package/src/modules/finance-ledger/query/getFinancialStatement.ts +29 -0
- package/src/modules/finance-ledger/query/getFiscalYear.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getFiscalYear.test.ts +31 -0
- package/src/modules/finance-ledger/query/getFiscalYear.ts +21 -0
- package/src/modules/finance-ledger/query/getJournalEntry.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getJournalEntry.test.ts +35 -0
- package/src/modules/finance-ledger/query/getJournalEntry.ts +29 -0
- package/src/modules/finance-ledger/query/getPeriodByDate.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getPeriodByDate.test.ts +53 -0
- package/src/modules/finance-ledger/query/getPeriodByDate.ts +27 -0
- package/src/modules/finance-ledger/query/getPeriodClose.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getPeriodClose.test.ts +31 -0
- package/src/modules/finance-ledger/query/getPeriodClose.ts +21 -0
- package/src/modules/finance-ledger/query/getSubledgerTransferStatus.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getSubledgerTransferStatus.test.ts +101 -0
- package/src/modules/finance-ledger/query/getSubledgerTransferStatus.ts +68 -0
- package/src/modules/finance-ledger/query/getTrialBalance.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getTrialBalance.test.ts +33 -0
- package/src/modules/finance-ledger/query/getTrialBalance.ts +30 -0
- package/src/modules/finance-ledger/query/listAccountingPeriods.generated.ts +5 -0
- package/src/modules/finance-ledger/query/listAccountingPeriods.test.ts +81 -0
- package/src/modules/finance-ledger/query/listAccountingPeriods.ts +61 -0
- package/src/modules/finance-ledger/query/listFinancialStatements.generated.ts +5 -0
- package/src/modules/finance-ledger/query/listFinancialStatements.test.ts +76 -0
- package/src/modules/finance-ledger/query/listFinancialStatements.ts +62 -0
- package/src/modules/finance-ledger/query/listFiscalYears.generated.ts +5 -0
- package/src/modules/finance-ledger/query/listFiscalYears.test.ts +63 -0
- package/src/modules/finance-ledger/query/listFiscalYears.ts +45 -0
- package/src/modules/finance-ledger/query/listJournalEntries.generated.ts +5 -0
- package/src/modules/finance-ledger/query/listJournalEntries.test.ts +91 -0
- package/src/modules/finance-ledger/query/listJournalEntries.ts +64 -0
- package/src/modules/finance-ledger/query/listPeriodCloses.generated.ts +5 -0
- package/src/modules/finance-ledger/query/listPeriodCloses.test.ts +63 -0
- package/src/modules/finance-ledger/query/listPeriodCloses.ts +64 -0
- package/src/modules/finance-ledger/query/listTrialBalances.generated.ts +5 -0
- package/src/modules/finance-ledger/query/listTrialBalances.test.ts +78 -0
- package/src/modules/finance-ledger/query/listTrialBalances.ts +56 -0
- package/src/modules/finance-ledger/seed/index.ts +19 -0
- package/src/modules/finance-ledger/tailor.config.ts +13 -0
- package/src/modules/finance-ledger/tailor.d.ts +13 -0
- package/src/modules/finance-ledger/testing/commandTestUtils.ts +35 -0
- package/src/modules/finance-ledger/testing/fixtures.ts +382 -0
- package/src/modules/finance-ledger/tsconfig.json +16 -0
- package/src/modules/inventory/command/updateLot.test.ts +1 -1
- package/src/modules/inventory/command/updateLot.ts +2 -3
- package/src/modules/inventory/command/updateStockMovement.ts +2 -3
- package/src/modules/inventory/command/updateStorageLocation.ts +12 -17
- package/src/modules/inventory/command/updateValuationPolicy.ts +2 -3
- package/src/modules/inventory/command/updateWarehouse.ts +2 -3
- package/src/modules/inventory/docs/commands/UpdateLot.md +3 -3
- package/src/modules/inventory/docs/commands/UpdateStorageLocation.md +6 -6
- package/src/modules/inventory/docs/commands/UpdateWarehouse.md +2 -2
- package/src/modules/item-management/command/updateItem.test.ts +16 -12
- package/src/modules/item-management/command/updateItem.ts +47 -31
- package/src/modules/item-management/command/updateTaxonomyNode.test.ts +15 -16
- package/src/modules/item-management/command/updateTaxonomyNode.ts +42 -29
- package/src/modules/item-management/docs/commands/UpdateItem.md +7 -11
- package/src/modules/item-management/docs/commands/UpdateTaxonomyNode.md +10 -14
- package/src/modules/manufacturing/command/updateBillOfMaterial.ts +3 -4
- package/src/modules/manufacturing/command/updateProductionOrder.ts +3 -4
- package/src/modules/manufacturing/command/updateRouting.ts +3 -4
- package/src/modules/manufacturing/command/updateWorkCenter.test.ts +16 -7
- package/src/modules/manufacturing/command/updateWorkCenter.ts +41 -38
- package/src/modules/manufacturing/docs/commands/ActivateWorkCenter.md +2 -0
- package/src/modules/manufacturing/docs/commands/CompleteWorkOrder.md +2 -0
- package/src/modules/manufacturing/docs/commands/CreateBillOfMaterial.md +1 -0
- package/src/modules/manufacturing/docs/commands/ReviewManufacturingCostSummary.md +1 -0
- package/src/modules/manufacturing/docs/commands/UpdateWorkCenter.md +6 -5
- package/src/modules/manufacturing/docs/models/BillOfMaterialLine.md +42 -0
- package/src/modules/manufacturing/docs/models/CostVarianceLine.md +36 -0
- package/src/modules/manufacturing/docs/models/ManufacturingCostLine.md +37 -0
- package/src/modules/manufacturing/docs/models/ManufacturingCostSettlementRecord.md +34 -0
- package/src/modules/manufacturing/docs/models/ProductionOrderBomSnapshot.md +35 -0
- package/src/modules/manufacturing/docs/models/ProductionOrderCostBaseline.md +36 -0
- package/src/modules/manufacturing/docs/models/ProductionOrderMaterialRequirement.md +35 -0
- package/src/modules/manufacturing/docs/models/ProductionOrderRoutingSnapshot.md +34 -0
- package/src/modules/manufacturing/docs/models/RoutingOperation.md +40 -0
- package/src/modules/manufacturing/docs/models/WorkOrderExecutionEvent.md +38 -0
- package/src/modules/manufacturing/docs/queries/ExplodeBillOfMaterial.md +1 -0
- package/src/modules/manufacturing/docs/queries/ListWorkCentersBySite.md +1 -0
- package/src/modules/organization/command/updateCompany.test.ts +6 -6
- package/src/modules/organization/command/updateCompany.ts +3 -4
- package/src/modules/organization/command/updateDepartment.test.ts +7 -7
- package/src/modules/organization/command/updateDepartment.ts +13 -12
- package/src/modules/organization/command/updateSite.test.ts +10 -10
- package/src/modules/organization/command/updateSite.ts +3 -4
- package/src/modules/organization/docs/commands/UpdateCompany.md +6 -6
- package/src/modules/organization/docs/commands/UpdateDepartment.md +9 -10
- package/src/modules/organization/docs/commands/UpdateSite.md +12 -12
- package/src/modules/product-management/command/updateProduct.test.ts +17 -11
- package/src/modules/product-management/command/updateProduct.ts +45 -28
- package/src/modules/product-management/command/updateProductAttribute.test.ts +16 -21
- package/src/modules/product-management/command/updateProductAttribute.ts +40 -26
- package/src/modules/product-management/command/updateProductAttributeValue.ts +2 -3
- package/src/modules/product-management/command/updateProductCategory.test.ts +14 -19
- package/src/modules/product-management/command/updateProductCategory.ts +42 -26
- package/src/modules/product-management/docs/commands/UpdateProduct.md +16 -20
- package/src/modules/product-management/docs/commands/UpdateProductAttribute.md +10 -14
- package/src/modules/product-management/docs/commands/UpdateProductCategory.md +10 -14
- package/src/modules/purchase/command/updateGoodsReceipt.ts +2 -3
- package/src/modules/purchase/command/updatePurchaseBill.ts +2 -3
- package/src/modules/purchase/command/updatePurchaseOrder.ts +2 -3
- package/src/modules/purchase/command/updatePurchasePaymentTerm.ts +2 -3
- package/src/modules/purchase/command/updatePurchasePriceList.ts +2 -3
- package/src/modules/purchase/command/updatePurchasePriceRule.ts +2 -3
- package/src/modules/sales/command/updateChannel.test.ts +4 -4
- package/src/modules/sales/command/updateChannel.ts +2 -3
- package/src/modules/sales/command/updateListing.test.ts +2 -2
- package/src/modules/sales/command/updateListing.ts +2 -3
- package/src/modules/sales/command/updateSalesCreditNote.test.ts +2 -2
- package/src/modules/sales/command/updateSalesCreditNote.ts +2 -3
- package/src/modules/sales/command/updateSalesInvoice.test.ts +2 -2
- package/src/modules/sales/command/updateSalesInvoice.ts +2 -3
- package/src/modules/sales/command/updateSalesOrder.test.ts +3 -3
- package/src/modules/sales/command/updateSalesOrder.ts +2 -3
- package/src/modules/sales/command/updateSalesPaymentTerm.test.ts +2 -2
- package/src/modules/sales/command/updateSalesPaymentTerm.ts +2 -3
- package/src/modules/sales/command/updateSalesPriceList.test.ts +3 -3
- package/src/modules/sales/command/updateSalesPriceList.ts +2 -3
- package/src/modules/sales/command/updateSalesPriceRule.test.ts +3 -3
- package/src/modules/sales/command/updateSalesPriceRule.ts +2 -3
- package/src/modules/sales/command/updateShipment.test.ts +2 -2
- package/src/modules/sales/command/updateShipment.ts +2 -3
- package/src/modules/sales/docs/commands/UpdateChannel.md +4 -4
- package/src/modules/sales/docs/commands/UpdateListing.md +2 -2
- package/src/modules/sales/docs/commands/UpdateSalesCreditNote.md +2 -2
- package/src/modules/sales/docs/commands/UpdateSalesInvoice.md +2 -2
- package/src/modules/sales/docs/commands/UpdateSalesOrder.md +3 -3
- package/src/modules/sales/docs/commands/UpdateSalesPaymentTerm.md +2 -2
- package/src/modules/sales/docs/commands/UpdateSalesPriceList.md +3 -3
- package/src/modules/sales/docs/commands/UpdateSalesPriceRule.md +3 -3
- package/src/modules/sales/docs/commands/UpdateShipment.md +2 -2
- package/src/modules/user-management/README.md +2 -1
- package/src/modules/user-management/command/updateOwnProfile.generated.ts +6 -0
- package/src/modules/user-management/command/updateOwnProfile.test.ts +191 -0
- package/src/modules/user-management/command/updateOwnProfile.ts +82 -0
- package/src/modules/user-management/command/updateUser.generated.ts +6 -0
- package/src/modules/user-management/command/updateUser.test.ts +195 -0
- package/src/modules/user-management/command/updateUser.ts +76 -0
- package/src/modules/user-management/docs/commands/UpdateOwnProfile.md +68 -0
- package/src/modules/user-management/docs/commands/UpdateUser.md +67 -0
- package/src/modules/user-management/docs/features/user-account-management.md +28 -3
- package/src/modules/user-management/docs/models/User.md +2 -0
- package/src/modules/user-management/lib/errors.generated.ts +5 -0
- package/src/modules/user-management/lib/permissions.generated.ts +2 -0
- package/src/modules/user-management/module.ts +5 -0
- package/src/modules/user-management/seed/index.ts +19 -0
- package/src/progress/schema.test.ts +161 -0
- package/src/progress/schema.ts +316 -0
- package/templates/scaffold/app/backend/package.json +1 -3
- package/templates/scaffold/app/backend/seed/data/AuditEntry.jsonl +0 -0
- package/templates/scaffold/app/backend/seed/data/AuditEntry.schema.ts +20 -0
- package/templates/scaffold/app/backend/seed/data/AuditPolicy.jsonl +7 -0
- package/templates/scaffold/app/backend/seed/data/AuditPolicy.schema.ts +15 -0
- package/templates/scaffold/app/backend/seed/data/AuditableEntity.jsonl +4 -0
- package/templates/scaffold/app/backend/seed/data/AuditableEntity.schema.ts +20 -0
- package/templates/scaffold/app/backend/seed/data/ChangeDetail.jsonl +0 -0
- package/templates/scaffold/app/backend/seed/data/ChangeDetail.schema.ts +20 -0
- package/templates/scaffold/app/backend/seed/data/Company.jsonl +0 -0
- package/templates/scaffold/app/backend/seed/data/Company.schema.ts +15 -0
- package/templates/scaffold/app/backend/seed/data/Permission.jsonl +13 -0
- package/templates/scaffold/app/backend/seed/data/Permission.schema.ts +1 -1
- package/templates/scaffold/app/backend/seed/data/PolicyFieldRule.jsonl +0 -0
- package/templates/scaffold/app/backend/seed/data/PolicyFieldRule.schema.ts +20 -0
- package/templates/scaffold/app/backend/seed/data/Role.jsonl +1 -0
- package/templates/scaffold/app/backend/seed/data/Role.schema.ts +1 -1
- package/templates/scaffold/app/backend/seed/data/RolePermission.jsonl +13 -0
- package/templates/scaffold/app/backend/seed/data/RolePermission.schema.ts +1 -1
- package/templates/scaffold/app/backend/seed/data/User.jsonl +1 -1
- package/templates/scaffold/app/backend/seed/data/User.schema.ts +1 -1
- package/templates/scaffold/app/backend/seed/data/UserRole.jsonl +1 -0
- package/templates/scaffold/app/backend/seed/data/UserRole.schema.ts +1 -1
- package/templates/scaffold/app/backend/seed/data/_User.jsonl +1 -1
- package/templates/scaffold/app/backend/seed/exec.mjs +12 -0
- package/templates/scaffold/app/backend/src/executors/permissionCreated.ts +2 -2
- package/templates/scaffold/app/backend/src/executors/permissionDeleted.ts +2 -2
- package/templates/scaffold/app/backend/src/generated/kysely-tailordb.ts +62 -0
- package/templates/scaffold/app/backend/src/modules-db.ts +13 -0
- package/templates/scaffold/app/backend/src/modules.ts +3 -5
- package/templates/scaffold/app/backend/src/resolvers/assignPermissionToRole.ts +70 -0
- package/templates/scaffold/app/backend/src/resolvers/assignRoleToUser.ts +72 -0
- package/templates/scaffold/app/backend/src/resolvers/createRole.ts +92 -0
- package/templates/scaffold/app/backend/src/resolvers/createUser.ts +113 -13
- package/templates/scaffold/app/backend/src/resolvers/deactivateUser.ts +67 -0
- package/templates/scaffold/app/backend/src/resolvers/reactivateUser.ts +63 -0
- package/templates/scaffold/app/backend/src/resolvers/revokePermissionFromRole.ts +72 -0
- package/templates/scaffold/app/backend/src/resolvers/revokeRoleFromUser.ts +72 -0
- package/templates/scaffold/app/backend/src/resolvers/updateOwnProfile.ts +107 -0
- package/templates/scaffold/app/backend/src/resolvers/updateUserProfile.ts +107 -0
- package/templates/scaffold/app/backend/src/tests/stories/audit-log/user--view-audit-log-detail.test.ts +79 -0
- package/templates/scaffold/app/backend/src/tests/stories/audit-log/user--view-audit-log.test.ts +86 -0
- package/templates/scaffold/app/backend/src/tests/stories/role-management/user--assign-role-to-user.test.ts +103 -0
- package/templates/scaffold/app/backend/src/tests/stories/role-management/user--create-role.test.ts +61 -0
- package/templates/scaffold/app/backend/src/tests/stories/role-management/user--remove-role-from-user.test.ts +89 -0
- package/templates/scaffold/app/backend/src/tests/stories/role-management/user--update-role-permissions.test.ts +125 -0
- package/templates/scaffold/app/backend/src/tests/stories/user-lifecycle/user--browse-user-list.test.ts +91 -0
- package/templates/scaffold/app/backend/src/tests/stories/user-lifecycle/user--create-user-account.test.ts +97 -0
- package/templates/scaffold/app/backend/src/tests/stories/user-lifecycle/user--toggle-user-status.test.ts +131 -0
- package/templates/scaffold/app/backend/src/tests/stories/user-lifecycle/user--update-own-profile.test.ts +85 -0
- package/templates/scaffold/app/backend/src/tests/stories/user-lifecycle/user--update-user-profile.test.ts +158 -0
- package/templates/scaffold/app/backend/src/tests/stories/user-lifecycle/user--view-own-profile.test.ts +30 -0
- package/templates/scaffold/app/backend/src/tests/stories/user-lifecycle/user--view-user-detail.test.ts +98 -0
- package/templates/scaffold/app/backend/tailor.config.ts +6 -2
- package/templates/scaffold/app/backend/vitest.config.ts +4 -21
- package/templates/scaffold/app/docs/actors/user.md +11 -0
- package/templates/scaffold/app/docs/business-flow/audit-log/README.md +31 -0
- package/templates/scaffold/app/docs/business-flow/audit-log/story/user--view-audit-log-detail.md +35 -0
- package/templates/scaffold/app/docs/business-flow/audit-log/story/user--view-audit-log.md +44 -0
- package/templates/scaffold/app/docs/business-flow/role-management/README.md +33 -0
- package/templates/scaffold/app/docs/business-flow/role-management/story/user--assign-role-to-user.md +35 -0
- package/templates/scaffold/app/docs/business-flow/role-management/story/user--create-role.md +41 -0
- package/templates/scaffold/app/docs/business-flow/role-management/story/user--remove-role-from-user.md +33 -0
- package/templates/scaffold/app/docs/business-flow/role-management/story/user--update-role-permissions.md +41 -0
- package/templates/scaffold/app/docs/business-flow/user-lifecycle/README.md +48 -0
- package/templates/scaffold/app/docs/business-flow/user-lifecycle/story/user--browse-user-list.md +38 -0
- package/templates/scaffold/app/docs/business-flow/user-lifecycle/story/user--create-user-account.md +45 -0
- package/templates/scaffold/app/docs/business-flow/user-lifecycle/story/user--toggle-user-status.md +38 -0
- package/templates/scaffold/app/docs/business-flow/user-lifecycle/story/user--update-own-profile.md +36 -0
- package/templates/scaffold/app/docs/business-flow/user-lifecycle/story/user--update-user-profile.md +41 -0
- package/templates/scaffold/app/docs/business-flow/user-lifecycle/story/user--view-own-profile.md +30 -0
- package/templates/scaffold/app/docs/business-flow/user-lifecycle/story/user--view-user-detail.md +33 -0
- package/templates/scaffold/app/docs/resolver/assignPermissionToRole.md +16 -0
- package/templates/scaffold/app/docs/resolver/assignRoleToUser.md +17 -0
- package/templates/scaffold/app/docs/resolver/createRole.md +17 -0
- package/templates/scaffold/app/docs/resolver/createUser.md +23 -0
- package/templates/scaffold/app/docs/resolver/deactivateUser.md +17 -0
- package/templates/scaffold/app/docs/resolver/reactivateUser.md +16 -0
- package/templates/scaffold/app/docs/resolver/revokePermissionFromRole.md +17 -0
- package/templates/scaffold/app/docs/resolver/revokeRoleFromUser.md +17 -0
- package/templates/scaffold/app/docs/resolver/updateOwnProfile.md +20 -0
- package/templates/scaffold/app/docs/resolver/updateUserProfile.md +19 -0
- package/templates/scaffold/app/docs/screen/audit-entry-detail.md +30 -0
- package/templates/scaffold/app/docs/screen/audit-entry-list.md +25 -0
- package/templates/scaffold/app/docs/screen/my-profile-edit-form.md +22 -0
- package/templates/scaffold/app/docs/screen/my-profile.md +27 -0
- package/templates/scaffold/app/docs/screen/role-create-form.md +23 -0
- package/templates/scaffold/app/docs/screen/role-detail.md +27 -0
- package/templates/scaffold/app/docs/screen/role-edit-form.md +21 -0
- package/templates/scaffold/app/docs/screen/role-list.md +23 -0
- package/templates/scaffold/app/docs/screen/user-create-form.md +23 -0
- package/templates/scaffold/app/docs/screen/user-detail.md +33 -0
- package/templates/scaffold/app/docs/screen/user-edit-form.md +22 -0
- package/templates/scaffold/app/docs/screen/user-list.md +24 -0
- package/templates/scaffold/app/frontend/package.json +1 -1
- package/templates/scaffold/app/frontend/src/App.tsx +4 -0
- package/templates/scaffold/app/frontend/src/components/composed/error-fallback.tsx +1 -1
- package/templates/scaffold/app/frontend/src/graphql/generated/graphql-env.d.ts +59 -31
- package/templates/scaffold/app/frontend/src/graphql/generated/schema.graphql +1411 -688
- package/templates/scaffold/app/frontend/src/hooks/use-toast.ts +1 -1
- package/templates/scaffold/app/frontend/src/lib/permission-groups.ts +59 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/audit/[id]/components/audit-entry-detail.tsx +102 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/audit/[id]/page.tsx +65 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/audit/components/audit-entries-table.tsx +90 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/audit/page.tsx +52 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/profile/edit/components/edit-profile-form.tsx +125 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/profile/edit/page.tsx +19 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/profile/page.tsx +41 -21
- package/templates/scaffold/app/frontend/src/pages/user-management/role/[id]/components/role-actions.tsx +26 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/role/[id]/components/role-detail.tsx +69 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/role/[id]/edit/components/edit-role-form.tsx +192 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/role/[id]/edit/page.tsx +51 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/role/[id]/page.tsx +56 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/role/components/roles-table.tsx +85 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/role/create/components/create-role-form.tsx +204 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/role/create/page.tsx +19 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/role/page.tsx +60 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/user/[id]/components/user-actions.tsx +216 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/user/[id]/components/user-detail.tsx +97 -33
- package/templates/scaffold/app/frontend/src/pages/user-management/user/[id]/edit/components/edit-user-form.tsx +115 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/user/[id]/edit/page.tsx +51 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/user/[id]/page.tsx +8 -2
- package/templates/scaffold/app/frontend/src/pages/user-management/user/components/users-table.tsx +43 -42
- package/templates/scaffold/app/frontend/src/pages/user-management/user/create/components/create-user-form.tsx +120 -45
- package/templates/scaffold/app/frontend/src/pages/user-management/user/page.tsx +3 -4
- package/templates/scaffold/app/frontend/src/providers/graphql-provider.tsx +8 -1
- package/templates/scaffold/module/eslint.config.js +8 -0
- package/templates/scaffold/project/__dot__gitignore +1 -0
- package/templates/scaffold/project/__pnpm-workspace.yaml +3 -0
- package/templates/scaffold/project/apps/.gitkeep +0 -0
- package/templates/scaffold/project/modules/.gitkeep +0 -0
- package/templates/scaffold/project/package.json +15 -0
- package/templates/workflows/erp-kit-check.yml +10 -4
- package/src/generator/generate-stubs.ts +0 -35
- package/templates/scaffold/app/frontend/src/components/ui/badge.tsx +0 -39
- package/templates/scaffold/app/frontend/src/components/ui/button.tsx +0 -60
- package/templates/scaffold/app/frontend/src/components/ui/card.tsx +0 -75
- package/templates/scaffold/app/frontend/src/components/ui/input.tsx +0 -21
- package/templates/scaffold/app/frontend/src/components/ui/table.tsx +0 -90
- /package/src/modules/{supplier-portal → accounting/executor}/.gitkeep +0 -0
- /package/{templates/scaffold/app/docs/actors → src/modules/finance-ledger/command}/.gitkeep +0 -0
- /package/{templates/scaffold/app/docs/business-flow → src/modules/finance-ledger/db}/.gitkeep +0 -0
- /package/{templates/scaffold/app/docs/resolver → src/modules/finance-ledger/executor}/.gitkeep +0 -0
- /package/{templates/scaffold/app/docs/screen → src/modules/finance-ledger/query}/.gitkeep +0 -0
- /package/templates/{config → scaffold/project}/license.config.json +0 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Subledger Integration
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Subledger Integration provides the standardized event-driven framework through which upstream operational modules — purchase (accounts payable), sales (accounts receivable), inventory (valuation), and manufacturing (cost settlement) — post journal entries into the general ledger. Each upstream module emits a domain event containing the financial impact of a business transaction (e.g., a validated purchase bill, an issued sales invoice, an inventory valuation change, or a manufacturing cost settlement). The finance-ledger module subscribes to these events, validates the handoff payload against its own constraints (accounting period status, account validity, debit/credit balance), creates the corresponding journal entry with appropriate journal type classification, and acknowledges successful posting back to the originating module. This event-driven architecture decouples operational transaction processing from accounting, allowing each module to evolve independently while maintaining GL completeness.
|
|
6
|
+
|
|
7
|
+
The handoff contract for each subledger type defines the required payload fields, the expected account references (sourced from coa-management), the journal type assignment, and the acknowledgment pattern. Purchase and sales handoffs reference specific GL accounts for payable/receivable recognition and revenue/expense classification. Inventory handoffs carry valuation change amounts with asset and contra-account references. Manufacturing handoffs include WIP, absorption, and variance account references along with cost settlement data. All handoff contracts enforce idempotency — duplicate event delivery results in acknowledgment without re-posting — and require the originating module to have validated the target accounting period status before emitting the event. The finance-ledger module performs its own period status check as a secondary gate, rejecting events that target periods not in OPEN or FUTURE_ENTERABLE status.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
Organizations need a disciplined, auditable mechanism for subledger-to-GL integration to ensure financial completeness and operational consistency:
|
|
12
|
+
|
|
13
|
+
- **GL completeness**: Every financial transaction originating in an operational module must ultimately be reflected in the general ledger. Without standardized integration contracts, transactions can be lost between modules, leading to incomplete financial statements and failed audits
|
|
14
|
+
- **Separation of concerns**: Operational modules own business logic (purchase matching, invoice issuance, inventory valuation, cost settlement) while the finance-ledger owns accounting logic (double-entry enforcement, period control, account validation). The handoff contract is the boundary — upstream modules produce financial events, the GL consumes them
|
|
15
|
+
- **Event-driven decoupling**: By using domain events rather than direct API calls, subledger modules do not need runtime knowledge of GL internals. This follows the pattern used by Oracle Subledger Accounting (SLA) and SAP's document-posting architecture, where operational documents trigger accounting events that the GL processes independently
|
|
16
|
+
- **Idempotent processing**: Network failures, retries, and at-least-once delivery guarantees mean the GL may receive the same event multiple times. Idempotency keyed on source document reference ensures exactly-once posting semantics without requiring distributed transactions
|
|
17
|
+
- **Period validation at the boundary**: Upstream modules query accounting period status before emitting handoff events (first gate), and the finance-ledger re-validates period status upon receipt (second gate). This defense-in-depth approach prevents posting to closed or permanently closed periods even if the upstream module's status cache is stale
|
|
18
|
+
- **Acknowledgment contracts**: Each subledger type receives a typed acknowledgment upon successful posting (e.g., `PurchaseBillPostingAcknowledgment`, `ManufacturingCostSettlementAcknowledgment`). This enables upstream modules to track GL posting status, detect failures, and implement compensating actions
|
|
19
|
+
- **Journal type classification**: Handoff contracts assign the correct journal type (Sales, Purchase, Miscellaneous) to each generated journal entry, ensuring proper categorization in trial balances and financial statements
|
|
20
|
+
- **Audit traceability**: Every subledger-originated journal entry carries a source document reference (e.g., purchase bill ID, sales invoice number, inventory event ID, manufacturing settlement ID) linking the GL entry back to the originating business transaction for audit trail continuity
|
|
21
|
+
|
|
22
|
+
## Process Flow
|
|
23
|
+
|
|
24
|
+
The generic subledger-to-GL posting flow applies to all upstream module types:
|
|
25
|
+
|
|
26
|
+
```mermaid
|
|
27
|
+
flowchart TD
|
|
28
|
+
A[Upstream module completes business transaction] --> B[Upstream module queries AccountingPeriod status]
|
|
29
|
+
B --> C{Period OPEN or FUTURE_ENTERABLE?}
|
|
30
|
+
C -- No --> D[Upstream module rejects or defers posting]
|
|
31
|
+
C -- Yes --> E[Upstream module emits subledger handoff event]
|
|
32
|
+
E --> F[finance-ledger receives handoff event]
|
|
33
|
+
F --> G{Idempotency check: already posted?}
|
|
34
|
+
G -- Yes --> H[Return existing acknowledgment]
|
|
35
|
+
G -- No --> I[Validate accounting period status]
|
|
36
|
+
I --> J{Period still OPEN or FUTURE_ENTERABLE?}
|
|
37
|
+
J -- No --> K[Reject event with period status error]
|
|
38
|
+
J -- Yes --> L[Validate GL account references via coa-management]
|
|
39
|
+
L --> M{All accounts valid and active?}
|
|
40
|
+
M -- No --> N[Reject event with account validation error]
|
|
41
|
+
M -- Yes --> O[Create journal entry with balanced debit/credit lines]
|
|
42
|
+
O --> P[Post journal entry]
|
|
43
|
+
P --> Q[Emit typed acknowledgment to upstream module]
|
|
44
|
+
Q --> R[Upstream module records GL posting confirmation]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Each subledger type maps to specific account structures and journal types:
|
|
48
|
+
|
|
49
|
+
```mermaid
|
|
50
|
+
flowchart LR
|
|
51
|
+
subgraph Purchase
|
|
52
|
+
P1[PurchaseBill validated] --> P2[Debit: Expense/Asset account]
|
|
53
|
+
P2 --> P3[Credit: Accounts Payable]
|
|
54
|
+
P3 --> P4[Journal Type: Purchase]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
subgraph Sales
|
|
58
|
+
S1[SalesInvoice issued] --> S2[Debit: Accounts Receivable]
|
|
59
|
+
S2 --> S3[Credit: Revenue account]
|
|
60
|
+
S3 --> S4[Journal Type: Sales]
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
subgraph Inventory
|
|
64
|
+
I1[Valuation event emitted] --> I2[Debit/Credit: Inventory Asset]
|
|
65
|
+
I2 --> I3[Credit/Debit: COGS or Adjustment]
|
|
66
|
+
I3 --> I4[Journal Type: Miscellaneous]
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
subgraph Manufacturing
|
|
70
|
+
M1[Cost settlement emitted] --> M2[Debit: Finished Goods / Variance]
|
|
71
|
+
M2 --> M3[Credit: WIP account]
|
|
72
|
+
M3 --> M4[Journal Type: Miscellaneous]
|
|
73
|
+
end
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Scenario Patterns
|
|
77
|
+
|
|
78
|
+
- **Purchase Bill Payable Recognition**: A purchase module validates and matches a vendor invoice (PurchaseBill) against a purchase order and goods receipt. Upon successful three-way match, it emits a handoff event containing the bill amount, expense or asset account reference, and the accounts payable GL account. The finance-ledger creates a journal entry debiting the expense/asset account and crediting accounts payable, then returns a `PurchaseBillPostingAcknowledgment` with the generated journal entry ID
|
|
79
|
+
|
|
80
|
+
- **Sales Invoice Receivable Recognition**: The sales module issues a SalesInvoice to a customer. It emits a handoff event with the invoice total, accounts receivable GL account, and revenue account reference. The finance-ledger creates a journal entry debiting accounts receivable and crediting revenue, classified as a Sales journal type. The acknowledgment enables the sales module to mark the invoice as GL-posted
|
|
81
|
+
|
|
82
|
+
- **Sales Credit Note Reversal**: A SalesCreditNote is issued for a returned product. The sales module emits a handoff event that mirrors the original invoice posting with reversed debits and credits — debit revenue, credit accounts receivable. The finance-ledger validates the net effect and posts the reversing entry, preserving the audit link to both the original invoice and the credit note
|
|
83
|
+
|
|
84
|
+
- **Inventory Goods Receipt Valuation**: When inventory receives goods against a purchase order, the inventory module emits a valuation event with the received quantity, unit cost, inventory asset account, and goods receipt clearing account. The finance-ledger creates a journal entry debiting the inventory asset account and crediting the clearing account, capturing the cost basis of incoming stock
|
|
85
|
+
|
|
86
|
+
- **Inventory Adjustment and Scrap**: A cycle count reveals a shortfall, and the inventory module emits an adjustment event. The finance-ledger debits an inventory loss/adjustment expense account and credits the inventory asset account. For scrap events, a similar pattern posts to a scrap expense account, ensuring that inventory shrinkage is properly reflected in the GL
|
|
87
|
+
|
|
88
|
+
- **Manufacturing Cost Settlement**: At period end, the manufacturing module calculates actual production costs against standard costs and emits a cost settlement event containing WIP account references, finished goods account, and variance accounts (material price variance, labor efficiency variance, overhead variance). The finance-ledger debits finished goods and variance accounts, credits WIP, and returns a `ManufacturingCostSettlementAcknowledgment` so the manufacturing module can mark the production order as financially settled
|
|
89
|
+
|
|
90
|
+
- **Duplicate Event Delivery (Idempotency)**: A network retry causes the purchase module to emit the same PurchaseBill handoff event twice. On the second receipt, the finance-ledger detects the duplicate via the source document reference, skips journal entry creation, and returns the original acknowledgment. No duplicate posting occurs
|
|
91
|
+
|
|
92
|
+
- **Stale Period Status Rejection**: The sales module caches a period as OPEN but the period was closed by the controller between the cache read and the event emission. The finance-ledger's secondary period validation catches the mismatch and rejects the event with a period status error, prompting the sales module to defer the posting to the next open period
|
|
93
|
+
|
|
94
|
+
- **Multi-Currency Subledger Posting**: A purchase bill denominated in EUR is handed off to the finance-ledger for a company whose base currency is USD. The handoff event includes the foreign currency amount, the transaction currency code, and the exchange rate. The finance-ledger creates journal lines in both the transaction currency and the base currency, applying the exchange rate conversion per the primitives module's rate lookup
|
|
95
|
+
|
|
96
|
+
- **Cross-Subledger Period-End Verification**: During period-end close, the finance-ledger generates a subledger transfer completeness report checking that all expected handoff events from purchase, sales, inventory, and manufacturing for the closing period have been received and acknowledged. Outstanding items are flagged for the controller to investigate before closing the period
|
|
97
|
+
|
|
98
|
+
## Test Cases
|
|
99
|
+
|
|
100
|
+
- Purchase handoff event with valid PurchaseBill creates a journal entry with debit to expense/asset account and credit to accounts payable
|
|
101
|
+
- Purchase handoff journal entry is classified as Purchase journal type
|
|
102
|
+
- Purchase handoff acknowledgment includes the generated journal entry ID and posting timestamp
|
|
103
|
+
- Sales handoff event with valid SalesInvoice creates a journal entry with debit to accounts receivable and credit to revenue account
|
|
104
|
+
- Sales handoff journal entry is classified as Sales journal type
|
|
105
|
+
- Sales credit note handoff creates a reversing journal entry with debit to revenue and credit to accounts receivable
|
|
106
|
+
- Sales handoff acknowledgment includes the generated journal entry ID and posting timestamp
|
|
107
|
+
- Inventory goods receipt handoff creates a journal entry with debit to inventory asset and credit to clearing account
|
|
108
|
+
- Inventory adjustment handoff creates a journal entry with debit to adjustment expense and credit to inventory asset
|
|
109
|
+
- Inventory scrap handoff creates a journal entry with debit to scrap expense and credit to inventory asset
|
|
110
|
+
- Inventory handoff journal entries are classified as Miscellaneous journal type
|
|
111
|
+
- Manufacturing cost settlement handoff creates journal entries debiting finished goods and variance accounts, crediting WIP
|
|
112
|
+
- Manufacturing handoff returns a ManufacturingCostSettlementAcknowledgment with journal entry ID and settlement reference
|
|
113
|
+
- Manufacturing variance entries separately record material price variance, labor efficiency variance, and overhead variance when applicable
|
|
114
|
+
- All subledger-originated journal entries maintain balanced debits and credits (double-entry enforcement)
|
|
115
|
+
- All subledger-originated journal entries carry a source document reference linking to the originating business transaction
|
|
116
|
+
- Duplicate handoff events with the same source document reference are idempotent — no duplicate journal entries are created
|
|
117
|
+
- Duplicate handoff events return the original acknowledgment without re-posting
|
|
118
|
+
- Handoff events targeting an accounting period in OPEN status are accepted
|
|
119
|
+
- Handoff events targeting an accounting period in FUTURE_ENTERABLE status are accepted (advance postings)
|
|
120
|
+
- Handoff events targeting an accounting period in NEVER_OPENED status are rejected with a period status error
|
|
121
|
+
- Handoff events targeting an accounting period in CLOSED status are rejected with a period status error
|
|
122
|
+
- Handoff events targeting an accounting period in PERMANENTLY_CLOSED status are rejected with a period status error
|
|
123
|
+
- Handoff events referencing an invalid or non-existent GL account are rejected with an account validation error
|
|
124
|
+
- Handoff events referencing a GL account in DRAFT status (not yet active) are rejected with an account status error
|
|
125
|
+
- Handoff events referencing a deactivated GL account with a successor mapping are redirected to the successor account
|
|
126
|
+
- Multi-currency handoff events create journal lines in both transaction currency and base currency with correct exchange rate conversion
|
|
127
|
+
- Handoff events with zero or negative amounts are rejected with a validation error
|
|
128
|
+
- Each subledger handoff event processing emits an audit event via the audit module recording the source module, document reference, and journal entry created
|
|
129
|
+
- Failed handoff processing emits an audit event recording the rejection reason and source document reference
|
|
130
|
+
- Subledger transfer completeness check for a period reports all acknowledged and outstanding handoff events grouped by source module
|
|
131
|
+
- Period-end close workflow blocks closing if outstanding unacknowledged subledger events exist for the target period
|
|
132
|
+
- Handoff events are scoped to a company; events from one company cannot post to another company's GL accounts or periods
|
|
133
|
+
|
|
134
|
+
## Reference Links
|
|
135
|
+
|
|
136
|
+
- [Oracle Subledger Accounting (SLA) Overview](https://docs.oracle.com/en/cloud/saas/financials/24d/oafcf/subledger-accounting.html)
|
|
137
|
+
- [SAP FI Integration with Subledgers (AP, AR, MM)](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/ee3509643e954b3da2e0ebfa846c02e1/4cbe15773ecd2a44e10000000a42189b.html)
|
|
138
|
+
- [Oracle Fusion Create Subledger Journal Entries](https://docs.oracle.com/en/cloud/saas/financials/24d/oafcf/subledger-journal-entries.html)
|
|
139
|
+
- [SAP Document Posting Architecture (FI-GL Integration)](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/ee3509643e954b3da2e0ebfa846c02e1/5dc0ef593e3d2944e10000000a42189b.html)
|
|
140
|
+
- [Odoo Accounting Integration with Invoicing and Inventory](https://www.odoo.com/documentation/19.0/applications/finance/accounting/get_started/cheat_sheet.html)
|
|
141
|
+
- [NetSuite Subledger to GL Posting](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N671498.html)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Trial Balance
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The Trial Balance is a point-in-time snapshot report that summarizes the balances of all GL accounts for a specific accounting period within a company. For each account, the report presents the opening balance, total period debits, total period credits, and the resulting closing balance. The trial balance serves as the fundamental verification mechanism in double-entry bookkeeping: total debits across all accounts must equal total credits. Any imbalance indicates a posting error that must be resolved before financial statements can be generated. The report is scoped to a single company (via `companyId` from the organization module) and a single accounting period, and it derives its account structure from the active Chart of Accounts managed by coa-management.
|
|
6
|
+
|
|
7
|
+
The trial balance supports two variants: **pre-close** and **post-close**. A pre-close trial balance is generated during or before the period-end close process, reflecting all standard and adjusting journal entries posted up to that point. A post-close trial balance is generated after all closing entries have been applied, verifying that temporary accounts (revenue, expense) have been zeroed out and their balances transferred to retained earnings. Both variants aggregate data from posted journal lines in the general ledger, grouping results by the account group hierarchy defined in coa-management. The trial balance is the foundational input for financial statement generation (income statement, balance sheet) and is a required artifact in every period-end close workflow.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
Organizations rely on the trial balance as a core financial control and reporting mechanism:
|
|
12
|
+
|
|
13
|
+
- **Debit-credit equilibrium verification**: The trial balance confirms that total debits equal total credits across all accounts, validating the integrity of double-entry bookkeeping for the period. Any discrepancy signals a posting error that must be investigated before proceeding with financial close
|
|
14
|
+
- **Period-end close prerequisite**: Generating a balanced trial balance is a mandatory step in the period-end close workflow. Auditors and controllers use it to confirm that all journal entries for the period have been posted correctly before producing financial statements
|
|
15
|
+
- **Pre-close visibility**: The pre-close trial balance gives accountants a working view of account balances before adjusting and closing entries are applied, enabling them to identify missing accruals, misclassifications, or unposted transactions
|
|
16
|
+
- **Post-close validation**: The post-close trial balance verifies that all temporary accounts (revenue, expense, gains, losses) have been closed to retained earnings, ensuring only permanent accounts (assets, liabilities, equity) carry forward balances into the next period
|
|
17
|
+
- **Account group aggregation**: Balances are organized according to the account group hierarchy from coa-management, providing subtotals at each level (e.g., Current Assets, Fixed Assets, Total Assets) that align with the company's reporting structure
|
|
18
|
+
- **Financial statement foundation**: The trial balance provides the verified, balanced dataset from which the income statement, balance sheet, and other financial statements are generated. Without a balanced trial balance, downstream statement generation is blocked
|
|
19
|
+
- **Multi-period comparison**: By generating trial balances for consecutive periods, organizations can perform trend analysis and variance detection, identifying unusual fluctuations in account balances that may require investigation
|
|
20
|
+
- **Audit trail support**: Each generated trial balance is a timestamped snapshot, providing auditors with evidence of account balances at a specific point in time and supporting regulatory compliance requirements
|
|
21
|
+
|
|
22
|
+
## Process Flow
|
|
23
|
+
|
|
24
|
+
The following diagram shows the end-to-end workflow for generating a trial balance:
|
|
25
|
+
|
|
26
|
+
```mermaid
|
|
27
|
+
flowchart TD
|
|
28
|
+
A[Select company and accounting period] --> B[Determine trial balance variant]
|
|
29
|
+
B --> C{Pre-close or post-close?}
|
|
30
|
+
C -- Pre-close --> D[Retrieve all posted journal lines for the period]
|
|
31
|
+
C -- Post-close --> E[Retrieve all posted journal lines including closing entries]
|
|
32
|
+
D --> F[Fetch GL accounts from active CoA via coa-management]
|
|
33
|
+
E --> F
|
|
34
|
+
F --> G[Calculate opening balance per account from prior period closing balances]
|
|
35
|
+
G --> H[Aggregate period debits and credits per account from journal lines]
|
|
36
|
+
H --> I[Compute closing balance per account: opening + debits - credits]
|
|
37
|
+
I --> J{Total debits == total credits?}
|
|
38
|
+
J -- Yes --> K[Group balances by account group hierarchy]
|
|
39
|
+
K --> L[Generate trial balance snapshot with timestamp]
|
|
40
|
+
L --> M[Trial balance available for financial statement generation]
|
|
41
|
+
J -- No --> N[Report imbalance error with discrepancy amount]
|
|
42
|
+
N --> O[Investigate and correct journal entries]
|
|
43
|
+
O --> D
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The following state diagram shows the lifecycle of a trial balance snapshot:
|
|
47
|
+
|
|
48
|
+
```mermaid
|
|
49
|
+
stateDiagram-v2
|
|
50
|
+
[*] --> Generating: generateTrialBalance
|
|
51
|
+
Generating --> Balanced: debit-credit totals match
|
|
52
|
+
Generating --> Imbalanced: debit-credit totals do not match
|
|
53
|
+
Balanced --> [*]: snapshot stored
|
|
54
|
+
Imbalanced --> [*]: error reported
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Scenario Patterns
|
|
58
|
+
|
|
59
|
+
- **Standard Month-End Pre-Close**: An accountant generates a pre-close trial balance at the end of January to review all account balances before adjusting entries. The report reveals that total debits equal total credits, confirming posting integrity. The accountant identifies a missing accrual by reviewing individual account balances and posts an adjusting entry before regenerating the trial balance
|
|
60
|
+
- **Post-Close Verification After Period End**: After all closing entries have been posted for Q4, the controller generates a post-close trial balance. Revenue and expense accounts show zero balances, confirming that income summary entries correctly transferred net income to retained earnings. Only balance sheet accounts carry forward into the new fiscal year
|
|
61
|
+
- **Imbalance Detection and Resolution**: A trial balance generated mid-period reveals a 500 USD discrepancy between total debits and total credits. The accounting team traces the imbalance to a one-sided journal entry that was incorrectly posted. After correcting the entry, a regenerated trial balance confirms equilibrium
|
|
62
|
+
- **Multi-Entity Consolidated Review**: A parent company generates trial balances for each of its three subsidiaries for the same period. Each trial balance is scoped to its respective company and CoA. The finance team uses the individual trial balances as inputs for intercompany elimination and consolidated financial statement preparation
|
|
63
|
+
- **Year-End Audit Preparation**: External auditors request pre-close and post-close trial balances for all twelve months of the fiscal year. The accounting team generates each snapshot, providing auditors with a complete trail of account balances throughout the year, organized by the company's account group hierarchy
|
|
64
|
+
- **New Account Verification**: After adding a new GL account for a recently launched product line, the accountant generates a trial balance to confirm that postings to the new account are correctly reflected and that overall debit-credit equilibrium is maintained
|
|
65
|
+
- **Account Group Subtotal Analysis**: A CFO reviews the trial balance grouped by account hierarchy to analyze subtotals at the department level (e.g., Sales Expenses, R&D Expenses). The grouping follows the account group hierarchy defined in coa-management, enabling drill-down from summary to detail
|
|
66
|
+
|
|
67
|
+
## Test Cases
|
|
68
|
+
|
|
69
|
+
- Trial balance can only be generated for a company with an ACTIVE Chart of Accounts
|
|
70
|
+
- Trial balance can only be generated for a valid accounting period that exists in the system
|
|
71
|
+
- Trial balance must include all GL accounts from the active CoA, even those with zero balances
|
|
72
|
+
- Opening balance for each account equals the closing balance from the immediately preceding period
|
|
73
|
+
- Opening balance for the first period of a new CoA defaults to zero for all accounts
|
|
74
|
+
- Period debits per account equal the sum of all debit amounts from posted journal lines for that account in the period
|
|
75
|
+
- Period credits per account equal the sum of all credit amounts from posted journal lines for that account in the period
|
|
76
|
+
- Closing balance per account equals opening balance plus period debits minus period credits
|
|
77
|
+
- Total debits across all accounts must equal total credits across all accounts (fundamental equilibrium check)
|
|
78
|
+
- Generating a trial balance when total debits do not equal total credits produces an imbalance error with the discrepancy amount
|
|
79
|
+
- Pre-close trial balance excludes closing entries (entries that zero out temporary accounts)
|
|
80
|
+
- Post-close trial balance includes all closing entries and shows zero balances for all temporary accounts (revenue, expense)
|
|
81
|
+
- Post-close trial balance shows non-zero balances only for permanent accounts (assets, liabilities, equity)
|
|
82
|
+
- Trial balance is scoped to a single company; accounts from other companies are never included
|
|
83
|
+
- Trial balance respects the account group hierarchy from coa-management, providing subtotals at each group level
|
|
84
|
+
- Only posted journal entries are included; draft or voided journal entries are excluded from aggregation
|
|
85
|
+
- Trial balance snapshot includes a generation timestamp recording when the report was produced
|
|
86
|
+
- Trial balance snapshot records the variant type (pre-close or post-close)
|
|
87
|
+
- Generating a trial balance for a period with no posted journal entries produces a valid report with zero debits, zero credits, and opening balances carried forward
|
|
88
|
+
- Trial balance correctly handles accounts with only debit postings (no credits) and vice versa
|
|
89
|
+
- Trial balance generation emits an audit event recording the acting user, company, period, variant, and timestamp
|
|
90
|
+
- Regenerating a trial balance for the same period and variant produces an updated snapshot reflecting any new postings since the last generation
|
|
91
|
+
- Trial balance accounts are ordered by account code in ascending order within each account group
|
|
92
|
+
|
|
93
|
+
## Reference Links
|
|
94
|
+
|
|
95
|
+
- [SAP Trial Balance Report](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/ee3509643e954b3da2e0ebfa846c02e1/4006d63d7e167014e10000000a42189c.html)
|
|
96
|
+
- [Oracle Fusion Trial Balance](https://docs.oracle.com/en/cloud/saas/financials/24d/oafcf/trial-balance.html)
|
|
97
|
+
- [NetSuite Trial Balance Report](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N1584498.html)
|
|
98
|
+
- [Odoo Trial Balance and Financial Reports](https://www.odoo.com/documentation/19.0/applications/finance/accounting/reporting.html)
|
|
99
|
+
- [QuickBooks Trial Balance Overview](https://quickbooks.intuit.com/learn-support/en-us/help-article/report-management/trial-balance-report/L0t0FuAGH_US_en_US)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Year End Close
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Year-end close is the fiscal year-end extension of the standard period-end close process. It runs exclusively on the final period of a fiscal year, after that period's standard close checklist has been completed. The process generates an automatic closing journal entry that zeroes out all temporary accounts (revenue and expense) and transfers the net income or net loss to the retained earnings account defined in the active Chart of Accounts. This closing entry follows the explicit closing entry model used by Oracle, SAP, and NetSuite, where closing entries are posted as distinct, auditable journal entries rather than computed in real-time.
|
|
6
|
+
|
|
7
|
+
After the closing entry is posted, the year-end close generates opening balance entries for the first period of the new fiscal year. These opening balances carry forward all permanent account balances (assets, liabilities, equity — including the updated retained earnings) so that the new fiscal year starts with a complete balance sheet. The year-end close is a prerequisite for the new fiscal year's accounting periods to begin accepting operational postings, ensuring continuity between fiscal years. The entire process is auditable, with each step recorded via the audit module.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- **Retained earnings accuracy**: Closing temporary accounts to retained earnings ensures the balance sheet correctly reflects cumulative equity at fiscal year-end, which is required by GAAP, IFRS, and virtually all accounting standards
|
|
12
|
+
- **Clean start for new fiscal year**: Opening balance entries provide a complete starting point for the new fiscal year without requiring the system to recompute balances from historical transactions across all prior years
|
|
13
|
+
- **Explicit and auditable closing entries**: Posting closing entries as distinct journal entries (rather than virtual real-time computation) creates a clear, immutable audit trail that external auditors can verify independently
|
|
14
|
+
- **Temporary vs. permanent account distinction**: The year-end process enforces the fundamental accounting distinction between temporary accounts (revenue, expense — reset to zero each year) and permanent accounts (assets, liabilities, equity — carried forward indefinitely)
|
|
15
|
+
- **Fiscal year continuity**: Opening balance generation ensures that the accounting equation (Assets = Liabilities + Equity) holds at the start of the new fiscal year, preventing orphaned or imbalanced periods
|
|
16
|
+
- **Compliance with reporting standards**: IAS 1 and US GAAP require that financial statements present a complete picture of financial position, including retained earnings that reflect all prior-year results. The year-end close produces the entries that make this possible
|
|
17
|
+
- **Sequential dependency enforcement**: By requiring year-end close to run only on the final period of a fiscal year and only after its standard close is complete, the system prevents premature closing that could miss late-arriving transactions
|
|
18
|
+
|
|
19
|
+
## Process Flow
|
|
20
|
+
|
|
21
|
+
```mermaid
|
|
22
|
+
flowchart TD
|
|
23
|
+
A[Final period standard close completed] --> B{Is this the final period of the fiscal year?}
|
|
24
|
+
B -- No --> C[Standard permanent close - no year-end steps needed]
|
|
25
|
+
B -- Yes --> D[Initiate year-end close]
|
|
26
|
+
D --> E[Identify all temporary accounts: REVENUE and EXPENSE types]
|
|
27
|
+
E --> F[Calculate net income/loss: total revenue minus total expenses]
|
|
28
|
+
F --> G[Look up retained earnings account from CoA configuration]
|
|
29
|
+
G --> H{Retained earnings account configured?}
|
|
30
|
+
H -- No --> I[Reject: retained earnings account required]
|
|
31
|
+
H -- Yes --> J[Generate closing journal entry]
|
|
32
|
+
J --> K[Debit all revenue accounts to zero]
|
|
33
|
+
K --> L[Credit all expense accounts to zero]
|
|
34
|
+
L --> M[Post net difference to retained earnings account]
|
|
35
|
+
M --> N[Verify closing entry is balanced]
|
|
36
|
+
N --> O[Generate opening balance entries for new fiscal year]
|
|
37
|
+
O --> P[Post opening balances to first period of new fiscal year]
|
|
38
|
+
P --> Q[Year-end close complete - permanently close final period]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Scenario Patterns
|
|
42
|
+
|
|
43
|
+
- **Standard Year-End Close**: After closing December (the 12th and final period), the system generates a closing entry that debits all revenue accounts and credits all expense accounts, posting the net income to retained earnings. Opening balance entries are generated for January of the new fiscal year carrying forward all asset, liability, and equity balances
|
|
44
|
+
- **Year-End Close with Net Loss**: The company reports a net loss for the fiscal year. The closing entry credits all revenue accounts and debits all expense accounts, with the net loss debited to retained earnings, reducing cumulative equity. Opening balances reflect the reduced retained earnings
|
|
45
|
+
- **Non-Calendar Fiscal Year Close**: A company with an April-to-March fiscal year runs year-end close on the March period. The process is identical to a calendar year-end but triggers on the March period as the final period of the fiscal year
|
|
46
|
+
- **13-Period Fiscal Year Close**: A company using a 13-period fiscal calendar runs year-end close on period 13. The closing entry covers all 13 periods of revenue and expense activity
|
|
47
|
+
- **Multi-Entity Year-End Close**: A parent company coordinates year-end close across three subsidiaries. Each subsidiary runs its own year-end close independently, generating entity-specific closing entries and opening balances. The parent company's consolidation process consumes the resulting opening balances
|
|
48
|
+
- **Missing Retained Earnings Account**: The accounting team attempts year-end close but the active Chart of Accounts does not have an account with RETAINED_EARNINGS operational classification. The process is rejected with a clear error, requiring CoA configuration before year-end close can proceed
|
|
49
|
+
- **Year-End Close with Prior Adjustments**: An auditor posts a final adjustment during the soft-lock phase of the final period. The year-end close incorporates this adjustment into the closing entry calculation, ensuring the retained earnings transfer reflects all final adjustments
|
|
50
|
+
|
|
51
|
+
## Test Cases
|
|
52
|
+
|
|
53
|
+
- Year-end close can only be initiated for the final period of a fiscal year
|
|
54
|
+
- Initiating year-end close for a non-final period is rejected with an invalid period error
|
|
55
|
+
- Year-end close requires the final period's standard close checklist to be completed through the soft-lock or permanent close stage
|
|
56
|
+
- Year-end close generates a closing journal entry that debits all REVENUE-type accounts to zero
|
|
57
|
+
- Year-end close generates a closing journal entry that credits all EXPENSE-type accounts to zero
|
|
58
|
+
- The net difference (net income or net loss) is posted to the retained earnings account
|
|
59
|
+
- Year-end close fails if no account with RETAINED_EARNINGS operational classification exists in the active CoA
|
|
60
|
+
- The closing journal entry is balanced (total debits equal total credits)
|
|
61
|
+
- The closing journal entry is flagged with a distinct journal type (e.g., CLOSING) for identification
|
|
62
|
+
- The closing journal entry is posted to the final period of the fiscal year
|
|
63
|
+
- Only accounts with posted journal lines during the fiscal year are included in the closing entry (zero-balance temporary accounts are excluded)
|
|
64
|
+
- Opening balance entries are generated for all permanent accounts (ASSET, LIABILITY, EQUITY types)
|
|
65
|
+
- Opening balance entries are posted to the first period of the new fiscal year
|
|
66
|
+
- Opening balance entries carry the correct closing balance from each permanent account, including the updated retained earnings
|
|
67
|
+
- Opening balance entries are flagged with a distinct journal type (e.g., OPENING) for identification
|
|
68
|
+
- The sum of all opening balance debits equals the sum of all opening balance credits (accounting equation maintained)
|
|
69
|
+
- Year-end close cannot be run twice for the same fiscal year; duplicate attempts are rejected
|
|
70
|
+
- Year-end close emits audit events recording each step: closing entry generation, retained earnings posting, opening balance generation
|
|
71
|
+
- The closing entry references the fiscal year and the retained earnings account in its metadata for traceability
|
|
72
|
+
- Opening balances for the new fiscal year are only generated if the new fiscal year's periods exist
|
|
73
|
+
- Year-end close fails gracefully if the new fiscal year has not been defined, with a clear error message
|
|
74
|
+
- After year-end close, the final period of the old fiscal year is permanently closed
|
|
75
|
+
- After year-end close, the first period of the new fiscal year contains opening balance entries and is ready for operational postings
|
|
76
|
+
- Year-end close is scoped to a single company; each company runs year-end close independently
|
|
77
|
+
|
|
78
|
+
## Reference Links
|
|
79
|
+
|
|
80
|
+
- [Oracle Fusion Year-End Close Process](https://docs.oracle.com/en/cloud/saas/financials/24d/oafcf/general-ledger-close.html)
|
|
81
|
+
- [SAP S/4HANA Year-End Closing](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/ee3509643e954b3da2e0ebfa846c02e1/4588dcd34eab6e37e10000000a42189b.html)
|
|
82
|
+
- [NetSuite Year-End Tasks](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_1531269686.html)
|
|
83
|
+
- [Odoo Fiscal Year Closing](https://www.odoo.com/documentation/19.0/applications/finance/accounting/get_started/cheat_sheet.html)
|
|
84
|
+
- [IFRS IAS 1 Presentation of Financial Statements](https://www.ifrs.org/issued-standards/list-of-standards/ias-1-presentation-of-financial-statements/)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# AccountingPeriod
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
AccountingPeriod represents a discrete time segment (typically a month, quarter, or custom interval) within a fiscal year, scoped to a single company via companyId. Each period carries a start date, end date, period name, period type (OPERATING or ADJUSTMENT), and a five-state status that governs whether journal entries can be posted. The five-state lifecycle (NEVER_OPENED, FUTURE_ENTERABLE, OPEN, CLOSED, PERMANENTLY_CLOSED) mirrors the industry-standard model used by Oracle Financials and provides granular control over when and how transactions flow into each period. Accounting periods are the temporal backbone of the general ledger — every journal entry must reference a valid period, and the period's current status determines whether that posting is accepted or rejected.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> NeverOpened: createAccountingPeriod
|
|
18
|
+
NeverOpened --> FutureEnterable: openForAdvanceEntry
|
|
19
|
+
NeverOpened --> Open: openPeriod
|
|
20
|
+
FutureEnterable --> Open: openPeriod
|
|
21
|
+
Open --> Closed: closePeriod
|
|
22
|
+
Closed --> Open: reopenPeriod
|
|
23
|
+
Closed --> PermanentlyClosed: permanentlyClosePeriod
|
|
24
|
+
PermanentlyClosed --> [*]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Command Definitions
|
|
28
|
+
|
|
29
|
+
- [createAccountingPeriod](../commands/CreateAccountingPeriod.md) - Create a new accounting period in NEVER_OPENED status within a fiscal year
|
|
30
|
+
- [openForAdvanceEntry](../commands/OpenForAdvanceEntry.md) - Transition a NEVER_OPENED period to FUTURE_ENTERABLE to allow advance postings
|
|
31
|
+
- [openPeriod](../commands/OpenPeriod.md) - Transition a NEVER_OPENED or FUTURE_ENTERABLE period to OPEN
|
|
32
|
+
- [closePeriod](../commands/ClosePeriod.md) - Transition an OPEN period to CLOSED
|
|
33
|
+
- [reopenPeriod](../commands/ReopenPeriod.md) - Transition a CLOSED period back to OPEN for adjustments
|
|
34
|
+
- [permanentlyClosePeriod](../commands/PermanentlyClosePeriod.md) - Transition a CLOSED period to PERMANENTLY_CLOSED (irreversible)
|
|
35
|
+
- [deleteAccountingPeriod](../commands/DeleteAccountingPeriod.md) - Delete an accounting period with no associated journal entries
|
|
36
|
+
|
|
37
|
+
### Query Definitions
|
|
38
|
+
|
|
39
|
+
- [GetAccountingPeriod](../queries/GetAccountingPeriod.md) - Retrieve an accounting period by id
|
|
40
|
+
- [ListAccountingPeriods](../queries/ListAccountingPeriods.md) - List accounting periods for a fiscal year or company with optional status filter
|
|
41
|
+
- [GetPeriodByDate](../queries/GetPeriodByDate.md) - Find the accounting period for a given date and company
|
|
42
|
+
|
|
43
|
+
### Models
|
|
44
|
+
|
|
45
|
+
- AccountingPeriod
|
|
46
|
+
|
|
47
|
+
### Invariants
|
|
48
|
+
|
|
49
|
+
- Accounting periods can only be created in NEVER_OPENED status
|
|
50
|
+
- Period name is required and must be non-empty
|
|
51
|
+
- Period must have a valid start date and end date, with start date strictly before end date
|
|
52
|
+
- Period must reference a valid companyId from the organization module
|
|
53
|
+
- Period must belong to a fiscal year that is scoped to the same company
|
|
54
|
+
- Periods within the same fiscal year must not have overlapping date ranges
|
|
55
|
+
- Periods within the same fiscal year must cover the full fiscal year date range without gaps
|
|
56
|
+
- Two periods in the same fiscal year cannot have identical start and end dates unless one is an adjustment period
|
|
57
|
+
- Period type must be OPERATING or ADJUSTMENT
|
|
58
|
+
- Adjustment periods share the same end date as the final regular period but are typed as ADJUSTMENT
|
|
59
|
+
- A PERMANENTLY_CLOSED period cannot transition to any other status (irreversible)
|
|
60
|
+
- An OPEN period cannot transition directly to PERMANENTLY_CLOSED (must go through CLOSED first)
|
|
61
|
+
- A NEVER_OPENED period cannot transition directly to CLOSED
|
|
62
|
+
- A period cannot be deleted if it has any associated journal entries regardless of status
|
|
63
|
+
- Journal entries can only be posted to periods in OPEN or FUTURE_ENTERABLE status
|
|
64
|
+
- All period status transitions emit audit events via the audit module recording the acting user, timestamp, and previous and new status values
|
|
65
|
+
|
|
66
|
+
### Relationships
|
|
67
|
+
|
|
68
|
+
- **References Company**: Each accounting period is scoped to a Company via companyId (organization module)
|
|
69
|
+
- **References FiscalYear**: Each accounting period belongs to a FiscalYear via fiscalYearId
|
|
70
|
+
- **Has Many JournalEntry**: An accounting period may have journal entries posted to it
|
|
71
|
+
- **Has One PeriodClose**: An accounting period may have at most one active PeriodClose record
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# FinancialStatement
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
FinancialStatement represents a generated financial report — Balance Sheet (statement of financial position), Profit & Loss (income statement), or Cash Flow Statement. Each statement is scoped to a single company, denominated in the company's base currency, and structured according to the account group hierarchy defined in coa-management. A statement is created in DRAFT status from trial balance data and can be regenerated (replaced) until finalized. Once FINALIZED, the statement is immutable. The statement contains FinancialStatementLineItem records organized by account group sections with subtotals and totals.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> Draft: generateFinancialStatement
|
|
18
|
+
Draft --> Draft: regenerateFinancialStatement
|
|
19
|
+
Draft --> Finalized: finalizeFinancialStatement
|
|
20
|
+
Finalized --> [*]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Command Definitions
|
|
24
|
+
|
|
25
|
+
- [generateFinancialStatement](../commands/GenerateFinancialStatement.md) - Generate a financial statement from trial balance data in DRAFT status
|
|
26
|
+
- [regenerateFinancialStatement](../commands/RegenerateFinancialStatement.md) - Regenerate a DRAFT statement with updated trial balance data
|
|
27
|
+
- [finalizeFinancialStatement](../commands/FinalizeFinancialStatement.md) - Finalize a DRAFT statement, making it immutable
|
|
28
|
+
|
|
29
|
+
### Query Definitions
|
|
30
|
+
|
|
31
|
+
- [GetFinancialStatement](../queries/GetFinancialStatement.md) - Retrieve a financial statement by id with all line items
|
|
32
|
+
- [ListFinancialStatements](../queries/ListFinancialStatements.md) - List financial statements for a company with optional filters
|
|
33
|
+
|
|
34
|
+
### Models
|
|
35
|
+
|
|
36
|
+
- FinancialStatement
|
|
37
|
+
- FinancialStatementLineItem
|
|
38
|
+
|
|
39
|
+
### Invariants
|
|
40
|
+
|
|
41
|
+
- FinancialStatement requires a valid companyId referencing an ACTIVE company
|
|
42
|
+
- FinancialStatement requires a valid chartOfAccountsId referencing an ACTIVE CoA
|
|
43
|
+
- Statement type must be one of: BALANCE_SHEET, PROFIT_AND_LOSS, CASH_FLOW
|
|
44
|
+
- Balance Sheet generation requires a single reporting date (as-of date)
|
|
45
|
+
- Profit & Loss generation requires a date range (start date and end date)
|
|
46
|
+
- Cash Flow Statement generation requires a date range and a method (DIRECT or INDIRECT)
|
|
47
|
+
- The reporting date or date range must fall within a closed or active accounting period
|
|
48
|
+
- A Balance Sheet includes only accounts of type ASSET, LIABILITY, and EQUITY
|
|
49
|
+
- A Profit & Loss includes only accounts of type REVENUE and EXPENSE
|
|
50
|
+
- A Cash Flow Statement derives from ledger data covering all account types relevant to cash movements
|
|
51
|
+
- On a correctly generated Balance Sheet, total assets equal total liabilities plus total equity
|
|
52
|
+
- Statement line items are structured according to the account group hierarchy from coa-management
|
|
53
|
+
- Comparative period data, when requested, is aligned to the same account group sections as the current period
|
|
54
|
+
- If comparative period trial balance data is unavailable, generation fails with a descriptive error
|
|
55
|
+
- FinancialStatement is created in DRAFT status
|
|
56
|
+
- A DRAFT statement can be regenerated with updated trial balance data
|
|
57
|
+
- A FINALIZED statement is immutable — its line items, parameters, and output cannot be modified
|
|
58
|
+
- Finalizing an already FINALIZED statement fails
|
|
59
|
+
- All monetary amounts are denominated in the company's base currency
|
|
60
|
+
- Accounts not assigned to any account group are reported in an "Unclassified" section and flagged as warnings
|
|
61
|
+
- Statement output includes subtotals at each level of the account group hierarchy
|
|
62
|
+
- Generating a statement for a period with no posted journal entries fails with a validation error
|
|
63
|
+
- Statement generation for a company with no trial balance data for the requested period returns a validation error
|
|
64
|
+
- Cash Flow Statement (indirect method) starts with net income and adjusts for non-cash items and working capital changes
|
|
65
|
+
- Cash Flow Statement reconciles to the net change between opening and closing cash balances
|
|
66
|
+
- Each statement records a reference to the trial balance snapshot it was generated from
|
|
67
|
+
- Statement generation emits an audit event via the audit module recording the acting user, timestamp, statement type, and parameters
|
|
68
|
+
- Finalizing a statement emits an audit event recording the status transition from DRAFT to FINALIZED
|
|
69
|
+
|
|
70
|
+
### Relationships
|
|
71
|
+
|
|
72
|
+
- **References Company**: Each statement is scoped to a Company via companyId (organization module)
|
|
73
|
+
- **References ChartOfAccounts**: Each statement references a ChartOfAccounts via chartOfAccountsId (coa-management module)
|
|
74
|
+
- **References TrialBalance**: Each statement references the TrialBalance it was generated from via trialBalanceId
|
|
75
|
+
- **References TrialBalance (comparative)**: Optionally references a prior period TrialBalance via comparativePeriodTrialBalanceId
|
|
76
|
+
- **Has Many FinancialStatementLineItem**: A statement contains line items organized by sections
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# FinancialStatementLineItem
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
FinancialStatementLineItem represents a single row in a generated FinancialStatement. Each line item carries a label, current period amount, optional comparative period amount, line type (DETAIL for individual accounts, SUBTOTAL for group aggregations, TOTAL for section totals), section type indicating where it appears in the statement, sort order for display, and optional references to the account or account group it represents. Line items are created during financial statement generation and are immutable once the parent statement is finalized.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Standard
|
|
12
|
+
|
|
13
|
+
### Command Definitions
|
|
14
|
+
|
|
15
|
+
- [generateFinancialStatement](../commands/GenerateFinancialStatement.md) - Line items are created as part of financial statement generation
|
|
16
|
+
|
|
17
|
+
### Query Definitions
|
|
18
|
+
|
|
19
|
+
- [GetFinancialStatement](../queries/GetFinancialStatement.md) - Line items are returned as part of the parent financial statement
|
|
20
|
+
|
|
21
|
+
### Models
|
|
22
|
+
|
|
23
|
+
- FinancialStatementLineItem
|
|
24
|
+
|
|
25
|
+
### Invariants
|
|
26
|
+
|
|
27
|
+
- Each line item must belong to a valid FinancialStatement
|
|
28
|
+
- Line type must be one of DETAIL, SUBTOTAL, or TOTAL
|
|
29
|
+
- Section type is required and indicates the report section (e.g., Current Assets, Non-Current Liabilities, Revenue, Operating Expenses) where the line item appears
|
|
30
|
+
- Label is required and must be non-empty
|
|
31
|
+
- Amount is required and denominated in the company's base currency
|
|
32
|
+
- Comparative amount is present only when comparative period data was requested
|
|
33
|
+
- Sort order determines display positioning within the statement
|
|
34
|
+
- Accounts not assigned to any account group are reported in an "Unclassified" section
|
|
35
|
+
- Line items are immutable once the parent FinancialStatement is FINALIZED
|
|
36
|
+
|
|
37
|
+
### Relationships
|
|
38
|
+
|
|
39
|
+
- **References FinancialStatement**: Each line item belongs to a FinancialStatement via financialStatementId
|
|
40
|
+
- **References AccountGroup**: Optionally references an AccountGroup via accountGroupId (coa-management module)
|
|
41
|
+
- **References Account**: Optionally references an Account via accountId for DETAIL line items (coa-management module)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# FiscalYear
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
FiscalYear represents a logical grouping of accounting periods scoped to a single company. Each fiscal year carries a name, start date, and end date, and may follow a calendar year (January–December) or a non-calendar cycle (e.g., April–March, 4-4-5 week structures). A fiscal year contains one or more AccountingPeriod records that collectively span its full date range. The fiscal year is the outermost temporal boundary for period management, trial balance generation, and year-end close processes.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Standard
|
|
12
|
+
|
|
13
|
+
### Command Definitions
|
|
14
|
+
|
|
15
|
+
- [createFiscalYear](../commands/CreateFiscalYear.md) - Create a new fiscal year for a company with name, start/end dates
|
|
16
|
+
- [updateFiscalYear](../commands/UpdateFiscalYear.md) - Update mutable fields of an existing fiscal year (name only; dates immutable after periods exist)
|
|
17
|
+
- [deleteFiscalYear](../commands/DeleteFiscalYear.md) - Delete a fiscal year with no associated accounting periods
|
|
18
|
+
|
|
19
|
+
### Query Definitions
|
|
20
|
+
|
|
21
|
+
- [GetFiscalYear](../queries/GetFiscalYear.md) - Retrieve a fiscal year by id
|
|
22
|
+
- [ListFiscalYears](../queries/ListFiscalYears.md) - List fiscal years for a company with optional filters
|
|
23
|
+
|
|
24
|
+
### Models
|
|
25
|
+
|
|
26
|
+
- FiscalYear
|
|
27
|
+
|
|
28
|
+
### Invariants
|
|
29
|
+
|
|
30
|
+
- Fiscal year must reference a valid companyId from the organization module
|
|
31
|
+
- Fiscal year name is required and must be non-empty
|
|
32
|
+
- Fiscal year must have a valid start date and end date, with start date strictly before end date
|
|
33
|
+
- Fiscal years within the same company must not have overlapping date ranges
|
|
34
|
+
- Fiscal year start and end dates are immutable after accounting periods have been created
|
|
35
|
+
- A fiscal year cannot be deleted if it has any associated accounting periods
|
|
36
|
+
- Year-end close can only be run once per fiscal year; duplicate attempts are rejected
|
|
37
|
+
|
|
38
|
+
### Relationships
|
|
39
|
+
|
|
40
|
+
- **References Company**: Each fiscal year belongs to a Company via companyId (organization module)
|
|
41
|
+
- **Has Many AccountingPeriod**: A fiscal year contains one or more accounting periods
|