private int getDoctorSessionValue() { int sessionVal = 0; Doctor doctor = doctorService.get(Long.parseLong(doctorID)); SessionPayment sp = spService.getSpExistPatient(id); for (DoctorSession ds : sp.getListOfSession()) { if (ds.getDoctor().getId() == doctor.getId()) { sessionVal += ds.getSum(); } } return sessionVal; }
public int checkVal() { Doctor doctor = doctorService.get(Long.parseLong(doctorID)); SessionPayment sp = spService.getSpExistPatient(id); int sessionVal = 0; for (DoctorSession ds : sp.getListOfSession()) { if (ds.getDoctor().getId() == doctor.getId()) { sessionVal += ds.getSum(); } } int paymentVal = 0; for (Payment p : sp.getListOfPayment()) { Doctor doctor1 = paymentService.get(p.getId()).getDoctor(); if (doctor1 != null) if (doctor1.getId() == doctor.getId()) { paymentVal += p.getValue(); } } return sessionVal - paymentVal; }