Commit 6e2cf430 authored by asant's avatar asant

Added new requirement related points

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@192127 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6d284107
......@@ -277,7 +277,34 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
break;
}
}
//Commented on 05-10-18 START
//Added by AMOL START
/*try
{
if( E12GenericUtility.checkNull(custCode).length() > 0 && E12GenericUtility.checkNull(fromDtStr).length() > 0
&& E12GenericUtility.checkNull(toDtStr).length() > 0)
{
System.out.println("#### WFValData From Date :"+fromDtStr);
System.out.println("#### WFValData To Date :"+toDtStr);
formatedInvIds = new SalesQuotRevision().getInvoiceIds(formatedInvIds,custCode,fromDtStr,toDtStr,conn);
System.out.println("#### Formatted IDs ["+formatedInvIds+"]");
System.out.println("#### formatedInvIds.length ["+formatedInvIds.length()+"]");
if(formatedInvIds.length() == 2 || formatedInvIds == null)
{
errCode = "VTNORECFND";
errList.add(errCode);
errFields.add("to_date");
break;
}
}
}
catch(Exception e)
{
System.out.println("#### Exception in WFValDate Invoice_ID "+e);
e.printStackTrace();
}*/
//Added by AMOL END
//Commented on 05-10-18 END
}
}
......@@ -290,7 +317,34 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
for ( int rowCnt=0; rowCnt < parentNodeListLen; rowCnt++ )
{
try {
parentNode = parentNodeList.item(rowCnt);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("#### Detail 2 Name [ "+childNodeName+"]");
//System.out.println("#### Detail3 Value [ "+childNode.getFirstChild().getNodeValue()+"]");
if(childNodeName.equalsIgnoreCase("item_code"))
{
itemCodeStr = E12GenericUtility.checkNull(genericUtility.getColumnValue("item_code", dom));
System.out.println("###### item_code ["+itemCodeStr+"]");
if(itemCodeStr.isEmpty())
{
errCode = "INVITMCO";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
}
try
{
System.out.println("#### IN FORM 2 ");
parentNode = parentNodeList.item(rowCnt);
......@@ -343,6 +397,7 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
{
e.printStackTrace();
}
}
if(count2 == 0)
{
......@@ -372,7 +427,14 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("#### Detail 3 Name [ "+childNodeName+"]");
/*childElem = (Element) childNode;
System.out.println("#### item(0) ["+childElem.getElementsByTagName("item_code").item(0)+"]");
if(childElem.getElementsByTagName("item_code").item(0)!= null)
{
System.out.println("#### VALUE ==>"+childElem.getElementsByTagName("item_code").item(0).getFirstChild().getNodeValue());
}*/
//cildNodeValue = childNode.getFirstChild().getNodeValue();
//System.out.println("#### Detail3 Value [ "+childNode.getFirstChild().getNodeValue()+"]");
if(childNodeName.equalsIgnoreCase("sr_no"))
{
srNoStr = E12GenericUtility.checkNull(genericUtility.getColumnValue("sr_no", dom));
......@@ -433,6 +495,15 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
break;
}
}
/*else if (childNodeName.equalsIgnoreCase("discount"))
{
srNoStr = E12GenericUtility.checkNull(genericUtility.getColumnValue("discount", dom));
}*/
/*else if (childNodeName.equalsIgnoreCase("comm_perc"))
{
srNoStr = E12GenericUtility.checkNull(genericUtility.getColumnValue("comm_perc", dom));
}*/
}
}
......@@ -742,27 +813,51 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
//START 08-10-18
else if(currentColumn.trim().equalsIgnoreCase("itm_default_add"))
{
System.out.println("@@@@@@ #### "+srNoSet);
try
{
//globalNo = globalNo +1;
//String newSrNo = getSrNo(dom2);
//System.out.println("#### New SrNo ");
String newSrNo = "";
System.out.println("######### srNoSet size "+srNoSet.size());
if(copyOfsrNoSet != null)
System.out.println("###### "+getLineNo(dom));
System.out.println("###### "+getLineNo(dom1));
System.out.println("###### "+getLineNo(dom2));
int lineNo = Integer.parseInt(getLineNo(dom1));
String custCodeStrng = genericUtility.getColumnValue("cust_code", dom1);//Logic2
String fromDateStrng = genericUtility.getColumnValue("from_date", dom1);//Logic2
String toDateStrrng = genericUtility.getColumnValue("to_date", dom1);//Logic2
if(srNoSet == null) //Logic2
{
getGoodsMap(custCodeStrng,fromDateStrng,toDateStrrng);
getDomId(dom2);
if(lineNo >= 1)
{
if(srNoSet != null)
{
//getDomId(dom2);
//newSrNo = (srNoSet.size()+lineNo)+"";
newSrNo = (srNoSet.size())+"";
}else
{
newSrNo = ""+lineNo;
}
}
}
/*if(copyOfsrNoSet != null)
{
srNoSet.addAll(copyOfsrNoSet);//Add new sr No Form 2
copyOfsrNoSet.clear();////Add new sr No Form 2
}
if(!srNoSet.isEmpty())
if(srNoSet != null) //Logic2
{
newSrNo = (srNoSet.size()+1)+"";
//srNoSet.add(srNoSet.size()+1);
//srNoSet.clear();
}
if(!srNoSet.isEmpty()) ////Logic1
{
newSrNo = (srNoSet.size()+1)+"";
}
else
{
......@@ -774,7 +869,7 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
System.out.println("######## ZerO SeT...");
newSrNo = "1";
}
}
}*/
System.out.println("######### AFter New SrNo "+newSrNo);
valueXmlString.append("<Detail2 domID=\""+newSrNo+"\" selected=\"N\" > \r\n");
......@@ -806,7 +901,7 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
}
catch (Exception e)
{
System.out.println("@@@@ Exception ON ITEMCHANGE ==> itm_default_add : "+e);
e.printStackTrace();
}
}
......@@ -889,6 +984,8 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
System.out.println("@@@@ Exception ON ITEMCHANGE ==> ITEM_CODE : "+e);
}
}
else if(currentColumn.trim().equalsIgnoreCase("qty_per_month"))
{
......@@ -937,7 +1034,50 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
System.out.println("@@@@ Exception ON ITEMCHANGE ==> qty_per_month :"+e);
}
}
/*else if(currentColumn.trim().equalsIgnoreCase("rate"))
{
//Require system entries.
custCode = checkNull(genericUtility.getColumnValue("cust_code",dom2));
String itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
qtyMonth = checkNull(genericUtility.getColumnValue("qty_per_month",dom));
rate = checkNull(genericUtility.getColumnValue("rate",dom));
discount = checkNull(genericUtility.getColumnValue("discount",dom));
grossRate = checkNull(genericUtility.getColumnValue("gross_rate",dom));
commission = checkNull(genericUtility.getColumnValue("comm_perc",dom));
commissionPerUnit = checkNull(genericUtility.getColumnValue("comm_per_unit",dom));
Double grossRate2 = ((getDoubleValue(rate) - ((getDoubleValue(rate) * getDoubleValue(discount)) / 100)));
if(grossRate2.isNaN() || grossRate2.isInfinite())
{
grossRate2 = 0.0;
}
double comm = 0;
try
{ String commTable = getCommission(custCode, conn);
comm = getCommision(commTable,currDate,conn,itemCode);
}
catch(Exception e)
{
comm = 0;
}
double commPerUnit2 = (((grossRate2 * comm) / 100));
double newCostRate2 = ((grossRate2 - commPerUnit2));
double costRate2 = getCostRate(conn, itemCode);
double availblStock = getStockDetails(conn,itemCode);
double profit2 = (newCostRate2 - costRate2);
String profitParse = String.format("%.2f", profit);
double profitOnGoods2 = (Double.parseDouble(profitParse) * getDoubleValue(qtyMonth));
double finalPrice2 = (grossRate2 * getDoubleValue(qtyMonth));
Double percProfit2 = ((profitOnGoods2 / finalPrice2) * 100);
if(percProfit2.isNaN() || percProfit2.isInfinite())
{
percProfit2 = 0.0;
}
}*/
else if(currentColumn.trim().equalsIgnoreCase("discount"))
{
try
......@@ -1755,6 +1895,7 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
if ( parentNode.getAttributes().getNamedItem( "domID" ) != null )
{
System.out.println("Inside Attribute : "+elementAttr);
Node node = elementAttr.getElementsByTagName("attribute").item(0);
String str = node.getAttributes().getNamedItem("updateFlag").getTextContent();
System.out.println("str :: "+str);
......@@ -2674,10 +2815,11 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
}
return availblStock;
}
//Not Using
//Wrkflw ....
@Override
public String approvePriceRate(String quotNo, String userInfo, String xmlData)
{
System.out.println("###### approvePriceRate .....");
Document dom = null;
try
{
......@@ -2703,6 +2845,33 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
String transDB = userInfoBean.getTransDB();
connection = connDriver.getConnectDB(transDB);
connection.setAutoCommit(false);
//Added by AMOL on 18-10-18 [To show transcation History to USER] START
String sqlStr = "UPDATE SALES_QUOT SET WF_STATUS = ? WHERE QUOT_NO = ?";
System.out.println("######### Updating Approve Satus ");
try
{
pstmt = connection.prepareStatement(sqlStr);
pstmt.setString(1, "S");
pstmt.setString(2, quotNo);
int updateCount = pstmt.executeUpdate();
if(updateCount > 0)
{
connection.commit();
}
System.out.println("#### Updating transetup No of rows "+updateCount);
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
e.printStackTrace();
}
//Added by AMOL on 18-10-18 [To show transcation History to USER] END
chgTerm = checkNull(genericUtility.getColumnValue("chg_term", dom, "1")).trim();
chgUser = checkNull(genericUtility.getColumnValue("chg_user", dom, "1")).trim();
custCode = checkNull(genericUtility.getColumnValue("cust_code", dom, "1")).trim();
......@@ -2738,6 +2907,7 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
System.out.println(":unit : in uniit "+unit);
}
}
System.out.println("####");
updatePriceList(priceList, itemCode, unit, revisedRate, chgTerm, chgUser, connection);
}
......@@ -2873,14 +3043,8 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
int insertUpdate = insertPstmt.executeUpdate();
System.out.println("SalesQuotProposal.updatePriceList() L insertUpdate" +insertUpdate);
/* if(updatePreStmt != null)
{
updatePreStmt.close();
updatePreStmt = null;
}*/
if(updatedCnt >= 0 || insertUpdate >= 0 )
if(updatedCnt > 0 || insertUpdate > 0 )
{
//connection.commit();
}
......@@ -2889,17 +3053,86 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
insertPstmt.close();
insertPstmt = null;
}
} catch (SQLException e)
{
e.printStackTrace();
}
finally
{
try
{
if(connection != null)
{
connection.close();
connection = null;
}
} catch (SQLException e)
{
e.printStackTrace();
}
}
}
//WrkFlw...
public String rejectRate(String quotNo, String userInfo, String xmlData)
{
System.out.println("###### New Rate Rejeced .....");
ConnDriver connDriver = new ConnDriver();
Connection connection = null;
PreparedStatement pstmt = null;
//ResultSet resultSet = null;
String sqlStr = "UPDATE SALES_QUOT SET WF_STATUS = ? WHERE QUOT_NO = ?";
try
{
UserInfoBean userInfoBean = new UserInfoBean(userInfo);
String transDB = userInfoBean.getTransDB();
connection = connDriver.getConnectDB(transDB);
connection.setAutoCommit(false);
pstmt = connection.prepareStatement(sqlStr);
pstmt.setString(1, "R");
pstmt.setString(2, quotNo);
int updateCount = pstmt.executeUpdate();
if(updateCount > 0)
{
connection.commit();
}
System.out.println("#### Updating transetup No of rows "+updateCount);
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
if(connection != null)
{
try
{
connection.close();
connection = null;
} catch (SQLException e) {
e.printStackTrace();
}
}
}
return "1";
}
private String getCommission(String custCode, Connection connection)
{
PreparedStatement pStmt = null;
......@@ -3710,11 +3943,14 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
}
//Added on 09-10-18 To calculate Total Summary.Below code get data for form no2 START
// private Map<String,LinkedList<Double> > summaryProfitMap = null;
private JSONObject finalSummaryProfitMap = null;
public JSONObject getGoodsMap(String custCode, String fromDateStr, String toDateStr)
{
//
srNoSet = new HashSet();
finalSummaryProfitMap = new JSONObject();
JSONObject summaryGoodsMap = new JSONObject();
......@@ -3820,6 +4056,7 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
while(itr.hasNext())
{
srNo++;
srNoSet.add(srNo);
Map.Entry<String, Double> entry = itr.next();
String itemCode = E12GenericUtility.checkNull(entry.getKey());
......@@ -3894,8 +4131,7 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
{
return finalSummaryProfitMap;
}
//Added on 09-10-18 To calculate Total Summary.Below code get data for form no2 END
private String getLineNo(Document docu)
{
//String srNo = "";
......@@ -3906,4 +4142,34 @@ public class SalesQuotProposal extends ValidatorEJB implements SalesQuotProposal
return String.valueOf(nListLen);
}
//Logic 2
private String getDomId(Document docu)
{
NodeList parentNList = docu.getElementsByTagName("Detail2");
int nListLen = parentNList.getLength();
System.out.println("#### Detail2 Lenght @@@@@@@@"+nListLen);
Node node = null;
//Element elem = null;
for(int i = 0; i < nListLen; i++)
{
node = parentNList.item(i);
if(node.getAttributes().getNamedItem( "domID" ) != null)
{
Node n = node.getAttributes().getNamedItem( "domID" );
if(n != null)
{
String domID = n.getNodeValue();
System.out.println("#### DOM ID "+domID);
if(srNoSet != null)
{
srNoSet.add(Integer.parseInt(domID));
}
}
}
}
return "";
}
}
\ 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