SET DELETED ON

OPEN DATABASE D:\2011\STR\BAZE\STR

USE ROBA ALIAS ROBA IN 0

USE D:\BIOS\RO\ZALIHE ALIAS ZALIHE IN 0
USE D:\BIOS\RO\RO01 ALIAS RO01 IN 0
USE D:\BIOS\A\KALKSTAV ALIAS KALKSTAV IN 0

SELECT ROBA
ZAP

SELECT ZALIHE
INDEX ON ZA_SIFRA TO A
SET INDEX TO  A
GOTO TOP

SELECT KALKSTAV
SET ORDER TO KALKSTAV
GOTO TOP


SELECT RO01
GOTO TOP
DO WHILE !EOF()
A1=RO01.RO01CTRL
A2=RO01.RO01NAZ
A3=RO01.JM
A4=0
A5=0
a6=0
SELECT ZALIHE
GOTO TOP
SEEK "01"+A1
IF FOUND()
*!*		A4=ZALIHE.ZA_NABAVNA
*!*		A5=ZALIHE.ZA_vpc
	a6=zalihe.za_ulaz-zalihe.za_izlaz
ENDIF
SELECT KALKSTAV
GOTO TOP
SEEK A1
DO WHILE !EOF()
IF KALKSTAV.KS_CEN<>0 .AND. KALKSTAV.KS_MPC<>0
	A4=KALKSTAV.KS_CEN
	A5=KALKSTAV.KS_MPC
	EXIT
ENDIF
SKIP
ENDDO
		
SELECT roba
APPEND BLANK
replace roba.sifrob WITH a1
replace roba.naziv WITH a2
replace roba.jm WITH a3
replace roba.tarifa WITH "18"
replace roba.nabcen WITH a4*(1-18/118)
replace roba.procen WITH a5	
replace roba.kolicina WITH a6
SELECT ro01
SKIP
ENDDO
