Commit e8f007ea authored by nkhan's avatar nkhan

[S15IBAS003] Updated Sources For Adding Validation From MSI And removing extra validation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@103421 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0e61e5c9
......@@ -12,6 +12,7 @@ import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
......@@ -77,10 +78,15 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
String priceList = "";
String priceListTar = "";
String calcMethod = "";
String childNodeValue = "" ;
String active = "";
String effDateStr ="", validUptoStr ="";
Timestamp effDate = null, validUpto = null;
int ctr = 0;
int count = 0;
int currentFormNo = 0;
int childNodeListLength;
double minQty = 0.0, maxQty = 0.0, minRate = 0.0, rate = 0.0;
StringBuffer valueXmlString = new StringBuffer();
ArrayList<String> errList = new ArrayList();
ArrayList<String> errFields = new ArrayList<String>();
......@@ -120,6 +126,7 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
/* Comment By Nasruddin [20-SEP-16] START
if(childNodeName.equalsIgnoreCase("calc_method"))
{
calcMethod = genericUtility.getColumnValue("calc_method", dom);
......@@ -150,8 +157,12 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
errCode = "VTCALMNUL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}*/
}
}
Comment By Nasruddin [20-SEP-16] END
*/
/* Comment By Nasruddin [20-SEP-16] START
else if(childNodeName.equalsIgnoreCase("price_list"))
{
priceList = genericUtility.getColumnValue("price_list", dom);
......@@ -202,10 +213,10 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
}
}
}Comment By Nasruddin [20-SEP-16] END*/
else if(childNodeName.equalsIgnoreCase("price_list__parent"))
if(childNodeName.equalsIgnoreCase("price_list__parent"))
{
priceListParent = genericUtility.getColumnValue("price_list__parent", dom);
if (priceListParent !=null && priceListParent.trim().length() > 0)
......@@ -220,6 +231,57 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
}
}
//Changed By Nasruddin [20-SEP-16] start
else if(childNodeName.equalsIgnoreCase("slab_no") || childNodeName.equalsIgnoreCase("tax_base") || childNodeName.equalsIgnoreCase("item_code"))
{
childNodeValue = checkNullAndTrim(genericUtility.getColumnValue(childNodeName, dom));
if (childNodeValue !=null && childNodeValue.trim().length() > 0)
{
count = 0;
sql = "SELECT COUNT(1) FROM ITEM WHERE ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, childNodeValue);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt(1);
}
pstmt.close();
pstmt=null;
rs.close();
rs = null;
if( count == 0)
{
errCode = "VMITEM_CD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
sql = "SELECT ACTIVE FROM ITEM WHERE ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, childNodeValue);
rs = pstmt.executeQuery();
if( rs.next() )
{
active = rs.getString("ACTIVE");
}
pstmt.close();
pstmt=null;
rs.close();
rs = null;
if("N".equalsIgnoreCase(active))
{
errCode = "VTITEM4";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
}
//Changed By Nasruddin [20-SEP-16] end
}
valueXmlString.append("</Detail1>");
break;
......@@ -233,7 +295,8 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("calc_method"))
/* cOMMENT bY Nasruddin [20-SEP-16] START
* if(childNodeName.equalsIgnoreCase("calc_method"))
{
calcMethod = genericUtility.getColumnValue("calc_method", dom);
if (calcMethod !=null && calcMethod.trim().length() > 0)
......@@ -263,9 +326,8 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else if(childNodeName.equalsIgnoreCase("price_list__tar"))
if(childNodeName.equalsIgnoreCase("price_list__tar"))
{
priceListTar = genericUtility.getColumnValue("price_list__tar", dom);
if (priceListTar == null || priceListTar.trim().length() == 0)
......@@ -289,9 +351,84 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
}
}
}cOMMENT bY Nasruddin [20-SEP-16] end*/
//Changed By Nasruddin STARt [20-sep-16] START
if(childNodeName.equalsIgnoreCase("min_qty"))
{
minQty = convertNumber(checkNullAndTrim(genericUtility.getColumnValue("min_qty", dom)));
maxQty = convertNumber(checkNullAndTrim(genericUtility.getColumnValue("max_qty", dom)));
if(maxQty < minQty)
{
errCode = "VMMINQTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else if(childNodeName.equalsIgnoreCase("min_rate"))
{
minRate = convertNumber(checkNullAndTrim(genericUtility.getColumnValue("min_rate", dom)));
rate = convertNumber(checkNullAndTrim(genericUtility.getColumnValue("rate", dom)));
if(rate < minRate)
{
errCode = "VMMINQTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else if(childNodeName.equalsIgnoreCase("valid_upto"))
{
effDateStr = genericUtility.getColumnValue("eff_date",dom);
validUptoStr = genericUtility.getColumnValue("valid_upto",dom);
if((effDateStr != null) && (validUptoStr != null))
{
effDate = Timestamp.valueOf(genericUtility.getValidDateString(effDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
validUpto = Timestamp.valueOf(genericUtility.getValidDateString(validUptoStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
if( !validUpto.after(effDate) )
{
errCode = "VMVAL_UPTO";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("tax_code"))
{
childNodeValue = checkNullAndTrim(genericUtility.getColumnValue("tax_code", dom));
count = 0;
sql = "SELECT COUNT(1) FROM TAX WHERE TAX_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, childNodeValue);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt(1);
}
pstmt.close();
pstmt=null;
rs.close();
rs = null;
if( count == 0)
{
errCode = "VTTAX1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else if(childNodeName.equalsIgnoreCase("rate"))
{
rate = convertNumber(checkNullAndTrim(genericUtility.getColumnValue("rate", dom)));
if(rate <= 0)
{
errCode = "VTRATE2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
//Changed By Nasruddin [20-sep-16] END
}
valueXmlString.append("</Detail2>");
break;
}
......@@ -369,6 +506,19 @@ public class PriceListIC extends ValidatorEJB implements PriceListICLocal, Price
return errString;
}
private double convertNumber(String columnValue)
{
return columnValue.trim().length() == 0 ? 0 : Double.parseDouble(columnValue);
}
// Changed By Nasruddin 20-SEP-16 STARt
private String checkNullAndTrim(String value)
{
return value == null ? "" : value.trim();
}
// Changed By Nasruddin 20-SEP-16 END
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
......
......@@ -2,7 +2,6 @@ package ibase.webitm.ejb.dis;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
......@@ -13,7 +12,6 @@ import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import javax.ejb.Stateless;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
......@@ -75,6 +73,7 @@ public class PriceListTranIC extends ValidatorEJB implements
int ctr = 0, childNodeLength = 0, currentFormNo = 0, count = 0;
Date validUptoDt = null, effDate = null;
String childNodeName = "", minQty = "", maxQty = "", maxRate = "", minRate = "", validUpto = "", effFrom = "", rate = "";
String modName = "w_pricelist_tran", tranId = "", keyFlag = "", taxCode = "";
try {
ConnDriver con = new ConnDriver();
//Changes and Commented By Bhushan on 09-06-2016 :START
......@@ -89,19 +88,22 @@ public class PriceListTranIC extends ValidatorEJB implements
if (objContext != null && objContext.trim().length() > 0) {
currentFormNo = Integer.parseInt(objContext);
}
switch (currentFormNo) {
case 1: {
switch (currentFormNo)
{
case 1:
{
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++) {
for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("price_list")) {
if (childNodeName.equalsIgnoreCase("price_list"))
{
System.out.println(":::childNodeName" + childNodeName);
priceList = genericUtility.getColumnValue("price_list",
dom);
priceList = genericUtility.getColumnValue("price_list",dom);
priceList = priceList == null ? "" : priceList.trim();
System.out.println(":::price list:: " + priceList);
......@@ -109,23 +111,24 @@ public class PriceListTranIC extends ValidatorEJB implements
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, priceList);
rs = pstmt.executeQuery();
if (rs.next()) {
if (rs.next())
{
count = rs.getInt("count");
}
System.out.println("::: count:::" + count);
if (count <= 0) {
errString = getErrorString(
"price_list", "VTPLIST", userId);
if (count <= 0)
{
errString = getErrorString("price_list", "VTPLIST", userId);
return errString;
}
close(pstmt, rs);
sql = "select manage_type from pricelist_mst where price_list = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, priceList);
rs = pstmt.executeQuery();
if (rs.next()) {
if (rs.next())
{
manageType = rs.getString("manage_type");
}
......@@ -133,14 +136,59 @@ public class PriceListTranIC extends ValidatorEJB implements
System.out.println(":: manage type::" + manageType);
if (!manageType.equalsIgnoreCase("M") || manageType.equalsIgnoreCase("")) {
if (!manageType.equalsIgnoreCase("M") || manageType.equalsIgnoreCase(""))
{
errString = getErrorString("price_list", "VTMTYPE", userId);
return errString;
}
close(pstmt, rs);
}
// Changed By Nasruddin [20-SEP-16] START
if (childNodeName.equalsIgnoreCase("tran_id"))
{
System.out.println(":::childNodeName" + childNodeName);
tranId = genericUtility.getColumnValue("tran_id", dom);
sql = "SELECT KEY_FLAG FROM TRANSETUP WHERE TRAN_WINDOW =''";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, modName);
rs = pstmt.executeQuery();
if(rs.next())
{
keyFlag = rs.getString("KEY_FLAG");
}
close(pstmt, rs);
keyFlag = keyFlag == null ?"M": keyFlag.trim();
if( keyFlag == "M" && tranId == null || tranId.trim().length() == 0 )
{
errString = getErrorString("tran_id", "VMCODNULL", userId);
return errString;
}
else
{
if("A".equals(editFlag))
{
count = 0;
sql = "SELECT COUNT(1) FROM PRICELIST_HDR WHERE TRAN_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
close(pstmt, rs);
if(count > 0)
{
errString = getErrorString("tran_id", "VMDUPL1", userId);
return errString;
}
}
}
if (childNodeName.equalsIgnoreCase("ref_no")) {
}
// Changed By Nasruddin [20-SEP-16] END
if (childNodeName.equalsIgnoreCase("ref_no"))
{
System.out.println(":::childNodeName" + childNodeName);
refNo = genericUtility.getColumnValue("ref_no", dom);
refNo = refNo == null ? "" : refNo.trim();
......@@ -168,15 +216,18 @@ public class PriceListTranIC extends ValidatorEJB implements
break;
}
case 2: {
case 2:
{
parentNodeList = dom.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++) {
for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("item_code")) {
if (childNodeName.equalsIgnoreCase("item_code"))
{
System.out.println(":::childNodeName" + childNodeName);
itemCode = genericUtility.getColumnValue("item_code", dom);
itemCode = itemCode == null ? "" : itemCode.trim();
......@@ -186,7 +237,8 @@ public class PriceListTranIC extends ValidatorEJB implements
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
if (rs.next()) {
if (rs.next())
{
count = rs.getInt("count");
}
System.out.println("::count ::: " + count);
......@@ -194,8 +246,7 @@ public class PriceListTranIC extends ValidatorEJB implements
close(pstmt, rs);
if (count <= 0) {
errString = getErrorString(
"item_code", "VMITEM_CD", userId);
errString = getErrorString("item_code", "VMITEM_CD", userId);
return errString;
}
......@@ -207,13 +258,15 @@ public class PriceListTranIC extends ValidatorEJB implements
active = rs.getString("active");
}
close(pstmt, rs);
if (active.equalsIgnoreCase("N")) {
if (active.equalsIgnoreCase("N"))
{
errString = getErrorString("item_code", "VTITEM4", userId);
return errString;
}
}
if (childNodeName.equalsIgnoreCase("min_qty")) {
if (childNodeName.equalsIgnoreCase("min_qty"))
{
System.out.println(":::childNodeName" + childNodeName);
minQty = genericUtility.getColumnValue("min_qty", dom);
minQty = minQty == null ? "" : minQty.trim();
......@@ -229,13 +282,15 @@ public class PriceListTranIC extends ValidatorEJB implements
Double max = Double.parseDouble(maxQty);
System.out.println("double max quantity::::" + max);
if (min > max) {
if (min > max)
{
errString = getErrorString("min_qty", "VMMINQTY", userId);
return errString;
}
}
if (childNodeName.equalsIgnoreCase("min_rate")) {
if (childNodeName.equalsIgnoreCase("min_rate"))
{
System.out.println(":::childNodeName" + childNodeName);
minRate = genericUtility.getColumnValue("min_rate", dom);
minRate = minRate == null ? "" : minRate.trim();
......@@ -251,13 +306,15 @@ public class PriceListTranIC extends ValidatorEJB implements
Double max = Double.parseDouble(maxRate);
System.out.println("double max rate::::" + max);
if (min > max) {
if (min > max)
{
errString = getErrorString("min_rate", "VMMINRATE", userId);
return errString;
}
}
if (childNodeName.equalsIgnoreCase("valid_upto")) {
if (childNodeName.equalsIgnoreCase("valid_upto"))
{
System.out.println(":::childNodeName" + childNodeName);
validUpto = genericUtility.getColumnValue("valid_upto", dom);
validUpto = validUpto == null ? "" : validUpto.trim();
......@@ -279,7 +336,8 @@ public class PriceListTranIC extends ValidatorEJB implements
}
}
if (childNodeName.equalsIgnoreCase("rate")) {
if (childNodeName.equalsIgnoreCase("rate"))
{
System.out.println(":::childNodeName" + childNodeName);
rate = genericUtility.getColumnValue("rate", dom);
rate = rate == null ? "" : rate.trim();
......@@ -288,15 +346,39 @@ public class PriceListTranIC extends ValidatorEJB implements
Double rateDouble = Double.parseDouble(rate);
System.out.println("::double rate:: " + rateDouble);
if (rateDouble <= 0) {
if (rateDouble <= 0)
{
errString = getErrorString("rate", "VTRATE2", userId);
return errString;
}
}
//Changed By Nasruddin 20-SEP-16 START
if(childNodeName.equalsIgnoreCase("tax_code"))
{
taxCode = genericUtility.getColumnValue("tax_code", dom);
count = 0;
sql = "SELECT COUNT(1) FROM TAX WHERE TAX_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt(1);
}
close(pstmt, rs);
if( count == 0)
{
errString = getErrorString("tax_code", "VTTAX1", userId);
return errString;
}
}
//Changed By Nasruddin 20-SEP-16 END
}
}
}
}
} catch (Exception e) {
catch (Exception e) {
System.out.println(":::: " + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace();
} finally {
......
......@@ -80,7 +80,7 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur
String sql = "";
String errCode = "";
String errorType = "";
String errString = "";
String errString = "", termTable = "";
int ctr = 0;
int currentFormNo = 0;
int cnt = 0;
......@@ -90,6 +90,7 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String termCode = "";
ConnDriver connDriver = new ConnDriver();
int childNodeListLength=0;
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
......@@ -121,10 +122,11 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("term_code"))
{
String termCode = "";
termCode = this.genericUtility.getColumnValue("term_code", dom);
if(termCode != null && termCode.trim().length() > 0 )
{
//Comment By Nasruddin [20-SEP-16]
//if(termCode != null && termCode.trim().length() > 0 )
//{
sql = "select count(*) from pur_term where term_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,termCode);
......@@ -143,8 +145,59 @@ public class PurTermTable extends ValidatorEJB implements PurTermTableLocal, Pur
rs = null;
pstmt.close();
pstmt = null;
//}
}
//Changed By Nasruddin Start [20-SEP-16]
else if(childNodeName.equalsIgnoreCase("term_table"))
{
termTable = this.genericUtility.getColumnValue("term_table", dom);
sql = "SELECT COUNT(1) FROM PUR_TERM_TABLE WHERE TERM_TABLE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,termTable);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0)
{
errCode = "VTITABL1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
if("A".equalsIgnoreCase(editFlag) && errCode == null || errCode.trim().length()==0)
{
termCode = this.genericUtility.getColumnValue("term_code", dom);
sql ="SELECT COUNT(1) FROM PUR_TERM_TABLE WHERE TERM_TABLE = ? AND TERM_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,termTable);
pstmt.setString(2, termCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt > 0)
{
errCode = "VTDUPENTRY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
}
//Changed By Nasruddin [20-SEP-16] END
}
//valueXmlString.append("</Detail1>");
//break;
......
......@@ -87,10 +87,12 @@ public class PurchaseTermsIC extends ValidatorEJB implements PurchaseTermsICRemo
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++) {
for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("term_code")){
if(childNodeName.equalsIgnoreCase("term_code"))
{
termCode= genericUtility.getColumnValue("term_code", dom);
termCode = termCode == null ? "" : termCode.trim();
System.out.println("termCode ::::" + termCode);
......@@ -98,7 +100,8 @@ public class PurchaseTermsIC extends ValidatorEJB implements PurchaseTermsICRemo
sql = "select key_flag from transetup where tran_window = 'w_pur_term' " ;
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next()){
if(rs.next())
{
keyFlag = rs.getString("key_flag");
}
......@@ -108,29 +111,36 @@ public class PurchaseTermsIC extends ValidatorEJB implements PurchaseTermsICRemo
if(keyFlag.isEmpty()){
keyFlag = "M";
}
if(termCode.isEmpty() && keyFlag.equalsIgnoreCase("M")){
if(termCode.isEmpty() && keyFlag.equalsIgnoreCase("M"))
{
errString = itmdbAccessEJB.getErrorString("term_code", "VTTERMNULL", userId);
return errString;
}else if(editFlag.equalsIgnoreCase("A")){
}
else if(editFlag.equalsIgnoreCase("A"))
{
int count = 0;
sql = "select count(*) as count from pur_term where term_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, termCode);
rs = pstmt.executeQuery();
if(rs.next()){
if(rs.next())
{
count = rs.getInt("count");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count > 0){
if(count > 0)
{
errString = itmdbAccessEJB.getErrorString("term_code", "VMDUPL1", userId);
return errString;
}
}
}
if(childNodeName.equalsIgnoreCase("descr")){
/* Comment By Nasruddin [20-SEP-16] START
if(childNodeName.equalsIgnoreCase("descr"))
{
descr = genericUtility.getColumnValue("descr", dom);
descr = descr == null ? "" : descr.trim();
System.out.println("Description :::" + descr);
......@@ -139,26 +149,35 @@ public class PurchaseTermsIC extends ValidatorEJB implements PurchaseTermsICRemo
return errString;
}
}
Comment By Nasruddin [20-SEP-16] END */
}
}
}catch(Exception e){
}catch(Exception e)
{
System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace();
}finally{
try{
if(rs != null){
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null){
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(conn != null){
if(conn != null)
{
conn.close();
conn = null;
}
}catch(Exception e1){
}
catch(Exception e1){
System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e1.getMessage());
e1.printStackTrace();
}
......
......@@ -80,55 +80,69 @@ public class SalesReturnReasonIC extends ValidatorEJB implements SalesReturnReas
currentFormNo = Integer.parseInt(objContext);
}
System.out.println("in wfValdata doc :::::");
switch (currentFormNo) {
switch (currentFormNo)
{
case 1:
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++) {
for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("reason_code")){
/* Comment By Nasruddin 21-SEP-16 START
if(childNodeName.equalsIgnoreCase("reason_code"))
{
reasonCode = genericUtility.getColumnValue("reason_code", dom);
reasonCode = reasonCode == null ? "" : reasonCode.trim();
System.out.println("reasonCode ::::" + reasonCode);
if(reasonCode.isEmpty()){
if(reasonCode.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("reason_code", "VTREABL", userId);
return errString;
}else if(editFlag.equalsIgnoreCase("A")){
}
else if(editFlag.equalsIgnoreCase("A"))
{
int count = 0;
sql = "select count(*) as count from SRETURN_REASON where reason_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, reasonCode);
rs = pstmt.executeQuery();
if(rs.next()){
if(rs.next())
{
count = rs.getInt("count");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count > 0){
if(count > 0)
{
errString = itmdbAccessEJB.getErrorString("reason_code", "VTREAINV", userId);
return errString;
}
}
}
if(childNodeName.equalsIgnoreCase("reason_descr")){
if(childNodeName.equalsIgnoreCase("reason_descr"))
{
descr = genericUtility.getColumnValue("reason_descr", dom);
descr = descr == null ? "" : descr.trim();
System.out.println("Description :::" + descr);
if(descr.trim().isEmpty()){
if(descr.trim().isEmpty())
{
errString = itmdbAccessEJB.getErrorString("reason_descr", "VMDESCR", userId);
return errString;
}
}
if(childNodeName.equalsIgnoreCase("restr_days")){
Comment By Nasruddin 21-SEP-16 END */
if(childNodeName.equalsIgnoreCase("restr_days"))
{
restrDays = genericUtility.getColumnValue("restr_days", dom);
restrDays = restrDays == null ? "" : restrDays.trim();
System.out.println("Restr Days" + restrDays);
if(restrDays.trim().isEmpty()){
if(restrDays.trim().isEmpty())
{
errString = itmdbAccessEJB.getErrorString("restr_days", "VTRESTBL", userId);
return errString;
}
......
......@@ -117,209 +117,213 @@ public class SchemeDefMaster extends ValidatorEJB implements
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeListLength; ctr++) {
for (ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if ("bom_code".equalsIgnoreCase(childNodeName)) {
bom_code = checkNull(genericUtility.getColumnValue(
"bom_code", curDom));
type = checkNull(genericUtility.getColumnValue("type",
curDom));
if (!type.equalsIgnoreCase("C")) {
if ("bom_code".equalsIgnoreCase(childNodeName))
{
bom_code = checkNull(genericUtility.getColumnValue("bom_code", curDom));
type = checkNull(genericUtility.getColumnValue("type",curDom));
if (!type.equalsIgnoreCase("C"))
{
sql = "Select Count(*) as COUNT from scheme_applicability where scheme_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, bom_code.trim());
rs = pstmt.executeQuery();
if (rs.next()) {
if (rs.next())
{
count = rs.getInt("COUNT");
}
if (count <= 0) {
callPstRs(pstmt, rs);
if (count <= 0)
{
errList.add("VMSCHEME1");
errFields.add(childNodeName.toLowerCase());
break;
}
}
if (editFlag.equalsIgnoreCase("A")) {
/*
if (editFlag.equalsIgnoreCase("A"))
{
count = 0;
sql = "Select Count(*) as COUNT from BOM where bom_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, bom_code.trim());
rs = pstmt.executeQuery();
if (rs.next()) {
if (rs.next())
{
count = rs.getInt("COUNT");
}
if (count >= 1) {
if (count >= 1)
{
errList.add("VPINVBMCD");
errFields.add(childNodeName.toLowerCase());
break;
}
}
callPstRs(pstmt, rs);
*/
}
else if ("batch_qty".equalsIgnoreCase(childNodeName)) {
else if ("batch_qty".equalsIgnoreCase(childNodeName))
{
scheme_flag = checkNull(genericUtility.getColumnValue(
"scheme_flag", curDom));
if (scheme_flag.isEmpty()) {
scheme_flag = checkNull(genericUtility.getColumnValue("scheme_flag", curDom));
/*Comment By Nasruddin [20-SEP16] Start
* if (scheme_flag.isEmpty())
{
scheme_flag = "Q";
}
if (!scheme_flag.equalsIgnoreCase("V")) {
batch_qty = checkNull(genericUtility
.getColumnValue("batch_qty", curDom));
}Comment By Nasruddin [20-SEP16] END */
if (!scheme_flag.equalsIgnoreCase("V"))
{
batch_qty = checkNull(genericUtility.getColumnValue("batch_qty", curDom));
Double batchQuantity;
if (batch_qty.isEmpty()) {
if (batch_qty.isEmpty())
{
batchQuantity = 0.0;
} else {
}
else
{
batchQuantity = Double.parseDouble(batch_qty);
}
if (batchQuantity == 0) {
if (batchQuantity == 0.0)
{
errList.add("VTBQTY");
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
else if ("batch_value".equalsIgnoreCase(childNodeName)) {
scheme_flag = checkNull(genericUtility.getColumnValue(
"scheme_flag", curDom));
else if ("batch_value".equalsIgnoreCase(childNodeName))
{
if (scheme_flag.isEmpty()) {
scheme_flag = checkNull(genericUtility.getColumnValue("scheme_flag", curDom));
/* Comment By Nasruddin [20-SEP16] Start
if (scheme_flag.isEmpty())
{
scheme_flag = "Q";
}
Comment By Nasruddin [20-SEP16] END */
System.out.println("scheme_flag in batch_value: "
+ scheme_flag);
if (scheme_flag.equalsIgnoreCase("V")) {
batch_value = checkNull(genericUtility
.getColumnValue("batch_value", curDom));
if (scheme_flag.equalsIgnoreCase("V"))
{
batch_value = checkNull(genericUtility.getColumnValue("batch_value", curDom));
Double batchValue;
if (batch_value.isEmpty()) {
if (batch_value.isEmpty())
{
batchValue = 0.0;
} else {
} else
{
batchValue = Double.parseDouble(batch_value);
}
System.out.println("batchValue in batch_value: "
+ batchValue);
if (batchValue == 0) {
if (batchValue == 0.0)
{
errList.add("VTBVALUE");
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
else if ("min_qty".equalsIgnoreCase(childNodeName))
{
else if ("min_qty".equalsIgnoreCase(childNodeName)) {
scheme_flag = checkNull(genericUtility.getColumnValue(
"scheme_flag", curDom));
if (scheme_flag.isEmpty()) {
scheme_flag = checkNull(genericUtility.getColumnValue("scheme_flag", curDom));
/* Comment By Nasruddin [20-SEP16] Start
if (scheme_flag.isEmpty())
{
scheme_flag = "Q";
}
if (!scheme_flag.equalsIgnoreCase("V")) {
batch_qty = checkNull(genericUtility
.getColumnValue("batch_qty", curDom));
min_qty = checkNull(genericUtility.getColumnValue(
"min_qty", curDom));
Comment By Nasruddin [20-SEP16] END */
if (!scheme_flag.equalsIgnoreCase("V"))
{
batch_qty = checkNull(genericUtility.getColumnValue("batch_qty", curDom));
min_qty = checkNull(genericUtility.getColumnValue("min_qty", curDom));
Double batchQuantity, minQuantity;
System.out.println("batch_qty in min_qty: "
+ batch_qty);
if (batch_qty.isEmpty()) {
System.out.println("batch_qty in min_qty: " + batch_qty);
if (batch_qty.isEmpty())
{
batchQuantity = 0.0;
} else {
}
else
{
batchQuantity = Double.parseDouble(batch_qty);
}
System.out
.println("min_qty in min_qty: " + min_qty);
if (min_qty.isEmpty()) {
System.out.println("min_qty in min_qty: " + min_qty);
if (min_qty.isEmpty())
{
minQuantity = 0.0;
} else {
} else
{
minQuantity = Double.parseDouble(min_qty);
}
System.out.println("batchQuantity: "
+ batchQuantity + "batch_qty: " + batch_qty
+ "in min_qty");
if ((batchQuantity > 0) && !(batch_qty.isEmpty())) {
if (minQuantity < batchQuantity) {
if ((batchQuantity > 0) && !(batch_qty.isEmpty()))
{
if (minQuantity < batchQuantity)
{
errList.add("VTMINQTY");
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
}
else if ("min_batch_value".equalsIgnoreCase(childNodeName))
{
else if ("min_batch_value".equalsIgnoreCase(childNodeName)) {
scheme_flag = checkNull(genericUtility.getColumnValue(
"scheme_flag", curDom));
batch_value = checkNull(genericUtility.getColumnValue(
"batch_value", curDom));
min_batch_value = checkNull(genericUtility
.getColumnValue("min_batch_value", curDom));
if (scheme_flag.isEmpty()) {
scheme_flag = checkNull(genericUtility.getColumnValue("scheme_flag", curDom));
batch_value = checkNull(genericUtility.getColumnValue("batch_value", curDom));
min_batch_value = checkNull(genericUtility.getColumnValue("min_batch_value", curDom));
/* Comment By Nasruddin [20-SEP16] Start
if (scheme_flag.isEmpty())
{
scheme_flag = "Q";
}
Comment By Nasruddin [20-SEP16] END*/
Double batchValue, minBatchValue;
if (batch_value.isEmpty()) {
if (batch_value.isEmpty())
{
batchValue = 0.0;
} else {
}
else
{
batchValue = Double.parseDouble(batch_value);
}
if (min_batch_value.isEmpty()) {
if (min_batch_value.isEmpty())
{
minBatchValue = 0.0;
} else {
}
else
{
minBatchValue = Double.parseDouble(min_batch_value);
}
System.out.println("scheme_flag in min_batch_value: "
+ scheme_flag);
System.out.println("scheme_flag in min_batch_value: "+ scheme_flag);
System.out.println("batchValue: " + batchValue
+ " batch_value: " + batch_value
+ " minBatchValue: " + minBatchValue);
if (scheme_flag.equalsIgnoreCase("V")) {
if ((batchValue > 0) && !(batch_value.isEmpty())) {
if (scheme_flag.equalsIgnoreCase("V"))
{
if ((batchValue > 0) && !(batch_value.isEmpty()))
{
System.out.println("Inside (batchValue>0)");
if (minBatchValue < batchValue) {
if (minBatchValue < batchValue)
{
System.out
.println("Inside minBatchValue<batchValue");
errList.add("VTMINVALUE");
......@@ -330,7 +334,6 @@ public class SchemeDefMaster extends ValidatorEJB implements
}
}
}
break;
......@@ -349,25 +352,25 @@ public class SchemeDefMaster extends ValidatorEJB implements
qty_per = "",
app_max_qty = "";
for (ctr = 0; ctr < childNodeListLength; ctr++) {
for (ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if ("valid_upto".equalsIgnoreCase(childNodeName)) {
valid_upto = checkNull(genericUtility.getColumnValue(
"valid_upto", curDom));
if ("valid_upto".equalsIgnoreCase(childNodeName))
{
eff_from = checkNull(genericUtility.getColumnValue(
"eff_from", curDom));
valid_upto = checkNull(genericUtility.getColumnValue("valid_upto", curDom));
eff_from = checkNull(genericUtility.getColumnValue("eff_from", curDom));
SimpleDateFormat sdf = new SimpleDateFormat(
genericUtility.getApplDateFormat());
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
if (!(valid_upto.isEmpty()) || !(eff_from.isEmpty())) {
if (!(valid_upto.isEmpty()) || !(eff_from.isEmpty()))
{
Date validUpto = sdf.parse(valid_upto);
Date effFrom = sdf.parse(eff_from);
if (effFrom.after(validUpto)) {
if (effFrom.after(validUpto))
{
errList.add("VMVAL_UPTO");
errFields.add(childNodeName.toLowerCase());
break;
......@@ -376,95 +379,109 @@ public class SchemeDefMaster extends ValidatorEJB implements
}
if ("item_code".equalsIgnoreCase(childNodeName)) {
item_code = checkNull(genericUtility.getColumnValue(
"item_code", curDom));
header_item_code = checkNull(genericUtility
.getColumnValue("item_code", hdrDom));
if ("item_code".equalsIgnoreCase(childNodeName))
{
item_code = checkNull(genericUtility.getColumnValue("item_code", curDom));
header_item_code = checkNull(genericUtility.getColumnValue("item_code", hdrDom));
sql = "Select Count(*) as COUNT from item where item_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, item_code.trim());
rs = pstmt.executeQuery();
if (rs.next()) {
if (rs.next())
{
count = rs.getInt("COUNT");
}
if (count <= 0) {
if (count <= 0)
{
errList.add("VMITEM_CD");
errFields.add(childNodeName.toLowerCase());
break;
} else {
}
else
{
String active = "";
sql = "select active as ACTIVE from item where item_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, item_code.trim());
rs = pstmt.executeQuery();
if (rs.next()) {
if (rs.next())
{
active = rs.getString("ACTIVE");
}
if (!active.equalsIgnoreCase("Y")) {
if (!active.equalsIgnoreCase("Y"))
{
errList.add("VTITEM4");
errFields.add(childNodeName.toLowerCase());
break;
} else {
System.out.println("header_item_code: "
+ header_item_code);
}
else
{
System.out.println("header_item_code: " + header_item_code);
String item_ser_header = "", item_ser_detail = "", oth_series = "";
if (!header_item_code.isEmpty()) {
if (!header_item_code.isEmpty())
{
sql = "select item_ser from ITEMSER_CHANGE where item_code = ? and valid_upto is null";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, header_item_code.trim());
rs = pstmt.executeQuery();
if (rs.next()) {
item_ser_header = rs
.getString("item_ser");
if (rs.next())
{
item_ser_header = rs.getString("item_ser");
}
// Changed By Nasruddin 20-SEP-16 START
callPstRs(pstmt, rs);
if(!item_ser_header.isEmpty())
{
sql = "select item_ser from Item where item_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, header_item_code.trim());
rs = pstmt.executeQuery();
if (rs.next())
{
item_ser_header = rs.getString("item_ser");
}
callPstRs(pstmt, rs);
}
// Changed By Nasruddin 20-SEP-16 END
sql = "select item_ser from ITEMSER_CHANGE where item_code = ? and valid_upto is null";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, item_code.trim());
rs = pstmt.executeQuery();
if (rs.next())
{
item_ser_detail = rs.getString("item_ser");
}
// Changed By Nasruddin 20-SEP-16 START
callPstRs(pstmt, rs);
if(!item_ser_detail.isEmpty())
{
sql = "select item_ser from Item where item_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, item_code.trim());
rs = pstmt.executeQuery();
if (rs.next())
{
item_ser_header = rs.getString("item_ser");
}
if (rs.next()) {
item_ser_detail = rs
.getString("item_ser");
callPstRs(pstmt, rs);
}
sql = "select oth_series from itemser where item_ser = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, item_ser_header.trim());
rs = pstmt.executeQuery();
if (rs.next()) {
oth_series = rs.getString("oth_series");
}
callPstRs(pstmt, rs);
if (oth_series.isEmpty()) {
// Changed By Nasruddin 20-SEP-16 END
if (oth_series.isEmpty())
{
oth_series = "N";
}
......@@ -474,13 +491,10 @@ public class SchemeDefMaster extends ValidatorEJB implements
+ item_ser_detail + " oth_series: "
+ oth_series);
if (!(item_ser_header.trim()
.equalsIgnoreCase(item_ser_detail))
&& (oth_series
.equalsIgnoreCase("N"))) {
if (!(item_ser_header.trim().equalsIgnoreCase(item_ser_detail)) && (oth_series.equalsIgnoreCase("N")))
{
errList.add("VTITEM2");
errFields.add(childNodeName
.toLowerCase());
errFields.add(childNodeName.toLowerCase());
break;
}
}
......@@ -491,16 +505,14 @@ public class SchemeDefMaster extends ValidatorEJB implements
if ("qty_per".equalsIgnoreCase(childNodeName)) {
qty_per = checkNull(genericUtility.getColumnValue(
"qty_per", curDom));
scheme_flag = checkNull(genericUtility.getColumnValue(
"scheme_flag", hdrDom));
qty_per = checkNull(genericUtility.getColumnValue("qty_per", curDom));
scheme_flag = checkNull(genericUtility.getColumnValue("scheme_flag", hdrDom));
if (!(scheme_flag.equalsIgnoreCase("V"))) {
if (!(scheme_flag.equalsIgnoreCase("V")))
{
int qtyPer = Integer.parseInt(qty_per);
if ((qty_per.isEmpty()) || (qtyPer == 0)) {
if ((qty_per.isEmpty()) || (qtyPer == 0))
{
errList.add("VTQTY");
errFields.add(childNodeName.toLowerCase());
break;
......@@ -511,14 +523,9 @@ public class SchemeDefMaster extends ValidatorEJB implements
if ("app_max_qty".equalsIgnoreCase(childNodeName)) {
app_max_qty = checkNull(genericUtility.getColumnValue(
"app_max_qty", curDom));
app_min_qty = checkNull(genericUtility.getColumnValue(
"app_min_qty", curDom));
scheme_flag = checkNull(genericUtility.getColumnValue(
"scheme_flag", hdrDom));
app_max_qty = checkNull(genericUtility.getColumnValue("app_max_qty", curDom));
app_min_qty = checkNull(genericUtility.getColumnValue("app_min_qty", curDom));
scheme_flag = checkNull(genericUtility.getColumnValue("scheme_flag", hdrDom));
int appMaxQty = Integer.parseInt(app_max_qty);
int appMinQty = Integer.parseInt(app_min_qty);
......
......@@ -137,16 +137,48 @@ public class SiteCustomer extends ValidatorEJB implements SiteCustomerLocal,Site
{
count = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count == 0)
{
errCode = "VMCUST1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
// Changed By Nasruddin START [22-SEP-16]
else
{
if("A".equals(editFlag) && errCode.trim().length() == 0)
{
custCode = genericUtility.getColumnValue("cust_code", dom);
siteCode = genericUtility.getColumnValue("site_code", dom);
sql = "SELECT COUNT(1) FROM SITE_CUSTOMER WHERE SITE_CODE = ? AND CUST_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count > 0)
{
errCode = "VMPMKY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
// Changed By Nasruddin END [22-SEP-16]
}
else if(childNodeName.equalsIgnoreCase("terr_code"))
{
......@@ -411,7 +443,6 @@ public class SiteCustomer extends ValidatorEJB implements SiteCustomerLocal,Site
}
}// End of try
catch(Exception e)
{
e.printStackTrace();
......
......@@ -10,6 +10,7 @@
package ibase.webitm.ejb.dis;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.util.*;
......@@ -118,6 +119,7 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
String isFaciLocCode = "", isFaciSiteCode = "", lockGroup = "";
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
Connection conn = null;
......@@ -132,6 +134,7 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
ResultSet rs4 = null;
ResultSet rs5 = null;
ConnDriver connDriver = new ConnDriver();
FinCommon finCommon = new FinCommon(); // Changed By Nasruddin [20-SEP-16]
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try
{
......@@ -151,19 +154,28 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
if(childNodeName.equalsIgnoreCase("item_code"))
{
itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
/*
* Comment By Nasruddin [20-SEP-16] START
if(itemCode == null || itemCode.trim().length() == 0)
{
errCode = "VMITEMCD1 ";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else if(itemCode != null && itemCode.trim().length() > 0)
Comment By Nasruddin [20-SEP-16] END
*/
if(itemCode != null && itemCode.trim().length() > 0)
{
if(editFlag.equalsIgnoreCase("A"))
{
sql = "select count(*) from siteitem where item_code = ?";
// Changed By Nasruddin [20-SEP-16]
siteCode = genericUtility.getColumnValue("site_code", dom);
//sql = "select count(*) from siteitem where item_code = ?";
sql = "select count(1) from siteitem where item_code = ? and site_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
pstmt.setString(2, siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -175,7 +187,7 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
pstmt = null;
if(count > 0)
{
errCode = "VMITEMDK ";
errCode = "VMDUPL1 ";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
......@@ -230,13 +242,16 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
else if(childNodeName.equalsIgnoreCase("item_ser"))
{
itemSer = checkNull(genericUtility.getColumnValue("item_ser", dom));
/*
* Comment By Nasruddin [20-SEP-16] START
if(itemSer == null || itemSer.trim().length() == 0)
{
errCode = "VMITMSERBK";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else if(itemSer != null && itemSer.trim().length() > 0)
Comment By Nasruddin [20-SEP-16] END*/
if(itemSer != null && itemSer.trim().length() > 0)
{
//errcode = nvo_dis.gbf_itemser(mval,transer)
sql = "select count(*) from itemser where item_ser = ?";
......@@ -266,7 +281,8 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
siteCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"));
if(empCodePln != null && empCodePln.trim().length() > 0)
{
//errcode = nvo_dis.gbf_employee(mval1,mval,transer)
// Comment By Nasruddin Start 20-SEP-16
/*errcode = nvo_dis.gbf_employee(mval1,mval,transer)
sql = "select count(*) from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCodePln);
......@@ -285,6 +301,15 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
rs = null;
pstmt.close();
pstmt = null;
Comment By Nasruddin 20-SEP-16 END
*/
errCode = finCommon.isEmployee(siteCode, empCodePln, "", conn);
if (errCode != null && errCode.trim().length() > 0)
{
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("emp_code__iapr"))
......@@ -293,7 +318,9 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
siteCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"));
if(empCodeApr != null && empCodeApr.trim().length() > 0)
{
//errcode = nvo_dis.gbf_employee(mval1,mval,transer)
/*
* Comment By Nasruddin Start 20-SEP-16
errcode = nvo_dis.gbf_employee(mval1,mval,transer)
sql = "select count(*) from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCodeApr);
......@@ -312,8 +339,17 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
rs = null;
pstmt.close();
pstmt = null;
Comment By Nasruddin 20-SEP-16 END
*/
errCode = finCommon.isEmployee(siteCode, empCodeApr, "", conn);
if (errCode != null && errCode.trim().length() > 0)
{
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
/* Comment by Nasruddin [20-SEP-16] Start
else if(childNodeName.equalsIgnoreCase("emp_code__pur"))
{
empCodePur = checkNull(genericUtility.getColumnValue("emp_code__pur", dom));
......@@ -340,6 +376,7 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
pstmt = null;
}
}
Comment by Nasruddin [20-SEP-16] End */
else if(childNodeName.equalsIgnoreCase("supp_code__pref"))
{
supplierCodePref = checkNull(genericUtility.getColumnValue("supp_code__pref", dom));
......@@ -655,14 +692,15 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
suppilerSour = checkNull(genericUtility.getColumnValue("supp_sour", dom));
if(suppilerSour != null && suppilerSour.equalsIgnoreCase("P"))
{
if(purLeadTime == 0)
if(purLeadTime <= 0)
{
errCode = "VTLIDGRZR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
if(suppilerSour != null && suppilerSour.equalsIgnoreCase("M"))
/* Comment by nASRUDDIN [20-sep-16] start
* if(suppilerSour != null && suppilerSour.equalsIgnoreCase("M"))
{
if(purLeadTime < 0)
{
......@@ -670,7 +708,7 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}Comment by nASRUDDIN [20-sep-16] end*/
}
else if(childNodeName.equalsIgnoreCase("appr_supp"))
{
......@@ -854,14 +892,16 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
siteCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"));
if(locCodeAprv != null && locCodeAprv.trim().length() > 0)
{
sql = "select case when available is null then 'Y' else available end from invstat , location where invstat.inv_stat = location.inv_stat and location.loc_code = ?";
// Changed By Nasruddin [21-SEP-16] STARt
//sql = "select case when available is null then 'Y' else available end from invstat , location where invstat.inv_stat = location.inv_stat and location.loc_code = ?";
sql="select case when a.available is null then 'Y' else a.available end, b.facility_code from invstat a , location b WHERE A.INV_STAT = B.INV_STAT and b.loc_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,locCodeAprv);
rs = pstmt.executeQuery();
if(rs.next())
{
avail = checkNull(rs.getString(1));
isFaciLocCode = checkNull(rs.getString(2));
}
if(avail != null && avail.equalsIgnoreCase("N"))
{
......@@ -873,6 +913,33 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
rs = null;
pstmt.close();
pstmt = null;
if(errCode == null || errCode.trim().length() == 0)
{
sql = "select FACILITY_CODE from SITE where SITE_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
isFaciSiteCode = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(isFaciLocCode != null && isFaciLocCode.trim().length() > 0 && isFaciSiteCode != null && isFaciSiteCode.trim().length() > 0)
{
if(!(isFaciLocCode).equalsIgnoreCase(isFaciLocCode))
{
errCode = "VMFACI2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
// Changed By Nasruddin [21-SEP-16] END
}
}
else if(childNodeName.equalsIgnoreCase("loc_code__rej"))
......@@ -882,13 +949,16 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
siteCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"));
if(locCodeRej != null && locCodeRej.trim().length() > 0)
{
sql = "select case when available is null then 'N' else available end from invstat,location where invstat.inv_stat = location.inv_stat and location.loc_code =?";
// Changed By Nasruddin [21-SEP-16] STARt
//sql = "select case when available is null then 'N' else available end from invstat,location where invstat.inv_stat = location.inv_stat and location.loc_code =?";
sql="select case when a.available is null then 'N' else a.available end, b.facility_code from invstat a , location b WHERE A.INV_STAT = B.INV_STAT and b.loc_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,locCodeRej);
rs = pstmt.executeQuery();
if(rs.next())
{
avail = checkNull(rs.getString(1));
isFaciLocCode = checkNull(rs.getString(2));
if(avail.equalsIgnoreCase("Y"))
{
errCode = "VMLOCREJ";
......@@ -900,6 +970,33 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
rs = null;
pstmt.close();
pstmt = null;
if(errCode == null || errCode.trim().length() == 0)
{
sql = "select FACILITY_CODE from SITE where SITE_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
isFaciSiteCode = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(isFaciLocCode != null && isFaciLocCode.trim().length() > 0 && isFaciSiteCode != null && isFaciSiteCode.trim().length() > 0)
{
if(!(isFaciLocCode).equalsIgnoreCase(isFaciLocCode))
{
errCode = "VMFACI2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
// Changed By Nasruddin [21-SEP-16] END
}
}
else if(childNodeName.equalsIgnoreCase("loc_code__insp"))
......@@ -909,13 +1006,16 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
siteCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"));
if(locCodeInsp != null && locCodeInsp.trim().length() > 0)
{
sql = "select (case when available is null then 'N' else available end) from invstat,location where invstat.inv_stat = location.inv_stat and location.loc_code = ?";
// Changed By Nasruddin [21-SEP-16] STARt
//sql = "select (case when available is null then 'N' else available end) from invstat,location where invstat.inv_stat = location.inv_stat and location.loc_code = ?";
sql="select case when a.available is null then 'N' else a.available end, b.facility_code from invstat a , location b WHERE A.INV_STAT = B.INV_STAT and b.loc_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,locCodeInsp);
rs = pstmt.executeQuery();
if(rs.next())
{
avail = rs.getString(1);
isFaciLocCode = rs.getString(2);
if(avail.equalsIgnoreCase("Y"))
{
errCode = "VMLOCINSP";
......@@ -927,6 +1027,32 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
rs = null;
pstmt.close();
pstmt = null;
if(errCode == null || errCode.trim().length() == 0)
{
sql = "select FACILITY_CODE from SITE where SITE_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
isFaciSiteCode = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(isFaciLocCode != null && isFaciLocCode.trim().length() > 0 && isFaciSiteCode != null && isFaciSiteCode.trim().length() > 0)
{
if(!(isFaciLocCode).equalsIgnoreCase(isFaciLocCode))
{
errCode = "VMFACI2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
// Changed By Nasruddin [21-SEP-16] END
}
}
else if(childNodeName.equalsIgnoreCase("qc_reqd"))
......@@ -1123,6 +1249,7 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
pstmt = null;
}
}
/* Changed By Nasruddin Start [21-SEP-16] Start
else if(childNodeName.equalsIgnoreCase("tax_chap"))
{
taxChap = checkNull(genericUtility.getColumnValue("tax_chap", dom));
......@@ -1173,7 +1300,33 @@ public class SiteItemIC extends ValidatorEJB implements SiteItemICLocal, SiteIte
pstmt.close();
pstmt = null;
}
}*/
else if(childNodeName.equalsIgnoreCase("lock_group"))
{
lockGroup = checkNull(genericUtility.getColumnValue("lock_group", dom));
if(lockGroup != null && lockGroup.trim().length() > 0)
{
sql = "SELECT COUNT(1) FROM LOCK_GROUP WHERE LOCK_GROUP = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,lockGroup);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
if(cnt == 0)
{
errCode = "VTLOCGRP";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
//Changed By Nasruddin 21-SEP-16 END
}
int errListSize = errList.size();
......
......@@ -64,14 +64,14 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
String siteCodeCh = "";
String siteCodePay = "";
String crmTerm = "";
String taxClass = "";
String taxClass = "", lockGroup = "";
String taxEnv = "";
String childNodeName = null;
String errString = "";
String errCode = "";
String userId = "";
String sql = "";
String errorType = "";
String errorType = "", currCode = "";
int cnt = 0;
int ctr=0;
int childNodeListLength;
......@@ -155,11 +155,11 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
}
else if(childNodeName.equalsIgnoreCase("site_code__ch"))
{
//channelPartner = checkNull(genericUtility.getColumnValue("channel_partner", dom));
channelPartner = checkNull(genericUtility.getColumnValue("channel_partner", dom));
siteCodeCh = checkNull(genericUtility.getColumnValue("site_code__ch", dom));
System.out.println("siteCodeCh"+siteCodeCh);
/*if(channelPartner != null && channelPartner.equalsIgnoreCase("Y"))
// Changed By nasruddin 22-SEP-16 START
if(channelPartner != null && channelPartner.equalsIgnoreCase("Y"))
{
if(siteCodeCh == null || siteCodeCh.trim().length() < 0)
{
......@@ -167,7 +167,8 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}*/
}
/*
if(siteCodeCh != null && siteCodeCh.trim().length() > 0)
{
sql = "SELECT COUNT(*) FROM site where site_code = ?";
......@@ -189,6 +190,7 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
pstmt.close();
pstmt = null;
}
Changed by Nasruddin 22-SEP-16 END*/
}
else if(childNodeName.equalsIgnoreCase("site_code__pay"))
{
......@@ -218,7 +220,8 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
pstmt = null;
}
}
/*else if(childNodeName.equalsIgnoreCase("curr_code"))
// Changed By Nasruddin START 22-SEP-16
else if(childNodeName.equalsIgnoreCase("curr_code"))
{
currCode = checkNull(genericUtility.getColumnValue("curr_code", dom));
if(currCode != null && currCode.trim().length() > 0)
......@@ -242,7 +245,7 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
pstmt.close();
pstmt = null;
}
}*/
}/*Changed By Nasruddin END 22-SEP-16 START
else if(childNodeName.equalsIgnoreCase("cr_term"))
{
crmTerm = checkNull(genericUtility.getColumnValue("cr_term", dom));
......@@ -269,6 +272,7 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
pstmt = null;
}
}
else if(childNodeName.equalsIgnoreCase("tax_class"))
{
taxClass = checkNull(genericUtility.getColumnValue("tax_class", dom));
......@@ -321,6 +325,39 @@ public class SiteSupplierIC extends ValidatorEJB implements SiteSupplierICLocal,
pstmt = null;
}
}
*/
//Changed By Nasruddin 22-SEP-16 START
else if(childNodeName.equalsIgnoreCase("lock_group"))
{
lockGroup = genericUtility.getColumnValue("lock_group", dom);
if(lockGroup != null && lockGroup.trim().length() > 0)
{
cnt = 0;
sql = "SELECT COUNT(1) FROM LOCK_GROUP Where LOCK_GROUP = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lockGroup);
rs = pstmt.executeQuery();
if( rs.next() )
{
cnt = rs.getInt(1);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
if( cnt == 0 )
{
errCode = "VMLOCKCODE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
//Changed By Nasruddin 22-SEP-16 END
}
......
......@@ -3,6 +3,8 @@ package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
......@@ -66,7 +68,12 @@ ITMDBAccessEJB itmdbAccessEJB = new ITMDBAccessEJB();
Node parentNode = null, childNode = null;
String childNodeName = "",userId = "";
int currentFormNo = 0, childNodeLength = 0, ctr = 0;
// Changed By Nasruddin Start 21-SEp-16
String sql= "";
PreparedStatement pstmt = null;
ResultSet rs = null;
int count = 0 ;
// Changed By Nasruddin 21-SEp-16 END
try {
System.out.println("::in wfvalData doc::");
ConnDriver con = new ConnDriver();
......@@ -78,43 +85,109 @@ ITMDBAccessEJB itmdbAccessEJB = new ITMDBAccessEJB();
if(objContext != null && objContext.trim().length() > 0){
currentFormNo = Integer.parseInt(objContext);
}
switch(currentFormNo){
switch(currentFormNo)
{
case 1:
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for(ctr = 0;ctr<childNodeLength;ctr++){
for(ctr = 0;ctr<childNodeLength;ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("spec_ref")){
if(childNodeName.equalsIgnoreCase("spec_ref"))
{
specRef = genericUtility.getColumnValue("spec_ref", dom);
specRef = specRef == null ? "" : specRef.trim();
System.out.println(":::specification ref" + specRef);
if(specRef.isEmpty()){
if(specRef.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("spec_ref", "VTSPECREF", userId);
return errString;
}
}
if(childNodeName.equalsIgnoreCase("spec_code")){
if(childNodeName.equalsIgnoreCase("spec_code"))
{
specCode = genericUtility.getColumnValue("spec_code", dom);
specCode = specCode == null ? "" : specCode.trim();
System.out.println(":::specification code" + specCode);
if(specCode.isEmpty()){
errString = itmdbAccessEJB.getErrorString("spec_code", "VTSPECCODE", userId);
if(specCode.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("spec_code", "VMCODNULL", userId);
return errString;
}
// Changed By Nasruddin 21-SEP-16 Start
else
{
if("A".equals(editFlag))
{
sql = "SELECT COUNT(1) FROM SPECIFICATION WHERE SPEC_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, specCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt(1);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
}
if( count > 0)
{
errString = itmdbAccessEJB.getErrorString("spec_code", "VMPMKY", userId);
return errString;
}
}
// Changed By Nasruddin 21-SEP-16 END
}
}
if(conn != null) {
}
/* Comment By Nasruddin 21-SEP-16 START
if(conn != null)
{
conn.close();
conn = null;
}
} catch (Exception e) {
Comment By Nasruddin 21-SEP-16 END */
}
catch (Exception e)
{
System.out.println("::::" + this.getClass().getSimpleName() + "::::" + e.getMessage());
e.printStackTrace();
}
//Changed By Nasruddin 21-SEP-16 STart
finally
{
try
{
if(conn != null)
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
}
conn = null;
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
//Changed By Nasruddin 21-SEP-16 END
return errString;
}
}
......@@ -123,6 +123,7 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal,
if( childNodeName.equalsIgnoreCase("days_from") && "A".equals(editFlag) )
{
String daysFrom = checkNull(genericUtility.getColumnValue("days_from", dom));
/* Comment By Nasruddin 21-SEP-16 Start
String daysTo = checkNull(genericUtility.getColumnValue("days_to", dom));
String deductPerc = checkNull(genericUtility.getColumnValue("deduct_perc", dom));
if(daysFrom.trim().length() <= 0)
......@@ -156,7 +157,8 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal,
errFields.add(childNodeName.toLowerCase());
}
else
{
{*/
count2 = 0;
sql = " select count(*) from sreturn_norms where days_from <= ? and days_to >= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setInt(1,Integer.parseInt(daysFrom));
......@@ -176,13 +178,14 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal,
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
//} Comment By Nasruddin 21-SEP-16 END
}
if(childNodeName.equalsIgnoreCase("days_to ") && "A".equals(editFlag) )
{
String daysTo = checkNull(genericUtility.getColumnValue("days_to", dom));
String daysFrom = checkNull(genericUtility.getColumnValue("days_from", dom));
/* Comment By Nasruddin 21-SEP-16 START
String deductPerc = checkNull(genericUtility.getColumnValue("deduct_perc", dom));
if(daysTo.trim().length() <= 0)
{
......@@ -208,7 +211,8 @@ public class SreturnNormsIC extends ValidatorEJB implements SreturnNormsICLocal,
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else if (Integer.parseInt(daysTo) < Integer.parseInt(daysFrom))
Comment By Nasruddin 21-SEP-16 END */
if (Integer.parseInt(daysTo) < Integer.parseInt(daysFrom))
{
errCode = "VMNORMS01";
errList.add(errCode);
......
......@@ -85,6 +85,7 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
ConnDriver connDriver = new ConnDriver();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
System.out.println("Station Val Start");
String modName = "w_station" , keyFlag = ""; // Changed By Nasruddin 21-SEP-16
try
{
//Changes and Commented By Bhushan on 09-06-2016 :START
......@@ -104,14 +105,17 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
if(childNodeName.equalsIgnoreCase("state_code"))
{
stateCode = checkNull(genericUtility.getColumnValue("state_code", dom));
System.out.println("State code="+stateCode);
/* Comment By Nasruddin 21-SEP-16 START
if(stateCode == null || stateCode.trim().length() == 0)
{
errCode = "VMSTATCD2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else if(stateCode != null && stateCode.trim().length() > 0)
Comment By Nasruddin 21-SEP-16 END */
if(stateCode != null && stateCode.trim().length() > 0)
{
sql = "select count(*) from state where state_code = ?";
pstmt = conn.prepareStatement(sql);
......@@ -143,6 +147,25 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
//errList.add(errCode);
//errFields.add(childNodeName.toLowerCase());
//}
// Changed By Nasruddin 21-SEP-16 START
sql = "SELECT KEY_FLAG FROM TRANSETUP WHERE TRAN_WINDOW = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, modName);
rs = pstmt.executeQuery();
if( rs.next() )
{
keyFlag = rs.getString("KEY_FLAG");
}
keyFlag = keyFlag == null ? "M" : keyFlag.trim();
if( keyFlag == "M" && stanCode == null || stanCode.trim().length() == 0)
{
errCode = "VMSTAN1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
if(editFlag.equalsIgnoreCase("A"))
{
sql = "select count(*) from station where stan_code = ?";
......@@ -157,7 +180,7 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
}
if(count > 0)
{
errCode = "VMSTNDP";
errCode = "VMDUPL1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
......@@ -167,6 +190,8 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
pstmt = null;
}
}
}
/* Comment BY Nasruddin 21-sep-16 start
else if(childNodeName.equalsIgnoreCase("descr"))
{
desc = checkNull(genericUtility.getColumnValue("descr", dom));
......@@ -177,17 +202,22 @@ public class StationIC extends ValidatorEJB implements StationICLocal, StationIC
errFields.add(childNodeName.toLowerCase());
}
}
Comment BY Nasruddin 21-sep-16 end */
else if(childNodeName.equalsIgnoreCase("bank_code"))
{
bankCode = checkNull(genericUtility.getColumnValue("bank_code", dom));
System.out.println("bank code="+bankCode);
/* Comment BY Nasruddin 21-sep-16 start
if(bankCode == null || bankCode.trim().length() == 0)
{
errCode = "VMBANK1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else if(bankCode != null && bankCode.trim().length() > 0)
Comment BY Nasruddin 21-sep-16 end */
if(bankCode != null && bankCode.trim().length() > 0)
{
sql = "select count(*) from bank where bank_code = ?";
pstmt = conn.prepareStatement(sql);
......
......@@ -102,6 +102,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
int currentFormNo = 0;
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
String commTable = "";
String labOurInvolved = "", pfRegNo = "", lwfNo = "", pTaxNo = "", eciNo = "",esicRegNo = "", ssi = "", msmeRegDate = "", msmeRegNo = "", msmeType = "";//Changed By Nasruddin 21-SEp-16
try
{
SimpleDateFormat sdf1= new SimpleDateFormat(genericUtility.getDBDateFormat());
......@@ -199,12 +200,69 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}/*
Changed By Nasruddin 21-SEP-16 STARt
else if(childNodeName.equalsIgnoreCase("supp_code__pay"))
{
System.out.println(">>>>>>>>>>>supp_code__pay validation:");
payTo = genericUtility.getColumnValue("supp_code__pay", dom);
suppCode = genericUtility.getColumnValue("supp_code", dom);
keyFlag = findValue(conn, "key_flag", "transetup", "tran_window", "w_supplier");
if(!("A".equalsIgnoreCase(keyFlag)) && (payTo == null || payTo.trim().length() == 0))
{
errCode = "VEPAYTO";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else if(!(payTo.equals(suppCode)))
{
existFlag = isExist("supplier", "supp_code", payTo, conn);
if ("FALSE".equals(existFlag))
{
errCode = "VMPAYTO";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}*/
else if(childNodeName.equalsIgnoreCase("supp_code__pay"))
{
System.out.println(">>>>>>>>>>>supp_code__pay validation:");
payTo = genericUtility.getColumnValue("supp_code__pay", dom);
suppCode = genericUtility.getColumnValue("supp_code", dom);
if(payTo != null && payTo.trim().length() > 0)
{
if(!(suppCode).equalsIgnoreCase(payTo))
{
count = 0;
sql = "SELECT COUNT(1) FROM SUPPLIER WHERE SUPP_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, payTo);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt(1);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
if (count == 0)
{
errCode = "VMCODPAY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
}
else if(childNodeName.equalsIgnoreCase("pay_to"))
{
System.out.println(">>>>>>>>>>pay_to validation:");
payTo = genericUtility.getColumnValue("pay_to", dom);
suppCode = genericUtility.getColumnValue("supp_code", dom);
keyFlag = findValue(conn, "key_flag", "transetup", "tran_window", "w_supplier");
if(!("A".equalsIgnoreCase(keyFlag)) && (payTo == null || payTo.trim().length() == 0))
{
......@@ -223,17 +281,21 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
}
}
}
//Changed By Nasruddin 21-SEP-16 END
else if(childNodeName.equalsIgnoreCase("curr_code"))
{
currCode =genericUtility.getColumnValue("curr_code", dom);
if(currCode== null || currCode.trim().length() == 0)
/* Comment BY Nasruddin 21-SEP-16 START
* if(currCode== null || currCode.trim().length() == 0)
{
errCode = "VMNULLCURN";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
{Comment BY Nasruddin 21-SEP-16 END
*/
existFlag = isExist("currency", "curr_code", currCode, conn);
if ("FALSE".equals(existFlag))
{
......@@ -271,7 +333,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
}
}
}
}
//}
}
else if(childNodeName.equalsIgnoreCase("stan_code"))
{
......@@ -286,12 +348,14 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
errFields.add(childNodeName.toLowerCase());
}
}
/* Comment BY Nasruddin 21_sep-16 STARt
else
{
errCode = "VMSTANCOD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
Comment BY Nasruddin 21_sep-16 END*/
}
else if(childNodeName.equalsIgnoreCase("cr_term"))
......@@ -443,6 +507,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
}
}
}
/* Comment By Nasruddin 21-SEP-16 START
else if(childNodeName.equalsIgnoreCase("site_code__pay"))
{
siteCodePay = genericUtility.getColumnValue("site_code__pay", dom);
......@@ -456,7 +521,8 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
errFields.add(childNodeName.toLowerCase());
}
}
}
}Comment By Nasruddin 21-SEP-16 END
*/
else if(childNodeName.equalsIgnoreCase("dlv_term"))
{
dlvTerm = genericUtility.getColumnValue("dlv_term", dom);
......@@ -485,6 +551,8 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
}
}
}
/* Comment By Nasruddin 21-SEp-16 START
*
else if(childNodeName.equalsIgnoreCase("tran_code"))
{
tranCode = genericUtility.getColumnValue("tran_code", dom);
......@@ -499,6 +567,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
}
}
}
else if(childNodeName.equalsIgnoreCase("tax_env"))
{
taxEnv = genericUtility.getColumnValue("tax_env", dom);
......@@ -526,9 +595,10 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
errFields.add(childNodeName.toLowerCase());
}
}
}
}Comment By Nasruddin 21-SEp-16 end*/
//Changed By Nasruddin khan [19/JUL/16] START
else if( childNodeName.equalsIgnoreCase("comm_table")){
else if( childNodeName.equalsIgnoreCase("comm_table"))
{
commTable = checkNull(this.genericUtility.getColumnValue("comm_table", dom));
......@@ -556,6 +626,121 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
}
}//Changed By Nasruddin khan [19/JUL/16] END
// Changed By Nasruddin Start 21-SEP-16 START
else if(childNodeName.equalsIgnoreCase("pf_reg_no"))
{
labOurInvolved = genericUtility.getColumnValue("labour_involved", dom);
if("Y".equals(labOurInvolved))
{
pfRegNo = genericUtility.getColumnValue("pf_reg_no", dom);
if(pfRegNo == null || pfRegNo.trim().length() == 0 )
{
errCode = "VMSUPHRD01";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("esic_reg_no"))
{
labOurInvolved = genericUtility.getColumnValue("labour_involved", dom);
if("Y".equals(labOurInvolved))
{
esicRegNo = genericUtility.getColumnValue("esic_reg_no", dom);
if(esicRegNo == null || esicRegNo.trim().length() == 0 )
{
errCode = "VMSUPHRD02";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("eci_no"))
{
labOurInvolved = genericUtility.getColumnValue("labour_involved", dom);
if("Y".equals(labOurInvolved))
{
eciNo = genericUtility.getColumnValue("eci_no", dom);
if(eciNo == null || eciNo.trim().length() == 0 )
{
errCode = "VMSUPHRD03";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("ptax_no"))
{
labOurInvolved = genericUtility.getColumnValue("labour_involved", dom);
if("Y".equals(labOurInvolved))
{
pTaxNo = genericUtility.getColumnValue("ptax_no", dom);
if(pTaxNo == null || pTaxNo.trim().length() == 0 )
{
errCode = "VMSUPHRD04";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("lwf_no"))
{
labOurInvolved = genericUtility.getColumnValue("labour_involved", dom);
if("Y".equals(labOurInvolved))
{
lwfNo = genericUtility.getColumnValue("lwf_no", dom);
if(lwfNo == null || lwfNo.trim().length() == 0 )
{
errCode = "VMSUPHRD05";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("msme_type"))
{
ssi = genericUtility.getColumnValue("ssi", dom);
if("Y".equals(ssi))
{
msmeType = genericUtility.getColumnValue("msme_type", dom);
if(msmeType == null || msmeType.trim().length() == 0 )
{
errCode = "VMSUPSSI02";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("msme_reg_no"))
{
ssi = genericUtility.getColumnValue("ssi", dom);
if("Y".equals(ssi))
{
msmeRegNo = genericUtility.getColumnValue("msme_reg_no", dom);
if(msmeRegNo == null || msmeRegNo.trim().length() == 0 )
{
errCode = "VMSUPSSI03";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("msme_reg_date"))
{
ssi = genericUtility.getColumnValue("ssi", dom);
if("Y".equals(ssi))
{
msmeRegDate = genericUtility.getColumnValue("msme_reg_date", dom);
if(msmeRegDate == null || msmeRegDate.trim().length() == 0 )
{
errCode = "VMSUPSSI04";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
// Changed By Nasruddin Start 21-SEP-16 end
}
break; //end case 1 validation.
......
......@@ -64,8 +64,8 @@ public class SupplierItem extends ValidatorEJB implements SupplierItemLocal,Supp
String errCode="";
String errorType = "";
String childNodeName = null;
String errString = "";
int ctr=0;
String errString = "", lockGroup = "", sql = "";
int ctr=0, count = 0;
int childNodeListLength;
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
......@@ -107,6 +107,39 @@ public class SupplierItem extends ValidatorEJB implements SupplierItemLocal,Supp
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
//Changed By Nasruddin 22-SEP-16 START
else if(childNodeName.equalsIgnoreCase("lock_group"))
{
lockGroup = genericUtility.getColumnValue("lock_group", dom);
if(lockGroup != null && lockGroup.trim().length() > 0)
{
sql = "SELECT COUNT(1) FROM LOCK_GROUP Where LOCK_GROUP = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lockGroup);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt(1);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
if( count == 0 )
{
errCode = "VMLOCKCODE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
//Changed By Nasruddin 22-SEP-16 END
}//end of for
......
......@@ -88,18 +88,23 @@ public class TaxBaseIC extends ValidatorEJB implements TaxBaseICRemote, TaxBaseI
for (ctr = 0; ctr < childNodeLength; ctr++) {
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("tax_base")) {
if (childNodeName.equalsIgnoreCase("tax_base"))
{
System.out.println(":::childNodeName" + childNodeName);
String taxBase = genericUtility.getColumnValue("tax_base", dom);
//String taxBase = childNode.getFirstChild().getNodeValue();
taxBase = taxBase == null ? "" : taxBase.trim();
System.out.println("::: taxBase" + taxBase);
if(taxBase.length() <= 0){
if(taxBase.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("tax_base", "VMTAXB1", userId);
break;
}
else{
if(editFlag.equalsIgnoreCase("A")){
/* Comment By Nasruddin Start 21-SEP-16 START
else
{
if(editFlag.equalsIgnoreCase("A"))
{
int count = 0;
sql = "select count(*) as count from taxbase where tax_base = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -115,35 +120,43 @@ public class TaxBaseIC extends ValidatorEJB implements TaxBaseICRemote, TaxBaseI
}
}
}Comment By Nasruddin Start 21-SEP-16 END*/
}
}
if(childNodeName.equalsIgnoreCase("descr")){
if(childNodeName.equalsIgnoreCase("descr"))
{
String descr = genericUtility.getColumnValue("descr", dom);
//String descr = childNode.getFirstChild().getNodeValue();
descr = descr == null ? "" : descr.trim();
System.out.println("::: descr" + descr);
if(descr.length() <= 0){
if(descr.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("descr", "VMDESCR", userId);
break;
}
}
if(childNodeName.equalsIgnoreCase("apply_on")){
if(childNodeName.equalsIgnoreCase("apply_on"))
{
String applyOn = genericUtility.getColumnValue("apply_on", dom);
//String applyOn = childNode.getFirstChild().getNodeValue();
applyOn = applyOn == null ? "" : applyOn.trim();
System.out.println("::: applyOn " + applyOn);
if(applyOn.length() <= 0){
if(applyOn.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("apply_on", "VMAPPON1", userId);
break;
}
}
if(childNodeName.equalsIgnoreCase("apply_perc")){
if(childNodeName.equalsIgnoreCase("apply_perc"))
{
String applyPerc = genericUtility.getColumnValue("apply_perc", dom);
//String applyPerc = childNode.getFirstChild().getNodeValue();
applyPerc = applyPerc == null ? "" : applyPerc.trim();
System.out.println("::: applyPerc " + applyPerc);
if(editFlag.equalsIgnoreCase("A") || editFlag.equalsIgnoreCase("E")){
if(applyPerc.length() <= 0){
if(editFlag.equalsIgnoreCase("A") || editFlag.equalsIgnoreCase("E"))
{
if(applyPerc.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("apply_perc", "VMAPPLPERC", userId);
break;
}
......@@ -159,33 +172,42 @@ public class TaxBaseIC extends ValidatorEJB implements TaxBaseICRemote, TaxBaseI
for (ctr = 0; ctr < childNodeLength; ctr++) {
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("tax_base")){
if(childNodeName.equalsIgnoreCase("tax_base"))
{
String tax = genericUtility.getColumnValue("tax_base", dom);
//String tax = childNode.getFirstChild().getNodeValue();
System.out.println(":::tax" + tax);
tax = tax == null ? "" : tax.trim();
if(tax.length() <= 0){
if(tax.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("tax_base", "VMTAXB1", userId);
break;
}
}
if(childNodeName.equalsIgnoreCase("tax_code")){
if(childNodeName.equalsIgnoreCase("tax_code"))
{
String taxCode = genericUtility.getColumnValue("tax_code", dom);
//String taxCode = childNode.getFirstChild().getNodeValue();
taxCode = taxCode == null ? "" : taxCode.trim();
if(taxCode.length() <= 0){
/* Comment By Nasrrudn 21-SEP-16 START
if(taxCode.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("tax_code", "VTTAXC", userId);
break;
}else {
}
//else Comment By Nasrrudn 21-SEP-16 END*/
//{
int count = 0;
sql = "select count(*) as count from tax where tax_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxCode);
rs = pstmt.executeQuery();
if(rs.next()){
if(rs.next())
{
count = rs.getInt("count");
}
if(count <= 0){
if(count <= 0)
{
errString = itmdbAccessEJB.getErrorString("tax_code", "VTTAX1", userId);
break;
}
......@@ -193,28 +215,59 @@ public class TaxBaseIC extends ValidatorEJB implements TaxBaseICRemote, TaxBaseI
rs = null;
pstmt.close();
pstmt = null;
//}
}
}
if(childNodeName.equalsIgnoreCase("seq_no")){
if(childNodeName.equalsIgnoreCase("seq_no"))
{
String seqNo = genericUtility.getColumnValue("seq_no", dom);
//String seqNo = childNode.getFirstChild().getNodeValue();
seqNo = seqNo == null ? "" : seqNo.trim();
if(seqNo.length() <= 0){
if(seqNo.length() <= 0)
{
errString = itmdbAccessEJB.getErrorString("seq_no", "VMSEQNO", userId);
break;
}
if(!seqNo.matches("\\d+")){
errString = itmdbAccessEJB.getErrorString("seq_no", "VTSEQINV", userId);
}
}
}
}
}catch(Exception e)
}
catch(Exception e)
{
System.out.println(":::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace();
}
// Changed By Nasruddin 21-SEP-16 STart
finally
{
try
{
if(conn != null)
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
}
conn = null;
}
catch(Exception d)
{
d.printStackTrace();
throw new ITMException(d);
}
} // Changed By Nasruddin 21-SEP-16 STart
return errString;
}
public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag,
......
......@@ -90,15 +90,19 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote
for (ctr = 0; ctr < childNodeLength; ctr++) {
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("site_code")){
if(childNodeName.equalsIgnoreCase("site_code"))
{
siteCode = genericUtility.getColumnValue("site_code", dom);
//siteCode = childNode.getFirstChild().getNodeValue();
siteCode = siteCode == null ? "" : siteCode.trim();
System.out.println("site code :::" + siteCode);
if(siteCode.isEmpty()){
errString = itmdbAccessEJB.getErrorString("site_code", "VPBLKSITE", userId);
if(siteCode.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("site_code", "VMSITECD1", userId);
return errString;
}else{
}
else
{
int count = 0;
sql = "select count(*) as count from site where site_code = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -107,7 +111,8 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote
if(rs.next()){
count = rs.getInt("count");
}
if(count == 0){
if(count == 0)
{
errString = itmdbAccessEJB.getErrorString("site_code", "VMSITE1", userId);
return errString;
}
......@@ -117,7 +122,9 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote
pstmt = null;
}
}
if(childNodeName.equalsIgnoreCase("tran_type")){
/*Comment By Nasruddin 21-SEp-16 STart
if(childNodeName.equalsIgnoreCase("tran_type"))
{
tranType = genericUtility.getColumnValue("tran_type", dom);
//tranType = childNode.getFirstChild().getNodeValue();
tranType = tranType == null ? "" : tranType.trim();
......@@ -160,26 +167,33 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote
}
}
}
}Comment By Nasruddin 21-SEp-16 END*/
if(childNodeName.equalsIgnoreCase("site_code__for")){
if(childNodeName.equalsIgnoreCase("site_code__for"))
{
siteCodeFor = genericUtility.getColumnValue("site_code__for", dom);
//siteCodeFor = childNode.getFirstChild().getNodeValue();
siteCodeFor = siteCodeFor == null ? "" : siteCodeFor.trim();
System.out.println("site code for :::::" + siteCodeFor);
if(siteCodeFor.isEmpty()){
errString = itmdbAccessEJB.getErrorString("site_code__for", "VPBLKSITE", userId);
if(siteCodeFor.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("site_code__for", "VMSITECD1", userId);
return errString;
}else{
}
else
{
int count = 0;
sql = "select count(*) as count from site where site_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCodeFor);
rs = pstmt.executeQuery();
if(rs.next()){
if(rs.next())
{
count = rs.getInt("count");
}
if(count == 0){
if(count == 0)
{
errString = itmdbAccessEJB.getErrorString("site_code__for", "VMSITE1", userId);
return errString;
}
......@@ -189,12 +203,14 @@ public class TaxDefermentIC extends ValidatorEJB implements TaxDefermentICRemote
pstmt = null;
}
}
if(childNodeName.equalsIgnoreCase("tax_code")){
if(childNodeName.equalsIgnoreCase("tax_code"))
{
taxCode = genericUtility.getColumnValue("tax_code", dom);
//taxCode = childNode.getFirstChild().getNodeValue();
taxCode = taxCode == null ? "" : taxCode.trim();
System.out.println("tax code :::" + taxCode);
if(taxCode.isEmpty()){
if(taxCode.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("tax_code", "VTTAXC", userId);
return errString;
}
......
......@@ -80,25 +80,31 @@ public String wfValData(Document dom, Document dom1, Document dom2, String objCo
if (objContext != null && objContext.trim().length() > 0) {
currentFormNo = Integer.parseInt(objContext);
}
switch (currentFormNo) {
switch (currentFormNo)
{
case 1:
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++) {
for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("tax_env")){
if (childNodeName.equalsIgnoreCase("tax_env"))
{
System.out.println(":::childNodeName" + childNodeName);
String taxEnv = genericUtility.getColumnValue("tax_env", dom);
taxEnv = taxEnv == null ? "" : taxEnv.trim();
System.out.println("::: taxEnv" + taxEnv);
if(taxEnv.length() <= 0){
if(taxEnv.length() <= 0)
{
errString = itmDBAccessEJB.getErrorString("tax_env", "VMTAXENV", userId);
break;
}
else{
/* Comment By Nasruddin 21-sep16 Start
* else
{
if(editFlag.equalsIgnoreCase("A")){
int count = 0;
sql = "select count(*) as count from taxenv where tax_env = ?";
......@@ -117,27 +123,32 @@ public String wfValData(Document dom, Document dom1, Document dom2, String objCo
pstmt.close();
pstmt = null;
}
}Comment By Nasruddin 21-sep16 End*/
}
}
if(childNodeName.equalsIgnoreCase("descr")){
if(childNodeName.equalsIgnoreCase("descr"))
{
String descr = genericUtility.getColumnValue("descr", dom);
descr = descr == null ? "" : descr.trim();
System.out.println("::: descr" + descr);
if(descr.length() <= 0){
if(descr.length() <= 0)
{
errString = itmDBAccessEJB.getErrorString("descr", "VMDESCR", userId);
break;
}
}
if(childNodeName.equalsIgnoreCase("site_code")){
if(childNodeName.equalsIgnoreCase("site_code"))
{
String siteCode = genericUtility.getColumnValue("site_code", dom);
siteCode = siteCode == null ? "" : siteCode.trim();
if(siteCode.length() > 0){
if(siteCode.length() > 0)
{
int count = 0;
sql = "select count(*) as count from site where site_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
rs = pstmt.executeQuery();
if(rs.next()){
if(rs.next())
{
count = rs.getInt("count");
}
if(count <= 0){
......@@ -150,10 +161,12 @@ public String wfValData(Document dom, Document dom1, Document dom2, String objCo
pstmt = null;
}
}
if(childNodeName.equalsIgnoreCase("ref_ser")){
if(childNodeName.equalsIgnoreCase("ref_ser"))
{
String refSer = genericUtility.getColumnValue("ref_ser", dom);
refSer = refSer == null ? "" : refSer.trim();
if(refSer.length() > 0){
if(refSer.length() > 0)
{
int count = 0;
sql = "select count(*) as count from refser where ref_ser = ?";
pstmt = conn.prepareStatement(sql);
......@@ -172,6 +185,7 @@ public String wfValData(Document dom, Document dom1, Document dom2, String objCo
pstmt = null;
}
}
}
break;
case 2:
......@@ -182,14 +196,21 @@ public String wfValData(Document dom, Document dom1, Document dom2, String objCo
for (ctr = 0; ctr < childNodeLength; ctr++) {
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("stan_code__fr")){
if(childNodeName.equalsIgnoreCase("stan_code__fr"))
{
String stanCodeFor = genericUtility.getColumnValue("stan_code__fr", dom);
stanCodeFor = stanCodeFor == null ? "" : stanCodeFor.trim();
if(stanCodeFor.length() <= 0){
/*
* Comment By Nasruddin 21-SEp-16 Start
if(stanCodeFor.length() <= 0)
{
errString = itmDBAccessEJB.getErrorString("stan_code__fr", "VTSTAN2", userId);
break;
}
else{
Comment By Nasruddin 21-SEp-16 END*/
//Changed By Nasruddin 21-SEP-16
if(stanCodeFor.length() > 0)
{
int count = 0;
sql = "select count(*) as count from station where stan_code = ?";
pstmt = conn.prepareStatement(sql);
......@@ -209,16 +230,22 @@ public String wfValData(Document dom, Document dom1, Document dom2, String objCo
}
}
if(childNodeName.equalsIgnoreCase("stan_code__to")){
if(childNodeName.equalsIgnoreCase("stan_code__to"))
{
String stanCodeTo = genericUtility.getColumnValue("stan_code__to", dom);
//String stanCodeTo = childNode.getFirstChild().getNodeValue();
stanCodeTo = stanCodeTo == null ? "" : stanCodeTo.trim();
System.out.println("::: stanCodeTo " + stanCodeTo);
/*
* Comment By Nasruddin 21-SEp-16 Start
if(stanCodeTo.length() <= 0){
errString = itmDBAccessEJB.getErrorString("stan_code__to", "VTSTAN3", userId);
break;
}
else{
Comment By Nasruddin 21-SEp-16 END*/
//Changed By Nasruddin 21-SEP-16
if(stanCodeTo.length() > 0)
{
int count = 0;
sql1 = "select count(*) as count from station where stan_code = ?";
pstmt = conn.prepareStatement(sql1);
......@@ -237,10 +264,14 @@ public String wfValData(Document dom, Document dom1, Document dom2, String objCo
pstmt = null;
}
}
if(childNodeName.equalsIgnoreCase("tax_class")){
if(childNodeName.equalsIgnoreCase("tax_class"))
{
String taxClass = genericUtility.getColumnValue("tax_class", dom);
taxClass = taxClass == null ? "" : taxClass.trim();
int count = 0;
//Changed By Nasruddin 21-SEP-16
if(taxClass.length() > 0)
{
sql = "select count(*) as count from taxclass where tax_class = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxClass);
......@@ -248,7 +279,8 @@ public String wfValData(Document dom, Document dom1, Document dom2, String objCo
if(rs.next()){
count = rs.getInt("count");
}
if(count <= 0){
if(count <= 0)
{
errString = itmDBAccessEJB.getErrorString("tax_class", "VTTCLASS1", userId);
break;
}
......@@ -257,10 +289,16 @@ public String wfValData(Document dom, Document dom1, Document dom2, String objCo
pstmt.close();
pstmt = null;
}
if(childNodeName.equalsIgnoreCase("tax_chap")){
}
if(childNodeName.equalsIgnoreCase("tax_chap"))
{
String taxChap = genericUtility.getColumnValue("tax_chap", dom);
taxChap = taxChap == null ? "" : taxChap.trim();
int count = 0;
//Changed By Nasruddin 21-SEP-16
if(taxChap.length() > 0)
{
sql = "select count(*) as count from taxchap where tax_chap = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxChap);
......@@ -278,6 +316,75 @@ public String wfValData(Document dom, Document dom1, Document dom2, String objCo
pstmt = null;
}
}
//Changed By Nasruddin 21-SEP-16 Start
if(childNodeName.equalsIgnoreCase("state_code__to"))
{
String stateCodeTo = genericUtility.getColumnValue("state_code__to", dom);
stateCodeTo = stateCodeTo == null ? "" : stateCodeTo.trim();
System.out.println("::: stateCodeTo " + stateCodeTo);
if(stateCodeTo.length() > 0)
{
int count = 0;
sql1 = "select count(*) as count from state where state_code = ?";
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1, stateCodeTo);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt("count");
}
if(count == 0)
{
errString = itmDBAccessEJB.getErrorString("state_code__to", "VMSTATCD2", userId);
break;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
if(childNodeName.equalsIgnoreCase("state_code__fr"))
{
String stateCodeFrom = genericUtility.getColumnValue("state_code__fr", dom);
stateCodeFrom = stateCodeFrom == null ? "" : stateCodeFrom.trim();
System.out.println("::: stateCodeTo " + stateCodeFrom);
if(stateCodeFrom.length() > 0)
{
int count = 0;
sql1 = "select count(*) as count from state where state_code = ?";
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1, stateCodeFrom);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt("count");
}
if(count == 0)
{
errString = itmDBAccessEJB.getErrorString("state_code__fr", "VMSTATCD2", userId);
break;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
if (childNodeName.equalsIgnoreCase("tax_env"))
{
System.out.println(":::childNodeName" + childNodeName);
String taxEnv = genericUtility.getColumnValue("tax_env", dom);
if( taxEnv == null || taxEnv.trim().length() > 0)
{
errString = itmDBAccessEJB.getErrorString("ref_ser", "VTREFSER5", userId);
break;
}
}
//Changed By Nasruddin 21-SEP-16 END
}
break;
case 3:
parentNodeList = dom.getElementsByTagName("Detail3");
......@@ -287,20 +394,39 @@ public String wfValData(Document dom, Document dom1, Document dom2, String objCo
for (ctr = 0; ctr < childNodeLength; ctr++) {
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("ref_ser")){
//Changed By Nasruddin 21-SEP-16 Start
if (childNodeName.equalsIgnoreCase("tax_env"))
{
System.out.println(":::childNodeName" + childNodeName);
String taxEnv = genericUtility.getColumnValue("tax_env", dom);
if( taxEnv == null || taxEnv.trim().length() > 0)
{
errString = itmDBAccessEJB.getErrorString("ref_ser", "VTREFSER5", userId);
break;
}
}
//Changed By Nasruddin 21-SEP-16 END
if(childNodeName.equalsIgnoreCase("ref_ser"))
{
String refSer1 = genericUtility.getColumnValue("ref_ser", dom);
//String refSer = childNode.getFirstChild().getNodeValue();
refSer1 = refSer1 == null ? "" : refSer1.trim();
System.out.println("::: refSer1" + refSer1);
int count = 0;
//Changed By Nasruddin 21-SEP-16
if(refSer1.length() > 0)
{
sql2 = "select count(*) as count from refser where ref_ser = ?";
pstmt = conn.prepareStatement(sql2);
pstmt.setString(1, refSer1);
rs = pstmt.executeQuery();
if(rs.next()){
if(rs.next())
{
count = rs.getInt("count");
}
if(count <= 0){
if(count <= 0)
{
errString = itmDBAccessEJB.getErrorString("ref_ser", "VTREFSER5", userId);
break;
}
......@@ -309,24 +435,32 @@ public String wfValData(Document dom, Document dom1, Document dom2, String objCo
pstmt.close();
pstmt = null;
}
if(childNodeName.equalsIgnoreCase("seq_no")){
}
if(childNodeName.equalsIgnoreCase("seq_no"))
{
String seqNo = genericUtility.getColumnValue("seq_no", dom);
seqNo = seqNo == null ? "" : seqNo.trim();
if(seqNo.length() <= 0){
if(seqNo.length() <= 0)
{
errString = itmDBAccessEJB.getErrorString("seq_no", "VMSEQNO", userId);
break;
}
if(!seqNo.matches("\\d+")){
if(!seqNo.matches("\\d+"))
{
errString = itmDBAccessEJB.getErrorString("seq_no", "VTSEQINV", userId);
}
}
if(childNodeName.equalsIgnoreCase("tax_code")){
if(childNodeName.equalsIgnoreCase("tax_code"))
{
String taxCode = genericUtility.getColumnValue("tax_code", dom);
taxCode = taxCode == null ? "" : taxCode.trim();
/* Comment By Nasrruddin Start 21-sep-16
if(taxCode.length() <= 0){
errString = itmDBAccessEJB.getErrorString("tax_code", "VTTAXC", userId);
break;
}else {
}
else
{Comment By Nasrruddin 21-SEP-16 End*/
int count = 0;
sql = "select count(*) as count from tax where tax_code = ?";
pstmt = conn.prepareStatement(sql);
......@@ -343,9 +477,10 @@ public String wfValData(Document dom, Document dom1, Document dom2, String objCo
rs = null;
pstmt.close();
pstmt = null;
//}
}
}
if(childNodeName.equalsIgnoreCase("acct_code")){
if(childNodeName.equalsIgnoreCase("acct_code"))
{
acctCode = genericUtility.getColumnValue("acct_code", dom);
acctCode = acctCode == null ? "" : acctCode.trim();
/*if(acctCode.length() <= 0){
......@@ -407,12 +542,44 @@ public String wfValData(Document dom, Document dom1, Document dom2, String objCo
}
}
}
}catch(Exception e){
}
catch(Exception e)
{
System.out.println(":::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace();
}
return errString;
}
// Changed By Nasruddin 21-SEP-16 STart
finally
{
try
{
if(conn != null)
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
}
conn = null;
}
catch(Exception d)
{
d.printStackTrace();
throw new ITMException(d);
}
}
// Changed By Nasruddin 21-SEP-16 END
return errString;
}
public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag,
String xtraParams) throws RemoteException, ITMException {
......
......@@ -59,9 +59,9 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
String acctCode = "";
String acctCode = "", acctCodeRevr = "";
String active = "";
String cctrCode = "";
String cctrCode = "", cctrCodeRevr = "";
String tauthCode = "";
String taxGroup = "";
String taxCode = "";
......@@ -144,8 +144,8 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt = null;
}*/
}
/* Comment By Nasruddin 21-SEp-16 Start
else if(childNodeName.equalsIgnoreCase("curr_code"))
{
currCode = checkNull(genericUtility.getColumnValue("curr_code", dom));
......@@ -171,20 +171,22 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt.close();
pstmt = null;
}
}
}Comment By Nasruddin 21-SEp-16 End*/
else if(childNodeName.equalsIgnoreCase("tax_group"))
{
taxGroup = checkNull(genericUtility.getColumnValue("tax_group", dom));
taxCode = checkNull(genericUtility.getColumnValue("tax_code", dom));
System.out.println("212 taxGroup="+taxGroup);
System.out.println("213 taxCode="+taxCode);
/* Comment BY Nasruddin 21-SEP-16 START
if(taxGroup == null || taxGroup.trim().length() == 0)
{
errCode = "VMTAXGRP";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else if(!taxCode.equalsIgnoreCase(taxGroup))
} Comment BY Nasruddin 21-SEP-16 END*/
if(!taxCode.equalsIgnoreCase(taxGroup))
{
sql = "select count(*) from tax where tax_code = ?";
pstmt = conn.prepareStatement(sql);
......@@ -206,6 +208,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt = null;
}
}
/* Comment By Nasruddin 21-Sep-16 Start
else if(childNodeName.equalsIgnoreCase("descr"))
{
descr = checkNull(genericUtility.getColumnValue("descr", dom));
......@@ -216,7 +219,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}Comment By Nasruddin 21-Sep-16 End*/
else if(childNodeName.equalsIgnoreCase("acct_code"))
{
acctCode = checkNull(genericUtility.getColumnValue("acct_code", dom));
......@@ -290,6 +293,81 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt = null;
}
}
// Changed By nasruddin 21-SEp-16 Start
else if(childNodeName.equalsIgnoreCase("cctr_code__revr"))
{
cctrCodeRevr = checkNull(genericUtility.getColumnValue("cctr_code__revr", dom));
if(cctrCodeRevr != null && cctrCodeRevr.trim().length() > 0)
{
sql = "select count(*) from costctr where cctr_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,cctrCodeRevr);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(count == 0)
{
errCode = "VMCCTRCD1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
else if(childNodeName.equalsIgnoreCase("acct_code__revr"))
{
acctCodeRevr = checkNull(genericUtility.getColumnValue("acct_code__revr", dom));
System.out.println("acctCodeRevr="+acctCodeRevr);
if(acctCodeRevr != null && acctCodeRevr.trim().length() > 0)
{
sql = "SELECT count(*) from accounts where acct_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,acctCodeRevr);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(count == 0)
{
errCode = "VMACCTA";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
sql2 = "select active from accounts where acct_code = ?";
pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1,acctCodeRevr);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
active = rs2.getString(1);
}
if(active != null && active.equalsIgnoreCase("Y"))
{
errCode = "VMACCTA";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs2.close();
rs2 = null;
pstmt2.close();
pstmt2 = null;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
// Changed By nasruddin 21-SEp-16 END
else if(childNodeName.equalsIgnoreCase("tauth_code"))
{
tauthCode = checkNull(genericUtility.getColumnValue("tauth_code", dom));
......@@ -315,7 +393,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt = null;
}
}
/*Comment By Nasruddin 21-SEp-16 START
else if(childNodeName.equalsIgnoreCase("tax_method"))
{
taxMethod = checkNull(genericUtility.getColumnValue("tax_method", dom));
......@@ -341,7 +419,7 @@ public class TaxIC extends ValidatorEJB implements TaxICLocal, TaxICRemote
pstmt.close();
pstmt = null;
}
}
}Comment By Nasruddin 21-SEp-16 END*/
else if(childNodeName.equalsIgnoreCase("bal_group"))
{
balGroup = checkNull(genericUtility.getColumnValue("bal_group", dom));
......
......@@ -80,7 +80,7 @@ implements TaxRateICLocal, TaxRateICRemote
String errorType = "";
String errString = "";
String siteCode = "";
String taxCode = "";
String taxCode = "", taxSet ="";
String taxClass = "";
String sql = "";
String taxChap = "";
......@@ -158,7 +158,10 @@ implements TaxRateICLocal, TaxRateICRemote
else if(childNodeName.equalsIgnoreCase("tax_class"))
{
taxClass=checkNull(this.genericUtility.getColumnValue("tax_class", dom));
sql="Select Count(*) from taxclass where tax_class = ?";
if(taxClass.trim().length() > 0)//cHANGED bY nasruddin 21-SEP16
{
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,taxClass);
rs=pstmt.executeQuery();
......@@ -169,7 +172,7 @@ implements TaxRateICLocal, TaxRateICRemote
}
if(cnt==0)
{
errCode = "VTTAX1";
errCode = "VTCLASS1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
......@@ -178,6 +181,9 @@ implements TaxRateICLocal, TaxRateICRemote
pstmt.close();
pstmt = null;
}
}
/* Comment By Nasruddin End 21-SEP-16 START
else if(childNodeName.equalsIgnoreCase("slab_base"))
{
slabBase=this.genericUtility.getColumnValue("slab_base", dom);
......@@ -189,10 +195,12 @@ implements TaxRateICLocal, TaxRateICRemote
}
}
Comment By Nasruddin End 21-SEP-16 END*/
else if(childNodeName.equalsIgnoreCase("tax_chap"))
{
taxChap=checkNull(this.genericUtility.getColumnValue("tax_chap", dom));
if(taxChap.trim().length() > 0)//cHANGED bY nasruddin 21-SEP16
{
sql="Select Count(*) from taxchap where tax_chap = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,taxChap);
......@@ -213,6 +221,7 @@ implements TaxRateICLocal, TaxRateICRemote
pstmt.close();
pstmt = null;
}
}
else if(childNodeName.equalsIgnoreCase("tax_base"))
{
taxBase=checkNull(this.genericUtility.getColumnValue("tax_base", dom));
......@@ -249,7 +258,9 @@ implements TaxRateICLocal, TaxRateICRemote
}
}
else if(childNodeName.equalsIgnoreCase("acct_code__reco") || childNodeName.equalsIgnoreCase("acct_code"))
// Changed By Nasruddin 21-SEP-16 START
else if(childNodeName.equalsIgnoreCase("acct_code__reco") || childNodeName.equalsIgnoreCase("acct_code") || childNodeName.equalsIgnoreCase("acct_code__revr"))
//else if(childNodeName.equalsIgnoreCase("acct_code__reco") || childNodeName.equalsIgnoreCase("acct_code"))
{
if(childNodeName.equalsIgnoreCase("acct_code__reco"))
{
......@@ -259,7 +270,10 @@ implements TaxRateICLocal, TaxRateICRemote
{
acctCode= checkNull(this.genericUtility.getColumnValue("acct_code", dom));
}
else if(childNodeName.equalsIgnoreCase("acct_code__revr"))
{
acctCode= checkNull(this.genericUtility.getColumnValue("acct_code__revr", dom));
}
if(acctCode != null && acctCode.trim().length() > 0)
{
sql = "select count(*) from accounts where acct_code = ?";
......@@ -296,7 +310,9 @@ implements TaxRateICLocal, TaxRateICRemote
}
}
else if(childNodeName.equalsIgnoreCase("cctr_code__reco") || childNodeName.equalsIgnoreCase("cctr_code"))
// Changed By Nasruddin 21-SEP-16
else if(childNodeName.equalsIgnoreCase("cctr_code__reco") || childNodeName.equalsIgnoreCase("cctr_code") || childNodeName.equalsIgnoreCase("cctr_code__revr"))
//else if(childNodeName.equalsIgnoreCase("cctr_code__reco") || childNodeName.equalsIgnoreCase("cctr_code"))
{
if(childNodeName.equalsIgnoreCase("cctr_code__reco"))
{
......@@ -306,7 +322,10 @@ implements TaxRateICLocal, TaxRateICRemote
{
cctrCode= checkNull(this.genericUtility.getColumnValue("cctr_code", dom));
}
else if(childNodeName.equalsIgnoreCase("cctr_code"))
{
cctrCode= checkNull(this.genericUtility.getColumnValue("cctr_code__revr", dom));
}
if(acctCode != null && acctCode.trim().length() > 0)
{
......
......@@ -100,6 +100,7 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
/* Comment By Nasruddin 21-SEp-16 Start
if(childNodeName.equalsIgnoreCase("tran_id"))
{
tranId = genericUtility.getColumnValue("tran_id", dom);
......@@ -162,15 +163,21 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev
pstmt.close();
pstmt = null;
}
Comment By Nasruddin 21-SEp-16 End;
*/
else if(childNodeName.equalsIgnoreCase("tax_chap__old"))
if(childNodeName.equalsIgnoreCase("tax_chap__old"))
{
/*
Comment By Nasruddin 21-Sep-16 Start
if ( childNode.getFirstChild() == null )
{
errCode = "VMSTCDNULL";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
Comment By Nasruddin Start 21-Sep-16 END
*/
taxChapOld = genericUtility.getColumnValue("tax_chap__old", dom);
sql = "select count(*) from taxchap where tax_chap = ?";
pstmt = conn.prepareStatement(sql);
......@@ -180,26 +187,29 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(cnt <= 0)
{
errCode = "VTTAXCHAP1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
else if(childNodeName.equalsIgnoreCase("tax_chap__new"))
{
/*
* Comment By Nasruddin 21-SEp-16 Start
if ( childNode.getFirstChild() == null )
{
errCode = "VMSTCDNUL1";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
Comment By Nasruddin 21-SEp-16 END */
taxChapNew = genericUtility.getColumnValue("tax_chap__new", dom);
sql = "select count(*) from taxchap where tax_chap = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -209,16 +219,91 @@ public class TaxRevision extends ValidatorEJB implements TaxRevisionLocal,TaxRev
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(cnt <=0)
{
errCode = "VTTAXCHAP1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
//Changed By nasruddin 21-Sep-16 Start
else
{
sql = "SELECT COUNT(1) FROM TAXSET WHERE TAX_CHAP = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,taxChapNew);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(cnt >0)
{
errCode = "VTTAXCHAP2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else
{
taxChapOld = genericUtility.getColumnValue("tax_chap__old", dom);
tranId = genericUtility.getColumnValue("tran_id", dom);
cnt = 0;
if(tranId != null && tranId.trim().length() > 0)
{
sql = "SELECT COUNT(1) FROM TAX_REVISION WHERE ( TAX_REVISION.TAX_CHAP__OLD = ?) AND ( TAX_REVISION.TAX_CHAP__NEW = ? ) AND ( TAX_REVISION.TRAN_ID <> ?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxChapOld);
pstmt.setString(2, taxChapNew);
pstmt.setString(3, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
else
{
sql = "SELECT COUNT(1) FROM TAX_REVISION WHERE ( TAX_REVISION.TAX_CHAP__OLD = ?) AND ( TAX_REVISION.TAX_CHAP__NEW = ? )";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxChapOld);
pstmt.setString(2, taxChapNew);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
if( cnt > 0)
{
errCode = "VTTAXRDUP";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
// Changed By nasruddin 21-SEP-16 ENd
}
}
break;
......
......@@ -5,15 +5,12 @@ import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import javax.ejb.Stateless;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
......@@ -86,50 +83,66 @@ public class TransporterModeIC extends ValidatorEJB implements TransporterModeIC
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++) {
for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("tran_code")){
if(childNodeName.equalsIgnoreCase("tran_code"))
{
tranCode = genericUtility.getColumnValue("tran_code", dom);
tranCode = tranCode == null ? "" : tranCode.trim();
System.out.println("transporter code ::::" + tranCode);
if(tranCode.isEmpty()){
errString = itmdbAccessEJB.getErrorString("tran_code", "VTBLTRSC", userId);
if(tranCode.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("tran_code", "VMCODNULL", userId);
return errString;
}else{
}
else
{
int count = 0;
sql = "select count(*) as count from transporter where tran_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranCode);
rs = pstmt.executeQuery();
if(rs.next()){
if(rs.next())
{
count = rs.getInt("count");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count == 0){
if(count == 0)
{
errString = itmdbAccessEJB.getErrorString("tran_code", "VTTRANCD1", userId);
return errString;
}
}
}
if(childNodeName.equalsIgnoreCase("trans_mode")){
if(childNodeName.equalsIgnoreCase("trans_mode"))
{
transMode = genericUtility.getColumnValue("trans_mode", dom);
transMode = transMode == null ? "" : transMode.trim();
System.out.println("mode of transport :::" + transMode);
if(transMode.isEmpty()){
errString = itmdbAccessEJB.getErrorString("trans_mode", "VTBLMOTRS", userId);
if(transMode.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("trans_mode", "VMCODNULL", userId);
return errString;
}else{
}
else
{
int count = 0;
//Changed By Nasruddin 21-sep-16 start
if("A".equals(editFlag))
{
sql = "select count(*) as count from transporter_mode where tran_code = ? and trans_mode = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranCode);
pstmt.setString(2, transMode);
rs = pstmt.executeQuery();
if(rs.next()){
if(rs.next())
{
count = rs.getInt("count");
}
......@@ -138,18 +151,51 @@ public class TransporterModeIC extends ValidatorEJB implements TransporterModeIC
pstmt.close();
pstmt = null;
if(count > 0){
errString = itmdbAccessEJB.getErrorString("", "VTINVTCTM", userId);
if(count > 0)
{
errString = itmdbAccessEJB.getErrorString("", "VMDUPL1", userId);
return errString;
}
}
}
}
}
}
}catch(Exception e){
}
catch(Exception e)
{
System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace();
}
// Changed by Nasruddin 21-sep-16 Start
finally
{
try
{
if(conn != null)
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
}
conn = null;
}
catch(Exception d)
{
d.printStackTrace();
throw new ITMException(d);
}
}
// Changed by Nasruddin 21-sep-16 End
return errString;
}
......
......@@ -119,6 +119,7 @@ public class UnitConvIC extends ValidatorEJB implements UnitConvICLocal,UnitConv
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
/* Comment By Nasruddin 21-Sep-16 START
if (childNodeName.trim().equalsIgnoreCase("unit__fr"))
{
unitFr = genericUtility.getColumnValue("unit__fr", dom);
......@@ -149,17 +150,55 @@ public class UnitConvIC extends ValidatorEJB implements UnitConvICLocal,UnitConv
errFields.add(childNodeName.toLowerCase());
}
}
} else if (childNodeName.trim()
.equalsIgnoreCase("unit__to"))
} Comment By Nasruddin 21-Sep-16 END */
if (childNodeName.trim().equalsIgnoreCase("unit__to"))
{
unitTo = genericUtility.getColumnValue("unit__to", dom);
unitFr = genericUtility.getColumnValue("unit__fr", dom);
/* Comment By Nasruddin 21-Sep-16 START
if (unitTo == null || unitTo.trim().length() <= 0)
{
errCode = "VMUNIT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
} Comment By Nasruddin 21-Sep-16 Nasruddin */
if (unitFr.equalsIgnoreCase(unitTo))
{
errCode = "VTUNIT2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
// Changed By Nasruddin Start 21-SEP-16
else
{
if("A".equals(editFlag))
{
itemCode = genericUtility.getColumnValue("item_code", dom);
sql ="SELECT COUNT(1) FROM UOMCONV WHERE UNIT__FR = ? AND UNIT__TO = ? AND ITEM_CODE = ?;";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, unitFr);
pstmt.setString(2, unitTo);
pstmt.setString(3, itemCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
if (cnt == 0)
{
errCode = "VMDUPL1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
} // Changed By Nasruddin Start 21-SEP-16 END
/* Comment By Nasruddin 21-Sep-16 START
if (unitTo != null && unitTo.trim().length() > 0)
{
sql = "select count(*) from uom where unit = ? ";
......@@ -181,14 +220,10 @@ public class UnitConvIC extends ValidatorEJB implements UnitConvICLocal,UnitConv
pstmt.close();
pstmt = null;
}
if (unitFr.equalsIgnoreCase(unitTo))
{
errCode = "VTUNIT2";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
Comment By Nasruddin 21-Sep-16 END*/
}
} else if (childNodeName.trim().equalsIgnoreCase("item_code"))
/* Comment By Nasruddin 21-Sep-16 START
else if (childNodeName.trim().equalsIgnoreCase("item_code"))
{
System.out.println(""+""+""+"Change not made in UnitComnIC EJB extending ValidateEJB"+""+""+""+""+""+""+""+""+""+""+""+""+""+""+"");
itemCode = genericUtility.getColumnValue("item_code",dom);
......@@ -249,7 +284,7 @@ public class UnitConvIC extends ValidatorEJB implements UnitConvICLocal,UnitConv
}
}
}Comment by nasriuddin 19-sep-16 END*/
}// END OF FOR
}// END OF SWITCH
int errListSize = errList.size();
......
......@@ -81,24 +81,32 @@ public class UnitOfMeasureIC extends ValidatorEJB implements UnitOfMeasureICRemo
currentFormNo = Integer.parseInt(objContext);
}
System.out.println("in wfValdata doc :::::");
switch (currentFormNo) {
switch (currentFormNo)
{
case 1:
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++) {
for (ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("unit")){
if(childNodeName.equalsIgnoreCase("unit"))
{
unit = genericUtility.getColumnValue("unit", dom);
unit = unit == null ? "" : unit.trim();
System.out.println("unit ::::" + unit);
if(unit.isEmpty()){
if(unit.isEmpty())
{
errString = itmdbAccessEJB.getErrorString("unit", "VTCRTERM", userId);
return errString;
}else if(editFlag.equalsIgnoreCase("A")){
}
else if(editFlag.equalsIgnoreCase("A"))
{
int count = 0;
if(unit !=null && unit.trim().length() > 0)
{
sql = "select count(*) as count from uom where unit = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, unit);
......@@ -116,14 +124,18 @@ public class UnitOfMeasureIC extends ValidatorEJB implements UnitOfMeasureICRemo
}
}
}
if(childNodeName.equalsIgnoreCase("descr")){
}
if(childNodeName.equalsIgnoreCase("descr"))
{
descr = genericUtility.getColumnValue("descr", dom);
//descr = descr == null ? "" : descr.trim();
System.out.println("Description :::" + descr);
if(descr.trim().isEmpty()){
errString = itmdbAccessEJB.getErrorString("descr", "VMDESCR", userId);
return errString;
}else{
}
else
{
int count = 0;
sql = "select count(*) as count from uom where unit != ? and trim(descr) = ?";
pstmt = conn.prepareStatement(sql);
......@@ -139,7 +151,8 @@ public class UnitOfMeasureIC extends ValidatorEJB implements UnitOfMeasureICRemo
pstmt.close();
pstmt = null;
if(count > 0){
if(count > 0)
{
errString = itmdbAccessEJB.getErrorString("descr", "VMDUPDESCR", userId);
return errString;
}
......@@ -147,12 +160,18 @@ public class UnitOfMeasureIC extends ValidatorEJB implements UnitOfMeasureICRemo
}
}
}
}catch(Exception e){
}
catch(Exception e)
{
System.out.println("::::" + this.getClass().getSimpleName() + ":::" + e.getMessage());
e.printStackTrace();
}finally{
try{
if(rs != null){
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment