Commit 40b68f37 authored by cshah's avatar cshah

Changes in tran_date column in itemchange and wfvaldata method


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91694 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 692a8a95
...@@ -11,6 +11,7 @@ import java.util.*; ...@@ -11,6 +11,7 @@ import java.util.*;
import java.util.Date; import java.util.Date;
import java.sql.*; import java.sql.*;
import org.w3c.dom.*; import org.w3c.dom.*;
import javax.xml.parsers.*; import javax.xml.parsers.*;
import javax.ejb.*; import javax.ejb.*;
import javax.naming.InitialContext; import javax.naming.InitialContext;
...@@ -36,12 +37,13 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -36,12 +37,13 @@ public class CustStock extends ValidatorEJB //implements SessionBean
{ {
} }
*/ */
public String wfValData() throws RemoteException,ITMException public String wfValData() throws RemoteException,ITMException
{ {
return ""; return "";
} }
// Commented by Chandni Shah 17-Apr-2012
public String wfValData(String xmlString, String formNo, String editFlag) throws RemoteException,ITMException /*public String wfValData(String xmlString, String formNo, String editFlag) throws RemoteException,ITMException
{ {
Document dom = null; Document dom = null;
String errString = ""; String errString = "";
...@@ -56,10 +58,69 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -56,10 +58,69 @@ public class CustStock extends ValidatorEJB //implements SessionBean
} }
errString = wfValData(dom, formNo, editFlag); errString = wfValData(dom, formNo, editFlag);
return (errString); return (errString);
}*/
// Added by Chandni Shah 17-Apr-2012
public String wfValData(String xmlString, String xmlString1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
String errString = null;
Document dom = null;
Document dom1 = null;
Document dom2 = null;
try
{
//System.out.println("xmlString:-" + xmlString );
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
}
catch(Exception e)
{
//System.out.println("Exception : SOrderFormEJB : wfValData(String xmlString) : ==>\n"+e.getMessage());
throw new ITMException( e );
}
return (errString);
} }
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
public String wfValData(Document dom, String formNo, String editFlag) throws RemoteException,ITMException {
String errString = null;
Document dom = null;
Document dom1 = null;
Document dom2 = null;
try
{
System.out.println("cHANDNI 11 xmlString:-" + xmlString );
System.out.println("cHANDNI 12 xmlString:-" + xmlString1 );
//long startTime = System.currentTimeMillis();
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
System.out.println("Chandni 13 dom"+dom);
System.out.println("Chandni 14 dom"+dom1);
if (xmlString2.trim().length() > 0 )
{
dom2 = parseString("<Root>" + xmlString2+ "</Root>");
}
System.out.println("Chandni 15 dom"+dom2);
//long endTime = System.currentTimeMillis();
//long totalTime = endTime - startTime;
//System.out.println(xmlString2);
//System.out.println("start Time Spend :: "+startTime+" Milliseconds");
//System.out.println("End Time Spend :: "+endTime+" Milliseconds");
//System.out.println("Total Time Spend :: "+totalTime+" Milliseconds");
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
}
catch(Exception e)
{
//System.out.println("Exception : SOrderFormEJB : wfValData(String xmlString) : ==>\n"+e.getMessage());
throw new ITMException( e );
}
return (errString);
}
// Commented by Chandni Shah 17-Apr-2012
//public String wfValData(Document dom, String formNo, String editFlag) throws RemoteException,ITMException
public String wfValData(Document dom, Document dom1,Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
// Added by Chandni Shah 17-Apr-2012
boolean checkNextCol = true; boolean checkNextCol = true;
String columnName = ""; String columnName = "";
String columnValue = ""; String columnValue = "";
...@@ -90,8 +151,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -90,8 +151,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean
java.util.Date restUpto2 = null; java.util.Date restUpto2 = null;
SimpleDateFormat sdfFormat=null; SimpleDateFormat sdfFormat=null;
// 11/09/09 manoharan // 11/09/09 manoharan
String begPart = null; String begPart = null;
String endPart = null; String endPart = null;
String itemDescr = null; String itemDescr = null;
// end 11/09/09 manoharan // end 11/09/09 manoharan
...@@ -101,51 +162,61 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -101,51 +162,61 @@ public class CustStock extends ValidatorEJB //implements SessionBean
try try
{ {
System.out.println("CustStockEJB validation"); //System.out.println("CustStockEJB validation");
AppConnectParm appConnect = new AppConnectParm(); /*AppConnectParm appConnect = new AppConnectParm();
Properties p = appConnect.getProperty(); Properties p = appConnect.getProperty();
InitialContext ctx = new InitialContext(p); InitialContext ctx = new InitialContext(p);
itmDBAccess = (ITMDBAccessLocal)ctx.lookup("ibase/ITMDBAccessEJB/local"); itmDBAccess = (ITMDBAccessLocal)ctx.lookup("ibase/ITMDBAccessEJB/local");
*/
//itmDBAccess = itmDBAccessHome.create(); //itmDBAccess = itmDBAccessHome.create();
ibase.webitm.utility.GenericUtility genericUtility = new ibase.webitm.utility.GenericUtility(); ibase.webitm.utility.GenericUtility genericUtility = new ibase.webitm.utility.GenericUtility();
conn = getConnection(); conn = getConnection();
userId = getColumnValue( "user_id", dom ); userId = genericUtility.getColumnValue( "user_id", dom );
currentFormNo = Integer.parseInt( formNo ); //currentFormNo = Integer.parseInt( formNo );
currentFormNo = Integer.parseInt( objContext ); // Added by Chandni Shah 17-Apr-2012
switch ( currentFormNo ) switch ( currentFormNo )
{ {
case 1: case 1:
columnValue = getColumnValue( "tran_date", dom ); System.out.println("currentFormNo:::"+currentFormNo);
columnValue = genericUtility.getColumnValue("tran_date", dom );
System.out.println("columnValue 11:"+columnValue);
if(columnValue != null) if(columnValue != null)
{ {
siteCode = getColumnValue( "site_code", dom ); siteCode = genericUtility.getColumnValue( "site_code", dom );
System.out.println("columnValue 12:"+columnValue+"_and checkNextCol:"+checkNextCol);
if ( columnValue.length() != 0 && checkNextCol ) if ( columnValue.length() != 0 && checkNextCol )
{ {
System.out.println("inside columnValue:::");
errCode = nfCheckPeriod("SAL",getDateObject(columnValue),siteCode); errCode = nfCheckPeriod("SAL",getDateObject(columnValue),siteCode);
if (errCode.length() != 0) if (errCode.length() != 0)
{ {
System.out.println("errCode k ander");
//errString = getErrorString("",errCode,userId); //errString = getErrorString("",errCode,userId);
//checkNextCol = false; //checkNextCol = false;
errString = itmDBAccess.getErrorString("tran_date",errCode,userId,null,conn); //errString = itmDBAccess.getErrorString("tran_date",errCode,userId);//,null,conn);
errString = getErrorString("tran_date",errCode,userId);//,null,conn); // Change by Chandni Shah 17-Apr-2012
break; break;
} }
} }
} }
columnValue = getColumnValue("cust_code",dom); //columnValue = getColumnValue("cust_code",dom);
columnValue = genericUtility.getColumnValue("cust_code",dom); // Change by Chandni Shah 17-Apr-2012
if(columnValue != null) if(columnValue != null)
{ {
siteCode = getColumnValue("site_code",dom); //siteCode = getColumnValue("site_code",dom);
siteCode = genericUtility.getColumnValue("site_code",dom);
System.out.println("siteCode [" +siteCode+ "]"); System.out.println("siteCode [" +siteCode+ "]");
tranDate = getColumnValue("tran_date",dom); tranDate = genericUtility.getColumnValue("tran_date",dom);
if (columnValue.length() != 0 && checkNextCol) if (columnValue.length() != 0 && checkNextCol)
{ {
errCode = isCustomer(siteCode,columnValue,"S-CSTK",conn); errCode = isCustomer(siteCode,columnValue,"S-CSTK",conn);
System.out.println("errCode [" +errCode+ "]"); System.out.println("errCode [" +errCode+ "]");
if (errCode.length() !=0 ) if (errCode.length() !=0 )
{ {
//errString = getErrorString("cust_code",errCode,userId); errString = getErrorString("cust_code",errCode,userId);
//checkNextCol = false; //checkNextCol = false;
errString = itmDBAccess.getErrorString("cust_code",errCode,userId,null,conn); //errString = itmDBAccess.getErrorString("cust_code",errCode,userId);//,null,conn);
break; break;
} }
} }
...@@ -162,20 +233,20 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -162,20 +233,20 @@ public class CustStock extends ValidatorEJB //implements SessionBean
{ {
if (rs.getInt(1) == 0) if (rs.getInt(1) == 0)
{ {
//errString = getErrorString("cust_code","VTSITECUST",userId); errString = getErrorString("cust_code","VTSITECUST",userId);
//checkNextCol = false; //checkNextCol = false;
errString = itmDBAccess.getErrorString("cust_code","VTSITECUST",userId,null,conn); //errString = itmDBAccess.getErrorString("cust_code","VTSITECUST",userId);//,null,conn);
break; break;
} }
} }
} }
else else
{ {
/*Select count(1) into :cnt /* Select count(1) into :cnt
From customer From customer
Where cust_code = :mval Where cust_code = :mval
And (case when channel_partner is null then 'N' else channel_partner end ) = 'N'; And (case when channel_partner is null then 'N' else channel_partner end ) = 'N';
If cnt = 0 Then errcode = "VTCUST"*/ If cnt = 0 Then errcode = "VTCUST" */
sqlCnt = "SELECT COUNT(1) COUNT FROM CUSTOMER WHERE CUST_CODE = '" + columnValue + "' And (CASE WHEN CHANNEL_PARTNER IS NULL THEN 'N' ELSE CHANNEL_PARTNER END ) = 'N'"; sqlCnt = "SELECT COUNT(1) COUNT FROM CUSTOMER WHERE CUST_CODE = '" + columnValue + "' And (CASE WHEN CHANNEL_PARTNER IS NULL THEN 'N' ELSE CHANNEL_PARTNER END ) = 'N'";
System.out.println("sql :\n"+sqlCnt); System.out.println("sql :\n"+sqlCnt);
stmt = conn.createStatement(); stmt = conn.createStatement();
...@@ -183,7 +254,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -183,7 +254,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if (rs.next() && rs.getInt( "COUNT" ) == 0) if (rs.next() && rs.getInt( "COUNT" ) == 0)
{ {
//errCode = "VTCUST"; //errCode = "VTCUST";
errString = itmDBAccess.getErrorString("cust_code","VTCUST",userId,null,conn); //errString = itmDBAccess.getErrorString("cust_code","VTCUST",userId);//,null,conn);
errString = getErrorString("cust_code","VTCUST",userId);//,null,conn);
break; break;
} }
} }
...@@ -193,10 +265,11 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -193,10 +265,11 @@ public class CustStock extends ValidatorEJB //implements SessionBean
stmt = null; stmt = null;
} }
} }
columnValue = getColumnValue("site_code",dom); //columnValue = getColumnValue("site_code",dom);
columnValue = genericUtility.getColumnValue("site_code",dom);
if(columnValue != null) if(columnValue != null)
{ {
custCode = getColumnValue("cust_code",dom); custCode = genericUtility.getColumnValue("cust_code",dom);
if (checkNextCol) if (checkNextCol)
{ {
sqlCnt = "SELECT NVL(COUNT(*),0) FROM SITE WHERE SITE_CODE = '"+columnValue+"'"; sqlCnt = "SELECT NVL(COUNT(*),0) FROM SITE WHERE SITE_CODE = '"+columnValue+"'";
...@@ -207,10 +280,10 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -207,10 +280,10 @@ public class CustStock extends ValidatorEJB //implements SessionBean
{ {
if (rs.getInt(1)==0) if (rs.getInt(1)==0)
{ {
//errString = getErrorString("site_code","VTSITECD1",userId); errString = getErrorString("site_code","VTSITECD1",userId);
//checkNextCol = false; //checkNextCol = false;
errString = itmDBAccess.getErrorString("site_code","VTSITECD1",userId,null,conn); //errString = itmDBAccess.getErrorString("site_code","VTSITECD1",userId);//,null,conn);
break; break;
} }
} }
...@@ -233,10 +306,10 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -233,10 +306,10 @@ public class CustStock extends ValidatorEJB //implements SessionBean
{ {
if (rs.getInt(1)==0) if (rs.getInt(1)==0)
{ {
//errString = getErrorString("site_code","VTSITECUST",userId); errString = getErrorString("site_code","VTSITECUST",userId);
//checkNextCol = false; //checkNextCol = false;
errString = itmDBAccess.getErrorString("site_code","VTSITECUST",userId,null,conn); //errString = itmDBAccess.getErrorString("site_code","VTSITECUST",userId);//,null,conn);
break; break;
} }
} }
...@@ -249,7 +322,7 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -249,7 +322,7 @@ public class CustStock extends ValidatorEJB //implements SessionBean
} }
//SHWETA 2/14/2005 --Not required at the time of validation //SHWETA 2/14/2005 --Not required at the time of validation
columnValue = getColumnValue("tran_id__last",dom); columnValue = genericUtility.getColumnValue("tran_id__last",dom);
if (columnValue != null) if (columnValue != null)
{ {
Statement stmt14 = null; Statement stmt14 = null;
...@@ -291,11 +364,11 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -291,11 +364,11 @@ public class CustStock extends ValidatorEJB //implements SessionBean
} }
} }
} }
columnValue = getColumnValue("to_date",dom); columnValue = genericUtility.getColumnValue("to_date",dom);
if (columnValue != null) if (columnValue != null)
{ {
frdate1 = getColumnValue("from_date",dom); frdate1 = genericUtility.getColumnValue("from_date",dom);
tranDate1 = getColumnValue("tran_date",dom); tranDate1 = genericUtility.getColumnValue("tran_date",dom);
if (!columnValue.equals("") && checkNextCol) if (!columnValue.equals("") && checkNextCol)
{ {
frdate2 = getDateObject(frdate1); frdate2 = getDateObject(frdate1);
...@@ -304,20 +377,22 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -304,20 +377,22 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if (todate.compareTo(frdate2) < 0) if (todate.compareTo(frdate2) < 0)
{ {
//errCode = "VFRTODATE"; //errCode = "VFRTODATE";
errString = itmDBAccess.getErrorString("to_date","VFRTODATE",userId,null,conn); //errString = itmDBAccess.getErrorString("to_date","VFRTODATE",userId);//,null,conn);
errString = getErrorString("to_date","VFRTODATE",userId);//,null,conn);
break; break;
} }
else if (tranDate2.compareTo(todate) < 0) else if (tranDate2.compareTo(todate) < 0)
{ {
//errCode = "VTDATE9"; //errCode = "VTDATE9";
errString = itmDBAccess.getErrorString("to_date","VTDATE9",userId,null,conn); //errString = itmDBAccess.getErrorString("to_date","VTDATE9",userId);//,null,conn);
errString = getErrorString("to_date","VTDATE9",userId);//,null,conn);
break; break;
} }
else else
{ {
custCode = getColumnValue("cust_code",dom); custCode = genericUtility.getColumnValue("cust_code",dom);
siteCode = getColumnValue("site_code",dom); siteCode = genericUtility.getColumnValue("site_code",dom);
itemSer = getColumnValue("item_ser",dom); itemSer = genericUtility.getColumnValue("item_ser",dom);
if (itemSer.length() == 0) if (itemSer.length() == 0)
{ {
selQueryBuff = new StringBuffer(); selQueryBuff = new StringBuffer();
...@@ -344,7 +419,7 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -344,7 +419,7 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if (rs.getInt(1) > 0 && editFlag.equals("A")) if (rs.getInt(1) > 0 && editFlag.equals("A"))
{ {
//errCode = "VTDUPREC"; //errCode = "VTDUPREC";
errString = itmDBAccess.getErrorString("to_date","VTDUPREC",userId,null,conn); errString = itmDBAccess.getErrorString("to_date","VTDUPREC",userId);//,null,conn);
break; break;
} }
} }
...@@ -375,13 +450,14 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -375,13 +450,14 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if (rs.getInt(1) == 0) if (rs.getInt(1) == 0)
{ {
//errCode = "VTITMSER1"; //errCode = "VTITMSER1";
errString = itmDBAccess.getErrorString("item_ser","VTITMSER1",userId,null,conn); //errString = itmDBAccess.getErrorString("item_ser","VTITMSER1",userId);//,null,conn);
errString = getErrorString("item_ser","VTITMSER1",userId);//,null,conn);
break; break;
} }
else else
{ {
custCode = getColumnValue("cust_code",dom); custCode = genericUtility.getColumnValue("cust_code",dom);
itemSer = getColumnValue("item_ser",dom); itemSer = genericUtility.getColumnValue("item_ser",dom);
selQueryBuff = new StringBuffer(); selQueryBuff = new StringBuffer();
selQueryBuff.append("SELECT NVL(COUNT(*),0) FROM CUSTOMER_SERIES WHERE CUST_CODE = '"); selQueryBuff.append("SELECT NVL(COUNT(*),0) FROM CUSTOMER_SERIES WHERE CUST_CODE = '");
selQueryBuff.append(custCode).append("' AND ITEM_SER = '"); selQueryBuff.append(custCode).append("' AND ITEM_SER = '");
...@@ -394,7 +470,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -394,7 +470,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if (rs2.getInt(1) == 0) if (rs2.getInt(1) == 0)
{ {
//errCode = "VTITEMSER4"; //errCode = "VTITEMSER4";
errString = itmDBAccess.getErrorString("item_ser","VTITEMSER4",userId,null,conn); //errString = itmDBAccess.getErrorString("item_ser","VTITEMSER4",userId);//,null,conn);
errString = getErrorString("item_ser","VTITEMSER4",userId);//,null,conn);
break; break;
} }
} }
...@@ -426,7 +503,7 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -426,7 +503,7 @@ public class CustStock extends ValidatorEJB //implements SessionBean
errcode = 'VTINVSCHDT' errcode = 'VTINVSCHDT'
end if end if
end if*/ end if*/
columnValue = getColumnValue("sch_date__1",dom); columnValue = genericUtility.getColumnValue("sch_date__1",dom);
if(columnValue != null) if(columnValue != null)
{ {
sdfFormat = new SimpleDateFormat(getApplDateFormat()); sdfFormat = new SimpleDateFormat(getApplDateFormat());
...@@ -434,11 +511,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -434,11 +511,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if ( schDate.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 ) if ( schDate.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 )
{ {
//errCode = "VTINVSCHDT"; //errCode = "VTINVSCHDT";
errString = itmDBAccess.getErrorString("sch_date__1","VTINVSCHDT",userId,null,conn); //errString = itmDBAccess.getErrorString("sch_date__1","VTINVSCHDT",userId);//,null,conn);
errString = getErrorString("sch_date__1","VTINVSCHDT",userId);//,null,conn);
break; break;
} }
} }
columnValue = getColumnValue("sch_date__2",dom); columnValue =genericUtility.getColumnValue("sch_date__2",dom);
if(columnValue != null) if(columnValue != null)
{ {
sdfFormat = new SimpleDateFormat(getApplDateFormat()); sdfFormat = new SimpleDateFormat(getApplDateFormat());
...@@ -446,11 +524,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -446,11 +524,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if ( schDate2.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 ) if ( schDate2.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 )
{ {
//errCode = "VTINVSCHDT"; //errCode = "VTINVSCHDT";
errString = itmDBAccess.getErrorString("sch_date__2","VTINVSCHDT",userId,null,conn); //errString = itmDBAccess.getErrorString("sch_date__2","VTINVSCHDT",userId);//,null,conn);
errString = getErrorString("sch_date__2","VTINVSCHDT",userId);//,null,conn);
break; break;
} }
} }
columnValue = getColumnValue("sch_date__3",dom); columnValue = genericUtility.getColumnValue("sch_date__3",dom);
if(columnValue != null) if(columnValue != null)
{ {
sdfFormat = new SimpleDateFormat(getApplDateFormat()); sdfFormat = new SimpleDateFormat(getApplDateFormat());
...@@ -458,11 +537,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -458,11 +537,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if ( schDate3.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 ) if ( schDate3.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 )
{ {
//errCode = "VTINVSCHDT"; //errCode = "VTINVSCHDT";
errString = itmDBAccess.getErrorString("sch_date__3","VTINVSCHDT",userId,null,conn); //errString = itmDBAccess.getErrorString("sch_date__3","VTINVSCHDT",userId);//,null,conn);
errString = getErrorString("sch_date__3","VTINVSCHDT",userId);//,null,conn);
break; break;
} }
} }
columnValue = getColumnValue("sch_date__4",dom); columnValue = genericUtility.getColumnValue("sch_date__4",dom);
if(columnValue != null) if(columnValue != null)
{ {
sdfFormat = new SimpleDateFormat(getApplDateFormat()); sdfFormat = new SimpleDateFormat(getApplDateFormat());
...@@ -470,11 +550,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -470,11 +550,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if ( schDate4.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 ) if ( schDate4.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 )
{ {
//errCode = "VTINVSCHDT"; //errCode = "VTINVSCHDT";
errString = itmDBAccess.getErrorString("sch_date__4","VTINVSCHDT",userId,null,conn); //errString = itmDBAccess.getErrorString("sch_date__4","VTINVSCHDT",userId);//,null,conn);
errString = getErrorString("sch_date__4","VTINVSCHDT",userId);//,null,conn);
break; break;
} }
} }
columnValue = getColumnValue("sch_date__5",dom); columnValue = genericUtility.getColumnValue("sch_date__5",dom);
if(columnValue != null) if(columnValue != null)
{ {
sdfFormat = new SimpleDateFormat(getApplDateFormat()); sdfFormat = new SimpleDateFormat(getApplDateFormat());
...@@ -482,11 +563,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -482,11 +563,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if ( schDate5.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 ) if ( schDate5.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 )
{ {
//errCode = "VTINVSCHDT"; //errCode = "VTINVSCHDT";
errString = itmDBAccess.getErrorString("sch_date__5","VTINVSCHDT",userId,null,conn); //errString = itmDBAccess.getErrorString("sch_date__5","VTINVSCHDT",userId);//,null,conn);
errString = getErrorString("sch_date__5","VTINVSCHDT",userId);//,null,conn);
break; break;
} }
} }
columnValue = getColumnValue("sch_date__6",dom); columnValue = genericUtility.getColumnValue("sch_date__6",dom);
if(columnValue != null) if(columnValue != null)
{ {
sdfFormat = new SimpleDateFormat(getApplDateFormat()); sdfFormat = new SimpleDateFormat(getApplDateFormat());
...@@ -494,7 +576,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -494,7 +576,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if ( schDate6.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 ) if ( schDate6.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 )
{ {
//errCode = "VTINVSCHDT"; //errCode = "VTINVSCHDT";
errString = itmDBAccess.getErrorString("sch_date__6","VTINVSCHDT",userId,null,conn); //errString = itmDBAccess.getErrorString("sch_date__6","VTINVSCHDT",userId);//,null,conn);
errString = getErrorString("sch_date__6","VTINVSCHDT",userId);//,null,conn);
break; break;
} }
} }
...@@ -615,11 +698,11 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -615,11 +698,11 @@ public class CustStock extends ValidatorEJB //implements SessionBean
{ {
itemDescr = " - " + itemDescr; itemDescr = " - " + itemDescr;
} }
begPart = errString.substring( 0, errString.indexOf("<trace>") + 7 ); begPart = errString.substring( 0, errString.indexOf("<trace>") + 7 );
endPart = errString.substring( errString.indexOf("</trace>")); endPart = errString.substring( errString.indexOf("</trace>"));
errString = begPart + " Invalid Item : " + columnValue.toString() + itemDescr + " for Site_code : "+siteCode + " " + endPart; errString = begPart + " Invalid Item : " + columnValue.toString() + itemDescr + " for Site_code : "+siteCode + " " + endPart;
begPart =null; begPart =null;
endPart =null; endPart =null;
// end 11/09/09 manoharan // end 11/09/09 manoharan
break; break;
} }
...@@ -881,8 +964,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -881,8 +964,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean
double saless = 0; double saless = 0;
double clStk = 0; double clStk = 0;
int currentFormNo = 0; int currentFormNo = 0;
int mon = 0; //int mon = 0;
int days =0; //int days =0;
float rateValue = 0f; float rateValue = 0f;
String opValue = ""; String opValue = "";
...@@ -1218,12 +1301,13 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -1218,12 +1301,13 @@ public class CustStock extends ValidatorEJB //implements SessionBean
else if (currentColumn.trim().equals("tran_date")) else if (currentColumn.trim().equals("tran_date"))
{ {
tranDate = getColumnValue("tran_date",dom1); tranDate = getColumnValue("tran_date",dom1);
System.out.println("tranDate---"+tranDate);
trnDate = getDateObject(tranDate); trnDate = getDateObject(tranDate);
Calendar calendar = new GregorianCalendar(); Calendar calendar = new GregorianCalendar();
calendar.setTime(trnDate); //mon = calendar.get(Calendar.MONTH);
mon = calendar.get(Calendar.MONTH); //year = calendar.get(Calendar.YEAR);
year = calendar.get(Calendar.YEAR);
columnValue = genericUtility.getValidDateString( columnValue , getApplDateFormat() , "dd-MMM-yyyy" ); columnValue = genericUtility.getValidDateString( columnValue , getApplDateFormat() , "dd-MMM-yyyy" );
/* Commented By Chandni As Date is not setting Properly 19-Apr-2012
if (getApplDateFormat().equalsIgnoreCase("dd-MM-yyyy")) if (getApplDateFormat().equalsIgnoreCase("dd-MM-yyyy"))
{ {
if (mon <= 8) if (mon <= 8)
...@@ -1272,10 +1356,25 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -1272,10 +1356,25 @@ public class CustStock extends ValidatorEJB //implements SessionBean
else if (getApplDateFormat().equalsIgnoreCase("dd-MMM-yyyy")) else if (getApplDateFormat().equalsIgnoreCase("dd-MMM-yyyy"))
{ {
lastDate = days + "-" + tranDate.substring(3, 6) + "-" + year; lastDate = days + "-" + tranDate.substring(3, 6) + "-" + year;
} }*/
/* Commented By Chandni As Date is not setting Properly
valueXmlString.append("<tran_date>").append(lastDate).append("</tran_date>\r\n"); valueXmlString.append("<tran_date>").append(lastDate).append("</tran_date>\r\n");
valueXmlString.append("<from_date>").append(firstDate).append("</from_date>\r\n"); valueXmlString.append("<from_date>").append(firstDate).append("</from_date>\r\n");
valueXmlString.append("<to_date>").append(lastDate).append("</to_date>\r\n"); valueXmlString.append("<to_date>").append(lastDate).append("</to_date>\r\n");
Comment Ended*/
//Added by chandni 19-Apr-2012
calendar.setTime(trnDate);
calendar.set(Calendar.DAY_OF_MONTH,1);
System.out.println("getApplDateFormat()----"+getApplDateFormat());
java.text.SimpleDateFormat dtf = new SimpleDateFormat( getApplDateFormat() );
valueXmlString.append("<from_date>").append(dtf.format( calendar.getTime() )).append("</from_date>\r\n");
int ld = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
calendar.set(Calendar.DAY_OF_MONTH,ld);
System.out.println("Date : " + calendar.getTime());
System.out.println("Last Date: " + lastDate);
valueXmlString.append("<tran_date>").append(dtf.format( calendar.getTime() )).append("</tran_date>\r\n");
valueXmlString.append("<to_date>").append(dtf.format( calendar.getTime() )).append("</to_date>\r\n");
/*select code into :ls_prd_code from period /*select code into :ls_prd_code from period
where fr_date <= :ld_tran_date and to_date >= :ld_tran_date ; where fr_date <= :ld_tran_date and to_date >= :ld_tran_date ;
dw_edit.setitem (1, "prd_code", ls_prd_code)*/ dw_edit.setitem (1, "prd_code", ls_prd_code)*/
......
...@@ -25,7 +25,7 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -25,7 +25,7 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
{ {
/*public void ejbCreate() throws RemoteException, CreateException /*public void ejbCreate() throws RemoteException, CreateException
{ {
} }
public void ejbRemove() public void ejbRemove()
{ {
...@@ -1117,8 +1117,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -1117,8 +1117,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
double saless = 0; double saless = 0;
double clStk = 0; double clStk = 0;
int currentFormNo = 0; int currentFormNo = 0;
int mon = 0; //int mon = 0;
int days =0; //int days =0;
float rateValue = 0f; float rateValue = 0f;
String opValue = ""; String opValue = "";
...@@ -1576,9 +1576,10 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -1576,9 +1576,10 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
trnDate = getDateObject(tranDate); trnDate = getDateObject(tranDate);
Calendar calendar = new GregorianCalendar(); Calendar calendar = new GregorianCalendar();
calendar.setTime(trnDate); calendar.setTime(trnDate);
mon = calendar.get(Calendar.MONTH); //mon = calendar.get(Calendar.MONTH);
year = calendar.get(Calendar.YEAR); //year = calendar.get(Calendar.YEAR);
columnValue = genericUtility.getValidDateString( columnValue , getApplDateFormat() , "dd-MMM-yyyy" ); columnValue = genericUtility.getValidDateString( columnValue , getApplDateFormat() , "dd-MMM-yyyy" );
/* Commented By Chandni As Date is not setting Properly 19-Apr-2012
if (getApplDateFormat().equalsIgnoreCase("dd-MM-yyyy")) if (getApplDateFormat().equalsIgnoreCase("dd-MM-yyyy"))
{ {
if (mon <= 8) if (mon <= 8)
...@@ -1628,9 +1629,26 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -1628,9 +1629,26 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
{ {
lastDate = days + "-" + tranDate.substring(3, 6) + "-" + year; lastDate = days + "-" + tranDate.substring(3, 6) + "-" + year;
} }
*/
/* Commented By Chandni As Date is not setting Properly
valueXmlString.append("<tran_date>").append(lastDate).append("</tran_date>\r\n"); valueXmlString.append("<tran_date>").append(lastDate).append("</tran_date>\r\n");
valueXmlString.append("<from_date>").append(firstDate).append("</from_date>\r\n"); valueXmlString.append("<from_date>").append(firstDate).append("</from_date>\r\n");
valueXmlString.append("<to_date>").append(lastDate).append("</to_date>\r\n"); valueXmlString.append("<to_date>").append(lastDate).append("</to_date>\r\n");
Comment Ended*/
//Added by chandni 19-Apr-2012
calendar.setTime(trnDate);
calendar.set(Calendar.DAY_OF_MONTH,1);
System.out.println("getApplDateFormat()----"+getApplDateFormat());
java.text.SimpleDateFormat dtf = new SimpleDateFormat( getApplDateFormat() );
valueXmlString.append("<from_date>").append(dtf.format( calendar.getTime() )).append("</from_date>\r\n");
int ld = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
calendar.set(Calendar.DAY_OF_MONTH,ld);
System.out.println("Date : " + calendar.getTime());
System.out.println("Last Date: " + lastDate);
valueXmlString.append("<tran_date>").append(dtf.format( calendar.getTime() )).append("</tran_date>\r\n");
valueXmlString.append("<to_date>").append(dtf.format( calendar.getTime() )).append("</to_date>\r\n");
/*select code into :ls_prd_code from period /*select code into :ls_prd_code from period
where fr_date <= :ld_tran_date and to_date >= :ld_tran_date ; where fr_date <= :ld_tran_date and to_date >= :ld_tran_date ;
dw_edit.setitem (1, "prd_code", ls_prd_code)*/ dw_edit.setitem (1, "prd_code", ls_prd_code)*/
......
...@@ -11,6 +11,7 @@ import java.util.*; ...@@ -11,6 +11,7 @@ import java.util.*;
import java.util.Date; import java.util.Date;
import java.sql.*; import java.sql.*;
import org.w3c.dom.*; import org.w3c.dom.*;
import javax.xml.parsers.*; import javax.xml.parsers.*;
import javax.ejb.*; import javax.ejb.*;
import javax.naming.InitialContext; import javax.naming.InitialContext;
...@@ -36,12 +37,13 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -36,12 +37,13 @@ public class CustStock extends ValidatorEJB //implements SessionBean
{ {
} }
*/ */
public String wfValData() throws RemoteException,ITMException public String wfValData() throws RemoteException,ITMException
{ {
return ""; return "";
} }
// Commented by Chandni Shah 17-Apr-2012
public String wfValData(String xmlString, String formNo, String editFlag) throws RemoteException,ITMException /*public String wfValData(String xmlString, String formNo, String editFlag) throws RemoteException,ITMException
{ {
Document dom = null; Document dom = null;
String errString = ""; String errString = "";
...@@ -56,10 +58,69 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -56,10 +58,69 @@ public class CustStock extends ValidatorEJB //implements SessionBean
} }
errString = wfValData(dom, formNo, editFlag); errString = wfValData(dom, formNo, editFlag);
return (errString); return (errString);
}*/
// Added by Chandni Shah 17-Apr-2012
public String wfValData(String xmlString, String xmlString1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
String errString = null;
Document dom = null;
Document dom1 = null;
Document dom2 = null;
try
{
//System.out.println("xmlString:-" + xmlString );
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
}
catch(Exception e)
{
//System.out.println("Exception : SOrderFormEJB : wfValData(String xmlString) : ==>\n"+e.getMessage());
throw new ITMException( e );
}
return (errString);
} }
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
public String wfValData(Document dom, String formNo, String editFlag) throws RemoteException,ITMException {
String errString = null;
Document dom = null;
Document dom1 = null;
Document dom2 = null;
try
{
System.out.println("cHANDNI 11 xmlString:-" + xmlString );
System.out.println("cHANDNI 12 xmlString:-" + xmlString1 );
//long startTime = System.currentTimeMillis();
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
System.out.println("Chandni 13 dom"+dom);
System.out.println("Chandni 14 dom"+dom1);
if (xmlString2.trim().length() > 0 )
{
dom2 = parseString("<Root>" + xmlString2+ "</Root>");
}
System.out.println("Chandni 15 dom"+dom2);
//long endTime = System.currentTimeMillis();
//long totalTime = endTime - startTime;
//System.out.println(xmlString2);
//System.out.println("start Time Spend :: "+startTime+" Milliseconds");
//System.out.println("End Time Spend :: "+endTime+" Milliseconds");
//System.out.println("Total Time Spend :: "+totalTime+" Milliseconds");
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
}
catch(Exception e)
{
//System.out.println("Exception : SOrderFormEJB : wfValData(String xmlString) : ==>\n"+e.getMessage());
throw new ITMException( e );
}
return (errString);
}
// Commented by Chandni Shah 17-Apr-2012
//public String wfValData(Document dom, String formNo, String editFlag) throws RemoteException,ITMException
public String wfValData(Document dom, Document dom1,Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
// Added by Chandni Shah 17-Apr-2012
boolean checkNextCol = true; boolean checkNextCol = true;
String columnName = ""; String columnName = "";
String columnValue = ""; String columnValue = "";
...@@ -90,8 +151,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -90,8 +151,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean
java.util.Date restUpto2 = null; java.util.Date restUpto2 = null;
SimpleDateFormat sdfFormat=null; SimpleDateFormat sdfFormat=null;
// 11/09/09 manoharan // 11/09/09 manoharan
String begPart = null; String begPart = null;
String endPart = null; String endPart = null;
String itemDescr = null; String itemDescr = null;
// end 11/09/09 manoharan // end 11/09/09 manoharan
...@@ -101,51 +162,61 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -101,51 +162,61 @@ public class CustStock extends ValidatorEJB //implements SessionBean
try try
{ {
System.out.println("CustStockEJB validation"); //System.out.println("CustStockEJB validation");
AppConnectParm appConnect = new AppConnectParm(); /*AppConnectParm appConnect = new AppConnectParm();
Properties p = appConnect.getProperty(); Properties p = appConnect.getProperty();
InitialContext ctx = new InitialContext(p); InitialContext ctx = new InitialContext(p);
itmDBAccess = (ITMDBAccessLocal)ctx.lookup("ibase/ITMDBAccessEJB/local"); itmDBAccess = (ITMDBAccessLocal)ctx.lookup("ibase/ITMDBAccessEJB/local");
*/
//itmDBAccess = itmDBAccessHome.create(); //itmDBAccess = itmDBAccessHome.create();
ibase.webitm.utility.GenericUtility genericUtility = new ibase.webitm.utility.GenericUtility(); ibase.webitm.utility.GenericUtility genericUtility = new ibase.webitm.utility.GenericUtility();
conn = getConnection(); conn = getConnection();
userId = getColumnValue( "user_id", dom ); userId = genericUtility.getColumnValue( "user_id", dom );
currentFormNo = Integer.parseInt( formNo ); //currentFormNo = Integer.parseInt( formNo );
currentFormNo = Integer.parseInt( objContext ); // Added by Chandni Shah 17-Apr-2012
switch ( currentFormNo ) switch ( currentFormNo )
{ {
case 1: case 1:
columnValue = getColumnValue( "tran_date", dom ); System.out.println("currentFormNo:::"+currentFormNo);
columnValue = genericUtility.getColumnValue("tran_date", dom );
System.out.println("columnValue 11:"+columnValue);
if(columnValue != null) if(columnValue != null)
{ {
siteCode = getColumnValue( "site_code", dom ); siteCode = genericUtility.getColumnValue( "site_code", dom );
System.out.println("columnValue 12:"+columnValue+"_and checkNextCol:"+checkNextCol);
if ( columnValue.length() != 0 && checkNextCol ) if ( columnValue.length() != 0 && checkNextCol )
{ {
System.out.println("inside columnValue:::");
errCode = nfCheckPeriod("SAL",getDateObject(columnValue),siteCode); errCode = nfCheckPeriod("SAL",getDateObject(columnValue),siteCode);
if (errCode.length() != 0) if (errCode.length() != 0)
{ {
System.out.println("errCode k ander");
//errString = getErrorString("",errCode,userId); //errString = getErrorString("",errCode,userId);
//checkNextCol = false; //checkNextCol = false;
errString = itmDBAccess.getErrorString("tran_date",errCode,userId,null,conn); //errString = itmDBAccess.getErrorString("tran_date",errCode,userId);//,null,conn);
errString = getErrorString("tran_date",errCode,userId);//,null,conn); // Change by Chandni Shah 17-Apr-2012
break; break;
} }
} }
} }
columnValue = getColumnValue("cust_code",dom); //columnValue = getColumnValue("cust_code",dom);
columnValue = genericUtility.getColumnValue("cust_code",dom); // Change by Chandni Shah 17-Apr-2012
if(columnValue != null) if(columnValue != null)
{ {
siteCode = getColumnValue("site_code",dom); //siteCode = getColumnValue("site_code",dom);
siteCode = genericUtility.getColumnValue("site_code",dom);
System.out.println("siteCode [" +siteCode+ "]"); System.out.println("siteCode [" +siteCode+ "]");
tranDate = getColumnValue("tran_date",dom); tranDate = genericUtility.getColumnValue("tran_date",dom);
if (columnValue.length() != 0 && checkNextCol) if (columnValue.length() != 0 && checkNextCol)
{ {
errCode = isCustomer(siteCode,columnValue,"S-CSTK",conn); errCode = isCustomer(siteCode,columnValue,"S-CSTK",conn);
System.out.println("errCode [" +errCode+ "]"); System.out.println("errCode [" +errCode+ "]");
if (errCode.length() !=0 ) if (errCode.length() !=0 )
{ {
//errString = getErrorString("cust_code",errCode,userId); errString = getErrorString("cust_code",errCode,userId);
//checkNextCol = false; //checkNextCol = false;
errString = itmDBAccess.getErrorString("cust_code",errCode,userId,null,conn); //errString = itmDBAccess.getErrorString("cust_code",errCode,userId);//,null,conn);
break; break;
} }
} }
...@@ -162,20 +233,20 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -162,20 +233,20 @@ public class CustStock extends ValidatorEJB //implements SessionBean
{ {
if (rs.getInt(1) == 0) if (rs.getInt(1) == 0)
{ {
//errString = getErrorString("cust_code","VTSITECUST",userId); errString = getErrorString("cust_code","VTSITECUST",userId);
//checkNextCol = false; //checkNextCol = false;
errString = itmDBAccess.getErrorString("cust_code","VTSITECUST",userId,null,conn); //errString = itmDBAccess.getErrorString("cust_code","VTSITECUST",userId);//,null,conn);
break; break;
} }
} }
} }
else else
{ {
/*Select count(1) into :cnt /* Select count(1) into :cnt
From customer From customer
Where cust_code = :mval Where cust_code = :mval
And (case when channel_partner is null then 'N' else channel_partner end ) = 'N'; And (case when channel_partner is null then 'N' else channel_partner end ) = 'N';
If cnt = 0 Then errcode = "VTCUST"*/ If cnt = 0 Then errcode = "VTCUST" */
sqlCnt = "SELECT COUNT(1) COUNT FROM CUSTOMER WHERE CUST_CODE = '" + columnValue + "' And (CASE WHEN CHANNEL_PARTNER IS NULL THEN 'N' ELSE CHANNEL_PARTNER END ) = 'N'"; sqlCnt = "SELECT COUNT(1) COUNT FROM CUSTOMER WHERE CUST_CODE = '" + columnValue + "' And (CASE WHEN CHANNEL_PARTNER IS NULL THEN 'N' ELSE CHANNEL_PARTNER END ) = 'N'";
System.out.println("sql :\n"+sqlCnt); System.out.println("sql :\n"+sqlCnt);
stmt = conn.createStatement(); stmt = conn.createStatement();
...@@ -183,7 +254,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -183,7 +254,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if (rs.next() && rs.getInt( "COUNT" ) == 0) if (rs.next() && rs.getInt( "COUNT" ) == 0)
{ {
//errCode = "VTCUST"; //errCode = "VTCUST";
errString = itmDBAccess.getErrorString("cust_code","VTCUST",userId,null,conn); //errString = itmDBAccess.getErrorString("cust_code","VTCUST",userId);//,null,conn);
errString = getErrorString("cust_code","VTCUST",userId);//,null,conn);
break; break;
} }
} }
...@@ -193,10 +265,11 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -193,10 +265,11 @@ public class CustStock extends ValidatorEJB //implements SessionBean
stmt = null; stmt = null;
} }
} }
columnValue = getColumnValue("site_code",dom); //columnValue = getColumnValue("site_code",dom);
columnValue = genericUtility.getColumnValue("site_code",dom);
if(columnValue != null) if(columnValue != null)
{ {
custCode = getColumnValue("cust_code",dom); custCode = genericUtility.getColumnValue("cust_code",dom);
if (checkNextCol) if (checkNextCol)
{ {
sqlCnt = "SELECT NVL(COUNT(*),0) FROM SITE WHERE SITE_CODE = '"+columnValue+"'"; sqlCnt = "SELECT NVL(COUNT(*),0) FROM SITE WHERE SITE_CODE = '"+columnValue+"'";
...@@ -207,10 +280,10 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -207,10 +280,10 @@ public class CustStock extends ValidatorEJB //implements SessionBean
{ {
if (rs.getInt(1)==0) if (rs.getInt(1)==0)
{ {
//errString = getErrorString("site_code","VTSITECD1",userId); errString = getErrorString("site_code","VTSITECD1",userId);
//checkNextCol = false; //checkNextCol = false;
errString = itmDBAccess.getErrorString("site_code","VTSITECD1",userId,null,conn); //errString = itmDBAccess.getErrorString("site_code","VTSITECD1",userId);//,null,conn);
break; break;
} }
} }
...@@ -233,10 +306,10 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -233,10 +306,10 @@ public class CustStock extends ValidatorEJB //implements SessionBean
{ {
if (rs.getInt(1)==0) if (rs.getInt(1)==0)
{ {
//errString = getErrorString("site_code","VTSITECUST",userId); errString = getErrorString("site_code","VTSITECUST",userId);
//checkNextCol = false; //checkNextCol = false;
errString = itmDBAccess.getErrorString("site_code","VTSITECUST",userId,null,conn); //errString = itmDBAccess.getErrorString("site_code","VTSITECUST",userId);//,null,conn);
break; break;
} }
} }
...@@ -249,7 +322,7 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -249,7 +322,7 @@ public class CustStock extends ValidatorEJB //implements SessionBean
} }
//SHWETA 2/14/2005 --Not required at the time of validation //SHWETA 2/14/2005 --Not required at the time of validation
columnValue = getColumnValue("tran_id__last",dom); columnValue = genericUtility.getColumnValue("tran_id__last",dom);
if (columnValue != null) if (columnValue != null)
{ {
Statement stmt14 = null; Statement stmt14 = null;
...@@ -291,11 +364,11 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -291,11 +364,11 @@ public class CustStock extends ValidatorEJB //implements SessionBean
} }
} }
} }
columnValue = getColumnValue("to_date",dom); columnValue = genericUtility.getColumnValue("to_date",dom);
if (columnValue != null) if (columnValue != null)
{ {
frdate1 = getColumnValue("from_date",dom); frdate1 = genericUtility.getColumnValue("from_date",dom);
tranDate1 = getColumnValue("tran_date",dom); tranDate1 = genericUtility.getColumnValue("tran_date",dom);
if (!columnValue.equals("") && checkNextCol) if (!columnValue.equals("") && checkNextCol)
{ {
frdate2 = getDateObject(frdate1); frdate2 = getDateObject(frdate1);
...@@ -304,20 +377,22 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -304,20 +377,22 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if (todate.compareTo(frdate2) < 0) if (todate.compareTo(frdate2) < 0)
{ {
//errCode = "VFRTODATE"; //errCode = "VFRTODATE";
errString = itmDBAccess.getErrorString("to_date","VFRTODATE",userId,null,conn); //errString = itmDBAccess.getErrorString("to_date","VFRTODATE",userId);//,null,conn);
errString = getErrorString("to_date","VFRTODATE",userId);//,null,conn);
break; break;
} }
else if (tranDate2.compareTo(todate) < 0) else if (tranDate2.compareTo(todate) < 0)
{ {
//errCode = "VTDATE9"; //errCode = "VTDATE9";
errString = itmDBAccess.getErrorString("to_date","VTDATE9",userId,null,conn); //errString = itmDBAccess.getErrorString("to_date","VTDATE9",userId);//,null,conn);
errString = getErrorString("to_date","VTDATE9",userId);//,null,conn);
break; break;
} }
else else
{ {
custCode = getColumnValue("cust_code",dom); custCode = genericUtility.getColumnValue("cust_code",dom);
siteCode = getColumnValue("site_code",dom); siteCode = genericUtility.getColumnValue("site_code",dom);
itemSer = getColumnValue("item_ser",dom); itemSer = genericUtility.getColumnValue("item_ser",dom);
if (itemSer.length() == 0) if (itemSer.length() == 0)
{ {
selQueryBuff = new StringBuffer(); selQueryBuff = new StringBuffer();
...@@ -344,7 +419,7 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -344,7 +419,7 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if (rs.getInt(1) > 0 && editFlag.equals("A")) if (rs.getInt(1) > 0 && editFlag.equals("A"))
{ {
//errCode = "VTDUPREC"; //errCode = "VTDUPREC";
errString = itmDBAccess.getErrorString("to_date","VTDUPREC",userId,null,conn); errString = itmDBAccess.getErrorString("to_date","VTDUPREC",userId);//,null,conn);
break; break;
} }
} }
...@@ -375,13 +450,14 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -375,13 +450,14 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if (rs.getInt(1) == 0) if (rs.getInt(1) == 0)
{ {
//errCode = "VTITMSER1"; //errCode = "VTITMSER1";
errString = itmDBAccess.getErrorString("item_ser","VTITMSER1",userId,null,conn); //errString = itmDBAccess.getErrorString("item_ser","VTITMSER1",userId);//,null,conn);
errString = getErrorString("item_ser","VTITMSER1",userId);//,null,conn);
break; break;
} }
else else
{ {
custCode = getColumnValue("cust_code",dom); custCode = genericUtility.getColumnValue("cust_code",dom);
itemSer = getColumnValue("item_ser",dom); itemSer = genericUtility.getColumnValue("item_ser",dom);
selQueryBuff = new StringBuffer(); selQueryBuff = new StringBuffer();
selQueryBuff.append("SELECT NVL(COUNT(*),0) FROM CUSTOMER_SERIES WHERE CUST_CODE = '"); selQueryBuff.append("SELECT NVL(COUNT(*),0) FROM CUSTOMER_SERIES WHERE CUST_CODE = '");
selQueryBuff.append(custCode).append("' AND ITEM_SER = '"); selQueryBuff.append(custCode).append("' AND ITEM_SER = '");
...@@ -394,7 +470,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -394,7 +470,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if (rs2.getInt(1) == 0) if (rs2.getInt(1) == 0)
{ {
//errCode = "VTITEMSER4"; //errCode = "VTITEMSER4";
errString = itmDBAccess.getErrorString("item_ser","VTITEMSER4",userId,null,conn); //errString = itmDBAccess.getErrorString("item_ser","VTITEMSER4",userId);//,null,conn);
errString = getErrorString("item_ser","VTITEMSER4",userId);//,null,conn);
break; break;
} }
} }
...@@ -426,7 +503,7 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -426,7 +503,7 @@ public class CustStock extends ValidatorEJB //implements SessionBean
errcode = 'VTINVSCHDT' errcode = 'VTINVSCHDT'
end if end if
end if*/ end if*/
columnValue = getColumnValue("sch_date__1",dom); columnValue = genericUtility.getColumnValue("sch_date__1",dom);
if(columnValue != null) if(columnValue != null)
{ {
sdfFormat = new SimpleDateFormat(getApplDateFormat()); sdfFormat = new SimpleDateFormat(getApplDateFormat());
...@@ -434,11 +511,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -434,11 +511,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if ( schDate.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 ) if ( schDate.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 )
{ {
//errCode = "VTINVSCHDT"; //errCode = "VTINVSCHDT";
errString = itmDBAccess.getErrorString("sch_date__1","VTINVSCHDT",userId,null,conn); //errString = itmDBAccess.getErrorString("sch_date__1","VTINVSCHDT",userId);//,null,conn);
errString = getErrorString("sch_date__1","VTINVSCHDT",userId);//,null,conn);
break; break;
} }
} }
columnValue = getColumnValue("sch_date__2",dom); columnValue =genericUtility.getColumnValue("sch_date__2",dom);
if(columnValue != null) if(columnValue != null)
{ {
sdfFormat = new SimpleDateFormat(getApplDateFormat()); sdfFormat = new SimpleDateFormat(getApplDateFormat());
...@@ -446,11 +524,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -446,11 +524,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if ( schDate2.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 ) if ( schDate2.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 )
{ {
//errCode = "VTINVSCHDT"; //errCode = "VTINVSCHDT";
errString = itmDBAccess.getErrorString("sch_date__2","VTINVSCHDT",userId,null,conn); //errString = itmDBAccess.getErrorString("sch_date__2","VTINVSCHDT",userId);//,null,conn);
errString = getErrorString("sch_date__2","VTINVSCHDT",userId);//,null,conn);
break; break;
} }
} }
columnValue = getColumnValue("sch_date__3",dom); columnValue = genericUtility.getColumnValue("sch_date__3",dom);
if(columnValue != null) if(columnValue != null)
{ {
sdfFormat = new SimpleDateFormat(getApplDateFormat()); sdfFormat = new SimpleDateFormat(getApplDateFormat());
...@@ -458,11 +537,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -458,11 +537,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if ( schDate3.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 ) if ( schDate3.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 )
{ {
//errCode = "VTINVSCHDT"; //errCode = "VTINVSCHDT";
errString = itmDBAccess.getErrorString("sch_date__3","VTINVSCHDT",userId,null,conn); //errString = itmDBAccess.getErrorString("sch_date__3","VTINVSCHDT",userId);//,null,conn);
errString = getErrorString("sch_date__3","VTINVSCHDT",userId);//,null,conn);
break; break;
} }
} }
columnValue = getColumnValue("sch_date__4",dom); columnValue = genericUtility.getColumnValue("sch_date__4",dom);
if(columnValue != null) if(columnValue != null)
{ {
sdfFormat = new SimpleDateFormat(getApplDateFormat()); sdfFormat = new SimpleDateFormat(getApplDateFormat());
...@@ -470,11 +550,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -470,11 +550,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if ( schDate4.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 ) if ( schDate4.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 )
{ {
//errCode = "VTINVSCHDT"; //errCode = "VTINVSCHDT";
errString = itmDBAccess.getErrorString("sch_date__4","VTINVSCHDT",userId,null,conn); //errString = itmDBAccess.getErrorString("sch_date__4","VTINVSCHDT",userId);//,null,conn);
errString = getErrorString("sch_date__4","VTINVSCHDT",userId);//,null,conn);
break; break;
} }
} }
columnValue = getColumnValue("sch_date__5",dom); columnValue = genericUtility.getColumnValue("sch_date__5",dom);
if(columnValue != null) if(columnValue != null)
{ {
sdfFormat = new SimpleDateFormat(getApplDateFormat()); sdfFormat = new SimpleDateFormat(getApplDateFormat());
...@@ -482,11 +563,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -482,11 +563,12 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if ( schDate5.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 ) if ( schDate5.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 )
{ {
//errCode = "VTINVSCHDT"; //errCode = "VTINVSCHDT";
errString = itmDBAccess.getErrorString("sch_date__5","VTINVSCHDT",userId,null,conn); //errString = itmDBAccess.getErrorString("sch_date__5","VTINVSCHDT",userId);//,null,conn);
errString = getErrorString("sch_date__5","VTINVSCHDT",userId);//,null,conn);
break; break;
} }
} }
columnValue = getColumnValue("sch_date__6",dom); columnValue = genericUtility.getColumnValue("sch_date__6",dom);
if(columnValue != null) if(columnValue != null)
{ {
sdfFormat = new SimpleDateFormat(getApplDateFormat()); sdfFormat = new SimpleDateFormat(getApplDateFormat());
...@@ -494,7 +576,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -494,7 +576,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean
if ( schDate6.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 ) if ( schDate6.compareTo(getDateObject(sdfFormat.format( new Date()))) < 0 )
{ {
//errCode = "VTINVSCHDT"; //errCode = "VTINVSCHDT";
errString = itmDBAccess.getErrorString("sch_date__6","VTINVSCHDT",userId,null,conn); //errString = itmDBAccess.getErrorString("sch_date__6","VTINVSCHDT",userId);//,null,conn);
errString = getErrorString("sch_date__6","VTINVSCHDT",userId);//,null,conn);
break; break;
} }
} }
...@@ -615,11 +698,11 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -615,11 +698,11 @@ public class CustStock extends ValidatorEJB //implements SessionBean
{ {
itemDescr = " - " + itemDescr; itemDescr = " - " + itemDescr;
} }
begPart = errString.substring( 0, errString.indexOf("<trace>") + 7 ); begPart = errString.substring( 0, errString.indexOf("<trace>") + 7 );
endPart = errString.substring( errString.indexOf("</trace>")); endPart = errString.substring( errString.indexOf("</trace>"));
errString = begPart + " Invalid Item : " + columnValue.toString() + itemDescr + " for Site_code : "+siteCode + " " + endPart; errString = begPart + " Invalid Item : " + columnValue.toString() + itemDescr + " for Site_code : "+siteCode + " " + endPart;
begPart =null; begPart =null;
endPart =null; endPart =null;
// end 11/09/09 manoharan // end 11/09/09 manoharan
break; break;
} }
...@@ -881,8 +964,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -881,8 +964,8 @@ public class CustStock extends ValidatorEJB //implements SessionBean
double saless = 0; double saless = 0;
double clStk = 0; double clStk = 0;
int currentFormNo = 0; int currentFormNo = 0;
int mon = 0; //int mon = 0;
int days =0; //int days =0;
float rateValue = 0f; float rateValue = 0f;
String opValue = ""; String opValue = "";
...@@ -1218,12 +1301,13 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -1218,12 +1301,13 @@ public class CustStock extends ValidatorEJB //implements SessionBean
else if (currentColumn.trim().equals("tran_date")) else if (currentColumn.trim().equals("tran_date"))
{ {
tranDate = getColumnValue("tran_date",dom1); tranDate = getColumnValue("tran_date",dom1);
System.out.println("tranDate---"+tranDate);
trnDate = getDateObject(tranDate); trnDate = getDateObject(tranDate);
Calendar calendar = new GregorianCalendar(); Calendar calendar = new GregorianCalendar();
calendar.setTime(trnDate); //mon = calendar.get(Calendar.MONTH);
mon = calendar.get(Calendar.MONTH); //year = calendar.get(Calendar.YEAR);
year = calendar.get(Calendar.YEAR);
columnValue = genericUtility.getValidDateString( columnValue , getApplDateFormat() , "dd-MMM-yyyy" ); columnValue = genericUtility.getValidDateString( columnValue , getApplDateFormat() , "dd-MMM-yyyy" );
/* Commented By Chandni As Date is not setting Properly 19-Apr-2012
if (getApplDateFormat().equalsIgnoreCase("dd-MM-yyyy")) if (getApplDateFormat().equalsIgnoreCase("dd-MM-yyyy"))
{ {
if (mon <= 8) if (mon <= 8)
...@@ -1272,10 +1356,25 @@ public class CustStock extends ValidatorEJB //implements SessionBean ...@@ -1272,10 +1356,25 @@ public class CustStock extends ValidatorEJB //implements SessionBean
else if (getApplDateFormat().equalsIgnoreCase("dd-MMM-yyyy")) else if (getApplDateFormat().equalsIgnoreCase("dd-MMM-yyyy"))
{ {
lastDate = days + "-" + tranDate.substring(3, 6) + "-" + year; lastDate = days + "-" + tranDate.substring(3, 6) + "-" + year;
} }*/
/* Commented By Chandni As Date is not setting Properly
valueXmlString.append("<tran_date>").append(lastDate).append("</tran_date>\r\n"); valueXmlString.append("<tran_date>").append(lastDate).append("</tran_date>\r\n");
valueXmlString.append("<from_date>").append(firstDate).append("</from_date>\r\n"); valueXmlString.append("<from_date>").append(firstDate).append("</from_date>\r\n");
valueXmlString.append("<to_date>").append(lastDate).append("</to_date>\r\n"); valueXmlString.append("<to_date>").append(lastDate).append("</to_date>\r\n");
Comment Ended*/
//Added by chandni 19-Apr-2012
calendar.setTime(trnDate);
calendar.set(Calendar.DAY_OF_MONTH,1);
System.out.println("getApplDateFormat()----"+getApplDateFormat());
java.text.SimpleDateFormat dtf = new SimpleDateFormat( getApplDateFormat() );
valueXmlString.append("<from_date>").append(dtf.format( calendar.getTime() )).append("</from_date>\r\n");
int ld = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
calendar.set(Calendar.DAY_OF_MONTH,ld);
System.out.println("Date : " + calendar.getTime());
System.out.println("Last Date: " + lastDate);
valueXmlString.append("<tran_date>").append(dtf.format( calendar.getTime() )).append("</tran_date>\r\n");
valueXmlString.append("<to_date>").append(dtf.format( calendar.getTime() )).append("</to_date>\r\n");
/*select code into :ls_prd_code from period /*select code into :ls_prd_code from period
where fr_date <= :ld_tran_date and to_date >= :ld_tran_date ; where fr_date <= :ld_tran_date and to_date >= :ld_tran_date ;
dw_edit.setitem (1, "prd_code", ls_prd_code)*/ dw_edit.setitem (1, "prd_code", ls_prd_code)*/
......
...@@ -25,7 +25,7 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -25,7 +25,7 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
{ {
/*public void ejbCreate() throws RemoteException, CreateException /*public void ejbCreate() throws RemoteException, CreateException
{ {
} }
public void ejbRemove() public void ejbRemove()
{ {
...@@ -1117,8 +1117,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -1117,8 +1117,8 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
double saless = 0; double saless = 0;
double clStk = 0; double clStk = 0;
int currentFormNo = 0; int currentFormNo = 0;
int mon = 0; //int mon = 0;
int days =0; //int days =0;
float rateValue = 0f; float rateValue = 0f;
String opValue = ""; String opValue = "";
...@@ -1576,9 +1576,10 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -1576,9 +1576,10 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
trnDate = getDateObject(tranDate); trnDate = getDateObject(tranDate);
Calendar calendar = new GregorianCalendar(); Calendar calendar = new GregorianCalendar();
calendar.setTime(trnDate); calendar.setTime(trnDate);
mon = calendar.get(Calendar.MONTH); //mon = calendar.get(Calendar.MONTH);
year = calendar.get(Calendar.YEAR); //year = calendar.get(Calendar.YEAR);
columnValue = genericUtility.getValidDateString( columnValue , getApplDateFormat() , "dd-MMM-yyyy" ); columnValue = genericUtility.getValidDateString( columnValue , getApplDateFormat() , "dd-MMM-yyyy" );
/* Commented By Chandni As Date is not setting Properly 19-Apr-2012
if (getApplDateFormat().equalsIgnoreCase("dd-MM-yyyy")) if (getApplDateFormat().equalsIgnoreCase("dd-MM-yyyy"))
{ {
if (mon <= 8) if (mon <= 8)
...@@ -1628,9 +1629,26 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean ...@@ -1628,9 +1629,26 @@ public class CustStockItem extends ValidatorEJB //implements SessionBean
{ {
lastDate = days + "-" + tranDate.substring(3, 6) + "-" + year; lastDate = days + "-" + tranDate.substring(3, 6) + "-" + year;
} }
*/
/* Commented By Chandni As Date is not setting Properly
valueXmlString.append("<tran_date>").append(lastDate).append("</tran_date>\r\n"); valueXmlString.append("<tran_date>").append(lastDate).append("</tran_date>\r\n");
valueXmlString.append("<from_date>").append(firstDate).append("</from_date>\r\n"); valueXmlString.append("<from_date>").append(firstDate).append("</from_date>\r\n");
valueXmlString.append("<to_date>").append(lastDate).append("</to_date>\r\n"); valueXmlString.append("<to_date>").append(lastDate).append("</to_date>\r\n");
Comment Ended*/
//Added by chandni 19-Apr-2012
calendar.setTime(trnDate);
calendar.set(Calendar.DAY_OF_MONTH,1);
System.out.println("getApplDateFormat()----"+getApplDateFormat());
java.text.SimpleDateFormat dtf = new SimpleDateFormat( getApplDateFormat() );
valueXmlString.append("<from_date>").append(dtf.format( calendar.getTime() )).append("</from_date>\r\n");
int ld = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
calendar.set(Calendar.DAY_OF_MONTH,ld);
System.out.println("Date : " + calendar.getTime());
System.out.println("Last Date: " + lastDate);
valueXmlString.append("<tran_date>").append(dtf.format( calendar.getTime() )).append("</tran_date>\r\n");
valueXmlString.append("<to_date>").append(dtf.format( calendar.getTime() )).append("</to_date>\r\n");
/*select code into :ls_prd_code from period /*select code into :ls_prd_code from period
where fr_date <= :ld_tran_date and to_date >= :ld_tran_date ; where fr_date <= :ld_tran_date and to_date >= :ld_tran_date ;
dw_edit.setitem (1, "prd_code", ls_prd_code)*/ dw_edit.setitem (1, "prd_code", ls_prd_code)*/
......
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