void ResaltarErrores() { int n_row = 0; int n_col = 0; double n_valor = 0; string c_valor = ""; for (n_col = 4; n_col <= FgDatos.Cols.Count - 1; n_col++) { for (n_row = 3; n_row <= FgDatos.Rows.Count - 1; n_row++) { n_valor = Convert.ToDouble(funFunciones.NulosN(FgDatos.GetData(n_row, n_col))); if (n_valor == 0) { funFlex.Flex_PintarCeldas(FgDatos, n_row, n_col, n_row, n_col, Color.Red); } } } for (n_col = 4; n_col <= FgDatos2.Cols.Count - 1; n_col++) { for (n_row = 3; n_row <= FgDatos2.Rows.Count - 1; n_row++) { c_valor = funFunciones.NulosC(FgDatos2.GetData(n_row, n_col)).ToString(); if (c_valor == "00:00:00") { funFlex.Flex_PintarCeldas(FgDatos2, n_row, n_col, n_row, n_col, Color.Red); } } } }
void PintarDatos() { int n_row = 0; int n_numdat = 0; string c_dato = ""; Color o_color; Helper.Comunes.Convertir funCon = new Helper.Comunes.Convertir(); for (n_row = 2; n_row <= FgDatos.Rows.Count - 1; n_row++) { n_numdat = Convert.ToInt32(FgDatos.GetData(n_row, 9)); if (n_numdat == 0) { funFlex.Flex_PintarCeldas(FgDatos, n_row, 2, n_row, 2, Color.Blue, Color.Transparent); } if (n_numdat == 1) { funFlex.Flex_PintarCeldas(FgDatos, n_row, 2, n_row, 2, Color.Green, Color.Transparent); } if (n_numdat == 2) { c_dato = funCon.DecimalEnHoras(Convert.ToDouble(FgDatos.GetData(n_row, 5))); FgDatos.SetData(n_row, 5, c_dato); } if (n_numdat == 3) { funFlex.Flex_PintarCeldas(FgDatos, n_row, 2, n_row, 2, Color.Green, Color.Transparent); } } }
void MostrarTotales() { double n_valor = 0; FgDatos.Rows.Count = FgDatos.Rows.Count + 1; FgDatos.SetData(FgDatos.Rows.Count - 1, 2, "TOTALES ==>"); n_valor = funFlex.FlexSumarCol(FgDatos, 4, 2, FgDatos.Rows.Count - 2); FgDatos.SetData(FgDatos.Rows.Count - 1, 4, n_valor.ToString("0.00")); n_valor = funFlex.FlexSumarCol(FgDatos, 5, 2, FgDatos.Rows.Count - 2); FgDatos.SetData(FgDatos.Rows.Count - 1, 5, n_valor.ToString("0.00")); n_valor = funFlex.FlexSumarCol(FgDatos, 6, 2, FgDatos.Rows.Count - 2); FgDatos.SetData(FgDatos.Rows.Count - 1, 6, n_valor.ToString("0.00")); n_valor = funFlex.FlexSumarCol(FgDatos, 7, 2, FgDatos.Rows.Count - 2); FgDatos.SetData(FgDatos.Rows.Count - 1, 7, n_valor.ToString("0.00")); n_valor = funFlex.FlexSumarCol(FgDatos, 8, 2, FgDatos.Rows.Count - 2); FgDatos.SetData(FgDatos.Rows.Count - 1, 8, n_valor.ToString("0.00")); n_valor = funFlex.FlexSumarCol(FgDatos, 9, 2, FgDatos.Rows.Count - 2); FgDatos.SetData(FgDatos.Rows.Count - 1, 9, n_valor.ToString("0.00")); n_valor = funFlex.FlexSumarCol(FgDatos, 10, 2, FgDatos.Rows.Count - 2); FgDatos.SetData(FgDatos.Rows.Count - 1, 10, n_valor.ToString("0.00")); n_valor = funFlex.FlexSumarCol(FgDatos, 11, 2, FgDatos.Rows.Count - 2); FgDatos.SetData(FgDatos.Rows.Count - 1, 11, n_valor.ToString("0.00")); n_valor = funFlex.FlexSumarCol(FgDatos, 12, 2, FgDatos.Rows.Count - 2); FgDatos.SetData(FgDatos.Rows.Count - 1, 12, n_valor.ToString("0.00")); n_valor = funFlex.FlexSumarCol(FgDatos, 13, 2, FgDatos.Rows.Count - 2); FgDatos.SetData(FgDatos.Rows.Count - 1, 13, n_valor.ToString("0.00")); n_valor = funFlex.FlexSumarCol(FgDatos, 14, 2, FgDatos.Rows.Count - 2); FgDatos.SetData(FgDatos.Rows.Count - 1, 14, n_valor.ToString("0.00")); n_valor = funFlex.FlexSumarCol(FgDatos, 15, 2, FgDatos.Rows.Count - 2); FgDatos.SetData(FgDatos.Rows.Count - 1, 15, n_valor.ToString("0.00")); funFlex.Flex_PintarCeldas(FgDatos, FgDatos.Rows.Count - 1, 1, FgDatos.Rows.Count - 1, FgDatos.Cols.Count - 1, Color.Black, Color.PaleGreen); funFlex.Flex_PintarCeldas(FgDatos, 1, FgDatos.Cols.Count - 1, FgDatos.Rows.Count - 1, FgDatos.Cols.Count - 1, Color.Black, Color.Pink); }
void PintarGrid() { funFlex.Flex_PintarCeldas(FgDatos, 2, 1, FgDatos.Rows.Count - 1, 2, Color.Black, Color.Beige); funFlex.Flex_PintarCeldas(FgDatos, 2, 5, FgDatos.Rows.Count - 1, 6, Color.Black, Color.Beige); funFlex.Flex_PintarCeldas(FgDatos, 2, 9, FgDatos.Rows.Count - 1, 10, Color.Black, Color.Beige); funFlex.Flex_PintarCeldas(FgDatos, 2, 13, FgDatos.Rows.Count - 1, 14, Color.Black, Color.Beige); funFlex.Flex_PintarCeldas(FgDatos, 2, 17, FgDatos.Rows.Count - 1, 18, Color.Black, Color.Beige); }
void n_pintacelda(int n_fila, int n_columna, int n_valor) { Color o_color = new Color(); if (n_valor == 5) { o_color = Color.Green; } if (n_valor == 4) { o_color = Color.Yellow; } if (n_valor == 6) { o_color = Color.Red; } funFlex.Flex_PintarCeldas(FgItems, n_fila, n_columna, n_fila, n_columna, o_color, o_color); }
void SumarColumnas() { int n_col = 3; FgDatos.Rows.Count = FgDatos.Rows.Count + 1; FgDatos.SetData(FgDatos.Rows.Count - 1, 1, "T O T A L E S ==>"); for (n_col = 2; n_col <= FgDatos.Cols.Count - 1; n_col++) { double n_valor = funFlex.FlexSumarCol(FgDatos, n_col, 2, FgDatos.Rows.Count - 2); FgDatos.SetData(FgDatos.Rows.Count - 1, n_col, n_valor.ToString("0.00")); } funFlex.Flex_PintarCeldas(FgDatos, FgDatos.Rows.Count - 1, 1, FgDatos.Rows.Count - 1, FgDatos.Cols.Count - 1, Color.Black, Color.Coral); funFlex.Flex_PintarCeldas(FgDatos, 2, FgDatos.Cols.Count - 1, FgDatos.Rows.Count - 2, FgDatos.Cols.Count - 1, Color.Black, Color.DarkSeaGreen); }
void MostrarDatosItems() { int n_row = 0; int n_numanos = 0; double n_valor; DataTable dtResult = new DataTable(); CN_ges_planventas o_plan = new CN_ges_planventas(); dtResult = funDatos.DataTableFiltrar(dtItems, "n_id = " + n_IdItem + ""); if (dtResult.Rows.Count != 0) { TxtCodPro.Text = dtResult.Rows[0]["c_codpro"].ToString(); TxtDes.Text = dtResult.Rows[0]["c_despro"].ToString(); TxtUniMed.Text = dtResult.Rows[0]["c_abrpre"].ToString(); } o_plan.mysConec = mysConec; o_plan.VentasItemxPorAnos(STU_SISTEMA.EMPRESAID, n_IdItem); dtResult = o_plan.dtLista; FgItems.Rows.Count = 2; if (dtResult != null) { if (dtResult.Rows.Count != 0) { funFlex.FlexMostrarDatos(FgItems, arrCabeceraFlex1, dtResult, 2, true); FgItems.SelectionMode = C1.Win.C1FlexGrid.SelectionModeEnum.Row; n_numanos = dtResult.Rows.Count; // CALCULAMOS EL TOTAL double n_totalmes = 0; FgItems.Rows.Count = FgItems.Rows.Count + 1; FgItems.SetData(FgItems.Rows.Count - 1, 1, "TOTAL ==>"); n_totalmes = funFlex.FlexSumarCol(FgItems, 2, 2, FgItems.Rows.Count - 1); FgItems.SetData(FgItems.Rows.Count - 1, 2, n_totalmes.ToString("0.00")); n_totalmes = funFlex.FlexSumarCol(FgItems, 3, 2, FgItems.Rows.Count - 1); FgItems.SetData(FgItems.Rows.Count - 1, 3, n_totalmes.ToString("0.00")); n_totalmes = funFlex.FlexSumarCol(FgItems, 4, 2, FgItems.Rows.Count - 1); FgItems.SetData(FgItems.Rows.Count - 1, 4, n_totalmes.ToString("0.00")); n_totalmes = funFlex.FlexSumarCol(FgItems, 5, 2, FgItems.Rows.Count - 1); FgItems.SetData(FgItems.Rows.Count - 1, 5, n_totalmes.ToString("0.00")); n_totalmes = funFlex.FlexSumarCol(FgItems, 6, 2, FgItems.Rows.Count - 1); FgItems.SetData(FgItems.Rows.Count - 1, 6, n_totalmes.ToString("0.00")); n_totalmes = funFlex.FlexSumarCol(FgItems, 7, 2, FgItems.Rows.Count - 1); FgItems.SetData(FgItems.Rows.Count - 1, 7, n_totalmes.ToString("0.00")); n_totalmes = funFlex.FlexSumarCol(FgItems, 8, 2, FgItems.Rows.Count - 1); FgItems.SetData(FgItems.Rows.Count - 1, 8, n_totalmes.ToString("0.00")); n_totalmes = funFlex.FlexSumarCol(FgItems, 9, 2, FgItems.Rows.Count - 1); FgItems.SetData(FgItems.Rows.Count - 1, 9, n_totalmes.ToString("0.00")); n_totalmes = funFlex.FlexSumarCol(FgItems, 10, 2, FgItems.Rows.Count - 1); FgItems.SetData(FgItems.Rows.Count - 1, 10, n_totalmes.ToString("0.00")); n_totalmes = funFlex.FlexSumarCol(FgItems, 11, 2, FgItems.Rows.Count - 1); FgItems.SetData(FgItems.Rows.Count - 1, 11, n_totalmes.ToString("0.00")); n_totalmes = funFlex.FlexSumarCol(FgItems, 12, 2, FgItems.Rows.Count - 1); FgItems.SetData(FgItems.Rows.Count - 1, 12, n_totalmes.ToString("0.00")); n_totalmes = funFlex.FlexSumarCol(FgItems, 13, 2, FgItems.Rows.Count - 1); FgItems.SetData(FgItems.Rows.Count - 1, 13, n_totalmes.ToString("0.00")); n_totalmes = funFlex.FlexSumarCol(FgItems, 14, 2, FgItems.Rows.Count - 1); FgItems.SetData(FgItems.Rows.Count - 1, 14, n_totalmes.ToString("0.00")); //CALCULAMOS EL PROMEDIO FgItems.Rows.Count = FgItems.Rows.Count + 1; FgItems.SetData(FgItems.Rows.Count - 1, 1, "PROMEDIO ==>"); double n_total = 0; Double n_promedio = 0; n_total = Convert.ToDouble(FgItems.GetData(FgItems.Rows.Count - 2, 2)); n_promedio = (n_total / n_numanos); FgItems.SetData(FgItems.Rows.Count - 1, 2, n_promedio.ToString("0.00")); n_total = Convert.ToDouble(FgItems.GetData(FgItems.Rows.Count - 2, 3)); n_promedio = (n_total / n_numanos); FgItems.SetData(FgItems.Rows.Count - 1, 3, n_promedio.ToString("0.00")); n_total = Convert.ToDouble(FgItems.GetData(FgItems.Rows.Count - 2, 4)); n_promedio = (n_total / n_numanos); FgItems.SetData(FgItems.Rows.Count - 1, 4, n_promedio.ToString("0.00")); n_total = Convert.ToDouble(FgItems.GetData(FgItems.Rows.Count - 2, 5)); n_promedio = (n_total / n_numanos); FgItems.SetData(FgItems.Rows.Count - 1, 5, n_promedio.ToString("0.00")); n_total = Convert.ToDouble(FgItems.GetData(FgItems.Rows.Count - 2, 6)); n_promedio = (n_total / n_numanos); FgItems.SetData(FgItems.Rows.Count - 1, 6, n_promedio.ToString("0.00")); n_total = Convert.ToDouble(FgItems.GetData(FgItems.Rows.Count - 2, 7)); n_promedio = (n_total / n_numanos); FgItems.SetData(FgItems.Rows.Count - 1, 7, n_promedio.ToString("0.00")); n_total = Convert.ToDouble(FgItems.GetData(FgItems.Rows.Count - 2, 8)); n_promedio = (n_total / n_numanos); FgItems.SetData(FgItems.Rows.Count - 1, 8, n_promedio.ToString("0.00")); n_total = Convert.ToDouble(FgItems.GetData(FgItems.Rows.Count - 2, 9)); n_promedio = (n_total / n_numanos); FgItems.SetData(FgItems.Rows.Count - 1, 9, n_promedio.ToString("0.00")); n_total = Convert.ToDouble(FgItems.GetData(FgItems.Rows.Count - 2, 10)); n_promedio = (n_total / n_numanos); FgItems.SetData(FgItems.Rows.Count - 1, 10, n_promedio.ToString("0.00")); n_total = Convert.ToDouble(FgItems.GetData(FgItems.Rows.Count - 2, 11)); n_promedio = (n_total / n_numanos); FgItems.SetData(FgItems.Rows.Count - 1, 11, n_promedio.ToString("0.00")); n_total = Convert.ToDouble(FgItems.GetData(FgItems.Rows.Count - 2, 12)); n_promedio = (n_total / n_numanos); FgItems.SetData(FgItems.Rows.Count - 1, 12, n_promedio.ToString("0.00")); n_total = Convert.ToDouble(FgItems.GetData(FgItems.Rows.Count - 2, 13)); n_promedio = (n_total / n_numanos); FgItems.SetData(FgItems.Rows.Count - 1, 13, n_promedio.ToString("0.00")); n_total = Convert.ToDouble(FgItems.GetData(FgItems.Rows.Count - 2, 14)); n_promedio = (n_total / n_numanos); FgItems.SetData(FgItems.Rows.Count - 1, 14, n_promedio.ToString("0.00")); } } string[] c_datos = new string[12]; int n_fil = 0; int n_ele = 0; string c_dato = ""; n_row = 0; for (n_row = 2; n_row <= FgItems.Rows.Count - 3; n_row++) { n_ele = 0; for (n_fil = 2; n_fil <= FgItems.Cols.Count - 4; n_fil++) { c_datos[n_ele] = Convert.ToDouble(funFunciones.NulosN(FgItems.GetData(n_row, n_fil))).ToString("0.00"); n_ele = n_ele + 1; } c_dato = HallarPromedio(c_datos).ToString("0.00"); FgItems.SetData(n_row, FgItems.Cols.Count - 1, c_dato); } funFlex.Flex_PintarCeldas(FgItems, FgItems.Rows.Count - 2, 1, FgItems.Rows.Count - 1, 14, Color.Black, Color.Coral); funFlex.Flex_PintarCeldas(FgItems, 2, FgItems.Cols.Count - 2, FgItems.Rows.Count - 1, FgItems.Cols.Count - 1, Color.Black, Color.LightCoral); MostrarPlanVenta(); }
void AgruparResultado() { int n_fil = 0; double n_val = 0; int n_filalt = 0; string c_dato = ""; double n_pro = 0; int n_filcolor1 = 0; int n_filcolor2 = 0; int n_color = 1; double n_total = 0; double n_valor1 = 0; double n_valor2 = 0; for (n_fil = 3; n_fil <= FgDatos.Rows.Count - 1; n_fil++) { n_val = Convert.ToDouble(FgDatos.GetData(n_fil, 13)); if (n_val == 99999) { c_dato = ""; } n_filalt = FgDatos.Rows[n_fil].Height; c_dato = FgDatos.GetData(n_fil, 2).ToString(); if (n_val == 0) { funFlex.Flex_PintarCeldas(FgDatos, n_fil, 1, n_fil, 12, Color.Blue, Color.Transparent); } else { if (n_pro != 0) { if (n_val == 99999) { funFlex.Flex_PintarCeldas(FgDatos, n_fil, 1, n_fil, 12, Color.Blue, Color.Transparent); } else { if (n_val != n_pro) { if (n_color == 1) { funFlex.Flex_PintarCeldas(FgDatos, n_filcolor1, 1, n_filcolor2, 12, Color.Black, Color.Beige); n_color = 2; } else { funFlex.Flex_PintarCeldas(FgDatos, n_filcolor1, 1, n_filcolor2, 12, Color.Black, Color.White); n_color = 1; } n_pro = n_val; n_filcolor1 = n_fil; n_filcolor2 = n_fil; n_total = Convert.ToDouble(FgDatos.GetData(n_fil, 12)); } else { n_filcolor2 = n_filcolor2 + 1; n_valor1 = Convert.ToDouble(FgDatos.GetData(n_fil, 10)); n_valor2 = Convert.ToDouble(FgDatos.GetData(n_fil, 11)); n_total = ((n_total - n_valor1) + n_valor2); FgDatos.SetData(n_fil, 12, n_total.ToString("0.00")); } } } else { n_pro = n_val; n_filcolor1 = n_fil; n_filcolor2 = n_fil; n_total = Convert.ToDouble(FgDatos.GetData(n_fil, 12)); } } } if (n_color == 1) { funFlex.Flex_PintarCeldas(FgDatos, n_filcolor1, 1, n_filcolor2, 12, Color.Black, Color.Beige); n_color = 2; } else { funFlex.Flex_PintarCeldas(FgDatos, n_filcolor1, 1, n_filcolor2, 12, Color.Black, Color.White); n_color = 1; } }