Пример #1
0
        private void CargarGrilladeNc()
        {
            usuarioentidad = (UsuarioEntidad)Session["Usuario"];

            string[] unosPermisosTest = new string[] { "NCredito" };
            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 == 5 || comprobante.miTipoComprobante.IdTipoComprobante == 6 || comprobante.miTipoComprobante.IdTipoComprobante == 7)
                    {
                        NCs.Add(comprobante);
                    }
                }
            }

            if (NCs.Count == 0)
            {
                sinnc.InnerHtml = "<strong>Usted no tiene notas de credito disponibles para consultar.</strong>";
            }
            else
            {
                contenedorsinnc.Visible = false;
            }

            for (int i = 0; i < NCs.Count; i++)
            {
                NCsDTO NCAMostrar = new NCsDTO();
                //  NCAMostrar.NroComprobante = NCs[i].NroComprobante;
                NCAMostrar.FechaComprobante = NCs[i].FechaComprobante;
                NCAMostrar.TipoComprobante  = ComprobanteBLL.TipoComprobanteSelectById(NCs[i].miTipoComprobante.IdTipoComprobante).DescripTipoComprobante;
                char   TipoNCLetra         = NCAMostrar.TipoComprobante[NCAMostrar.TipoComprobante.Length - 1];
                string Sucursal4caracteres = "";
                Sucursal4caracteres = NCs[i].miSucursal.IdSucursal.ToString("D4");
                string NumeroNC8Caracteres = "";
                NumeroNC8Caracteres       = NCs[i].NroComprobante.ToString("D8");
                NCAMostrar.NroComprobante = "NC" + TipoNCLetra + "-" + Sucursal4caracteres + "-" + NumeroNC8Caracteres;

                List <ComprobanteDetalleEntidad> Detalles = new List <ComprobanteDetalleEntidad>();

                Detalles         = ComprobanteBLL.DetallesSelectByComprobante(NCs[i].NroComprobante, NCs[i].miSucursal.IdSucursal, NCs[i].miTipoComprobante.IdTipoComprobante);
                NCAMostrar.Total = MontoTotalPorNC(Detalles);
                NotasDeCreditoAMostrar.Add(NCAMostrar);
            }

            grilladenc.DataSource  = null;
            NotasDeCreditoAMostrar = (List <NCsDTO>)NotasDeCreditoAMostrar.OrderByDescending(X => X.FechaComprobante).ToList();
            grilladenc.DataSource  = NotasDeCreditoAMostrar;
            grilladenc.DataBind();
        }
Пример #2
0
        protected void btnBuscarCliente_Click(object sender, EventArgs e)
        {
            List <PedidoEntidad> Pedidos = new List <PedidoEntidad>();

            Pedidos = pedidoCore.SelectAllByCUIT(usuarioentidad.CUIT);

            List <ComprobanteEntidad> NCsDelCliente         = new List <ComprobanteEntidad>();
            List <NCsDTO>             NCsAMostrarDelCliente = new List <NCsDTO>();

            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 == 5 || comprobante.miTipoComprobante.IdTipoComprobante == 6 || comprobante.miTipoComprobante.IdTipoComprobante == 7)
                        {
                            NCsDelCliente.Add(comprobante);
                        }
                    }
                }
            }

            if (NCsDelCliente.Count == 0)
            {
                contenedorsinnc.Visible = true;
                sinnc.InnerHtml         = "<strong>Este cliente no tiene notas de credito disponibles para consultar.</strong>";
            }
            else
            {
                contenedorsinnc.Visible = false;
            }

            for (int i = 0; i < NCsDelCliente.Count; i++)
            {
                NCsDTO NCAMostrar = new NCsDTO();
                //  NCAMostrar.NroComprobante = NCs[i].NroComprobante;
                NCAMostrar.FechaComprobante = NCs[i].FechaComprobante;
                NCAMostrar.TipoComprobante  = ComprobanteBLL.TipoComprobanteSelectById(NCs[i].miTipoComprobante.IdTipoComprobante).DescripTipoComprobante;
                char   TipoNCLetra         = NCAMostrar.TipoComprobante[NCAMostrar.TipoComprobante.Length - 1];
                string Sucursal4caracteres = "";
                Sucursal4caracteres = NCs[i].miSucursal.IdSucursal.ToString("D4");
                string NumeroNC8Caracteres = "";
                NumeroNC8Caracteres       = NCs[i].NroComprobante.ToString("D8");
                NCAMostrar.NroComprobante = "NC" + TipoNCLetra + "-" + Sucursal4caracteres + "-" + NumeroNC8Caracteres;

                List <ComprobanteDetalleEntidad> Detalles = new List <ComprobanteDetalleEntidad>();

                Detalles         = ComprobanteBLL.DetallesSelectByComprobante(NCs[i].NroComprobante, NCs[i].miSucursal.IdSucursal, NCs[i].miTipoComprobante.IdTipoComprobante);
                NCAMostrar.Total = MontoTotalPorNC(Detalles);
                NCsAMostrarDelCliente.Add(NCAMostrar);
            }

            grilladenc.DataSource          = NCsAMostrarDelCliente;
            grilladenc.AutoGenerateColumns = false;
            grilladenc.DataBind();
        }