on 07-18-2011 5:01 PM
Buenos días
Alguna sugerencia de como hacer una alerta o bloquear la elaboración de una factura si es que tiene pendiente un anticipo?? A fin de asegurarnos que ese anticipo se aplique directamente a la factura.
Saludos.
Porque no lo haces con el transaction?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Buenas
Después de varias pruebas llegué a lo siguiente, por si a alguien le sirve
DECLARE @SOCIO NVARCHAR(40)
DECLARE @ANTICIPO NVARCHAR(40)
IF @object_type IN ('13') AND @transaction_type IN ('A','U')
BEGIN
SET @SOCIO=(Select T1.CardCode
FROM OINV T1
WHERE T1.[DocEntry] = @list_of_cols_val_tab_del)
SET @ANTICIPO=(Select T1.[DpmAmnt]
FROM OINV T1
WHERE T1.[DocEntry] = @list_of_cols_val_tab_del)
IF (
SELECT T0.[DocEntry] FROM [dbo].[ODPI] T0
WHERE (T0.[CardCode] = @SOCIO OR T0.[FatherCard] = @SOCIO AND T0.[FatherType] = 'P ' ) AND T0.[CANCELED] = 'N '
AND T0.[DpmStatus] = 'O ' AND T0.[DpmDrawn] = 'N ' AND (T0.[Posted] = 'Y '
AND cast(@ANTICIPO AS FLOAT) = 0
AND T0.[PaidSum] <> 0 OR (T0.[Posted] = 'N ' AND T0.[PaidSum] <> 0 AND T0.[DocStatus] = 'C ' )
AND T0.[Docnum] = @list_of_cols_val_tab_del )
) > '0'
BEGIN
SET @error = 1012
SET @error_message = 'Existe un anticipo de cliente'+' '+@SOCIO
END
END
Saludos
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.