on 02-12-2010 9:23 PM
Estimado amigos nuevamente quisiera pedirles su apoyo como puedo hacer una validacion para que no se haga una factura si este no tiene un documento base osea si no tiene como base una Orden de venta o una entrega ??
he hecho validaciones por el documento pero no validando a a nivel de detalle ya que el basetype esta en la tabla inv1 como puedo hacer ???
Slds
QASAC
Hola Jesus
Prueba con la siguiente validación
-- VALIDACION OBLIGATORIO FACTURA TENGA UNA ENTREGA
IF @object_type IN ('13') AND @error = 0 --OBJECT TYPE DE OITM
AND @transaction_type IN ('A')
AND @list_of_cols_val_tab_del <> ''
BEGIN
DECLARE @Con_factura Int
DECLARE @MSN Int
SET @Con_factura = 0
IF @object_type = '13' --FACTURA VENTA
BEGIN
SET @Con_factura = (SELECT COUNT(*)
FROM INV1 T0
JOIN OINV T1 ON T1.DocEntry = T0.DocEntry
WHERE T0.DocEntry = @list_of_cols_val_tab_del
AND T1.DocType = 'I'
AND T0.BaseType IN (-1, 17, 23))
if @Con_factura > 0 begin
set @error = 130
set @error_message= 'No existe una Entrega'
end
END
END
-
-
FIN DE OBLIGATORIO FACTURA TENGA UNA ENTREGA
Espero te sea de ayuda
Saludos Cordiales,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hola Jesús, puedes realizar un stored procedure que combine las tablas cabecera y lineas y haces la validación con algun campo de las líneas. Intenta y me avisas cualquier cosa
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 | |
6 | |
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.