Commit 6439153d authored by tmahadi's avatar tmahadi

jsp and sql merged for firmplan


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@104294 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 862fa4a2
<%@page import="org.apache.poi.ss.usermodel.Row"%>
<%@page import="org.apache.poi.ss.usermodel.Cell"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFCell"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFRow"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFFont"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFSheet"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFCellStyle"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFWorkbook"%>
<%@page import="org.apache.poi.hssf.util.HSSFColor"%>
<%@page import="org.apache.poi.hssf.util.CellRangeAddress"%>
<%@ page import="java.io.*"%> <%@ page import="java.io.*"%>
<%@ page import="java.net.*"%> <%@ page import="java.net.*"%>
<%@ page import="ibase.utility.*"%> <%@ page import="ibase.utility.*"%>
...@@ -8,6 +18,7 @@ ...@@ -8,6 +18,7 @@
<%@ page import="ibase.utility.UserInfoBean"%> <%@ page import="ibase.utility.UserInfoBean"%>
<%@ page import="ibase.webitm.servlet.ITMWizardHandlerServlet"%> <%@ page import="ibase.webitm.servlet.ITMWizardHandlerServlet"%>
<%@ page import="ibase.webitm.ejb.mfg.WoFirmplanPrcRemote"%> <%@ page import="ibase.webitm.ejb.mfg.WoFirmplanPrcRemote"%>
<%@ page import="ibase.webitm.ejb.mfg.WoFirmplanICRemote"%>
<%@ page import="org.w3c.dom.Node"%> <%@ page import="org.w3c.dom.Node"%>
<%@ page import="org.w3c.dom.Element"%> <%@ page import="org.w3c.dom.Element"%>
...@@ -28,24 +39,22 @@ ...@@ -28,24 +39,22 @@
<%@ page import="java.text.DecimalFormat"%> <%@ page import="java.text.DecimalFormat"%>
<% <%
String loginCode = "", XTRA_PARAMS_SEPARATOR = "", chgTerm = "", workOrder = "", campgnNo = "", leastExpdtRM = "", exportToExcel = "YES";
String loginCode = "", XTRA_PARAMS_SEPARATOR = "", chgTerm = "", workOrder = "", campgnNo = "", leastExpdtRM = "";
StringBuffer valueXmlString; StringBuffer valueXmlString;
//DecimalFormat df = new DecimalFormat("#.###"); //DecimalFormat df = new DecimalFormat("#.###");
DecimalFormat df = new DecimalFormat("0.000"); DecimalFormat df = new DecimalFormat("0.000");
HSSFWorkbook workbook = new HSSFWorkbook();
session = request.getSession(); session = request.getSession();
ibase.utility.UserInfoBean userInfo = (ibase.utility.UserInfoBean)session.getAttribute("USER_INFO"); ibase.utility.UserInfoBean userInfo = (ibase.utility.UserInfoBean) session.getAttribute("USER_INFO");
if(userInfo != null) if (userInfo != null) {
{
loginCode = userInfo.getLoginCode(); loginCode = userInfo.getLoginCode();
System.out.println( "Getting Login Code -----------------["+loginCode+"]"); System.out.println("Getting Login Code -----------------["
} + loginCode + "]");
else } else {
{ System.out.println("userInfo is null -----------------");
System.out.println( "userInfo is null -----------------");
} }
XTRA_PARAMS_SEPARATOR = "~~"; XTRA_PARAMS_SEPARATOR = "~~";
...@@ -61,19 +70,19 @@ ...@@ -61,19 +70,19 @@
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("user_country=" + userInfo.getUserCountry()); xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("user_country=" + userInfo.getUserCountry());
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("charEnc=" + userInfo.getCharEnc()); xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("charEnc=" + userInfo.getCharEnc());
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("termId="+userInfo.getRemoteHost()); xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("termId=" + userInfo.getRemoteHost());
chgTerm = userInfo.getRemoteHostName(); chgTerm = userInfo.getRemoteHostName();
if( chgTerm != null && chgTerm.length() > 15 ) if (chgTerm != null && chgTerm.length() > 15) {
{
chgTerm = chgTerm.substring(0, 15); chgTerm = chgTerm.substring(0, 15);
} } else if (chgTerm == null || chgTerm.length() == 0) {
else if( chgTerm == null || chgTerm.length() == 0 )
{
chgTerm = userInfo.getRemoteHost(); chgTerm = userInfo.getRemoteHost();
} }
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("chgTerm=" + chgTerm ); xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("chgTerm=" + chgTerm);
System.out.println("xtraParamsBuff ["+xtraParamsBuff+"]"); System.out.println("xtraParamsBuff [" + xtraParamsBuff + "]");
//exportToExcel = request.getParameter("exportToExcel");
System.out.println("exportToExcel:::: [" + exportToExcel + "]");
workOrder = request.getParameter("workOrder"); workOrder = request.getParameter("workOrder");
campgnNo = request.getParameter("campgnNo"); campgnNo = request.getParameter("campgnNo");
...@@ -81,20 +90,56 @@ ...@@ -81,20 +90,56 @@
//System.out.println( "workOrder from WOrderStkStatus.jsp -----------------" + workOrder); //System.out.println( "workOrder from WOrderStkStatus.jsp -----------------" + workOrder);
//System.out.println( "campgnNo from WOrderStkStatus.jsp -----------------" + campgnNo); //System.out.println( "campgnNo from WOrderStkStatus.jsp -----------------" + campgnNo);
//String campgnNo = "", leastExpdtRM = ""; //String campgnNo = "", leastExpdtRM = "";
String errorMessageVal = "";
valueXmlString = new StringBuffer( "<?xml version='1.0' encoding='ISO-8859-1'?>\r\n" ); valueXmlString = new StringBuffer("<?xml version='1.0' encoding='ISO-8859-1'?>\r\n");
valueXmlString.append("<Detail1 objContext=\"1\" objName=\"wo_firmplan\" domID=\"1\" dbID=\"\" >\r\n"); valueXmlString.append("<Detail1 objContext=\"1\" objName=\"wo_firmplan\" domID=\"1\" dbID=\"\" >\r\n");
valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n"); valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
valueXmlString.append( "<work_order><![CDATA[" ).append( workOrder ).append( "]]></work_order>\r\n" ); valueXmlString.append("<work_order><![CDATA[").append(workOrder).append("]]></work_order>\r\n");
valueXmlString.append( "<campgn_no><![CDATA[" ).append( campgnNo ).append( "]]></campgn_no>\r\n" ); valueXmlString.append("<campgn_no><![CDATA[").append(campgnNo).append("]]></campgn_no>\r\n");
valueXmlString.append("</Detail1>\r\n"); valueXmlString.append("</Detail1>\r\n");
//System.out.println("valueXmlString in WOrderStkStatus.jsp :::::::: ["+valueXmlString.toString()+"]"); System.out.println("valueXmlString in WOrderStkStatus.jsp :::::::: ["
WoFirmplanPrcRemote woFirmplanPrcRmt = (WoFirmplanPrcRemote)new InitialContext().lookup("ibase/WoFirmplanPrc/remote"); + valueXmlString.toString() + "]");
WoFirmplanICRemote woFirmplanICRmt = (WoFirmplanICRemote) new InitialContext().lookup("ibase/WoFirmplanIC/remote");
String validation = woFirmplanICRmt.wfValData(
valueXmlString.toString(), valueXmlString.toString(), "1",
"", xtraParamsBuff.toString());
System.out.println("validation string ::::::::::: " + validation);
if (validation.trim().length() > 0) {
DocumentBuilderFactory factoryVal = DocumentBuilderFactory
.newInstance();
DocumentBuilder builderVal = factoryVal.newDocumentBuilder();
InputSource inputSourceVal = new InputSource(new StringReader(
validation));
Document domVal = builderVal.parse(inputSourceVal);
NodeList errorListVal = domVal.getElementsByTagName("error");
int errorListLenVal = errorListVal.getLength();
for (int errCtr = 0; errCtr < errorListLenVal; errCtr++) {
Node errorNodeVal = errorListVal.item(errCtr);
if (errorNodeVal.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) errorNodeVal;
errorMessageVal = eElement.getElementsByTagName("message").item(0).getTextContent()
+ "\\n"
+ eElement.getElementsByTagName("description").item(0).getTextContent();
System.out.println("message ::::::::::: "
+ errorMessageVal);
%>
<script>
alert("<%=errorMessageVal%>");
</script>
<%
}
}
} else {
WoFirmplanPrcRemote woFirmplanPrcRmt = (WoFirmplanPrcRemote) new InitialContext().lookup("ibase/WoFirmplanPrc/remote");
String xmlStr = woFirmplanPrcRmt.process(valueXmlString.toString(), valueXmlString.toString(), "firmplan", xtraParamsBuff.toString()); String xmlStr = woFirmplanPrcRmt.process(valueXmlString.toString(), valueXmlString.toString(), "firmplan", xtraParamsBuff.toString());
System.out.println("xmlStr from WOrderStkStatus.jsp ::::::::::: " + xmlStr); System.out.println("xmlStr from WOrderStkStatus.jsp ::::::::::: " + xmlStr);
%>
%>
<html> <html>
<head> <head>
...@@ -106,37 +151,177 @@ ...@@ -106,37 +151,177 @@
</head> </head>
<body> <body>
<%
/* if (exportToExcel != null && exportToExcel.toString().equalsIgnoreCase("YES")) {
response.setContentType("application/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment;filename=" + "firmplan.xls");
} */
%>
<form>
<table>
<tr>
<td><input type="button" style="cursor: hand" value="CLOSE"
onClick="window.close()" /></td>
</tr>
</table>
<table>
<form> <%
<table border="0" width="100%"> //TODO
HSSFSheet spreadsheet = workbook.createSheet("Fontstyle");
HSSFRow row = null;
int rowNum = 1;
row = spreadsheet.createRow(rowNum);
rowNum += 1;
//Create a new font and alter it.
HSSFFont font = workbook.createFont();
font.setColor(HSSFColor.RED.index);
//Set font into style
HSSFCellStyle redColorStyle = workbook.createCellStyle();
redColorStyle.setFont(font);
redColorStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
redColorStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
redColorStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
redColorStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
// Create a cell with a value and set style to it.
HSSFCell cell = row.createCell(0);
cell.setCellValue("Stock not sufficient - Red colour");
cell.setCellStyle(redColorStyle);
font = workbook.createFont();
font.setItalic(true);
font.setColor(HSSFColor.BLUE.index);
//Set font into style
HSSFCellStyle blueColorStyle = workbook.createCellStyle();
blueColorStyle.setFont(font);
blueColorStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
blueColorStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
blueColorStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
blueColorStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
// Create a cell with a value and set style to it.
row = spreadsheet.createRow(rowNum);
rowNum += 1;
cell = row.createCell(0);
cell.setCellValue("Current site alternate item - Blue colour");
cell.setCellStyle(blueColorStyle);
font = workbook.createFont();
font.setItalic(true);
font.setColor(HSSFColor.GREEN.index);
//Set font into style
HSSFCellStyle greenColorStyle = workbook.createCellStyle();
greenColorStyle.setFont(font);
greenColorStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
greenColorStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
greenColorStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
greenColorStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
// Create a cell with a value and set style to it.
row = spreadsheet.createRow(rowNum);
rowNum += 1;
cell = row.createCell(0);
cell.setCellValue("Other site main item - Green colour");
cell.setCellStyle(greenColorStyle);
font = workbook.createFont();
font.setItalic(true);
font.setColor(HSSFColor.GREY_50_PERCENT.index);
//Set font into style
HSSFCellStyle grayColorStyle = workbook.createCellStyle();
grayColorStyle.setFont(font);
grayColorStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
grayColorStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
grayColorStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
grayColorStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
// Create a cell with a value and set style to it.
row = spreadsheet.createRow(rowNum);
rowNum += 1;
cell = row.createCell(0);
cell.setCellValue("Other site alternate item - Gray colour");
cell.setCellStyle(grayColorStyle);
HSSFCellStyle cellStyle = workbook.createCellStyle();
cellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
row = spreadsheet.createRow(rowNum);
rowNum += 1;
final String[] titlesHeader =
{"Work Order", "Oper.", "Exp Level", "Main Item", "Description", "Unit", "Critical(Y/N)", "Bill Quantity", "Batch No", "Stock Details", "Adjuct With", "Adjust Quantity", "Reserved Stock Details", "Update Quantity"};
final String[] titlesHeader2 =
{"Work Order", "Oper.", "Exp Level", "Main Item", "Description", "Unit", "Critical(Y/N)", "Bill Quantity", "Batch No", "Loc.","Lot No.","Lot SL","Quantity", "Adjuct With", "Adjust Quantity", "Loc.","Lot No.","Lot SL","Quantity", "Update Quantity"};
row = spreadsheet.createRow(rowNum);
for (int cellCtr = 0; cellCtr < titlesHeader.length; cellCtr++)
{
if(titlesHeader[cellCtr].equalsIgnoreCase("Stock Details")) {
cell = row.createCell((int) cellCtr);
cell.setCellValue(titlesHeader[cellCtr]);
spreadsheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, cellCtr, cellCtr+3));
cell.setCellStyle(cellStyle);
} else if (titlesHeader[cellCtr].equalsIgnoreCase("Reserved Stock Details")) {
cell = row.createCell((int) cellCtr+4);
cell.setCellValue(titlesHeader[cellCtr]);
spreadsheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, cellCtr, cellCtr+3));
cell.setCellStyle(cellStyle);
}
}
rowNum += 1;
row = spreadsheet.createRow(rowNum);
rowNum += 1;
for (int cellCtr = 0; cellCtr < titlesHeader2.length; cellCtr++)
{
//headerCell = headerRow.createCell((short) cellCtr);
cell = row.createCell((int) cellCtr);
cell.setCellValue(titlesHeader2[cellCtr]);
cell.setCellStyle(cellStyle);
}
%>
<tr>
<td style="color: #FF0000;">Stock not sufficient - Red colour</td>
</tr>
<tr>
<td style="color: #0000FF;">Current site alternate item - Blue
colour</td>
</tr>
<tr>
<td style="color: #006400;">Other site main item - Green colour</td>
</tr>
<tr>
<td style="color: #808000;">Other site alternate item - Pale green colour</td>
</tr>
</table>
<table border="0" width="100%">
<tr> <tr>
<th colspan="2" rowspan="2">Work Order</th> <th colspan="2" rowspan="2">Work Order</th>
<th colspan="2" rowspan="2">Oper.</th> <th colspan="2" rowspan="2">Oper.</th>
<th colspan="2" rowspan="2">Exp <br> <th colspan="2" rowspan="2">Exp <br>Level
Level</th> </th>
<th colspan="2" rowspan="2">Main/Alternate <br> <th colspan="2" rowspan="2">Main/Alternate <br>Item
Item</th> </th>
<th colspan="2" rowspan="2">Description</th> <th colspan="2" rowspan="2">Description</th>
<th colspan="2" rowspan="2">Unit</th> <th colspan="2" rowspan="2">Unit</th>
<th colspan="2" rowspan="2">Critical <br> <th colspan="2" rowspan="2">Critical <br>(Y/N)
(Y/N)</th> </th>
<th colspan="2" rowspan="2">Bill <br> <th colspan="2" rowspan="2">Bill <br>Quantity
Quantity</th> </th>
<th colspan="2" rowspan="2">Match<br>Potency</th> <th colspan="2" rowspan="2">Batch No</th>
<th colspan="2" rowspan="2">Minimum<br> <!-- <th colspan="2" rowspan="2">Match<br>Potency</th>
Potency</th> <th colspan="2" rowspan="2">Minimum<br>Potency</th>
<th colspan="2" rowspan="2">Std.<br> <th colspan="2" rowspan="2">Std.<br>Potency</th>
Potency</th> <th colspan="2" rowspan="2">Stock <br>Potency</th> -->
<th colspan="2" rowspan="2">Stock <br>
Potency</th>
<th colspan="4">Stock Detail</th> <th colspan="4">Stock Detail</th>
<th colspan="2" rowspan="2">Adjust<br> <th colspan="2" rowspan="2">Adjust<br>With
With</th> </th>
<th colspan="2" rowspan="2">Adjust <br> <th colspan="2" rowspan="2">Adjust <br>quantity
quantity</th> </th>
<th colspan="4">Reserved Stock Details</th> <th colspan="4">Reserved Stock Details</th>
<th colspan="2" rowspan="2">Update<br>quantity</th> <th colspan="2" rowspan="2">Update<br>quantity
</th>
</tr> </tr>
<tr> <tr>
...@@ -153,106 +338,134 @@ ...@@ -153,106 +338,134 @@
</tr> </tr>
<% <%
String successMessage = "Firmplan completed sucessfully..... !!!";
String errorMessage = "Process completed sucessfully..... !!!"; String errorMessage = "Firmplan Failed....!!!";
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder(); DocumentBuilder builder = factory.newDocumentBuilder();
// Document dom = builder.parse("http://localhost:9090/ibase/webitm/Firmplan/firmplan.xml"); // Document dom = builder.parse("http://localhost:9090/ibase/webitm/Firmplan/firmplan.xml");
//Document dom = builder.parse("http://localhost:9090/ibase/webitm/Firmplan/Error.xml"); //Document dom = builder.parse("http://localhost:9090/ibase/webitm/Firmplan/Error.xml");
InputSource inputSource = new InputSource( new StringReader( xmlStr ) ); InputSource inputSource = new InputSource(new StringReader(
Document dom = builder.parse( inputSource ); xmlStr));
Document dom = builder.parse(inputSource);
ArrayList resvList = null; ArrayList resvList = null;
ArrayList stkList = null; ArrayList stkList = null;
HashMap exmpLabelMap = null; HashMap exmpLabelMap = null;
String isAlternate = "", stockPotency = "", allocQty = "", itemPotency = "", tranId = "", updtQty = "", potencyAdj = "", adjQty = "", String isAlternate = "", stockPotency = "", allocQty = "", itemPotency = "", tranId = "", updtQty = "", potencyAdj = "", adjQty = "", itemCode = "", itemDescr = "", unit = "", otherSite = "";
itemCode = "", itemDescr = "", unit = "",otherSite = "";
//DecimalFormat df = new DecimalFormat("0.000"); //DecimalFormat df = new DecimalFormat("0.000");
System.out
NodeList wrkOrderNodeList = dom.getElementsByTagName("work_order"); .println("DOM PRINTED TO BELOW CHECK WHAT'S IN XML\n------------------------------");
System.out.println(GenericUtility.getInstance().serializeDom(
dom));
System.out
.println("------------------------------\nDOM PRINTED TO ABOVE CHECK WHAT'S IN XML");
NodeList wrkOrderNodeList = dom
.getElementsByTagName("work_order");
int wrkOrderNodeListLength = wrkOrderNodeList.getLength(); int wrkOrderNodeListLength = wrkOrderNodeList.getLength();
System.out.println("My List="+wrkOrderNodeList); System.out.println("My List=" + wrkOrderNodeList);
System.out.println("My List Length="+wrkOrderNodeList); System.out.println("My List Length=" + wrkOrderNodeListLength);
if(wrkOrderNodeListLength > 0) String result = "";
{
if (wrkOrderNodeListLength > 0) {
NodeList resultList = dom.getElementsByTagName("successful");
Node resultNode = resultList.item(0);
result = resultNode.getTextContent();
}
System.out.println("Result:::" + result);
if (wrkOrderNodeListLength > 0 && result.equalsIgnoreCase("YES")) {
%>
<script>
alert("<%=successMessage%>");
</script>
<%
} else if (wrkOrderNodeListLength > 0
&& result.equalsIgnoreCase("NO")) {
%> %>
<script> <script>
alert("<%=errorMessage%>"); alert("<%=errorMessage%>");
</script> </script>
<% <%
for(int wrkCtr = 0; wrkCtr <= wrkOrderNodeListLength; wrkCtr++) }
{
if (wrkOrderNodeListLength > 0) {
for (int wrkCtr = 0; wrkCtr <= wrkOrderNodeListLength; wrkCtr++) {
Node wrkOrderNode = wrkOrderNodeList.item(wrkCtr); Node wrkOrderNode = wrkOrderNodeList.item(wrkCtr);
if(wrkOrderNode != null && wrkOrderNode.getNodeType() == wrkOrderNode.ELEMENT_NODE) if (wrkOrderNode != null
{ && wrkOrderNode.getNodeType() == wrkOrderNode.ELEMENT_NODE) {
NodeList explLabNodeList = wrkOrderNode.getChildNodes(); NodeList explLabNodeList = wrkOrderNode
.getChildNodes();
int explLabNodeListLen = explLabNodeList.getLength(); int explLabNodeListLen = explLabNodeList
.getLength();
for(int explCtr = 0;explCtr <= explLabNodeListLen;explCtr++) for (int explCtr = 0; explCtr <= explLabNodeListLen; explCtr++) {
{ Node explLblNode = explLabNodeList
Node explLblNode = explLabNodeList.item(explCtr); .item(explCtr);
stkList = new ArrayList(); stkList = new ArrayList();
resvList = new ArrayList(); resvList = new ArrayList();
exmpLabelMap = new HashMap(); exmpLabelMap = new HashMap();
if(explLblNode != null && explLblNode.getNodeType() == explLblNode.ELEMENT_NODE) if (explLblNode != null
{ && explLblNode.getNodeType() == explLblNode.ELEMENT_NODE) {
NodeList dataNodeList = explLblNode.getChildNodes(); NodeList dataNodeList = explLblNode.getChildNodes();
int dataNodeListLen = dataNodeList.getLength(); int dataNodeListLen = dataNodeList.getLength();
for(int dataCtr = 0;dataCtr <= dataNodeListLen;dataCtr++) for (int dataCtr = 0; dataCtr <= dataNodeListLen; dataCtr++) {
{ Node dataNode = dataNodeList
Node dataNode = dataNodeList.item(dataCtr); .item(dataCtr);
boolean isFalse = false; boolean isFalse = false;
if(dataNode != null && dataNode.getNodeType() == dataNode.ELEMENT_NODE) if (dataNode != null
{ && dataNode.getNodeType() == dataNode.ELEMENT_NODE) {
//System.out.println("column Name ["+dataNode.getNodeName()+"]column value ["+dataNode.getFirstChild().getNodeValue()+"]"); //System.out.println("column Name ["+dataNode.getNodeName()+"]column value ["+dataNode.getFirstChild().getNodeValue()+"]");
//System.out.println("column Name ["+dataNode.getNodeName()); //System.out.println("column Name ["+dataNode.getNodeName());
if(dataNode.getNodeName().equalsIgnoreCase("reserve_stock")) if (dataNode.getNodeName().equalsIgnoreCase("reserve_stock")) {
{
NodeList reservestkNodeList = dataNode.getChildNodes(); NodeList reservestkNodeList = dataNode.getChildNodes();
int reservestkNodeListLen = reservestkNodeList.getLength(); int reservestkNodeListLen = reservestkNodeList.getLength();
for(int dataResvCtr = 0;dataResvCtr <= reservestkNodeListLen;dataResvCtr++) for (int dataResvCtr = 0; dataResvCtr <= reservestkNodeListLen; dataResvCtr++) {
{ Node dataRecvNode = reservestkNodeList
Node dataRecvNode = reservestkNodeList.item(dataResvCtr); .item(dataResvCtr);
if(dataRecvNode != null && dataRecvNode.getNodeType() == dataRecvNode.ELEMENT_NODE) if (dataRecvNode != null
{ && dataRecvNode
.getNodeType() == dataRecvNode.ELEMENT_NODE) {
HashMap dataRcvMap = new HashMap(); HashMap dataRcvMap = new HashMap();
//System.out.println("dataRecvNode column Name ["+dataRecvNode.getNodeName()+"] dataRecvNode column value ["+dataRecvNode.getFirstChild().getNodeValue()+"]"); //System.out.println("dataRecvNode column Name ["+dataRecvNode.getNodeName()+"] dataRecvNode column value ["+dataRecvNode.getFirstChild().getNodeValue()+"]");
NodeList detailRecvNodeList = dataRecvNode.getChildNodes(); NodeList detailRecvNodeList = dataRecvNode
int detailRecvNodeListLen = detailRecvNodeList.getLength(); .getChildNodes();
int detailRecvNodeListLen = detailRecvNodeList
.getLength();
for(int detailResvCtr = 0;detailResvCtr <= detailRecvNodeListLen;detailResvCtr++) for (int detailResvCtr = 0; detailResvCtr <= detailRecvNodeListLen; detailResvCtr++) {
{ Node detailRecvNode = detailRecvNodeList
Node detailRecvNode = detailRecvNodeList.item(detailResvCtr); .item(detailResvCtr);
if(detailRecvNode != null && detailRecvNode.getNodeType() == detailRecvNode.ELEMENT_NODE) if (detailRecvNode != null
{ && detailRecvNode.getNodeType() == detailRecvNode.ELEMENT_NODE) {
if(detailRecvNode.getFirstChild() != null) if (detailRecvNode
{ .getFirstChild() != null) {
//System.out.println("column Name ["+detailRecvNode.getNodeName()+"]column value ["+detailRecvNode.getFirstChild().getNodeValue()+"]"); //System.out.println("column Name ["+detailRecvNode.getNodeName()+"]column value ["+detailRecvNode.getFirstChild().getNodeValue()+"]");
dataRcvMap.put(detailRecvNode.getNodeName(), detailRecvNode.getFirstChild().getNodeValue()); dataRcvMap.put(detailRecvNode.getNodeName(),
} detailRecvNode.getFirstChild().getNodeValue());
else } else {
{
//System.out.println("column Name ["+detailRecvNode.getNodeName()+"]column value []"); //System.out.println("column Name ["+detailRecvNode.getNodeName()+"]column value []");
dataRcvMap.put(detailRecvNode.getNodeName(), ""); dataRcvMap.put(detailRecvNode.getNodeName(),
"");
} }
} }
} }
...@@ -260,61 +473,69 @@ ...@@ -260,61 +473,69 @@
} }
} }
} }
if(dataNode.getNodeName().equalsIgnoreCase("stock_detail")) if (dataNode.getNodeName().equalsIgnoreCase("stock_detail")) {
{
NodeList reservestkNodeList = dataNode.getChildNodes(); NodeList reservestkNodeList = dataNode.getChildNodes();
int reservestkNodeListLen = reservestkNodeList.getLength(); int reservestkNodeListLen = reservestkNodeList.getLength();
for(int dataResvCtr = 0;dataResvCtr <= reservestkNodeListLen;dataResvCtr++) for (int dataResvCtr = 0; dataResvCtr <= reservestkNodeListLen; dataResvCtr++) {
{
Node dataRecvNode = reservestkNodeList.item(dataResvCtr); Node dataRecvNode = reservestkNodeList.item(dataResvCtr);
if(dataRecvNode != null && dataRecvNode.getNodeType() == dataRecvNode.ELEMENT_NODE) if (dataRecvNode != null
{ && dataRecvNode
.getNodeType() == dataRecvNode.ELEMENT_NODE) {
HashMap datastkMap = new HashMap(); HashMap datastkMap = new HashMap();
System.out.println("dataRecvNode column Name ["+dataRecvNode.getNodeName()+"] dataRecvNode column value ["+dataRecvNode.getFirstChild().getNodeValue()+"]"); System.out
.println("dataRecvNode column Name ["
NodeList detailRecvNodeList = dataRecvNode.getChildNodes(); + dataRecvNode
int detailRecvNodeListLen = detailRecvNodeList.getLength(); .getNodeName()
+ "] dataRecvNode column value ["
for(int detailResvCtr = 0;detailResvCtr <= detailRecvNodeListLen;detailResvCtr++) + dataRecvNode
{ .getFirstChild()
Node detailRecvNode = detailRecvNodeList.item(detailResvCtr); .getNodeValue()
+ "]");
if(detailRecvNode != null && detailRecvNode.getNodeType() == detailRecvNode.ELEMENT_NODE)
{ NodeList detailRecvNodeList = dataRecvNode
if(detailRecvNode.getFirstChild() != null) .getChildNodes();
{ int detailRecvNodeListLen = detailRecvNodeList
.getLength();
for (int detailResvCtr = 0; detailResvCtr <= detailRecvNodeListLen; detailResvCtr++) {
Node detailRecvNode = detailRecvNodeList
.item(detailResvCtr);
if (detailRecvNode != null
&& detailRecvNode.getNodeType() == detailRecvNode.ELEMENT_NODE) {
if (detailRecvNode
.getFirstChild() != null) {
//System.out.println("column Name ["+detailRecvNode.getNodeName()+"]column value ["+detailRecvNode.getFirstChild().getNodeValue()+"]"); //System.out.println("column Name ["+detailRecvNode.getNodeName()+"]column value ["+detailRecvNode.getFirstChild().getNodeValue()+"]");
datastkMap.put(detailRecvNode.getNodeName(), detailRecvNode.getFirstChild().getNodeValue()); datastkMap.put(detailRecvNode.getNodeName(), detailRecvNode.getFirstChild().getNodeValue());
} } else {
else
{
//System.out.println("column Name ["+detailRecvNode.getNodeName()+"]column value []"); //System.out.println("column Name ["+detailRecvNode.getNodeName()+"]column value []");
datastkMap.put(detailRecvNode.getNodeName(), ""); datastkMap.put(detailRecvNode.getNodeName(),
"");
} }
} }
} }
System.out.println("datastkMap ["+datastkMap); System.out
.println("datastkMap ["
+ datastkMap);
stkList.add(datastkMap); stkList.add(datastkMap);
System.out.println("StockListSize ["+stkList.size()); System.out
} .println("StockListSize ["
} + stkList
.size());
} }
else
{
if(dataNode.getFirstChild() != null)
{
exmpLabelMap.put(dataNode.getNodeName(), dataNode.getFirstChild().getNodeValue());
} }
else } else {
{ if (dataNode.getFirstChild() != null) {
exmpLabelMap.put(dataNode
.getNodeName(),
dataNode.getFirstChild().getNodeValue());
} else {
exmpLabelMap.put(dataNode.getNodeName(), ""); exmpLabelMap.put(dataNode.getNodeName(), "");
} }
...@@ -324,37 +545,37 @@ ...@@ -324,37 +545,37 @@
} }
} }
if(exmpLabelMap != null && exmpLabelMap.size() > 0) if (exmpLabelMap != null
{ && exmpLabelMap.size() > 0) {
int sizeStkList = stkList.size(); int sizeStkList = stkList.size();
int sizeresvList = resvList.size(); int sizeresvList = resvList.size();
System.out.println("exmpLabelMap :::::::::: "
System.out.println("stkList :::::::::: " + stkList); + exmpLabelMap.toString());
System.out.println("resvList :::::::::: " + stkList); System.out.println("stkList :::::::::: "
+ stkList);
System.out.println("resvList :::::::::: "
+ stkList);
//out.println("::::::::: Inside if for reserve stock :::::::::: "); //out.println("::::::::: Inside if for reserve stock :::::::::: ");
//out.println(" ::::::::: Inside else for stock details :::::::::: "); //out.println(" ::::::::: Inside else for stock details :::::::::: ");
for(int ctrRcv = 0; ctrRcv < sizeStkList; ctrRcv++) for (int ctrRcv = 0; ctrRcv < sizeStkList; ctrRcv++) {
{
%> %>
<tr> <tr>
<% <%
HashMap dataStkMap = (HashMap)stkList.get(ctrRcv); //TODO --Create Row for Each Data.
row = spreadsheet.createRow(rowNum);
rowNum += 1;
HashMap dataStkMap = (HashMap) stkList.get(ctrRcv);
HashMap dataRcvMap = null; HashMap dataRcvMap = null;
if(ctrRcv < sizeresvList) if (ctrRcv < sizeresvList) {
{
dataRcvMap = (HashMap)resvList.get(ctrRcv); dataRcvMap = (HashMap) resvList.get(ctrRcv);
} }
if (exmpLabelMap.get("match_potency").equals("N")) {
if(exmpLabelMap.get("match_potency").equals("N"))
{
itemPotency = "0"; itemPotency = "0";
} } else {
else
{
itemPotency = (String) exmpLabelMap.get("item_potency"); itemPotency = (String) exmpLabelMap.get("item_potency");
} }
...@@ -378,16 +599,29 @@ ...@@ -378,16 +599,29 @@
//System.out.println("Stock Block data stock Map ["+exmpLabelMap.toString()+"]"); //System.out.println("Stock Block data stock Map ["+exmpLabelMap.toString()+"]");
%> %>
<td colspan="2"><%=exmpLabelMap.get("work_order") %></td> <td colspan="2"><%=exmpLabelMap.get("work_order")%></td>
<%
cell = row.createCell((int)0);
cell.setCellValue(exmpLabelMap.get("work_order").toString());
cell.setCellStyle(cellStyle);
%>
<!-- Work Order --> <!-- Work Order -->
<td colspan="2"><%=exmpLabelMap.get("operation") %></td> <td colspan="2"><%=exmpLabelMap.get("operation")%></td>
<%
cell = row.createCell((int)1);
cell.setCellValue(exmpLabelMap.get("operation").toString());
cell.setCellStyle(cellStyle);
%>
<!-- Oper. --> <!-- Oper. -->
<td colspan="2"><%=exmpLabelMap.get("exp_lev") %></td> <td colspan="2"><%=exmpLabelMap.get("exp_lev")%></td>
<%
cell = row.createCell((int)2);
cell.setCellValue(exmpLabelMap.get("exp_lev").toString());
cell.setCellStyle(cellStyle);
%>
<!-- Exp. level --> <!-- Exp. level -->
<% <%
if (dataStkMap != null) {
if(dataStkMap != null)
{
//out.println(" ------- else --------------------------------- " );out.println("<br>" ); //out.println(" ------- else --------------------------------- " );out.println("<br>" );
itemCode = (String) dataStkMap.get("item_code"); itemCode = (String) dataStkMap.get("item_code");
...@@ -398,37 +632,29 @@ ...@@ -398,37 +632,29 @@
updtQty = (String) dataStkMap.get("alloc_qty"); updtQty = (String) dataStkMap.get("alloc_qty");
isAlternate = (String) dataStkMap.get("is_alternate"); isAlternate = (String) dataStkMap.get("is_alternate");
otherSite = (String) dataStkMap.get("other_site"); otherSite = (String) dataStkMap.get("other_site");
} } else {
else
{
//out.println("----- Inside if dataRcvMap != null ------------- "); //out.println("----- Inside if dataRcvMap != null ------------- ");
//out.println("<br>" ); //out.println("<br>" );
if(dataRcvMap.get("tran_id") == null) if (dataRcvMap.get("tran_id") == null) {
{
tranId = ""; tranId = "";
} } else {
else
{
tranId = (String) dataRcvMap.get("tran_id"); tranId = (String) dataRcvMap.get("tran_id");
} }
if (dataRcvMap.get("item_code").equals("")) {
if(dataRcvMap.get("item_code").equals(""))
{
itemCode = (String) dataStkMap.get("item_code"); itemCode = (String) dataStkMap.get("item_code");
itemDescr = (String) dataStkMap.get("item_descr"); itemDescr = (String) dataStkMap.get("item_descr");
unit = (String) dataStkMap.get("unit"); unit = (String) dataStkMap.get("unit");
stockPotency = (String) dataStkMap.get("stock_potency"); stockPotency = (String) dataStkMap.get("stock_potency");
System.out.println("@@stockPotency123"+stockPotency); System.out.println("@@stockPotency123"
+ stockPotency);
potencyAdj = (String) dataStkMap.get("potency_adj"); potencyAdj = (String) dataStkMap.get("potency_adj");
updtQty = (String) dataStkMap.get("alloc_qty"); updtQty = (String) dataStkMap.get("alloc_qty");
isAlternate = (String) dataStkMap.get("is_alternate"); isAlternate = (String) dataStkMap.get("is_alternate");
otherSite = (String) dataStkMap.get("other_site"); otherSite = (String) dataStkMap.get("other_site");
} } else {
else
{
itemCode = (String) dataRcvMap.get("item_code"); itemCode = (String) dataRcvMap.get("item_code");
itemDescr = (String) dataRcvMap.get("item_descr"); itemDescr = (String) dataRcvMap.get("item_descr");
unit = (String) dataRcvMap.get("unit"); unit = (String) dataRcvMap.get("unit");
...@@ -440,8 +666,10 @@ ...@@ -440,8 +666,10 @@
otherSite = (String) dataStkMap.get("other_site"); otherSite = (String) dataStkMap.get("other_site");
} }
if(dataRcvMap.get("item_code").equals("") && dataStkMap.get("item_code").equals("")) if (dataRcvMap.get("item_code").equals("")
{ && dataStkMap.get(
"item_code")
.equals("")) {
itemCode = (String) exmpLabelMap.get("item_code"); itemCode = (String) exmpLabelMap.get("item_code");
itemDescr = (String) exmpLabelMap.get("item_descr"); itemDescr = (String) exmpLabelMap.get("item_descr");
...@@ -452,106 +680,200 @@ ...@@ -452,106 +680,200 @@
otherSite = (String) dataStkMap.get("other_site"); otherSite = (String) dataStkMap.get("other_site");
} }
if(!dataRcvMap.get("item_code").equals("") && !dataStkMap.get("item_code").equals("")) if (!dataRcvMap.get("item_code").equals("") && !dataStkMap.get("item_code").equals("")) {
{
itemCode = (String) exmpLabelMap.get("item_code"); itemCode = (String) exmpLabelMap.get("item_code");
itemDescr = (String) exmpLabelMap.get("item_descr"); itemDescr = (String) exmpLabelMap.get("item_descr");
unit = (String) exmpLabelMap.get("unit"); unit = (String) exmpLabelMap.get("unit");
stockPotency = (String) dataStkMap.get("stock_potency"); stockPotency = (String) dataStkMap.get("stock_potency");
double potencyAdjDb = Double.parseDouble(dataStkMap.get("alloc_qty") + "");// + Double.parseDouble(dataRcvMap.get("qty_adj")+"");
double potencyAdjDb = Double.parseDouble(dataStkMap.get("alloc_qty")+"");// + Double.parseDouble(dataRcvMap.get("qty_adj")+"");
potencyAdj = Double.toString(potencyAdjDb); potencyAdj = Double.toString(potencyAdjDb);
double updtQtyDb = Double.parseDouble(dataStkMap.get("alloc_qty")+"");// + Double.parseDouble(dataRcvMap.get("upd_qty")+""); double updtQtyDb = Double.parseDouble(dataStkMap.get("alloc_qty") + "");// + Double.parseDouble(dataRcvMap.get("upd_qty")+"");
updtQty = Double.toString(updtQtyDb); updtQty = Double.toString(updtQtyDb);
otherSite = (String) dataStkMap.get("other_site"); otherSite = (String) dataStkMap.get("other_site");
} }
} }
if(exmpLabelMap.get("is_sufficient").equals("N")) if (exmpLabelMap.get("is_sufficient").equals("N")) { // Red colour
{ // Red colour
%> %>
<td colspan="2" style="color: #FF0000;"><%=itemCode %></td> <td colspan="2" style="color: #FF0000;"><%=itemCode%></td>
<td colspan="2" style="color: #FF0000;"><%=itemDescr %></td>
<td colspan="2" style="color: #FF0000;"><%=unit %></td>
<% <%
} cell = row.createCell((int)3);
else if("Y".equals(isAlternate) && "Y".equals(otherSite)) cell.setCellValue(itemCode);
{ // pale green colour cell.setCellStyle(redColorStyle);
%> %>
<td colspan="2" style="color: #808000;"><%=itemCode %></td> <td colspan="2" style="color: #FF0000;"><%=itemDescr%></td>
<td colspan="2" style="color: #808000;"><%=itemDescr %></td>
<td colspan="2" style="color: #808000;"><%=unit %></td>
<% <%
} cell = row.createCell((int)4);
else if("Y".equals(isAlternate) && !"Y".equals(otherSite)) cell.setCellValue(itemDescr);
{ // blue colour cell.setCellStyle(redColorStyle);
%> %>
<td colspan="2" style="color: #0000FF;"><%=itemCode %></td> <td colspan="2" style="color: #FF0000;"><%=unit%></td>
<td colspan="2" style="color: #0000FF;"><%=itemDescr %></td>
<td colspan="2" style="color: #0000FF;"><%=unit %></td>
<% <%
} cell = row.createCell((int)5);
else if(!"Y".equals(isAlternate) && "Y".equals(otherSite)) cell.setCellValue(unit);
{ // green colour cell.setCellStyle(redColorStyle);
%> %>
<td colspan="2" style="color: #006400;"><%=itemCode %></td>
<td colspan="2" style="color: #006400;"><%=itemDescr %></td>
<td colspan="2" style="color: #006400;"><%=unit %></td>
<% <%
} } else if ("Y".equals(isAlternate) && "Y".equals(otherSite)) { // pale green colour
else
{
%> %>
<td colspan="2"><%=itemCode %></td> <td colspan="2" style="color: #808000;"><%=itemCode%></td>
<td colspan="2"><%=itemDescr %></td>
<td colspan="2"><%=unit %></td>
<% <%
} cell = row.createCell((int)3);
cell.setCellValue(itemCode);
cell.setCellStyle(grayColorStyle);
%>
<td colspan="2" style="color: #808000;"><%=itemDescr%></td>
<%
cell = row.createCell((int)4);
cell.setCellValue(itemDescr);
cell.setCellStyle(grayColorStyle);
%>
<td colspan="2" style="color: #808000;"><%=unit%></td>
<%
cell = row.createCell((int)5);
cell.setCellValue(unit);
cell.setCellStyle(grayColorStyle);
%>
<%
} else if ("Y".equals(isAlternate) && !"Y".equals(otherSite)) { // blue colour
%>
<td colspan="2" style="color: #0000FF;"><%=itemCode%></td>
<%
cell = row.createCell((int)3);
cell.setCellValue(itemCode);
cell.setCellStyle(blueColorStyle);
%>
<td colspan="2" style="color: #0000FF;"><%=itemDescr%></td>
<%
cell = row.createCell((int)4);
cell.setCellValue(itemDescr);
cell.setCellStyle(blueColorStyle);
%>
<td colspan="2" style="color: #0000FF;"><%=unit%></td>
<%
cell = row.createCell((int)5);
cell.setCellValue(unit);
cell.setCellStyle(blueColorStyle);
%>
<%
} else if (!"Y".equals(isAlternate) && "Y".equals(otherSite)) { // green colour
%>
<td colspan="2" style="color: #006400;"><%=itemCode%></td>
<%
cell = row.createCell((int)3);
cell.setCellValue(itemCode);
cell.setCellStyle(greenColorStyle);
%>
<td colspan="2" style="color: #006400;"><%=itemDescr%></td>
<%
cell = row.createCell((int)4);
cell.setCellValue(itemDescr);
cell.setCellStyle(greenColorStyle);
%>
<td colspan="2" style="color: #006400;"><%=unit%></td>
<%
cell = row.createCell((int)5);
cell.setCellValue(unit);
cell.setCellStyle(greenColorStyle);
%>
<%
} else {
%>
<td colspan="2"><%=itemCode%></td>
<%
cell = row.createCell((int)3);
cell.setCellValue(itemCode);
cell.setCellStyle(cellStyle);
%>
<td colspan="2"><%=itemDescr%></td>
<%
cell = row.createCell((int)4);
cell.setCellValue(itemDescr);
cell.setCellStyle(cellStyle);
%>
<td colspan="2"><%=unit%></td>
<%
cell = row.createCell((int)5);
cell.setCellValue(unit);
cell.setCellStyle(cellStyle);
%>
<%
}
%>
<td colspan="2"><%=exmpLabelMap.get("crit_Item")%></td>
<%
cell = row.createCell((int)6);
cell.setCellValue(exmpLabelMap.get("crit_Item").toString());
cell.setCellStyle(cellStyle);
%> %>
<td colspan="2"><%=exmpLabelMap.get("crit_Item") %></td>
<!-- Critical Item (Y/N) --> <!-- Critical Item (Y/N) -->
<% <%
String billQty = (String) exmpLabelMap.get("quantity"); String billQty = (String) exmpLabelMap.get("quantity");
billQty = billQty == null || billQty.length()== 0 ? "0" : billQty; billQty = billQty == null
billQty=df.format(Double.parseDouble(billQty)); || billQty.length() == 0
? "0"
: billQty;
billQty = df.format(Double.parseDouble(billQty));
%> %>
<!-- <td colspan="2" ><--%=exmpLabelMap.get("quantity") %></td> --> <!-- <td colspan="2" ><--%=exmpLabelMap.get("quantity") %></td> -->
<!-- WO Bill Quantity --> <!-- WO Bill Quantity -->
<td colspan="2"><%=billQty %></td> <td colspan="2"><%=billQty%></td>
<%
cell = row.createCell((int)7);
cell.setCellValue(billQty);
cell.setCellStyle(cellStyle);
%>
<!-- WO Bill Quantity --> <!-- WO Bill Quantity -->
<% <%
String quantityAdj = (String) exmpLabelMap.get("adjusted_qty"); String quantityAdj = (String) exmpLabelMap.get("adjusted_qty");
quantityAdj = quantityAdj == null || quantityAdj.length()== 0 ? "0" : quantityAdj; quantityAdj = quantityAdj == null
quantityAdj=df.format(Double.parseDouble(quantityAdj)); || quantityAdj.length() == 0
? "0"
: quantityAdj;
quantityAdj = df.format(Double.parseDouble(quantityAdj));
%> %>
<!-- (+/-) Adjusted Qty. --> <!-- (+/-) Adjusted Qty. -->
<td colspan="2"><%=exmpLabelMap.get("match_potency") %></td> <td colspan="2"><%=exmpLabelMap.get("lot_no")%></td>
<%
cell = row.createCell((int)8);
cell.setCellValue(exmpLabelMap.get("lot_no").toString());
cell.setCellStyle(cellStyle);
%>
<%-- <td colspan="2"><%=exmpLabelMap.get("match_potency") %></td> --%>
<!-- M. Pote. -- if match_potency value N the item_potency == 0 --> <!-- M. Pote. -- if match_potency value N the item_potency == 0 -->
<% <%
String minPtency = (String) exmpLabelMap.get("min_potency_perc"); String minPtency = (String) exmpLabelMap.get("min_potency_perc");
minPtency = minPtency == null || minPtency.length()== 0 ? "0" : minPtency; minPtency = minPtency == null
minPtency=df.format(Double.parseDouble(minPtency)); || minPtency.length() == 0
? "0"
: minPtency;
minPtency = df.format(Double.parseDouble(minPtency));
%> %>
<td colspan="2"><%=minPtency %></td> <%-- <td colspan="2"><%=minPtency %></td> --%>
<!-- Minimum Potency --> <!-- Minimum Potency -->
<% <%
// String minPtency = (String) exmpLabelMap.get("min_potency_perc"); // String minPtency = (String) exmpLabelMap.get("min_potency_perc");
itemPotency = itemPotency == null || itemPotency.length()== 0 ? "0" : itemPotency; itemPotency = itemPotency == null
itemPotency=df.format(Double.parseDouble(itemPotency)); || itemPotency.length() == 0
? "0"
: itemPotency;
itemPotency = df.format(Double.parseDouble(itemPotency));
%> %>
<td colspan="2"><%=itemPotency %></td> <%-- <td colspan="2"><%=itemPotency %></td> --%>
<!-- Item Standard Potency --> <!-- Item Standard Potency -->
<% <%
stockPotency = stockPotency == null || stockPotency.length()== 0 ? "0" : stockPotency; stockPotency = stockPotency == null
stockPotency=df.format(Double.parseDouble(stockPotency)); || stockPotency.length() == 0
? "0"
: stockPotency;
stockPotency = df.format(Double.parseDouble(stockPotency));
%> %>
<td colspan="2"><%=stockPotency%></td> <%-- <td colspan="2"><%=stockPotency%></td> --%>
<!-- Stock Potency show from res or stock --> <!-- Stock Potency show from res or stock -->
...@@ -559,52 +881,110 @@ ...@@ -559,52 +881,110 @@
//System.out.println("Stock Block data stock Map ["+dataStkMap.toString()+"]"); //System.out.println("Stock Block data stock Map ["+dataStkMap.toString()+"]");
%> %>
<td colspan="1"><%=dataStkMap.get("loc_code") %></td> <td colspan="1"><%=dataStkMap.get("loc_code")%></td>
<%
cell = row.createCell((int)9);
cell.setCellValue(dataStkMap.get("loc_code").toString());
cell.setCellStyle(cellStyle);
%>
<!-- Stock Detail --> <!-- Stock Detail -->
<td colspan="1"><%=dataStkMap.get("lot_no") %></td> <td colspan="1"><%=dataStkMap.get("lot_no")%></td>
<%
cell = row.createCell((int)10);
cell.setCellValue(dataStkMap.get("lot_no").toString());
cell.setCellStyle(cellStyle);
%>
<!-- Stock Detail --> <!-- Stock Detail -->
<td colspan="1"><%=dataStkMap.get("lot_sl") %></td> <td colspan="1"><%=dataStkMap.get("lot_sl")%></td>
<%
cell = row.createCell((int)11);
cell.setCellValue(dataStkMap.get("lot_sl").toString());
cell.setCellStyle(cellStyle);
%>
<!-- Stock Detail --> <!-- Stock Detail -->
<% <%
String quantity = (String)dataStkMap.get("quantity"); String quantity = (String) dataStkMap.get("quantity");
quantity = quantity == null || quantity.length()== 0 ? "0" : quantity; quantity = quantity == null
quantity=df.format(Double.parseDouble(quantity)); || quantity.length() == 0
? "0"
: quantity;
quantity = df.format(Double.parseDouble(quantity));
%>
<td colspan="1"><%=quantity%></td>
<%
cell = row.createCell((int)12);
cell.setCellValue(quantity);
cell.setCellStyle(cellStyle);
%> %>
<td colspan="1"><%=quantity %></td>
<!-- Stock Qty. from stock --> <!-- Stock Qty. from stock -->
<td colspan="2"><%=exmpLabelMap.get("adj_potency") %></td> <td colspan="2"><%=exmpLabelMap.get("adj_potency")%></td>
<%
cell = row.createCell((int)13);
cell.setCellValue(exmpLabelMap.get("adj_potency").toString());
cell.setCellStyle(cellStyle);
%>
<!-- Adjusted With --> <!-- Adjusted With -->
<% <%
potencyAdj = potencyAdj == null || potencyAdj.length()== 0 ? "0" : potencyAdj; potencyAdj = potencyAdj == null
potencyAdj=df.format(Double.parseDouble(potencyAdj)); || potencyAdj.length() == 0
? "0"
: potencyAdj;
potencyAdj = df.format(Double.parseDouble(potencyAdj));
System.out.print("___________"
+ potencyAdj);
%>
<td colspan="2"><%=potencyAdj%></td>
<%
cell = row.createCell((int)14);
cell.setCellValue(potencyAdj);
cell.setCellStyle(cellStyle);
%> %>
<td colspan="2"><%=potencyAdj %></td>
<!-- Total Qty. to be Adj. for Item stock or res--> <!-- Total Qty. to be Adj. for Item stock or res-->
<% <%
if(dataRcvMap != null) if (dataRcvMap != null) {
{
//System.out.println("Stock Block data reserve Map ["+dataRcvMap.toString()+"]"); //System.out.println("Stock Block data reserve Map ["+dataRcvMap.toString()+"]");
%> %>
<td colspan="1"><%=dataRcvMap.get("loc_code") %></td> <td colspan="1"><%=dataRcvMap.get("loc_code")%></td>
<%
cell = row.createCell((int)15);
cell.setCellValue(dataRcvMap.get("loc_code").toString());
cell.setCellStyle(cellStyle);
%>
<!-- Reserve --> <!-- Reserve -->
<td colspan="1"><%=dataRcvMap.get("lot_no") %></td> <td colspan="1"><%=dataRcvMap.get("lot_no")%></td>
<%
cell = row.createCell((int)16);
cell.setCellValue(dataRcvMap.get("lot_no").toString());
cell.setCellStyle(cellStyle);
%>
<!-- Reserve --> <!-- Reserve -->
<td colspan="1"><%=dataRcvMap.get("lot_sl") %></td> <td colspan="1"><%=dataRcvMap.get("lot_sl")%></td>
<%
cell = row.createCell((int)17);
cell.setCellValue(dataRcvMap.get("lot_sl").toString());
cell.setCellStyle(cellStyle);
%>
<!-- Reserve --> <!-- Reserve -->
<% <%
String quantityRcv = (String)dataRcvMap.get("quantity"); String quantityRcv = (String) dataRcvMap.get("quantity");
quantityRcv = quantityRcv == null || quantityRcv.length()== 0 ? "0" : quantityRcv; quantityRcv = quantityRcv == null
quantityRcv=df.format(Double.parseDouble(quantityRcv)); || quantityRcv.length() == 0
? "0"
: quantityRcv;
quantityRcv = df.format(Double.parseDouble(quantityRcv));
%>
<td colspan="1"><%=quantityRcv%></td>
<%
cell = row.createCell((int)18);
cell.setCellValue(quantityRcv);
cell.setCellStyle(cellStyle);
%> %>
<td colspan="1"><%=quantityRcv %></td>
<!-- Reserve --> <!-- Reserve -->
<% <%
} } else {
else
{
%> %>
<td colspan="1"></td> <td colspan="1"></td>
<td colspan="1"></td> <td colspan="1"></td>
...@@ -612,10 +992,18 @@ ...@@ -612,10 +992,18 @@
<td colspan="1"></td> <td colspan="1"></td>
<% <%
} }
updtQty = updtQty == null || updtQty.length()== 0 ? "0" : updtQty; updtQty = updtQty == null
updtQty=df.format(Double.parseDouble(updtQty)); || updtQty.length() == 0
? "0"
: updtQty;
updtQty = df.format(Double.parseDouble(updtQty));
%>
<td colspan="1"><%=updtQty%></td>
<%
cell = row.createCell((int)19);
cell.setCellValue(updtQty);
cell.setCellStyle(cellStyle);
%> %>
<td colspan="1"><%=updtQty %></td>
<!-- UPD QTY --> <!-- UPD QTY -->
</tr> </tr>
<% <%
...@@ -626,23 +1014,26 @@ ...@@ -626,23 +1014,26 @@
//System.out.println("trrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"); //System.out.println("trrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr");
} }
} }
}
else } else {
{ //System.out.println("in else message ::::::::::: ");
NodeList errorList = dom.getElementsByTagName("error"); NodeList errorList = dom.getElementsByTagName("error");
int errorListLen = errorList.getLength(); int errorListLen = errorList.getLength();
for(int errCtr = 0; errCtr < errorListLen; errCtr++) for (int errCtr = 0; errCtr < errorListLen; errCtr++) {
{
Node errorNode = errorList.item(errCtr); Node errorNode = errorList.item(errCtr);
if (errorNode.getNodeType() == Node.ELEMENT_NODE) if (errorNode.getNodeType() == Node.ELEMENT_NODE) {
{
Element eElement = (Element) errorNode; Element eElement = (Element) errorNode;
//errorMessage = eElement.getElementsByTagName("message").item(0).getTextContent() +"'\n'"+ eElement.getElementsByTagName("description").item(0).getTextContent(); //errorMessage = eElement.getElementsByTagName("message").item(0).getTextContent() +"'\n'"+ eElement.getElementsByTagName("description").item(0).getTextContent();
errorMessage = eElement.getElementsByTagName("message").item(0).getTextContent()+"\\n"+eElement.getElementsByTagName("description").item(0).getTextContent(); errorMessage = eElement
System.out.println("message ::::::::::: "+ errorMessage); .getElementsByTagName("message").item(0)
.getTextContent()
+ "\\n"
+ eElement.getElementsByTagName("description").item(0).getTextContent();
System.out.println("message ::::::::::: "
+ errorMessage);
%> %>
<script> <script>
alert("<%=errorMessage%>"); alert("<%=errorMessage%>");
...@@ -651,11 +1042,28 @@ ...@@ -651,11 +1042,28 @@
} }
} }
} }
}
%> %>
</table> </table>
<%
if (exportToExcel == null || exportToExcel.length() == 0) {
%>
<a href="WOrderStkStatusRep.jsp?exportToExcel=YES">Export to Excel</a>
<%
} else {
File fName = new File(workOrder.trim()+"_"+campgnNo+"_firmplan_" + System.currentTimeMillis() + ".xls");
FileOutputStream fos = new FileOutputStream(fName);
workbook.write(fos);
fos.close();
System.out.println(fName.getAbsolutePath() + " written successfully");
String jBossFirmPlanPath = CommonConstants.JBOSSHOME + File.separator + "firmplan_Excels" +File.separator + fName.getName();
fName.renameTo(new File(jBossFirmPlanPath));
//response.setContentType("application/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
//response.setHeader("Content-Disposition", "attachment;filename="+fName);
}
%>
</form> </form>
</body> </body>
</html> </html>
\ No newline at end of file
Insert into mfgparm (PRD_CODE,VAR_NAME,VAR_TYPE,VAR_VALUE,DESCR,VAR_SUBS,CHG_DATE,CHG_USER,CHG_TERM) values ('999999','AWMS_EXP_DATE_CHECK','S','8',
'No of days',null,sysdate,'BASE','BASE');
--sql for validations in firmplan added on 03/Jan/2017--
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values ('VTWORDNO','Invalid work order number','Workorder Number does not exists','E','Y',null,null,null,sysdate,'E28529','jbnbaskalyani',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values ('VTCMPGNO','Invalid Campaign No','Campaign Number does not exists.','E','Y',null,null,null,sysdate,'E28529','jbnbaskalyani',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values ('INVTRANS','Cannot Process','Please enter either workorder or campaign no.','E','Y',null,null,null,sysdate,'E28529','jbnbaskalyani',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values ('VTCMPWORD','Fields Blank','Input fields cannot be left blank','E','Y',null,null,null,sysdate,'E28529','jbnbaskalyani',null,null);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment