@tailor-platform/erp-kit 0.7.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 +25 -0
- package/README.md +8 -4
- package/dist/cli.mjs +70 -70
- package/package.json +1 -1
- package/skills/erp-kit-app-5-impl-backend/SKILL.md +5 -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 +3 -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 +3 -2
- package/skills/erp-kit-app-7-impl-review/references/module-wiring-parity.md +14 -8
- 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/index.ts +8 -2
- package/src/commands/init.test.ts +24 -8
- package/src/commands/init.ts +5 -12
- package/src/commands/lib/distribute.test.ts +1 -20
- package/src/commands/lib/distribute.ts +0 -14
- package/src/commands/update.test.ts +1 -1
- package/src/generator/scaffold.ts +25 -4
- 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/command/updateFiscalYear.ts +2 -3
- package/src/modules/finance-ledger/command/updateJournalEntry.test.ts +0 -17
- package/src/modules/finance-ledger/command/updateJournalEntry.ts +2 -10
- package/src/modules/finance-ledger/command/updateJournalLine.ts +2 -3
- package/src/modules/finance-ledger/docs/commands/UpdateJournalEntry.md +1 -4
- 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/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.schema.ts +20 -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.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/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/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/.gitkeep → backend/seed/data/AuditEntry.jsonl} +0 -0
- /package/templates/scaffold/app/{docs/business-flow/.gitkeep → backend/seed/data/ChangeDetail.jsonl} +0 -0
- /package/templates/scaffold/app/{docs/resolver/.gitkeep → backend/seed/data/Company.jsonl} +0 -0
- /package/templates/scaffold/app/{docs/screen/.gitkeep → backend/seed/data/PolicyFieldRule.jsonl} +0 -0
- /package/templates/{config → scaffold/project}/license.config.json +0 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Budget Management
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Budget Management provides the planning and control capabilities of the accounting module, enabling organizations to create budgets with line items per cost element, manage approval workflows, track multiple budget versions, and compare budgeted amounts against actual postings from finance-ledger. A budget entity carries a name, budget holder, fiscal year, period range, total amount, status, version type, and a cost object reference (cost center, profit center, or internal order). Each budget contains one or more BudgetLineItem records that specify a cost element, planned amount, and accounting period. The corresponding GL account for each line item is derived automatically from the primary cost element's one-to-one GL account mapping defined in cost-element-management, ensuring a single authoritative planning axis while preserving traceability to the general ledger. A PlanVersion entity (BUDGET, FORECAST, or SIMULATION) supports multi-version planning so organizations can maintain an approved operating budget alongside rolling forecasts and what-if simulations.
|
|
6
|
+
|
|
7
|
+
Budgets follow a five-stage lifecycle — DRAFT, SUBMITTED, APPROVED, ACTIVE, CLOSED — enforcing segregation of duties between budget creation, approval, and cost posting. Budgetary control (funds check) provides real-time validation that prevents transactions from exceeding approved budget amounts, using the BudgetAvailability formula: `Available = Budget - (Actual + Commitments + Encumbrances)`. Actual amounts are sourced from posted journal entries in finance-ledger. Commitments represent outstanding purchase order amounts received from the purchase module via commitment events; encumbrances represent purchase requisition amounts (future extension). This three-bucket model aligns with SAP availability control and Oracle budgetary control patterns. Budget periods reference finance-ledger FiscalYear and AccountingPeriod entities for period alignment, and budget lock at period-end integrates with finance-ledger period close. All budgets are scoped to a Company.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
Organizations need a structured budgeting process to plan expenditures, control costs, and measure financial performance against targets:
|
|
12
|
+
|
|
13
|
+
- **Expenditure planning**: Budgets translate strategic objectives into quantified financial plans by allocating planned amounts to cost elements across accounting periods, providing a financial roadmap for the fiscal year. The corresponding GL account is derived from each primary cost element's GL mapping, ensuring consistency between management and financial accounting without requiring dual-axis maintenance
|
|
14
|
+
- **Approval workflow enforcement**: The DRAFT to SUBMITTED to APPROVED progression ensures budgets are reviewed and authorized before activation, enforcing segregation of duties required by SOX and internal control frameworks — budget approval must be separate from budget creation and cost posting
|
|
15
|
+
- **Multi-version planning**: PlanVersion support (BUDGET, FORECAST, SIMULATION) allows organizations to maintain an approved operating budget alongside rolling forecasts and what-if simulations, enabling agile financial planning without altering the baseline commitment
|
|
16
|
+
- **Budgetary control (funds check)**: Real-time validation prevents transactions from exceeding available budget using the formula `Available = Budget - (Actual + Commitments + Encumbrances)`. This three-bucket availability check catches overspend at entry time, including amounts committed via purchase orders that have not yet been invoiced, preventing the common failure mode where PO-committed funds are double-spent
|
|
17
|
+
- **Commitment tracking**: Outstanding purchase order amounts are tracked as commitments that reduce available budget. When the purchase module confirms, receives, or invoices a PO, commitment amounts are consumed and reclassified as actuals. This integration requires consuming commitment events from the purchase module (PO confirmed, goods received, invoice matched)
|
|
18
|
+
- **Budget vs. actual comparison**: Comparing budgeted amounts against actual postings from finance-ledger journal entries surfaces variances early, enabling corrective action before period close
|
|
19
|
+
- **Cost object alignment**: Budgets reference cost centers, profit centers, or internal orders, linking financial plans to the organizational and project structures managed by the accounting module
|
|
20
|
+
- **Period alignment with finance-ledger**: Budget periods reference FiscalYear and AccountingPeriod from finance-ledger, ensuring budget and actual data share the same temporal boundaries for accurate variance analysis
|
|
21
|
+
- **Budget lock at period-end**: Closing a budget period prevents further modifications to planned amounts, integrating with finance-ledger period close to produce a frozen baseline for reporting and audit
|
|
22
|
+
- **Audit trail**: Every lifecycle transition — creation, submission, approval, activation, closure — is recorded with the acting user and timestamp, supporting internal and external audit requirements
|
|
23
|
+
|
|
24
|
+
## Process Flow
|
|
25
|
+
|
|
26
|
+
```mermaid
|
|
27
|
+
stateDiagram-v2
|
|
28
|
+
[*] --> Draft: createBudget
|
|
29
|
+
Draft --> Draft: updateBudget / addLineItem / removeLineItem
|
|
30
|
+
Draft --> Submitted: submitBudget
|
|
31
|
+
Submitted --> Approved: approveBudget
|
|
32
|
+
Submitted --> Draft: rejectBudget
|
|
33
|
+
Approved --> Active: activateBudget
|
|
34
|
+
Active --> Closed: closeBudget
|
|
35
|
+
Draft --> [*]: deleteBudget
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```mermaid
|
|
39
|
+
flowchart TD
|
|
40
|
+
A[Define budget scope: fiscal year, cost object, version type] --> B[Create Budget in DRAFT with header fields]
|
|
41
|
+
B --> C[Add BudgetLineItem records per cost element and period]
|
|
42
|
+
C --> D{All periods and cost elements covered?}
|
|
43
|
+
D -- No --> C
|
|
44
|
+
D -- Yes --> E[Submit budget for approval]
|
|
45
|
+
E --> F{Approver reviews budget}
|
|
46
|
+
F -- Reject --> G[Return to DRAFT with rejection reason]
|
|
47
|
+
G --> C
|
|
48
|
+
F -- Approve --> H[Budget status set to APPROVED]
|
|
49
|
+
H --> I[Activate budget for budgetary control]
|
|
50
|
+
I --> J[Funds check enabled: transactions validated against budget]
|
|
51
|
+
J --> K{Period-end reached?}
|
|
52
|
+
K -- No --> J
|
|
53
|
+
K -- Yes --> L[Lock budget period and run variance analysis]
|
|
54
|
+
L --> M{All periods complete?}
|
|
55
|
+
M -- No --> K
|
|
56
|
+
M -- Yes --> N[Close budget]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```mermaid
|
|
60
|
+
flowchart TD
|
|
61
|
+
A[Transaction submitted against cost element] --> B{Budget exists and ACTIVE for cost object?}
|
|
62
|
+
B -- No --> C[Transaction proceeds without funds check]
|
|
63
|
+
B -- Yes --> D[Compute BudgetAvailability]
|
|
64
|
+
D --> D1[Available = Budget - Actual + Commitments + Encumbrances]
|
|
65
|
+
D1 --> E{Available >= transaction amount?}
|
|
66
|
+
E -- Yes --> F[Transaction passes funds check]
|
|
67
|
+
E -- No --> G[Transaction rejected: budget exceeded]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```mermaid
|
|
71
|
+
flowchart TD
|
|
72
|
+
A[Purchase Order confirmed in purchase module] --> B[Commitment event received by accounting]
|
|
73
|
+
B --> C[Record commitment amount against cost element + cost object + period]
|
|
74
|
+
C --> D[BudgetAvailability reduced by commitment amount]
|
|
75
|
+
D --> E{Goods receipt or invoice posted?}
|
|
76
|
+
E -- Goods Receipt --> F[Reduce commitment, increase actual by received amount]
|
|
77
|
+
E -- Invoice Matched --> G[Reduce remaining commitment, actual reflects invoiced amount]
|
|
78
|
+
E -- PO Cancelled --> H[Release commitment amount back to available budget]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Scenario Patterns
|
|
82
|
+
|
|
83
|
+
- **Annual Operating Budget Creation**: A finance manager creates a new budget for fiscal year 2026 scoped to a cost center, adds line items for each cost element (salaries, travel, office supplies) distributed across twelve monthly periods, submits for department head approval, and activates upon approval to enable funds checking
|
|
84
|
+
- **Rolling Forecast Update**: A financial analyst creates a FORECAST plan version based on the approved BUDGET version, adjusts planned amounts for Q3 and Q4 to reflect revised revenue projections, and submits the forecast for review — the original BUDGET version remains unchanged as the committed baseline
|
|
85
|
+
- **What-If Simulation**: A planning team creates a SIMULATION plan version to model the financial impact of opening a new office, copying the current budget as a base and adding incremental line items for rent, staffing, and equipment — the simulation is never activated but serves as decision support
|
|
86
|
+
- **Budget Rejection and Revision**: A department submits a budget that exceeds the company-wide allocation. The finance director rejects it with a note to reduce travel expenses by 15%. The budget returns to DRAFT, the submitter adjusts the travel line items, and resubmits for approval
|
|
87
|
+
- **Funds Check Blocking an Overspend**: An employee submits a purchase order for office furniture. The funds check computes BudgetAvailability as `Budget - (Actual + Commitments + Encumbrances)` for the office supplies cost element in the current period. The available budget is insufficient after accounting for existing PO commitments, and the transaction is rejected with a budget exceeded error
|
|
88
|
+
- **Commitment Tracking from Purchase Orders**: A department issues a PO for consulting services worth $50,000. The purchase module emits a commitment event, and accounting records a $50,000 commitment against the consulting cost element budget. When the first invoice for $20,000 is matched, the commitment reduces by $20,000 and actual increases by $20,000, keeping BudgetAvailability unchanged. When the PO is fully invoiced, the commitment reaches zero
|
|
89
|
+
- **Mid-Year Budget Transfer**: A budget holder reallocates planned amounts between cost elements within the same budget (e.g., moving unused travel budget to training) by updating line items while the budget is ACTIVE, subject to approval controls
|
|
90
|
+
- **Budget vs. Actual Variance Report**: At month-end, a controller compares budgeted amounts against actual postings from finance-ledger journal entries for each cost element and period. The comparison highlights a 20% overrun in consulting expenses, triggering a management review
|
|
91
|
+
- **Period-End Budget Lock**: As the finance-ledger accounting period for January is closed, the corresponding budget period is locked, freezing planned amounts for January and preventing retroactive adjustments to the baseline
|
|
92
|
+
- **Multi-Cost-Object Budgeting**: A company creates separate budgets for three profit centers within the same fiscal year, each with its own line items and approval chain, enabling decentralized budget ownership while maintaining company-level consolidation
|
|
93
|
+
|
|
94
|
+
## Test Cases
|
|
95
|
+
|
|
96
|
+
- Budget lifecycle follows DRAFT -> SUBMITTED -> APPROVED -> ACTIVE -> CLOSED state machine
|
|
97
|
+
- Budget can only be created in DRAFT status
|
|
98
|
+
- Budget requires a valid companyId; the company must be in ACTIVE status
|
|
99
|
+
- Budget requires a valid fiscal year reference from finance-ledger
|
|
100
|
+
- Budget requires a name, budget holder, and cost object reference (cost center, profit center, or internal order)
|
|
101
|
+
- Budget must reference a valid PlanVersion (BUDGET, FORECAST, or SIMULATION)
|
|
102
|
+
- A DRAFT budget can be updated (name, description, budget holder, line items)
|
|
103
|
+
- A DRAFT budget can be deleted; deletion removes all associated line items
|
|
104
|
+
- Submitting a budget transitions status from DRAFT to SUBMITTED
|
|
105
|
+
- A budget with no line items cannot be submitted
|
|
106
|
+
- Only a user different from the budget creator can approve the budget (segregation of duties)
|
|
107
|
+
- Approving a budget transitions status from SUBMITTED to APPROVED
|
|
108
|
+
- Rejecting a budget transitions status from SUBMITTED back to DRAFT
|
|
109
|
+
- Rejection requires a reason text
|
|
110
|
+
- Activating an APPROVED budget transitions status to ACTIVE and enables funds checking
|
|
111
|
+
- Only one ACTIVE budget of type BUDGET can exist per cost object per fiscal year
|
|
112
|
+
- Multiple FORECAST or SIMULATION versions can coexist for the same cost object and fiscal year
|
|
113
|
+
- Closing an ACTIVE budget transitions status to CLOSED; no further modifications are permitted
|
|
114
|
+
- A CLOSED budget cannot be reopened
|
|
115
|
+
- BudgetLineItem requires a valid cost element reference; the cost element must be a PRIMARY type in ACTIVE status
|
|
116
|
+
- BudgetLineItem derives its GL account automatically from the referenced primary cost element's GL account mapping; no separate GL account field is required
|
|
117
|
+
- BudgetLineItem requires a valid accounting period reference from finance-ledger
|
|
118
|
+
- BudgetLineItem planned amount must be a positive value
|
|
119
|
+
- Line items can be added to or removed from a DRAFT budget
|
|
120
|
+
- Line items cannot be added to or removed from a SUBMITTED, APPROVED, or CLOSED budget
|
|
121
|
+
- Duplicate line items (same account and period) within a single budget are rejected
|
|
122
|
+
- Funds check computes BudgetAvailability as `Budget - (Actual + Commitments + Encumbrances)` for the target cost element, period, and cost object
|
|
123
|
+
- A transaction that exceeds BudgetAvailability is rejected with a budget exceeded error when budgetary control is active
|
|
124
|
+
- A transaction against a cost element with no corresponding budget line item is flagged as unbudgeted
|
|
125
|
+
- Commitment amounts are recorded when a purchase order confirmation event is received from the purchase module
|
|
126
|
+
- Commitment amounts are reduced and actual amounts are increased when a goods receipt or invoice match event is received from the purchase module
|
|
127
|
+
- Commitment amounts are fully released when a purchase order cancellation event is received from the purchase module
|
|
128
|
+
- Encumbrances (purchase requisition amounts) are tracked as a future extension; the availability formula reserves the field but the initial implementation treats encumbrances as zero
|
|
129
|
+
- Budget vs. actual comparison retrieves actual amounts from finance-ledger posted journal entries matching the budget's cost object, cost element, and period
|
|
130
|
+
- Variance is computed as planned amount minus actual amount; positive variance indicates underspend, negative indicates overspend
|
|
131
|
+
- Budget periods align with finance-ledger AccountingPeriod boundaries; misaligned periods are rejected
|
|
132
|
+
- Locking a budget period prevents further modifications to planned amounts for that period
|
|
133
|
+
- Budget lock integrates with finance-ledger period close; closing an accounting period triggers the corresponding budget period lock
|
|
134
|
+
- PlanVersion of type FORECAST or SIMULATION can reference a base version from which line items are copied
|
|
135
|
+
- Creating a budget emits an audit event recording the acting user, timestamp, and initial field values
|
|
136
|
+
- Submitting, approving, rejecting, activating, and closing a budget each emit audit events recording the status transition and acting user
|
|
137
|
+
- Budgets are scoped to a company; budgets from different companies are fully isolated
|
|
138
|
+
- Only users with appropriate permissions can create, submit, approve, activate, or close budgets
|
|
139
|
+
- Unauthorized users receive a permission denied error when attempting budget operations
|
|
140
|
+
|
|
141
|
+
## Reference Links
|
|
142
|
+
|
|
143
|
+
- [SAP S/4HANA Budget Management and Availability Control](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/4dbfa293944e410aa3ca0e0905bda494/d0b843994f0d1014a585e2078de58ced.html)
|
|
144
|
+
- [Oracle Fusion Financials Budgetary Control](https://docs.oracle.com/en/cloud/saas/financials/24d/oafcf/budgetary-control.html)
|
|
145
|
+
- [Odoo Budget Management](https://www.odoo.com/documentation/19.0/applications/finance/accounting/reporting/budget.html)
|
|
146
|
+
- [NetSuite Budgets Overview](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N2169498.html)
|
|
147
|
+
- [Sage Intacct Budgeting and Planning](https://www.sage.com/en-us/sage-business-cloud/intacct/features/budgeting-and-planning/)
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Cost Allocation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Cost Allocation is the process of distributing overhead costs from sender cost centers to receiver cost objects (cost centers, profit centers, or internal orders) using configurable allocation cycles and rules. The module supports two distinct allocation methods: assessment, which posts using secondary cost elements (aggregating the original cost elements into a single overhead category on the receiver), and distribution, which preserves the original primary cost elements on the receiver side for full cost transparency.
|
|
6
|
+
|
|
7
|
+
An allocation cycle groups a set of allocation rules, each defining a sender cost center, one or more receiver cost objects, and the allocation basis (fixed percentage or amount-based factor). Cycles progress through a controlled lifecycle — DRAFT, VALIDATED, EXECUTED, POSTED, and optionally REVERSED — ensuring that allocations are reviewed and tested before they affect the general ledger. Execution first runs in test mode to preview results, then in actual mode to generate immutable allocation result records. Posting creates journal entries through the finance-ledger subledger integration pattern, and corrections are handled exclusively via reversal and re-posting, never by deletion.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
Organizations need a structured cost allocation mechanism to accurately assign indirect and overhead costs to the business areas that consume them:
|
|
12
|
+
|
|
13
|
+
- **Overhead cost distribution**: Shared service costs (IT, facilities, HR) must be allocated to the operating units that benefit from them, enabling accurate product and service costing
|
|
14
|
+
- **Assessment vs distribution flexibility**: Assessment simplifies receiver-side reporting by consolidating costs under secondary cost elements, while distribution preserves original cost element detail for granular cost analysis — organizations choose based on their reporting requirements
|
|
15
|
+
- **Allocation rule governance**: Configurable rules with percentage-based or factor-based allocation bases ensure that cost distribution reflects actual resource consumption or agreed-upon sharing ratios
|
|
16
|
+
- **Percentage completeness validation**: Allocation rules for a given sender must have receiver percentages summing to exactly 100%, preventing under- or over-allocation of costs
|
|
17
|
+
- **Test run capability**: Executing an allocation cycle in test mode allows controllers to review projected results before committing actual postings, reducing the risk of errors in the general ledger
|
|
18
|
+
- **Immutable audit trail**: Allocation results are recorded as immutable records linking cycle, sender, receiver, allocated amount, and cost element, satisfying internal control and external audit requirements
|
|
19
|
+
- **Correction via reversal**: Posted allocations cannot be modified or deleted — corrections require reversing the entire cycle and re-executing with corrected rules, preserving full traceability of all cost movements
|
|
20
|
+
- **Period and company scoping**: Allocation cycles are scoped to a specific company and accounting period, ensuring that cost distributions align with the correct reporting boundaries
|
|
21
|
+
- **Ledger integration**: Allocation postings flow through the finance-ledger journal entry system, maintaining consistency between the cost accounting subledger and the general ledger
|
|
22
|
+
|
|
23
|
+
## Process Flow
|
|
24
|
+
|
|
25
|
+
```mermaid
|
|
26
|
+
stateDiagram-v2
|
|
27
|
+
[*] --> Draft: createAllocationCycle
|
|
28
|
+
Draft --> Draft: updateAllocationCycle / addAllocationRule / removeAllocationRule
|
|
29
|
+
Draft --> Validated: validateAllocationCycle
|
|
30
|
+
Validated --> Draft: invalidateAllocationCycle
|
|
31
|
+
Validated --> Executed: executeAllocationCycle (ACTUAL)
|
|
32
|
+
Executed --> Posted: postAllocationCycle
|
|
33
|
+
Posted --> Reversed: reverseAllocationCycle
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```mermaid
|
|
37
|
+
flowchart TD
|
|
38
|
+
A[Define allocation cycle with type and period] --> B[Add allocation rules: sender, receivers, percentages]
|
|
39
|
+
B --> C{All sender rules sum to 100%?}
|
|
40
|
+
C -- No --> D[Adjust rule percentages]
|
|
41
|
+
D --> B
|
|
42
|
+
C -- Yes --> E[Validate allocation cycle]
|
|
43
|
+
E --> F[Execute in TEST_RUN mode]
|
|
44
|
+
F --> G{Review test results acceptable?}
|
|
45
|
+
G -- No --> H[Return to DRAFT and adjust rules]
|
|
46
|
+
H --> B
|
|
47
|
+
G -- Yes --> I[Execute in ACTUAL mode]
|
|
48
|
+
I --> J[Immutable AllocationResult records created]
|
|
49
|
+
J --> K[Post allocation cycle]
|
|
50
|
+
K --> L{Assessment or Distribution?}
|
|
51
|
+
L -- Assessment --> M[Create journal entries with secondary cost elements]
|
|
52
|
+
L -- Distribution --> N[Create journal entries preserving original cost elements]
|
|
53
|
+
M --> O[Journal entries posted via finance-ledger]
|
|
54
|
+
N --> O
|
|
55
|
+
O --> P[Allocation complete]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```mermaid
|
|
59
|
+
flowchart TD
|
|
60
|
+
A[Select posted allocation cycle to reverse] --> B[Create reversal journal entries with inverted amounts]
|
|
61
|
+
B --> C{Reversal period OPEN or FUTURE_ENTERABLE?}
|
|
62
|
+
C -- No --> D[Select valid reversal period]
|
|
63
|
+
D --> C
|
|
64
|
+
C -- Yes --> E[Post reversal entries via finance-ledger]
|
|
65
|
+
E --> F[Allocation cycle status set to REVERSED]
|
|
66
|
+
F --> G[Original allocation amounts offset to zero]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Scenario Patterns
|
|
70
|
+
|
|
71
|
+
- **IT Department Overhead Assessment**: The IT cost center incurs infrastructure and support costs that serve multiple business units. An assessment cycle allocates these costs to the Sales, Manufacturing, and R&D cost centers using secondary cost element "IT Overhead Assessment" with fixed percentages (40%, 35%, 25%). Receivers see a single aggregated IT overhead line rather than individual cost element details
|
|
72
|
+
- **Facilities Cost Distribution**: Building maintenance, utilities, and security costs from the Facilities cost center are distributed to three profit centers based on floor space ratios. Distribution method preserves the original cost elements (rent, electricity, cleaning) on the receiver side, enabling profit center managers to see the detailed breakdown of facility costs they are consuming
|
|
73
|
+
- **Shared Services Assessment to Internal Orders**: A central HR shared services cost center allocates recruitment and training costs to project-based internal orders using assessment. Each internal order receives an overhead charge under a secondary cost element, enabling project managers to see the total loaded cost of their initiatives
|
|
74
|
+
- **Multi-Receiver Percentage Allocation**: A logistics cost center distributes warehousing costs to five regional profit centers using percentages derived from order volume (30%, 25%, 20%, 15%, 10%). The controller validates that percentages total 100%, runs a test execution to verify amounts, and then executes and posts the actual allocation
|
|
75
|
+
- **Test Run Review and Adjustment**: A cost controller sets up an allocation cycle for administrative overhead but notices during the test run that one receiver cost center has been decommissioned. The controller returns the cycle to DRAFT, updates the rules to redirect that portion to the successor cost center, re-validates, and executes again
|
|
76
|
+
- **Allocation Reversal and Correction**: After posting a quarterly assessment cycle, a controller discovers that the allocation percentages were based on outdated headcount data. The controller reverses the posted cycle, creates a new cycle with corrected percentages, validates, executes, and posts the corrected allocation — both the original and corrected postings remain in the ledger for full auditability
|
|
77
|
+
- **Period-End Overhead Allocation**: At month-end close, the accounting team executes multiple allocation cycles to distribute all overhead cost centers before generating management reports. Each cycle targets the current accounting period and is posted sequentially to ensure dependent allocations (e.g., secondary cost centers that received allocations themselves) are captured correctly
|
|
78
|
+
|
|
79
|
+
## Test Cases
|
|
80
|
+
|
|
81
|
+
- Allocation cycle lifecycle follows DRAFT -> VALIDATED -> EXECUTED -> POSTED state machine; posted cycles can transition to REVERSED
|
|
82
|
+
- Allocation cycle can only be created in DRAFT status
|
|
83
|
+
- Allocation cycle requires a valid type (ASSESSMENT or DISTRIBUTION)
|
|
84
|
+
- Allocation cycle requires a valid name
|
|
85
|
+
- Allocation cycle must reference a valid companyId; the company must be in ACTIVE status
|
|
86
|
+
- Allocation cycle must reference a valid accounting period
|
|
87
|
+
- Allocation rules can be added to or removed from a DRAFT allocation cycle
|
|
88
|
+
- Allocation rules cannot be added to or removed from a VALIDATED, EXECUTED, POSTED, or REVERSED cycle
|
|
89
|
+
- Each allocation rule must reference a valid sender cost center
|
|
90
|
+
- Each allocation rule must reference a valid receiver cost object (cost center, profit center, or internal order)
|
|
91
|
+
- A sender cost center cannot also appear as a receiver within the same allocation rule set
|
|
92
|
+
- Allocation rule percentages for a given sender must sum to exactly 100%
|
|
93
|
+
- Allocation rules with percentages not summing to 100% for any sender cause validation to fail
|
|
94
|
+
- Allocation rule percentage values must be positive (greater than zero)
|
|
95
|
+
- Validating a DRAFT cycle with valid rules transitions its status to VALIDATED
|
|
96
|
+
- Validating a cycle with no allocation rules fails
|
|
97
|
+
- A VALIDATED cycle can be returned to DRAFT for further editing
|
|
98
|
+
- Executing an allocation cycle in TEST_RUN mode generates preview results without changing cycle status to EXECUTED
|
|
99
|
+
- Executing an allocation cycle in ACTUAL mode transitions its status from VALIDATED to EXECUTED
|
|
100
|
+
- Execution in ACTUAL mode creates immutable AllocationResult records for each sender-receiver-amount combination
|
|
101
|
+
- AllocationResult records cannot be modified or deleted after creation
|
|
102
|
+
- Each AllocationResult references the allocation cycle, sender, receiver, allocated amount, and cost element used
|
|
103
|
+
- Executing a cycle that is not in VALIDATED status fails with an invalid status transition error
|
|
104
|
+
- Posting an EXECUTED cycle creates journal entries through the finance-ledger subledger integration
|
|
105
|
+
- Assessment-type allocation postings use secondary cost elements in the generated journal entries
|
|
106
|
+
- Distribution-type allocation postings preserve the original primary cost elements in the generated journal entries
|
|
107
|
+
- Posting transitions the cycle status from EXECUTED to POSTED
|
|
108
|
+
- Posting a cycle that is not in EXECUTED status fails with an invalid status transition error
|
|
109
|
+
- Journal entries created by posting reference the allocation cycle as the source document
|
|
110
|
+
- Reversing a POSTED cycle creates reversal journal entries with inverted amounts
|
|
111
|
+
- Reversal transitions the cycle status from POSTED to REVERSED
|
|
112
|
+
- Reversing a cycle that is not in POSTED status fails with an invalid status transition error
|
|
113
|
+
- Reversal journal entries must target a period that is in OPEN or FUTURE_ENTERABLE status
|
|
114
|
+
- A REVERSED cycle cannot be reversed again
|
|
115
|
+
- Allocation cycles are scoped to a company; cycles from different companies are fully isolated
|
|
116
|
+
- Allocation cycles reference a specific accounting period; the period must be in OPEN or FUTURE_ENTERABLE status for posting
|
|
117
|
+
- Posting an allocation cycle to a CLOSED or PERMANENTLY_CLOSED period is rejected
|
|
118
|
+
- Updating allocation cycle fields (name, rules) is only permitted while the cycle is in DRAFT status
|
|
119
|
+
- Deleting an allocation cycle is only permitted while in DRAFT status
|
|
120
|
+
- Creating an allocation cycle emits an audit event recording the acting user, timestamp, and initial field values
|
|
121
|
+
- Validating, executing, posting, and reversing an allocation cycle each emit audit events recording the status transition and acting user
|
|
122
|
+
- Only users with appropriate permissions can create, validate, execute, post, or reverse allocation cycles
|
|
123
|
+
|
|
124
|
+
## Reference Links
|
|
125
|
+
|
|
126
|
+
- [SAP Cost Center Accounting: Assessment and Distribution](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/ee3509643e954b3da2e0ebfa846c02e1/b867e2f9b57c4dc3b7ec7356aca3bb4e.html)
|
|
127
|
+
- [SAP Allocation Cycles in Controlling](https://help.sap.com/docs/SAP_ERP/29e50beaa37a447f8e4c13b0c5a15f32/42a07c62b9f343e0e10000000a11466f.html)
|
|
128
|
+
- [Oracle Fusion Cost Allocation Manager](https://docs.oracle.com/en/cloud/saas/financials/24d/oafcf/cost-allocation.html)
|
|
129
|
+
- [Odoo Analytic Accounting and Cost Distribution](https://www.odoo.com/documentation/19.0/applications/finance/accounting/reporting/analytic_accounting.html)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# cost-center-management
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Cost Center Management is the foundational feature of the accounting module, providing the ability to create, maintain, and hierarchically organize cost centers for overhead cost accumulation and management accounting reporting. A cost center represents a responsibility area within a company that accumulates costs — such as an IT department, a production floor, or a facilities group. Each cost center carries a code, name, description, category (e.g., overhead, production, administration, sales), responsible person, optional department reference, validity period (valid-from/to dates), and a position within a cost center hierarchy.
|
|
6
|
+
|
|
7
|
+
Cost centers are distinct from organizational departments: a single cost center can span multiple departments, and a single department can map to multiple cost centers. This separation allows management accounting structures to evolve independently of the organizational chart. Cost centers are scoped to a Company (from the organization module) and serve as the primary receiver for overhead costs, acting as the foundational cost object referenced by cost allocation, budget management, variance analysis, and internal order settlement. A standard cost center hierarchy must be established before cost centers can be created, following the SAP CO pattern where a hierarchy root is a prerequisite for cost center master data.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
Organizations need a structured cost center framework to track and control overhead costs for internal decision-making:
|
|
12
|
+
|
|
13
|
+
- **Overhead cost accumulation**: Cost centers collect indirect costs (rent, utilities, salaries, depreciation) that cannot be directly assigned to products or services, providing visibility into where overhead costs originate
|
|
14
|
+
- **Management responsibility assignment**: Each cost center has a designated responsible person, enabling accountability for cost control at the organizational unit level and supporting delegation of budgetary authority
|
|
15
|
+
- **Hierarchical roll-up reporting**: Cost center hierarchies allow costs to be aggregated from leaf-level cost centers up through intermediate grouping nodes to the root, enabling management reporting at any level of granularity
|
|
16
|
+
- **Foundation for cost allocation**: Cost centers serve as senders and receivers in cost allocation cycles (assessment and distribution), making them prerequisites for the cost-allocation feature
|
|
17
|
+
- **Budget anchoring**: Budgets are created against cost centers and their associated cost elements, making cost center master data a prerequisite for the budget-management feature
|
|
18
|
+
- **Variance analysis basis**: Plan-vs-actual comparisons are performed at the cost center level, requiring stable cost center definitions with clear validity periods
|
|
19
|
+
- **Separation from organizational structure**: Decoupling cost centers from departments allows the management accounting structure to reflect cost responsibility boundaries rather than HR reporting lines, supporting matrix organizations and shared service models
|
|
20
|
+
- **Temporal validity**: Valid-from and valid-to dates enable cost centers to be introduced for new organizational units or retired when restructuring occurs, without deleting historical cost data
|
|
21
|
+
- **Category-based classification**: Cost center categories (overhead, production, administration, sales, research) enable filtering, default cost element assignment, and category-specific reporting across the management accounting module
|
|
22
|
+
|
|
23
|
+
## Process Flow
|
|
24
|
+
|
|
25
|
+
```mermaid
|
|
26
|
+
stateDiagram-v2
|
|
27
|
+
[*] --> HierarchyCreated: createCostCenterHierarchy
|
|
28
|
+
HierarchyCreated --> HierarchyActive: addRootNode
|
|
29
|
+
HierarchyActive --> HierarchyActive: addChildNode / removeNode / reorganizeNodes
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```mermaid
|
|
33
|
+
flowchart TD
|
|
34
|
+
A[Establish cost center hierarchy] --> B[Create hierarchy with name and version]
|
|
35
|
+
B --> C[Define root node]
|
|
36
|
+
C --> D[Add child nodes to build grouping structure]
|
|
37
|
+
D --> E{Hierarchy complete?}
|
|
38
|
+
E -- No --> D
|
|
39
|
+
E -- Yes --> F[Hierarchy ready for cost center assignment]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```mermaid
|
|
43
|
+
flowchart TD
|
|
44
|
+
A[Create cost center master data] --> B[Assign code, name, category]
|
|
45
|
+
B --> C[Set responsible person and optional department reference]
|
|
46
|
+
C --> D[Define valid-from and valid-to dates]
|
|
47
|
+
D --> E[Assign to hierarchy node]
|
|
48
|
+
E --> F{Hierarchy node exists?}
|
|
49
|
+
F -- No --> G[Create or select hierarchy node]
|
|
50
|
+
G --> E
|
|
51
|
+
F -- Yes --> H[Cost center created and active]
|
|
52
|
+
H --> I[Available for cost postings, budgets, and allocations]
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```mermaid
|
|
56
|
+
flowchart TD
|
|
57
|
+
A[Update cost center] --> B{Change type?}
|
|
58
|
+
B -- Master data update --> C[Update name, description, category, responsible person]
|
|
59
|
+
C --> D[Audit trail records field changes]
|
|
60
|
+
B -- Hierarchy reassignment --> E[Move cost center to different hierarchy node]
|
|
61
|
+
E --> D
|
|
62
|
+
B -- Retirement --> F[Set valid-to date to end validity]
|
|
63
|
+
F --> G[Cost center excluded from future postings]
|
|
64
|
+
G --> D
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Scenario Patterns
|
|
68
|
+
|
|
69
|
+
- **Initial Setup for New Company**: A newly onboarded company establishes its cost center hierarchy by creating a root node (e.g., "Company ABC Cost Centers"), adding intermediate grouping nodes for each functional area (Administration, Production, Sales, R&D), and then creating individual cost centers under each group. This hierarchy becomes the prerequisite for all subsequent budgeting and cost allocation activities
|
|
70
|
+
- **Shared Service Center**: An IT department provides services to multiple business units. A single cost center "IT Services" is created under the overhead grouping node, accumulating all IT-related costs. This cost center later serves as the sender in cost allocation cycles that distribute IT costs to receiving cost centers based on headcount or usage metrics
|
|
71
|
+
- **Production Floor Cost Tracking**: A manufacturing company creates cost centers for each production line (Line A, Line B, Line C) under a "Production" grouping node. Each cost center has the category "production" and a designated line supervisor as the responsible person. Overhead costs like machine depreciation and maintenance are accumulated per line for variance analysis against planned production costs
|
|
72
|
+
- **Organizational Restructuring**: Following a merger, the company reorganizes its cost center hierarchy by moving several cost centers from one grouping node to another. Existing cost centers retain their historical cost data, while the hierarchy reflects the new organizational reality. Cost centers belonging to dissolved units have their valid-to dates set to the reorganization date
|
|
73
|
+
- **Seasonal Operations**: A retail company creates a cost center for a seasonal pop-up store with a valid-from date of November 1 and valid-to date of January 31. The cost center accumulates costs only during the holiday season and is excluded from allocations and postings outside its validity window
|
|
74
|
+
- **Cross-Department Responsibility**: A quality assurance function spans both the production and engineering departments. A single cost center "Quality Assurance" is created and assigned to a responsible person from the QA team, independent of department boundaries. This illustrates the separation between cost centers and organizational departments
|
|
75
|
+
- **Multi-Version Hierarchy Planning**: The company maintains two hierarchy versions — "Current" reflecting the active cost center structure, and "Planned Q3" reflecting a proposed reorganization. The planned version allows management to model allocation impacts before committing to the restructuring
|
|
76
|
+
|
|
77
|
+
## Test Cases
|
|
78
|
+
|
|
79
|
+
- A cost center hierarchy must be created before any cost centers can be created within a company
|
|
80
|
+
- A cost center hierarchy requires a name and version identifier
|
|
81
|
+
- A cost center hierarchy is scoped to a company; hierarchies from different companies are fully isolated
|
|
82
|
+
- A hierarchy root node must be established before child nodes can be added
|
|
83
|
+
- Hierarchy nodes support parent-child relationships with a sort order and level attribute
|
|
84
|
+
- A hierarchy node cannot be its own parent (no self-referencing)
|
|
85
|
+
- A hierarchy node cannot create a circular reference (child cannot be an ancestor of its parent)
|
|
86
|
+
- Deleting a hierarchy node that has child nodes or assigned cost centers is rejected
|
|
87
|
+
- A cost center requires a unique code within the company scope
|
|
88
|
+
- A cost center requires a name and a valid category
|
|
89
|
+
- A cost center must reference a valid hierarchy node within the same company's hierarchy
|
|
90
|
+
- A cost center must reference a valid companyId; the company must be in ACTIVE status
|
|
91
|
+
- A cost center has a valid-from date that must be earlier than or equal to its valid-to date
|
|
92
|
+
- A cost center with no valid-to date is treated as indefinitely active from its valid-from date
|
|
93
|
+
- A cost center optionally references a responsible person (from user-management)
|
|
94
|
+
- A cost center optionally references a department (from the organization module) for informational mapping
|
|
95
|
+
- Creating a cost center emits an audit event recording the acting user, timestamp, and initial field values
|
|
96
|
+
- Updating a cost center (name, description, category, responsible person, department, hierarchy node) emits an audit event recording previous and new field values
|
|
97
|
+
- A cost center code cannot be changed after creation to preserve referential integrity across budgets, allocations, and postings
|
|
98
|
+
- A cost center whose valid-to date has passed cannot receive new cost postings
|
|
99
|
+
- A cost center whose valid-from date is in the future cannot receive cost postings until that date is reached
|
|
100
|
+
- Moving a cost center to a different hierarchy node updates the hierarchy assignment and emits an audit event
|
|
101
|
+
- A cost center can only be assigned to a hierarchy node within the same company's hierarchy
|
|
102
|
+
- Multiple cost centers can be assigned to the same hierarchy node
|
|
103
|
+
- Cost center categories must be from a defined set (e.g., overhead, production, administration, sales, research)
|
|
104
|
+
- Changing a cost center's category is permitted and emits an audit event
|
|
105
|
+
- A cost center cannot be deleted if it has associated cost postings, budget line items, or allocation rules referencing it
|
|
106
|
+
- A cost center with no dependent records can be deleted; deletion emits an audit event
|
|
107
|
+
- Hierarchy roll-up reporting aggregates costs from child nodes up through parent nodes to the root
|
|
108
|
+
- A cost center hierarchy can have multiple versions within the same company
|
|
109
|
+
- Only users with appropriate permissions (from user-management) can create, update, or delete cost centers and hierarchy nodes
|
|
110
|
+
- Unauthorized users receive a permission denied error when attempting cost center operations
|
|
111
|
+
|
|
112
|
+
## Reference Links
|
|
113
|
+
|
|
114
|
+
- [SAP S/4HANA Cost Center Accounting](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/40ff4b3e8d2c4a2b8b3af8a4aa862a5e/65b18f9c49cc1014e10000000a174cb4.html)
|
|
115
|
+
- [SAP Cost Center Standard Hierarchy](https://help.sap.com/docs/SAP_S4HANA_CLOUD/21c2b8c1e03d4e6eba4d34de9eccf41d/65b18f9c49cc1014e10000000a174cb4.html)
|
|
116
|
+
- [Oracle Fusion Cost Center Segment](https://docs.oracle.com/en/cloud/saas/financials/24d/oafcf/cost-centers.html)
|
|
117
|
+
- [Odoo Analytic Accounting (Cost Center Equivalent)](https://www.odoo.com/documentation/19.0/applications/finance/accounting/reporting/analytic_accounting.html)
|
|
118
|
+
- [SAP CO Cost Center Planning](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/40ff4b3e8d2c4a2b8b3af8a4aa862a5e/65b18f9c49cc1014e10000000a174cb4.html)
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Cost Element Management
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Cost Element Management provides the foundational classification layer for management accounting within the accounting module. Cost elements define the types of costs that can be recorded, allocated, and analyzed across cost centers, profit centers, and internal orders. The module distinguishes two fundamental categories: primary cost elements, which are mapped one-to-one to GL accounts from coa-management and represent costs that appear in both financial and management accounting (e.g., material costs, labor costs, depreciation), and secondary cost elements, which exist exclusively within the controlling domain and are used solely for internal cost allocation activities such as assessment, distribution, and settlement.
|
|
6
|
+
|
|
7
|
+
Every cost posting or allocation in the accounting module requires a valid cost element, making this feature a prerequisite for all downstream management accounting processes. Primary cost elements bridge financial accounting and controlling by linking each cost type to its corresponding GL account, ensuring consistency between the general ledger and cost reports. Secondary cost elements enable internal cost flows that have no counterpart in financial reporting, allowing organizations to model overhead distribution, activity-based costing, and inter-departmental service charges. Cost elements are scoped to a Company and carry validity periods to support time-dependent cost classifications.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
Organizations need a structured cost element catalog to classify and control cost flows in management accounting:
|
|
12
|
+
|
|
13
|
+
- **Cost type classification**: Cost elements categorize expenditures into meaningful types (overhead, material, labor, depreciation for primary; assessment, distribution, internal activity allocation, settlement for secondary), enabling consistent cost reporting and analysis across the organization
|
|
14
|
+
- **Bridge between financial and management accounting**: Primary cost elements maintain a mandatory one-to-one mapping to GL accounts from coa-management, ensuring that every cost recorded in the general ledger can be consumed by controlling processes without discrepancy
|
|
15
|
+
- **Internal allocation enablement**: Secondary cost elements provide cost types that exist only within controlling, allowing organizations to model internal cost flows (e.g., IT department charging other departments for services) without polluting financial statements
|
|
16
|
+
- **Prerequisite for cost postings**: No cost can be posted to a cost center, profit center, or internal order without a valid cost element. This gating mechanism enforces a complete and auditable cost classification before any transaction occurs
|
|
17
|
+
- **Time-dependent validity**: Valid-from and valid-to dates on cost elements allow organizations to phase in new cost types or retire obsolete ones without deleting historical data, supporting period-accurate cost reporting
|
|
18
|
+
- **Company-scoped isolation**: Cost elements are defined per company, ensuring that each legal entity maintains its own cost classification structure aligned with its chart of accounts and management reporting requirements
|
|
19
|
+
- **Regulatory and ERP alignment**: The primary/secondary distinction mirrors the cost element model used by SAP, Oracle, and other major ERP systems, facilitating migration, integration, and compliance with established management accounting practices
|
|
20
|
+
|
|
21
|
+
## Process Flow
|
|
22
|
+
|
|
23
|
+
```mermaid
|
|
24
|
+
stateDiagram-v2
|
|
25
|
+
[*] --> Draft: createCostElement
|
|
26
|
+
Draft --> Draft: updateCostElement
|
|
27
|
+
Draft --> Active: activateCostElement
|
|
28
|
+
Active --> Inactive: deactivateCostElement
|
|
29
|
+
Inactive --> Active: reactivateCostElement
|
|
30
|
+
Draft --> [*]: deleteCostElement
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```mermaid
|
|
34
|
+
flowchart TD
|
|
35
|
+
A[Identify cost type to classify] --> B{Primary or Secondary?}
|
|
36
|
+
B -- Primary --> C[Select GL account from coa-management]
|
|
37
|
+
C --> D[Create primary cost element with GL account reference]
|
|
38
|
+
B -- Secondary --> E[Create secondary cost element without GL account]
|
|
39
|
+
D --> F[Set category, validity period, and description]
|
|
40
|
+
E --> F
|
|
41
|
+
F --> G[Activate cost element]
|
|
42
|
+
G --> H[Cost element available for cost postings and allocations]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```mermaid
|
|
46
|
+
flowchart TD
|
|
47
|
+
A[Cost posting or allocation initiated] --> B{Cost element specified?}
|
|
48
|
+
B -- No --> C[Reject: cost element required]
|
|
49
|
+
B -- Yes --> D{Cost element active and within validity period?}
|
|
50
|
+
D -- No --> E[Reject: invalid or expired cost element]
|
|
51
|
+
D -- Yes --> F{Primary cost element?}
|
|
52
|
+
F -- Yes --> G{Referenced GL account active in active CoA?}
|
|
53
|
+
G -- No --> H[Reject: GL account invalid]
|
|
54
|
+
G -- Yes --> I[Accept cost posting]
|
|
55
|
+
F -- No --> J{Used in allocation context only?}
|
|
56
|
+
J -- No --> K[Reject: secondary elements for internal allocation only]
|
|
57
|
+
J -- Yes --> I
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Scenario Patterns
|
|
61
|
+
|
|
62
|
+
- **Overhead Cost Element Setup**: A controller creates a primary cost element for "Office Rent" mapped to the corresponding rent expense GL account. The element is categorized as an overhead cost, given a validity period spanning the fiscal year, and activated. All rent postings to cost centers now reference this cost element for consistent overhead reporting
|
|
63
|
+
- **Material Cost Classification**: During initial system setup, the accounting team creates primary cost elements for each material cost category (raw materials, packaging, consumables), each mapped to its respective GL account from the chart of accounts. These elements enable material cost tracking across cost centers and internal orders
|
|
64
|
+
- **Labor Cost Tracking**: Primary cost elements are created for different labor cost types (salaries, wages, overtime, benefits), each referencing the appropriate payroll expense GL account. Cost center managers can then analyze labor costs by type within their responsibility areas
|
|
65
|
+
- **Depreciation Cost Element**: A primary cost element for asset depreciation is created and mapped to the depreciation expense GL account. This enables depreciation charges calculated by the asset module to flow into cost center reports as a distinct cost type
|
|
66
|
+
- **Assessment Cycle Preparation**: A controller creates a secondary cost element of category "assessment" to be used in the monthly overhead assessment cycle. This element does not reference any GL account and will only appear in cost center reports when the assessment allocation distributes shared service costs
|
|
67
|
+
- **Internal Activity Allocation**: A secondary cost element of category "internal activity allocation" is created for IT services. When the IT cost center allocates its costs to receiving cost centers based on service hours, this secondary element classifies the allocated amounts, keeping them separate from primary cost postings
|
|
68
|
+
- **Settlement to Profitability**: A secondary cost element of category "settlement" is created to settle accumulated costs from an internal order to a profit center. The settlement posting uses this element to classify the cost transfer, which remains invisible in financial accounting
|
|
69
|
+
- **Cost Element Retirement**: At the end of a fiscal year, a controller deactivates a cost element that is no longer relevant due to organizational restructuring. Existing historical postings referencing this element remain intact, but no new postings can use it
|
|
70
|
+
- **Cross-Company Cost Element Alignment**: Two subsidiaries each maintain their own cost element catalogs. Although the element codes and categories may align for consolidated reporting, each company's primary cost elements reference GL accounts from their respective charts of accounts
|
|
71
|
+
|
|
72
|
+
## Test Cases
|
|
73
|
+
|
|
74
|
+
- Cost element can be created in DRAFT status with a unique code within the company scope
|
|
75
|
+
- Cost element requires a valid companyId; the company must be in ACTIVE status
|
|
76
|
+
- Cost element code must be unique within the same company
|
|
77
|
+
- Cost element requires a name and a type (PRIMARY or SECONDARY)
|
|
78
|
+
- Cost element requires a category appropriate to its type (overhead, material, labor, depreciation for PRIMARY; assessment, distribution, internal_activity_allocation, settlement for SECONDARY)
|
|
79
|
+
- Primary cost element must reference a valid GL account from an ACTIVE Chart of Accounts
|
|
80
|
+
- Primary cost element GL account reference must point to an active GL account
|
|
81
|
+
- Primary cost element creation fails if the GL account reference is missing
|
|
82
|
+
- Primary cost element creation fails if the referenced GL account does not exist or is inactive
|
|
83
|
+
- Secondary cost element must not reference a GL account; providing a GL account reference for a secondary element is rejected
|
|
84
|
+
- Cost element valid-from date must be before or equal to valid-to date
|
|
85
|
+
- Cost element valid-from and valid-to dates are optional; omitting them means the element is valid indefinitely
|
|
86
|
+
- Cost element description is optional and can be updated while in DRAFT or ACTIVE status
|
|
87
|
+
- Activating a DRAFT cost element transitions its status to ACTIVE
|
|
88
|
+
- Activating an already ACTIVE cost element fails with an invalid status transition error
|
|
89
|
+
- Deactivating an ACTIVE cost element transitions its status to INACTIVE
|
|
90
|
+
- Reactivating an INACTIVE cost element transitions its status back to ACTIVE
|
|
91
|
+
- Only DRAFT cost elements can be deleted; ACTIVE and INACTIVE elements cannot be deleted
|
|
92
|
+
- Deleting a DRAFT cost element removes it and emits an audit event
|
|
93
|
+
- Cost postings referencing a cost element that is INACTIVE or outside its validity period are rejected
|
|
94
|
+
- Cost postings referencing a cost element that is ACTIVE and within its validity period are accepted
|
|
95
|
+
- A primary cost element cannot be assigned a secondary category (assessment, distribution, internal_activity_allocation, settlement)
|
|
96
|
+
- A secondary cost element cannot be assigned a primary category (overhead, material, labor, depreciation)
|
|
97
|
+
- Changing the type of a cost element (PRIMARY to SECONDARY or vice versa) after activation is not permitted
|
|
98
|
+
- Changing the GL account reference of a primary cost element after activation is not permitted
|
|
99
|
+
- Secondary cost elements can only be used in internal allocation contexts (assessment, distribution, activity allocation, settlement)
|
|
100
|
+
- Attempting to use a secondary cost element for a direct cost posting (non-allocation) is rejected
|
|
101
|
+
- Cost elements are scoped to a company; elements from different companies are fully isolated
|
|
102
|
+
- A primary cost element's GL account must belong to the same company's chart of accounts
|
|
103
|
+
- Two primary cost elements within the same company cannot reference the same GL account
|
|
104
|
+
- Updating the category of an ACTIVE cost element is not permitted
|
|
105
|
+
- Cost element creation emits an audit event recording the acting user, timestamp, and initial field values
|
|
106
|
+
- Cost element activation emits an audit event recording the status transition and acting user
|
|
107
|
+
- Cost element deactivation emits an audit event recording the status transition and acting user
|
|
108
|
+
|
|
109
|
+
## Reference Links
|
|
110
|
+
|
|
111
|
+
- [SAP Cost Element Accounting](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/ee3509643e954b3da2e0ebfa846c02e1/4cae4c5eecaa7286e10000000a42189b.html)
|
|
112
|
+
- [SAP Primary and Secondary Cost Elements](https://help.sap.com/docs/SAP_ERP/ba879a6e2ea04d9bb94c7ccd7cdac446/89d8463bf4f84033e10000000a174cb4.html)
|
|
113
|
+
- [Oracle Cost Management Overview](https://docs.oracle.com/en/cloud/saas/financials/24d/oafcf/cost-management.html)
|
|
114
|
+
- [Controlling with Cost Elements in SAP S/4HANA](https://community.sap.com/topics/s4hana/cost-elements)
|