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);
            }
        }
Beispiel #2
0
        public void MachineBodyTop(int arg_icol, int arg_irow, int arg_idt, DataTable arg_dt, AxFPUSpreadADO.AxfpSpread arg_grid)
        {
            try
            {
                arg_grid.SetCellBorder(arg_icol, arg_irow, arg_icol, arg_irow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank);
                //  arg_grid.SetCellBorder(arg_icol, arg_irow, arg_icol + 1, arg_irow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                arg_grid.SetCellBorder(arg_icol, arg_irow, arg_icol, arg_irow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank);

                arg_grid.set_RowHeight(arg_irow, _iHeight);


                arg_grid.Col  = arg_icol;
                arg_grid.Row  = arg_irow;
                arg_grid.Text = arg_dt.Rows[arg_idt]["MOLD_SIZE_CD"].ToString().Replace("/", "/\n");

                if (arg_dt.Rows[arg_idt]["USE_YN"].ToString() == "N")
                {
                    arg_grid.BackColor = Color.LightGray;
                    iNoUse++;
                    //_dtColor.Rows[row_index][column_index] = "5";
                }
                else if (arg_dt.Rows[arg_idt]["MOLD_SIZE_CD"].ToString() == "" || arg_dt.Rows[arg_idt]["MOLD_SIZE_CD"].ToString().ToUpper() == "NO PLAN")
                {
                    if (arg_dt.Rows[arg_idt]["PLAN_FIX_YN"].ToString() == "Y")
                    {
                        arg_grid.BackColor = Color.LightCyan;

                        // _dtColor.Rows[row_index][column_index] = "8";
                    }
                    else
                    {
                        arg_grid.BackColor = Color.Red;
                        iNoPlan++;
                        //_dtColor.Rows[row_index][column_index] = "4";
                    }
                }
                else if (arg_dt.Rows[arg_idt]["MOLD_SIZE_CD"].ToString().Split('/').Length > 1)
                {
                    arg_grid.BackColor = Color.Yellow;
                    arg_grid.ForeColor = Color.Black;
                    iMoldChange++;
                    iPlan++;
                    //_dtColor.Rows[row_index][column_index] = "6";
                }
                else
                {
                    arg_grid.BackColor = Color.FromArgb(0, 255, 0);
                    iPlan++;
                    //_dtColor.Rows[row_index][column_index] = "3";
                }
            }
            catch (Exception)
            {}
        }
        public void MachineBody(int arg_icol, int arg_irow, int arg_idt, DataTable arg_dt, AxFPUSpreadADO.AxfpSpread arg_grid)
        {
            try
            {
                arg_grid.SetCellBorder(arg_icol + 1, arg_irow, arg_icol + 2, arg_irow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                arg_grid.SetCellBorder(arg_icol + 3, arg_irow, arg_icol + 3, arg_irow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);
                arg_grid.SetCellBorder(arg_icol + 1, arg_irow, arg_icol + 2, arg_irow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid);

                arg_grid.set_RowHeight(arg_irow, 20);

                arg_grid.Col       = arg_icol;
                arg_grid.Row       = arg_irow;
                arg_grid.Text      = arg_dt.Rows[arg_idt]["MACHINE_NAME"].ToString();
                arg_grid.FontSize  = 11;
                arg_grid.FontBold  = true;
                arg_grid.BackColor = Color.LightGreen;

                ///Plan
                arg_grid.Col  = arg_icol + 1;
                arg_grid.Text = arg_dt.Rows[arg_idt]["MOLD_SIZE_CD"].ToString();
                if (arg_dt.Rows[arg_idt]["STATUS"].ToString() == "1")
                {
                    arg_grid.BackColor = Color.Yellow;
                }
                else
                {
                    arg_grid.BackColor = Color.White;
                }

                ///Act
                arg_grid.Col  = arg_icol + 2;
                arg_grid.Text = arg_dt.Rows[arg_idt]["ACTUAL"].ToString();
                if (arg_dt.Rows[arg_idt]["STATUS"].ToString() == "1")
                {
                    arg_grid.BackColor = Color.Yellow;
                }
                else
                {
                    arg_grid.BackColor = Color.White;
                }
            }
            catch (Exception)
            { }
        }
Beispiel #4
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)
            {
            }
        }
        private void Display_Grid(AxFPUSpreadADO.AxfpSpread _axfpSpread, DataTable _dt)
        {
            _axfpSpread.RowsFrozen = 2;
            if (_sProcess == "CMP")
            {
                _axfpSpread.BringToFront();
                int iNumberRow = _dt.Rows.Count;
                if (iNumberRow > 99)
                {
                    iNumberRow = 99;
                }

                for (int iRow = 0; iRow < iNumberRow; iRow++)
                {
                    if (_dt.Rows[iRow]["DIV"].ToString() == "0")
                    {
                        _axfpSpread.Col       = -1;
                        _axfpSpread.Row       = iRow + 2;
                        _axfpSpread.BackColor = Color.LightGray;
                    }

                    _axfpSpread.SetText(1, iRow + 2, _dt.Rows[iRow]["MODEL_NAME"].ToString());
                    if (_dt.Rows[iRow]["PLAN_QTY"].ToString() != "0")
                    {
                        _axfpSpread.SetText(2, iRow + 2, _dt.Rows[iRow]["PLAN_QTY"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(2, iRow + 2, "");
                    }
                    if (_dt.Rows[iRow]["BEF_QTY"].ToString() != "0")
                    {
                        _axfpSpread.SetText(3, iRow + 2, _dt.Rows[iRow]["BEF_QTY"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(3, iRow + 2, "");
                    }


                    if (_dt.Rows[iRow]["IN_QTY"].ToString() != "0")
                    {
                        _axfpSpread.SetText(4, iRow + 2, _dt.Rows[iRow]["IN_QTY"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(4, iRow + 2, "");
                    }

                    if (_dt.Rows[iRow]["OUT_QTY"].ToString() != "0")
                    {
                        _axfpSpread.SetText(5, iRow + 2, _dt.Rows[iRow]["OUT_QTY"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(5, iRow + 2, "");
                    }

                    if (_dt.Rows[iRow]["INV_QTY"].ToString() != "0")
                    {
                        _axfpSpread.SetText(6, iRow + 2, _dt.Rows[iRow]["INV_QTY"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(6, iRow + 2, "");
                    }

                    if (_dt.Rows[iRow]["LEADTIME"].ToString() != "0")
                    {
                        _axfpSpread.SetText(7, iRow + 2, _dt.Rows[iRow]["LEADTIME"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(7, iRow + 2, "");
                    }
                }
                for (int iRow = _dt.Rows.Count + 1; iRow < _axfpSpread.MaxRows; iRow++)
                {
                    _axfpSpread.set_RowHeight(iRow + 1, 0);
                }
            }

            if (_sProcess == "PHP")
            {
                int iNumberRow = _dt.Rows.Count;
                if (iNumberRow > 99)
                {
                    iNumberRow = 99;
                }

                for (int iRow = 0; iRow < iNumberRow; iRow++)
                {
                    if (_dt.Rows[iRow]["DIV"].ToString() == "0")
                    {
                        _axfpSpread.Col       = -1;
                        _axfpSpread.Row       = iRow + 3;
                        _axfpSpread.BackColor = Color.LightGray;
                    }

                    _axfpSpread.SetText(1, iRow + 3, _dt.Rows[iRow]["MODEL_NAME"].ToString());
                    if (_dt.Rows[iRow]["PLAN_QTY"].ToString() != "0")
                    {
                        _axfpSpread.SetText(2, iRow + 3, _dt.Rows[iRow]["PLAN_QTY"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(2, iRow + 3, "");
                    }
                    if (_dt.Rows[iRow]["INV_QTY"].ToString() != "0")
                    {
                        _axfpSpread.SetText(3, iRow + 3, _dt.Rows[iRow]["INV_QTY"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(3, iRow + 3, "");
                    }


                    if (_dt.Rows[iRow]["LEADTIME"].ToString() != "0")
                    {
                        _axfpSpread.SetText(4, iRow + 3, _dt.Rows[iRow]["LEADTIME"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(4, iRow + 3, "");
                    }

                    if (_dt.Rows[iRow]["UV_INV_QTY"].ToString() != "0")
                    {
                        _axfpSpread.SetText(5, iRow + 3, _dt.Rows[iRow]["UV_INV_QTY"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(5, iRow + 3, "");
                    }

                    if (_dt.Rows[iRow]["UV_LT"].ToString() != "0")
                    {
                        _axfpSpread.SetText(6, iRow + 3, _dt.Rows[iRow]["UV_LT"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(6, iRow + 3, "");
                    }

                    if (_dt.Rows[iRow]["SP_INV_QTY"].ToString() != "0")
                    {
                        _axfpSpread.SetText(7, iRow + 3, _dt.Rows[iRow]["SP_INV_QTY"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(7, iRow + 3, "");
                    }

                    if (_dt.Rows[iRow]["SP_LT"].ToString() != "0")
                    {
                        _axfpSpread.SetText(8, iRow + 3, _dt.Rows[iRow]["SP_LT"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(8, iRow + 3, "");
                    }
                }
                for (int iRow = _dt.Rows.Count + 1; iRow < _axfpSpread.MaxRows; iRow++)
                {
                    _axfpSpread.set_RowHeight(iRow + 1, 0);
                }
            }
        }
Beispiel #6
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);
        }
Beispiel #7
0
        private void Display_Grid(AxFPUSpreadADO.AxfpSpread _axfpSpread, DataTable _dt)
        {
            if (_sProcess == "FSS")
            {
                int iNumberRow = _dt.Rows.Count;
                if (iNumberRow > 99)
                {
                    iNumberRow = 99;
                }

                for (int iRow = 0; iRow < iNumberRow; iRow++)
                {
                    _axfpSpread.SetText(1, iRow + 4, _dt.Rows[iRow]["MODEL_NAME"].ToString());
                    if (_dt.Rows[iRow]["PLAN_QTY"].ToString() != "0")
                    {
                        _axfpSpread.SetText(2, iRow + 4, _dt.Rows[iRow]["PLAN_QTY"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(2, iRow + 4, "");
                    }
                    if (_dt.Rows[iRow]["INV_QTY"].ToString() != "0")
                    {
                        _axfpSpread.SetText(3, iRow + 4, _dt.Rows[iRow]["INV_QTY"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(3, iRow + 4, "");
                    }


                    if (_dt.Rows[iRow]["LEADTIME"].ToString() != "0")
                    {
                        _axfpSpread.SetText(4, iRow + 4, _dt.Rows[iRow]["LEADTIME"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(4, iRow + 4, "");
                    }

                    if (_dt.Rows[iRow]["UV_INV_QTY"].ToString() != "0")
                    {
                        _axfpSpread.SetText(5, iRow + 4, _dt.Rows[iRow]["UV_INV_QTY"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(5, iRow + 4, "");
                    }

                    if (_dt.Rows[iRow]["UV_LT"].ToString() != "0")
                    {
                        _axfpSpread.SetText(6, iRow + 4, _dt.Rows[iRow]["UV_LT"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(6, iRow + 4, "");
                    }

                    if (_dt.Rows[iRow]["SP_INV_QTY"].ToString() != "0")
                    {
                        _axfpSpread.SetText(7, iRow + 4, _dt.Rows[iRow]["SP_INV_QTY"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(7, iRow + 4, "");
                    }

                    if (_dt.Rows[iRow]["SP_LT"].ToString() != "0")
                    {
                        _axfpSpread.SetText(8, iRow + 4, _dt.Rows[iRow]["SP_LT"].ToString());
                    }
                    else
                    {
                        _axfpSpread.SetText(8, iRow + 4, "");
                    }
                }
                for (int iRow = _dt.Rows.Count + 1; iRow < _axfpSpread.MaxRows; iRow++)
                {
                    _axfpSpread.set_RowHeight(iRow + 1, 0);
                }
            }
        }
Beispiel #8
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;
            }
        }
Beispiel #9
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;
        }
Beispiel #10
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 Search_Daily_Report()
        {
            try
            {

                 double[] total = {0,0,0,0,0,0,0};
                DataTable dt = null;

                dt = null;

                dt = select_deffect_monitor();

                if (dt != null && dt.Rows.Count > 1)
                {
                    iNumRow = dt.Rows.Count;
                    dt_Daily_Report = dt;
            
                    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.##";
                            axfpSpread.Row = i + 2;

                            axfpSpread.set_RowHeight(i + 2, 21.5);

                            Double d = 0;
                            

                            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());

                            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());

                            d = 0;

                            d = Convert.ToDouble(dt_Daily_Report.Rows[i]["DATE_1"].ToString());
                            if (d != 0)
                            {
                                this.axfpSpread.SetText(5, i + 2, d.ToString(sFormat));
                            }
                            else
                            {
                                this.axfpSpread.SetText(5, i + 2, "0");
                            }

                            d = 0;
                            d = Convert.ToDouble(dt_Daily_Report.Rows[i]["DATE_2"].ToString());
                            if (d != 0)
                            {
                                this.axfpSpread.SetText(6, i + 2, d.ToString(sFormat));
                            }
                            else
                            {
                                this.axfpSpread.SetText(6, i + 2, "0");
                            }
                            d = 0;
                             d = Convert.ToDouble(dt_Daily_Report.Rows[i]["DATE_3"].ToString());
                             if (d != 0)
                             {
                                 this.axfpSpread.SetText(7, i + 2, d.ToString(sFormat));
                             }
                             else
                             {
                                 this.axfpSpread.SetText(7, i + 2, "0");
                             }
                            d = 0;
                             d = Convert.ToDouble(dt_Daily_Report.Rows[i]["DATE_4"].ToString());
                             if (d != 0)
                             {
                                 this.axfpSpread.SetText(8, i + 2, d.ToString(sFormat));
                             }
                             else
                             {
                                 this.axfpSpread.SetText(8, i + 2, "0");

                             }
                            d = 0;
                             d = Convert.ToDouble(dt_Daily_Report.Rows[i]["DATE_5"].ToString());
                             if (d != 0)
                             {

                                 this.axfpSpread.SetText(9, i + 2, d.ToString(sFormat));
                             }
                             else
                             {
                                 this.axfpSpread.SetText(9, i + 2, "0");
                             }
                            d = 0;
                             d = Convert.ToDouble(dt_Daily_Report.Rows[i]["DATE_6"].ToString());
                             if (d != 0)
                             {
                                 this.axfpSpread.SetText(10, i + 2, d.ToString(sFormat));
                             }
                             else
                             {
                                 this.axfpSpread.SetText(10, i + 2, "0");
                             }
                            d = 0;
                             d = Convert.ToDouble(dt_Daily_Report.Rows[i]["TOT"].ToString());
                             if (d != 0)
                             {
                                 this.axfpSpread.SetText(11, i + 2, d.ToString(sFormat));
                             }
                             else
                             {
                                 this.axfpSpread.SetText(11, i + 2, "0");
                             }
                            if (dt_Daily_Report.Rows[i]["REASON_TAIL_CD"].ToString() == "RAT")
                            {
                                for (int j = 3; j < dt_Daily_Report.Columns.Count; j++)
                                {
                                    axfpSpread.Col = j;
                                    axfpSpread.Row = i + 2;
                                    axfpSpread.BackColor = Color.DodgerBlue;
                                    
                                }

                            }
                            if (dt_Daily_Report.Rows[i]["REASON_TAIL_CD"].ToString() == "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 <= 11)
                                    {
                                        total[j - 5] += axfpSpread.Text == "0" ? 0 : Convert.ToDouble(axfpSpread.Text);
                                    }

                                }

                            }
                            
                            

                        }
                     //   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, (total[0] / Convert.ToDouble(dt.Rows[0][8].ToString()) * 100) == 0 ? "0" : (total[0] / Convert.ToDouble(dt.Rows[0][8].ToString()) * 100).ToString("###,##0.00"));
                        axfpSpread.SetText(6, dt.Rows.Count + 2, (total[1] / Convert.ToDouble(dt.Rows[0][9].ToString()) * 100) == 0 ? "0" : (total[1] / Convert.ToDouble(dt.Rows[0][9].ToString()) * 100).ToString("###,##0.00"));
                        axfpSpread.SetText(7, dt.Rows.Count + 2, (total[2] / Convert.ToDouble(dt.Rows[0][10].ToString()) * 100) == 0 ? "0" : (total[2] / Convert.ToDouble(dt.Rows[0][10].ToString()) * 100).ToString("###,##0.00"));
                        axfpSpread.SetText(8, dt.Rows.Count + 2, (total[3] / Convert.ToDouble(dt.Rows[0][11].ToString()) * 100) == 0 ? "0" : (total[3] / Convert.ToDouble(dt.Rows[0][11].ToString()) * 100).ToString("###,##0.00"));
                        axfpSpread.SetText(9, dt.Rows.Count + 2, (total[4] / Convert.ToDouble(dt.Rows[0][12].ToString()) * 100) == 0 ? "0" : (total[4] / Convert.ToDouble(dt.Rows[0][12].ToString()) * 100).ToString("###,##0.00"));
                        axfpSpread.SetText(10, dt.Rows.Count + 2, (total[5] / Convert.ToDouble(dt.Rows[0][13].ToString()) * 100) == 0 ? "0" : (total[5] / Convert.ToDouble(dt.Rows[0][13].ToString()) * 100).ToString("###,##0.00"));
                        axfpSpread.SetText(11, dt.Rows.Count + 2, (total[6] / Convert.ToDouble(dt.Rows[0][14].ToString()) * 100) == 0 ? "0" : (total[6] / Convert.ToDouble(dt.Rows[0][14].ToString()) * 100).ToString("###,##0.00"));


                        for (int i = 0; i < total.Length;i++ )
                        {
                            if (total[i] == 0)
                            {
                                for (int j = 2; j <= dt.Rows.Count+2; j++)
                                {
                                    axfpSpread.SetText(i+5, j, "");
                                }
                            }
                        }
       
                        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);

                        dt = null;

                        dt = select_chart_1();
                        if (dt != null & dt.Rows.Count > 0)
                        {
                            //chart1.Hide();
                            createChart(chart1, dt, "Injection Defective");
                            
                        }

                        dt = null;

                        dt = select_chart_2();
                        if (dt != null & dt.Rows.Count > 0)
                        {
                            //chart2.Hide();
                            createChart(chart2, dt, "UV Defective");
                            
                        }
                        //axfpSpread.Visible = true;
              
                                          
                    }

                    else
                    {
                       
                    }
                }
                else
                {


                    //axfDailyReport_Header.Visible = true;
                    //axfDailyReport.Visible = false;
               
                    iNumRow = 0;
                    

                }
                
              
            }
            catch (Exception )
            {

            }

        }
        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
            { }
        }
Beispiel #13
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;
            }
        }