DROP PROC OP_aumentarnrofactura
GO

CREATE PROC OP_aumentarnrofactura
@SALESPOINT ud_ptovta
as

BEGIN TRAN

update OP_SALESPOINTSETTING 
		set NBRTICKFAC=NBRTICKFAC+1,
		BATNBRSALES = BATNBRSALES+1  
		where SALESPOINT=@SALESPOINT

 IF (@@error!=0)
    BEGIN
        RAISERROR  20000 'OP_GRABARVENTASCTORE: Error al Grabar Transaccion'
        ROLLBACK TRAN
        RETURN(1)    
    END
    COMMIT TRAN   
RETURN (0)   
--select ,NBRTICKBOL  

go

OP_aumentarnrofactura 'PTOVTA02'
select SALESPOINT,NBRTICKFAC from op_salespointsetting
