on 06-09-2011 9:09 PM
Hola a todos
Tengo el siguiente problema.
Tengo un flujo de aprobación que se dispara para tofdas las cotizaciones con un descuento superior al 15%. El problema es que si tiene un descuento menor se crea sin problemas, no obstante luego de eso es posible modificarla, subirle el descuento y volver a grabarla. Como ya está grabada no entra al flujo de aprobación.
Espero puedan ayudarme.
Saludos
IF @object_type IN ('23') AND @error = 0
AND @transaction_type IN ('U')
AND @list_of_cols_val_tab_del <> ''
BEGIN
IF @object_type = '23'
BEGIN
DECLARE @CAMPO INT
SET @CAMPO = 0
SET @CAMPO = (SELECT COUNT(*)
FROM OQUT T0
WHERE T0.DocEntry = @list_of_cols_val_tab_del
And T0.DiscPrcnt > 0 u2013-Ingresar campo y condicion,ejemplo :que no se actualize el %descuento > que 0
)
END
IF @CAMPO > 0 begin
set @error = 1
set @error_message='INGRESAR MENSAJE DE ERROR'
END
END
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
El código anterior no permitirá modificar el descuento cuando sea mayor que cero una vez creado.
ejemplo: una cotización creada con un descuento de un 5%, al intentar modificar ese descuento después de creado enviará el mensaje de error y no actualizará el % de descuento
Saludos cordiales
Luis Parra V.
Edited by: Luis Parra on Jun 9, 2011 11:39 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
con un transaction notification que no te permita actualizar el descuento una vez creado.
Saludos Cordiales
Luis Parra V.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Quieres evitar que se modifique el documento? o solo el descuento?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Pues si quieres evitar que se modifique el documento solo agrega una linea al transaction que sea
if @transaction_type in ('U') and @object_type in ('23')
begin
set @error=1
set @error_message='No puede modificar el documento'
end
Con esto, no pueden grabar cambio alguno en un documento ya creado
No pude postear antes, pero dejare mi aporte
IF @object_type = ('23') AND @transaction_type = ('U')
BEGIN
DECLARE
@DESC_HIST NUMERIC(19,6),
@DESC_ACT NUMERIC(19,6)
SELECT
@DESC_HIST = (SELECT T0.DiscPrcnt
FROM ADOC T0
WHERE T0.ObjType = @object_type AND T0.DocEntry = @list_of_cols_val_tab_del AND
T0.LogInstanc = (SELECT TOP 1 Y.LogInstanc
FROM ADOC Y
WHERE Y.DocEntry = @list_of_cols_val_tab_del AND Y.ObjType = @object_type
ORDER BY Y.LogInstanc DESC)),
@DESC_ACT = (SELECT T0.DiscPrcnt FROM OQUT T0 WHERE T0.DocEntry = @list_of_cols_val_tab_del)
IF @DESC_ACT != @DESC_HIST
BEGIN
SELECT @error = -1000,@error_message = 'No puede modificar el descuento'
END
END
Luis una consulta, no he probado el SP, pero si entiendo el descuento al ser mayor a 0 lo bloqueara, pero si es descuento negativo lo dejara pasar?
Atte.
Felipe Loyola
PD: en 8.81 hay historial por linea tambien
Edited by: Floyola on Jun 10, 2011 9:04 AM
Bloquea mediante un TN, la modificacion de los descuentos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
11 | |
11 | |
6 | |
6 | |
5 | |
4 | |
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.