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); } } }
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); }
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); } } }
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); } } }
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); }
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); } } }
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; }
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 ) { } }