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 DGVenta_CellEndEdit(object sender, DataGridViewCellEventArgs e) { DGVenta.Rows[e.RowIndex].Cells[3].Value.ToString(); this.DGVenta.Columns[3].DefaultCellStyle.Format = String.Format("$###,##0.00"); calcularutilidadgrid(); DGVenta.CurrentRow.Cells[3].Value = UtilityFrm.formateodecimal(Convert.ToDecimal(DGVenta.CurrentRow.Cells[3].Value), 2); DGVenta.CurrentRow.Cells[4].Value = UtilityFrm.formateodecimal(Convert.ToDecimal(DGVenta.CurrentRow.Cells[4].Value), 2); DGVenta.CurrentRow.Cells[5].Value = UtilityFrm.formateodecimal(Convert.ToDecimal(DGVenta.CurrentRow.Cells[5].Value), 2); }
private void Btntraer_Click(object sender, EventArgs e) { try { decimal preciocompravar = 0; if (dataLista.RowCount != 0) { foreach (DataGridViewRow fila in dataLista.Rows) { if (Convert.ToBoolean(fila.Cells[0].Value) == true) { if (recorrerlista(Convert.ToInt32(fila.Cells["idarticulo"].Value)) == false) { // , fila.Cells["utilidad"].Value, fila.Cells["flete"].Value, fila.Cells["precio"].Value preciocompravar = Convert.ToDecimal(fila.Cells["precio_compra"].Value); if (opcionvista == "PRECIOMASIVO") { listadodearticulo.Rows.Add(fila.Cells["idarticulo"].Value, fila.Cells["nombre"].Value, fila.Cells["descripcion"].Value, UtilityFrm.formateodecimal(Convert.ToDecimal(fila.Cells["precio_compra"].Value), 2), UtilityFrm.formateodecimal(Convert.ToDecimal(fila.Cells["utilidad"].Value), 2), UtilityFrm.formateodecimal(Convert.ToDecimal(fila.Cells["flete"].Value), 2), UtilityFrm.formateodecimal(Convert.ToDecimal(fila.Cells["precio"].Value), 2)); } else if (opcionvista == "STOCK") { listadodearticulo.Rows.Add(fila.Cells["idarticulo"].Value, fila.Cells["nombre"].Value, UtilityFrm.formateodecimal(Convert.ToDecimal(fila.Cells["precio_compra"].Value), 2), UtilityFrm.formateodecimal(Convert.ToDecimal(fila.Cells["precio"].Value), 2), "1", UtilityFrm.formateodecimal(Convert.ToDecimal(fila.Cells["stock_actual"].Value), 2)); } } } } } //this.listadodearticulo.Columns["Preciocompra"].DefaultCellStyle.Format = String.Format("$###,##0.00"); //this.listadodearticulo.Columns["Precioventa"].DefaultCellStyle.Format = String.Format("$###,##0.00"); //this.listadodearticulo.Columns["Utilidad"].DefaultCellStyle.Format = String.Format("%0.00"); //this.listadodearticulo.Columns["Flete"].DefaultCellStyle.Format = String.Format("%0.00"); } catch (Exception x) { UtilityFrm.mensajeError(x.Message); } }
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); }