drop procedure op_obtienenbrloadsales 
go
create procedure op_obtienenbrloadsales 
@SALESPOINT ud_ptovta
as
declare @nbrloadsale ud_correlativos

	select nbrloadsale from op_salespointsetting where SALESPOINT=@SALESPOINT

	update 	op_salespointsetting set nbrloadsale =nbrloadsale +1 where SALESPOINT=@SALESPOINT

 IF (@@error!=0)
    BEGIN
        RAISERROR  20000 'op_obtienenbrloadsales: Error al Obtener Correlativo'
        ROLLBACK TRAN
        RETURN(1)    
    END
    SELECT @nbrloadsale as nbrloadsale
    COMMIT TRAN   
go
