DROP PROC op_obtenertransgrabadas
GO

CREATE PROC op_obtenertransgrabadas
@puntoventa ud_ptovta,
@SALESTYPE CHAR(1)
as
select 	corrnbr as Nro_Transaccion,
	custidss as Codigo,
	CUSTNAME as Cliente, 
	TOTALPEN as Total,
	DATEPROCESALES as Fecha, 
	SALESPERID as Vendedor 
	from tmp_op_salescstore 
	where stksave=1 AND PROCESSED=0 and SALESPOINT=@puntoventa AND SALESTYPE=@SALESTYPE and TOTALPEN>0
	order by corrnbr
go

exec op_obtenertransgrabadas 'PTOVTA02 ','A'
select * from tmp_op_salescstore 


