private void Search_Daily_Report() { try { double[] total = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // DataTable dt = null; // dt = null; InitGridHeader(); DataTable dt = select_deffect_monitor(UC_MONTH.GetValue()); if (dt != null && dt.Rows.Count > 1) { iNumRow = dt.Rows.Count; dt_Daily_Report = dt; axfpSpread.ClearRange(1, 2, axfpSpread.MaxCols, axfpSpread.MaxRows, true); // axfDailyReport_Header.Visible = false; axfpSpread.Row = dt.Rows.Count + 2; axfpSpread.BackColor = Color.Lime; if (dt_Daily_Report != null && dt_Daily_Report.Rows.Count > 1) { for (int i = 0; i < dt_Daily_Report.Rows.Count; i++) { // string sFormat = "#,###,##0.##"; if (dt_Daily_Report.Rows[i]["remark"].ToString() == "10" || dt_Daily_Report.Rows[i]["remark"].ToString() == "20" || dt_Daily_Report.Rows[i]["remark"].ToString() == "30") { axfpSpread.Row = i + 2; axfpSpread.Col = 4; axfpSpread.TypeHAlign = TypeHAlignConstants.TypeHAlignLeft; } axfpSpread.set_RowHeight(i + 2, 20.5); this.axfpSpread.SetText(1, i + 2, dt_Daily_Report.Rows[i]["LEV"].ToString()); this.axfpSpread.SetText(2, i + 2, dt_Daily_Report.Rows[i]["PROCESS_NM"].ToString().Replace(" ", "\n")); this.axfpSpread.SetText(3, i + 2, dt_Daily_Report.Rows[i]["REASON_HEAD_NM"].ToString()); this.axfpSpread.SetText(4, i + 2, dt_Daily_Report.Rows[i]["REASON_TAIL_NM"].ToString()); this.axfpSpread.SetText(5, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_1"])); this.axfpSpread.SetText(6, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_2"])); this.axfpSpread.SetText(7, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_3"])); this.axfpSpread.SetText(8, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_4"])); this.axfpSpread.SetText(9, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_5"])); this.axfpSpread.SetText(10, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_6"])); this.axfpSpread.SetText(11, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_7"])); this.axfpSpread.SetText(12, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_8"])); this.axfpSpread.SetText(13, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_9"])); this.axfpSpread.SetText(14, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_10"])); this.axfpSpread.SetText(15, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_11"])); this.axfpSpread.SetText(16, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_12"])); this.axfpSpread.SetText(17, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_13"])); this.axfpSpread.SetText(18, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_14"])); this.axfpSpread.SetText(19, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_15"])); this.axfpSpread.SetText(20, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_16"])); this.axfpSpread.SetText(21, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_17"])); this.axfpSpread.SetText(22, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_18"])); this.axfpSpread.SetText(23, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_19"])); this.axfpSpread.SetText(24, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_20"])); this.axfpSpread.SetText(25, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_21"])); this.axfpSpread.SetText(26, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_22"])); this.axfpSpread.SetText(27, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_23"])); this.axfpSpread.SetText(28, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_24"])); this.axfpSpread.SetText(29, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_25"])); this.axfpSpread.SetText(30, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_26"])); this.axfpSpread.SetText(31, i + 2, FormatData(dt_Daily_Report.Rows[i]["DATE_27"])); this.axfpSpread.SetText(32, i + 2, FormatData(dt_Daily_Report.Rows[i]["TOT"])); if (dt_Daily_Report.Rows[i]["REASON_TAIL_CD"].ToString().Substring(0, 3) == "RAT") { for (int j = 3; j < dt_Daily_Report.Columns.Count; j++) { axfpSpread.Col = j; axfpSpread.Row = i + 2; axfpSpread.BackColor = Color.DodgerBlue; } } else if (dt_Daily_Report.Rows[i]["REASON_TAIL_CD"].ToString().Substring(0, 3) == "TOT") { for (int j = 4; j < dt_Daily_Report.Columns.Count; j++) { axfpSpread.Col = j; axfpSpread.Row = i + 2; axfpSpread.BackColor = Color.Yellow; if (j >= 5 && j <= 35) { total[j - 5] += axfpSpread.Text == "" ? 0 : Convert.ToDouble(axfpSpread.Text); } } } else { for (int j = 1; j < dt_Daily_Report.Columns.Count; j++) { axfpSpread.Col = j; axfpSpread.Row = i + 2; axfpSpread.BackColor = Color.White; } } } // axfpSpread.AddCellSpan(1, dt.Rows.Count + 2, 4, 1); axfpSpread.SetText(2, dt.Rows.Count + 2, "Total"); axfpSpread.SetText(4, dt.Rows.Count + 2, "%"); axfpSpread.SetText(5, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_1"].ToString()) == 0 ? "0" : (total[0] / Convert.ToDouble(dt.Rows[0]["DATE_1"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(6, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_2"].ToString()) == 0 ? "0" : (total[1] / Convert.ToDouble(dt.Rows[0]["DATE_2"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(7, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_3"].ToString()) == 0 ? "0" : (total[2] / Convert.ToDouble(dt.Rows[0]["DATE_3"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(8, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_4"].ToString()) == 0 ? "0" : (total[3] / Convert.ToDouble(dt.Rows[0]["DATE_4"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(9, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_5"].ToString()) == 0 ? "0" : (total[4] / Convert.ToDouble(dt.Rows[0]["DATE_5"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(10, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_6"].ToString()) == 0 ? "0" : (total[5] / Convert.ToDouble(dt.Rows[0]["DATE_6"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(11, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_7"].ToString()) == 0 ? "0" : (total[6] / Convert.ToDouble(dt.Rows[0]["DATE_7"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(12, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_8"].ToString()) == 0 ? "0" : (total[7] / Convert.ToDouble(dt.Rows[0]["DATE_8"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(13, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_9"].ToString()) == 0 ? "0" : (total[8] / Convert.ToDouble(dt.Rows[0]["DATE_9"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(14, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_10"].ToString()) == 0 ? "0" : (total[9] / Convert.ToDouble(dt.Rows[0]["DATE_10"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(15, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_11"].ToString()) == 0 ? "0" : (total[10] / Convert.ToDouble(dt.Rows[0]["DATE_11"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(16, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_12"].ToString()) == 0 ? "0" : (total[11] / Convert.ToDouble(dt.Rows[0]["DATE_12"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(17, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_13"].ToString()) == 0 ? "0" : (total[12] / Convert.ToDouble(dt.Rows[0]["DATE_13"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(18, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_14"].ToString()) == 0 ? "0" : (total[13] / Convert.ToDouble(dt.Rows[0]["DATE_14"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(19, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_15"].ToString()) == 0 ? "0" : (total[14] / Convert.ToDouble(dt.Rows[0]["DATE_15"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(20, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_16"].ToString()) == 0 ? "0" : (total[15] / Convert.ToDouble(dt.Rows[0]["DATE_16"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(21, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_17"].ToString()) == 0 ? "0" : (total[16] / Convert.ToDouble(dt.Rows[0]["DATE_17"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(22, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_18"].ToString()) == 0 ? "0" : (total[17] / Convert.ToDouble(dt.Rows[0]["DATE_18"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(23, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_19"].ToString()) == 0 ? "0" : (total[18] / Convert.ToDouble(dt.Rows[0]["DATE_19"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(24, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_20"].ToString()) == 0 ? "0" : (total[19] / Convert.ToDouble(dt.Rows[0]["DATE_20"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(25, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_21"].ToString()) == 0 ? "0" : (total[20] / Convert.ToDouble(dt.Rows[0]["DATE_21"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(26, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_22"].ToString()) == 0 ? "0" : (total[21] / Convert.ToDouble(dt.Rows[0]["DATE_22"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(27, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_23"].ToString()) == 0 ? "0" : (total[22] / Convert.ToDouble(dt.Rows[0]["DATE_23"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(28, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_24"].ToString()) == 0 ? "0" : (total[23] / Convert.ToDouble(dt.Rows[0]["DATE_24"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(29, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_25"].ToString()) == 0 ? "0" : (total[24] / Convert.ToDouble(dt.Rows[0]["DATE_25"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(30, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_26"].ToString()) == 0 ? "0" : (total[25] / Convert.ToDouble(dt.Rows[0]["DATE_26"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(31, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["DATE_27"].ToString()) == 0 ? "0" : (total[26] / Convert.ToDouble(dt.Rows[0]["DATE_27"].ToString()) * 100).ToString("###,##0.00")); axfpSpread.SetText(32, dt.Rows.Count + 2, Convert.ToDouble(dt.Rows[0]["TOT"].ToString()) == 0 ? "0" : (total[27] / Convert.ToDouble(dt.Rows[0]["TOT"].ToString()) * 100).ToString("###,##0.00")); for (int j = 1; j < dt_Daily_Report.Columns.Count; j++) { axfpSpread.Col = j; axfpSpread.Row = dt.Rows.Count + 2; axfpSpread.BackColor = Color.Lime; } int iTmp = dt.Rows.Count + 3; for (int i = 2; i < iTmp; i++) { axfpSpread.set_RowHeight(i, 20.5); } for (int i = dt.Rows.Count + 3; i < axfpSpread.MaxRows + 1; i++) { axfpSpread.set_RowHeight(i, 0); } MergeCol(axfpSpread, 2, 1); MergeCol(axfpSpread, 2, 2); MergeCol(axfpSpread, 2, 3); // axfpSpread.TopRow = dt.Rows.Count - 15; dt = null; dt = select_chart_1(UC_MONTH.GetValue()); if (dt != null & dt.Rows.Count > 0) { createChart(chart1, dt, dt.Rows[0]["title"].ToString()); } //dt = null; //dt = select_chart_2(UC_MONTH.GetValue()); //if (dt != null & dt.Rows.Count > 0) //{ // createChart(chart2, dt, dt.Rows[0]["title"].ToString()); //} //dt = select_chart_3(); //if (dt != null & dt.Rows.Count > 0) //{ // createChart(chart3, dt, dt.Rows[0]["title"].ToString()); //} // showAnimation(axfpSpread); } else { } } else { // axfDailyReport_Header.Visible = true; iNumRow = 0; } } catch (Exception) { } }
private void timer1_Tick(object sender, EventArgs e) { cCount++; lblDate.Text = string.Format(DateTime.Now.ToString("yyyy-MM-dd\nHH:mm:ss")); if (cCount >= 60) { try { this.Cursor = Cursors.WaitCursor; string DATE_FROM = UC_MONTH.GetValue() + "01", DATE_TO = UC_MONTH.GetValue() + DateTime.DaysInMonth(Convert.ToInt32(UC_MONTH.GetValue().Substring(0, 4)), Convert.ToInt32(UC_MONTH.GetValue().Substring(4, 2))).ToString(); loadTopLeft(MGL_I_QSD_DATA_SELECT("CHART1", DATE_FROM, DATE_TO)); bindingDataGrid(DATE_FROM, DATE_TO); BindingChart(); this.Cursor = Cursors.Default; cCount = 0; } catch { this.Cursor = Cursors.Default; cCount = 0; } } }
private void CreateChart() { try { chartBTS.Legends.Clear(); //chartBTS.AppearanceNameSerializable = "Chameleon"; Series series1 = new Series("BTS", ViewType.Bar); chartBTS.AnimationStartMode = DevExpress.XtraCharts.ChartAnimationMode.OnDataChanged; DevExpress.XtraCharts.SideBySideBarSeriesView sideBySideBarSeriesView1 = new DevExpress.XtraCharts.SideBySideBarSeriesView(); DevExpress.XtraCharts.SideBySideBarSeriesLabel sideBySideBarSeriesLabel1 = new DevExpress.XtraCharts.SideBySideBarSeriesLabel(); Series series2 = new Series("Target", ViewType.Line); DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False; sideBySideBarSeriesView1.ColorEach = false; sideBySideBarSeriesView1.Color = System.Drawing.Color.LimeGreen; sideBySideBarSeriesView1.FillStyle.FillMode = DevExpress.XtraCharts.FillMode.Solid; series1.Label.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); series1.Label.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); series1.Label.TextPattern = "{V:#,#.0}" + "%"; series1.View = sideBySideBarSeriesView1; series1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series2.Label.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); series2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; series2.Label.TextPattern = "{V:#,#.0}" + "%"; lineSeriesView1.Color = System.Drawing.Color.LimeGreen; lineSeriesView1.LineMarkerOptions.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(208)))), ((int)(((byte)(80))))); lineSeriesView1.LineStyle.Thickness = 4; series2.View = lineSeriesView1; DataTable dt = SEL_SMT_BTS("C", line, mline, opcd, UC_MONTH.GetValue()); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { series1.Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), dt.Rows[i]["BTS"])); series2.Points.Add(new SeriesPoint(dt.Rows[i]["DAY"].ToString(), dt.Rows[i]["TARGET"])); if (Convert.ToDouble(dt.Rows[i]["BTS"]) < Convert.ToDouble(dt.Rows[i]["TARGET"]) && Convert.ToDouble(dt.Rows[i]["BTS"]) >= Convert.ToDouble(dt.Rows[i]["TARGET"]) - 5) { series1.Points[i].Color = Color.Yellow; } else if (Convert.ToDouble(dt.Rows[i]["BTS"]) < Convert.ToDouble(dt.Rows[i]["TARGET"]) - 5) { series1.Points[i].Color = Color.Red; } else { series1.Points[i].Color = System.Drawing.Color.LimeGreen; } } chartBTS.SeriesSerializable = new DevExpress.XtraCharts.Series[] { series1, series2 }; ((XYDiagram)chartBTS.Diagram).AxisX.Label.Font = new System.Drawing.Font("Tahoma", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)chartBTS.Diagram).AxisX.Title.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); ((XYDiagram)chartBTS.Diagram).AxisY.Label.TextPattern = "{V:#,#}"; ((XYDiagram)chartBTS.Diagram).AxisY.Label.Font = new System.Drawing.Font("Tahoma", 13F); ((XYDiagram)chartBTS.Diagram).AxisY.Title.Font = new System.Drawing.Font("Calibri", 22F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); ((XYDiagram)chartBTS.Diagram).AxisY.Title.Text = "BTS (%)"; ((XYDiagram)chartBTS.Diagram).AxisY.Title.TextColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); DevExpress.XtraCharts.Legend legend1 = new DevExpress.XtraCharts.Legend(); DevExpress.XtraCharts.CustomLegendItem customLegendItem1 = new DevExpress.XtraCharts.CustomLegendItem(); DevExpress.XtraCharts.CustomLegendItem customLegendItem2 = new DevExpress.XtraCharts.CustomLegendItem(); DevExpress.XtraCharts.CustomLegendItem customLegendItem3 = new DevExpress.XtraCharts.CustomLegendItem(); customLegendItem1.MarkerColor = System.Drawing.Color.LimeGreen; customLegendItem1.Name = "GREEN"; customLegendItem1.Text = ">=" + dt.Rows[0]["TARGET"].ToString() + "%"; customLegendItem2.MarkerColor = System.Drawing.Color.Yellow; customLegendItem2.Name = "YELLOW"; customLegendItem2.Text = ">=" + (Convert.ToDouble(dt.Rows[0]["TARGET"].ToString()) - 5).ToString() + "% and <" + dt.Rows[0]["TARGET"].ToString() + "%"; customLegendItem3.MarkerColor = System.Drawing.Color.Red; customLegendItem3.Name = "RED"; customLegendItem3.Text = "<" + (Convert.ToDouble(dt.Rows[0]["TARGET"].ToString()) - 5).ToString() + "%"; legend1.CustomItems.AddRange(new DevExpress.XtraCharts.CustomLegendItem[] { customLegendItem1, customLegendItem2, customLegendItem3 }); legend1.AlignmentHorizontal = DevExpress.XtraCharts.LegendAlignmentHorizontal.Right; legend1.AlignmentVertical = DevExpress.XtraCharts.LegendAlignmentVertical.TopOutside; legend1.Direction = DevExpress.XtraCharts.LegendDirection.LeftToRight; legend1.Font = new System.Drawing.Font("Tahoma", 12F); legend1.Name = "Legend1"; this.chartBTS.Legends.AddRange(new DevExpress.XtraCharts.Legend[] { legend1 }); } } catch (Exception EX) { } }
private void UC_MONTH_ValueChangeEvent(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; string DATE_FROM = UC_MONTH.GetValue() + "01", DATE_TO = UC_MONTH.GetValue() + DateTime.DaysInMonth(Convert.ToInt32(UC_MONTH.GetValue().Substring(0, 4)), Convert.ToInt32(UC_MONTH.GetValue().Substring(4, 2))).ToString(); loadTopLeft(MGL_I_QSD_DATA_SELECT("CHART1", DATE_FROM, DATE_TO)); bindingDataGrid(DATE_FROM, DATE_TO); BindingChart(); this.Cursor = Cursors.Default; } catch { this.Cursor = Cursors.Default; } }