on 03-11-2013 3:52 PM
hola a todos,
ayuda en la validacion del campo referencia de la OINV,,,para que no dupliquen o no se repitan los valores (datos)
yo lo hice de esta manera:
pero no esta validando correctamente...
if @object_type = '13' and (@transaction_type = 'A' or @transaction_type = 'U')
BEGIN
declare @numref as varchar(100)
declare @ref as int
set @ref = 0
set @numref = (Select x.NumAtCard from OINV x where x.DocEntry=@list_of_cols_val_tab_del)
set @ref = (select count(xx.NumAtCard)from OINV xx where upper(xx.NumAtCard)=upper(@numref))
set @ref=@ref - 1
if @ref >= 0 or @numref is null
begin
set @error='9998'
set @error_message='El Número de Nota de Remisión [ '+@numref+' ] ya existe o esta en blanco, favor verificar '+CAST(@ref as varchar(10))
end
END
de antemano les agradezco su valiosa ayuda.
atte: Edwin
Ve si te sirve de esta manera,
if @object_type = '13' and (@transaction_type in ('A' ,'U'))
begin
declare @Numref as varchar (100)
if (@object_type = '13')
begin
select @Numref = NumAtCard from OINV T0 where docentry = @list_of_cols_Val_tab_del
begin
if (@Numref is not null) or (@Numref is null)
begin
if 1!= (select count (docentry) from OINV where (NumatCard = @Numref) )
begin
select @error =9998
select @error_message = 'El Número de Nota de Remisión ['+@Numref+'] ya existe o esta en blanco, favor verificar'
End
End
End
End
End
Saludos.
Alessandro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hubiera sido más fácil creo yo habilitando la opción de bloquear referencia del cilente en Gestión - Inicialización sistema - Parametrizaciones de documento, pestaña Por Documento, y ahí elijes Factura y luego elijes "Blo&quear liberación/recibo" en la sección de "Si se produce un duplicado del número de referencia del cliente".
Saludos,
Juan Carlos.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
8 | |
7 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.