private void buttonReport_Click(object sender, EventArgs e)
        {
            string datosEmpleado         = "";
            string motivo                = "";
            ClaseCapaDatosFerreteria cpd = new ClaseCapaDatosFerreteria();
            ClaseBitacoraFerreteria  cbf = new ClaseBitacoraFerreteria();

            try
            {
                datosEmpleado = cpd.ExtraerCodigo3("CONCAT(Apellidos,',',Nombre) AS ", "NombreC", "" +
                                                   " bd_ferreteria.tbl_Persona, bd_ferreteria.tbl_usuario, bd_ferreteria.tbl_Empleado",
                                                   "tbl_Empleado.status ", " 1 AND tbl_Persona.status = 1 " +
                                                   "AND tbl_Persona.id = tbl_Empleado.tbl_Persona_id " +
                                                   "AND tbl_usuario.tbl_empleado_DPI = tbl_empleado.DPI " +
                                                   "AND tbl_usuario.id = " + cbf.GetUserCodeForLog()
                                                   );
                motivo = cpd.ExtraerCodigo2("Motivo", "tbl_devolucionencabezado",
                                            "id", labelNoDevolucion.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            ///
            ReporteadorFerreteria.REPORTS.ReportDevolucionCotizacionDetalle objRpt = new ReporteadorFerreteria.REPORTS.ReportDevolucionCotizacionDetalle();
            ReporteadorFerreteria.DATASETS.DataSetP ds1 = new ReporteadorFerreteria.DATASETS.DataSetP();
            foreach (DataGridViewRow row in dtg_ProductosDetalle.Rows)
            {
                ReporteadorFerreteria.DATASETS.DataSetP.tbl_Encabezado_DetalleRow rowDetalles = ds1.tbl_Encabezado_Detalle.Newtbl_Encabezado_DetalleRow();
                rowDetalles.id       = Convert.ToString(row.Cells["CODIGO"].Value);
                rowDetalles.Producto = Convert.ToString(row.Cells["PRODUCTO"].Value);
                rowDetalles.Cantidad = Convert.ToString(row.Cells["CANTIDAD"].Value);

                ds1.tbl_Encabezado_Detalle.Addtbl_Encabezado_DetalleRow(rowDetalles);
            }
            objRpt.SetDataSource(ds1);
            TextObject txtObject            = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextBy"];
            TextObject txtObjectDate        = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextDate"];
            TextObject txtObjectType        = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextType"];
            TextObject txtObjectObjeto      = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextObjeto"];
            TextObject txtObjectNo          = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextNoOrden"];
            TextObject txtObjectFEmision    = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextFEmision"];
            TextObject txtObjectbjetivo     = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextObjetivo"];
            TextObject txtObjectMotivo      = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextMotivoDetalle"];
            TextObject txtObjectMotivoTitle = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextMotivoTitle"];

            txtObjectDate.Text     = DateTime.Now.ToLongTimeString();
            txtObject.Text         = datosEmpleado;
            txtObjectType.Text     = "DEVOLUCIONES";
            txtObjectObjeto.Text   = "Cliente:";
            txtObjectMotivo.Text   = motivo;
            txtObjectNo.Text       = labelNoDevolucion.Text;
            txtObjectFEmision.Text = labelFechaEntrega.Text;
            txtObjectbjetivo.Text  = labelCliente.Text;

            UI_Visualizador form = new UI_Visualizador();

            form.crystalReportViewerGlobal.ReportSource = objRpt;
            form.ShowDialog();
        }
Пример #2
0
        private void buttonGenerarReporte_Click(object sender, EventArgs e)
        {
            string datosEmpleado         = "";
            ClaseCapaDatosFerreteria cpd = new ClaseCapaDatosFerreteria();
            ClaseBitacoraFerreteria  cbf = new ClaseBitacoraFerreteria();

            try
            {
                datosEmpleado = cpd.ExtraerCodigo3("CONCAT(Apellidos,',',Nombre) AS ", "NombreC", "" +
                                                   " bd_ferreteria.tbl_Persona, bd_ferreteria.tbl_usuario, bd_ferreteria.tbl_Empleado",
                                                   "tbl_Empleado.status ", " 1 AND tbl_Persona.status = 1 " +
                                                   "AND tbl_Persona.id = tbl_Empleado.tbl_Persona_id " +
                                                   "AND tbl_usuario.tbl_empleado_DPI = tbl_empleado.DPI " +
                                                   "AND tbl_usuario.id = " + cbf.GetUserCodeForLog()
                                                   );
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            ///
            ReporteadorFerreteria.REPORTS.ReportProductos objRpt = new ReporteadorFerreteria.REPORTS.ReportProductos();
            ReporteadorFerreteria.DATASETS.DataSetP       ds1    = new ReporteadorFerreteria.DATASETS.DataSetP();
            foreach (DataGridViewRow row in dtg_Productos.Rows)
            {
                ReporteadorFerreteria.DATASETS.DataSetP.tbl_productoRow rowProducto = ds1.tbl_producto.Newtbl_productoRow();
                rowProducto.id           = Convert.ToString(row.Cells["id"].Value);
                rowProducto.Nombre       = Convert.ToString(row.Cells["Nombre"].Value);
                rowProducto.PrecioCompra = Convert.ToString(row.Cells["PrecioCompra"].Value);
                rowProducto.PrecioVenta  = Convert.ToString(row.Cells["PrecioVenta"].Value);
                rowProducto.Material     = Convert.ToString(row.Cells["Material"].Value);
                rowProducto.Marca        = Convert.ToString(row.Cells["Marca"].Value);
                rowProducto.Color        = Convert.ToString(row.Cells["Color"].Value);
                rowProducto.Cantidad     = Convert.ToString(row.Cells["Cantidad"].Value);
                rowProducto.Bodega       = Convert.ToString(row.Cells["Bodega"].Value);

                ds1.tbl_producto.Addtbl_productoRow(rowProducto);
            }
            objRpt.SetDataSource(ds1);
            TextObject txtObject     = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextBy"];
            TextObject txtObjectDate = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextDate"];

            txtObjectDate.Text = DateTime.Now.ToLongTimeString();
            txtObject.Text     = datosEmpleado;
            UI_Visualizador form = new UI_Visualizador();

            form.crystalReportViewerGlobal.ReportSource = objRpt;
            form.ShowDialog();
        }
Пример #3
0
        private void buttonGenerarReporte_Click(object sender, EventArgs e)
        {
            string datosEmpleado         = "";
            ClaseCapaDatosFerreteria cpd = new ClaseCapaDatosFerreteria();
            ClaseBitacoraFerreteria  cbf = new ClaseBitacoraFerreteria();

            try
            {
                datosEmpleado = cpd.ExtraerCodigo3("CONCAT(Apellidos,',',Nombre) AS ", "NombreC", "" +
                                                   " bd_ferreteria.tbl_Persona, bd_ferreteria.tbl_usuario, bd_ferreteria.tbl_Empleado",
                                                   "tbl_Empleado.status ", " 1 AND tbl_Persona.status = 1 " +
                                                   "AND tbl_Persona.id = tbl_Empleado.tbl_Persona_id " +
                                                   "AND tbl_usuario.tbl_empleado_DPI = tbl_empleado.DPI " +
                                                   "AND tbl_usuario.id = " + cbf.GetUserCodeForLog()
                                                   );
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            ///
            ReporteadorFerreteria.REPORTS.ReportDevoluciones objRpt = new ReporteadorFerreteria.REPORTS.ReportDevoluciones();
            ReporteadorFerreteria.DATASETS.DataSetP          ds1    = new ReporteadorFerreteria.DATASETS.DataSetP();
            foreach (DataGridViewRow row in DataGridViewDetalles.Rows)
            {
                ReporteadorFerreteria.DATASETS.DataSetP.tbl_ReporteDevolucionesRow rowDevoluciones = ds1.tbl_ReporteDevoluciones.Newtbl_ReporteDevolucionesRow();
                rowDevoluciones.id           = Convert.ToString(row.Cells["ID"].Value);
                rowDevoluciones.FechaEmision = Convert.ToString(row.Cells["FECHA EMISION"].Value);
                rowDevoluciones.Objetivo     = Convert.ToString(row.Cells["CLIENTE"].Value);
                rowDevoluciones.Aprobado     = Convert.ToString(row.Cells["APROBADO"].Value);
                rowDevoluciones.Motivo       = Convert.ToString(row.Cells["MOTIVO"].Value);

                ds1.tbl_ReporteDevoluciones.Addtbl_ReporteDevolucionesRow(rowDevoluciones);
            }
            objRpt.SetDataSource(ds1);
            TextObject txtObject     = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextBy"];
            TextObject txtObjectDate = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextDate"];
            TextObject txtObjectType = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextType"];

            txtObjectDate.Text = DateTime.Now.ToLongTimeString();
            txtObject.Text     = datosEmpleado;
            UI_Visualizador form = new UI_Visualizador();

            form.crystalReportViewerGlobal.ReportSource = objRpt;
            form.ShowDialog();
        }
Пример #4
0
        private void buttonGenerarReporte_Click(object sender, EventArgs e)
        {
            string datosEmpleado         = "";
            ClaseCapaDatosFerreteria cpd = new ClaseCapaDatosFerreteria();
            ClaseBitacoraFerreteria  cbf = new ClaseBitacoraFerreteria();

            try
            {
                datosEmpleado = cpd.ExtraerCodigo3("CONCAT(Apellidos,',',Nombre) AS ", "NombreC", "" +
                                                   " bd_ferreteria.tbl_Persona, bd_ferreteria.tbl_usuario, bd_ferreteria.tbl_Empleado",
                                                   "tbl_Empleado.status ", " 1 AND tbl_Persona.status = 1 " +
                                                   "AND tbl_Persona.id = tbl_Empleado.tbl_Persona_id " +
                                                   "AND tbl_usuario.tbl_empleado_DPI = tbl_empleado.DPI " +
                                                   "AND tbl_usuario.id = " + cbf.GetUserCodeForLog()
                                                   );
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            ///
            ReporteadorFerreteria.REPORTS.ReportComprasVentas objRpt = new ReporteadorFerreteria.REPORTS.ReportComprasVentas();
            ReporteadorFerreteria.DATASETS.DataSetP           ds1    = new ReporteadorFerreteria.DATASETS.DataSetP();
            foreach (DataGridViewRow row in DataGridViewDetalles.Rows)
            {
                ReporteadorFerreteria.DATASETS.DataSetP.tbl_ReporteVentaCompraRow rowVentaCompra = ds1.tbl_ReporteVentaCompra.Newtbl_ReporteVentaCompraRow();
                rowVentaCompra.id               = Convert.ToString(row.Cells["ID"].Value);
                rowVentaCompra.FechaEmision     = Convert.ToString(row.Cells["FECHA EMISION"].Value);
                rowVentaCompra.FechaCancelacion = Convert.ToString(row.Cells["FECHA CANCELACION"].Value);
                rowVentaCompra.Total            = Convert.ToString(row.Cells["TOTAL"].Value);
                rowVentaCompra.Objetivo         = Convert.ToString(row.Cells[titleObjetivo].Value);
                rowVentaCompra.Cancelado        = Convert.ToString(row.Cells["CANCELADO"].Value);
                rowVentaCompra.Saldo            = Convert.ToString(row.Cells["SALDO"].Value);

                ds1.tbl_ReporteVentaCompra.Addtbl_ReporteVentaCompraRow(rowVentaCompra);
            }
            objRpt.SetDataSource(ds1);
            TextObject txtObject     = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextBy"];
            TextObject txtObjectDate = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextDate"];
            TextObject txtTotal      = (TextObject)objRpt.ReportDefinition.Sections["Section4"].ReportObjects["TextTotal"];
            TextObject txtSaldo      = (TextObject)objRpt.ReportDefinition.Sections["Section4"].ReportObjects["TextSaldo"];
            string     type          = "";

            if (tablaObj == "tbl_comprasencabezado")
            {
                type = "COMPRAS";
            }
            else
            {
                type = "VENTAS";
            }
            TextObject txtObjectType = (TextObject)objRpt.ReportDefinition.Sections["Section1"].ReportObjects["TextType"];

            txtTotal.Text      = sumarFilas(3).ToString();
            txtSaldo.Text      = sumarFilas(6).ToString();
            txtObjectDate.Text = DateTime.Now.ToLongTimeString();
            txtObject.Text     = datosEmpleado;
            txtObjectType.Text = type;
            UI_Visualizador form = new UI_Visualizador();

            form.crystalReportViewerGlobal.ReportSource = objRpt;
            form.ShowDialog();
        }