DROP PROCEDURE GrabarDetContometroProc
GO
CREATE PROCEDURE GrabarDetContometroProc
(	@CORRNBR int,
	@BATNBRTURN  UD_CORRELATIVOS
)
AS
BEGIN    

	DECLARE   @ERROR	integer


       INSERT 	INTO 	OP_CTRLTURNDET(BATNBRTURN,SITEID,DATEPROCES,NBRTUR,SIDE,HOSENUMBER,INVTIDBARR,STARTREADING,ENDREADING,QTYSALES,QTYSERAF,QTYOTHER,TOTQTY)
		SELECT 	@BATNBRTURN,SITEID,DATEPROCES,NBRTUR,SIDE,HOSENUMBER,INVTIDBARR,STARTREADING,ENDREADING,QTYSALES,QTYSERAF,QTYOTHER,TOTQTY
		FROM	TMP_OP_CTRLTURNDET
		WHERE	CORRNBR=@CORRNBR

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

  RETURN (0)

END
