private void añadedetalle(DataGridViewRow fila) { clsDetalleSeparacionVenta deta = new clsDetalleSeparacionVenta(); deta.CodProducto = Convert.ToInt32(fila.Cells[codproducto.Name].Value); deta.CodSeparacion = Convert.ToInt32(sepa.CodSeparacion); deta.CodAlmacen = Convert.ToInt32(cmbAlmacen.SelectedValue); deta.UnidadIngresada = Convert.ToInt32(fila.Cells[codunidad.Name].Value); deta.Cantidad = Convert.ToDouble(fila.Cells[cantidad.Name].Value); deta.PrecioUnitario = Convert.ToDouble(fila.Cells[preciounit.Name].Value); deta.Subtotal = Convert.ToDouble(fila.Cells[importe.Name].Value); //deta.Subtotal = Convert.ToDouble(fila.Cells[importe.Name].Value); //deta.Subtotal = Convert.ToDouble(fila.Cells[valorventa.Name].Value); deta.Descuento1 = Convert.ToDouble(fila.Cells[dscto1.Name].Value); deta.MontoDescuento = Convert.ToDouble(fila.Cells[montodscto.Name].Value); deta.Igv = Convert.ToDouble(fila.Cells[igv.Name].Value); // deta.Importe = Convert.ToDouble(fila.Cells[precioventa.Name].Value); deta.Importe = Convert.ToDouble(fila.Cells[precioventa.Name].Value); deta.PrecioReal = Convert.ToDouble(fila.Cells[precioreal.Name].Value); deta.ValoReal = Convert.ToDouble(fila.Cells[valoreal.Name].Value); deta.CodUser = frmLogin.iCodUser; detalle1.Add(deta); }
public Boolean InsertarDetalleSepa(clsDetalleSeparacionVenta detalle) { try { return(Msepa.insertdetalle(detalle)); } catch (Exception ex) { DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: " + ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } }
public bool insertdetalle(clsDetalleSeparacionVenta detalle_venta) { try { con.conectarBD(); cmd = new MySqlCommand("GuardaDetalleSeparacionVenta", con.conector); cmd.CommandType = CommandType.StoredProcedure; MySqlParameter oParam; oParam = cmd.Parameters.AddWithValue("codpro", detalle_venta.CodProducto); oParam = cmd.Parameters.AddWithValue("codseparacion", detalle_venta.CodSeparacion); oParam = cmd.Parameters.AddWithValue("codalma", detalle_venta.CodAlmacen); oParam = cmd.Parameters.AddWithValue("unidad", detalle_venta.UnidadIngresada); oParam = cmd.Parameters.AddWithValue("cantidad", detalle_venta.Cantidad); oParam = cmd.Parameters.AddWithValue("precio", detalle_venta.PrecioUnitario); oParam = cmd.Parameters.AddWithValue("subtotal", detalle_venta.Subtotal); oParam = cmd.Parameters.AddWithValue("dscto1", detalle_venta.Descuento1); oParam = cmd.Parameters.AddWithValue("dscto2", detalle_venta.Descuento2); oParam = cmd.Parameters.AddWithValue("dscto3", detalle_venta.Descuento3); oParam = cmd.Parameters.AddWithValue("montodscto", detalle_venta.MontoDescuento); oParam = cmd.Parameters.AddWithValue("igv", detalle_venta.Igv); oParam = cmd.Parameters.AddWithValue("importe", detalle_venta.Importe); oParam = cmd.Parameters.AddWithValue("precioreal", detalle_venta.PrecioReal); oParam = cmd.Parameters.AddWithValue("valoreal", detalle_venta.ValoReal); oParam = cmd.Parameters.AddWithValue("codusu", detalle_venta.CodUser); oParam = cmd.Parameters.AddWithValue("newid", 0); oParam.Direction = ParameterDirection.Output; int x = cmd.ExecuteNonQuery(); detalle_venta.CodDetalleSeparacion = Convert.ToInt32(cmd.Parameters["newid"].Value); if (x != 0) { return(true); } else { return(false); } } catch (MySqlException ex) { throw ex; } finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); } }