Esempio n. 1
0
        public void AgregarDetalle(Producto producto, int cantidad, decimal ValorUnitario)
        {
            Detalle detalle = new Detalle(producto, cantidad, ValorUnitario)
            {
                Id_Factura = Id_Factura
            };

            Detalles.Add(detalle);
        }
Esempio n. 2
0
 public void AgregarDetalle(Producto producto, int cantidad)
 {
     {
         Detalle detalle = new Detalle(producto, cantidad)
         {
             Id_Factura = Id_Factura
         };
         Detalles.Add(detalle);
     }
 }
Esempio n. 3
0
 public CompraBuilder AgregarDetalle(Producto producto, int cantidad, double precio)
 {
     totalDetalles++;
     Detalles.Add(new CompraDetalle
     {
         Producto = producto,
         Cantidad = cantidad,
         Precio   = precio
     });
     return(this);
 }
Esempio n. 4
0
        private void AgregarDetalle()
        {
            var ventanaDetalle = new EdicionDetalleReceta
            {
                DataContext = new EdicionDetalleRecetaViewModel()
            };
            var resultado = ventanaDetalle.ShowDialog();

            if (resultado.HasValue && resultado.Value && !DetalleRepetido(((EdicionDetalleRecetaViewModel)ventanaDetalle.DataContext).DetalleReceta.ID_ITEM))
            {
                Detalles.Add(((EdicionDetalleRecetaViewModel)ventanaDetalle.DataContext).DetalleReceta);
            }
        }
Esempio n. 5
0
 public void AgregarDetalle(Detalle detalle)
 {
     Detalle = new Detalle
     {
         Descuento     = detalle.Producto.Descuento,
         Fecha         = DateTime.Now,
         IVA           = detalle.Producto.IVA,
         Producto      = detalle.Producto,
         ValorTotal    = detalle.ValorTotal,
         ValorUnitario = detalle.Producto.ValorUnitario,
         ProductoId    = detalle.Producto.Codigo,
         Cantidad      = detalle.Cantidad,
     };
     Detalle.CalcularTotal();
     Detalles.Add(Detalle);
 }
Esempio n. 6
0
        public DevolucionBuilder AgregarDetalle(Producto producto, int cantidad)
        {
            TotalDetalles++;
            if (Venta == null) return this;
            if (Venta.VentaDetalles == null) return this;
            var productoBodega = Venta.VentaDetalles.FirstOrDefault(x => x.ProductoBodega.Producto == producto);
            if (productoBodega == null) return this;

            if (productoBodega.Cantidad < cantidad) return this;

            productoBodega.Cantidad -= cantidad;
            Detalles.Add(new DevolucionDetalle
            {
                Producto = producto,
                Cantidad = cantidad
            });

            return this;
        }
Esempio n. 7
0
        public VentaBuilder AgregarDetalle(ProductoBodega producto, int cantidad, double precio, double descuento)
        {
            VentaDetalle detalleExistente = Detalles.FirstOrDefault(x => x.ProductoBodega == producto);

            if (detalleExistente != null)
            {
                detalleExistente.Aumentar(cantidad, precio, descuento);
            }
            else
            {
                Detalles.Add(new VentaDetalle
                {
                    ProductoBodega = producto,
                    Cantidad       = cantidad,
                    Precio         = precio,
                    Descuento      = descuento
                });
            }
            return(this);
        }
Esempio n. 8
0
        public void AgregarDetalle(Detalle detalle)
        {
            Detalle Detalle = new Detalle
            {
                Tipo       = this.Tipo == "venta" ? "resta" : "aumento",
                Cantidad   = detalle.Cantidad,
                Descuento  = detalle.Descuento,
                IdFactura  = detalle.IdFactura,
                IdProducto = detalle.IdProducto,
                PrecioBase = detalle.PrecioBase,
                Total      = detalle.Total,
            };

            Detalle.ColocarProducto(detalle.ObtenerProducto());
            Detalle.CalcularSubTotal();
            Detalle.CalcularDescontado();
            Detalle.CalcularValorIva();
            Detalle.CalcularTotal();
            Detalles.Add(Detalle);
        }
