package ibase.dashboard.mfg.bean;

import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@SuppressWarnings("serial")
public class ProductionVsBudgetReportServlet extends HttpServlet
{

	public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
	{
		 doPost( request, response );
	}
    

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
	{
		 ProductionVsBudgetReportBean bean=null;	
		 String exportPDFPath   ="";		 
		 String exportImagePath ="";
		 String preyearMonth    ="";
		 String rptTitle        ="";
		 String userID          ="";
		
		System.out.println(" ENTER - ProductionVsBudgetReportServlet  ***********************");
		try
		{
			
			  bean = new ProductionVsBudgetReportBean();			 
			  HttpSession session= request.getSession();
			  HashMap <String, List<String>> gridDataMap  =  (HashMap<String, List<String>>) session.getAttribute("gridDataMap");
			  userID           =(String)request.getParameter("userID");
			  exportPDFPath    =(String)request.getParameter("exportPDFPath");		 
			  exportImagePath  =(String)request.getParameter("exportImagePath");	
			  preyearMonth     =(String)request.getParameter("preyearMonth");	
			  rptTitle         =(String)request.getParameter("rptTitle");
			  System.out.println("userID====="+userID); 
		      //System.out.println("exportPDFPath====="+exportPDFPath); 
		      //System.out.println("exportImagePath====="+exportImagePath); 
		      //System.out.println("preyearMonth====="+preyearMonth); 
		      //System.out.println("rptTitle====="+rptTitle); 
			 //call EJB method for PDF creation*******************
			  bean.generatePDF(gridDataMap, exportPDFPath, exportImagePath, preyearMonth, rptTitle,userID);
			  response.setContentType("text/html");
			  response.getWriter().write("PDF Creation");
		}
		catch (Exception e)
		{
			System.out.println("Exception :ProductionVsBudgetReportServlet : ProductionVsBudgetReportServlet) :"+e.getMessage()); //$NON-NLS-1$
			try 
			{
				throw new ITMException(e);
			}
			catch (ITMException e1) 
			{
				e1.printStackTrace();
			}
		}
		finally
		{
		
		}
	}

		
	
	
}