void txtIngrediente_Validating(object sender, CancelEventArgs e) { DevExpress.XtraEditors.TextEdit Editor = (DevExpress.XtraEditors.TextEdit) this.gridControl1.MainView.ActiveEditor; if (!Editor.IsModified) { return; } string Texto = Editor.Text; platoIngrediente = (PlatosIngrediente)this.platosIngredienteBindingSource.Current; if (UbicarProducto(Texto)) { if (ingrediente == null) { Editor.Undo(); e.Cancel = true; return; } LeerIngrediente(false); Editor.Text = ingrediente.Descripcion; } else { LeerIngrediente(false); Editor.Undo(); } }
void btnCargarReceta_Click(object sender, EventArgs e) { Plato p = new Plato(); FrmBuscarEntidades f = new FrmBuscarEntidades(); f.BuscarPlatos(""); if (f.DialogResult != System.Windows.Forms.DialogResult.OK) { return; } p = (Plato)f.registro; foreach (PlatosIngrediente item in p.PlatosIngredientes) { PlatosIngrediente nuevo = new PlatosIngrediente(); nuevo.Cantidad = item.Cantidad; nuevo.CostoRacion = item.CostoRacion; nuevo.IdIngrediente = item.IdIngrediente; nuevo.Ingrediente = item.Ingrediente; nuevo.Raciones = item.Raciones; nuevo.Total = item.Total; nuevo.UnidadMedida = item.UnidadMedida; nuevo.IdPlatoIngrediente = FactoryContadores.GetMax("IdPlatoIngrediente"); registro.PlatosIngredientes.Add(nuevo); } this.platosIngredienteBindingSource.ResetBindings(true); }
private void gridControl1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { gridView1.MoveBy(0); } if (gridView1.ActiveEditor == null) { if (e.KeyCode == Keys.Delete || e.KeyCode == Keys.Subtract) { if (this.gridView1.IsFocusedView) { PlatosIngrediente i = (PlatosIngrediente)this.platosIngredienteBindingSource.Current; if (i == null) { return; } registro.PlatosIngredientes.Remove(i); this.platosIngredienteBindingSource.DataSource = registro.PlatosIngredientes; } e.Handled = true; } } }
private void txtCantidad_Validating(object sender, CancelEventArgs e) { DevExpress.XtraEditors.CalcEdit Editor = (DevExpress.XtraEditors.CalcEdit) this.gridControl1.MainView.ActiveEditor; if (!Editor.IsModified) { return; } platoIngrediente = (PlatosIngrediente)this.platosIngredienteBindingSource.Current; platoIngrediente.Total = (double)(double)Editor.Value * platoIngrediente.CostoRacion; }
private void LeerIngrediente(bool Buscar) { if (ingrediente == null) { return; } platoIngrediente = (PlatosIngrediente)this.platosIngredienteBindingSource.Current; platoIngrediente.Cantidad = 1; platoIngrediente.CostoRacion = ingrediente.Costo; platoIngrediente.IdIngrediente = ingrediente.IdIngrediente; platoIngrediente.Ingrediente = ingrediente.Descripcion; platoIngrediente.Raciones = 1; platoIngrediente.UnidadMedida = ingrediente.UnidadMedida; platoIngrediente.Total = platoIngrediente.Cantidad * platoIngrediente.CostoRacion; platoIngrediente.UnidadMedida = ingrediente.UnidadMedida; }
public static LibroInventario CrearItem(int?mes, int?año, PlatosIngrediente item) { using (var db = new DatosEntities()) { DateTime FechaInventario = Convert.ToDateTime("01/" + mes.Value.ToString("00") + "/" + año.Value.ToString("0000")); LibroInventario ant = (from p in db.LibroInventarios where p.Fecha < FechaInventario && p.IdProducto == item.IdPlato select p).FirstOrDefault(); LibroInventario q = new LibroInventario(); q.IdProducto = item.IdIngrediente; q.Fecha = FechaInventario; q.Inicio = ant == null ? 0 : ant.InventarioFisico; q.Entradas = 0; q.Salidas = 0; q.Final = 0; q.InventarioFisico = 0; q.Ajustes = 0; q.Mes = mes; q.Año = año; q.Producto = item.Ingrediente; return(q); } }
void txtIngrediente_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { platoIngrediente = (PlatosIngrediente)this.platosIngredienteBindingSource.Current; UbicarProducto(""); LeerIngrediente(false); }