Commit 58924625 authored by ssalve's avatar ssalve

Added 2 methods getRateValueForAllDetail and gettaxableAmtForAllDetail on 14AUG2017


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106601 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 850e70d2
...@@ -13,6 +13,8 @@ import java.sql.ResultSet; ...@@ -13,6 +13,8 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.*;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
...@@ -22,6 +24,7 @@ import javax.imageio.ImageIO; ...@@ -22,6 +24,7 @@ import javax.imageio.ImageIO;
import ibase.utility.CommonConstants; import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.bean.gst.APICallData; import ibase.webitm.bean.gst.APICallData;
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.utility.ITMException; import ibase.webitm.utility.ITMException;
...@@ -30,6 +33,8 @@ import ibase.webitm.utility.TransIDGenerator; ...@@ -30,6 +33,8 @@ import ibase.webitm.utility.TransIDGenerator;
public class GSTCommonUtil extends ValidatorEJB public class GSTCommonUtil extends ValidatorEJB
{ {
E12GenericUtility genericUtility = new E12GenericUtility(); E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
public String getImagePath(String tranWindow, String tranId, String altColVal, String folderName, Connection conn) throws ITMException public String getImagePath(String tranWindow, String tranId, String altColVal, String folderName, Connection conn) throws ITMException
{ {
System.out.println("Common utility to get image path"); System.out.println("Common utility to get image path");
...@@ -680,4 +685,74 @@ public class GSTCommonUtil extends ValidatorEJB ...@@ -680,4 +685,74 @@ public class GSTCommonUtil extends ValidatorEJB
return null; return null;
} }
} }
public double gettaxableAmtForAllDetail(Document dom2) throws ITMException
{
Node childNode = null;
NodeList updateList;
String childNodeName = "",retString="";
String taxable_amt = "";
double finalAmt=0;
try
{
NodeList detailNoteList = dom2.getElementsByTagName("Detail2");
for(int cnt = 0;cnt<detailNoteList.getLength();cnt++)
{
Node pNode=detailNoteList.item(cnt);
childNodeName = pNode.getNodeName();
System.out.println("childNodeNameForDetail2:::"+childNodeName+"childNode["+pNode+"]");
//System.out.println("detailString value is =="+genericUtility.serializeDom(dom2));
taxable_amt = checkNull(genericUtility.getColumnValueFromNode("taxable_amt", pNode));
System.out.println("taxable_amt is::::"+taxable_amt);
finalAmt = finalAmt + Double.parseDouble(taxable_amt);
}
System.out.println("final Amount is ::::"+finalAmt);
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return finalAmt;
}
public boolean getRateValueForAllDetail(Document dom2) throws ITMException
{
SortedSet<Double> gstRate = new TreeSet<Double>();
Node childNode = null;
NodeList updateList;
String childNodeName = "",retString="";
String gst_rate1 = "";
double gst_rate=0;
boolean gstCheck = false;
try
{
NodeList detailNoteList = dom2.getElementsByTagName("Detail2");
for(int cnt = 0;cnt<detailNoteList.getLength();cnt++)
{
Node pNode=detailNoteList.item(cnt);
childNodeName = pNode.getNodeName();
System.out.println("childNodeNameForDetail2:::"+childNodeName+"childNode["+pNode+"]");
gst_rate1 = checkNull(genericUtility.getColumnValueFromNode("gst_rate", pNode));
gst_rate = Double.valueOf(gst_rate1);
System.out.println("gst_rate is::::"+gst_rate);
gstRate.add(gst_rate);
System.out.println("Set is ::["+gstRate+"]");
System.out.println("Size of Set Elements is ::::["+gstRate.size()+"]" + "First Element in Set is :::["+gstRate.first()+"]");
if(!(gstRate.size() == 1) && gstRate.first() == 0.0)
{
gstCheck = true;
System.out.println("Rate Contains 0 with other non-zero elements!!!!");
}
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return gstCheck;
}
} }
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