update vs4tinventorymb set tinmamouquantity=abs(tinmamouquantity) where tinmshow=1 and
(tinmtintalias='BORROW' or tinmtintalias='BORROWBACK' or tinmtintalias='BUILT' or tinmtintalias='BUILTOUT' or tinmtintalias='CHANGESTATUS' 
or tinmtintalias='PURCHASERETURN' or tinmtintalias='RECEIVEBORROW' or tinmtintalias='RECEIVECONSIGN'
or tinmtintalias='RECEIVECONSIGNRETURN' or tinmtintalias='RETURNBUILT' or tinmtintalias='SENDCONSIGN' or tinmtintalias='SENDCONSIGNRETURN'
or tinmtintalias='TRANSFER')
GO

update vs4tinventorymb set tinmamouquantity=-1*abs(tinmamouquantity) where tinmshow=0 and
(tinmtintalias='BORROW' or tinmtintalias='BORROWBACK' or tinmtintalias='BUILT' or tinmtintalias='BUILTOUT' or tinmtintalias='CHANGESTATUS' 
or tinmtintalias='PURCHASERETURN' or tinmtintalias='RECEIVEBORROW' or tinmtintalias='RECEIVECONSIGN'
or tinmtintalias='RECEIVECONSIGNRETURN' or tinmtintalias='RETURNBUILT' or tinmtintalias='SENDCONSIGN' or tinmtintalias='SENDCONSIGNRETURN'
or tinmtintalias='TRANSFER')
GO

update vs4tinventorymb set tinmamount=abs(tinmamount) where tinmamouquantity>0 and
(tinmtintalias='BORROW' or tinmtintalias='BORROWBACK' or tinmtintalias='BUILT' or tinmtintalias='BUILTOUT' or tinmtintalias='CHANGESTATUS' 
or tinmtintalias='PURCHASERETURN' or tinmtintalias='RECEIVEBORROW' or tinmtintalias='RECEIVECONSIGN'
or tinmtintalias='RECEIVECONSIGNRETURN' or tinmtintalias='RETURNBUILT' or tinmtintalias='SENDCONSIGN' or tinmtintalias='SENDCONSIGNRETURN'
or tinmtintalias='TRANSFER')
GO

update vs4tinventorymb set tinmamount=-1*abs(tinmamount) where tinmamouquantity<0 and
(tinmtintalias='BORROW' or tinmtintalias='BORROWBACK' or tinmtintalias='BUILT' or tinmtintalias='BUILTOUT' or tinmtintalias='CHANGESTATUS' 
or tinmtintalias='PURCHASERETURN' or tinmtintalias='RECEIVEBORROW' or tinmtintalias='RECEIVECONSIGN'
or tinmtintalias='RECEIVECONSIGNRETURN' or tinmtintalias='RETURNBUILT' or tinmtintalias='SENDCONSIGN' or tinmtintalias='SENDCONSIGNRETURN'
or tinmtintalias='TRANSFER')
GO

UPDATE VS4TInventoryMB set tinminquantity=abs(tinmoutquantity) WHERE tinminquantity=0 and  tinmamouquantity>0 and
(tinmtintalias='BORROW' or tinmtintalias='BORROWBACK' or tinmtintalias='BUILT' or tinmtintalias='BUILTOUT' or tinmtintalias='CHANGESTATUS' 
or tinmtintalias='PURCHASERETURN' or tinmtintalias='RECEIVEBORROW' or tinmtintalias='RECEIVECONSIGN'
or tinmtintalias='RECEIVECONSIGNRETURN' or tinmtintalias='RETURNBUILT' or tinmtintalias='SENDCONSIGN' or tinmtintalias='SENDCONSIGNRETURN'
or tinmtintalias='TRANSFER')
GO

UPDATE VS4TInventoryMB set tinmoutquantity=0 WHERE tinminquantity<>0 and tinmoutquantity<>0 and  tinmamouquantity>0 and
(tinmtintalias='BORROW' or tinmtintalias='BORROWBACK' or tinmtintalias='BUILT' or tinmtintalias='BUILTOUT' or tinmtintalias='CHANGESTATUS' 
or tinmtintalias='PURCHASERETURN' or tinmtintalias='RECEIVEBORROW' or tinmtintalias='RECEIVECONSIGN'
or tinmtintalias='RECEIVECONSIGNRETURN' or tinmtintalias='RETURNBUILT' or tinmtintalias='SENDCONSIGN' or tinmtintalias='SENDCONSIGNRETURN'
or tinmtintalias='TRANSFER')
GO

UPDATE VS4TInventoryMB set tinmoutquantity=abs(tinminquantity) WHERE tinmoutquantity=0 and  tinmamouquantity<0 and
(tinmtintalias='BORROW' or tinmtintalias='BORROWBACK' or tinmtintalias='BUILT' or tinmtintalias='BUILTOUT' or tinmtintalias='CHANGESTATUS' 
or tinmtintalias='PURCHASERETURN' or tinmtintalias='RECEIVEBORROW' or tinmtintalias='RECEIVECONSIGN'
or tinmtintalias='RECEIVECONSIGNRETURN' or tinmtintalias='RETURNBUILT' or tinmtintalias='SENDCONSIGN' or tinmtintalias='SENDCONSIGNRETURN'
or tinmtintalias='TRANSFER')
GO

UPDATE VS4TInventoryMB set tinminquantity=0 WHERE tinminquantity<>0 and tinmoutquantity<>0 and  tinmamouquantity<0 and
(tinmtintalias='BORROW' or tinmtintalias='BORROWBACK' or tinmtintalias='BUILT' or tinmtintalias='BUILTOUT' or tinmtintalias='CHANGESTATUS' 
or tinmtintalias='PURCHASERETURN' or tinmtintalias='RECEIVEBORROW' or tinmtintalias='RECEIVECONSIGN'
or tinmtintalias='RECEIVECONSIGNRETURN' or tinmtintalias='RETURNBUILT' or tinmtintalias='SENDCONSIGN' or tinmtintalias='SENDCONSIGNRETURN'
or tinmtintalias='TRANSFER')
GO