Skip to content

Stock In

Backlog fieldValue
Story IDINV-DASH-019
EpicInventory
Story typeDashboard
Review statusDraft - business analyst and business owner review required
Source evidenceInventory MFE route/form, Inventory.Apis controller, application command/query handlers, validators, domain entities, and posting services
Last source review2026-07-10

Purpose

Record stock received into a warehouse outside or from connected source documents.

User stories

  • As a warehouse receiver, I want to create a Stock In with date, warehouse, operational tag, and item lines so that received stock is recorded.
  • As a receiver, I want to scan a barcode, select multiple items, or import lines so that entry is efficient.
  • As a receiver, I want to assign batch/serial tracking details so that tracked stock remains traceable.
  • As an authorized supervisor, I want to post a valid draft so that on-hand stock and related accounting become effective.
  • As an auditor, I want to view, print, search, and export Stock In records.

Acceptance criteria

  1. A draft requires a valid date, destination warehouse, operational tag where applicable, and at least one valid positive-quantity line.
  2. Barcode selection resolves the correct item variant/unit.
  3. Tracking quantities equal their parent line quantity for tracked items.
  4. Drafts may be edited or deleted only with permission and while business state allows it.
  5. Posting validates open period, settings, item/warehouse status, tracking, costs, and accounts.
  6. Successful posting increases stock exactly once and marks the transaction Posted.
  7. Repeated posting requests do not duplicate stock or journals.
  8. Posted records are viewable/printable but not changed through normal draft editing.
  9. List export respects search, sorting, and visible scope.

Posting details

  1. Post accepts only a valid Draft in an open financial period. The warehouse opening balance must already be posted, no physical count may lock the affected stock, and every item, UOM, quantity, cost, and tracking allocation must validate.
  2. For a manual Stock In, the journal debits the destination Warehouse GL account and credits the selected Operational Tag GL account. Both accounts are mandatory; Post fails rather than silently substituting an unrelated account.
  3. For a delegated receipt, the calling document supplies the source-specific counter-account. Purchase and transfer flows normally use Goods in Transit; sales-return or other source flows use the account defined by that source contract. This replaces the manual Operational Tag credit.
  4. Posting creates or updates stock headers, receipt details, tracking records, valuation layers, weighted-moving-average/last-purchase cost values, the linked journal, and the Stock In status. The source document receives the resulting Stock In/journal references where its contract requires them.
  5. Stock, valuation, journal, links, and status commit as one operation. A validation, account, delegate, or persistence failure leaves the document Draft with no partial effect; a repeated Post must not create a second receipt or journal. Unposting is available only through the explicitly supported source reversal workflow.

General ledger posting

ConditionDebitCreditAmount basisNotes
Manual Stock InDestination Warehouse GLOperational Tag GLReceived quantity x posted unit costBoth accounts are required.
Purchase or transfer receiptDestination Warehouse GLGoods in TransitDelegated receipt valueCounter-account is supplied by the source flow.
Other delegated receiptDestination Warehouse GLSource-supplied accountDelegated receipt valueThe source contract, not the manual tag, controls the credit.
Failed/no-op post--NoneNo journal is retained.

Module and data effects

Affected areaEffectConditional/no-effect rule
Inventory quantityIncreases destination on-hand/available stock.No effect for an invalid or rolled-back post.
ValuationCreates receipt layers and updates WMA/last-purchase cost.Source-supplied cost is used for delegated receipts.
TrackingCreates batch/serial/expiry balances and movement history.Untracked items create no tracking identity.
Source documentReturns Stock In and journal IDs and advances source status.Manual Stock In has no purchase/transfer source to update.
AccountingPosts the table above atomically with stock.No commercial receivable/payable/revenue entry is created.

Core acceptance scenarios

  1. Given a valid Draft Stock In, posted warehouse opening balance, no open count, valid tracking/UOM, Warehouse GL, and Operational Tag GL, when Post is clicked, then stock quantities/cost layers increase, Warehouse GL is debited, Operational Tag GL is credited, the journal is linked, and status becomes Posted in one commit.
  2. Given source-document Stock In, when it posts, then the delegate uses the source-specific COGS or Goods-in-Transit account instead of the manual Operational Tag account.
  3. Given any prerequisite fails, when Post is attempted, then no stock header/detail, journal, or status change is committed.

Data classification

