DROP PROCEDURE GrabarDetHistPrecCliProc
GO
CREATE PROCEDURE GrabarDetHistPrecCliProc
(	@CORRNBR int,
	@PRCLVLCUSTID	 UD_PRCLVLCUSTID,
	@SITEID		UD_IDSITE
)
AS
BEGIN    

	DECLARE   @ERROR	integer


       INSERT 	INTO 	OP_PRCLVLCUSTDET(PRCLVLCUSTID,SITEID,DISCMTO,SLS_PRICE,SLS_PRICECUST,INVTIDSKU,DESCR)
		SELECT 	@PRCLVLCUSTID,SITEID,DISCMTO,SLS_PRICE,SLS_PRICECUST,INVTIDSKU,DESCR
		FROM	TMP_OP_PRCLVLCUSTDET
		WHERE	CORRNBR=@CORRNBR AND SITEID=@SITEID

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

  RETURN (0)

END


