SET EXCLUSIVE ON
SET DATE GERMAN
SET CENTURY on
SET DELETED ON

USE inventar ALIAS inventar IN 0
SELECT inventar
ZAP
SET ORDER TO tag sifrob
GOTO top

USE decalt ALIAS deca IN 0
USE kancelarija ALIAS kancelarija IN 0
USE tijanalt ALIAS tijana IN 0
USE vukosavalt ALIAS vukosava IN 0

********************** deca
SELECT deca
GOTO top
DO WHILE !EOF()
a1=deca.sifrob
a2=deca.naziv
a3=deca.nabcen
a4=deca.procen
a5=deca.kolicina
SELECT inventar
GOTO top
SEEK a1
IF !FOUND()
	APPEND blank
	replace inventar.sifrob WITH a1
	replace inventar.naziv 	WITH a2
ELSE
	replace inventar.nabcen WITH a3
	replace inventar.procen WITH a4
	replace inventar.kolicina WITH inventar.kolicina+a5
endif	
SELECT deca
SKIP
ENDDO
*******************************
********************** kancelarija
SELECT kancelarija
GOTO top
DO WHILE !EOF()
a1=kancelarija.sifrob
a2=kancelarija.naziv
a3=kancelarija.nabcen
a4=kancelarija.procen
a5=kancelarija.kolicina
SELECT inventar
GOTO top
SEEK a1
IF !FOUND()
	APPEND blank
	replace inventar.sifrob WITH a1
	replace inventar.naziv 	WITH a2
ELSE
	replace inventar.nabcen WITH a3
	replace inventar.procen WITH a4
	replace inventar.kolicina WITH inventar.kolicina+a5
endif	
SELECT kancelarija
SKIP
ENDDO
*******************************
********************** tijana
SELECT tijana
GOTO top
DO WHILE !EOF()
a1=tijana.sifrob
a2=tijana.naziv
a3=tijana.nabcen
a4=tijana.procen
a5=tijana.kolicina
SELECT inventar
GOTO top
SEEK a1
IF !FOUND()
	APPEND blank
	replace inventar.sifrob WITH a1
	replace inventar.naziv 	WITH a2
ELSE
	replace inventar.nabcen WITH a3
	replace inventar.procen WITH a4
	replace inventar.kolicina WITH inventar.kolicina+a5
endif	
SELECT tijana
SKIP
ENDDO
*******************************
********************** vukosava
SELECT vukosava
GOTO top
DO WHILE !EOF()
a1=vukosava.sifrob
a2=vukosava.naziv
a3=vukosava.nabcen
a4=vukosava.procen
a5=vukosava.kolicina
SELECT inventar
GOTO top
SEEK a1
IF !FOUND()
	APPEND blank
	replace inventar.sifrob WITH a1
	replace inventar.naziv 	WITH a2
ELSE
	replace inventar.nabcen WITH a3
	replace inventar.procen WITH a4
	replace inventar.kolicina WITH inventar.kolicina+a5
endif	
SELECT vukosava
SKIP
ENDDO
*******************************
RETURN
