UPDATE VS4TARInvoiceMB Set TIoMAmountVAT=round(TIoMNAmountInRate/107*7,2) WHERE TIoMTaxType=2
GO
UPDATE VS4TARInvoiceMB Set TIoMAmountVAT=0 WHERE (SELECT TIvoVATRate FROM VS4TARInvoice WHERE VS4TARInvoice.TIvoNo=VS4TARInvoiceMB.TIoMTIvoNo)=0
GO
UPDATE VS4TARInvoiceMB Set TIoMAmountVAT=0 WHERE TIoMAmountVAT is null
GO
UPDATE VS4TARInvoiceMB Set TIoMTaxBase=TIoMNAmountInRate-TIoMAmountVAT WHERE TIoMTaxType=2
GO

UPDATE VS4TAPInvoiceMB Set TIPMAmountVAT=round(TIPMNAmountInRate/107*7,2) WHERE TIPMTaxType=2
GO
UPDATE VS4TAPInvoiceMB Set TIPMAmountVAT=0 WHERE (SELECT TIAPVATRate FROM VS4TAPInvoice WHERE VS4TAPInvoice.TIAPNo=VS4TAPInvoiceMB.TIPMTIAPNo)=0
GO
UPDATE VS4TAPInvoiceMB Set TIPMAmountVAT=0 WHERE TIPMAmountVAT is null
GO
UPDATE VS4TAPInvoiceMB Set TIPMTaxBase=TIPMNAmountInRate-TIPMAmountVAT WHERE TIPMTaxType=2
GO
