1 DataSet ds = new DataSet(); 2 ds.ReadXml( " c:\\budgetTable.xml " ); 3 4 code from Zhen #region code from Zhen 5DataTable budgetTable=ds.Tables[0]; 6DataRow[] rows1=budgetTable.Select("bdgKeyCode='INDAZI' and bdgflagRawType='T'"); 7DataRow[] rows2=budgetTable.Select("bdgKeyCode='INDDIP' and bdgflagRawType='T'"); 8DataRow[] rows3=budgetTable.Select("bdgKeyCode='TRAZI' and bdgflagRawType='T'"); 9DataRow[] rows4=budgetTable.Select("bdgKeyCode='TRDIP' and bdgflagRawType='T'"); 10DataRow amountOne; 11DataRow amountTwo; 12DataRow amountThree; 13DataRow amountFour; 14 15if(rows1.Length>0) 16{ 17 amountOne=rows1[0]; 18} 19else 20{ 21 amountOne=budgetTable.NewRow(); 22} 23if(rows2.Length>0) 24{ 25 amountTwo=rows2[0]; 26} 27else 28{ 29 amountTwo=budgetTable.NewRow(); 30} 31if(rows3.Length>0) 32{ 33 amountThree=rows3[0]; 34} 35else 36{ 37 amountThree=budgetTable.NewRow(); 38} 39if(rows4.Length>0) 40{ 41 amountFour=rows4[0]; 42} 43else 44{ 45 amountFour=budgetTable.NewRow(); 46} 47 48rows1=budgetTable.Select("bdgKeyCode='INDAZI' and bdgflagRawType='D' and bdgflagToBeDisplayed=true and bdgPercentage is null"); 49rows2=budgetTable.Select("bdgKeyCode='INDDIP' and bdgflagRawType='D' and bdgflagToBeDisplayed=true and bdgPercentage is null"); 50rows3=budgetTable.Select("bdgKeyCode='TRAZI' and bdgflagRawType='D' and bdgflagToBeDisplayed=true and bdgPercentage is null"); 51rows4=budgetTable.Select("bdgKeyCode='TRDIP' and bdgflagRawType='D' and bdgflagToBeDisplayed=true and bdgPercentage is null"); 52DataRow baseOne; 53DataRow baseTwo; 54DataRow baseThree; 55DataRow baseFour; 56 57if(rows1.Length>0) 58{ 59 baseOne=rows1[0]; 60} 61else 62{ 63 baseOne=budgetTable.NewRow(); 64} 65if(rows2.Length>0) 66{ 67 baseTwo=rows2[0]; 68} 69else 70{ 71 baseTwo=budgetTable.NewRow(); 72} 73if(rows3.Length>0) 74{ 75 baseThree=rows3[0]; 76} 77else 78{ 79 baseThree=budgetTable.NewRow(); 80} 81if(rows4.Length>0) 82{ 83 baseFour=rows4[0]; 84} 85else 86{ 87 baseFour=budgetTable.NewRow(); 88} 89 90rows1=budgetTable.Select("bdgKeyCode='INDAZI' and bdgflagRawType='D' and bdgflagToBeDisplayed=true and bdgPercentage is not null"); 91rows2=budgetTable.Select("bdgKeyCode='INDDIP' and bdgflagRawType='D' and bdgflagToBeDisplayed=true and bdgPercentage is not null"); 92rows3=budgetTable.Select("bdgKeyCode='TRAZI' and bdgflagRawType='D' and bdgflagToBeDisplayed=true and bdgPercentage is not null"); 93rows4=budgetTable.Select("bdgKeyCode='TRDIP' and bdgflagRawType='D' and bdgflagToBeDisplayed=true and bdgPercentage is not null"); 94DataRow[] datasOne=new DataRow[rows1.Length+2]; 95DataRow[] datasTwo=new DataRow[rows2.Length+2]; 96DataRow[] datasThree=new DataRow[rows3.Length+2]; 97DataRow[] datasFour=new DataRow[rows4.Length+2]; 98 99datasOne[0]=baseOne;100for(int i=1;i<=rows1.Length;i++)101{ 102 datasOne[i]=rows1[i-1];103}104datasOne[rows1.Length+1]=amountOne;105106datasTwo[0]=baseTwo;107for(int i=1;i<=rows2.Length;i++)108{ 109 datasTwo[i]=rows2[i-1];110}111datasTwo[rows2.Length+1]=amountTwo;112113datasThree[0]=baseThree;114for(int i=1;i<=rows3.Length;i++)115{ 116 datasThree[i]=rows3[i-1];117}118datasThree[rows3.Length+1]=amountThree;119120datasFour[0]=baseFour;121for(int i=1;i<=rows4.Length;i++)122{ 123 datasFour[i]=rows4[i-1];124}125datasFour[rows4.Length+1]=amountFour; 126127DataRow[][] arrayint={datasOne,datasThree};128string[] arraystring={ "INDAZI","TRAZI", "GroupOne" };129 130131#endregion 132 133 PicPage pp = new PicPage(); 134 135 ChartControl chartControl = (ChartControl)pp.Sections[ " detail " ].Controls[ " ccPerlazienda " ]; 136 SeriesCollection objSeries = chartControl.Series; 137 objSeries.Clear(); 138 139 DataDynamics.ActiveReports.Chart.Axis axis1 = new DataDynamics.ActiveReports.Chart.Axis(); 140 141 DataDynamics.ActiveReports.Chart.Axis axis3 = new DataDynamics.ActiveReports.Chart.Axis(); 142 143 144 axis1.AxisType = DataDynamics.ActiveReports.Chart.AxisType.Categorical; 145 axis1.LabelFont = new DataDynamics.ActiveReports.Chart.FontInfo(System.Drawing.Color.Black, new System.Drawing.Font( " Microsoft Sans Serif " , 8F)); 146 axis1.MajorTick = new DataDynamics.ActiveReports.Chart.Tick( new DataDynamics.ActiveReports.Chart.Graphics.Line(), new DataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Black, DataDynamics.ActiveReports.Chart.Graphics.LineStyle.Dot), 1 , 5F, true ); 147 axis1.MinorTick = new DataDynamics.ActiveReports.Chart.Tick( new DataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Transparent, 0 , DataDynamics.ActiveReports.Chart.Graphics.LineStyle.None), new DataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Transparent, 0 , DataDynamics.ActiveReports.Chart.Graphics.LineStyle.None), 0 , 0F, false ); 148 axis1.TitleFont = new DataDynamics.ActiveReports.Chart.FontInfo(System.Drawing.Color.Black, new System.Drawing.Font( " Microsoft Sans Serif " , 8F)); 149 150 axis3.LabelFont = new DataDynamics.ActiveReports.Chart.FontInfo(System.Drawing.Color.Black, new System.Drawing.Font( " Microsoft Sans Serif " , 8F)); 151 axis3.MajorTick = new DataDynamics.ActiveReports.Chart.Tick( new DataDynamics.ActiveReports.Chart.Graphics.Line(), new DataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Black, DataDynamics.ActiveReports.Chart.Graphics.LineStyle.Dot), 1 , 5F, true ); 152 axis3.MinorTick = new DataDynamics.ActiveReports.Chart.Tick( new DataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Transparent, 0 , DataDynamics.ActiveReports.Chart.Graphics.LineStyle.None), new DataDynamics.ActiveReports.Chart.Graphics.Line(System.Drawing.Color.Transparent, 0 , DataDynamics.ActiveReports.Chart.Graphics.LineStyle.None), 0 , 0F, false ); 153 axis3.Position = 0 ; 154 axis3.TitleFont = new DataDynamics.ActiveReports.Chart.FontInfo(System.Drawing.Color.Black, new System.Drawing.Font( " Microsoft Sans Serif " , 8F), - 90F); 155 156 DataRow[] line1 = arrayint[ 0 ]; 157 DataRow[] line2 = arrayint[ 1 ]; 158 159 Hashtable ht = new Hashtable(); 160 for ( int i = 0 ; i < line1.Length - 1 ; i ++ ) 161 { 162 DataRow dr = line1[i];163 if( !ht.ContainsKey( dr[1].ToString() ) )164 { 165 Series ser = new Series();166 ser.Name = dr[1].ToString();167168 ser.AxisX = axis1;169 ser.AxisY = axis3;170 ser.Type = DataDynamics.ActiveReports.Chart.ChartType.StackedBar3D;171 ser.Properties = new CustomProperties(new KeyValuePair[] { new DataDynamics.ActiveReports.Chart.KeyValuePair("BarType", DataDynamics.ActiveReports.Chart.BarType.Bar)});172 chartControl.Series.Add(ser);173174 ht.Add( dr[1].ToString(), ser );175 }176} 177 178 for ( int i = 0 ; i < line2.Length - 1 ; i ++ ) 179 { 180 DataRow dr = line2[i];181 if( !ht.ContainsKey( dr[1].ToString() ) )182 { 183 Series ser = new Series();184 ser.Name = dr[1].ToString();185186 ser.AxisX = axis1;187 ser.AxisY = axis3;188 ser.Type = DataDynamics.ActiveReports.Chart.ChartType.StackedBar3D;189 ser.Properties = new CustomProperties(new KeyValuePair[] { new DataDynamics.ActiveReports.Chart.KeyValuePair("BarType", DataDynamics.ActiveReports.Chart.BarType.Bar)});190 chartControl.Series.Add(ser);191192 ht.Add( dr[1].ToString(), ser );193 }194} 195 196 for ( int i = 0 ; i < line1.Length - 1 ; i ++ ) 197 { 198 DataRow dr = line1[i];199 Series ser = (Series)ht[dr[1]];200 DataPoint objDataPoint1 = new DataPoint(); //Declare a new DataPoint201 objDataPoint1.XValue = dr[0];202 objDataPoint1.YValues = new DoubleArray(dr[4].ToString());203204 DataPoint objDataPoint2 = new DataPoint( line2[0][0], new DoubleArray("0"), false);205 for( int j = 0; j < line2.Length - 1; j++ )206 { 207 DataRow dr2 = line2[j];208 if( dr2[1].ToString() == ser.Name )209 { 210 objDataPoint2.XValue = dr2[0];211 objDataPoint2.YValues = new DoubleArray(dr2[4].ToString());212 break;213 }214 }215216 if( ser.Points.Count == 0 )217 ser.Points.AddRange( new DataPoint[]{ objDataPoint1,objDataPoint2 } );218 else219 { 220 string s ="";221 }222 223} 224 225 for ( int i = 0 ; i < line2.Length - 1 ; i ++ ) 226 { 227 DataRow dr = line2[i];228229 Series ser = (Series)ht[dr[1]];230 DataPoint objDataPoint1 = new DataPoint(); //Declare a new DataPoint231 objDataPoint1.XValue = dr[0];232 objDataPoint1.YValues = new DoubleArray( dr[4].ToString() );233234 DataPoint objDataPoint2 = new DataPoint( line1[0][0], new DoubleArray("0"), false);235236 if( ser.Points.Count == 0 )237 ser.Points.AddRange( new DataPoint[]{ objDataPoint2, objDataPoint1} );238 else239 { 240 ser.Points.RemoveAt( 1 );241 ser.Points.Add( objDataPoint1 );242 }243} 244 245 246 247 pp.Run(); 248 249 DataDynamics.ActiveReports.Export.Html.HtmlExport htmlExporter = new DataDynamics.ActiveReports.Export.Html.HtmlExport(); 250 htmlExporter.Export( pp.Document, " c:\\aaa.html " ); 251 252 pp.Stop(); 253
1 <? xml version="1.0" standalone="yes" ?> 2 < NewDataSet > 3 < budgetTable > 4 < bdgKeyCode > INDAZI </ bdgKeyCode > 5 < bdgLabel > TOT. IMPORTO BASE </ bdgLabel > 6 < bdgUnit > euro </ bdgUnit > 7 < bdgAmount > 252,00 </ bdgAmount > 8 < bdgAmountfloat > 252 </ bdgAmountfloat > 9 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 10 < bdgflagRawType > D </ bdgflagRawType > 11 </ budgetTable > 12 < budgetTable > 13 < bdgKeyCode > INDAZI </ bdgKeyCode > 14 < bdgLabel > + ratei 13a,14a,ferie TFR </ bdgLabel > 15 < bdgUnit > euro </ bdgUnit > 16 < bdgAmount > 85,68 </ bdgAmount > 17 < bdgAmountfloat > 85.68 </ bdgAmountfloat > 18 < bdgPercentage > 34% </ bdgPercentage > 19 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 20 < bdgflagRawType > D </ bdgflagRawType > 21 </ budgetTable > 22 < budgetTable > 23 < bdgKeyCode > INDAZI </ bdgKeyCode > 24 < bdgLabel > + oneri previdanziali </ bdgLabel > 25 < bdgUnit > euro </ bdgUnit > 26 < bdgAmount > 111,43 </ bdgAmount > 27 < bdgAmountfloat > 111.43 </ bdgAmountfloat > 28 < bdgPercentage > 33% </ bdgPercentage > 29 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 30 < bdgflagRawType > D </ bdgflagRawType > 31 </ budgetTable > 32 < budgetTable > 33 < bdgKeyCode > INDAZI </ bdgKeyCode > 34 < bdgLabel > + IRAP </ bdgLabel > 35 < bdgUnit > euro </ bdgUnit > 36 < bdgAmount > 17,52 </ bdgAmount > 37 < bdgAmountfloat > 17.52 </ bdgAmountfloat > 38 < bdgPercentage > 3,9% </ bdgPercentage > 39 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 40 < bdgflagRawType > D </ bdgflagRawType > 41 </ budgetTable > 42 < budgetTable > 43 < bdgKeyCode > INDAZI </ bdgKeyCode > 44 < bdgLabel > + IRES su IRAP </ bdgLabel > 45 < bdgUnit > euro </ bdgUnit > 46 < bdgAmount > 4,82 </ bdgAmount > 47 < bdgAmountfloat > 4.82 </ bdgAmountfloat > 48 < bdgPercentage > 27,5% </ bdgPercentage > 49 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 50 < bdgflagRawType > D </ bdgflagRawType > 51 </ budgetTable > 52 < budgetTable > 53 < bdgKeyCode > INDAZI </ bdgKeyCode > 54 < bdgLabel > SPENDO </ bdgLabel > 55 < bdgUnit > euro </ bdgUnit > 56 < bdgAmount > 471,45 </ bdgAmount > 57 < bdgAmountfloat > 471.45 </ bdgAmountfloat > 58 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 59 < bdgflagRawType > T </ bdgflagRawType > 60 </ budgetTable > 61 < budgetTable > 62 < bdgKeyCode > INDDIP </ bdgKeyCode > 63 < bdgLabel > IMPORTO BASE </ bdgLabel > 64 < bdgUnit > euro </ bdgUnit > 65 < bdgAmount > 12,00 </ bdgAmount > 66 < bdgAmountfloat > 12 </ bdgAmountfloat > 67 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 68 < bdgflagRawType > D </ bdgflagRawType > 69 </ budgetTable > 70 < budgetTable > 71 < bdgKeyCode > INDDIP </ bdgKeyCode > 72 < bdgLabel > - oneri previdenziali </ bdgLabel > 73 < bdgUnit > euro </ bdgUnit > 74 < bdgAmount > -1,10 </ bdgAmount > 75 < bdgAmountfloat > -1.1 </ bdgAmountfloat > 76 < bdgPercentage > 9,19% </ bdgPercentage > 77 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 78 < bdgflagRawType > D </ bdgflagRawType > 79 </ budgetTable > 80 < budgetTable > 81 < bdgKeyCode > INDDIP </ bdgKeyCode > 82 < bdgLabel > - IRPEF </ bdgLabel > 83 < bdgUnit > euro </ bdgUnit > 84 < bdgAmount > -3,54 </ bdgAmount > 85 < bdgAmountfloat > -3.54 </ bdgAmountfloat > 86 < bdgPercentage > 27% </ bdgPercentage > 87 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 88 < bdgflagRawType > D </ bdgflagRawType > 89 </ budgetTable > 90 < budgetTable > 91 < bdgKeyCode > INDDIP </ bdgKeyCode > 92 < bdgLabel > PER EROGARE </ bdgLabel > 93 < bdgUnit > euro </ bdgUnit > 94 < bdgAmount > 7,36 </ bdgAmount > 95 < bdgAmountfloat > 7.36 </ bdgAmountfloat > 96 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 97 < bdgflagRawType > T </ bdgflagRawType > 98 </ budgetTable > 99 < budgetTable > 100 < bdgKeyCode > TRAZI </ bdgKeyCode > 101 < bdgLabel > TOT. VAL. TICKET </ bdgLabel > 102 < bdgUnit > euro </ bdgUnit > 103 < bdgAmount > 252,00 </ bdgAmount > 104 < bdgAmountfloat > 252 </ bdgAmountfloat > 105 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 106 < bdgflagRawType > D </ bdgflagRawType > 107 </ budgetTable > 108 < budgetTable > 109 < bdgKeyCode > TRAZI </ bdgKeyCode > 110 < bdgLabel > + IVA 4% </ bdgLabel > 111 < bdgUnit > euro </ bdgUnit > 112 < bdgAmount > 10,08 </ bdgAmount > 113 < bdgAmountfloat > 10.08 </ bdgAmountfloat > 114 < bdgPercentage > 4% </ bdgPercentage > 115 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 116 < bdgflagRawType > D </ bdgflagRawType > 117 </ budgetTable > 118 < budgetTable > 119 < bdgKeyCode > TRAZI </ bdgKeyCode > 120 < bdgLabel > + oneri previdenziali </ bdgLabel > 121 < bdgUnit > euro </ bdgUnit > 122 < bdgAmount > 46,50 </ bdgAmount > 123 < bdgAmountfloat > 46.5 </ bdgAmountfloat > 124 < bdgPercentage > 33% </ bdgPercentage > 125 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 126 < bdgflagRawType > D </ bdgflagRawType > 127 </ budgetTable > 128 < budgetTable > 129 < bdgKeyCode > TRAZI </ bdgKeyCode > 130 < bdgLabel > + IRAP </ bdgLabel > 131 < bdgUnit > euro </ bdgUnit > 132 < bdgAmount > 12,03 </ bdgAmount > 133 < bdgAmountfloat > 12.03 </ bdgAmountfloat > 134 < bdgPercentage > 3,9% </ bdgPercentage > 135 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 136 < bdgflagRawType > D </ bdgflagRawType > 137 </ budgetTable > 138 < budgetTable > 139 < bdgKeyCode > TRAZI </ bdgKeyCode > 140 < bdgLabel > + IRES su IRAP </ bdgLabel > 141 < bdgUnit > euro </ bdgUnit > 142 < bdgAmount > 3,31 </ bdgAmount > 143 < bdgAmountfloat > 3.31 </ bdgAmountfloat > 144 < bdgPercentage > 27,5% </ bdgPercentage > 145 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 146 < bdgflagRawType > D </ bdgflagRawType > 147 </ budgetTable > 148 < budgetTable > 149 < bdgKeyCode > TRAZI </ bdgKeyCode > 150 < bdgLabel > SPENDO </ bdgLabel > 151 < bdgUnit > euro </ bdgUnit > 152 < bdgAmount > 323,92 </ bdgAmount > 153 < bdgAmountfloat > 323.92 </ bdgAmountfloat > 154 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 155 < bdgflagRawType > T </ bdgflagRawType > 156 </ budgetTable > 157 < budgetTable > 158 < bdgKeyCode > TRDIP </ bdgKeyCode > 159 < bdgLabel > VALORE TICKET </ bdgLabel > 160 < bdgUnit > euro </ bdgUnit > 161 < bdgAmount > 12,00 </ bdgAmount > 162 < bdgAmountfloat > 12 </ bdgAmountfloat > 163 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 164 < bdgflagRawType > D </ bdgflagRawType > 165 </ budgetTable > 166 < budgetTable > 167 < bdgKeyCode > TRDIP </ bdgKeyCode > 168 < bdgLabel > - oneri previdenziali </ bdgLabel > 169 < bdgUnit > euro </ bdgUnit > 170 < bdgAmount > 0,62 </ bdgAmount > 171 < bdgAmountfloat > 0.62 </ bdgAmountfloat > 172 < bdgPercentage > 9,19% </ bdgPercentage > 173 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 174 < bdgflagRawType > D </ bdgflagRawType > 175 </ budgetTable > 176 < budgetTable > 177 < bdgKeyCode > TRDIP </ bdgKeyCode > 178 < bdgLabel > - IRPEF </ bdgLabel > 179 < bdgUnit > euro </ bdgUnit > 180 < bdgAmount > 1,98 </ bdgAmount > 181 < bdgAmountfloat > 1.98 </ bdgAmountfloat > 182 < bdgPercentage > 27% </ bdgPercentage > 183 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 184 < bdgflagRawType > D </ bdgflagRawType > 185 </ budgetTable > 186 < budgetTable > 187 < bdgKeyCode > TRDIP </ bdgKeyCode > 188 < bdgLabel > PER EROGARE </ bdgLabel > 189 < bdgUnit > euro </ bdgUnit > 190 < bdgAmount > 9,40 </ bdgAmount > 191 < bdgAmountfloat > 9.4 </ bdgAmountfloat > 192 < bdgflagToBeDisplayed > true </ bdgflagToBeDisplayed > 193 < bdgflagRawType > T </ bdgflagRawType > 194 </ budgetTable > 195 </ NewDataSet >