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.net.*"%>
<%@ page import="ibase.utility.*"%>
......@@ -8,6 +18,7 @@
<%@ page import="ibase.utility.UserInfoBean"%>
<%@ page import="ibase.webitm.servlet.ITMWizardHandlerServlet"%>
<%@ 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.Element"%>
......@@ -27,74 +38,108 @@
<%@ page import="javax.naming.InitialContext"%>
<%@ page import="java.text.DecimalFormat"%>
<%
String loginCode = "", XTRA_PARAMS_SEPARATOR = "", chgTerm = "", workOrder = "", campgnNo = "", leastExpdtRM = "";
StringBuffer valueXmlString;
//DecimalFormat df = new DecimalFormat("#.###");
DecimalFormat df = new DecimalFormat("0.000");
session = request.getSession();
ibase.utility.UserInfoBean userInfo = (ibase.utility.UserInfoBean)session.getAttribute("USER_INFO");
if(userInfo != null)
{
loginCode = userInfo.getLoginCode();
System.out.println( "Getting Login Code -----------------["+loginCode+"]");
}
else
{
System.out.println( "userInfo is null -----------------");
}
XTRA_PARAMS_SEPARATOR = "~~";
StringBuffer xtraParamsBuff = new StringBuffer();
xtraParamsBuff.append("loginCode=" + userInfo.getLoginCode());
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("loginEmpCode=" + userInfo.getEmpCode());
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("loginSiteCode=" + userInfo.getSiteCode());
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("entityCode=" + userInfo.getEntityCode());
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("profileId=" + userInfo.getProfileId());
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("userType=" + userInfo.getUserType());
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("runMode=I");
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("user_lang=" + userInfo.getUserLanguage());
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("termId="+userInfo.getRemoteHost());
chgTerm = userInfo.getRemoteHostName();
if( chgTerm != null && chgTerm.length() > 15 )
{
chgTerm = chgTerm.substring(0, 15);
}
else if( chgTerm == null || chgTerm.length() == 0 )
{
chgTerm = userInfo.getRemoteHost();
}
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("chgTerm=" + chgTerm );
System.out.println("xtraParamsBuff ["+xtraParamsBuff+"]");
workOrder = request.getParameter("workOrder");
campgnNo = request.getParameter("campgnNo");
//leastExpdtRM = request.getParameter("leastExpdtRM");
//System.out.println( "workOrder from WOrderStkStatus.jsp -----------------" + workOrder);
//System.out.println( "campgnNo from WOrderStkStatus.jsp -----------------" + campgnNo);
//String campgnNo = "", leastExpdtRM = "";
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("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\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("</Detail1>\r\n");
//System.out.println("valueXmlString in WOrderStkStatus.jsp :::::::: ["+valueXmlString.toString()+"]");
WoFirmplanPrcRemote woFirmplanPrcRmt = (WoFirmplanPrcRemote)new InitialContext().lookup("ibase/WoFirmplanPrc/remote");
String xmlStr = woFirmplanPrcRmt.process(valueXmlString.toString(), valueXmlString.toString(), "firmplan", xtraParamsBuff.toString());
System.out.println("xmlStr from WOrderStkStatus.jsp ::::::::::: " + xmlStr);
%>
<%
String loginCode = "", XTRA_PARAMS_SEPARATOR = "", chgTerm = "", workOrder = "", campgnNo = "", leastExpdtRM = "", exportToExcel = "YES";
StringBuffer valueXmlString;
//DecimalFormat df = new DecimalFormat("#.###");
DecimalFormat df = new DecimalFormat("0.000");
HSSFWorkbook workbook = new HSSFWorkbook();
session = request.getSession();
ibase.utility.UserInfoBean userInfo = (ibase.utility.UserInfoBean) session.getAttribute("USER_INFO");
if (userInfo != null) {
loginCode = userInfo.getLoginCode();
System.out.println("Getting Login Code -----------------["
+ loginCode + "]");
} else {
System.out.println("userInfo is null -----------------");
}
XTRA_PARAMS_SEPARATOR = "~~";
StringBuffer xtraParamsBuff = new StringBuffer();
xtraParamsBuff.append("loginCode=" + userInfo.getLoginCode());
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("loginEmpCode=" + userInfo.getEmpCode());
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("loginSiteCode=" + userInfo.getSiteCode());
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("entityCode=" + userInfo.getEntityCode());
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("profileId=" + userInfo.getProfileId());
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("userType=" + userInfo.getUserType());
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("runMode=I");
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("user_lang=" + userInfo.getUserLanguage());
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("termId=" + userInfo.getRemoteHost());
chgTerm = userInfo.getRemoteHostName();
if (chgTerm != null && chgTerm.length() > 15) {
chgTerm = chgTerm.substring(0, 15);
} else if (chgTerm == null || chgTerm.length() == 0) {
chgTerm = userInfo.getRemoteHost();
}
xtraParamsBuff.append(XTRA_PARAMS_SEPARATOR).append("chgTerm=" + chgTerm);
System.out.println("xtraParamsBuff [" + xtraParamsBuff + "]");
//exportToExcel = request.getParameter("exportToExcel");
System.out.println("exportToExcel:::: [" + exportToExcel + "]");
workOrder = request.getParameter("workOrder");
campgnNo = request.getParameter("campgnNo");
//leastExpdtRM = request.getParameter("leastExpdtRM");
//System.out.println( "workOrder from WOrderStkStatus.jsp -----------------" + workOrder);
//System.out.println( "campgnNo from WOrderStkStatus.jsp -----------------" + campgnNo);
//String campgnNo = "", leastExpdtRM = "";
String errorMessageVal = "";
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("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\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("</Detail1>\r\n");
System.out.println("valueXmlString in WOrderStkStatus.jsp :::::::: ["
+ 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());
System.out.println("xmlStr from WOrderStkStatus.jsp ::::::::::: " + xmlStr);
%>
<html>
<head>
......@@ -106,556 +151,919 @@
</head>
<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>
<%
//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>
<th colspan="2" rowspan="2">Work Order</th>
<th colspan="2" rowspan="2">Oper.</th>
<th colspan="2" rowspan="2">Exp <br>Level
</th>
<th colspan="2" rowspan="2">Main/Alternate <br>Item
</th>
<th colspan="2" rowspan="2">Description</th>
<th colspan="2" rowspan="2">Unit</th>
<th colspan="2" rowspan="2">Critical <br>(Y/N)
</th>
<th colspan="2" rowspan="2">Bill <br>Quantity
</th>
<th colspan="2" rowspan="2">Batch No</th>
<!-- <th colspan="2" rowspan="2">Match<br>Potency</th>
<th colspan="2" rowspan="2">Minimum<br>Potency</th>
<th colspan="2" rowspan="2">Std.<br>Potency</th>
<th colspan="2" rowspan="2">Stock <br>Potency</th> -->
<th colspan="4">Stock Detail</th>
<th colspan="2" rowspan="2">Adjust<br>With
</th>
<th colspan="2" rowspan="2">Adjust <br>quantity
</th>
<th colspan="4">Reserved Stock Details</th>
<th colspan="2" rowspan="2">Update<br>quantity
</th>
</tr>
<tr>
<th>Loc.</th>
<th>Lot No.</th>
<th>Lot SL</th>
<th>Quantity</th>
<th>Loc.</th>
<th>Lot No.</th>
<th>Lot SL</th>
<th>Quantity</th>
</tr>
<form>
<table border="0" width="100%">
<tr>
<th colspan="2" rowspan="2">Work Order</th>
<th colspan="2" rowspan="2">Oper.</th>
<th colspan="2" rowspan="2">Exp <br>
Level</th>
<th colspan="2" rowspan="2">Main/Alternate <br>
Item</th>
<th colspan="2" rowspan="2">Description</th>
<th colspan="2" rowspan="2">Unit</th>
<th colspan="2" rowspan="2">Critical <br>
(Y/N)</th>
<th colspan="2" rowspan="2">Bill <br>
Quantity</th>
<th colspan="2" rowspan="2">Match<br>Potency</th>
<th colspan="2" rowspan="2">Minimum<br>
Potency</th>
<th colspan="2" rowspan="2">Std.<br>
Potency</th>
<th colspan="2" rowspan="2">Stock <br>
Potency</th>
<th colspan="4">Stock Detail</th>
<th colspan="2" rowspan="2">Adjust<br>
With</th>
<th colspan="2" rowspan="2">Adjust <br>
quantity</th>
<th colspan="4">Reserved Stock Details</th>
<th colspan="2" rowspan="2">Update<br>quantity</th>
</tr>
<tr>
<th>Loc.</th>
<th>Lot No.</th>
<th>Lot SL</th>
<th>Quantity</th>
<th>Loc.</th>
<th>Lot No.</th>
<th>Lot SL</th>
<th>Quantity</th>
</tr>
<%
String errorMessage = "Process completed sucessfully..... !!!";
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
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/Error.xml");
InputSource inputSource = new InputSource( new StringReader( xmlStr ) );
Document dom = builder.parse( inputSource );
ArrayList resvList = null;
ArrayList stkList = null;
HashMap exmpLabelMap = null;
String isAlternate = "", stockPotency = "", allocQty = "", itemPotency = "", tranId = "", updtQty = "", potencyAdj = "", adjQty = "",
itemCode = "", itemDescr = "", unit = "",otherSite = "";
//DecimalFormat df = new DecimalFormat("0.000");
NodeList wrkOrderNodeList = dom.getElementsByTagName("work_order");
int wrkOrderNodeListLength = wrkOrderNodeList.getLength();
System.out.println("My List="+wrkOrderNodeList);
System.out.println("My List Length="+wrkOrderNodeList);
if(wrkOrderNodeListLength > 0)
{
%>
<script>
<%
String successMessage = "Firmplan completed sucessfully..... !!!";
String errorMessage = "Firmplan Failed....!!!";
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
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/Error.xml");
InputSource inputSource = new InputSource(new StringReader(
xmlStr));
Document dom = builder.parse(inputSource);
ArrayList resvList = null;
ArrayList stkList = null;
HashMap exmpLabelMap = null;
String isAlternate = "", stockPotency = "", allocQty = "", itemPotency = "", tranId = "", updtQty = "", potencyAdj = "", adjQty = "", itemCode = "", itemDescr = "", unit = "", otherSite = "";
//DecimalFormat df = new DecimalFormat("0.000");
System.out
.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();
System.out.println("My List=" + wrkOrderNodeList);
System.out.println("My List Length=" + wrkOrderNodeListLength);
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>
alert("<%=errorMessage%>");
</script>
<%
for(int wrkCtr = 0; wrkCtr <= wrkOrderNodeListLength; wrkCtr++)
{
Node wrkOrderNode = wrkOrderNodeList.item(wrkCtr);
if(wrkOrderNode != null && wrkOrderNode.getNodeType() == wrkOrderNode.ELEMENT_NODE)
{
NodeList explLabNodeList = wrkOrderNode.getChildNodes();
int explLabNodeListLen = explLabNodeList.getLength();
for(int explCtr = 0;explCtr <= explLabNodeListLen;explCtr++)
{
Node explLblNode = explLabNodeList.item(explCtr);
stkList = new ArrayList();
resvList = new ArrayList();
exmpLabelMap = new HashMap();
if(explLblNode != null && explLblNode.getNodeType() == explLblNode.ELEMENT_NODE)
{
NodeList dataNodeList = explLblNode.getChildNodes();
int dataNodeListLen = dataNodeList.getLength();
for(int dataCtr = 0;dataCtr <= dataNodeListLen;dataCtr++)
{
Node dataNode = dataNodeList.item(dataCtr);
boolean isFalse = false;
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());
if(dataNode.getNodeName().equalsIgnoreCase("reserve_stock"))
{
NodeList reservestkNodeList = dataNode.getChildNodes();
int reservestkNodeListLen = reservestkNodeList.getLength();
for(int dataResvCtr = 0;dataResvCtr <= reservestkNodeListLen;dataResvCtr++)
{
Node dataRecvNode = reservestkNodeList.item(dataResvCtr);
if(dataRecvNode != null && dataRecvNode.getNodeType() == dataRecvNode.ELEMENT_NODE)
{
HashMap dataRcvMap = new HashMap();
//System.out.println("dataRecvNode column Name ["+dataRecvNode.getNodeName()+"] dataRecvNode column value ["+dataRecvNode.getFirstChild().getNodeValue()+"]");
NodeList detailRecvNodeList = dataRecvNode.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()+"]");
dataRcvMap.put(detailRecvNode.getNodeName(), detailRecvNode.getFirstChild().getNodeValue());
}
else
{
//System.out.println("column Name ["+detailRecvNode.getNodeName()+"]column value []");
dataRcvMap.put(detailRecvNode.getNodeName(), "");
}
}
}
resvList.add(dataRcvMap);
}
}
}
if(dataNode.getNodeName().equalsIgnoreCase("stock_detail"))
{
NodeList reservestkNodeList = dataNode.getChildNodes();
int reservestkNodeListLen = reservestkNodeList.getLength();
for(int dataResvCtr = 0;dataResvCtr <= reservestkNodeListLen;dataResvCtr++)
{
Node dataRecvNode = reservestkNodeList.item(dataResvCtr);
if(dataRecvNode != null && dataRecvNode.getNodeType() == dataRecvNode.ELEMENT_NODE)
{
HashMap datastkMap = new HashMap();
System.out.println("dataRecvNode column Name ["+dataRecvNode.getNodeName()+"] dataRecvNode column value ["+dataRecvNode.getFirstChild().getNodeValue()+"]");
NodeList detailRecvNodeList = dataRecvNode.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()+"]");
datastkMap.put(detailRecvNode.getNodeName(), detailRecvNode.getFirstChild().getNodeValue());
}
else
{
//System.out.println("column Name ["+detailRecvNode.getNodeName()+"]column value []");
datastkMap.put(detailRecvNode.getNodeName(), "");
}
}
}
System.out.println("datastkMap ["+datastkMap);
stkList.add(datastkMap);
System.out.println("StockListSize ["+stkList.size());
}
}
}
else
{
if(dataNode.getFirstChild() != null)
{
exmpLabelMap.put(dataNode.getNodeName(), dataNode.getFirstChild().getNodeValue());
}
else
{
exmpLabelMap.put(dataNode.getNodeName(), "");
}
}
}
}
}
if(exmpLabelMap != null && exmpLabelMap.size() > 0)
{
int sizeStkList = stkList.size();
int sizeresvList = resvList.size();
System.out.println("stkList :::::::::: " + stkList);
System.out.println("resvList :::::::::: " + stkList);
//out.println("::::::::: Inside if for reserve stock :::::::::: ");
//out.println(" ::::::::: Inside else for stock details :::::::::: ");
for(int ctrRcv = 0; ctrRcv < sizeStkList; ctrRcv++)
{
%>
<tr>
<%
HashMap dataStkMap = (HashMap)stkList.get(ctrRcv);
HashMap dataRcvMap = null;
if(ctrRcv < sizeresvList)
{
dataRcvMap = (HashMap)resvList.get(ctrRcv);
}
if(exmpLabelMap.get("match_potency").equals("N"))
{
itemPotency = "0";
}
else
{
itemPotency = (String) exmpLabelMap.get("item_potency");
}
/*
out.println(" --------------------------- start --------------------------------- " );
out.println("<br>" );
out.println(" ::::::::: ctrRcv :::::::::: " + ctrRcv );
out.println(" ::::::::: sizeStkList :::::::::: " + sizeStkList );
out.println(" ::::::::: sizeresvList :::::::::: " + sizeresvList );
out.println(" ::::::::: dataRcvMap :::::::::: " + dataRcvMap );
out.println("<br>" );
out.println(" ::::::::: dataStkMap :::::::::: " + dataStkMap );
out.println("<br>" );
out.println("------------------ is alternate rec ------------- " + dataRcvMap.get("is_alternate"));
out.println("<br>" );
out.println("------------------ is alternate stock ------------- " + dataStkMap.get("is_alternate"));
out.println("<br>" );
out.println("------------------ inside isAlternate ------------- " + isAlternate);
out.println("<br>" );
*/
//System.out.println("Stock Block data stock Map ["+exmpLabelMap.toString()+"]");
%>
<td colspan="2"><%=exmpLabelMap.get("work_order") %></td>
<!-- Work Order -->
<td colspan="2"><%=exmpLabelMap.get("operation") %></td>
<!-- Oper. -->
<td colspan="2"><%=exmpLabelMap.get("exp_lev") %></td>
<!-- Exp. level -->
<%
if(dataStkMap != null)
{
//out.println(" ------- else --------------------------------- " );out.println("<br>" );
itemCode = (String) dataStkMap.get("item_code");
itemDescr = (String) dataStkMap.get("item_descr");
unit = (String) dataStkMap.get("unit");
stockPotency = (String) dataStkMap.get("stock_potency");
potencyAdj = (String) dataStkMap.get("potency_adj");
updtQty = (String) dataStkMap.get("alloc_qty");
isAlternate = (String) dataStkMap.get("is_alternate");
otherSite = (String) dataStkMap.get("other_site");
}
else
{
//out.println("----- Inside if dataRcvMap != null ------------- ");
//out.println("<br>" );
if(dataRcvMap.get("tran_id") == null)
{
tranId = "";
}
else
{
tranId = (String) dataRcvMap.get("tran_id");
}
if(dataRcvMap.get("item_code").equals(""))
{
itemCode = (String) dataStkMap.get("item_code");
itemDescr = (String) dataStkMap.get("item_descr");
unit = (String) dataStkMap.get("unit");
stockPotency = (String) dataStkMap.get("stock_potency");
System.out.println("@@stockPotency123"+stockPotency);
potencyAdj = (String) dataStkMap.get("potency_adj");
updtQty = (String) dataStkMap.get("alloc_qty");
isAlternate = (String) dataStkMap.get("is_alternate");
otherSite = (String) dataStkMap.get("other_site");
}
else
{
itemCode = (String) dataRcvMap.get("item_code");
itemDescr = (String) dataRcvMap.get("item_descr");
unit = (String) dataRcvMap.get("unit");
stockPotency = (String) dataRcvMap.get("stock_potency");
potencyAdj = (String) dataRcvMap.get("potency_adj");
updtQty = (String) dataRcvMap.get("alloc_qty");
isAlternate = (String) dataRcvMap.get("is_alternate");
otherSite = (String) dataStkMap.get("other_site");
}
if(dataRcvMap.get("item_code").equals("") && dataStkMap.get("item_code").equals(""))
{
itemCode = (String) exmpLabelMap.get("item_code");
itemDescr = (String) exmpLabelMap.get("item_descr");
unit = (String) exmpLabelMap.get("unit");
stockPotency = "";
potencyAdj = "";
updtQty = "";
otherSite = (String) dataStkMap.get("other_site");
}
if(!dataRcvMap.get("item_code").equals("") && !dataStkMap.get("item_code").equals(""))
{
itemCode = (String) exmpLabelMap.get("item_code");
itemDescr = (String) exmpLabelMap.get("item_descr");
unit = (String) exmpLabelMap.get("unit");
stockPotency = (String) dataStkMap.get("stock_potency");
double potencyAdjDb = Double.parseDouble(dataStkMap.get("alloc_qty")+"");// + Double.parseDouble(dataRcvMap.get("qty_adj")+"");
potencyAdj = Double.toString(potencyAdjDb);
double updtQtyDb = Double.parseDouble(dataStkMap.get("alloc_qty")+"");// + Double.parseDouble(dataRcvMap.get("upd_qty")+"");
updtQty = Double.toString(updtQtyDb);
otherSite = (String) dataStkMap.get("other_site");
}
}
if(exmpLabelMap.get("is_sufficient").equals("N"))
{ // Red colour
%>
<td colspan="2" style="color: #FF0000;"><%=itemCode %></td>
<td colspan="2" style="color: #FF0000;"><%=itemDescr %></td>
<td colspan="2" style="color: #FF0000;"><%=unit %></td>
<%
}
else if("Y".equals(isAlternate) && "Y".equals(otherSite))
{ // pale green colour
%>
<td colspan="2" style="color: #808000;"><%=itemCode %></td>
<td colspan="2" style="color: #808000;"><%=itemDescr %></td>
<td colspan="2" style="color: #808000;"><%=unit %></td>
<%
}
else if("Y".equals(isAlternate) && !"Y".equals(otherSite))
{ // blue colour
%>
<td colspan="2" style="color: #0000FF;"><%=itemCode %></td>
<td colspan="2" style="color: #0000FF;"><%=itemDescr %></td>
<td colspan="2" style="color: #0000FF;"><%=unit %></td>
<%
}
else if(!"Y".equals(isAlternate) && "Y".equals(otherSite))
{ // green colour
%>
<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
{
%>
<td colspan="2"><%=itemCode %></td>
<td colspan="2"><%=itemDescr %></td>
<td colspan="2"><%=unit %></td>
<%
}
%>
<td colspan="2"><%=exmpLabelMap.get("crit_Item") %></td>
<!-- Critical Item (Y/N) -->
<%
String billQty = (String) exmpLabelMap.get("quantity");
billQty = billQty == null || billQty.length()== 0 ? "0" : billQty;
billQty=df.format(Double.parseDouble(billQty));
%>
<!-- <td colspan="2" ><--%=exmpLabelMap.get("quantity") %></td> -->
<!-- WO Bill Quantity -->
<td colspan="2"><%=billQty %></td>
<!-- WO Bill Quantity -->
<%
String quantityAdj = (String) exmpLabelMap.get("adjusted_qty");
quantityAdj = quantityAdj == null || quantityAdj.length()== 0 ? "0" : quantityAdj;
quantityAdj=df.format(Double.parseDouble(quantityAdj));
%>
<!-- (+/-) Adjusted Qty. -->
<td colspan="2"><%=exmpLabelMap.get("match_potency") %></td>
<!-- M. Pote. -- if match_potency value N the item_potency == 0 -->
<%
String minPtency = (String) exmpLabelMap.get("min_potency_perc");
minPtency = minPtency == null || minPtency.length()== 0 ? "0" : minPtency;
minPtency=df.format(Double.parseDouble(minPtency));
%>
<td colspan="2"><%=minPtency %></td>
<!-- Minimum Potency -->
<%
// String minPtency = (String) exmpLabelMap.get("min_potency_perc");
itemPotency = itemPotency == null || itemPotency.length()== 0 ? "0" : itemPotency;
itemPotency=df.format(Double.parseDouble(itemPotency));
%>
<td colspan="2"><%=itemPotency %></td>
<!-- Item Standard Potency -->
<%
stockPotency = stockPotency == null || stockPotency.length()== 0 ? "0" : stockPotency;
stockPotency=df.format(Double.parseDouble(stockPotency));
%>
<td colspan="2"><%=stockPotency%></td>
<!-- Stock Potency show from res or stock -->
<%
//System.out.println("Stock Block data stock Map ["+dataStkMap.toString()+"]");
%>
<td colspan="1"><%=dataStkMap.get("loc_code") %></td>
<!-- Stock Detail -->
<td colspan="1"><%=dataStkMap.get("lot_no") %></td>
<!-- Stock Detail -->
<td colspan="1"><%=dataStkMap.get("lot_sl") %></td>
<!-- Stock Detail -->
<%
String quantity = (String)dataStkMap.get("quantity");
quantity = quantity == null || quantity.length()== 0 ? "0" : quantity;
quantity=df.format(Double.parseDouble(quantity));
%>
<td colspan="1"><%=quantity %></td>
<!-- Stock Qty. from stock -->
<td colspan="2"><%=exmpLabelMap.get("adj_potency") %></td>
<!-- Adjusted With -->
<%
potencyAdj = potencyAdj == null || potencyAdj.length()== 0 ? "0" : potencyAdj;
potencyAdj=df.format(Double.parseDouble(potencyAdj));
%>
<td colspan="2"><%=potencyAdj %></td>
<!-- Total Qty. to be Adj. for Item stock or res-->
<%
if(dataRcvMap != null)
{
//System.out.println("Stock Block data reserve Map ["+dataRcvMap.toString()+"]");
%>
<td colspan="1"><%=dataRcvMap.get("loc_code") %></td>
<!-- Reserve -->
<td colspan="1"><%=dataRcvMap.get("lot_no") %></td>
<!-- Reserve -->
<td colspan="1"><%=dataRcvMap.get("lot_sl") %></td>
<!-- Reserve -->
<%
String quantityRcv = (String)dataRcvMap.get("quantity");
quantityRcv = quantityRcv == null || quantityRcv.length()== 0 ? "0" : quantityRcv;
quantityRcv=df.format(Double.parseDouble(quantityRcv));
%>
<td colspan="1"><%=quantityRcv %></td>
<!-- Reserve -->
<%
}
else
{
%>
<td colspan="1"></td>
<td colspan="1"></td>
<td colspan="1"></td>
<td colspan="1"></td>
<%
}
updtQty = updtQty == null || updtQty.length()== 0 ? "0" : updtQty;
updtQty=df.format(Double.parseDouble(updtQty));
%>
<td colspan="1"><%=updtQty %></td>
<!-- UPD QTY -->
</tr>
<%
}
}
}
//System.out.println("trrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr");
}
}
}
else
{
NodeList errorList = dom.getElementsByTagName("error");
int errorListLen = errorList.getLength();
for(int errCtr = 0; errCtr < errorListLen; errCtr++)
{
Node errorNode = errorList.item(errCtr);
if (errorNode.getNodeType() == Node.ELEMENT_NODE)
{
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();
System.out.println("message ::::::::::: "+ errorMessage);
%>
<script>
<%
}
if (wrkOrderNodeListLength > 0) {
for (int wrkCtr = 0; wrkCtr <= wrkOrderNodeListLength; wrkCtr++) {
Node wrkOrderNode = wrkOrderNodeList.item(wrkCtr);
if (wrkOrderNode != null
&& wrkOrderNode.getNodeType() == wrkOrderNode.ELEMENT_NODE) {
NodeList explLabNodeList = wrkOrderNode
.getChildNodes();
int explLabNodeListLen = explLabNodeList
.getLength();
for (int explCtr = 0; explCtr <= explLabNodeListLen; explCtr++) {
Node explLblNode = explLabNodeList
.item(explCtr);
stkList = new ArrayList();
resvList = new ArrayList();
exmpLabelMap = new HashMap();
if (explLblNode != null
&& explLblNode.getNodeType() == explLblNode.ELEMENT_NODE) {
NodeList dataNodeList = explLblNode.getChildNodes();
int dataNodeListLen = dataNodeList.getLength();
for (int dataCtr = 0; dataCtr <= dataNodeListLen; dataCtr++) {
Node dataNode = dataNodeList
.item(dataCtr);
boolean isFalse = false;
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());
if (dataNode.getNodeName().equalsIgnoreCase("reserve_stock")) {
NodeList reservestkNodeList = dataNode.getChildNodes();
int reservestkNodeListLen = reservestkNodeList.getLength();
for (int dataResvCtr = 0; dataResvCtr <= reservestkNodeListLen; dataResvCtr++) {
Node dataRecvNode = reservestkNodeList
.item(dataResvCtr);
if (dataRecvNode != null
&& dataRecvNode
.getNodeType() == dataRecvNode.ELEMENT_NODE) {
HashMap dataRcvMap = new HashMap();
//System.out.println("dataRecvNode column Name ["+dataRecvNode.getNodeName()+"] dataRecvNode column value ["+dataRecvNode.getFirstChild().getNodeValue()+"]");
NodeList detailRecvNodeList = dataRecvNode
.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()+"]");
dataRcvMap.put(detailRecvNode.getNodeName(),
detailRecvNode.getFirstChild().getNodeValue());
} else {
//System.out.println("column Name ["+detailRecvNode.getNodeName()+"]column value []");
dataRcvMap.put(detailRecvNode.getNodeName(),
"");
}
}
}
resvList.add(dataRcvMap);
}
}
}
if (dataNode.getNodeName().equalsIgnoreCase("stock_detail")) {
NodeList reservestkNodeList = dataNode.getChildNodes();
int reservestkNodeListLen = reservestkNodeList.getLength();
for (int dataResvCtr = 0; dataResvCtr <= reservestkNodeListLen; dataResvCtr++) {
Node dataRecvNode = reservestkNodeList.item(dataResvCtr);
if (dataRecvNode != null
&& dataRecvNode
.getNodeType() == dataRecvNode.ELEMENT_NODE) {
HashMap datastkMap = new HashMap();
System.out
.println("dataRecvNode column Name ["
+ dataRecvNode
.getNodeName()
+ "] dataRecvNode column value ["
+ dataRecvNode
.getFirstChild()
.getNodeValue()
+ "]");
NodeList detailRecvNodeList = dataRecvNode
.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()+"]");
datastkMap.put(detailRecvNode.getNodeName(), detailRecvNode.getFirstChild().getNodeValue());
} else {
//System.out.println("column Name ["+detailRecvNode.getNodeName()+"]column value []");
datastkMap.put(detailRecvNode.getNodeName(),
"");
}
}
}
System.out
.println("datastkMap ["
+ datastkMap);
stkList.add(datastkMap);
System.out
.println("StockListSize ["
+ stkList
.size());
}
}
} else {
if (dataNode.getFirstChild() != null) {
exmpLabelMap.put(dataNode
.getNodeName(),
dataNode.getFirstChild().getNodeValue());
} else {
exmpLabelMap.put(dataNode.getNodeName(), "");
}
}
}
}
}
if (exmpLabelMap != null
&& exmpLabelMap.size() > 0) {
int sizeStkList = stkList.size();
int sizeresvList = resvList.size();
System.out.println("exmpLabelMap :::::::::: "
+ exmpLabelMap.toString());
System.out.println("stkList :::::::::: "
+ stkList);
System.out.println("resvList :::::::::: "
+ stkList);
//out.println("::::::::: Inside if for reserve stock :::::::::: ");
//out.println(" ::::::::: Inside else for stock details :::::::::: ");
for (int ctrRcv = 0; ctrRcv < sizeStkList; ctrRcv++) {
%>
<tr>
<%
//TODO --Create Row for Each Data.
row = spreadsheet.createRow(rowNum);
rowNum += 1;
HashMap dataStkMap = (HashMap) stkList.get(ctrRcv);
HashMap dataRcvMap = null;
if (ctrRcv < sizeresvList) {
dataRcvMap = (HashMap) resvList.get(ctrRcv);
}
if (exmpLabelMap.get("match_potency").equals("N")) {
itemPotency = "0";
} else {
itemPotency = (String) exmpLabelMap.get("item_potency");
}
/*
out.println(" --------------------------- start --------------------------------- " );
out.println("<br>" );
out.println(" ::::::::: ctrRcv :::::::::: " + ctrRcv );
out.println(" ::::::::: sizeStkList :::::::::: " + sizeStkList );
out.println(" ::::::::: sizeresvList :::::::::: " + sizeresvList );
out.println(" ::::::::: dataRcvMap :::::::::: " + dataRcvMap );
out.println("<br>" );
out.println(" ::::::::: dataStkMap :::::::::: " + dataStkMap );
out.println("<br>" );
out.println("------------------ is alternate rec ------------- " + dataRcvMap.get("is_alternate"));
out.println("<br>" );
out.println("------------------ is alternate stock ------------- " + dataStkMap.get("is_alternate"));
out.println("<br>" );
out.println("------------------ inside isAlternate ------------- " + isAlternate);
out.println("<br>" );
*/
//System.out.println("Stock Block data stock Map ["+exmpLabelMap.toString()+"]");
%>
<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 -->
<td colspan="2"><%=exmpLabelMap.get("operation")%></td>
<%
cell = row.createCell((int)1);
cell.setCellValue(exmpLabelMap.get("operation").toString());
cell.setCellStyle(cellStyle);
%>
<!-- Oper. -->
<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 -->
<%
if (dataStkMap != null) {
//out.println(" ------- else --------------------------------- " );out.println("<br>" );
itemCode = (String) dataStkMap.get("item_code");
itemDescr = (String) dataStkMap.get("item_descr");
unit = (String) dataStkMap.get("unit");
stockPotency = (String) dataStkMap.get("stock_potency");
potencyAdj = (String) dataStkMap.get("potency_adj");
updtQty = (String) dataStkMap.get("alloc_qty");
isAlternate = (String) dataStkMap.get("is_alternate");
otherSite = (String) dataStkMap.get("other_site");
} else {
//out.println("----- Inside if dataRcvMap != null ------------- ");
//out.println("<br>" );
if (dataRcvMap.get("tran_id") == null) {
tranId = "";
} else {
tranId = (String) dataRcvMap.get("tran_id");
}
if (dataRcvMap.get("item_code").equals("")) {
itemCode = (String) dataStkMap.get("item_code");
itemDescr = (String) dataStkMap.get("item_descr");
unit = (String) dataStkMap.get("unit");
stockPotency = (String) dataStkMap.get("stock_potency");
System.out.println("@@stockPotency123"
+ stockPotency);
potencyAdj = (String) dataStkMap.get("potency_adj");
updtQty = (String) dataStkMap.get("alloc_qty");
isAlternate = (String) dataStkMap.get("is_alternate");
otherSite = (String) dataStkMap.get("other_site");
} else {
itemCode = (String) dataRcvMap.get("item_code");
itemDescr = (String) dataRcvMap.get("item_descr");
unit = (String) dataRcvMap.get("unit");
stockPotency = (String) dataRcvMap.get("stock_potency");
potencyAdj = (String) dataRcvMap.get("potency_adj");
updtQty = (String) dataRcvMap.get("alloc_qty");
isAlternate = (String) dataRcvMap.get("is_alternate");
otherSite = (String) dataStkMap.get("other_site");
}
if (dataRcvMap.get("item_code").equals("")
&& dataStkMap.get(
"item_code")
.equals("")) {
itemCode = (String) exmpLabelMap.get("item_code");
itemDescr = (String) exmpLabelMap.get("item_descr");
unit = (String) exmpLabelMap.get("unit");
stockPotency = "";
potencyAdj = "";
updtQty = "";
otherSite = (String) dataStkMap.get("other_site");
}
if (!dataRcvMap.get("item_code").equals("") && !dataStkMap.get("item_code").equals("")) {
itemCode = (String) exmpLabelMap.get("item_code");
itemDescr = (String) exmpLabelMap.get("item_descr");
unit = (String) exmpLabelMap.get("unit");
stockPotency = (String) dataStkMap.get("stock_potency");
double potencyAdjDb = Double.parseDouble(dataStkMap.get("alloc_qty") + "");// + Double.parseDouble(dataRcvMap.get("qty_adj")+"");
potencyAdj = Double.toString(potencyAdjDb);
double updtQtyDb = Double.parseDouble(dataStkMap.get("alloc_qty") + "");// + Double.parseDouble(dataRcvMap.get("upd_qty")+"");
updtQty = Double.toString(updtQtyDb);
otherSite = (String) dataStkMap.get("other_site");
}
}
if (exmpLabelMap.get("is_sufficient").equals("N")) { // Red colour
%>
<td colspan="2" style="color: #FF0000;"><%=itemCode%></td>
<%
cell = row.createCell((int)3);
cell.setCellValue(itemCode);
cell.setCellStyle(redColorStyle);
%>
<td colspan="2" style="color: #FF0000;"><%=itemDescr%></td>
<%
cell = row.createCell((int)4);
cell.setCellValue(itemDescr);
cell.setCellStyle(redColorStyle);
%>
<td colspan="2" style="color: #FF0000;"><%=unit%></td>
<%
cell = row.createCell((int)5);
cell.setCellValue(unit);
cell.setCellStyle(redColorStyle);
%>
<%
} else if ("Y".equals(isAlternate) && "Y".equals(otherSite)) { // pale green colour
%>
<td colspan="2" style="color: #808000;"><%=itemCode%></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);
%>
<!-- Critical Item (Y/N) -->
<%
String billQty = (String) exmpLabelMap.get("quantity");
billQty = billQty == null
|| billQty.length() == 0
? "0"
: billQty;
billQty = df.format(Double.parseDouble(billQty));
%>
<!-- <td colspan="2" ><--%=exmpLabelMap.get("quantity") %></td> -->
<!-- WO Bill Quantity -->
<td colspan="2"><%=billQty%></td>
<%
cell = row.createCell((int)7);
cell.setCellValue(billQty);
cell.setCellStyle(cellStyle);
%>
<!-- WO Bill Quantity -->
<%
String quantityAdj = (String) exmpLabelMap.get("adjusted_qty");
quantityAdj = quantityAdj == null
|| quantityAdj.length() == 0
? "0"
: quantityAdj;
quantityAdj = df.format(Double.parseDouble(quantityAdj));
%>
<!-- (+/-) Adjusted Qty. -->
<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 -->
<%
String minPtency = (String) exmpLabelMap.get("min_potency_perc");
minPtency = minPtency == null
|| minPtency.length() == 0
? "0"
: minPtency;
minPtency = df.format(Double.parseDouble(minPtency));
%>
<%-- <td colspan="2"><%=minPtency %></td> --%>
<!-- Minimum Potency -->
<%
// String minPtency = (String) exmpLabelMap.get("min_potency_perc");
itemPotency = itemPotency == null
|| itemPotency.length() == 0
? "0"
: itemPotency;
itemPotency = df.format(Double.parseDouble(itemPotency));
%>
<%-- <td colspan="2"><%=itemPotency %></td> --%>
<!-- Item Standard Potency -->
<%
stockPotency = stockPotency == null
|| stockPotency.length() == 0
? "0"
: stockPotency;
stockPotency = df.format(Double.parseDouble(stockPotency));
%>
<%-- <td colspan="2"><%=stockPotency%></td> --%>
<!-- Stock Potency show from res or stock -->
<%
//System.out.println("Stock Block data stock Map ["+dataStkMap.toString()+"]");
%>
<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 -->
<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 -->
<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 -->
<%
String quantity = (String) dataStkMap.get("quantity");
quantity = quantity == null
|| 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);
%>
<!-- Stock Qty. from stock -->
<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 -->
<%
potencyAdj = potencyAdj == null
|| 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);
%>
<!-- Total Qty. to be Adj. for Item stock or res-->
<%
if (dataRcvMap != null) {
//System.out.println("Stock Block data reserve Map ["+dataRcvMap.toString()+"]");
%>
<td colspan="1"><%=dataRcvMap.get("loc_code")%></td>
<%
cell = row.createCell((int)15);
cell.setCellValue(dataRcvMap.get("loc_code").toString());
cell.setCellStyle(cellStyle);
%>
<!-- Reserve -->
<td colspan="1"><%=dataRcvMap.get("lot_no")%></td>
<%
cell = row.createCell((int)16);
cell.setCellValue(dataRcvMap.get("lot_no").toString());
cell.setCellStyle(cellStyle);
%>
<!-- Reserve -->
<td colspan="1"><%=dataRcvMap.get("lot_sl")%></td>
<%
cell = row.createCell((int)17);
cell.setCellValue(dataRcvMap.get("lot_sl").toString());
cell.setCellStyle(cellStyle);
%>
<!-- Reserve -->
<%
String quantityRcv = (String) dataRcvMap.get("quantity");
quantityRcv = quantityRcv == null
|| 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);
%>
<!-- Reserve -->
<%
} else {
%>
<td colspan="1"></td>
<td colspan="1"></td>
<td colspan="1"></td>
<td colspan="1"></td>
<%
}
updtQty = updtQty == null
|| 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);
%>
<!-- UPD QTY -->
</tr>
<%
}
}
}
//System.out.println("trrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr");
}
}
} else {
//System.out.println("in else message ::::::::::: ");
NodeList errorList = dom.getElementsByTagName("error");
int errorListLen = errorList.getLength();
for (int errCtr = 0; errCtr < errorListLen; errCtr++) {
Node errorNode = errorList.item(errCtr);
if (errorNode.getNodeType() == Node.ELEMENT_NODE) {
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();
System.out.println("message ::::::::::: "
+ errorMessage);
%>
<script>
alert("<%=errorMessage%>");
</script>
<%
}
}
}
%>
</table>
</script>
<%
}
}
}
}
%>
</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>
</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