Planveyor RU

Northwind

a sibling on SQL Server

dbo.Products

dbo.GetReorderCandidates

What needs reordering?

Active products with a shortage: reorder level minus stock and units on order.

Shortage = reorder level − (units in stock + units on order)

Active products only, shortage > 0. NULL = 0. Order: ID.

Synthetic fixture

One: 12 − (3 + 4) = 5
Two: 9 − (1 + 2) = 6

Expected result

IDNameShortage
1One5
2Two6

Local JS demo · no SQL, AI or Git File version v01 Role route

Synthetic example. No SQL Server, AI roles or Git are run. You can see a sibling on SQL Server in the planveyor-mssql repository (in Russian).