OPEN DATABASE d:\robno\baze\belcar SHARED
SET DELETED ON

USE d:\robno\baze\ZAGREV ALIAS ZAGREV shared IN 0
USE d:\robno\baze\REVSTAV ALIAS REVSTAV shared IN 0
SELECT ZAGREV
GOTO top
DO WHILE !EOF()
A1=ZAGREV.BRDOK
SELECT REVSTAV
SET ORDER TO TAG BRDOK
GOTO TOP
SEEK A1
muku=0
DO WHILE !EOF()
IF revstav.brdok<>a1
	EXIT
endif	
A2=REVSTAV.KOLICINA
A3=REVSTAV.CENASAPOR
muku=muku+a2*a3
skip
ENDDO
SELECT zagrev
replace zagrev.pvred WITH muku
SKIP
ENDDO

