public DetalleMostrar(FacturasDetalle m) { Id = m.ProductoId; Descripcion = ProductosBLL.Search(m.ProductoId).Descripcion; Precio = m.Precio; Cantidad = m.Cantidad; Subtotal = Precio * Cantidad; }
private void Remover_Click(object sender, RoutedEventArgs e) { FacturasDetalle facturas = GetSelectedCompra(); if (facturas == null) { MessageBox.Show("Primero seleccione un producto", "Mensaje", MessageBoxButton.OK); return; } if (DatosDataGrid.Items.Count >= 1 && DatosDataGrid.SelectedIndex <= DatosDataGrid.Items.Count - 1) { FacturasDetalle m = (FacturasDetalle)factura.Detalle[DatosDataGrid.SelectedIndex]; float itbs = (float)(ProductosBLL.Search(Convert.ToInt32(m.ProductoId)).PorcentajeITBIS) / 100; factura.Total -= m.Precio * m.Cantidad; factura.Total -= m.Precio * m.Cantidad * itbs; factura.Itbis -= m.Precio * m.Cantidad * itbs; factura.Detalle.RemoveAt(DatosDataGrid.SelectedIndex); Actualizar(factura.Detalle); Cargar(); } }
protected void ButtonAgregar_Click(object sender, EventArgs e) { RepositorioBase <Articulos> art = new RepositorioBase <Articulos>(); FacturasDetalle facdetalle = new FacturasDetalle(); Facturas facturas = new Facturas(); var buscar = art.Buscar(int.Parse(TextboxArticuloID.Text)); facdetalle.NombreArticulo = buscar.Nombre; facdetalle.Precio = Convert.ToInt32(TextBoxPrecioArticulo.Text); facdetalle.Importe = facdetalle.Precio * int.Parse(TextBoxCantidadArticulo.Text); facdetalle.IDArt = int.Parse(TextboxArticuloID.Text); facdetalle.Cantidad = int.Parse(TextBoxCantidadArticulo.Text); total += facdetalle.Importe; TextBoxTotal.Text = total.ToString(); detalle.Add(facdetalle); FacturaGridView.DataSource = detalle; FacturaGridView.DataBind(); }