private void btnLimpiar_Click(object sender, EventArgs e) { try { if (lstvDatos.Items.Count == 0) { MessageBox.Show("Agregue productos a la lista!"); } else { int n; n = 0; while (n < lstvDatos.Items.Count) { clsStock nuevoStock; nuevoStock = new clsStock(Convert.ToInt32(lstvDatos.Items[n].SubItems[3].Text), Convert.ToInt32(lblIdAlmacen.Text), Convert.ToInt32(lstvDatos.Items[n].SubItems[7].Text), Convert.ToDecimal(lstvDatos.Items[n].Text)); nuevoStock.ActualizarAñadir(); n = n + 1; } lstvDatos.Items.Clear(); txtIGV2.Clear(); txtSubtotal.Clear(); txtTotal.Clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnEliminarItem_Click(object sender, EventArgs e) { try { ////ACTUALIZAR Stock clsStock nuevoStock; nuevoStock = new clsStock(Convert.ToInt32(lstvDatos.SelectedItems[0].SubItems[3].Text), Convert.ToInt32(lblIdAlmacen.Text), Convert.ToInt32(lblEquivalenciaMed.Text), Convert.ToDecimal(lstvDatos.SelectedItems[0].Text)); nuevoStock.ActualizarAñadir(); double total, subtotal, igv; total = 0; subtotal = 0; igv = 0; total = Convert.ToDouble(txtTotal.Text) - Convert.ToDouble(lstvDatos.SelectedItems[0].SubItems[6].Text); subtotal = total / 1.18; igv = subtotal * 0.18; lstvDatos.SelectedItems[0].Remove(); txtSubtotal.Text = subtotal.ToString("0.00"); txtIGV2.Text = igv.ToString("0.00"); txtTotal.Text = total.ToString("0.00"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnAgregar_Click(object sender, EventArgs e) { ////ACTUALIZAR Stock clsStock nuevoStock; nuevoStock = new clsStock(Convert.ToInt32(lblIdProducto.Text), Convert.ToInt32(lblIdAlmacen.Text), Convert.ToInt32(lblEquivalencia.Text), Convert.ToDecimal(nudCantidad.Value)); nuevoStock.ActualizarAñadir(); btnAgregar.Enabled = false; btnQuitar.Enabled = false; cmbMedida.Enabled = false; nudCantidad.Enabled = false; btnLimpiar.Enabled = true; btnLimpiar.PerformClick(); }