Commit e2abd8b9 authored by awarekar's avatar awarekar

sales budget wizard related implementation

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@198607 ce508802-f39f-4f6c-b175-0d175dae99d5
parent dcd0a043
package ibase.webitm.ejb.fin; package ibase.webitm.ejb.fin;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.sql.Connection;
import java.io.Serializable; import java.sql.PreparedStatement;
import java.sql.*; import java.sql.ResultSet;
import ibase.utility.UserInfoBean;
import javax.servlet.http.HttpSession;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.*;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants; import ibase.utility.CommonConstants;
import ibase.utility.*; import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.*; import ibase.utility.UserInfoBean;
import ibase.webitm.utility.ITMException;
public class SalesBudgetCustWizBean implements Serializable public class SalesBudgetCustWizBean
{ {
private ibase.utility.UserInfoBean userInfo = null; private ibase.utility.UserInfoBean userInfo = null;
private HttpSession sessionCtx = null;
private String objName = ""; private String objName = "";
private String user_lang ="en"; private String user_lang ="en";
private String user_country = "US"; private String user_country = "US";
private E12GenericUtility genericUtility = new E12GenericUtility();
public SalesBudgetCustWizBean( String objName, HttpSession sessionCtx ) throws ITMException
{ public SalesBudgetCustWizBean( String objName, UserInfoBean userInfo ) throws ITMException
try
{
this.objName = objName;
this.sessionCtx = sessionCtx;
this.userInfo = ( ibase.utility.UserInfoBean ) this.sessionCtx.getAttribute("USER_INFO");
}
catch (Exception e)
{
throw new ITMException(e);
}
}
public SalesBudgetCustWizBean( String objName) throws ITMException
{ {
try try
{ {
this.objName = objName; this.objName = objName;
this.userInfo = userInfo;
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -51,30 +32,24 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -51,30 +32,24 @@ public class SalesBudgetCustWizBean implements Serializable
} }
} }
public SalesBudgetCustWizBean() throws ITMException
{
System.out.println("==>x AM SalesBudgetCustWizBean constructor");
}
public UserInfoBean getUserInfo() public UserInfoBean getUserInfo()
{ {
return this.userInfo; return this.userInfo;
} }
public void setUserInfo(UserInfoBean userInfo) public void setUserInfo(UserInfoBean userInfo)
{ {
this.userInfo = userInfo; this.userInfo = userInfo;
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public String getCustCode( String selectedposCode) throws ITMException public String getCustCode( String selectedposCode) throws ITMException
{ {
String custCode= ""; String custCode= "";
Connection connectionObject = null;
try try
{ {
connectionObject = getConnection(); custCode = getCusCode( selectedposCode ); //sales_budget_cust_wiz1_wiz_en_US_A
custCode = getCusCode( selectedposCode); //sales_budget_cust_wiz1_wiz_en_US_A
String xslFileName = getXSLFileName( "sales_budget_cust_custmr_code_wiz_" + this.user_lang + "_" + this.user_country + ".xsl" ); String xslFileName = getXSLFileName( "sales_budget_cust_custmr_code_wiz_" + this.user_lang + "_" + this.user_country + ".xsl" );
custCode = ( new ibase.webitm.utility.GenericUtility() ).transformToString( xslFileName, custCode, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" ); custCode = genericUtility.transformToString( xslFileName, custCode, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" );
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -82,40 +57,40 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -82,40 +57,40 @@ public class SalesBudgetCustWizBean implements Serializable
} }
finally finally
{ {
} }
return custCode; return custCode;
} }
public String getCusCode( String selectedcusCode ) throws ITMException private String getCusCode( String selectedCustCode ) throws ITMException
{ {
String csCode = selectedcusCode.toUpperCase();
String sql = "",custCode="";
StringBuffer valueXmlString = new StringBuffer("<Root>\r\n"); StringBuffer valueXmlString = new StringBuffer("<Root>\r\n");
Connection connectionObject = null; Connection connectionObject = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
E12GenericUtility genericUtility = new E12GenericUtility();
try try
{ {
connectionObject = getConnection(); connectionObject = getConnection();
sql = "SELECT CUST_CODE,CUST_NAME FROM CUSTOMER WHERE CUST_NAME LIKE '"+csCode+"%' ";
selectedCustCode = (selectedCustCode != null) ? selectedCustCode.trim().toUpperCase() : selectedCustCode;
//sql = "SELECT CUST_CODE,CUST_NAME FROM CUSTOMER WHERE CUST_NAME LIKE '"+csCode+"%' ";
String sql = "SELECT CUST_CODE,CUST_NAME FROM CUSTOMER "
+ "WHERE (UPPER(CUST_CODE) LIKE UPPER('"+selectedCustCode+"%') OR UPPER(CUST_NAME) LIKE UPPER('"+selectedCustCode+"%'))";
pstmt = connectionObject.prepareStatement(sql); pstmt = connectionObject.prepareStatement(sql);
//pstmt.setString( 1, custCode ); //pstmt.setString( 1, custCode );
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
int num = 1; int num = 1;
while (rs.next()) while (rs.next())
{ {
String cusCode = rs.getString("CUST_CODE"); String customerCode = rs.getString("CUST_CODE");
String cusDescr = rs.getString("CUST_NAME"); String custDescr = rs.getString("CUST_NAME");
csCode = (csCode != null) ? csCode.trim() : csCode; customerCode = (customerCode != null) ? customerCode.trim() : customerCode;
cusCode = (cusCode != null) ? cusCode.trim() : cusCode; custDescr = (custDescr != null) ? custDescr.trim() : custDescr;
cusDescr = (cusDescr != null) ? cusDescr.trim() : cusDescr;
if ( selectedCustCode.equals( customerCode ) )
if ( csCode.equals( cusCode ) )
{ {
valueXmlString.append("<CUSTOMER domID='" + num + "' selected = 'Y'>\r\n"); valueXmlString.append("<CUSTOMER domID='" + num + "' selected = 'Y'>\r\n");
} }
...@@ -124,11 +99,21 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -124,11 +99,21 @@ public class SalesBudgetCustWizBean implements Serializable
valueXmlString.append("<CUSTOMER domID='" + num + "' selected = 'N'>\r\n"); valueXmlString.append("<CUSTOMER domID='" + num + "' selected = 'N'>\r\n");
} }
valueXmlString.append("<CUST_CODE><![CDATA[").append( cusCode ).append("]]></CUST_CODE>\r\n"); valueXmlString.append("<CUST_CODE><![CDATA[").append( customerCode ).append("]]></CUST_CODE>\r\n");
valueXmlString.append("<CUST_NAME><![CDATA[").append( cusDescr ).append("]]></CUST_NAME>\r\n"); valueXmlString.append("<CUST_NAME><![CDATA[").append( custDescr ).append("]]></CUST_NAME>\r\n");
valueXmlString.append("</CUSTOMER>\r\n"); valueXmlString.append("</CUSTOMER>\r\n");
num++; num++;
} }
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -139,12 +124,22 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -139,12 +124,22 @@ public class SalesBudgetCustWizBean implements Serializable
{ {
try try
{ {
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (connectionObject != null && !connectionObject.isClosed()) if (connectionObject != null && !connectionObject.isClosed())
{ {
connectionObject.close(); connectionObject.close();
connectionObject = null; connectionObject = null;
} }
} }
catch (Exception e) catch (Exception e)
{ {
throw new ITMException(e); throw new ITMException(e);
...@@ -153,19 +148,15 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -153,19 +148,15 @@ public class SalesBudgetCustWizBean implements Serializable
valueXmlString.append("</Root>\r\n"); valueXmlString.append("</Root>\r\n");
return valueXmlString.toString(); return valueXmlString.toString();
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public String getPosCode( String selectedPosCode) throws ITMException
public String getPosCode( String selectedposCode) throws ITMException
{ {
String posCode= ""; String posCode= "";
Connection connectionObject = null;
try try
{ {
connectionObject = getConnection(); posCode = getPOS( selectedPosCode); //sales_budget_cust_wiz1_wiz_en_US_A
posCode = getPOS( selectedposCode); //sales_budget_cust_wiz1_wiz_en_US_A
String xslFileName = getXSLFileName( "sales_budget_cust_pos_code_wiz_" + this.user_lang + "_" + this.user_country + ".xsl" ); String xslFileName = getXSLFileName( "sales_budget_cust_pos_code_wiz_" + this.user_lang + "_" + this.user_country + ".xsl" );
posCode = ( new ibase.webitm.utility.GenericUtility() ).transformToString( xslFileName, posCode, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" ); posCode = genericUtility.transformToString( xslFileName, posCode, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" );
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -173,21 +164,22 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -173,21 +164,22 @@ public class SalesBudgetCustWizBean implements Serializable
} }
finally finally
{ {
} }
return posCode; return posCode;
} }
public String getPOS( String selectedposCode ) throws ITMException private String getPOS( String selectedPosCode ) throws ITMException
{ {
String sql = ""; String sql = "";
StringBuffer valueXmlString = new StringBuffer("<Root>\r\n"); StringBuffer valueXmlString = new StringBuffer("<Root>\r\n");
Connection connectionObject = null; Connection connectionObject = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
E12GenericUtility genericUtility = new E12GenericUtility();
try try
{ {
selectedPosCode = (selectedPosCode != null) ? selectedPosCode.trim() : selectedPosCode;
connectionObject = getConnection(); connectionObject = getConnection();
sql="select pos_code,descr from org_structure where active = ?"; sql="select pos_code,descr from org_structure where active = ?";
pstmt = connectionObject.prepareStatement(sql); pstmt = connectionObject.prepareStatement(sql);
...@@ -198,18 +190,17 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -198,18 +190,17 @@ public class SalesBudgetCustWizBean implements Serializable
{ {
String posCode = rs.getString("POS_CODE"); String posCode = rs.getString("POS_CODE");
String posDescr = rs.getString("DESCR"); String posDescr = rs.getString("DESCR");
selectedposCode = (selectedposCode != null) ? selectedposCode.trim() : selectedposCode;
posCode = (posCode != null) ? posCode.trim() : posCode; posCode = (posCode != null) ? posCode.trim() : posCode;
posDescr = (posDescr != null) ? posDescr.trim() : posDescr; posDescr = (posDescr != null) ? posDescr.trim() : posDescr;
if ( selectedposCode.equals( posCode ) ) if ( selectedPosCode.equals( posCode ) )
{ {
valueXmlString.append("<ORG_STRUCTURE domID='" + num + "' selected = 'Y'>\r\n"); valueXmlString.append("<ORG_STRUCTURE domID='" + num + "' selected = 'Y'>\r\n");
} }
else else
{ {
valueXmlString.append("<ORG_STRUCTURE domID='" + num + "' selected = 'N'>\r\n"); valueXmlString.append("<ORG_STRUCTURE domID='" + num + "' selected = 'N'>\r\n");
} }
valueXmlString.append("<POS_CODE><![CDATA[").append( posCode ).append("]]></POS_CODE>\r\n"); valueXmlString.append("<POS_CODE><![CDATA[").append( posCode ).append("]]></POS_CODE>\r\n");
...@@ -217,6 +208,16 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -217,6 +208,16 @@ public class SalesBudgetCustWizBean implements Serializable
valueXmlString.append("</ORG_STRUCTURE>\r\n"); valueXmlString.append("</ORG_STRUCTURE>\r\n");
num++; num++;
} }
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -227,6 +228,16 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -227,6 +228,16 @@ public class SalesBudgetCustWizBean implements Serializable
{ {
try try
{ {
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (connectionObject != null && !connectionObject.isClosed()) if (connectionObject != null && !connectionObject.isClosed())
{ {
connectionObject.close(); connectionObject.close();
...@@ -241,23 +252,15 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -241,23 +252,15 @@ public class SalesBudgetCustWizBean implements Serializable
valueXmlString.append("</Root>\r\n"); valueXmlString.append("</Root>\r\n");
return valueXmlString.toString(); return valueXmlString.toString();
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public String getPriceList( String selectedItemSeries ) throws ITMException
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public String getPriceList( String selecteditemSeries) throws ITMException
{ {
String priceList= ""; String priceList= "";
Connection connectionObject = null;
try try
{ {
connectionObject = getConnection(); priceList = getPricList( selectedItemSeries); //sales_budget_cust_wiz1_wiz_en_US_A
priceList = getPricList( selecteditemSeries); //sales_budget_cust_wiz1_wiz_en_US_A
String xslFileName = getXSLFileName( "sales_budget_cust_price_list_wiz_" + this.user_lang + "_" + this.user_country + ".xsl" ); String xslFileName = getXSLFileName( "sales_budget_cust_price_list_wiz_" + this.user_lang + "_" + this.user_country + ".xsl" );
priceList = ( new ibase.webitm.utility.GenericUtility() ).transformToString( xslFileName, priceList, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" ); priceList = genericUtility.transformToString( xslFileName, priceList, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" );
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -265,24 +268,23 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -265,24 +268,23 @@ public class SalesBudgetCustWizBean implements Serializable
} }
finally finally
{ {
} }
return priceList; return priceList;
} }
private String getPricList( String selectedPriceList ) throws ITMException
public String getPricList( String selectedPriceList ) throws ITMException
{ {
String sql = ""; String sql = "";
StringBuffer valueXmlString = new StringBuffer("<Root>\r\n"); StringBuffer valueXmlString = new StringBuffer("<Root>\r\n");
Connection connectionObject = null; Connection connectionObject = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
E12GenericUtility genericUtility = new E12GenericUtility();
try try
{ {
selectedPriceList = (selectedPriceList != null) ? selectedPriceList.trim() : selectedPriceList;
connectionObject = getConnection(); connectionObject = getConnection();
//sql = "SELECT CODE, DESCR FROM PERIOD ";
sql = "SELECT PRICE_LIST,DESCR FROM PRICELIST_MST"; sql = "SELECT PRICE_LIST,DESCR FROM PRICELIST_MST";
pstmt = connectionObject.prepareStatement(sql); pstmt = connectionObject.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -291,18 +293,17 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -291,18 +293,17 @@ public class SalesBudgetCustWizBean implements Serializable
{ {
String prcList = rs.getString("PRICE_LIST"); String prcList = rs.getString("PRICE_LIST");
String prcDescr = rs.getString("DESCR"); String prcDescr = rs.getString("DESCR");
selectedPriceList = (selectedPriceList != null) ? selectedPriceList.trim() : selectedPriceList;
prcList = (prcList != null) ? prcList.trim() : prcList; prcList = (prcList != null) ? prcList.trim() : prcList;
prcDescr = (prcDescr != null) ? prcDescr.trim() : prcDescr; prcDescr = (prcDescr != null) ? prcDescr.trim() : prcDescr;
if ( selectedPriceList.equals( prcList ) ) if ( selectedPriceList.equals( prcList ) )
{ {
valueXmlString.append("<PRICELIST_MST domID='" + num + "' selected = 'Y'>\r\n"); valueXmlString.append("<PRICELIST_MST domID='" + num + "' selected = 'Y'>\r\n");
} }
else else
{ {
valueXmlString.append("<PRICELIST_MST domID='" + num + "' selected = 'N'>\r\n"); valueXmlString.append("<PRICELIST_MST domID='" + num + "' selected = 'N'>\r\n");
} }
valueXmlString.append("<PRICE_LIST><![CDATA[").append( prcList ).append("]]></PRICE_LIST>\r\n"); valueXmlString.append("<PRICE_LIST><![CDATA[").append( prcList ).append("]]></PRICE_LIST>\r\n");
...@@ -310,6 +311,16 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -310,6 +311,16 @@ public class SalesBudgetCustWizBean implements Serializable
valueXmlString.append("</PRICELIST_MST>\r\n"); valueXmlString.append("</PRICELIST_MST>\r\n");
num++; num++;
} }
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -320,6 +331,16 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -320,6 +331,16 @@ public class SalesBudgetCustWizBean implements Serializable
{ {
try try
{ {
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (connectionObject != null && !connectionObject.isClosed()) if (connectionObject != null && !connectionObject.isClosed())
{ {
connectionObject.close(); connectionObject.close();
...@@ -334,19 +355,15 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -334,19 +355,15 @@ public class SalesBudgetCustWizBean implements Serializable
valueXmlString.append("</Root>\r\n"); valueXmlString.append("</Root>\r\n");
return valueXmlString.toString(); return valueXmlString.toString();
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public String getItmSeries( String selectedItemSeries) throws ITMException
public String getItmSeries( String selecteditemSeries) throws ITMException
{ {
String itmSeries= ""; String itmSeries= "";
Connection connectionObject = null;
try try
{ {
connectionObject = getConnection(); itmSeries = getItemSeries( selectedItemSeries); //sales_budget_cust_wiz1_wiz_en_US_A
itmSeries = getItemSeries( selecteditemSeries); //sales_budget_cust_wiz1_wiz_en_US_A
String xslFileName = getXSLFileName( "sales_budget_cust_item_series_wiz_" + this.user_lang + "_" + this.user_country + ".xsl" ); String xslFileName = getXSLFileName( "sales_budget_cust_item_series_wiz_" + this.user_lang + "_" + this.user_country + ".xsl" );
itmSeries = ( new ibase.webitm.utility.GenericUtility() ).transformToString( xslFileName, itmSeries, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" ); itmSeries = genericUtility.transformToString( xslFileName, itmSeries, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" );
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -354,21 +371,22 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -354,21 +371,22 @@ public class SalesBudgetCustWizBean implements Serializable
} }
finally finally
{ {
} }
return itmSeries; return itmSeries;
} }
public String getItemSeries( String selecteditemSeries ) throws ITMException private String getItemSeries( String selectedItemSeries ) throws ITMException
{ {
String sql = ""; String sql = "";
StringBuffer valueXmlString = new StringBuffer("<Root>\r\n"); StringBuffer valueXmlString = new StringBuffer("<Root>\r\n");
Connection connectionObject = null; Connection connectionObject = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
E12GenericUtility genericUtility = new E12GenericUtility();
try try
{ {
selectedItemSeries = (selectedItemSeries != null) ? selectedItemSeries.trim() : selectedItemSeries;
connectionObject = getConnection(); connectionObject = getConnection();
sql="SELECT ITEM_SER,DESCR FROM ITEMSER"; sql="SELECT ITEM_SER,DESCR FROM ITEMSER";
pstmt = connectionObject.prepareStatement(sql); pstmt = connectionObject.prepareStatement(sql);
...@@ -378,12 +396,11 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -378,12 +396,11 @@ public class SalesBudgetCustWizBean implements Serializable
{ {
String itmSeries = rs.getString("ITEM_SER"); String itmSeries = rs.getString("ITEM_SER");
String itmSeriesDescr = rs.getString("DESCR"); String itmSeriesDescr = rs.getString("DESCR");
selecteditemSeries = (selecteditemSeries != null) ? selecteditemSeries.trim() : selecteditemSeries;
itmSeries = (itmSeries != null) ? itmSeries.trim() : itmSeries; itmSeries = (itmSeries != null) ? itmSeries.trim() : itmSeries;
itmSeriesDescr = (itmSeriesDescr != null) ? itmSeriesDescr.trim() : itmSeriesDescr; itmSeriesDescr = (itmSeriesDescr != null) ? itmSeriesDescr.trim() : itmSeriesDescr;
if ( selecteditemSeries.equals( itmSeries ) ) if ( selectedItemSeries.equals( itmSeries ) )
{ {
valueXmlString.append("<ITEMSER domID='" + num + "' selected = 'Y'>\r\n"); valueXmlString.append("<ITEMSER domID='" + num + "' selected = 'Y'>\r\n");
} }
...@@ -397,6 +414,16 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -397,6 +414,16 @@ public class SalesBudgetCustWizBean implements Serializable
valueXmlString.append("</ITEMSER>\r\n"); valueXmlString.append("</ITEMSER>\r\n");
num++; num++;
} }
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -407,6 +434,16 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -407,6 +434,16 @@ public class SalesBudgetCustWizBean implements Serializable
{ {
try try
{ {
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (connectionObject != null && !connectionObject.isClosed()) if (connectionObject != null && !connectionObject.isClosed())
{ {
connectionObject.close(); connectionObject.close();
...@@ -421,19 +458,15 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -421,19 +458,15 @@ public class SalesBudgetCustWizBean implements Serializable
valueXmlString.append("</Root>\r\n"); valueXmlString.append("</Root>\r\n");
return valueXmlString.toString(); return valueXmlString.toString();
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public String getAcctPrd( String selectedAcctPrd) throws ITMException public String getAcctPrd( String selectedAcctPrd) throws ITMException
{ {
String acctPrd= ""; String acctPrd= "";
Connection connectionObject = null;
try try
{ {
connectionObject = getConnection();
acctPrd = getActPrd( selectedAcctPrd); //sales_budget_cust_wiz1_wiz_en_US_A acctPrd = getActPrd( selectedAcctPrd); //sales_budget_cust_wiz1_wiz_en_US_A
String xslFileName = getXSLFileName( "sales_budget_cust_acct_prd_wiz_" + this.user_lang + "_" + this.user_country + ".xsl" ); String xslFileName = getXSLFileName( "sales_budget_cust_acct_prd_wiz_" + this.user_lang + "_" + this.user_country + ".xsl" );
acctPrd = ( new ibase.webitm.utility.GenericUtility() ).transformToString( xslFileName, acctPrd, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" ); acctPrd = genericUtility.transformToString( xslFileName, acctPrd, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" );
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -441,24 +474,23 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -441,24 +474,23 @@ public class SalesBudgetCustWizBean implements Serializable
} }
finally finally
{ {
} }
return acctPrd; return acctPrd;
} }
private String getActPrd( String selectedAcctPrd ) throws ITMException
public String getActPrd( String selectedAcctPrd ) throws ITMException
{ {
String sql = ""; String sql = "";
StringBuffer valueXmlString = new StringBuffer("<Root>\r\n"); StringBuffer valueXmlString = new StringBuffer("<Root>\r\n");
Connection connectionObject = null; Connection connectionObject = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
E12GenericUtility genericUtility = new E12GenericUtility();
try try
{ {
selectedAcctPrd = (selectedAcctPrd != null) ? selectedAcctPrd.trim() : selectedAcctPrd;
connectionObject = getConnection(); connectionObject = getConnection();
//sql = "SELECT CODE, DESCR FROM PERIOD ";
sql = "SELECT CODE,DESCR FROM ACCTPRD ORDER BY CODE ASC"; sql = "SELECT CODE,DESCR FROM ACCTPRD ORDER BY CODE ASC";
pstmt = connectionObject.prepareStatement(sql); pstmt = connectionObject.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -467,13 +499,10 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -467,13 +499,10 @@ public class SalesBudgetCustWizBean implements Serializable
{ {
String accCode = checkNull( rs.getString("CODE") ); String accCode = checkNull( rs.getString("CODE") );
String accDescr = checkNull( rs.getString("DESCR") ); String accDescr = checkNull( rs.getString("DESCR") );
//String acctFrom = checkNull(rs.getString("FR_DATE"));
//String acctTo = checkNull(rs.getString("TO_DATE"));
selectedAcctPrd = (selectedAcctPrd != null) ? selectedAcctPrd.trim() : selectedAcctPrd;
accCode = (accCode != null) ? accCode.trim() : accCode; accCode = (accCode != null) ? accCode.trim() : accCode;
accDescr = (accDescr != null) ? accDescr.trim() : accDescr; accDescr = (accDescr != null) ? accDescr.trim() : accDescr;
if ( selectedAcctPrd.equals( accCode ) ) if ( selectedAcctPrd.equals( accCode ) )
{ {
valueXmlString.append("<ACCTPRD domID='" + num + "' selected = 'Y'>\r\n"); valueXmlString.append("<ACCTPRD domID='" + num + "' selected = 'Y'>\r\n");
...@@ -482,15 +511,21 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -482,15 +511,21 @@ public class SalesBudgetCustWizBean implements Serializable
{ {
valueXmlString.append("<ACCTPRD domID='" + num + "' selected = 'N'>\r\n"); valueXmlString.append("<ACCTPRD domID='" + num + "' selected = 'N'>\r\n");
} }
//acctFrom = acctFrom.substring(0, acctFrom.indexOf(" "));
//acctTo = acctTo.substring(0, acctTo.indexOf(" "));
valueXmlString.append("<CODE><![CDATA[").append( accCode ).append("]]></CODE>\r\n"); valueXmlString.append("<CODE><![CDATA[").append( accCode ).append("]]></CODE>\r\n");
valueXmlString.append("<DESCR><![CDATA[").append( accDescr ).append("]]></DESCR>\r\n"); valueXmlString.append("<DESCR><![CDATA[").append( accDescr ).append("]]></DESCR>\r\n");
//valueXmlString.append("<FR_DATE><![CDATA[").append( acctFrom ).append("]]></FR_DATE>\r\n");
//valueXmlString.append("<TO_DATE><![CDATA[").append( acctTo ).append("]]></TO_DATE>\r\n");
valueXmlString.append("</ACCTPRD>\r\n"); valueXmlString.append("</ACCTPRD>\r\n");
num++; num++;
} }
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -501,6 +536,16 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -501,6 +536,16 @@ public class SalesBudgetCustWizBean implements Serializable
{ {
try try
{ {
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (connectionObject != null && !connectionObject.isClosed()) if (connectionObject != null && !connectionObject.isClosed())
{ {
connectionObject.close(); connectionObject.close();
...@@ -515,7 +560,7 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -515,7 +560,7 @@ public class SalesBudgetCustWizBean implements Serializable
valueXmlString.append("</Root>\r\n"); valueXmlString.append("</Root>\r\n");
return valueXmlString.toString(); return valueXmlString.toString();
} }
private String getXSLFileName( String xslFileName )throws ITMException private String getXSLFileName( String xslFileName )throws ITMException
{ {
String retFileName = null; String retFileName = null;
...@@ -552,49 +597,36 @@ public class SalesBudgetCustWizBean implements Serializable ...@@ -552,49 +597,36 @@ public class SalesBudgetCustWizBean implements Serializable
return retFileName; return retFileName;
} }
private String checkNull( String input )
public String checkNull( String input ) {
if (input == null || "null".equalsIgnoreCase(input))
{ {
if (input == null || "null".equalsIgnoreCase(input)) input= "";
{
input= "";
}
return input.trim();
} }
// added by rupali on 16/08/8 foe multi-tenancy related changes [start] return input.trim();
public Connection getConnection() }
// added by rupali on 16/08/8 foe multi-tenancy related changes [start]
private Connection getConnection()
{
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
try
{ {
Connection conn = null; if(this.userInfo != null)
ConnDriver connDriver = new ConnDriver();
try
{ {
if(this.userInfo != null) String transDB = this.userInfo.getTransDB();
{ if( transDB != null && transDB.trim().length() > 0 && !"null".equalsIgnoreCase(transDB))
String transDB = this.userInfo.getTransDB();
if( transDB != null && transDB.trim().length() > 0 && !"null".equalsIgnoreCase(transDB))
{
conn = connDriver.getConnectDB(transDB);
connDriver = null;
}
else
{
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
}
}
else
{ {
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB(transDB);
connDriver = null; connDriver = null;
} }
} }
catch(Exception e)
{
e.printStackTrace();
}
return conn;
} }
catch(Exception e)
{
e.printStackTrace();
}
return conn;
}
} }
package ibase.webitm.ejb.fin; package ibase.webitm.ejb.fin;
import java.net.InetAddress;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.*; import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.Format;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
import ibase.utility.UserInfoBean;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.utility.UserInfoBean;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
public class SalesBudgetCustWizEJB extends ValidatorEJB public class SalesBudgetCustWizEJB extends ValidatorEJB
{ {
E12GenericUtility genericUtility = new E12GenericUtility(); E12GenericUtility genericUtility = new E12GenericUtility();
public SalesBudgetCustWizEJB()
{
System.out.println("<== AMEY ==>");
}
public String wfValData() throws RemoteException,ITMException
{
return "";
}
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
System.out.println("wfValData 1 ==>]");
Document dom = null; Document dom = null;
Document dom1 = null; Document dom1 = null;
Document dom2 = null; Document dom2 = null;
...@@ -50,27 +38,14 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -50,27 +38,14 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
{ {
dom = parseString(xmlString); dom = parseString(xmlString);
} }
else
{
System.out.println("xmlstring is null");
}
if(xmlString1 != null && xmlString1.trim().length()!=0) if(xmlString1 != null && xmlString1.trim().length()!=0)
{ {
dom1 = parseString(xmlString1); dom1 = parseString(xmlString1);
} }
else
{
System.out.println("xmlstring1 is null");
}
if(xmlString2 != null && xmlString2.trim().length()!=0) if(xmlString2 != null && xmlString2.trim().length()!=0)
{ {
dom2 = parseString(xmlString2); dom2 = parseString(xmlString2);
} }
else
{
System.out.println("xmlstring2 is null");
}
System.out.println("Before call valdata");
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams); errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
} }
catch(Exception e) catch(Exception e)
...@@ -82,9 +57,6 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -82,9 +57,6 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
public String wfValData(Document dom, Document dom1,Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException public String wfValData(Document dom, Document dom1,Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
System.out.println("wfValData 2 ==>]");
E12GenericUtility genericUtility = new ibase.utility.E12GenericUtility();
String userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"); String userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
String errString = ""; String errString = "";
...@@ -97,15 +69,11 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -97,15 +69,11 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rSet = null ; ResultSet rSet = null ;
ITMDBAccessEJB itmDBAccessLocal = null;
StringBuffer valueXmlString = new StringBuffer(); StringBuffer valueXmlString = new StringBuffer();
try try
{ {
connectionObject = getConnection(); connectionObject = getConnection();
itmDBAccessLocal = new ITMDBAccessEJB();
System.out.println("call valdata");
System.out.println("wfValData objContext ["+objContext+"]");
if(objContext != null && objContext.trim().length()>0) if(objContext != null && objContext.trim().length()>0)
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
...@@ -114,262 +82,226 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -114,262 +82,226 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
switch (currentFormNo) switch (currentFormNo)
{ {
case 1: case 1:
ResultSet rs = null; ResultSet rs = null;
NodeList parentNodeList = null; NodeList parentNodeList = null;
NodeList childNodeList = null; NodeList childNodeList = null;
int ctr = 0; int ctr = 0;
String errCode=""; String errCode="";
System.out.println("x==> in wfvalData 2 - > case 1"); System.out.println("x==> in wfvalData 2 - > case 1");
parentNodeList = dom.getElementsByTagName("Detail1"); parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
int childNodeLength1 = childNodeList.getLength(); int childNodeLength1 = childNodeList.getLength();
valueXmlString.append("<Detail1>"); valueXmlString.append("<Detail1>");
for (ctr = 0; ctr < childNodeLength1; ctr++) for (ctr = 0; ctr < childNodeLength1; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("x==> childNodeName now "+childNodeName);
if ("cust_code".equalsIgnoreCase( childNodeName ))
{ {
childNode = childNodeList.item(ctr); String cusCode = checkNull(genericUtility.getColumnValue("cust_code", dom)).trim();
childNodeName = childNode.getNodeName();
if ( cusCode.length() == 0 || cusCode == null )
System.out.println("x==> childNodeName now "+childNodeName);
if ("cust_code".equalsIgnoreCase( childNodeName ))
{ {
String cusCode = checkNull(genericUtility.getColumnValue("cust_code", dom)).trim(); errCode = "VTCUSTNEX";
errString = getErrorString("cusCode", errCode, userId);
if ( cusCode.length() == 0 || cusCode == null )
break;
}
else
{
String sql = "SELECT CUST_CODE,CUST_NAME FROM CUSTOMER WHERE CUST_CODE = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, cusCode);
rs = pstmt.executeQuery();
if(!rs.next())
{ {
errCode = "VTCUSTNEX"; errCode = "VTCUSTNEX ";
errString = getErrorString("cusCode", errCode, userId); errString = getErrorString("cust_code", errCode, userId);
break; break;
}
else
{
String sql = "SELECT CUST_CODE,CUST_NAME FROM CUSTOMER WHERE CUST_CODE = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, cusCode);
rs = pstmt.executeQuery();
if(!rs.next())
{
errCode = "VTCUSTNEX ";
errString = getErrorString("cust_code", errCode, userId);
break;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
}
else if ("pos_code".equalsIgnoreCase( childNodeName ))
else if ("pos_code".equalsIgnoreCase( childNodeName ))
{
String posCode = checkNull(genericUtility.getColumnValue("pos_code", dom)).trim();
if ( posCode.length() == 0 || posCode == null )
{ {
String posCode = checkNull(genericUtility.getColumnValue("pos_code", dom)).trim(); errCode = "INVPOSCODE";
errString = getErrorString("pos_code", errCode, userId);
if ( posCode.length() == 0 || posCode == null ) break;
}
else
{
String sql = "select pos_code,descr from org_structure where active = ? and POS_CODE = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, "Y");
pstmt.setString(2, posCode);
rs = pstmt.executeQuery();
if(!rs.next())
{ {
errCode = "INVPOSCODE"; errCode = "INVPOSCODE";
errString = getErrorString("pos_code", errCode, userId); errString = getErrorString("pos_code", errCode, userId);
break; break;
}
else
{
String sql = "select pos_code,descr from org_structure where active = ? and POS_CODE = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, "Y");
pstmt.setString(2, posCode);
rs = pstmt.executeQuery();
if(!rs.next())
{
errCode = "INVPOSCODE";
errString = getErrorString("pos_code", errCode, userId);
break;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
}
else if ("item_ser".equalsIgnoreCase( childNodeName ))
else if ("item_ser".equalsIgnoreCase( childNodeName ))
{
String itemSer = checkNull(genericUtility.getColumnValue("item_ser", dom)).trim();
if (itemSer.length() == 0 || itemSer == null)
{ {
String itemSer = checkNull(genericUtility.getColumnValue("item_ser", dom)).trim(); errCode = "NULITEMSER";
errString = getErrorString("item_ser", errCode, userId);
if (itemSer.length() == 0 || itemSer == null) break;
}
else
{
String sql = "SELECT ITEM_SER FROM ITEM WHERE ITEM_SER = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString( 1, itemSer );
rs = pstmt.executeQuery();
if(!rs.next())
{ {
errCode = "NULITEMSER"; errCode = "VTITEMSER1";
errString = getErrorString("item_ser", errCode, userId); errString = getErrorString("item_ser", errCode, userId);
break; break;
}
else
{
String sql = "SELECT ITEM_SER FROM ITEM WHERE ITEM_SER = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString( 1, itemSer );
rs = pstmt.executeQuery();
if(!rs.next())
{
errCode = "VTITEMSER1";
errString = getErrorString("item_ser", errCode, userId);
break;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
}
else if ("price_list".equalsIgnoreCase( childNodeName ))
else if ("price_list".equalsIgnoreCase( childNodeName ))
{
String priceList = checkNull(genericUtility.getColumnValue("price_list", dom)).trim();
if (priceList.length() == 0 || priceList == null)
{ {
String priceList = checkNull(genericUtility.getColumnValue("price_list", dom)).trim(); errCode = "VTINVPLIST";
errString = getErrorString("price_list", errCode, userId);
if (priceList.length() == 0 || priceList == null) break;
}
else
{
String sql = "SELECT PRICE_LIST FROM PRICELIST_MST WHERE PRICE_LIST = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString( 1, priceList );
rs = pstmt.executeQuery();
if(!rs.next())
{ {
errCode = "VTINVPLIST"; errCode = "VTINVPLIST";
errString = getErrorString("price_list", errCode, userId); errString = getErrorString("price_list", errCode, userId);
break; break;
}
else
{
String sql = "SELECT PRICE_LIST FROM PRICELIST_MST WHERE PRICE_LIST = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString( 1, priceList );
rs = pstmt.executeQuery();
if(!rs.next())
{
errCode = "VTINVPLIST";
errString = getErrorString("price_list", errCode, userId);
break;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
}
else if ("acct_prd".equalsIgnoreCase( childNodeName ))
else if ("acct_prd".equalsIgnoreCase( childNodeName ))
{
String acctPrd = checkNull(genericUtility.getColumnValue("acct_prd", dom)).trim();
if (acctPrd.length() == 0 || acctPrd == null)
{ {
String acctPrd = checkNull(genericUtility.getColumnValue("acct_prd", dom)).trim(); errCode = "VTNULLPRD ";
errString = getErrorString("acct_prd", errCode, userId);
if (acctPrd.length() == 0 || acctPrd == null) break;
}
else
{
//String sql = "SELECT CODE FROM PERIOD WHERE ACCT_PRD = ?";
String sql = "SELECT CODE FROM ACCTPRD WHERE CODE = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString( 1, acctPrd );
rs = pstmt.executeQuery();
if(!rs.next())
{ {
errCode = "VTNULLPRD "; errCode = "VTITXPRC03";
errString = getErrorString("acct_prd", errCode, userId); errString = getErrorString("acct_prd", errCode, userId);
break; break;
}
else
{
String sql = "SELECT CODE FROM PERIOD WHERE ACCT_PRD = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString( 1, acctPrd );
rs = pstmt.executeQuery();
if(!rs.next())
{
errCode = "VTITXPRC03";
errString = getErrorString("acct_prd", errCode, userId);
break;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} }
} }
valueXmlString.append("</Detail1>");
}
break; valueXmlString.append("</Detail1>");
case 2: break;
parentNodeList = dom.getElementsByTagName("Detail2"); case 2:
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); parentNodeList = dom.getElementsByTagName("Detail2");
int childNodeLength = childNodeList.getLength(); parentNode = parentNodeList.item(0);
String quantity=""; childNodeList = parentNode.getChildNodes();
int qty=0; int childNodeLength = childNodeList.getLength();
String quantity="";
valueXmlString.append("<Detail2>"); int qty=0;
for (ctr = 0; ctr < childNodeLength; ctr++) valueXmlString.append("<Detail2>");
for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if ( childNodeName.equalsIgnoreCase("quantity") )
{ {
childNode = childNodeList.item(ctr); quantity = checkNull(genericUtility.getColumnValue("quantity", dom));
childNodeName = childNode.getNodeName();
if( quantity.length() == 0 )
if ( childNodeName.equalsIgnoreCase("quantity") ) {
errString = getErrorString("quantity", "BLNKQUAN", userId);
break;
}
else
{ {
quantity = checkNull(genericUtility.getColumnValue("quantity", dom)).trim(); qty = Integer.valueOf(quantity);
if( qty < 0 )
if( quantity.length() == 0 || quantity == null || quantity == "")
{ {
errString = getErrorString("quantity", "BLNKQUAN", userId); errString = getErrorString("quantity", "VTTOTQTNG", userId);
break; break;
}
else
{
qty = Integer.valueOf(quantity);
if( qty < 0 )
{
errString = getErrorString("quantity", "VTTOTQTNG", userId);
break;
}
} }
} }
} }
valueXmlString.append("</Detail2>"); }
System.out.println("x==> in wfvalData 2 - > case 2 //END"); valueXmlString.append("</Detail2>");
break; System.out.println("x==> in wfvalData 2 - > case 2 //END");
break;
} }
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("wfValdata::Exception:" + getClass().getSimpleName() + ":::" + e.getMessage()); System.out.println("wfValdata::Exception:" + getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
/*e.printStackTrace();
errString = "";
errString = genericUtility.createErrorString( e ) ;
String messageValue="",message = "";
if( errString.indexOf("<Errors>")!=-1 )
{
if( errString.length() > 0 )
{
String msgDescr = errString.substring(errString.indexOf("<description>")+("<description>").length(),errString.indexOf("</description>"));
messageValue = msgDescr.substring(msgDescr.indexOf("<![CDATA[")+("<![CDATA[").length(),msgDescr.indexOf("]"));
String messageDescr = errString.substring(errString.indexOf("<message>")+("<message>").length(),errString.indexOf("</message>"));
message = messageDescr.substring(messageDescr.indexOf("<![CDATA[")+("<![CDATA[").length(),messageDescr.indexOf("]"));
System.out.println("errorMessage==>"+messageValue);
StringBuffer valueXmlErrorString = new StringBuffer( "<?xmlversion=\"1.0\"?>\r\n<Root>\r\n<Header>\r\n<Errors>\r\n" );
valueXmlErrorString.append("<error id=\"INVDATA\" type=\"E\" column_name=\"\">");
valueXmlErrorString.append("<message><![CDATA[").append(message).append("]]></message>\r\n");
valueXmlErrorString.append("<description><![CDATA[").append(messageValue).append("]]></description>\r\n");
valueXmlErrorString.append("<type>E</type>\r\n");
valueXmlErrorString.append("<option></option>\r\n");
valueXmlErrorString.append("<time></time>\r\n");
valueXmlErrorString.append("<alarm></alarm>\r\n");
valueXmlErrorString.append("<source></source>\r\n");
valueXmlErrorString.append("<trace>Error : NO DATA</trace>\r\n");
valueXmlErrorString.append("<redirect>1</redirect>\r\n");
valueXmlErrorString.append("</error>\r\n");
valueXmlErrorString.append("</Errors>\r\n");
valueXmlErrorString.append("</Header>\r\n");
valueXmlErrorString.append( "</Root>\r\n" );
System.out.println( "\n****valueXmlErrorString :" + valueXmlErrorString.toString() + ":********" );
errString =valueXmlErrorString.toString();
}
}*/
/*Ended By Dipak*/
} }
finally finally
{ {
...@@ -393,56 +325,13 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -393,56 +325,13 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
} }
catch (Exception e) catch (Exception e)
{ {
System.out.println("Exception in EJB[" System.out.println("Exception in EJB[" + getClass().getSimpleName() + "]::wfValData::finally catch [" + e.getMessage() + "]");
+ getClass().getSimpleName() + "]::wfValData::finally catch ["
+ e.getMessage() + "]");
} }
/*catch(Exception e)
{
System.out.println( "Exception :defaultDataWiz :==>\n"+e.getMessage());
errString = "";
errString = genericUtility.createErrorString( e ) ;
System.out.println( "errString ::" +errString + ":" );
String messageValue="",message = "";
if( errString.indexOf("<Errors>")!=-1 )
{
if( errString.length() > 0 )
{
String msgDescr = errString.substring(errString.indexOf("<description>")+("<description>").length(),errString.indexOf("</description>"));
messageValue = msgDescr.substring(msgDescr.indexOf("<![CDATA[")+("<![CDATA[").length(),msgDescr.indexOf("]"));
String messageDescr = errString.substring(errString.indexOf("<message>")+("<message>").length(),errString.indexOf("</message>"));
message = messageDescr.substring(messageDescr.indexOf("<![CDATA[")+("<![CDATA[").length(),messageDescr.indexOf("]"));
System.out.println("errorMessage==>"+messageValue);
StringBuffer valueXmlErrorString = new StringBuffer( "<?xmlversion=\"1.0\"?>\r\n<Root>\r\n<Header>\r\n<Errors>\r\n" );
valueXmlErrorString.append("<error id=\"INVDATA\" type=\"E\" column_name=\"\">");
valueXmlErrorString.append("<message><![CDATA[").append(message).append("]]></message>\r\n");
valueXmlErrorString.append("<description><![CDATA[").append(messageValue).append("]]></description>\r\n");
valueXmlErrorString.append("<type>E</type>\r\n");
valueXmlErrorString.append("<option></option>\r\n");
valueXmlErrorString.append("<time></time>\r\n");
valueXmlErrorString.append("<alarm></alarm>\r\n");
valueXmlErrorString.append("<source></source>\r\n");
valueXmlErrorString.append("<trace>Error : NO DATA</trace>\r\n");
valueXmlErrorString.append("<redirect>1</redirect>\r\n");
valueXmlErrorString.append("</error>\r\n");
valueXmlErrorString.append("</Errors>\r\n");
valueXmlErrorString.append("</Header>\r\n");
valueXmlErrorString.append( "</Root>\r\n" );
System.out.println( "\n****valueXmlErrorString :" + valueXmlErrorString.toString() + ":********" );
errString =valueXmlErrorString.toString();
}
}
}*/
} }
System.out.println("errString ["+errString+"]"); System.out.println("errString ["+errString+"]");
return errString; return errString;
} }
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{ {
Document dom = null; Document dom = null;
...@@ -455,7 +344,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -455,7 +344,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
System.out.println ( "xmlString :" + xmlString); System.out.println ( "xmlString :" + xmlString);
System.out.println ( "xmlString1 :" + xmlString1); System.out.println ( "xmlString1 :" + xmlString1);
System.out.println ( "xmlString2 :" + xmlString2); System.out.println ( "xmlString2 :" + xmlString2);
if (xmlString != null && xmlString.trim().length()!=0) if (xmlString != null && xmlString.trim().length()!=0)
{ {
dom = genericUtility.parseString(xmlString); dom = genericUtility.parseString(xmlString);
...@@ -499,20 +388,13 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -499,20 +388,13 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
System.out.println("x==> itemChanged called");
System.out.println("x==> DOM "+dom);
System.out.println("x==> DOM1 "+dom1);
System.out.println("x==> DOM2 "+dom2);
System.out.println("x==> objContext "+objContext);
System.out.println("x==> currentColumn "+currentColumn);
int currentFormNo= 0; int currentFormNo= 0;
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
PreparedStatement pstmt2 = null; PreparedStatement pstmt2 = null;
ResultSet rs2 = null; ResultSet rs2 = null;
StringBuffer valueXmlString = new StringBuffer(); StringBuffer valueXmlString = new StringBuffer();
NodeList parentNodeList = null; NodeList parentNodeList = null;
NodeList childNodeList = null; NodeList childNodeList = null;
...@@ -525,43 +407,35 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -525,43 +407,35 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
ArrayList<String> acctPrdlist=new ArrayList<String>(); ArrayList<String> acctPrdlist=new ArrayList<String>();
try try
{ {
conn = getConnection();
//returnStr = defaultDataWiz(dom, dom1, dom2, objContext, currentColumn, editFlag, xtraParams);
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("Driver");
InetAddress ownIP=InetAddress.getLocalHost();
chgTerm = ownIP.getHostAddress();
//connectionObject = getConnection();
UserInfoBean userInfo = getUserInfo(); UserInfoBean userInfo = getUserInfo();
siteCode = userInfo.getSiteCode(); siteCode = userInfo.getSiteCode();
userId = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginCode" ); userId = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginCode" );
//chgTerm = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "chgTerm" );
DateFormat dtFormat = new SimpleDateFormat(getApplDateFormat()); DateFormat dtFormat = new SimpleDateFormat(getApplDateFormat());
java.util.Date date = Calendar.getInstance().getTime(); java.util.Date date = Calendar.getInstance().getTime();
currDate = dtFormat.format( date ); currDate = dtFormat.format( date );
Calendar cal = Calendar.getInstance(); /*Calendar cal = Calendar.getInstance();
cal.add(Calendar.MONTH, -1); cal.add(Calendar.MONTH, -1);
Date result = cal.getTime(); Date result = cal.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
String prevPrd = String.valueOf(sdf.format(result)); String prevPrd = String.valueOf(sdf.format(result));
String curPrd = String.valueOf(sdf.format(date)); String curPrd = String.valueOf(sdf.format(date));
prevPrd = prevPrd.substring(0,prevPrd.length()-2); prevPrd = prevPrd.substring(0,prevPrd.length()-2);
curPrd = curPrd.substring(0,curPrd.length()-2); curPrd = curPrd.substring(0,curPrd.length()-2);*/
if ((objContext != null) && (objContext.trim().length() > 0)) if ((objContext != null) && (objContext.trim().length() > 0))
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
} }
System.out.println("[" + getClass().getSimpleName()+ "AMEY NOW currentFormNo:" + currentFormNo);
System.out.println("AMM x==> IC currentColumn:::::" + currentColumn);
valueXmlString = new StringBuffer("<?xml version=\"1.0\" encoding=''?><Root><header><editFlag>"); valueXmlString = new StringBuffer("<?xml version=\"1.0\" encoding=''?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>"); valueXmlString.append(editFlag).append("</editFlag></header>");
switch (currentFormNo) switch (currentFormNo)
{ {
...@@ -571,7 +445,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -571,7 +445,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
parentNodeList = dom.getElementsByTagName("Detail1"); parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail1>"); //valueXmlString.append("<Detail1>");
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
do do
{ {
...@@ -587,20 +461,37 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -587,20 +461,37 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
System.out.println("AMM x==> IC CURRENT COLUMN 111 " + currentColumn + "]"); System.out.println("AMM x==> IC CURRENT COLUMN 111 " + currentColumn + "]");
//valueXmlString.append("<Detail1>\r\n"); //valueXmlString.append("<Detail1>\r\n");
valueXmlString.append( "<Detail1 domID='" + count + "'>");
if ("itm_default".equalsIgnoreCase( currentColumn )) if ( "itm_default".equalsIgnoreCase( currentColumn ) )
{ {
valueXmlString.append( "<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\"/>\r\n"); valueXmlString.append( "<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\"/>\r\n");
valueXmlString.append( "<tran_date><![CDATA[").append( currDate ).append( "]]></tran_date>\r\n" ); valueXmlString.append( "<tran_date><![CDATA[").append( currDate ).append( "]]></tran_date>\r\n" );
valueXmlString.append( "<chg_date><![CDATA[" ).append( currDate ).append( "]]></chg_date>\r\n" ); /*valueXmlString.append( "<chg_date><![CDATA[" ).append( currDate ).append( "]]></chg_date>\r\n" );
valueXmlString.append( "<chg_user><![CDATA[" ).append( userId ).append( "]]></chg_user>\r\n" ); valueXmlString.append( "<chg_user><![CDATA[" ).append( userId ).append( "]]></chg_user>\r\n" );
valueXmlString.append( "<chg_term><![CDATA[" ).append( chgTerm ).append( "]]></chg_term>\r\n" ); valueXmlString.append( "<chg_term><![CDATA[" ).append( chgTerm ).append( "]]></chg_term>\r\n" );*/
valueXmlString.append( "<site_code><![CDATA[" ).append( siteCode ).append( "]]></site_code>\r\n" ); valueXmlString.append( "<site_code><![CDATA[" ).append( siteCode ).append( "]]></site_code>\r\n" );
valueXmlString.append( "<cust_code><![CDATA[" ).append( nullVar ).append( "]]></cust_code>\r\n" );
valueXmlString.append( "<cust_descr><![CDATA[" ).append( nullVar ).append( "]]></cust_descr>\r\n" );
valueXmlString.append( "<pos_code><![CDATA[" ).append( nullVar ).append( "]]></pos_code>\r\n" );
valueXmlString.append( "<pos_descr><![CDATA[" ).append( nullVar ).append( "]]></pos_descr>\r\n" );
valueXmlString.append( "<item_ser><![CDATA[" ).append( nullVar ).append( "]]></item_ser>\r\n" );
valueXmlString.append( "<itm_descr><![CDATA[" ).append( nullVar ).append( "]]></itm_descr>\r\n" );
valueXmlString.append( "<price_list><![CDATA[" ).append( nullVar ).append( "]]></price_list>\r\n" );
valueXmlString.append( "<prc_descr><![CDATA[" ).append( nullVar ).append( "]]></prc_descr>\r\n" );
valueXmlString.append( "<acct_prd><![CDATA[" ).append( nullVar ).append( "]]></acct_prd>\r\n" );
valueXmlString.append( "<remarks><![CDATA[" ).append( nullVar ).append( "]]></remarks>\r\n" );
//count ++;
} }
else if (currentColumn.trim().equalsIgnoreCase("cust_code")) else if (currentColumn.trim().equalsIgnoreCase("cust_code"))
{ {
custCode = checkNull(genericUtility.getColumnValue("cust_code", dom)).trim(); custCode = checkNull(genericUtility.getColumnValue("cust_code", dom));
if( custCode != null && custCode.trim().length()!=0 ) if( custCode != null && custCode.trim().length()!=0 )
{ {
...@@ -614,7 +505,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -614,7 +505,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
posCode = checkNull(rs.getString("POS_CODE")); posCode = checkNull(rs.getString("POS_CODE"));
posD = checkNull(rs.getString("DESCR")); posD = checkNull(rs.getString("DESCR"));
} }
String sql2= "SELECT CUST_NAME FROM CUSTOMER WHERE CUST_CODE = ?"; String sql2= "SELECT CUST_NAME FROM CUSTOMER WHERE CUST_CODE = ?";
pstmt2 = conn.prepareStatement(sql2); pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1, custCode); pstmt2.setString(1, custCode);
...@@ -623,7 +514,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -623,7 +514,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
{ {
custName = checkNull(rs2.getString("CUST_NAME")); custName = checkNull(rs2.getString("CUST_NAME"));
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
...@@ -634,19 +525,18 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -634,19 +525,18 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
pstmt2 = null; pstmt2 = null;
} }
valueXmlString.append("<pos_code><![CDATA[" + posCode + "]]></pos_code>"); valueXmlString.append("<pos_code><![CDATA[" + posCode + "]]></pos_code>");
valueXmlString.append("<pos_descr><![CDATA[" + posD + "]]></pos_descr>"); valueXmlString.append("<pos_descr><![CDATA[" + posD + "]]></pos_descr>");
valueXmlString.append("<cus_descr><![CDATA[" + custName + "]]></cus_descr>"); valueXmlString.append("<cust_descr><![CDATA[" + custName + "]]></cust_descr>");
} }
else if(currentColumn.trim().equalsIgnoreCase("pos_code")) else if(currentColumn.trim().equalsIgnoreCase("pos_code"))
{ {
String posCode2 = checkNull(genericUtility.getColumnValue("pos_code", dom)).trim(); String posCode2 = checkNull(genericUtility.getColumnValue("pos_code", dom));
if( posCode2 != null && posCode2.trim().length()!=0 ) if( posCode2 != null && posCode2.trim().length()!=0 )
{ {
String sql3="select descr from org_structure where pos_code=? and active = ?"; String sql3="select descr from org_structure where pos_code=? and active = ?";
pstmt = conn.prepareStatement(sql3); pstmt = conn.prepareStatement(sql3);
pstmt.setString(1, posCode2); pstmt.setString(1, posCode2);
pstmt.setString(2, "Y"); pstmt.setString(2, "Y");
...@@ -660,18 +550,17 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -660,18 +550,17 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
valueXmlString.append("<pos_descr><![CDATA[" + posDescr + "]]></pos_descr>"); valueXmlString.append("<pos_descr><![CDATA[" + posDescr + "]]></pos_descr>");
} }
else if(currentColumn.trim().equalsIgnoreCase("item_ser")) //itm_descr else if(currentColumn.trim().equalsIgnoreCase("item_ser")) //itm_descr
{ {
String itmSer2 = checkNull(genericUtility.getColumnValue("item_ser", dom)).trim(); String itmSer2 = checkNull(genericUtility.getColumnValue("item_ser", dom));
if( itmSer2 != null && itmSer2.trim().length()!=0 ) if( itmSer2 != null && itmSer2.trim().length()!=0 )
{ {
String sql3="SELECT DESCR FROM ITEMSER WHERE ITEM_SER = ?"; String sql3="SELECT DESCR FROM ITEMSER WHERE ITEM_SER = ?";
pstmt = conn.prepareStatement(sql3); pstmt = conn.prepareStatement(sql3);
pstmt.setString(1, itmSer2); pstmt.setString(1, itmSer2);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -684,18 +573,16 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -684,18 +573,16 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
valueXmlString.append("<itm_descr><![CDATA[" + itmDes + "]]></itm_descr>"); valueXmlString.append("<itm_descr><![CDATA[" + itmDes + "]]></itm_descr>");
} }
else if(currentColumn.trim().equalsIgnoreCase("price_list")) else if(currentColumn.trim().equalsIgnoreCase("price_list"))
{ {
String prcList2 = checkNull(genericUtility.getColumnValue("price_list", dom)).trim(); String prcList2 = checkNull(genericUtility.getColumnValue("price_list", dom));
if( prcList2 != null && prcList2.trim().length()!=0 ) if( prcList2 != null && prcList2.trim().length()!=0 )
{ {
String sql3="SELECT DESCR FROM PRICELIST_MST WHERE PRICE_LIST = ?"; String sql3="SELECT DESCR FROM PRICELIST_MST WHERE PRICE_LIST = ?";
pstmt = conn.prepareStatement(sql3); pstmt = conn.prepareStatement(sql3);
pstmt.setString(1, prcList2); pstmt.setString(1, prcList2);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -708,17 +595,18 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -708,17 +595,18 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
valueXmlString.append("<prc_descr><![CDATA[" + priceDesc + "]]></prc_descr>"); valueXmlString.append("<prc_descr><![CDATA[" + priceDesc + "]]></prc_descr>");
} }
valueXmlString.append("</Detail1>"); valueXmlString.append("</Detail1>");
break; break;
case 2: case 2:
System.out.println("IC switch case 2"); System.out.println("IC switch case 2");
String sql=""; String sql="";
String priclist=""; String priclist="";
int initialQnty = 0;
String itemSer="",acctPrd=""; String itemSer="",acctPrd="";
System.out.println("itemChanged:currentFormNo:" + currentFormNo); System.out.println("itemChanged:currentFormNo:" + currentFormNo);
parentNodeList = dom.getElementsByTagName("Detail2"); parentNodeList = dom.getElementsByTagName("Detail2");
...@@ -738,7 +626,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -738,7 +626,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
} }
while ((ctr < childNodeListLength) && (!childNodeName.equals(currentColumn))); while ((ctr < childNodeListLength) && (!childNodeName.equals(currentColumn)));
System.out.println("IC CURRENT COLUMN 333 " + currentColumn + "]"); System.out.println("IC CURRENT COLUMN 333 " + currentColumn + "]");
if ("itm_default".equalsIgnoreCase( currentColumn )) if ("itm_default".equalsIgnoreCase( currentColumn ))
{ {
if( currentColumn.equalsIgnoreCase("itm_default") ) if( currentColumn.equalsIgnoreCase("itm_default") )
...@@ -747,7 +635,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -747,7 +635,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
itemSer = checkNull(genericUtility.getColumnValue("item_ser", dom1)); itemSer = checkNull(genericUtility.getColumnValue("item_ser", dom1));
acctPrd = checkNull(genericUtility.getColumnValue("acct_prd", dom1)); acctPrd = checkNull(genericUtility.getColumnValue("acct_prd", dom1));
//String lineNo = genericUtility.getColumnValue("line_no", dom); //String lineNo = genericUtility.getColumnValue("line_no", dom);
//Period Code //Period Code
String sql3 = "SELECT CODE FROM PERIOD WHERE ACCT_PRD = ? ORDER BY CODE"; String sql3 = "SELECT CODE FROM PERIOD WHERE ACCT_PRD = ? ORDER BY CODE";
pstmt = conn.prepareStatement(sql3); pstmt = conn.prepareStatement(sql3);
...@@ -761,8 +649,8 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -761,8 +649,8 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
//Item //Item
String sql2 = "SELECT ITEM_CODE, UNIT FROM ITEM WHERE ITEM_SER = ?"; String sql2 = "SELECT ITEM_CODE, UNIT FROM ITEM WHERE ITEM_SER = ?";
pstmt = conn.prepareStatement( sql2 ); pstmt = conn.prepareStatement( sql2 );
...@@ -786,7 +674,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -786,7 +674,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
rs2 = null; rs2 = null;
pstmt2.close(); pstmt2.close();
pstmt2 = null; pstmt2 = null;
for( int i=0; i < acctPrdlist.size(); i++ ) for( int i=0; i < acctPrdlist.size(); i++ )
{ {
valueXmlString.append("<Detail2 domID='" + count + "' objContext = '"+currentFormNo+"' selected=\"Y\" >\r\n"); valueXmlString.append("<Detail2 domID='" + count + "' objContext = '"+currentFormNo+"' selected=\"Y\" >\r\n");
...@@ -794,6 +682,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -794,6 +682,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
valueXmlString.append("<prd_code><![CDATA[" + acctPrdlist.get(i) + "]]></prd_code>"); valueXmlString.append("<prd_code><![CDATA[" + acctPrdlist.get(i) + "]]></prd_code>");
valueXmlString.append("<item_code><![CDATA[" + itemCode + "]]></item_code>"); valueXmlString.append("<item_code><![CDATA[" + itemCode + "]]></item_code>");
valueXmlString.append("<item_ser><![CDATA[" + itemSer + "]]></item_ser>"); valueXmlString.append("<item_ser><![CDATA[" + itemSer + "]]></item_ser>");
valueXmlString.append("<quantity><![CDATA[" + initialQnty + "]]></quantity>");
valueXmlString.append("<unit><![CDATA[" + itemUnit + "]]></unit>"); valueXmlString.append("<unit><![CDATA[" + itemUnit + "]]></unit>");
valueXmlString.append("<line_no><![CDATA[" + count + "]]></line_no>"); valueXmlString.append("<line_no><![CDATA[" + count + "]]></line_no>");
valueXmlString.append("<rate><![CDATA[" + rate + "]]></rate>"); valueXmlString.append("<rate><![CDATA[" + rate + "]]></rate>");
...@@ -806,10 +695,10 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -806,10 +695,10 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} }
break; break;
} }
valueXmlString.append("</Root>"); valueXmlString.append("</Root>");
} }
...@@ -817,10 +706,10 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -817,10 +706,10 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
e.printStackTrace(); e.printStackTrace();
} }
return valueXmlString.toString(); return valueXmlString.toString();
//return returnStr;
} }
private String checkNull(String input) { private String checkNull(String input)
return input == null ? "" : input.trim(); {
return E12GenericUtility.checkNull( input );
} }
} }
...@@ -135,13 +135,13 @@ border: 1px solid #E7E7E7 !important; ...@@ -135,13 +135,13 @@ border: 1px solid #E7E7E7 !important;
<TR> <TR>
<TD class="header_main" nowrap="true" align="left" valign="middle" style="padding-left: 10px;font-size:16px;" width="2%" > <TD class="header_main" nowrap="true" align="left" valign="middle" style="padding-left: 10px;font-size:16px;" width="2%" >
Salses Budget Wizard Salses Budget
</TD> </TD>
</TR> </TR>
</TABLE> </TABLE>
<table id="errorActivityTable" width="100%" class="tableClass" style="margin: 0px 0px 0px 0px;position: relative;width: calc(literal('100% - 15px'));width: -moz-calc(literal('100% - 15px'));padding-right:0px; padding-left:5xp; width: -webkit-calc(literal('100% - 15px'));box-shadow: 3px 3px 3px gray;-moz-box-shadow:3px 3px 3px gray;-webkit-box-shadow: 3px 3px 3px gray;-o-box-shadow: 3px 3px 3px gray;background: rgba(255, 204, 0, 0.66);min-height: 50px;bottom:10px" border="1" cellspacing="0" cellpadding="0"> <table id="errorActivityTable" width="100%" class="tableClass" style="margin: 0px 0px 0px 0px;position: relative;width: calc(literal('100% - 15px'));width: -moz-calc(literal('100% - 15px'));padding-right:0px; padding-left:5xp; width: -webkit-calc(literal('100% - 15px'));box-shadow: 3px 3px 3px gray;-moz-box-shadow:3px 3px 3px gray;-webkit-box-shadow: 3px 3px 3px gray;-o-box-shadow: 3px 3px 3px gray;background: rgba(255, 204, 0, 0.66);min-height: 50px;bottom:10px" border="0" cellspacing="0" cellpadding="0">
<!--Changed by Dhiraj 30/09/10 [WS01SUN007] .end--> <!--Changed by Dhiraj 30/09/10 [WS01SUN007] .end-->
<xsl:for-each select="//error"> <xsl:for-each select="//error">
...@@ -203,12 +203,16 @@ border: 1px solid #E7E7E7 !important; ...@@ -203,12 +203,16 @@ border: 1px solid #E7E7E7 !important;
<xsl:for-each select="//Detail1"> <xsl:for-each select="//Detail1">
<xsl:variable name="tran_id"><xsl:value-of select="tran_id"/></xsl:variable> <xsl:variable name="tran_id"><xsl:value-of select="tran_id"/></xsl:variable>
<xsl:variable name="cust_code"><xsl:value-of select="cust_code"/></xsl:variable> <xsl:variable name="cust_code"><xsl:value-of select="cust_code"/></xsl:variable>
<xsl:variable name="cust_descr"><xsl:value-of select="cust_descr"/></xsl:variable>
<xsl:variable name="pos_code"><xsl:value-of select="pos_code"/></xsl:variable> <xsl:variable name="pos_code"><xsl:value-of select="pos_code"/></xsl:variable>
<xsl:variable name="pos_descr"><xsl:value-of select="pos_descr"/></xsl:variable>
<xsl:variable name="acct_prd"><xsl:value-of select="acct_prd"/></xsl:variable> <xsl:variable name="acct_prd"><xsl:value-of select="acct_prd"/></xsl:variable>
<xsl:variable name="item_ser"><xsl:value-of select="item_ser"/></xsl:variable> <xsl:variable name="item_ser"><xsl:value-of select="item_ser"/></xsl:variable>
<xsl:variable name="itm_descr"><xsl:value-of select="itm_descr"/></xsl:variable>
<xsl:variable name="net_amt"><xsl:value-of select="net_amt"/></xsl:variable> <xsl:variable name="net_amt"><xsl:value-of select="net_amt"/></xsl:variable>
<xsl:variable name="remarks"><xsl:value-of select="remarks"/></xsl:variable> <xsl:variable name="remarks"><xsl:value-of select="remarks"/></xsl:variable>
<xsl:variable name="price_list"><xsl:value-of select="price_list"/></xsl:variable> <xsl:variable name="price_list"><xsl:value-of select="price_list"/></xsl:variable>
<xsl:variable name="prc_descr"><xsl:value-of select="prc_descr"/></xsl:variable>
<xsl:variable name="site_code"><xsl:value-of select="site_code"/></xsl:variable> <xsl:variable name="site_code"><xsl:value-of select="site_code"/></xsl:variable>
<xsl:variable name="tran_date"><xsl:value-of select="tran_date"/></xsl:variable> <xsl:variable name="tran_date"><xsl:value-of select="tran_date"/></xsl:variable>
<xsl:variable name="chg_date"><xsl:value-of select="chg_date"/></xsl:variable> <xsl:variable name="chg_date"><xsl:value-of select="chg_date"/></xsl:variable>
...@@ -232,9 +236,9 @@ border: 1px solid #E7E7E7 !important; ...@@ -232,9 +236,9 @@ border: 1px solid #E7E7E7 !important;
<strong>Customer code: </strong> <strong>Customer code: </strong>
</td> </td>
<td class="td_leftAlign" > <td class="td_leftAlign" >
<input type="text" value="{$cust_code}" class="input_editable" name="Detail1.{normalize-space($dbID)}.cust_code" id="Detail1.{normalize-space($dbID)}.cust_code" maxlength="10" onchange="callItemChange('{normalize-space($dbID)}', 'cust_code');" ISCHANGED="false"/> <input type="text" value="{$cust_code}" class="input_editable" name="Detail1.{normalize-space($dbID)}.cust_code" id="Detail1.{normalize-space($dbID)}.cust_code" placeholder="Enter Customer code" maxlength="10" onchange="callItemChange('{normalize-space($dbID)}', 'cust_code');" ISCHANGED="false"/>
<a href="javascript:callCustCode( '{normalize-space($dbID)}','{normalize-space($cust_code)}' );"> <img src="/ibase/webitm/images/pophelp.png" border="0"/> </a> <a href="javascript:callCustCode( '{normalize-space($dbID)}','{normalize-space($cust_code)}' );"> <img src="/ibase/webitm/images/pophelp.png" border="0"/> </a>
<input type="text" class="input_editable" name="Detail1.{normalize-space($dbID)}.cus_descr" id="Detail1.{normalize-space($dbID)}.cus_descr" maxlength="5" style="width:300px" ISCHANGED="false" readonly="true" /> <input type="text" value="{$cust_descr}" class="input_editable" name="Detail1.{normalize-space($dbID)}.cust_descr" id="Detail1.{normalize-space($dbID)}.cust_descr" maxlength="5" style="width:300px" ISCHANGED="false" readonly="true" />
</td> </td>
</tr> </tr>
...@@ -246,7 +250,7 @@ border: 1px solid #E7E7E7 !important; ...@@ -246,7 +250,7 @@ border: 1px solid #E7E7E7 !important;
<td class="td_leftAlign" > <td class="td_leftAlign" >
<input type="text" class="input_editable" value="{$pos_code}" name="Detail1.{normalize-space($dbID)}.pos_code" id="Detail1.{normalize-space($dbID)}.pos_code" placeholder="Enter POS code" maxlength="10" onchange="callItemChange('{normalize-space($dbID)}', 'pos_code');" ISCHANGED="false"/> <input type="text" class="input_editable" value="{$pos_code}" name="Detail1.{normalize-space($dbID)}.pos_code" id="Detail1.{normalize-space($dbID)}.pos_code" placeholder="Enter POS code" maxlength="10" onchange="callItemChange('{normalize-space($dbID)}', 'pos_code');" ISCHANGED="false"/>
<a href="javascript:callPosCode( '{normalize-space($dbID)}','{normalize-space($pos_code)}' );"> <img src="/ibase/webitm/images/pophelp.png" border="0"/> </a> <a href="javascript:callPosCode( '{normalize-space($dbID)}','{normalize-space($pos_code)}' );"> <img src="/ibase/webitm/images/pophelp.png" border="0"/> </a>
<input type="text" class="input_editable" name="Detail1.{normalize-space($dbID)}.pos_descr" id="Detail1.{normalize-space($dbID)}.pos_descr" maxlength="5" style="width:300px" ISCHANGED="false" readonly="true" /> <input type="text" value="{$pos_descr}" class="input_editable" name="Detail1.{normalize-space($dbID)}.pos_descr" id="Detail1.{normalize-space($dbID)}.pos_descr" maxlength="5" style="width:300px" ISCHANGED="false" readonly="true" />
</td> </td>
</tr> </tr>
...@@ -258,7 +262,7 @@ border: 1px solid #E7E7E7 !important; ...@@ -258,7 +262,7 @@ border: 1px solid #E7E7E7 !important;
<td class="td_leftAlign" > <td class="td_leftAlign" >
<input type="text" class="input_editable" value="{$item_ser}" name="Detail1.{normalize-space($dbID)}.item_ser" id="Detail1.{normalize-space($dbID)}.item_ser" placeholder="Enter Item series" maxlength="5" onchange="callItemChange('{normalize-space($dbID)}', 'item_ser');" ISCHANGED="false"/> <input type="text" class="input_editable" value="{$item_ser}" name="Detail1.{normalize-space($dbID)}.item_ser" id="Detail1.{normalize-space($dbID)}.item_ser" placeholder="Enter Item series" maxlength="5" onchange="callItemChange('{normalize-space($dbID)}', 'item_ser');" ISCHANGED="false"/>
<a href="javascript:callItemSeries( '{normalize-space($dbID)}','{normalize-space($item_ser)}' );"> <img src="/ibase/webitm/images/pophelp.png" border="0"/> </a> <a href="javascript:callItemSeries( '{normalize-space($dbID)}','{normalize-space($item_ser)}' );"> <img src="/ibase/webitm/images/pophelp.png" border="0"/> </a>
<input type="text" class="input_editable" name="Detail1.{normalize-space($dbID)}.itm_descr" id="Detail1.{normalize-space($dbID)}.itm_descr" maxlength="5" style="width:300px" ISCHANGED="false" readonly="true" /> <input type="text" value="{$itm_descr}" class="input_editable" name="Detail1.{normalize-space($dbID)}.itm_descr" id="Detail1.{normalize-space($dbID)}.itm_descr" maxlength="5" style="width:300px" ISCHANGED="false" readonly="true" />
</td> </td>
</tr> </tr>
...@@ -270,7 +274,7 @@ border: 1px solid #E7E7E7 !important; ...@@ -270,7 +274,7 @@ border: 1px solid #E7E7E7 !important;
<td class="td_leftAlign" > <td class="td_leftAlign" >
<input type="text" value="{$price_list}" class="input_editable" name="Detail1.{normalize-space($dbID)}.price_list" id="Detail1.{normalize-space($dbID)}.price_list" placeholder="Enter Price List" maxlength="200" onchange="callItemChange('{normalize-space($dbID)}', 'price_list');" ISCHANGED="false" /> <input type="text" value="{$price_list}" class="input_editable" name="Detail1.{normalize-space($dbID)}.price_list" id="Detail1.{normalize-space($dbID)}.price_list" placeholder="Enter Price List" maxlength="200" onchange="callItemChange('{normalize-space($dbID)}', 'price_list');" ISCHANGED="false" />
<a href="javascript:callPriceList( '{normalize-space($dbID)}','{normalize-space($price_list)}' );"> <img src="/ibase/webitm/images/pophelp.png" border="0"/> </a> <a href="javascript:callPriceList( '{normalize-space($dbID)}','{normalize-space($price_list)}' );"> <img src="/ibase/webitm/images/pophelp.png" border="0"/> </a>
<input type="text" class="input_editable" name="Detail1.{normalize-space($dbID)}.prc_descr" id="Detail1.{normalize-space($dbID)}.prc_descr" maxlength="5" style="width:300px" ISCHANGED="false" readonly="true" /> <input type="text" value="{$prc_descr}" class="input_editable" name="Detail1.{normalize-space($dbID)}.prc_descr" id="Detail1.{normalize-space($dbID)}.prc_descr" maxlength="5" style="width:300px" ISCHANGED="false" readonly="true" />
</td> </td>
</tr> </tr>
......
...@@ -144,13 +144,13 @@ border: 1px solid #E7E7E7 !important; ...@@ -144,13 +144,13 @@ border: 1px solid #E7E7E7 !important;
<TR> <TR>
<TD class="header_main" nowrap="true" align="left" valign="middle" style="padding-left: 10px;font-size:16px;" width="2%" > <TD class="header_main" nowrap="true" align="left" valign="middle" style="padding-left: 10px;font-size:16px;" width="2%" >
Salses Budget Wizard Detail Salses Budget
</TD> </TD>
</TR> </TR>
</TABLE> </TABLE>
<table id="errorActivityTable" width="100%" class="tableClass" style="margin: 0px 0px 0px 0px;position: relative;width: calc(literal('100% - 15px'));width: -moz-calc(literal('100% - 15px'));padding-right:0px; padding-left:5xp; width: -webkit-calc(literal('100% - 15px'));box-shadow: 3px 3px 3px gray;-moz-box-shadow:3px 3px 3px gray;-webkit-box-shadow: 3px 3px 3px gray;-o-box-shadow: 3px 3px 3px gray;background: rgba(255, 204, 0, 0.66);min-height: 50px;bottom:10px" border="1" cellspacing="0" cellpadding="0"> <table id="errorActivityTable" width="100%" class="tableClass" style="margin: 0px 0px 0px 0px;position: relative;width: calc(literal('100% - 15px'));width: -moz-calc(literal('100% - 15px'));padding-right:0px; padding-left:5xp; width: -webkit-calc(literal('100% - 15px'));box-shadow: 3px 3px 3px gray;-moz-box-shadow:3px 3px 3px gray;-webkit-box-shadow: 3px 3px 3px gray;-o-box-shadow: 3px 3px 3px gray;background: rgba(255, 204, 0, 0.66);min-height: 50px;bottom:10px" border="0" cellspacing="0" cellpadding="0">
<xsl:for-each select="//error"> <xsl:for-each select="//error">
<xsl:if test="position() = 1"> <xsl:if test="position() = 1">
......
...@@ -15,7 +15,7 @@ function callCustCode( dbID, custCode ) ...@@ -15,7 +15,7 @@ function callCustCode( dbID, custCode )
function callItemSeries( dbID, itmSeries ) function callItemSeries( dbID, itmSeries )
{ {
var selectedItmSeries = document.getElementById("Detail1."+dbID+".item_ser").value; var selectedItmSeries = document.getElementById("Detail1."+dbID+".item_ser").value;
var url = '/ibase/webitm/jsp/SalesBudgetCustWiz.jsp?DBID='+dbID+'&SELECTED_ITM_SERIES='+selectedItmSeries+'&FIELD_NAME=ITEM_SER'; var url = '/ibase/webitm/jsp/SalesBudgetCustWiz.jsp?DBID='+dbID+'&SELECTED_ITM_SERIES='+selectedItmSeries+'&FIELD_NAME=ITEM_SER';
var win = window.open( url, 'ItemSeries', 'toolbar=no,status=yes,resizable=no,scrollbars=yes,left=100,top=50,width=500,height=406' ); var win = window.open( url, 'ItemSeries', 'toolbar=no,status=yes,resizable=no,scrollbars=yes,left=100,top=50,width=500,height=406' );
} }
...@@ -40,28 +40,32 @@ function callPriceList( dbID, prcList ) ...@@ -40,28 +40,32 @@ function callPriceList( dbID, prcList )
var win = window.open( url, 'PriceList', 'toolbar=no,status=yes,resizable=no,scrollbars=yes,left=100,top=50,width=500,height=406' ); var win = window.open( url, 'PriceList', 'toolbar=no,status=yes,resizable=no,scrollbars=yes,left=100,top=50,width=500,height=406' );
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////// DISPLAY DESCRIPTION //////////////////////////////////////////////////// //////////////////////////////////////////////////////DISPLAY DESCRIPTION ////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function displayCustActivity( cusCode, cusDescr ) function displayCustActivity( cusCode, cusDescr )
{ {
if (document.getElementById("Detail1..cust_code") != null) if (document.getElementById("Detail1..cust_code") != null)
{ {
document.getElementById("Detail1..cust_code").value = cusCode; document.getElementById("Detail1..cust_code").value = cusCode;
document.getElementById("Detail1..cus_descr").value = cusDescr; document.getElementById("Detail1..cust_descr").value = cusDescr;
callItemChange('', 'cust_code');
} }
else if(document.getElementById("Detail1.1.cust_code") != null) else if(document.getElementById("Detail1.1.cust_code") != null)
{ {
document.getElementById("Detail1.1.cust_code").value = cusCode; document.getElementById("Detail1.1.cust_code").value = cusCode;
document.getElementById("Detail1.1.cus_descr").value = cusDescr; document.getElementById("Detail1.1.cust_descr").value = cusDescr;
callItemChange('1', 'cust_code');
} }
} }
function displayPosActivity( posCode, posDescr ) function displayPosActivity( posCode, posDescr )
{ {
if (document.getElementById("Detail1..pos_code") != null) if (document.getElementById("Detail1..pos_code") != null)
{ {
document.getElementById("Detail1..pos_code").value = posCode; document.getElementById("Detail1..pos_code").value = posCode;
...@@ -76,7 +80,7 @@ function displayPosActivity( posCode, posDescr ) ...@@ -76,7 +80,7 @@ function displayPosActivity( posCode, posDescr )
function displayItemActivity( itmCode, itmDescr ) function displayItemActivity( itmCode, itmDescr )
{ {
if (document.getElementById("Detail1..item_ser") != null) if (document.getElementById("Detail1..item_ser") != null)
{ {
document.getElementById("Detail1..item_ser").value = itmCode; document.getElementById("Detail1..item_ser").value = itmCode;
...@@ -91,7 +95,7 @@ function displayItemActivity( itmCode, itmDescr ) ...@@ -91,7 +95,7 @@ function displayItemActivity( itmCode, itmDescr )
function displayPriceActivity( prcList, prcDescr ) function displayPriceActivity( prcList, prcDescr )
{ {
if (document.getElementById("Detail1..price_list") != null) if (document.getElementById("Detail1..price_list") != null)
{ {
document.getElementById("Detail1..price_list").value = prcList; document.getElementById("Detail1..price_list").value = prcList;
...@@ -106,7 +110,7 @@ function displayPriceActivity( prcList, prcDescr ) ...@@ -106,7 +110,7 @@ function displayPriceActivity( prcList, prcDescr )
function displayPrdActivity( prdCode, prdDescr ) function displayPrdActivity( prdCode, prdDescr )
{ {
if (document.getElementById("Detail1..acct_prd") != null) if (document.getElementById("Detail1..acct_prd") != null)
{ {
document.getElementById("Detail1..acct_prd").value = prdCode; document.getElementById("Detail1..acct_prd").value = prdCode;
...@@ -119,83 +123,90 @@ function displayPrdActivity( prdCode, prdDescr ) ...@@ -119,83 +123,90 @@ function displayPrdActivity( prdCode, prdDescr )
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////// NET AMOUNT //////////////////////////////////////////////////// //////////////////////////////////////////////////////NET AMOUNT ////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function validateFirstFormData( value ) function validateFirstFormData( value )
{ {
console.log('In setActionVal validation.validateFirstFormData..'); console.log('In setActionVal validation.validateFirstFormData..');
var csCode = document.getElementById("Detail1..cust_code").value; var csCode = document.getElementById("Detail1.1.cust_code").value;
var psCode = document.getElementById("Detail1..pos_code").value; var psCode = document.getElementById("Detail1.1.pos_code").value;
var iteSer = document.getElementById("Detail1..item_ser").value; var iteSer = document.getElementById("Detail1.1.item_ser").value;
var prcList = document.getElementById("Detail1..price_list").value; var prcList = document.getElementById("Detail1.1.price_list").value;
var actPrd = document.getElementById("Detail1..acct_prd").value var actPrd = document.getElementById("Detail1.1.acct_prd").value
if ( csCode == null || csCode == "" ) if ( csCode == null || csCode == "" )
{ {
alert("Please enter the value for Customer code"); console.log('cust_code');
return false; alert("Please enter the value for Customer code");
} return false;
else if ( psCode == null || psCode == "" ) }
{ if ( csCode.length < 3 )
alert("Please enter the value for Position code"); {
return false; console.log('cust_code');
} alert("Please enter Minimum 3 characters of value for customer Name");
else if ( iteSer == null || iteSer == "" ) return false;
{ }
alert("Please enter the value for Item Series"); if ( psCode == null || psCode == "" )
return false; {
} alert("Please enter the value for Position code");
else if ( prcList == null || prcList == "" ) return false;
{ }
alert("Please enter the value for Price List"); if ( iteSer == null || iteSer == "" )
return false; {
} alert("Please enter the value for Item Series");
else if ( actPrd == null || actPrd == "" ) return false;
{ }
alert("Please enter the Account Period"); if ( prcList == null || prcList == "" )
return false; {
} alert("Please enter the value for Price List");
else return false;
{ }
console.log('Successfull in else 1'); if ( actPrd == null || actPrd == "" )
setActionVal( value ); {
} alert("Please enter the Account Period");
return false;
}
else
{
console.log('Successfull in else 1');
setActionVal( value );
}
} }
function validateSecondFormData( value ) function validateSecondFormData( value )
{ {
console.log('In setActionVal validation.validateSecondFormData..'); console.log('In setActionVal validation.validateSecondFormData..');
//var qnty = document.getElementById("Detail2.1.quantity").value; var qnty = document.getElementById("Detail2."+dbId+".quantity").value;
var qnty = document.getElementById("Detail2."+dbId+".quantity").value; console.log('qnty= '+qnty);
console.log('qnty= '+qnty); if ( qnty == null || qnty == "" )
if ( qnty == null || qnty == "" ) {
{ alert("Please enter the Quantity");
alert("Please enter the Quantity"); return false;
return false; }
} if( qnty < 0 )
if( qnty < 0 ) {
{ alert("Quantity can't be Negative! Please enter valid Quantity");
alert("Quantity can't be Negative! Please enter valid Quantity"); return false;
return false; }
} else
else {
{ console.log('Successfull in else 2');
console.log('Successfull in else 2'); setActionVal( value );
setActionVal( value ); }
}
} }
function setActionVal( value ) function setActionVal( value )
{ {
console.log('Successfull in setActionVal'); console.log('Successfull in setActionVal');
document.getElementById("action").value = value; document.getElementById("action").value = value;
return true; return true;
} }
function doHideMsg(str) function doHideMsg(str)
{ {
document.getElementById(str).style.display = 'none'; document.getElementById(str).style.display = 'none';
} }
function disableButtons(formNo) function disableButtons(formNo)
...@@ -216,22 +227,27 @@ function disableButtons(formNo) ...@@ -216,22 +227,27 @@ function disableButtons(formNo)
function setNetAmount( dbId ) function setNetAmount( dbId )
{ {
qty = document.getElementById("Detail2."+dbId+".quantity").value; qty = document.getElementById("Detail2."+dbId+".quantity").value;
console.log('qty= '+qty); console.log('qty= '+qty);
if ( qty == null || qty == "" ) if ( qty == null || qty == "" )
{ {
alert("Please enter the Quantity"); alert("Please enter the Quantity");
} document.getElementById("Detail2."+dbId+".quantity").focus();
if( qty < 0 ) }
{ else if( qty < 0 )
alert("Quantity can't be Negative! Please enter valid Quantity"); {
} alert("Quantity can't be Negative! Please enter valid Quantity");
obj1 = document.getElementById("Detail2."+dbId+".rate"); document.getElementById("Detail2."+dbId+".quantity").focus();
var rate = trims(obj1.value); }
var amt = qty * rate ; else
if(document.getElementById("Detail2."+dbId+".net_amt") != null)
{ {
document.getElementById("Detail2."+dbId+".net_amt").value = amt; obj1 = document.getElementById("Detail2."+dbId+".rate");
var rate = trims(obj1.value);
var amt = qty * rate ;
if(document.getElementById("Detail2."+dbId+".net_amt") != null)
{
document.getElementById("Detail2."+dbId+".net_amt").value = amt;
}
} }
} }
...@@ -255,24 +271,24 @@ function trims(sVal) ...@@ -255,24 +271,24 @@ function trims(sVal)
return sTrimmed; return sTrimmed;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////// ITEM CHANGE //////////////////////////////////////////////////// //////////////////////////////////////////////////////ITEM CHANGE ////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var wizard_obj_name = ""; var wizard_obj_name = "";
function buildDataString( colName ) function buildDataString( colName )
{ {
var objCtx = colName.substring("Detail".length, colName.indexOf( "." ) ); var objCtx = colName.substring("Detail".length, colName.indexOf( "." ) );
local_dom_id = colName.substring(colName.indexOf( "." )+1, colName.lastIndexOf( "." ) ); local_dom_id = colName.substring(colName.indexOf( "." )+1, colName.lastIndexOf( "." ) );
colName = (colName.indexOf( "." ) != -1 ) ? colName.substring( colName.lastIndexOf( "." )+1 , colName.length ) : colName; colName = (colName.indexOf( "." ) != -1 ) ? colName.substring( colName.lastIndexOf( "." )+1 , colName.length ) : colName;
var dataString = "<?xml version='1.0' encoding='UTF-8'?>" var dataString = "<?xml version='1.0' encoding='UTF-8'?>"
+"<DocumentRoot>" +"<DocumentRoot>"
+"<description>Datawindow Root</description>" +"<description>Datawindow Root</description>"
+"<group0>" +"<group0>"
+"<description>Group0 description</description>" +"<description>Group0 description</description>"
+"<Header0>" +"<Header0>"
+"<description>Header0 members</description>"; +"<description>Header0 members</description>";
var currEditForm = document.forms[0]; var currEditForm = document.forms[0];
if ( currEditForm != undefined ) if ( currEditForm != undefined )
...@@ -280,19 +296,19 @@ function buildDataString( colName ) ...@@ -280,19 +296,19 @@ function buildDataString( colName )
for( formCtr = 1; formCtr <= parseInt(objCtx); formCtr++ ) for( formCtr = 1; formCtr <= parseInt(objCtx); formCtr++ )
{ {
var prev_dom_id = -1;//Gulzar on 21/03/15 var prev_dom_id = -1;//Gulzar on 21/03/15
var dataElements = ""; var dataElements = "";
for( ctr = 0; ctr < currEditForm.elements.length; ctr++ ) for( ctr = 0; ctr < currEditForm.elements.length; ctr++ )
{ {
var obj = currEditForm.elements[ctr]; var obj = currEditForm.elements[ctr];
var columnName = obj.name; var columnName = obj.name;
var objectCtx = columnName.substring("Detail".length, columnName.indexOf( "." ) ); var objectCtx = columnName.substring("Detail".length, columnName.indexOf( "." ) );
if(parseInt(objectCtx) == formCtr) if(parseInt(objectCtx) == formCtr)
{ {
var curr_dom_id = columnName.substring(columnName.indexOf( "." )+1, columnName.lastIndexOf( "." ) ); var curr_dom_id = columnName.substring(columnName.indexOf( "." )+1, columnName.lastIndexOf( "." ) );
if( curr_dom_id != prev_dom_id) if( curr_dom_id != prev_dom_id)
{ {
if(prev_dom_id != -1) if(prev_dom_id != -1)
...@@ -300,10 +316,10 @@ function buildDataString( colName ) ...@@ -300,10 +316,10 @@ function buildDataString( colName )
dataString += "</Detail" + formCtr + ">"; dataString += "</Detail" + formCtr + ">";
} }
dataString += "<Detail" + objectCtx + " id='2' dbID='' domID='" + curr_dom_id + "' " dataString += "<Detail" + objectCtx + " id='2' dbID='' domID='" + curr_dom_id + "' "
+ "objName='" + wizard_obj_name + "' objContext='" + objectCtx + "'>" + "objName='" + wizard_obj_name + "' objContext='" + objectCtx + "'>"
+ "<attribute pkNames='' status='O' updateFlag='N' selected='N'/>"; + "<attribute pkNames='' status='O' updateFlag='N' selected='N'/>";
} }
if( obj.name != undefined && obj.name.indexOf( "Detail" ) == 0 && obj.value != undefined ) if( obj.name != undefined && obj.name.indexOf( "Detail" ) == 0 && obj.value != undefined )
{ {
...@@ -323,10 +339,10 @@ function buildDataString( colName ) ...@@ -323,10 +339,10 @@ function buildDataString( colName )
} }
} }
} }
dataString += "</Header0>" dataString += "</Header0>"
+ "</group0>" + "</group0>"
+ "</DocumentRoot>"; + "</DocumentRoot>";
return dataString; return dataString;
} }
...@@ -336,7 +352,7 @@ function getSaveString( colName ) ...@@ -336,7 +352,7 @@ function getSaveString( colName )
local_dom_id = colName.substring(colName.indexOf( "." )+1, colName.lastIndexOf( "." ) ); local_dom_id = colName.substring(colName.indexOf( "." )+1, colName.lastIndexOf( "." ) );
global_obj_context = objCtx; global_obj_context = objCtx;
var saveString = ""; var saveString = "";
var isChange = false; var isChange = false;
var changeColString = ""; var changeColString = "";
...@@ -376,7 +392,7 @@ function getSaveString( colName ) ...@@ -376,7 +392,7 @@ function getSaveString( colName )
if( obj.ISCHANGED == "true" ) if( obj.ISCHANGED == "true" )
{ {
isChange = true; isChange = true;
var colName = obj.name; var colName = obj.name;
if( colName.indexOf( "." ) != -1 ) if( colName.indexOf( "." ) != -1 )
{ {
...@@ -399,8 +415,8 @@ function getSaveString( colName ) ...@@ -399,8 +415,8 @@ function getSaveString( colName )
changeColString += "</Detail>"; changeColString += "</Detail>";
} }
saveString = "<?xml version='1.0' encoding='utf-8'?>" saveString = "<?xml version='1.0' encoding='utf-8'?>"
+ "<Root>" + "<Root>"
+ getHeaderString( colName, objCtx, local_dom_id ); + getHeaderString( colName, objCtx, local_dom_id );
if(isChange) if(isChange)
{ {
...@@ -412,52 +428,58 @@ function getSaveString( colName ) ...@@ -412,52 +428,58 @@ function getSaveString( colName )
function getHeaderString( colName, objCtx, local_dom_id ) function getHeaderString( colName, objCtx, local_dom_id )
{ {
var obj_name = "sales_budget_cust_wiz"; var obj_name = "sales_budget_cust_wiz";
colName = (colName.indexOf( "." ) != -1 ) ? colName.substring( colName.lastIndexOf( "." )+1 , colName.length ) : colName ; colName = (colName.indexOf( "." ) != -1 ) ? colName.substring( colName.lastIndexOf( "." )+1 , colName.length ) : colName ;
return "<header>" return "<header>"
+ "<objName><![CDATA["+obj_name+"]]></objName>" + "<objName><![CDATA["+obj_name+"]]></objName>"
+ "<pageContext><![CDATA[2]]></pageContext>" + "<pageContext><![CDATA[2]]></pageContext>"
+ "<objContext><![CDATA["+objCtx+"]]></objContext>" + "<objContext><![CDATA["+objCtx+"]]></objContext>"
+ "<editFlag><![CDATA["+local_edit_mode+"]]></editFlag>" + "<editFlag><![CDATA["+local_edit_mode+"]]></editFlag>"
+ "<focusedColumn><![CDATA[" + colName + "]]></focusedColumn>" + "<focusedColumn><![CDATA[" + colName + "]]></focusedColumn>"
+ "<elementName><![CDATA[" + arguments[1] + "]]></elementName>" + "<elementName><![CDATA[" + arguments[1] + "]]></elementName>"
+ "<keyValue><![CDATA[" + ( local_dom_id ) + "]]></keyValue>" + "<keyValue><![CDATA[" + ( local_dom_id ) + "]]></keyValue>"
+ "<taxKeyValue><![CDATA[" + ( ( global_obj_context == "1" ) ? "1" : local_dom_id ) + "]]></taxKeyValue>" + "<taxKeyValue><![CDATA[" + ( ( global_obj_context == "1" ) ? "1" : local_dom_id ) + "]]></taxKeyValue>"
+ "<saveLevel><![CDATA[0]]></saveLevel>" + "<saveLevel><![CDATA[0]]></saveLevel>"
+ "<forcedSave><![CDATA[" + global_forced_save + "]]></forcedSave>" + "<forcedSave><![CDATA[" + global_forced_save + "]]></forcedSave>"
+ "<taxInFocus><![CDATA[false]]></taxInFocus>" + "<taxInFocus><![CDATA[false]]></taxInFocus>"
+ "</header>"; + "</header>";
} }
function callItemChange( dbId, fieldName ) function callItemChange( dbId, fieldName )
{ {
var obj = document.getElementById("OBJ_NAME"); var obj = document.getElementById("OBJ_NAME");
var objName = obj.value; var objName = obj.value;
wizard_obj_name = objName; wizard_obj_name = objName;
var action = "post_item_change"; var action = "post_item_change";
var detailFieldName = document.getElementById("Detail1."+dbId+"."+fieldName).name; var detailFieldName = document.getElementById("Detail1."+dbId+"."+fieldName).name;
var saveString = getSaveString( detailFieldName ); var saveString = getSaveString( detailFieldName );
console.log(saveString); console.log(saveString);
var dataString = buildDataString( detailFieldName ); var dataString = buildDataString( detailFieldName );
console.log(dataString); console.log(dataString);
local_dom_id = ( detailFieldName ).substring( ( detailFieldName ).indexOf( "." )+1, ( detailFieldName ).lastIndexOf( "." ) ); local_dom_id = ( detailFieldName ).substring( ( detailFieldName ).indexOf( "." )+1, ( detailFieldName ).lastIndexOf( "." ) );
console.log(local_dom_id); console.log(local_dom_id);
if( saveString != "" ) if( saveString != "" )
{ {
var url = "/ibase/WebITMStatelessItemChangeServlet?OBJ_NAME="+objName+"&ACTION=post_item_change&TRANS_DOM="+encodeURIComponent(saveString)+"&DETAIL_DOM="+encodeURIComponent(dataString)+"&DOM_ID="+local_dom_id; var url = "/ibase/WebITMStatelessItemChangeServlet?OBJ_NAME="+objName+"&ACTION=post_item_change&TRANS_DOM="+encodeURIComponent(saveString)+"&DETAIL_DOM="+encodeURIComponent(dataString)+"&DOM_ID="+local_dom_id;
makeRequestWizard( url, fieldName); makeRequestWizard( url, fieldName);
//var argArr = new Array();
//argArr[0] = "signItemChange";
//makeRequestWizard( url, setColumnValuesWizard );
} }
} }
function setPosCodeVal(xmldoc) function setPosCodeVal(xmldoc)
{ {
console.log("amey "+xmldoc); console.log("amey "+xmldoc);
if (window.DOMParser) if (window.DOMParser)
{ {
parser=new DOMParser(); parser=new DOMParser();
try try
...@@ -481,73 +503,64 @@ function setPosCodeVal(xmldoc) ...@@ -481,73 +503,64 @@ function setPosCodeVal(xmldoc)
if(xmldoc != null ) if(xmldoc != null )
{ {
//if(objFormName === 'doctor') var detailElement = xmldoc.getElementsByTagName("Detail1");
//{ for (var i = 0; i < detailElement.length; i++)
var detailElement = xmldoc.getElementsByTagName("Detail1"); {
for (var i = 0; i < detailElement.length; i++) var detail = detailElement[i];
var posCod="";
var posDes = "";
var custName="";
var strgType="";
var placeRequired="";
if( detail.getElementsByTagName("pos_code")[0] != null && detail.getElementsByTagName("pos_code")[0].childNodes[0] != null )
{ {
var detail = detailElement[i]; posCod = detail.getElementsByTagName("pos_code")[0].childNodes[0].nodeValue;
var posCod=""; }
var posDes = ""; if (document.getElementById("Detail1..pos_code") != null)
var custName=""; {
var strgType=""; document.getElementById("Detail1..pos_code").value = posCod;
var placeRequired=""; }
if( detail.getElementsByTagName("pos_code")[0] != null && detail.getElementsByTagName("pos_code")[0].childNodes[0] != null ) else if(document.getElementById("Detail1.1.pos_code") != null)
{ {
posCod = detail.getElementsByTagName("pos_code")[0].childNodes[0].nodeValue; document.getElementById("Detail1.1.pos_code").value = posCod;
}
//document.getElementById("Detail1..pos_code").value = posCod;
if( detail.getElementsByTagName("pos_descr")[0] != null && detail.getElementsByTagName("pos_descr")[0].childNodes[0] != null )
if (document.getElementById("Detail1..pos_code") != null) {
{ posDes = detail.getElementsByTagName("pos_descr")[0].childNodes[0].nodeValue;
document.getElementById("Detail1..pos_code").value = posCod;
} }
else if(document.getElementById("Detail1.1.pos_code") != null) if (document.getElementById("Detail1..pos_descr") != null)
{ {
document.getElementById("Detail1.1.pos_code").value = posCod; document.getElementById("Detail1..pos_descr").value = posDes;
} }
} else if(document.getElementById("Detail1.1.pos_descr") != null)
if( detail.getElementsByTagName("pos_descr")[0] != null && detail.getElementsByTagName("pos_descr")[0].childNodes[0] != null ) {
{ document.getElementById("Detail1.1.pos_descr").value = posDes;
posDes = detail.getElementsByTagName("pos_descr")[0].childNodes[0].nodeValue; }
//document.getElementById("Detail1..pos_descr").value = posDes; if( detail.getElementsByTagName("cust_descr")[0] != null && detail.getElementsByTagName("cust_descr")[0].childNodes[0] != null )
{
if (document.getElementById("Detail1..pos_descr") != null) custName = detail.getElementsByTagName("cust_descr")[0].childNodes[0].nodeValue;
{
document.getElementById("Detail1..pos_descr").value = posDes; }
} if (document.getElementById("Detail1..cust_descr") != null)
else if(document.getElementById("Detail1.1.pos_descr") != null) {
{ document.getElementById("Detail1..cust_descr").value = custName;
document.getElementById("Detail1.1.pos_descr").value = posDes; }
} else if(document.getElementById("Detail1.1.cust_descr") != null)
} {
if( detail.getElementsByTagName("cus_descr")[0] != null && detail.getElementsByTagName("cus_descr")[0].childNodes[0] != null ) document.getElementById("Detail1.1.cust_descr").value = custName;
{ }
custName = detail.getElementsByTagName("cus_descr")[0].childNodes[0].nodeValue; }
}
//document.getElementById("Detail1..cus_descr").value = custName;
if (document.getElementById("Detail1..cus_descr") != null)
{
document.getElementById("Detail1..cus_descr").value = custName;
}
else if(document.getElementById("Detail1.1.cus_descr") != null)
{
document.getElementById("Detail1.1.cus_descr").value = custName;
}
}
}
//}
}
} }
function setPosDescrVal(xmldoc) function setPosDescrVal(xmldoc)
{ {
console.log("amey "+xmldoc); console.log("amey "+xmldoc);
if (window.DOMParser) if (window.DOMParser)
{ {
parser=new DOMParser(); parser=new DOMParser();
try try
...@@ -571,38 +584,37 @@ function setPosDescrVal(xmldoc) ...@@ -571,38 +584,37 @@ function setPosDescrVal(xmldoc)
if(xmldoc != null ) if(xmldoc != null )
{ {
var detailElement = xmldoc.getElementsByTagName("Detail1"); var detailElement = xmldoc.getElementsByTagName("Detail1");
for (var i = 0; i < detailElement.length; i++) for (var i = 0; i < detailElement.length; i++)
{
var detail = detailElement[i];
var posdescr="";
var custName="";
var strgType="";
var placeRequired="";
if( detail.getElementsByTagName("pos_descr")[0] != null && detail.getElementsByTagName("pos_descr")[0].childNodes[0] != null )
{ {
var detail = detailElement[i]; posdescr = detail.getElementsByTagName("pos_descr")[0].childNodes[0].nodeValue;
var posdescr=""; //document.getElementById("Detail1..pos_descr").value = posdescr;
var custName=""; }
var strgType=""; if (document.getElementById("Detail1..pos_descr") != null)
var placeRequired=""; {
if( detail.getElementsByTagName("pos_descr")[0] != null && detail.getElementsByTagName("pos_descr")[0].childNodes[0] != null ) document.getElementById("Detail1..pos_descr").value = posdescr;
{ }
posdescr = detail.getElementsByTagName("pos_descr")[0].childNodes[0].nodeValue; else if(document.getElementById("Detail1.1.pos_descr") != null)
{
//document.getElementById("Detail1..pos_descr").value = posdescr; document.getElementById("Detail1.1.pos_descr").value = posdescr;
}
if (document.getElementById("Detail1..pos_descr") != null)
{ }
document.getElementById("Detail1..pos_descr").value = posdescr; }
}
else if(document.getElementById("Detail1.1.pos_descr") != null)
{
document.getElementById("Detail1.1.pos_descr").value = posdescr;
}
}
}
}
} }
function setItmDescrVal(xmldoc) function setItmDescrVal(xmldoc)
{ {
console.log("amey "+xmldoc); console.log("amey "+xmldoc);
if (window.DOMParser) if (window.DOMParser)
{ {
parser=new DOMParser(); parser=new DOMParser();
try try
...@@ -626,38 +638,35 @@ function setItmDescrVal(xmldoc) ...@@ -626,38 +638,35 @@ function setItmDescrVal(xmldoc)
if(xmldoc != null ) if(xmldoc != null )
{ {
var detailElement = xmldoc.getElementsByTagName("Detail1"); var detailElement = xmldoc.getElementsByTagName("Detail1");
for (var i = 0; i < detailElement.length; i++) for (var i = 0; i < detailElement.length; i++)
{
var detail = detailElement[i];
var itmdescr="";
var custName="";
var strgType="";
var placeRequired="";
if( detail.getElementsByTagName("itm_descr")[0] != null && detail.getElementsByTagName("itm_descr")[0].childNodes[0] != null )
{ {
var detail = detailElement[i]; itmdescr = detail.getElementsByTagName("itm_descr")[0].childNodes[0].nodeValue;
var itmdescr=""; }
var custName=""; if (document.getElementById("Detail1..itm_descr") != null)
var strgType=""; {
var placeRequired=""; document.getElementById("Detail1..itm_descr").value = itmdescr;
if( detail.getElementsByTagName("itm_descr")[0] != null && detail.getElementsByTagName("itm_descr")[0].childNodes[0] != null ) }
{ else if(document.getElementById("Detail1.1.itm_descr") != null)
itmdescr = detail.getElementsByTagName("itm_descr")[0].childNodes[0].nodeValue; {
document.getElementById("Detail1.1.itm_descr").value = itmdescr;
//document.getElementById("Detail1..itm_descr").value = itmdescr; }
}
if (document.getElementById("Detail1..itm_descr") != null) }
{
document.getElementById("Detail1..itm_descr").value = itmdescr;
}
else if(document.getElementById("Detail1.1.itm_descr") != null)
{
document.getElementById("Detail1.1.itm_descr").value = itmdescr;
}
}
}
}
} }
function setPrcDescrVal(xmldoc) function setPrcDescrVal(xmldoc)
{ {
console.log("amey "+xmldoc); console.log("amey "+xmldoc);
if (window.DOMParser) if (window.DOMParser)
{ {
parser=new DOMParser(); parser=new DOMParser();
try try
...@@ -681,47 +690,43 @@ function setPrcDescrVal(xmldoc) ...@@ -681,47 +690,43 @@ function setPrcDescrVal(xmldoc)
if(xmldoc != null ) if(xmldoc != null )
{ {
var detailElement = xmldoc.getElementsByTagName("Detail1"); var detailElement = xmldoc.getElementsByTagName("Detail1");
for (var i = 0; i < detailElement.length; i++) for (var i = 0; i < detailElement.length; i++)
{
var detail = detailElement[i];
var prcdescr="";
var custName="";
var strgType="";
var placeRequired="";
if( detail.getElementsByTagName("prc_descr")[0] != null && detail.getElementsByTagName("prc_descr")[0].childNodes[0] != null )
{ {
var detail = detailElement[i]; prcdescr = detail.getElementsByTagName("prc_descr")[0].childNodes[0].nodeValue;
var prcdescr=""; }
var custName=""; if (document.getElementById("Detail1..prc_descr") != null)
var strgType=""; {
var placeRequired=""; document.getElementById("Detail1..prc_descr").value = prcdescr;
if( detail.getElementsByTagName("prc_descr")[0] != null && detail.getElementsByTagName("prc_descr")[0].childNodes[0] != null ) }
{ else if(document.getElementById("Detail1.1.prc_descr") != null)
prcdescr = detail.getElementsByTagName("prc_descr")[0].childNodes[0].nodeValue; {
document.getElementById("Detail1.1.prc_descr").value = prcdescr;
//document.getElementById("Detail1..prc_descr").value = prcdescr; }
}
if (document.getElementById("Detail1..prc_descr") != null)
{
document.getElementById("Detail1..prc_descr").value = prcdescr;
}
else if(document.getElementById("Detail1.1.prc_descr") != null)
{
document.getElementById("Detail1.1.prc_descr").value = prcdescr;
}
}
}
}
}
if (window.ActiveXObject) /*code for IE6, IE5*/
{
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) /*code for IE7+, Firefox, Chrome, Opera, Safari*/
{
httpRequest = new XMLHttpRequest();
} }
}
if (window.ActiveXObject) /*code for IE6, IE5*/
{
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) /*code for IE7+, Firefox, Chrome, Opera, Safari*/
{
httpRequest = new XMLHttpRequest();
}
function makeRequestWizard( url, setColumnValuesWizard ) function makeRequestWizard( url, setColumnValuesWizard )
{ {
var sURL = unescape(window.location); var sURL = unescape(window.location);
if( ! isServerBusy ) if( ! isServerBusy )
{ {
isServerBusy = true; isServerBusy = true;
...@@ -750,10 +755,9 @@ function receiveResponseWizard( setColumnValuesWizard ) ...@@ -750,10 +755,9 @@ function receiveResponseWizard( setColumnValuesWizard )
} }
} }
function processResponseWizard( setColumnValuesWizard ) function processResponseWizard( setColumnValuesWizard )
{ {
var returnStr = null; var returnStr = null;
isProcessOn = false; isProcessOn = false;
if ( window.ActiveXObject ) if ( window.ActiveXObject )
{ {
...@@ -764,12 +768,12 @@ function processResponseWizard( setColumnValuesWizard ) ...@@ -764,12 +768,12 @@ function processResponseWizard( setColumnValuesWizard )
{ {
try try
{ {
var parser = new DOMParser(); var parser = new DOMParser();
xmldoc = httpRequest.responseText; xmldoc = httpRequest.responseText;
} }
catch(e) catch(e)
{ {
alert("inside catch:"+e.message); alert("inside catch:"+e.message);
} }
} }
//if( ! checkForError( xmldoc ) ) //if( ! checkForError( xmldoc ) )
...@@ -777,59 +781,57 @@ function processResponseWizard( setColumnValuesWizard ) ...@@ -777,59 +781,57 @@ function processResponseWizard( setColumnValuesWizard )
// setColumnValuesWizard( xmldoc ); // setColumnValuesWizard( xmldoc );
// isServerBusy = false; // isServerBusy = false;
//} //}
console.log('setColumnValuesWizard.['+setColumnValuesWizard+']'); console.log('setColumnValuesWizard.['+setColumnValuesWizard+']');
if( ! checkForError( xmldoc ) ) if( ! checkForError( xmldoc ) )
{ {
if ( setColumnValuesWizard == "cust_code" ) if ( setColumnValuesWizard == "cust_code" )
{ {
console.log('vicky 1.......'+xmldoc); console.log('vicky 1.......'+xmldoc);
setPosCodeVal(xmldoc); setPosCodeVal(xmldoc);
} }
else if( setColumnValuesWizard == "pos_code" ) else if( setColumnValuesWizard == "pos_code" )
{ {
console.log('vicky 2.......'+xmldoc); console.log('vicky 2.......'+xmldoc);
setPosDescrVal(xmldoc); setPosDescrVal(xmldoc);
} }
else if( setColumnValuesWizard == "item_ser" ) else if( setColumnValuesWizard == "item_ser" )
{ {
console.log('vicky 3.......'+xmldoc); console.log('vicky 3.......'+xmldoc);
setItmDescrVal(xmldoc); setItmDescrVal(xmldoc);
} }
else if( setColumnValuesWizard == "price_list" ) else if( setColumnValuesWizard == "price_list" )
{ {
console.log('vicky 4.......'+xmldoc); console.log('vicky 4.......'+xmldoc);
setPrcDescrVal(xmldoc); setPrcDescrVal(xmldoc);
} }
else else
{ {
setColumnValuesWizard(xmldoc); setColumnValuesWizard(xmldoc);
} }
} }
isServerBusy = false; isServerBusy = false;
} }
function loadXMLString(txt) function loadXMLString(txt)
{ {
if (window.DOMParser) if (window.DOMParser)
{ {
parser=new DOMParser(); parser=new DOMParser();
xmlDoc=parser.parseFromString(txt,"text/xml"); xmlDoc=parser.parseFromString(txt,"text/xml");
}
else /* code for IE*/
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.loadXML(txt);
}
return xmlDoc;
} }
else /* code for IE*/
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.loadXML(txt);
}
return xmlDoc;
}
function setColumnValuesWizard( retVal ) function setColumnValuesWizard( retVal )
{ {
var xmldoc = null; var xmldoc = null;
if (window.ActiveXObject) if (window.ActiveXObject)
{ {
...@@ -841,7 +843,7 @@ function setColumnValuesWizard( retVal ) ...@@ -841,7 +843,7 @@ function setColumnValuesWizard( retVal )
var parser = new DOMParser(); var parser = new DOMParser();
xmldoc = parser.parseFromString(retVal,"text/xml" ); xmldoc = parser.parseFromString(retVal,"text/xml" );
xmldoc=httpRequest.responseXML; xmldoc=httpRequest.responseXML;
} }
if( xmldoc.nodeType != 9 ) if( xmldoc.nodeType != 9 )
...@@ -878,7 +880,7 @@ function setColumnValuesWizard( retVal ) ...@@ -878,7 +880,7 @@ function setColumnValuesWizard( retVal )
}//if (colNode.firstChild != null || colNode.firstChild != undefined) }//if (colNode.firstChild != null || colNode.firstChild != undefined)
colNewValue = ( colNewValue == "null" ) ? "" : colNewValue; colNewValue = ( colNewValue == "null" ) ? "" : colNewValue;
var obj = undefined; var obj = undefined;
if( isDotNotation ) if( isDotNotation )
{ {
//write logic to rebuild colName = colName.formNo. //write logic to rebuild colName = colName.formNo.
...@@ -923,8 +925,6 @@ function setColumnValuesWizard( retVal ) ...@@ -923,8 +925,6 @@ function setColumnValuesWizard( retVal )
} }
} }
function checkForError( retVal, argArr ) function checkForError( retVal, argArr )
{ {
console.log("WizardItemchange.js >> checkForError...."); console.log("WizardItemchange.js >> checkForError....");
...@@ -934,12 +934,12 @@ function checkForError( retVal, argArr ) ...@@ -934,12 +934,12 @@ function checkForError( retVal, argArr )
} }
catch(err){} catch(err){}
if ( retVal.indexOf("<html>") != -1 || retVal.indexOf("<HTML>") != -1 ) if ( retVal.indexOf("<html>") != -1 || retVal.indexOf("<HTML>") != -1 )
{ {
return false; return false;
} }
var xmldoc = null; var xmldoc = null;
if (window.ActiveXObject) if (window.ActiveXObject)
{ {
...@@ -951,14 +951,14 @@ function checkForError( retVal, argArr ) ...@@ -951,14 +951,14 @@ function checkForError( retVal, argArr )
var parser = new DOMParser(); var parser = new DOMParser();
xmldoc = parser.parseFromString(retVal,"text/xml" ); xmldoc = parser.parseFromString(retVal,"text/xml" );
if(xmldoc == null || xmldoc == "null" || xmldoc == "") if(xmldoc == null || xmldoc == "null" || xmldoc == "")
xmldoc=httpRequest.responseXML; xmldoc=httpRequest.responseXML;
} }
if( xmldoc.nodeType != 9 ) if( xmldoc.nodeType != 9 )
{ {
return true;; return true;;
} }
var errorsNode = xmldoc.getElementsByTagName( "Errors" ); var errorsNode = xmldoc.getElementsByTagName( "Errors" );
var column_name = ""; var column_name = "";
if( errorsNode.length != 0 ) if( errorsNode.length != 0 )
...@@ -966,84 +966,84 @@ function checkForError( retVal, argArr ) ...@@ -966,84 +966,84 @@ function checkForError( retVal, argArr )
var msg = ""; var msg = "";
var toSave = false; var toSave = false;
outer: outer:
for(j = 0; j < errorsNode.length; j++) //Errors Node for(j = 0; j < errorsNode.length; j++) //Errors Node
{
inner:
for(i = 0; i < errorsNode.item(j).childNodes.length; i++) //error node
{ {
var errorNode = errorsNode.item(j).childNodes.item(i); inner:
for(i = 0; i < errorsNode.item(j).childNodes.length; i++) //error node
var id ;
var type ;
var column_nameNode;
var column_name;
if(errorNode.attributes != null || column_nameNode != undefined)
{
id = errorNode.attributes.getNamedItem("id").value;
type = errorNode.attributes.getNamedItem("type").value;
column_nameNode = errorNode.attributes.getNamedItem("column_name");
if(column_nameNode != null || column_nameNode != undefined)
{
column_name = column_nameNode.value;
}
}
var noOfErrorChilds = errorNode.childNodes.length;
var tagName = new Array();
var tagValue = new Array();
var mesCtr = 0;
var descrCtr = 1;
var traceCtr = 2;
var redirCtr = 3;
for(ctr = 0 ; ctr < noOfErrorChilds; ctr++)
{
var errorChild = errorNode.childNodes.item(ctr);
tagName[ctr] = errorChild.NodeName;
if(errorChild.firstChild != null || errorChild.firstChild != undefined)
{
tagValue[ctr] = errorChild.firstChild.nodeValue;
}
else
{
tagValue[ctr] = "";
}
}
if (type=="E" || type=="X")
{
alert("Exception \nMessage : " + tagValue[mesCtr] + "\nDescription : " + tagValue[descrCtr] + "\nTrace : " + tagValue[traceCtr] + "\nRedirect : " + tagValue[redirCtr]);
global_save_level = "0";
toSave = false;
global_forced_save = "false";
break outer;
}
else if (type=="P")
{
alert("Prompt \nMessage : " + tagValue[mesCtr] + "\nDescription : " + tagValue[descrCtr] + "\nTrace : " + tagValue[traceCtr] + "\nRedirect : " + tagValue[redirCtr]);
toSave = true;
break outer;
}
else if (type=="W")
{
var Yes_or_No = confirm( "Warning \nMessage : " + tagValue[mesCtr] + "\nDescription : " + tagValue[descrCtr] + "\nTrace : " + tagValue[traceCtr] + "\nRedirect : " + tagValue[redirCtr]);
if ( Yes_or_No == 1 )
{
global_forced_save = "true";
toSave = true;
continue;
}
else
{ {
global_save_level = "0"; var errorNode = errorsNode.item(j).childNodes.item(i);
toSave = false;
global_forced_save = "false"; var id ;
break outer; var type ;
} var column_nameNode;
}//else if (type=="W") var column_name;
}// for inner:
}//for outer: if(errorNode.attributes != null || column_nameNode != undefined)
{
id = errorNode.attributes.getNamedItem("id").value;
type = errorNode.attributes.getNamedItem("type").value;
column_nameNode = errorNode.attributes.getNamedItem("column_name");
if(column_nameNode != null || column_nameNode != undefined)
{
column_name = column_nameNode.value;
}
}
var noOfErrorChilds = errorNode.childNodes.length;
var tagName = new Array();
var tagValue = new Array();
var mesCtr = 0;
var descrCtr = 1;
var traceCtr = 2;
var redirCtr = 3;
for(ctr = 0 ; ctr < noOfErrorChilds; ctr++)
{
var errorChild = errorNode.childNodes.item(ctr);
tagName[ctr] = errorChild.NodeName;
if(errorChild.firstChild != null || errorChild.firstChild != undefined)
{
tagValue[ctr] = errorChild.firstChild.nodeValue;
}
else
{
tagValue[ctr] = "";
}
}
if (type=="E" || type=="X")
{
alert("Exception \nMessage : " + tagValue[mesCtr] + "\nDescription : " + tagValue[descrCtr] + "\nTrace : " + tagValue[traceCtr] + "\nRedirect : " + tagValue[redirCtr]);
global_save_level = "0";
toSave = false;
global_forced_save = "false";
break outer;
}
else if (type=="P")
{
alert("Prompt \nMessage : " + tagValue[mesCtr] + "\nDescription : " + tagValue[descrCtr] + "\nTrace : " + tagValue[traceCtr] + "\nRedirect : " + tagValue[redirCtr]);
toSave = true;
break outer;
}
else if (type=="W")
{
var Yes_or_No = confirm( "Warning \nMessage : " + tagValue[mesCtr] + "\nDescription : " + tagValue[descrCtr] + "\nTrace : " + tagValue[traceCtr] + "\nRedirect : " + tagValue[redirCtr]);
if ( Yes_or_No == 1 )
{
global_forced_save = "true";
toSave = true;
continue;
}
else
{
global_save_level = "0";
toSave = false;
global_forced_save = "false";
break outer;
}
}//else if (type=="W")
}// for inner:
}//for outer:
if (toSave) if (toSave)
{ {
if( argArr != null && argArr != undefined && argArr.length > 0 ) if( argArr != null && argArr != undefined && argArr.length > 0 )
...@@ -1129,15 +1129,3 @@ function checkForError( retVal, argArr ) ...@@ -1129,15 +1129,3 @@ function checkForError( retVal, argArr )
} }
} }
} }
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<% <%
ibase.utility.UserInfoBean userInfo = ( ibase.utility.UserInfoBean )session.getAttribute( "USER_INFO" );
String itmSeries = "",posCode = "", priceList = "", acctprd = "",custCode = "",htmlData = "", fld_name = ""; String itmSeries = "",posCode = "", priceList = "", acctprd = "",custCode = "",htmlData = "", fld_name = "";
System.out.println("@@@@@@@@@ In StrgBrandActPeriodCode.jsp @@@@@@@@@@@@@@@@"); System.out.println("@@@@@@@@@ In StrgBrandActPeriodCode.jsp @@@@@@@@@@@@@@@@");
SalesBudgetCustWizBean salesBudgetCustWizBean = new SalesBudgetCustWizBean(); SalesBudgetCustWizBean salesBudgetCustWizBean = new SalesBudgetCustWizBean( "sales_budget_cust_wiz", userInfo );
fld_name = ( String ) request.getParameter("FIELD_NAME"); fld_name = ( String ) request.getParameter("FIELD_NAME");
System.out.println("@@@@@@@@@ In StrgBrandActPeriodCode.jsp FIELD_NAME =" +fld_name); System.out.println("@@@@@@@@@ In StrgBrandActPeriodCode.jsp FIELD_NAME =" +fld_name);
...@@ -25,15 +26,6 @@ ...@@ -25,15 +26,6 @@
acctprd = ( String ) request.getParameter("SELECTED_ACCT_PRD"); acctprd = ( String ) request.getParameter("SELECTED_ACCT_PRD");
System.out.println("@@@@@@@@@ In StrgBrandActPeriodCode.jsp acctprd =" +acctprd); System.out.println("@@@@@@@@@ In StrgBrandActPeriodCode.jsp acctprd =" +acctprd);
ibase.utility.UserInfoBean userInfo = ( ibase.utility.UserInfoBean )session.getAttribute( "USER_INFO" );
System.out.println("@@@@@@@@@ In StrgBrandActPeriodCode.jsp userInfo ::"+userInfo.toString());
if( userInfo != null )
{
salesBudgetCustWizBean.setUserInfo( userInfo );
}
if ( fld_name.equalsIgnoreCase("CUST_CODE") && custCode != null ) if ( fld_name.equalsIgnoreCase("CUST_CODE") && custCode != null )
{ {
htmlData = salesBudgetCustWizBean.getCustCode( custCode ); htmlData = salesBudgetCustWizBean.getCustCode( custCode );
......
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