Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. for (int i = 0; i < meses.length; i++) {
  2. recorrerMeses(i);
  3. }
  4.  
  5. Query datos = FirebaseDatabase.getInstance().getReference(nodos.nodoControl).orderByChild(nodos.nodo_dni).equalTo(usuarios.getDni());
  6. datos.addListenerForSingleValueEvent(new ValueEventListener() {
  7. @Override
  8. public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
  9. if (dataSnapshot.exists()) {
  10. for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
  11. Control c = snapshot.getValue(Control.class);
  12. if (c.getFecha() >= lgfechaMin && c.getFecha() <= lgfechaMax) {
  13. if (String.valueOf(c.getCantidad()).contains("-")) {
  14. saldoNegativo += Float.parseFloat(String.valueOf(c.getCantidad()));
  15. } else {
  16. saldoPositivo += Float.parseFloat(String.valueOf(c.getCantidad()));
  17. }
  18. } else {
  19. saldoNegativo = 0f;
  20. saldoPositivo = 0f;
  21. }
  22. }
  23. entradasPositivas.add(new BarEntry(i, saldoPositivo));
  24. entradasNegativas.add(new BarEntry(i, saldoNegativo));
  25. crearGrafica();
  26. }
  27. }
  28.  
  29. @Override
  30. public void onCancelled(@NonNull DatabaseError databaseError) {
  31. Toast.makeText(gráficaMensual.this, "Error en el servidor", Toast.LENGTH_SHORT).show();
  32. }
  33. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement