private void btnAlmacenVentaEliminar_Click(object sender, RoutedEventArgs e) { InventarioVentas a = dtgAlmacenDeVentaInventario.SelectedItem as InventarioVentas; if (a != null) { if (MessageBox.Show("Realmente quiere eliminar la venta", "Almacen de Ventas", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { manejadorVenta.Eliminar(a.Id); AccionesAlmacenDeVentanas(); } } else { MessageBox.Show("No ha seleccionado ninguna fila", "Inventario", MessageBoxButton.OK, MessageBoxImage.Error); return; } }
private void dtgAlmacenDeVentaInventario_MouseDoubleClick(object sender, MouseButtonEventArgs e) { InventarioVentas a = dtgAlmacenDeVentaInventario.SelectedItem as InventarioVentas; if (a != null) { txtAlmacenSub_Total.Text = a.Subtotal.ToString(); txtAlmacenIva.Text = a.Iva.ToString(); txtAlmacenTotal.Text = a.Total.ToString(); txtAlmacenCambio.Text = a.Cambio.ToString(); txtAlmacenCliente.Text = a.Nombre_Cliente.ToString(); txtAlmacenEmpleado.Text = a.Nombre_Empleado.ToString(); txtAlmacenFecha.Text = a.Fecha.ToString(); txtAlmacenPago.Text = a.Forma_Pago.ToString(); dtgAlmacenDeVentaObservarVenta.ItemsSource = a.Productos_Venta; } else { MessageBox.Show("No ha seleccionado ninguna fila", "Inventario", MessageBoxButton.OK, MessageBoxImage.Error); return; } }
private void VentaBtnVenta_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtVentaPago.Text)) { MessageBox.Show("No ha llenado la casilla de 'Forma de pago'", "Venta", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (string.IsNullOrEmpty(txtVentaCliente.Text)) { MessageBox.Show("No ha llenado la casilla de 'Nombre de Cliente'", "Venta", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (string.IsNullOrEmpty(cmbVentaNombreEmpleado.Text)) { MessageBox.Show("No ha seleccionado el 'Nombre del Empleado'", "Venta", MessageBoxButton.OK, MessageBoxImage.Error); return; } float total = 0; foreach (Ventaas item in venta) { total += item.Total; } /* txtVentaSubtotal.Text = total.ToString(); * txtVentaIva.Text = (iva * total).ToString(); * txtVentaTotal.Text = (total + (total * iva)).ToString();*/ if (float.Parse(txtVentaPago.Text) < (total + (total * iva))) { MessageBox.Show("Forma de pago inferior a la venta", "Venta", MessageBoxButton.OK, MessageBoxImage.Error); return; } float cambio = 0; cambio = (float.Parse(txtVentaPago.Text)) - (total + (total * iva)); MessageBox.Show("MONTO\nSub-total: $" + total.ToString() + "\nIva: $" + (iva * total) + "\ntotal: $" + (total + (total * iva)) + "\nForma de pago: $" + txtVentaPago.Text + "\nCambio: $" + cambio, "Venta", MessageBoxButton.OK, MessageBoxImage.Information); /*Guardar los datos en el archivo*/ AccionesArchivo reporte = new AccionesArchivo(txtVentaCliente.Text.ToUpper() + ".poo"); string datos = ""; datos = string.Format("Farmacia 'Mi QUERIDO ENFERMITO'\nFecha: {0}\nEmpleado: {1}\nCliente: {2}\n-------------------------------------\nProducto Precio Cantidad Total\n-------------------------------------\n", txtVentaFecha.Text, cmbVentaNombreEmpleado.Text.ToUpper(), txtVentaCliente.Text.ToUpper()); string elementos = ""; foreach (Ventaas item in venta) { elementos += string.Format("{0} {1} {2} {3}\n", item.Producto, item.Precio, item.Cantidad, item.Total); } string informacion = string.Format("\nSubtotal: ${0}\nIva: ${1}\nTotal: ${2}\nForma de pago: ${3}\nCambio: ${4}\n\n ¡¡¡Vuelva pronto!!!", txtVentaSubtotal.Text, txtVentaIva.Text, txtVentaTotal.Text, txtVentaPago.Text, cambio); reporte.Guardar(datos + elementos + informacion); MessageBox.Show("Reporte Guardado con Exito: " + txtVentaCliente.Text.ToUpper() + ".poo", "Reporte", MessageBoxButton.OK, MessageBoxImage.Information); /*Guardar los datos en el archivo*/ /*LLenar los datos del Inventario*/ try { InventarioVentas Ventas = new InventarioVentas() { Nombre_Cliente = txtVentaCliente.Text, Cambio = cambio, Fecha = DateTime.Now, Iva = float.Parse(txtVentaIva.Text), Nombre_Empleado = cmbVentaNombreEmpleado.Text, Subtotal = float.Parse(txtVentaSubtotal.Text), Total = total + (total * iva), Forma_Pago = float.Parse(txtVentaPago.Text), Productos_Venta = venta, }; manejadorVenta.Agregar(Ventas); AccionesAlmacenDeVentanas(); } catch (Exception) { MessageBox.Show("No se pudo generar Lista en Inventario de Ventas", "Ventas", MessageBoxButton.OK, MessageBoxImage.Error); return; } /*Fin de LLenar Los datos delInvenatrio*/ InabilitarCamposVenta(false); venta = new List <Ventaas>(); //limpia la lista dtgListaDeVenta.ItemsSource = null; //limpia la tabla ActualizarTablaProductosEnVenta(); InabilitarBotonVentaVenta(true); }
/// <summary> /// Modificar /// </summary> /// <param name="entidad"></param> /// <returns>modicar una venta</returns> public bool Modificar(InventarioVentas entidad) { return(venta.Editar(entidad)); }
/// <summary> /// Agregar /// </summary> /// <param name="entidad"></param> /// <returns>agrega ventas</returns> public bool Agregar(InventarioVentas entidad) { return(venta.Crear(entidad)); }