Exemple #1
0
        private void load_data()
        {
            System.Data.DataSet ds = LOAD_DATA_v2(_wh_cd, _mline_cd, UC_MONTH.GetValue());
            axGrid.Hide();
            load_data_grid(ds.Tables[0]);
            AnimateWindow(axGrid.Handle, 300, AW_SLIDE | 0X4);
            axGrid.Show();
            //pn_body.Visible = true;

            switch (Lang)
            {
            case "Vn":
                CreateChartLine(Chart1, ds.Tables[1], "Cắt");
                CreateChartLine(Chart2, ds.Tables[3], "May 1");
                CreateChartLine(Chart3, ds.Tables[5], "May 2");
                CreateChartLine(Chart4, ds.Tables[2], "Chuẩn bị");
                CreateChartLine(Chart5, ds.Tables[4], "Lắp ráp");
                break;

            case "En":
                CreateChartLine(Chart1, ds.Tables[1], "Cutting");
                CreateChartLine(Chart2, ds.Tables[3], "Stitching 1");
                CreateChartLine(Chart3, ds.Tables[5], "Stitching 2");
                CreateChartLine(Chart4, ds.Tables[2], "Stockfit");
                CreateChartLine(Chart5, ds.Tables[4], "Assembly");
                break;
            }



            BindingPOD(ds.Tables[6]);
        }
        private void InitGridHeader()
        {
            for (int i = 5; i <= 31; i++)
            {
                this.axfpSpread.SetText(i, 1, "DATE_" + (i - 4).ToString());
            }
            DataTable dt = null;

            dt = select_work_date(UC_MONTH.GetValue());
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    this.axfpSpread.SetText(i + 5, 1, dt.Rows[i]["THEDATE"].ToString());
                }

                axfpSpread.LeftCol = dt.Rows.Count - 1;
            }
            for (int i = 5; i <= 31; i++)
            {
                string sHeader = "";
                axfpSpread.Col = i;
                axfpSpread.Row = 1;
                sHeader        = axfpSpread.Value.ToString();
                if (sHeader.Contains("DATE_"))
                {
                    axfpSpread.set_ColWidth(i, 0);
                }
                else
                {
                    axfpSpread.set_ColWidth(i, 10.37);
                }
            }
        }
Exemple #3
0
 private void load_data()
 {
     try
     {
         load_head();
         DataTable dt = SEL_SMT_BTS("Q", line, mline, opcd, UC_MONTH.GetValue());
         if (dt != null && dt.Rows.Count > 0)
         {
             axfpSpread.MaxRows = dt.Rows.Count + 2;
             ClearGrid(axfpSpread);
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 for (int j = 1; j < dt.Columns.Count; j++)
                 {
                     axfpSpread.SetText(j + 1, i + 3, dt.Rows[i][j].ToString() == "" ? "" : dt.Rows[i][j].ToString());
                     //axfpSpread.SetText(j, i + 3, "2,999");
                 }
             }
         }
         CreateChart();
     }
     catch
     {
     }
 }
Exemple #4
0
        private void gvwBase_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            try
            {
                if (e.Column.ColumnHandle < 2 || e.Clicks <= 1)
                {
                    return;
                }
                DataTable dtF   = new DataTable();
                string    DateF = string.Concat(UC_MONTH.GetValue(), dtf.Columns[e.Column.ColumnHandle].ColumnName.ToString().Replace("'", ""));
                string    DateT = string.Concat(UC_MONTH.GetValue(), dtf.Columns[e.Column.ColumnHandle].ColumnName.ToString().Replace("'", ""));
                if (e.RowHandle == gvwBase.RowCount - 2 && e.Column.ColumnHandle != 2)
                {
                    dtF = MGL_I_QSD_DATA_SELECT("POPUP1", DateF, DateT);
                    Popup.FRM_SMT_INTERNAL_POPUP_1 POPUP_1 = new Popup.FRM_SMT_INTERNAL_POPUP_1(dtF);
                    POPUP_1.ShowDialog();
                }

                if (e.RowHandle == gvwBase.RowCount - 1 && e.Column.ColumnHandle != 2)
                {
                    dtF = MGL_I_QSD_DATA_SELECT("POPUP2", DateF, DateT);
                    Popup.FRM_SMT_INTERNAL_POPUP_2 POPUP_2 = new Popup.FRM_SMT_INTERNAL_POPUP_2(dtF);
                    POPUP_2.ShowDialog();
                }
            }
            catch { }
        }
