public ArrayList
ArrayList
int idpersona=Integer.parseInt(id);
ArrayList
Balance bia;
try {
Session sesion = HibernateUtil.getSessionFactory().getCurrentSession();
sesion.beginTransaction();
Query q = sesion.createSQLQuery("select p.nombre, p.apellido, sum(m.valor), monthname(m.fecha), year(m.fecha) from persona p, movimiento m where p.id_persona=m.fk_id_persona and p.id_persona="+idpersona+" and m.tipo='Ingreso' group by(p.nombre), monthname(m.fecha), year(m.fecha)");
bIngresosAdminList = (ArrayList
Iterator it=bIngresosAdminList.iterator();
while (it.hasNext()) {
Object[] result=(Object[])it.next();
bia=new Balance();
bia.setNombre((String) result[0]);
bia.setApellido((String) result[1]);
bia.setTotal((Double) result[2]);
bia.setMes((String) result[3]);
bia.setAnio((Integer) result[4]);
nueva.add(bia);
}
} catch (Exception e) {
e.printStackTrace();
}
return nueva;
}
public ArrayList
ArrayList
int idpersona=Integer.parseInt(id);
ArrayList
Balance bea;
try {
Session sesion = HibernateUtil.getSessionFactory().getCurrentSession();
sesion.beginTransaction();
Query q = sesion.createSQLQuery("select p.nombre, p.apellido, sum(m.valor), monthname(m.fecha), year(m.fecha) from persona p, movimiento m where p.id_persona=m.fk_id_persona and p.id_persona="+idpersona+" and m.tipo='Egreso' group by(p.nombre), monthname(m.fecha), year(m.fecha)");
bEgresosAdminList = (ArrayList
Iterator it=bEgresosAdminList.iterator();
while (it.hasNext()) {
Object[] result=(Object[])it.next();
bea=new Balance();
bea.setNombre((String) result[0]);
bea.setApellido((String) result[1]);
bea.setTotal((Double) result[2]);
bea.setMes((String) result[3]);
bea.setAnio((Integer) result[4]);
nueva.add(bea);
}
} catch (Exception e) {
e.printStackTrace();
}
return nueva;
}
public ArrayList
ArrayList
int idpersona=Integer.parseInt(id);
ArrayList
Balance bie;
try {
Session sesion = HibernateUtil.getSessionFactory().getCurrentSession();
sesion.beginTransaction();
Query q = sesion.createSQLQuery("select p.nombre, p.apellido, sum(m.valor), monthname(m.fecha), year(m.fecha) from persona p, movimiento m where p.id_persona=m.fk_id_persona and p.id_persona="+idpersona+" and m.tipo='Ingreso' group by(p.nombre), monthname(m.fecha), year(m.fecha)");
bIngresosEmpList = (ArrayList
Iterator it=bIngresosEmpList.iterator();
while (it.hasNext()) {
Object[] result=(Object[])it.next();
bie=new Balance();
bie.setNombre((String) result[0]);
bie.setApellido((String) result[1]);
bie.setTotal((Double) result[2]);
bie.setMes((String) result[3]);
bie.setAnio((Integer) result[4]);
nueva.add(bie);
}
} catch (Exception e) {
e.printStackTrace();
}
return nueva;
}
public ArrayList
ArrayList
int idpersona=Integer.parseInt(id);
ArrayList
Balance bee;
try {
Session sesion = HibernateUtil.getSessionFactory().getCurrentSession();
sesion.beginTransaction();
Query q = sesion.createSQLQuery("select p.nombre, p.apellido, sum(m.valor), monthname(m.fecha), year(m.fecha) from persona p, movimiento m where p.id_persona=m.fk_id_persona and p.id_persona="+idpersona+" and m.tipo='Egreso' group by(p.nombre), monthname(m.fecha), year(m.fecha)");
bEgresosEmpList = (ArrayList
Iterator it=bEgresosEmpList.iterator();
while (it.hasNext()) {
Object[] result=(Object[])it.next();
bee=new Balance();
bee.setNombre((String) result[0]);
bee.setApellido((String) result[1]);
bee.setTotal((Double) result[2]);
bee.setMes((String) result[3]);
bee.setAnio((Integer) result[4]);
nueva.add(bee);
}
} catch (Exception e) {
e.printStackTrace();
}
return nueva;
}
No hay comentarios:
Publicar un comentario