IMS Documentation

Stock Maintenance

Stock Maintenance rebuilds IMS on-hand quantities from the transaction history. It starts from each item/store opening quantity and reapplies purchases, purchase returns, stock transfers, sales, sales returns, stock adjustments and stock depreciation to restore the calculated stock balance.

Open the screenTools → Stock Maintenance.
IMS Stock Maintenance screen with Store selection and Run button
Stock Maintenance can rebuild one selected store or the full IMS stock balance.
Operational maintenanceStock Maintenance can take time. IMS warns that the targeted store(s) will not be available for normal transactions while the maintenance process is running. Run it during an approved maintenance window when possible.

Select one store or all stores

Enter a Store ID to rebuild one location. IMS validates the ID and displays the store name beside it.

Leave the Store field blank to run Stock Maintenance for all stores. This is the broader maintenance operation and can take longer because IMS recalculates every applicable item/store balance.

Run Stock Maintenance

  1. Choose a Store, or leave Store blank for all stores.
  2. Click Run.
  3. Review the warning that the targeted store(s) will be unavailable for transactions during maintenance.
  4. Click Yes to continue.
  5. Follow the progress messages while IMS recalculates the stock balances.
  6. Wait for the Done confirmation before resuming normal activity.

The screen prevents a new run when IMS Autos/maintenance blocking rules are active or when the IMS database connection is unavailable.

What IMS recalculates

IMS rebuilds quantity from the underlying inventory transactions rather than simply trusting the current balance stored in item_prods.qty.

Stock sourceEffect on quantity
Opening / First QuantityStarting balance for the item/store.
PurchasesAdds received quantity.
Purchase ReturnsSubtracts returned quantity.
Stock Transfer InAdds quantity received by the destination store.
Stock Transfer OutSubtracts quantity sent from the source store.
Cash / Credit SalesSubtracts inventory-item sales.
Cash / Credit ReturnsAdds returned inventory quantity.
Stock AdjustmentsApplies the signed adjustment quantity.
Stock DepreciationSubtracts depreciated/write-off quantity.

Maintenance process

The progress indicator represents the main stages of the rebuild:

StageWhat happens
Preparing Stock MaintenanceIMS temporarily disables transaction processing for the targeted store scope and records which stores should be active again afterward.
Calculating Stock MovementsIMS combines the applicable inventory movements into a temporary recalculation table by Item Code and Store.
Adding Missing Item Store RowsIf a transaction exists for an Item/Store combination that does not yet exist in the stock-balance table, IMS creates the missing row using the item's current cost.
Adding Opening BalanceThe current quantity is reset to the stored opening/first quantity for the selected scope.
Applying Stock MovementsThe summed transaction movements are applied to the opening quantity.
FinalizingIMS restores the targeted stores to their operational transaction state and completes the maintenance.

Missing item/store balances

Stock Maintenance also repairs a specific structural case: a valid transaction history can exist for an Item Code and Store even when the corresponding item_prods balance row is missing. IMS creates that missing Item/Store record before it reapplies the opening quantity and transaction movements.

Transaction safety and rollback

The recalculation is performed as one database transaction. If an error occurs during the maintenance process, IMS rolls the maintenance transaction back rather than leaving a partially recalculated stock balance.

After a successful run, IMS writes a Stock Maintenance entry to the IMS activity log identifying either the selected store or an All Stores maintenance run.

IMS Autos

The Stock Maintenance screen itself is the manual maintenance tool. Where IMS Autos is implemented and configured, the same stock-maintenance requirement can be scheduled as part of the regular automated maintenance process, reducing the need to run it manually as a routine task.

When to use the manual screenManual Stock Maintenance is most useful when an authorized administrator needs to rebuild and verify one store immediately, or when a full recalculation is required outside the normal automated schedule.