CLOSE TABLES

USE d:\2009\pod\august\artikli ALIAS artikli IN 0
USE d:\2009\robno\baze\roba ALIAS roba EXCLUSIVE IN 0

SELECT roba
ZAP

SELECT artikli
GOTO top
DO WHILE !EOF()
a1=artikli.preduzece
IF ALLTRIM(a1)<>"1"
	SKIP
	LOOP
endif	
a2=artikli.sifra
a3=artikli.jm
a5=artikli.stopa*100
IF a5=0
	mtar="0"
ENDIF
IF a5=8
	mtar="8"
ENDIF
IF a5=18
	mtar="18"
ENDIF
IF a5=5
	mtar="5"
ENDIF
	

a4=UPPER(naziv)
a4=konvertuj(a4,"CCC","È")
a4=konvertuj(a4,"CC","Æ")
a4=konvertuj(a4,"DJ","Ð")
a4=konvertuj(a4,"ZZ","Ž")
a4=konvertuj(a4,"SS","Š")

SELECT roba
APPEND BLANK
replace roba.sifrob 	WITH a2
replace roba.naziv	WITH a4
replace roba.jm		WITH a3
replace roba.tarifa	WITH mtar
SELECT artikli
SKIP
ENDDO
RETURN



FUNCTION KONVeRTUJ(STA,menjam,CIME)
Ml1=LEN(ALLTRIM(sta))
ml2=LEN(ALLTRIM(cime))
ml3=LEN(ALLTRIM(menjam))
FOR i=1 TO ml1
mpoz=AT(menjam,sta)
IF mpoz>0
	sta1=SUBSTR(sta,1,mpoz-1)
	sta1=sta1+cime+SUBSTR(sta,mpoz+ml3,ml1-(mpoz+ml3-1))
	sta=sta1
ENDIF
NEXT i
return(sta)	