DataRule
Receipt dateRequired; defaults to the current clock for the API command and must resolve to a valid financial period.
Source document type and IDRequired by the manual command validator; identifies the operational tag or upstream source.
WarehouseRequired; must exist, have a Warehouse GL account, have its opening balance posted, and have no open reconciliation.
NotesOptional; copied to the journal description/line descriptions.
LinesAt least one required. Service lines are removed from source-document posted Stock In because services do not create stock.
Item/variant/UOMRequired and active. UOM base calculation must be non-zero.
QuantityRequired and positive. Serial-tracked line quantity must equal 1.
CostRequired and greater than zero for the manual flow. Subcost is quantity multiplied by cost.
BarcodeOptional; if supplied it must exist and is linked to the line.
Batch numberRequired for batch tracking.
Serial IDRequired and globally unique for serial tracking, including within the submitted document.
Expiry dateRequired for batch tracking, expiry-enabled serials, and expiry-enabled untracked items.

Clicking Save

Save creates a Draft Stock In with a generated Stock In sequence. It records header/lines/tracking but does not change available stock or create a journal. Draft lines may be edited/deleted subject to permissions and state.

Clicking Post

  1. Re-loads the document and rejects missing or non-Draft records.
  2. Revalidates active item, variant, UOM, and warehouse references.
  3. Blocks posting while a reconciliation is open or before the warehouse opening balance is posted.
  4. Converts each line to base quantity and resolves tracking identity: vendor batch, serial, or generated system batch for expiry-only stock.
  5. Creates/updates item-warehouse and batch stock headers and adds inbound stock-detail history.
  6. Recalculates available quantity, last-purchase cost, and weighted-average cost where applicable.
  7. Creates the journal and stores its ID/code on the Stock In.
  8. Changes status from Draft to Posted and commits once.

GL effect

  • Manual Stock In: debit Warehouse GL, credit selected Operational Tag GL, for total line subcost.
  • Source-document Stock In: debit Warehouse GL; credit COGS for Sales Return, otherwise Goods in Transit from Inventory settings.
  • Purchase Stock In with landed cost can debit warehouse for inventory plus landed cost and add credits to the resolved landed-cost expense accounts.

See Posting and Account Resolution.

Post failures

Posting makes no committed change when the document is not Draft, Accounting is unavailable, the period/UOM/setup is invalid, the warehouse opening balance is missing, a count is open, a required GL account is absent, tracking is invalid, or journal creation fails.

Status, action, and reversal controls

ActionRequired state/authorityPreconditions and affected dataFailure/reversal rule
Add/SaveStock In Add; new/DraftReceipt date, source type, warehouse, positive lines, UOM and conditional tracking; saves Draft onlyNo quantity, valuation, or GL effect until Post
EditDraft plus Stock In Edit and preventPostedGuardReload current Draft; preserve line/tracking identity and revalidate sourcePosted or concurrently changed receipt remains unchanged
DeleteDraft plus DeleteNo dependent posted source stateRemoves Draft only; posted receipt requires source reversal
PostDraft plus PostOpen period, posted warehouse opening, no count lock, valid cost/UOM/tracking and resolved Warehouse/counter accountsStock, layers, tracking, journal, source links, and status commit together or all roll back
View/PrintView/print authorityAuthorized record and templateRead-only; print failure has no business effect
ReverseSource-specific reversal authorityOpen allowed period and no incompatible later consumption/count/transfer dependencyReverse journal and stock layers/tracking through originating workflow; never delete the Posted receipt

Reconciliation controls

ControlRequired equality
Line quantity in base UOMSum of batch/serial/expiry tracking quantity
Receipt valueWarehouse GL debit and counter-account credit
Posted receipt detailsIncrease in warehouse stock/layers by item and tracking identity
Delegated source quantity/valueStock In links and source document received/remaining totals

Frontend page coverage

The following UI coverage is sourced from the pulled MFE route configuration. A Module-level supporting artifact mapping is evidence of a reachable screen, but requires BA confirmation that it belongs to this story rather than a more specific feature story.

Route/pageComponentModeRoute permission/guardMapping confidenceSource
(module default)StockInListComponentList/navigationPermission: AppInventoryPermissions.StockIn_List; Guards: PolicyAuthGuardExplicit frontend feature ruleapps/inventory/src/app/remote-entry/transactions/transactions.module.ts:66
addAddStockInComponentAddPermission: AppInventoryPermissions.StockIn_Add; Guards: PolicyAuthGuardExplicit frontend feature ruleapps/inventory/src/app/remote-entry/transactions/transactions.module.ts:78
edit/:idEditStockInComponentEditPermission: AppInventoryPermissions.StockIn_Edit; Guards: PolicyAuthGuard, preventPostedGuardExplicit frontend feature ruleapps/inventory/src/app/remote-entry/transactions/transactions.module.ts:89
stockinMainStockInListComponentComponentList/navigationPermission: AppInventoryPermissions.StockIn_List; Guards: PolicyAuthGuardExplicit frontend feature ruleapps/inventory/src/app/remote-entry/transactions/transactions.module.ts:56
view/:idViewStockInComponentView/detailPermission: AppInventoryPermissions.StockIn_View; Guards: PolicyAuthGuardExplicit frontend feature ruleapps/inventory/src/app/remote-entry/transactions/transactions.module.ts:101

