<%@ page contentType="text/html"%>
<%@ page
	import="javax.xml.parsers.DocumentBuilderFactory,javax.xml.parsers.DocumentBuilder,org.w3c.dom.*"%>
<%@page import="ibase.dashboard.sfa.ejb.*"%>
<!--<%@page import="ibase.webitm.reports.utility.ResourceConstants"%>
-->
<%@page import="ibase.utility.CommonConstants"%>
<%@ page import="javax.naming.InitialContext"%>
<%@page import="javax.naming.Context"%>
<%@page import="org.w3c.dom.Node"%>
<%@page import="org.w3c.dom.NodeList"%>
<%@page import="ibase.webitm.utility.GenericUtility"%>

<%!GenericUtility genericUtility = GenericUtility.getInstance();
	String xmlString = "";
	String objName = "";
	Document dom = null;
	NodeList dtlList = null;
	Node parentNode = null;
	NodeList childNodeList = null;
	Node currDetail = null;
	String childNodeName = "";
	String salePersnName = "",doctorsName = "", notMetSince = "", visitMissed = "",rptTitle;%>
<%
	response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT");
	response.setHeader("Cache-Control", "no-store, no-cache,must-revalidate");
	response.addHeader("Cache-Control", "post-check=0, pre-check=0");
	response.setHeader("Pragma", "no-cache");
	int ctr = 0;
	CommonConstants.setAPPLICATION_CONTEXT(config.getServletContext().getRealPath("/"));
%>
<html>
<head>
<style type="text/css">
.reportName {
	FONT-FAMILY: Arial;
	FONT-SIZE: 12pt;
	font-weight: bold;
}

.reportTitle {
	FONT-FAMILY: Arial;
	FONT-SIZE: 10pt;
}

.reportDetail {
	FONT-FAMILY: Arial;
	FONT-SIZE: 10pt;
	width: 350px;
	border: 1px solid;

}
.tblHeader 
{
 font-weight: bold;
}
</style>
<script type="text/javascript" src="FusionCharts.js"></script>
</head>
<body>

<%
	try
	{
		
		
		rptTitle   = request.getParameter("rtitle");
		if (rptTitle == null || rptTitle.trim().length() == 0)
		{
			rptTitle =" " ;
		} else
		{
			if(rptTitle.equalsIgnoreCase("Y") && rptTitle.trim().length()!= 0)
			{
				rptTitle ="Important Doctors Missed ";
		      }
			else{
				rptTitle =" " ;
			}
		}
		
		ibase.utility.UserInfoBean userInfo = (ibase.utility.UserInfoBean) session.getAttribute("USER_INFO");
		String user = userInfo.getLoginCode();
		System.out.println("user ::" + user);
		Context context = new InitialContext();
		ImpDocMissedRemote dashboardPortal = (ImpDocMissedRemote)context.lookup("ibase/ImpDocMissed/remote");
		//DashboardPortal dashboardPortal=(DashboardPortal)context.lookup("ibase.dashboard.sfa.ejb.DashboardPortal.class.getName()");
		if (user != null && user.trim().length() != 0)
		{
			xmlString = dashboardPortal.getData(user);
			System.out.println("Return xmlString====" + xmlString);
		}
		
		
		
		
		
		
		
		
%>
<%
	if (xmlString != null && xmlString.trim().length() > 0)
		{
%>
<table class="reportName">
	<tr>
		<td><%=rptTitle%></td>
	</tr>
</table>
<table class="reportDetail" rules="all" FRAME=BOX>
	<tr class="tblHeader">
		<td>Doctors Name</td>
		<td>Not Met Since</td>
		<td>No.Of Visit Missed</td>
	</tr>
	<tr>
		<td colspan="3"><b>Sales Person:</b><%=dashboardPortal.getSalePersn()%></td>
	</tr>

	<%
		dom = genericUtility.parseString(xmlString);
	if(dom !=null)
	{
				dtlList = dom.getElementsByTagName("Detail");
				for (int cntr = 0; cntr < dtlList.getLength(); cntr++)
				{
					parentNode = dtlList.item(cntr);
					childNodeList = parentNode.getChildNodes();

					for (int nodCtr = 0; nodCtr < childNodeList.getLength(); nodCtr++)
					{
						currDetail = childNodeList.item(nodCtr);
						childNodeName = currDetail.getNodeName();
						if (childNodeName.trim().equals("doctors_name"))
						{
							doctorsName = genericUtility.getColumnValueFromNode("doctors_name", parentNode);
						}
						if (childNodeName.trim().equals("days_since_not_met"))
						{
							notMetSince = genericUtility.getColumnValueFromNode("days_since_not_met", parentNode);
						}
						if (childNodeName.trim().equals("visits_missed"))
						{
							visitMissed = genericUtility.getColumnValueFromNode("visits_missed", parentNode);
						}
					}
	%>
	<tr>
		<td width="180px"><%=doctorsName%></td>
		<td align="right"><%=notMetSince%></td>
		<td align="center"><%=visitMissed%></td>
	</tr>

	<%
		}}
	%>

</table>
<%
	}

	} catch (Exception ex)
	{
		System.out.println("Exception in JSP :ImpDocMissed:" + ex.getMessage());
	}
%>
</body>
</html>