SET DELETED ON
clear
SET DEFAULT TO d:\2011\robno\baze
OPEN DATABASE belcar SHARED
USE kalkstav ALIAS kalkstav shared IN 0
sET DEVICE TO printer
SET PRINTER TO a.lst
USE d:\2010\robno\baze\zalihe ALIAS zalihe shared IN 0
SELECT kalkstav
GOTO top
DO WHILE !EOF()
IF KALKSTAV.BRDOK="PS"
	A1=KALKSTAV.SIFROB
	MM=KALKSTAV.MAGACIN
	SELECT ZALIHE
	SET ORDER TO TAG ZALIHE
	GOTO TOP
	SEEK MM+A1
	IF FOUND()
		A2=ZALIHE.NABCEN
		A3=ZALIHE.PROCEN
		IF a2<>kalkstav.ncena .or. (zalihe.ukol-zalihe.ikol)-kalkstav.kolicina<>0
			@PROW()+1,1 say a1 picture "99999999"
			@PROW(),10 say zalihe.ukol-zalihe.ikol
			@PROW(),25 say zalihe.nabcen
			@PROW(),40 say kalkstav.kolicina
			@PROW(),55 say kalkstav.ncena
		endif	
*!*			SELECT KALKSTAV
*!*			REPLACE KALKSTAV.NCENA WITH A2
*!*			REPLACE KALKSTAV.PCENA WITH A3
*!*			REPLACE KALKSTAV.DOBCEN WITH A2
	ENDIF
ENDIF
SELECT KALKSTAV
SKIP
ENDDO
SET PRINTER to
SET DEVICE TO screen

RETURN
