Commit 5a5b52ce authored by prane's avatar prane

Added common validation for tax_environment to (purchase,sales, expense or all).

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@207861 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 11c18d36
......@@ -3793,13 +3793,16 @@ public class FinCommon
* @return Error code if not valid
* @exception ITMException
*/
public String checkTaxEnvStatus(String taxEnv, Timestamp date, Connection conn)
//Pavan R 17sep19[Changed below method signature to validate tax environment in all transaction]
//public String checkTaxEnvStatus(String taxEnv, Timestamp date, Connection conn)
public String checkTaxEnvStatus(String taxEnv, Timestamp date, String busiType, Connection conn)
{
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = null;
String errCode = null;
String status = null;
String sql = "", busiProcUse = "";
String errCode = "";
String status = "";
boolean errFlag = false;
// TYPE SHOULD BE SAME AS ENTERED
try
{
......@@ -3814,11 +3817,40 @@ public class FinCommon
status = rs.getString(1);
if (status.equalsIgnoreCase("C"))
{
errCode = "VTTAXENVCL";
//Pavan R 17sept19 start[closed cursors and prepared statement]
pstmt.close(); pstmt = null;
rs.close(); rs = null;
errCode = "VTTAXENVCL";
return errCode;
}
}
pstmt.close(); pstmt = null;
rs.close(); rs = null;
//Pavan R 17sep19 start[to validate tax environment in all transaction]
sql = "select busi_proc_use from taxenv where tax_env = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxEnv);
rs = pstmt.executeQuery();
if (rs.next()) {
busiProcUse = rs.getString("busi_proc_use") != null ? rs.getString("busi_proc_use") : "";
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
String busiProcUseArr[] = busiProcUse.split(",");
if (busiProcUseArr.length > 0) {
for (int i = 0; i < busiProcUseArr.length; i++) {
if (busiType.trim().equalsIgnoreCase(busiProcUseArr[i].trim())) {
errFlag = true;
}
}
}
if (!errFlag) {
errCode = "VTTAXENVVL";
return errCode;
}
//Pavan R 17sep19 end[to validate tax environment in all transaction]
}
catch(Exception e)
{
......@@ -15890,6 +15922,7 @@ public class FinCommon
}
}
}
//Added by Varsha V on 26-10-18 to return error if future date is not allowed
if(errCode == null || errCode.trim().length() == 0)
{
......
......@@ -738,7 +738,10 @@ public class InvoiceIC extends ValidatorEJB implements InvoiceICLocal, InvoiceIC
}
else
{
errorCode = finCommon.checkTaxEnvStatus(taxEnv, tranDateTm, conn);
//Pavan R 17sept19 start[to validate tax environment]
//errorCode = finCommon.checkTaxEnvStatus(taxEnv, tranDateTm, conn);
errorCode = finCommon.checkTaxEnvStatus(taxEnv, tranDateTm, "S", conn);
//Pavan R 17sept19 end[to validate tax environment]
if(errorCode != null && errorCode.trim().length() > 0)
{
errString = itmDBAccess.getErrorString("tax_env", errorCode, loginCode, "", conn);
......@@ -1056,8 +1059,10 @@ public class InvoiceIC extends ValidatorEJB implements InvoiceICLocal, InvoiceIC
}
if("tax_env".equalsIgnoreCase(childNodeName))
{
taxEnv = checkNull(genericUtility.getColumnValue("tax_env",dom));
tranDateStr = checkNull(genericUtility.getColumnValue("tran_date", dom));
//taxEnv = checkNull(genericUtility.getColumnValue("tax_env",dom));
taxEnv = getParentColumnValue("tax_env", dom, "3");
//tranDateStr = checkNull(genericUtility.getColumnValue("tran_date", dom));
tranDateStr = checkNull(genericUtility.getColumnValue("tran_date", dom1));
if(tranDateStr.trim().length()>0)
{
tranDateTm = Timestamp.valueOf(genericUtility.getValidDateString(tranDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
......@@ -1092,7 +1097,10 @@ public class InvoiceIC extends ValidatorEJB implements InvoiceICLocal, InvoiceIC
}
else
{
errorCode = finCommon.checkTaxEnvStatus(taxEnv, tranDateTm, conn);
//Pavan R 17sept19 start[to validate tax environment]
//errorCode = finCommon.checkTaxEnvStatus(taxEnv, tranDateTm, conn);
errorCode = finCommon.checkTaxEnvStatus(taxEnv, tranDateTm, "S", conn);
//Pavan R 17sept19 end[to validate tax environment]
if(errorCode != null && errorCode.trim().length() > 0)
{
errString = itmDBAccess.getErrorString("tax_env", errorCode, loginCode, "", conn);
......@@ -3538,4 +3546,31 @@ public class InvoiceIC extends ValidatorEJB implements InvoiceICLocal, InvoiceIC
}
return errotType;
}
public String getParentColumnValue(String currColumn, Document dom, String formNo)throws ITMException
{
NodeList parentNodeList=null;
Node parentNode=null;
String Value = "";
try
{
E12GenericUtility genericUtility= new E12GenericUtility();
parentNodeList = dom.getElementsByTagName("Detail"+formNo);
int childNodeListLength = parentNodeList.getLength();
for(int ctr = 0; ctr < childNodeListLength; ctr++)
{
parentNode = parentNodeList.item(ctr);
Value = genericUtility.getColumnValueFromNode(currColumn, parentNode);
break;
} // end for
}//END TRY
catch(Exception e)
{
System.out.println("DistCommon::getParentColumnValue::Exception ::"+e);
e.printStackTrace();
throw new ITMException(e);
}
return Value;
}
}
\ No newline at end of file
......@@ -145,6 +145,7 @@ public class MiscVoucherIC extends ValidatorEJB implements MiscVoucherICLocal, M
double totAmt = 0.0;
Timestamp refDate = null;
Timestamp today = null;
Timestamp tranDt = null;
java.util.Date tranPdate = null;
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
......@@ -1126,15 +1127,28 @@ public class MiscVoucherIC extends ValidatorEJB implements MiscVoucherICLocal, M
if (rs.next()) {
cnt = rs.getInt(1);
}
if (cnt == 0) {
errCode = "VMTAENV1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0) {
errCode = "VMTAENV1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}else //Pavan R 17sept19 start[to validate tax environment]
{
tranDate = genericUtility.getColumnValue("tran_date", dom);
if (tranDate != null && tranDate.trim().length() > 0) {
tranDt = Timestamp.valueOf(genericUtility.getValidDateString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+ " 00:00:00.0");
}
errCode = finCommon.checkTaxEnvStatus( taxEnv, tranDt,"F", conn );
System.out.println("TaxEnvironment::Case1["+taxEnv+"]errCode["+errCode+"]");
if( errCode != null && errCode.trim().length() > 0 ) {
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
} //Pavan R 17sept19 end[to validate tax environment]
}
}
......@@ -1489,7 +1503,46 @@ public class MiscVoucherIC extends ValidatorEJB implements MiscVoucherICLocal, M
}
//added by deepak sawant
}
}
//Pavan R 17sept19 start[to validate tax environment]
else if (childNodeName.equalsIgnoreCase("tax_env"))
{
cnt = 0;
//taxEnv = checkNull(genericUtility.getColumnValue("tax_env", dom));
taxEnv = getParentColumnValue("tax_env", dom, "2");
if (taxEnv != null && (taxEnv.trim().length() > 0)) {
sql = "SELECT COUNT(*) FROM taxenv WHERE tax_env = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxEnv);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0) {
errCode = "VMTAENV1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}else
{
tranDate = genericUtility.getColumnValue("tran_date", dom1);
if (tranDate != null && tranDate.trim().length() > 0) {
tranDt = Timestamp.valueOf(genericUtility.getValidDateString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+ " 00:00:00.0");
}
errCode = finCommon.checkTaxEnvStatus( taxEnv, tranDt,"F", conn );
System.out.println("TaxEnvironment::Case2["+taxEnv+"]errCode["+errCode+"]");
if( errCode != null && errCode.trim().length() > 0 ) {
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
}
//Pavan R 17sept19 end[to validate tax environment]
}
break;
......@@ -2155,7 +2208,46 @@ public class MiscVoucherIC extends ValidatorEJB implements MiscVoucherICLocal, M
pstmt.close();
pstmt = null;
}
}
}
//Pavan R 04sept19 start[to validate tax environment]
else if (childNodeName.equalsIgnoreCase("tax_env"))
{
cnt = 0;
System.out.println("TaxEnvironment::Case3["+genericUtility.serializeDom(dom)+"]");
//taxEnv = checkNull(genericUtility.getColumnValue("tax_env", dom));
taxEnv = getParentColumnValue("tax_env", dom, "3");
if (taxEnv != null && (taxEnv.trim().length() > 0)) {
sql = "SELECT COUNT(*) FROM taxenv WHERE tax_env = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, taxEnv);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0) {
errCode = "VMTAENV1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}else
{
tranDate = genericUtility.getColumnValue("tran_date", dom1);
if (tranDate != null && tranDate.trim().length() > 0) {
tranDt = Timestamp.valueOf(genericUtility.getValidDateString(tranDate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+ " 00:00:00.0");
}
errCode = finCommon.checkTaxEnvStatus( taxEnv, tranDt,"F", conn );
System.out.println("TaxEnvironment::Case3["+taxEnv+"]errCode["+errCode+"]");
if( errCode != null && errCode.trim().length() > 0 ) {
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
}
//Pavan R 04sept19 end[to validate tax environment]
}
break;
}//end switch
......@@ -5907,5 +5999,33 @@ public class MiscVoucherIC extends ValidatorEJB implements MiscVoucherICLocal, M
return isDuplicateBillNo;
}
//Modified by Anjali R. on [08/02/2019][Added method to Check for same bill number in multiple lines][End]
public String getParentColumnValue(String currColumn, Document dom, String formNo)throws ITMException
{
NodeList parentNodeList=null;
Node parentNode=null;
String Value = "";
try
{
E12GenericUtility genericUtility= new E12GenericUtility();
parentNodeList = dom.getElementsByTagName("Detail"+formNo);
int childNodeListLength = parentNodeList.getLength();
for(int ctr = 0; ctr < childNodeListLength; ctr++)
{
parentNode = parentNodeList.item(ctr);
Value = genericUtility.getColumnValueFromNode(currColumn, parentNode);
break;
} // end for
}//END TRY
catch(Exception e)
{
System.out.println("DistCommon::getParentColumnValue::Exception ::"+e);
e.printStackTrace();
throw new ITMException(e);
}
return Value;
}
}
\ No newline at end of file
......@@ -760,8 +760,10 @@ public class PaymentExpenseEJB extends ValidatorEJB implements PaymentExpenseLoc
}
else if("tax_env".equalsIgnoreCase(childNodeName))
{
taxEnv = checkNull(genericUtility.getColumnValue("tax_env",dom));
tranDateStr = checkNull(genericUtility.getColumnValue("tran_date", dom));
//taxEnv = checkNull(genericUtility.getColumnValue("tax_env",dom));
taxEnv = checkNull(getParentColumnValue("tax_env",dom, "2"));
System.out.println("DirectPay 2 taxEnv["+taxEnv+"]");
tranDateStr = checkNull(genericUtility.getColumnValue("tran_date", dom1));
if(tranDateStr.trim().length()>0)
{
tranDateTm = Timestamp.valueOf(genericUtility.getValidDateString(tranDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
......@@ -800,7 +802,10 @@ public class PaymentExpenseEJB extends ValidatorEJB implements PaymentExpenseLoc
}
else
{
errCode = finCommon.checkTaxEnvStatus(taxEnv, tranDateTm, conn);
//Pavan R 17sept19 start[to validate tax environment]
//errCode = finCommon.checkTaxEnvStatus(taxEnv, tranDateTm, conn);
errCode = finCommon.checkTaxEnvStatus(taxEnv, tranDateTm, "F", conn);
//Pavan R 04sept19 end[to validate tax environment]
if(errCode != null && errCode.trim().length() > 0)
{
errList.add(errCode);
......@@ -2796,4 +2801,31 @@ public class PaymentExpenseEJB extends ValidatorEJB implements PaymentExpenseLoc
System.out.println("Returned amount in getCalculatedAmount::: ["+netAmountBC+"]");
return netAmountBC;
}
public String getParentColumnValue(String currColumn, Document dom, String formNo)throws ITMException
{
NodeList parentNodeList=null;
Node parentNode=null;
String Value = "";
try
{
E12GenericUtility genericUtility= new E12GenericUtility();
parentNodeList = dom.getElementsByTagName("Detail"+formNo);
int childNodeListLength = parentNodeList.getLength();
for(int ctr = 0; ctr < childNodeListLength; ctr++)
{
parentNode = parentNodeList.item(ctr);
Value = genericUtility.getColumnValueFromNode(currColumn, parentNode);
break;
} // end for
}//END TRY
catch(Exception e)
{
System.out.println("DistCommon::getParentColumnValue::Exception ::"+e);
e.printStackTrace();
throw new ITMException(e);
}
return Value;
}
}
\ No newline at end of file
......@@ -184,7 +184,7 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
String effBankStr="",rcpacctAmt="";
String refType = "",guid = "",chqAmt;
Timestamp tranDt = null;
double rcpacctAmtdbl=0;
//Calendar currentDate = Calendar.getInstance();--by monika
......@@ -911,7 +911,17 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
errCode = "VMTAXENVNF";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else //Pavan R 17sept19 start[to validate tax environment]
{
tranDateS=this.genericUtility.getColumnValue("tran_date", dom);
tranDt = Timestamp.valueOf(genericUtility.getValidDateString(tranDateS,this.genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
errCode = finCommon.checkTaxEnvStatus( taxEnv, tranDt,"F", conn );
if( errCode != null && errCode.trim().length() > 0 ) {
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
} //Pavan R 17sept19 end[to validate tax environment]
}
}
//ended by akhilesh on 19/AUG/13 for tax provision
......@@ -1648,7 +1658,8 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
}
else if(childNodeName.equalsIgnoreCase("tax_env"))
{
taxEnv = checkNull(genericUtility.getColumnValue("tax_env", dom));
//taxEnv = checkNull(genericUtility.getColumnValue("tax_env", dom));
taxEnv = checkNull(getParentColumnValue("tax_env", dom, "2"));
if( taxEnv != null && taxEnv.trim().length() > 0)
{
sql = "select count(*) from taxenv where tax_env = ?";
......@@ -1670,7 +1681,16 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
errCode = "VMTAXENVNF";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}else //Pavan R 17sept19 start[to validate tax environment]
{
tranDateS=this.genericUtility.getColumnValue("tran_date", dom1);
tranDt = Timestamp.valueOf(genericUtility.getValidDateString(tranDateS,this.genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
errCode = finCommon.checkTaxEnvStatus( taxEnv, tranDt,"F", conn );
if( errCode != null && errCode.trim().length() > 0 ) {
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
} //Pavan R 31aug19 end[to validate tax environment in all transaction]
}
}
//ended by akhilesh on 31/july/13 for tax provision
......@@ -5372,7 +5392,32 @@ public class ReceiptAdv extends ValidatorEJB implements ReceiptAdvLocal, Receipt
}
public String getParentColumnValue(String currColumn, Document dom, String formNo)throws ITMException
{
NodeList parentNodeList=null;
Node parentNode=null;
String Value = "";
try
{
E12GenericUtility genericUtility= new E12GenericUtility();
parentNodeList = dom.getElementsByTagName("Detail"+formNo);
int childNodeListLength = parentNodeList.getLength();
for(int ctr = 0; ctr < childNodeListLength; ctr++)
{
parentNode = parentNodeList.item(ctr);
Value = genericUtility.getColumnValueFromNode(currColumn, parentNode);
break;
} // end for
}//END TRY
catch(Exception e)
{
System.out.println("DistCommon::getParentColumnValue::Exception ::"+e);
e.printStackTrace();
throw new ITMException(e);
}
return Value;
}
}
\ No newline at end of file
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