private void CalculaFechaDebida()
        {
            SchemaSettingInfo variable = null;
            int valor = Convert.ToInt32(Nivel_NUD.Value);

            switch (valor)
            {
            case 1:
            {
                variable = _variables.GetItem("PLAZO_MAXIMO_DISCREPANCIAS_N1");
            }
            break;

            case 2:
            {
                variable = _variables.GetItem("PLAZO_MAXIMO_DISCREPANCIAS_N2");
            }
            break;

            case 3:
            {
                variable = _variables.GetItem("PLAZO_MAXIMO_DISCREPANCIAS_N3");
            }
            break;

            default:
                return;
            }

            ((Discrepancia)Datos.Current).FechaDebida     = _fecha_comunicado.AddDays(Convert.ToInt32(variable.Value));
            ((Discrepancia)Datos.Current).FechaAmpliacion = ((Discrepancia)Datos.Current).FechaDebida;
        }
        private void FechaDebida_DTP_ValueChanged(object sender, EventArgs e)
        {
            if (Datos.Current == null)
            {
                return;
            }
            Discrepancia      discrepancia = ((Discrepancia)Datos.Current);
            DateTime          fecha_debida;
            SchemaSettingInfo variable = null;

            switch (discrepancia.Nivel)
            {
            case 1:
            {
                variable = _variables.GetItem("PLAZO_MAXIMO_DISCREPANCIAS_N1");
            }
            break;

            case 2:
            {
                variable = _variables.GetItem("PLAZO_MAXIMO_DISCREPANCIAS_N2");
            }
            break;

            case 3:
            {
                variable = _variables.GetItem("PLAZO_MAXIMO_DISCREPANCIAS_N3");
            }
            break;

            default: break;
            }

            if (variable != null)
            {
                int porc_ampliacion = Convert.ToInt32(_variables.GetItem("PLAZO_MAXIMO_AMPLIACION").Value);
                int dias_ampliacion = (Convert.ToInt32(variable.Value) * porc_ampliacion) / 100;
                fecha_debida = discrepancia.FechaDebida.AddDays(dias_ampliacion);
                if (fecha_debida.Date < FechaDebida_DTP.Value.Date)
                {
                    FechaDebida_DTP.Value = fecha_debida;
                }
            }
        }