public List <GestionArticulos> InformeGestionArticulosFiltroArticuloTiempo(string articulo, DateTime desde, DateTime hasta) { List <GestionArticulos> gaList = new List <GestionArticulos>(); try { OpenConnection(); NpgsqlCommand cmdSel = new NpgsqlCommand("select * from suma_stock " + "inner join articulos on id = id_articulo " + "where fecha_suma BETWEEN @desde and @hasta and nombre LIKE '%' || @filtro || '%' " + "UNION " + "select * from perdida_stock " + " inner join articulos on id = id_articulo " + " where fecha_perdida BETWEEN @desde and @hasta and nombre LIKE '%' || @filtro || '%' order by fecha_suma DESC ", npgsqlConn); cmdSel.Parameters.Add("@filtro", NpgsqlTypes.NpgsqlDbType.Varchar, 50).Value = articulo; cmdSel.Parameters.Add("@desde", NpgsqlTypes.NpgsqlDbType.Date).Value = desde; cmdSel.Parameters.Add("@hasta", NpgsqlTypes.NpgsqlDbType.Date).Value = hasta; NpgsqlDataReader drArt = cmdSel.ExecuteReader(); while (drArt.Read()) { GestionArticulos ga = new GestionArticulos(); ga.ID = (string)drArt["id_articulo"]; ga.Nombre = (string)drArt["nombre"]; ga.Fecha_movimiento = (DateTime)drArt["fecha_suma"]; ga.Descripcion = (string)drArt["razon_de_suma"] + " (" + (int)drArt["cantidad"] + " " + (string)drArt["unidad"] + ")"; ga.Signo = Convert.ToChar((string)drArt["signo"]); gaList.Add(ga); } } finally { CloseConnection(); } return(gaList); }
public List <GestionArticulos> InformeGestionArticulos() { List <GestionArticulos> gaList = new List <GestionArticulos>(); try { OpenConnection(); NpgsqlCommand cmdSel = new NpgsqlCommand("select * from suma_stock " + "inner join articulos on id = id_articulo where EXTRACT(YEAR FROM fecha_suma) = EXTRACT(YEAR FROM current_date) " + "UNION " + " select * from perdida_stock " + "inner join articulos on id = id_articulo where EXTRACT(YEAR FROM fecha_perdida) = EXTRACT(YEAR FROM current_date) order by fecha_suma DESC ", npgsqlConn); NpgsqlDataReader drArt = cmdSel.ExecuteReader(); while (drArt.Read()) { GestionArticulos ga = new GestionArticulos(); ga.ID = (string)drArt["id_articulo"]; ga.Nombre = (string)drArt["nombre"]; ga.Fecha_movimiento = (DateTime)drArt["fecha_suma"]; ga.Descripcion = (string)drArt["razon_de_suma"] + " (" + (int)drArt["cantidad"] + " " + (string)drArt["unidad"] + ")"; ga.Signo = Convert.ToChar((string)drArt["signo"]); gaList.Add(ga); } } finally { CloseConnection(); } return(gaList); }
private void _ControlBotones(string obj) { Visible1 = Visibility.Visible; Visible2 = Visibility.Hidden; RaisePropertyChanged("Visible1"); RaisePropertyChanged("Visible2"); switch (obj) { case "btnUsuarios": VistaContenida = new GestionUsuarios(); RaisePropertyChanged("VistaContenida"); break; case "btnClientes": VistaContenida = new GestionClientes(); RaisePropertyChanged("VistaContenida"); break; case "btnMascotas": VistaContenida = new GestionMascotas(); RaisePropertyChanged("VistaContenida"); break; case "btnProveedores": VistaContenida = new GestionProveedores(); RaisePropertyChanged("VistaContenida"); break; case "btnArticulos": VistaContenida = new GestionArticulos(); RaisePropertyChanged("Vistacontenida"); break; case "btnServicios": VistaContenida = new GestionServicios(); RaisePropertyChanged("Vistacontenida"); break; case "btnPedirCita": VistaContenida = new PedirCita(); RaisePropertyChanged("Vistacontenida"); break; case "btnVerCita": VistaContenida = new VerCita(); RaisePropertyChanged("Vistacontenida"); break; case "btmCobrar": VistaContenida = new Cobrar(); RaisePropertyChanged("Vistacontenida"); break; default: Console.WriteLine("boton no implementado, date caña julian"); break; } }