public IHttpActionResult PostDetalle(Detalle detalle) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Detalles.Add(detalle); try { db.SaveChanges(); } catch (DbUpdateException) { if (DetalleExists(detalle.ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = detalle.ID }, detalle)); }
private void BTNdetalle_Click(object sender, RoutedEventArgs e) { try { Detalle ventana = new Detalle(); DataRowView row = (DataRowView)dataGridCxC.SelectedItems[0]; DateTime fechaConsulta = Convert.ToDateTime(FechaConsul.Text); int mesIni = Int32.Parse(TextBox_Meses.Value.ToString()); DateTime _mesini = fechaConsulta.AddMonths(-mesIni); DateTime fechaBack = Convert.ToDateTime(FechaBack.Text); ventana.referencia = row["cod_ref"].ToString(); ventana.bodega = TextCod_bod.Text; ventana.mesini = _mesini.ToString("dd/MM/yyyy"); ventana.backorder = fechaBack.ToString("dd/MM/yyyy"); //MessageBox.Show("cod_empresa:"+ cod_empresa); ventana.empresa = cod_empresa; ventana.ShowInTaskbar = false; ventana.ShowDialog(); } catch (Exception) { MessageBox.Show("error al cargar pedidos y bakorder"); } }
public static async Task <Comuna> GetComunaFromInput(Detalle detalle, Conexion con, bool isNew) { string promptValue; Comuna comunaobj = null; List <Comuna> comunas = await GetComunasAsync(con); do { if (isNew) { promptValue = ComunaInput.ShowDialog("New Auxiliar, be careful.", $"'Comuna' not found, please input below:", detalle.Instruction.ParticipantDebtor.BusinessName, detalle.RutReceptor, detalle.Instruction.ParticipantDebtor.CommercialAddress, comunas); } else { promptValue = ComunaInput.ShowDialog("Update Auxiliar, be careful.", $"'Comuna' not found, please input below:", detalle.Instruction.ParticipantDebtor.BusinessName, detalle.RutReceptor, detalle.Instruction.ParticipantDebtor.CommercialAddress, comunas); } // comunaobj = comunas.FirstOrDefault(x => Auxiliar.RemoveDiacritics(x.ComDes).ToLower() == Auxiliar.RemoveDiacritics(promptValue.ToLower())); } while (comunaobj == null); return(await Task.FromResult(comunaobj)); }
private static List <Detalle> GetDetalle(int idcpe, SqlConnection connection) { var lista = new List <Detalle>(); string query = "select * from cpe_doc_det where idcpe= {0}"; var resul = string.Format(query, idcpe); var command = new SqlCommand(resul, connection); var reader = command.ExecuteReader(); try { while (reader.Read()) { var document = new Detalle(reader); lista.Add(document); //Console.WriteLine(document); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally{ reader.Close(); } return(lista); }
private void dgvDetalles_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (dgvDetalles.SelectedRows.Count > 0) { detalle = new Detalle(); detalle.IdDetalle = Convert.ToInt32(dgvDetalles.Rows[e.RowIndex].Cells[0].Value.ToString()); detalle.Actividad = dgvDetalles.Rows[e.RowIndex].Cells[1].Value.ToString(); detalle.Cantidad = Convert.ToInt32(dgvDetalles.Rows[e.RowIndex].Cells[2].Value.ToString()); detalle.PrecioUnitario = Convert.ToDouble(dgvDetalles.Rows[e.RowIndex].Cells[3].Value.ToString()); txtActividad.Text = detalle.Actividad; txtCantidad.Text = Convert.ToString(detalle.Cantidad); txtPrecioUnitario.Text = Convert.ToString(detalle.PrecioUnitario); txtTotalDetalle.Text = Convert.ToString(detalle.Cantidad * detalle.PrecioUnitario); btnQuitar.Enabled = true; btnAgregar.Enabled = false; btnNuevoItem.Enabled = true; } else { MessageBox.Show("Por favor seleccione una fila.", "BIO-DENT", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch { } }
public DetalleViewModel(Detalle detalle) { CantidadProducto = detalle.CantidadProducto; ProductoId = detalle.ProductoId; Descuento = detalle.Descuento; ValorProducto = detalle.ValorProducto; }
public string ingresarDetalle(Detalle elDetalle) { miComando = new MySqlCommand(); Console.WriteLine("GestorDetalle"); miComando.CommandText = "IngresarDetalle"; miComando.Parameters.Add("@idP", MySqlDbType.Int32); miComando.Parameters["@idP"].Value = elDetalle.Id_Producto; miComando.Parameters.Add("@idV", MySqlDbType.Int32); miComando.Parameters["@idV"].Value = elDetalle.Id_Venta; miComando.Parameters.Add("@cant", MySqlDbType.Int32); miComando.Parameters["@cant"].Value = elDetalle.Cantidad_Producto; respuesta = this.ejecutarSentencia(miComando); if (respuesta == "") { respuesta += "se ha realizado correctamente la transaccion"; } Console.WriteLine(respuesta); Console.WriteLine("Fin del gestor ingreso Cliente"); return(respuesta); }
private static string ObtenerRegistros(DataRow[] rows, Detalle detalle) { string lineas = string.Empty; string linea; if (detalle != null) { foreach (DataRow row in rows) { linea = string.Empty; foreach (var item in detalle.Campos.OrderBy(reg => reg.Offset)) { var campo = row.Field <string>(item.NombreBaseDeDatos); campo = CompletarRegistro(campo, item.PadCaracter, item.Longitud, item.IsPadLeft); linea += campo; } lineas += linea + saltoLinea; if (row.Table.ChildRelations.Count > 0) { var dataRelation = row.Table.ChildRelations[0]; lineas += ObtenerRegistros(row.GetChildRows(dataRelation), detalle.SubDetalle); } } } return(lineas); }
private void btnAgregar_Click(object sender, EventArgs e) { if (txtCantidad.Text != "") { if (medicamento.Stock > Convert.ToInt32(txtCantidad.Text)) { if (farmaceutico.modificarStock(medicamento, Convert.ToInt32(txtStock.Text) - Convert.ToInt32(txtCantidad.Text))) { detalle = new Detalle(id++, medicamento, Convert.ToInt32(txtCantidad.Text)); detalles.Add(detalle); cbxProductos.SelectedIndex = 0; txtStock.Text = ""; txtCantidad.Text = ""; llenarDataGridView(); producto = true; btnAgregar.Enabled = false; } else { MessageBox.Show("No se pudo ingresar el Producto", "IESS", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("No hay suficiente cantidad de Producto", "IESS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("Ingrese la cantidad del Producto", "IESS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void GuardarDetalle() { using (VeterinariaEntities contexto = new VeterinariaEntities()) { _detalle = new Detalle() { Atencion = _atencionId, Observacion = txtObservacion.Text, Valor = Convert.ToInt32(txtUnitario.Text) }; contexto.Entry(_detalle).State = System.Data.Entity.EntityState.Added; contexto.SaveChanges(); CargarDetalle(); LimpiarDetalle(); MessageBox.Show( $"Se guardo el detalle para la atencion Nº {_atencionId}", ".:Sistema Veterinaria:.", MessageBoxButtons.OK, MessageBoxIcon.Information ); CalcularMontos(); } }
private void button1_Click(object sender, EventArgs e) { DialogResult respuesta = MessageBox.Show( "Esta seguro de cambiar a otra antencion.", ".:Sistema Veterinaria:.", MessageBoxButtons.YesNo, MessageBoxIcon.Information ); if (respuesta == DialogResult.Yes) { _atencion = null; _detalle = null; _atencionId = 0; cbxMascota.Enabled = true; cbxCliente.Enabled = true; txtObservacion.Enabled = false; txtUnitario.Enabled = false; txtIva.Clear(); txtSubtotal.Clear(); txtTotal.Clear(); dgvListado.Rows.Clear(); cbxCliente.Focus(); } txtUnitario.Focus(); }
public static int ActualizarDetallePorId(Detalle vehiculo) { int filasAfectadas = 0; using (SqlConnection sqlConnection = new SqlConnection(connectionString)) { SqlCommand sqlCommand = new SqlCommand(null, sqlConnection); sqlCommand.CommandText = "UPDATE Detalle SET idCompra = @compra, idVehiculo = @auto WHERE idDetalle = @idDetalle"; sqlCommand.Parameters.AddWithValue("@compra", vehiculo.IdCompra); sqlCommand.Parameters.AddWithValue("@auto", vehiculo.IdVehiculo); sqlCommand.Parameters.AddWithValue("@idDetalle", vehiculo.IdDetalle); try { sqlConnection.Open(); filasAfectadas = sqlCommand.ExecuteNonQuery(); sqlConnection.Close(); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(filasAfectadas); } }
public static int AgregarDetalle(Detalle vehiculo) { int filasAfectadas = 0; using (SqlConnection sqlConnection = new SqlConnection(connectionString)) { SqlCommand sqlCommand = new SqlCommand(null, sqlConnection); sqlCommand.CommandText = "INSERT INTO Detalle (idCompra,idVehiculos) values (@compra,@auto)"; sqlCommand.Parameters.AddWithValue("@compra", vehiculo.IdCompra); sqlCommand.Parameters.AddWithValue("@auto", vehiculo.IdVehiculo); try { sqlConnection.Open(); filasAfectadas = sqlCommand.ExecuteNonQuery(); sqlConnection.Close(); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(filasAfectadas); } }
void registrar() { Venta ve = new Venta(); List <Detalle> lista = new List <Detalle>(); foreach (DataRow item in tbDetalle.Rows) { Detalle d = new Detalle(); d.IdProducto = Int32.Parse(item[0].ToString()); d.Precio = decimal.Parse(item[2].ToString()); d.Cantidad = Int32.Parse(item[3].ToString()); d.Descuento = 0; lista.Add(d); } try { ve.IdCliente = cboCliente.SelectedValue.ToString(); ve.IdEmpleado = (int)cboEmpleado.SelectedValue; ve.Fecha = DateTime.Parse(txtFecha.Text); ve.Monto = decimal.Parse(txtTotal.Text); ve.Item = lista; txtNro.Text = VentaBll.RegistarVenta(ve).ToString(); nFactura = int.Parse(txtNro.Text); MessageBox.Show("Venta registrada correctamente", "Registrar", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error Fatal"); } }
public IHttpActionResult PutDetalle(int id, Detalle detalle) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != detalle.idDetalle) { return(BadRequest()); } try { DetalleBLL.Update(detalle); return(Content(HttpStatusCode.OK, "Detalle actualizado correctamente")); } catch (Exception ex) { Detalle det = DetalleBLL.Get(id); if (det == null) { return(NotFound()); } else { return(StatusCode(HttpStatusCode.NoContent)); } } }
public bool registarDetalle(Detalle detalle) { ConexionBD conexionBD = new ConexionBD(); try { string queryInsert = "INSERT INTO detalle VALUE ('" + detalle.Id + "','" + detalle.Id_det + "','" + detalle.Id_prod + "','" + detalle.Cantidad + "'," + detalle.Id_doc + "');"; //-------------consultar conexionBD.abrirConexion(); SqlCommand cmd = new SqlCommand(queryInsert, conexionBD.Conexion); int aux = cmd.ExecuteNonQuery(); if (aux > 0) { return(true); } else { return(false); } } catch (Exception) { return(false); } finally { conexionBD.cerrarConexion(); } }
/// <summary> /// Permite agregar un nuevo detalle de una transacccion /// </summary> /// <param name="idtransaccion"> Representa el numero de identificacion de una transaccion existente</param> /// <param name="IdTipoDetalle">Representa el numero de identificacion de un tipo de detalle</param> /// <param name="Descripcion">Representa la descripcion del detalle</param> /// <param name="cantidad">Representa la cantidad ingresar de la transaccion</param> /// <param name="TipoTransaccion">Representa el numero </param> /// <param name="activo">Representa el estado del detalle</param> /// <returns></returns> public static int agregar(int idtransaccion, int IdTipoDetalle, string Descripcion, decimal cantidad, int TipoTransaccion, bool activo) { int result = -1; Detalle det = new Detalle() { IdTransaccion = idtransaccion, TipoDetalle = IdTipoDetalle, Descripcion = Descripcion, Cantidad = cantidad, TipoTransaccion = TipoTransaccion, Activo = activo }; try { _Detalle db = new _Detalle(det); result = db.agregar(); } catch (Exception ex) { result = -1; throw ex; } return(result); }
public async Task <IActionResult> PutDetalle(int id, Detalle detalle) { if (id != detalle.numEmision) { return(BadRequest()); } _context.Entry(detalle).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DetalleExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public Detalle Post(Detalle dta) { var local = _context.Detalle.Local.FirstOrDefault(e => e.IdDetalles.Equals(dta.IdDetalles)); if (local != null) { _context.Entry(local).State = EntityState.Detached; } if (dta.IdDetalles == 0) { _context.Entry(dta).State = EntityState.Detached; } else { _context.Entry(dta).State = EntityState.Modified; } //if (dta.IdDetalles == 0) //{ // _context.Detalle.Add(dta); //} //else //{ // _context.Detalle.Attach(dta); // _context.Detalle.Update(dta); //} _context.SaveChanges(); return(dta); }
public async Task <ActionResult <Detalle> > PostDetalle(Detalle detalle) { _context.Detalles.Add(detalle); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDetalle", new { id = detalle.numEmision }, detalle)); }
public List <DetalleLogistica> conocerDetalleLogistica(int codigoEntrega) { acceso = new AccesoDatos(); conexion = new SqlConnection(acceso.CadenaConexion()); consulta = new SqlCommand("select codigoDetalleLogistica, codigoArticulo, cantidad from DetallesLogistica where codigoEntrega='" + codigoEntrega + "'", conexion); try { conexion.Open(); lector = consulta.ExecuteReader(); while (lector.Read()) { Detalle.Add(new DetalleLogistica() { CodigoDetalleLogistica = int.Parse(lector["codigoDetalleLogistica"].ToString()), Cantidad = int.Parse(lector["cantidad"].ToString()), CodigoArticulo = int.Parse(lector["codigoArticulo"].ToString()) }); } return(Detalle); } catch (SqlException) { return(Detalle); } finally { conexion.Close(); } }
private static Detalle GenerarSubDetalle() { Detalle subDetalle = new Detalle(); subDetalle.NombreTabla = "subRegistro"; subDetalle.Campos = new List <CampoDetalle>(); CampoDetalle registro = new CampoDetalle() { NombreCampo = "NTARJCLI", NombreBaseDeDatos = "NumeroTarjetaCliente", Descripcion = "Número de Tarjeta socio", Longitud = 16, Offset = 0, PadCaracter = '0', IsPadLeft = true }; subDetalle.Campos.Add(registro); registro = new CampoDetalle() { NombreCampo = "AB", NombreBaseDeDatos = "AltaBaja", Descripcion = "Altas o Bajas de Listas", Longitud = 1, Offset = 16, PadCaracter = '0', IsPadLeft = true }; subDetalle.Campos.Add(registro); return(subDetalle); }
private void btnAgregar_Click(object sender, EventArgs e) { float subtotal = 0; float ivatotal = 0; float total = 0; Detalle detalle = new Detalle(); detalle.CodigoD = codigoDet; detalle.CantidadD = int.Parse(txtCantidad.Text); detalle.ProductoD = cbxDetalle.Text; detalle.PrecioD = Convert.ToSingle(txtPrecio.Text); detalle.IvaD = Convert.ToSingle(txtIVA.Text); detalle.ImporteD = Convert.ToSingle(txtImporte.Text); listaDetalles.Add(detalle); BindingSource bs = new BindingSource(listaDetalles, ""); tblDatos.DataSource = bs; codigoDet++; foreach (Detalle d in listaDetalles) { subtotal += d.ImporteD; ivatotal += d.IvaD; total = subtotal + ivatotal; } txtSubtotal.Text = subtotal.ToString(); txtIvaTotal.Text = ivatotal.ToString(); txtTotal.Text = total.ToString(); btnTerminar.Enabled = true; }
private static Detalle GenerarDetalle() { Detalle detalle = new Detalle(); detalle.NombreTabla = "registro"; detalle.Campos = new List <CampoDetalle>(); CampoDetalle campoDetalle = new CampoDetalle() { NombreCampo = "T-LISTA", NombreBaseDeDatos = "TipoLista", Descripcion = "Tipo de lista", Longitud = 2, Offset = 0, PadCaracter = '0', IsPadLeft = true }; detalle.Campos.Add(campoDetalle); campoDetalle = new CampoDetalle() { NombreCampo = "COD-TEXTO", NombreBaseDeDatos = "CodigoTexto", Descripcion = "Código de texto", Longitud = 35, Offset = 6, PadCaracter = '0', IsPadLeft = true }; detalle.Campos.Add(campoDetalle); return(detalle); }
private static Detalle GenerarRegistro() { Detalle detalle = new Detalle(); detalle.NombreTabla = "registro"; detalle.Campos = new List <CampoDetalle>(); CampoDetalle campoDetalle = new CampoDetalle() { NombreCampo = "COD-TEXTO", NombreBaseDeDatos = "CodigoTexto", Descripcion = "Código del texto", Longitud = 4, Offset = 0, PadCaracter = '0', IsPadLeft = true }; detalle.Campos.Add(campoDetalle); campoDetalle = new CampoDetalle() { NombreCampo = "DESCR", NombreBaseDeDatos = "DescripcionMensaje", Descripcion = "Descripción del mensaje", Longitud = 35, Offset = 4, PadCaracter = ' ', IsPadLeft = false }; detalle.Campos.Add(campoDetalle); return(detalle); }
public void Resetear() { this.txtvuelto.Text = ""; this.TxtDineroCliente.Text = ""; this.TxtIdVenta.Text = ""; this.TxtNeto.Text = ""; this.TxtIva.Text = ""; this.TxtTotal.Text = ""; this.TxtNombre.Text = ""; this.TxtMaterno.Text = ""; this.TxtPaterno.Text = ""; this.TxtNombreProducto.Text = ""; this.TxtCantidadProducto.Text = ""; this.TxtCondiciones.Text = ""; this.groupBox1.Enabled = false; this.groupBox2.Enabled = false; this.groupBox3.Enabled = false; this.VentaSeleccionada = null; this.Productoseleccionado = null; this.Clienteseleccionado = null; this.detalleseleccionado = null; this.TxtDineroCliente.Enabled = false; this.txtvuelto.Enabled = false; this.BtnTerminarVenta.Enabled = false; this.BtnCancelarVenta.Enabled = false; this.BtnNuevaVenta.Enabled = true; }
public FrmNewModCompras(Detalle detalle) { InitializeComponent(); _proveedor = new Proveedor(); _ordenDecompra = new OrdenDeCompra(); detalle_ = new Detalle(); Validacion.combo2campos(cboProveedor, "RazonSocial", "IdProveedor", "Proveedores"); Validacion.combo2campos(cboEstado, "DescripcionOrdenCompra", "IdEstadoOrdenCompra", "EstadoOrdenCompra"); if (detalle != null) { BtnGenerar.Enabled = false; BtnGenerar.Visible = false; detalle_.ordenCompra.IdOrdenDeCompra = detalle.ordenCompra.IdOrdenDeCompra; detalle_.proveedor.IdProveedor = detalle.proveedor.IdProveedor; cboProveedor.Text = detalle.proveedor.RazonSocial.ToString(); cboProveedor.Enabled = false; listarDetalles(); } else { btnModificar.Enabled = false; btnModificar.Visible = false; } }
public static Task EncodeTimbre417(Detalle d, TipoTask task) { return(Task.Run(() => { string ted = null; switch (task) { case TipoTask.Creditor: ted = d.DteInfoRefLast.FirmaDTE; break; case TipoTask.Debtor: DTEDefTypeDocumento doc = (DTEDefTypeDocumento)d.DTEDef.Item; ted = HSerialize.TED_To_Xml(doc.TED); break; } BarcodeWriter timbre417 = new BarcodeWriter { Format = BarcodeFormat.PDF_417, Options = new PDF417EncodingOptions() { ErrorCorrection = ZXing.PDF417.Internal.PDF417ErrorCorrectionLevel.L5, Height = 3, Width = 9, Compaction = ZXing.PDF417.Internal.Compaction.BYTE } }; timbre417 .Write(ted) .Save(Path.GetTempPath() + $"\\timbre{d.Folio}.png"); })); }
public async Task <IActionResult> Edit(int id, [Bind("idDetalle,idCliente,idDistribuidor")] Detalle detalle) { if (id != detalle.idDetalle) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(detalle); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DetalleExists(detalle.idDetalle)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["idCliente"] = new SelectList(_context.Cliente, "idCliente", "idCliente", detalle.idCliente); ViewData["idDistribuidor"] = new SelectList(_context.Distribuidores, "idDistribuidor", "idDistribuidor", detalle.idDistribuidor); return(View(detalle)); }
public IHttpActionResult PutDetalle(int id, Detalle detalle) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != detalle.ID) { return(BadRequest()); } db.Entry(detalle).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DetalleExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }