@tailor-platform/erp-kit 0.5.1 → 0.7.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 +29 -0
- package/README.md +10 -10
- package/dist/cli.mjs +499 -81
- package/package.json +1 -1
- package/skills/erp-kit-app-1-requirements/SKILL.md +33 -17
- package/skills/erp-kit-app-2-requirements-review/SKILL.md +12 -0
- package/skills/erp-kit-app-3-plan/SKILL.md +18 -4
- package/skills/erp-kit-app-3-plan/references/resolver-extraction.md +1 -1
- package/skills/erp-kit-app-3-plan/references/screen-extraction.md +1 -1
- package/skills/erp-kit-app-4-plan-review/SKILL.md +12 -0
- package/skills/erp-kit-app-5-impl-backend/SKILL.md +19 -4
- package/skills/erp-kit-app-6-impl-frontend/SKILL.md +12 -0
- package/skills/erp-kit-app-7-impl-review/SKILL.md +14 -2
- package/skills/erp-kit-app-shared/references/progress-protocol.md +77 -0
- package/skills/erp-kit-mock-scenario/SKILL.md +1 -1
- package/skills/erp-kit-module-1-requirements/SKILL.md +1 -1
- package/skills/erp-kit-module-3-plan/SKILL.md +3 -3
- package/skills/erp-kit-module-3-update-plan/SKILL.md +3 -3
- package/skills/erp-kit-module-5-impl/SKILL.md +1 -1
- package/skills/erp-kit-module-6-impl-review/SKILL.md +39 -17
- package/src/commands/app/index.ts +2 -0
- package/src/commands/app/progress/git-context.ts +16 -0
- package/src/commands/app/progress/index.ts +45 -0
- package/src/commands/app/progress/log.ts +49 -0
- package/src/commands/app/progress/progress.test.ts +128 -0
- package/src/commands/app/progress/schema-cmd.ts +10 -0
- package/src/commands/check.test.ts +4 -4
- package/src/commands/generate-doc.ts +1 -1
- package/src/commands/lib/discovery.test.ts +18 -10
- package/src/commands/lib/discovery.ts +17 -9
- package/src/commands/lib/paths.ts +4 -2
- package/src/commands/lib/sync-check-source.test.ts +1 -1
- package/src/commands/lib/sync-check-source.ts +6 -1
- package/src/commands/lib/sync-check-tests.test.ts +127 -6
- package/src/commands/lib/sync-check-tests.ts +82 -4
- package/src/commands/sync-check.ts +10 -3
- package/src/generator/generate-app-code.test.ts +0 -6
- package/src/generator/generate-app-code.ts +47 -22
- package/src/generator/generate-code.test.ts +10 -40
- package/src/generator/generate-code.ts +6 -12
- package/src/generator/stub-templates.test.ts +9 -5
- package/src/generator/stub-templates.ts +16 -9
- package/src/modules/finance-ledger/README.md +50 -0
- package/src/modules/finance-ledger/command/.gitkeep +0 -0
- package/src/modules/finance-ledger/command/addJournalLine.generated.ts +6 -0
- package/src/modules/finance-ledger/command/addJournalLine.test.ts +438 -0
- package/src/modules/finance-ledger/command/addJournalLine.ts +122 -0
- package/src/modules/finance-ledger/command/approveAndLockPeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/approveAndLockPeriod.test.ts +107 -0
- package/src/modules/finance-ledger/command/approveAndLockPeriod.ts +72 -0
- package/src/modules/finance-ledger/command/beginClose.generated.ts +6 -0
- package/src/modules/finance-ledger/command/beginClose.test.ts +106 -0
- package/src/modules/finance-ledger/command/beginClose.ts +58 -0
- package/src/modules/finance-ledger/command/closePeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/closePeriod.test.ts +87 -0
- package/src/modules/finance-ledger/command/closePeriod.ts +44 -0
- package/src/modules/finance-ledger/command/createAccountingPeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/createAccountingPeriod.test.ts +425 -0
- package/src/modules/finance-ledger/command/createAccountingPeriod.ts +133 -0
- package/src/modules/finance-ledger/command/createFiscalYear.generated.ts +6 -0
- package/src/modules/finance-ledger/command/createFiscalYear.test.ts +197 -0
- package/src/modules/finance-ledger/command/createFiscalYear.ts +70 -0
- package/src/modules/finance-ledger/command/createJournalEntry.generated.ts +6 -0
- package/src/modules/finance-ledger/command/createJournalEntry.test.ts +261 -0
- package/src/modules/finance-ledger/command/createJournalEntry.ts +121 -0
- package/src/modules/finance-ledger/command/deleteAccountingPeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/deleteAccountingPeriod.test.ts +71 -0
- package/src/modules/finance-ledger/command/deleteAccountingPeriod.ts +55 -0
- package/src/modules/finance-ledger/command/deleteFiscalYear.generated.ts +6 -0
- package/src/modules/finance-ledger/command/deleteFiscalYear.test.ts +38 -0
- package/src/modules/finance-ledger/command/deleteFiscalYear.ts +34 -0
- package/src/modules/finance-ledger/command/deleteJournalEntry.generated.ts +6 -0
- package/src/modules/finance-ledger/command/deleteJournalEntry.test.ts +58 -0
- package/src/modules/finance-ledger/command/deleteJournalEntry.ts +43 -0
- package/src/modules/finance-ledger/command/executeYearEndClose.generated.ts +6 -0
- package/src/modules/finance-ledger/command/executeYearEndClose.test.ts +239 -0
- package/src/modules/finance-ledger/command/executeYearEndClose.ts +415 -0
- package/src/modules/finance-ledger/command/finalCloseAndLockPeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/finalCloseAndLockPeriod.test.ts +102 -0
- package/src/modules/finance-ledger/command/finalCloseAndLockPeriod.ts +76 -0
- package/src/modules/finance-ledger/command/finalizeFinancialStatement.generated.ts +6 -0
- package/src/modules/finance-ledger/command/finalizeFinancialStatement.test.ts +73 -0
- package/src/modules/finance-ledger/command/finalizeFinancialStatement.ts +73 -0
- package/src/modules/finance-ledger/command/generateFinancialStatement.generated.ts +6 -0
- package/src/modules/finance-ledger/command/generateFinancialStatement.test.ts +311 -0
- package/src/modules/finance-ledger/command/generateFinancialStatement.ts +275 -0
- package/src/modules/finance-ledger/command/generatePreliminaryStatements.generated.ts +6 -0
- package/src/modules/finance-ledger/command/generatePreliminaryStatements.test.ts +152 -0
- package/src/modules/finance-ledger/command/generatePreliminaryStatements.ts +140 -0
- package/src/modules/finance-ledger/command/generateTrialBalance.generated.ts +6 -0
- package/src/modules/finance-ledger/command/generateTrialBalance.test.ts +439 -0
- package/src/modules/finance-ledger/command/generateTrialBalance.ts +268 -0
- package/src/modules/finance-ledger/command/initiatePeriodClose.generated.ts +6 -0
- package/src/modules/finance-ledger/command/initiatePeriodClose.test.ts +153 -0
- package/src/modules/finance-ledger/command/initiatePeriodClose.ts +84 -0
- package/src/modules/finance-ledger/command/openForAdvanceEntry.generated.ts +6 -0
- package/src/modules/finance-ledger/command/openForAdvanceEntry.test.ts +87 -0
- package/src/modules/finance-ledger/command/openForAdvanceEntry.ts +44 -0
- package/src/modules/finance-ledger/command/openPeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/openPeriod.test.ts +90 -0
- package/src/modules/finance-ledger/command/openPeriod.ts +44 -0
- package/src/modules/finance-ledger/command/permanentlyClosePeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/permanentlyClosePeriod.test.ts +87 -0
- package/src/modules/finance-ledger/command/permanentlyClosePeriod.ts +48 -0
- package/src/modules/finance-ledger/command/postAdjustingEntries.generated.ts +6 -0
- package/src/modules/finance-ledger/command/postAdjustingEntries.test.ts +392 -0
- package/src/modules/finance-ledger/command/postAdjustingEntries.ts +156 -0
- package/src/modules/finance-ledger/command/postJournalEntry.generated.ts +6 -0
- package/src/modules/finance-ledger/command/postJournalEntry.test.ts +346 -0
- package/src/modules/finance-ledger/command/postJournalEntry.ts +160 -0
- package/src/modules/finance-ledger/command/processInventoryHandoff.generated.ts +6 -0
- package/src/modules/finance-ledger/command/processInventoryHandoff.test.ts +211 -0
- package/src/modules/finance-ledger/command/processInventoryHandoff.ts +133 -0
- package/src/modules/finance-ledger/command/processManufacturingHandoff.generated.ts +6 -0
- package/src/modules/finance-ledger/command/processManufacturingHandoff.test.ts +221 -0
- package/src/modules/finance-ledger/command/processManufacturingHandoff.ts +133 -0
- package/src/modules/finance-ledger/command/processPurchaseHandoff.generated.ts +6 -0
- package/src/modules/finance-ledger/command/processPurchaseHandoff.test.ts +222 -0
- package/src/modules/finance-ledger/command/processPurchaseHandoff.ts +133 -0
- package/src/modules/finance-ledger/command/processSalesHandoff.generated.ts +6 -0
- package/src/modules/finance-ledger/command/processSalesHandoff.test.ts +257 -0
- package/src/modules/finance-ledger/command/processSalesHandoff.ts +135 -0
- package/src/modules/finance-ledger/command/regenerateFinancialStatement.generated.ts +6 -0
- package/src/modules/finance-ledger/command/regenerateFinancialStatement.test.ts +129 -0
- package/src/modules/finance-ledger/command/regenerateFinancialStatement.ts +186 -0
- package/src/modules/finance-ledger/command/removeJournalLine.generated.ts +6 -0
- package/src/modules/finance-ledger/command/removeJournalLine.test.ts +65 -0
- package/src/modules/finance-ledger/command/removeJournalLine.ts +39 -0
- package/src/modules/finance-ledger/command/reopenPeriod.generated.ts +6 -0
- package/src/modules/finance-ledger/command/reopenPeriod.test.ts +87 -0
- package/src/modules/finance-ledger/command/reopenPeriod.ts +44 -0
- package/src/modules/finance-ledger/command/reverseJournalEntry.generated.ts +6 -0
- package/src/modules/finance-ledger/command/reverseJournalEntry.test.ts +337 -0
- package/src/modules/finance-ledger/command/reverseJournalEntry.ts +140 -0
- package/src/modules/finance-ledger/command/revertSoftLock.generated.ts +6 -0
- package/src/modules/finance-ledger/command/revertSoftLock.test.ts +96 -0
- package/src/modules/finance-ledger/command/revertSoftLock.ts +67 -0
- package/src/modules/finance-ledger/command/updateFiscalYear.generated.ts +6 -0
- package/src/modules/finance-ledger/command/updateFiscalYear.test.ts +138 -0
- package/src/modules/finance-ledger/command/updateFiscalYear.ts +85 -0
- package/src/modules/finance-ledger/command/updateJournalEntry.generated.ts +6 -0
- package/src/modules/finance-ledger/command/updateJournalEntry.test.ts +195 -0
- package/src/modules/finance-ledger/command/updateJournalEntry.ts +86 -0
- package/src/modules/finance-ledger/command/updateJournalLine.generated.ts +6 -0
- package/src/modules/finance-ledger/command/updateJournalLine.test.ts +385 -0
- package/src/modules/finance-ledger/command/updateJournalLine.ts +155 -0
- package/src/modules/finance-ledger/command/verifySubledgerTransfers.generated.ts +6 -0
- package/src/modules/finance-ledger/command/verifySubledgerTransfers.test.ts +201 -0
- package/src/modules/finance-ledger/command/verifySubledgerTransfers.ts +113 -0
- package/src/modules/finance-ledger/command/verifyTrialBalance.generated.ts +6 -0
- package/src/modules/finance-ledger/command/verifyTrialBalance.test.ts +136 -0
- package/src/modules/finance-ledger/command/verifyTrialBalance.ts +97 -0
- package/src/modules/finance-ledger/db/.gitkeep +0 -0
- package/src/modules/finance-ledger/db/accountingPeriod.ts +58 -0
- package/src/modules/finance-ledger/db/financialStatement.ts +92 -0
- package/src/modules/finance-ledger/db/financialStatementLineItem.ts +76 -0
- package/src/modules/finance-ledger/db/fiscalYear.ts +41 -0
- package/src/modules/finance-ledger/db/journalEntry.ts +101 -0
- package/src/modules/finance-ledger/db/journalLine.ts +64 -0
- package/src/modules/finance-ledger/db/periodClose.ts +97 -0
- package/src/modules/finance-ledger/db/trialBalance.ts +63 -0
- package/src/modules/finance-ledger/db/trialBalanceLine.ts +63 -0
- package/src/modules/finance-ledger/docs/commands/AddJournalLine.md +74 -0
- package/src/modules/finance-ledger/docs/commands/ApproveAndLockPeriod.md +53 -0
- package/src/modules/finance-ledger/docs/commands/BeginClose.md +47 -0
- package/src/modules/finance-ledger/docs/commands/ClosePeriod.md +45 -0
- package/src/modules/finance-ledger/docs/commands/CreateAccountingPeriod.md +69 -0
- package/src/modules/finance-ledger/docs/commands/CreateFiscalYear.md +56 -0
- package/src/modules/finance-ledger/docs/commands/CreateJournalEntry.md +63 -0
- package/src/modules/finance-ledger/docs/commands/DeleteAccountingPeriod.md +46 -0
- package/src/modules/finance-ledger/docs/commands/DeleteFiscalYear.md +40 -0
- package/src/modules/finance-ledger/docs/commands/DeleteJournalEntry.md +44 -0
- package/src/modules/finance-ledger/docs/commands/ExecuteYearEndClose.md +81 -0
- package/src/modules/finance-ledger/docs/commands/FinalCloseAndLockPeriod.md +49 -0
- package/src/modules/finance-ledger/docs/commands/FinalizeFinancialStatement.md +43 -0
- package/src/modules/finance-ledger/docs/commands/GenerateFinancialStatement.md +86 -0
- package/src/modules/finance-ledger/docs/commands/GeneratePreliminaryStatements.md +53 -0
- package/src/modules/finance-ledger/docs/commands/GenerateTrialBalance.md +75 -0
- package/src/modules/finance-ledger/docs/commands/InitiatePeriodClose.md +58 -0
- package/src/modules/finance-ledger/docs/commands/OpenForAdvanceEntry.md +44 -0
- package/src/modules/finance-ledger/docs/commands/OpenPeriod.md +45 -0
- package/src/modules/finance-ledger/docs/commands/PermanentlyClosePeriod.md +45 -0
- package/src/modules/finance-ledger/docs/commands/PostAdjustingEntries.md +61 -0
- package/src/modules/finance-ledger/docs/commands/PostJournalEntry.md +81 -0
- package/src/modules/finance-ledger/docs/commands/ProcessInventoryHandoff.md +72 -0
- package/src/modules/finance-ledger/docs/commands/ProcessManufacturingHandoff.md +68 -0
- package/src/modules/finance-ledger/docs/commands/ProcessPurchaseHandoff.md +68 -0
- package/src/modules/finance-ledger/docs/commands/ProcessSalesHandoff.md +71 -0
- package/src/modules/finance-ledger/docs/commands/RegenerateFinancialStatement.md +60 -0
- package/src/modules/finance-ledger/docs/commands/RemoveJournalLine.md +42 -0
- package/src/modules/finance-ledger/docs/commands/ReopenPeriod.md +45 -0
- package/src/modules/finance-ledger/docs/commands/ReverseJournalEntry.md +62 -0
- package/src/modules/finance-ledger/docs/commands/RevertSoftLock.md +49 -0
- package/src/modules/finance-ledger/docs/commands/UpdateFiscalYear.md +60 -0
- package/src/modules/finance-ledger/docs/commands/UpdateJournalEntry.md +50 -0
- package/src/modules/finance-ledger/docs/commands/UpdateJournalLine.md +61 -0
- package/src/modules/finance-ledger/docs/commands/VerifySubledgerTransfers.md +59 -0
- package/src/modules/finance-ledger/docs/commands/VerifyTrialBalance.md +53 -0
- package/src/modules/finance-ledger/docs/features/accounting-period-management.md +110 -0
- package/src/modules/finance-ledger/docs/features/financial-statement-generation.md +115 -0
- package/src/modules/finance-ledger/docs/features/journal-entry-management.md +138 -0
- package/src/modules/finance-ledger/docs/features/period-end-close.md +102 -0
- package/src/modules/finance-ledger/docs/features/subledger-integration.md +141 -0
- package/src/modules/finance-ledger/docs/features/trial-balance.md +99 -0
- package/src/modules/finance-ledger/docs/features/year-end-close.md +84 -0
- package/src/modules/finance-ledger/docs/models/AccountingPeriod.md +71 -0
- package/src/modules/finance-ledger/docs/models/FinancialStatement.md +76 -0
- package/src/modules/finance-ledger/docs/models/FinancialStatementLineItem.md +41 -0
- package/src/modules/finance-ledger/docs/models/FiscalYear.md +41 -0
- package/src/modules/finance-ledger/docs/models/JournalEntry.md +80 -0
- package/src/modules/finance-ledger/docs/models/JournalLine.md +47 -0
- package/src/modules/finance-ledger/docs/models/PeriodClose.md +83 -0
- package/src/modules/finance-ledger/docs/models/TrialBalance.md +56 -0
- package/src/modules/finance-ledger/docs/models/TrialBalanceLine.md +37 -0
- package/src/modules/finance-ledger/docs/queries/GetAccountingPeriod.md +35 -0
- package/src/modules/finance-ledger/docs/queries/GetFinancialStatement.md +38 -0
- package/src/modules/finance-ledger/docs/queries/GetFiscalYear.md +35 -0
- package/src/modules/finance-ledger/docs/queries/GetJournalEntry.md +37 -0
- package/src/modules/finance-ledger/docs/queries/GetPeriodByDate.md +38 -0
- package/src/modules/finance-ledger/docs/queries/GetPeriodClose.md +36 -0
- package/src/modules/finance-ledger/docs/queries/GetSubledgerTransferStatus.md +45 -0
- package/src/modules/finance-ledger/docs/queries/GetTrialBalance.md +38 -0
- package/src/modules/finance-ledger/docs/queries/ListAccountingPeriods.md +46 -0
- package/src/modules/finance-ledger/docs/queries/ListFinancialStatements.md +46 -0
- package/src/modules/finance-ledger/docs/queries/ListFiscalYears.md +42 -0
- package/src/modules/finance-ledger/docs/queries/ListJournalEntries.md +48 -0
- package/src/modules/finance-ledger/docs/queries/ListPeriodCloses.md +46 -0
- package/src/modules/finance-ledger/docs/queries/ListTrialBalances.md +51 -0
- package/src/modules/finance-ledger/executor/.gitkeep +0 -0
- package/src/modules/finance-ledger/generated/enums.ts +109 -0
- package/src/modules/finance-ledger/generated/kysely-tailordb.ts +202 -0
- package/src/modules/finance-ledger/index.ts +2 -0
- package/src/modules/finance-ledger/lib/_db_deps.ts +56 -0
- package/src/modules/finance-ledger/lib/errors.generated.ts +332 -0
- package/src/modules/finance-ledger/lib/permissions.generated.ts +41 -0
- package/src/modules/finance-ledger/lib/types.ts +66 -0
- package/src/modules/finance-ledger/module.ts +262 -0
- package/src/modules/finance-ledger/package.json +26 -0
- package/src/modules/finance-ledger/permissions.ts +3 -0
- package/src/modules/finance-ledger/query/.gitkeep +0 -0
- package/src/modules/finance-ledger/query/getAccountingPeriod.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getAccountingPeriod.test.ts +31 -0
- package/src/modules/finance-ledger/query/getAccountingPeriod.ts +21 -0
- package/src/modules/finance-ledger/query/getFinancialStatement.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getFinancialStatement.test.ts +35 -0
- package/src/modules/finance-ledger/query/getFinancialStatement.ts +29 -0
- package/src/modules/finance-ledger/query/getFiscalYear.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getFiscalYear.test.ts +31 -0
- package/src/modules/finance-ledger/query/getFiscalYear.ts +21 -0
- package/src/modules/finance-ledger/query/getJournalEntry.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getJournalEntry.test.ts +35 -0
- package/src/modules/finance-ledger/query/getJournalEntry.ts +29 -0
- package/src/modules/finance-ledger/query/getPeriodByDate.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getPeriodByDate.test.ts +53 -0
- package/src/modules/finance-ledger/query/getPeriodByDate.ts +27 -0
- package/src/modules/finance-ledger/query/getPeriodClose.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getPeriodClose.test.ts +31 -0
- package/src/modules/finance-ledger/query/getPeriodClose.ts +21 -0
- package/src/modules/finance-ledger/query/getSubledgerTransferStatus.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getSubledgerTransferStatus.test.ts +101 -0
- package/src/modules/finance-ledger/query/getSubledgerTransferStatus.ts +68 -0
- package/src/modules/finance-ledger/query/getTrialBalance.generated.ts +5 -0
- package/src/modules/finance-ledger/query/getTrialBalance.test.ts +33 -0
- package/src/modules/finance-ledger/query/getTrialBalance.ts +30 -0
- package/src/modules/finance-ledger/query/listAccountingPeriods.generated.ts +5 -0
- package/src/modules/finance-ledger/query/listAccountingPeriods.test.ts +81 -0
- package/src/modules/finance-ledger/query/listAccountingPeriods.ts +61 -0
- package/src/modules/finance-ledger/query/listFinancialStatements.generated.ts +5 -0
- package/src/modules/finance-ledger/query/listFinancialStatements.test.ts +76 -0
- package/src/modules/finance-ledger/query/listFinancialStatements.ts +62 -0
- package/src/modules/finance-ledger/query/listFiscalYears.generated.ts +5 -0
- package/src/modules/finance-ledger/query/listFiscalYears.test.ts +63 -0
- package/src/modules/finance-ledger/query/listFiscalYears.ts +45 -0
- package/src/modules/finance-ledger/query/listJournalEntries.generated.ts +5 -0
- package/src/modules/finance-ledger/query/listJournalEntries.test.ts +91 -0
- package/src/modules/finance-ledger/query/listJournalEntries.ts +64 -0
- package/src/modules/finance-ledger/query/listPeriodCloses.generated.ts +5 -0
- package/src/modules/finance-ledger/query/listPeriodCloses.test.ts +63 -0
- package/src/modules/finance-ledger/query/listPeriodCloses.ts +64 -0
- package/src/modules/finance-ledger/query/listTrialBalances.generated.ts +5 -0
- package/src/modules/finance-ledger/query/listTrialBalances.test.ts +78 -0
- package/src/modules/finance-ledger/query/listTrialBalances.ts +56 -0
- package/src/modules/finance-ledger/seed/index.ts +19 -0
- package/src/modules/finance-ledger/tailor.config.ts +13 -0
- package/src/modules/finance-ledger/tailor.d.ts +13 -0
- package/src/modules/finance-ledger/testing/commandTestUtils.ts +35 -0
- package/src/modules/finance-ledger/testing/fixtures.ts +382 -0
- package/src/modules/finance-ledger/tsconfig.json +16 -0
- package/src/modules/inventory/docs/features/inventory-adjustment.md +2 -1
- package/src/modules/inventory/docs/features/scrap-management.md +39 -1
- package/src/modules/manufacturing/README.md +63 -0
- package/src/modules/manufacturing/command/.gitkeep +0 -0
- package/src/modules/manufacturing/command/activateBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/activateBillOfMaterial.test.ts +166 -0
- package/src/modules/manufacturing/command/activateBillOfMaterial.ts +173 -0
- package/src/modules/manufacturing/command/activateRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/activateRouting.test.ts +152 -0
- package/src/modules/manufacturing/command/activateRouting.ts +92 -0
- package/src/modules/manufacturing/command/activateWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/activateWorkCenter.test.ts +135 -0
- package/src/modules/manufacturing/command/activateWorkCenter.ts +91 -0
- package/src/modules/manufacturing/command/cancelProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/cancelProductionOrder.test.ts +151 -0
- package/src/modules/manufacturing/command/cancelProductionOrder.ts +114 -0
- package/src/modules/manufacturing/command/closeProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/closeProductionOrder.test.ts +126 -0
- package/src/modules/manufacturing/command/closeProductionOrder.ts +87 -0
- package/src/modules/manufacturing/command/completeProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/completeProductionOrder.test.ts +132 -0
- package/src/modules/manufacturing/command/completeProductionOrder.ts +97 -0
- package/src/modules/manufacturing/command/completeWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/completeWorkOrder.test.ts +369 -0
- package/src/modules/manufacturing/command/completeWorkOrder.ts +212 -0
- package/src/modules/manufacturing/command/createBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/createBillOfMaterial.test.ts +210 -0
- package/src/modules/manufacturing/command/createBillOfMaterial.ts +176 -0
- package/src/modules/manufacturing/command/createProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/createProductionOrder.test.ts +160 -0
- package/src/modules/manufacturing/command/createProductionOrder.ts +129 -0
- package/src/modules/manufacturing/command/createRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/createRouting.test.ts +168 -0
- package/src/modules/manufacturing/command/createRouting.ts +128 -0
- package/src/modules/manufacturing/command/createWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/createWorkCenter.test.ts +148 -0
- package/src/modules/manufacturing/command/createWorkCenter.ts +131 -0
- package/src/modules/manufacturing/command/deactivateBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/deactivateBillOfMaterial.test.ts +103 -0
- package/src/modules/manufacturing/command/deactivateBillOfMaterial.ts +78 -0
- package/src/modules/manufacturing/command/deactivateRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/deactivateRouting.test.ts +112 -0
- package/src/modules/manufacturing/command/deactivateRouting.ts +76 -0
- package/src/modules/manufacturing/command/deactivateWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/deactivateWorkCenter.test.ts +113 -0
- package/src/modules/manufacturing/command/deactivateWorkCenter.ts +85 -0
- package/src/modules/manufacturing/command/pauseWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/pauseWorkOrder.test.ts +118 -0
- package/src/modules/manufacturing/command/pauseWorkOrder.ts +82 -0
- package/src/modules/manufacturing/command/recordInventoryIssueOutcome.generated.ts +6 -0
- package/src/modules/manufacturing/command/recordInventoryIssueOutcome.test.ts +183 -0
- package/src/modules/manufacturing/command/recordInventoryIssueOutcome.ts +139 -0
- package/src/modules/manufacturing/command/recordManufacturingCostSettlementAcknowledgment.generated.ts +6 -0
- package/src/modules/manufacturing/command/recordManufacturingCostSettlementAcknowledgment.test.ts +120 -0
- package/src/modules/manufacturing/command/recordManufacturingCostSettlementAcknowledgment.ts +110 -0
- package/src/modules/manufacturing/command/releaseProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/releaseProductionOrder.test.ts +220 -0
- package/src/modules/manufacturing/command/releaseProductionOrder.ts +450 -0
- package/src/modules/manufacturing/command/reopenProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/reopenProductionOrder.test.ts +196 -0
- package/src/modules/manufacturing/command/reopenProductionOrder.ts +98 -0
- package/src/modules/manufacturing/command/reportWorkOrderProgress.generated.ts +6 -0
- package/src/modules/manufacturing/command/reportWorkOrderProgress.test.ts +204 -0
- package/src/modules/manufacturing/command/reportWorkOrderProgress.ts +129 -0
- package/src/modules/manufacturing/command/rescheduleProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/rescheduleProductionOrder.test.ts +185 -0
- package/src/modules/manufacturing/command/rescheduleProductionOrder.ts +95 -0
- package/src/modules/manufacturing/command/resumeWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/resumeWorkOrder.test.ts +122 -0
- package/src/modules/manufacturing/command/resumeWorkOrder.ts +94 -0
- package/src/modules/manufacturing/command/reviewManufacturingCostSummary.generated.ts +6 -0
- package/src/modules/manufacturing/command/reviewManufacturingCostSummary.test.ts +231 -0
- package/src/modules/manufacturing/command/reviewManufacturingCostSummary.ts +137 -0
- package/src/modules/manufacturing/command/startWorkOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/startWorkOrder.test.ts +118 -0
- package/src/modules/manufacturing/command/startWorkOrder.ts +126 -0
- package/src/modules/manufacturing/command/technicallyCompleteProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/technicallyCompleteProductionOrder.test.ts +153 -0
- package/src/modules/manufacturing/command/technicallyCompleteProductionOrder.ts +106 -0
- package/src/modules/manufacturing/command/unreleaseProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/unreleaseProductionOrder.test.ts +140 -0
- package/src/modules/manufacturing/command/unreleaseProductionOrder.ts +131 -0
- package/src/modules/manufacturing/command/updateBillOfMaterial.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateBillOfMaterial.test.ts +149 -0
- package/src/modules/manufacturing/command/updateBillOfMaterial.ts +174 -0
- package/src/modules/manufacturing/command/updateProductionOrder.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateProductionOrder.test.ts +112 -0
- package/src/modules/manufacturing/command/updateProductionOrder.ts +145 -0
- package/src/modules/manufacturing/command/updateRouting.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateRouting.test.ts +211 -0
- package/src/modules/manufacturing/command/updateRouting.ts +124 -0
- package/src/modules/manufacturing/command/updateWorkCenter.generated.ts +6 -0
- package/src/modules/manufacturing/command/updateWorkCenter.test.ts +152 -0
- package/src/modules/manufacturing/command/updateWorkCenter.ts +137 -0
- package/src/modules/manufacturing/db/.gitkeep +0 -0
- package/src/modules/manufacturing/db/billOfMaterial.ts +70 -0
- package/src/modules/manufacturing/db/billOfMaterialLine.ts +49 -0
- package/src/modules/manufacturing/db/costVarianceLine.ts +53 -0
- package/src/modules/manufacturing/db/manufacturingCostLine.ts +35 -0
- package/src/modules/manufacturing/db/manufacturingCostSettlementRecord.ts +39 -0
- package/src/modules/manufacturing/db/manufacturingCostSummary.ts +59 -0
- package/src/modules/manufacturing/db/productionOrder.ts +83 -0
- package/src/modules/manufacturing/db/productionOrderBomSnapshot.ts +44 -0
- package/src/modules/manufacturing/db/productionOrderCostBaseline.ts +44 -0
- package/src/modules/manufacturing/db/productionOrderMaterialRequirement.ts +57 -0
- package/src/modules/manufacturing/db/productionOrderRoutingSnapshot.ts +43 -0
- package/src/modules/manufacturing/db/routing.ts +63 -0
- package/src/modules/manufacturing/db/routingOperation.ts +57 -0
- package/src/modules/manufacturing/db/workCenter.ts +87 -0
- package/src/modules/manufacturing/db/workOrder.ts +65 -0
- package/src/modules/manufacturing/db/workOrderExecutionEvent.ts +54 -0
- package/src/modules/manufacturing/docs/commands/ActivateBillOfMaterial.md +50 -0
- package/src/modules/manufacturing/docs/commands/ActivateRouting.md +48 -0
- package/src/modules/manufacturing/docs/commands/ActivateWorkCenter.md +49 -0
- package/src/modules/manufacturing/docs/commands/CancelProductionOrder.md +48 -0
- package/src/modules/manufacturing/docs/commands/CloseProductionOrder.md +46 -0
- package/src/modules/manufacturing/docs/commands/CompleteProductionOrder.md +48 -0
- package/src/modules/manufacturing/docs/commands/CompleteWorkOrder.md +66 -0
- package/src/modules/manufacturing/docs/commands/CreateBillOfMaterial.md +54 -0
- package/src/modules/manufacturing/docs/commands/CreateProductionOrder.md +49 -0
- package/src/modules/manufacturing/docs/commands/CreateRouting.md +50 -0
- package/src/modules/manufacturing/docs/commands/CreateWorkCenter.md +51 -0
- package/src/modules/manufacturing/docs/commands/DeactivateBillOfMaterial.md +45 -0
- package/src/modules/manufacturing/docs/commands/DeactivateRouting.md +45 -0
- package/src/modules/manufacturing/docs/commands/DeactivateWorkCenter.md +45 -0
- package/src/modules/manufacturing/docs/commands/PauseWorkOrder.md +44 -0
- package/src/modules/manufacturing/docs/commands/RecordInventoryIssueOutcome.md +59 -0
- package/src/modules/manufacturing/docs/commands/RecordManufacturingCostSettlementAcknowledgment.md +49 -0
- package/src/modules/manufacturing/docs/commands/ReleaseProductionOrder.md +57 -0
- package/src/modules/manufacturing/docs/commands/ReopenProductionOrder.md +54 -0
- package/src/modules/manufacturing/docs/commands/ReportWorkOrderProgress.md +53 -0
- package/src/modules/manufacturing/docs/commands/RescheduleProductionOrder.md +45 -0
- package/src/modules/manufacturing/docs/commands/ResumeWorkOrder.md +44 -0
- package/src/modules/manufacturing/docs/commands/ReviewManufacturingCostSummary.md +52 -0
- package/src/modules/manufacturing/docs/commands/StartWorkOrder.md +46 -0
- package/src/modules/manufacturing/docs/commands/TechnicallyCompleteProductionOrder.md +51 -0
- package/src/modules/manufacturing/docs/commands/UnreleaseProductionOrder.md +46 -0
- package/src/modules/manufacturing/docs/commands/UpdateBillOfMaterial.md +48 -0
- package/src/modules/manufacturing/docs/commands/UpdateProductionOrder.md +48 -0
- package/src/modules/manufacturing/docs/commands/UpdateRouting.md +52 -0
- package/src/modules/manufacturing/docs/commands/UpdateWorkCenter.md +48 -0
- package/src/modules/manufacturing/docs/features/bill-of-material-management.md +83 -0
- package/src/modules/manufacturing/docs/features/manufacturing-cost-and-variance.md +191 -0
- package/src/modules/manufacturing/docs/features/production-order-lifecycle.md +103 -0
- package/src/modules/manufacturing/docs/features/routing-and-work-center-definition.md +63 -0
- package/src/modules/manufacturing/docs/features/work-order-execution.md +115 -0
- package/src/modules/manufacturing/docs/models/BillOfMaterial.md +60 -0
- package/src/modules/manufacturing/docs/models/ManufacturingCostSummary.md +66 -0
- package/src/modules/manufacturing/docs/models/ProductionOrder.md +76 -0
- package/src/modules/manufacturing/docs/models/Routing.md +58 -0
- package/src/modules/manufacturing/docs/models/WorkCenter.md +56 -0
- package/src/modules/manufacturing/docs/models/WorkOrder.md +63 -0
- package/src/modules/manufacturing/docs/queries/DetectBillOfMaterialCircularReference.md +39 -0
- package/src/modules/manufacturing/docs/queries/ExplodeBillOfMaterial.md +56 -0
- package/src/modules/manufacturing/docs/queries/GetBillOfMaterial.md +37 -0
- package/src/modules/manufacturing/docs/queries/GetManufacturingCostSummary.md +39 -0
- package/src/modules/manufacturing/docs/queries/GetProductionOrder.md +37 -0
- package/src/modules/manufacturing/docs/queries/GetRouting.md +39 -0
- package/src/modules/manufacturing/docs/queries/GetWorkCenter.md +35 -0
- package/src/modules/manufacturing/docs/queries/GetWorkOrder.md +38 -0
- package/src/modules/manufacturing/docs/queries/ListBillOfMaterialsByItem.md +42 -0
- package/src/modules/manufacturing/docs/queries/ListManufacturingCostSummariesByStatus.md +41 -0
- package/src/modules/manufacturing/docs/queries/ListProductionOrdersByStatus.md +41 -0
- package/src/modules/manufacturing/docs/queries/ListRoutingsByItem.md +42 -0
- package/src/modules/manufacturing/docs/queries/ListWorkCentersBySite.md +38 -0
- package/src/modules/manufacturing/docs/queries/ListWorkOrdersByProductionOrder.md +39 -0
- package/src/modules/manufacturing/docs/queries/ListWorkOrdersByWorkCenter.md +43 -0
- package/src/modules/manufacturing/executor/.gitkeep +0 -0
- package/src/modules/manufacturing/generated/enums.ts +113 -0
- package/src/modules/manufacturing/generated/kysely-tailordb.ts +247 -0
- package/src/modules/manufacturing/index.ts +2 -0
- package/src/modules/manufacturing/lib/_db_deps.ts +22 -0
- package/src/modules/manufacturing/lib/errors.generated.ts +592 -0
- package/src/modules/manufacturing/lib/permissions.generated.ts +35 -0
- package/src/modules/manufacturing/lib/types.ts +111 -0
- package/src/modules/manufacturing/module.ts +226 -0
- package/src/modules/manufacturing/permissions.ts +3 -0
- package/src/modules/manufacturing/query/.gitkeep +0 -0
- package/src/modules/manufacturing/query/detectBillOfMaterialCircularReference.generated.ts +5 -0
- package/src/modules/manufacturing/query/detectBillOfMaterialCircularReference.test.ts +115 -0
- package/src/modules/manufacturing/query/detectBillOfMaterialCircularReference.ts +79 -0
- package/src/modules/manufacturing/query/explodeBillOfMaterial.generated.ts +5 -0
- package/src/modules/manufacturing/query/explodeBillOfMaterial.test.ts +445 -0
- package/src/modules/manufacturing/query/explodeBillOfMaterial.ts +306 -0
- package/src/modules/manufacturing/query/getBillOfMaterial.generated.ts +5 -0
- package/src/modules/manufacturing/query/getBillOfMaterial.test.ts +64 -0
- package/src/modules/manufacturing/query/getBillOfMaterial.ts +27 -0
- package/src/modules/manufacturing/query/getManufacturingCostSummary.generated.ts +5 -0
- package/src/modules/manufacturing/query/getManufacturingCostSummary.test.ts +147 -0
- package/src/modules/manufacturing/query/getManufacturingCostSummary.ts +46 -0
- package/src/modules/manufacturing/query/getProductionOrder.generated.ts +5 -0
- package/src/modules/manufacturing/query/getProductionOrder.test.ts +139 -0
- package/src/modules/manufacturing/query/getProductionOrder.ts +84 -0
- package/src/modules/manufacturing/query/getRouting.generated.ts +5 -0
- package/src/modules/manufacturing/query/getRouting.test.ts +71 -0
- package/src/modules/manufacturing/query/getRouting.ts +34 -0
- package/src/modules/manufacturing/query/getWorkCenter.generated.ts +5 -0
- package/src/modules/manufacturing/query/getWorkCenter.test.ts +37 -0
- package/src/modules/manufacturing/query/getWorkCenter.ts +21 -0
- package/src/modules/manufacturing/query/getWorkOrder.generated.ts +5 -0
- package/src/modules/manufacturing/query/getWorkOrder.test.ts +73 -0
- package/src/modules/manufacturing/query/getWorkOrder.ts +28 -0
- package/src/modules/manufacturing/query/listBillOfMaterialsByItem.generated.ts +5 -0
- package/src/modules/manufacturing/query/listBillOfMaterialsByItem.test.ts +107 -0
- package/src/modules/manufacturing/query/listBillOfMaterialsByItem.ts +58 -0
- package/src/modules/manufacturing/query/listManufacturingCostSummariesByStatus.generated.ts +5 -0
- package/src/modules/manufacturing/query/listManufacturingCostSummariesByStatus.test.ts +96 -0
- package/src/modules/manufacturing/query/listManufacturingCostSummariesByStatus.ts +77 -0
- package/src/modules/manufacturing/query/listProductionOrdersByStatus.generated.ts +5 -0
- package/src/modules/manufacturing/query/listProductionOrdersByStatus.test.ts +121 -0
- package/src/modules/manufacturing/query/listProductionOrdersByStatus.ts +83 -0
- package/src/modules/manufacturing/query/listRoutingsByItem.generated.ts +5 -0
- package/src/modules/manufacturing/query/listRoutingsByItem.test.ts +110 -0
- package/src/modules/manufacturing/query/listRoutingsByItem.ts +54 -0
- package/src/modules/manufacturing/query/listWorkCentersBySite.generated.ts +5 -0
- package/src/modules/manufacturing/query/listWorkCentersBySite.test.ts +81 -0
- package/src/modules/manufacturing/query/listWorkCentersBySite.ts +70 -0
- package/src/modules/manufacturing/query/listWorkOrdersByProductionOrder.generated.ts +5 -0
- package/src/modules/manufacturing/query/listWorkOrdersByProductionOrder.test.ts +102 -0
- package/src/modules/manufacturing/query/listWorkOrdersByProductionOrder.ts +53 -0
- package/src/modules/manufacturing/query/listWorkOrdersByWorkCenter.generated.ts +5 -0
- package/src/modules/manufacturing/query/listWorkOrdersByWorkCenter.test.ts +143 -0
- package/src/modules/manufacturing/query/listWorkOrdersByWorkCenter.ts +56 -0
- package/src/modules/manufacturing/seed/index.ts +19 -0
- package/src/modules/manufacturing/tailor.config.ts +13 -0
- package/src/modules/manufacturing/tailor.d.ts +13 -0
- package/src/modules/manufacturing/testing/commandTestUtils.ts +29 -0
- package/src/modules/manufacturing/testing/fixtures.ts +402 -0
- package/src/progress/schema.test.ts +161 -0
- package/src/progress/schema.ts +316 -0
- package/templates/scaffold/app/backend/package.json +7 -2
- package/templates/scaffold/app/backend/src/tests/utils/graphql-client.ts +66 -0
- package/templates/scaffold/app/backend/src/tests/utils/setup.ts +21 -0
- package/templates/scaffold/app/backend/tsconfig.json +9 -2
- package/templates/scaffold/app/backend/vitest.config.ts +18 -0
- package/templates/scaffold/app/frontend/package.json +2 -2
- package/src/generator/generate-stubs.ts +0 -31
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# JournalEntry
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
JournalEntry is the core transactional entity of the finance-ledger module, implementing double-entry bookkeeping for all financial postings. A journal entry consists of a header record carrying the entry date, journal type, reference number, status, posting period, description, and optional source document reference, along with one or more JournalLine records. Every journal entry must satisfy the fundamental accounting constraint: total debits must equal total credits in the functional currency before it can be posted. Journal entries follow a lifecycle of DRAFT to POSTED, with posted entries eligible for reversal via a mirror entry that produces a REVERSED status on the original. The feature supports nine journal types (Sales, Purchase, Cash, Bank, Miscellaneous, Opening, Closing, Inventory, Manufacturing) to categorize entries by their business origin.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> Draft: createJournalEntry
|
|
18
|
+
Draft --> Draft: updateJournalEntry / addJournalLine / updateJournalLine / removeJournalLine
|
|
19
|
+
Draft --> Posted: postJournalEntry
|
|
20
|
+
Posted --> Reversed: reverseJournalEntry
|
|
21
|
+
Draft --> [*]: deleteJournalEntry
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Command Definitions
|
|
25
|
+
|
|
26
|
+
- [createJournalEntry](../commands/CreateJournalEntry.md) - Create a new journal entry in DRAFT status
|
|
27
|
+
- [updateJournalEntry](../commands/UpdateJournalEntry.md) - Update mutable fields of a DRAFT journal entry
|
|
28
|
+
- [deleteJournalEntry](../commands/DeleteJournalEntry.md) - Delete a DRAFT journal entry and all associated lines
|
|
29
|
+
- [addJournalLine](../commands/AddJournalLine.md) - Add a journal line to a DRAFT journal entry
|
|
30
|
+
- [updateJournalLine](../commands/UpdateJournalLine.md) - Update a journal line on a DRAFT journal entry
|
|
31
|
+
- [removeJournalLine](../commands/RemoveJournalLine.md) - Remove a journal line from a DRAFT journal entry
|
|
32
|
+
- [postJournalEntry](../commands/PostJournalEntry.md) - Post a balanced DRAFT journal entry to the general ledger
|
|
33
|
+
- [reverseJournalEntry](../commands/ReverseJournalEntry.md) - Reverse a posted journal entry via a mirror entry
|
|
34
|
+
- [processPurchaseHandoff](../commands/ProcessPurchaseHandoff.md) - Process a purchase subledger handoff event into a journal entry
|
|
35
|
+
- [processSalesHandoff](../commands/ProcessSalesHandoff.md) - Process a sales subledger handoff event into a journal entry
|
|
36
|
+
- [processInventoryHandoff](../commands/ProcessInventoryHandoff.md) - Process an inventory subledger handoff event into a journal entry
|
|
37
|
+
- [processManufacturingHandoff](../commands/ProcessManufacturingHandoff.md) - Process a manufacturing subledger handoff event into a journal entry
|
|
38
|
+
|
|
39
|
+
### Query Definitions
|
|
40
|
+
|
|
41
|
+
- [GetJournalEntry](../queries/GetJournalEntry.md) - Retrieve a journal entry by id with all lines
|
|
42
|
+
- [ListJournalEntries](../queries/ListJournalEntries.md) - List journal entries with filters (period, type, status, date range)
|
|
43
|
+
|
|
44
|
+
### Models
|
|
45
|
+
|
|
46
|
+
- JournalEntry
|
|
47
|
+
- JournalLine
|
|
48
|
+
|
|
49
|
+
### Invariants
|
|
50
|
+
|
|
51
|
+
- Journal entries can only be created in DRAFT status
|
|
52
|
+
- Journal entry requires a valid journal type (SALES, PURCHASE, CASH, BANK, MISCELLANEOUS, OPENING, CLOSING, INVENTORY, MANUFACTURING)
|
|
53
|
+
- Journal entry requires a valid entry date
|
|
54
|
+
- Journal entry requires a reference number that is unique within the company scope
|
|
55
|
+
- Journal entry must reference a valid companyId; the company must be in ACTIVE status
|
|
56
|
+
- Journal entry must reference a valid accounting period; the period must be in OPEN or FUTURE_ENTERABLE status for posting
|
|
57
|
+
- Journal entry description is optional and can be updated while in DRAFT status
|
|
58
|
+
- Source document reference is optional and can be set on creation or update in DRAFT status
|
|
59
|
+
- A journal entry must have at least two journal lines before it can be posted
|
|
60
|
+
- Total debits must equal total credits in the functional currency for posting to succeed
|
|
61
|
+
- Posted journal entries cannot be modified (no field updates, no line additions or removals)
|
|
62
|
+
- Posted journal entries cannot be deleted; only reversal is permitted
|
|
63
|
+
- DRAFT journal entries can be deleted; deletion removes all associated journal lines
|
|
64
|
+
- Reversing a posted entry creates a new journal entry with all debit/credit amounts inverted
|
|
65
|
+
- The reversal entry references the original entry and is automatically posted
|
|
66
|
+
- The original entry status transitions from POSTED to REVERSED upon successful reversal
|
|
67
|
+
- Reversing an entry that is already REVERSED fails
|
|
68
|
+
- The reversal entry must target a period that is in OPEN or FUTURE_ENTERABLE status
|
|
69
|
+
- Journal type and entry date cannot be changed after the entry is posted
|
|
70
|
+
- Adjusting entries created during period-end close must have a valid adjustingEntryType (ACCRUAL, DEFERRAL, or RECLASSIFICATION)
|
|
71
|
+
- Posting a journal entry to a CLOSED, PERMANENTLY_CLOSED, or NEVER_OPENED period is rejected
|
|
72
|
+
- Balance validation for multi-currency entries is performed on the functional currency amounts, not the foreign currency amounts
|
|
73
|
+
- All journal entry lifecycle operations emit audit events via the audit module recording the acting user, timestamp, and field-level details
|
|
74
|
+
|
|
75
|
+
### Relationships
|
|
76
|
+
|
|
77
|
+
- **References Company**: Each journal entry is scoped to a Company via companyId (organization module)
|
|
78
|
+
- **References AccountingPeriod**: Each journal entry references an AccountingPeriod via accountingPeriodId
|
|
79
|
+
- **Has Many JournalLine**: A journal entry contains one or more journal lines
|
|
80
|
+
- **References JournalEntry (reversal)**: A reversal entry references the original via reversalOfId
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# JournalLine
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
JournalLine represents a single debit or credit entry within a JournalEntry. Each line references a GL account from the coa-management module, specifies either a debit or credit amount (mutually exclusive), includes an optional line-level description, and optionally includes foreign currency details (currency code, exchange rate) with computed functional currency amounts. Journal lines are the atomic units of double-entry bookkeeping — they are always created, modified, and deleted in the context of their parent journal entry's lifecycle. Lines on a POSTED or REVERSED journal entry are immutable.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Standard
|
|
12
|
+
|
|
13
|
+
### Command Definitions
|
|
14
|
+
|
|
15
|
+
- [addJournalLine](../commands/AddJournalLine.md) - Add a journal line to a DRAFT journal entry
|
|
16
|
+
- [updateJournalLine](../commands/UpdateJournalLine.md) - Update a journal line on a DRAFT journal entry
|
|
17
|
+
- [removeJournalLine](../commands/RemoveJournalLine.md) - Remove a journal line from a DRAFT journal entry
|
|
18
|
+
|
|
19
|
+
### Query Definitions
|
|
20
|
+
|
|
21
|
+
- [GetJournalEntry](../queries/GetJournalEntry.md) - Journal lines are returned as part of the parent journal entry
|
|
22
|
+
|
|
23
|
+
### Models
|
|
24
|
+
|
|
25
|
+
- JournalLine
|
|
26
|
+
|
|
27
|
+
### Invariants
|
|
28
|
+
|
|
29
|
+
- Each journal line must reference a valid GL account from an ACTIVE Chart of Accounts
|
|
30
|
+
- Each journal line must specify either a debit amount or a credit amount (not both, and not zero for both)
|
|
31
|
+
- Debit and credit amounts must be positive values
|
|
32
|
+
- Multi-currency journal lines must specify a currency code and exchange rate
|
|
33
|
+
- The functional currency amount is computed as the foreign amount multiplied by the exchange rate
|
|
34
|
+
- Journal lines without an explicit currency default to the company's functional (base) currency with an exchange rate of 1.0
|
|
35
|
+
- Journal lines referencing an inactive or draft GL account are rejected at posting time
|
|
36
|
+
- Journal lines referencing a deprecated GL account with a successor mapping are redirected to the successor account at posting time
|
|
37
|
+
- If the successor account is itself inactive or deprecated without a further successor, the posting is rejected
|
|
38
|
+
- Journal lines can only be added to, updated on, or removed from a DRAFT journal entry
|
|
39
|
+
- Balance validation for multi-currency entries is performed on the functional currency amounts, not the foreign currency amounts
|
|
40
|
+
- Line-level description is optional and can be updated while the parent journal entry is in DRAFT status
|
|
41
|
+
- RECEIVABLE and PAYABLE classified accounts block direct manual journal postings (control account constraint)
|
|
42
|
+
|
|
43
|
+
### Relationships
|
|
44
|
+
|
|
45
|
+
- **References JournalEntry**: Each journal line belongs to a JournalEntry via journalEntryId
|
|
46
|
+
- **References Account**: Each journal line references a GL Account via accountId (coa-management module)
|
|
47
|
+
- **References Currency**: Each journal line optionally references a Currency via currencyCode for multi-currency postings (primitives module)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# PeriodClose
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
PeriodClose is a checklist-driven workflow entity that tracks the process of transitioning an accounting period from open to permanently closed. Each close operation is scoped to a single AccountingPeriod and follows a deterministic sequence of steps: initiation, subledger transfer verification, adjusting entry posting, trial balance verification, preliminary statement generation, review and approval, soft lock, and final permanent close. The entity records the initiating user, completion percentage, and current status. For the final period of a fiscal year, the close process extends to include year-end close steps (closing temporary accounts to retained earnings and generating opening balances for the new fiscal year).
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> NotStarted: initiatePeriodClose
|
|
18
|
+
NotStarted --> InProgress: beginClose
|
|
19
|
+
InProgress --> SubledgersVerified: verifySubledgerTransfers
|
|
20
|
+
SubledgersVerified --> AdjustmentsPosted: postAdjustingEntries
|
|
21
|
+
AdjustmentsPosted --> TrialBalanceVerified: verifyTrialBalance
|
|
22
|
+
TrialBalanceVerified --> UnderReview: generatePreliminaryStatements
|
|
23
|
+
UnderReview --> SoftLocked: approveAndLockPeriod
|
|
24
|
+
SoftLocked --> InProgress: revertSoftLock
|
|
25
|
+
SoftLocked --> PermanentlyClosed: finalCloseAndLockPeriod
|
|
26
|
+
PermanentlyClosed --> [*]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Command Definitions
|
|
30
|
+
|
|
31
|
+
- [initiatePeriodClose](../commands/InitiatePeriodClose.md) - Initiate the period close process for an accounting period
|
|
32
|
+
- [beginClose](../commands/BeginClose.md) - Begin the close checklist, transitioning from NOT_STARTED to IN_PROGRESS
|
|
33
|
+
- [verifySubledgerTransfers](../commands/VerifySubledgerTransfers.md) - Verify all subledger modules have transferred transactions to GL
|
|
34
|
+
- [postAdjustingEntries](../commands/PostAdjustingEntries.md) - Confirm adjusting entries (accruals, deferrals, reclassifications) are posted
|
|
35
|
+
- [verifyTrialBalance](../commands/VerifyTrialBalance.md) - Verify the period's trial balance is balanced
|
|
36
|
+
- [generatePreliminaryStatements](../commands/GeneratePreliminaryStatements.md) - Generate preliminary financial statements for review
|
|
37
|
+
- [approveAndLockPeriod](../commands/ApproveAndLockPeriod.md) - Approve and soft-lock the period
|
|
38
|
+
- [revertSoftLock](../commands/RevertSoftLock.md) - Revert a soft-locked period back to IN_PROGRESS
|
|
39
|
+
- [finalCloseAndLockPeriod](../commands/FinalCloseAndLockPeriod.md) - Permanently close the period (irreversible)
|
|
40
|
+
- [executeYearEndClose](../commands/ExecuteYearEndClose.md) - Execute year-end close: close temporary accounts to retained earnings and generate opening balances
|
|
41
|
+
|
|
42
|
+
### Query Definitions
|
|
43
|
+
|
|
44
|
+
- [GetPeriodClose](../queries/GetPeriodClose.md) - Retrieve the period close record for an accounting period
|
|
45
|
+
- [ListPeriodCloses](../queries/ListPeriodCloses.md) - List period close records for a fiscal year or company with optional status filter
|
|
46
|
+
- [GetSubledgerTransferStatus](../queries/GetSubledgerTransferStatus.md) - Retrieve subledger transfer completeness status for an accounting period
|
|
47
|
+
|
|
48
|
+
### Models
|
|
49
|
+
|
|
50
|
+
- PeriodClose
|
|
51
|
+
|
|
52
|
+
### Invariants
|
|
53
|
+
|
|
54
|
+
- PeriodClose can only be initiated for an AccountingPeriod that is in OPEN status
|
|
55
|
+
- PeriodClose cannot be initiated for a period that already has an active close in progress
|
|
56
|
+
- PeriodClose lifecycle follows NOT_STARTED → IN_PROGRESS → SUBLEDGERS_VERIFIED → ADJUSTMENTS_POSTED → TRIAL_BALANCE_VERIFIED → UNDER_REVIEW → SOFT_LOCKED → PERMANENTLY_CLOSED
|
|
57
|
+
- PeriodClose cannot skip steps; each transition requires the previous step to be completed
|
|
58
|
+
- Subledger verification fails if any registered subledger module has pending unposted transactions for the period
|
|
59
|
+
- Trial balance verification fails if the period's trial balance has a non-zero difference between total debits and credits
|
|
60
|
+
- Approval step requires a user with the appropriate authorization role (controller or finance manager)
|
|
61
|
+
- Soft-locking prevents the accounting team from posting new journal entries to the period
|
|
62
|
+
- Soft-locked period still allows postings from users with the advisor/auditor role
|
|
63
|
+
- Permanently closing a period makes it fully immutable; no further journal entries can be posted regardless of role
|
|
64
|
+
- Reverting a soft-locked period to IN_PROGRESS is permitted only before permanent close
|
|
65
|
+
- Reverting a permanently closed period is not permitted
|
|
66
|
+
- Each period has at most one active PeriodClose record
|
|
67
|
+
- Concurrent close attempts for the same period are rejected with a conflict error
|
|
68
|
+
- Year-end close can only be initiated for the final period of a fiscal year
|
|
69
|
+
- Year-end close requires the standard close checklist to be completed through the soft-lock stage
|
|
70
|
+
- Year-end close generates a closing journal entry zeroing temporary accounts to retained earnings
|
|
71
|
+
- Year-end close generates opening balance entries for the first period of the new fiscal year
|
|
72
|
+
- Year-end close fails if no retained earnings account exists in the active CoA
|
|
73
|
+
- Year-end close cannot be run twice for the same fiscal year
|
|
74
|
+
- PeriodClose tracks a completionPercentage that increments as each checklist step is completed
|
|
75
|
+
- PeriodClose records the userId of the operator who initiated the close and the userId who completed each checklist step
|
|
76
|
+
- Each state transition emits an audit event recording the acting user, timestamp, previous status, and new status
|
|
77
|
+
|
|
78
|
+
### Relationships
|
|
79
|
+
|
|
80
|
+
- **References AccountingPeriod**: Each PeriodClose is linked to an AccountingPeriod via accountingPeriodId
|
|
81
|
+
- **References FiscalYear**: The associated AccountingPeriod's fiscal year determines year-end close eligibility (via AccountingPeriod.fiscalYearId)
|
|
82
|
+
- **References User**: Records the initiating user via initiatedByUserId (user-management module)
|
|
83
|
+
- **References Account (retained earnings)**: Year-end close references the retained earnings account from the active CoA for closing temporary accounts
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# TrialBalance
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
TrialBalance is a point-in-time snapshot report that summarizes the balances of all GL accounts for a specific accounting period within a company. For each account, the report presents the opening balance, total period debits, total period credits, and the resulting closing balance via TrialBalanceLine records. The trial balance serves as the fundamental verification mechanism in double-entry bookkeeping: total debits across all accounts must equal total credits. The report supports two variants: pre-close (reflecting standard and adjusting entries) and post-close (reflecting closing entries that zero out temporary accounts). The trial balance is the foundational input for financial statement generation.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Standard
|
|
12
|
+
|
|
13
|
+
### Command Definitions
|
|
14
|
+
|
|
15
|
+
- [generateTrialBalance](../commands/GenerateTrialBalance.md) - Generate a trial balance snapshot for a company, period, and variant
|
|
16
|
+
|
|
17
|
+
### Query Definitions
|
|
18
|
+
|
|
19
|
+
- [GetTrialBalance](../queries/GetTrialBalance.md) - Retrieve a trial balance snapshot by id with all line items
|
|
20
|
+
- [ListTrialBalances](../queries/ListTrialBalances.md) - List trial balance snapshots for a company with optional filters (period, variant)
|
|
21
|
+
|
|
22
|
+
### Models
|
|
23
|
+
|
|
24
|
+
- TrialBalance
|
|
25
|
+
- TrialBalanceLine
|
|
26
|
+
|
|
27
|
+
### Invariants
|
|
28
|
+
|
|
29
|
+
- Trial balance can only be generated for a company with an ACTIVE Chart of Accounts
|
|
30
|
+
- Trial balance can only be generated for a valid accounting period that exists in the system
|
|
31
|
+
- Trial balance must include all GL accounts from the active CoA, even those with zero balances
|
|
32
|
+
- Opening balance for each account equals the closing balance from the immediately preceding period
|
|
33
|
+
- Opening balance for the first period of a new CoA defaults to zero for all accounts
|
|
34
|
+
- Period debits per account equal the sum of all debit amounts from posted journal lines for that account in the period
|
|
35
|
+
- Period credits per account equal the sum of all credit amounts from posted journal lines for that account in the period
|
|
36
|
+
- Closing balance per account equals opening balance plus period debits minus period credits
|
|
37
|
+
- Total debits across all accounts must equal total credits across all accounts (fundamental equilibrium check)
|
|
38
|
+
- Pre-close trial balance excludes closing entries
|
|
39
|
+
- Post-close trial balance includes all closing entries and shows zero balances for all temporary accounts
|
|
40
|
+
- Trial balance is scoped to a single company; accounts from other companies are never included
|
|
41
|
+
- Only posted journal entries are included; draft or voided entries are excluded
|
|
42
|
+
- Trial balance snapshot includes a generation timestamp
|
|
43
|
+
- Trial balance snapshot records the variant type (PRE_CLOSE or POST_CLOSE)
|
|
44
|
+
- Generating a trial balance when total debits do not equal total credits produces an imbalance error with the discrepancy amount
|
|
45
|
+
- Trial balance respects the account group hierarchy from coa-management, providing subtotals at each group level
|
|
46
|
+
- Trial balance accounts are ordered by account code in ascending order within each account group
|
|
47
|
+
- Generating a trial balance for a period with no posted journal entries produces a valid report with zero debits, zero credits, and opening balances carried forward
|
|
48
|
+
- Regenerating a trial balance for the same period and variant produces an updated snapshot reflecting any new postings since the last generation
|
|
49
|
+
- Trial balance generation emits an audit event via the audit module recording the acting user, company, period, variant, and timestamp
|
|
50
|
+
|
|
51
|
+
### Relationships
|
|
52
|
+
|
|
53
|
+
- **References Company**: Each trial balance is scoped to a Company via companyId (organization module)
|
|
54
|
+
- **References AccountingPeriod**: Each trial balance references an AccountingPeriod via accountingPeriodId
|
|
55
|
+
- **References ChartOfAccounts**: Each trial balance references a ChartOfAccounts via chartOfAccountsId (coa-management module)
|
|
56
|
+
- **Has Many TrialBalanceLine**: A trial balance contains line items for each account
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# TrialBalanceLine
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
TrialBalanceLine represents a single account's balance within a TrialBalance snapshot. Each line records the account reference, optional account group for hierarchical aggregation, opening balance, period debits, period credits, and computed closing balance. Lines are always created as part of trial balance generation and are immutable once the snapshot is produced.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Standard
|
|
12
|
+
|
|
13
|
+
### Command Definitions
|
|
14
|
+
|
|
15
|
+
- [generateTrialBalance](../commands/GenerateTrialBalance.md) - Trial balance lines are created as part of trial balance generation
|
|
16
|
+
|
|
17
|
+
### Query Definitions
|
|
18
|
+
|
|
19
|
+
- [GetTrialBalance](../queries/GetTrialBalance.md) - Trial balance lines are returned as part of the parent trial balance
|
|
20
|
+
|
|
21
|
+
### Models
|
|
22
|
+
|
|
23
|
+
- TrialBalanceLine
|
|
24
|
+
|
|
25
|
+
### Invariants
|
|
26
|
+
|
|
27
|
+
- Each trial balance line must reference a valid GL account from the active CoA
|
|
28
|
+
- Opening balance equals the closing balance from the immediately preceding period for the same account
|
|
29
|
+
- Closing balance equals opening balance plus period debits minus period credits
|
|
30
|
+
- Lines are ordered by account code in ascending order within each account group
|
|
31
|
+
- Lines are immutable once generated as part of a trial balance snapshot
|
|
32
|
+
|
|
33
|
+
### Relationships
|
|
34
|
+
|
|
35
|
+
- **References TrialBalance**: Each line belongs to a TrialBalance via trialBalanceId
|
|
36
|
+
- **References Account**: Each line references a GL Account via accountId (coa-management module)
|
|
37
|
+
- **References AccountGroup**: Each line optionally references an AccountGroup via accountGroupId (coa-management module)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# GetAccountingPeriod
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetAccountingPeriod retrieves a single accounting period record by id. The period record includes the period name, companyId, fiscalYearId, start date, end date, period type, and current status. This serves as the core period lookup for posting validation, period lifecycle management, and close workflows.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Accepts a single lookup parameter: `{ id }`
|
|
10
|
+
- Returns the full accounting period record including all fields (id, companyId, fiscalYearId, periodName, startDate, endDate, periodType, status, timestamps)
|
|
11
|
+
- Returns null if no matching accounting period is found
|
|
12
|
+
- Lookup is an exact match on id
|
|
13
|
+
|
|
14
|
+
## Process Flow
|
|
15
|
+
|
|
16
|
+
```mermaid
|
|
17
|
+
flowchart TD
|
|
18
|
+
A[Receive input with id] --> B[SELECT from AccountingPeriod where id = input.id]
|
|
19
|
+
B --> C{Period found?}
|
|
20
|
+
C -->|Yes| D[Return accounting period record]
|
|
21
|
+
C -->|No| E[Return null]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## External Dependencies
|
|
25
|
+
|
|
26
|
+
- None
|
|
27
|
+
|
|
28
|
+
## Error Scenarios
|
|
29
|
+
|
|
30
|
+
- **ACCOUNTING_PERIOD_NOT_FOUND**: No accounting period matches the given id — caller receives null
|
|
31
|
+
|
|
32
|
+
## Test Cases
|
|
33
|
+
|
|
34
|
+
- returns accounting period when found by id
|
|
35
|
+
- returns null when not found
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# GetFinancialStatement
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetFinancialStatement retrieves a single financial statement record by id, including all line items. The financial statement record contains the generation parameters (companyId, statement type, reporting date or date range, method for cash flow, status) and the full list of line items organized by account group sections. This query supports statement review, finalization workflows, and audit evidence retrieval.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Accepts a single lookup parameter: `{ id }`
|
|
10
|
+
- Returns the full financial statement record including all line items
|
|
11
|
+
- Line items are structured according to the account group hierarchy from coa-management, with section headings and subtotals
|
|
12
|
+
- Statement types include BALANCE_SHEET, PROFIT_AND_LOSS, and CASH_FLOW
|
|
13
|
+
- Returns null if no matching financial statement is found
|
|
14
|
+
- Lookup is an exact match on id
|
|
15
|
+
|
|
16
|
+
## Process Flow
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart TD
|
|
20
|
+
A[Receive input with id] --> B[SELECT from FinancialStatement where id = input.id]
|
|
21
|
+
B --> C{Financial statement found?}
|
|
22
|
+
C -->|Yes| D[Load all associated line items]
|
|
23
|
+
D --> E[Return financial statement with line items]
|
|
24
|
+
C -->|No| F[Return null]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## External Dependencies
|
|
28
|
+
|
|
29
|
+
- None
|
|
30
|
+
|
|
31
|
+
## Error Scenarios
|
|
32
|
+
|
|
33
|
+
- **FINANCIAL_STATEMENT_NOT_FOUND**: No financial statement matches the given id — caller receives null
|
|
34
|
+
|
|
35
|
+
## Test Cases
|
|
36
|
+
|
|
37
|
+
- returns financial statement with line items when found by id
|
|
38
|
+
- returns null with empty line items when not found
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# GetFiscalYear
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetFiscalYear retrieves a single fiscal year record by id. The fiscal year contains the year name, companyId, start date, end date, and status. This serves as the core fiscal year lookup for period management, year-end close workflows, and calendar structure validation.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Accepts a single lookup parameter: `{ id }`
|
|
10
|
+
- Returns the full fiscal year record including all fields (id, companyId, yearName, startDate, endDate, status, timestamps)
|
|
11
|
+
- Returns null if no matching fiscal year is found
|
|
12
|
+
- Lookup is an exact match on id
|
|
13
|
+
|
|
14
|
+
## Process Flow
|
|
15
|
+
|
|
16
|
+
```mermaid
|
|
17
|
+
flowchart TD
|
|
18
|
+
A[Receive input with id] --> B[SELECT from FiscalYear where id = input.id]
|
|
19
|
+
B --> C{Fiscal year found?}
|
|
20
|
+
C -->|Yes| D[Return fiscal year record]
|
|
21
|
+
C -->|No| E[Return null]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## External Dependencies
|
|
25
|
+
|
|
26
|
+
- None
|
|
27
|
+
|
|
28
|
+
## Error Scenarios
|
|
29
|
+
|
|
30
|
+
- **FISCAL_YEAR_NOT_FOUND**: No fiscal year matches the given id — caller receives null
|
|
31
|
+
|
|
32
|
+
## Test Cases
|
|
33
|
+
|
|
34
|
+
- returns fiscal year when found by id
|
|
35
|
+
- returns null when not found
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# GetJournalEntry
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetJournalEntry retrieves a single journal entry record by id, including all associated journal lines. The journal entry record contains the header fields (entry date, journal type, reference number, status, accounting period, description, source document reference) and the full list of journal lines (GL account, debit/credit amounts, currency, exchange rate, functional currency amount, line description). This is the primary query for viewing journal entry details, audit review, and reversal workflows.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Accepts a single lookup parameter: `{ id }`
|
|
10
|
+
- Returns the full journal entry record including all header fields and all associated journal lines
|
|
11
|
+
- Journal lines include account references, debit and credit amounts, currency details, and line descriptions
|
|
12
|
+
- Returns null if no matching journal entry is found
|
|
13
|
+
- Lookup is an exact match on id
|
|
14
|
+
|
|
15
|
+
## Process Flow
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart TD
|
|
19
|
+
A[Receive input with id] --> B[SELECT from JournalEntry where id = input.id]
|
|
20
|
+
B --> C{Journal entry found?}
|
|
21
|
+
C -->|Yes| D[Load all associated JournalLine records]
|
|
22
|
+
D --> E[Return journal entry with lines]
|
|
23
|
+
C -->|No| F[Return null]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## External Dependencies
|
|
27
|
+
|
|
28
|
+
- None
|
|
29
|
+
|
|
30
|
+
## Error Scenarios
|
|
31
|
+
|
|
32
|
+
- **JOURNAL_ENTRY_NOT_FOUND**: No journal entry matches the given id — caller receives null
|
|
33
|
+
|
|
34
|
+
## Test Cases
|
|
35
|
+
|
|
36
|
+
- returns journal entry with journal lines when found by id
|
|
37
|
+
- returns null with empty journal lines when not found
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# GetPeriodByDate
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetPeriodByDate finds the accounting period that contains a given date for a specific company. It looks up the operating period where the date falls between startDate and endDate (inclusive). This query is the primary mechanism used by upstream modules (purchase, sales, inventory, manufacturing) to determine which accounting period a transaction date maps to and whether posting is permitted.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Requires `companyId` and `date` as input parameters
|
|
10
|
+
- Searches for an accounting period where `startDate <= date <= endDate` and `periodType = OPERATING`
|
|
11
|
+
- Only OPERATING periods are returned; ADJUSTMENT periods are excluded from date-based lookup
|
|
12
|
+
- Returns the full accounting period record including status, enabling callers to check posting eligibility
|
|
13
|
+
- Returns null if no operating period covers the given date (e.g., date falls outside all defined fiscal year boundaries)
|
|
14
|
+
- If multiple periods could theoretically match (should not occur with properly configured non-overlapping periods), the query returns the first match
|
|
15
|
+
|
|
16
|
+
## Process Flow
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart TD
|
|
20
|
+
A[Receive input with companyId and date] --> B[SELECT from AccountingPeriod where companyId = input.companyId AND startDate <= input.date AND endDate >= input.date AND periodType = OPERATING]
|
|
21
|
+
B --> C{Period found?}
|
|
22
|
+
C -->|Yes| D[Return accounting period record]
|
|
23
|
+
C -->|No| E[Return null]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## External Dependencies
|
|
27
|
+
|
|
28
|
+
- None
|
|
29
|
+
|
|
30
|
+
## Error Scenarios
|
|
31
|
+
|
|
32
|
+
- **PERIOD_NOT_FOUND**: No operating period covers the given date for the specified company — caller receives null
|
|
33
|
+
|
|
34
|
+
## Test Cases
|
|
35
|
+
|
|
36
|
+
- returns period when date falls within range
|
|
37
|
+
- returns null when no period covers the date
|
|
38
|
+
- only returns OPERATING periods (not ADJUSTMENT)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# GetPeriodClose
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetPeriodClose retrieves the PeriodClose record for a given accounting period. The PeriodClose record tracks the close workflow status, checklist completion percentage, the user who initiated each step, and timestamps for each state transition. This query supports period-end close workflow management, status monitoring, and audit review of the close process.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Accepts a single lookup parameter: `{ accountingPeriodId }`
|
|
10
|
+
- Returns the full PeriodClose record including close status, completionPercentage, initiator userId, step timestamps, and audit metadata
|
|
11
|
+
- Each accounting period has at most one PeriodClose record
|
|
12
|
+
- Returns null if no close record exists for the given accounting period (i.e., close has not been initiated)
|
|
13
|
+
- Lookup is an exact match on accountingPeriodId
|
|
14
|
+
|
|
15
|
+
## Process Flow
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart TD
|
|
19
|
+
A[Receive input with accountingPeriodId] --> B[SELECT from PeriodClose where accountingPeriodId = input.accountingPeriodId]
|
|
20
|
+
B --> C{PeriodClose record found?}
|
|
21
|
+
C -->|Yes| D[Return PeriodClose record]
|
|
22
|
+
C -->|No| E[Return null]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## External Dependencies
|
|
26
|
+
|
|
27
|
+
- None
|
|
28
|
+
|
|
29
|
+
## Error Scenarios
|
|
30
|
+
|
|
31
|
+
- **PERIOD_CLOSE_NOT_FOUND**: No PeriodClose record exists for the given accounting period — caller receives null
|
|
32
|
+
|
|
33
|
+
## Test Cases
|
|
34
|
+
|
|
35
|
+
- returns period close when found by accounting period id
|
|
36
|
+
- returns null when not found
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# GetSubledgerTransferStatus
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetSubledgerTransferStatus returns the transfer completeness status for all subledger modules for a given accounting period. For each registered subledger module (purchase, sales, inventory, manufacturing), the query reports the total expected handoff events, the number of acknowledged (successfully posted) events, and the number of outstanding (pending) events. This query is a critical input to the period-end close workflow, where subledger transfer verification must pass before the close can proceed.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Accepts a single lookup parameter: `{ accountingPeriodId }`
|
|
10
|
+
- Returns a status record per subledger module: purchase, sales, inventory, manufacturing
|
|
11
|
+
- Each module status includes:
|
|
12
|
+
- `totalExpected` — total number of handoff events expected for the period
|
|
13
|
+
- `acknowledged` — number of events successfully posted and acknowledged
|
|
14
|
+
- `outstanding` — number of events not yet posted or acknowledged (`totalExpected - acknowledged`)
|
|
15
|
+
- The query aggregates data from subledger handoff event records and their acknowledgment status
|
|
16
|
+
- Returns the status for all registered subledger modules, even if a module has zero expected events
|
|
17
|
+
- Used by the period-end close workflow to determine whether subledger verification can pass
|
|
18
|
+
|
|
19
|
+
## Process Flow
|
|
20
|
+
|
|
21
|
+
```mermaid
|
|
22
|
+
flowchart TD
|
|
23
|
+
A[Receive input with accountingPeriodId] --> B[Query handoff events for the accounting period]
|
|
24
|
+
B --> C[Group events by source subledger module]
|
|
25
|
+
C --> D[For each module: count total expected events]
|
|
26
|
+
D --> E[For each module: count acknowledged events]
|
|
27
|
+
E --> F[For each module: compute outstanding = total - acknowledged]
|
|
28
|
+
F --> G[Return status per subledger module]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## External Dependencies
|
|
32
|
+
|
|
33
|
+
- None
|
|
34
|
+
|
|
35
|
+
## Error Scenarios
|
|
36
|
+
|
|
37
|
+
- **ACCOUNTING_PERIOD_NOT_FOUND**: The specified accounting period does not exist — caller receives an error
|
|
38
|
+
|
|
39
|
+
## Test Cases
|
|
40
|
+
|
|
41
|
+
- returns error when accounting period does not exist
|
|
42
|
+
- returns status for all 4 modules
|
|
43
|
+
- returns zero counts when no entries exist
|
|
44
|
+
- correctly counts posted vs draft entries
|
|
45
|
+
- returns correct outstanding counts
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# GetTrialBalance
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetTrialBalance retrieves a single trial balance snapshot by id, including all line items. The trial balance record contains the generation parameters (companyId, accounting period, variant type, generation timestamp) and the full list of line items showing each GL account's opening balance, period debits, period credits, and closing balance. This query supports period-end review, financial statement preparation, and audit evidence retrieval.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Accepts a single lookup parameter: `{ id }`
|
|
10
|
+
- Returns the full trial balance record including all line items
|
|
11
|
+
- Line items include account reference, opening balance, period debits, period credits, and closing balance
|
|
12
|
+
- Line items are organized by account group hierarchy and sorted by account code ascending within each group
|
|
13
|
+
- Returns null if no matching trial balance is found
|
|
14
|
+
- Lookup is an exact match on id
|
|
15
|
+
|
|
16
|
+
## Process Flow
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart TD
|
|
20
|
+
A[Receive input with id] --> B[SELECT from TrialBalance where id = input.id]
|
|
21
|
+
B --> C{Trial balance found?}
|
|
22
|
+
C -->|Yes| D[Load all associated line items]
|
|
23
|
+
D --> E[Return trial balance with line items]
|
|
24
|
+
C -->|No| F[Return null]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## External Dependencies
|
|
28
|
+
|
|
29
|
+
- None
|
|
30
|
+
|
|
31
|
+
## Error Scenarios
|
|
32
|
+
|
|
33
|
+
- **TRIAL_BALANCE_NOT_FOUND**: No trial balance matches the given id — caller receives null
|
|
34
|
+
|
|
35
|
+
## Test Cases
|
|
36
|
+
|
|
37
|
+
- returns trial balance with lines when found by id
|
|
38
|
+
- returns null with empty lines when not found
|