コード例 #1
0
        void MostrarDatos(DataTable dtIngresos, DataTable dtSalidas)
        {
            int    n_fil     = 0;
            int    n_col     = 0;
            int    n_reg     = 0;
            string c_nomcol  = "";
            int    n_columna = 0;

            C1.Win.C1FlexGrid.CellRange rng;

            n_fil = 2;
            FgItems.Cols.Count = 3;
            FgItems.Rows.Count = 2;
            FgItems.Cols.Count = 66;
            FgItems.Rows.Count = 2;
            n_col = 6;
            for (n_reg = 0; n_reg <= dtIngresos.Rows.Count - 1; n_reg++)
            {
                FgItems.Rows.Count = FgItems.Rows.Count + 1;
                FgItems.SetData(n_fil, 1, dtIngresos.Rows[n_reg]["TARJETA_TMP"].ToString());
                FgItems.SetData(n_fil, 2, dtIngresos.Rows[n_reg]["APENOM"].ToString());
                FgItems.SetData(n_fil, 3, dtIngresos.Rows[n_reg]["AREA"].ToString());

                n_columna = 4;
                for (n_col = 6; n_col <= dtIngresos.Columns.Count - 1; n_col++)
                {
                    c_nomcol = dtIngresos.Columns[n_col].ColumnName;
                    if (n_reg == 0)
                    {
                        FgItems.Cols[n_columna].Width              = 45;
                        FgItems.Cols[n_columna + 1].Width          = 45;
                        FgItems.Cols[n_columna].TextAlignFixed     = C1.Win.C1FlexGrid.TextAlignEnum.CenterCenter;
                        FgItems.Cols[n_columna + 1].TextAlignFixed = C1.Win.C1FlexGrid.TextAlignEnum.CenterCenter;

                        FgItems.Rows[0].AllowMerging = true;
                        rng = FgItems.GetCellRange(0, n_columna, 0, n_columna + 1);

                        if (c_nomcol.Length == 5)
                        {
                            rng.Data = "DIA " + c_nomcol.Substring(4, 1);
                        }
                        else
                        {
                            rng.Data = "DIA " + c_nomcol.Substring(4, 2);
                        }

                        FgItems.SetData(1, n_columna, "Ingreso");
                        FgItems.SetData(1, n_columna + 1, "Salida");
                    }
                    FgItems.SetData(n_fil, n_columna, dtIngresos.Rows[n_reg][c_nomcol].ToString());
                    n_columna = n_columna + 1;

                    if (ChkOpcion.Checked == true)                // AQUI IMPRIME EL FORMTATO PREPARADO MISTRANDO LAS HORAS FORMALES DE TRABAJO
                    {
                        string c_newhor;
                        string c_ing = "";
                        string c_sal = "";

                        if (dtIngresos.Rows[n_reg][c_nomcol].ToString() != "")
                        {
                            c_ing = dtIngresos.Rows[n_reg][c_nomcol].ToString();
                        }
                        if (dtSalidas.Rows[n_reg][c_nomcol].ToString() != "")
                        {
                            c_sal = dtSalidas.Rows[n_reg][c_nomcol].ToString();
                        }
                        c_newhor = Hora_HallarSalidaFormal(c_sal, c_ing, 9);
                        FgItems.SetData(n_fil, n_columna, c_newhor);
                    }
                    else
                    {
                        FgItems.SetData(n_fil, n_columna, dtSalidas.Rows[n_reg][c_nomcol].ToString());  // AQUI IMPRIME LAS HORAS REALMENTE TRABAJADAS
                    }
                    n_columna = n_columna + 1;
                }
                n_fil = n_fil + 1;
            }
        }