예제 #1
0
        private void EliminarFilas(List <int> elementos)
        {
            workbook = spreadsheetControl.Document;
            Worksheet worksheet_HojaTrabajo = workbook.Worksheets[0];
            int       intNumeroElementos    = elementos.Count;

            int intIdFormulacion_Detalle_Personal = 0;

            for (int i = 0; i < intNumeroElementos; i++)
            {
                intIdFormulacion_Detalle_Personal = Convert.ToInt32(worksheet_HojaTrabajo.Cells[elementos[i] - 1, 30].Value.NumericValue);
                if (intIdFormulacion_Detalle_Personal > 0)
                {
                    Boolean blnResult = false;
                    if (MyStuff.UsaWCF == true)
                    {
                        blnResult = objWCF.Elimina_FormulacionDetalle_Personal(intIdFormulacion_Detalle_Personal);
                    }
                    else
                    {
                        Service.Formulacion_Detalle_Personal SFDP = new Service.Formulacion_Detalle_Personal();
                        blnResult = SFDP.Elimina_FormulacionDetalle_Personal(intIdFormulacion_Detalle_Personal);
                    }
                }
            }
        }
예제 #2
0
        private void Btn_Guardar_Click(object sender, EventArgs e)
        {
            //-- Boton Guardar Documento

            SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);
            SplashScreenManager.Default.SetWaitFormDescription("Grabando información...");

            Model.Formulacion_Detalle_Personal   MFDP = new Model.Formulacion_Detalle_Personal();
            Service.Formulacion_Detalle_Personal SFDP = new Service.Formulacion_Detalle_Personal();

            workbook = spreadsheetControl.Document;
            Worksheet worksheet_HojaTrabajo = workbook.Worksheets[0];

            int _Rows = 9;
            int intIdFormulacion_Detalle_Personal = 0;

            while (true)
            {
                if (string.IsNullOrEmpty(Convert.ToString(worksheet_HojaTrabajo.Cells[_Rows, 3].Value.TextValue)))
                {
                    break;
                }



                MFDP.IidFormulacion_Detalle_Personal = Convert.ToInt32(worksheet_HojaTrabajo.Cells[_Rows, 30].Value.NumericValue);
                MFDP.CañoProceso     = strAñoProceso;
                MFDP.Cversion        = strVersion;
                MFDP.CcodCeCo        = Convert.ToString(worksheet_HojaTrabajo.Cells[_Rows, 6].Value.TextValue);
                MFDP.CcodCeCo_Gestor = strCodCentroCosto;
                MFDP.CcodPosPre      = Convert.ToString(worksheet_HojaTrabajo.Cells[_Rows, 6].Value.TextValue);
                MFDP.CcodConcepto    = FS.TraerDescripcion_DataTable(DS_Concepto.Tables[0],
                                                                     1,
                                                                     0,
                                                                     Convert.ToString(worksheet_HojaTrabajo.Cells[_Rows, 9].Value.TextValue)
                                                                     );
                if (string.IsNullOrEmpty(Convert.ToString(worksheet_HojaTrabajo.Cells[_Rows, 10].Value.TextValue)))
                {
                    MFDP.CTipoOrden   = "";
                    MFDP.CNumeroOrden = "";
                }
                else
                {
                    MFDP.CTipoOrden   = Convert.ToString(worksheet_HojaTrabajo.Cells[_Rows, 10].Value.TextValue).Substring(0, 2);
                    MFDP.CNumeroOrden = Convert.ToString(worksheet_HojaTrabajo.Cells[_Rows, 10].Value.TextValue).Substring(3, 10);
                }


                MFDP.CcodFuenteFinanciamiento = "001";
                MFDP.CcodTipoFormulacion      = strCodTipoFormulacion;

                //MFDP.CcodProyecto = strCodProyecto;
                MFDP.CcodProyecto         = "CORPORATIVOS  ";
                MFDP.CcodClaseGasto       = "02";
                MFDP.TdescripcionGasto    = Convert.ToString(worksheet_HojaTrabajo.Cells[_Rows, 11].Value.TextValue);
                MFDP.FvalorAnterior       = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 12].Value.NumericValue);
                MFDP.FvalorRestoActual    = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 13].Value.NumericValue);
                MFDP.FvalorFormulacion    = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 26].Value.NumericValue);
                MFDP.FvalorFormulacionUno = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 27].Value.NumericValue);
                MFDP.FvalorFormulacionDos = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 28].Value.NumericValue);

                if (Convert.ToString(worksheet_HojaTrabajo.Cells[_Rows, 1].Value.TextValue) == "Año Anterior")
                {
                    MFDP.IcodTipoInserccion = 2; // 2 Automatico
                }
                else
                {
                    MFDP.IcodTipoInserccion = 1; //- 1 Manual
                }
                MFDP.Cusuario = MyStuff.CodigoEmpleado;

                MFDP.Fmes_01 = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 14].Value.NumericValue);
                MFDP.Fmes_02 = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 15].Value.NumericValue);
                MFDP.Fmes_03 = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 16].Value.NumericValue);
                MFDP.Fmes_04 = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 17].Value.NumericValue);
                MFDP.Fmes_05 = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 18].Value.NumericValue);
                MFDP.Fmes_06 = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 19].Value.NumericValue);
                MFDP.Fmes_07 = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 20].Value.NumericValue);
                MFDP.Fmes_08 = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 21].Value.NumericValue);
                MFDP.Fmes_09 = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 22].Value.NumericValue);
                MFDP.Fmes_10 = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 23].Value.NumericValue);
                MFDP.Fmes_11 = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 24].Value.NumericValue);
                MFDP.Fmes_12 = Convert.ToDouble(worksheet_HojaTrabajo.Cells[_Rows, 25].Value.NumericValue);

                if (ValidaLineaGrabacion(MFDP, _Rows) == false)
                {
                    if (MFDP.IidFormulacion_Detalle_Personal == 0)
                    {
                        if (MyStuff.UsaWCF == true)
                        {
                            intIdFormulacion_Detalle_Personal = objWCF.Graba_FormulacionDetalle_Personal(MFDP);
                        }
                        else
                        {
                            intIdFormulacion_Detalle_Personal = SFDP.Graba_FormulacionDetalle_Personal(MFDP);
                        }
                        string Rango = traeRangoCelda(1, _Rows + 1, 1, _Rows + 1);
                        workbook = spreadsheetControl.Document;
                        Range      range           = worksheet_HojaTrabajo.Range[Rango];
                        Formatting rangeFormatting = range.BeginUpdateFormatting();
                        rangeFormatting.Fill.BackgroundColor = Color.Green;
                        range.EndUpdateFormatting(rangeFormatting);

                        worksheet_HojaTrabajo.Cells[_Rows, 30].Value = intIdFormulacion_Detalle_Personal;
                    }
                    else
                    {
                        if (MyStuff.UsaWCF == true)
                        {
                            intIdFormulacion_Detalle_Personal = objWCF.Modifica_FormulacionDetalle_Personal(MFDP);
                        }
                        else
                        {
                            intIdFormulacion_Detalle_Personal = SFDP.Modifica_FormulacionDetalle_Personal(MFDP);
                        }
                    }
                }

                _Rows++;
            }

            SplashScreenManager.CloseForm();
        }
