private void BtnCambiar_Click(object sender, EventArgs e) { if (DGVenta.Rows.Count != 0) { foreach (DataGridViewRow row in DGVenta.Rows) { if (cbcampoamodificar.Text != "" && txtPorcentaje.Text != "") { if (cbcampoamodificar.Text == "Precio_compra") { row.Cells[3].Value = UtilityFrm.formateodecimal(UtilityFrm.calcularventa(Convert.ToDecimal(row.Cells[3].Value), Convert.ToDecimal(txtPorcentaje.Text)), 2); } if (cbcampoamodificar.Text == "Utilidad") { row.Cells[4].Value = UtilityFrm.formateodecimal(Convert.ToDecimal(txtPorcentaje.Text), 2); } if (cbcampoamodificar.Text == "Flete") { row.Cells[5].Value = UtilityFrm.formateodecimal(Convert.ToDecimal(txtPorcentaje.Text), 2); } if (cbcampoamodificar.Text == "Precio_venta") { row.Cells[6].Value = UtilityFrm.formateodecimal(UtilityFrm.calcularpreciocosto(Convert.ToDecimal(row.Cells[6].Value), Convert.ToDecimal(txtPorcentaje.Text)), 2); } } } } refrescar(); }
private void btnAplicar_Click(object sender, EventArgs e) { try { if (DGVenta.Rows.Count != 0) { foreach (DataGridViewRow row in DGVenta.Rows) { row.Cells[6].Value = UtilityFrm.formateodecimal(UtilityFrm.calcularventa(Convert.ToDecimal(row.Cells[3].Value), Convert.ToDecimal(row.Cells[4].Value), Convert.ToDecimal(row.Cells[5].Value), Convert.ToDecimal(row.Cells[6].Value)), 2); } if (UtilityFrm.mensajeopcionsiono("Desea aplicar los cambios?") == true) { DataTable tablaArticulos = GrillaADataTable(DGVenta); string respuesta = NegocioArticulo.editarPrecioMasivo(tablaArticulos); UtilityFrm.mensajeConfirm("La actualizacion se realizo con exito"); DGVenta.Rows.Clear(); } } } catch (Exception s) { UtilityFrm.mensajeError(s.Message); } }
private void refrescar() { if (DGVenta.Rows.Count != 0) { foreach (DataGridViewRow row in DGVenta.Rows) { row.Cells[6].Value = UtilityFrm.formateodecimal(UtilityFrm.calcularventa(Convert.ToDecimal(row.Cells[3].Value), Convert.ToDecimal(row.Cells[4].Value), Convert.ToDecimal(row.Cells[5].Value), Convert.ToDecimal(row.Cells[6].Value)), 2); } } }
private void calcularutilidadgrid( ) { DGVenta.CurrentRow.Cells[6].Value = UtilityFrm.formateodecimal(UtilityFrm.calcularventa(Convert.ToDecimal(DGVenta.CurrentRow.Cells[3].Value), Convert.ToDecimal(DGVenta.CurrentRow.Cells[4].Value), Convert.ToDecimal(DGVenta.CurrentRow.Cells[5].Value), Convert.ToDecimal(DGVenta.CurrentRow.Cells[6].Value)), 2); }