예제 #1
0
        private void CargarGrilladeNd()
        {
            usuarioentidad = (UsuarioEntidad)Session["Usuario"];

            string[] unosPermisosTest = new string[] { "NDebito" };
            if (usuarioentidad == null || !this.Master.Autenticar(unosPermisosTest))
            {
                Response.Redirect("/Areas/Public/Forms/Home.aspx");
            }

            List <PedidoEntidad> Pedidos = new List <PedidoEntidad>();

            Pedidos = pedidoCore.SelectAllByCUIT(usuarioentidad.CUIT);

            foreach (var pedido in Pedidos)
            {
                var Comprobantes = ComprobanteBLL.ComprobanteSelectByIdPedido(pedido.IdPedido);
                foreach (var comprobante in Comprobantes)
                {
                    if (comprobante.miTipoComprobante.IdTipoComprobante == 8 || comprobante.miTipoComprobante.IdTipoComprobante == 9 || comprobante.miTipoComprobante.IdTipoComprobante == 10)
                    {
                        NDs.Add(comprobante);
                    }
                }
            }

            if (NDs.Count == 0)
            {
                sinnd.InnerHtml = "<strong>Usted no tiene notas de debito disponibles para consultar.";
            }
            else
            {
                contenedorsinnd.Visible = false;
            }

            for (int i = 0; i < NDs.Count; i++)
            {
                NDsDTO NDAMostrar = new NDsDTO();
                //  NDAMostrar.NroComprobante = NDs[i].NroComprobante;
                NDAMostrar.FechaComprobante = NDs[i].FechaComprobante;
                NDAMostrar.TipoComprobante  = ComprobanteBLL.TipoComprobanteSelectById(NDs[i].miTipoComprobante.IdTipoComprobante).DescripTipoComprobante;
                char   TipoNDLetra         = NDAMostrar.TipoComprobante[NDAMostrar.TipoComprobante.Length - 1];
                string Sucursal4caracteres = "";
                Sucursal4caracteres = NDs[i].miSucursal.IdSucursal.ToString("D4");
                string NumeroND8Caracteres = "";
                NumeroND8Caracteres       = NDs[i].NroComprobante.ToString("D8");
                NDAMostrar.NroComprobante = "ND" + TipoNDLetra + "-" + Sucursal4caracteres + "-" + NumeroND8Caracteres;
                List <ComprobanteDetalleEntidad> Detalles = new List <ComprobanteDetalleEntidad>();

                Detalles         = ComprobanteBLL.DetallesSelectByComprobante(NDs[i].NroComprobante, NDs[i].miSucursal.IdSucursal, NDs[i].miTipoComprobante.IdTipoComprobante);
                NDAMostrar.Total = NDs[i].Ajuste;
                NotasDeDebitoAMostrar.Add(NDAMostrar);
            }

            grilladend.DataSource          = null;
            NotasDeDebitoAMostrar          = (List <NDsDTO>)NotasDeDebitoAMostrar.OrderByDescending(X => X.FechaComprobante).ToList();
            grilladend.DataSource          = NotasDeDebitoAMostrar;
            grilladend.AutoGenerateColumns = false;
            grilladend.DataBind();
        }
예제 #2
0
        protected void btnBuscarCliente_Click(object sender, EventArgs e)
        {
            List <PedidoEntidad> Pedidos = new List <PedidoEntidad>();

            Pedidos = pedidoCore.SelectAllByCUIT(usuarioentidad.CUIT);

            List <ComprobanteEntidad> NDsDelCliente         = new List <ComprobanteEntidad>();
            List <NDsDTO>             NDsAMostrarDelCliente = new List <NDsDTO>();

            foreach (var pedido in Pedidos)
            {
                if (pedido.miUsuario.NombreUsuario == txtClienteBusqueda.Text)
                {
                    var Comprobantes = ComprobanteBLL.ComprobanteSelectByIdPedido(pedido.IdPedido);
                    foreach (var comprobante in Comprobantes)
                    {
                        if (comprobante.miTipoComprobante.IdTipoComprobante == 8 || comprobante.miTipoComprobante.IdTipoComprobante == 9 || comprobante.miTipoComprobante.IdTipoComprobante == 10)
                        {
                            NDsDelCliente.Add(comprobante);
                        }
                    }
                }
            }

            if (NDsDelCliente.Count == 0)
            {
                contenedorsinnd.Visible = true;
                sinnd.InnerHtml         = "<strong>Usted no tiene notas de debito disponibles para consultar.";
            }
            else
            {
                contenedorsinnd.Visible = false;
            }

            for (int i = 0; i < NDsDelCliente.Count; i++)
            {
                NDsDTO NDAMostrar = new NDsDTO();
                //  NDAMostrar.NroComprobante = NDs[i].NroComprobante;
                NDAMostrar.FechaComprobante = NDs[i].FechaComprobante;
                NDAMostrar.TipoComprobante  = ComprobanteBLL.TipoComprobanteSelectById(NDs[i].miTipoComprobante.IdTipoComprobante).DescripTipoComprobante;
                char   TipoNDLetra         = NDAMostrar.TipoComprobante[NDAMostrar.TipoComprobante.Length - 1];
                string Sucursal4caracteres = "";
                Sucursal4caracteres = NDs[i].miSucursal.IdSucursal.ToString("D4");
                string NumeroND8Caracteres = "";
                NumeroND8Caracteres       = NDs[i].NroComprobante.ToString("D8");
                NDAMostrar.NroComprobante = "ND" + TipoNDLetra + "-" + Sucursal4caracteres + "-" + NumeroND8Caracteres;
                List <ComprobanteDetalleEntidad> Detalles = new List <ComprobanteDetalleEntidad>();

                Detalles         = ComprobanteBLL.DetallesSelectByComprobante(NDs[i].NroComprobante, NDs[i].miSucursal.IdSucursal, NDs[i].miTipoComprobante.IdTipoComprobante);
                NDAMostrar.Total = NDsDelCliente[i].Ajuste;
                NDsAMostrarDelCliente.Add(NDAMostrar);
            }

            grilladend.DataSource          = NDsAMostrarDelCliente;
            grilladend.AutoGenerateColumns = false;
            grilladend.DataBind();
        }