on 03-21-2012 9:59 PM
Estimados,
Tengo creado un TN que valida al momento de hacer ingreso de mercancias por compras que la cantidad que se està ingresando NO sea mayor a la puesta en la ORDEN DE COMPRA, el problema se presenta si en la misma OC esta duplicado el mismo codigo de articulo, es decir NO permite crear la entrada de mercancia (asi las cantidaddes esten iguales a la OC) si el mismo codigo de articulo esta repedido en la OC.
Que debo agregar para que me valide las cantidades item x item ?
if @object_type in ('20') and @transaction_type
in ('A', 'U') ----------------- ENTRADA MERCANCIA
begin
if (select count(*)
FROM OPDN T0 INNER JOIN PDN1 T1 ON T0.DOCENTRY=T1.DOCENTRY
WHERE T1.Quantity>T1.U_Cantidadserv AND T1.BaseRef IS NOT NULL and T1.BaseType=22
AND @list_of_cols_val_tab_del = T0.DocEntry)>0
begin
set @error = 10
set @error_message ='** SP COMPRAS19: LA CANTIDAD ES SUPERIOR A LA ORDENADA, CUMNIQUELO A DPTO. COMPRAS'
end
end
Saludos,
JAMS
Hola Mauricio,
Probe a ejecutar el TN pero da error en targetentry, no soy experto en SQL, que puede estar fallando ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Cambia targetentry por trgetentry
En cuanto a las tablas de historial me refiero a las que empiezan con A, pon tu log en 0 y actualiza algun documento para depurar la ADOC, igual un artículo para depurar la AITM y AITW, veras que crecera mucho tu log de tu base pero despues con un shrink quedara muy reducida tu base. Hazlo en un fin de semana
Intenta con
if @object_type in ('20') and @transaction_type
in ('A', 'U') ----------------- ENTRADA MERCANCIA
begin
declare @por1 as int
declare @pdn1 as int
set @por1=(select sum(quantity)from
por1 where targetentry=@list_of_cols_val_tab_del)
set @pdn1=(select sum(quantity) from
pdn1 where docentry=@list_of_cols_val_tab_del)
if @por1!=@pdn1
begin
set @error=10
set @error_message='Tu 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.
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.