Esempio n. 9
0
        public void AgregarDetalle()
        {
            var testDetalle = new DetalleFormula
            {
                Name     = NewFormulaSelectedProduct.Nombre,
                IdMp     = NewFormulaSelectedProduct.Codigo,
                Quantity = NewFormulaNewDetalle.Quantity,
                Unidad   = NewFormulaSelectedProduct.Unidad
            };


            if (Detalles.Any(p => p.Name == testDetalle.Name))
            {
                MessageBox.Show("Esta MP ya se encuentra en la formula.");
            }
            else
            {
                FormulaQueries.agregarDetalle(testDetalle, SelectedFormula.CodFormula);
                Detalles.Add(testDetalle);
            }
        }
Esempio n. 10
0
 public FacturaViewModels(Factura factura)
 {
     Codigo    = factura.Codigo;
     IVA       = factura.IVA;
     Descuento = factura.Descuento;
     Cantidad  = factura.Cantidad;
     Estado    = factura.Estado;
     Total     = factura.Total;
     if (factura.transaccionName().Equals("FacturaCompra"))
     {
         EstadoTransaccion = "Compra";
     }
     else
     {
         EstadoTransaccion = "Venta";
     }
     Fecha = factura.Fecha;
     factura.ConsultarDetalles().ForEach(d => {
         var detalle = new DetalleViewModel(d);
         Detalles.Add(detalle);
     });
 }
Esempio n. 11
0
        public virtual void AgregarBaseFinal()
        {
            for (var i = 1; i < Detalles.Count; i++)
            {
                if (Detalles[i].Descripcion.Equals(Detalles[0].Descripcion))
                {
                    Detalles.RemoveAt(i);
                }
            }

            var baseFinal = new EntregaDistribucion()
            {
                Linea       = Detalles[0].Linea,
                Descripcion = Detalles[0].Descripcion,
                Estado      = EntregaDistribucion.Estados.Pendiente,
                Orden       = Detalles.Count,
                Viaje       = Detalles[0].Viaje
            };

            var ultimo     = Detalles.Last().ReferenciaGeografica;
            var origen     = new LatLon(ultimo.Latitude, ultimo.Longitude);
            var destino    = new LatLon(baseFinal.ReferenciaGeografica.Latitude, baseFinal.ReferenciaGeografica.Longitude);
            var directions = GoogleDirections.GetDirections(origen, destino, GoogleDirections.Modes.Driving, string.Empty, null);

            if (directions != null)
            {
                var distancia = directions.Distance / 1000.0;
                var duracion  = directions.Duration;
                var fecha     = Detalles.Last().Programado.Add(duracion);

                baseFinal.Programado      = fecha;
                baseFinal.ProgramadoHasta = fecha;
                baseFinal.KmCalculado     = distancia;
            }

            Detalles.Add(baseFinal);
        }
Esempio n. 12
0
        public void AgregarDetalle(Producto producto, int cantidad, int idFactura)
        {
            Detalle detalleVenta = new DetalleVenta(producto, cantidad, idFactura);

            Detalles.Add(detalleVenta);
        }
Esempio n. 13
0
 public void AddDetalle()
 {
     Detalles.Add(new FacturaDetalleViewModel());
 }
Esempio n. 14
0
 public virtual void AgregarSecundaria(EntidadSecundaria secundaria)
 {
     Detalles.Add(secundaria);
 }
Esempio n. 15
0
 private void agregarDetalle(DetalleVenta detalle)
 {
     Detalles.Add(detalle);
 }
Esempio n. 16
0
        public void AgregarDetalle(Producto producto, int nuevaCantidad, decimal valorUnitario, int idFactura)
        {
            Detalle detalle = new DetalleCompra(producto, nuevaCantidad, valorUnitario, idFactura);

            Detalles.Add(detalle);
        }