Exemple #5
0
        private void BindingDataChart()
        {
            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_E_QSD_DATA_SELECT("CHART1", DATE_FROM, DATE_TO));
            bindingDataGrid(DATE_FROM, DATE_TO);
        }
 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(SEL_DATA_OSD("CHART1", DATE_FROM, DATE_TO));
         bindingDataGrid(DATE_FROM, DATE_TO);
         this.Cursor = Cursors.Default;
     }
     catch { this.Cursor = Cursors.Default; }
 }
Exemple #7
0
        private void axfpOSD_ClickEvent(object sender, AxFPSpreadADO._DSpreadEvents_ClickEvent e)
        {
            string sCellValue = "";

            axfpOSD.Row = 1;
            axfpOSD.Col = e.col;
            sCellValue  = axfpOSD.Value.ToString();

            string date = UC_MONTH.GetValue() + sCellValue;

            //MessageBox.Show(date);
            this.TopMost = false;
            FRM_EXTERNAL_OSND_POP frm_pop = new FRM_EXTERNAL_OSND_POP(line, Mline, date, date);

            frm_pop.ShowDialog();
            frm_pop.TopMost = true;
        }
        private void axfpOSD_ClickEvent(object sender, AxFPSpreadADO._DSpreadEvents_ClickEvent e)
        {
            string sCellValue = "";

            axfpOSD.Row = 1;
            axfpOSD.Col = e.col;
            sCellValue  = axfpOSD.Value.ToString();

            string date = UC_MONTH.GetValue() + sCellValue;
            //MessageBox.Show(date);
            //this.TopMost = false;
            DataTable dt = SP_SMT_OSD_DETAIL(line, Mline, date, date, "", "Y");

            Popup.FRM_SMT_EXTERNAL_POPUP_1 frm_pop = new Popup.FRM_SMT_EXTERNAL_POPUP_1(dt);
            // FRM_EXTERNAL_OSND_POP frm_pop = new FRM_EXTERNAL_OSND_POP(line, Mline, date, date);
            frm_pop.ShowDialog();
            // frm_pop.TopMost = true;
        }
Exemple #9
0
        private void BindingOSDDaily()
        {
            try
            {
                DataTable dt = SP_SMT_OSD_DAILY("DAILY", line, Mline, UC_MONTH.GetValue());
                chartOSDDaily.DataSource = dt;

                Animation(axfpOSD, dt);
                //BindingGrid(dt);

                chartOSDDaily.Series[0].ArgumentDataMember = "OSD_YMD";
                chartOSDDaily.Series[0].ValueDataMembers.AddRange(new string[] { "OS" });
                chartOSDDaily.Series[0].ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative;
            }
            catch (Exception ex)
            {
            }
        }
Exemple #10
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     cCount++;
     lblDate.Text = string.Format(DateTime.Now.ToString("yyyy-MM-dd\nHH:mm:ss"));
     if (cCount >= 40)
     {
         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(SEL_DATA_OSD("CHART1", DATE_FROM, DATE_TO)); bindingDataGrid(DATE_FROM, DATE_TO);
             BindingChart();
             this.Cursor = Cursors.Default;
             cCount      = 0;
         }
         catch { this.Cursor = Cursors.Default; cCount = 0; }
     }
 }
