UPDATE VS4TARCreditNoteMB Set TRCMAmountVAT=round(TRCMNAmountInRate/107*7,2) WHERE TRCMTaxType=2
GO
UPDATE VS4TARCreditNoteMB Set TRCMAmountVAT=0 WHERE TRCMAmountVAT is null
GO
UPDATE VS4TARCreditNoteMB Set TRCMTaxBase=TRCMNAmountInRate-TRCMAmountVAT WHERE TRCMTaxType=2
GO

UPDATE VS4TARDebitNoteMB Set TDBMAmountVAT=round(TDBMNAmountInRate/107*7,2) WHERE TDBMTaxType=2
GO
UPDATE VS4TARDebitNoteMB Set TDBMAmountVAT=0 WHERE TDBMAmountVAT is null
GO
UPDATE VS4TARDebitNoteMB Set TDBMTaxBase=TDBMNAmountInRate-TDBMAmountVAT WHERE TDBMTaxType=2
GO

UPDATE VS4TAPCreditNoteMB Set TPCMAmountVAT=round(TPCMNAmountInRate/107*7,2) WHERE TPCMTaxType=2
GO
UPDATE VS4TAPCreditNoteMB Set TPCMAmountVAT=0 WHERE TPCMAmountVAT is null
GO
UPDATE VS4TAPCreditNoteMB Set TPCMTaxBase=TPCMNAmountInRate-TPCMAmountVAT WHERE TPCMTaxType=2
GO

UPDATE VS4TAPDebitNoteMB Set TDEBAmountVAT=round(TDEBNAmountInRate/107*7,2) WHERE TDEBTaxType=2
GO
UPDATE VS4TAPDebitNoteMB Set TDEBAmountVAT=0 WHERE TDEBAmountVAT is null
GO
UPDATE VS4TAPDebitNoteMB Set TDEBTaxBase=TDEBNAmountInRate-TDEBAmountVAT WHERE TDEBTaxType=2
GO