on 08-31-2010 4:24 PM
Existe alguna forma de bloquear a un cliente que tenga facturas vencidas?.
Es decir, que al tener alguna factura vencida no se le pueda seguir facturando.
Gracias de antemano.
Hola...
Podrías intentar con la siguiente validación...
IF (@transaction_type = 'A' OR @transaction_type = 'U') and @object_type = '13'
BEGIN
DECLARE @CONT INT
DECLARE @HOY DATETIME
DECLARE @CLIENTE NVARCHAR(40)
SET @HOY = (SELECT T0.DocDueDate FROM OINV T0 WHERE T0.DocEntry = @list_of_cols_val_tab_del)
SET @CLIENTE = (SELECT T0.CardCode FROM OINV T0 WHERE T0.DocEntry = @list_of_cols_val_tab_del)
SET @CONT = (SELECT COUNT(T0.DocNum) FROM OINV T0 WHERE T0.DocDueDate < @HOY AND T0.CardCode = @CLIENTE AND T0.DocStatus = 'O')
IF @CONT > 0
BEGIN
SET @error = '999'
SET @error_message = 'Existen Facturas Vencidas de este cliente'
END
END
Lo que hace es buscar al momento de querer crear una factura de cliente, si existen facturas vencidas. Si existen no permite la creación del documento actual.
De acuerdo a tu requerimiento lo modificas en caso fuese necesario.
Saludos Cordiales,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Podrias dependiendo de tu proceso de ventas, meter una alarma desde el pedido, para que se cree unicamente como preliminar el pedido.
Por ejemplo para facturas vencidas a mas de 10 dias el query seria algo como
SELECT Distinct 'TRUE' FROM OINV T0 WHERE T0.DocStatus = 'O'
AND DateDiff(dd, T0.DocDueDate, CONVERT(DateTime, CONVERT(nvarchar(11),GetDate(),112),112)) >= 10
AND T0.CardCOde = $[$4.0.0]
AND (Select balance from ocrd where cardcode=$[$4.0.0]) <>0
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hola...
Tendrías que hacer una validación por SQL (Transaction Notification), que identifique si existen para el SN facturas vencidas, y en virtud de ello arroje un mensaje que impida la facturación. Otra alternativa sería crear una alarma, pero ello solo te alertaría de la condición del cliente más no te impediría facturarle.
Existen varios post en donde se plantean soluciones de este tipo, te sugiero echar un vistazo para cubrir tu requerimiento..
Saludos Cordiales,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
6 | |
5 | |
5 | |
5 | |
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.