Exemple #11
0
 private void load_head()
 {
     try
     {
         DataTable dt = SEL_SMT_MON_PROD_STATUS("H", line, mline, UC_MONTH.GetValue());
         int       i;
         if (dt != null && dt.Rows.Count > 0)
         {
             axfpSpread.SetText(1, 1, dt.Rows[0]["MON"].ToString());
             axfpSpread.set_ColWidth(1, 16.5);
             //  axfpSpread.set_ColWidth(2, 226);
             for (i = 0; i < dt.Rows.Count; i++)
             {
                 if (dt.Rows[i]["CUR"].ToString() == "1")
                 {
                     axfpSpread.Row       = 1;
                     axfpSpread.Col       = i + 2;
                     axfpSpread.BackColor = Color.Salmon;
                     axfpSpread.Row       = 2;
                     axfpSpread.Col       = i + 2;
                     axfpSpread.BackColor = Color.Salmon;
                 }
                 axfpSpread.AddCellSpan(i + 2, 1, 1, 1);
                 axfpSpread.SetText(i + 2, 1, dt.Rows[i]["DAY"].ToString());
                 axfpSpread.SetText(i + 2, 2, dt.Rows[i]["DAY1"].ToString());
                 axfpSpread.set_ColWidth(i + 2, (double)221 / (double)(dt.Rows.Count));
                 //axfpSpread.set_ColWidth(i + 2, 240 / 27 + 0.3);
                 //axfpSpread.set_ColWidth(i + 2, (axfpSpread.Width-axfpSpread.get_ColWidth(1))/dt.Rows.Count);
             }
             axfpSpread.set_ColWidth(1, 16.3 + 220 - axfpSpread.get_ColWidth(i + 1) * dt.Rows.Count);
             axfpSpread.AddCellSpan(dt.Rows.Count + 1, 1, 1, 2);
             axfpSpread.AddCellSpan(dt.Rows.Count, 1, 1, 2);
             axfpSpread.AddCellSpan(dt.Rows.Count - 1, 1, 1, 2);
             //axfpSpread.set_ColWidth(1, 16.4 + 0.1 * 25 / dt.Rows.Count );
             for (int j = i + 2; j <= axfpSpread.MaxCols; j++)
             {
                 axfpSpread.set_ColWidth(j, 0);
             }
         }
     }
     catch
     {
     }
 }
Exemple #12
0
 private void BindingChart()
 {
     try
     {
         string    DATE_FROM = UC_MONTH.GetValue();
         DataTable dt        = MGL_I_QSD_DATA_SELECT("CHART2", DATE_FROM, DATE_FROM);
         chartNosew.DataSource    = null;
         chartHF.DataSource       = null;
         chartPrinting.DataSource = null;
         chartCutting.DataSource  = null;
         chartEmbroi.DataSource   = null;
         chartTotal.DataSource    = null;
         InitDataChart("UPN", chartNosew, dt);
         InitDataChart("UPF", chartHF, dt);
         InitDataChart("UPP", chartPrinting, dt);
         InitDataChart("UPC", chartCutting, dt);
         InitDataChart("UPE", chartEmbroi, dt);
         InitDataChart("TOT", chartTotal, dt);
     }
     catch { }
 }
Exemple #13
0
 private void BindingChart()
 {
     try
     {
         string    DATE_FROM = UC_MONTH.GetValue();
         DataTable dt        = SEL_DATA_OSD("CHART2", DATE_FROM, DATE_FROM);
         chartCutting.DataSource = null;
         chartNosew.DataSource   = null;
         chartHF.DataSource      = null;
         chartStit.DataSource    = null;
         chartStock.DataSource   = null;
         chartTotal.DataSource   = null;
         InitDataChart("UPC", chartCutting, dt);
         InitDataChart("UPN", chartNosew, dt);
         InitDataChart("UPF", chartHF, dt);
         InitDataChart("UPS", chartStit, dt);
         InitDataChart("FSS", chartStock, dt);
         InitDataChart("TOT", chartTotal, dt);
     }
     catch { }
 }
