private Detallado_ticket build_detallado(MySqlDataReader data) { Detallado_ticket item = new Detallado_ticket( data.GetInt16("folio"), data.GetString("fecha"), data.GetInt16("cantidad"), data.GetString("codigo"), data.GetString("descripcion"), data.GetDouble("total") ); return(item); }
public List <Detallado_ticket> get_detallado(string fecha_inicial, string fecha_final, int cliente) { string query = "select tbadetticket.id_ticket as folio, tbadetticket.cantidad, tbadetticket.total, tbatickets.fecha,tbaproductos.codigo, tbaproductos.descripcion from tbadetticket inner join tbatickets on tbadetticket.id_ticket=tbatickets.id inner join tbaproductos on tbadetticket.id_producto=tbaproductos.id where tbatickets.id_cliente='" + cliente.ToString() + "' and DATE_FORMAT(tbatickets.fecha,'%Y-%m-%d') BETWEEN '" + fecha_inicial + "' and '" + fecha_final + "' "; MySqlDataReader data = runQuery(query); List <Detallado_ticket> result = new List <Detallado_ticket>(); if (data.HasRows) { while (data.Read()) { Detallado_ticket item = build_detallado(data); result.Add(item); } } return(result); }