Commit a8b5e7db authored by ssalve's avatar ssalve

Sarita : Done changes for prd_code validation not to accept future period code on 4JAN 2018

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@177628 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0b1181bc
......@@ -92,8 +92,10 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
int childNodeLength = 0;
int ctr = 0, cnt = 0;
String childNodeName = "",siteCode="",prdCode="";
//Added by sarita on 4JAN2018
Timestamp prdCodeCurrent=null , currDate = null;
double totalPer=0 ,crntPer=0;
String allocation = "",CurrentLineNo="";
String allocation = "",CurrentLineNo="",updateFlag="";
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try
{
......@@ -196,7 +198,53 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
//Added by sarita on 4JAN2018
else
{
//contains period code other than current period code
sql = "SELECT FR_DATE FROM PERIOD WHERE CODE =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,prdCode);
//pstmt.setTimestamp(1, java.sql.Timestamp.valueOf(genericUtility.getValidDateString(new Date(), genericUtility.getDBDateFormat()+" 00:00:00.0")));
rs = pstmt.executeQuery();
if(rs.next())
{
//prdCodeCurrent = rs.getString("CODE") == null ? "" : rs.getString("CODE");
prdCodeCurrent = rs.getTimestamp("FR_DATE");
System.out.println("prdCodeCurrent ::["+prdCodeCurrent+"]");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(prdCodeCurrent != null)
{
currDate = java.sql.Timestamp.valueOf(genericUtility.getValidDateString(new Date(), genericUtility.getDBDateFormat()+" 00:00:00.0"));
System.out.println("currDate :: ["+currDate+"]"+"prdCodeCurrent >> ["+prdCodeCurrent+"]");
if(prdCodeCurrent.after(currDate))
{
errCode = "VTERRPRD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
/* if(!("".equalsIgnoreCase(prdCodeCurrent)) && !(prdCode.equalsIgnoreCase(prdCodeCurrent)))
{
errCode = "VTERRPRD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}*/
}
}
System.out.println("Site Code is ==="+siteCode +"----- AND -----"+"Period Code is ===="+prdCode);
sql = "select count(*) as count from resource_cons where site_code=? and prd_code=?";
......@@ -257,7 +305,7 @@ public class CostCtrAllocIC extends ValidatorEJB implements CostCtrAllocICRemote
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName::: for Case3"+childNodeName);
System.out.println("childNodeName::: for Case3"+childNodeName +"editFlag :::"+editFlag);
if("allocation".equalsIgnoreCase(childNodeName))
{
allocation = checkNull(genericUtility.getColumnValue("allocation",dom)).trim();
......@@ -1321,7 +1369,7 @@ public String defaultDataWiz() throws RemoteException, ITMException
dataMap = tempList.get(iCtr);
cctrCode = (String)dataMap.get("tech_spec");
itemSer = (String)dataMap.get("item_ser");
//changes by sarita on 08NOV2017
//changes by sarita on 08.11.2017
//invAmt = (double)dataMap.get("inv_amt");
invAmt = (Double)dataMap.get("inv_amt");
calcAlloc = (invAmt / totSalesAmt) * 100;
......@@ -1747,7 +1795,7 @@ public String defaultDataWiz() throws RemoteException, ITMException
//Added by sarita on 30NOV2017
updateFlag = getAttributeVal(pNode,"updateFlag");
System.out.println("perAmt ::"+perAmt + "\t" + "lineNo ::"+lineNo +"update Flag ::"+updateFlag);
//if(!lineNo.equalsIgnoreCase(CurrentLineNo.trim()))
//if(!lineNo.equalsIgnoreCase(CurrentLineNo.trim()))
if((!lineNo.equalsIgnoreCase(CurrentLineNo.trim())) && !("D".equalsIgnoreCase(updateFlag)))
{
System.out.println("Line No is.. "+CurrentLineNo);
......
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