Exemple #14
0
 private void BindingChart()
 {
     try
     {
         string    DATE_FROM = UC_MONTH.GetValue();
         DataTable dt        = SEL_DATA_OSD(Mline + "M", DATE_FROM, DATE_FROM);
         chartNosew.DataSource    = null;
         chartHF.DataSource       = null;
         chartPrinting.DataSource = null;
         chartLaser.DataSource    = null;
         chartEmbroi.DataSource   = null;
         chartTotal.DataSource    = null;
         InitDataChart("UPN", chartNosew, dt);
         InitDataChart("UPF", chartHF, dt);
         InitDataChart("UPP", chartPrinting, dt);
         InitDataChart("UPR", chartLaser, dt);
         InitDataChart("UPE", chartEmbroi, dt);
         InitDataChart("TOT", chartTotal, dt);
     }
     catch { }
 }
Exemple #15
0
 private void load_head()
 {
     try
     {
         DataTable dt = SEL_SMT_BTS("H", line, mline, opcd, UC_MONTH.GetValue());
         int       i;
         if (dt != null && dt.Rows.Count > 0)
         {
             axfpSpread.SetText(1, 1, dt.Rows[0]["MON"].ToString());
             axfpSpread.set_ColWidth(1, 16.7);
             for (i = 0; i < dt.Rows.Count; i++)
             {
                 if (dt.Rows[i]["CUR"].ToString() == "1")
                 {
                     axfpSpread.Row       = 1;
                     axfpSpread.Col       = i + 2;
                     axfpSpread.BackColor = Color.Salmon;
                     axfpSpread.Row       = 2;
                     axfpSpread.Col       = i + 2;
                     axfpSpread.BackColor = Color.Salmon;
                 }
                 axfpSpread.SetText(i + 2, 1, dt.Rows[i]["DAY"].ToString());
                 axfpSpread.SetText(i + 2, 2, dt.Rows[i]["DAY1"].ToString());
                 axfpSpread.set_ColWidth(i + 2, (double)221 / (double)(dt.Rows.Count));
             }
             axfpSpread.set_ColWidth(1, 16.6 + 220 - axfpSpread.get_ColWidth(i + 1) * dt.Rows.Count);
             for (int j = i + 2; j <= axfpSpread.MaxCols; j++)
             {
                 axfpSpread.set_ColWidth(j, 0);
             }
         }
     }
     catch
     {
     }
 }
