Lude cjene za vrednovanje

update g
set g.anStockPrice = m.anBuyPrice
from tHE_MoveItem g
inner join tHE_SetItem m on g.acIdent = m.acIdent
where g.acKey like '15A2Q%' and abs(round(abs(g.anStockPrice),0)- abs(m.anBuyPrice)) > 1000

 

update g
set g.anStockPrice = m.anBuyPrice
from tHE_MoveItem g
inner join tHE_SetItem m on g.acIdent = m.acIdent
where abs(round(abs(g.anStockPrice),0)- abs(m.anBuyPrice)) > 100

update g
set g.anStockPrice = m.anBuyPrice
from tHE_MoveItem g
inner join tHE_SetItem m on g.acIdent = m.acIdent
where g.anStockPrice <= 0 and g.anQty > 0

 


update p
set p.anStockPrice = round(p.anPrice - p.anPrice * 16.66666666666667 / 100,3)
from tHE_Move g
inner join tHE_MoveItem p on g.acKey = p.acKey
inner join tPA_SetDocType d on g.acDocType = d.acDocType-- and d.acType = 'M'
WHERE LEN(RTRIM(SUBSTRING(cast(p.anStockPrice as char), CHARINDEX('.', cast(p.anStockPrice as char))+1, 50))) > 7