PARAMETERS menoform
LOCAL sumacelkom, sumajedna, m.vyber, sumadva, sumacelkomdva
m.sumacelkom=0
m.sumajedna=0
m.sumacelkomdva=0
m.sumadva=0
m.vyber=""
* Create a custom shape - Losangle
WITH _Screen.System.Drawing as xfcDrawing
	LOCAL loPath as xfcGraphicsPath
	loPath = .Drawing2D.GraphicsPath.New()
	loPath.StartFigure()
	LOCAL laPoints(4)
	laPoints(1) = .Point.New(3,0)
	laPoints(2) = .Point.New(0,3)
	laPoints(3) = .Point.New(3,6)
	laPoints(4) = .Point.New(6,3)
	loPath.AddPolygon(@laPoints)
ENDWITH 

CREATE CURSOR sales (Chart1 n(8,2) NULL,Chart2 n(8,2) NULL,Chart3 n(8,2) NULL,Chart4 n(8,2) NULL,Chart5 n(8,2) NULL, Legenda c(30), Detach l, Color i, DadosX c(30), Hide_Slice l)
DO CASE 
	CASE LOWER(repo_name)=="por_hodiny"
		SELECT disti id_kas, SPACE(30) as meno FROM hodiny INTO CURSOR aaa READWRITE 
		REPLACE ALL meno WITH i_zkrat(id_kas)
		INSERT INTO aaa(id_kas,meno) VALUES ("__",jaz("rep_spolu"))
		LOCAL zorad
		IF RECCOUNT("aaa")>1
			DO FORM dajdruh WITH "", "aaa","id_kas",50,"meno",250 TO m.vyber
		ELSE
			m.vyber="__"		
		ENDIF 
		SELECT aaa
		IF m.vyber="__"
			SELECT hodina as meno, hodina, SUM(cena_slev) as stav, SUM(pocet_h) as mnozstvi, SUM(cena_slev2) as stav2, SUM(pocet_h2) as mnozstvi2 FROM hodiny GROUP BY hodina INTO CURSOR aaa READWRITE ORDER BY hodina
		ELSE
			SELECT hodina as meno, hodina, SUM(cena_slev) as stav, SUM(pocet_h) as mnozstvi, SUM(cena_slev2) as stav2, SUM(pocet_h2) as mnozstvi2 FROM hodiny GROUP BY hodina INTO CURSOR aaa READWRITE  WHERE id_kas=m.id_kas ORDER BY hodina
		ENDIF 		
		INSERT INTO sales (chart1, chart2, chart3, chart4, legenda, dadosx) SELECT stav, mnozstvi, stav2, mnozstvi2, meno, meno as dadosx FROM aaa order by hodina asc
		m.zorad=MESSAGEBOX(jaz("form_vyber_trzba_hostia"),4+32,"FoodMan")
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			.ChartsCount = 2
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"
			IF m.zorad=6
				.YAxis.caption=jaz("rep_trzba")
			ELSE 
				.YAxis.caption=jaz("pre_hosti")
			ENDIF 
			.XAxis.caption=jaz("rep_hodina")
			USE IN aaa
			IF m.zorad=6
				.Fields(1).FieldValue = "Chart1"
				.Fields(2).FieldValue = "Chart3"
			ELSE
				.Fields(1).FieldValue = "Chart2"
				.Fields(2).FieldValue = "Chart4"
			ENDIF 
			SELECT sales
			.Fields(1).Legend = m.oblast1_txt
			.Fields(2).Legend = m.oblast2_txt
			.Fields(1).Color  = RGB(100,175,213) && Azul
			.Fields(1).Shape  = lopath && Star
			.Fields(2).Color  = RGB(100,175,213) && Azul
			.Fields(2).Shape  = lopath && Star
			.Fields(1).AxisIndex = 2
			.Fields(2).AxisIndex = 2
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("rep_ttl_trzby po hodinach")
			IF m.vyber="__"
				.subtitle.caption = jaz("rep_spolu")
			ELSE
				.subtitle.caption = i_zkrat(m.vyber)
			ENDIF 
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.ListIndex=5
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="por_cisnici"
		SELECT username, autor, SUM(prachy) as stav, SUM(prachy2) as stav2 FROM ppp2 GROUP BY autor INTO CURSOR aaa READWRITE 
		INSERT INTO sales (chart1, chart2, legenda, dadosx) SELECT stav, stav2, username, username as dadosx FROM aaa order by stav desc 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			.ChartsCount = 2
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"
			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_autor")
			.Fields(1).FieldValue = "Chart1"
			.Fields(2).FieldValue = "Chart2"
			SELECT sales
			SUM chart1 TO m.sumajedna
			SUM chart2 TO m.sumadva
			SELECT aaa
			.Fields(1).Legend = m.oblast1_txt
			.Fields(2).Legend = m.oblast2_txt
			.Fields(1).Color  = RGB(100,175,213) && Azul
			.Fields(1).Shape  = lopath && Star
			.Fields(2).Color  = RGB(100,175,213) && Azul
			.Fields(2).Shape  = lopath && Star
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("rep_ttl_mark_cis")
			.SubTitle.Caption = ""
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.ListIndex=5
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="por_kas_platba"
		SELECT disti id_kas, id_zkratka as meno FROM platby INTO CURSOR aaa READWRITE WHERE !EMPTY(ALLTRIM(id_kas))
		REPLACE ALL meno WITH i_zkrat(id_kas)
		INSERT INTO aaa(id_kas,meno) VALUES ("__",jaz("rep_spolu"))
		IF RECCOUNT("aaa")>1
			DO FORM dajdruh WITH "", "aaa","id_kas",50,"meno",250 TO m.vyber
		ELSE
			m.vyber="__"		
		ENDIF 
		USE IN aaa 
		IF !EMPTY(vyber)	
			WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
				.ChartsCount = 2
				.SourceAlias = "Sales"
				.FieldAxis2  = "DadosX"
				.FieldHideSlice = "Hide_Slice"

				.YAxis.caption=jaz("rep_trzba")
				.XAxis.caption=jaz("rep_druh_pl")
				m.i=1
				m.j=2
				m.si="1"
				m.sj="2"
				IF m.vyber="__"
					SELECT druh_pl as meno, druh_pl, SUM(cena_pl) as prachy, SUM(cena_pl2) as prachy2 FROM platby INTO CURSOR aab READWRITE  GROUP BY druh_pl
				ELSE
					SELECT druh_pl as meno, druh_pl, SUM(cena_pl) as prachy, SUM(cena_pl2) as prachy2 FROM platby INTO CURSOR aab WHERE id_kas=m.vyber READWRITE GROUP BY druh_pl
				ENDIF 
				DELETE FOR (prachy=0 OR ISNULL(prachy)) AND (prachy2=0 OR ISNULL(prachy2))
				UPDATE sales SET chart&si=aab.prachy, chart&sj=aab.prachy2 from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, chart&sj, legenda, dadosx) SELECT prachy, prachy2, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				.Fields(m.j).FieldValue = "Chart"+m.sj
				SELECT sales
				SUM chart&si TO m.sumajedna
				SUM chart&sj TO m.sumadva
				IF ISNULL(m.sumajedna)
					m.sumajedna=0
				ENDIF 
				IF ISNULL(m.sumadva)
					m.sumadva=0
				ENDIF 
				m.sumacelkom=m.sumacelkom+m.sumajedna
				m.sumacelkomdva=m.sumacelkomdva+m.sumadva
				IF m.vyber="__"
					.Fields(m.i).Legend = m.oblast1_txt
					.Fields(m.j).Legend = m.oblast2_txt
				ELSE
					.Fields(m.i).Legend = m.oblast1_txt
					.Fields(m.j).Legend = m.oblast2_txt
				ENDIF 
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
				.Fields(m.j).Color  = RGB(100,175,213) && Azul
				.Fields(m.j).Shape  = lopath && Star
				.Fields(m.i).AxisIndex = 2
				.Fields(m.j).AxisIndex = 2
				.FieldColor = "Color"
				.FieldDetachSlice = "Detach"
				.FieldLegend = "Legenda"
				.Title.Caption = jaz("rep_ttl_tr_ka_casatr")
				IF m.vyber="__"
					.subtitle.caption = jaz("rep_spolu")
				ELSE
					.subtitle.caption = i_zkrat(m.vyber)
				ENDIF 
				.FontName = "Verdana"
				menoform.PF.p_Style.cmbcharttype.ListIndex=5
				.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
			ENDWITH 
		ELSE
			RETURN .f.
		ENDIF 
	CASE LOWER(repo_name)=="por_kas_catrib"
		SELECT disti id, id_zkratka as meno FROM tr_ka_ca INTO CURSOR aaa READWRITE WHERE !EMPTY(ALLTRIM(id))
		REPLACE ALL meno WITH i_zkrat(id)
		INSERT INTO aaa(id,meno) VALUES ("__",jaz("rep_spolu"))
		IF RECCOUNT("aaa")>1
			DO FORM dajdruh WITH "", "aaa","id",50,"meno",250 TO m.vyber
		ELSE
			m.vyber="__"		
		ENDIF 
		USE IN aaa 
		IF !EMPTY(vyber)	
			WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
				.ChartsCount = 2
				.SourceAlias = "Sales"
				.FieldAxis2  = "DadosX"
				.FieldHideSlice = "Hide_Slice"

				.YAxis.caption=jaz("rep_trzba")
				.XAxis.caption=jaz("rep_cas_atrib")
				m.i=1
				m.j=2
				m.si="1"
				m.sj="2"
				IF m.vyber="__"
					SELECT cas_atrib as meno, cas_atrib, SUM(cena_prod2) as prachy, SUM(cena_prod1) as prachy2 FROM tr_ka_ca INTO CURSOR aab READWRITE  GROUP BY cas_atrib
				ELSE
					SELECT cas_atrib as meno, cas_atrib, SUM(cena_prod2) as prachy, SUM(cena_prod1) as prachy2 FROM tr_ka_ca INTO CURSOR aab WHERE id=m.vyber READWRITE GROUP BY cas_atrib
				ENDIF 
				DELETE FOR (prachy=0 OR ISNULL(prachy)) AND (prachy2=0 OR ISNULL(prachy2))
				UPDATE sales SET chart&si=aab.prachy, chart&sj=aab.prachy2 from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, chart&sj, legenda, dadosx) SELECT prachy, prachy2, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				.Fields(m.j).FieldValue = "Chart"+m.sj
				SELECT sales
				SUM chart&si TO m.sumajedna
				SUM chart&sj TO m.sumadva
				IF ISNULL(m.sumajedna)
					m.sumajedna=0
				ENDIF 
				IF ISNULL(m.sumadva)
					m.sumadva=0
				ENDIF 
				m.sumacelkom=m.sumacelkom+m.sumajedna
				m.sumacelkomdva=m.sumacelkomdva+m.sumadva
				IF m.vyber="__"
					.Fields(m.i).Legend = m.oblast1_txt
					.Fields(m.j).Legend = m.oblast2_txt
				ELSE
					.Fields(m.i).Legend = m.oblast1_txt
					.Fields(m.j).Legend = m.oblast2_txt
				ENDIF 
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
				.Fields(m.j).Color  = RGB(100,175,213) && Azul
				.Fields(m.j).Shape  = lopath && Star
				.Fields(m.i).AxisIndex = 2
				.Fields(m.j).AxisIndex = 2
				.FieldColor = "Color"
				.FieldDetachSlice = "Detach"
				.FieldLegend = "Legenda"
				.Title.Caption = jaz("rep_ttl_tr_ka_casatr")
				IF m.vyber="__"
					.subtitle.caption = jaz("rep_spolu")
				ELSE
					.subtitle.caption = i_zkrat(m.vyber)
				ENDIF 
				.FontName = "Verdana"
				menoform.PF.p_Style.cmbcharttype.ListIndex=5
				.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
			ENDWITH 
		ELSE
			RETURN .f.
		ENDIF 
	CASE LOWER(repo_name)=="por_kas_druh"
		SELECT disti id, id_zkratka as meno FROM pom INTO CURSOR aaa READWRITE WHERE !EMPTY(ALLTRIM(id))
		REPLACE ALL meno WITH i_zkrat(id)
		INSERT INTO aaa(id,meno) VALUES ("__",jaz("rep_spolu"))
		IF RECCOUNT("aaa")>1
			DO FORM dajdruh WITH "", "aaa","id",50,"meno",250 TO m.vyber
		ELSE
			m.vyber="__"		
		ENDIF 
		USE IN aaa 
		IF !EMPTY(vyber)	
			WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
				.ChartsCount = 2
				.SourceAlias = "Sales"
				.FieldAxis2  = "DadosX"
				.FieldHideSlice = "Hide_Slice"

				.YAxis.caption=jaz("rep_trzba")
				.XAxis.caption=jaz("rep_druh")
				m.i=1
				m.j=2
				m.si="1"
				m.sj="2"
				IF m.vyber="__"
					SELECT druh as meno, druh, SUM(cena_prod2) as prachy, SUM(cena_prod1) as prachy2 FROM pom INTO CURSOR aab READWRITE  GROUP BY druh
				ELSE
					SELECT druh as meno, druh, SUM(cena_prod2) as prachy, SUM(cena_prod1) as prachy2 FROM pom INTO CURSOR aab WHERE id=m.vyber READWRITE GROUP BY druh
				ENDIF 
				DELETE FOR (prachy=0 OR ISNULL(prachy)) AND (prachy2=0 OR ISNULL(prachy2))
				UPDATE sales SET chart&si=aab.prachy, chart&sj=aab.prachy2 from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, chart&sj, legenda, dadosx) SELECT prachy, prachy2, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				.Fields(m.j).FieldValue = "Chart"+m.sj
				SELECT sales
				SUM chart&si TO m.sumajedna
				SUM chart&sj TO m.sumadva
				IF ISNULL(m.sumajedna)
					m.sumajedna=0
				ENDIF 
				IF ISNULL(m.sumadva)
					m.sumadva=0
				ENDIF 
				m.sumacelkom=m.sumacelkom+m.sumajedna
				m.sumacelkomdva=m.sumacelkomdva+m.sumadva
				IF m.vyber="__"
					.Fields(m.i).Legend = m.oblast1_txt
					.Fields(m.j).Legend = m.oblast2_txt
				ELSE
					.Fields(m.i).Legend = m.oblast1_txt
					.Fields(m.j).Legend = m.oblast2_txt
				ENDIF 
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
				.Fields(m.j).Color  = RGB(100,175,213) && Azul
				.Fields(m.j).Shape  = lopath && Star
				.Fields(m.i).AxisIndex = 2
				.Fields(m.j).AxisIndex = 2
				.FieldColor = "Color"
				.FieldDetachSlice = "Detach"
				.FieldLegend = "Legenda"
				.Title.Caption = jaz("rep_ttl_trzby_druh")
				IF m.vyber="__"
					.subtitle.caption = jaz("rep_spolu")
				ELSE
					.subtitle.caption = i_zkrat(m.vyber)
				ENDIF 
				.FontName = "Verdana"
				menoform.PF.p_Style.cmbcharttype.ListIndex=5
				.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
			ENDWITH 
		ELSE
			RETURN .f.
		ENDIF 
	CASE LOWER(repo_name)=="por_kas_druh_platba"
		IF !USED("trz_skup_plt2")
			SELECT disti id_kas,SPACE(30) as meno FROM trz_skup_plt INTO CURSOR aaa WHERE !INLIST(id_kas,"XX","XZ") AND !EMPTY(id_kas) READWRITE 
			REPLACE ALL meno WITH i_zkrat(id_kas)
		ELSE 
			SELECT disti "__" as id_kas,SPACE(30) as meno FROM trz_skup_plt2 INTO CURSOR aaa WHERE .F. READWRITE 
			INSERT INTO aaa(id_kas, meno) VALUES ("__",jaz("rep_spolu"))
		ENDIF 
		IF RECCOUNT("aaa")>1
			DO FORM dajdruh WITH "", "aaa","id_kas",50,"meno",250 TO m.vyber
		ELSE
			m.vyber="__"		
		ENDIF 
		USE IN aaa 
		IF !EMPTY(m.vyber)	
			WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
				.ChartsCount = 2
				.SourceAlias = "Sales"
				.FieldAxis2  = "DadosX"
				.FieldHideSlice = "Hide_Slice"

				.YAxis.caption=jaz("rep_trzba")
				.XAxis.caption=jaz("rep_druh_platby")

				m.i=1
				m.j=2
				m.si="1"
				m.sj="2"
				IF m.vyber="__"
					IF !USED("trz_skup_plt2")
						SELECT druh as meno, druh, SUM(cena_prod2) as prachy, SUM(cena_prod22) as prachy2 FROM trz_skup_plt INTO CURSOR aab READWRITE  GROUP BY druh WHERE dil=0
					ELSE 
						SELECT druh as meno, druh, SUM(cena_prod2) as prachy, SUM(cena_prod22) as prachy2 FROM trz_skup_plt2 INTO CURSOR aab READWRITE  GROUP BY druh WHERE dil=0
					ENDIF 
				ELSE
					IF !USED("trz_skup_plt2")
						SELECT druh as meno, druh, SUM(cena_prod2) as prachy, SUM(cena_prod22) as prachy2 FROM trz_skup_plt INTO CURSOR aab WHERE id_kas=m.vyber AND dil=0 READWRITE GROUP BY druh
					ELSE
						SELECT druh as meno, druh, SUM(cena_prod2) as prachy, SUM(cena_prod22) as prachy2 FROM trz_skup_plt2 INTO CURSOR aab WHERE id_kas=m.vyber AND dil=0 READWRITE GROUP BY druh
					ENDIF 
				ENDIF 
				DELETE FOR (prachy=0 OR ISNULL(prachy)) AND (prachy2=0 OR ISNULL(prachy2))
				UPDATE sales SET chart&si=aab.prachy, chart&sj=aab.prachy2 from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, chart&sj, legenda, dadosx) SELECT prachy, prachy2, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				.Fields(m.j).FieldValue = "Chart"+m.sj
				SELECT sales
				SUM chart&si TO m.sumajedna
				SUM chart&sj TO m.sumadva
				IF ISNULL(m.sumajedna)
					m.sumajedna=0
				ENDIF 
				IF ISNULL(m.sumadva)
					m.sumadva=0
				ENDIF 
				m.sumacelkom=m.sumacelkom+m.sumajedna
				m.sumacelkomdva=m.sumacelkomdva+m.sumadva
				IF m.vyber="__"
					.Fields(m.i).Legend = m.oblast1_txt
					.Fields(m.j).Legend = m.oblast2_txt
				ELSE
					.Fields(m.i).Legend = m.oblast1_txt
					.Fields(m.j).Legend = m.oblast2_txt
				ENDIF 
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
				.Fields(m.j).Color  = RGB(100,175,213) && Azul
				.Fields(m.j).Shape  = lopath && Star
				.Fields(m.i).AxisIndex = 2
				.Fields(m.j).AxisIndex = 2
				.FieldColor = "Color"
				.FieldDetachSlice = "Detach"
				.FieldLegend = "Legenda"
				.Title.Caption = jaz("s_trz po kasach/platbach")
					IF m.vyber="__"
						.subtitle.caption = jaz("rep_spolu")
					ELSE
						.subtitle.caption = i_zkrat(m.vyber)
					ENDIF 
				.FontName = "Verdana"
				menoform.PF.p_Style.cmbcharttype.ListIndex=5
				.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
			ENDWITH 
		ELSE
			RETURN .f.
		ENDIF 
	CASE LOWER(repo_name)=="trz_cenpasma"
		SELECT disti id_kas, SPACE(30) as meno FROM castky2 INTO CURSOR aaa READWRITE 
		REPLACE ALL meno WITH i_zkrat(id_kas)
		INSERT INTO aaa(id_kas,meno) VALUES ("__",jaz("rep_spolu"))
		IF RECCOUNT("aaa")>1
			DO FORM dajdruh WITH "", "aaa","id_kas",50,"meno",250 TO m.vyber
		ELSE
			m.vyber="__"		
		ENDIF 
		SELECT aaa
		IF !EMPTY(m.vyber)
			WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
				.Multichart=.t.
				.ChartType=18
				.ChartsCount = 2
				.SourceAlias = "Sales"
				.FieldAxis2  = "DadosX"
				.FieldHideSlice = "Hide_Slice"
				.YAxis.caption=jaz("rep_trzba")
				.YAxis2.caption=jaz("pre_hosti")
				.XAxis.caption="Pásmo"
				m.id_kas=m.vyber
				IF m.id_kas="__"
					SELECT SPACE(30) as meno, SUM(trzba1) as prachy, SUM(hostu1) as pocet FROM castky2 INTO CURSOR aab READWRITE 
				ELSE
					SELECT SPACE(30) as meno, SUM(trzba1) as prachy, SUM(hostu1) as pocet FROM castky2 INTO CURSOR aab READWRITE WHERE id_kas=m.vyber
				ENDIF 
				REPLACE ALL meno WITH "0 - " + ALLTRIM(STR(m.hranice1))
				UPDATE sales SET chart1=aab.prachy, chart2=aab.pocet from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart1, chart2,legenda, dadosx) SELECT prachy, pocet, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				IF m.id_kas="__"
					SELECT SPACE(30) as meno, SUM(trzba2) as prachy, SUM(hostu2) as pocet FROM castky2 INTO CURSOR aab READWRITE 
				ELSE
					SELECT SPACE(30) as meno, SUM(trzba2) as prachy, SUM(hostu2) as pocet FROM castky2 INTO CURSOR aab READWRITE WHERE id_kas=m.id_kas
				ENDIF 
				REPLACE ALL meno WITH ALLTRIM(STR(m.hranice1)) + " - " + ALLTRIM(STR(m.hranice2))
				UPDATE sales SET chart1=aab.prachy, chart2=aab.pocet from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart1, chart2,legenda, dadosx) SELECT prachy, pocet, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				IF m.id_kas="__"
					SELECT SPACE(30) as meno, SUM(trzba3) as prachy, SUM(hostu3) as pocet FROM castky2 INTO CURSOR aab READWRITE 
				ELSE
					SELECT SPACE(30) as meno, SUM(trzba3) as prachy, SUM(hostu3) as pocet FROM castky2 INTO CURSOR aab READWRITE WHERE id_kas=m.id_kas
				ENDIF 
				REPLACE ALL meno WITH ALLTRIM(STR(m.hranice2)) + " - " + ALLTRIM(STR(m.hranice3))
				UPDATE sales SET chart1=aab.prachy, chart2=aab.pocet from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart1, chart2,legenda, dadosx) SELECT prachy, pocet, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				IF m.id_kas="__"
					SELECT SPACE(30) as meno, SUM(trzba4) as prachy, SUM(hostu4) as pocet FROM castky2 INTO CURSOR aab READWRITE 
				ELSE
					SELECT SPACE(30) as meno, SUM(trzba4) as prachy, SUM(hostu4) as pocet FROM castky2 INTO CURSOR aab READWRITE WHERE id_kas=m.id_kas
				ENDIF 
				REPLACE ALL meno WITH ALLTRIM(STR(m.hranice3)) + " - " + ALLTRIM(STR(m.hranice4))
				UPDATE sales SET chart1=aab.prachy, chart2=aab.pocet from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart1, chart2,legenda, dadosx) SELECT prachy, pocet, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				IF m.id_kas="__"
					SELECT SPACE(30) as meno, SUM(trzba5) as prachy, SUM(hostu5) as pocet FROM castky2 INTO CURSOR aab READWRITE 
				ELSE
					SELECT SPACE(30) as meno, SUM(trzba5) as prachy, SUM(hostu5) as pocet FROM castky2 INTO CURSOR aab READWRITE WHERE id_kas=m.id_kas
				ENDIF 
				REPLACE ALL meno WITH ALLTRIM(STR(m.hranice4))+ " "+jaz("grafy_a_viac")
				UPDATE sales SET chart1=aab.prachy, chart2=aab.pocet from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart1, chart2,legenda, dadosx) SELECT prachy, pocet, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(1).FieldValue = "Chart1"
				.Fields(2).FieldValue = "Chart2"
				SELECT sales
				SUM chart1 TO m.sumajedna
				IF ISNULL(m.sumajedna)
					m.sumajedna=0
				ENDIF 
				m.sumacelkom=m.sumacelkom+m.sumajedna
				IF m.id_kas="__"
					.Fields(1).Legend = jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ELSE
					.Fields(1).Legend = i_zkrat(aaa.id_kas)+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ENDIF 
				.Fields(1).Color  = RGB(100,175,213) && Azul
				.Fields(1).Shape  = lopath && Star
				.Fields(1).charttype = 3
				.Fields(1).axisindex  = 1
				IF ISNULL(m.sumajedna)
					m.sumajedna=0
				ENDIF 
				SUM chart2 TO m.sumajedna
				.Fields(2).Legend = jaz("pre_hosti")+" :"+ALLTRIM(STR(m.sumajedna,10,2))
				.Fields(2).charttype = 5
				.Fields(2).Color  = RGB(100,175,213) && Azul
				.Fields(2).Shape  = lopath && Star
				.Fields(2).axisindex  = 2
				USE IN aaa 
				.FieldColor = "Color"
				.FieldDetachSlice = "Detach"
				.FieldLegend = "Legenda"
				.Title.Caption = jaz("rep_ttl_cen_pasma")
				.SubTitle.Caption = m.datsk1+" - "+m.datsk2
				.FontName = "Verdana"
				menoform.PF.p_Style.cmbcharttype.enabled=.f.
				menoform.PF.p_Style.cmbcharttype.ListIndex  = 18
			ENDWITH 
		ELSE
			USE IN aaa
			RETURN .f.
		ENDIF 
	CASE LOWER(repo_name)=="trz_hodiny"
		SELECT disti id_kas, SPACE(30) as meno FROM hodiny INTO CURSOR aaa READWRITE 
		REPLACE ALL meno WITH i_zkrat(id_kas)
		INSERT INTO aaa(id_kas,meno) VALUES ("__",jaz("rep_spolu"))
		LOCAL zorad
		IF RECCOUNT("aaa")>1
			DO FORM dajdruh WITH "", "aaa","id_kas",50,"meno",250 TO m.vyber
		ELSE
			m.vyber="__"		
		ENDIF 
		IF EMPTY(m.vyber)
			m.vyber="__"
		ENDIF 
		SELECT aaa
		IF m.vyber="__"
			SELECT hodina as meno, hodina, SUM(cena_slev) as stav, SUM(pocet_h) as mnozstvi FROM hodiny GROUP BY hodina INTO CURSOR aaa READWRITE ORDER BY hodina
		ELSE
			SELECT hodina as meno, hodina, SUM(cena_slev) as stav, SUM(pocet_h) as mnozstvi FROM hodiny GROUP BY hodina INTO CURSOR aaa READWRITE  WHERE id_kas=m.vyber ORDER BY hodina
		ENDIF 		
		INSERT INTO sales (chart1, chart2, legenda, dadosx) SELECT stav, mnozstvi, meno, meno as dadosx FROM aaa order by hodina asc
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			.ChartType=18
			.ChartsCount = 2
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"
			.YAxis.caption=jaz("rep_trzba")
			.YAxis2.caption=jaz("pre_hosti")
			.XAxis.caption=jaz("rep_hodina")
			SELECT sales
			SUM chart1 TO m.sumajedna
			.Fields(1).FieldValue = "Chart1"
			.Fields(1).Legend = jaz("rep_trzba")+": "+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)
			.Fields(1).Color  = RGB(100,175,213) && Azul
			.Fields(1).Shape  = lopath && Star
			.Fields(1).charttype = 3
			.Fields(1).axisindex  = 1
			SUM chart2 TO m.sumajedna
			.Fields(2).FieldValue = "Chart2"
			.Fields(2).Legend = jaz("pre_hosti")+" :"+ALLTRIM(STR(m.sumajedna,10,2))
			.Fields(2).charttype = 5
			.Fields(2).Color  = RGB(100,175,213) && Azul
			.Fields(2).Shape  = lopath && Star
			.Fields(2).axisindex  = 2
			SELECT aaa


			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("rep_ttl_trzby po hodinach")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.enabled=.f.
			menoform.PF.p_Style.cmbcharttype.ListIndex  = 18
		ENDWITH 


	CASE LOWER(repo_name)=="trz_cisnici2"
		SELECT username, autor, SUM(vynos) as stav, SUM(mnozstvi) as mnozstvi FROM cis_xx GROUP BY autor INTO CURSOR aaa READWRITE 
		INSERT INTO sales (chart1, chart2, legenda, dadosx) SELECT stav, mnozstvi, username, username as dadosx FROM aaa order by stav desc 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			.ChartType=18
			.ChartsCount = 2
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"
			.YAxis.caption=jaz("rep_vynos")
			.YAxis2.caption=jaz("rep_pocet_uctov")
			.XAxis.caption=jaz("rep_autor")
			SELECT sales
			SUM chart1 TO m.sumajedna
			.Fields(1).FieldValue = "Chart1"
			.Fields(1).Legend = jaz("rep_vynos")+": "+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)
			.Fields(1).Color  = RGB(100,175,213) && Azul
			.Fields(1).Shape  = lopath && Star
			.Fields(1).charttype = 3
			.Fields(1).axisindex  = 1
			SUM chart2 TO m.sumajedna
			.Fields(2).FieldValue = "Chart2"
			.Fields(2).Legend = jaz("rep_mnozstvi")+" :"+ALLTRIM(STR(m.sumajedna,10,2))
			.Fields(2).charttype = 5
			.Fields(2).Color  = RGB(100,175,213) && Azul
			.Fields(2).Shape  = lopath && Star
			.Fields(2).axisindex  = 2
			SELECT aaa


			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("rep_ttl_mark_cis")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.enabled=.f.
			menoform.PF.p_Style.cmbcharttype.ListIndex  = 18
		ENDWITH 
		
	CASE LOWER(repo_name)=="trz_cisnici"
		SELECT username, autor, SUM(prachy) as stav FROM ppp2 GROUP BY autor INTO CURSOR aaa READWRITE 
		INSERT INTO sales (chart1, legenda, dadosx) SELECT stav, username, username as dadosx FROM aaa order by stav desc 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			.ChartsCount = 1
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"
			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_autor")
			.Fields(1).FieldValue = "Chart1"
			SELECT sales
			SUM chart1 TO m.sumajedna
			SELECT aaa
			.Fields(1).Legend = jaz("rep_spolu")+": "+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)
			.Fields(1).Color  = RGB(100,175,213) && Azul
			.Fields(1).Shape  = lopath && Star
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("rep_ttl_mark_cis")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_rozpeti_uzav" OR LOWER(repo_name)=="trz_rozpeti"
		SELECT disti id_kas, SPACE(30) as meno FROM rozpeti INTO CURSOR aaa READWRITE 
		REPLACE ALL meno WITH i_zkrat(id_kas)
		INSERT INTO aaa(id_kas,meno) VALUES ("__",jaz("rep_spolu"))
		LOCAL zorad
		IF RECCOUNT("aaa")>1
			DO FORM dajdruh WITH "", "aaa","id_kas",50,"meno",250 TO m.vyber
		ELSE
			m.vyber="__"		
		ENDIF 
		SELECT aaa
		IF !EMPTY(m.vyber)
			ALTER table sales ADD COLUMN ("spotreba1") N(8,2) NULL
			ALTER table sales ADD COLUMN ("vynos1") N(8,2) NULL
			ALTER table sales ADD COLUMN ("dan1") N(8,2) NULL
			ALTER table sales ADD COLUMN ("rozp1") N(8,2) NULL
		ELSE
			USE IN aaa
			RETURN .f.
		ENDIF 
		menoform.pf.p_Style.Spn3D.Value=20
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			.ChartsCount = 5
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_suma")
			.XAxis.caption=jaz("form stredisko")
			m.i=1
			m.si="1"
			IF m.vyber="__"
				SELECT SPACE(30) as meno, id_man, SUM(cena_prod-vynos) as dan, SUM(vynos-naklady) as rozp, SUM(cena_prod) as cena_prod, SUM(vynos) as vynos, SUM(naklady) as naklady FROM rozpeti INTO CURSOR aab GROUP BY id_man READWRITE
			ELSE
				SELECT SPACE(30) as meno, id_man, SUM(cena_prod-vynos) as dan, SUM(vynos-naklady) as rozp, SUM(cena_prod) as cena_prod, SUM(vynos) as vynos, SUM(naklady) as naklady FROM rozpeti INTO CURSOR aab GROUP BY id_man READWRITE  WHERE id_kas=m.vyber
			ENDIF 
			REPLACE naklady WITH 0 FOR ISNULL(naklady)
			REPLACE cena_prod WITH 0 FOR ISNULL(cena_prod)
			REPLACE dan WITH 0 FOR ISNULL(dan)
			REPLACE vynos WITH 0 FOR ISNULL(vynos)
			REPLACE ALL meno WITH i_zkrat(id_man)
			UPDATE sales SET chart&si=aab.cena_prod, dan&si=aab.dan, vynos&si=aab.vynos, spotreba&si=aab.naklady, rozp&si=aab.rozp from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
			INSERT INTO sales (chart&si, dan&si, vynos&si, spotreba&si, rozp&si, legenda, dadosx) SELECT cena_prod, dan, vynos, naklady, rozp, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
			USE IN aab
			.Fields(1).FieldValue = "chart"+m.si
			.Fields(1).charttype = 3
			.Fields(1).axisindex = 1
			.Fields(4).FieldValue = "spotreba"+m.si
			.Fields(4).axisindex = 1
			.Fields(4).charttype = 5
			.Fields(2).FieldValue = "dan"+m.si
			.Fields(2).charttype = 3
			.Fields(2).axisindex = 1
			.Fields(5).FieldValue = "rozp"+m.si
			.Fields(5).charttype = 3
			.Fields(5).axisindex = 1
			.Fields(3).FieldValue = "vynos"+m.si
			.Fields(3).charttype = 3
			.Fields(3).axisindex = 1
			SELECT sales
			SUM chart&si TO m.sumajedna
			.Fields(1).Legend = jaz("rep_trzba")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
			SUM dan&si TO m.sumajedna
			.Fields(2).Legend = "DPH ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
			SUM rozp&si TO m.sumajedna
			.Fields(5).Legend = jaz("rep_rozpatie")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
			SUM spotreba&si TO m.sumajedna
			.Fields(4).Legend = jaz("rep_spotreba")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
			SUM vynos&si TO m.sumajedna
			.Fields(3).Legend = jaz("rep_vynos")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
			.Fields(1).Color  = RGB(100,175,213) && Azul
			.Fields(1).Shape  = 1 && Star
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = m.report_ttl
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.enabled=.T.
			menoform.PF.p_Style.cmbcharttype.ListIndex  = 3
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_kas_platba"
		SELECT disti field1 FROM platby INTO CURSOR aaa READWRITE 
		IF RECCOUNT("aaa")>5
			FOR m.i=6 TO RECCOUNT("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
			ENDFOR 
		ENDIF 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			.ChartsCount = RECCOUNT("aaa")
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=""

			SELECT aaa
			SCAN ALL 
				m.field1=aaa.field1
				m.i=RECNO("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				SELECT field2 as meno, field2, SUM(cena_pl) as prachy FROM platby INTO CURSOR aab WHERE field1=m.field1 READWRITE GROUP BY field2
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				SELECT sales
				SUM chart&si TO m.sumajedna
				IF ISNULL(m.sumajedna)
					m.sumajedna=0
				ENDIF 
				m.sumacelkom=m.sumacelkom+m.sumajedna
				SELECT aaa
				.Fields(m.i).Legend = aaa.field1+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
			ENDSCAN 
			.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
			.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
			.Fields(m.i).AxisIndex = 2
			USE IN aaa 
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("rep_ttl_kas_drpl")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_kas_catrib"
		SELECT disti id, id_zkratka FROM tr_ka_ca INTO CURSOR aaa READWRITE 
		LOCAL zorad
		IF RECCOUNT("aaa")>1
			m.zorad=""
			SELECT SPACE(30) AS radenie INTO CURSOR selzost FROM sales WHERE .F. READWRITE
			INSERT INTO selzost (radenie) VALUES (jaz("s_trz profit sumar"))
			INSERT INTO selzost (radenie) VALUES (jaz("s_sk_po_kasach"))
			DO FORM dajdruh WITH "","selzost","radenie",250 TO m.zorad
			IF !EMPTY(m.zorad)
				SELECT selzost
				LOCATE FOR radenie=m.zorad
				m.zorad=RECNO()
				USE IN selzost
			ELSE
				m.zorad=1
			ENDIF 
		ELSE
			m.zorad=1		
		ENDIF 
		SELECT aaa
		IF m.zorad=1
			DELETE all
			INSERT INTO aaa (id) VALUES ("__")
		ELSE 
			IF RECCOUNT("aaa")>5
				FOR m.i=6 TO RECCOUNT("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
				ENDFOR 
			ENDIF 
		ENDIF 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			IF m.zorad=1
				.ChartsCount = 1
			ELSE
				.ChartsCount = RECCOUNT("aaa")
			ENDIF 
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_manager")
			m.id=""
			SELECT aaa
			SCAN ALL 
				m.id=aaa.id
				m.i=RECNO("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				IF m.id="__"
					SELECT SPACE(30) as meno, cas_atrib, SUM(cena_prod2) as prachy FROM tr_ka_ca INTO CURSOR aab READWRITE GROUP BY cas_atrib
					m.i=1
					m.si="1"
				ELSE
					SELECT SPACE(30) as meno, cas_atrib, SUM(cena_prod2) as prachy FROM tr_ka_ca INTO CURSOR aab WHERE id=m.id READWRITE GROUP BY cas_atrib
				ENDIF 
				REPLACE ALL meno WITH cas_atrib
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				SELECT sales
				SUM chart&si TO m.sumajedna
				IF ISNULL(m.sumajedna)
					m.sumajedna=0
				ENDIF 
				m.sumacelkom=m.sumacelkom+m.sumajedna
				SELECT aaa
				IF m.id="__"
					.Fields(m.i).Legend = jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ELSE
					.Fields(m.i).Legend = aaa.id_zkratka+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ENDIF 
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
			ENDSCAN 
			IF m.id<>"__"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
			ENDIF 
			.Fields(m.i).AxisIndex = 2
			USE IN aaa 
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("rep_ttl_tr_ka_casatr")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_kas_druh"
		SELECT disti id, id_zkratka FROM pom INTO CURSOR aaa READWRITE 
		IF RECCOUNT("aaa")>5
			FOR m.i=6 TO RECCOUNT("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
			ENDFOR 
		ENDIF 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			.ChartsCount = RECCOUNT("aaa")
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_druh")
			m.id=" "
			SELECT aaa
			SCAN ALL 
				m.id=aaa.id
				m.id_zkratka=aaa.id_zkratka
				m.i=RECNO("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				SELECT druh as meno, druh, SUM(cena_prod2) as prachy FROM pom INTO CURSOR aab WHERE id=m.id READWRITE GROUP BY druh
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				SELECT sales
				SUM chart&si TO m.sumajedna
				IF ISNULL(m.sumajedna)
					m.sumajedna=0
				ENDIF 
				m.sumacelkom=m.sumacelkom+m.sumajedna
				SELECT aaa
				.Fields(m.i).Legend = aaa.id_zkratka+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
			ENDSCAN 
			IF m.id<>" "
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
			ENDIF 
			.Fields(m.i).AxisIndex = 2
			USE IN aaa 
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = m.ttl_report
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_5man"
		SELECT disti id_kas FROM kas_man1 INTO CURSOR aaa READWRITE 
		LOCAL zorad
		IF RECCOUNT("aaa")>1
			m.zorad=""
			SELECT SPACE(30) AS radenie INTO CURSOR selzost FROM sales WHERE .F. READWRITE
			INSERT INTO selzost (radenie) VALUES (jaz("s_trz profit sumar"))
			INSERT INTO selzost (radenie) VALUES ((jaz("s_sk_po_kasach")))
			DO FORM dajdruh WITH "","selzost","radenie",250 TO m.zorad
			IF !EMPTY(m.zorad)
				SELECT selzost
				LOCATE FOR radenie=m.zorad
				m.zorad=RECNO()
				USE IN selzost
			ELSE
				m.zorad=1
			ENDIF 
		ELSE
			m.zorad=1		
		ENDIF 
		SELECT aaa
		IF m.zorad=1
			DELETE all
			INSERT INTO aaa (id_kas) VALUES ("__")
		ELSE 
			IF RECCOUNT("aaa")>5
				FOR m.i=6 TO RECCOUNT("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
				ENDFOR 
			ENDIF 
		ENDIF 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			IF m.zorad=1
				.ChartsCount = 1
			ELSE
				.ChartsCount = RECCOUNT("aaa")
			ENDIF 
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_manager")
			m.id_kas="__"
			SELECT aaa
			SCAN ALL 
				m.id_kas=aaa.id_kas
				m.i=RECNO("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				IF m.id_kas="__"
					SELECT SPACE(30) as meno, SUM(tr1) as prachy FROM kas_man1 INTO CURSOR aab READWRITE 
					m.i=1
					m.si="1"
				ELSE
					SELECT SPACE(30) as meno, SUM(tr1) as prachy FROM kas_man1 INTO CURSOR aab WHERE id_kas=m.id_kas READWRITE 
				ENDIF 
				REPLACE ALL meno WITH i_zkrat(m.man1)
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				IF m.id_kas="__"
					SELECT SPACE(30) as meno, SUM(tr2) as prachy FROM kas_man1 INTO CURSOR aab READWRITE 
					m.i=1
					m.si="1"
				ELSE
					SELECT SPACE(30) as meno, SUM(tr2) as prachy FROM kas_man1 INTO CURSOR aab WHERE id_kas=m.id_kas READWRITE 
				ENDIF 
				REPLACE ALL meno WITH i_zkrat(m.man2)
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				IF m.id_kas="__"
					SELECT SPACE(30) as meno, SUM(tr3) as prachy FROM kas_man1 INTO CURSOR aab READWRITE 
					m.i=1
					m.si="1"
				ELSE
					SELECT SPACE(30) as meno, SUM(tr3) as prachy FROM kas_man1 INTO CURSOR aab WHERE id_kas=m.id_kas READWRITE 
				ENDIF 
				REPLACE ALL meno WITH i_zkrat(m.man3)
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				IF m.id_kas="__"
					SELECT SPACE(30) as meno, SUM(tr4) as prachy FROM kas_man1 INTO CURSOR aab READWRITE 
					m.i=1
					m.si="1"
				ELSE
					SELECT SPACE(30) as meno, SUM(tr4) as prachy FROM kas_man1 INTO CURSOR aab WHERE id_kas=m.id_kas READWRITE 
				ENDIF 
				REPLACE ALL meno WITH i_zkrat(m.man4)
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				IF m.id_kas="__"
					SELECT SPACE(30) as meno, SUM(tr5) as prachy FROM kas_man1 INTO CURSOR aab READWRITE 
					m.i=1
					m.si="1"
				ELSE
					SELECT SPACE(30) as meno, SUM(tr5) as prachy FROM kas_man1 INTO CURSOR aab WHERE id_kas=m.id_kas READWRITE 
				ENDIF 
				REPLACE ALL meno WITH i_zkrat(m.man5)
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				SELECT sales
				SUM chart&si TO m.sumajedna
				IF ISNULL(m.sumajedna)
					m.sumajedna=0
				ENDIF 
				m.sumacelkom=m.sumacelkom+m.sumajedna
				SELECT aaa
				IF m.id_kas="__"
					.Fields(m.i).Legend = jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ELSE
					.Fields(m.i).Legend = i_zkrat(aaa.id_kas)+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ENDIF 
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
			ENDSCAN 
			IF m.id_kas<>"__"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
			ENDIF 
			.Fields(m.i).AxisIndex = 2
			USE IN aaa 
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = m.ttl_trkasman
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_kas_druh_platba"
		IF !USED("trz_skup_plt2")
			SELECT disti id_kas FROM trz_skup_plt INTO CURSOR aaa WHERE !INLIST(id_kas,"XX","XZ") READWRITE 
			m.zorad=2
		ELSE 
			SELECT disti "__" as id_kas FROM trz_skup_plt2 INTO CURSOR aaa WHERE .F. READWRITE 
			m.zorad=1
		ENDIF 
		m.i=1
		SELECT aaa
		IF m.zorad=1
			DELETE all
			INSERT INTO aaa (id_kas) VALUES ("__")
		ELSE 
			IF RECCOUNT("aaa")>5
				FOR m.i=6 TO RECCOUNT("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
				ENDFOR 
			ENDIF 
		ENDIF 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			IF m.zorad=1
				.ChartsCount = 1
			ELSE
				.ChartsCount = RECCOUNT("aaa")
			ENDIF 
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_druh_platby")
			m.id_kas="__"
			SELECT aaa
			SCAN ALL 
				m.id_kas=aaa.id_kas
				m.i=RECNO("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				IF m.id_kas="__"
					SELECT druh as meno, druh, SUM(cena_prod2) as prachy FROM trz_skup_plt2 INTO CURSOR aab READWRITE  GROUP BY druh WHERE dil=0
					m.i=1
					m.si="1"
				ELSE
					SELECT druh as meno, druh, SUM(cena_prod2) as prachy FROM trz_skup_plt INTO CURSOR aab WHERE id_kas=m.id_kas AND dil=0 READWRITE GROUP BY druh
				ENDIF 
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				SELECT sales
				SUM chart&si TO m.sumajedna
				IF ISNULL(m.sumajedna)
					m.sumajedna=0
				ENDIF 
				m.sumacelkom=m.sumacelkom+m.sumajedna
				SELECT aaa
				IF m.id_kas="__"
					.Fields(m.i).Legend = jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ELSE
					.Fields(m.i).Legend = i_zkrat(aaa.id_kas)+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ENDIF 
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
			ENDSCAN 
			IF m.id_kas<>"__"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
			ENDIF 
			.Fields(m.i).AxisIndex = 2
			USE IN aaa 
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("s_trz po kasach/platbach")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LEFT(LOWER(repo_name),11)=="trz_kas_dph"
		SELECT disti id_kas FROM sk_fi3 INTO CURSOR aaa WHERE !INLIST(id_kas,"XX","XZ") READWRITE 
		LOCAL zorad
		IF RECCOUNT("aaa")>1
			m.zorad=""
			SELECT SPACE(30) AS radenie INTO CURSOR selzost FROM sales WHERE .F. READWRITE
			INSERT INTO selzost (radenie) VALUES (jaz("s_trz profit sumar"))
			INSERT INTO selzost (radenie) VALUES ((jaz("s_sk_po_kasach")))
			DO FORM dajdruh WITH "","selzost","radenie",250 TO m.zorad
			IF !EMPTY(m.zorad)
				SELECT selzost
				LOCATE FOR radenie=m.zorad
				m.zorad=RECNO()
				USE IN selzost
			ELSE
				m.zorad=1
			ENDIF 
		ELSE
			m.zorad=1		
		ENDIF 
		SELECT aaa
		IF m.zorad=1
			DELETE all
			INSERT INTO aaa (id_kas) VALUES ("__")
		ELSE 
			IF RECCOUNT("aaa")>5
				FOR m.i=6 TO RECCOUNT("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
				ENDFOR 
			ENDIF 
		ENDIF 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			IF m.zorad=1
				.ChartsCount = 1
			ELSE
				.ChartsCount = RECCOUNT("aaa")
			ENDIF 
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=STRTRAN(jaz("rep_sadzba dph :"),":","")
			m.id_kas="__"
			SELECT aaa
			SCAN ALL 
				m.id_kas=aaa.id_kas
				m.i=RECNO("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				IF m.id_kas="__"
					SELECT SPACE(10) as meno, SUM(trzba_dph1) as prachy FROM sk_fi3 INTO CURSOR aab READWRITE 
					m.i=1
					m.si="1"
				ELSE
					SELECT SPACE(10) as meno, SUM(trzba_dph1) as prachy FROM sk_fi3 INTO CURSOR aab WHERE id_kas=m.id_kas READWRITE 
				ENDIF 
				REPLACE ALL meno WITH STR(100*(m.s_dph1-1), 4,1) + "%"
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				IF m.id_kas="__"
					SELECT SPACE(10) as meno, SUM(trzba_dph2) as prachy FROM sk_fi3 INTO CURSOR aab READWRITE 
					m.i=1
					m.si="1"
				ELSE
					SELECT SPACE(10) as meno, SUM(trzba_dph2) as prachy FROM sk_fi3 INTO CURSOR aab WHERE id_kas=m.id_kas READWRITE 
				ENDIF 
				REPLACE ALL meno WITH STR(100*(m.s_dph2-1), 4,1) + "%"
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				IF m.id_kas="__"
					SELECT SPACE(10) as meno, SUM(trzba_dph3) as prachy FROM sk_fi3 INTO CURSOR aab READWRITE 
					m.i=1
					m.si="1"
				ELSE
					SELECT SPACE(10) as meno, SUM(trzba_dph3) as prachy FROM sk_fi3 INTO CURSOR aab WHERE id_kas=m.id_kas READWRITE 
				ENDIF 
				REPLACE ALL meno WITH STR(100*(m.s_dph3-1), 4,1) + "%"
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				SELECT sales
				SUM chart&si TO m.sumajedna
				IF ISNULL(m.sumajedna)
					m.sumajedna=0
				ENDIF 
				m.sumacelkom=m.sumacelkom+m.sumajedna
				SELECT aaa
				IF m.id_kas="__"
					.Fields(m.i).Legend = jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ELSE
					.Fields(m.i).Legend = i_zkrat(aaa.id_kas)+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ENDIF 
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
			ENDSCAN 
			IF m.id_kas<>"__"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
			ENDIF 
			.Fields(m.i).AxisIndex = 2
			USE IN aaa 
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("grafy_po_kasach_a_dph")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_i_roz_limit"
		SELECT DISTINCT text FROM buff INTO CURSOR aaa
		IF RECCOUNT("aaa")>1
			DO FORM dajdruh WITH "","aaa","text",250 TO m.vyber
		ELSE
			m.vyber=aaa.text
		ENDIF 
		USE IN aaa
		IF !EMPTY(m.vyber)
			ALTER table sales ADD COLUMN ("spotreba1") N(8,2) NULL
			menoform.pf.p_Style.Spn3D.Value=20
			WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
				.ChartsCount = 4
				.SourceAlias = "Sales"
				.FieldAxis2  = "DadosX"
				.FieldHideSlice = "Hide_Slice"

				.YAxis.caption=jaz("rep_trzba")
				.YAxis2.caption=jaz("rep_spotreba")
				.XAxis.caption=jaz("rep_stredisko")

				SELECT SPACE(30) as meno, buff.text, SUM(buff.sumpc) as sumpc, SUM(buff.sum_dph) as sum_dph, SUM(obr_ssum.spotreba) as spotreba FROM buff LEFT JOIN obr_ssum ON buff.id_man=obr_ssum.id_man AND buff.id_kas=obr_ssum.id_kas AND SUBSTR(buff.uzaverka,3,12)=obr_ssum.uzaverka AND buff.cen_hlad=obr_ssum.cen_hlad INTO CURSOR aab GROUP BY buff.text READWRITE WHERE text=m.vyber
				REPLACE spotreba WITH 0 FOR ISNULL(spotreba)
				REPLACE sumpc WITH 0 FOR ISNULL(sumpc)
				REPLACE sum_dph WITH 0 FOR ISNULL(sum_dph)
				REPLACE ALL meno WITH text
				UPDATE sales SET chart1=aab.sumpc, chart2=aab.sum_dph, chart3=aab.sumpc-aab.sum_dph+aab.spotreba,spotreba1=-aab.spotreba from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart1, chart2, chart3, spotreba1, legenda, dadosx) SELECT sumpc, sum_dph, sumpc-sum_dph+spotreba, -spotreba, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(1).FieldValue = "Chart1"
				.Fields(1).charttype = 3
				.Fields(1).axisindex = 1
				.Fields(2).FieldValue = "spotreba1"
				.Fields(2).axisindex = 1
				.Fields(2).charttype = 5
				.Fields(3).FieldValue = "Chart2"
				.Fields(3).charttype = 3
				.Fields(3).axisindex = 1
				.Fields(4).FieldValue = "Chart3"
				.Fields(4).charttype = 3
				.Fields(4).axisindex = 1
				SELECT sales
				SUM chart1 TO m.sumajedna
				.Fields(1).Legend = jaz("rep_trzba")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
				SUM chart2 TO m.sumajedna
				.Fields(3).Legend = "DPH ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
				SUM chart3 TO m.sumajedna
				.Fields(4).Legend = jaz("rep_rozpatie")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
				SELECT sales
				SUM spotreba1 TO m.sumajedna
				.Fields(2).Legend = jaz("rep_spotreba")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
				.Fields(1).Color  = RGB(100,175,213) && Azul
				.Fields(1).Shape  = 1 && Star
				.FieldColor = "Color"
				.FieldDetachSlice = "Detach"
				.FieldLegend = "Legenda"
				.Title.Caption = jaz("lim_zos_rozpatie")+" "+m.vyber
				.SubTitle.Caption = m.datsk1+" - "+m.datsk2
				.FontName = "Verdana"
				menoform.PF.p_Style.cmbcharttype.enabled=.T.
				menoform.PF.p_Style.cmbcharttype.ListIndex  = 8
				.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
			ENDWITH 
		ELSE 
			RETURN .f.
		ENDIF 
	CASE LOWER(repo_name)=="trz_i_roz_kas"
		ALTER table sales ADD COLUMN ("spotreba1") N(8,2) NULL
		menoform.pf.p_Style.Spn3D.Value=20
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			.ChartsCount = 4
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.YAxis2.caption=jaz("rep_spotreba")
			.XAxis.caption=jaz("rep_stredisko")

			SELECT SPACE(30) as meno, buff.id_kas, SUM(buff.sumpc) as sumpc, SUM(buff.sum_dph) as sum_dph, SUM(obr_ssum.spotreba) as spotreba FROM buff LEFT JOIN obr_ssum ON buff.id_kas=obr_ssum.id_kas AND buff.id_kas=obr_ssum.id_kas AND SUBSTR(buff.uzaverka,3,12)=obr_ssum.uzaverka INTO CURSOR aab GROUP BY buff.id_kas READWRITE 
			REPLACE spotreba WITH 0 FOR ISNULL(spotreba)
			REPLACE sumpc WITH 0 FOR ISNULL(sumpc)
			REPLACE sum_dph WITH 0 FOR ISNULL(sum_dph)
			REPLACE ALL meno WITH i_zkrat(id_kas)
			UPDATE sales SET chart1=aab.sumpc, chart2=aab.sum_dph, chart3=aab.sumpc-aab.sum_dph+aab.spotreba,spotreba1=-aab.spotreba from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
			INSERT INTO sales (chart1, chart2, chart3, spotreba1, legenda, dadosx) SELECT sumpc, sum_dph, sumpc-sum_dph+spotreba, -spotreba, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
			USE IN aab
			.Fields(1).FieldValue = "Chart1"
			.Fields(1).charttype = 3
			.Fields(1).axisindex = 1
			.Fields(2).FieldValue = "spotreba1"
			.Fields(2).axisindex = 1
			.Fields(2).charttype = 5
			.Fields(3).FieldValue = "Chart2"
			.Fields(3).charttype = 3
			.Fields(3).axisindex = 1
			.Fields(4).FieldValue = "Chart3"
			.Fields(4).charttype = 3
			.Fields(4).axisindex = 1
			SELECT sales
			SUM chart1 TO m.sumajedna
			.Fields(1).Legend = jaz("rep_trzba")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
			SUM chart2 TO m.sumajedna
			.Fields(3).Legend = "DPH ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
			SUM chart3 TO m.sumajedna
			.Fields(4).Legend = jaz("rep_rozpatie")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
			SELECT sales
			SUM spotreba1 TO m.sumajedna
			.Fields(2).Legend = jaz("rep_spotreba")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
			.Fields(1).Color  = RGB(100,175,213) && Azul
			.Fields(1).Shape  = 1 && Star
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("grafy_rozp_po_kasach")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.enabled=.T.
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="m_nakupy"
		SELECT DISTINCT nazev, druh FROM nakupy INTO CURSOR aaa
		IF RECCOUNT("aaa")>1
			DO FORM dajdruh WITH "","aaa","nazev",250,"druh",100 TO m.vyber
		ELSE
			m.vyber=aaa.nazev
		ENDIF 
		USE IN aaa
		IF !EMPTY(m.vyber)
			SELECT disti partner FROM nakupy INTO CURSOR aaa WHERE nazev=m.vyber READWRITE 
			LOCAL zorad
			IF RECCOUNT("aaa")>1
				m.zorad=""
				SELECT SPACE(30) AS radenie INTO CURSOR selzost FROM sales WHERE .F. READWRITE
				INSERT INTO selzost (radenie) VALUES (jaz("s_trz profit sumar"))
				INSERT INTO selzost (radenie) VALUES (jaz("grafy_po_partneroch"))
				DO FORM dajdruh WITH "","selzost","radenie",250 TO m.zorad
				IF !EMPTY(m.zorad)
					SELECT selzost
					LOCATE FOR radenie=m.zorad
					m.zorad=RECNO()
					USE IN selzost
				ELSE
					m.zorad=1
				ENDIF 
			ELSE
				m.zorad=1		
			ENDIF 
			SELECT aaa
			IF m.zorad=1
				DELETE all
				INSERT INTO aaa (partner) VALUES ("__")
			ELSE 
				IF RECCOUNT("aaa")>5
					FOR m.i=6 TO RECCOUNT("aaa")
						m.si=ALLTRIM(STR(m.i,2,0))
						ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
					ENDFOR 
				ENDIF 
			ENDIF 
			WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
				IF m.zorad=1
					.ChartsCount = 1
				ELSE
					.ChartsCount = RECCOUNT("aaa")
				ENDIF 
				.SourceAlias = "Sales"
				.FieldAxis2  = "DadosX"
				.FieldHideSlice = "Hide_Slice"

				.YAxis.caption=jaz("rep_cena")
				.XAxis.caption=jaz("rep_datum")
				.axisLegend2.Rotation=90
				SELECT aaa
				SCAN ALL 
					m.partner=aaa.partner
					m.i=RECNO("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					IF m.partner="__"
						SELECT DTOC(datum_dokl) as meno, datum_dokl, cena FROM nakupy INTO CURSOR aab ORDER BY datum_dokl READWRITE WHERE nazev=m.vyber
						m.i=1
						m.si="1"
					ELSE
						SELECT DTOC(datum_dokl) as meno, datum_dokl, cena FROM nakupy INTO CURSOR aab ORDER BY datum_dokl WHERE partner=m.partner AND nazev=m.vyber READWRITE 
					ENDIF 
					UPDATE sales SET chart&si=aab.cena from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
					INSERT INTO sales (chart&si, legenda, dadosx) SELECT cena, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
					USE IN aab
					.Fields(m.i).FieldValue = "Chart"+m.si
					IF m.partner="__"
						.Fields(m.i).Legend = "Cena "+en_meny(m.giakt_mena,3)
					ELSE
						.Fields(m.i).Legend = m.partner
					ENDIF 
					.Fields(m.i).Color  = RGB(100,175,213) && Azul
					.Fields(m.i).Shape  = lopath && Star
				ENDSCAN 
				.Fields(m.i).AxisIndex = 2
				USE IN aaa 
				menoform.pf.p_Style.Spn3D.Value=0
				.FieldColor = "Color"
				.FieldDetachSlice = "Detach"
				.FieldLegend = "Legenda"
			
				.Title.Caption = jaz("rep_ttl_m_nakupy")+" "+ALLTRIM(m.vyber)
				.SubTitle.Caption = m.d1_txt+" - "+m.d2_txt
				.FontName = "Verdana"
				menoform.PF.p_Style.cmbcharttype.ListIndex=5
				.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
				menoform.PF.p_Style.cmbcharttype.Enabled=.f.
			ENDWITH 
		ELSE
			RETURN .f.
		ENDIF
	CASE LOWER(repo_name)=="trz_i_kas_dr"
		SELECT disti id as id_kas FROM pom INTO CURSOR aaa WHERE !INLIST(id,"XX","XZ") READWRITE 
		LOCAL zorad
		IF RECCOUNT("aaa")>1
			m.zorad=""
			SELECT SPACE(30) AS radenie INTO CURSOR selzost FROM sales WHERE .F. READWRITE
			INSERT INTO selzost (radenie) VALUES (jaz("s_trz profit sumar"))
			INSERT INTO selzost (radenie) VALUES ((jaz("s_sk_po_kasach")))
			DO FORM dajdruh WITH "","selzost","radenie",250 TO m.zorad
			IF !EMPTY(m.zorad)
				SELECT selzost
				LOCATE FOR radenie=m.zorad
				m.zorad=RECNO()
				USE IN selzost
			ELSE
				m.zorad=1
			ENDIF 
		ELSE
			m.zorad=1		
		ENDIF 
		SELECT aaa
		IF m.zorad=1
			DELETE all
			INSERT INTO aaa (id_kas) VALUES ("__")
		ELSE 
			IF RECCOUNT("aaa")>5
				FOR m.i=6 TO RECCOUNT("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
				ENDFOR 
			ENDIF 
		ENDIF 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			IF m.zorad=1
				.ChartsCount = 1
			ELSE
				.ChartsCount = RECCOUNT("aaa")
			ENDIF 
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_druh")
			m.id_kas="__"
			SELECT aaa
			SCAN ALL 
				m.id_kas=aaa.id_kas
				m.i=RECNO("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				IF m.id_kas="__"
					SELECT druh as meno, druh, SUM(prachy) as prachy FROM pom INTO CURSOR aab GROUP BY druh READWRITE 
					m.i=1
					m.si="1"
				ELSE
					SELECT druh as meno, druh, SUM(prachy) as prachy FROM pom INTO CURSOR aab GROUP BY druh WHERE id=m.id_kas READWRITE 
				ENDIF 
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				SELECT sales
				SUM chart&si TO m.sumajedna
				m.sumacelkom=m.sumacelkom+m.sumajedna
				SELECT aaa
				IF m.id_kas="__"
					.Fields(m.i).Legend = jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ELSE
					.Fields(m.i).Legend = i_zkrat(aaa.id_kas)+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ENDIF 
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
			ENDSCAN 
			IF m.id_kas<>"__"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
			ENDIF 
			.Fields(m.i).AxisIndex = 2
			USE IN aaa 
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("grafy_trzby_po_druhoch")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 

	CASE LOWER(repo_name)=="trz_i_dr_kas"
		SELECT DISTINCT druh FROM pom INTO CURSOR aaa
		IF RECCOUNT("aaa")>1
			DO FORM dajdruh WITH "","aaa","druh",100 TO m.vyber
		ELSE
			m.vyber=aaa.druh
		ENDIF 
		USE IN aaa
		IF !EMPTY(m.vyber)
			WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
				.ChartsCount = 1
				.SourceAlias = "Sales"
				.FieldAxis2  = "DadosX"
				.FieldHideSlice = "Hide_Slice"

				.YAxis.caption=jaz("rep_trzba")
				.XAxis.caption=jaz("rep_kasa")

				SELECT SPACE(30) as meno, id, SUM(prachy) as prachy FROM pom INTO CURSOR aab GROUP BY id READWRITE WHERE druh=m.vyber
				REPLACE ALL meno WITH i_zkrat(id)
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart1=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart1, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(1).FieldValue = "Chart1"
				SELECT sales
				SUM chart1 TO m.sumajedna
				.Fields(1).Legend = m.vyber+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				.Fields(1).Color  = RGB(100,175,213) && Azul
				.Fields(1).Shape  = lopath && Star
				.Fields(1).AxisIndex = 2
				.FieldColor = "Color"
				.FieldDetachSlice = "Detach"
				.FieldLegend = "Legenda"
				.Title.Caption = jaz("grafy_trzba_za_druh")+":"+ALLTRIM(m.vyber)
				.SubTitle.Caption = m.datsk1+" - "+m.datsk2
				.FontName = "Verdana"
				menoform.PF.p_Style.cmbcharttype.ListIndex=8
				.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
			ENDWITH 
		ELSE
			RETURN .f.
		ENDIF
	CASE LOWER(repo_name)=="trz_i_dr_spart"
		SELECT disti id_kas FROM i_tr_sp INTO CURSOR aaa WHERE !INLIST(id_kas,"XX","XZ") READWRITE 
		LOCAL zorad
		IF RECCOUNT("aaa")>1
			m.zorad=""
			SELECT SPACE(30) AS radenie INTO CURSOR selzost FROM sales WHERE .F. READWRITE
			INSERT INTO selzost (radenie) VALUES (jaz("s_trz profit sumar"))
			INSERT INTO selzost (radenie) VALUES ((jaz("s_sk_po_kasach")))
			DO FORM dajdruh WITH "","selzost","radenie",250 TO m.zorad
			IF !EMPTY(m.zorad)
				SELECT selzost
				LOCATE FOR radenie=m.zorad
				m.zorad=RECNO()
				USE IN selzost
			ELSE
				m.zorad=1
			ENDIF 
		ELSE
			m.zorad=1		
		ENDIF 
		SELECT aaa
		IF m.zorad=1
			DELETE all
			INSERT INTO aaa (id_kas) VALUES ("__")
		ELSE 
			IF RECCOUNT("aaa")>5
				FOR m.i=6 TO RECCOUNT("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
				ENDFOR 
			ENDIF 
		ENDIF 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			IF m.zorad=1
				.ChartsCount = 1
			ELSE
				.ChartsCount = RECCOUNT("aaa")
			ENDIF 
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_spart")
			m.id_kas="__"
			SELECT aaa
			SCAN ALL 
				m.id_kas=aaa.id_kas
				m.i=RECNO("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				IF m.id_kas="__"
					SELECT spart as meno, spart, SUM(prachy) as prachy FROM i_tr_sp INTO CURSOR aab GROUP BY spart READWRITE 
					m.i=1
					m.si="1"
				ELSE
					SELECT spart as meno, spart, SUM(prachy) as prachy FROM i_tr_sp INTO CURSOR aab GROUP BY spart WHERE id_kas=m.id_kas READWRITE 
				ENDIF 
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				SELECT sales
				SUM chart&si TO m.sumajedna
				m.sumacelkom=m.sumacelkom+m.sumajedna
				SELECT aaa
				IF m.id_kas="__"
					.Fields(m.i).Legend = jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ELSE
					.Fields(m.i).Legend = i_zkrat(m.id_kas)+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ENDIF 
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
			ENDSCAN 
			IF m.id_kas<>"__"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
			ENDIF 
			.Fields(m.i).AxisIndex = 2
			USE IN aaa 
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("s_sk_trz trzby skup spart")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_i_meny"
		IF USED("buff1")
			SELECT mena, SUM(cena_pl) as prachy FROM buff1 INTO CURSOR aaa GROUP BY mena READWRITE 
		ELSE 
			SELECT mena, SUM(cena_pl) as prachy FROM buff INTO CURSOR aaa GROUP BY mena READWRITE 
		ENDIF 
		INSERT INTO sales (chart1, legenda, dadosx) SELECT prachy,mena, mena as dadosx FROM aaa order by prachy desc 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			.ChartsCount = 1
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"
			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_mena")
			.Fields(1).FieldValue = "Chart1"
			SELECT sales
			SUM chart1 TO m.sumajedna
			USE IN aaa
			.Fields(1).Legend = jaz("rep_cena")+": "+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)
			.Fields(1).Color  = RGB(100,175,213) && Azul
			.Fields(1).Shape  = lopath && Star
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("rep_ttl_i_trzmen")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_i_cisnik_platba1"
		SELECT disti SPACE(30) as meno, druh_pl FROM buff INTO CURSOR aaa READWRITE 
		IF RECCOUNT("aaa")>0
			REPLACE ALL meno WITH i_drupla(druh_pl)
			IF RECCOUNT("aaa")>5
				FOR m.i=6 TO RECCOUNT("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
				ENDFOR 
			ENDIF 
			m.sumacelkom=0
			WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
				.ChartsCount = RECCOUNT("aaa")
				.SourceAlias = "Sales"
				.FieldAxis2  = "DadosX"
				.FieldHideSlice = "Hide_Slice"
				.YAxis.caption=jaz("rep_trzba")
				.XAxis.caption=jaz("rep_casnik")
				SELECT aaa
				SCAN ALL 
					m.druh_pl=aaa.druh_pl
					m.i=RECNO("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					SELECT SPACE(30) as meno, autor, SUM(trzba) as prachy FROM buff INTO CURSOR aab GROUP BY autor WHERE druh_pl=m.druh_pl READWRITE 
					REPLACE ALL meno WITH i_mencis("01",autor)
					DELETE FOR prachy=0 OR ISNULL(prachy)
					UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
					INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
					USE IN aab
					.Fields(m.i).FieldValue = "Chart"+m.si
					SELECT sales
					SUM chart&si TO m.sumajedna
					m.sumacelkom=m.sumacelkom+m.sumajedna
					SELECT aaa
					.Fields(m.i).Legend = aaa.meno+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
					.Fields(m.i).Color  = RGB(100,175,213) && Azul
					.Fields(m.i).Shape  = lopath && Star
				ENDSCAN 
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
				.Fields(m.i).AxisIndex = 2
				USE IN aaa 
				.FieldColor = "Color"
				.FieldDetachSlice = "Detach"
				.FieldLegend = "Legenda"
				.Title.Caption = jaz("rep_ttl_i_casplt")
				.SubTitle.Caption = m.datsk1+" - "+m.datsk2
				.FontName = "Verdana"
				menoform.PF.p_Style.cmbcharttype.ListIndex=8
				.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
			ENDWITH 
		ENDIF 
	CASE LOWER(repo_name)=="trz_i_cisnik_platba"
		SELECT disti SPACE(30) as meno, autor FROM buff INTO CURSOR aaa WHERE !INLIST(id_kas,"XX","XZ") READWRITE 
		REPLACE ALL meno WITH i_mencis("01",autor)
		IF RECCOUNT("aaa")>5
			FOR m.i=6 TO RECCOUNT("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
			ENDFOR 
		ENDIF 
		m.sumacelkom=0
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			.ChartsCount = RECCOUNT("aaa")
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_druh_platby")

			SELECT aaa
			SCAN ALL 
				m.autor=aaa.autor
				m.i=RECNO("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				SELECT SPACE(30) as meno, druh_pl, SUM(trzba) as prachy FROM buff INTO CURSOR aab GROUP BY druh_pl WHERE autor=m.autor READWRITE 
				REPLACE ALL meno WITH i_drupla(druh_pl)
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				SELECT sales
				SUM chart&si TO m.sumajedna
				m.sumacelkom=m.sumacelkom+m.sumajedna
				SELECT aaa
				.Fields(m.i).Legend = aaa.meno+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
			ENDSCAN 
			.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
			.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
			.Fields(m.i).AxisIndex = 2
			USE IN aaa 
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("rep_ttl_i_casplt")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_i_kas_dr_hod"
		SELECT DISTINCT druh FROM buff INTO CURSOR aaa
		IF RECCOUNT("aaa")>1
			DO FORM dajdruh WITH "","aaa","druh",100 TO m.vyber
		ELSE
			m.vyber=aaa.druh
		ENDIF 
		USE IN aaa
		IF !EMPTY(m.vyber)
			SELECT disti id_kas FROM buff INTO CURSOR aaa WHERE !INLIST(id_kas,"XX","XZ") AND druh=m.vyber READWRITE 
			LOCAL zorad
			IF RECCOUNT("aaa")>1
				m.zorad=""
				SELECT SPACE(30) AS radenie INTO CURSOR selzost FROM sales WHERE .F. READWRITE
				INSERT INTO selzost (radenie) VALUES (jaz("s_trz profit sumar"))
				INSERT INTO selzost (radenie) VALUES ((jaz("s_sk_po_kasach")))
				DO FORM dajdruh WITH "","selzost","radenie",250 TO m.zorad
				IF !EMPTY(m.zorad)
					SELECT selzost
					LOCATE FOR radenie=m.zorad
					m.zorad=RECNO()
					USE IN selzost
				ELSE
					m.zorad=1
				ENDIF 
			ELSE
				m.zorad=1		
			ENDIF 
			SELECT aaa
			IF m.zorad=1
				DELETE all
				INSERT INTO aaa (id_kas) VALUES ("__")
			ELSE 
				IF RECCOUNT("aaa")>5
					FOR m.i=6 TO RECCOUNT("aaa")
						m.si=ALLTRIM(STR(m.i,2,0))
						ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
					ENDFOR 
				ENDIF 
			ENDIF 
			WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
				IF m.zorad=1
					.ChartsCount = 1
				ELSE
					.ChartsCount = RECCOUNT("aaa")
				ENDIF 
				.SourceAlias = "Sales"
				.FieldAxis2  = "DadosX"
				.FieldHideSlice = "Hide_Slice"

				.YAxis.caption=jaz("rep_trzba")
				.XAxis.caption=jaz("rep_hodina")
				m.id_kas="__"
				SELECT aaa
				SCAN ALL 
					m.id_kas=aaa.id_kas
					m.i=RECNO("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					IF m.id_kas="__"
						SELECT pl_hodina as meno, pl_hodina, SUM(prachy) as prachy FROM buff INTO CURSOR aab GROUP BY pl_hodina READWRITE WHERE druh=m.vyber
						m.i=1
						m.si="1"
					ELSE
						SELECT pl_hodina as meno, pl_hodina, SUM(prachy) as prachy FROM buff INTO CURSOR aab GROUP BY pl_hodina WHERE id_kas=m.id_kas AND druh=m.vyber READWRITE 
					ENDIF 
					DELETE FOR prachy=0 OR ISNULL(prachy)
					UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
					INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
					USE IN aab
					.Fields(m.i).FieldValue = "Chart"+m.si
					SELECT sales
					SUM chart&si TO m.sumajedna
					m.sumacelkom=m.sumacelkom+m.sumajedna
					SELECT aaa
					IF m.id_kas="__"
						.Fields(m.i).Legend = jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
					ELSE
						.Fields(m.i).Legend = i_zkrat(aaa.id_kas)+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
					ENDIF 
					.Fields(m.i).Color  = RGB(100,175,213) && Azul
					.Fields(m.i).Shape  = lopath && Star
				ENDSCAN 
				IF m.id_kas<>"__"
					.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
					.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
				ENDIF 
				.Fields(m.i).AxisIndex = 2
				USE IN aaa 
				.FieldColor = "Color"
				.FieldDetachSlice = "Detach"
				.FieldLegend = "Legenda"
				.Title.Caption = jaz("grafy_trzba_v_case_druh")+":"+ALLTRIM(m.vyber)
				.SubTitle.Caption = m.datsk1+" - "+m.datsk2
				.FontName = "Verdana"
				menoform.PF.p_Style.cmbcharttype.ListIndex=8
				.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
			ENDWITH 
		ELSE
			RETURN .f.
		ENDIF
	CASE LOWER(repo_name)=="trz_i_nazev_hod"
		SELECT DISTINCT nazev, druh FROM cas_kalk INTO CURSOR aaa
		IF RECCOUNT("aaa")>1
			DO FORM dajdruh WITH "","aaa","nazev",250,"druh",100 TO m.zorad
		ELSE
			m.zorad=aaa.nazev
		ENDIF 
		USE IN aaa
		IF !EMPTY(m.zorad)
			WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
				.Multichart=.T.
				.ChartType=18
				.ChartsCount = 2
				.SourceAlias = "Sales"
				.FieldAxis2  = "DadosX"
				.FieldHideSlice = "Hide_Slice"
				.YAxis.caption=jaz("rep_trzba")
				.YAxis2.caption=jaz("rep_mnozstvo")
				.XAxis.caption=jaz("rep_hodina")
				SELECT pl_hodina as meno, pl_hodina, SUM(prachy) as prachy, SUM(mnozstvi) as mnozstvi FROM cas_kalk INTO CURSOR aab GROUP BY pl_hodina WHERE nazev=m.zorad READWRITE 
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart1=aab.prachy, chart2=aab.mnozstvi from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart1, chart2, legenda, dadosx) SELECT prachy, mnozstvi, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(1).FieldValue = "Chart1"
				SELECT sales
				SUM chart1 TO m.sumajedna
				.Fields(1).Legend = jaz("rep_trzba")+" :"+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)
				.Fields(1).Color  = RGB(100,175,213) && Azul
				.Fields(1).charttype = 3
				.Fields(1).Shape  = lopath && Star
				SUM chart2 TO m.sumajedna
				.Fields(2).FieldValue = "Chart2"
				.Fields(2).Legend = jaz("rep_mnozstvo")+" :"+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)
				.Fields(2).charttype = 5
				.Fields(2).Color  = RGB(100,175,213) && Azul
				.Fields(2).Shape  = lopath && Star
				.Fields(2).axisindex  = 2
				.FieldColor = "Color"
				.FieldDetachSlice = "Detach"
				.FieldLegend = "Legenda"
				.Title.Caption = SUBSTR(jaz("s_sk_trz trzby casy"),4)+" (" +m.zorad+")"
				.SubTitle.Caption = m.datsk1+" - "+m.datsk2
				.FontName = "Verdana"
				menoform.PF.p_Style.cmbcharttype.enabled=.f.
				menoform.PF.p_Style.cmbcharttype.ListIndex  = 18
			ENDWITH 
		ELSE
			RETURN .f.
		ENDIF
	CASE LOWER(repo_name)=="trz_i_kas_hod"
		SELECT disti id_kas FROM buff INTO CURSOR aaa WHERE !INLIST(id_kas,"XX","XZ") READWRITE 
		LOCAL zorad
		IF RECCOUNT("aaa")>1
			m.zorad=""
			SELECT SPACE(30) AS radenie INTO CURSOR selzost FROM sales WHERE .F. READWRITE
			INSERT INTO selzost (radenie) VALUES (jaz("s_trz profit sumar"))
			INSERT INTO selzost (radenie) VALUES ((jaz("s_sk_po_kasach")))
			DO FORM dajdruh WITH "","selzost","radenie",250 TO m.zorad
			IF !EMPTY(m.zorad)
				SELECT selzost
				LOCATE FOR radenie=m.zorad
				m.zorad=RECNO()
				USE IN selzost
			ELSE
				m.zorad=1
			ENDIF 
		ELSE
			m.zorad=1		
		ENDIF 
		SELECT aaa
		IF m.zorad=1
			DELETE all
			INSERT INTO aaa (id_kas) VALUES ("__")
		ELSE 
			IF RECCOUNT("aaa")>5
				FOR m.i=6 TO RECCOUNT("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
				ENDFOR 
			ENDIF 
		ENDIF 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			IF m.zorad=1
				.ChartsCount = 1
			ELSE
				.ChartsCount = RECCOUNT("aaa")
			ENDIF 
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_hodina")
			m.id_kas="__"
			SELECT aaa
			SCAN ALL 
				m.id_kas=aaa.id_kas
				m.i=RECNO("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				IF m.id_kas="__"
					SELECT pl_hodina as meno, pl_hodina, SUM(prachy) as prachy FROM buff INTO CURSOR aab GROUP BY pl_hodina READWRITE 
					m.i=1
					m.si="1"
				ELSE
					SELECT pl_hodina as meno, pl_hodina, SUM(prachy) as prachy FROM buff INTO CURSOR aab GROUP BY pl_hodina WHERE id_kas=m.id_kas READWRITE 
				ENDIF 
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				SELECT sales
				SUM chart&si TO m.sumajedna
				m.sumacelkom=m.sumacelkom+m.sumajedna
				SELECT aaa
				IF m.id_kas="__"
					.Fields(m.i).Legend = jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ELSE
					.Fields(m.i).Legend = i_zkrat(aaa.id_kas)+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ENDIF 
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
			ENDSCAN 
			IF m.id_kas<>"__"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
			ENDIF 
			.Fields(m.i).AxisIndex = 2
			USE IN aaa 
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = SUBSTR(jaz("s_sk_trz trzby casy"),4)
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_i_rozpeti"
		ALTER table sales ADD COLUMN ("spotreba1") N(8,2) NULL
		menoform.pf.p_Style.Spn3D.Value=20
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			.ChartsCount = 4
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.YAxis2.caption=jaz("rep_spotreba")
			.XAxis.caption=jaz("rep_stredisko")

			SELECT SPACE(30) as meno, buff.id_man, SUM(buff.sumpc) as sumpc, SUM(buff.sum_dph) as sum_dph, SUM(obr_ssum.spotreba) as spotreba FROM buff LEFT JOIN obr_ssum ON buff.id_man=obr_ssum.id_man AND buff.id_kas=obr_ssum.id_kas AND SUBSTR(buff.uzaverka,3,12)=obr_ssum.uzaverka INTO CURSOR aab GROUP BY buff.id_man READWRITE 
			REPLACE spotreba WITH 0 FOR ISNULL(spotreba)
			REPLACE sumpc WITH 0 FOR ISNULL(sumpc)
			REPLACE sum_dph WITH 0 FOR ISNULL(sum_dph)
			REPLACE ALL meno WITH i_zkrat(id_man)
			UPDATE sales SET chart1=aab.sumpc, chart2=aab.sum_dph, chart3=aab.sumpc-aab.sum_dph+aab.spotreba,spotreba1=-aab.spotreba from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
			INSERT INTO sales (chart1, chart2, chart3, spotreba1, legenda, dadosx) SELECT sumpc, sum_dph, sumpc-sum_dph+spotreba, -spotreba, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
			USE IN aab
			.Fields(1).FieldValue = "Chart1"
			.Fields(1).charttype = 3
			.Fields(1).axisindex = 1
			.Fields(2).FieldValue = "spotreba1"
			.Fields(2).axisindex = 1
			.Fields(2).charttype = 5
			.Fields(3).FieldValue = "Chart2"
			.Fields(3).charttype = 3
			.Fields(3).axisindex = 1
			.Fields(4).FieldValue = "Chart3"
			.Fields(4).charttype = 3
			.Fields(4).axisindex = 1
			SELECT sales
			SUM chart1 TO m.sumajedna
			.Fields(1).Legend = jaz("rep_trzba")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
			SUM chart2 TO m.sumajedna
			.Fields(3).Legend = "DPH ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
			SUM chart3 TO m.sumajedna
			.Fields(4).Legend = jaz("rep_rozpatie")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
			SELECT sales
			SUM spotreba1 TO m.sumajedna
			.Fields(2).Legend = jaz("rep_spotreba")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+" "+en_meny(m.giakt_mena,3)+")"
			.Fields(1).Color  = RGB(100,175,213) && Azul
			.Fields(1).Shape  = 1 && Star
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("rep_ttl_vyrobne_rozpatie")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.enabled=.T.
			menoform.PF.p_Style.cmbcharttype.ListIndex  = 3
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_i_kas_hlad"
		SELECT disti id_kas FROM buff INTO CURSOR aaa WHERE !INLIST(id_kas,"XX","XZ") READWRITE 
		LOCAL zorad
		IF RECCOUNT("aaa")>1
			m.zorad=""
			SELECT SPACE(30) AS radenie INTO CURSOR selzost FROM sales WHERE .F. READWRITE
			INSERT INTO selzost (radenie) VALUES (jaz("s_trz profit sumar"))
			INSERT INTO selzost (radenie) VALUES ((jaz("s_sk_po_kasach")))
			DO FORM dajdruh WITH "","selzost","radenie",250 TO m.zorad
			IF !EMPTY(m.zorad)
				SELECT selzost
				LOCATE FOR radenie=m.zorad
				m.zorad=RECNO()
				USE IN selzost
			ELSE
				m.zorad=1
			ENDIF 
		ELSE
			m.zorad=1		
		ENDIF 
		SELECT aaa
		IF m.zorad=1
			DELETE all
			INSERT INTO aaa (id_kas) VALUES ("__")
		ELSE 
			IF RECCOUNT("aaa")>5
				FOR m.i=6 TO RECCOUNT("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
				ENDFOR 
			ENDIF 
		ENDIF 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			IF m.zorad=1
				.ChartsCount = 1
			ELSE
				.ChartsCount = RECCOUNT("aaa")
			ENDIF 
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_cenova_ hladina")
			m.id_kas="__"
			SELECT aaa
			SCAN ALL 
				m.id_kas=aaa.id_kas
				m.i=RECNO("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				IF m.id_kas="__"
					SELECT SPACE(30) as meno, cen_hlad, SUM(prachy) as prachy FROM buff INTO CURSOR aab GROUP BY cen_hlad READWRITE 
					m.i=1
					m.si="1"
				ELSE
					SELECT SPACE(30) as meno, cen_hlad, SUM(prachy) as prachy FROM buff INTO CURSOR aab GROUP BY cen_hlad WHERE id_kas=m.id_kas READWRITE 
				ENDIF 
				REPLACE ALL meno WITH "Hladina "+ALLTRIM(cen_hlad)
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				SELECT sales
				SUM chart&si TO m.sumajedna
				m.sumacelkom=m.sumacelkom+m.sumajedna
				SELECT aaa
				IF m.id_kas="__"
					.Fields(m.i).Legend = jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ELSE
					.Fields(m.i).Legend = i_zkrat(aaa.id_kas)+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ENDIF 
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
			ENDSCAN 
			IF m.id_kas<>"__"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
			ENDIF 
			.Fields(m.i).AxisIndex = 2
			USE IN aaa 
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("m_s_trzby po hladinach")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_i_man"
		SELECT disti id_man FROM buff INTO CURSOR aaa READWRITE 
		IF RECCOUNT("aaa")>5
			FOR m.i=6 TO RECCOUNT("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
			ENDFOR 
		ENDIF 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"

			.ChartsCount = RECCOUNT("aaa")
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_stredisko")

			SELECT aaa
			SCAN ALL 
				m.id_man=aaa.id_man
				m.i=RECNO("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				SELECT druh, SUM(prachy) as prachy FROM buff INTO CURSOR aab GROUP BY druh WHERE id_man=m.id_man READWRITE 
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.druh)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, druh, druh as dadosx FROM aab  WHERE !(druh IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				SELECT sales
				SUM chart&si TO m.sumajedna
				m.sumacelkom=m.sumacelkom+m.sumajedna
				SELECT aaa
				.Fields(m.i).Legend = i_zkrat(m.id_man)+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
			ENDSCAN 
			.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
			.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
			.Fields(m.i).AxisIndex = 2
			USE IN aaa 
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("grafy_trzby_po_stred_a_platba")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_i_man3"
		SELECT SPACE(30) as kasa, id_man, SUM(prachy) as prachy FROM asddf INTO CURSOR aaa GROUP BY id_man READWRITE 
		REPLACE ALL kasa WITH i_zkrat(id_man)
		INSERT INTO sales (chart1, legenda, dadosx) SELECT prachy,kasa, kasa as dadosx FROM aaa order by prachy desc 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"

			.ChartsCount = 1
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_kasa")
			.Fields(1).FieldValue = "Chart1"
			SELECT sales
			SUM chart1 TO m.sumajedna
			SELECT aaa
			.Fields(1).Legend = jaz("rep_spolu")+": "+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)
			.Fields(1).Color  = RGB(100,175,213) && Azul
			.Fields(1).Shape  = lopath && Star
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("grafy_trzba_po_strediskach")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_i_kas_cas"
		LOCAL zorad
		m.zorad=""
		SELECT SPACE(30) AS radenie INTO CURSOR selzost FROM sales WHERE .F. READWRITE
		INSERT INTO selzost (radenie) VALUES (jaz("lim_dni_druhy"))
		INSERT INTO selzost (radenie) VALUES (jaz("grafy_po_manageroch"))
		INSERT INTO selzost (radenie) VALUES (jaz("s_sk_predaj kalk casnik"))
		DO FORM dajdruh WITH "","selzost","radenie",250 TO m.zorad

		IF !EMPTY(m.zorad)
			SELECT selzost
			LOCATE FOR radenie=m.zorad
			m.zorad=RECNO()
			USE IN selzost
			SELECT disti id_kas FROM buff INTO CURSOR aaa WHERE !INLIST(id_kas,"XX","XZ") READWRITE 
			IF RECCOUNT("aaa")>5
				FOR m.i=6 TO RECCOUNT("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
				ENDFOR 
			ENDIF 
			WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
				.ChartsCount = RECCOUNT("aaa")
				.SourceAlias = "Sales"
				.FieldAxis2  = "DadosX"
				.FieldHideSlice = "Hide_Slice"
				.YAxis.caption=jaz("rep_trzba")
				.XAxis.caption=jaz("rep_kasa")
				SELECT aaa
				SCAN ALL 
					m.id_kas=aaa.id_kas
					m.i=RECNO("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					DO CASE 
						CASE m.zorad=1
							SELECT druh, SUM(prachy) as prachy FROM buff INTO CURSOR aab GROUP BY druh WHERE id_kas=m.id_kas READWRITE 
							REPLACE druh WITH "xxx" FOR ISNULL(druh)
							DELETE FOR prachy=0 OR ISNULL(prachy)
							UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.druh)
							INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, druh, druh as dadosx FROM aab  WHERE !(druh IN (SELECT ALLTRIM(dadosx) FROM sales))  
							USE IN aab
						CASE m.zorad=2
							SELECT SPACE(30) as meno, id_man, SUM(prachy) as prachy FROM buff INTO CURSOR aab GROUP BY id_man WHERE id_kas=m.id_kas READWRITE 
							REPLACE id_man WITH "xx" FOR ISNULL(id_man)
							REPLACE ALL meno WITH i_zkrat(id_man)
							DELETE FOR prachy=0 OR ISNULL(prachy)
							UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
							INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
							USE IN aab
						CASE m.zorad=3
							SELECT SPACE(30) as meno, autor, SUM(prachy) as prachy FROM buff INTO CURSOR aab GROUP BY autor WHERE id_kas=m.id_kas READWRITE 
							REPLACE autor WITH "xxx" FOR ISNULL(autor)
							REPLACE ALL meno WITH i_mencis(m.id_kas,autor)
							DELETE FOR prachy=0 OR ISNULL(prachy)
							UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
							INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
							USE IN aab
					ENDCASE 
					.Fields(m.i).FieldValue = "Chart"+m.si
					SELECT sales
					SUM chart&si TO m.sumajedna
					m.sumacelkom=m.sumacelkom+m.sumajedna
					SELECT aaa
					.Fields(m.i).Legend = i_zkrat(aaa.id_kas)+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
					.Fields(m.i).Color  = RGB(100,175,213) && Azul
					.Fields(m.i).Shape  = lopath && Star
				ENDSCAN 
			.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
			.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
			.Fields(m.i).AxisIndex = 2
			ENDWITH 
			USE IN aaa 
			WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
				.FieldColor = "Color"
				.FieldDetachSlice = "Detach"
				.FieldLegend = "Legenda"
				.Title.Caption = jaz("rep_ttl_i_trzkas")
				.SubTitle.Caption = m.datsk1+" - "+m.datsk2
				.FontName = "Verdana"
				menoform.PF.p_Style.cmbcharttype.ListIndex=8
				.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
			ENDWITH 
		ELSE
			USE IN selzost
		ENDIF  
	CASE LOWER(repo_name)=="trz_i_kas_dph"
		SELECT SPACE(30) as kasa, id_kas, SUM(prachy) as prachy FROM buff INTO CURSOR aaa GROUP BY id_kas READWRITE 
		REPLACE ALL kasa WITH i_zkrat(id_kas)
		INSERT INTO sales (chart1, legenda, dadosx) SELECT prachy,kasa, kasa as dadosx FROM aaa order by prachy desc 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"

			.ChartsCount = 1
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"
			SELECT sales
			SUM chart1 TO m.sumajedna
			SELECT aaa
			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_kasa")
			.Fields(1).FieldValue = "Chart1"
			.Fields(1).Legend = jaz("rep_spolu")+": "+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)
			.Fields(1).Color  = RGB(100,175,213) && Azul
			.Fields(1).Shape  = lopath && Star
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("rep_ttl_i_trzkas")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_i_cisnik"
		SELECT disti id_kas FROM buff INTO CURSOR aaa WHERE !INLIST(id_kas,"XX","XZ") READWRITE 
		LOCAL zorad
		IF RECCOUNT("aaa")>1
			m.zorad=""
			SELECT SPACE(30) AS radenie INTO CURSOR selzost FROM sales WHERE .F. READWRITE
			INSERT INTO selzost (radenie) VALUES (jaz("s_trz profit sumar"))
			INSERT INTO selzost (radenie) VALUES ((jaz("s_sk_po_kasach")))
			DO FORM dajdruh WITH "","selzost","radenie",250 TO m.zorad
			IF !EMPTY(m.zorad)
				SELECT selzost
				LOCATE FOR radenie=m.zorad
				m.zorad=RECNO()
				USE IN selzost
			ELSE
				m.zorad=1
			ENDIF 
		ELSE
			m.zorad=1		
		ENDIF 
		SELECT aaa
		IF m.zorad=1
			DELETE all
			INSERT INTO aaa (id_kas) VALUES ("__")
		ELSE 
			IF RECCOUNT("aaa")>5
				FOR m.i=6 TO RECCOUNT("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
				ENDFOR 
			ENDIF 
		ENDIF 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			IF m.zorad=1
				.ChartsCount = 1
			ELSE
				.ChartsCount = RECCOUNT("aaa")
			ENDIF 
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_casnik")
			m.id_kas="__"
			SELECT aaa
			SCAN ALL 
				m.id_kas=aaa.id_kas
				m.i=RECNO("aaa")
				m.si=ALLTRIM(STR(m.i,2,0))
				IF m.id_kas="__"
					SELECT SPACE(30) as meno, autor, SUM(prachy) as prachy FROM buff INTO CURSOR aab GROUP BY autor READWRITE 
					m.i=1
					m.si="1"
				ELSE
					SELECT SPACE(30) as meno, autor, SUM(prachy) as prachy FROM buff INTO CURSOR aab GROUP BY autor WHERE id_kas=m.id_kas READWRITE 
				ENDIF 
				REPLACE autor WITH "xxx" FOR ISNULL(autor)
				REPLACE ALL meno WITH i_mencis(m.id_kas,autor)
				DELETE FOR prachy=0 OR ISNULL(prachy)
				UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.meno)
				INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy, meno, meno as dadosx FROM aab  WHERE !(meno IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
				USE IN aab
				.Fields(m.i).FieldValue = "Chart"+m.si
				SELECT sales
				SUM chart&si TO m.sumajedna
				m.sumacelkom=m.sumacelkom+m.sumajedna
				SELECT aaa
				IF m.id_kas="__"
					.Fields(m.i).Legend = jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ELSE
					.Fields(m.i).Legend = i_zkrat(aaa.id_kas)+" ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
				ENDIF 
				.Fields(m.i).Color  = RGB(100,175,213) && Azul
				.Fields(m.i).Shape  = lopath && Star
			ENDSCAN 
			IF m.id_kas<>"__"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
			ENDIF 
			.Fields(m.i).AxisIndex = 2
			USE IN aaa 
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("m_s_trzby po cisnicich")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			menoform.PF.p_Style.cmbcharttype.ListIndex=8
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE LOWER(repo_name)=="trz_i_platba"
		SELECT disti id_kas, SPACE(30) as meno FROM buff INTO CURSOR aaa WHERE !INLIST(id_kas,"XX","XZ") READWRITE 
		REPLACE ALL meno WITH i_zkrat(id_kas)
		INSERT INTO aaa(id_kas,meno) VALUES ("__",jaz("rep_spolu"))
		IF RECCOUNT("aaa")>1
			DO FORM dajdruh WITH "", "aaa","id_kas",50,"meno",250 TO m.vyber
		ELSE
			m.vyber="__"		
		ENDIF 
		USE IN aaa
		IF !EMPTY(vyber)	
			IF m.vyber="__"
				SELECT disti dan FROM buff WHERE !INLIST(id_kas,"XX","XZ") INTO CURSOR aaa
			ELSE
				SELECT disti dan FROM buff WHERE id_kas=m.vyber INTO CURSOR aaa
			ENDIF 
			SELECT aaa
			IF RECCOUNT("aaa")>5
				FOR m.i=6 TO RECCOUNT("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					ALTER table sales ADD COLUMN ("chart"+m.si) N(8,2)
				ENDFOR 
			ENDIF 
			WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
				.ChartsCount = RECCOUNT("aaa")
				.SourceAlias = "Sales"
				.FieldAxis2  = "DadosX"
				.FieldHideSlice = "Hide_Slice"
				.YAxis.caption=jaz("rep_trzba")
				.XAxis.caption=jaz("rep_platba")

				SELECT aaa
				SCAN ALL 
					m.dan=aaa.dan
					m.i=RECNO("aaa")
					m.si=ALLTRIM(STR(m.i,2,0))
					IF m.vyber="__"
						SELECT menoplatby, SUM(prachy) as prachy FROM buff INTO CURSOR aab GROUP BY menoplatby WHERE dan=m.dan AND !INLIST(id_kas,"XX","XZ") READWRITE 
					ELSE 
						SELECT menoplatby, SUM(prachy) as prachy FROM buff INTO CURSOR aab GROUP BY menoplatby WHERE dan=m.dan AND id_kas=m.vyber READWRITE 
					ENDIF 
					DELETE FOR prachy=0 OR menoplatby=jaz("rep_spolu")
					UPDATE sales SET chart&si=aab.prachy from aab WHERE ALLTRIM(sales.dadosx)=ALLTRIM(aab.menoplatby)
					INSERT INTO sales (chart&si, legenda, dadosx) SELECT prachy,menoplatby, menoplatby as dadosx FROM aab  WHERE !(PADR(ALLTRIM(menoplatby),30) IN (SELECT PADR(ALLTRIM(dadosx),30) FROM sales))  
					USE IN aab
					.Fields(m.i).FieldValue = "Chart"+m.si
					SELECT sales
					SUM chart&si TO m.sumajedna
					m.sumacelkom=m.sumacelkom+m.sumajedna
					.Fields(m.i).Legend = "DPH "+ALLTRIM(STR(aaa.dan*100-100,5,0))+"% ("+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)+")"
					.Fields(m.i).Color  = RGB(100,175,213) && Azul
					.Fields(m.i).Shape  = lopath && Star
				ENDSCAN 
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+"----------------------"
				.Fields(m.i).Legend = .Fields(m.i).Legend+CHR(10)+jaz("rep_spolu")+" ("+ALLTRIM(STR(m.sumacelkom,10,2))+en_meny(m.giakt_mena,3)+")"
				.Fields(m.i).AxisIndex = 2
				USE IN aaa 
				.FieldColor = "Color"
				.FieldDetachSlice = "Detach"
				.FieldLegend = "Legenda"
				.Title.Caption = jaz("m_s_trzby po platbach")+" "+IIF(m.vyber="__","- všetky pokladne",i_zkrat(m.vyber))
				.SubTitle.Caption = m.datsk1+" - "+m.datsk2
				.FontName = "Verdana"
				menoform.PF.p_Style.cmbcharttype.ListIndex=8
				.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
			ENDWITH 
		ELSE
			RETURN .f.
		ENDIF 
	CASE LOWER(repo_name)=="trz_i_platba2"
		SELECT menoplatby, prachy FROM buff INTO CURSOR aaa
		INSERT INTO sales (chart1, legenda, dadosx) SELECT prachy,menoplatby, menoplatby as dadosx FROM aaa order by prachy desc WHERE menoplatby<>jaz("rep_spolu")
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"

			.ChartsCount = 1
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"

			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_platba")
			.Fields(1).FieldValue = "Chart1"
			SELECT sales
			SUM chart1 TO m.sumajedna
			SELECT aaa
			.Fields(1).Legend = jaz("rep_spolu")+": "+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)
			.Fields(1).Color  = RGB(100,175,213) && Azul
			.Fields(1).Shape  = lopath && Star
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("m_s_trzby po platbach")
			.SubTitle.Caption = m.datsk1+" - "+m.datsk2
			.FontName = "Verdana"
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 
	CASE "inventur"$LOWER(repo_name)
		SELECT druh, SUM(zustatek*cena_prum) as stav FROM inv GROUP BY druh INTO CURSOR aaa
		INSERT INTO sales (chart1, legenda, dadosx) SELECT stav, druh, druh as dadosx FROM aaa order by stav desc 
		WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
			.ChartsCount = 1
			.SourceAlias = "Sales"
			.FieldAxis2  = "DadosX"
			.FieldHideSlice = "Hide_Slice"
			.YAxis.caption=jaz("rep_trzba")
			.XAxis.caption=jaz("rep_druh")
			.Fields(1).FieldValue = "Chart1"
			SELECT sales
			SUM chart1 TO m.sumajedna
			SELECT aaa
			.Fields(1).Legend = jaz("rep_spolu")+": "+ALLTRIM(STR(m.sumajedna,10,2))+en_meny(m.giakt_mena,3)
			.Fields(1).Color  = RGB(100,175,213) && Azul
			.Fields(1).Shape  = lopath && Star
			.FieldColor = "Color"
			.FieldDetachSlice = "Detach"
			.FieldLegend = "Legenda"
			.Title.Caption = jaz("grafy_stav_zasob_druhy")
			.SubTitle.Caption = ALLTRIM(m.gcid_zkratka)
			.FontName = "Verdana"
			.ChartType = menoform.PF.p_Style.cmbcharttype.ListIndex && = 4 && Point  1 && Pie Chart
		ENDWITH 

	OTHERWISE 
		=MESSAGEBOX(jaz("grafy_graf_nedostupny"),48,"FoodMan")
		RETURN .f.
ENDCASE 
menoform.pf.p_Style.cntChartRow.spnChartsRow.SpinnerHighValue=menoform.foxcharts1.ChartsCount
menoform.pf.p_Style.cntChartRow.spnChartsRow.KeyboardHighValue=menoform.foxcharts1.ChartsCount
menoform.pf.p_data.cntChartRow.spnChartsRow.SpinnerHighValue=menoform.foxcharts1.ChartsCount
menoform.pf.p_data.cntChartRow.spnChartsRow.KeyboardHighValue=menoform.foxcharts1.ChartsCount

*WITH menoform.FoxCharts1 as FoxCharts OF "FoxCharts.vcx"
WITH menoform.FoxCharts1 as FoxCharts
	.BackColor = menoform.pf.p_background.cntBackGround.ShpBack.BackColor
	.BackColor2 = menoform.pf.p_background.cntBackGround.ShpBack2.BackColor 
	.Depth = menoform.pf.p_Style.Spn3D.Value
	.GradientLevel = menoform.pf.p_background.cntBackGround.spnGradLevel.Value
	menoform.PF.p_colors.ShpMainColor.BackColor = .Color1
	menoform.pf.p_axis.ShpAxisColor.BackColor = menoform.Foxcharts1.AxisColor
	.ColorType = menoform.PF.p_colors.OptColorType.Value - 1
	.BrushType = menoform.PF.p_colors.OptBrushType.Value
	.PieCompensateAngles = menoform.PF.p_Style.CntDonut.ChkWideEllipse.Value
	.PieShowPercent = menoform.Pf.p_Style.CntDonut.ChkShowPercent.Value 
	.BarsSpaceBetween = menoform.Pf.p_Style.CntBars.SpnBetweenBars.Value
	.MarginBottom = menoform.Pf.p_scales.SpnBottom.Value
	.MarginTop    = menoform.Pf.p_scales.SpnTop.Value
	.MarginLeft   = menoform.Pf.p_scales.SpnLeft.Value
	.MarginRight  = menoform.Pf.p_scales.SpnRight.Value
	.ShowValuesOnShapes = menoform.Pf.p_Style.chkvalueinshape.Value
	.DrawChart()
ENDWITH 

grafyhad = CREATEOBJECT("had", "Jazyky")
grafyhad.SHOW()
grafyhad.set_max(151)
menoform.pf.p_style.cntdonut.Label1.Caption=grafytexty(1)
grafyhad.INCREMENT(grafytexty(1))
menoform.pf.p_style.cntdonut.Label2.Caption=grafytexty(2)
grafyhad.INCREMENT(grafytexty(2))
menoform.pf.p_style.cntdonut.Label3.Caption=grafytexty(3)
grafyhad.INCREMENT(grafytexty(3))
menoform.pf.p_style.cntdonut.chkWideEllipse.Caption=grafytexty(4)
grafyhad.INCREMENT(grafytexty(4))
menoform.pf.p_style.cntdonut.chkShowPercent.Caption=grafytexty(5)
grafyhad.INCREMENT(grafytexty(5))
menoform.pf.p_style.cntdonut.ChkDetachSlice.Caption=grafytexty(6)
grafyhad.INCREMENT(grafytexty(6))
menoform.pf.p_style.cntdonut.ChkEnhancedDraw.Caption=grafytexty(7)
grafyhad.INCREMENT(grafytexty(7))
menoform.pf.p_style.cntdonut.Label4.Caption=grafytexty(8)
grafyhad.INCREMENT(grafytexty(8))
menoform.pf.p_style.cntdonut.Label5.Caption=grafytexty(9)
grafyhad.INCREMENT(grafytexty(9))
menoform.pf.p_style.cntdonut.Label6.Caption=grafytexty(10)
grafyhad.INCREMENT(grafytexty(10))
menoform.pf.p_style.cntdonut.ChkDetachonLegend.Caption=grafytexty(11)
grafyhad.INCREMENT(grafytexty(11))
menoform.pf.p_style.cntdonut.chkForceCircle.Caption=grafytexty(12)
grafyhad.INCREMENT(grafytexty(12))
menoform.pf.p_style.cntdonut.Label7.Caption=grafytexty(13)
grafyhad.INCREMENT(grafytexty(13))
menoform.pf.p_style.cntdonut.Check1.Caption=grafytexty(14)
grafyhad.INCREMENT(grafytexty(14))
menoform.pf.p_style.cntbars.Label2.Caption=grafytexty(15)
grafyhad.INCREMENT(grafytexty(15))
menoform.pf.p_style.cntbars.Label1.Caption=grafytexty(16)
grafyhad.INCREMENT(grafytexty(16))
menoform.pf.p_style.cntbars.optBarShape.Option1.Caption=grafytexty(17)
grafyhad.INCREMENT(grafytexty(17))
menoform.pf.p_style.cntbars.optBarShape.Option2.Caption=grafytexty(18)
grafyhad.INCREMENT(grafytexty(18))
menoform.pf.p_style.cntbars.optBarShape.Option3.Caption=grafytexty(19)
grafyhad.INCREMENT(grafytexty(19))
menoform.pf.p_style.cntbars.optLegendDIrection.Option1.Caption=grafytexty(20)
grafyhad.INCREMENT(grafytexty(20))
menoform.pf.p_style.cntbars.optLegendDIrection.Option2.Caption=grafytexty(21)
grafyhad.INCREMENT(grafytexty(21))
menoform.pf.p_style.cntbars.optLegendDIrection.Option3.Caption=grafytexty(22)
grafyhad.INCREMENT(grafytexty(22))
menoform.pf.p_style.cntbars.Label3.Caption=grafytexty(23)
grafyhad.INCREMENT(grafytexty(23))
menoform.pf.p_style.cntbars.Label4.Caption=grafytexty(24)
grafyhad.INCREMENT(grafytexty(24))
menoform.pf.p_style.cntbars.Optiongroup1.Option1.Caption=grafytexty(25)
grafyhad.INCREMENT(grafytexty(25))
menoform.pf.p_style.cntbars.Optiongroup1.Option2.Caption=grafytexty(26)
grafyhad.INCREMENT(grafytexty(26))
menoform.pf.p_style.cntbars.Label5.Caption=grafytexty(27)
grafyhad.INCREMENT(grafytexty(27))
menoform.pf.p_style.cntarea.Label2.Caption=grafytexty(28)
grafyhad.INCREMENT(grafytexty(28))
menoform.pf.p_style.cntarea.chkDraw3dLine.Caption=grafytexty(29)
grafyhad.INCREMENT(grafytexty(29))
menoform.pf.p_style.cntarea.chkDrawBorders.Caption=grafytexty(30)
grafyhad.INCREMENT(grafytexty(30))
menoform.pf.p_style.cntpointorline.Label2.Caption=grafytexty(31)
grafyhad.INCREMENT(grafytexty(31))
menoform.pf.p_style.cntpointorline.chkLineCaps.Caption=grafytexty(32)
grafyhad.INCREMENT(grafytexty(32))
menoform.pf.p_style.cntpointorline.Label3.Caption=grafytexty(33)
grafyhad.INCREMENT(grafytexty(33))
menoform.pf.p_style.cntpointorline.lblUnique.Caption=grafytexty(34)
grafyhad.INCREMENT(grafytexty(34))
menoform.pf.p_style.cntpointorline.chkUnique.Caption=grafytexty(35)
grafyhad.INCREMENT(grafytexty(35))
menoform.pf.p_style.chkSideLegend.Caption=grafytexty(36)
grafyhad.INCREMENT(grafytexty(36))
menoform.pf.p_style.chkValueinShape.Caption=grafytexty(37)
grafyhad.INCREMENT(grafytexty(37))
menoform.pf.p_style.Label3.Caption=grafytexty(38)
grafyhad.INCREMENT(grafytexty(38))
menoform.pf.p_style.cntchartrow.Label1.Caption=grafytexty(39)
grafyhad.INCREMENT(grafytexty(39))
menoform.pf.p_style.chkColorOnMouse.Caption=grafytexty(40)
grafyhad.INCREMENT(grafytexty(40))
menoform.pf.p_style.chkShowTips.Caption=grafytexty(41)
grafyhad.INCREMENT(grafytexty(41))
menoform.pf.p_style.chkShadow.Caption=grafytexty(42)
grafyhad.INCREMENT(grafytexty(42))
menoform.pf.p_style.Label1.Caption=grafytexty(43)
grafyhad.INCREMENT(grafytexty(43))
menoform.pf.p_style.chkShowPercent.Caption=grafytexty(44)
grafyhad.INCREMENT(grafytexty(44))
menoform.pf.p_legends.optLegends.Option1.Caption=grafytexty(45)
grafyhad.INCREMENT(grafytexty(45))
menoform.pf.p_legends.optLegends.Option2.Caption=grafytexty(46)
grafyhad.INCREMENT(grafytexty(46))
menoform.pf.p_legends.optLegends.Option3.Caption=grafytexty(47)
grafyhad.INCREMENT(grafytexty(47))
menoform.pf.p_legends.optLegends.Option4.Caption=grafytexty(48)
grafyhad.INCREMENT(grafytexty(48))
menoform.pf.p_legends.optLegends.Option5.Caption=grafytexty(49)
grafyhad.INCREMENT(grafytexty(49))
menoform.pf.p_legends.optLegends.Option6.Caption=grafytexty(50)
grafyhad.INCREMENT(grafytexty(50))
menoform.pf.p_legends.optLegends.Option7.Caption=grafytexty(51)
grafyhad.INCREMENT(grafytexty(51))
menoform.pf.p_legends.optLegends.Option8.Caption=grafytexty(52)
grafyhad.INCREMENT(grafytexty(52))
menoform.pf.p_legends.Label1.Caption=grafytexty(53)
grafyhad.INCREMENT(grafytexty(53))
menoform.pf.p_legends.Label2.Caption=grafytexty(54)
grafyhad.INCREMENT(grafytexty(54))
menoform.pf.p_legends.Label3.Caption=grafytexty(55)
grafyhad.INCREMENT(grafytexty(55))
menoform.pf.p_legends.Label4.Caption=grafytexty(56)
grafyhad.INCREMENT(grafytexty(56))
menoform.pf.p_legends.Label7.Caption=grafytexty(57)
grafyhad.INCREMENT(grafytexty(57))
menoform.pf.p_legends.Label5.Caption=grafytexty(58)
grafyhad.INCREMENT(grafytexty(58))
menoform.pf.p_legends.Label8.Caption=grafytexty(59)
grafyhad.INCREMENT(grafytexty(59))
menoform.pf.p_legends.Label9.Caption=grafytexty(60)
grafyhad.INCREMENT(grafytexty(60))
menoform.pf.p_legends.Label10.Caption=grafytexty(61)
grafyhad.INCREMENT(grafytexty(61))
menoform.pf.p_legends.Label6.Caption=grafytexty(62)
grafyhad.INCREMENT(grafytexty(62))
menoform.pf.p_legends.Label11.Caption=grafytexty(63)
grafyhad.INCREMENT(grafytexty(63))
menoform.pf.p_legends.Label12.Caption=grafytexty(64)
grafyhad.INCREMENT(grafytexty(64))
menoform.pf.p_legends.Label13.Caption=grafytexty(65)
grafyhad.INCREMENT(grafytexty(65))
menoform.pf.p_legends.Check1.Caption=grafytexty(66)
grafyhad.INCREMENT(grafytexty(66))
menoform.pf.p_legends.Label14.Caption=grafytexty(67)
grafyhad.INCREMENT(grafytexty(67))
menoform.pf.p_axis.chkAxisVisible.Caption=grafytexty(68)
grafyhad.INCREMENT(grafytexty(68))
menoform.pf.p_axis.Label2.Caption=grafytexty(69)
grafyhad.INCREMENT(grafytexty(69))
menoform.pf.p_axis.Label3.Caption=grafytexty(70)
grafyhad.INCREMENT(grafytexty(70))
menoform.pf.p_axis.Label4.Caption=grafytexty(71)
grafyhad.INCREMENT(grafytexty(71))
menoform.pf.p_axis.chkShowLineZero.Caption=grafytexty(72)
grafyhad.INCREMENT(grafytexty(72))
menoform.pf.p_axis.Label1.Caption=grafytexty(73)
grafyhad.INCREMENT(grafytexty(73))
menoform.pf.p_axis.chkTicOnAxis2.Caption=grafytexty(74)
grafyhad.INCREMENT(grafytexty(74))
menoform.pf.p_axis.Label5.Caption=grafytexty(75)
grafyhad.INCREMENT(grafytexty(75))
menoform.pf.p_colors.OptBrushType.Option1.Caption=grafytexty(76)
grafyhad.INCREMENT(grafytexty(76))
menoform.pf.p_colors.OptBrushType.Option2.Caption=grafytexty(77)
grafyhad.INCREMENT(grafytexty(77))
menoform.pf.p_colors.OptBrushType.Option3.Caption=grafytexty(78)
grafyhad.INCREMENT(grafytexty(78))
menoform.pf.p_colors.OptColorType.Option1.Caption=grafytexty(79)
grafyhad.INCREMENT(grafytexty(79))
menoform.pf.p_colors.OptColorType.Option2.Caption=grafytexty(80)
grafyhad.INCREMENT(grafytexty(80))
menoform.pf.p_colors.OptColorType.Option3.Caption=grafytexty(81)
grafyhad.INCREMENT(grafytexty(81))
menoform.pf.p_colors.OptColorType.Option4.Caption=grafytexty(82)
grafyhad.INCREMENT(grafytexty(82))
menoform.pf.p_colors.OptColorType.Option5.Caption=grafytexty(83)
grafyhad.INCREMENT(grafytexty(83))
menoform.pf.p_colors.Label2.Caption=grafytexty(84)
grafyhad.INCREMENT(grafytexty(84))
menoform.pf.p_colors.Label6.Caption=grafytexty(85)
grafyhad.INCREMENT(grafytexty(85))
menoform.pf.p_colors.Label3.Caption=grafytexty(86)
grafyhad.INCREMENT(grafytexty(86))
menoform.pf.p_colors.Label4.Caption=grafytexty(87)
grafyhad.INCREMENT(grafytexty(87))
menoform.pf.p_colors.cntgradient.lblGradLevel.Caption=grafytexty(88)
grafyhad.INCREMENT(grafytexty(88))
menoform.pf.p_colors.cntgradient.lblPieGradPosition.Caption=grafytexty(89)
grafyhad.INCREMENT(grafytexty(89))
menoform.pf.p_colors.cntgradient.ChkInvertColors.Caption=grafytexty(90)
grafyhad.INCREMENT(grafytexty(90))
menoform.pf.p_colors.cntgradient.lblGradDirection.Caption=grafytexty(91)
grafyhad.INCREMENT(grafytexty(91))
menoform.pf.p_colors.cntgradient.optGradientType.Option1.Caption=grafytexty(92)
grafyhad.INCREMENT(grafytexty(92))
menoform.pf.p_colors.cntgradient.optGradientType.Option2.Caption=grafytexty(93)
grafyhad.INCREMENT(grafytexty(93))
menoform.pf.p_colors.cntgradient.Label7.Caption=grafytexty(94)
grafyhad.INCREMENT(grafytexty(94))
menoform.pf.p_background.cntbackground.Label2.Caption=grafytexty(95)
grafyhad.INCREMENT(grafytexty(95))
menoform.pf.p_background.cntbackground.Label4.Caption=grafytexty(96)
grafyhad.INCREMENT(grafytexty(96))
menoform.pf.p_background.cntbackground.Label6.Caption=grafytexty(97)
grafyhad.INCREMENT(grafytexty(97))
menoform.pf.p_scales.Label3.Caption=grafytexty(98)
grafyhad.INCREMENT(grafytexty(98))
menoform.pf.p_scales.Label1.Caption=grafytexty(99)
grafyhad.INCREMENT(grafytexty(99))
menoform.pf.p_scales.Label2.Caption=grafytexty(100)
grafyhad.INCREMENT(grafytexty(100))
menoform.pf.p_scales.Label4.Caption=grafytexty(101)
grafyhad.INCREMENT(grafytexty(101))
menoform.pf.p_scales.Label5.Caption=grafytexty(102)
grafyhad.INCREMENT(grafytexty(102))
menoform.pf.p_scales.chkShowScales.Caption=grafytexty(103)
grafyhad.INCREMENT(grafytexty(103))
menoform.pf.p_scales.cntscales.Label6.Caption=grafytexty(104)
*WAIT "" WINDOW TIMEOUT 1
grafyhad.INCREMENT(grafytexty(104))
menoform.pf.p_scales.cntscales.Label7.Caption=grafytexty(105)
grafyhad.INCREMENT(grafytexty(105))
menoform.pf.p_scales.cntscales.Label8.Caption=grafytexty(106)
grafyhad.INCREMENT(grafytexty(106))
menoform.pf.p_scales.cntscales.Label11.Caption=grafytexty(107)
grafyhad.INCREMENT(grafytexty(107))
menoform.pf.p_scales.cntscales.Label9.Caption=grafytexty(108)
grafyhad.INCREMENT(grafytexty(108))
menoform.pf.p_scales.cntscales.chkAutoFormat.Caption=grafytexty(109)
grafyhad.INCREMENT(grafytexty(109))
menoform.pf.p_scales.cntscales.Label12.Caption=grafytexty(110)
grafyhad.INCREMENT(grafytexty(110))
menoform.pf.p_quality.optSmoothing.Option1.Caption=grafytexty(111)
grafyhad.INCREMENT(grafytexty(111))
menoform.pf.p_quality.optSmoothing.Option2.Caption=grafytexty(112)
grafyhad.INCREMENT(grafytexty(112))
menoform.pf.p_quality.optSmoothing.Option3.Caption=grafytexty(113)
grafyhad.INCREMENT(grafytexty(113))
menoform.pf.p_quality.optSmoothing.Option4.Caption=grafytexty(114)
grafyhad.INCREMENT(grafytexty(114))
menoform.pf.p_quality.optSmoothing.Option5.Caption=grafytexty(115)
grafyhad.INCREMENT(grafytexty(115))
menoform.pf.p_quality.optTextRendering.Option1.Caption=grafytexty(116)
grafyhad.INCREMENT(grafytexty(116))
menoform.pf.p_quality.optTextRendering.Option2.Caption=grafytexty(117)
grafyhad.INCREMENT(grafytexty(117))
menoform.pf.p_quality.optTextRendering.Option3.Caption=grafytexty(118)
grafyhad.INCREMENT(grafytexty(118))
menoform.pf.p_quality.optTextRendering.Option4.Caption=grafytexty(119)
grafyhad.INCREMENT(grafytexty(119))
menoform.pf.p_quality.optTextRendering.Option5.Caption=grafytexty(120)
grafyhad.INCREMENT(grafytexty(120))
menoform.pf.p_quality.optTextRendering.Option6.Caption=grafytexty(121)
grafyhad.INCREMENT(grafytexty(121))
menoform.pf.p_quality.Label4.Caption=grafytexty(122)
grafyhad.INCREMENT(grafytexty(122))
menoform.pf.p_quality.Label1.Caption=grafytexty(123)
grafyhad.INCREMENT(grafytexty(123))
menoform.pf.p_quality.Label3.Caption=grafytexty(124)
grafyhad.INCREMENT(grafytexty(124))
menoform.pf.p_quality.optCompositing.Option1.Caption=grafytexty(125)
grafyhad.INCREMENT(grafytexty(125))
menoform.pf.p_quality.optCompositing.Option2.Caption=grafytexty(126)
grafyhad.INCREMENT(grafytexty(126))
menoform.pf.p_quality.optCompositing.Option3.Caption=grafytexty(127)
grafyhad.INCREMENT(grafytexty(127))
menoform.pf.p_quality.optCompositing.Option4.Caption=grafytexty(128)
grafyhad.INCREMENT(grafytexty(128))
menoform.pf.p_quality.optCompositing.Option5.Caption=grafytexty(129)
grafyhad.INCREMENT(grafytexty(129))
menoform.pf.p_quality.Label2.Caption=grafytexty(130)
grafyhad.INCREMENT(grafytexty(130))
menoform.pf.p_quality.Label6.Caption=grafytexty(131)
grafyhad.INCREMENT(grafytexty(131))
menoform.pf.p_data.cntchartrow.Label1.Caption=grafytexty(132)
grafyhad.INCREMENT(grafytexty(132))
menoform.pf.p_data.cntchartscnt.Label1.Caption=grafytexty(133)
grafyhad.INCREMENT(grafytexty(133))
menoform.pf.p_props.Label4.Caption=grafytexty(134)
grafyhad.INCREMENT(grafytexty(134))
menoform.pf.p_props.chkWith.Caption=grafytexty(135)
grafyhad.INCREMENT(grafytexty(135))
menoform.PF.p_Style.Caption=grafytexty(136)
grafyhad.INCREMENT(grafytexty(136))
menoform.PF.p_Legends.Caption=grafytexty(137)
grafyhad.INCREMENT(grafytexty(137))
menoform.PF.P_Axis.Caption=grafytexty(138)
grafyhad.INCREMENT(grafytexty(138))
menoform.PF.p_Colors.Caption=grafytexty(139)
grafyhad.INCREMENT(grafytexty(139))
menoform.PF.p_Background.Caption=grafytexty(140)
grafyhad.INCREMENT(menoform.PF.p_Background.Caption)
menoform.PF.p_Scales.Caption=grafytexty(141)
grafyhad.INCREMENT(menoform.PF.p_Scales.Caption)
menoform.PF.p_Save.Caption=grafytexty(142)
grafyhad.INCREMENT(menoform.PF.p_Save.Caption)
menoform.PF.p_Quality.Caption=grafytexty(143)
grafyhad.INCREMENT(menoform.PF.p_Quality.Caption)
menoform.PF.p_Data.Caption=grafytexty(144)
grafyhad.INCREMENT(menoform.PF.p_Data.Caption)
menoform.PF.p_Props.Caption=grafytexty(145)
grafyhad.INCREMENT(menoform.PF.p_Props.Caption)
menoform.PF.p_About.Caption=grafytexty(146)
grafyhad.INCREMENT(menoform.PF.p_About.Caption)
menoform.pf.p_Legends.cmbAlignment.RowSource=grafytexty(178)
grafyhad.INCREMENT(menoform.pf.p_Legends.cmbAlignment.RowSource)
menoform.pf.p_axis.cmbBackLines.RowSource=grafytexty(179)
grafyhad.INCREMENT(menoform.pf.p_axis.cmbBackLines.RowSource)
menoform.pf.p_axis.cmbBackBars.RowSource=grafytexty(180)
grafyhad.INCREMENT(menoform.pf.p_axis.cmbBackBars.RowSource)
menoform.pf.p_colors.cntGradient.cmbGradDirection.RowSource=grafytexty(181)
grafyhad.INCREMENT(menoform.pf.p_colors.cntGradient.cmbGradDirection.RowSource)
menoform.pf.p_Background.cntBackGround.cmbGradDirection.RowSource=grafytexty(181)
grafyhad.INCREMENT(menoform.pf.p_Background.cntBackGround.cmbGradDirection.RowSource)
RELEASE grafyhad
RETURN .t.