Exemple #16
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 BindingOSDWeekly(string Comp_Name)
        {
            try
            {
                switch (Comp_Name)
                {
                case "IN":
                    chartIN.DataSource = SP_SMT_OSD_DAILY(Comp_Name, line, Mline, UC_MONTH.GetValue());
                    chartIN.Series[0].ArgumentDataMember = "STYLE_NAME";
                    chartIN.Series[0].ValueDataMembers.AddRange(new string[] { "QTY" });
                    chartIN.Series[0].ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative;

                    chartIN.Series[1].ArgumentDataMember = "STYLE_NAME";
                    chartIN.Series[1].ValueDataMembers.AddRange(new string[] { "PER" });
                    chartIN.Series[1].ArgumentScaleType            = DevExpress.XtraCharts.ScaleType.Qualitative;
                    ((XYDiagram)chartIN.Diagram).AxisX.Label.Angle = -35;

                    break;

                case "IP":
                    chartIPPH.DataSource = SP_SMT_OSD_DAILY(Comp_Name, line, Mline, UC_MONTH.GetValue());
                    chartIPPH.Series[0].ArgumentDataMember = "STYLE_NAME";
                    chartIPPH.Series[0].ValueDataMembers.AddRange(new string[] { "QTY" });
                    chartIPPH.Series[0].ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative;

                    chartIPPH.Series[1].ArgumentDataMember = "STYLE_NAME";
                    chartIPPH.Series[1].ValueDataMembers.AddRange(new string[] { "PER" });
                    chartIPPH.Series[1].ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative;

                    ((XYDiagram)chartIPPH.Diagram).AxisX.Label.Angle = -35;
                    break;

                case "PH":
                    chartPH.DataSource = SP_SMT_OSD_DAILY(Comp_Name, line, Mline, UC_MONTH.GetValue());
                    chartPH.Series[0].ArgumentDataMember = "STYLE_NAME";
                    chartPH.Series[0].ValueDataMembers.AddRange(new string[] { "QTY" });
                    chartPH.Series[0].ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative;

                    chartPH.Series[1].ArgumentDataMember = "STYLE_NAME";
                    chartPH.Series[1].ValueDataMembers.AddRange(new string[] { "PER" });
                    chartPH.Series[1].ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative;

                    ((XYDiagram)chartPH.Diagram).AxisX.Label.Angle = -35;
                    break;

                case "DMP":
                    chartDMPPU.DataSource = SP_SMT_OSD_DAILY(Comp_Name, line, Mline, UC_MONTH.GetValue());
                    chartDMPPU.Series[0].ArgumentDataMember = "STYLE_NAME";
                    chartDMPPU.Series[0].ValueDataMembers.AddRange(new string[] { "QTY" });
                    chartDMPPU.Series[0].ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative;

                    chartDMPPU.Series[1].ArgumentDataMember = "STYLE_NAME";
                    chartDMPPU.Series[1].ValueDataMembers.AddRange(new string[] { "PER" });
                    chartDMPPU.Series[1].ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative;

                    ((XYDiagram)chartDMPPU.Diagram).AxisX.Label.Angle = -35;
                    break;

                case "PU":
                    chartPU.DataSource = SP_SMT_OSD_DAILY(Comp_Name, line, Mline, UC_MONTH.GetValue());
                    chartPU.Series[0].ArgumentDataMember = "STYLE_NAME";
                    chartPU.Series[0].ValueDataMembers.AddRange(new string[] { "QTY" });
                    chartPU.Series[0].ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative;

                    chartPU.Series[1].ArgumentDataMember = "STYLE_NAME";
                    chartPU.Series[1].ValueDataMembers.AddRange(new string[] { "PER" });
                    chartPU.Series[1].ArgumentScaleType            = DevExpress.XtraCharts.ScaleType.Qualitative;
                    ((XYDiagram)chartPU.Diagram).AxisX.Label.Angle = -35;
                    break;

                case "OS":
                    chartOS.DataSource = SP_SMT_OSD_DAILY(Comp_Name, line, Mline, UC_MONTH.GetValue());
                    chartOS.Series[0].ArgumentDataMember = "STYLE_NAME";
                    chartOS.Series[0].ValueDataMembers.AddRange(new string[] { "QTY" });
                    chartOS.Series[0].ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative;

                    chartOS.Series[1].ArgumentDataMember = "STYLE_NAME";
                    chartOS.Series[1].ValueDataMembers.AddRange(new string[] { "PER" });
                    chartOS.Series[1].ArgumentScaleType            = DevExpress.XtraCharts.ScaleType.Qualitative;
                    ((XYDiagram)chartOS.Diagram).AxisX.Label.Angle = -35;
                    break;
                }
            }
            catch
            { }
        }
