Пример #1
0
        //Agrega el SAC a la lista.
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            string code = tbxCode.Text;
            string desc = tbxDescripcion.Text;
            string value;

            if (optSAC.Checked)
            {
                value = lblAbonar.Text;
            }
            else
            {
                value = lblAbonarProp.Text;
            }

            Label th_rem   = screenLiquidar.lblRemInfo;
            Label th_norem = screenLiquidar.lblNoRemInfo;
            Label tded     = screenLiquidar.lblDeduccionesInfo;
            Label tneto    = screenLiquidar.lblNetoInfo;

            DataRow dtXMLNewRow         = screenLiquidar.dtXML.NewRow();
            DataRow dtDgvDetallesNewRow = screenLiquidar.dtDgvDetalles.NewRow();


            dtDgvDetallesNewRow["codigo"]      = code;
            dtDgvDetallesNewRow["descripcion"] = desc;
            dtDgvDetallesNewRow["hab_fijo"]    = value;
            dtDgvDetallesNewRow["tipo"]        = "RM";
            dtDgvDetallesNewRow["modo"]        = "hab_fijo";
            dtDgvDetallesNewRow["unidades"]    = "1";
            dtDgvDetallesNewRow["codigoConceptoPorEmpresa"] = -10;

            screenLiquidar.dtDgvDetalles.Rows.Add(dtDgvDetallesNewRow);

            dtXMLNewRow["codigo"]      = code;
            dtXMLNewRow["descripcion"] = desc;
            dtXMLNewRow["hab_fijo"]    = value;
            dtXMLNewRow["tipo"]        = "RM";
            dtXMLNewRow["modo"]        = "hab_fijo";
            dtXMLNewRow["unidades"]    = "1";
            dtXMLNewRow["codigoConceptoPorEmpresa"] = -10;

            screenLiquidar.dtXML.Rows.Add(dtXMLNewRow);

            ManejoDeRecibo.CalcularTabla(screenLiquidar.dtDgvDetalles);

            screenLiquidar.DibujarTablaLiquidar();

            ManejoDeRecibo.CalcularTotales(screenLiquidar.dtDgvDetalles, screenLiquidar.dgvDetalles, th_rem, th_norem, tded, tneto);

            screenLiquidar.ModificarCeldasHaberDeduccion();

            Close();
        }
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                Label th_rem   = Liquidar_scrn.lblRemInfo;
                Label th_norem = Liquidar_scrn.lblNoRemInfo;
                Label tded     = Liquidar_scrn.lblDeduccionesInfo;
                Label tneto    = Liquidar_scrn.lblNetoInfo;

                DataRowView drv = dataGridView1.CurrentRow.DataBoundItem as DataRowView;
                DataRow     dr  = drv.Row;

                List <DataRow> listaConceptosFormula = RecuperarConceptosFormula(dr);

                foreach (DataRow row in listaConceptosFormula)
                {
                    DataRow dtDgvDetallesNewRow = Liquidar_scrn.dtDgvDetalles.NewRow();
                    DataRow dtXMLNewRow         = Liquidar_scrn.dtXML.NewRow();

                    dtDgvDetallesNewRow["codigo"]                   = Convert.ToString(row["codigo"]);
                    dtDgvDetallesNewRow["descripcion"]              = Convert.ToString(row["descripcion"]);
                    dtDgvDetallesNewRow["hab_fijo"]                 = Convert.ToString(row["hab_fijo"]);
                    dtDgvDetallesNewRow["hab_porc"]                 = Convert.ToString(row["hab_porc"]);
                    dtDgvDetallesNewRow["ded_fijo"]                 = Convert.ToString(row["ded_fijo"]);
                    dtDgvDetallesNewRow["ded_porc"]                 = Convert.ToString(row["ded_porc"]);
                    dtDgvDetallesNewRow["tipo"]                     = Convert.ToString(row["tipo"]);
                    dtDgvDetallesNewRow["modo"]                     = Convert.ToString(row["modo"]);
                    dtDgvDetallesNewRow["formula_porc"]             = Convert.ToString(row["formula_porc"]);
                    dtDgvDetallesNewRow["unidades"]                 = (Convert.ToInt32(row["codigoConceptoPorEmpresa"]) == Convert.ToInt32(dr["codigoConceptoPorEmpresa"])) ? tbxUnidades.Text : "1";
                    dtDgvDetallesNewRow["codigoConceptoPorEmpresa"] = Convert.ToString(row["codigoConceptoPorEmpresa"]);

                    Liquidar_scrn.dtDgvDetalles.Rows.Add(dtDgvDetallesNewRow);

                    dtXMLNewRow["codigo"]                   = Convert.ToString(row["codigo"]);
                    dtXMLNewRow["descripcion"]              = Convert.ToString(row["descripcion"]);
                    dtXMLNewRow["hab_fijo"]                 = Convert.ToString(row["hab_fijo"]);
                    dtXMLNewRow["hab_porc"]                 = Convert.ToString(row["hab_porc"]);
                    dtXMLNewRow["ded_fijo"]                 = Convert.ToString(row["ded_fijo"]);
                    dtXMLNewRow["ded_porc"]                 = Convert.ToString(row["ded_porc"]);
                    dtXMLNewRow["tipo"]                     = Convert.ToString(row["tipo"]);
                    dtXMLNewRow["modo"]                     = Convert.ToString(row["modo"]);
                    dtXMLNewRow["formula_porc"]             = Convert.ToString(row["formula_porc"]);
                    dtXMLNewRow["unidades"]                 = (Convert.ToInt32(row["codigoConceptoPorEmpresa"]) == Convert.ToInt32(dr["codigoConceptoPorEmpresa"])) ? tbxUnidades.Text : "1";
                    dtXMLNewRow["codigoConceptoPorEmpresa"] = Convert.ToString(row["codigoConceptoPorEmpresa"]);

                    Liquidar_scrn.dtXML.Rows.Add(dtXMLNewRow);
                }

                Liquidar_scrn.dtDgvDetalles.AcceptChanges();
                Liquidar_scrn.dtXML.AcceptChanges();

                ManejoDeRecibo.CalcularTabla(Liquidar_scrn.dtDgvDetalles);

                Liquidar_scrn.DibujarTablaLiquidar();

                ManejoDeRecibo.CalcularTotales(Liquidar_scrn.dtDgvDetalles, Liquidar_scrn.dgvDetalles, th_rem, th_norem, tded, tneto);

                Liquidar_scrn.ModificarCeldasHaberDeduccion();

                Close();
            }
            catch (Exception error)
            {
                MessageBox.Show("Error: " + error.Message);
            }
        }