USE [MinovaES_Tulisan_Prod]
GO
/****** Object:  StoredProcedure [dbo].[STOCKADJUSTMENTCLEARITEM]    Script Date: 20/08/2025 14.46.33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[STOCKADJUSTMENTCLEARITEM]

AS

DECLARE @DocNoAddition VARCHAR (8)=RIGHT('00000000' + CAST(CAST((select distinct MAX(CurrentID) FROM PCMBSENTERPRISENUMBERDOC WHERE TableName = 'PTRMATERIALHEAD') AS INT) + 1 AS VARCHAR(8)), 8)

DELETE from PTRMATERIALITEM_SA where DocNo=@DocNoAddition