SET DATE GERMAN
SET CENTURY on
SET DELETED ON
OPEN DATABASE d:\zoovet\baze\str
CLEAR

USE roba ALIAS roba SHARED IN 0
USE racstav ALIAS racstav SHARED IN 0

SELECT racstav
GOTO top
DO WHILE !EOF()
IF racstav.datum<>CTOD("28.12.2011")
	SKIP
	LOOP
ENDIF
a1=racstav.sifrob
a2=racstav.pcena
SELECT roba
SET ORDER TO tag sifrob
GOTO top
SEEK a1
IF FOUND()
	IF a2<>roba.procen .and. racstav.klrabat=0
		?a1,a2, roba.procen
		SELECT racstav
		replace racstav.rabat WITH (roba.procen/a2-1)*100
	endif
ENDIF
SELECT racstav
SKIP
ENDDO
RETURN
		