Exemple #18
0
        private void load_data()
        {
            try
            {
                //axfpSpread.Hide();
                load_head();
                DataTable dt       = SEL_SMT_MON_PROD_STATUS("Q", line, mline, UC_MONTH.GetValue());
                DataTable dt_chart = SEL_SMT_MON_PROD_STATUS("C", line, mline, UC_MONTH.GetValue());
                DataTable dt1      = SEL_SMT_MON_PROD_STATUS("C1", line, mline, UC_MONTH.GetValue());
                if (dt != null && dt.Rows.Count > 0)
                {
                    axfpSpread.MaxRows = dt.Rows.Count + 2;
                    ClearGrid(axfpSpread);
                    //axfpSpread.SetCellBorder(1, 1, axfpSpread.MaxCols, axfpSpread.MaxRows, FPSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                    //axfpSpread.SetCellBorder(1, 1, axfpSpread.MaxCols, axfpSpread.MaxRows, FPSpreadADO.CellBorderIndexConstants.CellBorderIndexTop, 0, FPSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                    //axfpSpread.SetCellBorder(1, 1, axfpSpread.MaxCols, axfpSpread.MaxRows, FPSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                    //axfpSpread.SetCellBorder(1, 1, axfpSpread.MaxCols, axfpSpread.MaxRows, FPSpreadADO.CellBorderIndexConstants.CellBorderIndexRight, 0, FPSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        for (int j = 2; j < dt.Columns.Count; j++)
                        {
                            if (dt.Columns[j].ColumnName.Replace("'", "") == "RATE")
                            {
                                axfpSpread.SetText(j, i + 3, dt.Rows[i][j].ToString().Trim() == "" ? "" : Convert.ToDouble(dt.Rows[i][j].ToString()).ToString() + "%");
                            }
                            else
                            {
                                axfpSpread.SetText(j, i + 3, dt.Rows[i][j].ToString().Trim() == "" ? "" : Convert.ToDouble(dt.Rows[i][j].ToString()).ToString("###,###,###"));
                            }
                            //axfpSpread.SetText(j, i + 3, "2,999");
                            if (j == dt.Columns.Count - 1)
                            {
                                axfpSpread.Row = i + 3;
                                axfpSpread.Col = j;
                                if (GetText(axfpSpread, j, i + 3) != "")
                                {
                                    if (Convert.ToDouble(GetText(axfpSpread, j, i + 3).Replace("%", "").Trim()) < 95)
                                    {
                                        axfpSpread.BackColor = Color.Red;
                                        axfpSpread.ForeColor = Color.White;
                                    }
                                    else if (Convert.ToDouble(GetText(axfpSpread, j, i + 3).Replace("%", "").Trim()) > 98)
                                    {
                                        axfpSpread.BackColor = Color.Green;
                                        axfpSpread.ForeColor = Color.White;
                                    }
                                    else
                                    {
                                        axfpSpread.BackColor = Color.Yellow;
                                        axfpSpread.ForeColor = Color.Black;
                                    }
                                }
                            }
                        }
                    }
                }
                bindingdatachart(chartControl1, dt_chart, "UPC_QTY", "UPC_TAR");
                bindingdatachart(chartControl2, dt_chart, "UPS1_QTY", "UPS1_TAR");
                bindingdatachart(chartControl3, dt_chart, "UPS2_QTY", "UPS2_TAR");
                bindingdatachart(chartControl4, dt_chart, "FSS_QTY", "FSS_TAR");
                bindingdatachart(chartControl5, dt_chart, "FGA_QTY", "FGA_TAR");
                //if (dt1 != null && dt1.Rows.Count > 0)
                //{
                //    BindingGauges(circularGauge, Convert.ToDouble(dt1.Rows[0]["RATE"]), Convert.ToInt32(dt1.Rows[0]["V_MIN"]), Convert.ToInt32(dt1.Rows[0]["V_MAX"]), Convert.ToInt32(dt1.Rows[0]["R_MIN"]), Convert.ToInt32(dt1.Rows[0]["R_MAX"]));
                //    lblR.Text = "<" + dt1.Rows[0]["R_MIN"].ToString() + "%";
                //    lblY.Text = ">=" + dt1.Rows[0]["R_MIN"].ToString() + "% && <=" + dt1.Rows[0]["R_MAX"].ToString() + "%";
                //    lblG.Text = ">" + dt1.Rows[0]["R_MAX"].ToString() + "%";
                //    lblRPlan.Text = "R.Plan: " + Convert.ToDouble(dt1.Rows[0]["RPLAN"]).ToString("#,#") + "Prs";
                //    lblProd.Text = "Prod: " + Convert.ToDouble(dt1.Rows[0]["PROD"]).ToString("#,#") + "Prs";
                //    lblRate.Text = "Rate: " + Convert.ToDouble(dt1.Rows[0]["RATE"]).ToString("#,#.0") + "%";
                //    labelRate.Text = Convert.ToDouble(dt1.Rows[0]["RATE"]).ToString("#,0.0") + "%";
                //}
                int i_min = 0, i_max = 100;
                if (dt != null && dt.Rows.Count > 0)
                {
                    if (GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim() != "")
                    {
                        if (Convert.ToDouble(GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim()) > 90 && Convert.ToDouble(GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim()) < 100)
                        {
                            i_min = 90;
                            i_max = 100;
                        }
                        else if (Convert.ToDouble(GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim()) < 90)
                        {
                            i_min = 90 - 3;
                            i_max = 100;
                        }
                        else if (Convert.ToDouble(GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim()) > 100)
                        {
                            i_min = 90;
                            i_max = 100 + 3;
                        }
                        else if (Convert.ToDouble(GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim()) == 0)
                        {
                            i_min = 0;
                            i_max = 100;
                        }
                        BindingGauges(circularGauge, Convert.ToDouble(GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim()), i_min, i_max, 95, 98);
                        labelRate.Text = Convert.ToDouble(GetText(axfpSpread, dt.Columns.Count - 1, axfpSpread.MaxRows).Replace("%", "").Trim()) + "%";
                    }
                }
                else
                {
                    BindingGauges(circularGauge, 0, 0, 100, 95, 98);
                    labelRate.Text = "0%";
                }

                //axfpSpread.Show();
            }
            catch (Exception ex)
            {
            }
        }
        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(UC_MONTH.GetValue());
                        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 InitGridHeader()
        {
            axfpSpread.MaxRows = 1;
            axfpSpread.MaxRows = 50;
            axfpSpread.Font    = new System.Drawing.Font("Calibri", 16.00F, System.Drawing.FontStyle.Bold);
            for (int i = 5; i <= 31; i++)
            {
                axfpSpread.Row        = -1;
                axfpSpread.Col        = i;
                axfpSpread.TypeHAlign = TypeHAlignConstants.TypeHAlignRight;

                axfpSpread.Row        = 1;
                axfpSpread.TypeHAlign = TypeHAlignConstants.TypeHAlignCenter;
                axfpSpread.TypeVAlign = TypeVAlignConstants.TypeVAlignCenter;
                this.axfpSpread.SetText(i, 1, "DATE_" + (i - 4).ToString());
            }

            DataTable dt = null;

            dt = select_work_date(UC_MONTH.GetValue());
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    this.axfpSpread.SetText(i + 5, 1, dt.Rows[i]["THEDATE"].ToString());
                }

                axfpSpread.LeftCol = dt.Rows.Count - 1;
            }
            for (int i = 5; i <= 31; i++)
            {
                string sHeader = "";
                axfpSpread.Col = i;
                axfpSpread.Row = 1;
                sHeader        = axfpSpread.Value.ToString();
                if (sHeader.Contains("DATE_"))
                {
                    axfpSpread.set_ColWidth(i, 0);
                }
                else
                {
                    axfpSpread.set_ColWidth(i, 10.37);
                }
            }

            axfpSpread.Row        = -1;
            axfpSpread.Col        = axfpSpread.MaxCols;
            axfpSpread.TypeHAlign = TypeHAlignConstants.TypeHAlignRight;

            axfpSpread.Row        = 1;
            axfpSpread.TypeHAlign = TypeHAlignConstants.TypeHAlignCenter;
            axfpSpread.TypeVAlign = TypeVAlignConstants.TypeVAlignCenter;

            axfpSpread.TypeHAlign = TypeHAlignConstants.TypeHAlignRight;


            //for (int i = 2; i < axfpSpread.MaxRows; i++)
            //{
            //    axfpSpread.set_RowHeight(i, 20.5);
            //    axfpSpread.Row = i;
            //    axfpSpread.BackColor = Color.White;
            //}
        }
Exemple #21
0
        private void CreateChart()
        {
            try
            {
                //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, 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)))));
                }
            }
            catch (Exception)
            {
            }
        }