DROP PROCEDURE ConfirmarTurnoProc
GO
CREATE PROCEDURE ConfirmarTurnoProc
(
	@SITEID		UD_IDSITE,
	@DATEPROCE 	UD_FECHA,
	@NUMBERTURN 	TINYINT,
	@SALESPERID	UD_SALESPERSONID
)
AS
BEGIN
	BEGIN TRAN
		UPDATE 	OP_TURNVSSIDE
		SET	STATUS=1
		WHERE 	SITEID=@SITEID AND DATEPROCE=@DATEPROCE AND NUMBERTURN=@NUMBERTURN AND SALESPERID=@SALESPERID

		    IF (@@error!=0 OR @@rowcount=0)
    			BEGIN
        			RAISERROR  20000 'Error Actualizando en OP_TURNVSSIDE'
        			ROLLBACK TRAN
        			RETURN(1)
    
    			END

	COMMIT TRAN
	RETURN(0)
END 