Observed frontend fields and validation

ComponentControlObserved frontend ruleComponent source
AddStockInComponentbarCodeVisible control; optional or API-dependentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/add-stock-in/add-stock-in.component.ts
AddStockInComponentcostVisible control; optional or API-dependentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/add-stock-in/add-stock-in.component.ts
AddStockInComponentitemIdVisible control; optional or API-dependentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/add-stock-in/add-stock-in.component.ts
AddStockInComponentnotesVisible control; optional or API-dependentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/add-stock-in/add-stock-in.component.ts
AddStockInComponentquantityVisible control; optional or API-dependentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/add-stock-in/add-stock-in.component.ts
AddStockInComponentreceiptDateConditionally required/validated in componentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/add-stock-in/add-stock-in.component.ts
AddStockInComponentsourceDocumentIdRequired in component validatorapps/inventory/src/app/remote-entry/transactions/pages/stock-In/add-stock-in/add-stock-in.component.ts
AddStockInComponentsourceDocumentTypeRequired in component validatorapps/inventory/src/app/remote-entry/transactions/pages/stock-In/add-stock-in/add-stock-in.component.ts
AddStockInComponentuomIdVisible control; optional or API-dependentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/add-stock-in/add-stock-in.component.ts
EditStockInComponentbarCodeVisible control; optional or API-dependentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/edit-stock-in/edit-stock-in.component.ts
EditStockInComponentcostRequired in component validatorapps/inventory/src/app/remote-entry/transactions/pages/stock-In/edit-stock-in/edit-stock-in.component.ts
EditStockInComponentitemIdVisible control; optional or API-dependentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/edit-stock-in/edit-stock-in.component.ts
EditStockInComponentnotesVisible control; optional or API-dependentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/edit-stock-in/edit-stock-in.component.ts
EditStockInComponentquantityRequired in component validatorapps/inventory/src/app/remote-entry/transactions/pages/stock-In/edit-stock-in/edit-stock-in.component.ts
EditStockInComponentreceiptDateConditionally required/validated in componentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/edit-stock-in/edit-stock-in.component.ts
EditStockInComponentsourceDocumentIdRequired in component validatorapps/inventory/src/app/remote-entry/transactions/pages/stock-In/edit-stock-in/edit-stock-in.component.ts
EditStockInComponentsourceDocumentTypeRequired in component validatorapps/inventory/src/app/remote-entry/transactions/pages/stock-In/edit-stock-in/edit-stock-in.component.ts
EditStockInComponentuomIdRequired in component validatorapps/inventory/src/app/remote-entry/transactions/pages/stock-In/edit-stock-in/edit-stock-in.component.ts
EditStockInComponentwarehouseIdRequired in component validatorapps/inventory/src/app/remote-entry/transactions/pages/stock-In/edit-stock-in/edit-stock-in.component.ts
ViewStockInComponentcodeVisible control; optional or API-dependentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/view-stock-in/view-stock-in.component.ts
ViewStockInComponentnotesVisible control; optional or API-dependentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/view-stock-in/view-stock-in.component.ts
ViewStockInComponentreceiptDateVisible control; optional or API-dependentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/view-stock-in/view-stock-in.component.ts
ViewStockInComponentsourceDocumentTypeVisible control; optional or API-dependentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/view-stock-in/view-stock-in.component.ts
ViewStockInComponentwarehouseNameVisible control; optional or API-dependentapps/inventory/src/app/remote-entry/transactions/pages/stock-In/view-stock-in/view-stock-in.component.ts

Observed frontend actions

