public Bitmap Bar_InfoStat(string getGrade,string getClass,GroupControl gControl) { DataSet dsBuildStatInfo = BuildMorningInfoStat(BegDate,EndDate,getGrade,getClass); DataSet dsClassInfo = new RealtimeInfoDataAccess().setClassList("",getClass,getGrade); int statMember = dsClassInfo.Tables[0].Rows.Count; if ( getClass.Equals("") ) { try { zedGraph_StuBarPrint = new ZedGraphControl(); gControl.Controls.Clear(); gControl.Controls.Add(zedGraph_StuBarPrint); zedGraph_StuBarPrint.Dock = DockStyle.Fill; GraphPane myPane = zedGraph_StuBarPrint.GraphPane; // Create a new graph with the dimension of the groupcontrol // GraphPane myPane = new GraphPane( new Rectangle( 0, 0, gControl.Width, gControl.Height ), // new GardenInfoDataAccess().GetGardenInfo().Tables[0].Rows[0][1].ToString() // + "晨检信息统计图", "统计日期: " // + BegDate.ToString("yyyy.MM.dd") + " 至 " + EndDate.ToString("yyyy.MM.dd"), "晨检统计率" ); myPane.Title = new GardenInfoDataAccess().GetGardenInfo().Tables[0].Rows[0][1].ToString() + "晨检信息统计图"; myPane.XAxis.Title = "统计日期: " + BegDate.ToString("yyyy.MM.dd") + " 至 " + EndDate.ToString("yyyy.MM.dd"); myPane.YAxis.Title = "晨检统计率"; myPane.FontSpec.IsBold = true; myPane.FontSpec.Size = 16; //build label shown below string[] classLabels = new string[statMember]; for ( int classMember=0 ; classMember<statMember; classMember++ ) { classLabels[classMember] = dsClassInfo.Tables[0].Rows[classMember][1].ToString(); } //build health bar double[] healthBar = new double[statMember]; for ( int healthMember=0 ; healthMember<statMember; healthMember++ ) { if ( dsBuildStatInfo.Tables[0].Rows[healthMember][3].ToString().Equals("0") ) healthBar[healthMember] = 0; else { string tempHealth = dsBuildStatInfo.Tables[0].Rows[healthMember][3].ToString(); healthBar[healthMember] = Convert.ToDouble(tempHealth.Substring(tempHealth.IndexOf("(")+1, tempHealth.IndexOf("%")-tempHealth.IndexOf("(")-1)); } } //build ill Bar double[] illBar = new double[statMember]; for ( int illMember=0; illMember<statMember; illMember++ ) { if ( dsBuildStatInfo.Tables[0].Rows[illMember][5].ToString().Equals("0") ) illBar[illMember] = 0; else { string tempIll = dsBuildStatInfo.Tables[0].Rows[illMember][5].ToString(); illBar[illMember] = Convert.ToDouble(tempIll.Substring(tempIll.IndexOf("(")+1, tempIll.IndexOf("%")-tempIll.IndexOf("(")-1)); } } //build wathc bar double[] watchBar = new double[statMember]; for ( int watchMember=0; watchMember<statMember; watchMember++ ) { if ( dsBuildStatInfo.Tables[0].Rows[watchMember][4].ToString().Equals("0") ) watchBar[watchMember] = 0; else { string tempWatch = dsBuildStatInfo.Tables[0].Rows[watchMember][4].ToString(); watchBar[watchMember] = Convert.ToDouble(tempWatch.Substring(tempWatch.IndexOf("(")+1, tempWatch.IndexOf("%")-tempWatch.IndexOf("(")-1)); } } //build absence bar double[] absBar = new double[statMember]; for ( int absMember=0; absMember<statMember; absMember++ ) { if ( dsBuildStatInfo.Tables[0].Rows[absMember][8].ToString().Equals("0") ) absBar[absMember] = 0; else { string tempAbs = dsBuildStatInfo.Tables[0].Rows[absMember][8].ToString(); absBar[absMember] = Convert.ToDouble(tempAbs.Substring(tempAbs.IndexOf("(")+1, tempAbs.IndexOf("%")-tempAbs.IndexOf("(")-1)); } } //build attend bar double[] attBar = new double[statMember]; for ( int attMember=0 ;attMember<statMember; attMember++ ) { if ( dsBuildStatInfo.Tables[0].Rows[attMember][9].ToString().Equals("0") ) attBar[attMember] = 0; else { string tempAtt = dsBuildStatInfo.Tables[0].Rows[attMember][9].ToString(); attBar[attMember] = Convert.ToDouble(tempAtt.Substring(tempAtt.IndexOf("(")+1, tempAtt.IndexOf("%")-tempAtt.IndexOf("(")-1)); } } if ( getGrade.Equals("") ) myPane.BarType = BarType.PercentStack; // Generate a red bar with "健康" in the legend BarItem myBar = myPane.AddBar( "健康", null, healthBar, Color.Red); myBar.Bar.Fill = new Fill( Color.Red, Color.White,Color.Red ); // Generate a blue bar with "服药" in the legend myBar = myPane.AddBar( "服药", null, illBar, Color.Blue ); myBar.Bar.Fill = new Fill( Color.Blue, Color.White, Color.Blue ); // Generate a green bar with "观察" in the legend myBar = myPane.AddBar( "观察", null, watchBar, Color.Green ); myBar.Bar.Fill = new Fill( Color.Green, Color.White, Color.Green ); // Generate a purple bar with "缺席" in the lengend myBar = myPane.AddBar("缺席",null,absBar,Color.Purple); myBar.Bar.Fill = new Fill(Color.Purple,Color.White,Color.Purple); //Generate a black line with "Curve 4" in the legend LineItem myCurve = myPane.AddCurve( "出勤率", null, attBar, Color.Black, SymbolType.Circle ); myCurve.Line.Fill = new Fill( Color.White, Color.LightSkyBlue, -45F ); //Fix up the curve attributes a little myCurve.Symbol.Size = 8.0F; myCurve.Symbol.Fill = new Fill( Color.White ); myCurve.Line.Width = 2.0F; // Draw the X tics between the labels instead of at the labels myPane.XAxis.IsTicsBetweenLabels = true; // Set the XAxis labels myPane.XAxis.TextLabels = classLabels; myPane.XAxis.ScaleFontSpec.Size = 10; // Set the XAxis to Text type myPane.XAxis.Type = AxisType.Text; // Fill the Axis and Pane backgrounds myPane.AxisFill = new Fill( Color.Pink, Color.FromArgb( 255, 255, 166), 90F ); myPane.PaneFill = new Fill( Color.Lavender ); // Tell ZedGraph to refigure the // axes since the data have changed // myPane.AxisChange( gra ); // myPane.Draw(gra); // myPane.ReSize(gra,new RectangleF(150, 300, 800,600)); zedGraph_StuBarPrint.IsShowContextMenu = false; zedGraph_StuBarPrint.IsEnableZoom = false; zedGraph_StuBarPrint.AxisChange(); return myPane.Image; } catch(Exception e) { Util.WriteLog(e.Message,Util.EXCEPTION_LOG_TITLE); return null; } } else { try { string health = dsBuildStatInfo.Tables[0].Rows[0][3].ToString(); string ill = dsBuildStatInfo.Tables[0].Rows[0][5].ToString(); string watch = dsBuildStatInfo.Tables[0].Rows[0][4].ToString(); string absence = dsBuildStatInfo.Tables[0].Rows[0][8].ToString(); string attend = dsBuildStatInfo.Tables[0].Rows[0][9].ToString(); // Graphics gra = gControl.CreateGraphics(); // Create a new graph with the dimension of the groupcontrol // GraphPane myPane = new GraphPane( new Rectangle( 0, 0, gControl.Width, gControl.Height ), // new GardenInfoDataAccess().GetGardenInfo().Tables[0].Rows[0][1].ToString() // + "晨检信息统计图", "统计日期: " // + BegDate.ToString("yyyy.MM.dd") + " 至 " + EndDate.ToString("yyyy.MM.dd"), "晨检统计率" ); zedGraph_StuBarPrint = new ZedGraphControl(); gControl.Controls.Clear(); gControl.Controls.Add(zedGraph_StuBarPrint); zedGraph_StuBarPrint.Dock = DockStyle.Fill; GraphPane myPane = zedGraph_StuBarPrint.GraphPane; myPane.Title = new GardenInfoDataAccess().GetGardenInfo().Tables[0].Rows[0][1].ToString() + "晨检信息统计图"; myPane.XAxis.Title = "统计日期: " + BegDate.ToString("yyyy.MM.dd") + " 至 " + EndDate.ToString("yyyy.MM.dd"); myPane.YAxis.Title = "晨检统计率"; myPane.FontSpec.IsBold = true; myPane.FontSpec.Size = 16; string[] statusLabels = { "健康","服药","观察","缺席","出勤率"}; double[] statusBar = new double[5]; if ( health.Equals("0") ) statusBar[0] = 0; else statusBar[0] = Convert.ToDouble(health.Substring(health.IndexOf("(")+1, health.IndexOf("%")-health.IndexOf("(")-1)); if ( ill.Equals("0") ) statusBar[1] = 0; else statusBar[1] = Convert.ToDouble(ill.Substring(ill.IndexOf("(")+1, ill.IndexOf("%")-ill.IndexOf("(")-1)); if ( watch.Equals("0") ) statusBar[2] = 0; else statusBar[2] = Convert.ToDouble(watch.Substring(watch.IndexOf("(")+1, watch.IndexOf("%")-watch.IndexOf("(")-1)); if ( absence.Equals("0") ) statusBar[3] = 0; else statusBar[3] = Convert.ToDouble(absence.Substring(absence.IndexOf("(")+1, absence.IndexOf("%")-absence.IndexOf("(")-1)); if ( attend.Equals("0") ) statusBar[4] = 0; else statusBar[4] = Convert.ToDouble(attend.Substring(attend.IndexOf("(")+1, attend.IndexOf("%")-attend.IndexOf("(")-1)); BarItem myBar = myPane.AddBar( dsBuildStatInfo.Tables[0].Rows[0]["info_className"].ToString(), null, statusBar, Color.Red); myBar.Bar.Fill = new Fill( Color.Red, Color.White,Color.Red ); for ( int i=0; i<statusBar.Length; i++ ) { // format the label string to have 1 decimal place string lab = statusBar[i].ToString( "0.00" ); // create the text item (assumes the x axis is ordinal or text) // for negative bars, the label appears just above the zero value TextItem text = new TextItem( lab, (float) (i+1), (float) (statusBar[i] + 1 ) ); // tell Zedgraph to use user scale units for locating the TextItem text.Location.CoordinateFrame = CoordType.AxisXYScale; // AlignH the left-center of the text to the specified point text.Location.AlignH = AlignH.Center; text.Location.AlignV = AlignV.Bottom; text.FontSpec.Border.IsVisible = false; text.FontSpec.Fill.IsVisible = false; // rotate the text 90 degrees text.FontSpec.Angle = 0; // add the TextItem to the list myPane.GraphItemList.Add( text ); } myPane.XAxis.IsTicsBetweenLabels = true; // Set the XAxis labels myPane.XAxis.TextLabels = statusLabels; myPane.XAxis.ScaleFontSpec.Size = 12; // Set the XAxis to Text type myPane.XAxis.Type = AxisType.Text; // Fill the Axis and Pane backgrounds myPane.AxisFill = new Fill( Color.Pink, Color.FromArgb( 255, 255, 166), 90F ); myPane.PaneFill = new Fill( Color.Lavender ); // Tell ZedGraph to refigure the // axes since the data have changed // myPane.AxisChange( gra ); // myPane.Draw(gra); // myPane.ReSize(gra,new RectangleF(1500, 300, 800,600)); zedGraph_StuBarPrint.IsShowContextMenu = false; zedGraph_StuBarPrint.IsEnableZoom = false; zedGraph_StuBarPrint.AxisChange(); return myPane.Image; } catch(Exception e) { Util.WriteLog(e.Message,Util.EXCEPTION_LOG_TITLE); return null; } } }
public Bitmap Pie_BackInfoStat(string getGrade,string getClass,DateTime getDate,PanelControl pControl) { using ( RealtimeInfoDataAccess realTimeInfoDataAccess = new RealtimeInfoDataAccess() ) { try { int getHasGone = 0; int getHasnotGone = 0; int getStuNumbers = 0; realTimeInfoDataAccess.GetRealtimeBackInfo_Graphic(getGrade,getClass,getDate,ref getHasGone,ref getHasnotGone,ref getStuNumbers); double hasGonePer = (double)getHasGone/(double)getStuNumbers; double hasnotGonePer = (double)getHasnotGone/(double)getStuNumbers; zedGraph_RealTimeInfoStatStudent = new ZedGraphControl(); pControl.Controls.Clear(); pControl.Controls.Add(zedGraph_RealTimeInfoStatStudent); zedGraph_RealTimeInfoStatStudent.Dock = DockStyle.Fill; GraphPane myPane = zedGraph_RealTimeInfoStatStudent.GraphPane; if ( getGrade.Equals("") ) myPane.Title = new GardenInfoDataAccess().GetGardenInfo().Tables[0].Rows[0][1].ToString() + "全年级晚接信息统计图\n"+"统计日期: " + getDate.ToString("yyyy-MM-dd"); else if ( getClass.Equals("") ) myPane.Title = new GardenInfoDataAccess().GetGardenInfo().Tables[0].Rows[0][1].ToString() + new StuInfoDataAccess().GetGradeList("",getGrade).Tables[0].Rows[0][1].ToString() + "晚接信息统计图\n"+"统计日期: " + getDate.ToString("yyyy-MM-dd"); else myPane.Title = new GardenInfoDataAccess().GetGardenInfo().Tables[0].Rows[0][1].ToString() + new RealtimeInfoDataAccess().setClassList("",getClass,getGrade).Tables[0].Rows[0][1].ToString() + "晚接信息统计图\n"+"统计日期: " + getDate.ToString("yyyy-MM-dd"); double[] statusVal = { hasGonePer, hasnotGonePer }; string[] statusLabel = { "已接走", "未接走"}; myPane.PaneFill = new Fill( Color.Cornsilk ); myPane.AxisFill = new Fill( Color.Cornsilk ); myPane.Legend.Position = LegendPos.Right ; myPane.Legend.FontSpec.Size = 12; PieItem [] slices = new PieItem[statusVal.Length] ; slices = myPane.AddPieSlices ( statusVal, statusLabel ); ((PieItem)slices[0]).LabelType = PieLabelType.Percent ; ((PieItem)slices[0]).LabelDetail.FontSpec.Size = 14; ((PieItem)slices[1]).LabelType = PieLabelType.Percent ; ((PieItem)slices[1]).LabelDetail.FontSpec.Size = 14; ((PieItem)slices[1]).Displacement = .1 ; BoxItem box = new BoxItem( new RectangleF( 0F, 0F, 1F, 1F ), Color.Empty, Color.PeachPuff ); box.Location.CoordinateFrame = CoordType.AxisFraction; box.Border.IsVisible = false; box.Location.AlignH = AlignH.Left; box.Location.AlignV = AlignV.Top; box.ZOrder = ZOrder.E_BehindAxis; myPane.GraphItemList.Add( box ); zedGraph_RealTimeInfoStatStudent.IsShowContextMenu = false; zedGraph_RealTimeInfoStatStudent.IsEnableZoom = false; zedGraph_RealTimeInfoStatStudent.AxisChange(); return myPane.Image; } catch(Exception e) { Util.WriteLog(e.Message,Util.EXCEPTION_LOG_TITLE); return null; } } }
//建立晨检统计表 public DataSet BuildMorningInfoStat(DateTime getBegDate,DateTime getEndDate,string getGrade,string getClass) { using ( MorningCheckPrintDataAccess morningCheckPrintDataAccess = new MorningCheckPrintDataAccess() ) { try { DataSet buildMorningInfoStat = new RealtimeInfoDataAccess().setClassList("",getClass,getGrade); buildMorningInfoStat.Tables[0].Columns.AddRange(new DataColumn[]{new DataColumn("info_health"),new DataColumn("info_watch"), new DataColumn("info_ill"),new DataColumn("info_shouldAtt"), new DataColumn("info_haveAtt"),new DataColumn("info_absence"), new DataColumn("info_attPer")}); DataSet dsHealth = morningCheckPrintDataAccess.SetMorningCheckInfoStat(getBegDate,getEndDate,getGrade,getClass,0,0); DataSet dsWatch = morningCheckPrintDataAccess.SetMorningCheckInfoStat(getBegDate,getEndDate,getGrade,getClass,2,0); DataSet dsIll = morningCheckPrintDataAccess.SetMorningCheckInfoStat(getBegDate,getEndDate,getGrade,getClass,3,0); DataSet dsAbsence = morningCheckPrintDataAccess.SetMorningCheckInfoStat(getBegDate,getEndDate,getGrade,getClass,-1,0); DataSet dsSum = morningCheckPrintDataAccess.SetMorningCheckInfoStat(getBegDate,getEndDate,getGrade,getClass,100,1); DataSet dsStuAmount = null; int healthNumbersAll = 0; int watchNumbersAll = 0; int illNumbersAll = 0; int absenceNumbersAll = 0; int sumNumbersAll = 0; int stuAmountAll = 0; for ( int row = 0; row < buildMorningInfoStat.Tables[0].Rows.Count; row ++ ) { dsStuAmount = new RealtimeInfoDataAccess().setStuAmount(buildMorningInfoStat.Tables[0].Rows[row][2].ToString(),getEndDate); //健康人数统计 if ( dsHealth.Tables[0].Rows.Count > 0 ) { for ( int healthRow = 0; healthRow < dsHealth.Tables[0].Rows.Count; healthRow ++ ) { if ( buildMorningInfoStat.Tables[0].Rows[row][2].ToString().Equals(dsHealth.Tables[0].Rows[healthRow][0].ToString()) ) { buildMorningInfoStat.Tables[0].Rows[row][3] = dsHealth.Tables[0].Rows[healthRow][1].ToString() + " (" +(Convert.ToDouble(dsHealth.Tables[0].Rows[healthRow][1]) /(Convert.ToDouble(dsStuAmount.Tables[0].Rows[0][0])*SetAttendDays())).ToString("0.00%") + ")"; healthNumbersAll += Convert.ToInt32(dsHealth.Tables[0].Rows[healthRow][1]); break; } else { if ( healthRow == dsHealth.Tables[0].Rows.Count - 1 ) buildMorningInfoStat.Tables[0].Rows[row][3] = 0; } } } else buildMorningInfoStat.Tables[0].Rows[row][3] = 0; //观察人数统计 if ( dsWatch.Tables[0].Rows.Count > 0 ) { for ( int watchRow = 0; watchRow < dsWatch.Tables[0].Rows.Count; watchRow ++ ) { if ( buildMorningInfoStat.Tables[0].Rows[row][2].ToString().Equals(dsWatch.Tables[0].Rows[watchRow][0].ToString()) ) { buildMorningInfoStat.Tables[0].Rows[row][4] = dsWatch.Tables[0].Rows[watchRow][1].ToString() + " (" +(Convert.ToDouble(dsWatch.Tables[0].Rows[watchRow][1]) /(Convert.ToDouble(dsStuAmount.Tables[0].Rows[0][0])*SetAttendDays())).ToString("0.00%") + ")"; watchNumbersAll += Convert.ToInt32(dsWatch.Tables[0].Rows[watchRow][1]); break; } else { if ( watchRow == dsWatch.Tables[0].Rows.Count - 1 ) buildMorningInfoStat.Tables[0].Rows[row][4] = 0; } } } else buildMorningInfoStat.Tables[0].Rows[row][4] = 0; //服药人数统计 if ( dsIll.Tables[0].Rows.Count > 0 ) { for ( int illRow = 0; illRow < dsIll.Tables[0].Rows.Count; illRow ++ ) { if ( buildMorningInfoStat.Tables[0].Rows[row][2].ToString().Equals(dsIll.Tables[0].Rows[illRow][0].ToString()) ) { buildMorningInfoStat.Tables[0].Rows[row][5] = dsIll.Tables[0].Rows[illRow][1].ToString() + " (" +(Convert.ToDouble(dsIll.Tables[0].Rows[illRow][1]) /(Convert.ToDouble(dsStuAmount.Tables[0].Rows[0][0])*SetAttendDays())).ToString("0.00%") + ")"; illNumbersAll += Convert.ToInt32(dsIll.Tables[0].Rows[illRow][1]); break; } else { if ( illRow == dsIll.Tables[0].Rows.Count - 1 ) buildMorningInfoStat.Tables[0].Rows[row][5] = 0; } } } else buildMorningInfoStat.Tables[0].Rows[row][5] = 0; //应出勤人数 if ( dsStuAmount.Tables[0].Rows.Count == 0 ) buildMorningInfoStat.Tables[0].Rows[row][6] = 0; else { buildMorningInfoStat.Tables[0].Rows[row][6] = (Convert.ToInt32(dsStuAmount.Tables[0].Rows[0][0])*SetAttendDays()).ToString(); stuAmountAll += Convert.ToInt32(dsStuAmount.Tables[0].Rows[0][0]) * SetAttendDays(); } //缺席人数 if ( dsAbsence.Tables[0].Rows.Count > 0 ) { for ( int absenceRow = 0; absenceRow < dsAbsence.Tables[0].Rows.Count; absenceRow ++ ) { if ( buildMorningInfoStat.Tables[0].Rows[row][2].ToString().Equals(dsAbsence.Tables[0].Rows[absenceRow][0].ToString()) ) { int total = Convert.ToInt32(dsStuAmount.Tables[0].Rows[0][0]) * SetAttendDays(); int health = 0; int ill = 0; int watch = 0; foreach(DataRow dr in dsHealth.Tables[0].Rows) { if (buildMorningInfoStat.Tables[0].Rows[row][2].ToString().Equals(dr[0].ToString())) { health = Convert.ToInt32(dr[1]); } } foreach(DataRow dr in dsIll.Tables[0].Rows) { if (buildMorningInfoStat.Tables[0].Rows[row][2].ToString().Equals(dr[0].ToString())) { ill = Convert.ToInt32(dr[1]); } } foreach(DataRow dr in dsWatch.Tables[0].Rows) { if (buildMorningInfoStat.Tables[0].Rows[row][2].ToString().Equals(dr[0].ToString())) { watch = Convert.ToInt32(dr[1]); } } int absence = total - health - watch - ill; absenceNumbersAll += absence; // double absence = total - // (dsHealth.Tables[0].Rows.Count > 0 ? (dsHealth.Tables[0].Rows[absenceRow][1]) : 0) - // (dsIll.Tables[0].Rows.Count > 0 ? Convert.ToInt32(dsIll.Tables[0].Rows[absenceRow][1]) : 0) - // (dsWatch.Tables[0].Rows.Count > 0 ? Convert.ToInt32(dsWatch.Tables[absenceRow].Rows[0][1]) : 0); buildMorningInfoStat.Tables[0].Rows[row][8] = string.Format("{0} ({1})", absence, ((double)absence / (double)total).ToString("0.00%")); //dsAbsence.Tables[0].Rows[absenceRow][1] = // buildMorningInfoStat.Tables[0].Rows[row][8] = dsAbsence.Tables[0].Rows[absenceRow][1].ToString() // + " (" +(Convert.ToDouble(dsAbsence.Tables[0].Rows[absenceRow][1]) // /(Convert.ToDouble(dsStuAmount.Tables[0].Rows[0][0])*SetAttendDays())).ToString("0.00%") + ")"; break; } else { if ( absenceRow == dsAbsence.Tables[0].Rows.Count - 1) buildMorningInfoStat.Tables[0].Rows[row][8] = 0; } } } else buildMorningInfoStat.Tables[0].Rows[row][8] = 0; //出勤率 if ( dsSum.Tables[0].Rows.Count > 0 ) { for ( int attRow = 0; attRow < dsSum.Tables[0].Rows.Count; attRow ++ ) { if ( buildMorningInfoStat.Tables[0].Rows[row][2].ToString().Equals(dsSum.Tables[0].Rows[attRow][0].ToString()) ) { buildMorningInfoStat.Tables[0].Rows[row][9] = (Convert.ToDouble(dsSum.Tables[0].Rows[attRow][1])/(Convert.ToDouble(dsStuAmount.Tables[0].Rows[0][0])*SetAttendDays())).ToString("0.00%"); buildMorningInfoStat.Tables[0].Rows[row][7] = Convert.ToInt32(dsSum.Tables[0].Rows[attRow][1]); sumNumbersAll += Convert.ToInt32(dsSum.Tables[0].Rows[attRow][1]); break; } else { if ( attRow == dsSum.Tables[0].Rows.Count - 1 ) { buildMorningInfoStat.Tables[0].Rows[row][9] = 0; buildMorningInfoStat.Tables[0].Rows[row][7] = 0; } } } } else { buildMorningInfoStat.Tables[0].Rows[row][9] = 0; buildMorningInfoStat.Tables[0].Rows[row][7] = 0; } //a if ( row == buildMorningInfoStat.Tables[0].Rows.Count - 1 ) { DataRow newRow = buildMorningInfoStat.Tables[0].NewRow(); newRow[1] = "[总计]"; if ( stuAmountAll == 0 ) { newRow[3] = 0; newRow[4] = 0; newRow[5] = 0; newRow[6] = 0; newRow[7] = 0; newRow[8] = 0; newRow[9] = 0; } else { newRow[3] = healthNumbersAll.ToString() + " (" +((double)healthNumbersAll/(double)stuAmountAll).ToString("0.00%") + ")"; newRow[4] = watchNumbersAll.ToString() + " (" +((double)watchNumbersAll/(double)stuAmountAll).ToString("0.00%") + ")"; newRow[5] = illNumbersAll.ToString() + " (" +((double)illNumbersAll/(double)stuAmountAll).ToString("0.00%") + ")"; newRow[6] = stuAmountAll; newRow[7] = sumNumbersAll; newRow[8] = absenceNumbersAll.ToString() + " (" +((double)absenceNumbersAll/(double)stuAmountAll).ToString("0.00%") + ")"; newRow[9] = ((double)sumNumbersAll/(double)stuAmountAll).ToString("0.00%"); } buildMorningInfoStat.Tables[0].Rows.Add(newRow); break; } } return buildMorningInfoStat; } catch(Exception e) { Util.WriteLog(e.Message,Util.EXCEPTION_LOG_TITLE); return null; } } }