private void btnReporte_Click(object sender, EventArgs e)
        {
            string         ruta = Application.StartupPath + "\\CobrarVentas.rpt";
            ReportDocument rpt  = new ReportDocument();


            dsVentas dsVentaCobrar = new dsVentas();

            dsVentaCobrar.EnforceConstraints = false;

            dsVentasTableAdapters.ClientesTableAdapter     clienteTableAdap     = new dsVentasTableAdapters.ClientesTableAdapter();
            dsVentasTableAdapters.CondPagoTableAdapter     condPagoTableAdap    = new dsVentasTableAdapters.CondPagoTableAdapter();
            dsVentasTableAdapters.DetalleVentaTableAdapter detVentaTableAdap    = new dsVentasTableAdapters.DetalleVentaTableAdapter();
            dsVentasTableAdapters.AbonarVentaTableAdapter  abonarVentaTableAdap = new dsVentasTableAdapters.AbonarVentaTableAdapter();
            dsVentasTableAdapters.VendedoresTableAdapter   vendedorTableAdap    = new dsVentasTableAdapters.VendedoresTableAdapter();
            dsVentasTableAdapters.VentasTableAdapter       ventaTableAdap       = new dsVentasTableAdapters.VentasTableAdapter();
            dsVentasTableAdapters.ArticulosTableAdapter    articuloTableAdap    = new dsVentasTableAdapters.ArticulosTableAdapter();
            dsVentasTableAdapters.MarcasTableAdapter       marcasTableAdap      = new dsVentasTableAdapters.MarcasTableAdapter();

            // llenos los tabla adapter

            clienteTableAdap.Fill(dsVentaCobrar.Clientes);
            condPagoTableAdap.Fill(dsVentaCobrar.CondPago);
            abonarVentaTableAdap.Fill(dsVentaCobrar.AbonarVenta);
            vendedorTableAdap.Fill(dsVentaCobrar.Vendedores);
            detVentaTableAdap.Fill(dsVentaCobrar.DetalleVenta);
            articuloTableAdap.Fill(dsVentaCobrar.Articulos);
            marcasTableAdap.Fill(dsVentaCobrar.Marcas);



            foreach (Entidades.E_Venta venta in this._listVenta)
            {
                dsVentas.VentasRow rowVenta = dsVentaCobrar.Ventas.NewVentasRow();
                rowVenta.codVenta    = venta.codVenta;
                rowVenta.CUIT        = venta.cuit;
                rowVenta.descuento   = venta.descuento;
                rowVenta.idCliente   = venta.cliente.idCliente;
                rowVenta.idVendedor  = venta.vendedor.idVendedor;
                rowVenta.idCondPago  = venta.condPago.idCondPago;
                rowVenta.precioTotal = venta.precioTotal;
                rowVenta.observacion = venta.observacion;
                rowVenta.recargo     = venta.recargo;
                rowVenta.fecVenta    = (DateTime)venta.fecha;

                dsVentaCobrar.Ventas.AddVentasRow(rowVenta);
            }
            ventaTableAdap.Fill(dsVentaCobrar.Ventas);

            rpt.Load(ruta);
            rpt.SetDataSource(dsVentaCobrar);


            frmRptVisor frmVerRpt = new frmRptVisor(rpt);

            frmVerRpt.Show();
        }
Exemple #2
0
        //Metodos
        private void generarRemito(Int64 codVenta)
        {
            try
            {
                string         ruta = Application.StartupPath + "\\crRemitoVenta.rpt";
                ReportDocument rpt  = new ReportDocument();

                dsVentas dsPintureriaVenta = new dsVentas();

                dsPintureriaVenta.EnforceConstraints = false;
                dsVentasTableAdapters.ClientesTableAdapter     clienteTableAdap     = new dsVentasTableAdapters.ClientesTableAdapter();
                dsVentasTableAdapters.CondPagoTableAdapter     condPagoTableAdap    = new dsVentasTableAdapters.CondPagoTableAdapter();
                dsVentasTableAdapters.DetalleVentaTableAdapter detVentaTableAdap    = new dsVentasTableAdapters.DetalleVentaTableAdapter();
                dsVentasTableAdapters.AbonarVentaTableAdapter  abonarVentaTableAdap = new dsVentasTableAdapters.AbonarVentaTableAdapter();
                dsVentasTableAdapters.VendedoresTableAdapter   vendedorTableAdap    = new dsVentasTableAdapters.VendedoresTableAdapter();
                dsVentasTableAdapters.VentasTableAdapter       ventaTableAdap       = new dsVentasTableAdapters.VentasTableAdapter();
                dsVentasTableAdapters.ArticulosTableAdapter    articuloTableAdap    = new dsVentasTableAdapters.ArticulosTableAdapter();
                dsVentasTableAdapters.MarcasTableAdapter       marcasTableAdap      = new dsVentasTableAdapters.MarcasTableAdapter();

                // llenos los tabla adapter

                clienteTableAdap.Fill(dsPintureriaVenta.Clientes);
                condPagoTableAdap.Fill(dsPintureriaVenta.CondPago);
                abonarVentaTableAdap.Fill(dsPintureriaVenta.AbonarVenta);
                vendedorTableAdap.Fill(dsPintureriaVenta.Vendedores);
                detVentaTableAdap.Fill(dsPintureriaVenta.DetalleVenta);
                articuloTableAdap.Fill(dsPintureriaVenta.Articulos);
                marcasTableAdap.Fill(dsPintureriaVenta.Marcas);

                ventaTableAdap.FillByGetOneVenta(dsPintureriaVenta.Ventas, codVenta);

                rpt.Load(ruta);
                rpt.SetDataSource(dsPintureriaVenta);


                frmRptVisor frmVerRpt = new frmRptVisor(rpt);
                frmVerRpt.Show();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }