Commit 2d9e4c27 authored by SABURI PATEKAR's avatar SABURI PATEKAR

Added transporter validation and RFQ rate calculation using FINPARAM-based pricelist configuration

parent 95b596ed
This source diff could not be displayed because it is too large. You can view the blob instead.
package ibase.webitm.ejb.dis;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.utility.BaseException;
import ibase.utility.BaseLogger;
import ibase.utility.E12GenericUtility;
import ibase.utility.GenericUtility;
import ibase.utility.UserInfoBean;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
public class ReqForQuotationIC extends ValidatorEJB {
E12GenericUtility genericUtility = new E12GenericUtility();
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException {
BaseLogger.log("3", getUserInfo(), null,
">>>>>>>>>>>>>>>>>>ReqForQuotationIC validation called>>>>>>>>>>>>>>>>>>>:::");
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String errString = null;
BaseLogger.log("3", null, null, "xmlString ReqForQuotationIC [" + xmlString + "]");
BaseLogger.log("3", null, null, "xmlString1 ReqForQuotationIC [" + xmlString1 + "]");
BaseLogger.log("3", null, null, "xmlString2 ReqForQuotationIC [" + xmlString2 + "]");
try {
if (xmlString != null && xmlString.trim().length() != 0) {
dom = genericUtility.parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length() != 0) {
dom1 = genericUtility.parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length() != 0) {
dom2 = genericUtility.parseString(xmlString2);
}
errString = wfValData(dom, dom1, dom2, objContext, editFlag, xtraParams);
BaseLogger.log("3", null, null, "ErrString: " + errString);
} catch (Exception e) {
System.out.println("Exception: ReqForQuotationIC: wfValData(String xmlString): " + e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
e.printStackTrace();
}
BaseLogger.log("3", null, null, "Returning from ReqForQuotationIC wfValData");
return (errString);
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException {
BaseLogger.log("3", getUserInfo(), null, "9>>>>>>>>>>>>>>>>>>ReqForQuotationIC validation called >>>>>>>>>>>>>>>>>>>");
BaseLogger.log("3", null, null, "Inside ReqForQuotationIC validation");
GenericUtility genericUtility = GenericUtility.getInstance();
try {
BaseLogger.log("3", getUserInfo(), null, "dom case2*>>>> Elements>>["+genericUtility.serializeDom(dom).toString()+"]");//added for testing
BaseLogger.log("3", getUserInfo(), null, "dom2 case2*>>>> Elements>>["+genericUtility.serializeDom(dom2).toString()+"]");//added for testing
BaseLogger.log("3", getUserInfo(), null, "dom1 case2*>>>> Elements>>["+genericUtility.serializeDom(dom1).toString()+"]");
} catch (BaseException e1) {
e1.printStackTrace();
}
String userId = "";
String requestId = "";
String sql="";
String errString = "";
Connection connection = null;
ResultSet rs = null;
PreparedStatement pstmt = null;
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = null;
int noOfChilds = 0;
int currentFormNo = 0;
try
{
SimpleDateFormat DOB = new SimpleDateFormat(getApplDateFormat());
connection = getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
switch ( currentFormNo )
{
case 1:
{
parentList = dom.getElementsByTagName("Detail"+ currentFormNo);
int parentNodeListLength = parentList.getLength();
System.out.println("parentNodeListLength["+parentNodeListLength+"]");
for (int prntCtr = 0; prntCtr < parentNodeListLength; prntCtr++ )
{
parentNode = parentList.item(prntCtr);
System.out.println("value of parentNode"+parentNode);
childList = parentNode.getChildNodes();
noOfChilds = childList.getLength();
System.out.println("value of noOfChilds"+noOfChilds);
for (int ctr = 0; ctr < noOfChilds; ctr++)
{
childNode = childList.item(ctr);
System.out.println("childNode"+childNode);
if( childNode.getNodeType() != Node.ELEMENT_NODE )
{
continue;
}
childNodeName = childNode.getNodeName();
if( childNodeName.equalsIgnoreCase("cust_code") )
{
String custCode = checkNull(genericUtility.getColumnValue("cust_code", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC custCode wfValData case 1 [" + custCode + "]");
String checkCustCodeSql = "select count(cust_code) as custCodeCount from customer where cust_code = ? and cust_type = 'R'";
PreparedStatement checkCustCodePs = connection.prepareStatement(checkCustCodeSql);
checkCustCodePs.setString(1, custCode);
ResultSet checkCustCodeRs = checkCustCodePs.executeQuery();
while(checkCustCodeRs.next()) {
int custCodeCont = checkCustCodeRs.getInt("custCodeCount");
BaseLogger.log("3", null, null, "ReqForQuotationIC custCode wfValData case 1 custCodeCont::[" + custCodeCont + "]");
if(custCodeCont<=0) {
errString = getErrorString("cust_code", "VTCUST1", userId);
break;
}
}
if(checkCustCodeRs != null)
{
checkCustCodeRs.close();
checkCustCodeRs = null;
}
if(checkCustCodePs != null)
{
checkCustCodePs.close();
checkCustCodePs = null;
}
}
if( childNodeName.equalsIgnoreCase("quot_type") )
{
String customerCode = checkNull(genericUtility.getColumnValue("cust_code", dom));
String quotationtype = checkNull(genericUtility.getColumnValue("quot_type", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC quotationtype wfValData case 1 [" + quotationtype + "]");
if (quotationtype.equalsIgnoreCase("G"))
{
// String groupCode = "select group_code from customer where cust_code= ?";
// PreparedStatement quotationcodePs = connection.prepareStatement(groupCode);
// quotationcodePs.setString(1, quotationcode);
// ResultSet quotationcodeRs = quotationcodePs.executeQuery();
String quotationtypeSql = "select count(group_code) as customergroupcount from customer where group_code= ?";
PreparedStatement quotationtypePs = connection.prepareStatement(quotationtypeSql);
quotationtypePs.setString(1, customerCode);
ResultSet quotationtypeRs = quotationtypePs.executeQuery();
while(quotationtypeRs.next())
{
int customergroupcount = quotationtypeRs.getInt("customergroupcount");
BaseLogger.log("3", null, null, "ReqForQuotationIC group_count wfValData case 1 quotationtypeRs::[" + customergroupcount + "]");
if(customergroupcount<=1)
{
errString = getErrorString("cust_code", "INVCG", userId);
break;
}
}
if(quotationtypeRs != null)
{
quotationtypeRs.close();
quotationtypeRs = null;
}
if(quotationtypePs != null)
{
quotationtypePs.close();
quotationtypePs = null;
}
}
}
if( childNodeName.equalsIgnoreCase("sales_pers") )
{
String salesPerson = checkNull(genericUtility.getColumnValue("sales_pers", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC salesPerson wfValData case 1 [" + salesPerson + "]");
String salesPersonSql = "select count(SALES_PERS) as salesPersonCount from SALES_PERS where SALES_PERS = ?";
PreparedStatement salesPersonPs = connection.prepareStatement(salesPersonSql);
salesPersonPs.setString(1, salesPerson);
ResultSet salesPersonRs = salesPersonPs.executeQuery();
while(salesPersonRs.next()) {
int salesPersonCount = salesPersonRs.getInt("salesPersonCount");
BaseLogger.log("3", null, null, "ReqForQuotationIC sales_pers wfValData case 1 salesPersonRs::[" + salesPersonCount + "]");
if(salesPersonCount<=0) {
errString = getErrorString("sales_pers", "VTSALPER", userId);
break;
}
}
if(salesPersonRs != null)
{
salesPersonRs.close();
salesPersonRs = null;
}
if(salesPersonPs != null)
{
salesPersonPs.close();
salesPersonPs = null;
}
}
if( childNodeName.equalsIgnoreCase("valid_upto") )
{
String validUptoStr = checkNull(genericUtility.getColumnValue("valid_upto", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC validUptoStr wfValData case 1 [" + validUptoStr + "]");
if(isDateInvalid(validUptoStr))
{
errString = getErrorString("valid_upto", "VTINUPTO", userId);
break;
}
}
if( childNodeName.equalsIgnoreCase("site_code") )
{
String siteCode = checkNull(genericUtility.getColumnValue("site_code", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC siteCode wfValData case 1 [" + siteCode + "]");
String checkSiteCodeSql = "select count(site_code) as siteCodeCount from site where site_code = ?";
PreparedStatement checkSiteCodePs = connection.prepareStatement(checkSiteCodeSql);
checkSiteCodePs.setString(1, siteCode);
ResultSet checkSiteCodeRs = checkSiteCodePs.executeQuery();
while(checkSiteCodeRs.next()) {
int siteCodeCont = checkSiteCodeRs.getInt("siteCodeCount");
BaseLogger.log("3", null, null, "ReqForQuotationIC siteCode wfValData case 1 siteCodeCont::[" + siteCodeCont + "]");
if(siteCodeCont<=0) {
errString = getErrorString("site_code", "VTSITCD1", userId);
break;
}
}
if(checkSiteCodeRs != null)
{
checkSiteCodeRs.close();
checkSiteCodeRs = null;
}
if(checkSiteCodePs != null)
{
checkSiteCodePs.close();
checkSiteCodePs = null;
}
}
if( childNodeName.equalsIgnoreCase("item_ser") )
{
String itemSerStr = checkNull(genericUtility.getColumnValue("item_ser", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC itemSerStr wfValData case 1 [" + itemSerStr + "]");
if (itemSerStr != null && itemSerStr.length() > 0) {
String[] itemSerArr = itemSerStr.split(",");
for (String itemSer : itemSerArr) {
BaseLogger.log("3", null, null, "ReqForQuotationIC item_ser wfValData case 1 itemSer [" + itemSer + "]");
sql = "SELECT count(1) FROM itemser WHERE item_ser = ?";
pstmt = connection.prepareStatement(sql);
pstmt.setString(1, itemSer.trim());
rs = pstmt.executeQuery();
long count = 0;
if (rs.next()) {
count = rs.getLong(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (count == 0) {
errString = getErrorString("item_ser", "VTITEMSER1", userId);
break;
}
}
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
}
}
}
break;
}
case 2:
{
parentList = dom.getElementsByTagName("Detail"+ currentFormNo);
int parentNodeListLength = parentList.getLength();
System.out.println("parentNodeListLength["+parentNodeListLength+"]");
for (int prntCtr = 0; prntCtr < parentNodeListLength; prntCtr++ )
{
parentNode = parentList.item(prntCtr);
System.out.println("value of parentNode"+parentNode);
childList = parentNode.getChildNodes();
noOfChilds = childList.getLength();
System.out.println("value of noOfChilds"+noOfChilds);
for (int ctr = 0; ctr < noOfChilds; ctr++)
{
childNode = childList.item(ctr);
System.out.println("childNode"+childNode);
if( childNode.getNodeType() != Node.ELEMENT_NODE )
{
continue;
}
childNodeName = childNode.getNodeName();
if( childNodeName.equalsIgnoreCase("item_code") )
{
String[] itemSerArr = null;
String itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
String itemSer = checkNull(genericUtility.getColumnValue("item_ser", dom1));
BaseLogger.log("3", null, null, "ReqForQuotationIC itemCode wfValData case 1 itemSer:[" + itemSer + "]");
BaseLogger.log("3", null, null, "ReqForQuotationIC itemCode wfValData case 1 [" + itemCode + "]");
if(itemSer != null && itemSer.trim().length() > 0)
{
itemSerArr = itemSer.split(",");
}
StringBuilder checkItemCodeSql = new StringBuilder(
"select count(item_code) as itemCodeCount from item where item_code = ?"
);
if(itemSerArr != null && itemSerArr.length > 0) {
checkItemCodeSql.append(" and item_ser IN (");
for(int i = 0; i < itemSerArr.length; i++) {
checkItemCodeSql.append("?");
if(i < itemSerArr.length - 1) {
checkItemCodeSql.append(",");
}
}
checkItemCodeSql.append(")");
}
String checkItemCodeSql1 = checkItemCodeSql.toString();
PreparedStatement checkItemCodePs = connection.prepareStatement(checkItemCodeSql1);
// 🔹 Set first parameter (item_code)
int paramIndex = 1;
checkItemCodePs.setString(paramIndex++, itemCode);
// 🔹 Set IN clause parameters (item_ser)
if(itemSerArr != null && itemSerArr.length > 0) {
for(String ser : itemSerArr) {
checkItemCodePs.setString(paramIndex++, ser.trim());
}
}
ResultSet checkItemCodeRs = checkItemCodePs.executeQuery();
while(checkItemCodeRs.next()) {
int itemCodeCont = checkItemCodeRs.getInt("itemCodeCount");
BaseLogger.log("3", null, null, "ReqForQuotationWiz itemCode wfValData case 1 itemCodeCont::[" + itemCodeCont + "]");
if(itemCodeCont<=0) {
errString = getErrorString("item_code", "STKVALITNE", userId);
break;
}
}
if(checkItemCodeRs != null)
{
checkItemCodeRs.close();
checkItemCodeRs = null;
}
if(checkItemCodePs != null)
{
checkItemCodePs.close();
checkItemCodePs = null;
}
}
if( childNodeName.equalsIgnoreCase("ptr_flag") )
{
String ptrFlag = checkNull(genericUtility.getColumnValue("ptr_flag", dom));
String rateQuot = checkNull(genericUtility.getColumnValue("rate_quot", dom));
String competitorRate = checkNull(genericUtility.getColumnValue("competitor_rate", dom));
String competitorItem = checkNull(genericUtility.getColumnValue("competitor_item", dom));
String competitorName = checkNull(genericUtility.getColumnValue("competitor_name", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC ptrFlag wfValData [" + ptrFlag + "]");
BaseLogger.log("3", null, null, "ReqForQuotationIC rateQuot wfValData [" + rateQuot + "]");
BaseLogger.log("3", null, null, "ReqForQuotationIC competitorRate wfValData [" + competitorRate + "]");
BaseLogger.log("3", null, null, "ReqForQuotationIC competitorItem wfValData [" + competitorItem + "]");
BaseLogger.log("3", null, null, "ReqForQuotationIC competitorNane wfValData [" + competitorName + "]");
if (ptrFlag.equalsIgnoreCase("N") || ptrFlag.trim().isEmpty()) {
BaseLogger.log("3", null, null, "ReqForQuotationIC in condition ptrFlag wfValData::: [" + ptrFlag + "]");
if(rateQuot==null || rateQuot.trim().length()<=0) {
errString = getErrorString("rate_quot", "INVQR", userId);
BaseLogger.log("3", null, null, "ReqForQuotationIC in competitor details null errString:: [" + errString + "]");
break;
}
// Check if any of the competitor fields are null or blank
if ((competitorRate == null || competitorRate.trim().isEmpty())
|| (competitorItem == null || competitorItem.trim().isEmpty())
|| (competitorName == null || competitorName.trim().isEmpty())) {
BaseLogger.log("3", null, null, "ReqForQuotationIC in competitor details null [" + ptrFlag + "]");
errString = getErrorString("ptr_flag", "COMPDETM", userId);
BaseLogger.log("3", null, null, "ReqForQuotationIC in competitor details null errString:: [" + errString + "]");
break;
}
}
}
// Mohammed.D 21-04-2026 added validition to check for negetive quantity value
if(childNodeName.equalsIgnoreCase("qty_quot"))
{
String qtyStr = checkNull(genericUtility.getColumnValue("qty_quot", dom));
int qtyVal = (qtyStr == null || qtyStr.trim().length() == 0) ? 0 : Integer.parseInt(qtyStr.trim());
if(qtyVal < 0)
{
errString = getErrorString("qty_quot", "VTQTYN", userId);
break;
}
}
if( childNodeName.equalsIgnoreCase("rate_quot") )
{
String phyAttrVal = "";
String itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
String quotedRate = checkNull(genericUtility.getColumnValue("rate_quot", dom));
int quotedRateInt = 0;
if(quotedRate!=null && quotedRate.trim().length()>0) {
double quotedRateDouble = Double.parseDouble(quotedRate);
quotedRateInt = (int) quotedRateDouble;
// quotedRateInt = Integer.parseInt(quotedRate);
if(quotedRateInt<=0) {
errString = getErrorString("rate_quot", "INVQR", userId);
BaseLogger.log("3", null, null, "ReqForQuotationIC in PHY_ATTRIB_19 details null errString:: [" + errString + "]");
break;
}
}
BaseLogger.log("3", null, null, "ReqForQuotationIC in condition itemCode wfValData quotedRate::: [" + quotedRate + "]");
BaseLogger.log("3", null, null, "ReqForQuotationIC in condition itemCode wfValData itemCode::: [" + itemCode + "]");
String phyAttrValSql = "select PHY_ATTRIB_19 from item where item_code = ?";
PreparedStatement phyAttrValPs = connection.prepareStatement(phyAttrValSql);
phyAttrValPs.setString(1, itemCode);
ResultSet phyAttrValRs = phyAttrValPs.executeQuery();
while(phyAttrValRs.next()) {
phyAttrVal = checkNull(phyAttrValRs.getString("PHY_ATTRIB_19"));
}
BaseLogger.log("3", null, null, "ReqForQuotationIC in condition itemCode wfValData phyAttrVal::: [" + phyAttrVal + "]");
if(phyAttrVal.equalsIgnoreCase("SRNA")) {
errString = getErrorString("rate_quot", "INEFSR", userId);
BaseLogger.log("3", null, null, "ReqForQuotationIC in PHY_ATTRIB_19 details null errString:: [" + errString + "]");
break;
}
if(phyAttrValPs != null)
{
phyAttrValPs.close();
phyAttrValPs = null;
}
if(phyAttrValRs != null)
{
phyAttrValRs.close();
phyAttrValRs = null;
}
}
//Added changes on 25-March-26 by Ajit [Start]
if( childNodeName.equalsIgnoreCase("unit") )
{
int unitCount = 0;
String unit = checkNull(genericUtility.getColumnValue("unit", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC in condition unit wfValData unit::: [" + unit + "]");
String unitCountSql = "select count(unit) as unitCount from uom where unit = ?";
PreparedStatement unitCountPs = connection.prepareStatement(unitCountSql);
unitCountPs.setString(1, unit);
ResultSet unitCountRs = unitCountPs.executeQuery();
while(unitCountRs.next()) {
unitCount = unitCountRs.getInt("unitCount");
}
BaseLogger.log("3", null, null, "ReqForQuotationIC in condition unitCount::: [" + unitCount + "]");
if(unitCount <= 0) {
errString = getErrorString("unit", "VTITEMUNIT", userId);
BaseLogger.log("3", null, null, "ReqForQuotationIC in UNIT not present in master errString:: [" + errString + "]");
break;
}
if(unitCountPs != null)
{
unitCountPs.close();
unitCountPs = null;
}
if(unitCountRs != null)
{
unitCountRs.close();
unitCountRs = null;
}
}
if( childNodeName.equalsIgnoreCase("pack_code") )
{
int packCodeCount = 0;
String packCode = checkNull(genericUtility.getColumnValue("pack_code", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC in condition unit wfValData packCode::: [" + packCode + "]");
String packCodeCountSql = "select count(pack_code) as packCodeCount from packing where pack_code = ?";
PreparedStatement packCodeCountPs = connection.prepareStatement(packCodeCountSql);
packCodeCountPs.setString(1, packCode);
ResultSet packCodeCountRs = packCodeCountPs.executeQuery();
while(packCodeCountRs.next()) {
packCodeCount = packCodeCountRs.getInt("packCodeCount");
}
BaseLogger.log("3", null, null, "ReqForQuotationIC in condition unitCount::: [" + packCodeCount + "]");
if(packCodeCount <= 0) {
errString = getErrorString("pack_code", "VTPCKCDM", userId);
BaseLogger.log("3", null, null, "ReqForQuotationIC in UNIT not present in master errString:: [" + errString + "]");
break;
}
if(packCodeCountPs != null)
{
packCodeCountPs.close();
packCodeCountPs = null;
}
if(packCodeCountRs != null)
{
packCodeCountRs.close();
packCodeCountRs = null;
}
}
//Added changes on 25-March-26 by Ajit [End]
//End elseif
}//End for loop
}//End for loop
break;
}//case1
}//switch
}//try
catch (Exception e)
{
System.out.println ("Exception: wfValData(Document dom): " + e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
throw new ITMException(e);
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(connection != null)
{
connection.close();
connection = null;
}
}
catch(Exception e)
{
errString = genericUtility.createErrorString(e);
}
}
return (errString);
}
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext,
String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException {
BaseLogger.log("3", getUserInfo(), null,
">>>>>>>>>>>>>>>>>> ReqForQuotationIC itemchange called Ajit>>>>>>>>>>>>>>>>>>>");
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String errString = null;
try {
if (xmlString != null && xmlString.trim().length() != 0) {
dom = genericUtility.parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length() != 0) {
dom1 = genericUtility.parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length() != 0) {
dom2 = genericUtility.parseString(xmlString2);
}
BaseLogger.log("3", null, null, "xmlString ReqForQuotationIC [" + xmlString + "]");
BaseLogger.log("3", null, null, "xmlString1 ReqForQuotationIC [" + xmlString1 + "]");
BaseLogger.log("3", null, null, "xmlString2 ReqForQuotationIC [" + xmlString2 + "]");
errString = itemChanged(dom, dom1, dom2, objContext, currentColumn, editFlag, xtraParams);
BaseLogger.log("3", null, null, "ErrString :" + errString);
} catch (Exception e) {
BaseLogger.log("3", null, null, "Exception :ReqForQuotationIC :itemChanged(String,String):" + e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
}
BaseLogger.log("3", null, null, "returning from ReqForQuotationIC itemChanged");
return errString;
}
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn,
String editFlag, String xtraParams) throws RemoteException, ITMException {
BaseLogger.log("3", getUserInfo(), null, ">>>>>>>>>>>>>>>>>> ReqForQuotationIC itemchange called Ajit>>>>>>>>>>>>>>>>>>>");
System.out.println("Inside itemchange");
Connection con = null;
PreparedStatement psSiteCustomer = null;
PreparedStatement psCustomer = null;
PreparedStatement psPriceList = null;
PreparedStatement psFinEntity = null;
String reStr = "";
ResultSet rs = null;
StringBuffer valueXmlString = null;
int currentFormNo = 0;
String userId = "";
String sql = "";
String priceList = "";
int rate= 0;
String finEntity = "";
double updatedDistMargin = 0, updatedStkMargin=0, updatedRetMargin=0;
String phy13 = "";
String phy14 = "";
String phy15 = "";
String ptsPriceList = "";
String ptrPriceList = "";
String ptdPriceList = "";
String mgmtPriceList = "";
List<String> itemCodeList = new ArrayList<>();
try {
UserInfoBean userInfo = getUserInfo();
String siteCode = checkNull(userInfo.getSiteCode());
String userCode = checkNull(userInfo.getLoginCode());
String userName = checkNull(userInfo.getUserName());
String siteDescr = checkNull(userInfo.getSiteDescr());
BaseLogger.log("3", null, null, "ReqForQuotationIC in siteCodeFromUserInfo:: "+siteCode);
BaseLogger.log("3", null, null, "ReqForQuotationIC in userCodeFromUserInfo:: "+userCode);
BaseLogger.log("3", null, null, "ReqForQuotationIC in userName:: "+userName);
BaseLogger.log("3", null, null, "ReqForQuotationIC in siteDescr:: "+siteDescr);
con = getConnection();
userId = getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"); // To get user details after login
if (objContext != null && objContext.trim().length() > 0) {
currentFormNo = Integer.parseInt(objContext);
}
// start creating xml
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>");
String ptrFlag = checkNull(genericUtility.getColumnValue("ptr_flag", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC in ptr_flat condition ptrFlag:: "+ptrFlag);
BaseLogger.log("3", null, null, "ReqForQuotationIC currentFormNo "+currentFormNo);
switch (currentFormNo) {
case 1:
{
valueXmlString.append("<Detail1>");
if ("itm_default".equalsIgnoreCase(currentColumn.trim())) {
BaseLogger.log("3", null, null, "ReqForQuotationIC in itm_default case 1");
// Set tran_date to current date
SimpleDateFormat dtFormat = new SimpleDateFormat(getApplDateFormat());
String currDate = dtFormat.format(Calendar.getInstance().getTime());
valueXmlString.append("<tran_date>").append("<![CDATA[" + currDate + "]]>").append("</tran_date>\r\n");
// Set req_date to current date
valueXmlString.append("<req_date>").append("<![CDATA[" + currDate + "]]>").append("</req_date>\r\n");
// Set site_code to logged in user's site code
valueXmlString.append("<site_code>").append("<![CDATA[" + siteCode + "]]>").append("</site_code>\r\n");
valueXmlString.append("<quot_type>").append("<![CDATA[C]]>").append("</quot_type>");
// Set sales_pers to logged in user's code
valueXmlString.append("<sales_pers>").append("<![CDATA[" + userCode + "]]>").append("</sales_pers>\r\n");
// Set sp_name to logged in user's name
valueXmlString.append("<sp_name>").append("<![CDATA[" + userName + "]]>").append("</sp_name>\r\n");
// Set site_descr to logged in user's site description
valueXmlString.append("<site_descr>") .append("<![CDATA[" + siteDescr + "]]>").append("</site_descr>\r\n");
}
if ("cust_code".equalsIgnoreCase(currentColumn.trim())) {
BaseLogger.log("3", null, null, "ReqForQuotationIC in item change case 1 cust_code condition");
String custName = "", addr1 = "", addr2="", addr3="";
String custCode = checkNull(genericUtility.getColumnValue("cust_code", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC in case 1 cust_code:: "+custCode);
String custDetilsSql = "select cust_name, addr1 , addr2 , addr3 from customer where cust_code = ?";
PreparedStatement custDetailsPs = con.prepareStatement(custDetilsSql);
custDetailsPs.setString(1, custCode);
ResultSet custDetailsRs = custDetailsPs.executeQuery();
while(custDetailsRs.next()) {
custName = custDetailsRs.getString("cust_name");
addr1 = custDetailsRs.getString("addr1");
addr2 = custDetailsRs.getString("addr2");
addr3 = custDetailsRs.getString("addr3");
}
BaseLogger.log("3", null, null, "ReqForQuotationIC in case 1 custName:: "+custName);
valueXmlString.append("<cust_name>").append("<![CDATA["+custName+"]]>").append("</cust_name>\r\n");
valueXmlString.append("<addr1>").append("<![CDATA["+addr1+"]]>").append("</addr1>\r\n");
valueXmlString.append("<addr2>").append("<![CDATA["+addr2+"]]>").append("</addr2>\r\n");
valueXmlString.append("<addr3>").append("<![CDATA["+addr3+"]]>").append("</addr3>\r\n");
}
if ("item_ser".equalsIgnoreCase(currentColumn.trim()))
{
String itemSerDescr = "";
String itemSerForIC = checkNull(genericUtility.getColumnValue("item_ser", dom, "1"));
BaseLogger.log("0", null, userId, "case 1::: item_ser");
System.out.println("case 1---------itemSerForIC05M------[" + itemSerForIC + "]");
if(itemSerForIC != null && itemSerForIC.trim().length() > 0)
{
String[] itemSerArr = itemSerForIC.split(",");
String itemSerSql = "select descr from itemser where item_ser = ?";
try (PreparedStatement itemSerPs = con.prepareStatement(itemSerSql))
{
for(String itemSer : itemSerArr)
{
itemSerPs.setString(1, itemSer.trim());
try (ResultSet itemSerRs = itemSerPs.executeQuery())
{
if(itemSerRs.next())
{
if(itemSerDescr.length() > 0)
{
itemSerDescr += ", ";
}
itemSerDescr += checkNull(itemSerRs.getString("descr"));
}
}
}
}
}
setNodeValue(dom, "descr", itemSerDescr);
BaseLogger.log("0", null, userId, "case 1::: item_ser descr::"+itemSerDescr);
valueXmlString.append("<descr>").append("<![CDATA["+itemSerDescr+"]]>").append("</descr>\r\n");
}
if ("sales_pers".equalsIgnoreCase(currentColumn.trim())) {
String salesPersCode = checkNull(genericUtility.getColumnValue("sales_pers", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC in itemchange case 1 sales_pers:: " + salesPersCode);
String sp_name = "";
if (salesPersCode != null && salesPersCode.trim().length() > 0) {
String sp_nameSql = "select SP_NAME from SALES_PERS where SALES_PERS = ?";
PreparedStatement sp_namePs = con.prepareStatement(sp_nameSql);
sp_namePs.setString(1, salesPersCode);
ResultSet sp_nameRs = sp_namePs.executeQuery();
if (sp_nameRs.next()) {
sp_name = checkNull(sp_nameRs.getString("SP_NAME"));
}
sp_nameRs.close();
sp_namePs.close();
}
BaseLogger.log("3", null, null, "ReqForQuotationIC in itemchange case 1 sp_name:: " + sp_name);
valueXmlString.append("<sp_name>").append("<![CDATA[" + sp_name + "]]>").append("</sp_name>\r\n");
}
if ("site_code".equalsIgnoreCase(currentColumn.trim()))
{
String sitecode = checkNull(genericUtility.getColumnValue("site_code", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC in itemchange case 1 site_code:: " + sitecode);
String site_descr = "";
if (sitecode != null && sitecode.trim().length() > 0)
{
String siteSql = "select descr from site where site_code = ?";
PreparedStatement site_descrPs = con.prepareStatement(siteSql);
site_descrPs.setString(1, sitecode);
ResultSet site_descrRs = site_descrPs.executeQuery();
if (site_descrRs.next())
{
site_descr = checkNull(site_descrRs.getString("DESCR"));
}
site_descrRs.close();
site_descrPs.close();
}
BaseLogger.log("3", null, null, "ReqForQuotationIC site_descr:: " + site_descr);
valueXmlString.append("<site_descr>") .append("<![CDATA[" + site_descr + "]]>").append("</site_descr>\r\n");
}
valueXmlString.append("</Detail1>");
break;
}
case 2:
{
valueXmlString.append("<Detail2>");
if ("itm_default".equalsIgnoreCase(currentColumn.trim()))
{
String custCode = checkNull(genericUtility.getColumnValue("cust_code", dom1));
BaseLogger.log("3", null, null, "ReqForQuotationIC in itm default ");
//Management rate block[Start]
String finEntityQuery = "select fin_entity from site where site_code = ?";
psFinEntity = con.prepareStatement(finEntityQuery);
psFinEntity.setString(1, siteCode);
rs = psFinEntity.executeQuery();
if(rs.next()) {
finEntity = checkNull(rs.getString("fin_entity"));
}
BaseLogger.log("3", null, null, "ReqForQuotationIC in itm default finEntity:: "+finEntity);
rs.close();
psFinEntity.close();
// Now, use finEntity to fetch VAR_VALUE from finparm
String varValueQuery = "select VAR_VALUE from finparm where ADDL_VALUE = ?";
PreparedStatement psVarValue = con.prepareStatement(varValueQuery);
psVarValue.setString(1, finEntity);
ResultSet rsVarValue = psVarValue.executeQuery();
String varValue = null;
if (rsVarValue.next()) {
varValue = checkNull(rsVarValue.getString("VAR_VALUE"));
}
BaseLogger.log("3", null, null, "ReqForQuotationIC in itm default varValue:: " + varValue);
// Clean up the result set and prepared statement for the varValue query
rsVarValue.close();
psVarValue.close();
// Finally, use varValue to fetch the rate from pricelist
String rateQuery = "select rate from pricelist where price_list = ?";
PreparedStatement psRate = con.prepareStatement(rateQuery);
psRate.setString(1, varValue);
ResultSet rsRate = psRate.executeQuery();
int MngmntAprvRate = 0;
if (rsRate.next()) {
MngmntAprvRate = rsRate.getInt("rate");
}
BaseLogger.log("3", null, null, "ReqForQuotationIC in itm default rate:: " + rate);
// Clean up the result set and prepared statement for the rate query
rsRate.close();
psRate.close();
String priceSql =
"SELECT TRIM(fp.var_name) AS var_name, pl.rate " +
"FROM finparm fp " +
"JOIN site s ON TRIM(s.fin_entity) = TRIM(fp.ADDL_VALUE) " +
"JOIN pricelist pl ON TRIM(pl.price_list) = TRIM(fp.VAR_VALUE) " +
"WHERE TRIM(s.site_code) = ? " +
"AND TRIM(fp.VAR_NAME) IN ('RFQ_PTS','RFQ_PTD')";
PreparedStatement psPrice = con.prepareStatement(priceSql);
psPrice.setString(1, siteCode);
ResultSet rsPrice = psPrice.executeQuery();
BigDecimal pts = null;
BigDecimal ptd = null;
BigDecimal PriceRate = null;
while (rsPrice.next()) {
String varName = checkNull(rsPrice.getString("VAR_NAME"));
PriceRate = rsPrice.getBigDecimal("rate");
if ("RFQ_PTS".equals(varName)) {
pts = PriceRate;
} else if ("RFQ_PTD".equals(varName)) {
ptd = PriceRate;
}
}
//PTR calculation start
String siteCustomerQuery =
"SELECT PRICE_LIST FROM SITE_CUSTOMER " +
"WHERE SITE_CODE = ? AND CUST_CODE = ?";
psSiteCustomer = con.prepareStatement(siteCustomerQuery);
psSiteCustomer.setString(1, siteCode);
psSiteCustomer.setString(2, custCode);
rs = psSiteCustomer.executeQuery();
if (rs.next()) {
priceList = rs.getString("PRICE_LIST");
}
rs.close();
psSiteCustomer.close();
// Step 2: If not found in SITE_CUSTOMER, fetch from CUSTOMER
if (priceList == null || priceList.trim().isEmpty()) {
String customerQuery =
"SELECT PRICE_LIST FROM CUSTOMER WHERE CUST_CODE = ?";
psCustomer = con.prepareStatement(customerQuery);
psCustomer.setString(1, custCode);
rs = psCustomer.executeQuery();
if (rs.next()) {
priceList = rs.getString("PRICE_LIST");
}
rs.close();
psCustomer.close();
}
// Step 3: Fetch RATE from PRICELIST table
if (priceList != null && !priceList.trim().isEmpty()) {
String priceListQuery =
"SELECT RATE FROM PRICELIST WHERE PRICE_LIST = ?";
psPriceList = con.prepareStatement(priceListQuery);
psPriceList.setString(1, priceList);
rs = psPriceList.executeQuery();
if (rs.next()) {
rate = rs.getInt("RATE");
}
rs.close();
psPriceList.close();
}
String itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
String phySql = "SELECT PHY_ATTRIB_13, PHY_ATTRIB_14, PHY_ATTRIB_15 FROM ITEM WHERE ITEM_CODE = ?";
PreparedStatement phyPs = con.prepareStatement(phySql);
phyPs.setString(1, itemCode);
ResultSet phyRs = phyPs.executeQuery();
if (phyRs.next())
{
phy13 = checkNull(phyRs.getString("PHY_ATTRIB_13"));
phy14 = checkNull(phyRs.getString("PHY_ATTRIB_14"));
phy15 = checkNull(phyRs.getString("PHY_ATTRIB_15"));
}
phyRs.close();
phyPs.close();
valueXmlString.append("<phy_attrib_13><![CDATA[" + phy13 + "]]></phy_attrib_13>\r\n");
valueXmlString.append("<phy_attrib_14><![CDATA[" + phy14 + "]]></phy_attrib_14>\r\n");
valueXmlString.append("<phy_attrib_15><![CDATA[" + phy15 + "]]></phy_attrib_15>\r\n");
if (phy13.equalsIgnoreCase(""))
{
valueXmlString.append("<phy_attrib_13><![CDATA[0]]></phy_attrib_13>\r\n");
}
else
{
valueXmlString.append("<phy_attrib_13><![CDATA[" + phy13 + "]]></phy_attrib_13>\r\n");
}
if (phy14.equalsIgnoreCase(""))
{
valueXmlString.append("<phy_attrib_14><![CDATA[0]]></phy_attrib_14>\r\n");
}
else
{
valueXmlString.append("<phy_attrib_14><![CDATA[" + phy14 + "]]></phy_attrib_14>\r\n");
}
if (phy15.equalsIgnoreCase(""))
{
valueXmlString.append("<phy_attrib_15><![CDATA[0]]></phy_attrib_15>\r\n");
}
else
{
valueXmlString.append("<phy_attrib_15><![CDATA[" + phy15 + "]]></phy_attrib_15>\r\n");
}
//PTR calculation end
valueXmlString.append("<rate_apprv>").append("<![CDATA["+MngmntAprvRate+"]]>").append("</rate_apprv>\r\n");
valueXmlString.append("<ptd>").append("<![CDATA["+ptd+"]]>").append("</ptd>\r\n");
valueXmlString.append("<pts>").append("<![CDATA["+pts+"]]>").append("</pts>\r\n");
valueXmlString.append("<ptr>").append("<![CDATA["+rate+"]]>").append("</ptr>\r\n");
valueXmlString.append("<qty_quot>").append("<![CDATA[0]]>").append("</qty_quot>\r\n");
//Management rate block[End]
}
if ("itm_defaultedit".equalsIgnoreCase(currentColumn.trim()))
{
BaseLogger.log("3", null, null, "==== EDIT MODE TRIGGERED ====");
String custCode = checkNull(genericUtility.getColumnValue("cust_code", dom1));
String ptrFlagForEdit = checkNull(genericUtility.getColumnValue("ptr_flag", dom));
String rateQuot = checkNull(genericUtility.getColumnValue("rate_quot", dom));
String itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
String unit = checkNull(genericUtility.getColumnValue("unit", dom));
String packCode = checkNull(genericUtility.getColumnValue("pack_code", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC in itm default edit itemCode::"+itemCode);
BaseLogger.log("3", null, null, "ReqForQuotationIC in itm default edit ptrFlagForEdit::"+ptrFlagForEdit);
BaseLogger.log("3", null, null, "ReqForQuotationIC in itm default edit rateQuot::"+rateQuot);
String phySql = "SELECT PHY_ATTRIB_13, PHY_ATTRIB_14, PHY_ATTRIB_15 FROM ITEM WHERE ITEM_CODE = ?";
PreparedStatement phyPs = con.prepareStatement(phySql);
phyPs.setString(1, itemCode);
ResultSet phyRs = phyPs.executeQuery();
if (phyRs.next())
{
phy13 = checkNull(phyRs.getString("PHY_ATTRIB_13"));
phy14 = checkNull(phyRs.getString("PHY_ATTRIB_14"));
phy15 = checkNull(phyRs.getString("PHY_ATTRIB_15"));
}
phyRs.close();
phyPs.close();
valueXmlString.append("<phy_attrib_13><![CDATA[" + phy13 + "]]></phy_attrib_13>\r\n");
valueXmlString.append("<phy_attrib_14><![CDATA[" + phy14 + "]]></phy_attrib_14>\r\n");
valueXmlString.append("<phy_attrib_15><![CDATA[" + phy15 + "]]></phy_attrib_15>\r\n");
if(ptrFlagForEdit.equalsIgnoreCase("Y"))
{
valueXmlString.append("<rate_quot protect='1'>").append("<![CDATA["+rateQuot+"]]>").append("</rate_quot>\r\n");
}
// Set sp_name to logged in user's name
valueXmlString.append("<sp_name>").append("<![CDATA[" + userName + "]]>").append("</sp_name>\r\n");
BaseLogger.log("3", null, null, "ReqForQuotationIC in itm default ");
//Management rate block[Start]
String finEntityQuery = "select fin_entity from site where site_code = ?";
psFinEntity = con.prepareStatement(finEntityQuery);
psFinEntity.setString(1, siteCode);
rs = psFinEntity.executeQuery();
if(rs.next()) {
finEntity = checkNull(rs.getString("fin_entity"));
}
BaseLogger.log("3", null, null, "ReqForQuotationIC in itm default finEntity:: "+finEntity);
rs.close();
psFinEntity.close();
// Now, use finEntity to fetch VAR_VALUE from finparm
String varValueQuery = "select VAR_VALUE from finparm where ADDL_VALUE = ?";
PreparedStatement psVarValue = con.prepareStatement(varValueQuery);
psVarValue.setString(1, finEntity);
ResultSet rsVarValue = psVarValue.executeQuery();
String varValue = null;
if (rsVarValue.next()) {
varValue = checkNull(rsVarValue.getString("VAR_VALUE"));
}
BaseLogger.log("3", null, null, "ReqForQuotationIC in itm default varValue:: " + varValue);
// Clean up the result set and prepared statement for the varValue query
rsVarValue.close();
psVarValue.close();
// Finally, use varValue to fetch the rate from pricelist
String rateQuery = "select rate from pricelist where price_list = ?";
PreparedStatement psRate = con.prepareStatement(rateQuery);
psRate.setString(1, varValue);
ResultSet rsRate = psRate.executeQuery();
int MngmntAprvRate = 0;
if (rsRate.next()) {
MngmntAprvRate = rsRate.getInt("rate");
}
BaseLogger.log("3", null, null, "ReqForQuotationIC in itm default rate:: " + rate);
// Clean up the result set and prepared statement for the rate query
rsRate.close();
psRate.close();
String priceSql =
"SELECT TRIM(fp.var_name) AS var_name, pl.rate " +
"FROM finparm fp " +
"JOIN site s ON TRIM(s.fin_entity) = TRIM(fp.ADDL_VALUE) " +
"JOIN pricelist pl ON TRIM(pl.price_list) = TRIM(fp.VAR_VALUE) " +
"WHERE TRIM(s.site_code) = ? " +
"AND TRIM(fp.VAR_NAME) IN ('RFQ_PTS','RFQ_PTD')";
PreparedStatement psPrice = con.prepareStatement(priceSql);
psPrice.setString(1, siteCode);
ResultSet rsPrice = psPrice.executeQuery();
BigDecimal pts = null;
BigDecimal ptd = null;
BigDecimal PriceRate = null;
while (rsPrice.next()) {
String varName = checkNull(rsPrice.getString("VAR_NAME"));
PriceRate = rsPrice.getBigDecimal("rate");
if ("RFQ_PTS".equals(varName)) {
pts = PriceRate;
} else if ("RFQ_PTD".equals(varName)) {
ptd = PriceRate;
}
}
//PTR calculation start
String siteCustomerQuery =
"SELECT PRICE_LIST FROM SITE_CUSTOMER " +
"WHERE SITE_CODE = ? AND CUST_CODE = ?";
psSiteCustomer = con.prepareStatement(siteCustomerQuery);
psSiteCustomer.setString(1, siteCode);
psSiteCustomer.setString(2, custCode);
rs = psSiteCustomer.executeQuery();
if (rs.next()) {
priceList = rs.getString("PRICE_LIST");
}
rs.close();
psSiteCustomer.close();
// Step 2: If not found in SITE_CUSTOMER, fetch from CUSTOMER
if (priceList == null || priceList.trim().isEmpty()) {
String customerQuery =
"SELECT PRICE_LIST FROM CUSTOMER WHERE CUST_CODE = ?";
psCustomer = con.prepareStatement(customerQuery);
psCustomer.setString(1, custCode);
rs = psCustomer.executeQuery();
if (rs.next()) {
priceList = rs.getString("PRICE_LIST");
}
rs.close();
psCustomer.close();
}
// Step 3: Fetch RATE from PRICELIST table
if (priceList != null && !priceList.trim().isEmpty()) {
String priceListQuery =
"SELECT RATE FROM PRICELIST WHERE PRICE_LIST = ?";
psPriceList = con.prepareStatement(priceListQuery);
psPriceList.setString(1, priceList);
rs = psPriceList.executeQuery();
if (rs.next()) { }
rs.close();
psPriceList.close();
}
//PTR calculation end
valueXmlString.append("<unit protect = '1'>").append("<![CDATA["+unit+"]]>").append("</unit>\r\n");
valueXmlString.append("<pack_code protect = '1'>").append("<![CDATA["+packCode+"]]>").append("</pack_code>\r\n");
valueXmlString.append("<rate_apprv>").append("<![CDATA["+MngmntAprvRate+"]]>").append("</rate_apprv>\r\n");
valueXmlString.append("<ptd>").append("<![CDATA["+ptd+"]]>").append("</ptd>\r\n");
valueXmlString.append("<pts>").append("<![CDATA["+pts+"]]>").append("</pts>\r\n");
valueXmlString.append("<ptr>").append("<![CDATA["+rate+"]]>").append("</ptr>\r\n");
valueXmlString.append("<ptr_flag>").append("<![CDATA["+ptrFlagForEdit+"]]>").append("</ptr_flag>\r\n");
//Added By Saburi - 16Apr2026 for calculation of PTR,PTS,PTD
if (rateQuot != null && !rateQuot.trim().isEmpty() && phy13 != null && !phy13.trim().isEmpty() && phy14 != null && !phy14.trim().isEmpty() && phy15 != null && !phy15.trim().isEmpty())
{
try
{
BigDecimal specialRate = new BigDecimal(rateQuot);
BigDecimal hundred = new BigDecimal("100");
BigDecimal distMargin = new BigDecimal(phy13);
BigDecimal stockMargin = new BigDecimal(phy14);
BigDecimal retMargin = new BigDecimal(phy15);
BigDecimal revisedPTR = specialRate.multiply(hundred.subtract(retMargin)).divide(hundred, 2, RoundingMode.HALF_UP);
BigDecimal revisedPTS = specialRate.multiply(hundred.subtract(stockMargin)).divide(hundred, 2, RoundingMode.HALF_UP);
BigDecimal revisedPTD = specialRate.multiply(hundred.subtract(distMargin)).divide(hundred, 2, RoundingMode.HALF_UP);
BaseLogger.log("3", null, null, "Revised PTR:>>>>> " + revisedPTR);
BaseLogger.log("3", null, null, "Revised PTS:>>>>> " + revisedPTS);
BaseLogger.log("3", null, null, "Revised PTD:>>>>> " + revisedPTD);
valueXmlString.append("<revised_ptr><![CDATA[").append(revisedPTR).append("]]></revised_ptr>\r\n");
valueXmlString.append("<revised_pts><![CDATA[").append(revisedPTS).append("]]></revised_pts>\r\n");
valueXmlString.append("<revised_ptd><![CDATA[").append(revisedPTD).append("]]></revised_ptd>\r\n");
BaseLogger.log("3", null, null, "✅ Edit Mode Calculation Done PTR=" + revisedPTR);
}
catch (Exception e)
{
BaseLogger.log("3", null, null, "❌ Calculation Error: " + e.getMessage());
}
}
//Management rate block[End]
}
if ("qty_quot".equalsIgnoreCase(currentColumn.trim()))
{
BaseLogger.log("3", getUserInfo(), null, "In qty_quot condition for case 2 item change");
String rateQuotStr = checkNull(genericUtility.getColumnValue("rate_quot", dom));
String qtyStr = checkNull(genericUtility.getColumnValue("qty_quot", dom));
int qty = 0;
BigDecimal rateQuotDecimal = BigDecimal.ZERO;
BigDecimal value = BigDecimal.ZERO;
try {
qty = (qtyStr != null && qtyStr.trim().length() > 0) ? Integer.parseInt(qtyStr.trim()) : 0;
rateQuotDecimal = (rateQuotStr != null && rateQuotStr.trim().length() > 0)
? new BigDecimal(rateQuotStr.trim())
: BigDecimal.ZERO;
value = rateQuotDecimal.multiply(new BigDecimal(qty));
BaseLogger.log("3", null, null,
"qty:: " + qty + " rateQuot:: " + rateQuotDecimal + " value:: " + value);
} catch (Exception e)
{
BaseLogger.log("3", null, null, "Error parsing values: " + e.getMessage());
}
valueXmlString.append("<value protect='1'><![CDATA[" + value + "]]></value>\r\n");
setNodeValue(dom, "value", value.toString()); // Added In 1389
}
if ("item_code".equalsIgnoreCase(currentColumn.trim()))
{
BaseLogger.log("3", null, null,
"item code:: Entered" );
String itemDescr = "";
String unit = "";
String packCode = "";
double ptsRate = 0;
double ptrRate = 0;
double ptdRate = 0;
double mgmtRate = 0;
BaseLogger.log("3", null, null, "ReqForQuotationIC in item_code ");
String itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC in item_code@@@ "+itemCode);
String itemDescrSql = "select descr,unit,pack_code from item where item_code = ?";
PreparedStatement itemDescrPs = con.prepareStatement(itemDescrSql);
itemDescrPs.setString(1, itemCode);
ResultSet itemDescrRs = itemDescrPs.executeQuery();
while(itemDescrRs.next()) {
itemDescr = checkNull(itemDescrRs.getString("descr"));
unit = checkNull(itemDescrRs.getString("unit"));
packCode = checkNull(itemDescrRs.getString("pack_code"));
}
//Added By Saburi-14APR
valueXmlString.append("<descr>").append("<![CDATA["+itemDescr+"]]>").append("</descr>\r\n");
valueXmlString.append("<unit protect='1'>").append("<![CDATA["+unit+"]]>").append("</unit>\r\n");
valueXmlString.append("<pack_code protect='1'>").append("<![CDATA["+packCode+"]]>").append("</pack_code>\r\n");
//Added by Saburi - 16Jun2026[Fetch and populate RFQ-based price list rates for an item.]
String finParamSql = "SELECT VAR_NAME, VAR_VALUE FROM FINPARM WHERE VAR_NAME IN ('RFQ_PTS','RFQ_PTR','RFQ_PTD','RFQ_MNGMNT')";
psPriceList = con.prepareStatement(finParamSql);
ResultSet rsFinParam = psPriceList.executeQuery();
while (rsFinParam.next())
{
String varName = checkNull(rsFinParam.getString("VAR_NAME"));
BaseLogger.log("3", null, null,"varName @@@@@"+varName);
String varValueObj = checkNull(rsFinParam.getString("VAR_VALUE"));
BaseLogger.log("3", null, null,"varValueObj @@@@@"+varValueObj);
if (varName.trim().equalsIgnoreCase("RFQ_PTS"))
{
ptsPriceList = varValueObj;
}
else if (varName.trim().equalsIgnoreCase("RFQ_PTR"))
{
ptrPriceList = varValueObj;
}
else if (varName.trim().equalsIgnoreCase("RFQ_PTD"))
{
ptdPriceList = varValueObj;
}
else if (varName.trim().equalsIgnoreCase("RFQ_MNGMNT"))
{
mgmtPriceList = varValueObj;
}
}
rsFinParam.close();
psPriceList.close();
BaseLogger.log("3", null, null,"PTS_PRICE_LIST [" + ptsPriceList + "] PTR_PRICE_LIST [" + ptrPriceList + "] PTD_PRICE_LIST [" + ptdPriceList + "] MGMT_PRICE_LIST [" + mgmtPriceList + "]");
String priceListQuery = "SELECT RATE FROM PRICELIST WHERE PRICE_LIST = ? AND ITEM_CODE = ? " +
"AND TRUNC(SYSDATE) BETWEEN TRUNC(NVL(EFF_FROM, SYSDATE)) AND TRUNC(NVL(VALID_UPTO, SYSDATE)) " +
"ORDER BY EFF_FROM DESC, SLAB_NO DESC " +
"FETCH FIRST 1 ROW ONLY";
/* PTS Rate */
if (ptsPriceList != null && !ptsPriceList.trim().isEmpty())
{
PreparedStatement ps = con.prepareStatement(priceListQuery);
ps.setString(1, ptsPriceList.trim());
ps.setString(2, itemCode.trim());
ResultSet rs1 = ps.executeQuery();
if (rs1.next()) {
ptsRate = rs1.getDouble("RATE");
}
rs1.close();
ps.close();
}
/* PTR Rate */
if (ptrPriceList != null && !ptrPriceList.trim().isEmpty())
{
PreparedStatement ps = con.prepareStatement(priceListQuery);
ps.setString(1, ptrPriceList.trim());
ps.setString(2, itemCode.trim());
ResultSet rs1 = ps.executeQuery();
if (rs1.next()) {
ptrRate = rs1.getDouble("RATE");
}
rs1.close();
ps.close();
}
/* PTD Rate */
if (ptdPriceList != null && !ptdPriceList.trim().isEmpty())
{
PreparedStatement ps = con.prepareStatement(priceListQuery);
ps.setString(1, ptdPriceList.trim());
ps.setString(2, itemCode.trim());
ResultSet rs1 = ps.executeQuery();
if (rs1.next()) {
ptdRate = rs1.getDouble("RATE");
}
rs1.close();
ps.close();
}
/* MGMT Rate */
if (mgmtPriceList != null && !mgmtPriceList.trim().isEmpty())
{
PreparedStatement ps = con.prepareStatement(priceListQuery);
ps.setString(1, mgmtPriceList.trim());
ps.setString(2, itemCode.trim());
ResultSet rsObj = ps.executeQuery();
if (rsObj.next()) {
mgmtRate = rsObj.getDouble("RATE");
}
rsObj.close();
ps.close();
}
BaseLogger.log("3", null, null,"PTS Rate [" + ptsRate + "] "+ "PTR Rate [" + ptrRate + "] "+ "PTD Rate [" + ptdRate + "] "+ "MGMT Rate [" + mgmtRate + "]");
valueXmlString.append("<pts><![CDATA[" + ptsRate + "]]></pts>\r\n");
valueXmlString.append("<ptd><![CDATA[" + ptdRate + "]]></ptd>\r\n");
valueXmlString.append("<ptr><![CDATA[" + ptrRate + "]]></ptr>\r\n");
String phySql = "SELECT PHY_ATTRIB_13, PHY_ATTRIB_14, PHY_ATTRIB_15 FROM ITEM WHERE ITEM_CODE = ?";
PreparedStatement phyPs = con.prepareStatement(phySql);
phyPs.setString(1, itemCode);
ResultSet phyRs = phyPs.executeQuery();
if (phyRs.next())
{
phy13 = checkNull(phyRs.getString("PHY_ATTRIB_13"));
phy14 = checkNull(phyRs.getString("PHY_ATTRIB_14"));
phy15 = checkNull(phyRs.getString("PHY_ATTRIB_15"));
}
phyRs.close();
phyPs.close();
valueXmlString.append("<phy_attrib_13><![CDATA[" + phy13 + "]]></phy_attrib_13>\r\n");
valueXmlString.append("<phy_attrib_14><![CDATA[" + phy14 + "]]></phy_attrib_14>\r\n");
valueXmlString.append("<phy_attrib_15><![CDATA[" + phy15 + "]]></phy_attrib_15>\r\n");
}
//Made changes if PTR_FLAG is "Y" then for Value field calculation used PTR field value instead of RATE_QUOT[10-APR]
if ("ptr_flag".equalsIgnoreCase(currentColumn.trim()))
{
BaseLogger.log("3", null, null, "ReqForQuotationIC in ptr_flag ");
String custCode = checkNull(genericUtility.getColumnValue("cust_code", dom1));
String rateStr = checkNull(genericUtility.getColumnValue("ptr", dom));
String qtyStr = checkNull(genericUtility.getColumnValue("qty_quot", dom));
String rateQuotStr = checkNull(genericUtility.getColumnValue("rate_quot", dom));
String itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
int qty = 0;
BigDecimal rateQuotDecimal = BigDecimal.ZERO;
BigDecimal value = BigDecimal.ZERO;
BaseLogger.log("3", null, null, "ReqForQuotationWiz in qty_quot condition qtyStr:: " + qtyStr);
BaseLogger.log("3", null, null, "ReqForQuotationWiz in qty_quot condition rateQuotStr:: " + rateQuotStr);
try
{
qty = (qtyStr != null && qtyStr.trim().length() > 0) ? Integer.parseInt(qtyStr.trim()) : 0;
rateQuotDecimal = (rateStr != null && rateStr.trim().length() > 0) ? new BigDecimal(rateStr.trim()) : BigDecimal.ZERO;
value = rateQuotDecimal.multiply(new BigDecimal(qty));
}
catch (Exception e)
{
BaseLogger.log("3", null, null, "Error parsing values: " + e.getMessage());
}
BaseLogger.log("3", null, null, "ReqForQuotationIC in ptr_flat condition:: "+ptrFlag);
BaseLogger.log("3", null, null, "ReqForQuotationIC in ptr_flat condition siteCode:: "+siteCode);
BaseLogger.log("3", null, null, "ReqForQuotationIC in ptr_flat condition custCode:: "+custCode);
BaseLogger.log("3", null, null, "ReqForQuotationIC in ptr_flat condition ptr:: "+rateStr);
if(ptrFlag.equalsIgnoreCase("Y"))
{
BaseLogger.log("3", getUserInfo(), null, "Final RATE : " + rate);
valueXmlString.append("<value protect='1'>").append("<![CDATA["+value+"]]>").append("</value>\r\n");
valueXmlString.append("<rate_quot protect='1'>").append("<![CDATA["+rateStr+"]]>").append("</rate_quot>\r\n");
//Added By Saburi - 15Apr2026 for calculation pts,ptr,ptd
updatedDistMargin = parseDoubleSafe(genericUtility.getColumnValue("phy_attrib_13", dom));
updatedStkMargin = parseDoubleSafe(genericUtility.getColumnValue("phy_attrib_14", dom));
updatedRetMargin = parseDoubleSafe(genericUtility.getColumnValue("phy_attrib_15", dom));
BaseLogger.log("3", null, null, "updatedDistMargin [" + updatedDistMargin + "]");
BaseLogger.log("3", null, null, "updatedStkMargin [" + updatedStkMargin + "]");
BaseLogger.log("3", null, null, "updatedRetMargin [" + updatedRetMargin + "]");
if (rateStr == null || rateStr.trim().isEmpty())
{
throw new Exception("Special Rate values are not defined for item: " + itemCode);
}
if ( updatedDistMargin == 0 || updatedStkMargin == 0 || updatedRetMargin == 0 )
{
valueXmlString.append("<phy_attrib_13><![CDATA[0]]></phy_attrib_13>\r\n");
valueXmlString.append("<phy_attrib_14><![CDATA[0]]></phy_attrib_14>\r\n");
valueXmlString.append("<phy_attrib_15><![CDATA[0]]></phy_attrib_15>\r\n");
}
BigDecimal specialRate = new BigDecimal(rateStr);
BigDecimal hundred = new BigDecimal("100");
BigDecimal distMargin = new BigDecimal(updatedDistMargin);
BigDecimal stockMargin = new BigDecimal(updatedStkMargin);
BigDecimal retMargin = new BigDecimal(updatedRetMargin);
// ✅ Correct calculation
BigDecimal revisedPTR = specialRate.multiply(hundred.subtract(retMargin))
.divide(hundred, 2, RoundingMode.HALF_UP);
BigDecimal revisedPTS = specialRate.multiply(hundred.subtract(stockMargin))
.divide(hundred, 2, RoundingMode.HALF_UP);
BigDecimal revisedPTD = specialRate.multiply(hundred.subtract(distMargin))
.divide(hundred, 2, RoundingMode.HALF_UP);
// ✅ Correct logs
BaseLogger.log("3", null, null, "FINAL revisedPTR [" + revisedPTR + "]");
BaseLogger.log("3", null, null, "FINAL revisedPTS [" + revisedPTS + "]");
BaseLogger.log("3", null, null, "FINAL revisedPTD [" + revisedPTD + "]");
// ✅ Correct XML mapping
valueXmlString.append("<revised_ptr><![CDATA[").append(revisedPTR).append("]]></revised_ptr>\r\n");
valueXmlString.append("<revised_pts><![CDATA[").append(revisedPTS).append("]]></revised_pts>\r\n");
valueXmlString.append("<revised_ptd><![CDATA[").append(revisedPTD).append("]]></revised_ptd>\r\n");
qty = (qtyStr != null && qtyStr.trim().length() > 0) ? Integer.parseInt(qtyStr.trim()) : 0;
rateQuotDecimal = (rateStr != null && rateStr.trim().length() > 0) ? new BigDecimal(rateStr.trim()) : BigDecimal.ZERO;
value = rateQuotDecimal.multiply(new BigDecimal(qty));
valueXmlString.append("<value>").append("<![CDATA[" + value + "]]>").append("</value>\r\n");
}
else if(ptrFlag.equalsIgnoreCase("N"))
{
valueXmlString.append("<value protect='1'>").append("<![CDATA[]]>").append("</value>\r\n");
valueXmlString.append("<rate_quot protect='0'>").append("<![CDATA[]]>").append("</rate_quot>\r\n");
valueXmlString.append("<revised_ptr>").append("<![CDATA[]]>").append("</revised_ptr>\r\n");
valueXmlString.append("<revised_pts>").append("<![CDATA[]]>").append("</revised_pts>\r\n");
valueXmlString.append("<revised_ptd>").append("<![CDATA[]]>").append("</revised_ptd>\r\n");
valueXmlString.append("<value>").append("<![CDATA[]]>").append("</value>\r\n");
}
}
if ("rate_quot".equalsIgnoreCase(currentColumn.trim()))
{
BaseLogger.log("3", null, null, "ReqForQuotationIC in rate_quot 1287::");
String rateQuot = checkNull(genericUtility.getColumnValue("rate_quot", dom));
String itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
String rateApprv = checkNull(genericUtility.getColumnValue("rate_apprv", dom));
String ratePtr = checkNull(genericUtility.getColumnValue("ptr", dom));
String qtyStr = checkNull(genericUtility.getColumnValue("qty_quot", dom));
int qty = 0;
BigDecimal rateQuotDecimal = BigDecimal.ZERO;
BigDecimal value = BigDecimal.ZERO;
BaseLogger.log("3", null, null, "ReqForQuotationWiz in qty_quot condition qtyStr:: " + qtyStr);
try
{
String quotedRate = checkNull(genericUtility.getColumnValue("rate_quot", dom));
updatedDistMargin = parseDoubleSafe(genericUtility.getColumnValue("phy_attrib_13", dom));
updatedStkMargin = parseDoubleSafe(genericUtility.getColumnValue("phy_attrib_14", dom));
updatedRetMargin = parseDoubleSafe(genericUtility.getColumnValue("phy_attrib_15", dom));
BaseLogger.log("3", null, null, "updatedDistMargin [" + updatedDistMargin + "]");
BaseLogger.log("3", null, null, "updatedStkMargin [" + updatedStkMargin + "]");
BaseLogger.log("3", null, null, "updatedRetMargin [" + updatedRetMargin + "]");
if (quotedRate == null || quotedRate.trim().isEmpty())
{
throw new Exception("Special Rate values are not defined for item: " + itemCode);
}
if (updatedDistMargin == 0 ||updatedStkMargin == 0 || updatedRetMargin == 0 )
{
valueXmlString.append("<phy_attrib_13><![CDATA[0]]></phy_attrib_13>\r\n");
valueXmlString.append("<phy_attrib_14><![CDATA[0]]></phy_attrib_14>\r\n");
valueXmlString.append("<phy_attrib_15><![CDATA[0]]></phy_attrib_15>\r\n");
}
BigDecimal specialRate = new BigDecimal(quotedRate);
BigDecimal hundred = new BigDecimal("100");
BigDecimal distMargin = new BigDecimal(updatedDistMargin);
BigDecimal stockMargin = new BigDecimal(updatedStkMargin);
BigDecimal retMargin = new BigDecimal(updatedRetMargin);
// ✅ Correct Calculations as per requirement
BigDecimal revisedPTR = specialRate.multiply(hundred.subtract(retMargin))
.divide(hundred, 2, RoundingMode.HALF_UP);
BigDecimal revisedPTS = specialRate.multiply(hundred.subtract(stockMargin))
.divide(hundred, 2, RoundingMode.HALF_UP);
BigDecimal revisedPTD = specialRate.multiply(hundred.subtract(distMargin))
.divide(hundred, 2, RoundingMode.HALF_UP);
BaseLogger.log("3", null, null, "FINAL revisedPTR@@@@ [" + revisedPTR + "]");
BaseLogger.log("3", null, null, "FINAL revisedPTS @@@@@[" + revisedPTS + "]");
BaseLogger.log("3", null, null, "FINAL revisedPTD@@@@ [" + revisedPTD + "]");
qty = (qtyStr != null && qtyStr.trim().length() > 0) ? Integer.parseInt(qtyStr.trim()) : 0;
rateQuotDecimal = (quotedRate != null && quotedRate.trim().length() > 0) ? new BigDecimal(quotedRate.trim()) : BigDecimal.ZERO;
value = rateQuotDecimal.multiply(new BigDecimal(qty));
valueXmlString.append("<value><![CDATA[").append(value).append("]]></value>\r\n");
valueXmlString.append("<revised_ptr><![CDATA[").append(revisedPTR).append("]]></revised_ptr>\r\n");
valueXmlString.append("<revised_pts><![CDATA[").append(revisedPTS).append("]]></revised_pts>\r\n");
valueXmlString.append("<revised_ptd><![CDATA[").append(revisedPTD).append("]]></revised_ptd>\r\n");
BaseLogger.log("3", null, null, "qty:: " + qty + " rateQuot:: " + rateQuotDecimal + " value:: " + value);
}
catch (Exception e)
{
BaseLogger.log("3", null, null, "Error parsing values: " + e.getMessage());
}
BaseLogger.log("3", null, null, "ReqForQuotationIC in rate_quot:: "+rateQuot+" rateApprv::"+rateApprv+ " ratePtr::"+ratePtr+" itemCode::"+itemCode);
if (!rateQuot.isEmpty() && !rateApprv.isEmpty())
{
BigDecimal rateApprvVal = new BigDecimal(rateApprv);
BigDecimal rateQuotVal = new BigDecimal(rateQuot);
BigDecimal ratePtrVal = new BigDecimal(ratePtr);
// added condition when ptr and rate_quot is same direct approval without management
if (ratePtrVal.compareTo(rateQuotVal) == 0)
{
BaseLogger.log("3", null, null, "in ratePtrVal == rateQuotVal condition");
String detail1Xml = "<Detail1><mgmnt_apprv><![CDATA[N]]></mgmnt_apprv><wf_status><![CDATA[A]]></wf_status></Detail1>";
int pos = valueXmlString.indexOf("</header>");
if (pos != -1) {
pos += "</header>".length(); // move after </header>
valueXmlString.insert(pos, detail1Xml);
}
BaseLogger.log("3", null, null,
"in rateApprvVal greater condition updatedXml ::" + valueXmlString);
}
if (rateApprvVal.compareTo(rateQuotVal) > 0)
{
BaseLogger.log("3", null, null, "in rateApprvVal greater condition");
BaseLogger.log("3", null, null, "in rateApprvVal greater condition valueXmlString::"+ valueXmlString);
String detail1Xml = "<Detail1><mgmnt_apprv><![CDATA[Y]]></mgmnt_apprv><wf_status><![CDATA[P]]></wf_status></Detail1>";
int pos = valueXmlString.indexOf("</header>");
if (pos != -1) {
pos += "</header>".length(); // move after </header>
valueXmlString.insert(pos, detail1Xml);
}
BaseLogger.log("3", null, null, "in rateApprvVal greater condition updatedXml ::"+valueXmlString);
}
if (rateQuotVal.compareTo(rateApprvVal) > 0)
{
BaseLogger.log("3", null, null, "in rateQuotVal greater condition");
BaseLogger.log("3", null, null, "in rateQuotVal greater condition valueXmlString::"+ valueXmlString);
String detail1Xml = "<Detail1><mgmnt_apprv><![CDATA[]]></mgmnt_apprv><wf_status><![CDATA[]]></wf_status></Detail1>";
int pos = valueXmlString.indexOf("</header>");
if (pos != -1) {
pos += "</header>".length(); // move after </header>
valueXmlString.insert(pos, detail1Xml);
}
BaseLogger.log("3", null, null, "in rateApprvVal greater condition updatedXml ::"+valueXmlString);
}
}
}
valueXmlString.append("</Detail2>\r\n");
break;
}
}
BaseLogger.log("3", null, null, "in rateApprvVal greater condition reStr>>>>> "+reStr);
valueXmlString.append("</Root>\r\n");
} catch (Exception e) {
BaseLogger.log("3", getUserInfo(), null, "Exception :ReqForQuotationIC :itemChanged(Document,String):" + e.getMessage() + ":");
e.printStackTrace();
} finally {
closeResources(rs, psSiteCustomer, conn);
closeResources(rs, psCustomer, conn);
closeResources(rs, psPriceList, conn);
closeResources(rs, psPriceList, con);
}
BaseLogger.log("3", getUserInfo(), null, "ReqForQuotationIC valueXmlString::"+valueXmlString.toString());
return valueXmlString.toString();
}
private void closeResources(ResultSet rs, PreparedStatement pstmt, Connection conn) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (pstmt != null) {
try {
pstmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
private String checkNull(String input) {
if (input == null) {
input = "";
} else {
input = input.trim();
}
return input;
}
private static void setNodeValue( Document dom, String nodeName, String nodeVal ) throws Exception
{
Node tempNode = dom.getElementsByTagName( nodeName ).item(0);
if( tempNode != null )
{
if( tempNode.getFirstChild() == null )
{
CDATASection cDataSection = dom.createCDATASection( nodeVal );
tempNode.appendChild( cDataSection );
}
else
{
tempNode.getFirstChild().setNodeValue(nodeVal);
}
}
tempNode = null;
}
public static boolean isDateInvalid(String validUptoStr)
{
try
{
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yy");
LocalDate validDate = LocalDate.parse(validUptoStr, formatter);
LocalDate currentDate = LocalDate.now();
if(validDate.isBefore(currentDate))
{
return true;
}
}
catch(Exception e)
{
BaseLogger.log("3", null, null, "Exception in date validation [" + e + "]");
}
return false;
}
private double parseDoubleSafe(String value)
{
try
{
if(value != null && value.trim().length() > 0)
{
return Double.parseDouble(value);
}
}
catch(Exception e)
{
BaseLogger.log("3", null, null, "Error parsing value: " + value);
}
return 0.0;
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
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