// Path: src/main/java/com/webpagebytes/wpbsample/data/Session.java
// public class Session {
// 	private String id;
// 	private Integer user_id;
// 	private Date create_timestamp;
// 	private HashMap<String, Object> sessionMap;
// 	
// 	public String getId() {
// 		return id;
// 	}
// 	public void setId(String id) {
// 		this.id = id;
// 	}
// 	public Integer getUser_id() {
// 		return user_id;
// 	}
// 	public void setUser_id(Integer user_id) {
// 		this.user_id = user_id;
// 	}
// 	public Date getCreate_timestamp() {
// 		return create_timestamp;
// 	}
// 	public void setCreate_timestamp(Date create_timestamp) {
// 		this.create_timestamp = create_timestamp;
// 	}
// 
// 	public HashMap<String, Object> getSessionMap()
// 	{
// 		if (sessionMap == null)
// 		{
// 			sessionMap = new HashMap<String, Object>();
// 		}
// 		return sessionMap;
// 	}
// 	public void setSessionMap(HashMap<String, Object> sessionMap)
// 	{
// 		this.sessionMap = sessionMap;
// 	}
// 	
// }
// 
// Path: src/main/java/com/webpagebytes/wpbsample/data/Transaction.java
// public class Transaction {
// 	private Long id;
// 	private Date date;
// 	int source_user_id;
// 	int destination_user_id;
// 	Long amount;
// 	String sourceUserName;
// 	String destinationUserName;
// 	
// 	public String getSourceUserName() {
// 		return sourceUserName;
// 	}
// 	public void setSourceUserName(String sourceUserName) {
// 		this.sourceUserName = sourceUserName;
// 	}
// 	public String getDestinationUserName() {
// 		return destinationUserName;
// 	}
// 	public void setDestinationUserName(String destinationUserName) {
// 		this.destinationUserName = destinationUserName;
// 	}
// 	public Long getId() {
// 		return id;
// 	}
// 	public void setId(Long id) {
// 		this.id = id;
// 	}
// 	public Date getDate() {
// 		return date;
// 	}
// 	public void setDate(Date date) {
// 		this.date = date;
// 	}
// 	public int getSource_user_id() {
// 		return source_user_id;
// 	}
// 	public void setSource_user_id(int source_user_id) {
// 		this.source_user_id = source_user_id;
// 	}
// 	public int getDestination_user_id() {
// 		return destination_user_id;
// 	}
// 	public void setDestination_user_id(int destination_user_id) {
// 		this.destination_user_id = destination_user_id;
// 	}
// 	public Long getAmount() {
// 		return amount;
// 	}
// 	public void setAmount(Long amount) {
// 		this.amount = amount;
// 	}
// 	
// 	
// }
// 
// Path: src/main/java/com/webpagebytes/wpbsample/utility/DateUtility.java
// public class DateUtility {
// 	public static Date addDays(Date aDate, int days)
// 	{
// 		Calendar cal = Calendar.getInstance();
// 		cal.setTime(aDate);
// 		cal.add(Calendar.DATE, days);
// 		return cal.getTime();
// 	}
// 	public static Date getToday()
// 	{
// 		Calendar cal = Calendar.getInstance();
// 		cal.set(Calendar.HOUR_OF_DAY, 0);
// 		cal.set(Calendar.MINUTE, 0);
// 		cal.set(Calendar.SECOND, 0);
// 		cal.set(Calendar.MILLISECOND, 0);
// 		return cal.getTime();
// 	}
// }


