SET DELETED ON
SET DATE GERMAN
SET CENTURY ON
OPEN DATABASE d:\2011\str\baze\str SHARED

USE roba ALIAS roba SHARED IN 0
USE nivstav ALIAS nivstav EXCLUSIVE IN 0

SELECT nivstav
ZAP

SELECT roba
GOTO top
DO WHILE !EOF()
a1=roba.sifrob
a2=roba.procen
a3=roba.kolicina
IF a2-FLOOR(a2)>0
	SELECT nivstav
	APPEND BLANK
	replace nivstav.brdok	WITH "000001"
	replace nivstav.sifrob WITH a1
	replace nivstav.kolicina WITH a3
	replace nivstav.scena WITH a2
	replace nivstav.ncena WITH CEILING(a2) 
	replace nivstav.marza WITH (nivstav.ncena-nivstav.scena)*(1-18/118)
	replace nivstav.datum WITH CTOD("04.01.2011")
	REPLACE NIVSTAV.VREME WITH "11:00:00"
	replace nivstav.pdv WITH (nivstav.ncena-nivstav.scena)*(18/118)
	REPLACE NIVSTAV.tarifa WITH "18"
	replace nivstav.stopa WITH 18
ENDIF
SELECT roba
SKIP
ENDDO
RETURN
	