private void setDefaultGrid(AxFPUSpreadADO.AxfpSpread arg_grid)
        {
            // Set Default Grid
            arg_grid.Visible = false;

            arg_grid.Reset();
            arg_grid.BorderStyle              = FPUSpreadADO.BorderStyleConstants.BorderStyleNone;
            arg_grid.DisplayColHeaders        = false;
            arg_grid.DisplayRowHeaders        = false;
            arg_grid.ActiveCellHighlightStyle = FPUSpreadADO.ActiveCellHighlightStyleConstants.ActiveCellHighlightStyleOff;
            arg_grid.GrayAreaBackColor        = Color.White;
            // arg_grid.ScrollBarExtMode = true;
            arg_grid.ColHeaderRows = 0;
            arg_grid.ScrollBars    = FPUSpreadADO.ScrollBarsConstants.ScrollBarsHorizontal;
            arg_grid.Font          = new System.Drawing.Font("Calibri", 11);
            arg_grid.set_RowHeight(1, 0.5);
            arg_grid.set_ColWidth(1, 0.5);
            arg_grid.TypeHAlign        = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter;
            arg_grid.TypeVAlign        = FPUSpreadADO.TypeVAlignConstants.TypeVAlignCenter;
            arg_grid.TypeEditMultiLine = true;
            arg_grid.SetCellBorder(1, 1, 150, arg_grid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank);
            arg_grid.SetCellBorder(1, 1, 150, arg_grid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank);

            for (int ic = 2; ic <= 150; ic++)
            {
                arg_grid.set_ColWidth(ic, 4.2);
            }
        }
示例#2
0
        private void Display_Grid(AxFPUSpreadADO.AxfpSpread _axfpSpread, DataTable _dt)
        {
            _axfpSpread.AddCellSpan(2, 1, _dt.Columns.Count - 1, 1);
            _axfpSpread.SetText(2, 1, DateTime.ParseExact(_dt.Columns[1].Caption.ToString().Substring(1, 8), "yyyyMMdd", CultureInfo.InvariantCulture).ToString("MMMM", CultureInfo.InvariantCulture));
            for (int iRow = 0; iRow < _dt.Rows.Count; iRow++)
            {
                int    iNumber = 0;
                double dTotal  = 0;
                double d       = Math.Round((232.125 - 17.12 - 9.5) / (_dt.Columns.Count - 1), 2);
                for (int iCol = 1; iCol < _dt.Columns.Count; iCol++)
                {
                    _axfpSpread.set_ColWidth(iCol + 1, d);
                    if (iRow == 0)
                    {
                        _axfpSpread.SetText(iCol + 1, iRow + 2, _dt.Columns[iCol].Caption.ToString().Substring(7, 2));
                    }

                    if (_dt.Rows[iRow][iCol].ToString() != "" && _dt.Rows[iRow][iCol].ToString() != "0")
                    {
                        _axfpSpread.SetText(iCol + 1, iRow + 3, _dt.Rows[iRow][iCol].ToString());
                        dTotal += Convert.ToDouble(_dt.Rows[iRow][iCol].ToString());
                        iNumber++;
                    }
                }
                if (iRow == 0)
                {
                    double dd = 232.125 - 17.12 - (_dt.Columns.Count - 1) * (_axfpSpread.get_ColWidth(_dt.Columns.Count));
                    _axfpSpread.AddCellSpan(_dt.Columns.Count + 1, iRow + 1, 1, 2);
                    _axfpSpread.SetText(_dt.Columns.Count + 1, iRow + 1, "Avg");
                    _axfpSpread.Row       = iRow + 1;
                    _axfpSpread.Col       = _dt.Columns.Count + 1;
                    _axfpSpread.BackColor = Color.Orange;
                    _axfpSpread.ForeColor = Color.White;
                    _axfpSpread.set_ColWidth(_dt.Columns.Count + 1, dd);
                }
                if (iNumber != 0)
                {
                    _axfpSpread.SetText(_dt.Columns.Count + 1, iRow + 3, Math.Round(dTotal / iNumber, 1));
                }
                else
                {
                    _axfpSpread.SetText(_dt.Columns.Count + 1, iRow + 3, 0);
                }

                for (int iCol = _dt.Columns.Count + 2; iCol <= _axfpSpread.MaxCols; iCol++)
                {
                    _axfpSpread.set_ColWidth(iCol, 0);
                }
            }
        }
示例#3
0
        private void GridRightHead(int arg_col, AxFPUSpreadADO.AxfpSpread arg_grid)
        {
            string[] str = { "Model", "Plan", "Input" };
            double[] w   = { 21.5, 10, 10 };
            arg_grid.Col        = arg_col;
            arg_grid.Row        = -1;
            arg_grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignLeft;
            for (int i = 0; i < str.Length; i++)
            {
                if (i > 0)
                {
                    arg_grid.Col        = arg_col + i;
                    arg_grid.Row        = -1;
                    arg_grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignRight;
                }

                arg_grid.Col        = arg_col + i;
                arg_grid.Row        = 1;
                arg_grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter;
                arg_grid.Text       = str[i];
                arg_grid.BackColor  = Color.Yellow;
                arg_grid.FontSize   = 14;
                arg_grid.set_ColWidth(arg_col + i, w[i]);
            }
        }
