示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Usuario = Utilerias.FiltrarUsuario(this);

            if (!IsPostBack)
            {
                string clave = Request.QueryString["id"];

                string Filas = "";
                List <NecesidadDetalle> NecesidadesDetalle = new List <NecesidadDetalle>();
                NecesidadesDetalle = NecesidadDetalleDAO.Listar().Where(p => p.ClaveNecesidad == Convert.ToInt32(clave)).ToList();
                foreach (NecesidadDetalle p in NecesidadesDetalle)
                {
                    p.Rellenar();

                    if (p.TipoConcepto == null)
                    {
                        Filas += Disenio.GenerarFilaTabla(p.Volumen.ToString(),
                                                          p.PrecioUnitario.ToString(),
                                                          p.Concepto.ToString(),
                                                          "");
                    }
                    else
                    {
                        Filas += Disenio.GenerarFilaTabla(p.Volumen.ToString(),
                                                          p.PrecioUnitario.ToString(),
                                                          p.Concepto.ToString(),
                                                          p.TipoConcepto.ToString());
                    }
                }
                litTBody.Text = Filas;
            }
        }
示例#2
0
 public TipoConcepto Rellenar()
 {
     try
     {
         Concepto          = ConceptoDAO.Get(ClaveConcepto);
         DetallesPrograma  = ProgramaDetalleDAO.Listar().Where(d => d.ClaveTipoConcepto == Clave).ToList();
         DetallesNecesidad = NecesidadDetalleDAO.Listar().Where(n => n.ClaveTipoConcepto == Clave).ToList();
         DetallesAumento   = AumentoDetalleDAO.Listar().Where(a => a.ClaveTipoConcepto == Clave).ToList();
         return(this);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
示例#3
0
 public Concepto Rellenar()
 {
     try
     {
         Tipos       = TipoConceptoDAO.Listar().Where(t => t.ClaveConcepto == Clave).ToList();
         Necesidades = NecesidadDetalleDAO.Listar().Where(n => n.ClaveConcepto == Clave).ToList();
         //Detalles = ProgramaDetalleDAO.Listar().Where(p => p.ClaveConcepto == Clave).ToList();
         Aumentos = AumentoDetalleDAO.Listar().Where(a => a.ClaveConcepto == Clave).ToList();
         return(this);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
示例#4
0
        public double CalcularImporte()
        {
            double Importe = 0.0;

            if (Detalles.Count == 0)
            {
                Detalles = NecesidadDetalleDAO.Listar().Where(n => n.ClaveNecesidad == Clave).ToList();
            }

            foreach (NecesidadDetalle d in Detalles)
            {
                Importe += d.CalcularImporte();
            }

            return(Importe);
        }
示例#5
0
 public Necesidad Rellenar()
 {
     try
     {
         Area      = AreaDAO.Get(ClaveArea);
         Periodo   = PeriodoDAO.Get(ClavePeriodo);
         Estatus   = EstatusNecesidadDAO.Get(ClaveEstatus);
         Detalles  = NecesidadDetalleDAO.Listar().Where(n => n.ClaveNecesidad == Clave).ToList();
         Programas = ProgramaDAO.Listar().Where(p => p.ClaveNecesidad == Clave).ToList();
         return(this);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
示例#6
0
        protected void btnAgregarMes_Click(object sender, EventArgs e)
        {
            try
            {
                detallesNecesidad = NecesidadDetalleDAO.Listar().Where(w => w.ClaveNecesidad == Convert.ToInt32(claveNec)).ToList();

                ProgramaDetalle programaDetalle = new ProgramaDetalle();
                programaDetalle.Cantidad          = Convert.ToDouble(cantidadProg.Text);
                programaDetalle.FechaInicio       = Utilerias.ParsearFecha(txtFechaCreacion.Text);
                programaDetalle.PrecioUnitario    = Convert.ToDecimal(precioUnit.Text);
                programaDetalle.ClavePrograma     = Convert.ToInt32(claveProg);
                programaDetalle.ClaveCircuito     = Convert.ToInt32(cmbCircuito.SelectedValue);
                programaDetalle.ClaveContrato     = null;
                programaDetalle.ClaveConcepto     = Convert.ToInt32(cmbConcepto.SelectedValue);
                programaDetalle.ClaveTipoConcepto = Convert.ToInt32(cmbTipoConcepto.SelectedValue);


                ProgramaDetalle programaNuevo = ProgramaDetalleDAO.Insertar(programaDetalle);
                if (programaNuevo == null)
                {
                    Mensaje Mensaje = new Mensaje()
                    {
                        Titulo    = "Algo salió mal",
                        Contenido = "La Necesidad no pudo guardarse. Para más información consulte al administrador del sistema",
                        Tipo      = TipoMensaje.ALERTA
                    };
                    litPrueba.Text = Disenio.GenerarMensaje(Mensaje);
                    return;
                }
                else
                {
                    Response.Redirect(ResolveUrl("~/App/Area/CrearProgramaDetalle.aspx?id=" + claveProg + "&idNec=" + claveNec));
                }
            }
            catch (Exception Ex)
            {
                Mensaje Mensaje = new Mensaje()
                {
                    Titulo    = "Error al crear el programa",
                    Contenido = Ex.Message,
                    Tipo      = TipoMensaje.ERROR
                };

                litMensaje.Text = Disenio.GenerarMensaje(Mensaje);
            }
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Usuario = Utilerias.FiltrarUsuario(this);
            Periodo = Usuario.ConsultarPeriodoActual();

            string claveProgramaDetalle = Request.QueryString["idPD"];

            string clave = Request.QueryString["id"];

            claveProg = clave;
            string necId = Request.QueryString["idNec"];

            claveNec = necId;
            string tipo  = Request.QueryString["tipo"];
            string Filas = "";

            if (!IsPostBack)
            {
                try
                {
                    detallesNecesidad = NecesidadDetalleDAO.Listar().Where(w => w.ClaveNecesidad == Convert.ToInt32(necId)).ToList();

                    if (clave != null && tipo == "eliminar")
                    {
                        int resultado = ProgramaDetalleDAO.Eliminar(Convert.ToInt32(claveProgramaDetalle));
                        if (resultado == 0)
                        {
                            Mensaje Mensaje = new Mensaje()
                            {
                                Titulo    = "Algo salió mal",
                                Contenido = "El programa no pudo eliminarse. Para más información consulte al administrador del sistema",
                                Tipo      = TipoMensaje.ALERTA
                            };
                            litPrueba.Text = Disenio.GenerarMensaje(Mensaje);
                            return;
                        }

                        Response.Redirect(ResolveUrl("~/App/Area/CrearProgramaDetalle.aspx?id=" + clave + "&idNec=" + necId));
                    }
                    else if (clave != null)
                    {
                        foreach (NecesidadDetalle det in detallesNecesidad)
                        {
                            det.Rellenar();

                            if (det.TipoConcepto == null)
                            {
                                Filas += Disenio.GenerarFilaTabla(det.Volumen.ToString(),
                                                                  det.PrecioUnitario.ToString(),
                                                                  Utilerias.ToCurrency(det.CalcularImporte()),
                                                                  det.Concepto.ToString(),
                                                                  "");
                                conceptosDisponibles.Add(det.Concepto);
                            }
                            else
                            {
                                Filas += Disenio.GenerarFilaTabla(det.Volumen.ToString(),
                                                                  det.PrecioUnitario.ToString(),
                                                                  Utilerias.ToCurrency(det.CalcularImporte()),
                                                                  det.Concepto.ToString(),
                                                                  det.TipoConcepto.ToString());
                                tipoConceptoDisponible.Add(det.TipoConcepto);
                            }
                        }

                        litTBody.Text = Filas;



                        Conceptos = ConceptoDAO.Listar().ToList();

                        cmbConcepto.DataSource = Conceptos;
                        cmbConcepto.DataBind();
                        Concepto Concepto = new Concepto();
                        Concepto                   = ConceptoDAO.Get(Convert.ToInt32(cmbConcepto.SelectedValue));
                        TiposConceptos             = Concepto.Rellenar().Tipos;
                        cmbTipoConcepto.DataSource = TiposConceptos;
                        cmbTipoConcepto.DataBind();

                        Circuitos = CircuitoDAO.Listar().Where(z => z.ClaveArea == Usuario.ClaveArea).ToList();
                        cmbCircuito.DataSource = Circuitos;
                        cmbCircuito.DataBind();


                        List <ProgramaDetalle> progDets = ProgramaDetalleDAO.Listar().Where(p => p.ClavePrograma == Convert.ToInt32(clave)).ToList();
                        string FilasDetalles            = "";

                        foreach (ProgramaDetalle p in progDets)
                        {
                            p.Rellenar();


                            string urlDelete = ResolveUrl("~/App/Area/CrearProgramaDetalle.aspx?idPD=" + p.Clave + "&id=" + clave + "&idNec=" + necId + "&tipo=eliminar");


                            if (p.TipoConcepto == null)
                            {
                                FilasDetalles += Disenio.GenerarFilaTabla(
                                    p.Cantidad.ToString(),
                                    p.FechaInicio.ToString(),
                                    p.PrecioUnitario.ToString(),
                                    p.Circuito.Descripcion.ToString(),
                                    p.Concepto.ToString(),
                                    "",
                                    "<a href='" + urlDelete + "' class='btn btn-default btn-block'>Eliminar</a>");
                            }
                            else
                            {
                                FilasDetalles += Disenio.GenerarFilaTabla(
                                    p.Cantidad.ToString(),
                                    p.FechaInicio.ToString(),
                                    p.PrecioUnitario.ToString(),
                                    p.Circuito.Descripcion.ToString(),
                                    p.Concepto.ToString(),
                                    p.TipoConcepto.ToString(),
                                    "<a href='" + urlDelete + "' class='btn btn-default btn-block'>Eliminar</a>"
                                    );
                            }
                        }

                        LitDetalles.Text = FilasDetalles;
                    }
                }



                catch (Exception Ex)
                {
                    Mensaje Mensaje = new Mensaje()
                    {
                        Titulo    = "Error en el proceso del detalle de programa de ejecucion",
                        Contenido = Ex.Message,
                        Tipo      = TipoMensaje.ERROR
                    };

                    litMensaje.Text = Disenio.GenerarMensaje(Mensaje);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {

            Usuario = Utilerias.FiltrarUsuario(this);

            if (!IsPostBack)
            {
                string clave = Request.QueryString["id"];
                string claveDetalle = Request.QueryString["idNecesidadDetalle"];
                string tipo = Request.QueryString["tipo"];
                string Filas = "";

                try
                {
                  
                        Necesidad Necesidad = new Necesidad();
                        Necesidad = NecesidadDAO.Get(Convert.ToInt32(clave));

                    if (Necesidad.ClaveEstatus == 2 )
                        {
                            btnEnivar.Visible = false;
                        btnRegistrarNecesidad.Visible = false;
                        }
                    

                    if (claveDetalle != null && tipo == "editar")
                    {
                        NecesidadDetalle NecesidadDetalle = new NecesidadDetalle();
                        NecesidadDetalle = NecesidadDetalleDAO.Get(Convert.ToInt32(claveDetalle));
                        txtVolumen.Text = NecesidadDetalle.Volumen.ToString();
                        txtPrecioU.Text = NecesidadDetalle.PrecioUnitario.ToString();
                        Conceptos = new List<Concepto>();
                        Conceptos.Add(NecesidadDetalle.Rellenar().Concepto);
                        cmbConcepto.DataSource = Conceptos;
                        cmbConcepto.DataBind();
                        cmbConcepto.Enabled = false;
                        TiposConceptos = new List<TipoConcepto>();
                        TiposConceptos.Add(NecesidadDetalle.Rellenar().TipoConcepto);
                        cmbTipoConcepto.DataSource = TiposConceptos;
                        cmbTipoConcepto.DataBind();
                        cmbTipoConcepto.Enabled = false;



                    }
                    else if (claveDetalle != null && tipo == "eliminar")
                    {
                        int resultado = NecesidadDetalleDAO.Eliminar(Convert.ToInt32(claveDetalle));
                        if (resultado == 0)
                        {
                            Mensaje Mensaje = new Mensaje()
                            {
                                Titulo = "Algo salió mal",
                                Contenido = "La Necesidad no pudo guardarse. Para más información consulte al administrador del sistema",
                                Tipo = TipoMensaje.ALERTA
                            };
                            litMensaje.Text = Disenio.GenerarMensaje(Mensaje);
                            return;
                        }

                        Response.Redirect(ResolveUrl("~/App/Area/RegistroNecesidadDetalle.aspx?id=" + clave));

                    }
                    else
                    {
                        Conceptos = ConceptoDAO.Listar();
                        cmbConcepto.DataSource = Conceptos;
                        cmbConcepto.DataBind();

                        Concepto Concepto = new Concepto();
                        Concepto = ConceptoDAO.Get(Convert.ToInt32(cmbConcepto.SelectedValue));
                        TiposConceptos = Concepto.Rellenar().Tipos;
                        cmbTipoConcepto.DataSource = TiposConceptos;
                        cmbTipoConcepto.DataBind();
                    }
                    double importeTotal = 0;
                    List<NecesidadDetalle> NecesidadesDetalle = new List<NecesidadDetalle>();
                    NecesidadesDetalle = NecesidadDetalleDAO.Listar().Where(p => p.ClaveNecesidad == Convert.ToInt32(clave)).ToList();
                    foreach (NecesidadDetalle p in NecesidadesDetalle)
                    {
                        p.Rellenar();

                        string urlEdit = ResolveUrl("~/App/Area/RegistroNecesidadDetalle.aspx?id=" + clave + "&idNecesidadDetalle=" + p.Clave + "&tipo=editar");
                        string urlDelete = ResolveUrl("~/App/Area/RegistroNecesidadDetalle.aspx?id=" + clave + "&idNecesidadDetalle=" + p.Clave + "&tipo=eliminar");

                        if(p.TipoConcepto == null)
                        {
                            Filas += Disenio.GenerarFilaTabla(p.Volumen.ToString(),
                            p.PrecioUnitario.ToString(),
                            Utilerias.ToCurrency(p.CalcularImporte()),
                            p.Concepto.ToString(),
                            "",
                             "<a href='" + urlEdit + "' class='btn btn-default btn-block'>Editar</a>",
                             "<a href='" + urlDelete + "' class='btn btn-default btn-block'>Eliminar</a>");

                            importeTotal += p.Volumen * p.PrecioUnitario;
                        }else
                        {
                            Filas += Disenio.GenerarFilaTabla(p.Volumen.ToString(),
                            p.PrecioUnitario.ToString(),
                            Utilerias.ToCurrency(p.CalcularImporte()),
                            p.Concepto.ToString(),
                            p.TipoConcepto.ToString(),
                             "<a href='" + urlEdit + "' class='btn btn-default btn-block'>Editar</a>",
                             "<a href='" + urlDelete + "' class='btn btn-default btn-block'>Eliminar</a>");
                            importeTotal += p.Volumen * p.PrecioUnitario;
                        }
                        

                    }
                    litTBody.Text = Filas;
                    LitimporteTotal.Text = "IMPORTE TOTAL = $ " + importeTotal.ToString();
                }
                catch (Exception Ex)
                {

                    Mensaje Mensaje = new Mensaje()
                    {
                        Titulo = "Error al mostrar el detalle",
                        Contenido = Ex.Message,
                        Tipo = TipoMensaje.ERROR
                    };

                    litMensaje.Text = Disenio.GenerarMensaje(Mensaje);

                }
            }
        }
        protected void btnRegistrarNecesidadDetalle_Click(object sender, EventArgs e)
        {
            try
            {
                string clave = Request.QueryString["id"];
                string tipo = Request.QueryString["tipo"];
                string claveDetalle = Request.QueryString["idNecesidadDetalle"];

                if (tipo == "editar" && claveDetalle != null)
                {
                    NecesidadDetalle NecesidadDetalle = new NecesidadDetalle();
                    NecesidadDetalle.Volumen = Convert.ToDouble(txtVolumen.Text);
                    NecesidadDetalle.PrecioUnitario = Convert.ToDouble(txtPrecioU.Text);
                    NecesidadDetalle.ClaveNecesidad = Convert.ToInt32(clave);
                    NecesidadDetalle.ClaveConcepto = Convert.ToInt32(cmbConcepto.SelectedValue);
                    if (!(cmbTipoConcepto.SelectedValue == ""))
                        NecesidadDetalle.ClaveTipoConcepto = Convert.ToInt32(cmbTipoConcepto.SelectedValue);
                    else NecesidadDetalle.ClaveTipoConcepto = null;


                    NecesidadDetalle NecesidadNueva = NecesidadDetalleDAO.Actualizar(Convert.ToInt32(claveDetalle), NecesidadDetalle);
                    if (NecesidadNueva == null)
                    {
                        Mensaje Mensaje = new Mensaje()
                        {
                            Titulo = "Algo salió mal",
                            Contenido = "La Necesidad no pudo guardarse. Para más información consulte al administrador del sistema",
                            Tipo = TipoMensaje.ALERTA
                        };
                        litMensaje.Text = Disenio.GenerarMensaje(Mensaje);
                        return;
                    }

                    Response.Redirect(ResolveUrl("~/App/Area/RegistroNecesidadDetalle.aspx?id=" + clave));
                }
                else
                {
                    NecesidadDetalle NecesidadDetalle = new NecesidadDetalle();
                    NecesidadDetalle.Volumen = Convert.ToDouble(txtVolumen.Text);
                    NecesidadDetalle.PrecioUnitario = Convert.ToDouble(txtPrecioU.Text);
                    NecesidadDetalle.ClaveNecesidad = Convert.ToInt32(clave);
                    NecesidadDetalle.ClaveConcepto = Convert.ToInt32(cmbConcepto.SelectedValue);
                    if (!(cmbTipoConcepto.SelectedValue == ""))
                        NecesidadDetalle.ClaveTipoConcepto = Convert.ToInt32(cmbTipoConcepto.SelectedValue);
                    else NecesidadDetalle.ClaveTipoConcepto = null;


                    NecesidadDetalle NecesidadNueva = NecesidadDetalleDAO.Insertar(NecesidadDetalle);
                    if (NecesidadNueva == null)
                    {
                        Mensaje Mensaje = new Mensaje()
                        {
                            Titulo = "Algo salió mal",
                            Contenido = "La Necesidad no pudo guardarse. Para más información consulte al administrador del sistema",
                            Tipo = TipoMensaje.ALERTA
                        };
                        litMensaje.Text = Disenio.GenerarMensaje(Mensaje);
                        return;
                    }

                    Response.Redirect(ResolveUrl("~/App/Area/RegistroNecesidadDetalle.aspx?id=" + clave));
                }



            }
            catch (Exception Ex)
            {
                Mensaje Mensaje = new Mensaje()
                {
                    Titulo = "Error al guardar ejercicio",
                    Contenido = Ex.Message,
                    Tipo = TipoMensaje.ERROR
                };

                litMensaje.Text = Disenio.GenerarMensaje(Mensaje);
            }

        }
示例#10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Usuario = Utilerias.FiltrarUsuario(this);
            ChecarMensaje();

            if (!IsPostBack)
            {
                Periodo Periodo = Usuario.ConsultarPeriodoActual();
                PresupuestosZona   = Usuario.Zona.Rellenar().Presupuestos;
                periodoActual.Text = Periodo.Descripcion.ToString();


                List <PresupuestoZona> presupuestos = Usuario.Rellenar().Zona.Rellenar().Presupuestos;
                foreach (PresupuestoZona p in presupuestos)
                {
                    if (p.Rellenar().PresupuestoDivisional.Rellenar().Periodo.EsActivo)
                    {
                        prepZona.Text = p.Monto.ToString();
                        prepdZona     = p;
                        prepD         = prepdZona.PresupuestoDisponible();
                        break;
                    }
                }

                List <Modelo.Area> AreasZona = new List <Modelo.Area>();
                AreasZona = Usuario.Zona.Rellenar().Areas;
                foreach (Modelo.Area a in AreasZona)
                {
                    List <Necesidad> aux = NecesidadDAO.Listar().Where(p => p.ClaveArea == a.Clave && p.ClaveEstatus == 4).ToList();
                    if (aux.Count != 0)
                    {
                        foreach (Necesidad z in aux.Where(p => p.ClavePeriodo == Periodo.Clave))
                        {
                            NecesidadesZona.Add(z);
                        }
                    }
                }
                foreach (Necesidad n in NecesidadesZona)
                {
                    List <NecesidadDetalle> aux = NecesidadDetalleDAO.Listar().Where(p => p.ClaveNecesidad == n.Clave).ToList();
                    if (aux.Count != 0)
                    {
                        double totales = 0;
                        foreach (NecesidadDetalle a in aux)
                        {
                            double totalArea = a.Volumen * a.PrecioUnitario;
                            totales += totalArea;
                            NecesidadZonaDetalle.Add(a);
                        }
                        totalesNecesidades.Add(totales);
                    }
                }


                PresupuestosZona = Usuario.Zona.Rellenar().Presupuestos;
                Areas            = Usuario.Zona.Rellenar().Areas;


                foreach (PresupuestoZona p in PresupuestosZona)
                {
                    if (p.Rellenar().PresupuestoDivisional.Rellenar().Periodo.EsActivo)
                    {
                        PresupuestoZonaActivo = p;
                        break;
                    }
                }
                string Filas = "";
                foreach (Modelo.Area a in Areas)
                {
                    List <PresupuestoArea> aux = a.Rellenar().Presupuestos.Where(p => p.ClavePresupuestoZona == PresupuestoZonaActivo.Clave).ToList();
                    PresupuestosAreas.Add(aux[0]);
                }

                if (PresupuestoZonaActivo.Rellenar().PresupuestoDivisional.Rellenar().Periodo.EsActivo)
                {
                    int x       = 0;
                    int bandera = totalesNecesidades.Count;
                    foreach (Modelo.PresupuestoArea r in PresupuestosAreas)
                    {
                        r.Rellenar();
                        Periodo periodo = r.PresupuestoZona.Rellenar().PresupuestoDivisional.Rellenar().Periodo;
                        if (x < bandera)
                        {
                            Filas += Disenio.GenerarFilaTabla(r.Area.Nombre,
                                                              "$ " + totalesNecesidades[x].ToString(),
                                                              "$ " + r.Monto.ToString(),
                                                              "<div class='input-group'>" +
                                                              "<span class='input-group-addon'><i class='fa fa-dollar'></i></span>" +
                                                              "<input value ='" + r.Monto + "'" + " name='prepz" + r.Clave + "'" + " id = 'txtprep'" + "type='text' class='form-control' value='' onkeyup='presupuesto(this);'/>" +
                                                              "</div>");
                            id++;
                            x++;
                        }
                        else
                        {
                            Filas += Disenio.GenerarFilaTabla(r.Area.Nombre,
                                                              "$ 0",
                                                              "$ " + r.Monto.ToString(),
                                                              "<div class='input-group'>" +
                                                              "<span class='input-group-addon'><i class='fa fa-dollar'></i></span>" +
                                                              "<input value ='" + r.Monto + "'" + " name='prepz" + r.Clave + "'" + " id = 'txtprep'" + "type='text' class='form-control' value='' onkeyup='presupuesto(this);'/>" +
                                                              "</div>");
                            id++;
                            x++;
                        }
                    }
                }
                litTBody.Text = Filas;
            }
        }
示例#11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Usuario = Utilerias.FiltrarUsuario(this);

            if (!IsPostBack)
            {
                Periodo Periodo = Usuario.ConsultarPeriodoActual();
                periodoActual.Text = Periodo.Descripcion.ToString();


                PresupuestosZona = Usuario.Rellenar().Zona.Rellenar().Presupuestos;
                foreach (PresupuestoZona p in PresupuestosZona)
                {
                    if (p.Rellenar().PresupuestoDivisional.Rellenar().Periodo.EsActivo)
                    {
                        presupuestoDivision.Text = p.Monto.ToString();
                        break;
                    }
                }



                List <Modelo.Area> AreasZona = new List <Modelo.Area>();
                AreasZona = Usuario.Zona.Rellenar().Areas;
                foreach (Modelo.Area a in AreasZona)
                {
                    List <Necesidad> aux = NecesidadDAO.Listar().Where(p => p.ClaveArea == a.Clave && p.ClaveEstatus == 4 && p.ClavePeriodo == Periodo.Clave).ToList();
                    if (aux.Count != 0 && aux.Count < 1)
                    {
                        NecesidadesZona.Add(aux[0]);
                    }
                    else if (aux.Count != 0)
                    {
                        foreach (Necesidad z in aux)
                        {
                            NecesidadesZona.Add(z);
                        }
                    }
                }
                foreach (Necesidad n in NecesidadesZona)
                {
                    List <NecesidadDetalle> aux = NecesidadDetalleDAO.Listar().Where(p => p.ClaveNecesidad == n.Clave).ToList();
                    if (aux.Count != 0 && aux.Count < 1)
                    {
                        NecesidadZonaDetalle.Add(aux[0]);

                        double totales = 0;
                        foreach (NecesidadDetalle a in aux)
                        {
                            double totalArea = a.Volumen * a.PrecioUnitario;
                            totales += totalArea;
                            NecesidadZonaDetalle.Add(a);
                        }
                        totalesNecesidades.Add(totales);
                    }
                    else if (aux.Count != 0)
                    {
                        double totales = 0;
                        foreach (NecesidadDetalle a in aux)
                        {
                            double totalArea = a.Volumen * a.PrecioUnitario;
                            totales += totalArea;
                            NecesidadZonaDetalle.Add(a);
                        }
                        totalesNecesidades.Add(totales);
                    }
                }

                double total = 0;
                foreach (NecesidadDetalle n in NecesidadZonaDetalle)
                {
                    double totalArea = 0;
                    totalArea = n.Volumen * n.PrecioUnitario;
                    total    += totalArea;
                }
                necesidadTotal.Text = total.ToString();

                string Filas = "";
                int    x     = 0;
                foreach (Modelo.Necesidad r in NecesidadesZona)
                {
                    r.Rellenar();
                    string url = ResolveUrl("~/App/Zona/NecesidadesArea.aspx?id=" + r.Clave);
                    Filas += Disenio.GenerarFilaTabla(r.Area.Rellenar().Nombre,
                                                      "$ " + totalesNecesidades[x].ToString(),
                                                      "<a href='" + url + "' class='btn btn-default btn-block'>Detalles</a>");
                    x++;
                }
                litTBody.Text = Filas;
            }
        }