Hi
Cardcode exists is Sales Order but still it is allowing to add A/R Invoice
IF @transaction_type IN ('A','U') AND @object_type = '13'
BEGIN
if exists
(SELECT T1.[CardCode]
FROM OINV T0
INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
INNER JOIN INV1 T2 ON T0.DocEntry = T2.DocEntry
Where T0.DocEntry=@list_of_cols_val_tab_del
and T2.BaseType=-1
and not exists
(SELECT T.[DocEntry] FROM RDR1 T WHERE T.[BaseCard]=T1.[CardCode]))
SELECT @error = 1, @error_message = 'A/R Invoice without Copy From Delivery not Permitted !'
Thanks