ComponentClick action/handlerBusiness review requirementComponent source
AddStockInComponentaddLineStockInNavigate only when the transaction produced a linked Stock In/Stock Out record and Inventory view permission is available; service-only/no-stock cases expose no stock link.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/add-stock-in/add-stock-in.component.ts
AddStockInComponentOnDeleteAvailable only in deletable states with Delete permission; identify the record in confirmation, call delete once, remove/refresh the list row on success, and retain the row with the API reason on failure.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/add-stock-in/add-stock-in.component.ts
AddStockInComponentopenDialogOpen the item/lookup/tracking dialog with the current warehouse, item, UOM, and remaining quantity context; accepted values must return to the correct line and cancel must not mutate it.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/add-stock-in/add-stock-in.component.ts
AddStockInComponentsetTrackingOpen the item/lookup/tracking dialog with the current warehouse, item, UOM, and remaining quantity context; accepted values must return to the correct line and cancel must not mutate it.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/add-stock-in/add-stock-in.component.ts
EditStockInComponentdeleteRowAvailable only in deletable states with Delete permission; identify the record in confirmation, call delete once, remove/refresh the list row on success, and retain the row with the API reason on failure.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/edit-stock-in/edit-stock-in.component.ts
EditStockInComponentnoDeleteAvailable only in deletable states with Delete permission; identify the record in confirmation, call delete once, remove/refresh the list row on success, and retain the row with the API reason on failure.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/edit-stock-in/edit-stock-in.component.ts
EditStockInComponentopenDialogOpen the item/lookup/tracking dialog with the current warehouse, item, UOM, and remaining quantity context; accepted values must return to the correct line and cancel must not mutate it.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/edit-stock-in/edit-stock-in.component.ts
EditStockInComponentsetStockInTrackingNavigate only when the transaction produced a linked Stock In/Stock Out record and Inventory view permission is available; service-only/no-stock cases expose no stock link.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/edit-stock-in/edit-stock-in.component.ts
StockInListComponentnavigateHelpPageComponentDocument the enabled state, permission, input context, resulting API or navigation effect, success refresh, and concrete failure behavior for this handler.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/stock-in-list/stock-in-list.component.ts
StockInListComponentonDeleteAvailable only in deletable states with Delete permission; identify the record in confirmation, call delete once, remove/refresh the list row on success, and retain the row with the API reason on failure.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/stock-in-list/stock-in-list.component.ts
StockInListComponentonEditOpen the identified editable record only with Edit permission; posted/locked records remain blocked by route or action state and list context must be recoverable on return.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/stock-in-list/stock-in-list.component.ts
StockInListComponentonPostAvailable only for a postable Draft and Post permission; confirm the document, prevent a second submission, call the posting API, and refresh status, journal/stock links, and row actions. Failure must keep the pre-post state.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/stock-in-list/stock-in-list.component.ts
StockInListComponentonVeiwOpen the authorized record in view mode with its status, totals, lines, source and generated-document links; handle deleted, forbidden, and missing records without exposing stale data.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/stock-in-list/stock-in-list.component.ts
StockInListComponentprintoutGenerate the printout for the selected record and authorized branch/tenant; use posted/current values and surface print, template, ZATCA/ETA, or popup failures without changing transaction state.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/stock-in-list/stock-in-list.component.ts
StockInListComponentrouteToJournalentryViewOpen the authorized record in view mode with its status, totals, lines, source and generated-document links; handle deleted, forbidden, and missing records without exposing stale data.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/stock-in-list/stock-in-list.component.ts
StockInListComponentrouteToViewOpen the authorized record in view mode with its status, totals, lines, source and generated-document links; handle deleted, forbidden, and missing records without exposing stale data.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/stock-in-list/stock-in-list.component.ts
ViewStockInComponentrouteToJournalentryViewOpen the authorized record in view mode with its status, totals, lines, source and generated-document links; handle deleted, forbidden, and missing records without exposing stale data.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/view-stock-in/view-stock-in.component.ts
ViewStockInComponentrouteToSourceTypeOpen the correct originating document type and ID only when a source link exists and its module view permission is available.apps/inventory/src/app/remote-entry/transactions/pages/stock-In/view-stock-in/view-stock-in.component.ts

Page-specific frontend acceptance criteria

  1. (module default) - List/navigation: Load an authorized paged/searchable list or navigation page; preserve filters/sort/paging and expose only permitted row and bulk actions. Security observed: Permission: AppInventoryPermissions.StockIn_List; Guards: PolicyAuthGuard
  2. add - Add: Render permitted fields, required indicators, defaults, dependent lookups, validation, Save/Cancel, loading, success, and API-error states. Security observed: Permission: AppInventoryPermissions.StockIn_Add; Guards: PolicyAuthGuard
  3. edit/:id - Edit: Load the identified record, enforce state/permission field locks, preserve concurrency identity, validate changes, and return without losing filters. Security observed: Permission: AppInventoryPermissions.StockIn_Edit; Guards: PolicyAuthGuard, preventPostedGuard
  4. stockin - List/navigation: Load an authorized paged/searchable list or navigation page; preserve filters/sort/paging and expose only permitted row and bulk actions. Security observed: Permission: AppInventoryPermissions.StockIn_List; Guards: PolicyAuthGuard
  5. view/:id - View/detail: Load an authorized immutable/detail representation with status-aware actions, linked records, print/export where exposed, and not-found/forbidden handling. Security observed: Permission: AppInventoryPermissions.StockIn_View; Guards: PolicyAuthGuard

Internal Documentation — Microtec