示例#4
0
        private void DisplayGrid(DataTable arg_dt, AxFPUSpreadADO.AxfpSpread arg_grid)
        {
            try
            {
                set_qty_actual();
                arg_grid.MaxRows = 1;
                if (arg_dt == null || arg_dt.Rows.Count == 0)
                {
                    return;
                }



                int row_s = 2;
                int irow  = row_s;
                int icol  = 2;
                _count           = 0;
                arg_grid.MaxRows = row_s + 25;
                MachineHead(icol, irow, 0, arg_dt, arg_grid);
                irow = row_s + 2;
                MachineBody(icol, irow, 0, arg_dt, arg_grid);
                for (int i = 1; i < arg_dt.Rows.Count; i++)
                {
                    if (arg_dt.Rows[i]["LINE_ID"].ToString() == arg_dt.Rows[i - 1]["LINE_ID"].ToString())
                    {
                        if (arg_dt.Rows[i]["MINI_LINE_ID"].ToString() == arg_dt.Rows[i - 1]["MINI_LINE_ID"].ToString())
                        {
                            irow++;
                        }
                        else
                        {
                            irow  = row_s + 2;
                            icol += 3;
                        }
                        MachineBody(icol, irow, i, arg_dt, arg_grid);
                    }
                    else
                    {
                        arg_grid.set_ColWidth(icol + 3, 0.7);
                        icol += 4;
                        irow  = row_s;
                        MachineHead(icol, irow, i, arg_dt, arg_grid);
                        irow = row_s + 2;
                        MachineBody(icol, irow, i, arg_dt, arg_grid);
                    }
                }
                arg_grid.MaxCols = icol + 3;
            }
            catch
            { }
            finally
            {
                // WarehouseMaterialSystem.ClassLib.WinAPI.AnimateWindow(arg_grid.Handle, 200, WarehouseMaterialSystem.ClassLib.WinAPI.getSlidType("2"));
                //   arg_grid.Visible = true;
            }
        }
        private void Display_Grid(AxFPUSpreadADO.AxfpSpread _axfpSpread, DataTable _dt)
        {
            _axfpSpread.AddCellSpan(2, 1, _dt.Columns.Count - 1, 1);
            _axfpSpread.SetText(2, 1, _dt.Columns[1].Caption.ToString().Substring(1, 4));
            for (int iRow = 0; iRow < _dt.Rows.Count; iRow++)
            {
                int    iNumber = 0;
                double dTotal  = 0;
                double d       = Math.Round((232.125 - 22 - 18.75) / (_dt.Columns.Count - 1), 2);
                for (int iCol = 1; iCol < _dt.Columns.Count; iCol++)
                {
                    //_axfpSpread.set_ColWidth(iCol + 1, d);
                    //if (iRow == 0)
                    //{
                    //    _axfpSpread.SetText(iCol+1,iRow+2,_dt.Columns[iCol].Caption.ToString().Substring(7,2));
                    //}
                    if (_dt.Rows[iRow][iCol].ToString() != "0")
                    {
                        _axfpSpread.SetText(iCol + 1, iRow + 3, _dt.Rows[iRow][iCol].ToString());
                    }
                    if (_dt.Rows[iRow][iCol].ToString() != "" && _dt.Rows[iRow][iCol].ToString() != "0")
                    {
                        dTotal += Convert.ToDouble(_dt.Rows[iRow][iCol].ToString());
                        iNumber++;
                    }
                }
                if (iRow == 0)
                {
                    double dd = 232.125 - 22 - (_dt.Columns.Count - 1) * (_axfpSpread.get_ColWidth(_dt.Columns.Count));
                    _axfpSpread.AddCellSpan(_dt.Columns.Count + 1, iRow + 1, 1, 2);
                    _axfpSpread.SetText(_dt.Columns.Count + 1, iRow + 1, "Average");
                    _axfpSpread.Row       = iRow + 1;
                    _axfpSpread.Col       = _dt.Columns.Count + 1;
                    _axfpSpread.BackColor = Color.Orange;
                    //_axfpSpread.set_ColWidth(_dt.Columns.Count + 1, dd);
                }
                if (iNumber != 0)
                {
                    _axfpSpread.SetText(_dt.Columns.Count + 1, iRow + 3, Math.Round(dTotal / iNumber, 1));
                }
                else
                {
                    _axfpSpread.SetText(_dt.Columns.Count + 1, iRow + 3, 0);
                }

                for (int iCol = _dt.Columns.Count + 2; iCol <= _axfpSpread.MaxCols; iCol++)
                {
                    _axfpSpread.set_ColWidth(iCol, 0);
                }
            }
        }
