Beispiel #1
0
        private void btn_aceptar_Click(object sender, RoutedEventArgs e)
        {
            if (dgrid_entrada.ItemsSource != null)
            {
                using (var db = new TiendaDbContext())
                {
                    var tienda           = db.Tiendas.First();
                    var articulo_entrada = new List <ArticuloEntrada>();
                    foreach (var item in dgrid_entrada.ItemsSource)
                    {
                        articulo_entrada.Add((item as entrada).genera_articulo_entrada(Fecha));
                    }
                    foreach (var articulo in articulo_entrada)
                    {
                        var producto = tienda.Productos.Where(p => p.Codigo == articulo.Codigo).First();
                        producto.CantidadBuenEstado += articulo.CantidadBuenEstado;
                        producto.CantidadDefectuoso += articulo.CantidadDefectuoso;
                        db.Entry(producto).State     = EntityState.Modified;
                    }
                    db.Entry(tienda).State = EntityState.Modified;
                    articulo_entrada.ForEach(p => db.ArticuloEntradas.Add(p));
                    var reporte = new ReporteEntrada {
                        Fecha = Fecha, Articulos = articulo_entrada
                    };
                    db.ReporteEntradas.Add(reporte);

                    db.SaveChanges();
                }
            }
            this.NavigationService.GoBack();
        }
Beispiel #2
0
        private void Entradas_Click(object sender, EventArgs e)
        {
            ReporteEntrada fm = new ReporteEntrada();

            fm.FormClosed += new FormClosedEventHandler(MostrarFormLogoAlCerrarForms);
            AbrirFormEnPanel(fm);
            //showSubMenu(panelSubMenuReportes);
            //---invocamos el metodo ocultar
            hideSubMenu();
        }
Beispiel #3
0
        private void ReporteButton_Click(object sender, EventArgs e)
        {
            if (entradaArticulos.Count == 0)
            {
                MessageBox.Show("No hay datos");
                return;
            }

            ReporteEntrada reporte = new ReporteEntrada(entradaArticulos);

            reporte.ShowDialog();
        }
Beispiel #4
0
        private void EntradaDeProductosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            RepositorioBase <EntradaProducto> repositorio = new RepositorioBase <EntradaProducto>();
            List <EntradaProducto>            lista       = new List <EntradaProducto>();

            lista = repositorio.GetList(p => true);
            if (lista.Count > 0)
            {
                MessageBox.Show("Un momento por favor.", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ReporteEntrada reporte = new ReporteEntrada(lista);
                reporte.ShowDialog();
            }
            else
            {
                MessageBox.Show("No hay datos para imprimir.", "ButterSoft", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #5
0
        public ReporteEntrada genera_reporte(ICollection <ArticuloEntrada> articulos)
        {
            var reporte = new ReporteEntrada
            {
                Fecha = DateTime.Now,
            };

            foreach (var art in articulos)
            {
                reporte.Articulos.Add(art);
            }

            using (var db = new TiendaDbContext())
            {
                db.ArticuloEntradas.AddRange(articulos);
                db.ReporteEntradas.Add(reporte);
                db.SaveChanges();
            }
            return(reporte);
        }
 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)
         {
             ReporteEntrada reporte = new ReporteEntrada(listado);
             reporte.ShowDialog();
         }
         else
         {
             MyerrorProvider.Clear();
             MyerrorProvider.SetError(Imprimirbutton, "No hay datos para imprimir.");
             return;
         }
     }
 }