예제 #3
0
        private void MostrarFiltro(Boolean blnSalir)
        {
            WINformulacion.Movimiento.Frm_ActualizaFormulacion_Personal_Filtro frm = new WINformulacion.Movimiento.Frm_ActualizaFormulacion_Personal_Filtro();
            frm.ShowMe();
            if (frm.blnProcesaExcel == true)
            {
                SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);
                SplashScreenManager.Default.SetWaitFormDescription("Recopilando informaciòn...");

                //Habilita Opciones

                this.Btn_BuscaClasificador.Enabled        = true;
                this.Btn_DistribuyeLineaFormulada.Enabled = true;
                this.Btn_Guardar.Enabled  = true;
                this.Btn_Imprimir.Enabled = true;

                //Traer Dato de la tabla



                Model.Formulacion_Cabecera   MFC = new Model.Formulacion_Cabecera();
                Service.Formulacion_Cabecera SFC = new Service.Formulacion_Cabecera();

                if (MyStuff.UsaWCF == true)
                {
                    MFC = objWCF.Recupera_FormulacionCabecera(MyStuff.AñoProceso);
                }
                else
                {
                    MFC = SFC.Recupera_FormulacionCabecera(MyStuff.AñoProceso);
                }


                strAñoProceso         = MFC.CañoProceso;
                strVersion            = MFC.Cversion;
                strCodTipoFormulacion = "05";
                strCodCentroCosto     = frm.strCodCentroCosto;

                //-- Recuperar Datos



                Service.DataGeneral SDG = new Service.DataGeneral();
                Service.CentroCosto SCC = new Service.CentroCosto();

                if (MyStuff.UsaWCF == true)
                {
                    DS_CentroCosto = objWCF.Ayuda_CentroCosto_Todos();

                    DS_Concepto = objWCF.Ayuda_Concepto();
                }
                else
                {
                    DS_CentroCosto = SCC.Ayuda_CentroCosto_Todos();

                    DS_Concepto = SDG.Ayuda_Concepto();
                }

                Service.Formulacion_Detalle_Personal SFDP = new Service.Formulacion_Detalle_Personal();
                if (MyStuff.UsaWCF == true)
                {
                    DS_Formulacion = objWCF.Lista_FormulacionDetalle_Personal("000000", strCodCentroCosto, strCodTipoFormulacion);
                }
                else
                {
                    DS_Formulacion = SFDP.Lista_FormulacionDetalle_Personal("000000", strCodCentroCosto, strCodTipoFormulacion);
                }

                workbook = spreadsheetControl.Document;
                string sRutaInterna = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Excel\Formulacion_Personal.xlsx");
                //workbook.LoadDocument(@"Excel\Formulacion_Proyecto_Inversion.xlsx", DocumentFormat.Xlsx);
                workbook.LoadDocument(sRutaInterna, DocumentFormat.Xlsx);

                Worksheet worksheet_HojaTrabajo = workbook.Worksheets[0];

                worksheet_HojaTrabajo.Cells[3, 2].Value = frm.strNomProyecto;
                worksheet_HojaTrabajo.Cells[4, 2].Value = frm.strNomCentroCosto;



                worksheet_HojaTrabajo.Cells[2, 26].Value = MFC.CañoProceso;
                worksheet_HojaTrabajo.Cells[3, 26].Value = MFC.Cversion;
                worksheet_HojaTrabajo.Cells[4, 26].Value = "Gastos de Personal";

                DV_Excel = DS_Formulacion.Tables[0].DefaultView;
                worksheet_HojaTrabajo.DataBindings.BindToDataSource(DV_Excel, 9, 1);

                //int intLinea = 9;
                //foreach (DataRow oRow1 in DS_Formulacion.Tables[0].Rows)
                //{
                //    string Rango = traeRangoCelda(1, intLinea + 1, 1, intLinea + 1);
                //    workbook = spreadsheetControl.Document;
                //    Range range = worksheet_HojaTrabajo.Range[Rango];
                //    Formatting rangeFormatting = range.BeginUpdateFormatting();
                //    rangeFormatting.Fill.BackgroundColor = Color.Green;
                //    range.EndUpdateFormatting(rangeFormatting);

                //    worksheet_HojaTrabajo.Cells[intLinea, 1].Value = Convert.ToString(oRow1["vNomTipoInserccion"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 2].Value = Convert.ToString(oRow1["vNomCentroCosto"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 3].Value = Convert.ToString(oRow1["vNomClaseGasto"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 4].Value = Convert.ToString(oRow1["cCodClasificador"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 5].Value = Convert.ToString(oRow1["vNomClasificador"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 6].Value = Convert.ToString(oRow1["cCodPosPre"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 7].Value = Convert.ToString(oRow1["vNomPosPre"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 8].Value = Convert.ToString(oRow1["vNomFuenteFinanciamiento"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 9].Value = Convert.ToString(oRow1["vNomConcepto"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 10].Value = Convert.ToString(oRow1["Orden"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 11].Value = Convert.ToString(oRow1["tDescripcionGasto"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 12].Value = Convert.ToDouble(oRow1["fValorAnterior"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 13].Value = Convert.ToDouble(oRow1["fValorRestoActual"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 14].Value = Convert.ToDouble(oRow1["fMes_01"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 15].Value = Convert.ToDouble(oRow1["fMes_02"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 16].Value = Convert.ToDouble(oRow1["fMes_03"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 17].Value = Convert.ToDouble(oRow1["fMes_04"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 18].Value = Convert.ToDouble(oRow1["fMes_05"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 19].Value = Convert.ToDouble(oRow1["fMes_06"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 20].Value = Convert.ToDouble(oRow1["fMes_07"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 21].Value = Convert.ToDouble(oRow1["fMes_08"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 22].Value = Convert.ToDouble(oRow1["fMes_09"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 23].Value = Convert.ToDouble(oRow1["fMes_10"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 24].Value = Convert.ToDouble(oRow1["fMes_11"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 25].Value = Convert.ToDouble(oRow1["fMes_12"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 26].Value = Convert.ToDouble(oRow1["fValorFormulacion"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 27].Value = Convert.ToDouble(oRow1["fValorFormulacionUno"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 28].Value = Convert.ToDouble(oRow1["fValorFormulacionDos"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 29].Value = Convert.ToDouble(oRow1["Distribucion"]);
                //    worksheet_HojaTrabajo.Cells[intLinea, 30].Value = Convert.ToInt32(oRow1["iidFormulacion_Detalle_Personal"]);

                //    //worksheet_HojaTrabajo.Cells[intLinea, 1000].Value = Convert.ToString(oRow1["vNomFuenteFinanciamiento"]);

                //    this.FormatoCeldas(intLinea);
                //    intLinea = intLinea + 1;
                //    //}
                //}

                this.ValidarColumnas();

                SplashScreenManager.CloseForm();
            }
            else
            {
                //if (blnSalir == true)
                //this.Close();
            }
        }