Actualitza el nom del interlocutor comercial de les factures marcades amb error al monitor amb el nom que figura al mestre:

update T1 set T1.CardName=T2.CardName
from OINV T1
join ECM2 T0 on T1.DocEntry=T0.SrcObjAbs and T0.SrcObjType='13'
join OCRD T2 on T2.CardCode=T1.CardCode
where T0.ActStatus<>'O' and T1.CardName<>T2.CardName

update T1 set T1.CardName=T2.CardName
from ORIN T1
join ECM2 T0 on T1.DocEntry=T0.SrcObjAbs and T0.SrcObjType='14'
join OCRD T2 on T2.CardCode=T1.CardCode
where T0.ActStatus<>'O' and T1.CardName<>T2.CardName

update T1 set T1.CardName=T2.CardName
from OPCH T1
join ECM2 T0 on T1.DocEntry=T0.SrcObjAbs and T0.SrcObjType='18'
join OCRD T2 on T2.CardCode=T1.CardCode
where T0.ActStatus<>'O' and T1.CardName<>T2.CardName

update T1 set T1.CardName=T2.CardName
from ORPC T1
join ECM2 T0 on T1.DocEntry=T0.SrcObjAbs and T0.SrcObjType='19'
join OCRD T2 on T2.CardCode=T1.CardCode
where T0.ActStatus<>'O' and T1.CardName<>T2.CardName

Actualitzar la informació del NIF:

update T1 set T1.LicTradNum=T2.LicTradNum
from OINV T1
join ECM2 T0 on T1.DocEntry=T0.SrcObjAbs and T0.SrcObjType='13'
join OCRD T2 on T2.CardCode=T1.CardCode
where T0.ActStatus<>'O' and T1.LicTradNum<>T2.LicTradNum

update T1 set T1.LicTradNum=T2.LicTradNum
from ORIN T1
join ECM2 T0 on T1.DocEntry=T0.SrcObjAbs and T0.SrcObjType='14'
join OCRD T2 on T2.CardCode=T1.CardCode
where T0.ActStatus<>'O' and T1.LicTradNum<>T2.LicTradNum

update T1 set T1.LicTradNum=T2.LicTradNum
from OPCH T1
join ECM2 T0 on T1.DocEntry=T0.SrcObjAbs and T0.SrcObjType='18'
join OCRD T2 on T2.CardCode=T1.CardCode
where T0.ActStatus<>'O' and T1.LicTradNum<>T2.LicTradNum

update T1 set T1.LicTradNum=T2.LicTradNum
from ORPC T1
join ECM2 T0 on T1.DocEntry=T0.SrcObjAbs and T0.SrcObjType='19'
join OCRD T2 on T2.CardCode=T1.CardCode
where T0.ActStatus<>'O' and T1.LicTradNum<>T2.LicTradNum

 

image_pdf