on 09-10-2015 4:45 PM
Hola a todos
Necesito realizar un bloqueo para que los vendedores no puedan modificar una orden venta después de haberla creado. Sólo ciertos usuarios podrán realizar algún cambio
Lo que realicé hasta ahora no me resulta
If @Object_Type = '17' and @transaction_type in ('U')
Begin
If (Select 'True' From ORDR T0
Where T0.DocEntry=@list_of_cols_val_tab_del and (t0.UserSign not in ('1','12','17','24', '58','70','76') )
) ='True'
Begin
Set @error='-1'
Set @error_message='ORDEN DE VENTA NO PUEDE SER MODIFICADO'
End
End
Buenas tardes
Utiliza el campo UserSign2 ya que ahí se guarda el usuario que esta actualizando. El campo UserSign es usuario creador.
Saludos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gracias a ambos, si me funcionó con el UserSign2. Pero ahora se me presenta otro inconveniente porque realmente son dos bloqueos:
1- Uno que al agregar o modificar un pedido, ciertos usuarios les permita nada mas cambiar la descripción de artículos de lo contrario le mande error
2- El otro que sólo al modificar ningún vendedor pueda hacerlo excepto ciertos usuarios de los cuales no están incluidos en el primer bloqueo
Cuando hago las pruebas los usuarios del primer grupo pueden modificar la descripción cuando agregan un pedido, pero si ese mismo usuario entra a modificar el pedido manda el error aunque sea que haya modificado nuevamente la descripción (en el que si tiene autorización)
Adjunto ambos bloqueos a ver si se pueden unir o que me puedan sugerir
Bloqueo #1
/*Bloqueo que no permite modificar Pedidos*/
If @Object_Type = '17' and @transaction_type in ('U')
Begin
If (Select 'True' From ORDR T0
Where T0.DocEntry=@list_of_cols_val_tab_del and (t0.UserSign2 not in ('1','12','17','24', '58','70','76') )
and DocType='I' ) ='True'
Begin
Set @error='-1'
Set @error_message='ORDEN DE VENTA NO PUEDE SER MODIFICADO'
End
End
Bloqueo #2
/*Bloqueo que no permite modificar la descripcion de un articulo en pedidos*/
If @Object_Type = '17' and @transaction_type in ('A','U')
Begin
If (Select top 1 'True' From ORDR T0,RDR1 T1
INNER JOIN OITM T2 ON T2.ItemCode=T1.ItemCode
Where T0.DocEntry=@list_of_cols_val_tab_del and (t0.UserSign not in ('1','12','20', '58','126') or t0.UserSign2 not in ('1','12','20', '58','126')) and T1.DocEntry=@list_of_cols_val_tab_del
and DocType='I' and T1.TreeType !='I' AND T2.ItemName <> T1.Dscription
)='True'
Begin
Set @error='-1'
Set @error_message='Descripción del articulo no puede ser modificada, Linea '+(
Select top 1 Convert(Varchar,(LineNum+1))+' '+'Referencia: '+T1.ItemCode
From ORDR T0,RDR1 T1
INNER JOIN OITM T2 ON T2.ItemCode=T1.ItemCode
Where T0.DocEntry=@list_of_cols_val_tab_del and (t0.UserSign not in ('1','12','20', '58','126') or t0.UserSign2 not in ('1','12','20', '58','126')) and T1.DocEntry=@list_of_cols_val_tab_del
and DocType='I' and T1.TreeType !='I' AND T2.ItemName <> T1.Dscription
)
End
End
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Prueba con
If @Object_Type = '17' and @transaction_type in ('U')
Begin
If (Select 'True' From ORDR T0
Where T0.DocEntry=@list_of_cols_val_tab_del and (t0.UserSign2 not in ('1','12','17','24', '58','70','76') )
) ='True'
Begin
Set @error='-1'
Set @error_message='ORDEN DE VENTA NO PUEDE SER MODIFICADO'
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 |
---|---|
101 | |
12 | |
11 | |
6 | |
6 | |
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.