public void verDescripcion() { GenerarVenta nuevo = new GenerarVenta(); decimal totalTemporal = 0; if (this.SelectFactura != null) { try { borrarDescripcion(); this.nuevoDetalle = detalleFactura.FindList(this.SelectFactura.Numerofactura); foreach (DetalleFactura row in nuevoDetalle.ToList()) { this.DetalleFacturas.Add(row); totalTemporal = totalTemporal + (row.Cantidad * row.Precio); } this.Total = totalTemporal.ToString(); } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.ToString()); } } else { Mensajes.ShowMessageAsync("Error", "Debe seleccionar alguna fila"); } }
public void Add() { GenerarVenta nuevo = new GenerarVenta(); decimal totalTemporal = 0; if (this.SelectProducto != null && !this.CantidadProducto.Equals("")) { if (Convert.ToInt16(this.CantidadProducto) <= Convert.ToInt16(this.Existencia)) { try { if (Convert.ToInt16(this.CantidadProducto) <= 11) { nuevo.PrecioUnitario = Convert.ToDecimal(this.PrecioUnitario); } else if (Convert.ToInt16(this.CantidadProducto) <= 15) { nuevo.PrecioUnitario = Convert.ToDecimal(this.PrecioPorDocena); } else if (Convert.ToInt16(this.CantidadProducto) > 15) { nuevo.PrecioUnitario = Convert.ToDecimal(this.PrecioPorMayor); } nuevo.CodigoProducto = this.SelectProducto.CodigoProducto; nuevo.Descripcion = this.SelectProducto.Descripcion; nuevo.Cantidad = Convert.ToInt16(this.CantidadProducto); nuevo.Total = (Convert.ToInt16(this.CantidadProducto) * nuevo.PrecioUnitario); this.GenerarVentas.Add(nuevo); foreach (GenerarVenta row in GenerarVentas.ToList()) { totalTemporal = totalTemporal + Convert.ToDecimal(row.Total); } this.Total = totalTemporal.ToString(); } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.ToString()); } } } else { Mensajes.ShowMessageAsync("Error", "Debe seleccionar alguna fila e ingresar una cantidad"); } this.CantidadProducto = ""; }