Commit 6ab252af authored by ngadkari's avatar ngadkari

tax_env picking based on country - country code to be added in tenvstn and pick the same

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@198084 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3de3a468
......@@ -7855,7 +7855,7 @@ public class DistCommon {
SimpleDateFormat sdf = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "", taxEnv = "", taxEnvPrefix = "", stateCodeFrom = "", stateCodeTo = "";
String sql = "", taxEnv = "", taxEnvPrefix = "", stateCodeFrom = "", stateCodeTo = "",countCodeFrom="",countCodeTo="";
try {
System.out.println("stationFrom[" + stationFrom);
System.out.println("stationTo[" + stationTo);
......@@ -8071,6 +8071,130 @@ public class DistCommon {
pstmt = null;
}
}
// added on 28-feb-2019 by nandkumar gadkari -if environment is still not found check on the basis of country code---start----------------
if (taxEnv == null || taxEnv.trim().length() == 0) {
sql = "select count_code from state where state_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, stateCodeFrom);
rs = pstmt.executeQuery();
if (rs.next()) {
countCodeFrom = rs.getString("count_code") != null ? rs
.getString("count_code") : "";
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "select count_code from state where state_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, stateCodeTo);
rs = pstmt.executeQuery();
if (rs.next()) {
countCodeTo = rs.getString("count_code") != null ? rs
.getString("count_code") : "";
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "SELECT tax_env "
+ " FROM tenvstan "
+ " WHERE state_code__fr = ' ' and " // state code from
+ " state_code__to = ' ' and "
+ " stan_code__fr = ' ' and "
+ " stan_code__to = ' ' and "
+ " count_code__fr = ? and "
+ " count_code__to = ? and "
+ " tax_class = ? and " + " tax_chap =? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, countCodeFrom);
pstmt.setString(2, countCodeTo);
pstmt.setString(3, taxClass);
pstmt.setString(4, taxChap);
rs = pstmt.executeQuery();
if (rs.next()) {
taxEnv = rs.getString("tax_env") != null ? rs
.getString("tax_env") : "";
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (taxEnv == null || taxEnv.trim().length() == 0) {
sql = "SELECT tax_env " + " FROM tenvstan "
+ " WHERE state_code__fr =' ' and "
+ " state_code__to = ' ' and "
+ " stan_code__fr = ' ' and "
+ " stan_code__to = ' ' and "
+ " count_code__fr = ? and "
+ " count_code__to = ? and "
+ " tax_class = ' ' and "
+ " tax_chap = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, countCodeFrom);
pstmt.setString(2, countCodeTo);
pstmt.setString(3, taxChap);
rs = pstmt.executeQuery();
if (rs.next()) {
taxEnv = rs.getString("tax_env") != null ? rs
.getString("tax_env") : "";
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
if (taxEnv == null || taxEnv.trim().length() == 0) {
sql = "SELECT tax_env " + " FROM tenvstan "
+ " WHERE state_code__fr = ' ' and "
+ " state_code__to = ' ' and "
+ " stan_code__fr = ' ' and "
+ " stan_code__to = ' ' and "
+ " count_code__fr = ? and "
+ " count_code__to = ? and "
+ " tax_class = ? and " + " tax_chap =' '";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, countCodeFrom);
pstmt.setString(2, countCodeTo);
pstmt.setString(3, taxClass);
rs = pstmt.executeQuery();
if (rs.next()) {
taxEnv = rs.getString("tax_env") != null ? rs
.getString("tax_env") : "";
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
if (taxEnv == null || taxEnv.trim().length() == 0) {
sql = "SELECT tax_env FROM tenvstan "
+ " WHERE state_code__fr = ' ' "
+ " and state_code__to = ' ' "
+ " and stan_code__fr = ' ' "
+ " and stan_code__to = ' ' "
+ " and count_code__fr = ? "
+ " and count_code__to = ? "
+ " and tax_class = ' ' " + " and "
+ " tax_chap =' ' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, countCodeFrom);
pstmt.setString(2, countCodeTo);
rs = pstmt.executeQuery();
if (rs.next()) {
taxEnv = rs.getString("tax_env") == null ? "" : rs
.getString("tax_env");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
// added on 28-feb-2019 by nandkumar gadkari -if environment is still not found check on the basis of country code---end----------------
String errorString = getCheckTaxEnvStatus(taxEnv, currDateTs, conn);
if (errorString != null && errorString.trim().length() > 0) {
taxEnv = "";
......
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