******************************************************************
PROCEDURE cenovky
DO clos_data
SELECT 0
USE (m.fn_karty) ALIAS karty
SELECT nazev, c_karty, kod, druh_kalk, cena_prum, cena01, objem, c_mena WHERE nazev1 # m.smazana_karta .AND. !EMPTY(druh_kalk);
	FROM (m.fn_karty) INTO TABLE (gcpri_path + "doklad")
SELECT DISTINCT druh_kalk AS druh, .T. AS lbl FROM (m.gcpri_path + "doklad") INTO TABLE (m.gcpri_path + "seldruhy")
m.gcfilter_triedenia=""
DO FORM seldruhy TO nenulove
SELECT doklad
SET RELATION TO druh_kalk INTO seldruhy
DELETE FOR EMPTY(seldruhy.lbl)
SET RELATION OFF INTO seldruhy
USE IN seldruhy
filtrujpriznaky("doklad")
RELEASE m.gcfilter_triedenia
PACK

SELECT doklad
IF RECCOUNT()>0
	SELECT DISTINCT nazev AS druh, .T. AS lbl FROM (m.gcpri_path + "doklad") INTO TABLE (m.gcpri_path + "seldruhy")
	DO FORM seldruhy TO nenulove
	SELECT doklad
	SET RELATION TO nazev INTO seldruhy
	DELETE FOR EMPTY(seldruhy.lbl)
	SET RELATION OFF INTO seldruhy
	USE IN seldruhy
	PACK
	IF RECCOUNT()>0
		SELECT 0
		CREATE CURSOR stitky (nazev1 c(30),cena1 Y, objem1 N(10,4), c_mena1 i,nazev2 c(30),cena2 Y, objem2 N(10,4), c_mena2 i,nazev3 c(30),cena3 Y, objem3 N(10,4), c_mena3 i)
		SELECT doklad
		m.x="1"
		SCAN ALL
			IF m.x="1"
				INSERT INTO stitky (nazev1,cena1,objem1,c_mena1) VALUES (doklad.nazev, doklad.cena01,doklad.objem,doklad.c_mena)
				m.x="2"
			ELSE
				IF m.x="2"
					REPLACE stitky.nazev2 WITH doklad.nazev, stitky.cena2 WITH doklad.cena01, stitky.objem2 WITH doklad.objem, stitky.c_mena2 WITH doklad.c_mena
					m.x="3"
				ELSE
					REPLACE stitky.nazev3 WITH doklad.nazev, stitky.cena3 WITH doklad.cena01, stitky.objem3 WITH doklad.objem, stitky.c_mena3 WITH doklad.c_mena
					m.x="1"
				ENDIF
			ENDIF
		ENDSCAN
		SELECT stitky
		REPLACE c_mena1 WITH m.giakt_mena FOR EMPTY(c_mena1)
		REPLACE c_mena2 WITH m.giakt_mena FOR EMPTY(c_mena2)
		REPLACE c_mena3 WITH m.giakt_mena FOR EMPTY(c_mena3)
		REPLACE objem1 WITH 1 FOR EMPTY(objem1)
		REPLACE objem2 WITH 1 FOR EMPTY(objem2)
		REPLACE objem3 WITH 1 FOR EMPTY(objem3)
		GO TOP
		IF m.giref_mena<>m.giakt_mena
			DO FORM get_mena
			IF m.girep_mena<=ALEN(en_meny,1)
			ELSE
				m.girep_mena=m.giakt_mena
			ENDIF
		ELSE
			m.girep_mena=m.giakt_mena

		ENDIF
		SELECT 0
		#IF "SLOVAK"$UPPER(GETENV("language"))
			SELECT SPACE(30) AS zostava,.F. AS lbl INTO CURSOR selzost FROM stitky WHERE .f. READWRITE 
			INSERT INTO selzost (zostava,lbl) VALUES ("Rozmer: 6,7 x 9",.F.)
			INSERT INTO selzost (zostava,lbl) VALUES ("Rozmer: 6,7 x 4,5",.F.)
			DO FORM selpartn WITH "selzost","zostava"
		#ELSE
			SELECT SPACE(30) AS sestava,.F. AS lbl INTO CURSOR selzost FROM stitky WHERE .f. READWRITE 
			INSERT INTO selzost (sestava,lbl) VALUES ("Rozměr: 6,7 x 9",.F.)
			INSERT INTO selzost (sestava,lbl) VALUES ("Rozměr: 6,7 x 4,5",.F.)
			DO FORM selpartn WITH "selzost","sestava"
		#ENDIF
		SELECT selzost
		SCAN FOR !EMPTY(lbl)
			DO CASE
				CASE RECNO()=1
					SELECT stitky
					DO pr_report WITH "cenovky"
				CASE RECNO()=2
					SELECT stitky
					DO pr_report WITH "cenovky1"
			ENDCASE
			SELECT selzost
		ENDSCAN
		USE IN selzost
		USE IN stitky
	ENDIF
ENDIF
USE IN doklad
USE IN karty


