All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (pull_request) Successful in 20m38s
Closes #5
36 lines
948 B
Transact-SQL
36 lines
948 B
Transact-SQL
USE [phronCare_OperationsHub]
|
|
GO
|
|
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Procedure: PhLSM_Stock_GetAvailabilityByStockItemIds
|
|
-- Module: Logistics / Stock (PhLSM)
|
|
-- Purpose: Returns quantity and availability data
|
|
-- for the requested stock items.
|
|
-- Author: Leandro Rojas
|
|
-- Created: 2026-03-09
|
|
-- =============================================
|
|
|
|
CREATE OR ALTER PROCEDURE [dbo].[PhLSM_Stock_GetAvailabilityByStockItemIds]
|
|
(
|
|
@StockItemIds dbo.PhLSM_StockItemIdList READONLY
|
|
)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
SELECT
|
|
si.id AS StockitemId,
|
|
si.quantity AS Quantity,
|
|
ISNULL(si.reserved_quantity, 0) AS ReservedQuantity,
|
|
si.quantity - ISNULL(si.reserved_quantity, 0) AS AvailableQuantity,
|
|
si.serial AS Serial
|
|
FROM dbo.PhLSM_StockItem si
|
|
INNER JOIN @StockItemIds ids
|
|
ON ids.stockitem_id = si.id;
|
|
END
|
|
GO |