public Calendar getExpectedDate() throws SQLException, ConnectException {
		Connection con = ConnectionService.getConnection();
		String query = "select count(*), expected_date from  purchase where DELIVERY_DATE is null group by EXPECTED_DATE having EXPECTED_DATE=(select EXPECTED_DATE from PURCHASE where RECEIPTID=(SELECT MAX(RECEIPTID) from PURCHASE))";
		PreparedStatement query_ps = con.prepareStatement(query);
		Calendar cal = new GregorianCalendar();
		ResultSet rs = query_ps.executeQuery();
		while (rs.next()) {
			if (rs.getInt(1) < 3) {
				Date date = rs.getDate(2);

				// long j= date.getTime()-cal.getTimeInMillis();
				cal.setTimeInMillis(date.getTime());
			} else {
				Date date = rs.getDate(2);
				cal.setTimeInMillis(date.getTime());
				cal.add(Calendar.DATE, 1);
			}
		}
		return cal;
	}