Commit 492506bf authored by ngadkari's avatar ngadkari

added new site_code and tran_date columns

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@196010 ce508802-f39f-4f6c-b175-0d175dae99d5
parent e33a9634
...@@ -9,6 +9,7 @@ package ibase.webitm.ejb.dis; ...@@ -9,6 +9,7 @@ package ibase.webitm.ejb.dis;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.fin.FinCommon;
//import ibase.webitm.utility.GenericUtility; //import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException; import java.rmi.RemoteException;
...@@ -83,6 +84,7 @@ public class InvoiceAmendmentIC extends ValidatorEJB implements InvoiceAmendment ...@@ -83,6 +84,7 @@ public class InvoiceAmendmentIC extends ValidatorEJB implements InvoiceAmendment
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ibase.utility.E12GenericUtility genericUtility= new ibase.utility.E12GenericUtility(); ibase.utility.E12GenericUtility genericUtility= new ibase.utility.E12GenericUtility();
FinCommon finCommon = new FinCommon();
// GenericUtility genericUtility = GenericUtility.getInstance(); // GenericUtility genericUtility = GenericUtility.getInstance();
...@@ -100,10 +102,10 @@ public class InvoiceAmendmentIC extends ValidatorEJB implements InvoiceAmendment ...@@ -100,10 +102,10 @@ public class InvoiceAmendmentIC extends ValidatorEJB implements InvoiceAmendment
int cnt = 0; int cnt = 0;
String columnValue = ""; String columnValue = "";
String columnValue1 = ""; String columnValue1 = "";
String confirmed = ""; String confirmed = "",tranDateStr="";
String sql = ""; String sql = "";
Timestamp date1 = null; Timestamp date1 = null;
Timestamp date2 = null; Timestamp date2 = null,TranDate=null;
int currentFormNo = 0; int currentFormNo = 0;
ConnDriver connDriver = null; ConnDriver connDriver = null;
...@@ -764,6 +766,87 @@ public class InvoiceAmendmentIC extends ValidatorEJB implements InvoiceAmendment ...@@ -764,6 +766,87 @@ public class InvoiceAmendmentIC extends ValidatorEJB implements InvoiceAmendment
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
} }
} }
//added by nandkumar gadkari on 17/01/19-------start------------------
else if (childNodeName.equalsIgnoreCase("site_code")) {
siteCode = checkNull(genericUtility.getColumnValue("site_code", dom));
System.out.println("siteCode: " + siteCode);
if (siteCode == null || siteCode.trim().length() == 0) {
errCode = "VMSITECD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("Site Code can not be blank!!");
} else {
if (siteCode != null && siteCode.trim().length() > 0) {
if (!(isExist(conn, "site", "site_code", siteCode))) {
errCode = "VMSITE1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
columnValue = null;
columnValue = genericUtility.getColumnValue( "invoice_id", dom );
if( columnValue != null && columnValue.trim().length() > 0 )
{
sql = " select Count(*) cnt from invoice where invoice_id = ? and site_code = ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, columnValue );
pstmt.setString( 2, siteCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
cnt = rs.getInt( "cnt" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( cnt == 0 )
{
errCode = "VTINVSITE1";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
}
}
}
else if (childNodeName.equalsIgnoreCase("tran_date"))
{
tranDateStr = (genericUtility.getColumnValue("tran_date", dom));
if(tranDateStr == null || tranDateStr.trim().length() ==0)
{
errCode ="VTTRANDT";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
else
{
tranDateStr=checkNullAndTrim(tranDateStr);
siteCode = checkNullAndTrim(genericUtility.getColumnValue("site_code", dom));
if(siteCode !=null && siteCode.trim().length() > 0)
{
System.out.println("@@@@ Tran Date[" + tranDateStr + "]");
TranDate = Timestamp.valueOf(genericUtility.getValidDateString(tranDateStr.toString(),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+" 00:00:00.0");
System.out.println("Trandate is"+TranDate);
errCode = finCommon.nfCheckPeriod("FIN", TranDate,siteCode, conn);
System.out.println("Errorcode in TranDate"+errCode);
if (errCode != null && errCode.trim().length() > 0)
{
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
}
//added by nandkumar gadkari on 17/01/19-------end------------------
} }
} }
break; break;
...@@ -1018,6 +1101,7 @@ public String itemChanged( Document dom, Document dom1, Document dom2, String ob ...@@ -1018,6 +1101,7 @@ public String itemChanged( Document dom, Document dom1, Document dom2, String ob
String remark = ""; String remark = "";
String chequeNo = ""; String chequeNo = "";
String custPord = ""; String custPord = "";
String siteCode = "";
Date effFrom = null; Date effFrom = null;
Date sbDate = null; Date sbDate = null;
Date grDate = null; Date grDate = null;
...@@ -1034,7 +1118,7 @@ public String itemChanged( Document dom, Document dom1, Document dom2, String ob ...@@ -1034,7 +1118,7 @@ public String itemChanged( Document dom, Document dom1, Document dom2, String ob
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String currAppdate ="";
String transModeVal = "";//Modified by Anjali R. on [16/01/2019] String transModeVal = "";//Modified by Anjali R. on [16/01/2019]
//SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy"); //SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy");
...@@ -1071,7 +1155,31 @@ public String itemChanged( Document dom, Document dom1, Document dom2, String ob ...@@ -1071,7 +1155,31 @@ public String itemChanged( Document dom, Document dom1, Document dom2, String ob
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
ctr ++; ctr ++;
}while(ctr < childNodeListLength && ! childNodeName.equals(currentColumn)); }while(ctr < childNodeListLength && ! childNodeName.equals(currentColumn));
//itm_default added by nandkumar gadkari on 18/09/19------------
if (currentColumn.trim().equalsIgnoreCase("itm_default") )
{
System.out.println("----------- inside itm_default ---------------");
siteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode");
sql = " select descr from site where site_code = ? ";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, siteCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
descr = rs.getString( "descr" );
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
valueXmlString.append("<site_code>").append("<![CDATA["+siteCode+"]]>").append("</site_code>");
valueXmlString.append("<site_descr>").append("<![CDATA["+descr+"]]>").append("</site_descr>");
java.sql.Timestamp currDate = null;
currDate = new java.sql.Timestamp(System.currentTimeMillis()) ;
currAppdate = new SimpleDateFormat(genericUtility.getApplDateFormat()).format(currDate).toString();
valueXmlString.append("<tran_date protect =\"0\">").append("<![CDATA["+currAppdate.trim()+"]]>").append("</tran_date>");
}
if( currentColumn.trim().equalsIgnoreCase( "invoice_id" ) ) if( currentColumn.trim().equalsIgnoreCase( "invoice_id" ) )
{ {
...@@ -1562,7 +1670,28 @@ public String itemChanged( Document dom, Document dom1, Document dom2, String ob ...@@ -1562,7 +1670,28 @@ public String itemChanged( Document dom, Document dom1, Document dom2, String ob
} }
} }
} }
} }
//added by nandkumar gadkari on 18/01/19-----------------------start---------------
if (currentColumn.trim().equalsIgnoreCase("site_code") )
{
siteCode = genericUtility.getColumnValue("site_code",dom);
sql = " select descr from site where site_code = ?";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, siteCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
descr = rs.getString(1);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
valueXmlString.append("<site_descr>").append("<![CDATA[" +descr+ "]]>").append("</site_descr>");
}
//added by nandkumar gadkari on 18/01/19-----------------------end---------------
valueXmlString.append( "</Detail1>\r\n" ); valueXmlString.append( "</Detail1>\r\n" );
break; break;
...@@ -1681,6 +1810,52 @@ private String checkDate( String input ) throws ITMException ...@@ -1681,6 +1810,52 @@ private String checkDate( String input ) throws ITMException
return input; return input;
} }
private boolean isExist(Connection conn, String tableName, String columnName, String value)
throws ITMException, RemoteException {
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
boolean status = false;
try {
sql = "SELECT count(*) from " + tableName + " where " + columnName + " = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, value);
rs = pstmt.executeQuery();
if (rs.next()) {
if (rs.getBoolean(1)) {
status = true;
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} catch (Exception e) {
System.out.println("Exception in isExist ");
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning String from isExist ");
return status;
}
public String checkNullAndTrim( String inputVal )
{
if ( inputVal == null )
{
inputVal = "";
}
else
{
inputVal = inputVal.trim();
}
return inputVal;
}
private static String getAbsString( String str )
{
return ( str == null || str.trim().length() == 0 || "null".equalsIgnoreCase( str.trim() ) ? "" : str.trim() );
}
} }
\ No newline at end of file
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