DROP PROCEDURE IN_GrabarDetHistPrecInvProc
GO
CREATE PROCEDURE IN_GrabarDetHistPrecInvProc
(	@CORRNBR int,
	@BATNBR  UD_CORRELATIVOS
)
AS
BEGIN    

	DECLARE   @ERROR	integer


       INSERT 	INTO 	IN_PRICELEVELTEMDET(BATNBRPRICELEVELTEM,SITEID,SEQUENCE,INVTIDSKU,DESCR,SLS_PRICE,DISCMTO,NEWSLS_PRICE,STDCOST)
		SELECT 	@BATNBR,SITEID,SEQUENCE,INVTIDSKU,DESCR,SLS_PRICE,DISCMTO,NEWSLS_PRICE,STDCOST
		FROM	TMP_IN_PRICELEVELTEMDET
		WHERE	CORRNBR=@CORRNBR

	IF (@@error!=0 OR @@ROWCOUNT=0 )
    	BEGIN
        	RETURN(1)
    	END

  RETURN (0)

END
