on 10-22-2009 5:11 PM
HOLA, ESTOY REALIZANDO UN SP PARA EL LIMITE DE CREDITO PERO EN OCASIONES TOMA EL SALO DE PEDIDOS Y ENTRGAS.... UNICAMENTE ES EL DE SALDO DE LA CUENTA CONTRA EL LIMITE DE CREDITO. LA SIGUIENTE CONSULTA ES LA QUE UTILIZO
-- Validacion de limite de credito en Factura
IF @transaction_type IN ('A','D','C') AND @object_type IN ('13')
BEGIN
if exists (Select T2.DocTotal from OINV T2 INNER JOIN OCRD T1 ON T2.CardCode = T1.CardCode WHERE T2.CardCode Like 'A_%%' AND ((T1.Balance*-1) + T2.DocTotal) > T1.[CreditLine] AND T2.DocEntry = @list_of_cols_val_tab_del )
begin
SELECT @error = 1, @error_message = 'SUPERO LIMITE DE CREDITO'
end
END
LO QUE REALIZA ES SUMA EL BALANCE + EL TOTAL DEL DOCUMENTO (FACTURA) > LIMITE DE CREDITO
ALGUIEN ME PODRIA AYUDAR O IDENTIFICAR ALGUNA IRREGULARIDAD.
SALUDOS
MS
Las autorizaciones que trae SAP para Limite de Credito no te sirven?
Yo tengo autorizacion para eso......antes de denegar no crees que deberias dar la opcion a la gente de tesoreria examinar el caso y ellos decidir si se le permite o no?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hola..
Entiendo que las opciones que SAP Business One te proporciona no contemplan una validación de este tipo, ya que como sabrás cuentas con Alarmas y con mensajes de advertencia cada vez que se supera el límite de crédito de un Socio de Negocios.
Los mensajes de advertencia son solo eso, mensajes, que no privan al usuario de crear de todos modos el documento, mientras que las alarmas son post-evento, vale decir, informan una vez que se ha superado el limite luego de la creación del documento.
Ahora para los propósitos deseados te sugiero que pruebes con el siguiente query:
IF (@object_type = '13' AND @transaction_type = 'A' )
BEGIN
DECLARE @VAR INT
DECLARE @SN AS NVARCHAR (30)
DECLARE @BALANCE INT
DECLARE @LINCRE INT
DECLARE @SUMCRE INT
SET @VAR =(SELECT DocTotal FROM OINV WHERE DocEntry = @list_of_cols_val_tab_del)
SET @SN =(SELECT CardCode FROM OINV WHERE DocEntry = @list_of_cols_val_tab_del)
SET @BALANCE = (SELECT abs(T1.Balance) FROM OCRD T1 WHERE T1.CardCode = @SN)
SET @LINCRE = (SELECT T1.CreditLine FROM OCRD T1 WHERE T1.CardCode = @SN)
SET @SUMCRE = (@BALANCE + @VAR)
IF (@SUMCRE > @LINCRE)
begin
SET @error = 1
SET @error_message = 'Supera Limite de Credito Cliente'
end
END
Pruebalo y me comentas como te fue.
Espero te sea de ayuda,
Saludos,
Edited by: Paul Ponce on Nov 15, 2009 7:01 PM
Edited by: Paul Ponce on Nov 19, 2009 11:16 PM
Edited by: Paul Ponce on Dec 29, 2009 7:03 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
7 | |
7 | |
4 | |
4 | |
3 | |
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.