private void dgvListaInsumo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { for (short i = 0; i < dgvListaSolicitud.Rows.Count; i++) { string cod = dgvPedidos.CurrentRow.Cells[0].Value.ToString(); if (cod == dgvListaSolicitud.Rows[i].Cells[0].Value.ToString()) { MessageBox.Show("Producto ya Especificado", "FactuTED", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } frmAddCantidad frm = new frmAddCantidad(); frm.lblCantidad.Text = "SALDO"; frm.ShowDialog(); string saldo = frm.txtCantidad.Text; frm.txtCantidad.Text = ""; frm.lblCantidad.Text = "CANTIDAD"; frm.ShowDialog(); string cantidad = frm.txtCantidad.Text; if (frm.Cancelado == false) { string cod = dgvPedidos.CurrentRow.Cells["Codigo"].Value.ToString(); string insumo = dgvPedidos.CurrentRow.Cells["Insumo"].Value.ToString(); string uniMedida = dgvPedidos.CurrentRow.Cells["UniMedida"].Value.ToString(); dgvListaSolicitud.Rows.Add(cod, insumo, saldo, cantidad, uniMedida, "X"); } } }
private void dgvProductos_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { string codProducto = dgvProductos.CurrentRow.Cells["cod"].Value.ToString(); string Producto = dgvProductos.CurrentRow.Cells["Insumo"].Value.ToString(); frmAddCantidad f = new frmAddCantidad(); f.lblCantidad.Text = "CANTIDAD"; f.ShowDialog(); if (f.Cancelado == true) { return; } float cantidad = Convert.ToSingle(f.txtCantidad.Text); f.txtCantidad.Text = ""; f.lblCantidad.Text = "IMPORTE"; f.ShowDialog(); if (f.Cancelado == true) { return; } float importe = Convert.ToSingle(f.txtCantidad.Text); if (f.Cancelado == true) { return; } //float cosTotalNuevo = cantidad * PrecioNuevo; //float costoTotal = cosTotalAntiguo + cosTotalNuevo; //float cantidadTotal = stocktotal + cantidad; //float costoPromedio = costoTotal / cantidadTotal; //float subTotal = costoPromedio * cantidad; dgvDetalle.Rows.Add(codProducto, Producto, cantidad, (importe / cantidad).ToString("0.00"), importe.ToString("0.00"), true, "x"); calcularFacturacion(); txtProducto.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void dgvProductoPrimo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { try { if (dgvProductoPrimo.RowCount > 0) { e.SuppressKeyPress = true; //Fila Seleccionada int select = dgvProductoPrimo.CurrentRow.Index; string codProducto = dgvProductoPrimo.Rows[select].Cells[0].Value.ToString(); string Producto = dgvProductoPrimo.Rows[select].Cells["Insumo"].Value.ToString(); frmAddCantidad frm = new frmAddCantidad(); frm.ShowDialog(); if (frm.Cancelado == false) { float cantidad = Convert.ToSingle(frm.txtCantidad.Text); string uniMedia = dgvProductoPrimo.Rows[select].Cells["UniMedida"].Value.ToString(); string costo = fn.select_one_value("Costo", "Insumo", "Insumo='" + Producto + "'", 0); dgvRecetaProducto.Rows.Add(codProducto, Producto, cantidad, costo, uniMedia, "X"); } } } catch (Exception ex) { MessageBox.Show("El detalle no se agrego a la receta", "AVISO DEL SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void txtNumero_Click(object sender, EventArgs e) { frmAddCantidad frm = new frmAddCantidad(); frm.ShowDialog(); if (frm.Cancelado == false) { txtNumero.Text = Convert.ToDecimal(frm.txtCantidad.Text).ToString("0000000000"); } }
private void dgvProductos_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { frmAddCantidad frm = new frmAddCantidad(); frm.ShowDialog(); if (frm.Cancelado == false) { string idInsumo = dgvInsumo.CurrentRow.Cells[0].Value.ToString(); string insumo = dgvInsumo.CurrentRow.Cells[1].Value.ToString(); string cantidad = frm.txtCantidad.Text; dgvSalida.Rows.Add(idInsumo, insumo, cantidad, 'X'); } } }
void btnSelectProd_Click(object sender, EventArgs e) { Button btn = sender as Button; int IDPresentacion = Convert.ToInt32(btn.Tag); frmAddCantidad frm = new frmAddCantidad(); frm.ShowDialog(); if (frm.Cancelado == false) { //Agregar el producto al GridView string cantidad = frm.txtCantidad.Text; string nombre = fn.select_one_value("Presentacion", "Presentacion", "IDPresentacion='" + IDPresentacion + "'", 0); string precio = fn.select_one_value("Precio", "Presentacion", "IDPresentacion='" + IDPresentacion + "'", 0); string subTotal = (Convert.ToDouble(cantidad) * Convert.ToDouble(precio)).ToString(); dgvDetalleVenta.Rows.Add(nombre, cantidad, precio, subTotal); CalcularVenta(); } }
private void btnMas_Click(object sender, EventArgs e) { Button btn = sender as Button; int IDPresentacion = Convert.ToInt32(btn.Tag); frmAddCantidad frm = new frmAddCantidad(); frm.ShowDialog(); if (frm.Cancelado == false) { //Agregar el producto al GridView string cantidad = frm.txtCantidad.Text; string precio = fn.select_one_value("Precio", "Presentacion", "IDPresentacion= (SELECT IDPresentacion from Presentacion where Presentacion = '" + dgvDetalleVenta.CurrentRow.Cells[0].Value.ToString() + "')", 0); string subTotal = (Convert.ToDouble(cantidad) * Convert.ToDouble(precio)).ToString(); dgvDetalleVenta.CurrentRow.Cells["CANTIDAD"].Value = cantidad; dgvDetalleVenta.CurrentRow.Cells["PreUni"].Value = precio; dgvDetalleVenta.CurrentRow.Cells["TOTAL"].Value = subTotal; CalcularVenta(); } }