Commit 5e19e649 authored by ssalve's avatar ssalve

updated GstrPosEJB code


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106299 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b0d9f7f1
...@@ -53,8 +53,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -53,8 +53,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
} }
return retString; return retString;
} }
public String postSave(String xmlstring, String xtraParams, String forcedFlag, Connection conn) throws RemoteException,ITMException public String postSave(String xmlstring, String xtraParams, String forcedFlag, Connection conn) throws RemoteException,ITMException
{ {
System.out.println("Inside GstrPosEJB Post Save ["+xmlstring+"] \n xtraParams ["+xtraParams+"] \n forcedFlag["+forcedFlag+"]"); System.out.println("Inside GstrPosEJB Post Save ["+xmlstring+"] \n xtraParams ["+xtraParams+"] \n forcedFlag["+forcedFlag+"]");
...@@ -104,7 +103,9 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -104,7 +103,9 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
gtin = "",//Supplier GTIN gtin = "",//Supplier GTIN
tranType = ""; tranType = "";
double invAmt =0.0,b2clInvVal = 0.0;//amount double invAmt =0.0,b2clInvVal = 0.0,gstRate = 0.0;//amount
boolean isWithPay = false;
try try
...@@ -137,7 +138,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -137,7 +138,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
NodeList detail1NodeList =dom.getElementsByTagName("Detail1"); NodeList detail1NodeList =dom.getElementsByTagName("Detail1");
int detail3NodeListlen = detail1NodeList.getLength(); int detail3NodeListlen = detail1NodeList.getLength();
loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
System.out.println("loginSite>>>>>>>>>>"+loginSite); System.out.println("loginSite>>>>>>>>>>"+loginSite);
for(int ctrH = 0; ctrH < detail3NodeListlen ; ctrH++) for(int ctrH = 0; ctrH < detail3NodeListlen ; ctrH++)
{ {
...@@ -214,7 +215,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -214,7 +215,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
{ {
eCommGtin = checkNullAndTrim(childNode.getFirstChild().getNodeValue()); eCommGtin = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
} }
else if(childNode != null && "gst_code".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null) else if(childNode != null && "gst_code_state".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{ {
cPos = checkNullAndTrim(childNode.getFirstChild().getNodeValue()); cPos = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
} }
...@@ -229,12 +230,42 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -229,12 +230,42 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
//Changed By Pragyan.end //Changed By Pragyan.end
} }
} }
NodeList nodeList =dom.getElementsByTagName("Detail2");
int nodeListlen = nodeList.getLength();
for(int ctr = 0; ctr < nodeListlen ; ctr++)
{
NodeList childNodeList = nodeList.item(ctr).getChildNodes();
int childNodeListlen = childNodeList.getLength();
System.out.println("childNodeListlen>>>>>"+childNodeListlen);
for(int ctrD = 0; ctrD < childNodeListlen ; ctrD++)
{
Node childNode = childNodeList.item(ctrD);
if(childNode != null && "gst_rate".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{
gstRate = Double.parseDouble(childNode.getFirstChild().getNodeValue());
System.out.println("gstRate::::::::::::"+gstRate);
if(gstRate <= 0)
{
isWithPay = true;
break;
}
}
if(isWithPay)
{
break;
}
}
}
System.out.println("tax_reg_no["+taxRegNo+"]"+"name["+name+"]"+"addr1["+addr1+"]"+"addr2["+addr2+"]"+"addr3["+addr3+"]"+"city["+city+"]"+"state["+state+"]"+"pin["+pin+"]"); 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)) //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) || "R".equalsIgnoreCase(gstType) || "S".equalsIgnoreCase(gstType) if("I".equalsIgnoreCase(gstType) || "E".equalsIgnoreCase(gstType)
|| "E".equalsIgnoreCase(gstType) || "N".equalsIgnoreCase(gstType)) ||"L".equalsIgnoreCase(gstType) || "N".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);
...@@ -295,19 +326,81 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -295,19 +326,81 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
} }
} }
}//end of if block for taxRegNo }//end of if block for taxRegNo
//Changed By Pragyan 04/07/17 to update tran type logics.start.
sPos = getGstStateCode(loginSite,conn);
/*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);
System.out.println("Record Type["+recordType+"]Gst Type ["+gstType+"]Doc Type["+docType+"]"); System.out.println("Record Type["+recordType+"]Gst Type ["+gstType+"]Doc Type["+docType+"]");
System.out.println("CTIN["+taxRegNo+"]Ecom Gtin["+eCommGtin+"]Suppplier POS["+sPos+"] Customer Pos["+cPos+"]Revrse Charge["+reverseCharge+"]Invoice amount ["+invAmt+"]"); System.out.println("CTIN["+taxRegNo+"]Ecom Gtin["+eCommGtin+"]Suppplier POS["+sPos+"] Customer Pos["+cPos+"]Revrse Charge["+reverseCharge+"]Invoice amount ["+invAmt+"]");
System.out.println("isWithPay:::::"+isWithPay);
if("1".equalsIgnoreCase(recordType)) if("1".equalsIgnoreCase(recordType))
{ {
b2clInvVal = Double.parseDouble(finCommon.getFinparams("999999", "GST_B2CL_INV_VAL", conn)); b2clInvVal = Double.parseDouble(finCommon.getFinparams("999999", "GST_B2CL_INV_VAL", conn));
if("I".equalsIgnoreCase(gstType)) if("I".equalsIgnoreCase(gstType)) //B2B Supplies, with SEZ and deemed exports
{ {
if( taxRegNo.length() > 0 if( taxRegNo.length() > 0
&& ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge)) && ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
...@@ -316,21 +409,42 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -316,21 +409,42 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
{ {
tranType = "01"; tranType = "01";
} }
else if(taxRegNo.length() > 0 else if((taxRegNo.length() > 0)
&& "Y".equalsIgnoreCase(reverseCharge) && ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
&& ("R".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType)) && ("R".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType))
&& ("".equalsIgnoreCase(eCommGtin) || eCommGtin.length() <=0)) && (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0))
{ {
tranType = "02"; tranType = "03";
} }
else if((taxRegNo.length() > 0) else if((taxRegNo.length() > 0)
&& ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge)) && ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
&& ("R".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType)) && ("Z".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType))
&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0) && isWithPay)
{
tranType = "08";
}
else if((taxRegNo.length() > 0)
&& ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
&& ("Z".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType))
&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0) && !isWithPay)
{
tranType = "09";
}
else if((taxRegNo.length() > 0)
&& ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
&& ("DE".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType))
&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0)) && (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0))
{ {
tranType = "03"; tranType = "10";
} }
else if((taxRegNo.length() == 0) //B2CL Inter State and inv amt > 250000 }
if("R".equalsIgnoreCase(gstType))
{
tranType = "02";
}
else if("S".equalsIgnoreCase(gstType))
{
if((taxRegNo.length() == 0) //B2CL Inter State and inv amt > 250000
&& ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge)) && ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
&& (eCommGtin.length() == 0) && (eCommGtin.length() == 0)
&& (!sPos.equalsIgnoreCase(cPos)) && (!sPos.equalsIgnoreCase(cPos))
...@@ -376,38 +490,24 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -376,38 +490,24 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
{ {
tranType = "14"; tranType = "14";
} }
} }
else if("E".equalsIgnoreCase(gstType)) else if("E".equalsIgnoreCase(gstType))
{ {
if("WPAY".equalsIgnoreCase(docType)) if(isWithPay)
{ {
tranType = "06"; tranType = "06";
} }
else if("WOPAY".equalsIgnoreCase(docType)) else if(!isWithPay)
{ {
tranType = "07"; tranType = "07";
} }
else if("SEWP".equalsIgnoreCase(docType))
{
tranType = "08";
}
else if("SEWOP".equalsIgnoreCase(docType))
{
tranType = "09";
}
else if((taxRegNo.length() > 0) && "DE".equalsIgnoreCase(docType))
{
tranType = "10";
}
} }
else if("L".equalsIgnoreCase(gstType)) /* else if("L".equalsIgnoreCase(gstType))
{ {
/*<item display="NIL rated supplies" data="NRATD"/> <item display="NIL rated supplies" data="NRATD"/>
<item display="NIL exempted supplies" data="EXEMP"/> <item display="NIL exempted supplies" data="EXEMP"/>
<item display="NIL non GST supplies" data="NOGST"/>*/ <item display="NIL non GST supplies" data="NOGST"/>
if((taxRegNo.length() > 0) //NIL rated Inter supplies to registred if((taxRegNo.length() > 0) //NIL rated Inter supplies to registred
&& (!sPos.equalsIgnoreCase(cPos)) && (!sPos.equalsIgnoreCase(cPos))
...@@ -483,52 +583,47 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -483,52 +583,47 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
tranType = "26"; tranType = "26";
} }
} }*/
else if("N".equalsIgnoreCase(gstType)) else if("C".equalsIgnoreCase(gstType))
{ {
if( taxRegNo.length() > 0 //Credit Note to registered customer if( taxRegNo.length() > 0) //Credit Note to registered customer
&& ("C".equalsIgnoreCase(docType)))
{ {
tranType = "29"; tranType = "29";
} }
else if( taxRegNo.length() > 0 //Debite Note to registered customer else
&& ("D".equalsIgnoreCase(docType)))
{ {
tranType = "30"; tranType = "31"; //Credit Note to un registered customer
} }
else if( taxRegNo.length() == 0 //Credit Note to unregistered customer }
&& ("C".equalsIgnoreCase(docType))) else if("D".equalsIgnoreCase(gstType))//Debite Note to registered customer
{
if( taxRegNo.length() > 0) //Credit Note to unregistered customer
{ {
tranType = "31"; tranType = "30";
} }
else if( taxRegNo.length() == 0 //Debite Note to unregistered customer else if( taxRegNo.length() == 0) //Debite Note to unregistered customer
&& ("D".equalsIgnoreCase(docType)))
{ {
tranType = "32"; tranType = "32";
} }
} }
else if("A".equalsIgnoreCase(gstType)) else if("A".equalsIgnoreCase(gstType))
{ {
if( taxRegNo.length() > 0 //Advance Received Intra state if(sPos.equalsIgnoreCase(cPos))
|| (sPos.equalsIgnoreCase(cPos)))
{ {
tranType = "41"; tranType = "41";
} }
else if( taxRegNo.length() > 0 //Advance Received Inter state else if(!sPos.equalsIgnoreCase(cPos))
|| (!sPos.equalsIgnoreCase(cPos)))
{ {
tranType = "42"; tranType = "42";
} }
} }
else if("T".equalsIgnoreCase(gstType))//Advance adjusted else if("T".equalsIgnoreCase(gstType))//Advance adjusted
{ {
if( taxRegNo.length() > 0 //Advance adjusted Intra state if(sPos.equalsIgnoreCase(cPos))
|| (sPos.equalsIgnoreCase(cPos)))
{ {
tranType = "43"; tranType = "43";
} }
else if( taxRegNo.length() > 0 //Advance adjusted Inter state else if(!sPos.equalsIgnoreCase(cPos))
|| (!sPos.equalsIgnoreCase(cPos)))
{ {
tranType = "44"; tranType = "44";
} }
...@@ -558,7 +653,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos ...@@ -558,7 +653,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
retString = itmDBAccessLocal.getErrorString("","VTBLNKDTL","","",conn); retString = itmDBAccessLocal.getErrorString("","VTBLNKDTL","","",conn);
return retString; return retString;
} }
if(xmlstring != null && xmlstring.indexOf("Detail2") == -1) if(xmlstring != null && xmlstring.indexOf("Detail2") == -1 && !(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