on 08-13-2013 5:56 PM
Hola Amigos
Tengo una consulta requiero que al momento de realizar las ofertas de ventas y los vendedores al seleccionar el cliente solo le aparesca la lista de clientes a los que fueron relacionados al momento de crear al cliente en Sap.
Saluods
ojala esto pueda ayudarte.
------Cotizaciones
IF @transaction_type in ('A','U') and (@object_type='23')
begin
DECLARE curOQUT CURSOR
FOR SELECT T0.DocNum, T0.CardCode, T0.CardName, T1.ItemCode, T1.DiscPrcnt, T0.DiscPrcnt, T0.UserSign,
Lista=(select top 1 ocrd.ListNum from OCRD with(nolock) where ocrd.CardCode=t0.CardCode),t1.Quantity,t1.Price,t1.whscode
FROM OQUT T0 INNER JOIN QUT1 T1 ON T0.DocEntry=T1.DocEntry
WHERE T0.DocEntry=@list_of_cols_val_tab_del AND ITEMCODE <>'1004825'
DECLARE @DocNumC as int
DECLARE @CardCodeC as varchar(15)
DECLARE @CardNameC as varchar(100)
DECLARE @ItemCodeC as varchar(20)
DECLARE @DiscPrcntC as numeric(19,6)
DECLARE @DiscPrcntCGN as numeric(19,6)
DECLARE @UserSignC as varchar(2)
DECLARE @ListaC as int
DECLARE @FraccionC as nvarchar(15)
DECLARE @PrecioC as numeric(19,6)
DECLARE @WhsC as nvarchar(8)
OPEN curOQUT
set @error=0
FETCH NEXT FROM curOQUT INTO @DocNumC, @CardCodeC, @CardNameC, @ItemCodeC, @DiscPrcntC,@DiscPrcntCGN, @UserSignC,@ListaC,@FraccionC,@PrecioC,@WhsC
WHILE @@Fetch_Status=0 AND @error=0
BEGIN
select @error=
case
when @CardNameC<>(select ocrd.cardname from ocrd with(nolock) where ocrd.cardcode=@CardCodeC and ocrd.AddID<>'1' ) then 1
/*BLOQUEO NO PERMITE DESCUENTO O DESCUENTO SUPERIOR A OFERTA CLIENTES CON LISTA ASIGNADA*/
when @ListaC<>1 AND @DiscPrcntC>0 and @UserSignC not in (1,29)
AND @DiscPrcntC>(isnull(isnull(
/*caso desc normal*/
(select SPP2.Discount from SPP2 with(nolock) where ItemCode=@ItemCodeC and spp2.CardCode='*2'),
/*caso desc por cantidad*/
(select spp1.Discount from SPP1 with(nolock) where ItemCode=@ItemCodeC and spp1.ListNum=@ListaC)
--0
),0))
and @UserSignC not in (1,29)
then 2
/*BLOQUEO NO PERMITE MAS DEL 10% DE DESCUENTO O DESCUENTO DE OFERTA A CLIENTES DE CONTADO*/
when @ListaC=1 AND @DiscPrcntC>10 and @UserSignC not in (1,29)
AND @DiscPrcntC>(
isnull(isnull( /*caso desc normal*/
(select SPP2.Discount from SPP2 with(nolock) where ItemCode=@ItemCodeC and spp2.CardCode='*1'),
/*caso desc por cantidad*/
(select spp1.Discount from SPP1 with(nolock) where ItemCode=@ItemCodeC and spp1.ListNum=@ListaC)),0))
and @UserSignC not in (1,29)
then 3
when @DiscPrcntCGN>=1 and @UserSignC not in (1,29) then 8
/*bloqueo para que usuarios solo utilicen el almacen que tienen asignado */
when @WhsC<>(select t1.Warehouse from ousr t0 with(nolock) inner join oudg t1 with(nolock) on t0.DfltsGroup=t1.Code where INTERNAL_K=@UserSignC)
and @UserSignC in (18,19,20,22,23,24,25,27,28,29,30,31)
then 7
/*fin de bloqueo*/
else 0
end,
@error_message=
case
WHEN @error=1 THEN N'No Puede Cambiar el Nombre de Cliente, Solo Clientes de Contado'
WHEN @error=2 THEN N'El Cliente ya Tiene Lista de Precio Asignada, Descuento no autorizado para el articulo ' + @ItemCodeC
WHEN @error=3 THEN N'Descuento no autorizado para el articulo ' + @ItemCodeC
WHEN @error=8 THEN N'No Se Admiten Descuento Generales en el Documento'
WHEN @error=5 THEN N'El Precio no Puede Ser Cero, Corrija Precio en Articulo: ' + @ItemCodeC
WHEN @error=6 THEN N'El Precio Es Menor al Costo, Corrija Precio en Articulo: ' + @ItemCodeC
WHEN @error=7 then N'No Puede Cotizar con Producto de Otro Almacen, Articulo: ' + @ItemcodeC
end
--UPDATE OCRD SET QryGroup1='N' WHERE CardCode=@CardCodeC
FETCH NEXT FROM curOQUT INTO @DocNumC, @CardCodeC, @CardNameC, @ItemCodeC, @DiscPrcntC,@DiscPrcntCGN,@UserSignC,@ListaC,@FraccionC,@PrecioC,@WhsC
END
CLOSE curOQUT
DEALLOCATE curOQUT
End
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gracias me funciono
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Por lo que veo que también consultaste sobre este tema (aquí), estas trabajando en SAP Business One (Español) no?
Por favor recuerda publicar tus temas en ese sub-espacio, así aquellos que usan ese sistema podrán leerte y ayudarte más rápido.
Si no es SAP B1, dime qué SAP tienes, y con qué módulos estás trabajando.
Saludos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
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.