on 07-18-2012 4:51 PM
Estimados,
He modificado el Transaction Notification pero no me funciona, lo que deseo realizar es impedir crear una factura si en alguna de sus lineas el precio es =0, agradezco toda la ayuda posible. saludos, por otra parte donde puede encontrar información acerca de como poder modificar el transaction Notification.
IF (@object_type = '13') and (@transaction_type= 'A')
BEGIN
IF EXISTS (SELECT T1.Price FROM OINV T0 INNER JOIN Inv1 T1 ON T0.DocEntry = T1.DocEntry
WHERE T0.DocEntry = @list_of_cols_val_tab_del and T1.Price =0 )
BEGIN
SET @error = 1
SET @error_message = 'Precio = a 0.0000'
END
END
Estimado, probé el TN y me bloqueo la creacion de la factura cuando una linea esta en precio 0
Atte.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Probé el codigo que mencionas y a mi me funciona perfectamente.
Asumo que la validacion es para facturas de venta y que al final deltransaction tienes:
select @error, @error_message.
Si sigue sin funcionar me avisas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Estimado Fernando,
Primeramente gracias por la respuesta oportuna, sigue sin funcionar el código, lo que puedo agregar es que tengo otras secciones dentro del TN que bloquean otras cosas, te copio solo por referencia el penultimo bloque(si funciona) y el último (que no me funciona
-- IMPIDE LA CREACIÓN DE UNA OC SIN NÚMERO DE REFERENCIA
If @object_type = '22'
Begin
set @DocEntry = @list_of_cols_val_tab_del
Declare @ReferenciaOC nvarchar (100)
Select @ReferenciaOC = rtrim(ltrim(T0.NumAtCard))
From OPOR T0
Where T0.DocEntry = @DocEntry
If @ReferenciaOC IS NULL
Begin
set @error = 1
set @error_message = 'DEBE INGRESAR EL NUMERO DE REFERENCIA'
End
End
--Select the return values
select @error, @error_message
end
---IMPIDE - Factura sin Precio
IF (@object_type = '13') and (@transaction_type= 'A')
BEGIN
IF EXISTS (SELECT T1.Price FROM OINV T0 INNER JOIN Inv1 T1 ON T0.DocEntry = T1.DocEntry
WHERE T0.DocEntry = @list_of_cols_val_tab_del and T1.Price =0 )
BEGIN
SET @error = 1
SET @error_message = 'Precio = a 0.0000'
END
select @error, @error_message
END
Muchas Gracias por tu ayuda.
Felipe,
Tengo este juego de validaciones, y realice el cambio que me indicas pero aun no me funciona
ALTER proc [dbo].[SBO_SP_TransactionNotification]
@object_type nvarchar(20), -- SBO Object Type
@transaction_type nchar(1), -- [A]dd, [U]pdate, [D]elete, [C]ancel, C[L]ose
@num_of_cols_in_key int,
@list_of_key_cols_tab_del nvarchar(255),
@list_of_cols_val_tab_del nvarchar(255)
AS
begin
-- Return values
declare @error int -- Result (0 for no error)
declare @error_message nvarchar (200) -- Error string to be displayed
select @error = 0
select @error_message = N'Ok'
declare @DocEntry int
--------------------------------------------------------------------------------------------------------------------------------
----------------IMPIDE QUE SE CREE UNA FACTURA DE CLIENTES SIN VENDEDOR
If @object_type = '13'
Begin
Set @DocEntry = @list_of_cols_val_tab_del
if (SELECT count(*)
FROM OINV T0
WHERE T0.DocEntry = @DocEntry AND T0.[SlpCode] = -1)>0 --and DATEPART(month, T0.DocDate) = DATEPART(month, GETDATE()) and DATEPART(year, T0.DocDate) = DATEPART(year, GETDATE()) and DATEPART(day, T0.DocDate) = DATEPART(day, GETDATE()))>0
begin
Set @error = 1
Set @error_message = 'INGRESAR CÓDIGO DE VENDEDOR RESPONSABLE'
end
end
--------------------------------------------------------------------------------------------------------------------------------
-- VALIDA QUE LA NCI SEA DE LA MISMA FECHA QUE LA FACTURA DE PROVEEDORES
If @object_type = '19'
Begin
Set @DocEntry = @list_of_cols_val_tab_del
if (SELECT count(*)
FROM [dbo].[ORPC] T0 INNER JOIN [dbo].[RPC1] T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OPCH T2 ON T1.BaseRef = T2.DocNum INNER JOIN NNM1 T3 ON T0.Series = T3.Series
WHERE T0.DocEntry = @DocEntry and T2.[DocDate] != T0.[DocDate]
and substring(T3.SeriesName,1,3) = 'NCI') > 0
begin
Set @error = 2
Set @error_message = 'LA FECHA DE LA NOTA DE CREDIO INTERNA NO ES IGUAL A LA FACTURA'
end
end
--------------------------------------------------------------------------------------------------------------------------------
-- VALIDA QUE LA NCI SEA DE LA MISMA FECHA QUE LA FACTURA DE CLIENTE
If @object_type = '14'
Begin
Set @DocEntry = @list_of_cols_val_tab_del
If (SELECT Count (*)
FROM [dbo].[ORIN] T0 INNER JOIN [dbo].[RIN1] T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OINV T2 ON T1.BaseRef = T2.DocNum INNER JOIN NNM1 T3 ON T0.Series = T3.Series
WHERE T0.DocEntry = @DocEntry and T2.[DocDate] != T0.[DocDate]
and (T0.Series=71 )) > 0
Begin
Set @error = 3
Set @error_message = 'LA FECHA DE LA NOTA DE CREDIO INTERNA NO ES IGUAL A LA FACTURA'
End
End
-- IMPIDE LA CREACIÓN DE FACTURAS DE CLIENTES CON EL CAMPO DE USUARIO 'SUCURSAL' VACÍO
If @object_type = '13'
Begin
Set @DocEntry = @list_of_cols_val_tab_del
if (SELECT count(*)
FROM OINV T0
WHERE T0.DocEntry=@DocEntry and T0.U_Sucursal IS NULL)>0 --and DATEPART(month, T0.DocDate) = DATEPART(month, GETDATE()) and DATEPART(year, T0.DocDate) = DATEPART(year, GETDATE()) and DATEPART(day, T0.DocDate) = DATEPART(day, GETDATE()))>0
begin
Set @error = 4
Set @error_message = 'FALTA INDICAR LA "SUCURSAL"'
end
end
--------------------------------------------------------------------------------------------------------------------------------
-- IMPIDE LA CREACIÓN DE UNA OC SIN NÚMERO DE REFERENCIA
If @object_type = '22'
Begin
set @DocEntry = @list_of_cols_val_tab_del
Declare @ReferenciaOC nvarchar (100)
Select @ReferenciaOC = rtrim(ltrim(T0.NumAtCard))
From OPOR T0
Where T0.DocEntry = @DocEntry
If @ReferenciaOC IS NULL
Begin
set @error = 5
set @error_message = 'DEBE INGRESAR EL NUMERO DE REFERENCIA'
End
End
--Select the return values
select @error, @error_message
end
---IMPIDE O/V - Factura sin Precio
IF (@object_type = '13') and (@transaction_type= 'A')
BEGIN
IF EXISTS (SELECT T0.DocEntry FROM OINV T0 INNER JOIN Inv1 T1 ON T0.DocEntry = T1.DocEntry and T1.Price =0
WHERE T0.DocEntry = @list_of_cols_val_tab_del )
BEGIN
SET @error = 6
SET @error_message = 'Precio = a 0.0000'
END
select @error, @error_message
END
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
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.