on 10-15-2015 8:48 PM
Buen Día:
Estoy queriendo validar mediante el Transaction Notification en el cliente el campo CURP (OCRD.AddId), esta validación quiero que se dispare antes de crear una Factura, si NO hay valor en dicho campo que no se pueda crear.
En el cliente debe de estar existentes los valores siguientes:
CURP (OCRD.AddId) = 1234-1 (si es vacio se dispara el error)
Pestaña de Direcciones – Destino
Id de dirección = ‘Entrega’ (CRD1.Address)
Indicador de Impuestos = ‘IVACCF’ (CRD1.TaxCode)
-- Validación para que el cliente tenga NRC(Numero de Registro de Contribuyente) antes de facturar un CCF(Comprobante de Credito Fiscal)
IF @transaction_type in ('A') AND @object_type IN ('13')
begin
declare @NRC as nvarchar(128)
declare @IVA as nvarchar(16)
set @NRC=(select AddId from ocrd where cardcode in (select cardcode from oinv where docentry=@list_of_cols_val_tab_del))
set @IVA=(SELECT T1.[TaxCode] FROM OCRD T0 ,CRD1 T1, OINV T2
WHERE T2.CardCode = T0.CardCode and T0.[CardCode] = T1.[CardCode] and T0.[CardType] = 'C' and T1.[Address] ='Entrega' and t2.docentry=@list_of_cols_val_tab_del)
if @NRC = NULL and @IVA = 'IVACCF'
begin
SET @error = 66
SET @error_message ='Falta Numero de Registro de Contribuyente en el Cliente'
end
end
A pesar que esta vacio el campo CURP no se dispara.
Gracias por la ayuda.
Hola nelson.
Este te bloquearía perfectamente la falta de curp:
---Bloqueo clientes
If @transaction_type in ('A') And @object_type = '13'
Begin
If (Select IsNull(T0.AddId,'') FROM OCRD T0 Inner Join OINV T1 On T0.CardCode = T1.CardCode Where T1.DocEntry = @list_of_cols_val_tab_del) = ''
Begin
SET @error = 9
SET @error_message = 'El cliente no contiene CURP'
END
End
Con este código puedes guiarte perfectamente para los demás bloqueos que ocupas.
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 | |
8 | |
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.