示例#6
0
 private void GridLeftHead(int arg_col, AxFPUSpreadADO.AxfpSpread arg_grid)
 {
     string[] str = { "Line", "Machine", "Input", "Bal" };
     int[]    w   = { 6, 12, 6, 6 };
     for (int i = 0; i < 4; i++)
     {
         arg_grid.Col       = arg_col + i;
         arg_grid.Row       = 1;
         arg_grid.Text      = str[i];
         arg_grid.BackColor = Color.Yellow;
         arg_grid.FontSize  = 14;
         arg_grid.set_ColWidth(arg_col + i, w[i]);
     }
 }
        private void load_grid(AxFPUSpreadADO.AxfpSpread axGrid)
        {
            int imax     = Convert.ToInt16(_dt_chart.Rows[0]["COL_COUNT"]);
            int iColSpan = Convert.ToInt16(_dt_chart.Rows[0]["COL_SPAN"]);

            axGrid.MaxCols = imax + 2;

            axGrid.AddCellSpan(3, 4, iColSpan, 1);

            axGrid.SetText(1, 1, EmptyIfNull(_dt_chart.Rows[0][axGrid.Name.Replace("axGrid_", "") + "_GNAME"].ToString()));
            for (int i = 0; i < imax; i++)
            {
                axGrid.SetText(i + 3, 1, _dt_chart.Rows[i]["TITLE"].ToString());
                axGrid.SetText(i + 3, 2, EmptyIfNull2(_dt_chart.Rows[i][axGrid.Name.Replace("axGrid_", "")].ToString()));
                axGrid.SetText(i + 3, 3, EmptyIfNull(_dt_chart.Rows[i][axGrid.Name.Replace("axGrid_", "") + "_PER"].ToString() + "%"));
                axGrid.SetText(3, 4, EmptyIfNull(_dt_chart.Rows[0][axGrid.Name.Replace("axGrid_", "") + "_IM"].ToString() + "%"));
                axGrid.set_ColWidth(i + 3, Convert.ToDouble(_dt_chart.Rows[i]["COL_WIDTH"]));

                axGrid.Col      = i + 3;
                axGrid.Row      = 1;
                axGrid.FontSize = Convert.ToSingle(_dt_chart.Rows[i]["FONT"]);
                axGrid.Row      = 4;

                if (i >= iColSpan)
                {
                    axGrid.BackColor = Color.White;
                }
                else
                {
                    axGrid.BackColor = Color.Navy;
                }
                axGrid.FontSize = 35f;
                axGrid.FontBold = true;
            }

            axGrid.SetCellBorder(1, 1, axGrid.MaxCols, axGrid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
            axGrid.SetCellBorder(1, 2, axGrid.MaxCols, axGrid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
            axGrid.SetCellBorder(1, 2, axGrid.MaxCols, axGrid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexTop, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
        }
示例#8
0
        private void create_grid(AxFPUSpreadADO.AxfpSpread arg_Grid, DataTable dtData)//, DataTable dtGrid)
        {
            try
            {
                arg_Grid.Visible = false;
                int iMaxCol = dtData.Columns.Count - 1;
                arg_Grid.MaxRows = 3;
                arg_Grid.MaxRows = dtData.Rows.Count + 3;

                /*
                 *
                 * // arg_Grid.MaxRows = dtData.Rows.Count -2;
                 * //  axGrid.ClearRange(0, 4, 100, 100, false);
                 *
                 * arg_Grid.Reset();
                 * arg_Grid.DisplayColHeaders = false;
                 * arg_Grid.DisplayRowHeaders = false;
                 * arg_Grid.ActiveCellHighlightStyle = FPUSpreadADO.ActiveCellHighlightStyleConstants.ActiveCellHighlightStyleOff;
                 * arg_Grid.ColHeaderRows = 0;
                 *
                 * arg_Grid.TypeVAlign = FPUSpreadADO.TypeVAlignConstants.TypeVAlignCenter;
                 * arg_Grid.Font = new System.Drawing.Font("Calibri", 10.25F, FontStyle.Bold);
                 *
                 * arg_Grid.RowsFrozen = 3;
                 * arg_Grid.ColsFrozen = 1;
                 *
                 * //arg_Grid.Row = 1;
                 * //   arg_Grid.BackColor = Color.Gray;
                 * //  arg_Grid.ForeColor = Color.White;
                 * arg_Grid.AddCellSpan(2, 1, 4, 1);
                 * arg_Grid.AddCellSpan(6, 1, 4, 1);
                 * arg_Grid.AddCellSpan(10, 1, 4, 1);
                 * arg_Grid.AddCellSpan(14, 1, 4, 1);
                 * arg_Grid.AddCellSpan(18, 1, 4, 1);
                 * arg_Grid.AddCellSpan(22, 1, 4, 1);
                 * arg_Grid.AddCellSpan(26, 1, 4, 1);
                 *
                 * //// cells
                 * arg_Grid.TypeEditMultiLine = true;
                 * arg_Grid.MaxCols = iMaxCol;
                 * arg_Grid.SetCellBorder(1, 1, iMaxCol, arg_Grid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                 * arg_Grid.SetCellBorder(1, 1, iMaxCol, arg_Grid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                 * arg_Grid.SetCellBorder(1, 1, iMaxCol, arg_Grid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexRight, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                 * arg_Grid.SetCellBorder(1, 2, iMaxCol, arg_Grid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                 * arg_Grid.SetCellBorder(1, 2, iMaxCol, arg_Grid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                 * arg_Grid.SetCellBorder(1, 2, iMaxCol, arg_Grid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexRight, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                 *
                 * //for (int i = 1; i < arg_Grid.MaxRows; i++)
                 * //{
                 *
                 * //    arg_Grid.Row = i;
                 * //    // arg_Grid.Col = 1;
                 * //      arg_Grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignRight;
                 * //    if (i == 1)
                 * //    {
                 * //        arg_Grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter;
                 * //        arg_Grid.Font = new System.Drawing.Font("Calibri", 12.25F, FontStyle.Bold);
                 * //        arg_Grid.BackColor = Color.Gray;
                 * //        arg_Grid.ForeColor = Color.White;
                 * //    }
                 * //    else if (i == 2)
                 * //    {
                 * //        arg_Grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter;
                 * //        arg_Grid.Font = new System.Drawing.Font("Calibri", 10.25F, FontStyle.Bold);
                 * //        arg_Grid.BackColor = Color.LightGray;
                 * //        arg_Grid.ForeColor = Color.White;
                 * //    }
                 * //    else if (i == 3)
                 * //    {
                 * //        arg_Grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter;
                 * //        arg_Grid.Font = new System.Drawing.Font("Calibri", 10.25F, FontStyle.Bold);
                 * //        arg_Grid.BackColor = Color.LightSalmon;
                 * //        arg_Grid.ForeColor = Color.White;
                 * //    }
                 * //    //else if (i > 3)
                 * //    //{
                 * //    //    arg_Grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignRight;
                 * //    //    arg_Grid.BackColor = Color.White;
                 * //    //    arg_Grid.ForeColor = Color.Black;
                 * //    //}
                 *
                 * //    else
                 * //    {
                 * //        arg_Grid.BackColor = Color.White;
                 * //        arg_Grid.ForeColor = Color.Black;
                 * //    }
                 * //    arg_Grid.set_RowHeight(i, 25);
                 *
                 * //}
                 * arg_Grid.Row = -1;
                 * arg_Grid.Col = 1;
                 */

                /// -----------row header------------------------------
                arg_Grid.Row = 1;

                arg_Grid.set_RowHeight(1, 30);

                int iDtRow = dtData == null || dtData.Rows.Count == 0 ? 50 : dtData.Rows.Count;
                //   int iDtCol = dtData == null || dtData.Columns.Count == 0 ? 29 : dtData.Columns.Count;


                if (iDtRow > 8)
                {
                    //iColName = "COL_WIDTH_SCOLL";
                    arg_Grid.ScrollBars     = FPUSpreadADO.ScrollBarsConstants.ScrollBarsVertical;
                    arg_Grid.ScrollBarWidth = 20;
                }

                else
                {
                    arg_Grid.ScrollBars = FPUSpreadADO.ScrollBarsConstants.ScrollBarsNone;
                }
                //  arg_Grid.MaxRows = iDtRow + arg_Grid.RowsFrozen;

                for (int i = 0; i < iMaxCol; i++)
                {
                    arg_Grid.Col = i + 1;
                }
                ///
                /// --------add data------------------------------
                ///
                if (dtData == null || dtData.Rows.Count == 0)
                {
                    return;
                }

                else
                {
                    double[] totalAvg = new double[dtData.Columns.Count];
                    double   temp     = 0.0;

                    for (int icol = 0; icol < dtData.Columns.Count; icol++)
                    {
                        arg_Grid.SetText(icol + 1, 1, dtData.Columns[icol + 1].ColumnName.Replace("'", "").Split('\n')[0]);
                        if (icol < dtData.Columns.Count - 2)
                        {
                            arg_Grid.SetText(icol + 2, 2, dtData.Columns[icol + 2].ColumnName.Replace("'", "").Split('\n')[1]);
                        }
                        if (icol == 1)
                        {
                            arg_Grid.set_ColWidth(1, 26.5);
                        }
                        if (icol >= 2)
                        {
                            arg_Grid.set_ColWidth(icol, 7.25);
                        }

                        arg_Grid.SetText(1, 1, "Week");
                        arg_Grid.SetText(1, 2, "Model");
                        // arg_Grid.SetText( 1, 3, "Total");

                        for (int i = 0; i < dtData.Rows.Count - 1; i++)
                        {
                            //if (icol >= 2 && i >= 3)
                            //{
                            //    arg_Grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignRight;
                            //   // arg_Grid.Font = new System.Drawing.Font("Calibri", 10.25F, FontStyle.Regular);
                            //}
                            // Rate.
                            if (dtData.Columns[icol + 1].ColumnName.Contains("%"))
                            {
                                double.TryParse(dtData.Rows[i][icol + 1].ToString(), out temp);
                                if (!string.IsNullOrWhiteSpace(dtData.Rows[i][icol + 1].ToString()) && temp > 0)
                                {
                                    string rate = dtData.Rows[i][icol + 1].ToString() + "%";
                                    arg_Grid.SetText(icol + 1, i + 3, rate);
                                }
                            }
                            // Remains.
                            else
                            {
                                double.TryParse(dtData.Rows[i][icol + 1].ToString(), out temp);
                                if (temp > 0)
                                {
                                    arg_Grid.SetText(icol + 1, i + 3, FormatNumber(dtData.Rows[i][icol + 1].ToString()));
                                }
                                else
                                {
                                    arg_Grid.SetText(icol + 1, i + 3, dtData.Rows[i][icol + 1].ToString());
                                }
                            }
                            //if (icol == 1)
                            //{
                            //    arg_Grid.Col = 1;
                            //    arg_Grid.Row = i;
                            //    arg_Grid.Font = new Font(arg_Grid.Font.FontFamily, arg_Grid.Font.Size, FontStyle.Bold);
                            //}
                            //if (icol >= 2 && i > 4)
                            //{
                            //    arg_Grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignRight;
                            //    arg_Grid.Font = new System.Drawing.Font("Calibri", 10.25F, FontStyle.Regular);
                            //}
                        }
                    }

                    // this.axGrid.Show();
                    // WarehouseMaterialSystem.ClassLib.WinAPI.AnimateWindow(this.axDetail.Handle, 400, WarehouseMaterialSystem.ClassLib.WinAPI.getSlidType("5"));
                }
            }
            catch (Exception)
            {
            }
        }
示例#9
0
        private void Display_Grid(AxFPUSpreadADO.AxfpSpread _axfpSpread, DataTable _dt)
        {
            //_axfpSpread.AddCellSpan(2, 1, _dt.Columns.Count-2, 1);
            //_axfpSpread.SetText(2, 1, DateTime.ParseExact(_dt.Columns[2].Caption.ToString().Substring(1, 8), "yyyyMMdd", CultureInfo.InvariantCulture).ToString("MMMM", CultureInfo.InvariantCulture));
            ClearGrid(_axfpSpread);
            for (int iRow = 0; iRow < _dt.Rows.Count; iRow++)
            {
                int    iNumber = 0;
                double dTotal  = 0;
                double d       = Math.Round((159 - 10.75 - 10 * 2) / (_dt.Columns.Count - 2), 2);
                for (int iCol = 1; iCol < _dt.Columns.Count; iCol++)
                {
                    _axfpSpread.set_ColWidth(iCol + 1, d);
                    if (iRow == 0 && iCol > 1)
                    {
                        _axfpSpread.SetText(iCol, iRow + 1, DateTime.ParseExact(_dt.Columns[iCol].Caption.ToString().Substring(1, 8), "yyyyMMdd", CultureInfo.InvariantCulture).ToString("MMM", CultureInfo.InvariantCulture));
                        _axfpSpread.SetText(iCol, iRow + 2, _dt.Columns[iCol].Caption.ToString().Substring(7, 2));
                    }
                    _axfpSpread.SetText(iCol, iRow + 3, _dt.Rows[iRow][iCol].ToString());
                    if (_dt.Rows[iRow][iCol].ToString() != "" && _dt.Rows[iRow][iCol].ToString() != "0" && iCol > 1)
                    {
                        dTotal += Convert.ToDouble(_dt.Rows[iRow][iCol].ToString());
                        iNumber++;
                    }
                }

                if (iNumber != 0)
                {
                    _axfpSpread.SetText(_dt.Columns.Count, iRow + 3, Math.Round(dTotal / iNumber, 1));
                    _axfpSpread.SetText(_dt.Columns.Count + 1, iRow + 3, Math.Round(dTotal, 1));
                }
                else
                {
                    _axfpSpread.SetText(_dt.Columns.Count, iRow + 3, 0);
                    _axfpSpread.SetText(_dt.Columns.Count + 1, iRow + 3, 0);
                }
            }

            double dd = 159 - 10.75 - (_dt.Columns.Count - 1) * (_axfpSpread.get_ColWidth(_dt.Columns.Count - 2));

            _axfpSpread.AddCellSpan(_dt.Columns.Count, 1, 1, 2);
            _axfpSpread.SetText(_dt.Columns.Count, 1, "Avg");
            _axfpSpread.Row       = 1;
            _axfpSpread.Col       = _dt.Columns.Count;
            _axfpSpread.BackColor = Color.Orange;
            _axfpSpread.ForeColor = Color.White;
            _axfpSpread.set_ColWidth(_dt.Columns.Count, dd / 2);


            _axfpSpread.AddCellSpan(_dt.Columns.Count + 1, 1, 1, 2);
            _axfpSpread.SetText(_dt.Columns.Count + 1, +1, "Total");
            _axfpSpread.Row       = 1;
            _axfpSpread.Col       = _dt.Columns.Count + 1;
            _axfpSpread.BackColor = Color.DodgerBlue;
            _axfpSpread.ForeColor = Color.White;
            _axfpSpread.set_ColWidth(_dt.Columns.Count + 1, dd / 2);

            for (int iCol = _dt.Columns.Count + 2; iCol <= _axfpSpread.MaxCols; iCol++)
            {
                _axfpSpread.set_ColWidth(iCol, 0);
            }
            for (int i = _dt.Rows.Count + 1; i <= _axfpSpread.MaxRows; i++)
            {
                _axfpSpread.set_RowHeight(i + 2, 0);
            }

            MergeRowGroupCol(_axfpSpread, 2, _dt.Columns.Count, 1);
        }
示例#10
0
        private void DisplayGridTop(DataTable arg_dt, AxFPUSpreadADO.AxfpSpread arg_grid)
        {
            try
            {
                _Dic_Location = new Dictionary <string, string>();

                if (arg_dt == null || arg_dt.Rows.Count == 0)
                {
                    return;
                }

                Double.TryParse(arg_dt.Rows[0]["WIDTH"].ToString(), out _iWidth);
                Double.TryParse(arg_dt.Rows[0]["HEIGHT"].ToString(), out _iHeight);

                // Set Default Grid
                arg_grid.Visible = false;

                arg_grid.Reset();
                arg_grid.BorderStyle              = FPUSpreadADO.BorderStyleConstants.BorderStyleNone;
                arg_grid.DisplayColHeaders        = false;
                arg_grid.DisplayRowHeaders        = false;
                arg_grid.ActiveCellHighlightStyle = FPUSpreadADO.ActiveCellHighlightStyleConstants.ActiveCellHighlightStyleOff;
                arg_grid.ColHeaderRows            = 0;
                arg_grid.ScrollBars = FPUSpreadADO.ScrollBarsConstants.ScrollBarsNone;
                arg_grid.Font       = new System.Drawing.Font("Calibri", 8);
                arg_grid.set_RowHeight(1, 0.5);
                arg_grid.set_ColWidth(1, 0.5);
                arg_grid.TypeHAlign        = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter;
                arg_grid.TypeVAlign        = FPUSpreadADO.TypeVAlignConstants.TypeVAlignCenter;
                arg_grid.TypeEditMultiLine = true;

                arg_grid.SetCellBorder(1, 1, 150, axGridTop.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank);
                arg_grid.SetCellBorder(1, 1, 150, axGridTop.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank);
                for (int ic = 2; ic <= 150; ic++)
                {
                    arg_grid.set_ColWidth(ic, 3.1);
                }

                int row_s = 2;
                int irow  = row_s;
                int icol  = 2;

                MachineHeadTop(icol, irow, 0, arg_dt, arg_grid);
                irow = row_s + 1;
                MachineBodyTop(icol, irow, 0, arg_dt, arg_grid);
                _Dic_Location.Add(irow.ToString() + "-" + icol.ToString(), arg_dt.Rows[0]["SHORT_NAME"].ToString());
                for (int i = 1; i < arg_dt.Rows.Count; i++)
                {
                    if (arg_dt.Rows[i]["LINE_ID"].ToString() == arg_dt.Rows[i - 1]["LINE_ID"].ToString())
                    {
                        if (arg_dt.Rows[i]["MINI_LINE_ID"].ToString() == arg_dt.Rows[i - 1]["MINI_LINE_ID"].ToString())
                        {
                            irow++;
                        }
                        else
                        {
                            irow = row_s + 1;
                            icol++;
                        }
                        MachineBodyTop(icol, irow, i, arg_dt, arg_grid);
                    }
                    else
                    {
                        axGridTop.set_ColWidth(icol + 1, 0.4);
                        icol += 2;
                        irow  = row_s;
                        MachineHeadTop(icol, irow, i, arg_dt, arg_grid);
                        irow = row_s + 1;
                        MachineBodyTop(icol, irow, i, arg_dt, arg_grid);
                    }

                    string loc = irow.ToString() + "-" + icol.ToString();

                    //for (int i = 0; i < _Dic_Location.Count; i++)
                    //{
                    //    _Dic_Location.
                    //}

                    _Dic_Location.Add(loc, arg_dt.Rows[i]["SHORT_NAME"].ToString());
                }

                arg_grid.RowsFrozen = irow + 1;
            }
            catch
            { }
            finally
            {
                arg_grid.Visible = true;
            }
        }
示例#11
0
        private void DisplayGridRight(DataTable arg_dt, AxFPUSpreadADO.AxfpSpread arg_grid)
        {
            int irow = 1, icol = 0;
            int iTotInput = 0, iTotMold = 0, iInput = 0, iMold = 0;
            int divRow = 11;

            arg_grid.Reset();
            //arg_grid.BorderStyle = FPUSpreadADO.BorderStyleConstants.BorderStyleNone;
            arg_grid.GrayAreaBackColor        = Color.White;
            arg_grid.DisplayColHeaders        = false;
            arg_grid.DisplayRowHeaders        = false;
            arg_grid.ActiveCellHighlightStyle = FPUSpreadADO.ActiveCellHighlightStyleConstants.ActiveCellHighlightStyleOff;
            arg_grid.ColHeaderRows            = 0;
            arg_grid.ScrollBars = FPUSpreadADO.ScrollBarsConstants.ScrollBarsNone;
            arg_grid.Font       = new System.Drawing.Font("Calibri", 11);
            //arg_grid.set_RowHeight(1, 0.5);
            //arg_grid.set_ColWidth(1, 0.5);
            arg_grid.TypeHAlign        = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter;
            arg_grid.TypeVAlign        = FPUSpreadADO.TypeVAlignConstants.TypeVAlignCenter;
            arg_grid.TypeEditMultiLine = true;

            arg_grid.Row      = 1;
            arg_grid.FontBold = true;



            //for (int ic = 1; ic <= 50; ic++)
            //    arg_grid.set_ColWidth(ic, 12);

            for (int ir = 1; ir <= divRow; ir++)
            {
                arg_grid.set_RowHeight(ir, 15);
            }

            // arg_grid.set_RowHeight(1, 22);
            arg_grid.set_RowHeight(divRow + 1, 18);

            GridRightHead(1, arg_grid);
            arg_grid.SetCellBorder(1, 1, arg_grid.MaxCols, divRow + 1, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0x4286f4, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
            arg_grid.SetCellBorder(1, 1, arg_grid.MaxCols, divRow + 1, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0x4286f4, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
            for (int i = 0; i < arg_dt.Rows.Count; i++)
            {
                if (irow == divRow)
                {
                    icol += 4;
                    irow  = 2;
                    GridRightHead(icol + 1, arg_grid);
                    arg_grid.set_ColWidth(icol, 2);
                    arg_grid.SetCellBorder(icol, 1, icol, divRow - 1, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank);
                    //arg_grid.SetCellBorder(irow , icol , 4, divRow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                    // arg_grid.SetCellBorder(irow , icol, 4, divRow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                }
                else
                {
                    irow++;
                }

                iInput = Convert.ToInt32(arg_dt.Rows[i]["MOLD_INPUT"]);
                iMold  = Convert.ToInt32(arg_dt.Rows[i]["QTY"]);

                arg_grid.SetText(icol + 1, irow, arg_dt.Rows[i]["SHORT_NAME"].ToString());
                arg_grid.SetText(icol + 2, irow, iMold.ToString("###,###,###"));
                arg_grid.SetText(icol + 3, irow, iInput.ToString("###,###,###"));

                iTotInput += Convert.ToInt32(arg_dt.Rows[i]["MOLD_INPUT"]);
                iTotMold  += Convert.ToInt32(arg_dt.Rows[i]["QTY"]);
            }

            arg_grid.AddCellSpan(1, divRow + 1, 13, 1);

            arg_grid.SetText(1, divRow + 1, "Total");
            arg_grid.SetText(icol + 3, divRow + 1, iTotInput.ToString("###,###,###"));
            arg_grid.SetText(icol + 2, divRow + 1, iTotMold.ToString("###,###,###"));
            arg_grid.Col        = -1;
            arg_grid.Row        = divRow + 1;
            arg_grid.BackColor  = Color.FromArgb(232, 232, 127);
            arg_grid.FontBold   = true;
            arg_grid.FontSize   = 14;
            arg_grid.Col        = 1;
            arg_grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter;
            arg_grid.MaxRows    = divRow + 1;
            arg_grid.MaxCols    = 15;
        }
示例#12
0
        private void DisplayGridLeft(DataTable arg_dt, AxFPUSpreadADO.AxfpSpread arg_grid)
        {
            int irow = 1, icol = 0, divRow;
            int iTotMachine = 0, iTotInput = 0, iTotBal = 0;

            arg_grid.Reset();
            // arg_grid.BorderStyle = FPUSpreadADO.BorderStyleConstants.BorderStyleNone;
            arg_grid.GrayAreaBackColor        = Color.White;
            arg_grid.DisplayColHeaders        = false;
            arg_grid.DisplayRowHeaders        = false;
            arg_grid.ActiveCellHighlightStyle = FPUSpreadADO.ActiveCellHighlightStyleConstants.ActiveCellHighlightStyleOff;
            arg_grid.ColHeaderRows            = 0;
            arg_grid.ScrollBars = FPUSpreadADO.ScrollBarsConstants.ScrollBarsNone;
            arg_grid.Font       = new System.Drawing.Font("Calibri", 11);
            //arg_grid.set_RowHeight(1, 0.5);
            //arg_grid.set_ColWidth(1, 0.5);
            arg_grid.TypeHAlign        = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter;
            arg_grid.TypeVAlign        = FPUSpreadADO.TypeVAlignConstants.TypeVAlignCenter;
            arg_grid.TypeEditMultiLine = true;

            arg_grid.Row      = 1;
            arg_grid.FontBold = true;


            //for (int ic = 1; ic <= 50; ic++)
            //    arg_grid.set_ColWidth(ic, 12);



            var query = from DataRow dRow in arg_dt.AsEnumerable()
                        //  where p.Used = "N"
                        group dRow by dRow["LINE_NAME"] into gp
                        select new
            {
                Line    = gp.Key,
                Machine = gp.Count(),
                Input   = gp.Count(dRow => dRow.Field <string>("USE_YN") == "Y")
            };

            divRow = (query.Count() / 2) + 2;
            for (int ir = 1; ir <= divRow; ir++)
            {
                arg_grid.set_RowHeight(ir, 15);
            }

            arg_grid.set_RowHeight(divRow + 1, 18);
            arg_grid.MaxCols = 9;
            arg_grid.MaxRows = divRow + 1;
            GridLeftHead(1, arg_grid);

            arg_grid.SetCellBorder(1, 1, arg_grid.MaxCols, divRow + 1, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0x4286f4, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
            arg_grid.SetCellBorder(1, 1, arg_grid.MaxCols, divRow + 1, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0x4286f4, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);


            foreach (var element in query)
            {
                if (irow == divRow)
                {
                    icol += 5;
                    irow  = 2;
                    GridLeftHead(icol + 1, arg_grid);
                    arg_grid.set_ColWidth(icol, 2);
                    arg_grid.SetCellBorder(icol, 1, icol, divRow - 1, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank);
                    //arg_grid.SetCellBorder(irow , icol , 4, divRow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                    // arg_grid.SetCellBorder(irow , icol, 4, divRow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                }
                else
                {
                    irow++;
                }

                arg_grid.SetText(icol + 1, irow, element.Line);
                arg_grid.SetText(icol + 2, irow, element.Machine);
                arg_grid.SetText(icol + 3, irow, element.Input);
                arg_grid.SetText(icol + 4, irow, element.Machine - element.Input);

                iTotMachine += element.Machine;
                iTotInput   += element.Input;
                iTotBal     += (element.Machine - element.Input);
            }

            arg_grid.AddCellSpan(1, divRow + 1, 6, 1);

            arg_grid.SetText(1, divRow + 1, "Total");
            arg_grid.SetText(icol + 2, divRow + 1, iTotMachine.ToString());
            arg_grid.SetText(icol + 3, divRow + 1, iTotInput.ToString());
            arg_grid.SetText(icol + 4, divRow + 1, iTotBal.ToString());
            arg_grid.Col       = -1;
            arg_grid.Row       = divRow + 1;
            arg_grid.BackColor = Color.FromArgb(232, 232, 127);
            arg_grid.FontBold  = true;
            arg_grid.FontSize  = 14;
        }
        private void MachineHead(int arg_icol, int arg_irow, int arg_idt, DataTable arg_dt, AxFPUSpreadADO.AxfpSpread arg_grid)
        {
            try
            {
                int iRow = Convert.ToInt32(arg_dt.Rows[arg_idt]["NUM_MINI_LINE"]);
                arg_grid.Col      = arg_icol;
                arg_grid.Row      = arg_irow;
                arg_grid.Text     = "Line " + arg_dt.Rows[arg_idt]["LINE_NAME"].ToString();
                arg_grid.FontSize = 11;
                arg_grid.FontBold = true;

                arg_grid.BackColor  = Color.DodgerBlue;
                arg_grid.ForeColor  = Color.White;
                arg_grid.TypeVAlign = FPUSpreadADO.TypeVAlignConstants.TypeVAlignCenter;
                arg_grid.AddCellSpan(arg_icol, arg_irow, iRow * 3, 1);

                //arg_grid.SetCellBorder(arg_icol, arg_irow, arg_icol, arg_irow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexOutline, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                // arg_grid.SetCellBorder(icol, irow, icol + 3, irow + 1, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                //arg_grid.SetCellBorder(icol, irow, icol + 2, irow +1, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                //arg_grid.SetCellBorder(icol, irow, icol + 2, irow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexTop, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);


                arg_irow++;
                arg_grid.Row = arg_irow;
                for (int i = 0; i < iRow; i++)
                {
                    if (arg_dt.Rows[arg_idt]["LINE_NAME"].ToString() == "E")
                    {
                        arg_grid.set_ColWidth(arg_icol + (i * 3), 6.0);
                    }

                    arg_grid.Col       = arg_icol + (i * 3);
                    arg_grid.Text      = "M/C";
                    arg_grid.BackColor = Color.LightSkyBlue;
                    //  arg_grid.ForeColor = Color.White;
                    arg_grid.FontSize = 11;
                    arg_grid.FontBold = true;

                    arg_grid.Col       = arg_icol + (i * 3) + 1;
                    arg_grid.Text      = "Plan";
                    arg_grid.BackColor = Color.Green;
                    arg_grid.ForeColor = Color.White;
                    arg_grid.FontSize  = 11;
                    arg_grid.FontBold  = true;

                    arg_grid.Col       = arg_icol + (i * 3) + 2;
                    arg_grid.Text      = "Act";
                    arg_grid.BackColor = Color.Orange;
                    arg_grid.ForeColor = Color.White;
                    arg_grid.FontSize  = 11;
                    arg_grid.FontBold  = true;
                }
                arg_grid.Col = -1;
                arg_grid.set_RowHeight(arg_irow, 20);

                //arg_grid.Col = arg_icol + 2;
                //arg_grid.Text = "R";
                //arg_grid.BackColor = Color.LightSkyBlue;
                ////  arg_grid.ForeColor = Color.White;
                //arg_grid.Font = new System.Drawing.Font("Calibri", 15, FontStyle.Bold);
            }
            catch
            { }
        }
示例#14
0
        private void DisplayGridTop(DataTable arg_dt, AxFPUSpreadADO.AxfpSpread arg_grid)
        {
            try
            {
                if (arg_dt == null || arg_dt.Rows.Count == 0)
                {
                    return;
                }

                // Set Default Grid
                arg_grid.Visible = false;

                arg_grid.Reset();
                arg_grid.BorderStyle              = FPUSpreadADO.BorderStyleConstants.BorderStyleNone;
                arg_grid.DisplayColHeaders        = false;
                arg_grid.DisplayRowHeaders        = false;
                arg_grid.ActiveCellHighlightStyle = FPUSpreadADO.ActiveCellHighlightStyleConstants.ActiveCellHighlightStyleOff;
                arg_grid.ColHeaderRows            = 0;
                arg_grid.ScrollBars = FPUSpreadADO.ScrollBarsConstants.ScrollBarsNone;
                arg_grid.Font       = new System.Drawing.Font("Calibri", 10);
                arg_grid.set_RowHeight(1, 0.5);
                arg_grid.set_ColWidth(1, 0.5);
                arg_grid.TypeHAlign        = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter;
                arg_grid.TypeVAlign        = FPUSpreadADO.TypeVAlignConstants.TypeVAlignCenter;
                arg_grid.TypeEditMultiLine = true;
                arg_grid.SetCellBorder(1, 1, 150, axGridTop.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank);
                arg_grid.SetCellBorder(1, 1, 150, axGridTop.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank);
                for (int ic = 2; ic <= 150; ic++)
                {
                    arg_grid.set_ColWidth(ic, 4.0);
                }

                int row_s = 2;
                int irow  = row_s;
                int icol  = 2;

                MachineHeadTop(icol, irow, 0, arg_dt, arg_grid);
                irow = row_s + 1;
                MachineBodyTop(icol, irow, 0, arg_dt, arg_grid);
                for (int i = 1; i < arg_dt.Rows.Count; i++)
                {
                    if (arg_dt.Rows[i]["LINE_ID"].ToString() == arg_dt.Rows[i - 1]["LINE_ID"].ToString())
                    {
                        if (arg_dt.Rows[i]["MINI_LINE_ID"].ToString() == arg_dt.Rows[i - 1]["MINI_LINE_ID"].ToString())
                        {
                            irow++;
                        }
                        else
                        {
                            irow = row_s + 1;
                            icol++;
                        }
                        MachineBodyTop(icol, irow, i, arg_dt, arg_grid);
                    }
                    else
                    {
                        axGridTop.set_ColWidth(icol + 1, 0.5);
                        icol += 2;
                        irow  = row_s;
                        MachineHeadTop(icol, irow, i, arg_dt, arg_grid);
                        irow = row_s + 1;
                        MachineBodyTop(icol, irow, i, arg_dt, arg_grid);
                    }
                }
            }
            catch
            { }
            finally
            {
                arg_grid.Visible = true;
            }
        }