private void toolStripButton2_Click(object sender, EventArgs e) { try { if (MessageBox.Show("¿Esta Seguro que desea Eliminar este registro?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { CLS.DetalleMovimiento oDMovimiento = new CLS.DetalleMovimiento(); if (!lblTransaccion.Text.Equals("Cotizacion")) { CLS.Inventario oInventario = new CLS.Inventario(); Double suma = 0.00; Double inventario = Convert.ToDouble(dtgDetalle.CurrentRow.Cells["exi"].Value); Double entrada = Convert.ToDouble(dtgDetalle.CurrentRow.Cells["cantitadsalida"].Value); suma = inventario + entrada; oInventario.IdProducto = dtgDetalle.CurrentRow.Cells["idp"].Value.ToString(); oInventario.Existencias = Convert.ToString(suma); oInventario.Actualizar_Existencias(); Cargar(); } // sincronizar oDMovimiento.IDDetalle = dtgDetalle.CurrentRow.Cells["iddetalle"].Value.ToString(); oDMovimiento.Eliminar(); CargarDetalle(); } } catch { } }
private void Guardar() { CLS.DetalleMovimiento dm = new CLS.DetalleMovimiento(); dm.IDProducto = txbIDProducto.Text; dm.IDMovimiento = lblIDMov.Text; dm.IDDetalle = lblIDDetalle.Text; dm.CEntrada = Convert.ToDouble(txbCantidad.Text); dm.Costo = Convert.ToDouble(txbPrecio.Text); dm.Gravado = Convert.ToDouble(txbSubtotal.Text); dm.SubTotal = Convert.ToDouble(txbSubtotal.Text); dm.IVA = Convert.ToDouble(txbIVA.Text); dm.Fecha = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); if (lblIDDetalle.Text.Length > 0) { actualilzar_existencias(); dm.Actualizar_Compra(); } else { actualilzar_existencias(); dm.Guardar_Compra(); } Cargar(); CargarDetalle(); }
private void Guardar() { CLS.DetalleMovimiento dm = new CLS.DetalleMovimiento(); dm.IDDetalle = lblIDDetalle.Text; dm.IDProducto = txbIDProducto.Text; dm.IDMovimiento = lblIDMov.Text; dm.CSalida = Convert.ToDouble(txbCantidad.Text); dm.Precio = Convert.ToDouble(txbPrecio.Text); dm.Gravado = Convert.ToDouble(txbSubtotal.Text); dm.IVA = Convert.ToDouble(txbIVA.Text); dm.SubTotal = dm.Gravado + dm.IVA; dm.Fecha = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); if (lblIDDetalle.Text.Length > 0) { if (!lblTransaccion.Text.Equals("Cotizacion")) { actualilzar_existencias(); } dm.Actualizar_Venta(); } else { if (!lblTransaccion.Text.Equals("Cotizacion")) { actualilzar_existencias(); } dm.Guardar_Venta(); } Cargar(); CargarDetalle(); }
private void btnEliminar_Click(object sender, EventArgs e) { try { Double total = 0.00; Double iva = 0.00; if (MessageBox.Show("¿Esta Seguro que desea Eliminar este registro?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { CLS.DetalleMovimiento oDMovimiento = new CLS.DetalleMovimiento(); CLS.Inventario oInventario = new CLS.Inventario(); Double resta = 0.00; Double inventario = Convert.ToDouble(dtgDetalle.CurrentRow.Cells["exi"].Value); Double entrada = Convert.ToDouble(dtgDetalle.CurrentRow.Cells["cantidadentrada"].Value); // sincronizar oDMovimiento.IDDetalle = dtgDetalle.CurrentRow.Cells["iddetalle"].Value.ToString(); oInventario.IdProducto = dtgDetalle.CurrentRow.Cells["idp"].Value.ToString(); resta = inventario - entrada; oInventario.Existencias = Convert.ToString(resta); oInventario.Actualizar_Existencias(); oDMovimiento.Eliminar(); foreach (DataGridViewRow row in dtgDetalle.Rows) { iva += Convert.ToDouble(row.Cells["MontoIVA"].Value); total += Convert.ToDouble(row.Cells["subtotal"].Value); } lblIVAsuma.Text = Convert.ToString(iva); lblsubtotalSuma.Text = Convert.ToString(total); Cargar(); CargarDetalle(); } } catch { } }