<%@ page language="java" session="true" contentType="text/html;charset=ISO-8859-1" %>
<%@ page pageEncoding="ISO-8859-1"%>
<%@ page import="com.etixpert.evolution.gui.servlets.*"%>
<%@ page import="com.etixpert.evolution.app.bonus.*"%>
<%@ page import="org.apache.log4j.*"%>
<%@ page import="java.util.*"%>
<%@ include file="header.jsp" %>
<%@ include file="check.jsp" %>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/style.css" rel="stylesheet" type="text/css">
<!--<div align="center"><h2>Under construction</h2></div>-->
<%
	String   userLoggeds    = (String) session.getAttribute("USER_LOGGED_ID");
	Integer  userLogged     = new Integer(userLoggeds);
	Integer  distributorId  = (Integer) session.getAttribute("BONUSDETAILS_DISTRIBUTOR_INTEGER");
	int      dateval        = 0;
	Calendar cDate          = (Calendar) session.getAttribute("BONUS_DATE");
	if (cDate != null) {
		dateval = cDate.get(java.util.Calendar.YEAR) * 12 +
		          cDate.get(java.util.Calendar.MONTH);
	}
	String message          = (String)   session.getAttribute("BONUS_MESSAGE");
	session.setAttribute("BONUS_MESSAGE", null);
%>
<SCRIPT LANGUAGE="JavaScript">
<!-- JavaScript code hiding

	function generatePDF(id) {
		open('process/bonus_print.jsp?pageAction=bonus_print&saveState=nothing&distr_id=' + id + '&date=<%= ("" + (dateval % 12 + 101)).substring(1)%>.<%=dateval / 12%>', '_blank', '')
	}

<% if (message != null) { %>
	alert('<%=message%>');
<% } %>
// -->
</SCRIPT>
</head>
<body>

<% if (distributorId != null && cDate != null) {
	 int cc = BonusList.TYPE_BONUSLIST;
         int idist = distributorId.intValue();
	 if (idist<0) {
		distributorId = new Integer(-idist);
		cc = BonusList.TYPE_BONUSDETAIL;
	 }
	 out.println(BonusList.generate(distributorId, userLogged, cDate.getTime(), cc = BonusList.TYPE_BONUSDETAIL, pageContext.getServletContext().getRealPath("WEB-INF")));
   }
%>
</body>
</html>
