update vs4tinventorymb set tinmamouquantity=-1*abs(tinmamouquantity) where 
(tinmtintalias='DAMAGE' or tinmtintalias='ISSUEUSE' or tinmtintalias='LOSS' or tinmtintalias='RECEIVEREPAIRRETURN' 
or tinmtintalias='SALEOUT' or tinmtintalias='SALEOUTPOS' or tinmtintalias='SALERETURNBACK' or tinmtintalias='SALERETURNED'
or tinmtintalias='SENDCONSIGNSOLD' or tinmtintalias='SENDREPAIR' or tinmtintalias='STOCKADJUSTOUT')
GO

update vs4tinventorymb set tinmamount=-1*abs(tinmamount) where
(tinmtintalias='DAMAGE' or tinmtintalias='ISSUEUSE' or tinmtintalias='LOSS' or tinmtintalias='RECEIVEREPAIRRETURN' 
or tinmtintalias='SALEOUT' or tinmtintalias='SALEOUTPOS' or tinmtintalias='SALERETURNBACK' or tinmtintalias='SALERETURNED'
or tinmtintalias='SENDCONSIGNSOLD' or tinmtintalias='SENDREPAIR' or tinmtintalias='STOCKADJUSTOUT')
GO

UPDATE VS4TInventoryMB set tinmoutquantity=abs(tinminquantity) WHERE tinmoutquantity=0 and
(tinmtintalias='DAMAGE' or tinmtintalias='ISSUEUSE' or tinmtintalias='LOSS'  or tinmtintalias='RECEIVEREPAIRRETURN' 
or tinmtintalias='SALEOUT' or tinmtintalias='SALEOUTPOS' or tinmtintalias='SALERETURNBACK' or tinmtintalias='SALERETURNED'
or tinmtintalias='SENDCONSIGNSOLD' or tinmtintalias='SENDREPAIR' or tinmtintalias='STOCKADJUSTOUT')
GO

UPDATE VS4TInventoryMB set tinminquantity=0 WHERE tinminquantity<>0 and tinmoutquantity<>0 and
(tinmtintalias='DAMAGE' or tinmtintalias='ISSUEUSE' or tinmtintalias='LOSS' or tinmtintalias='RECEIVEREPAIRRETURN' 
or tinmtintalias='SALEOUT' or tinmtintalias='SALEOUTPOS' or tinmtintalias='SALERETURNBACK' or tinmtintalias='SALERETURNED'
or tinmtintalias='SENDCONSIGNSOLD' or tinmtintalias='SENDREPAIR' or tinmtintalias='STOCKADJUSTOUT')
GO
