Example #1
0
        private void btnReimprimir_Click(object sender, EventArgs e)
        {
            LogicaGo logica        = new LogicaGo();
            var      confirmResult = MessageBox.Show("Desea Imprimir la factura?",
                                                     "Confirmar Impresión!!",
                                                     MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                if (factura == null)
                {
                    factura = logica.obtenerFactura(lbFacturas.SelectedValue.ToString());
                }
                else
                {
                    LocalReport reporte = new LocalReport();
                    //reporte.ReportPath = @"..\..\rptFactura.rdlc";
                    reporte.ReportPath = ConfigurationManager.AppSettings["rutaReporteFactura"];
                    ReportParameter[] parameters = new ReportParameter[2];

                    parameters[0] = new ReportParameter("nombre", factura.Nombre);
                    parameters[1] = new ReportParameter("facturaId", factura.IdFactura);
                    reporte.SetParameters(parameters);
                    ReportDataSource rds = new ReportDataSource("dsProductosVentas", ConvertToDataTable(listaProductosVenta));
                    reporte.DataSources.Add(rds);
                    Export(reporte);
                    Print();
                }
            }
        }
Example #2
0
        private void lbFacturas_SelectedIndexChanged(object sender, EventArgs e)
        {
            LogicaGo logica = new LogicaGo();

            lblFacturaId.Text = "Factura Numero: " + lbFacturas.SelectedValue.ToString();
            factura           = logica.obtenerFactura(lbFacturas.SelectedValue.ToString());
            if (factura != null)
            {
                lblComprador.Text = factura.Nombre;
                lblCelular.Text   = "Celular: " + factura.Celular;
                lblDireccion.Text = "Dirección: " + factura.Direccion;
                Decimal value;
                if (Decimal.TryParse(factura.ValorBruto.ToString(), out value))
                {
                    lblValorBruto.Text = "Valor Bruto: " + String.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:C2}", value);
                }
                else
                {
                    lblValorBruto.Text = "Valor Bruto: $0";
                }
                if (Decimal.TryParse(factura.Iva.ToString(), out value))
                {
                    lblIVA.Text = "IVA: " + String.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:C2}", value);
                }
                else
                {
                    lblIVA.Text = "IVA: $0";
                }
                if (Decimal.TryParse(factura.ValorTotal.ToString(), out value))
                {
                    lblTotal.Text = "Total: " + String.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:C2}", value);
                }
                else
                {
                    lblTotal.Text = "Total: $0";
                }
                lblFecha.Text           = "Fecha: " + factura.Fecha;
                lblUsuario.Text         = "Usuario: " + factura.Usuario;
                datos                   = logica.obteverProductosVenta(lbFacturas.SelectedValue.ToString());
                dgvProductos.DataSource = datos;
                listaProductosVenta     = new List <ProductoVenta>();
                ProductoVenta pv;
                foreach (DataRow dt in datos.Rows)
                {
                    pv          = new ProductoVenta();
                    pv.Nombre   = dt["nombre"].ToString();
                    pv.Cantidad = Convert.ToDecimal(dt["cantidad"].ToString());
                    pv.Total    = Convert.ToDecimal(dt["valor_total"].ToString());
                    listaProductosVenta.Add(pv);
                }
                btnReimprimir.Enabled = true;
            }
        }