import com.webpagebytes.wpbsample.data.Session;
import com.webpagebytes.wpbsample.data.Transaction;
import com.webpagebytes.wpbsample.utility.DateUtility;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.webpagebytes.cms.WPBForward;
import com.webpagebytes.cms.WPBModel;
import com.webpagebytes.cms.exception.WPBException;

		Integer user_id = (Integer) session.getSessionMap().get(SESSION_LOGIN_USERID); 
		
		int interval = getInterval(model);
		
		
		Date past = DateUtility.addDays(new Date(), -interval);
		List<Date> dates = new ArrayList<Date>();
		List<String> keys = new ArrayList<String>();
		Map<String, Long> receiveAmountPerDays = new HashMap<String, Long>();
		Map<String, Integer> receiveTransactionsPerDays = new HashMap<String, Integer>();
		Map<String, Long> paidAmountPerDays = new HashMap<String, Long>();
		Map<String, Integer> paidTransactionsPerDays = new HashMap<String, Integer>();

		for(int i = 0; i<= interval-1 ; i++)
		{
			
			Date aDate = DateUtility.addDays(past, i);
			dates.add(aDate);
			receiveAmountPerDays.put(String.valueOf(i), 0L);
			receiveTransactionsPerDays.put(String.valueOf(i), 0);
			paidAmountPerDays.put(String.valueOf(i), 0L);
			paidTransactionsPerDays.put(String.valueOf(i), 0);
			keys.add(String.valueOf(i));
		}
		int maxNumTransactions = 0;
		long maxAmountPerDay = 0;
		OutputStream os = null;
		try
		{
			List<Transaction> transactions = database.getTransactionsForUser(user_id, past, 1, MAX_RECORDS);

// Path: src/main/java/com/webpagebytes/wpbsample/data/Session.java
// public class Session {
// 	private String id;
// 	private Integer user_id;
// 	private Date create_timestamp;
// 	private HashMap<String, Object> sessionMap;
// 	
// 	public String getId() {
// 		return id;
// 	}
// 	public void setId(String id) {
// 		this.id = id;
// 	}
// 	public Integer getUser_id() {
// 		return user_id;
// 	}
// 	public void setUser_id(Integer user_id) {
// 		this.user_id = user_id;
// 	}
// 	public Date getCreate_timestamp() {
// 		return create_timestamp;
// 	}
// 	public void setCreate_timestamp(Date create_timestamp) {
// 		this.create_timestamp = create_timestamp;
// 	}
// 
// 	public HashMap<String, Object> getSessionMap()
// 	{
// 		if (sessionMap == null)
// 		{
// 			sessionMap = new HashMap<String, Object>();
// 		}
// 		return sessionMap;
// 	}
// 	public void setSessionMap(HashMap<String, Object> sessionMap)
// 	{
// 		this.sessionMap = sessionMap;
// 	}
// 	
// }
// 
// Path: src/main/java/com/webpagebytes/wpbsample/data/Transaction.java
// public class Transaction {
// 	private Long id;
// 	private Date date;
// 	int source_user_id;
// 	int destination_user_id;
// 	Long amount;
// 	String sourceUserName;
// 	String destinationUserName;
// 	
// 	public String getSourceUserName() {
// 		return sourceUserName;
// 	}
// 	public void setSourceUserName(String sourceUserName) {
// 		this.sourceUserName = sourceUserName;
// 	}
// 	public String getDestinationUserName() {
// 		return destinationUserName;
// 	}
// 	public void setDestinationUserName(String destinationUserName) {
// 		this.destinationUserName = destinationUserName;
// 	}
// 	public Long getId() {
// 		return id;
// 	}
// 	public void setId(Long id) {
// 		this.id = id;
// 	}
// 	public Date getDate() {
// 		return date;
// 	}
// 	public void setDate(Date date) {
// 		this.date = date;
// 	}
// 	public int getSource_user_id() {
// 		return source_user_id;
// 	}
// 	public void setSource_user_id(int source_user_id) {
// 		this.source_user_id = source_user_id;
// 	}
// 	public int getDestination_user_id() {
// 		return destination_user_id;
// 	}
// 	public void setDestination_user_id(int destination_user_id) {
// 		this.destination_user_id = destination_user_id;
// 	}
// 	public Long getAmount() {
// 		return amount;
// 	}
// 	public void setAmount(Long amount) {
// 		this.amount = amount;
// 	}
// 	
// 	
// }
// 
// Path: src/main/java/com/webpagebytes/wpbsample/utility/DateUtility.java
// public class DateUtility {
// 	public static Date addDays(Date aDate, int days)
// 	{
// 		Calendar cal = Calendar.getInstance();
// 		cal.setTime(aDate);
// 		cal.add(Calendar.DATE, days);
// 		return cal.getTime();
// 	}
// 	public static Date getToday()
// 	{
// 		Calendar cal = Calendar.getInstance();
// 		cal.set(Calendar.HOUR_OF_DAY, 0);
// 		cal.set(Calendar.MINUTE, 0);
// 		cal.set(Calendar.SECOND, 0);
// 		cal.set(Calendar.MILLISECOND, 0);
// 		return cal.getTime();
// 	}
// }


// Path: src/main/java/com/webpagebytes/wpbsample/controllers/ReportTransactionsController.java
import com.webpagebytes.wpbsample.data.Session;
import com.webpagebytes.wpbsample.data.Transaction;
import com.webpagebytes.wpbsample.utility.DateUtility;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.webpagebytes.cms.WPBForward;
import com.webpagebytes.cms.WPBModel;
import com.webpagebytes.cms.exception.WPBException;

		Integer user_id = (Integer) session.getSessionMap().get(SESSION_LOGIN_USERID); 
		
		int interval = getInterval(model);
		
		
		Date past = DateUtility.addDays(new Date(), -interval);
		List<Date> dates = new ArrayList<Date>();
		List<String> keys = new ArrayList<String>();
		Map<String, Long> receiveAmountPerDays = new HashMap<String, Long>();
		Map<String, Integer> receiveTransactionsPerDays = new HashMap<String, Integer>();
		Map<String, Long> paidAmountPerDays = new HashMap<String, Long>();
		Map<String, Integer> paidTransactionsPerDays = new HashMap<String, Integer>();

		for(int i = 0; i<= interval-1 ; i++)
		{
			
			Date aDate = DateUtility.addDays(past, i);
			dates.add(aDate);
			receiveAmountPerDays.put(String.valueOf(i), 0L);
			receiveTransactionsPerDays.put(String.valueOf(i), 0);
			paidAmountPerDays.put(String.valueOf(i), 0L);
			paidTransactionsPerDays.put(String.valueOf(i), 0);
			keys.add(String.valueOf(i));
		}
		int maxNumTransactions = 0;
		long maxAmountPerDay = 0;
		OutputStream os = null;
		try
		{
			List<Transaction> transactions = database.getTransactionsForUser(user_id, past, 1, MAX_RECORDS);

			for(Transaction transaction: transactions)
