// GET: ReporteProducto/Edit/5
        public ActionResult Edit(int id)
        {
            ViewBag.Id_papeleria = new SelectList(db.Papelerias, "Id_papeleria", "Nombre_papeleria");
            ReporteProducto reporteProducto = db.Reporte_productos.Single(g => g.Id_reporte_producto == id);

            return(View(reporteProducto));
        }
        public ActionResult VentasPorProducto(DateTime fecha_inicio, DateTime fecha_fin)
        {
            List <ReporteProducto> pedidos = new List <ReporteProducto>();
            ReporteProducto        pedidoTemporal;

            try
            {
                List <string> pedidosProducto = bl.consultarCantidadPedidoPorProducto(fecha_inicio, fecha_fin);
                for (int i = 0; i < pedidosProducto.Count() - 1; i += 3)
                {
                    pedidoTemporal             = new ReporteProducto();
                    pedidoTemporal.FechaInicio = fecha_inicio;
                    ViewBag.desde           = "desde";
                    ViewBag.hasta           = "hasta";
                    ViewBag.fechainicio     = fecha_inicio.ToString("yyyy-MM-dd");
                    pedidoTemporal.FechaFin = fecha_fin;
                    ViewBag.fechafin        = fecha_fin.ToString("yyyy-MM-dd");
                    pedidoTemporal.Codigo   = pedidosProducto.ElementAt(i);
                    pedidoTemporal.Producto = pedidosProducto.ElementAt(i + 1);
                    pedidoTemporal.Cantidad = pedidosProducto.ElementAt(i + 2);
                    pedidos.Add(pedidoTemporal);
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("", "Seleccione las fechas para generar el reporte");
            }

            return(View(pedidos));
        }
        // GET: ReporteProducto/Create
        public ActionResult Create()
        {
            ViewBag.Id_papeleria = new SelectList(db.Papelerias, "Id_papeleria", "Nombre_papeleria");
            ReporteProducto reporteProducto = new ReporteProducto
            {
                Fecha_emision       = DateTime.Parse(DateTime.Now.Date.ToString("dd/MM/yyyy")),
                Descripcion_reporte = "",
            };

            return(View());
        }
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         ReporteProducto reporteProducto = db.Reporte_productos.Single(g => g.Id_reporte_producto == id);
         db.Reporte_productos.Remove(reporteProducto);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
        private void btn_imprimir_Click(object sender, EventArgs e)
        {
            connection.OpenConnection();

            connection.ActualizarRegistro("alter view  VistaImprimir as select v.idViaje,v.fechaPrevistaOperacion,v.observaciones, e.placa, e.tipo , p.nombre, p.dpi, v.bodegaDestino,v.bodegaProcedencia from viaje v inner join piloto p on v.piloto_idpiloto=p.idpiloto inner join vehiculo e on v.vehiculo_idVehiculo = e.idVehiculo where v.idViaje = '" + Program.noviaje.ToString() + "';");
            connection.ActualizarRegistro("alter view Vistaproductos as select mi.codigoMovimientoInventario as No_movimiento,dm.Cantidad,pr.descripcion,dm.CostoTotal from movimientoinventario mi inner join detallemovimiento dm on mi.codigoMovimientoInventario = dm.movimientoInventario_codigoMovimientoInventario inner join productos pr on dm.productos_idProducto = pr.idProducto inner join viaje vj on mi.viaje_idViaje = vj.idViaje where vj.idViaje = '" + Program.noviaje.ToString() + "'; ");

            connection.CloseConnection();
            ReporteProducto rp = new ReporteProducto();

            rp.Show();
            ReporteEnvio re = new ReporteEnvio();

            re.Show();
        }
        public ActionResult Create(ReporteProducto reporteProducto)
        {
            try
            {
                db.Reporte_productos.Add(reporteProducto);
                db.SaveChanges();


                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemple #7
0
        private void ProductosToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            RepositorioBase <Productos> repositorio = new RepositorioBase <Productos>();
            List <Productos>            lista       = new List <Productos>();

            lista = repositorio.GetList(p => true);
            if (lista.Count > 0)
            {
                MessageBox.Show("Un momento por favor.", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ReporteProducto reporte = new ReporteProducto(lista);
                reporte.ShowDialog();
            }
            else
            {
                MessageBox.Show("No hay datos para imprimir.", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #8
0
        public async Task <Response <List <ReporteProducto> > > ObtenerReporteProductoPorIntervalo(IntervaloTicket i)
        {
            var response = new Response <List <ReporteProducto> >();

            try
            {
                using (var connection = new SqlConnection(con.getConnection()))
                {
                    using (var command = new SqlCommand("Reporte.spReporteProductosPorIntervalo", connection))
                    {
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.Clear();
                        command.Parameters.AddWithValue("@idEmpresa", i.idEmpresa);
                        command.Parameters.AddWithValue("@fechaInicio", i.fechaInicio);
                        command.Parameters.AddWithValue("@fechaFinal", i.fechaFinal);
                        command.Parameters.AddWithValue("@horaInicio", i.horaInicio);
                        command.Parameters.AddWithValue("@horaFinal", i.horaFinal);
                        connection.Open();
                        using (var reader = await command.ExecuteReaderAsync())
                        {
                            var list = new List <ReporteProducto>();
                            while (reader.Read())
                            {
                                var reporte = new ReporteProducto();
                                reporte.idProducto = reader.GetInt32("idProducto");
                                reporte.nombre     = reader.GetString("nombre");
                                reporte.precio     = reader.GetDouble("precio");
                                reporte.cantidad   = reader.GetInt32("cantidad");
                                reporte.total      = reader.GetDouble("total");
                                list.Add(reporte);
                            }
                            response.success = true;
                            response.message = "Datos Obtenidos Correctamente";
                            response.Data    = list;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                response.success = false;
                response.message = ex.Message;
            }
            return(response);
        }
 public ActionResult Edit(int id, FormCollection collection)
 {
     try
     {
         ReporteProducto reporteProducto = db.Reporte_productos.Single(g => g.Id_reporte_producto == id);
         if (TryUpdateModel <ReporteProducto>(reporteProducto))
         {
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         // TODO: Add update logic here
         return(View());
     }
     catch
     {
         return(View());
     }
 }
Exemple #10
0
        private void BtnAceptar_Click(object sender, EventArgs e)
        {
            IReporteFactura  reporte  = new ReporteFactura();
            IReporteProducto reporteP = new ReporteProducto();
            IReporteServicio reporteS = new ReporteServicio();

            if (getFiltro().Equals("Facturas"))
            {
                if (getFechaInicial().Length == 0 && getFechaFinal().Length == 0)
                {
                    MessageBox.Show("No ingresó ningúna fecha. Por favor ingrese un rango de fecha");
                }
                else
                {
                    reporte.reporteFacturas(getFechaInicial().ToString(), getFechaFinal().ToString(), dataGridView1);
                }
            }

            else if (getFiltro().Equals("Productos"))

            {
                if (getFechaInicial().Length == 0 && getFechaFinal().Length == 0)
                {
                    MessageBox.Show("No ingresó ningúna fecha. Por favor ingrese un rango de fecha");
                }
                else
                {
                    reporteP.reporteProducto(getFechaInicial().ToString(), getFechaFinal().ToString(), dataGridView1);
                }
            }

            else if (getFiltro().Equals("Servicios"))

            {
                if (getFechaInicial().Length == 0 && getFechaFinal().Length == 0)
                {
                    MessageBox.Show("No ingresó ningúna fecha. Por favor ingrese un rango de fecha");
                }
                else
                {
                    reporteS.reporteServicio(getFechaInicial().ToString(), getFechaFinal().ToString(), dataGridView1);
                }
            }
        }
Exemple #11
0
 private void Imprimirbutton_Click(object sender, EventArgs e)
 {
     if (listado == null || listado.Count <= 0)
     {
         MyerrorProvider.Clear();
         MyerrorProvider.SetError(Imprimirbutton, "No hay datos para imprimir.");
         return;
     }
     else
     {
         if (listado.Count > 0)
         {
             ReporteProducto reporte = new ReporteProducto(listado);
             reporte.ShowDialog();
         }
         else
         {
             MyerrorProvider.Clear();
             MyerrorProvider.SetError(Imprimirbutton, "No hay datos para imprimir.");
             return;
         }
     }
 }
        public ActionResult ReporteProducto(string id, DateTime fechai, DateTime fechaf)
        {
            LocalReport lr   = new LocalReport();
            string      path = Path.Combine(Server.MapPath("~/Reportes"), "VentasPorProducto.rdlc");

            if (System.IO.File.Exists(path))
            {
                lr.ReportPath = path;
            }
            else
            {
                return(View("Index"));
            }


            List <string>          pedidosProducto = bl.consultarCantidadPedidoPorProducto(fechai, fechaf);
            List <ReporteProducto> pedidos         = new List <ReporteProducto>();
            ReporteProducto        pedidoTemporal;

            for (int i = 0; i < pedidosProducto.Count() - 1; i += 3)
            {
                pedidoTemporal             = new ReporteProducto();
                pedidoTemporal.FechaInicio = fechai.Date;
                pedidoTemporal.FechaFin    = fechaf.Date;
                pedidoTemporal.Codigo      = pedidosProducto.ElementAt(i);
                pedidoTemporal.Producto    = pedidosProducto.ElementAt(i + 1);
                pedidoTemporal.Cantidad    = pedidosProducto.ElementAt(i + 2);
                pedidos.Add(pedidoTemporal);
            }


            ReportDataSource rd = new ReportDataSource("VentasPorProductoDataSet", pedidos);

            lr.DataSources.Add(rd);
            string reportType = id;
            string mimeType;
            string encoding;
            string fileNameExtension;



            string deviceInfo =
                "<DeviceInfo>" +
                "  <OutputFormat>" + id + "</OutputFormat>" +
                "  <PageWidth>8.5in</PageWidth>" +
                "  <PageHeight>11in</PageHeight>" +
                "  <MarginTop>0.5in</MarginTop>" +
                "  <MarginLeft>1in</MarginLeft>" +
                "  <MarginRight>1in</MarginRight>" +
                "  <MarginBottom>0.5in</MarginBottom>" +
                "</DeviceInfo>";

            Warning[] warnings;
            string[]  streams;
            byte[]    renderedBytes;

            renderedBytes = lr.Render(
                reportType,
                deviceInfo,
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);



            return(File(renderedBytes, mimeType));
        }
        // GET: ReporteProducto/Delete/5
        public ActionResult Delete(int id)
        {
            ReporteProducto reporteProducto = db.Reporte_productos.Single(g => g.Id_reporte_producto == id);

            return(View(reporteProducto));
        }