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
}
return retString;
}
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+"]");
......@@ -104,7 +103,9 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
gtin = "",//Supplier GTIN
tranType = "";
double invAmt =0.0,b2clInvVal = 0.0;//amount
double invAmt =0.0,b2clInvVal = 0.0,gstRate = 0.0;//amount
boolean isWithPay = false;
try
......@@ -137,7 +138,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
NodeList detail1NodeList =dom.getElementsByTagName("Detail1");
int detail3NodeListlen = detail1NodeList.getLength();
loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
System.out.println("loginSite>>>>>>>>>>"+loginSite);
for(int ctrH = 0; ctrH < detail3NodeListlen ; ctrH++)
{
......@@ -214,7 +215,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
{
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());
}
......@@ -229,12 +230,42 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
//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+"]");
//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) || "R".equalsIgnoreCase(gstType) || "S".equalsIgnoreCase(gstType)
|| "E".equalsIgnoreCase(gstType) || "N".equalsIgnoreCase(gstType))
if("I".equalsIgnoreCase(gstType) || "E".equalsIgnoreCase(gstType)
||"L".equalsIgnoreCase(gstType) || "N".equalsIgnoreCase(gstType))
{
sql = "select count(*) as cnt from gst_registration where gst_no=?";
pstmt = conn.prepareStatement(sql);
......@@ -295,19 +326,81 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
}
}
}//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("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))
{
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
&& ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
......@@ -316,21 +409,42 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
{
tranType = "01";
}
else if(taxRegNo.length() > 0
&& "Y".equalsIgnoreCase(reverseCharge)
else if((taxRegNo.length() > 0)
&& ("N".equalsIgnoreCase(reverseCharge) || "".equalsIgnoreCase(reverseCharge))
&& ("R".equalsIgnoreCase(docType) || "".equalsIgnoreCase(docType))
&& ("".equalsIgnoreCase(eCommGtin) || eCommGtin.length() <=0))
&& (!"".equalsIgnoreCase(eCommGtin) && eCommGtin.length() > 0))
{
tranType = "02";
tranType = "03";
}
else if((taxRegNo.length() > 0)
&& ("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))
{
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))
&& (eCommGtin.length() == 0)
&& (!sPos.equalsIgnoreCase(cPos))
......@@ -376,38 +490,24 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
{
tranType = "14";
}
}
else if("E".equalsIgnoreCase(gstType))
{
if("WPAY".equalsIgnoreCase(docType))
if(isWithPay)
{
tranType = "06";
}
else if("WOPAY".equalsIgnoreCase(docType))
else if(!isWithPay)
{
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 non GST supplies" data="NOGST"/>*/
<item display="NIL non GST supplies" data="NOGST"/>
if((taxRegNo.length() > 0) //NIL rated Inter supplies to registred
&& (!sPos.equalsIgnoreCase(cPos))
......@@ -483,52 +583,47 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
tranType = "26";
}
}
else if("N".equalsIgnoreCase(gstType))
}*/
else if("C".equalsIgnoreCase(gstType))
{
if( taxRegNo.length() > 0 //Credit Note to registered customer
&& ("C".equalsIgnoreCase(docType)))
if( taxRegNo.length() > 0) //Credit Note to registered customer
{
tranType = "29";
}
else if( taxRegNo.length() > 0 //Debite Note to registered customer
&& ("D".equalsIgnoreCase(docType)))
else
{
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
&& ("D".equalsIgnoreCase(docType)))
else if( taxRegNo.length() == 0) //Debite Note to unregistered customer
{
tranType = "32";
}
}
else if("A".equalsIgnoreCase(gstType))
{
if( taxRegNo.length() > 0 //Advance Received Intra state
|| (sPos.equalsIgnoreCase(cPos)))
if(sPos.equalsIgnoreCase(cPos))
{
tranType = "41";
}
else if( taxRegNo.length() > 0 //Advance Received Inter state
|| (!sPos.equalsIgnoreCase(cPos)))
else if(!sPos.equalsIgnoreCase(cPos))
{
tranType = "42";
}
}
else if("T".equalsIgnoreCase(gstType))//Advance adjusted
{
if( taxRegNo.length() > 0 //Advance adjusted Intra state
|| (sPos.equalsIgnoreCase(cPos)))
if(sPos.equalsIgnoreCase(cPos))
{
tranType = "43";
}
else if( taxRegNo.length() > 0 //Advance adjusted Inter state
|| (!sPos.equalsIgnoreCase(cPos)))
else if(!sPos.equalsIgnoreCase(cPos))
{
tranType = "44";
}
......@@ -558,7 +653,7 @@ public class GstrPosEJB extends ValidatorEJB implements GstrPosEJBRemote,GstrPos
retString = itmDBAccessLocal.getErrorString("","VTBLNKDTL","","",conn);
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....");
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