public FormulasVM() { //General setup Formulas = new ObservableCollection <Formula>(FormulaQueries.GetFormulas()); InactiveFormulas = new ObservableCollection <Formula>(FormulaQueries.GetFormulasInactivas()); NewFormulaProducts = new ObservableCollection <formulaProduct>(ProductQueries.GetFormulaProducts()); NuevaFormulaCommand = new NewFormulaCommand(this); AddDetalleNewFormulaDataGrid = new NewFormulaDetalleDatagridCommand(this); newFormulaAddInstruction = new NewFormulaAddInstructionCommand(this); editDetalleCommand = new EditDetalleCommand(this); newDetalleCommand = new NewDetalleCommand(this); newInstructionCommand = new NewInstructionCommand(this); editFormulacommand = new EditFormulaCommand(this); Transformations = new ObservableCollection <Formula>(FormulaQueries.GetFormulasTransformaciones()); UnidadCreada = new ObservableCollection <string> { "galones", "kilos" }; FormasFarmaceuticas = new ObservableCollection <string> { "jarabe", "tableta", "pildora", "suspension" }; //new formula modal window setup NewFormula = new Formula(); NewFormulaSelectedProduct = new formulaProduct(); NewFormulaNewDetalle = new DetalleFormula(); NewFormulaNewInstruction = new ProcedimientoDetalle(); SelectedFormula = Formulas[0]; }
public static List <formulaProduct> GetAllContainerMPFromAmount(int amount) { var mp = new List <formulaProduct>(); cn = DBConnection.MainConnection(); try { cmd = new OleDbCommand("SELECT codigo,nombre_producto,unidad_metrica,materia_prima.conversion_unitaria,unidad_muestra,cantidad_unidad_lote from materia_prima " + "INNER JOIN lote_entrada on materia_prima.codigo = lote_entrada.cod_mp " + " WHERE (codigo LIKE 'ENV%' OR codigo LIKE 'ETI%' OR codigo LIKE 'TP%') and cantidad_unidad_lote >= " + amount + " ;", cn); dr = cmd.ExecuteReader(); while (dr.Read()) { formulaProduct temp = new formulaProduct(); temp.Codigo = dr["codigo"].ToString(); temp.Nombre = dr["nombre_producto"].ToString(); temp.Unidad = "u"; temp.ConversionValue = 1; temp.UnidadMuestra = "u"; mp.Add(temp); } dr.Close(); cn.Close(); } catch (Exception ex) { System.Windows.MessageBox.Show("Error al buscar materia prima para formulas. " + ex.ToString()); } return(mp); }
public static List <formulaProduct> GetAllContainersMP() { var mp = new List <formulaProduct>(); cn = DBConnection.MainConnection(); try { cmd = new OleDbCommand("SELECT codigo,nombre_producto,unidad_metrica,conversion_unitaria,unidad_muestra from materia_prima" + " WHERE (codigo LIKE 'ENV%' OR codigo LIKE 'ETI%' OR codigo LIKE 'TP%');", cn); dr = cmd.ExecuteReader(); while (dr.Read()) { formulaProduct temp = new formulaProduct(); temp.Codigo = dr["codigo"].ToString(); temp.Nombre = dr["nombre_producto"].ToString(); temp.Unidad = dr["unidad_metrica"].ToString(); temp.ConversionValue = double.Parse(dr["conversion_unitaria"].ToString()); temp.UnidadMuestra = dr["unidad_muestra"].ToString(); mp.Add(temp); } dr.Close(); cn.Close(); } catch (Exception ex) { System.Windows.MessageBox.Show("Error al buscar materia prima para formulas. " + ex.ToString()); } return(mp); }
public ReferenciasVM() { FacturaResults = new ObservableCollection <Factura>(); PlaceHolder = new emptyObject(); getFacturasCommand = new GetFacturasCommand(this); getLotesSalCommand = new GetLotesSalCommand(this); Productos = new ObservableCollection <formulaProduct>(ProductQueries.GetAllMpSimplified()); Lotes = new ObservableCollection <LoteEntrada>(); IsEnabledLotes = false; IsEnabledMP = true; PlaceHolder.EmptyCantidad = 12; PlaceHolder.EmptyAmount = 12.21; SelectedLote = new LoteEntrada(); SelectedProduct = new formulaProduct(); Tipos = new ObservableCollection <string> { "Lote Salida", "Lote Producto Terminado" }; }