Commit 404582ea authored by ssalve's avatar ssalve

Done changes in tran_type and validation for Detail2 on 4AUG2017


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106490 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 04cbdd86
...@@ -9,6 +9,7 @@ import ibase.utility.E12GenericUtility; ...@@ -9,6 +9,7 @@ import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.fin.FinCommon; import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.util.gst.GSTCommonUtil;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException; import java.rmi.RemoteException;
...@@ -30,6 +31,7 @@ import org.w3c.dom.NodeList; ...@@ -30,6 +31,7 @@ import org.w3c.dom.NodeList;
public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPosEJBLocal public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPosEJBLocal
{ {
E12GenericUtility genericUtility = new E12GenericUtility(); E12GenericUtility genericUtility = new E12GenericUtility();
GSTCommonUtil gstUtility = new GSTCommonUtil();
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
/** /**
* Default constructor. * Default constructor.
...@@ -64,7 +66,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -64,7 +66,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
boolean isError = false,isLocCon = false; boolean isError = false,isLocCon = false;
Document dom = null; Document dom = null;
String sql = "",retString = ""; String sql = "",retString = "";
int cnt = 0; int cnt = 0,cnt1 = 0;
FinCommon finCommon = null; FinCommon finCommon = null;
String loginSite = ""; String loginSite = "";
java.sql.Date chg_date=null; java.sql.Date chg_date=null;
...@@ -232,7 +234,10 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -232,7 +234,10 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
} }
NodeList nodeList =dom.getElementsByTagName("Detail2"); NodeList nodeList =dom.getElementsByTagName("Detail2");
int nodeListlen = nodeList.getLength(); int nodeListlen = nodeList.getLength();
//Added by sarita on 4AUG2017
System.out.println("NodeList for Detail2 is ========"+nodeListlen);
cnt1 = gstUtility.getNumOfNonDelDetail(dom,2);
System.out.println("Value of cnt1 in GstrPosEJB is =="+cnt1);
for(int ctr = 0; ctr < nodeListlen ; ctr++) for(int ctr = 0; ctr < nodeListlen ; ctr++)
{ {
NodeList childNodeList = nodeList.item(ctr).getChildNodes(); NodeList childNodeList = nodeList.item(ctr).getChildNodes();
...@@ -264,8 +269,8 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -264,8 +269,8 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
//if("01".equalsIgnoreCase(tran_type) || "02".equalsIgnoreCase(tran_type) || "03".equalsIgnoreCase(tran_type) || "29".equalsIgnoreCase(tran_type) || "30".equalsIgnoreCase(tran_type)) //if("01".equalsIgnoreCase(tran_type) || "02".equalsIgnoreCase(tran_type) || "03".equalsIgnoreCase(tran_type) || "29".equalsIgnoreCase(tran_type) || "30".equalsIgnoreCase(tran_type))
if(taxRegNo != null && taxRegNo.trim().length() > 0) if(taxRegNo != null && taxRegNo.trim().length() > 0)
{ {
if("I".equalsIgnoreCase(gstType) || "E".equalsIgnoreCase(gstType) if("I".equalsIgnoreCase(gstType) || "R".equalsIgnoreCase(gstType)
||"L".equalsIgnoreCase(gstType) || "N".equalsIgnoreCase(gstType)) ||"C".equalsIgnoreCase(gstType) || "D".equalsIgnoreCase(gstType))
{ {
sql = "select count(*) as cnt from gst_registration where gst_no=?"; sql = "select count(*) as cnt from gst_registration where gst_no=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -327,68 +332,6 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -327,68 +332,6 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
} }
}//end of if block for taxRegNo }//end of if block for taxRegNo
/*System.out.println("tax_reg_no["+taxRegNo+"]"+"name["+name+"]"+"addr1["+addr1+"]"+"addr2["+addr2+"]"+"addr3["+addr3+"]"+"city["+city+"]"+"state["+state+"]"+"pin["+pin+"]");
if("01".equalsIgnoreCase(tran_type) || "02".equalsIgnoreCase(tran_type) || "03".equalsIgnoreCase(tran_type) || "29".equalsIgnoreCase(tran_type) || "30".equalsIgnoreCase(tran_type))
{
sql = "select count(*) as cnt from gst_registration where gst_no=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,taxRegNo);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("cnt");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(cnt > 0)
{
sql = "update gst_registration set name=?,addr1=?,addr2=?,addr3=?,city=?,state_code=?,pin=? where gst_no=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,name);
pstmt.setString(2,addr1);
pstmt.setString(3,addr2);
pstmt.setString(4,addr3);
pstmt.setString(5,city);
pstmt.setString(6,state);
pstmt.setString(7,pin);
pstmt.setString(8,taxRegNo);
pstmt.executeUpdate();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
else
{
sql = " insert into gst_registration (gst_no,name,addr1,addr2,addr3,city,state_code,pin) values(?,?,?,?,?,?,?,?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,taxRegNo);
pstmt.setString(2,name);
pstmt.setString(3,addr1);
pstmt.setString(4,addr2);
pstmt.setString(5,addr3);
pstmt.setString(6,city);
pstmt.setString(7,state);
pstmt.setString(8,pin);
pstmt.addBatch();
pstmt.executeBatch();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
}*/
//Changed By Pragyan 04/07/17 to update tran type logics.start. //Changed By Pragyan 04/07/17 to update tran type logics.start.
sPos = getGstStateCode(loginSite,conn); sPos = getGstStateCode(loginSite,conn);
...@@ -405,7 +348,6 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -405,7 +348,6 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
if((taxRegNo.length() > 0) if((taxRegNo.length() > 0)
&& ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge)) && ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
&& ("R".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType))) && ("R".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType)))
//changes by sarita on 28JUL2017
//&& ("".equalsIgnoreCase(eCommGtin) || eCommGtin.length() <=0)) //&& ("".equalsIgnoreCase(eCommGtin) || eCommGtin.length() <=0))
{ {
tranType = "01"; tranType = "01";
...@@ -420,7 +362,6 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -420,7 +362,6 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
else if((taxRegNo.length() > 0) else if((taxRegNo.length() > 0)
&& ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge)) && ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
&& ("Z".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType) && isWithPay)) && ("Z".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType) && isWithPay))
//changes by sarita on 28JUL2017
//&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0) ) //&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0) )
{ {
tranType = "08"; tranType = "08";
...@@ -428,7 +369,6 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -428,7 +369,6 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
else if((taxRegNo.length() > 0) else if((taxRegNo.length() > 0)
&& ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge)) && ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
&& ("Z".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType) && !isWithPay)) && ("Z".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType) && !isWithPay))
//changes by sarita on 28JUL2017
//&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0) ) //&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0) )
{ {
tranType = "09"; tranType = "09";
...@@ -436,7 +376,6 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -436,7 +376,6 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
else if((taxRegNo.length() > 0) else if((taxRegNo.length() > 0)
&& ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge)) && ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
&& ("DE".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType))) && ("DE".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType)))
//changes by sarita on 28JUL 2017
//&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0)) //&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0))
{ {
tranType = "10"; tranType = "10";
...@@ -499,11 +438,11 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -499,11 +438,11 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
{ {
if(isWithPay) if(isWithPay)
{ {
tranType = "06"; tranType = "07";
} }
else if(!isWithPay) else if(!isWithPay)
{ {
tranType = "07"; tranType = "06";
} }
} }
...@@ -651,13 +590,14 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -651,13 +590,14 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
//Changed By Pragyan 04/07/17 to update tran type logics.end //Changed By Pragyan 04/07/17 to update tran type logics.end
} }
else else //if(xmlstring == null || (xmlstring.indexOf("Detail1") == 0))
{ {
System.out.println("Detail1 not found"); System.out.println("Detail1 not found");
retString = itmDBAccessLocal.getErrorString("","VTBLNKDTL","","",conn); retString = itmDBAccessLocal.getErrorString("","VTBLNKDTL","","",conn);
return retString; return retString;
} }
if(xmlstring != null && xmlstring.indexOf("Detail2") == -1 && !(gstType.equalsIgnoreCase("L"))) //if(xmlstring != null && xmlstring.indexOf("Detail2") == -1 && !(gstType.equalsIgnoreCase("L")))
if(cnt1 == 0 && !(gstType.equalsIgnoreCase("L")))
{ {
System.out.println("Detail2 is empty in xmlString...."); System.out.println("Detail2 is empty in xmlString....");
retString = itmDBAccessLocal.getErrorString("","VTBLNKDTL2","","",conn); retString = itmDBAccessLocal.getErrorString("","VTBLNKDTL2","","",conn);
......
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