protected void llenarGrid(DateTime desde, DateTime hasta, string estado, string filtro)
        {
            this.grw_facturas.DataBindings.Clear();
            grw_facturas.Columns.Clear();
            string            mensaje = "";
            FacturaCabeceraTR tran    = new FacturaCabeceraTR();
            DataTable         datos   = tran.consultarFacturas(ref mensaje, desde, hasta, estado, filtro);

            if (datos != null)
            {
                this.grw_facturas.DataSource = datos;
                int ancho = this.grw_facturas.Width;

                this.grw_facturas.Columns["adicional1"].Visible = false;
                this.grw_facturas.Columns["adicional2"].Visible = false;

                if (this.adicionales != null)
                {
                    int valor = 0;
                    foreach (Object[] adicional in this.adicionales)
                    {
                        int    id     = Convert.ToInt32(adicional[0]);
                        string nombre = adicional[1].ToString();
                        if (id == 1)
                        {
                            this.grw_facturas.Columns["adicional1"].Width = Convert.ToInt16(ancho * 0.10);
                            valor += Convert.ToInt16(ancho * 0.10);
                            this.grw_facturas.Columns["adicional1"].HeaderText = nombre;
                            this.grw_facturas.Columns["adicional1"].Visible    = true;
                        }
                        else
                        {
                            this.grw_facturas.Columns["adicional2"].Width = Convert.ToInt16(ancho * 0.10);
                            valor += Convert.ToInt16(ancho * 0.10);
                            this.grw_facturas.Columns["adicional2"].HeaderText = nombre;
                            this.grw_facturas.Columns["adicional2"].Visible    = true;
                        }
                    }

                    ancho -= valor;
                }
                this.grw_facturas.Columns["id"].Visible           = false;
                this.grw_facturas.Columns["Fecha"].Width          = Convert.ToInt16(ancho * 0.20);
                this.grw_facturas.Columns["Documento"].Width      = Convert.ToInt16(ancho * 0.20);
                this.grw_facturas.Columns["Identificación"].Width = Convert.ToInt16(ancho * 0.10);
                this.grw_facturas.Columns["Cliente"].Width        = Convert.ToInt16(ancho * 0.20);
                //this.grw_facturas.Columns["Vendedor"].Width = Convert.ToInt16(ancho * 0.15);
                this.grw_facturas.Columns["Vendedor"].Visible = false;
                this.grw_facturas.Columns["Monto"].Width      = Convert.ToInt16(ancho * 0.10);
                this.grw_facturas.Columns["Estado"].Width     = Convert.ToInt16(ancho * 0.20);
                this.grw_facturas.Columns["anular"].Visible   = false;
            }
            else
            {
                Mensaje.error(mensaje);
            }
        }
예제 #2
0
        private void buscarDocumento(int idDocumento)
        {
            this.grw_productos.Rows.Clear();
            this.documento          = FacturaCabeceraTR.consultarFactura(idDocumento);
            this.txt_documento.Text = this.documento.Numero_documento;
            List <String[]> detalles = FacturaDetalleTR.consultarFacturaDetalle(this.documento.Id);

            if (detalles != null)
            {
                int i = 0;
                foreach (String[] detalle in detalles)
                {
                    this.grw_productos.Rows.Add();
                    this.grw_productos.Rows[i].Cells["id"].Value       = detalle[8];
                    this.grw_productos.Rows[i].Cells["nombre"].Value   = detalle[1];
                    this.grw_productos.Rows[i].Cells["cantidad"].Value = detalle[2];
                    this.grw_productos.Rows[i].Cells["unidad"].Value   = detalle[3];
                    i += 1;
                }
            }
        }
        private void frm_facturasPendientes_Load(object sender, EventArgs e)
        {
            int posX = ParametroTR.consultarIntXNombre("formularioPendientesX");
            int posY = ParametroTR.consultarIntXNombre("formularioPendientesY");

            if (posX != -1 && posY != -1)
            {
                this.Left = posX;
                this.Top  = posY;
            }


            List <object[]> facturas = FacturaCabeceraTR.consultarFacturasPendientes(this.adicionalPendiente);

            if (facturas != null)
            {
                foreach (object[] dato in facturas)
                {
                    this.agregarPendiente(dato[0].ToString(), dato[1].ToString());
                }
            }
        }