CLOSE ALL
OPEN DATABASE d:\2009\robno\baze\belcar

USE d:\2009\robno\baze\kupdob ALIAS kupdob IN 0
SELECT kupdob
SET ORDER to tag kupdob
GOTO top

OPEN DATABASE d:\2009\fin\baze\fin

USE d:\2009\fin\baze\konplan ALIAS konplan IN 0
USE d:\2009\fin\baze\gknjiga ALIAS gknjiga IN 0
SELECT konplan

SELECT gknjiga
GOTO top
DO WHILE !EOF()
IF EMPTY(gknjiga.analitika)
	SKIP
	LOOP
endif	
mkon=gknjiga.konto
mana=gknjiga.analitika
SELECT konplan
SET ORDER TO tag konplan
GOTO top
SEEK mkon+mana
IF !FOUND()
	SELECT kupdob
	SET ORDER TO tag kupdob
	SEEK SUBSTR(mana,1,6)
	SELECT konplan
	APPEND BLANK
	replace konplan.konto WITH mkon
	replace konplan.analitika WITH mana
	replace konplan.naziv WITH kupdob.naziv
ELSE
	SELECT kupdob
	SET ORDER TO tag kupdob
	SEEK SUBSTR(mana,1,6)
	SELECT konplan
	replace konplan.naziv WITH kupdob.naziv
ENDIF
SELECT gknjiga
SKIP
ENDDO
RETURN
	

