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;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.util.gst.GSTCommonUtil;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
......@@ -30,6 +31,7 @@ import org.w3c.dom.NodeList;
public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPosEJBLocal
{
E12GenericUtility genericUtility = new E12GenericUtility();
GSTCommonUtil gstUtility = new GSTCommonUtil();
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
/**
* Default constructor.
......@@ -64,7 +66,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
boolean isError = false,isLocCon = false;
Document dom = null;
String sql = "",retString = "";
int cnt = 0;
int cnt = 0,cnt1 = 0;
FinCommon finCommon = null;
String loginSite = "";
java.sql.Date chg_date=null;
......@@ -232,7 +234,10 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
}
NodeList nodeList =dom.getElementsByTagName("Detail2");
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++)
{
NodeList childNodeList = nodeList.item(ctr).getChildNodes();
......@@ -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(taxRegNo != null && taxRegNo.trim().length() > 0)
{
if("I".equalsIgnoreCase(gstType) || "E".equalsIgnoreCase(gstType)
||"L".equalsIgnoreCase(gstType) || "N".equalsIgnoreCase(gstType))
if("I".equalsIgnoreCase(gstType) || "R".equalsIgnoreCase(gstType)
||"C".equalsIgnoreCase(gstType) || "D".equalsIgnoreCase(gstType))
{
sql = "select count(*) as cnt from gst_registration where gst_no=?";
pstmt = conn.prepareStatement(sql);
......@@ -326,69 +331,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
}
}
}//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.
sPos = getGstStateCode(loginSite,conn);
......@@ -405,8 +348,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
if((taxRegNo.length() > 0)
&& ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
&& ("R".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType)))
//changes by sarita on 28JUL2017
//&& ("".equalsIgnoreCase(eCommGtin) || eCommGtin.length() <=0))
//&& ("".equalsIgnoreCase(eCommGtin) || eCommGtin.length() <=0))
{
tranType = "01";
}
......@@ -420,24 +362,21 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
else if((taxRegNo.length() > 0)
&& ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
&& ("Z".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType) && isWithPay))
//changes by sarita on 28JUL2017
//&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0) )
//&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0) )
{
tranType = "08";
}
else if((taxRegNo.length() > 0)
&& ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
&& ("Z".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType) && !isWithPay))
//changes by sarita on 28JUL2017
//&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0) )
//&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0) )
{
tranType = "09";
}
else if((taxRegNo.length() > 0)
&& ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
&& ("DE".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType)))
//changes by sarita on 28JUL 2017
//&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0))
//&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0))
{
tranType = "10";
}
......@@ -499,11 +438,11 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
{
if(isWithPay)
{
tranType = "06";
tranType = "07";
}
else if(!isWithPay)
{
tranType = "07";
tranType = "06";
}
}
......@@ -651,13 +590,14 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
//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");
retString = itmDBAccessLocal.getErrorString("","VTBLNKDTL","","",conn);
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....");
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